Modify

Opened 18 years ago

Closed 17 years ago

#202 closed defect (fixed)

Wrong URL sometimes generated on Windows

Reported by: anonymous Owned by: josm@…
Priority: major Milestone:
Component: Core Version: tested
Keywords: Cc:

Description

Sometimes the wrong url is generated on Windows, making it impossible to read the plugin jar. The correct way to generate a URL from a File in Java is file.toURI().toURL() . (file.toURL() by itself has bugs that the Java developers felt they couldn't fix without breaking backwards compatibility).

Attachments (1)

josmpatch.txt (721 bytes ) - added by anonymous 18 years ago.
patch against latest svn that fixes the problem

Download all attachments as: .zip

Change History (5)

by anonymous, 18 years ago

Attachment: josmpatch.txt added

patch against latest svn that fixes the problem

comment:1 by imi, 18 years ago

Resolution: fixed
Status: newclosed

comment:2 by imi, 18 years ago

Resolution: fixed
Status: closedreopened

patch doesn't work. Please describe when wrong URLs are generated and what these URLs are.

comment:3 by anonymous, 18 years ago

Sorry this is getting to you late. I typed in a long response like a week ago, but I guess I must not have submitted it correctly. I went to check on this bug today and noticed that the reply wasn't there, so here it is again.

My JOSM plugin directory is on a Windows network drive. The location is
server\docs$\username\Application Data\JOSM\plugins\.

new URL(getURLString(file.getAbsolutePath())) returns
file:/server/docs$/username/Application Data/JOSM/plugins/annotation-tester.jar

That url produces a FileNotFoundException.

Replacing that code with file.toURI().toURL() yeilds
file://server/docs$/username/Application%20Data/JOSM/plugins/annotation-tester.jar

I don't know if it's the space or the missing slash after the colon that causes the problem, but it could well be both. According to the Javadocs for File, file.toURI().toURL() is the recommended way to turn a file into a URL.

comment:4 by Gabriel Ebner <ge@…>, 17 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in r504.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain josm@….
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.