本文整理了Java中hudson.Util.displayIOException()
方法的一些代码示例,展示了Util.displayIOException()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.displayIOException()
方法的具体详情如下:
包路径:hudson.Util
类名称:Util
方法名:displayIOException
[英]On Windows, error messages for IOException aren't very helpful. This method generates additional user-friendly error message to the listener
[中]在Windows上,IOException的错误消息没有多大帮助。此方法会向侦听器生成其他用户友好的错误消息
代码示例来源:origin: jenkinsci/jenkins
/**
* 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);
}
}
代码示例来源:origin: jenkinsci/jenkins
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)));
代码示例来源:origin: jenkinsci/jenkins
Util.displayIOException(e,listener);
Functions.printStackTrace(e, listener.fatalError(Messages.Maven_ExecFailed()));
return false;
代码示例来源:origin: org.jenkins-ci.plugins/rake
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;
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* 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
}
}
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* 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
}
}
}
}
代码示例来源:origin: hudson/hudson-2.x
/**
* 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
}
}
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* 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
}
}
}
}
代码示例来源:origin: org.jenkins-ci.plugins/rake
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];
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* 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);
}
}
代码示例来源:origin: org.jenkins-ci.plugins/rake
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];
}
代码示例来源:origin: groupon/DotCi
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;
}
代码示例来源:origin: SonarSource/sonar-scanner-jenkins
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));
}
代码示例来源:origin: jenkinsci/pipeline-maven-plugin
@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();
}
}
}
代码示例来源:origin: lacostej/jenkins-unity3d-plugin
@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;
}
}
代码示例来源:origin: jenkinsci/artifactory-plugin
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);
}
}
代码示例来源:origin: org.jenkins-ci.plugins/javadoc
@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());
}
代码示例来源:origin: org.jenkins-ci.plugins/cloverphp
@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;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
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;
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
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;
}
内容来源于网络,如有侵权,请联系作者删除!