diff --git a/apps/showcase/src/main/webapp/WEB-INF/fileupload/multiple-success.jsp b/apps/showcase/src/main/webapp/WEB-INF/fileupload/multiple-success.jsp new file mode 100644 index 000000000..3ce6d84bb --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/fileupload/multiple-success.jsp @@ -0,0 +1,65 @@ + +<%@ page + language="java" + contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + Struts2 Showcase - Fileupload sample - Multiple fileupload + + + + + +
+ + + + + + + + + + + + +
+
+ File (): +
    +
  • ContentType:
  • +
  • FileName:
  • +
  • File:
  • +
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/plugins/embeddedjsp/pom.xml b/plugins/embeddedjsp/pom.xml index 414a2a4bc..a8ce923c3 100644 --- a/plugins/embeddedjsp/pom.xml +++ b/plugins/embeddedjsp/pom.xml @@ -101,7 +101,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19.1 ${project.build.testOutputDirectory}/jsps.jar diff --git a/plugins/oval/src/main/java/org/apache/struts2/oval/interceptor/OValValidationInterceptor.java b/plugins/oval/src/main/java/org/apache/struts2/oval/interceptor/OValValidationInterceptor.java index f7d7aa24f..e6cf60385 100644 --- a/plugins/oval/src/main/java/org/apache/struts2/oval/interceptor/OValValidationInterceptor.java +++ b/plugins/oval/src/main/java/org/apache/struts2/oval/interceptor/OValValidationInterceptor.java @@ -166,7 +166,8 @@ public class OValValidationInterceptor extends MethodFilterInterceptor { List configurers = validationManager.getConfigurers(clazz, context, validateJPAAnnotations); Validator validator = configurers.isEmpty() ? new Validator() : new Validator(configurers); - validator.addExpressionLanguage("ognl", ognlExpressionLanguage); + // Note: For Oval <= 1.70, API requires "validator.addExpressionLanguage("ognl", ognlExpressionLanguage)". + validator.getExpressionLanguageRegistry().registerExpressionLanguage("ognl", ognlExpressionLanguage); // Usage for Oval >= 1.80 due to API changes //if the method is annotated with a @Profiles annotation, use those profiles Method method = clazz.getMethod(methodName, new Class[0]); if (method != null) { diff --git a/plugins/oval/src/test/java/org/apache/struts2/oval/interceptor/OValValidationInterceptorTest.java b/plugins/oval/src/test/java/org/apache/struts2/oval/interceptor/OValValidationInterceptorTest.java index da9d34c6d..5bead8228 100644 --- a/plugins/oval/src/test/java/org/apache/struts2/oval/interceptor/OValValidationInterceptorTest.java +++ b/plugins/oval/src/test/java/org/apache/struts2/oval/interceptor/OValValidationInterceptorTest.java @@ -28,6 +28,8 @@ import java.util.Arrays; import java.util.List; import java.util.Map; +import junit.framework.AssertionFailedError; + public class OValValidationInterceptorTest extends XWorkTestCase { public void testSimpleFieldsXML() throws Exception { ActionProxy baseActionProxy = actionProxyFactory.createActionProxy("oval", "simpleFieldsXML", null, null); @@ -283,7 +285,18 @@ public class OValValidationInterceptorTest extends XWorkTestCase { assertEquals(5, fieldErrors.size()); // 5: as there will be field errors for 'model' and 'address' themselves assertValue(fieldErrors, "name", Arrays.asList("name cannot be null")); assertValue(fieldErrors, "email", Arrays.asList("email cannot be null")); - assertValue(fieldErrors, "address.street", Arrays.asList("street cannot be smaller than 7 characters")); + try { + // Oval version <= 1.40 validation error for invalid data reports: "net.sf.oval.constraint.AssertValid.violated". + assertValue(fieldErrors, "address", Arrays.asList("net.sf.oval.constraint.AssertValid.violated")); + // Oval version <= 1.40 validation error for minimum length reports: "street cannot be smaller than 7 characters". + assertValue(fieldErrors, "address.street", Arrays.asList("street cannot be smaller than 7 characters")); + } + catch (AssertionFailedError afe) { + // Oval version >= 1.50 validation error for invalid data reports: "address is invalid". + assertValue(fieldErrors, "address", Arrays.asList("address is invalid")); + // Oval version >= 1.50 validation error for minimum length reports: "street cannot be shorter than 7 characters". + assertValue(fieldErrors, "address.street", Arrays.asList("street cannot be shorter than 7 characters")); + } } @@ -300,7 +313,19 @@ public class OValValidationInterceptorTest extends XWorkTestCase { assertEquals(5, fieldErrors.size()); // 5: as there will be field errors for 'person' and 'person.address' themselves assertValue(fieldErrors, "person.name", Arrays.asList("name cannot be null")); assertValue(fieldErrors, "person.email", Arrays.asList("email cannot be null")); - assertValue(fieldErrors, "person.address.street", Arrays.asList("street cannot be smaller than 7 characters")); + try { + // Oval version <= 1.40 validation error for invalid data reports: "net.sf.oval.constraint.AssertValid.violated". + assertValue(fieldErrors, "person.address", Arrays.asList("net.sf.oval.constraint.AssertValid.violated")); + // Oval version <= 1.40 validation error for minimum length reports: "street cannot be smaller than 7 characters". + assertValue(fieldErrors, "person.address.street", Arrays.asList("street cannot be smaller than 7 characters")); + } + catch (AssertionFailedError afe) { + // Oval version >= 1.50 validation error for invalid data reports: "address is invalid". + assertValue(fieldErrors, "person.address", Arrays.asList("address is invalid")); + // Oval version >= 1.50 validation error for minimum length reports: "street cannot be shorter than 7 characters". + assertValue(fieldErrors, "person.address.street", Arrays.asList("street cannot be shorter than 7 characters")); + } + } diff --git a/pom.xml b/pom.xml index 6e8508e00..1b296c325 100644 --- a/pom.xml +++ b/pom.xml @@ -97,16 +97,16 @@ UTF-8 - 4.3.13.RELEASE + 4.3.20.RELEASE 3.2.8 7.0 3.0.8 1.0.7 2.11.1 - 2.9.6 + 2.9.7 - 1.6 + 1.7 https://builds.apache.org/analysis/ @@ -234,6 +234,13 @@ org.apache.maven.plugins maven-surefire-plugin 2.20.1 + + + org.apache.maven.surefire + surefire-junit47 + 2.20.1 + + -Duser.language=en -Duser.region=US @@ -242,6 +249,12 @@ **/TestBean.java + + + junit + false + + @@ -312,7 +325,7 @@ org.owasp dependency-check-maven - 3.1.1 + 3.3.4 src/etc/project-suppression.xml @@ -373,12 +386,12 @@ org.apache.maven.doxia doxia-core - 1.7 + 1.8 org.apache.maven.doxia doxia-module-markdown - 1.3 + 1.7 @@ -445,7 +458,7 @@ org.codehaus.mojo versions-maven-plugin - 2.5 + 2.7 @@ -618,7 +631,7 @@ org.apache.felix org.apache.felix.main - 4.0.3 + 4.6.1 org.apache.felix @@ -695,12 +708,13 @@ cglib cglib-nodep 2.1_3 + org.easymock easymock - 3.4 + 3.5.1 test @@ -714,7 +728,7 @@ org.glassfish javax.el - 3.0.0 + 3.0.1-b10 @@ -734,7 +748,7 @@ org.apache.tomcat jasper - 6.0.18 + 6.0.53 provided @@ -811,19 +825,19 @@ org.apache.tomcat juli - 6.0.18 + 6.0.53 commons-logging commons-logging - 1.1.3 + 1.2 org.apache.commons commons-collections4 - 4.1 + 4.2 @@ -839,17 +853,17 @@ commons-io commons-io - 2.5 + 2.6 org.apache.commons commons-lang3 - 3.6 + 3.8.1 org.apache.commons commons-text - 1.2 + 1.3 commons-digester @@ -875,7 +889,7 @@ commons-validator commons-validator - 1.5.1 + 1.6 @@ -973,7 +987,7 @@ org.mockito mockito-all - 1.9.5 + 1.10.19 test @@ -987,12 +1001,12 @@ org.slf4j slf4j-api - 1.7.12 + 1.7.25 org.slf4j slf4j-simple - 1.7.12 + 1.7.25 @@ -1012,13 +1026,13 @@ net.sf.oval oval - 1.31 + 1.90 com.thoughtworks.xstream xstream - 1.4.10 + 1.4.11.1 @@ -1030,12 +1044,12 @@ org.mortbay.jetty jetty - 6.1.9 + 6.1.26 org.mortbay.jetty jsp-2.1 - 6.1.9 + 6.1.26 @@ -1048,7 +1062,8 @@ cglib cglib - 2.2 + 2.2.2 + @@ -1078,13 +1093,13 @@ javax.enterprise cdi-api - 1.0-SP1 + 1.0-SP4 org.jboss.weld weld-core - 1.0.1-Final + 1.0.1-SP4 @@ -1096,7 +1111,7 @@ xerces xercesImpl - 2.10.0 + 2.12.0 test