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

NPE in org.exist.xquery.functions.fn.FunId#getId() #1642

Closed
dizzzz opened this Issue Dec 3, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@dizzzz
Member

dizzzz commented Dec 3, 2017

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:

curl 'http://localhost:8080/exist/apps/shc/works/search.html?query=justice&field=text&lucene-query-mode=any&tei-target=tei-text'
-XGET

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
at org.exist.http.urlrewrite.XQueryURLRewrite.service(XQueryURLRewrite.java:381)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

and here:

Caused by: javax.servlet.ServletException: An unknown error occurred: null
at org.exist.http.servlets.EXistServlet.doPost(EXistServlet.java:478)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

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:

a9c76a0#diff-88285676e2d4cdf4bde12b4f92e821ca

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
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Trace.txt

adamretter added a commit that referenced this issue Dec 5, 2017

Merge pull request #1644 from dizzzz/bugfix/NPE-in-org.exist.xquery.f…
…unctions.fn.FunId

Fix for #1642 NPE in org.exist.xquery.functions.fn.FunId

@adamretter adamretter closed this Dec 9, 2017

RemiKoutcherawy added a commit to RemiKoutcherawy/exist that referenced this issue Dec 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment