Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 218703

Summary: [LinkedResources] linked folder / file wizards fills error log with errors
Product: [Eclipse Project] Platform Reporter: Christian Vogt <cvogt>
Component: IDEAssignee: Boris Bokowski <bokowski>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, karim
Version: 3.4Keywords: helpwanted
Target Milestone: 3.4 RC1Flags: eclipse: review+
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
mylyn/context/zip
none
updated patch none

Description Christian Vogt CLA 2008-02-12 17:05:46 EST
Build ID: I20080122-0800

Open the File or Folder wizard.
Select a parent folder.
Click the Advanced button.
Check the "Link to file/folder in the file system" checkbox.
Leave the link location text box empty.
Start typing in a file/folder name. Every time the file/folder name text box is modified, the following two errors are logged.

!ENTRY org.eclipse.ui.ide 4 4 2008-02-12 16:59:44.437
!MESSAGE Must specify a URI scheme:

!ENTRY org.eclipse.core.filesystem 4 566 2008-02-12 16:59:44.437
!MESSAGE Must specify a URI scheme:

Note that an error is displayed at the top of the wizard stating "A Link location must be specified". This should be sufficient.
Comment 1 Christian Vogt CLA 2008-02-12 17:14:53 EST
I've also noticed that NPEs are thrown if any other non default file system is selected and the same procedure as above are followed. This happens if the file system returns null for their implementation of FileSystemContributor#getURI(String), which is a valid scenario according to the  javadoc on that method.

This is the error that gets logged:

java.lang.NullPointerException
	at org.eclipse.core.resources.team.TeamHook.validateCreateLink(TeamHook.java:162)
	at org.eclipse.team.internal.core.TeamHookDispatcher.validateCreateLink(TeamHookDispatcher.java:61)
	at org.eclipse.core.internal.resources.LocationValidator.validateLinkLocationURI(LocationValidator.java:108)
	at org.eclipse.core.internal.resources.Workspace.validateLinkLocationURI(Workspace.java:2045)
	at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.validateLinkLocation(CreateLinkedResourceGroup.java:608)
	at org.eclipse.ui.dialogs.WizardNewFileCreationPage.validateLinkedResource(WizardNewFileCreationPage.java:680)
	at org.eclipse.ui.dialogs.WizardNewFileCreationPage.validatePage(WizardNewFileCreationPage.java:726)
	at org.eclipse.ui.dialogs.WizardNewFileCreationPage.handleEvent(WizardNewFileCreationPage.java:556)
	at org.eclipse.ui.internal.ide.misc.ResourceAndContainerGroup.handleEvent(ResourceAndContainerGroup.java:364)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:976)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:957)
	at org.eclipse.swt.widgets.Text.wmCommandChild(Text.java:2423)
	at org.eclipse.swt.widgets.Control.WM_COMMAND(Control.java:3912)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3779)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4458)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2247)
	at org.eclipse.swt.widgets.Text.callWindowProc(Text.java:176)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3866)
	at org.eclipse.swt.widgets.Text.windowProc(Text.java:2067)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4458)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2333)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3367)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:260)
	at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:280)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:252)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:475)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:470)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:165)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:470)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:821)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:879)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:568)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:510)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:126)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1160)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:951)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:976)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:961)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:989)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:985)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1301)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3883)
	at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:5608)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3776)
	at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5604)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4458)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2333)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3367)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2392)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2356)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2222)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:474)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:469)
	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:193)
	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:362)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:615)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:564)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1251)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1227)
Comment 2 Szymon Brandys CLA 2008-04-10 13:19:08 EDT
*** Bug 226479 has been marked as a duplicate of this bug. ***
Comment 3 Boris Bokowski CLA 2008-04-10 23:34:31 EDT
Not sure if I will have the time to fix this for 3.4, but I'll try.
Comment 4 Boris Bokowski CLA 2008-05-02 14:56:54 EDT
Mass update - removing 3.4 target. This was one of the bugs I marked for investigation (and potential fixing) in 3.4 but I ran out of time. Please ping on the bug if fixing it would be really important for 3.4, and does not require API changes or feature work.
Comment 5 Christian Vogt CLA 2008-05-02 15:22:51 EDT
I would like to see this bug fixed. If the file system contributor returns a null location URI, then after CreateLinkedResourceGroup#validateLinkLocation(..) line 607 check if it is null and return a non-OK status instead of proceeding.
Comment 6 Boris Bokowski CLA 2008-05-02 16:00:37 EDT
Created attachment 98499 [details]
patch
Comment 7 Boris Bokowski CLA 2008-05-02 16:00:39 EDT
Created attachment 98500 [details]
mylyn/context/zip
Comment 8 Boris Bokowski CLA 2008-05-02 16:02:04 EDT
Christian, thanks for your help.



Kim, +1?
Comment 9 Christian Vogt CLA 2008-05-02 16:18:01 EDT
Looking at your patch in Comment #6, I do not think this will solve the NPE (I do not have the source available to test).

From the stack trace I provided the trace to the NPE is at line 607:
IStatus locationStatus = workspace.validateLinkLocationURI(linkHandle, locationURI);

At this point the locationURI variable is null because #getLinkTargetURI() can return null if a non-local file system contributor determines the URI to be invalid (as per the javadoc). Therefore prior to validating the link location, return a warning / error status if the locationURI is null.
Comment 10 Boris Bokowski CLA 2008-05-02 16:36:04 EDT
You are right - my patch only solves the original problem described in comment 0, not the NPE from comment 1. I'll attach a new patch on Monday.
Comment 11 Boris Bokowski CLA 2008-05-06 16:13:00 EDT
Created attachment 98939 [details]
updated patch

Kim, +1?
Comment 12 Kim Horne CLA 2008-05-07 08:37:25 EDT
+1
Comment 13 Boris Bokowski CLA 2008-05-07 09:31:53 EDT
Released to HEAD.
Comment 14 Boris Bokowski CLA 2008-05-30 21:52:43 EDT
Verified that the issue from comment #0 cannot be reproduced anymore with I20080530-1730.  Christian, could you please verify the problem you described in comment 1?