if (editRollBackNeeded) {
try {
hibernateTransaction.setRollbackOnly();
hibernateTransaction.rollback();
returnCode = 16;
logger.info(" ");
logger.info("RECORD EDIT ERROR " + "ROLLBACK OCCURRED - INVESTIGATE");
logger.info(" ");
message = message + " " + System.lineSeparator()
+ "RECORD EDIT ERROR " + "ROLLBACK OCCURRED - INVESTIGATE " + System.lineSeparator();
terminateProcess(returnCode, message) ;
} catch (Exception rollbackE) {
logger.info("ROLLBACK EXCEPTION " + rollbackE.getMessage() + " OCCURRED - INVESTIGATE");
message = message + " " + System.lineSeparator()
+ "ROLLBACK EXCEPTION WAS " + rollbackE.getMessage() + System.lineSeparator()
+ " " + System.lineSeparator();
}
} else {
try {
hibernateTransaction.commit();
} catch (SQLException commitExcep) {
commitExcep.printStackTrace(pw);
logger.info("COMMIT EXCEPTION WAS " + sw.toString());
logger.debug("COMMIT LOCAL MESSAGE " + Arrays.asList(commitExcep.getLocalizedMessage()));
logger.info(sw.toString()) ;
message = message + " " + System.lineSeparator()
+ "COMMIT EXCEPTION WAS " + sw.toString() + System.lineSeparator()
+ " " + System.lineSeparator();
if (hibernateTransaction != null) {
try {
hibernateTransaction.rollback();
returnCode = 16;
logger.info("SQL ERROR " + "ROLLBACK OCCURRED - INVESTIGATE");
logger.info(" ");
message = message + " " + System.lineSeparator()
+ "SQL ERROR " + "ROLLBACK OCCURRED - INVESTIGATE " + System.lineSeparator();
} catch (Exception rollbackE) {
logger.info("ROLLBACK EXCEPTION " + rollbackE.getMessage() + " OCCURRED - INVESTIGATE");
returnCode = 16;
terminateProcess(returnCode, message) ;
}
} else {
}
}
}
它位于Spring批的afterStep部分。我抛出所有异常,特别是SQL异常。我得到一个编译错误,说“SQLExecution永远不会抛出到相应try语句的主体中”。我真的不明白,因为我有这个错误。你能看看我搞砸了什么吗。