diff options
author | Roland Grunberg | 2017-06-26 19:42:15 +0000 |
---|---|---|
committer | Roland Grunberg | 2017-06-27 14:16:08 +0000 |
commit | 80aa6bfad79c4261beb281f8baefed7ed4ea68f2 (patch) | |
tree | e3774c09722e64ed8906d95c2ecf7e9be6ca91bb | |
parent | b77308e2c0018894de66bae72fee099b1c6fe9cd (diff) | |
download | org.eclipse.linuxtools-80aa6bfad79c4261beb281f8baefed7ed4ea68f2.tar.gz org.eclipse.linuxtools-80aa6bfad79c4261beb281f8baefed7ed4ea68f2.tar.xz org.eclipse.linuxtools-80aa6bfad79c4261beb281f8baefed7ed4ea68f2.zip |
Improve error message when JRE could not be located in the container.
- Guard against an NPE that may occur on initial loading of image tab
Change-Id: I85850b97d136e9d531cbf0eae164342c2befd734
Reviewed-on: https://git.eclipse.org/r/100073
Tested-by: Hudson CI
Reviewed-by: Roland Grunberg <rgrunber@redhat.com>
3 files changed, 9 insertions, 5 deletions
diff --git a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMRunner.java b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMRunner.java index 2275110be5..a5016daa06 100644 --- a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMRunner.java +++ b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMRunner.java @@ -92,7 +92,7 @@ public class ContainerVMRunner extends StandardVMRunner { exe = ((ContainerVMInstall)fVMInstance).getJavaExecutable(); } if (exe == null) { - abort(NLS.bind(Messages.ContainerVMRunner_Unable_to_locate_executable_for__0__1, new String[]{fVMInstance.getName()}), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); + abort(Messages.ContainerVMRunner_Unable_to_locate_executable_for__0__1, null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); } else { return exe.getAbsolutePath(); } diff --git a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/JavaImageTab.java b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/JavaImageTab.java index 102622be9e..6e1cf39729 100644 --- a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/JavaImageTab.java +++ b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/JavaImageTab.java @@ -73,9 +73,13 @@ public class JavaImageTab extends AbstractLaunchConfigurationTab { @Override public Object[] getElements(Object inputElement) { IDockerConnection conn = (IDockerConnection) inputElement; - return conn.getImages().stream() - .filter(i -> ! i.repoTags().get(0).equals("<none>:<none>")) //$NON-NLS-1$ - .toArray(size -> new IDockerImage[size]); + if (conn == null || conn.getImages() == null) { + return new Object[0]; + } else { + return conn.getImages().stream() + .filter(i -> ! i.repoTags().get(0).equals("<none>:<none>")) //$NON-NLS-1$ + .toArray(size -> new IDockerImage[size]); + } } }); imageCmb.setLabelProvider(new ColumnLabelProvider() { diff --git a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/messages.properties b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/messages.properties index 403e999468..74d72a0322 100644 --- a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/messages.properties +++ b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/messages.properties @@ -1,5 +1,5 @@ ContainerVMRunner_Specified_executable__0__does_not_exist_for__1__4=Specified executable {0} does not exist for {1} -ContainerVMRunner_Unable_to_locate_executable_for__0__1=Unable to locate executable for {0} +ContainerVMRunner_Unable_to_locate_executable_for__0__1=Unable to locate the JVM executable in the container. Please make sure that the selected image contains the Java Runtime Environment. ImageSelectionDialog_connection_label=Connection : ImageSelectionDialog_image_label=Image : ImageSelectionDialog_title=Image Selection |