Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -22,6 +22,7 @@ import java.io.FileNotFoundException;
|
||||
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -84,6 +85,7 @@ public class ScontriniImportService {
|
||||
entityProcessor.processEntity(entity, multiDBTransactionManager);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
anomalie.add(setAnomalia(e));
|
||||
}
|
||||
entitiesReturn.add(entity);
|
||||
@@ -111,31 +113,37 @@ public class ScontriniImportService {
|
||||
}
|
||||
|
||||
private AnomalieDTO setAnomalia(Exception e) {
|
||||
AnomalieDTO anomalia = new AnomalieDTO();
|
||||
if (e instanceof EntityException) {
|
||||
if (((EntityException) e).getSqlErrorCode() != null) {
|
||||
if (((EntityException) e).getSqlErrorCode() == 1205) {
|
||||
//deadlock
|
||||
anomalia.setTipo(AnomalieDTO.Type.ERROR);
|
||||
anomalia.setMessage(e.getMessage());
|
||||
return AnomalieDTO.error(e);
|
||||
} else if (((EntityException) e).getSqlErrorCode() == 2627) {
|
||||
//pk exception
|
||||
anomalia.setTipo(AnomalieDTO.Type.WARNING);
|
||||
anomalia.setMessage(e.getMessage());
|
||||
return AnomalieDTO.warning(e.getMessage());
|
||||
}
|
||||
}
|
||||
} else if (e instanceof SQLException) {
|
||||
if (((SQLException) e).getErrorCode() == 1205) {
|
||||
//deadlock
|
||||
return AnomalieDTO.error(e);
|
||||
} else if (((SQLException) e).getErrorCode() == 2627) {
|
||||
//pk exception
|
||||
return AnomalieDTO.warning(e.getMessage());
|
||||
} else {
|
||||
return AnomalieDTO.error(e);
|
||||
}
|
||||
} else if (e instanceof RuntimeException) {
|
||||
anomalia.setTipo(AnomalieDTO.Type.ERROR);
|
||||
anomalia.setMessage(e.getMessage());
|
||||
return AnomalieDTO.error(e);
|
||||
} else if (e instanceof MessagingException) {
|
||||
anomalia.setTipo(AnomalieDTO.Type.WARNING);
|
||||
anomalia.setMessage(e.getMessage());
|
||||
return AnomalieDTO.warning(e.getMessage());
|
||||
} else if (e instanceof FileNotFoundException) {
|
||||
anomalia.setTipo(AnomalieDTO.Type.ERROR);
|
||||
anomalia.setMessage(e.getMessage());
|
||||
return AnomalieDTO.error(e);
|
||||
} else {
|
||||
return AnomalieDTO.error(e);
|
||||
}
|
||||
|
||||
return anomalia;
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user