vancetang / reflections

Automatically exported from code.google.com/p/reflections
Do What The F*ck You Want To Public License
0 stars 0 forks source link

Cannot find items when there is a path in classpath that is parent of another jar #59

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When there is a path in the classpath that is a parent of another jar in the 
classpath, no items are found by Reflections.

In my case, I had "somejar::anotherjar" in the classpath.  Note the two colons. 
 That resolved to my current working dir (we'll say /foo), which has my jars a 
few subdirectories deep.

Jar:
/foo/sub/dir/somejar.jar

Current working directory (in classpath):
/foo

getBaseUrl(url,baseUrls) does (in part):

            //try to return the base url
            for (URL baseUrl : baseUrls) {
                String path2 = Vfs.normalizePath(baseUrl);
                if (path1.startsWith(path2)) {
                    return baseUrl;
                }
            }

"/foo/sub/dir/somejar.jar".startsWith("/foo") returns true and the baseUrl 
"/foo" is returned.  

Subsequently no items are found by Reflections.

If I remove the /foo path (::) from the classpath, Reflections works normally.

I am using Reflections 0.9.5-RC2 on both Solaris and OSX.

Original issue reported on code.google.com by ericparu...@gmail.com on 2 Nov 2010 at 10:44

GoogleCodeExporter commented 9 years ago
fixed on trunk

Original comment by ronm...@gmail.com on 12 May 2011 at 7:49