Author: markt Date: Tue Jun 16 09:06:24 2015 New Revision: 1685739 URL: http://svn.apache.org/r1685739 Log: Partial fix for https://bz.apache.org/bugzilla/show_bug.cgi?id=57938 Correctly handle empty fields when: - Connector.maxPostSize="-1" - Context.allowCasualMultipartParsing="true"
Modified: tomcat/trunk/java/javax/servlet/MultipartConfigElement.java Modified: tomcat/trunk/java/javax/servlet/MultipartConfigElement.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/MultipartConfigElement.java?rev=1685739&r1=1685738&r2=1685739&view=diff ============================================================================== --- tomcat/trunk/java/javax/servlet/MultipartConfigElement.java (original) +++ tomcat/trunk/java/javax/servlet/MultipartConfigElement.java Tue Jun 16 09:06:24 2015 @@ -51,7 +51,13 @@ public class MultipartConfigElement { } this.maxFileSize = maxFileSize; this.maxRequestSize = maxRequestSize; - this.fileSizeThreshold = fileSizeThreshold; + // Avoid threshold values of less than zero as they cause trigger NPEs + // in the Commons FileUpload port for fields that have no data. + if (fileSizeThreshold > 0) { + this.fileSizeThreshold = fileSizeThreshold; + } else { + this.fileSizeThreshold = 0; + } } public MultipartConfigElement(MultipartConfig annotation) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org