Affected: services.data.bioontology.org/annotatorplus (BioPortal production)
Deployed version: org.sifrproject:sifr-bioportal-annotator-proxy:0.1-SNAPSHOT
Reproduction
Via curl:
$ curl -sL -H "Authorization: apikey token=<YOUR_API_KEY>" \
"https://services.data.bioontology.org/annotatorplus?text=probiotics"
Returns HTTP 500 with the following stack trace embedded in the response body:
java.lang.NullPointerException
at java.base/java.io.Reader.<init>(Reader.java:167)
at java.base/java.io.InputStreamReader.<init>(InputStreamReader.java:93)
at org.sifrproject.util.RestfulRequest.streamAsString(RestfulRequest.java:60)
at org.sifrproject.util.RestfulRequest.queryAnnotator(RestfulRequest.java:27)
at org.sifrproject.servlet.AnnotatorServlet.doPost(AnnotatorServlet.java:175)
at org.sifrproject.servlet.AnnotatorServlet.doGet(AnnotatorServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:529)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.sifrproject.util.CharacterSetFilter.doFilter(CharacterSetFilter.java:24)
Via the UI: navigate to the AnnotatorPlus page, insert the sample text, and click "Get annotations". The Rails application displays: Problem getting annotations, please try again.
Diagnosis
The NPE is the visible symptom, not the root cause. Initial investigation suggests the proxy is hitting an upstream redirect (HTTPS → HTTP) that Java's HttpURLConnection refuses to follow by default, and the response-handling code in RestfulRequest.queryAnnotator doesn't tolerate the resulting state — it calls getErrorStream() on a 3xx response, which returns null, and streamAsString(null) then NPEs in the InputStreamReader constructor.
Relates to: ncbo/ontologies_api#217
Affected:
services.data.bioontology.org/annotatorplus(BioPortal production)Deployed version:
org.sifrproject:sifr-bioportal-annotator-proxy:0.1-SNAPSHOTReproduction
Via curl:
Returns HTTP 500 with the following stack trace embedded in the response body:
Via the UI: navigate to the AnnotatorPlus page, insert the sample text, and click "Get annotations". The Rails application displays: Problem getting annotations, please try again.
Diagnosis
The NPE is the visible symptom, not the root cause. Initial investigation suggests the proxy is hitting an upstream redirect (HTTPS → HTTP) that Java's
HttpURLConnectionrefuses to follow by default, and the response-handling code inRestfulRequest.queryAnnotatordoesn't tolerate the resulting state — it callsgetErrorStream()on a 3xx response, which returns null, andstreamAsString(null)then NPEs in theInputStreamReaderconstructor.Relates to: ncbo/ontologies_api#217