Bug 98918 AssertionFailedException with zero-length classpath variable entry
Against N20050608-0010.from20050608_1210 1) Create a java project "b" 2) Context menu on b > Properties > Java Build Path > Libraries 3) Add Variable. Select JUNIT_HOME, click Extend..., select junit.jar 4) Click Edit... 5) Delete all text in the text box, click OK. Now the error below is logged, and no further changes are applied to the build path until the dialog is closed or reopened: org.eclipse.jdt.internal.core.Assert$AssertionFailedException: Assertion failed; Illegal classpath variable path: '', must have at least one segment at org.eclipse.jdt.internal.core.Assert.isTrue(Assert.java:89) at org.eclipse.jdt.core.JavaCore.newVariableEntry(JavaCore.java:3549) at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.newClasspathEntry(CPListElement.java:171) at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.getClasspathEntry(CPListElement.java:124) at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.equals(CPListElement.java:321) at java.util.ArrayList.indexOf(Unknown Source) at java.util.ArrayList.contains(Unknown Source) at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.openVariableSelectionDialog(LibrariesWorkbookPage.java:705) at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.libaryPageCustomButtonPressed(LibrariesWorkbookPage.java:228) at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.access$0(LibrariesWorkbookPage.java:218) at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage$LibrariesAdapter.customButtonPressed(LibrariesWorkbookPage.java:173) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.buttonPressed(TreeListDialogField.java:167) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.doButtonSelected(TreeListDialogField.java:385) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.access$2(TreeListDialogField.java:381) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField$2.widgetSelected(TreeListDialogField.java:346) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:844) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3055) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2688) at org.eclipse.jface.window.Window.runEventLoop(Window.java:809) at org.eclipse.jface.window.Window.open(Window.java:787) at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:157) at org.eclipse.jface.action.Action.runWithEvent(Action.java:996) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:844) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3055) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2688) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1717) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1681) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:366) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:375) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:162) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/EditVariableEntryDialog.java
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil;
/**
  */
public class EditVariableEntryDialog extends StatusDialog {
	/**
	 * The path to which the archive variable points.
	 * Null if invalid path or not resolvable. Must not exist.
	 */	
	private IPath fFileVariablePath;
	
	private IStatus fNameStatus;
	
	private Set fExistingEntries;
	private VariablePathDialogField fFileNameField;
	private CLabel fFullPathResolvedLabel;
	/**
	 * Constructor for EditVariableEntryDialog.
	 * @param parent
	 */
	public EditVariableEntryDialog(Shell parent, IPath initialEntry, IPath[] existingEntries) {
		super(parent);
		setTitle(NewWizardMessages.EditVariableEntryDialog_title); 
		
		fExistingEntries= new HashSet();