mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 21:31:53 +01:00
Don't log errors on NotFoundExceptions in Jetty (#3931)
This commit is contained in:
parent
cb1b355869
commit
04cd8408de
@ -14,6 +14,7 @@ package org.openhab.core.io.rest.core.internal;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.ws.rs.NotFoundException;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.ext.ExceptionMapper;
|
||||
|
||||
@ -50,6 +51,12 @@ public class JSONResponseExceptionMapper implements ExceptionMapper<Exception> {
|
||||
logger.debug("Failed writing HTTP response, since other side closed the connection", e);
|
||||
// Returning null results in a Response.Status.NO_CONTENT response.
|
||||
return null;
|
||||
} else if (e instanceof NotFoundException) {
|
||||
// we catch this exception to avoid confusion errors in the log file, since this is not any error situation
|
||||
// see https://github.com/openhab/openhab-distro/issues/1616
|
||||
logger.debug("Requested resource not (yet) found", e);
|
||||
// Returning null results in a Response.Status.NO_CONTENT response.
|
||||
return Response.status(Response.Status.NOT_FOUND).build();
|
||||
} else {
|
||||
logger.error("Unexpected exception occurred while processing REST request.", e);
|
||||
return delegate.toResponse(e);
|
||||
|
Loading…
Reference in New Issue
Block a user