Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312888 - Problems when entering the linked folder location
Summary: Problems when entering the linked folder location
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 RC2   Edit
Assignee: Serge Beauchamp CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-14 07:17 EDT by Szymon Brandys CLA
Modified: 2010-05-19 07:57 EDT (History)
1 user (show)

See Also:
Szymon.Brandys: review+
tomasz.zarna: review+


Attachments
Patch (2.65 KB, patch)
2010-05-18 06:10 EDT, Serge Beauchamp CLA
no flags Details | Diff
Patch (2.72 KB, patch)
2010-05-18 10:50 EDT, Serge Beauchamp CLA
no flags Details | Diff
Patch (2.61 KB, patch)
2010-05-19 05:05 EDT, Serge Beauchamp CLA
no flags Details | Diff
Screenshot- shows it works (37.35 KB, image/png)
2010-05-19 05:13 EDT, Serge Beauchamp CLA
no flags Details
Shows that "c:/temp/s:" generate the appropriate error message (38.10 KB, image/png)
2010-05-19 05:15 EDT, Serge Beauchamp CLA
no flags Details
Patch (4.81 KB, patch)
2010-05-19 06:52 EDT, Serge Beauchamp CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Szymon Brandys CLA 2010-05-14 07:17:01 EDT
Build id: I20100511-0800

This bug is forked from Bug 310446. 
I noticed that exceptions are written down to the console, while entering the linked folder location in the NewFolder wizard.
For instance:

Steps [1]:
1) Open the NewFolder wizard
2) Go to 'Advanced' and check 'Linked Folder'
3) Type "c:/"

Steps [2]:
1) Open the NewFolder wizard
2) Go to 'Advanced' and check 'Linked Folder'
3) Type "file://c:/"

Steps [3]:
1) Open the NewFolder wizard
2) Go to 'Advanced' and check 'Linked Folder'
3) Type "ne:/" --> ne is non-existing scheme
Comment 1 Serge Beauchamp CLA 2010-05-18 06:10:28 EDT
Created attachment 168892 [details]
Patch

This patch addresses the 3 issues on my machine.  I'll get a hold on a clean WinXP machine to be sure there's no transient issues at hand.
Comment 2 Serge Beauchamp CLA 2010-05-18 10:50:24 EDT
Created attachment 168942 [details]
Patch

Synchronized with head.
Comment 3 Szymon Brandys CLA 2010-05-18 11:12:27 EDT
I think that CreateLinkedResourceGroup#getPathVariableManager can be simplified to this

	private IPathVariableManager getPathVariableManager() {
		if (updatableResourceName.getResource() != null)
			return updatableResourceName.getResource().getPathVariableManager();
		return ResourcesPlugin.getWorkspace().getPathVariableManager();
	}	
	
I tried to enter "file://c:" as the location and the error said " 'c:' already exists.". 
When "c:/temp/s:" is used as the location, I see " 's:' already exists.". On 3.5 it was " : is an invalid character in resource name 's:'.", what gave you an idea where the problem was.
Comment 4 Serge Beauchamp CLA 2010-05-19 05:05:22 EDT
Created attachment 169070 [details]
Patch

Refactor the getPathVariableManager() method as per Szymon's suggestion
Comment 5 Serge Beauchamp CLA 2010-05-19 05:13:28 EDT
Created attachment 169072 [details]
Screenshot- shows it works

>I tried to enter "file://c:" as the location and the error said " 'c:' already
>exists.". 
>When "c:/temp/s:" is used as the location, I see " 's:' already exists.". On
>3.5 it was " : is an invalid character in resource name 's:'.", what gave you
>an idea where the problem was.

As you can see in the attached screenshot, using (on Windows XP SP3):

- a clean eclipse RC1 SDK (eclipse-SDK-3.6RC1-win32.zip - I20100513-1500)
- a clean workspace
- only org.eclipse.ui.ide fetched clean from CVS
- only the patch in this bug report applied

It works fine.  

 - Putting "file://c:" as the location doesn't generate an error, and works perfectly.
 - Putting "c:/temp/s:" as the location gives the following error in the wizard: ' : is an invalid character in resource name 's:', as expected

I'm not sure why you see different results in your case, but something must be different in your environment.  It looks as if the patch isn't applied effectively, or an old version of that class is loaded at runtime.  Maybe you can put a breakpoint in CreateLinkedResourceGroup#getLinkTargetURI() to see that the following code is being executed properly:

	public URI getLinkTargetURI() {
		if (!createLink)
			return null;
		// linkTarget can contain either:
		//  1) a URI, ex: 								foo://bar/file.txt
		//  2) A path, ex: 								c:\foo\bar\file.txt
		//  3) A path variable relative path, ex:		VAR\foo\bar\file.txt
		URI uri;
		try {
			IPath path = Path.fromOSString(linkTarget);
			if (path != null && path.toFile().exists())
				return URIUtil.toURI(path);
			
			uri = new URI(linkTarget);
			URI resolved = getPathVariableManager().resolveURI(uri);
			try {
				EFS.getStore(resolved);
			} catch (CoreException e) {
				return URIUtil.toURI(path);
			}
		}catch(URISyntaxException e) {
			uri = convertToURI(linkTarget);
		}
		return uri;
	}

Btw, I'm using JVM 1.6.0_17
Comment 6 Serge Beauchamp CLA 2010-05-19 05:15:06 EDT
Created attachment 169073 [details]
Shows that "c:/temp/s:" generate the appropriate error message
Comment 7 Tomasz Zarna CLA 2010-05-19 06:13:29 EDT
I applied the latest patch and entered "file://c:" (comment 3). As soon as I added "/" to the path, receiving "file://c:/", I got the following exception in the Error Log:

eclipse.buildId=I20100516-0800
java.fullversion=JRE 1.6.0 IBM J9 2.4 Windows XP x86-32 jvmwi3260sr7-20091214_49398 (JIT enabled, AOT enabled)
J9VM - 20091214_049398
JIT  - r9_20091123_13891
GC   - 20091111_AA
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=pl_PL
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data C:\workspace\eclipse\_runtimes\runtime-EclipseApplication -dev file:C:/workspace/eclipse/team/dev.eclipse.org_HEAD_extssh/.metadata/.plugins/org.eclipse.pde.core/Eclipse/dev.properties -os win32 -ws win32 -arch x86


Error
Wed May 19 12:11:48 CEST 2010
Unhandled event loop exception

java.lang.IllegalArgumentException: Path must include project and resource name: /bug312888
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:1795)
	at org.eclipse.core.internal.resources.Container.getFolder(Container.java:221)
	at org.eclipse.ui.dialogs.WizardNewFolderMainPage$3.getResource(WizardNewFolderMainPage.java:204)
	at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.getPathVariableManager(CreateLinkedResourceGroup.java:605)
	at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.resolveVariable(CreateLinkedResourceGroup.java:575)
	at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.access$2(CreateLinkedResourceGroup.java:574)
	at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup$2.modifyText(CreateLinkedResourceGroup.java:278)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:173)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1076)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Text.wmCommandChild(Text.java:2526)
	at org.eclipse.swt.widgets.Control.WM_COMMAND(Control.java:4296)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4162)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2362)
	at org.eclipse.swt.widgets.Text.callWindowProc(Text.java:255)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4250)
	at org.eclipse.swt.widgets.Text.windowProc(Text.java:2170)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2459)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3655)
	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.actions.NewWizardShortcutAction.run(NewWizardShortcutAction.java:135)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 8 Serge Beauchamp CLA 2010-05-19 06:52:39 EDT
Created attachment 169087 [details]
Patch

Now fixes the exception reported in the .log file.

All raised issues are addressed with this patch.
Comment 9 Szymon Brandys CLA 2010-05-19 07:39:44 EDT
Regarding the "c: already exists" issue, indeed it looks like something with my configuration. The patch looks good to me. Just apply the formatting on the changed/added code.
Comment 10 Tomasz Zarna CLA 2010-05-19 07:54:16 EDT
Looks good now. 

The only thing I would change is the error message saying "A Link location must be specified" when I enter "c:". I did enter the link location so the message could be more precise, and tell me what is wrong with the given location. However, this seems to be a different issue (separate bug).
Comment 11 Serge Beauchamp CLA 2010-05-19 07:57:36 EDT
Now fixed on head.