From 72767c4f789244008581b36a2fca3e473399c62e Mon Sep 17 00:00:00 2001 From: mivola Date: Fri, 14 Sep 2018 13:36:57 +0200 Subject: [PATCH 1/2] fixes #358 by updating to Java8 (#359) --- .travis.yml | 2 +- pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 40d3995c..6c57468f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ after_script: # http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html # - oraclejdk8 is not supported anymore. jdk: - - openjdk7 + - openjdk8 cache: directories: - $HOME/.m2/repository diff --git a/pom.xml b/pom.xml index ff44c7e4..ce6912d5 100644 --- a/pom.xml +++ b/pom.xml @@ -43,8 +43,8 @@ UTF-8 UTF-8 - 1.7 - 1.7 + 1.8 + 1.8 true true From 3a3179ff50e2a41bd083efe7cecd66ee8b549ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Gond=C5=BEa?= Date: Fri, 14 Sep 2018 18:50:11 +0200 Subject: [PATCH 2/2] Fix #118: Avoid the unsafe cast in Build#Stop() (#326) - Recover when 405 is returned - Propagate other exceptions correctly --- .../main/java/com/offbytwo/jenkins/model/Build.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jenkins-client/src/main/java/com/offbytwo/jenkins/model/Build.java b/jenkins-client/src/main/java/com/offbytwo/jenkins/model/Build.java index 14b98369..f48e38e8 100644 --- a/jenkins-client/src/main/java/com/offbytwo/jenkins/model/Build.java +++ b/jenkins-client/src/main/java/com/offbytwo/jenkins/model/Build.java @@ -140,13 +140,13 @@ public String Stop() throws HttpResponseException, IOException { try { return client.get(url + "stop"); - } catch (IOException ex) { - if (((HttpResponseException) ex).getStatusCode() == 405) { + } catch (HttpResponseException ex) { + if (ex.getStatusCode() == 405) { stopPost(); return ""; } + throw ex; } - return ""; } /** Stops the build which is currently in progress. This version takes in @@ -163,13 +163,13 @@ public String Stop(boolean crumbFlag) throws HttpResponseException, IOException try { return client.get(url + "stop"); - } catch (IOException ex) { - if (((HttpResponseException) ex).getStatusCode() == 405) { + } catch (HttpResponseException ex) { + if (ex.getStatusCode() == 405) { stopPost(crumbFlag); return ""; } + throw ex; } - return ""; } private void stopPost(boolean crumbFlag) throws HttpResponseException, IOException {