You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2020/04/21 18:42:34 UTC

[struts] branch action-context-boost updated (2f27e45 -> f071c9d)

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

lukaszlenart pushed a change to branch action-context-boost
in repository https://gitbox.apache.org/repos/asf/struts.git.


    from 2f27e45  WW-4789 WW-3788 Marks LOCALE as deprecated on behalf using helper methods
     add 269af57  Adds nicer email messages
     add 03a609c  Switchs StrutsException by TypeConversionException in DateConverter, DateConverterTest added for unit testing
     add a11291d  Removes unnecessary import StrutsException
     add b6586c7  Switches StrutsException by TypeConversionException in NumberConverter; The respective unit tests are added to the NumberConverterTest
     add a9802a6  Switches StrutsException by TypeConversionException in XWorkBasicConverter; necessary Tests added to XWorkBasicConverterTest
     add 2453cdb  Switchs StrutsException by TypeConversionException in DateConverter, DateConverterTest added for unit testing
     add ec157c0  Removes unnecessary import StrutsException
     add 686e069  Switches StrutsException by TypeConversionException in NumberConverter; The respective unit tests are added to the NumberConverterTest
     add cd9cc53  Switches StrutsException by TypeConversionException in XWorkBasicConverter; necessary Tests added to XWorkBasicConverterTest
     add 7c92fdd  Merge branch 'WW5052-TypeConversionException' of https://github.com/santosr09/struts into WW5052-TypeConversionException
     add 1ef2985  Corrects formatting defects
     add 5239aa4  License info added
     add 2c2b1af  Modifies the expected result in DateConverter validation, ignores the TimeZone
     add 3e0473a  Adequates the strings for date formatting due to erros with JDK8
     add 9e1a554  Fixes error with Formatting Date when Java is 9 or greater due to the JEP 252
     add bf267ad  Moves TypeConversionException into org.apache.struts2.conversion
     add e8ce2c7  Merge pull request #399 from santosr09/WW5052-TypeConversionException
     add 9d0a6a8  Proposed WW-5068 change. ------ Proposed list of library version updates: ---     cdi-api 1.0-SP4 -> 1.2     weld-core 1.0.1-SP4 -> 2.2.16.SP1     weld-se 1.0.1-Final -> weld-se-core 2.2.16.SP1     htmlunit 2.27.0 and 2.37.0 -> 2.39.0     slf4j-api 1.7.29 -> 1.7.30     slf4j-simple 1.7.29 -> 1.7.30     log4j2 2.12.1 - > 2.13.1     jackson 2.10.1 -> 2.10.3     ognl 3.2.12 -> 3.2.14     asm 7.2 -> 7.3.1     spring 4.3.25.RELEASE -> 4.3.26.RELEASE     fluido-skin 1.8 -> 1.9 [...]
     add a5728a2  Merge pull request #403 from JCgH4164838Gh792C124B5/WW-5068-26x
     add 963fd90  Adds required distributionManagement section to allow publish the site
     add 230a300  Fixes url used to generate the website
     new f071c9d  Reverse merges master

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Jenkinsfile                                        |  63 ++++++---
 apps/rest-showcase/pom.xml                         |   2 +-
 apps/showcase/pom.xml                              |   6 +-
 .../xwork2/conversion/impl/DateConverter.java      |   6 +-
 .../xwork2/conversion/impl/NumberConverter.java    |  18 +--
 .../conversion/impl/XWorkBasicConverter.java       |  16 +--
 .../conversion/TypeConversionException.java        |   2 +-
 .../xwork2/conversion/impl/DateConverterTest.java  | 118 +++++++++++++++++
 .../conversion/impl/NumberConverterTest.java       | 143 +++++++++++++++++++++
 .../conversion/impl/XWorkBasicConverterTest.java   |  90 ++++++++++++-
 plugins/bean-validation/pom.xml                    |   6 +-
 plugins/cdi/pom.xml                                |   2 +-
 pom.xml                                            |  88 +++++++------
 13 files changed, 472 insertions(+), 88 deletions(-)
 rename core/src/main/java/{com/opensymphony/xwork2 => org/apache/struts2}/conversion/TypeConversionException.java (97%)
 create mode 100644 core/src/test/java/com/opensymphony/xwork2/conversion/impl/DateConverterTest.java


[struts] 01/01: Reverse merges master

Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch action-context-boost
in repository https://gitbox.apache.org/repos/asf/struts.git

commit f071c9d0edd1bd7f6a5f0b3068996a88248a5806
Merge: 2f27e45 230a300
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Tue Apr 21 20:42:15 2020 +0200

    Reverse merges master

 Jenkinsfile                                        |  63 ++++++---
 apps/rest-showcase/pom.xml                         |   2 +-
 apps/showcase/pom.xml                              |   6 +-
 .../xwork2/conversion/impl/DateConverter.java      |   6 +-
 .../xwork2/conversion/impl/NumberConverter.java    |  18 +--
 .../conversion/impl/XWorkBasicConverter.java       |  16 +--
 .../conversion/TypeConversionException.java        |   2 +-
 .../xwork2/conversion/impl/DateConverterTest.java  | 118 +++++++++++++++++
 .../conversion/impl/NumberConverterTest.java       | 143 +++++++++++++++++++++
 .../conversion/impl/XWorkBasicConverterTest.java   |  90 ++++++++++++-
 plugins/bean-validation/pom.xml                    |   6 +-
 plugins/cdi/pom.xml                                |   2 +-
 pom.xml                                            |  88 +++++++------
 13 files changed, 472 insertions(+), 88 deletions(-)

diff --cc core/src/test/java/com/opensymphony/xwork2/conversion/impl/NumberConverterTest.java
index 2b6f34b,049e740..b0271ea
--- a/core/src/test/java/com/opensymphony/xwork2/conversion/impl/NumberConverterTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/conversion/impl/NumberConverterTest.java
@@@ -18,8 -18,10 +18,9 @@@
   */
  package com.opensymphony.xwork2.conversion.impl;
  
 -import com.opensymphony.xwork2.ActionContext;
  import com.opensymphony.xwork2.SimpleFooAction;
  import com.opensymphony.xwork2.XWorkTestCase;
+ import org.apache.struts2.conversion.TypeConversionException;
  import org.apache.commons.lang3.StringUtils;
  
  import java.math.BigDecimal;
@@@ -27,7 -30,17 +28,17 @@@ import java.util.Locale
  import java.util.Map;
  
  public class NumberConverterTest extends XWorkTestCase {
 -    
 +
+     private final static String FLOAT_OUT_OF_RANGE = "3.5028235E38";
+     private final static String DOUBLE_OUT_OF_RANGE = "1.7976931348623157E309";
+     private final static String INTEGER_OUT_OF_RANGE = "2147483648";
+     private final static String MSG_OUT_OF_RANGE_CASTING = "Overflow or underflow casting";
+     private final static String MSG_OUT_OF_RANGE_CONVERTING = "Overflow or underflow converting";
+     private final static String MSG_UNPARSEABLE_NUMBER = "Unparseable number";
+     private final static String MSG_TEST_FAILS_OUT_OF_RANGE = "TypeConversionException expected when OUT OF RANGE";
+     private final static String MSG_TEST_FAILS_UNPARSEABLE_NUMBER = "TypeConversionException expected when UNPARSEABLE NUMBER";
+     private final static Locale LOCALE_MEXICO = new Locale("es_MX", "MX");
+ 
      public void testStringToNumberConversionPL() throws Exception {
          // given
          NumberConverter converter = new NumberConverter();
@@@ -157,6 -179,146 +168,138 @@@
          // then
          assertEquals(1234.4F, value);
      }
 -    
 +
+     public void testExceptionWhenPrimitiveIsOutOfRange() {
+         // given
+         NumberConverter converter = new NumberConverter();
 -        Map<String, Object> context = new HashMap<>();
 -        context.put(ActionContext.LOCALE, LOCALE_MEXICO);
 -        
++        Map<String, Object> context = createContextWithLocale(LOCALE_MEXICO);
++
+         // when
+         try {
+             Object value = converter.convertValue(context, null, null, null, INTEGER_OUT_OF_RANGE, int.class);
+             fail(MSG_TEST_FAILS_OUT_OF_RANGE);
+         } catch (Exception ex) {
+             // then
+             assertEquals(TypeConversionException.class, ex.getClass());
+             assertTrue(ex.getMessage().startsWith(MSG_OUT_OF_RANGE_CASTING));
+         }
+     }
 -    
++
+     public void testExceptionWhenANotPrimitiveIsUnparsable() {
+         // given
+         NumberConverter converter = new NumberConverter();
 -        Map<String, Object> context = new HashMap<>();
++        Map<String, Object> context = createContextWithLocale(LOCALE_MEXICO);
+         String strValue = "1.2";
 -        context.put(ActionContext.LOCALE, LOCALE_MEXICO);
 -        
++
+         // when
+         try {
+             Object value = converter.convertValue(context, null, null, null, strValue, Byte.class);
+             fail(MSG_TEST_FAILS_UNPARSEABLE_NUMBER);
+         } catch (Exception ex) {
+             // then
+             assertEquals(TypeConversionException.class, ex.getClass());
+             assertTrue(ex.getMessage().startsWith(MSG_UNPARSEABLE_NUMBER));
+         }
+     }
 -    
++
+     public void testExceptionWhenANotPrimitiveIsOutOfRange() {
+         // given
+         NumberConverter converter = new NumberConverter();
 -        Map<String, Object> context = new HashMap<>();
++        Map<String, Object> context = createContextWithLocale(LOCALE_MEXICO);
+         String strValue = "129";
 -        context.put(ActionContext.LOCALE, LOCALE_MEXICO);
 -        
++
+         // when
+         try {
+             Object value = converter.convertValue(context, null, null, null, strValue, Byte.class);
+             fail(MSG_TEST_FAILS_OUT_OF_RANGE);
+         } catch (Exception ex) {
+             // then
+             assertEquals(TypeConversionException.class, ex.getClass());
+             assertTrue(ex.getMessage().startsWith(MSG_OUT_OF_RANGE_CASTING));
+         }
+     }
 -    
++
+     public void testExceptionWhenUnparseableInConvertToBigDecimal() {
+         // given
+         NumberConverter converter = new NumberConverter();
 -        Map<String, Object> context = new HashMap<>();
++        Map<String, Object> context = createContextWithLocale(LOCALE_MEXICO);
+         String strValue = "1-23";
 -        context.put(ActionContext.LOCALE, LOCALE_MEXICO);
 -        
++
+         // when
+         try {
+             Object value = converter.convertValue(context, null, null, null, strValue, BigDecimal.class);
+             fail(MSG_TEST_FAILS_UNPARSEABLE_NUMBER);
+         } catch (Exception ex) {
+             // then
+             assertEquals(TypeConversionException.class, ex.getClass());
+             assertTrue(ex.getMessage().startsWith(MSG_UNPARSEABLE_NUMBER));
+         }
+     }
 -    
++
+     public void testExceptionWhenUnparseableInConvertToDouble() {
+         // given
+         NumberConverter converter = new NumberConverter();
 -        Map<String, Object> context = new HashMap<>();
++        Map<String, Object> context = createContextWithLocale(LOCALE_MEXICO);
+         String strValue = "1-23";
 -        context.put(ActionContext.LOCALE, LOCALE_MEXICO);
 -        
++
+         // when
+         try {
+             Object value = converter.convertValue(context, null, null, null, strValue, Double.class);
+             fail(MSG_TEST_FAILS_UNPARSEABLE_NUMBER);
+         } catch (Exception ex) {
+             // then
+             assertEquals(TypeConversionException.class, ex.getClass());
+             assertTrue(ex.getMessage().startsWith(MSG_UNPARSEABLE_NUMBER));
+         }
+     }
 -    
++
+     public void testExceptionWhenOutOfRangeInConvertToDouble() {
+         // given
+         NumberConverter converter = new NumberConverter();
 -        Map<String, Object> context = new HashMap<>();
 -        context.put(ActionContext.LOCALE, LOCALE_MEXICO);
 -        
++        Map<String, Object> context = createContextWithLocale(LOCALE_MEXICO);
++
+         // when
+         try {
+             Object value = converter.convertValue(context, null, null, null, DOUBLE_OUT_OF_RANGE, Double.class);
+             fail(MSG_TEST_FAILS_OUT_OF_RANGE);
+         } catch (Exception ex) {
+             // then
+             assertEquals(TypeConversionException.class, ex.getClass());
+             assertTrue(ex.getMessage().startsWith(MSG_OUT_OF_RANGE_CONVERTING));
+         }
+     }
 -    
++
+     public void testExceptionWhenOutOfRangeInConvertToFloat() {
+         // given
+         NumberConverter converter = new NumberConverter();
 -        Map<String, Object> context = new HashMap<>();
 -        context.put(ActionContext.LOCALE, LOCALE_MEXICO);
 -        
++        Map<String, Object> context = createContextWithLocale(LOCALE_MEXICO);
++
+         // when
+         try {
+             Object value = converter.convertValue(context, null, null, null, FLOAT_OUT_OF_RANGE, Float.class);
+             fail(MSG_TEST_FAILS_OUT_OF_RANGE);
+         } catch (Exception ex) {
+             // then
+             assertEquals(TypeConversionException.class, ex.getClass());
+             assertTrue(ex.getMessage().startsWith(MSG_OUT_OF_RANGE_CONVERTING));
+         }
+     }
 -    
++
+     public void testExceptionWhenUnparseableInConvertToFloat() {
+         // given
+         NumberConverter converter = new NumberConverter();
 -        Map<String, Object> context = new HashMap<>();
++        Map<String, Object> context = createContextWithLocale(LOCALE_MEXICO);
+         String strValue = "1-23";
 -        context.put(ActionContext.LOCALE, LOCALE_MEXICO);
 -        
++
+         // when
+         try {
+             Object value = converter.convertValue(context, null, null, null, strValue, Float.class);
+             fail(MSG_TEST_FAILS_UNPARSEABLE_NUMBER);
+         } catch (Exception ex) {
+             // then
+             assertEquals(TypeConversionException.class, ex.getClass());
+             assertTrue(ex.getMessage().startsWith(MSG_UNPARSEABLE_NUMBER));
+         }
+     }
 -    
 +
  }
diff --cc core/src/test/java/com/opensymphony/xwork2/conversion/impl/XWorkBasicConverterTest.java
index 5c67924,33fea83..4209da1
--- a/core/src/test/java/com/opensymphony/xwork2/conversion/impl/XWorkBasicConverterTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/conversion/impl/XWorkBasicConverterTest.java
@@@ -295,8 -391,7 +382,7 @@@ public class XWorkBasicConverterTest ex
      @Override
      protected void tearDown() throws Exception {
          super.tearDown();
 -        ActionContext.setContext(null);
 +        ActionContext.clear();
      }
- 
- 
+     
  }