| Summary: | WST code assumes IResource.getLocation() returns a non-null value | ||
|---|---|---|---|
| Product: | [WebTools] WTP Source Editing | Reporter: | John O'Shea <john.oshea> |
| Component: | wst.sse | Assignee: | Nitin Dahyabhai <thatnitind> |
| Status: | RESOLVED FIXED | QA Contact: | Nitin Dahyabhai <thatnitind> |
| Severity: | major | ||
| Priority: | P2 | CC: | csalter, david.black, david_williams, itewksbu |
| Version: | 1.5 | ||
| Target Milestone: | 3.2 M4 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Attachments: | |||
|
Description
John O'Shea
I've reveiwed the steps I outlined below to double check them and actually found that the FTP file sytem implementation isn't the most reliable to use (especially with a Windows XP FTP server). Aplogies for that, I didn't realise as I was testing using a lightweight HTTP based EFS file system plugin*. I'm attaching a build of this HTTP IFilesystem plugin that may help simplify your reproducing this problem. To reiterate, the problem is primarily that WTP XML/SSE editors cannot sucessfully open an XML IResource that is actually a workspace link to a URI that is resolved by a non-local EFS IFileSystem implementation. To reproduce: 1) Install the attached com.capeclear.filesystem.http plugin in your eclipse runtime 2) Place the attached .wsdl and .xml files onto a local web server (e.g. local apache or tomcat server). The default root URL (assumed by the project below) is http://localhost:8000/) 3) Fire up Eclipse and import the attached testlink project. 4) If your HTTP server is not at the above URL, edit the .project file and change each <locationURI> element to point to the correct location for each resource. 5) In the Navigator view, try opening the linked files. You should notice NullPointerExceptions being logged to the Error Log as well as exception dialogs being presented to the user. (By the way, I'm not yet certain what the little yellow decorator on the bottom right hand corner of link resource in the Navigator view signifies. It might be to signify that the resource is read-only as the underlying HTTP EFS filestore declares itself to be read-only. Either way, it is not relevant to this test scenario.) The main problems that I'm seeing throughout the code are 1) General assumptions that IFile locations are always on the local file system. This is no longer the case in Eclipse 3.2, hence IResource.getLocation() returning null. 2) There seems to be quite a lot of URIResolver related code that assumes that XML/WSDL <import> element "location" attributes only contain URLs that can ultimately be resolved to a path on the local file system. This assumption is invalid - import locations can be any valid URL (e.g. http://) as i the examples above. I'm attaching a number of example patches for various classes in WST SSE and WST XML that I've had to modify in order to get rid of the NullPointerExceptions while simply loading linked resources. I'm afraid I'm not certain that these patches don't break other pieces of the editors (specifically the URI Resolver code) so I don't think they are suitable as-is. However, they do allow me to open and validate files that are loaded via my HTTP IFileSystem so they might be an interim improvment if they do not break any existing functionality. Those more familiar with the SSE/XML code would know better. * The source for this HTTP based file system will be made publically available via a CVS server on developer.capeclear.com later this week hopefully. For the moment you can assume that the implementation will happily attempt to load any HTTP:// resource you point it at (from any HTTP 1.0 compliant server) Created attachment 49941 [details] HTTP EFS IFileSystem provider. See comment #2 Created attachment 49943 [details]
Sample XML file for deployment onto HTTP server.
Created attachment 49944 [details]
Sample XML file for deployment onto HTTP server.
Created attachment 49945 [details]
Sample XML file for deployment onto HTTP server.
Created attachment 49946 [details]
Sample project (zipped) containing links to resources on a HTTP server.
CCing Craig so he can follow along on any URI Resolver-related issues. Created attachment 50013 [details]
Example patch of some mods I made to WST sse/xml code to eliminate NPE's
(Forgot to attach this yesterday)
Note, I'm not suggesting this patch is a complete fix. I think the sse/xml code need a more complete review to identify the correct solutions - there seems to be quite a few areas where the assumptions outlined in this bug were made.
These patches "work for me" in the scenarios I am testing, though might break some other use cases.
The source code for the HTTP EFS IFileSystem provider is now available at http://developer.capeclear.com/?q=cvsrepo if you want it... As of WTP 3.2 ModelManagerImpl#calculateURIResolver checks for null FileBufferModelManager#createURIResolver does not use IResource.getLocation() but uses IFileBuffer#getLocation which should not be an issue because a file buffer should always have a location AbstractNestedValidator.validate does check for null Thus it is about time this one get resolved. (In reply to comment #10) > As of WTP 3.2 > > ModelManagerImpl#calculateURIResolver checks for null > FileBufferModelManager#createURIResolver does not use IResource.getLocation() > but uses IFileBuffer#getLocation which should not be an issue because a file > buffer should always have a location > AbstractNestedValidator.validate does check for null > > Thus it is about time this one get resolved. Actually #getLocation() is still called, but it is checked for null when doing so. Resolving courtesy of the last fix in bug 296022. |