Skip to content

Commit b80f0c3

Browse files
committed
fixed ExceptionUtil to handle null message
1 parent 77f7b06 commit b80f0c3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/java/com/predic8/membrane/core/util/ExceptionUtil.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
limitations under the License. */
1414
package com.predic8.membrane.core.util;
1515

16+
import org.jetbrains.annotations.NotNull;
17+
1618
public class ExceptionUtil {
1719

1820
/**
@@ -23,11 +25,11 @@ public class ExceptionUtil {
2325
* @param throwable the exception
2426
* @return a String containing all messages of nested exceptions
2527
*/
26-
public static String concatMessageAndCauseMessages(Throwable throwable) {
28+
public static String concatMessageAndCauseMessages(@NotNull Throwable throwable) {
2729
StringBuilder sb = new StringBuilder();
2830
boolean causedBy = false;
2931
do {
30-
boolean skip = sb.toString().contains(throwable.getMessage());
32+
boolean skip = throwable.getMessage() == null || sb.toString().contains(throwable.getMessage());
3133
if (!skip) {
3234
if (causedBy) {
3335
sb.append(" caused by: ");

0 commit comments

Comments
 (0)