Fix FindBugs warnings
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/fileupload/trunk@1565190 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/fileupload/MultipartStream.java b/src/main/java/org/apache/commons/fileupload/MultipartStream.java
index 9e0cbcd..6b37ac8 100644
--- a/src/main/java/org/apache/commons/fileupload/MultipartStream.java
+++ b/src/main/java/org/apache/commons/fileupload/MultipartStream.java
@@ -319,6 +319,11 @@
byte[] boundary,
int bufSize,
ProgressNotifier pNotifier) {
+
+ if (boundary == null) {
+ throw new IllegalArgumentException("boundary may not be null");
+ }
+
this.input = input;
this.bufSize = bufSize;
this.buffer = new byte[bufSize];
diff --git a/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java b/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java
index 195a52a..af708c1 100644
--- a/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java
+++ b/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java
@@ -48,6 +48,7 @@
assertNotNull(ms);
}
+ @SuppressWarnings("unused")
@Test(expected=IllegalArgumentException.class)
public void testSmallBuffer() throws Exception {
final String strData = "foobar";
@@ -55,8 +56,7 @@
InputStream input = new ByteArrayInputStream(contents);
byte[] boundary = BOUNDARY_TEXT.getBytes();
int iBufSize = 1;
- @SuppressWarnings("unused")
- MultipartStream ms = new MultipartStream(
+ new MultipartStream(
input,
boundary,
iBufSize,