Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceCollection NPE in list() #5521

Closed
gregw opened this issue Oct 28, 2020 · 2 comments · Fixed by #5527 or #5523
Closed

ResourceCollection NPE in list() #5521

gregw opened this issue Oct 28, 2020 · 2 comments · Fixed by #5527 or #5523
Assignees

Comments

@gregw
Copy link
Contributor

gregw commented Oct 28, 2020

Jetty version
9.4.x

Description

Caused by: java.lang.NullPointerException: Cannot read the array length because "<local3>" is null
    at java.util.Collections.addAll (Collections.java:5592)
    at org.eclipse.jetty.util.resource.ResourceCollection.list (ResourceCollection.java:423)
    at org.eclipse.jetty.util.resource.Resource.getAllResources (Resource.java:886)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir (AnnotationParser.java:777)
    at org.eclipse.jetty.annotations.AnnotationParser.parse (AnnotationParser.java:735)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call (AnnotationConfiguration.java:172)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run (AnnotationConfiguration.java:465)
@gregw gregw self-assigned this Oct 28, 2020
gregw added a commit that referenced this issue Oct 28, 2020
NPE check.
Note that I cannot work out how the none directory resource was added in the first place, so I was unable to reproduce the exact exception.
gregw added a commit that referenced this issue Oct 28, 2020
Refactor addPath in a simpler way, plus with TODOs to fix issues in 10 when merged.
@joakime
Copy link
Contributor

joakime commented Oct 28, 2020

Looks like the last commit broken jetty-maven-plugin's classloader.

It failed, consistently, across all JDKs.

Exception in thread "Thread-190" java.lang.NoClassDefFoundError: org/testcontainers/utility/PathUtils
	at org.testcontainers.utility.MountableFile.lambda$deleteOnExit$0(MountableFile.java:292)
       at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: org.testcontainers.utility.PathUtils
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)

gregw added a commit that referenced this issue Oct 28, 2020
Minimized changes in 9.  Will do bulk of changes in 10.
gregw added a commit that referenced this issue Oct 28, 2020
Fix from review. remove duplicate line.
@gregw gregw closed this as completed in 6698a31 Oct 28, 2020
gregw added a commit that referenced this issue Oct 28, 2020
Fix constructor and addPath so that all resources in a RC must exist when created.
gregw added a commit that referenced this issue Oct 28, 2020
Ensure that dirs passed to addPath end with / so they can be detected as dirs even if they do not exist.
gregw added a commit that referenced this issue Oct 28, 2020
Cleanup the vestiges of non existent directories detected by resource ending in /
gregw added a commit that referenced this issue Oct 28, 2020
Revert adding paths ending in / as jar:file resource needs them
@gregw gregw linked a pull request Oct 29, 2020 that will close this issue
@gregw
Copy link
Contributor Author

gregw commented Oct 29, 2020

Still work needed in jetty-10

@gregw gregw reopened this Oct 29, 2020
@gregw gregw linked a pull request Oct 29, 2020 that will close this issue
gregw added a commit that referenced this issue Nov 4, 2020
* Fixes #5521 ResourceCollection NPE

Fix constructor and addPath so that all resources in a RC must exist when created.

* Fixes #5521 ResourceCollection NPE

Cleanup the vestiges of non existent directories detected by resource ending in /

* Fixes #5521 ResourceCollection NPE

Revert adding paths ending in / as jar:file resource needs them

* feedback from review

improved javadoc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants