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

Fixes #5521 ResourceCollection list NPE #5523

Merged
merged 4 commits into from Oct 28, 2020

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Oct 28, 2020

Added null check for #5521.
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.

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
Copy link
Contributor Author

gregw commented Oct 28, 2020

@sbordet I'd really like to see some more debug from your test case, as I can't see how it was able to add a resource that does not exist.

@gregw
Copy link
Contributor Author

gregw commented Oct 28, 2020

Ah! I've worked out how to reproduce. It can't be reproduced in 9, because we always check if resource exists and can return null.

But in jetty-10, null is not a valid return for addPath, so even if resources to not exist, it uses a new constructor on ResourceCollection that also doesn't check to make a collection of non-existent resources. I will write code in 9.4 that is better structured and fix the 10 issues during the merge to 10.

Refactor addPath in a simpler way, plus with TODOs to fix issues in 10 when merged.
Minimized changes in 9.  Will do bulk of changes in 10.
Fix from review. remove duplicate line.
Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gregw gregw merged commit 6698a31 into jetty-9.4.x Oct 28, 2020
@gregw gregw deleted the jetty-9.4.x-5521-ResourceCollection-NPE branch October 28, 2020 14:24
@gregw gregw linked an issue Oct 29, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResourceCollection NPE in list()
2 participants