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

Bug 324750

Summary: [UI] JsDoc location cannot be edited via the User Libraries pref page
Product: [WebTools] JSDT Reporter: Michael Rennie <Michael_Rennie>
Component: GeneralAssignee: Project Inbox <jsdt.javascript-inbox>
Status: NEW --- QA Contact: Chris Jaun <cmjaun>
Severity: normal    
Priority: P3 CC: adrianp.quatinus, cmjaun
Version: 3.2   
Target Milestone: Future   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Michael Rennie CLA 2010-09-08 10:36:17 EDT
build id: 20100813105432

Steps

1. new workspace
2. navigate to the JavaScript > User Libraries pref page
3. add a new lib and add a folder to the new lib
4. expand the new lib and select the JsDoc entry
5. press the edit button

Expected

I would be presented with a way to edit the JsDoc location

Happens

Nothing. No error log entries.
Comment 1 Adrian Price CLA 2015-09-02 04:36:22 EDT
I stepped through this code in the debugger: the inability to edit is caused by a MalformedURLException thrown from the org.eclipse.wst.jsdt.internal.ui.wizards.buildpaths.JavadocAttributeConfiguration.performEdit() method at JavadocAttributeConfiguration.java line 80:

	public IIncludePathAttribute performEdit(Shell shell, ClasspathAttributeAccess attribute) {
		String initialLocation= attribute.getClasspathAttribute().getValue();
		String elementName= attribute.getParentClasspassEntry().getPath().lastSegment();
		try {
			URL locationURL= initialLocation != null ? new URL(initialLocation) : null; // <== line 80
			URL[] result= BuildPathDialogAccess.configureJavadocLocation(shell, elementName, locationURL);
			if (result != null) {
				URL newURL= result[0];
				String string= newURL != null ? newURL.toExternalForm() : null;
				return JavaScriptCore.newIncludepathAttribute(IIncludePathAttribute.JSDOC_LOCATION_ATTRIBUTE_NAME, string);
			}
		} catch (MalformedURLException e) {
			// todo
		}
		return null;
	}

The exception is thrown because the default value for initialLocation is the empty string "", which is not a valid URL. 

line 80 should be amended to read:

			URL locationURL= initialLocation != null && !initialLocation.isEmpty() ? new URL(initialLocation) : null;