You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2016/06/08 20:14:09 UTC

wicket git commit: Initialize the stream members after making the checks

Repository: wicket
Updated Branches:
  refs/heads/wicket-6.x c373c2d43 -> d96eda490


Initialize the stream members after making the checks


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d96eda49
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d96eda49
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d96eda49

Branch: refs/heads/wicket-6.x
Commit: d96eda49086da1d596402aaf0f4874492067694a
Parents: c373c2d
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jun 8 22:12:55 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 8 22:12:55 2016 +0200

----------------------------------------------------------------------
 .../wicket/util/upload/MultipartFormInputStream.java      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/d96eda49/wicket-util/src/main/java/org/apache/wicket/util/upload/MultipartFormInputStream.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/upload/MultipartFormInputStream.java b/wicket-util/src/main/java/org/apache/wicket/util/upload/MultipartFormInputStream.java
index 1602715..50a3222 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/upload/MultipartFormInputStream.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/upload/MultipartFormInputStream.java
@@ -314,11 +314,6 @@ public class MultipartFormInputStream
 	MultipartFormInputStream(final InputStream input, final byte[] boundary, final int bufSize,
 		final ProgressNotifier pNotifier)
 	{
-		this.input = input;
-		this.bufSize = bufSize;
-		buffer = new byte[bufSize];
-		notifier = pNotifier;
-
 		// We prepend CR/LF to the boundary to chop trailng CR/LF from
 		// body-data tokens.
 		boundaryLength = boundary.length + BOUNDARY_PREFIX.length;
@@ -327,6 +322,11 @@ public class MultipartFormInputStream
 			throw new IllegalArgumentException(
 				"The buffer size specified for the MultipartFormInputStream is too small");
 		}
+		this.input = input;
+		this.bufSize = Math.max(bufSize, boundaryLength*2);
+		buffer = new byte[bufSize];
+		notifier = pNotifier;
+
 		this.boundary = new byte[this.boundaryLength];
 		keepRegion = this.boundary.length;