diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatTemplate.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatTemplate.java index 4e81315d1..7b7af3fc6 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatTemplate.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatTemplate.java @@ -286,8 +286,15 @@ public class RepeatTemplate implements RepeatOperations { } if (logger.isDebugEnabled()) { - logger.debug("Handling exception: " + throwable.getClass().getName() + ", caused by: " - + unwrappedThrowable.getClass().getName() + ": " + unwrappedThrowable.getMessage()); + StringBuilder message = new StringBuilder("Handling exception: ") + .append(throwable.getClass().getName()); + if (unwrappedThrowable != null) { + message.append(", caused by: ") + .append(unwrappedThrowable.getClass().getName()) + .append(": ") + .append(unwrappedThrowable.getMessage()); + } + logger.debug(message.toString()); } exceptionHandler.handleException(context, unwrappedThrowable);