jparams / to-string-verifier

To String Verifier provides an easy and convenient way to test the toString method on your class.
MIT License
32 stars 6 forks source link

Fix issue when the project path contains whitespaces #60

Open Kobee1203 opened 1 year ago

Kobee1203 commented 1 year ago

If we have a project on the computer in a directory that contains spaces (example: C:\Documents and Settings\Projects\MyProject), the library resolves the path of the directories by calling the method URL.getFile(). The paths contain %20 characters instead of spaces. When the library checks if the directory exists (File.exists()), then it does not find the directory.

The solution is to replace URL.getFile() by URL.toURI().getPath().

References : https://community.oracle.com/tech/developers/discussion/2058345/url-getfile-outputs-20-as-space https://stackoverflow.com/questions/3263560/sysloader-getresource-problem-in-java