Answer
The toURL() method of File does not properly escape characters that aren't valid in a URL. You can write better code today without waiting for Java 6 by calling the toURL() method after calling toURI() on a File object:
URL url1 = file.toURL(); // bad
URL url2 = file.toURI().toURL(); //good
Is this item
helpful? yes no
Previous votes Yes: 2 No: 0
|
|
Comments and alternative answers
There are currently no comments
|
|
 |
|