wocommunity / wolips

wolips
53 stars 53 forks source link

bugfix for eclipse bug 145096 where filelocator returns broken url #123

Closed Wolfy42 closed 9 years ago

Wolfy42 commented 9 years ago

Project- and Component-Templates are not working when there is a SPACE in the path to the eclipse installation.

There is an old eclipse-bug which results in FileLocator.toFileURL returning an broken URL when there are spaces in the path. The eclipse bug for this problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=145096

The problem is that eclipse is using the deprecated file.toURL() in FileBundleEntry.getFileURL(). This method is deprecated with the message:

Deprecated. This method does not automatically escape characters that are illegal in URLs. It is recommended that new code convert an abstract pathname into a URL by first converting it into a URI, via the toURI method, and then converting the URI into a URL via the URI.toURL method.

The correct method to use in the getFileURL-Method would have been file.toURI().toURL().

As a workaround for this problem eclipse has the URIUtil.toURI method with the following description:

Returns the URL as a URI. This method will handle URLs that are not properly encoded (for example they contain unencoded space characters).

This bugfix uses this URIUtil-Method to fix the problem.

Steps to reproduce the problem