sharanggupta commented on code in PR #28313:
URL: https://github.com/apache/camel/pull/28313#discussion_r4353288031
##########
core/camel-support/src/main/java/org/apache/camel/support/scan/DefaultPackageScanClassResolver.java:
##########
@@ -344,8 +344,12 @@ protected List<String> doLoadJarClassEntries(InputStream
stream, String urlPath)
*/
private void doLoadImplementationsInJar(
PackageScanFilter test, String parent, List<String> entries,
Set<Class<?>> classes) {
+ // only entries inside the parent package (or its sub packages)
qualify, not entries of a sibling
+ // package whose name merely starts with the same characters
(com/acme/routes vs com/acme/routesupport),
+ // which is also what the directory based scanning does
+ String prefix = parent == null || parent.isEmpty() ||
parent.endsWith("/") ? parent : parent + "/";
for (String entry : entries) {
- if (entry.startsWith(parent)) {
+ if (prefix == null || entry.startsWith(prefix)) {
addIfMatching(test, entry, classes);
Review Comment:
Good catch, done in f5fc266533: the null arm is gone and the loop checks
`entry.startsWith(prefix)` directly. `find()` turns the root package into `""`
before reaching this method, so an empty prefix keeps the whole-JAR behaviour
and a null `parent` now fails fast instead of silently scanning everything.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]