Bug 5791 NPE in SocketUtil
Launch Eclipse using JDK 1.4 as JRE. From the launched eclispe, launch another program in debug mode, using JDK 1.4. This produces an NPE in SocketUtil: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:277) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run (ProgressMonitorDialog.java:335) at org.eclipse.jdt.internal.ui.launcher.JavaApplicationLauncherDelegate.doLaunch (JavaApplicationLauncherDelegate.java:181) at org.eclipse.jdt.internal.ui.launcher.JavaApplicationLauncherDelegate.launchEleme nt(JavaApplicationLauncherDelegate.java:81) at org.eclipse.jdt.internal.ui.launcher.JavaApplicationLauncherDelegate.launch (JavaApplicationLauncherDelegate.java:93) at org.eclipse.debug.internal.core.Launcher.launch(Launcher.java:104) at org.eclipse.debug.internal.ui.RelaunchActionDelegate.relaunch (RelaunchActionDelegate.java:37) at org.eclipse.debug.internal.ui.RelaunchActionDelegate.relaunch (RelaunchActionDelegate.java:46) at org.eclipse.debug.internal.ui.RelaunchHistoryLaunchAction$1.run (RelaunchHistoryLaunchAction.java:49) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:56) at org.eclipse.debug.internal.ui.RelaunchHistoryLaunchAction.run (RelaunchHistoryLaunchAction.java:47) at org.eclipse.jface.action.Action.runWithEvent(Action.java:453) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:361) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:352) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:47) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:727) at org.eclipse.ui.internal.Workbench.run(Workbench.java:710) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at SlimLauncher.main(SlimLauncher.java:14) Caused by: java.lang.NullPointerException at java.net.Socket.<init>(Socket.java:285) at java.net.Socket.<init>(Socket.java:121) at org.eclipse.jdt.internal.ui.launcher.SocketUtil.findUnusedLocalPort (SocketUtil.java:21) at org.eclipse.jdt.internal.ui.launcher.JDK12DebugLauncher.run (JDK12DebugLauncher.java:60) at org.eclipse.jdt.internal.ui.launcher.JavaApplicationLauncherDelegate$1.run (JavaApplicationLauncherDelegate.java:170) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run (ModalContext.java:98)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/launcher/JDK12DebugLauncher.java
addArguments(config.getVMArguments(), arguments);
		arguments.add("-Xdebug"); 
		arguments.add("-Xnoagent"); 
		arguments.add("-Djava.compiler=NONE"); 
		arguments.add("-Xrunjdwp:transport=dt_socket,address=127.0.0.1:" + port); 
		arguments.add(config.getClassToLaunch());
		addArguments(config.getProgramArguments(), arguments);
		String[] cmdLine= new String[arguments.size()];
		arguments.copyInto(cmdLine);
		ListeningConnector connector= getConnector();
		if (connector == null) {
			throw new CoreException(createStatus(LauncherMessages.getString("jdkLauncher.error.noConnector"), null)); 
		}
		Map map= connector.defaultArguments();
		int timeout= fVMInstance.getDebuggerTimeout();
		
		specifyArguments(map, port, timeout);
		Process p= null;
		try {
			try {
				connector.startListening(map);
				try {
					p= Runtime.getRuntime().exec(cmdLine);
		
				} catch (IOException e) {
					if (p != null) {
						p.destroy();
					}
					throw new CoreException(createStatus(LauncherMessages.getString("jdkLauncher.error.title"), e)); 
				}