From 9965b5e6c0eb0e7f708fc4fd329ad96e09d6d5e9 Mon Sep 17 00:00:00 2001 From: Steve Ramage Date: Fri, 3 Jul 2015 11:59:15 -0700 Subject: [PATCH] [JENKINS-29220] Handle InterruptedException properly --- .../RemoteBuildConfiguration.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfiguration.java b/src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfiguration.java index fa62789e..09ef14a8 100644 --- a/src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfiguration.java +++ b/src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfiguration.java @@ -448,12 +448,18 @@ private String buildGetUrl(String job, String securityToken) { */ private void failBuild(Exception e, BuildListener listener) throws IOException { System.out.print(e.getStackTrace()); - if (this.getShouldNotFailBuild()) { + if (this.getShouldNotFailBuild() && !(e instanceof InterruptedException)) { listener.error("Remote build failed for the following reason, but the build will continue:"); listener.error(e.getMessage()); } else { - listener.error("Remote build failed for the following reason:"); - throw new AbortException(e.getMessage()); + if(e instanceof InterruptedException){ + listener.error("Build cancelled by user"); + throw new AbortException("Build cancelled by user"); + } else + { + listener.error("Remote build failed for the following reason:"); + throw new AbortException(e.getMessage()); + } } } @@ -778,8 +784,8 @@ public String getBuildUrl(String buildUrlString, AbstractBuild build, BuildListe public String getConsoleOutput(String urlString, String requestType, AbstractBuild build, BuildListener listener) throws IOException { - - return getConsoleOutput( urlString, requestType, build, listener, 1 ); + + return getConsoleOutput( urlString, requestType, build, listener, 1 ); } /**