public MissingDependencyException(String pluginShortName, List<Dependency> missingDependencies) { super("One or more dependencies could not be resolved for " + pluginShortName + " : " + Util.join(missingDependencies, ", ")); this.pluginShortName = pluginShortName; this.missingDependencies = missingDependencies; }
public CycleDetectedException(List cycle) { super("Cycle detected: "+Util.join(cycle," -> ")); this.cycle = cycle; } }
public String getDependsOn() { if (names==null) return null; if (dependsOn==null) dependsOn = join(names," "); return dependsOn; }
/** * Returns the string representation of the classpath. */ @Override public String toString() { return Util.join(args,File.pathSeparator); } }
private void cutCycleAt(String referee, List<String> cycle) { // cycle contains variables in referrer-to-referee order. // This should not be negative, for the first and last one is same. int refererIndex = cycle.lastIndexOf(referee) - 1; assert(refererIndex >= 0); String referrer = cycle.get(refererIndex); boolean removed = refereeSetMap.get(referrer).remove(referee); assert(removed); LOGGER.warning(String.format("Cyclic reference detected: %s", Util.join(cycle," -> "))); LOGGER.warning(String.format("Cut the reference %s -> %s", referrer, referee)); }
protected Process sudoWithPass(ArgumentListBuilder args) throws IOException { args.prepend(sudoExe(),"-S"); listener.getLogger().println("$ "+Util.join(args.toList()," ")); ProcessBuilder pb = new ProcessBuilder(args.toCommandArray()); Process p = pb.start(); // TODO: use -p to detect prompt // TODO: detect if the password didn't work PrintStream ps = new PrintStream(p.getOutputStream()); ps.println(rootPassword); ps.println(rootPassword); ps.println(rootPassword); return p; } }.start(listener,rootPassword);
private void interrupt(Result result, boolean forShutdown, CauseOfInterruption... causes) { if (LOGGER.isLoggable(FINE)) LOGGER.log(FINE, String.format("%s is interrupted(%s): %s", getDisplayName(), result, Util.join(Arrays.asList(causes),",")), new InterruptedException()); lock.writeLock().lock(); try { if (!started) { // not yet started, so simply dispose this owner.removeExecutor(this); return; } interruptStatus = result; for (CauseOfInterruption c : causes) { if (!this.causes.contains(c)) this.causes.add(c); } if (asynchronousExecution != null) { asynchronousExecution.interrupt(forShutdown); } else { super.interrupt(); } } finally { lock.writeLock().unlock(); } }
/** * Computes the list of other form fields that the given field depends on, via the doFillXyzItems method, * and sets that as the 'fillDependsOn' attribute. Also computes the URL of the doFillXyzItems and * sets that as the 'fillUrl' attribute. */ public void calcFillSettings(String field, Map<String,Object> attributes) { String capitalizedFieldName = StringUtils.capitalize(field); String methodName = "doFill" + capitalizedFieldName + "Items"; Method method = ReflectionUtils.getPublicMethodNamed(getClass(), methodName); if(method==null) throw new IllegalStateException(String.format("%s doesn't have the %s method for filling a drop-down list", getClass(), methodName)); // build query parameter line by figuring out what should be submitted List<String> depends = buildFillDependencies(method, new ArrayList<String>()); if (!depends.isEmpty()) attributes.put("fillDependsOn",Util.join(depends," ")); attributes.put("fillUrl", String.format("%s/%s/fill%sItems", getCurrentDescriptorByNameUrl(), getDescriptorUrl(), capitalizedFieldName)); }
ClassLoader dependencyLoader = new DependencyClassLoader(coreClassLoader, archive, Util.join(dependencies,optionalDependencies)); dependencyLoader = getBaseClassLoader(atts, dependencyLoader);
scmNames.add(s.getDescriptor().getDisplayName()); scmDisplayName = " " + Util.join(scmNames, ", ");
@Override public void buildEnvironmentFor(Job j, EnvVars env, TaskListener listener) throws IOException, InterruptedException { Jenkins jenkins = Jenkins.getInstance(); String rootUrl = jenkins.getRootUrl(); if(rootUrl!=null) { env.put("JENKINS_URL", rootUrl); env.put("HUDSON_URL", rootUrl); // Legacy compatibility env.put("JOB_URL", rootUrl+j.getUrl()); } String root = jenkins.getRootDir().getPath(); env.put("JENKINS_HOME", root); env.put("HUDSON_HOME", root); // legacy compatibility Thread t = Thread.currentThread(); if (t instanceof Executor) { Executor e = (Executor) t; env.put("EXECUTOR_NUMBER", String.valueOf(e.getNumber())); if (e.getOwner() instanceof MasterComputer) { env.put("NODE_NAME", "master"); } else { env.put("NODE_NAME", e.getOwner().getName()); } Node n = e.getOwner().getNode(); if (n != null) env.put("NODE_LABELS", Util.join(n.getAssignedLabels(), " ")); } } }
public String getDependsOn() { if (names==null) return null; if (dependsOn==null) dependsOn = join(names," "); return dependsOn; }
/** * Returns the string representation of the classpath. */ @Override public String toString() { return Util.join(args,File.pathSeparator); } }
public MissingDependencyException(String pluginShortName, List<Dependency> missingDependencies) { super("One or more dependencies could not be resolved for " + pluginShortName + " : " + Util.join(missingDependencies, ", ")); this.pluginShortName = pluginShortName; this.missingDependencies = missingDependencies; }
public CycleDetectedException(List cycle) { super("Cycle detected: "+Util.join(cycle," -> ")); this.cycle = cycle; } }
public CycleDetectedException(List cycle) { super("Cycle detected: " + Util.join(cycle, " -> ")); this.cycle = cycle; } }
/** * @since 2.1.0 */ public String toString(final String sep) { return Util.join(args,sep); } }
private void cutCycleAt(String referee, List<String> cycle) { // cycle contains variables in referrer-to-referee order. // This should not be negative, for the first and last one is same. int refererIndex = cycle.lastIndexOf(referee) - 1; assert(refererIndex >= 0); String referrer = cycle.get(refererIndex); boolean removed = refereeSetMap.get(referrer).remove(referee); assert(removed); LOGGER.warning(String.format("Cyclic reference detected: %s", Util.join(cycle," -> "))); LOGGER.warning(String.format("Cut the reference %s -> %s", referrer, referee)); }
/** * Gets the {@link Label}s where the builds will be run. * @return never null */ public Set<Label> getLabels() { Set<Label> r = new HashSet<Label>(); for (Combination c : getAxes().subList(LabelAxis.class).list()) r.add(Hudson.getInstance().getLabel(Util.join(c.values(),"&&"))); return r; }
@Override public Label getAssignedLabel() { // combine all the label axes by &&. String expr = Util.join(combination.values(getParent().getAxes().subList(LabelAxis.class)), "&&"); return Hudson.getInstance().getLabel(Util.fixEmpty(expr)); }