Join GitHub today
NPE in org.exist.xquery.functions.fn.FunId#getId() #1642
Reported by craigberry on exist-open
I have a web app that is a variant of TEI Simple and it has a search form that works in 3.4.0 but breaks in 3.5.0 (and is still broken the same way in 3.6.0). Thanks to the "Copy as curl" feature in my browser, the form submission boils down to:
The result of that request is in the file attached here as search_test_350.html. It consists mostly of a 2500-line Java stack dump. Changing GET to POST makes no difference as far as the error I get. The heart of the matter seems to be somewhere around here:
Caused by: javax.servlet.ServletException: An error occurred while processing request to /exist/apps/shc/works/search.html: An unknown error occurred: null
Caused by: javax.servlet.ServletException: An unknown error occurred: null
This problem has in common with GitHub issue #1612 (#1612) blowing up on the same line in XQueryURLRewrite.java, but there it's an out of range exception rather than null exception as here, and I have no non-ASCII characters in my URL, which seems to be part of the problem there. I should also note that other parts of the app, including other form submissions, seem to be fine. A corollary of that is that I don't know how to make a smaller reproducer.
Since I'm getting an exception caused by a null in some code that was explicitly changed to return null in commit a9c76a0, I'm going to take a wild guess that the problem is somehow related to that commit:
The rather cryptic commit message says, in its entirety, "Node#getNamespaceURI and Node#getPrefix must return null unless a namespace or prefix is explicitly set at creation time." Why must they? Creation time of what, the HTTP request? Is there something I should be looking for in my namespace declarations or form submission that would get the namespace set?
In case it matters, I'm running on macOS Sierra (10.12.6) and I've used the .dmg installers for 3.4.0, 3.5.0, and 3.6.0. I've confirmed that downgrading to 3.4.0 fixes the problem. And my Java version:
$ java -version