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

henrib pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git


The following commit(s) were added to refs/heads/master by this push:
     new ef4d76a  JEXL-344: avoid filling stacktrace in return, continue, break 
supporting (jexl)exceptions
     new c90791a  Merge remote-tracking branch 'origin/master'
ef4d76a is described below

commit ef4d76a57b0b06a5b6b05c480d7dd9330362dd7e
Author: henrib <hen...@apache.org>
AuthorDate: Tue Feb 2 21:39:28 2021 +0100

    JEXL-344: avoid filling stacktrace in return, continue, break supporting 
(jexl)exceptions
---
 .../java/org/apache/commons/jexl3/JexlException.java | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/jexl3/JexlException.java 
b/src/main/java/org/apache/commons/jexl3/JexlException.java
index 35c7ff1..45d3299 100644
--- a/src/main/java/org/apache/commons/jexl3/JexlException.java
+++ b/src/main/java/org/apache/commons/jexl3/JexlException.java
@@ -69,7 +69,19 @@ public class JexlException extends RuntimeException {
      * @param cause the exception causing the error
      */
     public JexlException(final JexlNode node, final String msg, final 
Throwable cause) {
-        super(msg != null ? msg : "", unwrap(cause));
+        this(node, msg != null ? msg : "", unwrap(cause), true);
+    }
+
+    /**
+     * Creates a new JexlException.
+     *
+     * @param node  the node causing the error
+     * @param msg   the error message
+     * @param cause the exception causing the error
+     * @param trace whether this exception has a stacktrace and can 
<em>not</em> be suppressed
+     */
+    protected JexlException(final JexlNode node, final String msg, final 
Throwable cause, boolean trace) {
+        super(msg != null ? msg : "", unwrap(cause), !trace, trace);
         if (node != null) {
             mark = node;
             info = node.jexlInfo();
@@ -946,7 +958,7 @@ public class JexlException extends RuntimeException {
          * @param value the returned value
          */
         public Return(final JexlNode node, final String msg, final Object 
value) {
-            super(node, msg, null);
+            super(node, msg, null, false);
             this.result = value;
         }
 
@@ -986,7 +998,7 @@ public class JexlException extends RuntimeException {
          * @param node the break
          */
         public Break(final JexlNode node) {
-            super(node, "break loop", null);
+            super(node, "break loop", null, false);
         }
     }
 
@@ -1002,7 +1014,7 @@ public class JexlException extends RuntimeException {
          * @param node the continue
          */
         public Continue(final JexlNode node) {
-            super(node, "continue loop", null);
+            super(node, "continue loop", null, false);
         }
     }
 

Reply via email to