I am trouble shooting a failure in the REST API where exceptions are being gobbled up and not reported.
01 009 18:09:54 WARN [annotation.ExceptionHandlerExceptionResolver] - Failure in @ExceptionHandler org.geoserver.rest.RestControllerAdvice#handleGeneralException(Exception, HttpServletRequest, HttpServletResponse, OutputStream)
java.lang.IllegalArgumentException: No input String specified
at org.springframework.util.Assert.notNull(Assert.java:201)
at org.springframework.util.StreamUtils.copy(StreamUtils.java:142)
at org.geoserver.rest.RestControllerAdvice.handleGeneralException(RestControllerAdvice.java:126
The above warning is due to not performing a null check on e.getMessage() :
public void handleGeneralException(
Exception e, HttpServletRequest request, HttpServletResponse response, OutputStream os)
throws Exception {
// if there is a OGC request active, the exception was not meant for this dispatcher,
// nor it was if it's a security exception, in this case let servlet filters handle it
// instead
if (Dispatcher.REQUEST.get() != null
|| e instanceof AuthenticationException
|| e instanceof AccessDeniedException) {
throw e;
}
LOGGER.log(Level.SEVERE, e.getMessage(), e);
notifyExceptionToCallbacks(request, response, e);
response.setStatus(500);
response.setContentType(MediaType.TEXT_PLAIN_VALUE);
StreamUtils.copy(e.getMessage(), StandardCharsets.UTF_8, os);
}
|