/** * Handles a fatal build problem (exception) that occurred during the build. */ private void handleFatalBuildProblem(@Nonnull BuildListener listener, @Nonnull Throwable e) { if(listener!=null) { LOGGER.log(FINE, getDisplayName()+" failed to build",e); if(e instanceof IOException) Util.displayIOException((IOException)e,listener); Functions.printStackTrace(e, listener.fatalError(e.getMessage())); } else { LOGGER.log(SEVERE, getDisplayName()+" failed to build and we don't even have a listener",e); } }
script = createScriptFile(ws); } catch (IOException e) { Util.displayIOException(e,listener); Functions.printStackTrace(e, listener.fatalError(Messages.CommandInterpreter_UnableToProduceScript())); return false; Util.displayIOException(e, listener); Functions.printStackTrace(e, listener.fatalError(Messages.CommandInterpreter_CommandFailed())); Util.displayIOException(e,listener); Functions.printStackTrace(e, listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)));
Util.displayIOException(e,listener); Functions.printStackTrace(e, listener.fatalError(Messages.Maven_ExecFailed())); return false;
public static boolean isAlreadyInstalled(RubyInstallation[] current, String path) { try { for (RubyInstallation ruby : current) { if (new File(ruby.getPath()).getCanonicalPath().equals(new File(path).getCanonicalPath())) { return true; } } } catch (IOException e) { hudson.Util.displayIOException(e, null); } return false; }
/** * Handles a fatal build problem (exception) that occurred during the build. */ private void handleFatalBuildProblem(BuildListener listener, Throwable e) { if(listener!=null) { if(e instanceof IOException) Util.displayIOException((IOException)e,listener); Writer w = listener.fatalError(e.getMessage()); if(w!=null) { try { e.printStackTrace(new PrintWriter(w)); w.close(); } catch (IOException e1) { // ignore } } } }
/** * Handles a fatal build problem (exception) that occurred during the build. */ private void handleFatalBuildProblem(BuildListener listener, Throwable e) { if (listener != null) { if (e instanceof IOException) { Util.displayIOException((IOException) e, listener); } Writer w = listener.fatalError(e.getMessage()); if (w != null) { try { e.printStackTrace(new PrintWriter(w)); w.close(); } catch (IOException e1) { // ignore } } } }
/** * Handles a fatal build problem (exception) that occurred during the build. */ private void handleFatalBuildProblem(BuildListener listener, Throwable e) { if(listener!=null) { if(e instanceof IOException) Util.displayIOException((IOException)e,listener); Writer w = listener.fatalError(e.getMessage()); if(w!=null) { try { e.printStackTrace(new PrintWriter(w)); w.close(); } catch (IOException e1) { // ignore } } } }
/** * Handles a fatal build problem (exception) that occurred during the build. */ private void handleFatalBuildProblem(BuildListener listener, Throwable e) { if(listener!=null) { if(e instanceof IOException) Util.displayIOException((IOException)e,listener); Writer w = listener.fatalError(e.getMessage()); if(w!=null) { try { e.printStackTrace(new PrintWriter(w)); w.close(); } catch (IOException e1) { // ignore } } } }
protected static RubyInstallation[] getCanonicalRubies(RubyInstallation[] currentInstallations, Collection<File> candidates) { try { Collection<RubyInstallation> currentList = new LinkedHashSet<RubyInstallation>(Arrays.asList(currentInstallations)); out: for (File ruby : candidates) { for (RubyInstallation current : currentList) { if (current.getCanonicalExecutable().equals(getExecutable(ruby.getCanonicalPath()).getCanonicalFile())) { continue out; } } currentList.add(new RubyInstallation(ruby.getName(), ruby.getCanonicalPath())); } return currentList.toArray(new RubyInstallation[currentList.size()]); } catch (IOException e) { hudson.Util.displayIOException(e, null); } return new RubyInstallation[0]; }
/** * Handles a fatal build problem (exception) that occurred during the build. */ private void handleFatalBuildProblem(@Nonnull BuildListener listener, @Nonnull Throwable e) { if(listener!=null) { LOGGER.log(FINE, getDisplayName()+" failed to build",e); if(e instanceof IOException) Util.displayIOException((IOException)e,listener); Functions.printStackTrace(e, listener.fatalError(e.getMessage())); } else { LOGGER.log(SEVERE, getDisplayName()+" failed to build and we don't even have a listener",e); } }
public static RubyInstallation[] getCanonicalRubies(RubyInstallation[] currentInstallations) { try { Collection<File> rubies = getRubyInstallations(); return getCanonicalRubies(currentInstallations, rubies); } catch (IOException e) { hudson.Util.displayIOException(e, null); } return new RubyInstallation[0]; }
private boolean export(final AbstractBuild<?, ?> build, final TaskListener listener) throws InterruptedException, IOException { final FilePath ws = getFilePath(build); try { createFile(ws); } catch (final IOException e) { Util.displayIOException(e, listener); e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_UnableToProduceScript())); throw e; } return true; }
private void handleErrors(TaskListener listener, @Nullable SonarRunnerInstallation sri, long startTime, IOException e) { Logger.printFailureMessage(listener); Util.displayIOException(e, listener); String errorMessage = Messages.SonarScanner_ExecFailed(); if (sri == null && (System.currentTimeMillis() - startTime) < 1000 && getDescriptor().getSonarRunnerInstallations() == null) { // looks like the user didn't configure any SonarQube Scanner installation errorMessage += Messages.SonarScanner_GlobalConfigNeeded(); } e.printStackTrace(listener.fatalError(errorMessage)); }
@Override protected void finished(StepContext context) throws Exception { mavenSpyLogProcessor.processMavenSpyLogs(context, tempBinDir, options, mavenPublisherStrategy); try { tempBinDir.deleteRecursive(); } catch (IOException | InterruptedException e) { BuildListener listener = context.get(BuildListener.class); try { if (e instanceof IOException) { Util.displayIOException((IOException) e, listener); // Better IOException display on windows } e.printStackTrace(listener.fatalError("Error deleting temporary files")); } catch (Throwable t) { t.printStackTrace(); } } }
@Override public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException { try { _perform(build, launcher, listener); return true; } catch (PerformException e) { listener.fatalError(e.getMessage()); return false; } catch (IOException e) { Util.displayIOException(e, listener); String errorMessage = Messages.Unity3d_ExecUnexpectedlyFailed(); e.printStackTrace(listener.fatalError(errorMessage)); return false; } }
private boolean RunMaven(Run<?, ?> build, Launcher launcher, TaskListener listener, EnvVars env, FilePath workDir, String[] cmds) throws InterruptedException, IOException { try { int exitValue = launcher.launch().cmds(cmds).envs(env).stdout(listener).pwd(workDir).join(); boolean success = (exitValue == 0); build.setResult(success ? Result.SUCCESS : Result.FAILURE); return success; } catch (IOException e) { Util.displayIOException(e, listener); e.printStackTrace(listener.fatalError("command execution failed")); return false; } finally { ActionableHelper.deleteFilePath(workDir, classworldsConfPath); } }
@Override public void perform(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException { listener.getLogger().println(Messages.JavadocArchiver_Publishing()); EnvVars env = build.getEnvironment(listener); FilePath javadoc = workspace.child(env.expand(javadocDir)); FilePath target = new FilePath(keepAll ? getJavadocDir(build) : getJavadocDir(build.getParent())); try { if (javadoc.copyRecursiveTo("**/*",target)==0) { if(build.getResult().isBetterOrEqualTo(Result.UNSTABLE)) { // If the build failed, don't complain that there was no javadoc. // The build probably didn't even get to the point where it produces javadoc. listener.error(Messages.JavadocArchiver_NoMatchFound(javadoc,javadoc.validateAntFileMask("**/*"))); } build.setResult(Result.FAILURE); return; } } catch (IOException e) { Util.displayIOException(e,listener); e.printStackTrace(listener.fatalError(Messages.JavadocArchiver_UnableToCopy(javadoc,target))); build.setResult(Result.FAILURE); return; } build.addAction(new JavadocBuildAction()); }
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException { final File buildRootDir = build.getRootDir(); // should this top level? final FilePath cloverphpBuildTarget = new FilePath(buildRootDir).child("cloverphp"); final FilePath workspace = build.getWorkspace(); try { listener.getLogger().println("Publishing Clover coverage report..."); // create "jobs/builds/XXX/cloverphp" cloverphpBuildTarget.mkdirs(); EnvVars env = build.getEnvironment(listener); if (isPublishHtmlReport() && !isDisableArchiving()) { FilePath coverageReportDir = workspace.child(env.expand(reportDir)); FilePath htmlReportDir = new FilePath(cloverphpBuildTarget, "htmlreport"); htmlReportDir.mkdirs(); final boolean htmlExists = copyHtmlReport(coverageReportDir, htmlReportDir, listener); if (htmlExists) { // only add the HTML build action, if the HTML report is available build.getActions().add(new CloverHtmlBuildAction(htmlReportDir)); } } final boolean xmlExists = copyXmlReport(workspace, cloverphpBuildTarget, listener, env.expand(xmlLocation)); processCloverXml(build, listener, cloverphpBuildTarget); } catch (IOException e) { Util.displayIOException(e, listener); build.setResult(Result.FAILURE); } return true; }
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { listener.getLogger().println(Messages.JavadocArchiver_Publishing()); EnvVars env = build.getEnvironment(listener); FilePath javadoc = build.getWorkspace().child(env.expand(javadocDir)); FilePath target = new FilePath(keepAll ? getJavadocDir(build) : getJavadocDir(build.getProject())); try { if (javadoc.copyRecursiveTo("**/*",target)==0) { if(build.getResult().isBetterOrEqualTo(Result.UNSTABLE)) { // If the build failed, don't complain that there was no javadoc. // The build probably didn't even get to the point where it produces javadoc. listener.error(Messages.JavadocArchiver_NoMatchFound(javadoc,javadoc.validateAntFileMask("**/*"))); } build.setResult(Result.FAILURE); return true; } } catch (IOException e) { Util.displayIOException(e,listener); e.printStackTrace(listener.fatalError(Messages.JavadocArchiver_UnableToCopy(javadoc,target))); build.setResult(Result.FAILURE); return true; } // add build action, if javadoc is recorded for each build if(keepAll) build.addAction(new JavadocBuildAction(build)); return true; }
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { listener.getLogger().println(Messages.JavadocArchiver_Publishing()); EnvVars env = build.getEnvironment(listener); FilePath javadoc = build.getWorkspace().child(env.expand(javadocDir)); FilePath target = new FilePath(keepAll ? getJavadocDir(build) : getJavadocDir(build.getProject())); try { if (javadoc.copyRecursiveTo("**/*",target)==0) { if(build.getResult().isBetterOrEqualTo(Result.UNSTABLE)) { // If the build failed, don't complain that there was no javadoc. // The build probably didn't even get to the point where it produces javadoc. listener.error(Messages.JavadocArchiver_NoMatchFound(javadoc,javadoc.validateAntFileMask("**/*"))); } build.setResult(Result.FAILURE); return true; } } catch (IOException e) { Util.displayIOException(e,listener); e.printStackTrace(listener.fatalError(Messages.JavadocArchiver_UnableToCopy(javadoc,target))); build.setResult(Result.FAILURE); return true; } // add build action, if javadoc is recorded for each build if(keepAll) build.addAction(new JavadocBuildAction(build)); return true; }