Bug 551483 - Guard against NPE
Not sure if this a valid use case. In case a launchconfiguration==null
is result of a invalid junit test I prefer to fix the test instead.
Change-Id: Ie7cc399c9af78e111552dce8375740e2fd8211d8
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java
index b7b156c..f89b4c7 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java
@@ -440,9 +440,11 @@
arguments.add("--enable-preview"); //$NON-NLS-1$
}
+ ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
// check if java 14 or greater
if (getJavaVersion(fVMInstance) >= 14) {
- if (launch.getLaunchConfiguration().getAttribute(IJavaLaunchConfigurationConstants.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES, true)) {
+ if (launchConfiguration != null
+ && launchConfiguration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES, true)) {
arguments.add("-XX:+ShowCodeDetailsInExceptionMessages"); //$NON-NLS-1$
}
}
@@ -471,7 +473,7 @@
cmdLine = classpathShortener.getCmdLine();
envp = classpathShortener.getEnvp();
}
- String[] newCmdLine = validateCommandLine(launch.getLaunchConfiguration(), cmdLine);
+ String[] newCmdLine = validateCommandLine(launchConfiguration, cmdLine);
if (newCmdLine != null) {
cmdLine = newCmdLine;
}