Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-05-16 12:05:10 +02:00

View File

@@ -22,6 +22,7 @@ import java.io.FileNotFoundException;
import it.integry.ems.sync.MultiDBTransaction.Connection; import it.integry.ems.sync.MultiDBTransaction.Connection;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -84,6 +85,7 @@ public class ScontriniImportService {
entityProcessor.processEntity(entity, multiDBTransactionManager); entityProcessor.processEntity(entity, multiDBTransactionManager);
} catch (Exception e) { } catch (Exception e) {
logger.error(e);
anomalie.add(setAnomalia(e)); anomalie.add(setAnomalia(e));
} }
entitiesReturn.add(entity); entitiesReturn.add(entity);
@@ -111,31 +113,37 @@ public class ScontriniImportService {
} }
private AnomalieDTO setAnomalia(Exception e) { private AnomalieDTO setAnomalia(Exception e) {
AnomalieDTO anomalia = new AnomalieDTO();
if (e instanceof EntityException) { if (e instanceof EntityException) {
if (((EntityException) e).getSqlErrorCode() != null) { if (((EntityException) e).getSqlErrorCode() != null) {
if (((EntityException) e).getSqlErrorCode() == 1205) { if (((EntityException) e).getSqlErrorCode() == 1205) {
//deadlock //deadlock
anomalia.setTipo(AnomalieDTO.Type.ERROR); return AnomalieDTO.error(e);
anomalia.setMessage(e.getMessage());
} else if (((EntityException) e).getSqlErrorCode() == 2627) { } else if (((EntityException) e).getSqlErrorCode() == 2627) {
//pk exception //pk exception
anomalia.setTipo(AnomalieDTO.Type.WARNING); return AnomalieDTO.warning(e.getMessage());
anomalia.setMessage(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) { } else if (e instanceof RuntimeException) {
anomalia.setTipo(AnomalieDTO.Type.ERROR); return AnomalieDTO.error(e);
anomalia.setMessage(e.getMessage());
} else if (e instanceof MessagingException) { } else if (e instanceof MessagingException) {
anomalia.setTipo(AnomalieDTO.Type.WARNING); return AnomalieDTO.warning(e.getMessage());
anomalia.setMessage(e.getMessage());
} else if (e instanceof FileNotFoundException) { } else if (e instanceof FileNotFoundException) {
anomalia.setTipo(AnomalieDTO.Type.ERROR); return AnomalieDTO.error(e);
anomalia.setMessage(e.getMessage()); } else {
return AnomalieDTO.error(e);
} }
return anomalia; return null;
} }
} }