Nudity / 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

ClasspathHelper.forPackage() does not find URLs for package #103

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a ConfigurationBuilder
2. Add Urls using ClasspathHelper.forPackage()
3. Scan for classes with Reflections.getSubTypesOf()

What is the expected output? What do you see instead?

Reflections.getSubTypesOf() should find the available subclasses in the 
classpath. But instead it does not find any classes and complains with 'given 
scan urls are empty. set urls in the configuration'.

What version of the product are you using? On what operating system?

Version: 0.9.7-SNAPSHOT (Revision 150)
Operating System: Windows 7
Java 1.5.0-22

Please provide any additional information below.

ClasspathHelper.forPackage() first replaces dots in the package name with 
slashes and then escapes the path using Utils.encodePath(resourceName, true). 
On Windows operating system this will encode the slashes in resourceName into 
'%2f' which does no work, because package names always use the slash seperator 
and are included like that in the URL used by the class loader. Like this 
lastIndexOf() does not find the string in the URL.

Example:

name = "com.example"
resourceName = "com/example"
encodedResourceName = "com%2fexample"
url.toExternalForm() = 
  "file:/C:/path/com/example"
  or
  "jar:file:/C:/path/file.jar!/com/example"

Original issue reported on code.google.com by reb...@gmx.ch on 10 Feb 2012 at 1:59

GoogleCodeExporter commented 8 years ago
fixed on 0.9.7-RC1 and trunk. comments?

Original comment by ronm...@gmail.com on 2 May 2012 at 3:46

GoogleCodeExporter commented 8 years ago
Please release new version as soon as possible - this bug is very important

Original comment by vladimir...@gmail.com on 21 May 2012 at 9:59

GoogleCodeExporter commented 8 years ago
fixed 0.9.7

Original comment by ronm...@gmail.com on 22 May 2012 at 7:47