diff --git a/hawkbit-repository/hawkbit-repository-jpa-eclipselink/src/main/java/org/eclipse/hawkbit/repository/jpa/HawkbitEclipseLinkJpaDialect.java b/hawkbit-repository/hawkbit-repository-jpa-eclipselink/src/main/java/org/eclipse/hawkbit/repository/jpa/HawkbitEclipseLinkJpaDialect.java index 79f52b69d..5336f64bb 100644 --- a/hawkbit-repository/hawkbit-repository-jpa-eclipselink/src/main/java/org/eclipse/hawkbit/repository/jpa/HawkbitEclipseLinkJpaDialect.java +++ b/hawkbit-repository/hawkbit-repository-jpa-eclipselink/src/main/java/org/eclipse/hawkbit/repository/jpa/HawkbitEclipseLinkJpaDialect.java @@ -69,6 +69,8 @@ class HawkbitEclipseLinkJpaDialect extends EclipseLinkJpaDialect { codes.setDataIntegrityViolationCodes(DATA_INTEGRITY_VIOLATION_CODES); SQL_EXCEPTION_TRANSLATOR.setSqlErrorCodes(codes); + // explicitly set old translator as a fallback (uses Subclass translator by default) + SQL_EXCEPTION_TRANSLATOR.setFallbackTranslator(new SQLStateSQLExceptionTranslator()); } @Override diff --git a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/RestConfiguration.java b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/RestConfiguration.java index e86eecd10..13e98f403 100644 --- a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/RestConfiguration.java +++ b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/RestConfiguration.java @@ -96,6 +96,7 @@ public class RestConfiguration { private static final HttpStatus DEFAULT_RESPONSE_STATUS = HttpStatus.INTERNAL_SERVER_ERROR; private static final String MESSAGE_FORMATTER_SEPARATOR = " "; + private static final String LOG_EXCEPTION_FORMAT = "Handling exception {} of request {}"; static { ERROR_TO_HTTP_STATUS.put(SpServerError.SP_REPO_ENTITY_NOT_EXISTS, HttpStatus.NOT_FOUND); @@ -278,7 +279,7 @@ public class RestConfiguration { if (log.isDebugEnabled()) { logRequest(request, ex); } else { - log.error("Handling exception {} of request {}", ex.getClass().getName(), request.getRequestURL()); + log.error(LOG_EXCEPTION_FORMAT, ex.getClass().getName(), request.getRequestURL()); } final ExceptionInfo response = new ExceptionInfo(); @@ -298,9 +299,9 @@ public class RestConfiguration { // -> logging.level.org.eclipse.hawkbit.rest.RestConfiguration=TRACE private void logRequest(final HttpServletRequest request, final Exception ex) { if (log.isTraceEnabled()) { - log.trace("Handling exception {} of request {}", ex.getClass().getName(), request.getRequestURL(), ex); + log.trace(LOG_EXCEPTION_FORMAT, ex.getClass().getName(), request.getRequestURL(), ex); } else { - log.debug("Handling exception {} of request {}", ex.getClass().getName(), request.getRequestURL()); + log.debug(LOG_EXCEPTION_FORMAT, ex.getClass().getName(), request.getRequestURL()); } }