This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit 839ec3add74b09e9233cd1c7faeef7a7ac7f9175
Author: Alex Heneveld <[email protected]>
AuthorDate: Tue Nov 8 15:12:42 2022 +0000

    catch npe on exception collapsing
---
 .../src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java
 
b/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java
index 522272de9a..29ec876b19 100644
--- 
a/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java
+++ 
b/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java
@@ -350,7 +350,7 @@ public class Exceptions {
                     // (sometimes generating subsequent OOME's in logback that 
mask the first!)
                     // coarse heuristic for how to reduce it, but that's 
better than killing cpu, causing further errors, and suppressing the root cause 
altogether!
                     String msg = chain.get(0).getMessage();
-                    if (msg.length() > 512) msg = msg.substring(0, 500)+"...";
+                    if (msg!=null && msg.length() > 512) msg = 
msg.substring(0, 500)+"...";
                     return new PropagatedRuntimeException("Huge stack trace 
(size "+chain.size()+", removing all but last few), "
                             + "starting: 
"+chain.get(0).getClass().getName()+": "+msg+"; ultimately caused by: ", 
                             chain.get(chain.size() - 10));

Reply via email to