Andrew Merkle
40 minutes ago
I have a Grouper Web Service question. We seem to be encountering a 500 error when a 404 might be more appropriate when querying for a stem that does not exist.
We build a JSON payload and post to https://dev.grouper.it.vt.edu/grouper-ws/servicesRest/v2_6_000/stems
{"WsRestFindStemsRequest":{"wsStemLookups":[
{"stemName":"dpt:sis:doesnotexist"}
]}}
This stem does not exist, but instead of a 404 or an empty result set we get a 500: NullPointerException
{"WsFindStemsResults":{"resultMetadata":
{"resultCode":"EXCEPTION","resultMessage":"clientVersion: 2.6.0, wsStemQueryFilter: null, actAsSubject: null\n, params: null\n, wsStemLookups: Array size: 1: [0]: WsStemLookup[stemName=dpt:sis:doesnotexist]\n, java.lang.NullPointerException: Cannot invoke \"java.lang.Comparable.compareTo(Object)\" because \"k1\" is null\n\tat java.base/java.util.TreeMap.compare(TreeMap.java:1569)\n\tat java.base/java.util.TreeMap.addEntryToEmptyMap(TreeMap.java:776)\n\tat java.base/java.util.TreeMap.put(TreeMap.java:785)\n\tat java.base/java.util.TreeMap.put(TreeMap.java:534)\n\tat java.base/java.util.TreeSet.add(TreeSet.java:255)\n\tat edu.internet2.middleware.grouper.ws.GrouperServiceLogic.findStems(GrouperServiceLogic.java:1040)\n\tat edu.internet2.middleware.grouper.ws.coresoap.GrouperService.findStems(GrouperService.java:347)\n\tat edu.internet2.middleware.grouper.ws.rest.GrouperServiceRest.findStems(GrouperServiceRest.java:1019)\n\tat edu.internet2.middleware.grouper.ws.rest.method.GrouperWsRestGet$6.service(GrouperWsRestGet.java:347)\n\tat edu.internet2.middleware.grouper.ws.rest.method.GrouperRestHttpMethod$1.service(GrouperRestHttpMethod.java:57)\n\tat edu.internet2.middleware.grouper.ws.rest.GrouperRestServlet.service(GrouperRestServlet.java:202)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:583)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:212)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156)\n\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156)\n\tat edu.internet2.middleware.grouper.ws.GrouperServiceJ2ee.doFilter(GrouperServiceJ2ee.java:1088)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156)\n\tat edu.internet2.middleware.grouper.authentication.plugin.filter.SecurityFilterDecorator.doFilter(SecurityFilterDecorator.java:45)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156)\n\tat edu.internet2.middleware.grouper.authentication.plugin.filter.CallbackFilterDecorator.doFilter(CallbackFilterDecorator.java:48)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156)\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168)\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)\n\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:483)\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)\n\tat org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:679)\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346)\n\tat org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:617)\n\tat org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)\n\tat org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:934)\n\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1698)\n\tat org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)\n\tat org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)\n\tat org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)\n\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)\n\tat java.base/java.lang.Thread.run(Thread.java:840)","success":"F"}
,"responseMetadata":{"millis":"158","serverVersion":"4.12.0"}}}
Posting a stem that does exist returns a 200 and the object as expected.
Are we doing it wrong? Any thoughts?
1 reply
Chris Hyzer
< 1 minute ago
seems like a big we can fix, will look into it