-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
[BUG] NPE in org.exist.xquery.functions.securitymanager.IdFunction #4670
Comments
@nverwer Thanks for this, I appreciate the sentiment. However, the issue you describe indicates a bug at a lower-level in eXist-db as the Unfortunately this PR would simply hide that bug. I think hiding such bugs is not really what we should do, and so I am reluctant to merge this PR. Perhaps it would be worth looking at all sites where an |
There is no indication in |
We should always guard against NPEs. To not hide bugs we could throw a more meaningful error. |
Should not we reopen this so it has a bit more visibility? 'completed' does not sound quite right. Is a solution like this possible? @adamretter |
Describe the bug
In
/exist-core/src/main/java/org/exist/xquery/functions/securitymanager/IdFunction.java
an NPE can occur when thesm:id()
function is called. This happens whencontext.getRealUser()
returnsnull
.Expected behavior
When
context.getRealUser()
returns null, the<sm:real>
element should be empty, or absent.To Reproduce
This happens when an XQuery script is called from a web application, after eXist has been restarted. However, I cannot come up with a simple reliable example.
Context (please always complete the following information):
Additional context
The NPE occurs in
Here,
subject
may be null, since is is obtained fromcontext.getRealUser()
, which may be null.Proposed fix
I will make a PR, with a proposed solution avoiding the NPE.
The text was updated successfully, but these errors were encountered: