#15 spy.properties file not found when path contains a space

open
nobody
None
5
2013-10-12
2009-01-09
No

p6spy fails to load when the path to the properties file contains a space.

E.g. /E:/Program%20Files/apache-tomcat-5.5.26/webapps/myapp/WEB-INF/classes/spy.properties

We narrowed the problem to classLoadPropertyFile() in P6Util.java. The solution is to decode the URL path before passing it to the File constructor:

public static File classLoadPropertyFile(java.net.URL purl) {
try {
if (purl != null) {
// modified by jayakumar for JDK 1.2 support
//return new File(purl.getPath());
// return new File(getPath(purl));

// modified by davidmcmeans to handle %20's, etc. in the URL path
return new File( URLDecoder.decode( purl.getPath(), "UTF-8" ));

// end of modification
}
} catch (Exception e) {
// we ignore this, since JDK 1.2 does not suppport this method
}
return null;
}

Discussion

  • David McMeans

    David McMeans - 2009-01-09

    Modified P6Util.java

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks