org.springframework.dao.UncategorizedDataAccessException Java Examples

The following examples show how to use org.springframework.dao.UncategorizedDataAccessException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HawkBitEclipseLinkJpaDialectTest.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@Test
@Description("Use Case: PersistenceException that could not be mapped by EclipseLinkJpaDialect directly but instead is wrapped"
        + " into JpaSystemException. Cause of PersistenceException is not an SQLException.")
public void jpaSystemExceptionWithNumberFormatExceptionIsNull() {
    final PersistenceException persEception = mock(PersistenceException.class);
    when(persEception.getCause()).thenReturn(new NumberFormatException());

    assertThat(hawkBitEclipseLinkJpaDialectUnderTest.translateExceptionIfPossible(persEception))
            .isInstanceOf(UncategorizedDataAccessException.class);
}
 
Example #2
Source File: RestServiceExceptionMapper.java    From syncope with Apache License 2.0 5 votes vote down vote up
private static ResponseBuilder processBadRequestExceptions(final Exception ex) {
    // This exception might be raised by Flowable (if enabled)
    Class<?> ibatisPersistenceException = null;
    try {
        ibatisPersistenceException = Class.forName("org.apache.ibatis.exceptions.PersistenceException");
    } catch (ClassNotFoundException e) {
        // ignore
    }

    if (ex instanceof WorkflowException) {
        return builder(ClientExceptionType.Workflow, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ex instanceof PersistenceException) {
        return builder(ClientExceptionType.GenericPersistence, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ibatisPersistenceException != null && ibatisPersistenceException.isAssignableFrom(ex.getClass())) {
        return builder(ClientExceptionType.Workflow, "Currently unavailable. Please try later.");
    } else if (ex instanceof UncategorizedDataAccessException) {
        return builder(ClientExceptionType.DataIntegrityViolation, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ex instanceof ConfigurationException) {
        return builder(ClientExceptionType.InvalidConnIdConf, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ex instanceof ParsingValidationException) {
        return builder(ClientExceptionType.InvalidValues, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ex instanceof MalformedPathException) {
        return builder(ClientExceptionType.InvalidPath, ExceptionUtils.getRootCauseMessage(ex));
    }

    return null;
}
 
Example #3
Source File: ProductEventConsumer.java    From integration-patterns with MIT License 4 votes vote down vote up
@Inject
protected ProductEventConsumer(ProductEventProcessor messageProcessor, UnprocessableEventService unprocessableEventService) {
    super(messageProcessor, unprocessableEventService,
            ImmutableSet.of(UncategorizedDataAccessException.class, TransientDataAccessException.class,
                    CannotCreateTransactionException.class));
}