RESOLVED - BATCH-950: Exception during rollback hides root cause
log original exception if rollback failed
This commit is contained in:
@@ -296,12 +296,24 @@ public class TaskletStep extends AbstractStep {
|
||||
|
||||
}
|
||||
catch (Error e) {
|
||||
processRollback(stepExecution, fatalException, transaction);
|
||||
throw e;
|
||||
try {
|
||||
processRollback(stepExecution, fatalException, transaction);
|
||||
throw e;
|
||||
}
|
||||
catch (Exception rollbackException) {
|
||||
logger.error("Rollback failed, original error that caused the rollback is", e);
|
||||
throw rollbackException;
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
processRollback(stepExecution, fatalException, transaction);
|
||||
throw e;
|
||||
try {
|
||||
processRollback(stepExecution, fatalException, transaction);
|
||||
throw e;
|
||||
}
|
||||
catch (Exception rollbackException) {
|
||||
logger.error("Rollback failed, original exception that caused the rollback is", e);
|
||||
throw rollbackException;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
// only release the lock if we acquired it
|
||||
@@ -349,6 +361,9 @@ public class TaskletStep extends AbstractStep {
|
||||
fatalException.setException(e);
|
||||
throw new FatalException("Failed while processing rollback", e);
|
||||
}
|
||||
else {
|
||||
logger.error("Failed to rollback transaction", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (fatalException.hasException()) {
|
||||
|
||||
Reference in New Issue
Block a user