diff options
author | Dani Megert | 2015-05-27 09:46:40 +0000 |
---|---|---|
committer | Dani Megert | 2015-05-27 09:46:40 +0000 |
commit | bf59312babe8fc1bbe88241adad15e001ca8cb6d (patch) | |
tree | b35a74e291f6c79a6662423b4224f02e670ba36e | |
parent | bb28e9a35b338b99802f1b9cf4405590f299f0c1 (diff) | |
download | eclipse.jdt.debug-bf59312babe8fc1bbe88241adad15e001ca8cb6d.tar.gz eclipse.jdt.debug-bf59312babe8fc1bbe88241adad15e001ca8cb6d.tar.xz eclipse.jdt.debug-bf59312babe8fc1bbe88241adad15e001ca8cb6d.zip |
Fixed bug 468252: NullPointerException in JavaAppletLaunchConfigurationDelegate.buildHTMLFile (102)I20150528-0700I20150527-2010
-rw-r--r-- | org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaAppletLaunchConfigurationDelegate.java | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaAppletLaunchConfigurationDelegate.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaAppletLaunchConfigurationDelegate.java index 693030234..936948a40 100644 --- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaAppletLaunchConfigurationDelegate.java +++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaAppletLaunchConfigurationDelegate.java @@ -23,11 +23,13 @@ import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IDebugEventSetListener; @@ -35,6 +37,7 @@ import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IProcess; + import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; import org.eclipse.jdt.launching.JavaLaunchDelegate; import org.eclipse.jdt.launching.JavaRuntime; @@ -90,18 +93,21 @@ public class JavaAppletLaunchConfigurationDelegate extends JavaLaunchDelegate im } /** - * Using the specified launch configuration, build an HTML file that specifies the - * applet to launch. Return the name of the HTML file. + * Using the specified launch configuration, build an HTML file that specifies the applet to launch. Return the name of the HTML file. * - * @param configuration the launch config - * @param dir the directory in which to make the file + * @param configuration + * the launch config + * @param dir + * the directory in which to make the file * @return the new HTML file + * @throws CoreException + * if the file cannot be built */ - private File buildHTMLFile(ILaunchConfiguration configuration, File dir) { - File tempFile = null; + private File buildHTMLFile(ILaunchConfiguration configuration, File dir) throws CoreException { + String name = getAppletMainTypeName(configuration); + File tempFile = new File(dir, name + System.currentTimeMillis() + ".html"); //$NON-NLS-1$ try (FileOutputStream stream = new FileOutputStream(tempFile)) { String encoding = getLaunchManager().getEncoding(configuration); - String name = getAppletMainTypeName(configuration); StringBuffer buf = new StringBuffer(); buf.append("<html>\n"); //$NON-NLS-1$ buf.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + encoding + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -134,12 +140,11 @@ public class JavaAppletLaunchConfigurationDelegate extends JavaLaunchDelegate im buf.append("</body>\n"); //$NON-NLS-1$ buf.append("</html>\n"); //$NON-NLS-1$ - tempFile = new File(dir, name + System.currentTimeMillis() + ".html"); //$NON-NLS-1$ stream.write(buf.toString().getBytes(encoding)); } catch(IOException e) { - } catch(CoreException e) { + LaunchingPlugin.log(e); } - + return tempFile; } |