Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Grunberg2018-08-13 15:58:59 -0400
committerJeff Johnston2018-08-13 18:59:24 -0400
commitd2325a89210b7bcd33adb7d95f738587c8f36335 (patch)
treea5e5df1bbbb5f05647146cdbc4bdbf06e7690d74
parent71c2af0dc3a441e4b3bcb48b5bf9ec8692385777 (diff)
downloadorg.eclipse.linuxtools-d2325a89210b7bcd33adb7d95f738587c8f36335.tar.gz
org.eclipse.linuxtools-d2325a89210b7bcd33adb7d95f738587c8f36335.tar.xz
org.eclipse.linuxtools-d2325a89210b7bcd33adb7d95f738587c8f36335.zip
Bug 537902 - ContainerVMInstall should implement IVMInstall2.
The ClassPathShortener constructor, called from StandardVMRunner.getCommandLine(..) attempts to cast the input IVMInstall to an IVMInstall2 (if possible) in order to use its getJavaVersion() and returns null otherwise. However, the constructor also asserts that the returned java version cannot be null so our ContainerVMInstall must now implement IVMInstall2. Change-Id: I8d7666980650b36f30f19f30c9891d15b5c15e1b Reviewed-on: https://git.eclipse.org/r/127361 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> (cherry picked from commit 57336ee27edb0bb5f8ee9ea89c0acc177f3d9d97) Reviewed-on: https://git.eclipse.org/r/127366
-rw-r--r--containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMInstall.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMInstall.java b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMInstall.java
index bfb8b2ddc4..697d2046ae 100644
--- a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMInstall.java
+++ b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMInstall.java
@@ -18,6 +18,7 @@ import java.net.URL;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstall2;
import org.eclipse.jdt.launching.IVMInstallType;
import org.eclipse.jdt.launching.IVMRunner;
import org.eclipse.jdt.launching.LibraryLocation;
@@ -25,13 +26,14 @@ import org.eclipse.linuxtools.docker.core.DockerConnectionManager;
import org.eclipse.linuxtools.docker.core.IDockerImage;
import org.eclipse.linuxtools.internal.docker.core.DockerConnection;
-public class ContainerVMInstall implements IVMInstall {
+public class ContainerVMInstall implements IVMInstall, IVMInstall2 {
private ILaunchConfiguration config;
private String name;
private File installLocation;
private IDockerImage image;
private int port;
+ private String javaVersion;
public ContainerVMInstall (ILaunchConfiguration cfg, IDockerImage img, int port) {
this.config = cfg;
@@ -161,4 +163,24 @@ public class ContainerVMInstall implements IVMInstall {
return null;
}
+ @Override
+ public String getVMArgs() {
+ return null;
+ }
+
+ @Override
+ public void setVMArgs(String vmArgs) {
+ }
+
+ @Override
+ public String getJavaVersion() {
+ if (javaVersion == null) {
+ DockerConnection conn = getConnection();
+ ImageQuery q = new ImageQuery(conn, image.id());
+ javaVersion = String.valueOf(q.getJavaVersion());
+ q.destroy();
+ }
+ return javaVersion;
+ }
+
}

Back to the top