You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2019/12/14 08:15:23 UTC

[commons-jexl] branch master updated: JEXL: ctor aligned with method behavior; use UTC calendar in test

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 2c0a95e  JEXL: ctor aligned with method behavior; use UTC calendar in test
2c0a95e is described below

commit 2c0a95ecb29db71cbdee38651313f186c01bc55d
Author: henrib <he...@apache.org>
AuthorDate: Sat Dec 14 09:14:56 2019 +0100

    JEXL: ctor aligned with method behavior; use UTC calendar in test
---
 .../commons/jexl3/internal/introspection/ConstructorMethod.java       | 3 ++-
 src/test/java/org/apache/commons/jexl3/ArithmeticOperatorTest.java    | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/jexl3/internal/introspection/ConstructorMethod.java b/src/main/java/org/apache/commons/jexl3/internal/introspection/ConstructorMethod.java
index e82a111..e787b4b 100644
--- a/src/main/java/org/apache/commons/jexl3/internal/introspection/ConstructorMethod.java
+++ b/src/main/java/org/apache/commons/jexl3/internal/introspection/ConstructorMethod.java
@@ -19,6 +19,7 @@ package org.apache.commons.jexl3.internal.introspection;
 import java.beans.IntrospectionException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
+import org.apache.commons.jexl3.JexlException;
 import org.apache.commons.jexl3.introspection.JexlMethod;
 
 /**
@@ -101,7 +102,7 @@ public final class ConstructorMethod implements JexlMethod {
         } catch (IllegalArgumentException xargument) {
             return Uberspect.TRY_FAILED;
         } catch (InvocationTargetException xinvoke) {
-            return Uberspect.TRY_FAILED;
+            throw JexlException.tryFailed(xinvoke); // throw
         }
         return Uberspect.TRY_FAILED;
     }
diff --git a/src/test/java/org/apache/commons/jexl3/ArithmeticOperatorTest.java b/src/test/java/org/apache/commons/jexl3/ArithmeticOperatorTest.java
index 7310a9c..fb44e76 100644
--- a/src/test/java/org/apache/commons/jexl3/ArithmeticOperatorTest.java
+++ b/src/test/java/org/apache/commons/jexl3/ArithmeticOperatorTest.java
@@ -354,7 +354,7 @@ public class ArithmeticOperatorTest extends JexlTestCase {
 
         protected Object getDateValue(Date date, String key) {
             try {
-                Calendar cal = Calendar.getInstance();
+                Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
                 cal.setTime(date);
                 if ("yyyy".equals(key)) {
                     return cal.get(Calendar.YEAR);
@@ -473,7 +473,7 @@ public class ArithmeticOperatorTest extends JexlTestCase {
 
     @Test
     public void testFormatArithmetic() throws Exception {
-        Calendar cal = Calendar.getInstance();
+        Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
         cal.set(1969, 7, 20);
         Date x0 = cal.getTime();
         String y0 =  "MM/yy/dd";