-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix various issues with JarFileScanner #132
Conversation
Overview:
- Previously JarFileScanner assumed backslashes to be the platform independent
file separator for zip files. This is incorrect (and in fact, the associated
unit tests did assume forward slashes, using "javax/ws/rs" to denote the
package "javax.ws.rs"). See [1] for details.
- As a result the non-recursive scanning mode was broken: failing to find the
backslash delimiter, the scanner would return classes from subpackages even
when it was instructed not to do so. This has been fixed.
- The scanner also did not verify that "matching" classes were in a proper
subdirectory of the indicated package. As a result a class such as
javax.ws.rs.GET was matched for the following "packages":
- javax/ws/r (too short, misses an "s")
- javax/ws/rs/GE (too long, includes class name prefix)
This has been fixed as well.
The class' unit tests were extended to cover the problematic cases. Of the
five new unit tests, three fail prior to the fix.
[1] https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
|
Can one of the admins verify this patch? |
|
Jenkins, please test this patch. |
|
Hi Stephan, thanks for contributing. Regards, |
|
Hi @AdamLindenthal , thanks for having a look. The build passed, so that's a good first sign. Just let me know in case you'd like me to do things differently. |
|
EDIT: Please ignore (erroneous comment, left here just for continuity with the comment bellow)
|
|
Oh sorry for the comment above, this should have belonged to another pull request (and of course with someone other's name)! |
|
No problem ;) |
Fix various issues with JarFileScanner
|
@Stephan202 Thank you for you contribution. |
|
Hi, The package name provided to the I think it worths a JIRA ?! As a fix, for the recursive part, as the parent is a full qualified path (with the trailing slash, e.g.: |
|
Or maybe it is the philosophy of the JarFileScanner to be able to handle full packages path or just a part of the path !
|
|
Clear, thanks for getting back to this. Somewhere this week I'll try to open a PR with a fix that allows the delimiting slash to either be implicit (as the code supports now) or explicit (your use case). |
|
Hi, this may or may not be related (most likely not) to your changes, but it is related to resource scanning. I've found some issues with OSGI scanning. For more details, see https://java.net/jira/browse/JERSEY-2788 (specifically the third comment where I've pinpointed the issue). Regards |
This PR aims to correct the fix for JERSEY-2621 (cc89c97). It also addresses some other edge cases. Details are in the commit message:
NB: I already signed the OCA, in the context of #80.