commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hen...@apache.org
Subject [commons-jexl] branch master updated: JEXL: ctor aligned with method behavior; use UTC calendar in test
Date Sat, 14 Dec 2019 08:15:23 GMT
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 <henrib@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";


Mime
View raw message