try { // Going to attempt a commit. If it fails this flag will // stay false and we can use that later. getJobRepository().updateExecutionContext(stepExecution); stepExecution.incrementCommitCount(); if (logger.isDebugEnabled()) { logger.debug("Saving step execution before commit: " + stepExecution); } getJobRepository().update(stepExecution); } catch (Exception e) { // If we get to here there was a problem saving the step // execution and we have to fail. Stringmsg="JobRepository failure forcing rollback"; logger.error(msg, e); thrownewFatalStepExecutionException(msg, e); } } catch (Error e) { if (logger.isDebugEnabled()) { logger.debug("Rollback for Error: " + e.getClass().getName() + ": " + e.getMessage()); } rollback(stepExecution); throw e; } catch (RuntimeException e) { if (logger.isDebugEnabled()) { logger.debug("Rollback for RuntimeException: " + e.getClass().getName() + ": " + e.getMessage()); } rollback(stepExecution); throw e; } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Rollback for Exception: " + e.getClass().getName() + ": " + e.getMessage()); } rollback(stepExecution); // Allow checked exceptions thrownewUncheckedTransactionException(e); } return result; }