Skip to content

Commit 9f42b40

Browse files
committed
Fix NPE in RepeatTemplate
Resolves #1123 (cherry picked from commit 03d2833)
1 parent e022216 commit 9f42b40

File tree

1 file changed

+9
-2
lines changed
  • spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support

1 file changed

+9
-2
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatTemplate.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,15 @@ private void doHandle(Throwable throwable, RepeatContext context, Collection<Thr
294294
}
295295

296296
if (logger.isDebugEnabled()) {
297-
logger.debug("Handling exception: " + throwable.getClass().getName() + ", caused by: "
298-
+ unwrappedThrowable.getClass().getName() + ": " + unwrappedThrowable.getMessage());
297+
StringBuilder message = new StringBuilder("Handling exception: ")
298+
.append(throwable.getClass().getName());
299+
if (unwrappedThrowable != null) {
300+
message.append(", caused by: ")
301+
.append(unwrappedThrowable.getClass().getName())
302+
.append(": ")
303+
.append(unwrappedThrowable.getMessage());
304+
}
305+
logger.debug(message.toString());
299306
}
300307
exceptionHandler.handleException(context, unwrappedThrowable);
301308

0 commit comments

Comments
 (0)