Compare commits
No commits in common. "1673f1680bcf8616b55ada1aa5c4908581f89692" and "0326bde2098bd7a491f0733dd0c1554b4803a247" have entirely different histories.
1673f1680b
...
0326bde209
@ -1,26 +0,0 @@
|
||||
package org.kar.archidata.catcher;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.ext.ExceptionMapper;
|
||||
|
||||
public class ConstraintViolationExceptionCatcher implements ExceptionMapper<ConstraintViolationException> {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ConstraintViolationExceptionCatcher.class);
|
||||
|
||||
@Override
|
||||
public Response toResponse(final ConstraintViolationException exception) {
|
||||
LOGGER.warn("Catch ConstraintViolationException: {}", exception.getLocalizedMessage());
|
||||
final RestErrorResponse ret = build(exception);
|
||||
LOGGER.error("Error OID={}", ret.oid);
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity(ret).type(MediaType.APPLICATION_JSON).build();
|
||||
}
|
||||
|
||||
private RestErrorResponse build(final ConstraintViolationException exception) {
|
||||
return new RestErrorResponse(Response.Status.BAD_REQUEST, "Constraint Violation", exception.getMessage());
|
||||
}
|
||||
|
||||
}
|
@ -19,7 +19,6 @@ public class GenericCatcher {
|
||||
rc.register(FailExceptionCatcher.class);
|
||||
// generic Exception catcher
|
||||
rc.register(ExceptionCatcher.class);
|
||||
rc.register(ConstraintViolationExceptionCatcher.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import org.kar.archidata.exception.DataAccessException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.Nullable;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import jakarta.ws.rs.InternalServerErrorException;
|
||||
|
||||
@ -190,7 +189,6 @@ public class DataAccess {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T, ID_TYPE> T get(final Class<T> clazz, final ID_TYPE id, final QueryOption... options)
|
||||
throws Exception {
|
||||
try (DBAccess db = DBAccess.createInterface()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user