Author: mrdon Date: Sat Apr 12 04:41:24 2008 New Revision: 647434 URL: http://svn.apache.org/viewvc?rev=647434&view=rev Log: * Upgrading commons-fileupload to 1.2.1, now required * Cleaning up testing so spring's mocks are not in the compile scope WW-2590 WW-2588
Removed: struts/struts2/trunk/core/src/main/java/org/apache/struts2/validators/ Modified: struts/struts2/trunk/core/pom.xml struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java struts/struts2/trunk/core/src/test/java/org/apache/struts2/StrutsTestCase.java struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java struts/struts2/trunk/plugins/testng/src/main/java/org/apache/struts2/StrutsTestCase.java Modified: struts/struts2/trunk/core/pom.xml URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/pom.xml?rev=647434&r1=647433&r2=647434&view=diff ============================================================================== --- struts/struts2/trunk/core/pom.xml (original) +++ struts/struts2/trunk/core/pom.xml Sat Apr 12 04:41:24 2008 @@ -288,29 +288,20 @@ <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> - <version>1.1.1</version> - <optional>true</optional> + <version>1.2.1</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>1.0</version> - <optional>true</optional> + <version>1.3.2</version> </dependency> - - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.1</version> - <optional>true</optional> - </dependency> - + <!-- Mocks for unit testing (by Spring) --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-mock</artifactId> <version>2.0.8</version> - <optional>true</optional> + <scope>test</scope> </dependency> <dependency> @@ -405,6 +396,7 @@ <groupId>org.apache.struts</groupId> <artifactId>struts-annotations</artifactId> <version>1.0.3-20080216.121126-3</version> + <scope>compile</scope> <optional>true</optional> </dependency> Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java?rev=647434&r1=647433&r2=647434&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java Sat Apr 12 04:41:24 2008 @@ -87,6 +87,7 @@ try { ServletFileUpload upload = new ServletFileUpload(fac); upload.setSizeMax(maxSize); + List items = upload.parseRequest(createRequestContext(servletRequest)); for (Object item1 : items) { @@ -298,6 +299,10 @@ } public InputStream getInputStream() throws IOException { + InputStream in = req.getInputStream(); + if (in == null) { + throw new IOException("Missing content in the request"); + } return req.getInputStream(); } }; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java?rev=647434&r1=647433&r2=647434&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java Sat Apr 12 04:41:24 2008 @@ -24,13 +24,14 @@ import java.util.Map; import org.apache.struts2.dispatcher.Dispatcher; -import org.springframework.mock.web.MockServletContext; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.util.LocalizedTextUtil; import com.opensymphony.xwork2.util.ValueStack; import com.opensymphony.xwork2.util.ValueStackFactory; +import javax.servlet.ServletContext; + /** * Generic test setup methods to be used with any unit testing framework. */ @@ -44,11 +45,11 @@ LocalizedTextUtil.clearDefaultResourceBundles(); } - public static Dispatcher initDispatcher(Map<String,String> params) { + public static Dispatcher initDispatcher(ServletContext ctx, Map<String,String> params) { if (params == null) { params = new HashMap<String,String>(); } - Dispatcher du = new Dispatcher(new MockServletContext(), params); + Dispatcher du = new Dispatcher(ctx, params); du.init(); Dispatcher.setInstance(du); Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/StrutsTestCase.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/StrutsTestCase.java?rev=647434&r1=647433&r2=647434&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/java/org/apache/struts2/StrutsTestCase.java (original) +++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/StrutsTestCase.java Sat Apr 12 04:41:24 2008 @@ -32,6 +32,7 @@ import org.apache.struts2.dispatcher.Dispatcher; import org.apache.struts2.util.StrutsTestCaseHelper; +import org.springframework.mock.web.MockServletContext; import com.opensymphony.xwork2.XWorkTestCase; import com.opensymphony.xwork2.util.logging.LoggerFactory; @@ -81,7 +82,7 @@ } protected Dispatcher initDispatcher(Map<String,String> params) { - Dispatcher du = StrutsTestCaseHelper.initDispatcher(params); + Dispatcher du = StrutsTestCaseHelper.initDispatcher(new MockServletContext(), params); configurationManager = du.getConfigurationManager(); configuration = configurationManager.getConfiguration(); container = configuration.getContainer(); Modified: struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java?rev=647434&r1=647433&r2=647434&view=diff ============================================================================== --- struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java (original) +++ struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java Sat Apr 12 04:41:24 2008 @@ -32,6 +32,7 @@ import org.apache.struts2.dispatcher.Dispatcher; import org.apache.struts2.util.StrutsTestCaseHelper; +import org.springframework.mock.web.MockServletContext; import com.opensymphony.xwork2.XWorkTestCase; import com.opensymphony.xwork2.util.logging.LoggerFactory; @@ -81,7 +82,7 @@ } protected Dispatcher initDispatcher(Map<String,String> params) { - Dispatcher du = StrutsTestCaseHelper.initDispatcher(params); + Dispatcher du = StrutsTestCaseHelper.initDispatcher(new MockServletContext(), params); configurationManager = du.getConfigurationManager(); configuration = configurationManager.getConfiguration(); container = configuration.getContainer(); Modified: struts/struts2/trunk/plugins/testng/src/main/java/org/apache/struts2/StrutsTestCase.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/testng/src/main/java/org/apache/struts2/StrutsTestCase.java?rev=647434&r1=647433&r2=647434&view=diff ============================================================================== --- struts/struts2/trunk/plugins/testng/src/main/java/org/apache/struts2/StrutsTestCase.java (original) +++ struts/struts2/trunk/plugins/testng/src/main/java/org/apache/struts2/StrutsTestCase.java Sat Apr 12 04:41:24 2008 @@ -26,6 +26,7 @@ import org.apache.struts2.util.StrutsTestCaseHelper; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; +import org.springframework.mock.web.MockServletContext; import com.opensymphony.xwork2.TestNGXWorkTestCase; @@ -42,7 +43,7 @@ } protected Dispatcher initDispatcher(Map<String,String> params) { - Dispatcher du = StrutsTestCaseHelper.initDispatcher(params); + Dispatcher du = StrutsTestCaseHelper.initDispatcher(new MockServletContext(), params); configurationManager = du.getConfigurationManager(); configuration = configurationManager.getConfiguration(); container = configuration.getContainer();