FINERACT-803 fix exception handling for username duplication

This commit is contained in:
Sidney Wasibani
2020-01-10 16:38:44 +01:00
committed by Michael Vorburger ⛑️
parent a93a6b8487
commit ff702dbd19
3 changed files with 158 additions and 13 deletions
@@ -1,4 +1,4 @@
/**
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.EntityExistsException;
import javax.persistence.PersistenceException;
import org.apache.commons.lang.exception.ExceptionUtils;
@@ -65,6 +64,7 @@ import org.springframework.cache.annotation.Caching;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -164,13 +164,13 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements AppUserWrit
} catch (final DataIntegrityViolationException dve) {
handleDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
return CommandProcessingResult.empty();
}catch (final PersistenceException | AuthenticationServiceException dve) {
Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()) ;
} catch (final JpaSystemException | PersistenceException | AuthenticationServiceException dve) {
Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()) ;
handleDataIntegrityIssues(command, throwable, dve);
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
.build();
}catch (final PlatformEmailSendException e) {
} catch (final PlatformEmailSendException e) {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final String email = command.stringValueOfParameterNamed("email");
@@ -257,8 +257,8 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements AppUserWrit
} catch (final DataIntegrityViolationException dve) {
handleDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
return CommandProcessingResult.empty();
}catch (final PersistenceException | AuthenticationServiceException dve) {
Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()) ;
} catch (final JpaSystemException | PersistenceException | AuthenticationServiceException dve) {
Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()) ;
handleDataIntegrityIssues(command, throwable, dve);
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //