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
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.jdi.Bootstrap;
import org.eclipse.jdt.debug.core.JDIDebugModel;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.VMRunnerConfiguration;
import org.eclipse.jdt.launching.VMRunnerResult;
import com.sun.jdi.VirtualMachine;
import com.sun.jdi.connect.Connector;
import com.sun.jdi.connect.IllegalConnectorArgumentsException;
import com.sun.jdi.connect.ListeningConnector;
import com.sun.jdi.connect.Connector.IntegerArgument;
/**
 * A launcher for running java main classes. Uses JDI to launch a vm in debug 
 * mode.
 */
public class JDK12DebugLauncher extends JDK12Launcher {
	public interface IRetryQuery {
		boolean queryRetry();
	}
	private IRetryQuery fRetryQuery;
	/**
	 * Creates a new lauchner
	 */
	public JDK12DebugLauncher(IVMInstall vmInstance, IRetryQuery query) {
		super(vmInstance);
		fRetryQuery= query;
	}
	/**
	 * @see IVMRunner#run