aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-07-19 18:29:36 -0400
committerJeff Johnston2018-07-19 19:06:53 -0400
commit5702e46f75c7a24ccbce93c6eaa319ee14256ec3 (patch)
treecd27703dd5bcfcaf4704058375cd66130a5a921d
parent2f90bf9c84bddcb205287e891154307131c8da82 (diff)
downloadorg.eclipse.linuxtools-5702e46f75c7a24ccbce93c6eaa319ee14256ec3.tar.gz
org.eclipse.linuxtools-5702e46f75c7a24ccbce93c6eaa319ee14256ec3.tar.xz
org.eclipse.linuxtools-5702e46f75c7a24ccbce93c6eaa319ee14256ec3.zip
Bug 537205 - NoSuchElementException below ImageQuery.getJavaVersion
- add try/catch in ImageQuery getJavaVersion() method Change-Id: I519c70576d4eac6d7bcfb20dcd7815ac55da8856 Reviewed-on: https://git.eclipse.org/r/126347 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ImageQuery.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ImageQuery.java b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ImageQuery.java
index 0b9dd7fc17..0d824792c5 100644
--- a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ImageQuery.java
+++ b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ImageQuery.java
@@ -120,9 +120,13 @@ public class ImageQuery {
String result = exec(new String [] {"sh", "-c", "java -version 2>&1 | grep version | cut -d\\\" -f2 | cut -d_ -f1"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (result != null) {
result = result.replaceAll("\n", ""); //$NON-NLS-1$ //$NON-NLS-2$
- Version v = new Version(result);
- String newV = v.getMajor() + "." + v.getMinor(); //$NON-NLS-1$
- return Double.valueOf(newV);
+ try {
+ Version v = new Version(result);
+ String newV = v.getMajor() + "." + v.getMinor(); //$NON-NLS-1$
+ return Double.valueOf(newV);
+ } catch (Exception e) {
+ return 0;
+ }
} else {
return 0;
}