You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2024/04/24 17:57:30 UTC

(royale-compiler) 02/03: UnexpectedExceptionProblem: displays full stack trace instead of top of stack only

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

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit dadb1eedcf2f639069c95fca65bea161a56ec949
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Wed Apr 24 09:49:10 2024 -0700

    UnexpectedExceptionProblem: displays full stack trace instead of top of stack only
---
 .../compiler/problems/UnexpectedExceptionProblem.java      | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/compiler-common/src/main/java/org/apache/royale/compiler/problems/UnexpectedExceptionProblem.java b/compiler-common/src/main/java/org/apache/royale/compiler/problems/UnexpectedExceptionProblem.java
index 74a7c140b..f9e11603d 100644
--- a/compiler-common/src/main/java/org/apache/royale/compiler/problems/UnexpectedExceptionProblem.java
+++ b/compiler-common/src/main/java/org/apache/royale/compiler/problems/UnexpectedExceptionProblem.java
@@ -33,8 +33,18 @@ public final class UnexpectedExceptionProblem extends CompilerProblem
     {
         super();
         this.exceptionName = throwable.getClass().getName();
-        StackTraceElement element = throwable.getStackTrace()[0];
-        this.exceptionLocation = element.getClassName() + "." + element.getMethodName() + ":" + element.getLineNumber();
+        StringBuilder exceptionLocation = new StringBuilder();
+        boolean first = false;
+        for (StackTraceElement element : throwable.getStackTrace())
+        {
+            if (first)
+            {
+                exceptionLocation.append("\n\t");
+            }
+            exceptionLocation.append(element.getClassName() + "." + element.getMethodName() + ":" + element.getLineNumber());
+            first = true;
+        }
+        this.exceptionLocation = exceptionLocation.toString();
     }
 
     public final String exceptionName;