Project: JDT
Bug 230217 [build path] Improve feedback when importing non-existing user libraries
Reported: 2008-05-05 10:19:20 | Status: verified fixed

Build ID: M20080221-1800 Steps To Reproduce: 1. Open Eclipse for workspace #1. Go to Window > Preferences > Java > Build Path > User libraries. 2. Select a library with at least one Jar and export it to C:\Documents and Settings\user1\My Documents\myUserJars.userlibraries. 3. Edit myUserJars.userlibraries and change the jar paths to use an environment variable for the base directory instead of absolute paths. Paths based off of an environment variable are desirable since I want to use my user library in different workspaces containing different code streams. For example, change the following contents of myUserJars.userLibraries... <?xml version="1.0" encoding="UTF-8" standalone="no"?> <eclipse-userlibraries version="2"> <library name="MyUserJars" systemlibrary="false"> <archive path="C:/Workspace1/MyUserJars/activationlog.jar"/> </library> </eclipse-userlibraries> ...to this... <?xml version="1.0" encoding="UTF-8" standalone="no"?> <eclipse-userlibraries version="2"> <library name="MyUserJars" systemlibrary="false"> <archive path="${env.MYUSERJARS}/activationlog.jar"/> </library> </eclipse-userlibraries> 4. Open Eclipse for workspace #2. Go to Window > Preferences > Java > Build Path > User libraries. 5. Click Import. (Nothing happens. Expected a popup window to select a file to import.) 6. Delete myUserJars.userlibraries from file system. 7. Click Import. (Popup window appears as expected.) 8. Check .log file in workspace #2 directory. Find the stack trace for an unhandled exception. More information: Eclipse IDE for Java EE Developers v3.3.2 (no plugins) is silently throwing an exception when I click the Import button to view a list of *.userLibraries files in the My Documents directory. I previously exported my Jar user library to a *.userLibraries file and changed the paths to use an environment variable for the base directory instead of absolute directories. Eclipse fails to display the user library window or any error when I click the Import button. The only confirmation that I pressed the Import button is a stack trace in the .log file of my workspace directory. Eclipse should at least display an error when I click the Import button. It appears Eclipse tries to read all of the *.userLibraries files in the My Documents directory before showing the library list window, but gives up when it encounters a problem with the contents of one of the *.userLibraries files. Apparently I have to use absolute paths in the *.userLibraries file. It would be nice if I could use variables but that is a change request and I am more interested in just reporting a bug at this time. Here is the stack trace from the .log file of my workspace directory. !ENTRY org.eclipse.ui 4 0 2008-05-05 09:25:30.990 !MESSAGE Unhandled event loop exception !STACK 0 org.eclipse.core.runtime.AssertionFailedException: assertion failed: Path for IClasspathEntry must be absolute at org.eclipse.core.runtime.Assert.isTrue(Assert.java:109) at org.eclipse.jdt.core.JavaCore.newLibraryEntry(JavaCore.java:3829) at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.newClasspathEntry(CPListElement.java:184) at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.getClasspathEntry(CPListElement.java:151) at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.equals(CPListElement.java:460) at java.util.ArrayList.indexOf(Unknown Source) at java.util.ArrayList.contains(Unknown Source) at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPUserLibraryElement.add(CPUserLibraryElement.java:115) at org.eclipse.jdt.internal.ui.preferences.UserLibraryPreferencePage$LoadSaveDialog.loadLibraries(UserLibraryPreferencePage.java:686) at org.eclipse.jdt.internal.ui.preferences.UserLibraryPreferencePage$LoadSaveDialog.updateShownLibraries(UserLibraryPreferencePage.java:375) at org.eclipse.jdt.internal.ui.preferences.UserLibraryPreferencePage$LoadSaveDialog.dialogFieldChanged(UserLibraryPreferencePage.java:399) at org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField.dialogFieldChanged(DialogField.java:71) at org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField.setText(StringDialogField.java:162) at org.eclipse.jdt.internal.ui.preferences.UserLibraryPreferencePage$LoadSaveDialog.<init>(UserLibraryPreferencePage.java:301) at org.eclipse.jdt.internal.ui.preferences.UserLibraryPreferencePage.doLoad(UserLibraryPreferencePage.java:1144) at org.eclipse.jdt.internal.ui.preferences.UserLibraryPreferencePage.doCustomButtonPressed(UserLibraryPreferencePage.java:1018) at org.eclipse.jdt.internal.ui.preferences.UserLibraryPreferencePage$UserLibraryAdapter.customButtonPressed(UserLibraryPreferencePage.java:1344) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.buttonPressed(TreeListDialogField.java:168) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.doButtonSelected(TreeListDialogField.java:386) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.access$2(TreeListDialogField.java:382) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField$2.widgetSelected(TreeListDialogField.java:347) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.jface.window.Window.runEventLoop(Window.java:820) at org.eclipse.jface.window.Window.open(Window.java:796) at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:65) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) 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.equinox.launcher.Main.invokeFramework(Main.java:508) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447) at org.eclipse.equinox.launcher.Main.run(Main.java:1173) at org.eclipse.equinox.launcher.Main.main(Main.java:1148)

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListLabelProvider.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPUserLibraryElement.java