Skip to content

[11.1.x] ClassPathUtil doesn't work with Bundle-ClassPath equals to "." #2106

@nicolasbron

Description

@nicolasbron

#2105

When the Bundle-ClassPath contains "." the java classes are not correctly scanned to search for jakarta annotations. The problem is with:
https://github.com/ops4j/org.ops4j.pax.web/blob/pax-web-11.0.x/pax-web-api/src/main/java/org/ops4j/pax/web/utils/ClassPathUtil.java#L165

        final String bundleClasspath = bundle.getHeaders() == null ? null
				: bundle.getHeaders().get(Constants.BUNDLE_CLASSPATH);
		if (bundleClasspath == null) {
			// fallback to just root directory of the bundle
			return new URL[] { bundle.getEntry("/") };
		} else {
			String[] segments = bundleClasspath.split("\\s*,\\s*");
			for (String segment : segments) {
				final URL url = bundle.getEntry(segment);
				if (url == null) {
					continue;
				}

When the segment is equal "." the bundle.getEntry(".") returns null. It has to be "/" instead probably. I believe that there should be a check. If segment == "." then use "/" instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions