/** * @deprecated Specific to Remoting-based protocol. */ @Deprecated public Channel checkChannel() throws AbortException { if (channel==null) throw new AbortException("This command is requesting the deprecated -remoting mode. See https://jenkins.io/redirect/cli-command-requires-channel"); return channel; }
public synchronized void abort(Throwable cause) { interrupted = new AbortException(); if (cause!=null) interrupted.initCause(cause); notifyAll(); }
/** * Create a parameter value from the string given in the CLI. * * @param command * This is the command that got the parameter. * @throws AbortException * If the CLI processing should be aborted. Hudson will report the error message * without stack trace, and then exits this command. Useful for graceful termination. * @throws RuntimeException * All the other exceptions cause the stack trace to be dumped, and then * the command exits with an error code. * @since 1.334 */ @CheckForNull public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException { throw new AbortException("CLI parameter submission is not supported for the "+getClass()+" type. Please file a bug report for this"); }
public String call() throws IOException { File f = new File(script); if(f.exists()) return FileUtils.readFileToString(f); URL url; try { url = new URL(script); } catch (MalformedURLException e) { throw new AbortException("Unable to find a script "+script); } try (InputStream s = url.openStream()) { return IOUtils.toString(s); } } }
/** * Copies a single resource into the target folder, by the given name, and handle errors gracefully. */ private void copy(StaplerRequest req, StaplerResponse rsp, File dir, URL src, String name) throws ServletException, IOException { try { FileUtils.copyURLToFile(src,new File(dir, name)); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to copy "+name,e); sendError("Failed to copy "+name+": "+e.getMessage(),req,rsp); throw new AbortException(); } }
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);
private int showCommandDetails() throws Exception { CLICommand command = CLICommand.clone(this.command); if (command == null) { showAllCommands(); throw new AbortException(String.format("No such command %s. Available commands are above. ", this.command)); } command.printUsage(stderr, command.getCmdLineParser()); return 0; } }
try { if (!checkout((AbstractBuild) build, launcher, workspace, (BuildListener) listener, changelogFile)) { throw new AbortException(); throw new AbortException();
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);
/** * {@inheritDoc} * @return Delegates to {@link SimpleBuildStep#perform(Run, FilePath, Launcher, TaskListener)} if possible, always returning true or throwing an error. */ @Override public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { if (this instanceof SimpleBuildStep) { // delegate to the overloaded version defined in SimpleBuildStep FilePath workspace = build.getWorkspace(); if (workspace == null) { throw new AbortException("no workspace for " + build); } ((SimpleBuildStep) this).perform(build, workspace, launcher, listener); return true; } else if (build instanceof Build) { // delegate to the legacy signature deprecated in 1.312 return perform((Build)build,launcher,listener); } else { return true; } }
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);
@Override public void perform(Run<?,?> build, FilePath ws, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { if(artifacts.length()==0) { throw new AbortException(Messages.ArtifactArchiver_NoIncludes()); listener.getLogger().println(Messages.ArtifactArchiver_NoMatchFound(artifacts)); } else { throw new AbortException(Messages.ArtifactArchiver_NoMatchFound(artifacts)); throw new AbortException(e.toString()); // Message is not enough as that is the filename only
public boolean checkout(AbstractBuild build, Launcher launcher, BuildListener listener, File changelogFile) throws IOException, InterruptedException { SCM scm = getScm(); if(scm==null) return true; // no SCM FilePath workspace = build.getWorkspace(); if(workspace!=null){ workspace.mkdirs(); } else { throw new AbortException("Cannot checkout SCM, workspace is not defined"); } boolean r = scm.checkout(build, launcher, workspace, listener, changelogFile); if (r) { // Only calcRevisionsFromBuild if checkout was successful. Note that modern SCM implementations // won't reach this line anyway, as they throw AbortExceptions on checkout failure. calcPollingBaseline(build, launcher, listener); } return r; }
Throwable e = p.deploy(dynamicLoad).get().getError(); if (e!=null) { AbortException myException = new AbortException("Failed to install plugin " + source); myException.initCause(e); throw myException; throw new AbortException("Error occurred, see previous output.");
SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job); if (item == null) throw new AbortException(job.getFullDisplayName()+" has no SCM trigger, but checkSCM was specified"); Exception myException = new AbortException(); myException.initCause(e); throw myException; Exception myException = new AbortException(); myException.initCause(e); throw myException;