commons-compress git commit: fix javadoc warning

2017-06-24 Thread bodewig
Repository: commons-compress
Updated Branches:
  refs/heads/master c93d3e1d7 -> 5e108a2e7


fix javadoc warning


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/5e108a2e
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/5e108a2e
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/5e108a2e

Branch: refs/heads/master
Commit: 5e108a2e7b412871894509feb7350ea7c3f8a7fb
Parents: c93d3e1
Author: Stefan Bodewig 
Authored: Sat Jun 24 18:21:06 2017 +0200
Committer: Stefan Bodewig 
Committed: Sat Jun 24 18:21:06 2017 +0200

--
 .../compress/compressors/bzip2/BZip2CompressorInputStream.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/5e108a2e/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
 
b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
index 45bd063..a613ad8 100644
--- 
a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
@@ -376,7 +376,7 @@ public class BZip2CompressorInputStream extends 
CompressorInputStream implements
 /**
  * read bits from the input stream
  * @param n the number of bits to read, must not exceed 32?
- * @return
+ * @return the requested bits combined into an int
  * @throws IOException
  */
 private static int bsR(BitInputStream bin, final int n) throws IOException 
{



[3/3] commons-compress git commit: silence Sonar where we intentionally break its rules

2017-06-24 Thread bodewig
silence Sonar where we intentionally break its rules


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/19e1b02f
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/19e1b02f
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/19e1b02f

Branch: refs/heads/master
Commit: 19e1b02f754a9b7bc969eb17bd52cc36a85c4d74
Parents: 14fbf3a
Author: Stefan Bodewig 
Authored: Sat Jun 24 18:46:30 2017 +0200
Committer: Stefan Bodewig 
Committed: Sat Jun 24 18:46:30 2017 +0200

--
 .../commons/compress/archivers/dump/DumpArchiveEntry.java| 5 +++--
 .../commons/compress/archivers/dump/TapeInputStream.java | 6 +++---
 .../commons/compress/archivers/jar/JarArchiveEntry.java  | 2 +-
 .../commons/compress/archivers/tar/TarArchiveEntry.java  | 2 +-
 .../compress/archivers/zip/X5455_ExtendedTimestamp.java  | 4 ++--
 .../archivers/zip/Zip64ExtendedInformationExtraField.java| 8 
 .../compress/archivers/zip/ZipArchiveInputStream.java| 2 +-
 .../commons/compress/compressors/brotli/BrotliUtils.java | 4 ++--
 .../compressors/lz4/BlockLZ4CompressorInputStream.java   | 4 ++--
 .../parallel/FileBasedScatterGatherBackingStore.java | 2 +-
 10 files changed, 20 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/19e1b02f/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java
 
b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java
index c38cfda..84069a0 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java
@@ -417,8 +417,9 @@ public class DumpArchiveEntry implements ArchiveEntry {
 return false;
 }
 
-if ((summary == null && rhs.summary != null)
-|| (summary != null && !summary.equals(rhs.summary))) {
+// summary is always null right now, but this may change some day
+if ((summary == null && rhs.summary != null) // NOSONAR
+|| (summary != null && !summary.equals(rhs.summary))) { // NOSONAR
 return false;
 }
 

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/19e1b02f/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java 
b/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
index 64579b6..e82db2d 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
@@ -129,7 +129,7 @@ class TapeInputStream extends FilterInputStream {
 if (readOffset == blockSize) {
 try {
 readBlock(true);
-} catch (ShortFileException sfe) {
+} catch (ShortFileException sfe) { // NOSONAR
 return -1;
 }
 }
@@ -180,7 +180,7 @@ class TapeInputStream extends FilterInputStream {
 if (readOffset == blockSize) {
 try {
 readBlock((len - bytes) < blockSize);
-} catch (ShortFileException sfe) {
+} catch (ShortFileException sfe) { // NOSONAR
 return -1;
 }
 }
@@ -228,7 +228,7 @@ class TapeInputStream extends FilterInputStream {
 if (readOffset == blockSize) {
 try {
 readBlock(true);
-} catch (ShortFileException sfe) {
+} catch (ShortFileException sfe) { // NOSONAR
 return null;
 }
 }

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/19e1b02f/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveEntry.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveEntry.java 
b/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveEntry.java
index 835c840..f0c05f0 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveEntry.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveEntry.java
@@ -74,7 +74,7 @@ public class JarArchiveEntry extends ZipArchiveEntry {
  */
 @Deprecated
 public Certificate[] 

[1/3] commons-compress git commit: fix issues detected by Sonar

2017-06-24 Thread bodewig
Repository: commons-compress
Updated Branches:
  refs/heads/master 5e108a2e7 -> 19e1b02f7


fix issues detected by Sonar


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/9caad351
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/9caad351
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/9caad351

Branch: refs/heads/master
Commit: 9caad351f30249cc72fb2840f87ad12fe660978f
Parents: 5e108a2
Author: Stefan Bodewig 
Authored: Sat Jun 24 18:46:06 2017 +0200
Committer: Stefan Bodewig 
Committed: Sat Jun 24 18:46:06 2017 +0200

--
 .../archivers/dump/DumpArchiveEntry.java|  2 +-
 .../compress/archivers/zip/X7875_NewUnix.java   | 32 ++--
 2 files changed, 23 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/9caad351/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java
 
b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java
index 47e53ce..c38cfda 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java
@@ -409,7 +409,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
 
 final DumpArchiveEntry rhs = (DumpArchiveEntry) o;
 
-if ((header == null) || (rhs.header == null)) {
+if (rhs.header == null) {
 return false;
 }
 

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/9caad351/src/main/java/org/apache/commons/compress/archivers/zip/X7875_NewUnix.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/zip/X7875_NewUnix.java 
b/src/main/java/org/apache/commons/compress/archivers/zip/X7875_NewUnix.java
index 9e1c01c..a540dba 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X7875_NewUnix.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X7875_NewUnix.java
@@ -132,8 +132,10 @@ public class X7875_NewUnix implements ZipExtraField, 
Cloneable, Serializable {
  */
 @Override
 public ZipShort getLocalFileDataLength() {
-final int uidSize = 
trimLeadingZeroesForceMinLength(uid.toByteArray()).length;
-final int gidSize = 
trimLeadingZeroesForceMinLength(gid.toByteArray()).length;
+byte[] b = trimLeadingZeroesForceMinLength(uid.toByteArray());
+final int uidSize = b == null ? 0 : b.length;
+b = trimLeadingZeroesForceMinLength(gid.toByteArray());
+final int gidSize = b == null ? 0 : b.length;
 
 // The 3 comes from:  version=1 + uidsize=1 + gidsize=1
 return new ZipShort(3 + uidSize + gidSize);
@@ -165,26 +167,36 @@ public class X7875_NewUnix implements ZipExtraField, 
Cloneable, Serializable {
 // (e.g., so that the sign-bit is set to zero).  We need to remove that
 // before sending the number over the wire.
 uidBytes = trimLeadingZeroesForceMinLength(uidBytes);
+int uidBytesLen = uidBytes != null ? uidBytes.length : 0;
 gidBytes = trimLeadingZeroesForceMinLength(gidBytes);
+int gidBytesLen = gidBytes != null ? gidBytes.length : 0;
 
 // Couldn't bring myself to just call getLocalFileDataLength() when 
we've
 // already got the arrays right here.  Yeah, yeah, I know, premature
 // optimization is the root of all...
 //
 // The 3 comes from:  version=1 + uidsize=1 + gidsize=1
-final byte[] data = new byte[3 + uidBytes.length + gidBytes.length];
+final byte[] data = new byte[3 + uidBytesLen + gidBytesLen];
 
 // reverse() switches byte array from big-endian to little-endian.
-reverse(uidBytes);
-reverse(gidBytes);
+if (uidBytes != null) {
+reverse(uidBytes);
+}
+if (gidBytes != null) {
+reverse(gidBytes);
+}
 
 int pos = 0;
 data[pos++] = unsignedIntToSignedByte(version);
-data[pos++] = unsignedIntToSignedByte(uidBytes.length);
-System.arraycopy(uidBytes, 0, data, pos, uidBytes.length);
-pos += uidBytes.length;
-data[pos++] = unsignedIntToSignedByte(gidBytes.length);
-System.arraycopy(gidBytes, 0, data, pos, gidBytes.length);
+data[pos++] = unsignedIntToSignedByte(uidBytesLen);
+if (uidBytes != null) {
+System.arraycopy(uidBytes, 0, data, pos, uidBytesLen);
+}
+pos += uidBytesLen;
+

[2/3] commons-compress git commit: looks like Sonar false positives to me

2017-06-24 Thread bodewig
looks like Sonar false positives to me


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/14fbf3aa
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/14fbf3aa
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/14fbf3aa

Branch: refs/heads/master
Commit: 14fbf3aa807d987e706939c41b7386b82889f3e6
Parents: 9caad35
Author: Stefan Bodewig 
Authored: Sat Jun 24 18:46:19 2017 +0200
Committer: Stefan Bodewig 
Committed: Sat Jun 24 18:46:19 2017 +0200

--
 .../org/apache/commons/compress/compressors/lzma/LZMAUtils.java| 2 +-
 .../java/org/apache/commons/compress/compressors/xz/XZUtils.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/14fbf3aa/src/main/java/org/apache/commons/compress/compressors/lzma/LZMAUtils.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/compressors/lzma/LZMAUtils.java 
b/src/main/java/org/apache/commons/compress/compressors/lzma/LZMAUtils.java
index c4579ff..f3d5170 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lzma/LZMAUtils.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lzma/LZMAUtils.java
@@ -151,7 +151,7 @@ public class LZMAUtils {
 cachedLZMAAvailability = CachedAvailability.DONT_CACHE;
 } else if (cachedLZMAAvailability == CachedAvailability.DONT_CACHE) {
 final boolean hasLzma = internalIsLZMACompressionAvailable();
-cachedLZMAAvailability = hasLzma ? 
CachedAvailability.CACHED_AVAILABLE
+cachedLZMAAvailability = hasLzma ? 
CachedAvailability.CACHED_AVAILABLE // NOSONAR
 : CachedAvailability.CACHED_UNAVAILABLE;
 }
 }

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/14fbf3aa/src/main/java/org/apache/commons/compress/compressors/xz/XZUtils.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/compressors/xz/XZUtils.java 
b/src/main/java/org/apache/commons/compress/compressors/xz/XZUtils.java
index e4e4be6..f518e3d 100644
--- a/src/main/java/org/apache/commons/compress/compressors/xz/XZUtils.java
+++ b/src/main/java/org/apache/commons/compress/compressors/xz/XZUtils.java
@@ -168,7 +168,7 @@ public class XZUtils {
 cachedXZAvailability = CachedAvailability.DONT_CACHE;
 } else if (cachedXZAvailability == CachedAvailability.DONT_CACHE) {
 final boolean hasXz = internalIsXZCompressionAvailable();
-cachedXZAvailability = hasXz ? CachedAvailability.CACHED_AVAILABLE
+cachedXZAvailability = hasXz ? CachedAvailability.CACHED_AVAILABLE 
// NOSONAR
 : CachedAvailability.CACHED_UNAVAILABLE;
 }
 }



commons-compress git commit: make Sonar less unhappy

2017-06-24 Thread bodewig
Repository: commons-compress
Updated Branches:
  refs/heads/master fb9b61804 -> c93d3e1d7


make Sonar less unhappy


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

Branch: refs/heads/master
Commit: c93d3e1d7db2971a4e1e7e79d7bf933268cb970e
Parents: fb9b618
Author: Stefan Bodewig 
Authored: Sat Jun 24 18:10:45 2017 +0200
Committer: Stefan Bodewig 
Committed: Sat Jun 24 18:16:31 2017 +0200

--
 .../archivers/zip/ZipArchiveOutputStream.java   |  3 +-
 .../compress/archivers/zip/ZipConstants.java|  4 +--
 .../utils/FixedLengthBlockOutputStream.java | 33 +++-
 3 files changed, 23 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/c93d3e1d/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
index 63aeba7..cb594f2 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
@@ -760,7 +760,8 @@ public class ZipArchiveOutputStream extends 
ArchiveOutputStream {
 
 final Zip64ExtendedInformationExtraField z64 = 
getZip64Extra(entry.entry);
 
-ZipEightByteInteger size, compressedSize;
+ZipEightByteInteger size;
+ZipEightByteInteger compressedSize;
 if (phased) {
 // sizes are already known
 size = new ZipEightByteInteger(entry.entry.getSize());

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/c93d3e1d/src/main/java/org/apache/commons/compress/archivers/zip/ZipConstants.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/zip/ZipConstants.java 
b/src/main/java/org/apache/commons/compress/archivers/zip/ZipConstants.java
index 23f04a8..c230991 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipConstants.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipConstants.java
@@ -23,8 +23,6 @@ package org.apache.commons.compress.archivers.zip;
  * @since 1.3
  */
 final class ZipConstants {
-private ZipConstants() { }
-
 /** Masks last eight bits */
 static final int BYTE_MASK = 0xFF;
 
@@ -64,4 +62,6 @@ final class ZipConstants {
  */
 static final long ZIP64_MAGIC = 0xL;
 
+private ZipConstants() { }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/c93d3e1d/src/main/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStream.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStream.java
 
b/src/main/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStream.java
index 8fe6d20..6c93f34 100644
--- 
a/src/main/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStream.java
@@ -102,7 +102,7 @@ public class FixedLengthBlockOutputStream extends 
OutputStream implements Writab
 
 @Override
 public void write(int b) throws IOException {
-if(!isOpen()) {
+if (!isOpen()) {
 throw new ClosedChannelException();
 }
 buffer.put((byte) b);
@@ -110,10 +110,12 @@ public class FixedLengthBlockOutputStream extends 
OutputStream implements Writab
 }
 
 @Override
-public void write(byte[] b, int off, int len) throws IOException {
-if(!isOpen()) {
+public void write(byte[] b, final int offset, final int length) throws 
IOException {
+if (!isOpen()) {
 throw new ClosedChannelException();
 }
+int off = offset;
+int len = length;
 while (len > 0) {
 int n = Math.min(len, buffer.remaining());
 buffer.put(b, off, n);
@@ -125,7 +127,7 @@ public class FixedLengthBlockOutputStream extends 
OutputStream implements Writab
 
 @Override
 public int write(ByteBuffer src) throws IOException {
-if(!isOpen()) {
+if (!isOpen()) {
 throw new ClosedChannelException();
 }
 int srcRemaining = src.remaining();
@@ -161,7 +163,7 @@ public class 

[2/2] commons-fileupload git commit: Merge remote-tracking branch 'kinow/FILEUPLOAD-283'

2017-06-24 Thread kinow
Merge remote-tracking branch 'kinow/FILEUPLOAD-283'

This closes #8


Project: http://git-wip-us.apache.org/repos/asf/commons-fileupload/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/commons-fileupload/commit/86a79bce
Tree: http://git-wip-us.apache.org/repos/asf/commons-fileupload/tree/86a79bce
Diff: http://git-wip-us.apache.org/repos/asf/commons-fileupload/diff/86a79bce

Branch: refs/heads/master
Commit: 86a79bceac4a267819de986ca814f11b48d81da3
Parents: 94e5e1a f8f529e
Author: Bruno P. Kinoshita 
Authored: Sun Jun 25 17:04:04 2017 +1200
Committer: Bruno P. Kinoshita 
Committed: Sun Jun 25 17:04:04 2017 +1200

--
 .../apache/commons/fileupload/Constants.java|  32 ++
 .../commons/fileupload/DiskFileUploadTest.java  |  67 +++
 .../commons/fileupload/FileUploadTest.java  | 399 +
 .../commons/fileupload/FileUploadTestCase.java  |  52 ---
 .../fileupload/MockHttpServletRequest.java  |   2 +-
 .../commons/fileupload/MultipartStreamTest.java |   1 -
 .../fileupload/ProgressListenerTest.java|  15 +-
 .../fileupload/ServletFileUploadTest.java   | 446 ---
 .../apache/commons/fileupload/SizesTest.java|  30 +-
 .../org/apache/commons/fileupload/Util.java |  63 +++
 .../portlet/MockPortletActionRequest.java   | 271 +++
 .../portlet/PortletFileUploadTest.java  |  86 
 .../servlet/ServletFileUploadTest.java  |  89 
 13 files changed, 1033 insertions(+), 520 deletions(-)
--




[1/2] commons-fileupload git commit: FILEUPLOAD-283: add tests for the portlet package

2017-06-24 Thread kinow
Repository: commons-fileupload
Updated Branches:
  refs/heads/master 94e5e1a77 -> 86a79bcea


FILEUPLOAD-283: add tests for the portlet package


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

Branch: refs/heads/master
Commit: f8f529ee0baecc9262317cc5375af1eb42aadab4
Parents: b148d5f
Author: Bruno P. Kinoshita 
Authored: Sun Jun 11 17:23:07 2017 +1200
Committer: Bruno P. Kinoshita 
Committed: Sat Jun 17 11:05:42 2017 +1200

--
 .../apache/commons/fileupload/Constants.java|  32 ++
 .../commons/fileupload/DiskFileUploadTest.java  |  67 +++
 .../commons/fileupload/FileUploadTest.java  | 399 +
 .../commons/fileupload/FileUploadTestCase.java  |  52 ---
 .../fileupload/MockHttpServletRequest.java  |   2 +-
 .../commons/fileupload/MultipartStreamTest.java |   1 -
 .../fileupload/ProgressListenerTest.java|  15 +-
 .../fileupload/ServletFileUploadTest.java   | 446 ---
 .../apache/commons/fileupload/SizesTest.java|  30 +-
 .../org/apache/commons/fileupload/Util.java |  63 +++
 .../portlet/MockPortletActionRequest.java   | 271 +++
 .../portlet/PortletFileUploadTest.java  |  86 
 .../servlet/ServletFileUploadTest.java  |  89 
 13 files changed, 1033 insertions(+), 520 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-fileupload/blob/f8f529ee/src/test/java/org/apache/commons/fileupload/Constants.java
--
diff --git a/src/test/java/org/apache/commons/fileupload/Constants.java 
b/src/test/java/org/apache/commons/fileupload/Constants.java
new file mode 100644
index 000..69eaa53
--- /dev/null
+++ b/src/test/java/org/apache/commons/fileupload/Constants.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.fileupload;
+
+/**
+ * Constants used for testing.
+ *
+ * @since 1.4
+ */
+public final class Constants {
+
+/**
+ * The content type used in several tests.
+ */
+public static final String CONTENT_TYPE = "multipart/form-data; 
boundary=---1234";
+
+private Constants() {}
+}

http://git-wip-us.apache.org/repos/asf/commons-fileupload/blob/f8f529ee/src/test/java/org/apache/commons/fileupload/DiskFileUploadTest.java
--
diff --git 
a/src/test/java/org/apache/commons/fileupload/DiskFileUploadTest.java 
b/src/test/java/org/apache/commons/fileupload/DiskFileUploadTest.java
new file mode 100644
index 000..49f65f0
--- /dev/null
+++ b/src/test/java/org/apache/commons/fileupload/DiskFileUploadTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.fileupload;
+
+import static org.junit.Assert.fail;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test for {@link DiskFileUpload}. Remove when deprecated class is removed.
+ *
+ * @since 1.4
+ */

[3/3] commons-compress git commit: COMPRESS-407 record backwards incompatible change

2017-06-24 Thread bodewig
COMPRESS-407 record backwards incompatible change

closes #40 && closes #41 && closes #42


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

Branch: refs/heads/master
Commit: fb9b6180428694c45a8befab3ca32834d99acece
Parents: e57007c
Author: Stefan Bodewig 
Authored: Sat Jun 24 17:13:24 2017 +0200
Committer: Stefan Bodewig 
Committed: Sat Jun 24 17:13:24 2017 +0200

--
 src/changes/changes.xml | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/fb9b6180/src/changes/changes.xml
--
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0ec4038..b9dafea 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -43,7 +43,13 @@ The  type attribute can be add,update,fix,remove.
   
   
 
+ description="Release 1.15
+
+
+TarArchiveOutputStream now ensures record size is 512 and block size is
+a multiple of 512 as any other value would create invalid tar
+archives. This may break compatibility for code that deliberately
+wanted to create such files.">
   
 Make sure "version needed to extract" in local file header and
 central directory of a ZIP archive agree with each other.
@@ -77,6 +83,13 @@ The  type attribute can be add,update,fix,remove.
 Made sure ChecksumCalculatingInputStream receives valid
 checksum and input stream instances via the cnstructor.
   
+  
+TarArchiveOutputStream now verifies the block and record sizes
+specified at construction time are compatible with the tar
+specification. In particular 512 is the only recird size
+accepted and the block size must be a multiple of 512.
+  
 
 



[1/3] commons-compress git commit: COMPRESS-407 Validate Block and Record Sizes

2017-06-24 Thread bodewig
Repository: commons-compress
Updated Branches:
  refs/heads/master 4be9979b4 -> fb9b61804


COMPRESS-407 Validate Block and Record Sizes

Require block size >=0 that is multiple of 512 bytes.
Use block size of 512 if one is not given.
Require record size of 512 bytes. Deprecate constructors taking recordSize as 
parameter

Modify tests to check for enforcement of record size == 512
Modify tests to check for correct overall length  for
different block sizes including PAX default, USTAR default, and unspecified.

Signed-off-by: Simon Spero 

(cherry picked from commit d754d89)
Signed-off-by: Simon Spero 


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

Branch: refs/heads/master
Commit: b6ae1d09c384b57115bb34ed94c90e256e4b66b9
Parents: 4be9979
Author: Simon Spero 
Authored: Sun Jun 11 18:48:42 2017 -0400
Committer: Stefan Bodewig 
Committed: Sat Jun 24 16:50:39 2017 +0200

--
 .../archivers/tar/TarArchiveOutputStream.java   | 217 +++
 .../tar/TarArchiveOutputStreamTest.java | 209 --
 2 files changed, 261 insertions(+), 165 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/b6ae1d09/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
index 79c7bca..864d4ad 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
@@ -61,18 +61,18 @@ public class TarArchiveOutputStream extends 
ArchiveOutputStream {
 
 /** POSIX/PAX extensions are used to store big numbers in the archive. */
 public static final int BIGNUMBER_POSIX = 2;
-
-private long  currSize;
-private StringcurrName;
-private long  currBytes;
-private final byte[]recordBuf;
-private int   assemLen;
-private final byte[]assemBuf;
-private int   longFileMode = LONGFILE_ERROR;
-private int   bigNumberMode = BIGNUMBER_ERROR;
+private static final int RECORD_SIZE = 512;
+
+private long currSize;
+private String currName;
+private long currBytes;
+private final byte[] recordBuf;
+private int assemLen;
+private final byte[] assemBuf;
+private int longFileMode = LONGFILE_ERROR;
+private int bigNumberMode = BIGNUMBER_ERROR;
 private int recordsWritten;
 private final int recordsPerBlock;
-private final int recordSize;
 
 private boolean closed = false;
 
@@ -93,12 +93,14 @@ public class TarArchiveOutputStream extends 
ArchiveOutputStream {
 private static final ZipEncoding ASCII =
 ZipEncodingHelper.getZipEncoding("ASCII");
 
+private static int BLOCK_SIZE_UNSPECIFIED = -511;
+
 /**
  * Constructor for TarInputStream.
  * @param os the output stream to use
  */
 public TarArchiveOutputStream(final OutputStream os) {
-this(os, TarConstants.DEFAULT_BLKSIZE, TarConstants.DEFAULT_RCDSIZE);
+this(os, BLOCK_SIZE_UNSPECIFIED);
 }
 
 /**
@@ -108,59 +110,82 @@ public class TarArchiveOutputStream extends 
ArchiveOutputStream {
  * @since 1.4
  */
 public TarArchiveOutputStream(final OutputStream os, final String 
encoding) {
-this(os, TarConstants.DEFAULT_BLKSIZE, TarConstants.DEFAULT_RCDSIZE, 
encoding);
+this(os, BLOCK_SIZE_UNSPECIFIED, encoding);
 }
 
 /**
  * Constructor for TarInputStream.
  * @param os the output stream to use
- * @param blockSize the block size to use
+ * @param blockSize the block size to use. Must be a multiple of 512 bytes.
  */
 public TarArchiveOutputStream(final OutputStream os, final int blockSize) {
-this(os, blockSize, TarConstants.DEFAULT_RCDSIZE);
+this(os, blockSize, null);
 }
 
+
 /**
  * Constructor for TarInputStream.
  * @param os the output stream to use
  * @param blockSize the block size to use
- * @param encoding name of the encoding to use for file names
- * @since 1.4
+ * @param recordSize the record size to use. Must be 512 bytes.
+ * @deprecated recordSize must always be 512 bytes. An 
IllegalArgumentException will be thrown
+ * if any other value is used
  */
+@Deprecated
 

[2/3] commons-compress git commit: COMPRESS-407 tweaks

2017-06-24 Thread bodewig
COMPRESS-407 tweaks


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

Branch: refs/heads/master
Commit: e57007c00d577c8f66a5d93681058a528613645c
Parents: b6ae1d0
Author: Stefan Bodewig 
Authored: Sat Jun 24 17:02:30 2017 +0200
Committer: Stefan Bodewig 
Committed: Sat Jun 24 17:02:30 2017 +0200

--
 .../commons/compress/archivers/tar/TarArchiveOutputStream.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/e57007c0/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
--
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
index 864d4ad..6b31705 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
@@ -93,7 +93,7 @@ public class TarArchiveOutputStream extends 
ArchiveOutputStream {
 private static final ZipEncoding ASCII =
 ZipEncodingHelper.getZipEncoding("ASCII");
 
-private static int BLOCK_SIZE_UNSPECIFIED = -511;
+private static final int BLOCK_SIZE_UNSPECIFIED = -511;
 
 /**
  * Constructor for TarInputStream.
@@ -175,7 +175,7 @@ public class TarArchiveOutputStream extends 
ArchiveOutputStream {
 realBlockSize = blockSize;
 }
 
-if(realBlockSize <=0 || realBlockSize % RECORD_SIZE != 0) {
+if (realBlockSize <=0 || realBlockSize % RECORD_SIZE != 0) {
 throw new IllegalArgumentException("Block size must be a multiple 
of 512 bytes. Attempt to use set size of " + blockSize);
 }
 out = new CountingOutputStream(os);