You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2016/04/10 06:18:17 UTC
[01/46] commons-compress git commit: reduce code duplication with
patch by Thomas Meyer
Repository: commons-compress
Updated Branches:
refs/heads/COMPRESS-207 17501ed87 -> ffc026d06
reduce code duplication with patch by Thomas Meyer
the patch was part of a patch attached to COMPRESS-207
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/21d1f01f
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/21d1f01f
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/21d1f01f
Branch: refs/heads/COMPRESS-207
Commit: 21d1f01f681d78ab6b710f7fce84e2238a63439c
Parents: bee2612
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Mar 27 18:37:09 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Mar 27 18:37:09 2016 +0200
----------------------------------------------------------------------
.../bzip2/BZip2CompressorInputStream.java | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/21d1f01f/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 4456860..edf90cb 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
@@ -392,23 +392,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
}
private boolean bsGetBit() throws IOException {
- int bsLiveShadow = this.bsLive;
- int bsBuffShadow = this.bsBuff;
-
- if (bsLiveShadow < 1) {
- int thech = this.in.read();
-
- if (thech < 0) {
- throw new IOException("unexpected end of stream");
- }
-
- bsBuffShadow = (bsBuffShadow << 8) | thech;
- bsLiveShadow += 8;
- this.bsBuff = bsBuffShadow;
- }
-
- this.bsLive = bsLiveShadow - 1;
- return ((bsBuffShadow >> (bsLiveShadow - 1)) & 1) != 0;
+ return bsR(1) != 0;
}
private char bsGetUByte() throws IOException {
[21/46] commons-compress git commit: Refactor magic string.
Posted by bo...@apache.org.
Refactor magic string.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ac6b5f3a
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ac6b5f3a
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ac6b5f3a
Branch: refs/heads/COMPRESS-207
Commit: ac6b5f3a7e1dc36c9ec4f2d34a20f311ee760900
Parents: e21728c
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 08:55:27 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 08:55:27 2016 -0700
----------------------------------------------------------------------
.../compress/archivers/ArchiveStreamFactoryTest.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ac6b5f3a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
index a64b9a6..338df54 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
@@ -42,6 +42,8 @@ import org.junit.Test;
public class ArchiveStreamFactoryTest {
+ private static final String UNKNOWN = "??";
+
/**
* see https://issues.apache.org/jira/browse/COMPRESS-171
*/
@@ -228,7 +230,7 @@ public class ArchiveStreamFactoryTest {
static {
String dflt;
- dflt = "??";
+ dflt = UNKNOWN;
try {
dflt = getField(new ArjArchiveInputStream(new FileInputStream(getFile("bla.arj"))), "charsetName");
} catch (ArchiveException e) {
@@ -237,7 +239,7 @@ public class ArchiveStreamFactoryTest {
e.printStackTrace();
}
ARJ_DEFAULT = dflt;
- dflt = "??";
+ dflt = UNKNOWN;
try {
dflt = getField(new DumpArchiveInputStream(new FileInputStream(getFile("bla.dump"))), "encoding");
} catch (ArchiveException e) {
@@ -357,7 +359,7 @@ public class ArchiveStreamFactoryTest {
fld = cls.getSuperclass().getDeclaredField(name);
} catch (NoSuchFieldException e) {
System.out.println("Cannot find " + name + " in class " + instance.getClass().getSimpleName());
- return "??";
+ return UNKNOWN;
}
}
boolean isAccessible = fld.isAccessible();
@@ -370,10 +372,10 @@ public class ArchiveStreamFactoryTest {
return (String) object;
}
System.out.println("Wrong type: " + object.getClass().getCanonicalName() + " for " + name + " in class " + instance.getClass().getSimpleName());
- return "??";
+ return UNKNOWN;
} catch (Exception e) {
e.printStackTrace();
- return "??";
+ return UNKNOWN;
} finally {
if (!isAccessible) {
fld.setAccessible(isAccessible);
[35/46] commons-compress git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/commons-compress.git
Posted by bo...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-compress.git
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/bf85a64a
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/bf85a64a
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/bf85a64a
Branch: refs/heads/COMPRESS-207
Commit: bf85a64aaee3abee6f25f031862561162a613dd9
Parents: 478bef3 c84c34e
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 10:06:50 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 10:06:50 2016 -0700
----------------------------------------------------------------------
pom.xml | 13 ++++
src/changes/changes.xml | 2 +-
.../archivers/sevenz/AES256SHA256Decoder.java | 19 ++----
.../compress/archivers/sevenz/Coders.java | 9 ++-
.../archivers/tar/TarArchiveInputStream.java | 4 +-
.../commons/compress/AbstractTestCase.java | 5 +-
.../archivers/sevenz/SevenZNativeHeapTest.java | 64 ++++++++++++++++++++
7 files changed, 89 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/bf85a64a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/bf85a64a/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/bf85a64a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/bf85a64a/src/test/java/org/apache/commons/compress/AbstractTestCase.java
----------------------------------------------------------------------
[17/46] commons-compress git commit: Add missing '@Override'
annotations.
Posted by bo...@apache.org.
Add missing '@Override' annotations.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/24e93896
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/24e93896
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/24e93896
Branch: refs/heads/COMPRESS-207
Commit: 24e938962728b05aa5b21654ea7146bab8302f4c
Parents: ab85f00
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 00:56:41 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 00:56:41 2016 -0700
----------------------------------------------------------------------
.../apache/commons/compress/archivers/zip/StreamCompressor.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/24e93896/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
index f1c810e..657a492 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
@@ -270,6 +270,7 @@ public abstract class StreamCompressor implements Closeable {
this.bs = bs;
}
+ @Override
protected final void writeOut(byte[] data, int offset, int length)
throws IOException {
bs.writeOut(data, offset, length);
@@ -284,6 +285,7 @@ public abstract class StreamCompressor implements Closeable {
this.os = os;
}
+ @Override
protected final void writeOut(byte[] data, int offset, int length)
throws IOException {
os.write(data, offset, length);
@@ -298,6 +300,7 @@ public abstract class StreamCompressor implements Closeable {
this.raf = raf;
}
+ @Override
protected final void writeOut(byte[] data, int offset, int length)
throws IOException {
raf.write(data, offset, length);
[24/46] commons-compress git commit: Add missing '@Override'
annotations to implementations of interface methods.
Posted by bo...@apache.org.
Add missing '@Override' annotations to implementations of interface
methods.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ab17a705
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ab17a705
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ab17a705
Branch: refs/heads/COMPRESS-207
Commit: ab17a70527ee46e3632be8911a31931fc3e78183
Parents: 35d616f
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 09:04:17 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 09:04:17 2016 -0700
----------------------------------------------------------------------
.../compress/archivers/ar/ArArchiveEntry.java | 4 ++++
.../compress/archivers/arj/ArjArchiveEntry.java | 4 ++++
.../archivers/cpio/CpioArchiveEntry.java | 4 ++++
.../archivers/dump/DumpArchiveEntry.java | 4 ++++
.../archivers/dump/DumpArchiveInputStream.java | 1 +
.../archivers/sevenz/SevenZArchiveEntry.java | 4 ++++
.../compress/archivers/sevenz/SevenZFile.java | 1 +
.../archivers/sevenz/SevenZOutputFile.java | 1 +
.../compress/archivers/tar/TarArchiveEntry.java | 4 ++++
.../compress/archivers/tar/TarUtils.java | 3 +++
.../zip/AbstractUnicodeExtraField.java | 6 +++++
.../compress/archivers/zip/AsiExtraField.java | 7 ++++++
.../archivers/zip/FallbackZipEncoding.java | 3 +++
.../compress/archivers/zip/JarMarker.java | 7 ++++++
.../compress/archivers/zip/NioZipEncoding.java | 3 +++
.../archivers/zip/PKWareExtraHeader.java | 7 ++++++
.../zip/ParallelScatterZipCreator.java | 2 ++
.../archivers/zip/ScatterZipOutputStream.java | 1 +
.../archivers/zip/Simple8BitZipEncoding.java | 4 ++++
.../archivers/zip/StreamCompressor.java | 1 +
.../archivers/zip/UnicodeCommentExtraField.java | 1 +
.../archivers/zip/UnicodePathExtraField.java | 1 +
.../zip/UnparseableExtraFieldData.java | 7 ++++++
.../archivers/zip/UnrecognizedExtraField.java | 7 ++++++
.../compress/archivers/zip/X000A_NTFS.java | 7 ++++++
.../archivers/zip/X5455_ExtendedTimestamp.java | 7 ++++++
.../compress/archivers/zip/X7875_NewUnix.java | 7 ++++++
.../zip/Zip64ExtendedInformationExtraField.java | 7 ++++++
.../compress/archivers/zip/ZipArchiveEntry.java | 1 +
.../commons/compress/archivers/zip/ZipFile.java | 2 ++
.../compress/changes/ChangeSetPerformer.java | 6 +++++
.../compressors/snappy/PureJavaCrc32C.java | 12 ++++++----
.../FileBasedScatterGatherBackingStore.java | 4 ++++
.../commons/compress/utils/BitInputStream.java | 1 +
.../commons/compress/ArchiveReadTest.java | 1 +
.../compress/archivers/LongPathTest.java | 1 +
.../compress/archivers/LongSymLinkTest.java | 1 +
.../commons/compress/archivers/ZipTestCase.java | 1 +
.../archivers/memory/MemoryArchiveEntry.java | 4 ++++
.../zip/ParallelScatterZipCreatorTest.java | 3 +++
.../archivers/zip/ScatterSampleTest.java | 1 +
.../zip/ScatterZipOutputStreamTest.java | 1 +
.../compress/archivers/zip/Zip64SupportIT.java | 25 +++++++++++++++++---
.../compressors/FramedSnappyTestCase.java | 3 +++
.../commons/compress/compressors/ZTestCase.java | 3 +++
.../commons/compress/utils/IOUtilsTest.java | 3 +++
46 files changed, 181 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
index ab419fd..36a8b40 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
@@ -117,10 +117,12 @@ public class ArArchiveEntry implements ArchiveEntry {
0, 0, DEFAULT_MODE, inputFile.lastModified() / 1000);
}
+ @Override
public long getSize() {
return this.getLength();
}
+ @Override
public String getName() {
return name;
}
@@ -145,6 +147,7 @@ public class ArArchiveEntry implements ArchiveEntry {
return lastModified;
}
+ @Override
public Date getLastModifiedDate() {
return new Date(1000 * getLastModified());
}
@@ -153,6 +156,7 @@ public class ArArchiveEntry implements ArchiveEntry {
return length;
}
+ @Override
public boolean isDirectory() {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
index a033a14..4a080b2 100644
--- a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
@@ -46,6 +46,7 @@ public class ArjArchiveEntry implements ArchiveEntry {
*
* @return This entry's name.
*/
+ @Override
public String getName() {
if ((localFileHeader.arjFlags & LocalFileHeader.Flags.PATHSYM) != 0) {
return localFileHeader.name.replaceAll("/",
@@ -59,6 +60,7 @@ public class ArjArchiveEntry implements ArchiveEntry {
*
* @return This entry's file size.
*/
+ @Override
public long getSize() {
return localFileHeader.originalSize;
}
@@ -67,6 +69,7 @@ public class ArjArchiveEntry implements ArchiveEntry {
*
* @return True if the entry refers to a directory
*/
+ @Override
public boolean isDirectory() {
return localFileHeader.fileType == LocalFileHeader.FileTypes.DIRECTORY;
}
@@ -86,6 +89,7 @@ public class ArjArchiveEntry implements ArchiveEntry {
*
* @return the last modified date
*/
+ @Override
public Date getLastModifiedDate() {
long ts = isHostOsUnix() ? localFileHeader.dateTimeModified * 1000l
: ZipUtil.dosToJavaTime(0xFFFFFFFFL & localFileHeader.dateTimeModified);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
index 4ea1a54..10d40d2 100644
--- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
@@ -422,6 +422,7 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry {
* @return Returns the filesize.
* @see org.apache.commons.compress.archivers.ArchiveEntry#getSize()
*/
+ @Override
public long getSize() {
return this.filesize;
}
@@ -518,6 +519,7 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry {
*
* @return Returns the name.
*/
+ @Override
public String getName() {
return this.name;
}
@@ -581,6 +583,7 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry {
return this.mtime;
}
+ @Override
public Date getLastModifiedDate() {
return new Date(1000 * getTime());
}
@@ -617,6 +620,7 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry {
*
* @return TRUE if this entry is a directory.
*/
+ @Override
public boolean isDirectory() {
return CpioUtil.fileType(mode) == C_ISDIR;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/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 e5c7a01..0a3d546 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
@@ -563,6 +563,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Returns the name of the entry.
* @return the name of the entry.
*/
+ @Override
public String getName() {
return name;
}
@@ -596,6 +597,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* The last modified date.
* @return the last modified date
*/
+ @Override
public Date getLastModifiedDate() {
return new Date(mtime);
}
@@ -604,6 +606,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Is this a directory?
* @return whether this is a directory
*/
+ @Override
public boolean isDirectory() {
return type == TYPE.DIRECTORY;
}
@@ -693,6 +696,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Returns the size of the entry.
* @return the size
*/
+ @Override
public long getSize() {
return isDirectory() ? SIZE_UNKNOWN : size;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
index fa8f6a7..1b4ac3f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
@@ -138,6 +138,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
// released first.
queue = new PriorityQueue<DumpArchiveEntry>(10,
new Comparator<DumpArchiveEntry>() {
+ @Override
public int compare(DumpArchiveEntry p, DumpArchiveEntry q) {
if (p.getOriginalName() == null || q.getOriginalName() == null) {
return Integer.MAX_VALUE;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
index b15bb7d..c6317ce 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
@@ -57,6 +57,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
*
* @return This entry's name.
*/
+ @Override
public String getName() {
return name;
}
@@ -91,6 +92,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
*
* @return True if this entry is a directory.
*/
+ @Override
public boolean isDirectory() {
return isDirectory;
}
@@ -195,6 +197,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* last modified date.
* @return the last modified date
*/
+ @Override
public Date getLastModifiedDate() {
if (hasLastModifiedDate) {
return ntfsTimeToJavaTime(lastModifiedDate);
@@ -404,6 +407,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
*
* @return This entry's file size.
*/
+ @Override
public long getSize() {
return size;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index 2512eec..ab6198e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -126,6 +126,7 @@ public class SevenZFile implements Closeable {
* Closes the archive.
* @throws IOException if closing the file fails
*/
+ @Override
public void close() throws IOException {
if (file != null) {
try {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
index 1886898..4e273a2 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
@@ -106,6 +106,7 @@ public class SevenZOutputFile implements Closeable {
*
* @throws IOException on error
*/
+ @Override
public void close() throws IOException {
if (!finished) {
finish();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
index 1938f67..4fac7d5 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
@@ -419,6 +419,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @return This entry's name.
*/
+ @Override
public String getName() {
return name;
}
@@ -629,6 +630,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
return new Date(modTime * MILLIS_PER_SECOND);
}
+ @Override
public Date getLastModifiedDate() {
return getModTime();
}
@@ -667,6 +669,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @return This entry's file size.
*/
+ @Override
public long getSize() {
return size;
}
@@ -841,6 +844,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @return True if this entry is a directory.
*/
+ @Override
public boolean isDirectory() {
if (file != null) {
return file.isDirectory();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
index 28f7164..ba850a5 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
@@ -45,8 +45,10 @@ public class TarUtils {
* ZipEncoding.
*/
static final ZipEncoding FALLBACK_ENCODING = new ZipEncoding() {
+ @Override
public boolean canEncode(String name) { return true; }
+ @Override
public ByteBuffer encode(String name) {
final int length = name.length();
byte[] buf = new byte[length];
@@ -58,6 +60,7 @@ public class TarUtils {
return ByteBuffer.wrap(buf);
}
+ @Override
public String decode(byte[] buffer) {
final int length = buffer.length;
StringBuilder result = new StringBuilder(length);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
index 4dbfc40..21d5edf 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
@@ -127,6 +127,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
data = null;
}
+ @Override
public byte[] getCentralDirectoryData() {
if (data == null) {
this.assembleData();
@@ -139,6 +140,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
return b;
}
+ @Override
public ZipShort getCentralDirectoryLength() {
if (data == null) {
assembleData();
@@ -146,14 +148,17 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
return new ZipShort(data != null ? data.length : 0);
}
+ @Override
public byte[] getLocalFileDataData() {
return getCentralDirectoryData();
}
+ @Override
public ZipShort getLocalFileDataLength() {
return getCentralDirectoryLength();
}
+ @Override
public void parseFromLocalFileData(byte[] buffer, int offset, int length)
throws ZipException {
@@ -178,6 +183,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
* Doesn't do anything special since this class always uses the
* same data in central directory and local file data.
*/
+ @Override
public void parseFromCentralDirectoryData(byte[] buffer, int offset,
int length)
throws ZipException {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
index a2dc1c3..983422a 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
@@ -89,6 +89,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* The Header-ID.
* @return the value for the header id for this extrafield
*/
+ @Override
public ZipShort getHeaderId() {
return HEADER_ID;
}
@@ -98,6 +99,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* Header-ID or length specifier.
* @return a <code>ZipShort</code> for the length of the data of this extra field
*/
+ @Override
public ZipShort getLocalFileDataLength() {
return new ZipShort(WORD // CRC
+ 2 // Mode
@@ -112,6 +114,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* Delegate to local file data.
* @return the centralDirectory length
*/
+ @Override
public ZipShort getCentralDirectoryLength() {
return getLocalFileDataLength();
}
@@ -121,6 +124,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* or length specifier.
* @return get the data
*/
+ @Override
public byte[] getLocalFileDataData() {
// CRC will be added later
byte[] data = new byte[getLocalFileDataLength().getValue() - WORD];
@@ -153,6 +157,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* Delegate to local file data.
* @return the local file data
*/
+ @Override
public byte[] getCentralDirectoryData() {
return getLocalFileDataData();
}
@@ -258,6 +263,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* @param length the number of bytes in the array from offset
* @throws ZipException on error
*/
+ @Override
public void parseFromLocalFileData(byte[] data, int offset, int length)
throws ZipException {
@@ -295,6 +301,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* Doesn't do anything special since this class always uses the
* same data in central directory and local file data.
*/
+ @Override
public void parseFromCentralDirectoryData(byte[] buffer, int offset,
int length)
throws ZipException {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java b/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
index 14bab4a..4551b79 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
@@ -65,6 +65,7 @@ class FallbackZipEncoding implements ZipEncoding {
* @see
* org.apache.commons.compress.archivers.zip.ZipEncoding#canEncode(java.lang.String)
*/
+ @Override
public boolean canEncode(String name) {
return true;
}
@@ -73,6 +74,7 @@ class FallbackZipEncoding implements ZipEncoding {
* @see
* org.apache.commons.compress.archivers.zip.ZipEncoding#encode(java.lang.String)
*/
+ @Override
public ByteBuffer encode(String name) throws IOException {
if (this.charsetName == null) { // i.e. use default charset, see no-args constructor
return ByteBuffer.wrap(name.getBytes());
@@ -84,6 +86,7 @@ class FallbackZipEncoding implements ZipEncoding {
* @see
* org.apache.commons.compress.archivers.zip.ZipEncoding#decode(byte[])
*/
+ @Override
public String decode(byte[] data) throws IOException {
if (this.charsetName == null) { // i.e. use default charset, see no-args constructor
return new String(data);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java b/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java
index f5dde85..81d9053 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java
@@ -48,6 +48,7 @@ public final class JarMarker implements ZipExtraField {
* The Header-ID.
* @return the header id
*/
+ @Override
public ZipShort getHeaderId() {
return ID;
}
@@ -57,6 +58,7 @@ public final class JarMarker implements ZipExtraField {
* Header-ID or length specifier.
* @return 0
*/
+ @Override
public ZipShort getLocalFileDataLength() {
return NULL;
}
@@ -66,6 +68,7 @@ public final class JarMarker implements ZipExtraField {
* Header-ID or length specifier.
* @return 0
*/
+ @Override
public ZipShort getCentralDirectoryLength() {
return NULL;
}
@@ -75,6 +78,7 @@ public final class JarMarker implements ZipExtraField {
* or length specifier.
* @return the data
*/
+ @Override
public byte[] getLocalFileDataData() {
return NO_BYTES;
}
@@ -84,6 +88,7 @@ public final class JarMarker implements ZipExtraField {
* length specifier.
* @return the data
*/
+ @Override
public byte[] getCentralDirectoryData() {
return NO_BYTES;
}
@@ -96,6 +101,7 @@ public final class JarMarker implements ZipExtraField {
*
* @throws ZipException on error
*/
+ @Override
public void parseFromLocalFileData(byte[] data, int offset, int length)
throws ZipException {
if (length != 0) {
@@ -107,6 +113,7 @@ public final class JarMarker implements ZipExtraField {
* Doesn't do anything special since this class always uses the
* same data in central directory and local file data.
*/
+ @Override
public void parseFromCentralDirectoryData(byte[] buffer, int offset,
int length)
throws ZipException {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java b/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
index f93192c..9ec15a5 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
@@ -55,6 +55,7 @@ class NioZipEncoding implements ZipEncoding {
* @see
* org.apache.commons.compress.archivers.zip.ZipEncoding#canEncode(java.lang.String)
*/
+ @Override
public boolean canEncode(String name) {
CharsetEncoder enc = this.charset.newEncoder();
enc.onMalformedInput(CodingErrorAction.REPORT);
@@ -67,6 +68,7 @@ class NioZipEncoding implements ZipEncoding {
* @see
* org.apache.commons.compress.archivers.zip.ZipEncoding#encode(java.lang.String)
*/
+ @Override
public ByteBuffer encode(String name) {
CharsetEncoder enc = this.charset.newEncoder();
@@ -114,6 +116,7 @@ class NioZipEncoding implements ZipEncoding {
* @see
* org.apache.commons.compress.archivers.zip.ZipEncoding#decode(byte[])
*/
+ @Override
public String decode(byte[] data) throws IOException {
return this.charset.newDecoder()
.onMalformedInput(CodingErrorAction.REPORT)
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java b/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
index f733a1b..ce52c6f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
@@ -86,6 +86,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
*
* @return the header id
*/
+ @Override
public ZipShort getHeaderId() {
return headerId;
}
@@ -106,6 +107,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
*
* @return the length of the local data
*/
+ @Override
public ZipShort getLocalFileDataLength() {
return new ZipShort(localData != null ? localData.length : 0);
}
@@ -115,6 +117,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
*
* @return the local data
*/
+ @Override
public byte[] getLocalFileDataData() {
return ZipUtil.copy(localData);
}
@@ -135,6 +138,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
*
* @return the central data length
*/
+ @Override
public ZipShort getCentralDirectoryLength() {
if (centralData != null) {
return new ZipShort(centralData.length);
@@ -147,6 +151,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
*
* @return the central data if present, else return the local file data
*/
+ @Override
public byte[] getCentralDirectoryData() {
if (centralData != null) {
return ZipUtil.copy(centralData);
@@ -163,6 +168,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
* the number of bytes to use in the data array.
* @see ZipExtraField#parseFromLocalFileData(byte[], int, int)
*/
+ @Override
public void parseFromLocalFileData(byte[] data, int offset, int length) {
byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
@@ -178,6 +184,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
* the number of bytes to use in the data array.
* @see ZipExtraField#parseFromCentralDirectoryData(byte[], int, int)
*/
+ @Override
public void parseFromCentralDirectoryData(byte[] data, int offset, int length) {
byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java b/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
index 198bed1..26d9807 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
@@ -64,6 +64,7 @@ public class ParallelScatterZipCreator {
private static class DefaultBackingStoreSupplier implements ScatterGatherBackingStoreSupplier {
final AtomicInteger storeNum = new AtomicInteger(0);
+ @Override
public ScatterGatherBackingStore get() throws IOException {
File tempFile = File.createTempFile("parallelscatter", "n" + storeNum.incrementAndGet());
return new FileBasedScatterGatherBackingStore(tempFile);
@@ -171,6 +172,7 @@ public class ParallelScatterZipCreator {
}
final ZipArchiveEntryRequest zipArchiveEntryRequest = createZipArchiveEntryRequest(zipArchiveEntry, source);
return new Callable<Object>() {
+ @Override
public Object call() throws Exception {
tlScatterStreams.get().addArchiveEntry(zipArchiveEntryRequest);
return null;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
index 862666f..0edaa3f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
@@ -124,6 +124,7 @@ public class ScatterZipOutputStream implements Closeable {
* Closes this stream, freeing all resources involved in the creation of this stream.
* @throws IOException If closing fails
*/
+ @Override
public void close() throws IOException {
backingStore.close();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java b/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
index 4535247..f6f7b35 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
@@ -59,6 +59,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
this.unicode = unicode;
}
+ @Override
public int compareTo(Simple8BitChar a) {
return this.unicode - a.unicode;
}
@@ -216,6 +217,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* @see
* org.apache.commons.compress.archivers.zip.ZipEncoding#canEncode(java.lang.String)
*/
+ @Override
public boolean canEncode(String name) {
for (int i=0;i<name.length();++i) {
@@ -234,6 +236,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* @see
* org.apache.commons.compress.archivers.zip.ZipEncoding#encode(java.lang.String)
*/
+ @Override
public ByteBuffer encode(String name) {
ByteBuffer out = ByteBuffer.allocate(name.length()
+ 6 + (name.length() + 1) / 2);
@@ -261,6 +264,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* @see
* org.apache.commons.compress.archivers.zip.ZipEncoding#decode(byte[])
*/
+ @Override
public String decode(byte[] data) throws IOException {
char [] ret = new char[data.length];
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
index 657a492..d4925c1 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
@@ -204,6 +204,7 @@ public abstract class StreamCompressor implements Closeable {
writtenToOutputStreamForLastEntry = 0;
}
+ @Override
public void close() throws IOException {
def.end();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java
index 00fe333..1289583 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java
@@ -62,6 +62,7 @@ public class UnicodeCommentExtraField extends AbstractUnicodeExtraField {
super(comment, bytes);
}
+ @Override
public ZipShort getHeaderId() {
return UCOM_ID;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java
index dfd3f65..35935f3 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java
@@ -61,6 +61,7 @@ public class UnicodePathExtraField extends AbstractUnicodeExtraField {
super(name, bytes);
}
+ @Override
public ZipShort getHeaderId() {
return UPATH_ID;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java
index 029cfcd..b4a92bb 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java
@@ -39,6 +39,7 @@ public final class UnparseableExtraFieldData implements ZipExtraField {
*
* @return a completely arbitrary value that should be ignored.
*/
+ @Override
public ZipShort getHeaderId() {
return HEADER_ID;
}
@@ -48,6 +49,7 @@ public final class UnparseableExtraFieldData implements ZipExtraField {
*
* @return The LocalFileDataLength value
*/
+ @Override
public ZipShort getLocalFileDataLength() {
return new ZipShort(localFileData == null ? 0 : localFileData.length);
}
@@ -57,6 +59,7 @@ public final class UnparseableExtraFieldData implements ZipExtraField {
*
* @return The CentralDirectoryLength value
*/
+ @Override
public ZipShort getCentralDirectoryLength() {
return centralDirectoryData == null
? getLocalFileDataLength()
@@ -68,6 +71,7 @@ public final class UnparseableExtraFieldData implements ZipExtraField {
*
* @return The LocalFileDataData value
*/
+ @Override
public byte[] getLocalFileDataData() {
return ZipUtil.copy(localFileData);
}
@@ -77,6 +81,7 @@ public final class UnparseableExtraFieldData implements ZipExtraField {
*
* @return The CentralDirectoryData value
*/
+ @Override
public byte[] getCentralDirectoryData() {
return centralDirectoryData == null
? getLocalFileDataData() : ZipUtil.copy(centralDirectoryData);
@@ -89,6 +94,7 @@ public final class UnparseableExtraFieldData implements ZipExtraField {
* @param offset offset into buffer to read data
* @param length the length of data
*/
+ @Override
public void parseFromLocalFileData(byte[] buffer, int offset, int length) {
localFileData = new byte[length];
System.arraycopy(buffer, offset, localFileData, 0, length);
@@ -101,6 +107,7 @@ public final class UnparseableExtraFieldData implements ZipExtraField {
* @param offset offset into buffer to read data
* @param length the length of data
*/
+ @Override
public void parseFromCentralDirectoryData(byte[] buffer, int offset,
int length) {
centralDirectoryData = new byte[length];
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
index d6a2d77..a4a532d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
@@ -45,6 +45,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* Get the header id.
* @return the header id
*/
+ @Override
public ZipShort getHeaderId() {
return headerId;
}
@@ -68,6 +69,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* Get the length of the local data.
* @return the length of the local data
*/
+ @Override
public ZipShort getLocalFileDataLength() {
return new ZipShort(localData != null ? localData.length : 0);
}
@@ -76,6 +78,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* Get the local data.
* @return the local data
*/
+ @Override
public byte[] getLocalFileDataData() {
return ZipUtil.copy(localData);
}
@@ -99,6 +102,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* If there is no central data, get the local file data length.
* @return the central data length
*/
+ @Override
public ZipShort getCentralDirectoryLength() {
if (centralData != null) {
return new ZipShort(centralData.length);
@@ -110,6 +114,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* Get the central data.
* @return the central data if present, else return the local file data
*/
+ @Override
public byte[] getCentralDirectoryData() {
if (centralData != null) {
return ZipUtil.copy(centralData);
@@ -123,6 +128,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* @param length the number of bytes to use in the data array.
* @see ZipExtraField#parseFromLocalFileData(byte[], int, int)
*/
+ @Override
public void parseFromLocalFileData(byte[] data, int offset, int length) {
byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
@@ -135,6 +141,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* @param length the number of bytes to use in the data array.
* @see ZipExtraField#parseFromCentralDirectoryData(byte[], int, int)
*/
+ @Override
public void parseFromCentralDirectoryData(byte[] data, int offset,
int length) {
byte[] tmp = new byte[length];
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java b/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
index e2bde27..e020720 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
@@ -77,6 +77,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @return the value for the header id for this extrafield
*/
+ @Override
public ZipShort getHeaderId() {
return HEADER_ID;
}
@@ -87,6 +88,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @return a <code>ZipShort</code> for the length of the data of this extra field
*/
+ @Override
public ZipShort getLocalFileDataLength() {
return new ZipShort(4 /* reserved */
+ 2 /* Tag#1 */
@@ -104,6 +106,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @return a <code>ZipShort</code> for the length of the data of this extra field
*/
+ @Override
public ZipShort getCentralDirectoryLength() {
return getLocalFileDataLength();
}
@@ -114,6 +117,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @return get the data
*/
+ @Override
public byte[] getLocalFileDataData() {
byte[] data = new byte[getLocalFileDataLength().getValue()];
int pos = 4;
@@ -135,6 +139,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @return the central directory data
*/
+ @Override
public byte[] getCentralDirectoryData() {
return getLocalFileDataData();
}
@@ -147,6 +152,7 @@ public class X000A_NTFS implements ZipExtraField {
* @param length the number of bytes in the array from offset
* @throws java.util.zip.ZipException on error
*/
+ @Override
public void parseFromLocalFileData(
byte[] data, int offset, int length
) throws ZipException {
@@ -171,6 +177,7 @@ public class X000A_NTFS implements ZipExtraField {
* Doesn't do anything special since this class always uses the
* same parsing logic for both central directory and local file data.
*/
+ @Override
public void parseFromCentralDirectoryData(
byte[] buffer, int offset, int length
) throws ZipException {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
index 8a7c7df..81bd9ca 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
@@ -126,6 +126,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @return the value for the header id for this extrafield
*/
+ @Override
public ZipShort getHeaderId() {
return HEADER_ID;
}
@@ -136,6 +137,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @return a <code>ZipShort</code> for the length of the data of this extra field
*/
+ @Override
public ZipShort getLocalFileDataLength() {
return new ZipShort(1 +
(bit0_modifyTimePresent ? 4 : 0) +
@@ -154,6 +156,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @return a <code>ZipShort</code> for the length of the data of this extra field
*/
+ @Override
public ZipShort getCentralDirectoryLength() {
return new ZipShort(1 +
(bit0_modifyTimePresent ? 4 : 0)
@@ -166,6 +169,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @return get the data
*/
+ @Override
public byte[] getLocalFileDataData() {
byte[] data = new byte[getLocalFileDataLength().getValue()];
int pos = 0;
@@ -194,6 +198,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @return the central directory data
*/
+ @Override
public byte[] getCentralDirectoryData() {
byte[] centralData = new byte[getCentralDirectoryLength().getValue()];
byte[] localData = getLocalFileDataData();
@@ -212,6 +217,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
* @param length the number of bytes in the array from offset
* @throws java.util.zip.ZipException on error
*/
+ @Override
public void parseFromLocalFileData(
byte[] data, int offset, int length
) throws ZipException {
@@ -239,6 +245,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
* Doesn't do anything special since this class always uses the
* same parsing logic for both central directory and local file data.
*/
+ @Override
public void parseFromCentralDirectoryData(
byte[] buffer, int offset, int length
) throws ZipException {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/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 e325b56..007ca50 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
@@ -81,6 +81,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*
* @return the value for the header id for this extrafield
*/
+ @Override
public ZipShort getHeaderId() {
return HEADER_ID;
}
@@ -129,6 +130,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*
* @return a <code>ZipShort</code> for the length of the data of this extra field
*/
+ @Override
public ZipShort getLocalFileDataLength() {
int uidSize = trimLeadingZeroesForceMinLength(uid.toByteArray()).length;
int gidSize = trimLeadingZeroesForceMinLength(gid.toByteArray()).length;
@@ -143,6 +145,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*
* @return a <code>ZipShort</code> for the length of the data of this extra field
*/
+ @Override
public ZipShort getCentralDirectoryLength() {
return ZERO;
}
@@ -153,6 +156,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*
* @return get the data
*/
+ @Override
public byte[] getLocalFileDataData() {
byte[] uidBytes = uid.toByteArray();
byte[] gidBytes = gid.toByteArray();
@@ -190,6 +194,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*
* @return get the data
*/
+ @Override
public byte[] getCentralDirectoryData() {
return new byte[0];
}
@@ -202,6 +207,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
* @param length the number of bytes in the array from offset
* @throws java.util.zip.ZipException on error
*/
+ @Override
public void parseFromLocalFileData(
byte[] data, int offset, int length
) throws ZipException {
@@ -223,6 +229,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
* Doesn't do anything since this class doesn't store anything
* inside the central directory.
*/
+ @Override
public void parseFromCentralDirectoryData(
byte[] buffer, int offset, int length
) throws ZipException {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
index c7bec68..0c5ec02 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
@@ -103,14 +103,17 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
this.diskStart = diskStart;
}
+ @Override
public ZipShort getHeaderId() {
return HEADER_ID;
}
+ @Override
public ZipShort getLocalFileDataLength() {
return new ZipShort(size != null ? 2 * DWORD : 0);
}
+ @Override
public ZipShort getCentralDirectoryLength() {
return new ZipShort((size != null ? DWORD : 0)
+ (compressedSize != null ? DWORD : 0)
@@ -118,6 +121,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
+ (diskStart != null ? WORD : 0));
}
+ @Override
public byte[] getLocalFileDataData() {
if (size != null || compressedSize != null) {
if (size == null || compressedSize == null) {
@@ -130,6 +134,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
return EMPTY;
}
+ @Override
public byte[] getCentralDirectoryData() {
byte[] data = new byte[getCentralDirectoryLength().getValue()];
int off = addSizes(data);
@@ -144,6 +149,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
return data;
}
+ @Override
public void parseFromLocalFileData(byte[] buffer, int offset, int length)
throws ZipException {
if (length == 0) {
@@ -173,6 +179,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
}
}
+ @Override
public void parseFromCentralDirectoryData(byte[] buffer, int offset,
int length)
throws ZipException {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
index 935f012..504646d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
@@ -754,6 +754,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* leak through and the returned value may depend on your local
* time zone as well as your version of Java.</p>
*/
+ @Override
public Date getLastModifiedDate() {
return new Date(getTime());
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
index 3b51b07..95e8c4c 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
@@ -239,6 +239,7 @@ public class ZipFile implements Closeable {
* Closes the archive.
* @throws IOException if an error occurs closing the archive.
*/
+ @Override
public void close() throws IOException {
// this flag is only written here and read in finalize() which
// can never be run in parallel.
@@ -1091,6 +1092,7 @@ public class ZipFile implements Closeable {
*/
private final Comparator<ZipArchiveEntry> OFFSET_COMPARATOR =
new Comparator<ZipArchiveEntry>() {
+ @Override
public int compare(ZipArchiveEntry e1, ZipArchiveEntry e2) {
if (e1 == e2) {
return 0;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java b/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
index 8ed861c..865fc09 100644
--- a/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
+++ b/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
@@ -244,12 +244,15 @@ public class ChangeSetPerformer {
ArchiveInputStreamIterator(ArchiveInputStream in) {
this.in = in;
}
+ @Override
public boolean hasNext() throws IOException {
return (next = in.getNextEntry()) != null;
}
+ @Override
public ArchiveEntry next() {
return next;
}
+ @Override
public InputStream getInputStream() {
return in;
}
@@ -264,12 +267,15 @@ public class ChangeSetPerformer {
this.in = in;
nestedEnum = in.getEntriesInPhysicalOrder();
}
+ @Override
public boolean hasNext() {
return nestedEnum.hasMoreElements();
}
+ @Override
public ArchiveEntry next() {
return current = nestedEnum.nextElement();
}
+ @Override
public InputStream getInputStream() throws IOException {
return in.getInputStream(current);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java b/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
index 4163e7a..506d86c 100644
--- a/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
+++ b/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
@@ -42,16 +42,19 @@ class PureJavaCrc32C implements Checksum {
reset();
}
- public long getValue() {
+ @Override
+public long getValue() {
long ret = crc;
return (~ret) & 0xffffffffL;
}
- public void reset() {
+ @Override
+public void reset() {
crc = 0xffffffff;
}
- public void update(byte[] b, int off, int len) {
+ @Override
+public void update(byte[] b, int off, int len) {
int localCrc = crc;
while(len > 7) {
@@ -91,7 +94,8 @@ class PureJavaCrc32C implements Checksum {
crc = localCrc;
}
- final public void update(int b) {
+ @Override
+final public void update(int b) {
crc = (crc >>> 8) ^ T[T8_0_start + ((crc ^ b) & 0xff)];
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/parallel/FileBasedScatterGatherBackingStore.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/parallel/FileBasedScatterGatherBackingStore.java b/src/main/java/org/apache/commons/compress/parallel/FileBasedScatterGatherBackingStore.java
index 59ee680..b8225a3 100644
--- a/src/main/java/org/apache/commons/compress/parallel/FileBasedScatterGatherBackingStore.java
+++ b/src/main/java/org/apache/commons/compress/parallel/FileBasedScatterGatherBackingStore.java
@@ -39,10 +39,12 @@ public class FileBasedScatterGatherBackingStore implements ScatterGatherBackingS
os = new FileOutputStream(target);
}
+ @Override
public InputStream getInputStream() throws IOException {
return new FileInputStream(target);
}
+ @Override
@SuppressWarnings("ResultOfMethodCallIgnored")
public void closeForWriting() throws IOException {
if (!closed) {
@@ -51,10 +53,12 @@ public class FileBasedScatterGatherBackingStore implements ScatterGatherBackingS
}
}
+ @Override
public void writeOut(byte[] data, int offset, int length) throws IOException {
os.write(data, offset, length);
}
+ @Override
public void close() throws IOException {
closeForWriting();
target.delete();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/main/java/org/apache/commons/compress/utils/BitInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/BitInputStream.java b/src/main/java/org/apache/commons/compress/utils/BitInputStream.java
index 91aad68..b34590e 100644
--- a/src/main/java/org/apache/commons/compress/utils/BitInputStream.java
+++ b/src/main/java/org/apache/commons/compress/utils/BitInputStream.java
@@ -54,6 +54,7 @@ public class BitInputStream implements Closeable {
this.byteOrder = byteOrder;
}
+ @Override
public void close() throws IOException {
in.close();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
index 9f67273..4cd72d0 100644
--- a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
+++ b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
@@ -77,6 +77,7 @@ public class ArchiveReadTest extends AbstractTestCase {
assertTrue(ARCDIR.exists());
Collection<Object[]> params = new ArrayList<Object[]>();
for (String f : ARCDIR.list(new FilenameFilter() {
+ @Override
public boolean accept(File dir, String name) {
return !name.endsWith(".txt");
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
index 4f4d8ba..212cfb1 100644
--- a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
@@ -83,6 +83,7 @@ public class LongPathTest extends AbstractTestCase {
public static Collection<Object[]> data() {
Collection<Object[]> params = new ArrayList<Object[]>();
for (String f : ARCDIR.list(new FilenameFilter() {
+ @Override
public boolean accept(File dir, String name) {
return !name.endsWith(".txt");
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
index 5395588..61bfdea 100644
--- a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
@@ -83,6 +83,7 @@ public class LongSymLinkTest extends AbstractTestCase {
public static Collection<Object[]> data() {
Collection<Object[]> params = new ArrayList<Object[]>();
for (String f : ARCDIR.list(new FilenameFilter() {
+ @Override
public boolean accept(File dir, String name) {
return !name.endsWith(".txt");
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
index 9a506cd..4c952fb 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
@@ -313,6 +313,7 @@ public final class ZipTestCase extends AbstractTestCase {
String first_payload = "ABBA";
String second_payload = "AAAAAAAAAAAA";
ZipArchiveEntryPredicate allFilesPredicate = new ZipArchiveEntryPredicate() {
+ @Override
public boolean test(ZipArchiveEntry zipArchiveEntry) {
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/archivers/memory/MemoryArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/memory/MemoryArchiveEntry.java b/src/test/java/org/apache/commons/compress/archivers/memory/MemoryArchiveEntry.java
index c8dd561..86efb09 100644
--- a/src/test/java/org/apache/commons/compress/archivers/memory/MemoryArchiveEntry.java
+++ b/src/test/java/org/apache/commons/compress/archivers/memory/MemoryArchiveEntry.java
@@ -30,20 +30,24 @@ public final class MemoryArchiveEntry implements ArchiveEntry {
name = pName;
}
+ @Override
public String getName() {
return name;
}
+ @Override
public long getSize() {
// TODO Auto-generated method stub
return 0;
}
+ @Override
public boolean isDirectory() {
// TODO Auto-generated method stub
return false;
}
+ @Override
public Date getLastModifiedDate() {
return new Date();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
index 63b0acb..f99b8fa 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
@@ -78,6 +78,7 @@ public class ParallelScatterZipCreatorTest {
ExecutorService es = Executors.newFixedThreadPool(1);
ScatterGatherBackingStoreSupplier supp = new ScatterGatherBackingStoreSupplier() {
+ @Override
public ScatterGatherBackingStore get() throws IOException {
return new FileBasedScatterGatherBackingStore(tmp = File.createTempFile("parallelscatter", "n1"));
}
@@ -113,6 +114,7 @@ public class ParallelScatterZipCreatorTest {
final byte[] payloadBytes = ("content" + i).getBytes();
ZipArchiveEntry za = createZipArchiveEntry(entries, i, payloadBytes);
zipCreator.addArchiveEntry(za, new InputStreamSupplier() {
+ @Override
public InputStream get() {
return new ByteArrayInputStream(payloadBytes);
}
@@ -127,6 +129,7 @@ public class ParallelScatterZipCreatorTest {
final byte[] payloadBytes = ("content" + i).getBytes();
ZipArchiveEntry za = createZipArchiveEntry(entries, i, payloadBytes);
final Callable<Object> callable = zipCreator.createCallable(za, new InputStreamSupplier() {
+ @Override
public InputStream get() {
return new ByteArrayInputStream(payloadBytes);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
index b0da1c5..1d26789 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
@@ -45,6 +45,7 @@ public class ScatterSampleTest {
ZipArchiveEntry archiveEntry = new ZipArchiveEntry("test1.xml");
archiveEntry.setMethod(ZipEntry.DEFLATED);
InputStreamSupplier supp = new InputStreamSupplier() {
+ @Override
public InputStream get() {
return new ByteArrayInputStream("Hello".getBytes());
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
index 88836e4..f7550ce 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
@@ -79,6 +79,7 @@ public class ScatterZipOutputStreamTest {
private InputStreamSupplier createPayloadSupplier(final ByteArrayInputStream payload) {
return new InputStreamSupplier() {
+ @Override
public InputStream get() {
return payload;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
index c676b89..0dc521d 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
@@ -204,6 +204,7 @@ public class Zip64SupportIT {
private static ZipOutputTest write100KFiles(final Zip64Mode mode) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
@@ -321,6 +322,7 @@ public class Zip64SupportIT {
private static final ZipOutputTest write100KFilesModeNever =
new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
@@ -348,7 +350,8 @@ public class Zip64SupportIT {
throws Throwable {
withTemporaryArchive("readSelfGenerated100KFilesUsingZipFile()",
new ZipOutputTest() {
- public void test(File f,
+ @Override
+ public void test(File f,
ZipArchiveOutputStream zos)
throws IOException {
write100KFilesToStream(zos);
@@ -372,6 +375,7 @@ public class Zip64SupportIT {
private static ZipOutputTest
write3EntriesCreatingBigArchive(final Zip64Mode mode) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
@@ -485,6 +489,7 @@ public class Zip64SupportIT {
private static final ZipOutputTest write3EntriesCreatingBigArchiveModeNever =
new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
@@ -516,7 +521,8 @@ public class Zip64SupportIT {
throws Throwable {
withTemporaryArchive("read3EntriesCreatingBigArchiveFileUsingZipFile",
new ZipOutputTest() {
- public void test(File f,
+ @Override
+ public void test(File f,
ZipArchiveOutputStream zos)
throws IOException {
write3EntriesCreatingBigArchiveToStream(zos);
@@ -570,6 +576,7 @@ public class Zip64SupportIT {
private static ZipOutputTest writeBigStoredEntry(final boolean knownSize,
final Zip64Mode mode) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
@@ -751,6 +758,7 @@ public class Zip64SupportIT {
private static ZipOutputTest
writeBigStoredEntryModeNever(final boolean knownSize) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
@@ -808,6 +816,7 @@ public class Zip64SupportIT {
writeBigDeflatedEntryToStream(final boolean knownSize,
final Zip64Mode mode) {
return new ZipOutputTest() {
+ @Override
public void test(File f,
ZipArchiveOutputStream zos)
throws IOException {
@@ -994,6 +1003,7 @@ public class Zip64SupportIT {
private static ZipOutputTest
writeBigDeflatedEntryUnknownSizeToStream(final Zip64Mode mode) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
try {
@@ -1050,6 +1060,7 @@ public class Zip64SupportIT {
writeBigDeflatedEntryToFile(final boolean knownSize,
final Zip64Mode mode) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
@@ -1221,7 +1232,8 @@ public class Zip64SupportIT {
throws Throwable {
withTemporaryArchive("writeBigDeflatedEntryKnownSizeToStreamModeNever",
new ZipOutputTest() {
- public void test(File f,
+ @Override
+ public void test(File f,
ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
@@ -1254,6 +1266,7 @@ public class Zip64SupportIT {
private static ZipOutputTest
writeBigDeflatedEntryToFileModeNever(final boolean knownSize) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
@@ -1309,6 +1322,7 @@ public class Zip64SupportIT {
private static ZipOutputTest writeSmallStoredEntry(final boolean knownSize,
final Zip64Mode mode) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
@@ -1487,6 +1501,7 @@ public class Zip64SupportIT {
private static ZipOutputTest
writeSmallStoredEntryModeAlways(final boolean knownSize) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Always);
@@ -1649,6 +1664,7 @@ public class Zip64SupportIT {
writeSmallDeflatedEntryToStream(final boolean knownSize,
final Zip64Mode mode) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
@@ -1821,6 +1837,7 @@ public class Zip64SupportIT {
private static ZipOutputTest
writeSmallDeflatedEntryToStreamModeAlways(final boolean knownSize) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Always);
@@ -2003,6 +2020,7 @@ public class Zip64SupportIT {
writeSmallDeflatedEntryToFile(final boolean knownSize,
final Zip64Mode mode) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
@@ -2177,6 +2195,7 @@ public class Zip64SupportIT {
private static ZipOutputTest
writeSmallDeflatedEntryToFileModeAlways(final boolean knownSize) {
return new ZipOutputTest() {
+ @Override
public void test(File f, ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Always);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java b/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
index 0f38c28..3e15d52 100644
--- a/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
@@ -38,6 +38,7 @@ public final class FramedSnappyTestCase
@Test
public void testDefaultExtraction() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
+ @Override
public CompressorInputStream wrap(InputStream is) throws IOException {
return new FramedSnappyCompressorInputStream(is);
}
@@ -47,6 +48,7 @@ public final class FramedSnappyTestCase
@Test
public void testDefaultExtractionViaFactory() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
+ @Override
public CompressorInputStream wrap(InputStream is) throws Exception {
return new CompressorStreamFactory()
.createCompressorInputStream(CompressorStreamFactory.SNAPPY_FRAMED,
@@ -58,6 +60,7 @@ public final class FramedSnappyTestCase
@Test
public void testDefaultExtractionViaFactoryAutodetection() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
+ @Override
public CompressorInputStream wrap(InputStream is) throws Exception {
return new CompressorStreamFactory().createCompressorInputStream(is);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/compressors/ZTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/ZTestCase.java b/src/test/java/org/apache/commons/compress/compressors/ZTestCase.java
index 3ea1e2e..92f01bd 100644
--- a/src/test/java/org/apache/commons/compress/compressors/ZTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/ZTestCase.java
@@ -37,6 +37,7 @@ public final class ZTestCase extends AbstractTestCase {
@Test
public void testZUnarchive() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
+ @Override
public CompressorInputStream wrap(InputStream is) throws IOException {
return new ZCompressorInputStream(is);
}
@@ -46,6 +47,7 @@ public final class ZTestCase extends AbstractTestCase {
@Test
public void testZUnarchiveViaFactory() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
+ @Override
public CompressorInputStream wrap(InputStream is) throws Exception {
return new CompressorStreamFactory()
.createCompressorInputStream(CompressorStreamFactory.Z, is);
@@ -56,6 +58,7 @@ public final class ZTestCase extends AbstractTestCase {
@Test
public void testZUnarchiveViaAutoDetection() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
+ @Override
public CompressorInputStream wrap(InputStream is) throws Exception {
return new CompressorStreamFactory()
.createCompressorInputStream(new BufferedInputStream(is));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab17a705/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
index 6310810..e468bd5 100644
--- a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
@@ -34,6 +34,7 @@ public class IOUtilsTest {
@Test
public void skipUsingSkip() throws Exception {
skip(new StreamWrapper() {
+ @Override
public InputStream wrap(InputStream toWrap) {
return toWrap;
}
@@ -43,6 +44,7 @@ public class IOUtilsTest {
@Test
public void skipUsingRead() throws Exception {
skip(new StreamWrapper() {
+ @Override
public InputStream wrap(InputStream toWrap) {
return new FilterInputStream(toWrap) {
@Override
@@ -57,6 +59,7 @@ public class IOUtilsTest {
@Test
public void skipUsingSkipAndRead() throws Exception {
skip(new StreamWrapper() {
+ @Override
public InputStream wrap(final InputStream toWrap) {
return new FilterInputStream(toWrap) {
boolean skipped;
[11/46] commons-compress git commit: Try another way
Posted by bo...@apache.org.
Try another way
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/bda90579
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/bda90579
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/bda90579
Branch: refs/heads/COMPRESS-207
Commit: bda90579ebafc6b9f841bbd0567f6a9e5df1575f
Parents: 7d07cb3
Author: Sebb <se...@apache.org>
Authored: Fri Apr 8 19:37:38 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Fri Apr 8 19:37:38 2016 +0100
----------------------------------------------------------------------
.gitattributes | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/bda90579/.gitattributes
----------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes
index 631f41a..8214dab 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,6 +1,5 @@
-src/test/resources/longfile_gnu.ar eol=lf
-src/test/resources/longfile_bsd.ar eol=lf
-src/test/resources/longpath/minotaur.ar eol=lf
+*.ar binary
+*.arj binary
# These must be identical to the copies in SHRUNK.ZIP
src/test/resources/test1.xml eol=lf
src/test/resources/test2.xml eol=lf
[07/46] commons-compress git commit: Missing case statements
Posted by bo...@apache.org.
Missing case statements
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/d2014e1e
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/d2014e1e
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/d2014e1e
Branch: refs/heads/COMPRESS-207
Commit: d2014e1e04dfea6c62aca314b8b15c269b675d9d
Parents: d378ed4
Author: Sebb <se...@apache.org>
Authored: Fri Apr 8 18:54:20 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Fri Apr 8 18:54:20 2016 +0100
----------------------------------------------------------------------
.../apache/commons/compress/archivers/zip/ZipFile.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/d2014e1e/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
index f6331e8..f1bcbef 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
@@ -430,6 +430,19 @@ public class ZipFile implements Closeable {
};
case BZIP2:
return new BZip2CompressorInputStream(bis);
+ case AES_ENCRYPTED:
+ case ENHANCED_DEFLATED:
+ case EXPANDING_LEVEL_1:
+ case EXPANDING_LEVEL_2:
+ case EXPANDING_LEVEL_3:
+ case EXPANDING_LEVEL_4:
+ case JPEG:
+ case LZMA:
+ case PKWARE_IMPLODING:
+ case PPMD:
+ case TOKENIZATION:
+ case UNKNOWN:
+ case WAVPACK:
default:
throw new ZipException("Found unsupported compression method "
+ ze.getMethod());
[09/46] commons-compress git commit: Try to fix some Windows test
failures (presumably this occurred when SVN moved to Git and the EOL
properties were not transferred)
Posted by bo...@apache.org.
Try to fix some Windows test failures (presumably this occurred when SVN
moved to Git and the EOL properties were not transferred)
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/74e4301a
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/74e4301a
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/74e4301a
Branch: refs/heads/COMPRESS-207
Commit: 74e4301adb2eac499a86c24eb04ccfc8dbb430c2
Parents: e158fc1
Author: Sebb <se...@apache.org>
Authored: Fri Apr 8 18:56:57 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Fri Apr 8 18:56:57 2016 +0100
----------------------------------------------------------------------
.gitattributes | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/74e4301a/.gitattributes
----------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes
index 4edf1d9..a1de9b4 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,3 +1,6 @@
src/test/resources/longfile_gnu.ar eol=lf
src/test/resources/longfile_bsd.ar eol=lf
src/test/resources/longpath/minotaur.ar eol=lf
+# These must be identical to the copies in SHRUNK.ZIP
+src/test/resources/test1.xml eol=lf
+src/test/resources/test2.xml eol=lf
[06/46] commons-compress git commit: Statement unnecessarily nested
within else clause.
Posted by bo...@apache.org.
Statement unnecessarily nested within else clause.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/d378ed45
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/d378ed45
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/d378ed45
Branch: refs/heads/COMPRESS-207
Commit: d378ed45084b93c481d597152054800a2a829154
Parents: 18dcf38
Author: ggregory <gg...@apache.org>
Authored: Wed Apr 6 10:21:39 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Wed Apr 6 10:21:39 2016 -0700
----------------------------------------------------------------------
.../archivers/ArchiveStreamFactory.java | 27 +++++++-------------
1 file changed, 9 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/d378ed45/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java b/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
index 28fe13b..b69cada 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
@@ -209,44 +209,38 @@ public class ArchiveStreamFactory {
if (ARJ.equalsIgnoreCase(archiverName)) {
if (entryEncoding != null) {
return new ArjArchiveInputStream(in, entryEncoding);
- } else {
- return new ArjArchiveInputStream(in);
}
+ return new ArjArchiveInputStream(in);
}
if (ZIP.equalsIgnoreCase(archiverName)) {
if (entryEncoding != null) {
return new ZipArchiveInputStream(in, entryEncoding);
- } else {
- return new ZipArchiveInputStream(in);
}
+ return new ZipArchiveInputStream(in);
}
if (TAR.equalsIgnoreCase(archiverName)) {
if (entryEncoding != null) {
return new TarArchiveInputStream(in, entryEncoding);
- } else {
- return new TarArchiveInputStream(in);
}
+ return new TarArchiveInputStream(in);
}
if (JAR.equalsIgnoreCase(archiverName)) {
if (entryEncoding != null) {
return new JarArchiveInputStream(in, entryEncoding);
- } else {
- return new JarArchiveInputStream(in);
}
+ return new JarArchiveInputStream(in);
}
if (CPIO.equalsIgnoreCase(archiverName)) {
if (entryEncoding != null) {
return new CpioArchiveInputStream(in, entryEncoding);
- } else {
- return new CpioArchiveInputStream(in);
}
+ return new CpioArchiveInputStream(in);
}
if (DUMP.equalsIgnoreCase(archiverName)) {
if (entryEncoding != null) {
return new DumpArchiveInputStream(in, entryEncoding);
- } else {
- return new DumpArchiveInputStream(in);
}
+ return new DumpArchiveInputStream(in);
}
if (SEVEN_Z.equalsIgnoreCase(archiverName)) {
throw new StreamingNotSupportedException(SEVEN_Z);
@@ -290,23 +284,20 @@ public class ArchiveStreamFactory {
if (TAR.equalsIgnoreCase(archiverName)) {
if (entryEncoding != null) {
return new TarArchiveOutputStream(out, entryEncoding);
- } else {
- return new TarArchiveOutputStream(out);
}
+ return new TarArchiveOutputStream(out);
}
if (JAR.equalsIgnoreCase(archiverName)) {
if (entryEncoding != null) {
return new JarArchiveOutputStream(out, entryEncoding);
- } else {
- return new JarArchiveOutputStream(out);
}
+ return new JarArchiveOutputStream(out);
}
if (CPIO.equalsIgnoreCase(archiverName)) {
if (entryEncoding != null) {
return new CpioArchiveOutputStream(out, entryEncoding);
- } else {
- return new CpioArchiveOutputStream(out);
}
+ return new CpioArchiveOutputStream(out);
}
if (SEVEN_Z.equalsIgnoreCase(archiverName)) {
throw new StreamingNotSupportedException(SEVEN_Z);
[37/46] commons-compress git commit: Add final modifier to local
variables.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java
index 8df0edb..e38f819 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java
@@ -35,8 +35,8 @@ public class ZipEightByteIntegerTest {
*/
@Test
public void testLongToBytes() {
- ZipEightByteInteger zl = new ZipEightByteInteger(0xAB12345678l);
- byte[] result = zl.getBytes();
+ final ZipEightByteInteger zl = new ZipEightByteInteger(0xAB12345678l);
+ final byte[] result = zl.getBytes();
assertEquals("length getBytes", 8, result.length);
assertEquals("first byte getBytes", 0x78, result[0]);
assertEquals("second byte getBytes", 0x56, result[1]);
@@ -53,8 +53,8 @@ public class ZipEightByteIntegerTest {
*/
@Test
public void testLongFromBytes() {
- byte[] val = new byte[] {0x78, 0x56, 0x34, 0x12, (byte) 0xAB, 0x00, 0x00, 0x00};
- ZipEightByteInteger zl = new ZipEightByteInteger(val);
+ final byte[] val = new byte[] {0x78, 0x56, 0x34, 0x12, (byte) 0xAB, 0x00, 0x00, 0x00};
+ final ZipEightByteInteger zl = new ZipEightByteInteger(val);
assertEquals("longValue from bytes", 0xAB12345678l, zl.getLongValue());
}
@@ -63,10 +63,10 @@ public class ZipEightByteIntegerTest {
*/
@Test
public void testBIToBytes() {
- ZipEightByteInteger zl =
+ final ZipEightByteInteger zl =
new ZipEightByteInteger(BigInteger.valueOf(Long.MAX_VALUE)
.shiftLeft(1));
- byte[] result = zl.getBytes();
+ final byte[] result = zl.getBytes();
assertEquals("length getBytes", 8, result.length);
assertEquals("first byte getBytes", (byte) 0xFE, result[0]);
assertEquals("second byte getBytes", (byte) 0xFF, result[1]);
@@ -83,8 +83,8 @@ public class ZipEightByteIntegerTest {
*/
@Test
public void testBIFromBytes() {
- byte[] val = new byte[] {(byte) 0xFE, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
- ZipEightByteInteger zl = new ZipEightByteInteger(val);
+ final byte[] val = new byte[] {(byte) 0xFE, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
+ final ZipEightByteInteger zl = new ZipEightByteInteger(val);
assertEquals("value from bytes",
BigInteger.valueOf(Long.MAX_VALUE).shiftLeft(1),
zl.getValue());
@@ -95,9 +95,9 @@ public class ZipEightByteIntegerTest {
*/
@Test
public void testEquals() {
- ZipEightByteInteger zl = new ZipEightByteInteger(0x12345678);
- ZipEightByteInteger zl2 = new ZipEightByteInteger(0x12345678);
- ZipEightByteInteger zl3 = new ZipEightByteInteger(0x87654321);
+ final ZipEightByteInteger zl = new ZipEightByteInteger(0x12345678);
+ final ZipEightByteInteger zl2 = new ZipEightByteInteger(0x12345678);
+ final ZipEightByteInteger zl3 = new ZipEightByteInteger(0x87654321);
assertTrue("reflexive", zl.equals(zl));
@@ -115,7 +115,7 @@ public class ZipEightByteIntegerTest {
*/
@Test
public void testSign() {
- ZipEightByteInteger zl = new ZipEightByteInteger(new byte[] {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF});
+ final ZipEightByteInteger zl = new ZipEightByteInteger(new byte[] {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF});
assertEquals(BigInteger.valueOf(Long.MAX_VALUE).shiftLeft(1).setBit(0),
zl.getValue());
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
index 237adf2..f0c049a 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
@@ -60,7 +60,7 @@ public class ZipEncodingTest {
// the defined ones
// retrieved by
// awk '/^0x/ && NF>2 {print $1;}' CP1252.TXT
- byte[] b =
+ final byte[] b =
new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -116,8 +116,8 @@ public class ZipEncodingTest {
Assert.assertEquals(expected.length, actual.limit());
- for (byte anExpected : expected) {
- byte a = actual.get();
+ for (final byte anExpected : expected) {
+ final byte a = actual.get();
Assert.assertEquals(anExpected, a);
}
@@ -126,7 +126,7 @@ public class ZipEncodingTest {
private void doSimpleEncodingTest(final String name, byte[] testBytes)
throws IOException {
- ZipEncoding enc = ZipEncodingHelper.getZipEncoding(name);
+ final ZipEncoding enc = ZipEncodingHelper.getZipEncoding(name);
if (testBytes == null) {
@@ -136,11 +136,11 @@ public class ZipEncodingTest {
}
}
- String decoded = enc.decode(testBytes);
+ final String decoded = enc.decode(testBytes);
assertTrue(enc.canEncode(decoded));
- ByteBuffer encoded = enc.encode(decoded);
+ final ByteBuffer encoded = enc.encode(decoded);
assertEquals(testBytes, encoded);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
index 8a35b5d..3876f59 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
@@ -48,7 +48,7 @@ public class ZipFileTest {
@Test
public void testCDOrder() throws Exception {
readOrderTest();
- ArrayList<ZipArchiveEntry> l = Collections.list(zf.getEntries());
+ final ArrayList<ZipArchiveEntry> l = Collections.list(zf.getEntries());
assertEntryName(l, 0, "AbstractUnicodeExtraField");
assertEntryName(l, 1, "AsiExtraField");
assertEntryName(l, 2, "ExtraFieldUtils");
@@ -77,7 +77,7 @@ public class ZipFileTest {
@Test
public void testPhysicalOrder() throws Exception {
readOrderTest();
- ArrayList<ZipArchiveEntry> l = Collections.list(zf.getEntriesInPhysicalOrder());
+ final ArrayList<ZipArchiveEntry> l = Collections.list(zf.getEntriesInPhysicalOrder());
assertEntryName(l, 0, "AbstractUnicodeExtraField");
assertEntryName(l, 1, "AsiExtraField");
assertEntryName(l, 2, "ExtraFieldUtils");
@@ -109,20 +109,20 @@ public class ZipFileTest {
zf.close();
try {
zf.close();
- } catch (Exception ex) {
+ } catch (final Exception ex) {
fail("Caught exception of second close");
}
}
@Test
public void testReadingOfStoredEntry() throws Exception {
- File f = File.createTempFile("commons-compress-zipfiletest", ".zip");
+ final File f = File.createTempFile("commons-compress-zipfiletest", ".zip");
f.deleteOnExit();
OutputStream o = null;
InputStream i = null;
try {
o = new FileOutputStream(f);
- ZipArchiveOutputStream zo = new ZipArchiveOutputStream(o);
+ final ZipArchiveOutputStream zo = new ZipArchiveOutputStream(o);
ZipArchiveEntry ze = new ZipArchiveEntry("foo");
ze.setMethod(ZipEntry.STORED);
ze.setSize(4);
@@ -138,7 +138,7 @@ public class ZipFileTest {
ze = zf.getEntry("foo");
assertNotNull(ze);
i = zf.getInputStream(ze);
- byte[] b = new byte[4];
+ final byte[] b = new byte[4];
assertEquals(4, i.read(b));
assertEquals(-1, i.read());
} finally {
@@ -157,7 +157,7 @@ public class ZipFileTest {
*/
@Test
public void testWinzipBackSlashWorkaround() throws Exception {
- File archive = getFile("test-winzip.zip");
+ final File archive = getFile("test-winzip.zip");
zf = new ZipFile(archive);
assertNull(zf.getEntry("\u00e4\\\u00fc.txt"));
assertNotNull(zf.getEntry("\u00e4/\u00fc.txt"));
@@ -170,7 +170,7 @@ public class ZipFileTest {
*/
@Test
public void testSkipsPK00Prefix() throws Exception {
- File archive = getFile("COMPRESS-208.zip");
+ final File archive = getFile("COMPRESS-208.zip");
zf = new ZipFile(archive);
assertNotNull(zf.getEntry("test1.xml"));
assertNotNull(zf.getEntry("test2.xml"));
@@ -198,16 +198,16 @@ public class ZipFileTest {
// I looked into creating a test with hard links, but zip does not appear to
// support hard links, so nevermind.
- File archive = getFile("COMPRESS-214_unix_symlinks.zip");
+ final File archive = getFile("COMPRESS-214_unix_symlinks.zip");
zf = new ZipFile(archive);
- Enumeration<ZipArchiveEntry> en = zf.getEntries();
+ final Enumeration<ZipArchiveEntry> en = zf.getEntries();
while (en.hasMoreElements()) {
- ZipArchiveEntry zae = en.nextElement();
- String link = zf.getUnixSymlink(zae);
+ final ZipArchiveEntry zae = en.nextElement();
+ final String link = zf.getUnixSymlink(zae);
if (zae.isUnixSymlink()) {
- String name = zae.getName();
- String expected = expectedVals.get(name);
+ final String name = zae.getName();
+ final String expected = expectedVals.get(name);
assertEquals(expected, link);
} else {
// Should be null if it's not a symlink!
@@ -221,15 +221,15 @@ public class ZipFileTest {
*/
@Test
public void testDuplicateEntry() throws Exception {
- File archive = getFile("COMPRESS-227.zip");
+ final File archive = getFile("COMPRESS-227.zip");
zf = new ZipFile(archive);
- ZipArchiveEntry ze = zf.getEntry("test1.txt");
+ final ZipArchiveEntry ze = zf.getEntry("test1.txt");
assertNotNull(ze);
assertNotNull(zf.getInputStream(ze));
int numberOfEntries = 0;
- for (ZipArchiveEntry entry : zf.getEntries("test1.txt")) {
+ for (final ZipArchiveEntry entry : zf.getEntries("test1.txt")) {
numberOfEntries++;
assertNotNull(zf.getInputStream(entry));
}
@@ -241,11 +241,11 @@ public class ZipFileTest {
*/
@Test
public void testExcessDataInZip64ExtraField() throws Exception {
- File archive = getFile("COMPRESS-228.zip");
+ final File archive = getFile("COMPRESS-228.zip");
zf = new ZipFile(archive);
// actually, if we get here, the test already has passed
- ZipArchiveEntry ze = zf.getEntry("src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java");
+ final ZipArchiveEntry ze = zf.getEntry("src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java");
assertEquals(26101, ze.getSize());
}
@@ -277,9 +277,9 @@ public class ZipFileTest {
*/
@Test
public void testReadingOfFirstStoredEntry() throws Exception {
- File archive = getFile("COMPRESS-264.zip");
+ final File archive = getFile("COMPRESS-264.zip");
zf = new ZipFile(archive);
- ZipArchiveEntry ze = zf.getEntry("test.txt");
+ final ZipArchiveEntry ze = zf.getEntry("test.txt");
assertEquals(5, ze.getSize());
assertArrayEquals(new byte[] {'d', 'a', 't', 'a', '\n'},
IOUtils.toByteArray(zf.getInputStream(ze)));
@@ -287,11 +287,11 @@ public class ZipFileTest {
@Test
public void testUnzipBZip2CompressedEntry() throws Exception {
- File archive = getFile("bzip2-zip.zip");
+ final File archive = getFile("bzip2-zip.zip");
zf = new ZipFile(archive);
- ZipArchiveEntry ze = zf.getEntry("lots-of-as");
+ final ZipArchiveEntry ze = zf.getEntry("lots-of-as");
assertEquals(42, ze.getSize());
- byte[] expected = new byte[42];
+ final byte[] expected = new byte[42];
Arrays.fill(expected , (byte)'a');
assertArrayEquals(expected, IOUtils.toByteArray(zf.getInputStream(ze)));
}
@@ -307,14 +307,14 @@ public class ZipFileTest {
* central directory order is different from entry data order.
*/
private void readOrderTest() throws Exception {
- File archive = getFile("ordertest.zip");
+ final File archive = getFile("ordertest.zip");
zf = new ZipFile(archive);
}
private static void assertEntryName(final ArrayList<ZipArchiveEntry> entries,
final int index,
final String expectedName) {
- ZipArchiveEntry ze = entries.get(index);
+ final ZipArchiveEntry ze = entries.get(index);
assertEquals("src/main/java/org/apache/commons/compress/archivers/zip/"
+ expectedName + ".java",
ze.getName());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ZipLongTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipLongTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipLongTest.java
index 33a1b7b..f72d886 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipLongTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipLongTest.java
@@ -33,8 +33,8 @@ public class ZipLongTest {
*/
@Test
public void testToBytes() {
- ZipLong zl = new ZipLong(0x12345678);
- byte[] result = zl.getBytes();
+ final ZipLong zl = new ZipLong(0x12345678);
+ final byte[] result = zl.getBytes();
assertEquals("length getBytes", 4, result.length);
assertEquals("first byte getBytes", 0x78, result[0]);
assertEquals("second byte getBytes", 0x56, result[1]);
@@ -47,7 +47,7 @@ public class ZipLongTest {
*/
@Test
public void testPut() {
- byte[] arr = new byte[5];
+ final byte[] arr = new byte[5];
ZipLong.putLong(0x12345678, arr, 1);
assertEquals("first byte getBytes", 0x78, arr[1]);
assertEquals("second byte getBytes", 0x56, arr[2]);
@@ -60,8 +60,8 @@ public class ZipLongTest {
*/
@Test
public void testFromBytes() {
- byte[] val = new byte[] {0x78, 0x56, 0x34, 0x12};
- ZipLong zl = new ZipLong(val);
+ final byte[] val = new byte[] {0x78, 0x56, 0x34, 0x12};
+ final ZipLong zl = new ZipLong(val);
assertEquals("value from bytes", 0x12345678, zl.getValue());
}
@@ -70,9 +70,9 @@ public class ZipLongTest {
*/
@Test
public void testEquals() {
- ZipLong zl = new ZipLong(0x12345678);
- ZipLong zl2 = new ZipLong(0x12345678);
- ZipLong zl3 = new ZipLong(0x87654321);
+ final ZipLong zl = new ZipLong(0x12345678);
+ final ZipLong zl2 = new ZipLong(0x12345678);
+ final ZipLong zl3 = new ZipLong(0x87654321);
assertTrue("reflexive", zl.equals(zl));
@@ -90,14 +90,14 @@ public class ZipLongTest {
*/
@Test
public void testSign() {
- ZipLong zl = new ZipLong(new byte[] {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF});
+ final ZipLong zl = new ZipLong(new byte[] {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF});
assertEquals(0x00000000FFFFFFFFl, zl.getValue());
}
@Test
public void testClone() {
- ZipLong s1 = new ZipLong(42);
- ZipLong s2 = (ZipLong) s1.clone();
+ final ZipLong s1 = new ZipLong(42);
+ final ZipLong s2 = (ZipLong) s1.clone();
assertNotSame(s1, s2);
assertEquals(s1, s2);
assertEquals(s1.getValue(), s2.getValue());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ZipShortTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipShortTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipShortTest.java
index eb498ba..7354e97 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipShortTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipShortTest.java
@@ -33,8 +33,8 @@ public class ZipShortTest {
*/
@Test
public void testToBytes() {
- ZipShort zs = new ZipShort(0x1234);
- byte[] result = zs.getBytes();
+ final ZipShort zs = new ZipShort(0x1234);
+ final byte[] result = zs.getBytes();
assertEquals("length getBytes", 2, result.length);
assertEquals("first byte getBytes", 0x34, result[0]);
assertEquals("second byte getBytes", 0x12, result[1]);
@@ -46,7 +46,7 @@ public class ZipShortTest {
*/
@Test
public void testPut() {
- byte[] arr = new byte[3];
+ final byte[] arr = new byte[3];
ZipShort.putShort(0x1234, arr, 1);
assertEquals("first byte getBytes", 0x34, arr[1]);
assertEquals("second byte getBytes", 0x12, arr[2]);
@@ -58,8 +58,8 @@ public class ZipShortTest {
*/
@Test
public void testFromBytes() {
- byte[] val = new byte[] {0x34, 0x12};
- ZipShort zs = new ZipShort(val);
+ final byte[] val = new byte[] {0x34, 0x12};
+ final ZipShort zs = new ZipShort(val);
assertEquals("value from bytes", 0x1234, zs.getValue());
}
@@ -68,9 +68,9 @@ public class ZipShortTest {
*/
@Test
public void testEquals() {
- ZipShort zs = new ZipShort(0x1234);
- ZipShort zs2 = new ZipShort(0x1234);
- ZipShort zs3 = new ZipShort(0x5678);
+ final ZipShort zs = new ZipShort(0x1234);
+ final ZipShort zs2 = new ZipShort(0x1234);
+ final ZipShort zs3 = new ZipShort(0x5678);
assertTrue("reflexive", zs.equals(zs));
@@ -88,14 +88,14 @@ public class ZipShortTest {
*/
@Test
public void testSign() {
- ZipShort zs = new ZipShort(new byte[] {(byte)0xFF, (byte)0xFF});
+ final ZipShort zs = new ZipShort(new byte[] {(byte)0xFF, (byte)0xFF});
assertEquals(0x0000FFFF, zs.getValue());
}
@Test
public void testClone() {
- ZipShort s1 = new ZipShort(42);
- ZipShort s2 = (ZipShort) s1.clone();
+ final ZipShort s1 = new ZipShort(42);
+ final ZipShort s2 = (ZipShort) s1.clone();
assertNotSame(s1, s2);
assertEquals(s1, s2);
assertEquals(s1.getValue(), s2.getValue());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ZipUtilTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipUtilTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipUtilTest.java
index ea7e9a4..1ce819f 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipUtilTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipUtilTest.java
@@ -37,18 +37,18 @@ public class ZipUtilTest {
@Before
public void setUp() throws Exception {
time = new Date();
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.setTime(time);
- int year = cal.get(Calendar.YEAR);
- int month = cal.get(Calendar.MONTH) + 1;
- long value = ((year - 1980) << 25)
+ final int year = cal.get(Calendar.YEAR);
+ final int month = cal.get(Calendar.MONTH) + 1;
+ final long value = ((year - 1980) << 25)
| (month << 21)
| (cal.get(Calendar.DAY_OF_MONTH) << 16)
| (cal.get(Calendar.HOUR_OF_DAY) << 11)
| (cal.get(Calendar.MINUTE) << 5)
| (cal.get(Calendar.SECOND) >> 1);
- byte[] result = new byte[4];
+ final byte[] result = new byte[4];
result[0] = (byte) ((value & 0xFF));
result[1] = (byte) ((value & 0xFF00) >> 8);
result[2] = (byte) ((value & 0xFF0000) >> 16);
@@ -58,7 +58,7 @@ public class ZipUtilTest {
@Test
public void testZipLong() throws Exception {
- ZipLong test = ZipUtil.toDosTime(time);
+ final ZipLong test = ZipUtil.toDosTime(time);
assertEquals(test.getValue(), zl.getValue());
}
@@ -74,16 +74,16 @@ public class ZipUtilTest {
@Test
public void testMinTime(){
- byte[] b1 = ZipUtil.toDosTime(0);
- byte b10 = b1[0]; // Save the first byte
+ final byte[] b1 = ZipUtil.toDosTime(0);
+ final byte b10 = b1[0]; // Save the first byte
b1[0]++; // change it
- byte[] b2 = ZipUtil.toDosTime(0); // get the same time
+ final byte[] b2 = ZipUtil.toDosTime(0); // get the same time
assertEquals(b10,b2[0]); // first byte should still be the same
}
@Test
public void testOutsideCalendar(){
- byte[] b1 = ZipUtil.toDosTime(160441200000L); // 1.1..1975
+ final byte[] b1 = ZipUtil.toDosTime(160441200000L); // 1.1..1975
assertEquals(0, b1[0]);
assertEquals(33, b1[1]);
assertEquals(0, b1[2]);
@@ -92,9 +92,9 @@ public class ZipUtilTest {
@Test
public void testInsideCalendar(){
- TimeZone tz = TimeZone.getDefault();
- long date = 476096400000L; // 1.1.1985, 10:00 am GMT
- byte[] b1 = ZipUtil.toDosTime(date - tz.getOffset(date));
+ final TimeZone tz = TimeZone.getDefault();
+ final long date = 476096400000L; // 1.1.1985, 10:00 am GMT
+ final byte[] b1 = ZipUtil.toDosTime(date - tz.getOffset(date));
assertEquals(0, b1[0]);
assertEquals(72, b1[1]);
assertEquals(65, b1[2]);
@@ -103,7 +103,7 @@ public class ZipUtilTest {
@Test
public void testReverse() {
- byte[][] bTest = new byte[6][];
+ final byte[][] bTest = new byte[6][];
bTest[0] = new byte[]{};
bTest[1] = new byte[]{1};
bTest[2] = new byte[]{1, 2};
@@ -111,7 +111,7 @@ public class ZipUtilTest {
bTest[4] = new byte[]{1, 2, 3, 4};
bTest[5] = new byte[]{1, 2, 3, 4, 5};
- byte[][] rTest = new byte[6][];
+ final byte[][] rTest = new byte[6][];
rTest[0] = new byte[]{};
rTest[1] = new byte[]{1};
rTest[2] = new byte[]{2, 1};
@@ -122,7 +122,7 @@ public class ZipUtilTest {
assertEquals("test and result arrays are same length", bTest.length, rTest.length);
for (int i = 0; i < bTest.length; i++) {
- byte[] result = ZipUtil.reverse(bTest[i]);
+ final byte[] result = ZipUtil.reverse(bTest[i]);
assertTrue("reverse mutates in-place", bTest[i] == result);
assertTrue("reverse actually reverses", Arrays.equals(rTest[i], result));
}
@@ -130,45 +130,45 @@ public class ZipUtilTest {
@Test
public void testBigToLong() {
- BigInteger big1 = BigInteger.valueOf(1);
- BigInteger big2 = BigInteger.valueOf(Long.MAX_VALUE);
- BigInteger big3 = BigInteger.valueOf(Long.MIN_VALUE);
+ final BigInteger big1 = BigInteger.valueOf(1);
+ final BigInteger big2 = BigInteger.valueOf(Long.MAX_VALUE);
+ final BigInteger big3 = BigInteger.valueOf(Long.MIN_VALUE);
assertEquals(1L, ZipUtil.bigToLong(big1));
assertEquals(Long.MAX_VALUE, ZipUtil.bigToLong(big2));
assertEquals(Long.MIN_VALUE, ZipUtil.bigToLong(big3));
- BigInteger big4 = big2.add(big1);
+ final BigInteger big4 = big2.add(big1);
try {
ZipUtil.bigToLong(big4);
fail("Should have thrown IllegalArgumentException");
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
// All is good.
}
- BigInteger big5 = big3.subtract(big1);
+ final BigInteger big5 = big3.subtract(big1);
try {
ZipUtil.bigToLong(big5);
fail("ZipUtil.bigToLong(BigInteger) should have thrown IllegalArgumentException");
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
// All is good.
}
}
@Test
public void testLongToBig() {
- long l0 = 0;
- long l1 = 1;
- long l2 = -1;
- long l3 = Integer.MIN_VALUE;
- long l4 = Long.MAX_VALUE;
- long l5 = Long.MIN_VALUE;
-
- BigInteger big0 = ZipUtil.longToBig(l0);
- BigInteger big1 = ZipUtil.longToBig(l1);
- BigInteger big2 = ZipUtil.longToBig(l2);
- BigInteger big3 = ZipUtil.longToBig(l3);
- BigInteger big4 = ZipUtil.longToBig(l4);
+ final long l0 = 0;
+ final long l1 = 1;
+ final long l2 = -1;
+ final long l3 = Integer.MIN_VALUE;
+ final long l4 = Long.MAX_VALUE;
+ final long l5 = Long.MIN_VALUE;
+
+ final BigInteger big0 = ZipUtil.longToBig(l0);
+ final BigInteger big1 = ZipUtil.longToBig(l1);
+ final BigInteger big2 = ZipUtil.longToBig(l2);
+ final BigInteger big3 = ZipUtil.longToBig(l3);
+ final BigInteger big4 = ZipUtil.longToBig(l4);
assertEquals(0, big0.longValue());
assertEquals(1, big1.longValue());
@@ -179,7 +179,7 @@ public class ZipUtilTest {
try {
ZipUtil.longToBig(l5);
fail("ZipUtil.longToBig(long) should have thrown IllegalArgumentException");
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
}
}
@@ -189,7 +189,7 @@ public class ZipUtilTest {
// Yay, we can completely test all possible input values in this case!
int expectedVal = 128;
for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
- byte b = (byte) i;
+ final byte b = (byte) i;
assertEquals(expectedVal, ZipUtil.signedByteToUnsignedInt(b));
expectedVal++;
if (expectedVal == 256) {
@@ -202,7 +202,7 @@ public class ZipUtilTest {
public void testUnsignedIntToSignedByte() {
int unsignedVal = 128;
for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
- byte expectedVal = (byte) i;
+ final byte expectedVal = (byte) i;
assertEquals(expectedVal, ZipUtil.unsignedIntToSignedByte(unsignedVal));
unsignedVal++;
if (unsignedVal == 256) {
@@ -213,14 +213,14 @@ public class ZipUtilTest {
try {
ZipUtil.unsignedIntToSignedByte(-1);
fail("ZipUtil.unsignedIntToSignedByte(-1) should have thrown IllegalArgumentException");
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
// All is good.
}
try {
ZipUtil.unsignedIntToSignedByte(256);
fail("ZipUtil.unsignedIntToSignedByte(256) should have thrown IllegalArgumentException");
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
// All is good.
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java b/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java
index b9edb0b..a546a89 100644
--- a/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java
+++ b/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java
@@ -50,9 +50,9 @@ public final class ChangeSetTestCase extends AbstractTestCase {
// Delete a directory tree
private void archiveListDeleteDir(final String prefix){
- Iterator<String> it = archiveList.iterator();
+ final Iterator<String> it = archiveList.iterator();
while(it.hasNext()){
- String entry = it.next();
+ final String entry = it.next();
if (entry.startsWith(prefix+"/")){ // TODO won't work with folders
it.remove();
}
@@ -61,9 +61,9 @@ public final class ChangeSetTestCase extends AbstractTestCase {
// Delete a single file
private void archiveListDelete(final String prefix){
- Iterator<String> it = archiveList.iterator();
+ final Iterator<String> it = archiveList.iterator();
while(it.hasNext()){
- String entry = it.next();
+ final String entry = it.next();
if (entry.equals(prefix)){
it.remove();
}
@@ -85,15 +85,15 @@ public final class ChangeSetTestCase extends AbstractTestCase {
in = new FileInputStream(getFile("test.txt"));
in2 = new FileInputStream(getFile("test2.xml"));
- ArchiveEntry e = new ZipArchiveEntry("test.txt");
- ArchiveEntry e2 = new ZipArchiveEntry("test.txt");
+ final ArchiveEntry e = new ZipArchiveEntry("test.txt");
+ final ArchiveEntry e2 = new ZipArchiveEntry("test.txt");
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.add(e, in);
changes.add(e2, in2);
assertEquals(1, changes.getChanges().size());
- Change c = changes.getChanges().iterator().next();
+ final Change c = changes.getChanges().iterator().next();
assertEquals(in2, c.getInput());
} finally {
if (in != null) {
@@ -120,15 +120,15 @@ public final class ChangeSetTestCase extends AbstractTestCase {
in = new FileInputStream(getFile("test.txt"));
in2 = new FileInputStream(getFile("test2.xml"));
- ArchiveEntry e = new ZipArchiveEntry("test.txt");
- ArchiveEntry e2 = new ZipArchiveEntry("test.txt");
+ final ArchiveEntry e = new ZipArchiveEntry("test.txt");
+ final ArchiveEntry e2 = new ZipArchiveEntry("test.txt");
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.add(e, in, true);
changes.add(e2, in2, false);
assertEquals(1, changes.getChanges().size());
- Change c = changes.getChanges().iterator().next();
+ final Change c = changes.getChanges().iterator().next();
assertEquals(in, c.getInput());
} finally {
if (in != null) {
@@ -151,11 +151,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeleteDir() throws Exception {
final String archivename = "cpio";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -165,10 +165,10 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.deleteDir("bla");
archiveListDeleteDir("bla");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -193,11 +193,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeleteDir2() throws Exception {
final String archivename = "cpio";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -207,10 +207,10 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.deleteDir("la");
archiveListDeleteDir("la");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -235,11 +235,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeleteDir3() throws Exception {
final String archivename = "cpio";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -249,10 +249,10 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.deleteDir("test.txt");
archiveListDeleteDir("test.txt");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -277,11 +277,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeleteFile() throws Exception {
final String archivename = "cpio";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -291,11 +291,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.delete("bla/test5.xml");
archiveListDelete("bla/test5.xml");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -320,11 +320,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeleteFile2() throws Exception {
final String archivename = "cpio";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -334,11 +334,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.delete("bla");
//archiveListDelete("bla");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -364,11 +364,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeletePlusAddSame() throws Exception {
final String archivename = "zip";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
File testtxt = null;
@@ -379,17 +379,17 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.delete("test/test3.xml");
archiveListDelete("test/test3.xml");
// Add a file
testtxt = getFile("test.txt");
- ArchiveEntry entry = out.createArchiveEntry(testtxt, "test/test3.xml");
+ final ArchiveEntry entry = out.createArchiveEntry(testtxt, "test/test3.xml");
changes.add(entry, new FileInputStream(testtxt));
archiveList.add("test/test3.xml");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -410,10 +410,10 @@ public final class ChangeSetTestCase extends AbstractTestCase {
final BufferedInputStream buf = new BufferedInputStream(is);
in = factory.createArchiveInputStream(buf);
check = this.checkArchiveContent(in, archiveList, false);
- File test3xml = new File(check,"result/test/test3.xml");
+ final File test3xml = new File(check,"result/test/test3.xml");
assertEquals(testtxt.length(), test3xml.length());
- BufferedReader reader = new BufferedReader(new FileReader(test3xml));
+ final BufferedReader reader = new BufferedReader(new FileReader(test3xml));
String str;
while ((str = reader.readLine()) != null) {
// All lines look like this
@@ -436,11 +436,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testChangeSetResults() throws Exception {
final String archivename = "cpio";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -449,18 +449,18 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.deleteDir("bla");
archiveListDeleteDir("bla");
// Add a file
final File file1 = getFile("test.txt");
- ArchiveEntry entry = out.createArchiveEntry(file1, "bla/test.txt");
+ final ArchiveEntry entry = out.createArchiveEntry(file1, "bla/test.txt");
changes.add(entry, new FileInputStream(file1));
archiveList.add("bla/test.txt");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
- ChangeSetResults results = performer.perform(ais, out);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetResults results = performer.perform(ais, out);
is.close();
// Checks
@@ -500,11 +500,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeletePlusAdd() throws Exception {
final String archivename = "cpio";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -513,17 +513,17 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.deleteDir("bla");
archiveListDeleteDir("bla");
// Add a file
final File file1 = getFile("test.txt");
- ArchiveEntry entry = out.createArchiveEntry(file1, "bla/test.txt");
+ final ArchiveEntry entry = out.createArchiveEntry(file1, "bla/test.txt");
changes.add(entry, new FileInputStream(file1));
archiveList.add("bla/test.txt");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -547,11 +547,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeleteFromAndAddToZip() throws Exception {
final String archivename = "zip";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -560,17 +560,17 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
final File file1 = getFile("test.txt");
- ArchiveEntry entry = new ZipArchiveEntry("blub/test.txt");
+ final ArchiveEntry entry = new ZipArchiveEntry("blub/test.txt");
changes.add(entry, new FileInputStream(file1));
archiveList.add("blub/test.txt");
changes.delete("testdata/test1.xml");
archiveListDelete("testdata/test1.xml");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -594,11 +594,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeleteFromAndAddToZipUsingZipFilePerform() throws Exception {
final String archivename = "zip";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ZipFile ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -606,17 +606,17 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
final File file1 = getFile("test.txt");
- ArchiveEntry entry = new ZipArchiveEntry("blub/test.txt");
+ final ArchiveEntry entry = new ZipArchiveEntry("blub/test.txt");
changes.add(entry, new FileInputStream(file1));
archiveList.add("blub/test.txt");
changes.delete("testdata/test1.xml");
archiveListDelete("testdata/test1.xml");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
} finally {
@@ -640,11 +640,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testAddDeleteAdd() throws Exception {
final String archivename = "cpio";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -653,17 +653,17 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
final File file1 = getFile("test.txt");
- ArchiveEntry entry = new CpioArchiveEntry("blub/test.txt");
+ final ArchiveEntry entry = new CpioArchiveEntry("blub/test.txt");
changes.add(entry, new FileInputStream(file1));
archiveList.add("blub/test.txt");
changes.deleteDir("blub");
archiveListDeleteDir("blub");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -689,11 +689,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeleteAddDelete() throws Exception {
final String archivename = "cpio";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -702,19 +702,19 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.deleteDir("bla");
final File file1 = getFile("test.txt");
- ArchiveEntry entry = new CpioArchiveEntry("bla/test.txt");
+ final ArchiveEntry entry = new CpioArchiveEntry("bla/test.txt");
changes.add(entry, new FileInputStream(file1));
archiveList.add("bla/test.txt");
changes.deleteDir("bla");
archiveListDeleteDir("bla");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -742,7 +742,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ArchiveInputStream ais = null;
File temp = null;
try {
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.delete("test2.xml");
final File input = getFile("bla.zip");
@@ -754,7 +754,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream("zip",
new FileOutputStream(temp));
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
} finally {
@@ -766,7 +766,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
}
}
- List<String> expected = new ArrayList<String>();
+ final List<String> expected = new ArrayList<String>();
expected.add("test1.xml");
this.checkArchiveContent(temp, expected);
@@ -783,7 +783,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ArchiveInputStream ais = null;
File temp = null;
try {
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.delete("test2.xml");
final File input = getFile("bla.tar");
@@ -794,7 +794,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream("tar",
new FileOutputStream(temp));
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
} finally {
@@ -805,7 +805,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ais.close();
}
}
- List<String> expected = new ArrayList<String>();
+ final List<String> expected = new ArrayList<String>();
expected.add("test1.xml");
this.checkArchiveContent(temp, expected);
}
@@ -821,7 +821,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ArchiveInputStream ais = null;
File temp = null;
try {
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.delete("test2.xml");
changes.deleteDir("META-INF");
changes.delete(".classpath");
@@ -835,7 +835,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream("jar",
new FileOutputStream(temp));
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
} finally {
@@ -846,7 +846,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ais.close();
}
}
- List<String> expected = new ArrayList<String>();
+ final List<String> expected = new ArrayList<String>();
expected.add("test1.xml");
this.checkArchiveContent(temp, expected);
}
@@ -857,7 +857,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ArchiveInputStream ais = null;
File temp = null;
try {
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.delete("test2.xml");
final File file1 = getFile("test.txt");
@@ -882,7 +882,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream("tar",
new FileOutputStream(temp));
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
} finally {
@@ -893,7 +893,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ais.close();
}
}
- List<String> expected = new ArrayList<String>();
+ final List<String> expected = new ArrayList<String>();
expected.add("test1.xml");
expected.add("testdata/test.txt");
final ArchiveInputStream in = factory.createArchiveInputStream("tar", new FileInputStream(temp));
@@ -911,14 +911,14 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ArchiveInputStream ais = null;
File temp = null;
try {
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.delete("test2.xml");
changes.deleteDir("META-INF");
changes.delete(".classpath");
changes.delete(".project");
final File file1 = getFile("test.txt");
- JarArchiveEntry entry = new JarArchiveEntry("testdata/test.txt");
+ final JarArchiveEntry entry = new JarArchiveEntry("testdata/test.txt");
changes.add(entry, new FileInputStream(file1));
final File input = getFile("bla.jar");
@@ -929,7 +929,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream("jar",
new FileOutputStream(temp));
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
} finally {
@@ -940,7 +940,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ais.close();
}
}
- List<String> expected = new ArrayList<String>();
+ final List<String> expected = new ArrayList<String>();
expected.add("test1.xml");
expected.add("testdata/test.txt");
this.checkArchiveContent(temp, expected);
@@ -957,7 +957,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ArchiveInputStream ais = null;
File temp = null;
try {
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.delete("test2.xml");
final File input = getFile("bla.ar");
@@ -968,7 +968,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream("ar",
new FileOutputStream(temp));
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
} finally {
@@ -980,7 +980,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
}
}
- List<String> expected = new ArrayList<String>();
+ final List<String> expected = new ArrayList<String>();
expected.add("test1.xml");
this.checkArchiveContent(temp, expected);
}
@@ -996,7 +996,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ArchiveInputStream ais = null;
File temp = null;
try {
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
changes.delete("test2.xml");
final File file1 = getFile("test.txt");
@@ -1014,7 +1014,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream("ar",
new FileOutputStream(temp));
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
} finally {
@@ -1025,7 +1025,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
ais.close();
}
}
- List<String> expected = new ArrayList<String>();
+ final List<String> expected = new ArrayList<String>();
expected.add("test1.xml");
expected.add("test.txt");
this.checkArchiveContent(temp, expected);
@@ -1065,14 +1065,14 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testAddToEmptyArchive() throws Exception {
final String archivename = "zip";
- File input = this.createEmptyArchive(archivename);
+ final File input = this.createEmptyArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
InputStream is = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
try {
is = new FileInputStream(input);
@@ -1082,10 +1082,10 @@ public final class ChangeSetTestCase extends AbstractTestCase {
new FileOutputStream(result));
final File file1 = getFile("test.txt");
- ArchiveEntry entry = new ZipArchiveEntry("bla/test.txt");
+ final ArchiveEntry entry = new ZipArchiveEntry("bla/test.txt");
changes.add(entry, new FileInputStream(file1));
archiveList.add("bla/test.txt");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -1111,14 +1111,14 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testDeleteAddToOneFileArchive() throws Exception {
final String archivename = "zip";
- File input = this.createSingleEntryArchive(archivename);
+ final File input = this.createSingleEntryArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
InputStream is = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
try {
is = new FileInputStream(input);
@@ -1130,11 +1130,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
archiveListDelete("test1.xml");
final File file = getFile("test.txt");
- ArchiveEntry entry = out.createArchiveEntry(file,"bla/test.txt");
+ final ArchiveEntry entry = out.createArchiveEntry(file,"bla/test.txt");
changes.add(entry, new FileInputStream(file));
archiveList.add("bla/test.txt");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -1160,14 +1160,14 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testAddDeleteToOneFileArchive() throws Exception {
final String archivename = "cpio";
- File input = this.createSingleEntryArchive(archivename);
+ final File input = this.createSingleEntryArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
InputStream is = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
try {
is = new FileInputStream(input);
@@ -1176,14 +1176,14 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
final File file = getFile("test.txt");
- ArchiveEntry entry = out.createArchiveEntry(file,"bla/test.txt");
+ final ArchiveEntry entry = out.createArchiveEntry(file,"bla/test.txt");
changes.add(entry, new FileInputStream(file));
archiveList.add("bla/test.txt");
changes.delete("test1.xml");
archiveListDelete("test1.xml");
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
performer.perform(ais, out);
is.close();
@@ -1210,11 +1210,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testAddAllreadyExistingWithReplaceTrue() throws Exception {
final String archivename = "zip";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -1223,14 +1223,14 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
final File file1 = getFile("test.txt");
- ArchiveEntry entry = new ZipArchiveEntry("testdata/test1.xml");
+ final ArchiveEntry entry = new ZipArchiveEntry("testdata/test1.xml");
changes.add(entry, new FileInputStream(file1), true);
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
- ChangeSetResults results = performer.perform(ais, out);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetResults results = performer.perform(ais, out);
assertTrue(results.getAddedFromChangeSet().contains("testdata/test1.xml"));
is.close();
@@ -1255,11 +1255,11 @@ public final class ChangeSetTestCase extends AbstractTestCase {
@Test
public void testAddAllreadyExistingWithReplaceFalse() throws Exception {
final String archivename = "zip";
- File input = this.createArchive(archivename);
+ final File input = this.createArchive(archivename);
ArchiveOutputStream out = null;
ArchiveInputStream ais = null;
- File result = File.createTempFile("test", "."+archivename);
+ final File result = File.createTempFile("test", "."+archivename);
result.deleteOnExit();
try {
@@ -1268,14 +1268,14 @@ public final class ChangeSetTestCase extends AbstractTestCase {
out = factory.createArchiveOutputStream(archivename,
new FileOutputStream(result));
- ChangeSet changes = new ChangeSet();
+ final ChangeSet changes = new ChangeSet();
final File file1 = getFile("test.txt");
- ArchiveEntry entry = new ZipArchiveEntry("testdata/test1.xml");
+ final ArchiveEntry entry = new ZipArchiveEntry("testdata/test1.xml");
changes.add(entry, new FileInputStream(file1), false);
- ChangeSetPerformer performer = new ChangeSetPerformer(changes);
- ChangeSetResults results = performer.perform(ais, out);
+ final ChangeSetPerformer performer = new ChangeSetPerformer(changes);
+ final ChangeSetResults results = performer.perform(ais, out);
assertTrue(results.getAddedFromStream().contains("testdata/test1.xml"));
assertTrue(results.getAddedFromChangeSet().isEmpty());
assertTrue(results.getDeleted().isEmpty());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java b/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java
index 5132166..0ae8dee 100644
--- a/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java
@@ -41,7 +41,7 @@ public final class BZip2TestCase extends AbstractTestCase {
output = new File(dir, "test.txt.bz2");
final OutputStream out = new FileOutputStream(output);
final CompressorOutputStream cos = new CompressorStreamFactory().createCompressorOutputStream("bzip2", out);
- FileInputStream in = new FileInputStream(input);
+ final FileInputStream in = new FileInputStream(input);
IOUtils.copy(in, cos);
cos.close();
in.close();
@@ -53,7 +53,7 @@ public final class BZip2TestCase extends AbstractTestCase {
final InputStream is = new FileInputStream(toDecompress);
final CompressorInputStream in =
new CompressorStreamFactory().createCompressorInputStream("bzip2", is);
- FileOutputStream os = new FileOutputStream(decompressed);
+ final FileOutputStream os = new FileOutputStream(decompressed);
IOUtils.copy(in, os);
is.close();
os.close();
@@ -68,7 +68,7 @@ public final class BZip2TestCase extends AbstractTestCase {
final File output = new File(dir, "bla.txt");
final InputStream is = new FileInputStream(input);
final CompressorInputStream in = new CompressorStreamFactory().createCompressorInputStream("bzip2", is);
- FileOutputStream os = new FileOutputStream(output);
+ final FileOutputStream os = new FileOutputStream(output);
IOUtils.copy(in, os);
is.close();
os.close();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/DeflateTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/DeflateTestCase.java b/src/test/java/org/apache/commons/compress/compressors/DeflateTestCase.java
index 7d6a7e5..b713ed3 100644
--- a/src/test/java/org/apache/commons/compress/compressors/DeflateTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/DeflateTestCase.java
@@ -67,7 +67,7 @@ public final class DeflateTestCase extends AbstractTestCase {
final File output = new File(dir, "test1.xml.deflate");
final OutputStream out = new FileOutputStream(output);
try {
- DeflateParameters params = new DeflateParameters();
+ final DeflateParameters params = new DeflateParameters();
params.setWithZlibHeader(false);
final CompressorOutputStream cos = new DeflateCompressorOutputStream(out, params);
try {
@@ -119,7 +119,7 @@ public final class DeflateTestCase extends AbstractTestCase {
final File output = new File(dir, "bla.tar");
final InputStream is = new FileInputStream(input);
try {
- DeflateParameters params = new DeflateParameters();
+ final DeflateParameters params = new DeflateParameters();
params.setWithZlibHeader(false);
final CompressorInputStream in = new DeflateCompressorInputStream(is, params);
FileOutputStream out = null;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java b/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java
index eccbd5e..674a2a0 100644
--- a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java
@@ -89,30 +89,30 @@ public final class DetectCompressorTestCase {
@Test
public void testDetection() throws Exception {
- CompressorInputStream bzip2 = getStreamFor("bla.txt.bz2");
+ final CompressorInputStream bzip2 = getStreamFor("bla.txt.bz2");
assertNotNull(bzip2);
assertTrue(bzip2 instanceof BZip2CompressorInputStream);
- CompressorInputStream gzip = getStreamFor("bla.tgz");
+ final CompressorInputStream gzip = getStreamFor("bla.tgz");
assertNotNull(gzip);
assertTrue(gzip instanceof GzipCompressorInputStream);
- CompressorInputStream pack200 = getStreamFor("bla.pack");
+ final CompressorInputStream pack200 = getStreamFor("bla.pack");
assertNotNull(pack200);
assertTrue(pack200 instanceof Pack200CompressorInputStream);
- CompressorInputStream xz = getStreamFor("bla.tar.xz");
+ final CompressorInputStream xz = getStreamFor("bla.tar.xz");
assertNotNull(xz);
assertTrue(xz instanceof XZCompressorInputStream);
- CompressorInputStream zlib = getStreamFor("bla.tar.deflatez");
+ final CompressorInputStream zlib = getStreamFor("bla.tar.deflatez");
assertNotNull(zlib);
assertTrue(zlib instanceof DeflateCompressorInputStream);
try {
factory.createCompressorInputStream(new ByteArrayInputStream(new byte[0]));
fail("No exception thrown for an empty input stream");
- } catch (CompressorException e) {
+ } catch (final CompressorException e) {
// expected
}
}
@@ -129,7 +129,7 @@ public final class DetectCompressorTestCase {
try {
fac.setDecompressConcatenated(true);
fail("Expected IllegalStateException");
- } catch (IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
@@ -138,7 +138,7 @@ public final class DetectCompressorTestCase {
try {
fac.setDecompressConcatenated(true);
fail("Expected IllegalStateException");
- } catch (IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
}
@@ -146,13 +146,13 @@ public final class DetectCompressorTestCase {
@Test
public void testMutiples() throws Exception {
for(int i=0; i <tests.length; i++) {
- TestData test = tests[i];
+ final TestData test = tests[i];
final CompressorStreamFactory fac = test.factory;
assertNotNull("Test entry "+i, fac);
assertEquals("Test entry "+i, test.concat, fac.getDecompressConcatenated());
- CompressorInputStream in = getStreamFor(test.fileName, fac);
+ final CompressorInputStream in = getStreamFor(test.fileName, fac);
assertNotNull("Test entry "+i,in);
- for (char entry : test.entryNames) {
+ for (final char entry : test.entryNames) {
assertEquals("Test entry" + i, entry, in.read());
}
assertEquals(0, in.available());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java b/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
index 67b5c82..f8f04c4 100644
--- a/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
@@ -92,7 +92,7 @@ public final class FramedSnappyTestCase
final File original = getFile("bla.tar");
final FileInputStream written = new FileInputStream(output);
try {
- FileInputStream orig = new FileInputStream(original);
+ final FileInputStream orig = new FileInputStream(original);
try {
assertArrayEquals(IOUtils.toByteArray(written),
IOUtils.toByteArray(orig));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java b/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
index 5f133ab..624abeb 100644
--- a/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
@@ -135,7 +135,7 @@ public final class GZipTestCase extends AbstractTestCase {
in.close();
out.close();
- byte[] data = ((ByteArrayOutputStream) out).toByteArray();
+ final byte[] data = ((ByteArrayOutputStream) out).toByteArray();
in = new ByteArrayInputStream(data, 0, data.length - 1);
cin = new CompressorStreamFactory()
.createCompressorInputStream("gz", in);
@@ -144,7 +144,7 @@ public final class GZipTestCase extends AbstractTestCase {
try {
IOUtils.copy(cin, out);
fail("Expected an exception");
- } catch (IOException ioex) {
+ } catch (final IOException ioex) {
// the whole point of the test
}
@@ -163,7 +163,7 @@ public final class GZipTestCase extends AbstractTestCase {
@Test
public void testInteroperabilityWithGzipCompressorInputStream() throws Exception {
- FileInputStream fis = new FileInputStream(getFile("test3.xml"));
+ final FileInputStream fis = new FileInputStream(getFile("test3.xml"));
byte[] content;
try {
content = IOUtils.toByteArray(fis);
@@ -171,28 +171,28 @@ public final class GZipTestCase extends AbstractTestCase {
fis.close();
}
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ final ByteArrayOutputStream bout = new ByteArrayOutputStream();
- GzipParameters parameters = new GzipParameters();
+ final GzipParameters parameters = new GzipParameters();
parameters.setCompressionLevel(Deflater.BEST_COMPRESSION);
parameters.setOperatingSystem(3);
parameters.setFilename("test3.xml");
parameters.setComment("Test file");
parameters.setModificationTime(System.currentTimeMillis());
- GzipCompressorOutputStream out = new GzipCompressorOutputStream(bout, parameters);
+ final GzipCompressorOutputStream out = new GzipCompressorOutputStream(bout, parameters);
out.write(content);
out.flush();
out.close();
- GzipCompressorInputStream in = new GzipCompressorInputStream(new ByteArrayInputStream(bout.toByteArray()));
- byte[] content2 = IOUtils.toByteArray(in);
+ final GzipCompressorInputStream in = new GzipCompressorInputStream(new ByteArrayInputStream(bout.toByteArray()));
+ final byte[] content2 = IOUtils.toByteArray(in);
Assert.assertArrayEquals("uncompressed content", content, content2);
}
@Test
public void testInteroperabilityWithGZIPInputStream() throws Exception {
- FileInputStream fis = new FileInputStream(getFile("test3.xml"));
+ final FileInputStream fis = new FileInputStream(getFile("test3.xml"));
byte[] content;
try {
content = IOUtils.toByteArray(fis);
@@ -200,45 +200,45 @@ public final class GZipTestCase extends AbstractTestCase {
fis.close();
}
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ final ByteArrayOutputStream bout = new ByteArrayOutputStream();
- GzipParameters parameters = new GzipParameters();
+ final GzipParameters parameters = new GzipParameters();
parameters.setCompressionLevel(Deflater.BEST_COMPRESSION);
parameters.setOperatingSystem(3);
parameters.setFilename("test3.xml");
parameters.setComment("Test file");
parameters.setModificationTime(System.currentTimeMillis());
- GzipCompressorOutputStream out = new GzipCompressorOutputStream(bout, parameters);
+ final GzipCompressorOutputStream out = new GzipCompressorOutputStream(bout, parameters);
out.write(content);
out.flush();
out.close();
- GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(bout.toByteArray()));
- byte[] content2 = IOUtils.toByteArray(in);
+ final GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(bout.toByteArray()));
+ final byte[] content2 = IOUtils.toByteArray(in);
Assert.assertArrayEquals("uncompressed content", content, content2);
}
@Test
public void testInvalidCompressionLevel() {
- GzipParameters parameters = new GzipParameters();
+ final GzipParameters parameters = new GzipParameters();
try {
parameters.setCompressionLevel(10);
fail("IllegalArgumentException not thrown");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
parameters.setCompressionLevel(-5);
fail("IllegalArgumentException not thrown");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
}
private void testExtraFlags(final int compressionLevel, final int flag) throws Exception {
- FileInputStream fis = new FileInputStream(getFile("test3.xml"));
+ final FileInputStream fis = new FileInputStream(getFile("test3.xml"));
byte[] content;
try {
content = IOUtils.toByteArray(fis);
@@ -246,11 +246,11 @@ public final class GZipTestCase extends AbstractTestCase {
fis.close();
}
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ final ByteArrayOutputStream bout = new ByteArrayOutputStream();
- GzipParameters parameters = new GzipParameters();
+ final GzipParameters parameters = new GzipParameters();
parameters.setCompressionLevel(compressionLevel);
- GzipCompressorOutputStream out = new GzipCompressorOutputStream(bout, parameters);
+ final GzipCompressorOutputStream out = new GzipCompressorOutputStream(bout, parameters);
IOUtils.copy(new ByteArrayInputStream(content), out);
out.flush();
out.close();
@@ -275,28 +275,28 @@ public final class GZipTestCase extends AbstractTestCase {
@Test
public void testOverWrite() throws Exception {
- GzipCompressorOutputStream out = new GzipCompressorOutputStream(new ByteArrayOutputStream());
+ final GzipCompressorOutputStream out = new GzipCompressorOutputStream(new ByteArrayOutputStream());
out.close();
try {
out.write(0);
fail("IOException expected");
- } catch (IOException e) {
+ } catch (final IOException e) {
// expected
}
}
@Test
public void testMetadataRoundTrip() throws Exception {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ final ByteArrayOutputStream bout = new ByteArrayOutputStream();
- GzipParameters parameters = new GzipParameters();
+ final GzipParameters parameters = new GzipParameters();
parameters.setCompressionLevel(Deflater.BEST_COMPRESSION);
parameters.setModificationTime(123456000);
parameters.setOperatingSystem(13);
parameters.setFilename("test3.xml");
parameters.setComment("Umlaute möglich?");
- GzipCompressorOutputStream out = new GzipCompressorOutputStream(bout, parameters);
- FileInputStream fis = new FileInputStream(getFile("test3.xml"));
+ final GzipCompressorOutputStream out = new GzipCompressorOutputStream(bout, parameters);
+ final FileInputStream fis = new FileInputStream(getFile("test3.xml"));
try {
IOUtils.copy(fis, out);
} finally {
@@ -304,10 +304,10 @@ public final class GZipTestCase extends AbstractTestCase {
out.close();
}
- GzipCompressorInputStream input =
+ final GzipCompressorInputStream input =
new GzipCompressorInputStream(new ByteArrayInputStream(bout.toByteArray()));
input.close();
- GzipParameters readParams = input.getMetaData();
+ final GzipParameters readParams = input.getMetaData();
assertEquals(Deflater.BEST_COMPRESSION, readParams.getCompressionLevel());
assertEquals(123456000, readParams.getModificationTime());
assertEquals(13, readParams.getOperatingSystem());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java b/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java
index 3f30f0d..22a0488 100644
--- a/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java
@@ -77,14 +77,14 @@ public final class Pack200TestCase extends AbstractTestCase {
ArchiveEntry entry = in.getNextEntry();
while (entry != null) {
- File archiveEntry = new File(dir, entry.getName());
+ final File archiveEntry = new File(dir, entry.getName());
archiveEntry.getParentFile().mkdirs();
if (entry.isDirectory()) {
archiveEntry.mkdir();
entry = in.getNextEntry();
continue;
}
- OutputStream out = new FileOutputStream(archiveEntry);
+ final OutputStream out = new FileOutputStream(archiveEntry);
IOUtils.copy(in, out);
out.close();
entry = in.getNextEntry();
@@ -136,7 +136,7 @@ public final class Pack200TestCase extends AbstractTestCase {
try {
final ArchiveInputStream in = new ArchiveStreamFactory()
.createArchiveInputStream("jar", is);
- List<String> files = new ArrayList<String>();
+ final List<String> files = new ArrayList<String>();
files.add("testdata/test1.xml");
files.add("testdata/test2.xml");
checkArchiveContent(in, files);
@@ -150,7 +150,7 @@ public final class Pack200TestCase extends AbstractTestCase {
public void testGoodSignature() throws Exception {
final InputStream is = new FileInputStream(getFile("bla.pack"));
try {
- byte[] sig = new byte[4];
+ final byte[] sig = new byte[4];
is.read(sig);
assertTrue(Pack200CompressorInputStream.matches(sig, 4));
} finally {
@@ -162,7 +162,7 @@ public final class Pack200TestCase extends AbstractTestCase {
public void testBadSignature() throws Exception {
final InputStream is = new FileInputStream(getFile("bla.jar"));
try {
- byte[] sig = new byte[4];
+ final byte[] sig = new byte[4];
is.read(sig);
assertFalse(Pack200CompressorInputStream.matches(sig, 4));
} finally {
@@ -174,7 +174,7 @@ public final class Pack200TestCase extends AbstractTestCase {
public void testShortSignature() throws Exception {
final InputStream is = new FileInputStream(getFile("bla.pack"));
try {
- byte[] sig = new byte[2];
+ final byte[] sig = new byte[2];
is.read(sig);
assertFalse(Pack200CompressorInputStream.matches(sig, 2));
} finally {
@@ -184,7 +184,7 @@ public final class Pack200TestCase extends AbstractTestCase {
@Test
public void testInputStreamMethods() throws Exception {
- Map<String, String> m = new HashMap<String, String>();
+ final Map<String, String> m = new HashMap<String, String>();
m.put("foo", "bar");
final InputStream is =
new Pack200CompressorInputStream(new FileInputStream(getFile("bla.jar")),
@@ -195,7 +195,7 @@ public final class Pack200TestCase extends AbstractTestCase {
assertTrue(is.markSupported());
is.mark(5);
assertEquals(0x50, is.read());
- byte[] rest = new byte[3];
+ final byte[] rest = new byte[3];
assertEquals(3, is.read(rest));
assertEquals(0x4b, rest[0]);
assertEquals(3, rest[1]);
@@ -212,7 +212,7 @@ public final class Pack200TestCase extends AbstractTestCase {
@Test
public void testOutputStreamMethods() throws Exception {
final File output = new File(dir, "bla.pack");
- Map<String, String> m = new HashMap<String, String>();
+ final Map<String, String> m = new HashMap<String, String>();
m.put("foo", "bar");
final OutputStream out = new FileOutputStream(output);
try {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java b/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java
index 2a86b3f..6718340 100644
--- a/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java
@@ -36,7 +36,7 @@ public final class XZTestCase extends AbstractTestCase {
@Test
public void testXZCreation() throws Exception {
- long max = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax();
+ final long max = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax();
System.out.println("XZTestCase: HeapMax="+max+" bytes "+(double)max/(1024*1024)+" MB");
final File input = getFile("test1.xml");
final File output = new File(dir, "test1.xml.xz");
[18/46] commons-compress git commit: Add final modifier to private
fields.
Posted by bo...@apache.org.
Add final modifier to private fields.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/8d72635b
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/8d72635b
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/8d72635b
Branch: refs/heads/COMPRESS-207
Commit: 8d72635b9f244fc070d7b5f0d22e6d1211a153c9
Parents: 24e9389
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 00:59:26 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 00:59:26 2016 -0700
----------------------------------------------------------------------
.../org/apache/commons/compress/archivers/sevenz/SevenZFile.java | 2 +-
src/test/java/org/apache/commons/compress/ArchiveReadTest.java | 2 +-
.../java/org/apache/commons/compress/archivers/LongPathTest.java | 2 +-
.../org/apache/commons/compress/archivers/LongSymLinkTest.java | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8d72635b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index 3ea9369..0e47f8c 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -77,7 +77,7 @@ public class SevenZFile implements Closeable {
private InputStream currentFolderInputStream = null;
private byte[] password;
- private ArrayList<InputStream> deferredBlockStreams = new ArrayList<InputStream>();
+ private final ArrayList<InputStream> deferredBlockStreams = new ArrayList<InputStream>();
static final byte[] sevenZSignature = {
(byte)'7', (byte)'z', (byte)0xBC, (byte)0xAF, (byte)0x27, (byte)0x1C
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8d72635b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
index e8a3a4b..9f67273 100644
--- a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
+++ b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
@@ -51,7 +51,7 @@ public class ArchiveReadTest extends AbstractTestCase {
private static final File ARCDIR = new File(CLASSLOADER.getResource("archives").getFile());
private static final ArrayList<String> FILELIST = new ArrayList<String>();
- private File file;
+ private final File file;
public ArchiveReadTest(String file){
this.file = new File(ARCDIR, file);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8d72635b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
index 3aa423d..4f4d8ba 100644
--- a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
@@ -58,7 +58,7 @@ public class LongPathTest extends AbstractTestCase {
private static final File ARCDIR = new File(CLASSLOADER.getResource("longpath").getFile());
private static final ArrayList<String> FILELIST = new ArrayList<String>();
- private File file;
+ private final File file;
public LongPathTest(String file){
this.file = new File(ARCDIR, file);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8d72635b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
index 6ae4aa8..5395588 100644
--- a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
@@ -58,7 +58,7 @@ public class LongSymLinkTest extends AbstractTestCase {
private static final File ARCDIR = new File(CLASSLOADER.getResource("longsymlink").getFile());
private static final ArrayList<String> FILELIST = new ArrayList<String>();
- private File file;
+ private final File file;
public LongSymLinkTest(String file){
this.file = new File(ARCDIR, file);
[26/46] commons-compress git commit: Revert "remove powermockito
tests for Java5 compatibility"
Posted by bo...@apache.org.
Revert "remove powermockito tests for Java5 compatibility"
This reverts commit 142a788ad8102cd30b04746d4dc1b0bd56927059.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/e7c50cef
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/e7c50cef
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/e7c50cef
Branch: refs/heads/COMPRESS-207
Commit: e7c50ceff3d12c94730849aab73978ebd857d3f9
Parents: 9cc0604
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sat Apr 9 18:25:14 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sat Apr 9 18:25:14 2016 +0200
----------------------------------------------------------------------
pom.xml | 13 ++++
.../archivers/sevenz/SevenZNativeHeapTest.java | 64 ++++++++++++++++++++
2 files changed, 77 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/e7c50cef/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 38f4be5..a2df99b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,7 @@ jar, tar, zip, dump, 7z, arj.
<!-- configuration bits for cutting a release candidate -->
<commons.release.version>${project.version}</commons.release.version>
<commons.rc.version>RC1</commons.rc.version>
+ <powermock.version>1.6.4</powermock.version>
</properties>
<issueManagement>
@@ -65,6 +66,18 @@ jar, tar, zip, dump, 7z, arj.
<version>1.5</version>
<optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<developers>
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/e7c50cef/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZNativeHeapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZNativeHeapTest.java b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZNativeHeapTest.java
new file mode 100644
index 0000000..896af8c
--- /dev/null
+++ b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZNativeHeapTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.compress.archivers.sevenz;
+
+import org.apache.commons.compress.AbstractTestCase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mockito;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.zip.Deflater;
+import java.util.zip.Inflater;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest(Coders.DeflateDecoder.class)
+public class SevenZNativeHeapTest extends AbstractTestCase {
+
+ @InjectMocks
+ Coders.DeflateDecoder deflateDecoder;
+
+ @Test
+ public void testEndDeflaterOnCloseStream() throws Exception {
+ final Deflater deflater = PowerMockito.spy(new Deflater());
+ PowerMockito.whenNew(Deflater.class).withAnyArguments().thenReturn(deflater);
+
+ final OutputStream outputStream = deflateDecoder.encode(new ByteArrayOutputStream(), 9);
+ outputStream.close();
+
+ Mockito.verify(deflater).end();
+ }
+
+ @Test
+ public void testEndInflaterOnCloseStream() throws Exception {
+ final Inflater inflater = PowerMockito.spy(new Inflater());
+ PowerMockito.whenNew(Inflater.class).withAnyArguments().thenReturn(inflater);
+
+ final InputStream inputStream = deflateDecoder.decode("dummy",new ByteArrayInputStream(new byte[0]),0,null,null);
+ inputStream.close();
+
+ Mockito.verify(inflater).end();
+ }
+}
[16/46] commons-compress git commit: These static fields should be
accessed directly.
Posted by bo...@apache.org.
These static fields should be accessed directly.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ab85f00b
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ab85f00b
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ab85f00b
Branch: refs/heads/COMPRESS-207
Commit: ab85f00b6d327907ee23291979a6998c54cf88ad
Parents: 999821c
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 00:55:39 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 00:55:39 2016 -0700
----------------------------------------------------------------------
.../apache/commons/compress/archivers/zip/StreamCompressor.java | 5 +++--
.../commons/compress/archivers/zip/ZipArchiveInputStream.java | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab85f00b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
index 8e12e64..f1c810e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
@@ -26,6 +26,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.zip.CRC32;
import java.util.zip.Deflater;
+import java.util.zip.ZipEntry;
/**
* Encapsulates a {@link Deflater} and crc calculator, handling multiple types of output streams.
@@ -168,7 +169,7 @@ public abstract class StreamCompressor implements Closeable {
while ((length = source.read(readerBuf, 0, readerBuf.length)) >= 0) {
write(readerBuf, 0, length, method);
}
- if (method == ZipArchiveEntry.DEFLATED) {
+ if (method == ZipEntry.DEFLATED) {
flushDeflater();
}
}
@@ -186,7 +187,7 @@ public abstract class StreamCompressor implements Closeable {
long write(byte[] b, int offset, int length, int method) throws IOException {
long current = writtenToOutputStreamForLastEntry;
crc.update(b, offset, length);
- if (method == ZipArchiveEntry.DEFLATED) {
+ if (method == ZipEntry.DEFLATED) {
writeDeflated(b, offset, length);
} else {
writeCounted(b, offset, length);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ab85f00b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
index 584aa4a..f8df66b 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
@@ -305,7 +305,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
processZip64Extra(size, cSize);
- if (current.entry.getCompressedSize() != ZipArchiveEntry.SIZE_UNKNOWN) {
+ if (current.entry.getCompressedSize() != ArchiveEntry.SIZE_UNKNOWN) {
if (current.entry.getMethod() == ZipMethod.UNSHRINKING.getCode()) {
current.in = new UnshrinkingInputStream(new BoundedInputStream(in, current.entry.getCompressedSize()));
} else if (current.entry.getMethod() == ZipMethod.IMPLODING.getCode()) {
[08/46] commons-compress git commit: Close resource
Posted by bo...@apache.org.
Close resource
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/e158fc10
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/e158fc10
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/e158fc10
Branch: refs/heads/COMPRESS-207
Commit: e158fc108cacc0b4f73d37044e48a04137596b67
Parents: d2014e1
Author: Sebb <se...@apache.org>
Authored: Fri Apr 8 18:55:08 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Fri Apr 8 18:55:08 2016 +0100
----------------------------------------------------------------------
.../commons/compress/archivers/tar/TarArchiveInputStreamTest.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/e158fc10/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
index b1519a2..11232c6 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
@@ -77,6 +77,7 @@ public class TarArchiveInputStreamTest {
.parsePaxHeaders(new ByteArrayInputStream("11 foo=bar\n7 foo=\n"
.getBytes(CharsetNames.UTF_8)));
assertEquals(0, headers.size());
+ tais.close();
}
@Test
[30/46] commons-compress git commit: Add final modifier to method
parameters.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
index a7fa24e..99aabf9 100644
--- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
@@ -95,7 +95,7 @@ public class GzipCompressorInputStream extends CompressorInputStream {
*
* @throws IOException if the stream could not be created
*/
- public GzipCompressorInputStream(InputStream inputStream)
+ public GzipCompressorInputStream(final InputStream inputStream)
throws IOException {
this(inputStream, false);
}
@@ -120,8 +120,8 @@ public class GzipCompressorInputStream extends CompressorInputStream {
*
* @throws IOException if the stream could not be created
*/
- public GzipCompressorInputStream(InputStream inputStream,
- boolean decompressConcatenated)
+ public GzipCompressorInputStream(final InputStream inputStream,
+ final boolean decompressConcatenated)
throws IOException {
// Mark support is strictly needed for concatenated files only,
// but it's simpler if it is always available.
@@ -145,7 +145,7 @@ public class GzipCompressorInputStream extends CompressorInputStream {
return parameters;
}
- private boolean init(boolean isFirstMember) throws IOException {
+ private boolean init(final boolean isFirstMember) throws IOException {
assert isFirstMember || decompressConcatenated;
// Check the magic bytes without a possibility of EOFException.
@@ -233,7 +233,7 @@ public class GzipCompressorInputStream extends CompressorInputStream {
return true;
}
- private byte[] readToNull(DataInputStream inData) throws IOException {
+ private byte[] readToNull(final DataInputStream inData) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
int b = 0;
while ((b = inData.readUnsignedByte()) != 0x00) { // NOPMD
@@ -242,7 +242,7 @@ public class GzipCompressorInputStream extends CompressorInputStream {
return bos.toByteArray();
}
- private long readLittleEndianInt(DataInputStream inData) throws IOException {
+ private long readLittleEndianInt(final DataInputStream inData) throws IOException {
return inData.readUnsignedByte()
| (inData.readUnsignedByte() << 8)
| (inData.readUnsignedByte() << 16)
@@ -260,7 +260,7 @@ public class GzipCompressorInputStream extends CompressorInputStream {
* @since 1.1
*/
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, int off, int len) throws IOException {
if (endReached) {
return -1;
}
@@ -349,7 +349,7 @@ public class GzipCompressorInputStream extends CompressorInputStream {
*
* @since 1.1
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < 2) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
index aeae8c0..d1afb5d 100644
--- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
@@ -66,7 +66,7 @@ public class GzipCompressorOutputStream extends CompressorOutputStream {
* @param out the stream to compress to
* @throws IOException if writing fails
*/
- public GzipCompressorOutputStream(OutputStream out) throws IOException {
+ public GzipCompressorOutputStream(final OutputStream out) throws IOException {
this(out, new GzipParameters());
}
@@ -78,14 +78,14 @@ public class GzipCompressorOutputStream extends CompressorOutputStream {
*
* @since 1.7
*/
- public GzipCompressorOutputStream(OutputStream out, GzipParameters parameters) throws IOException {
+ public GzipCompressorOutputStream(final OutputStream out, final GzipParameters parameters) throws IOException {
this.out = out;
this.deflater = new Deflater(parameters.getCompressionLevel(), true);
writeHeader(parameters);
}
- private void writeHeader(GzipParameters parameters) throws IOException {
+ private void writeHeader(final GzipParameters parameters) throws IOException {
String filename = parameters.getFilename();
String comment = parameters.getComment();
@@ -131,7 +131,7 @@ public class GzipCompressorOutputStream extends CompressorOutputStream {
}
@Override
- public void write(int b) throws IOException {
+ public void write(final int b) throws IOException {
write(new byte[]{(byte) (b & 0xff)}, 0, 1);
}
@@ -141,7 +141,7 @@ public class GzipCompressorOutputStream extends CompressorOutputStream {
* @since 1.1
*/
@Override
- public void write(byte[] buffer) throws IOException {
+ public void write(final byte[] buffer) throws IOException {
write(buffer, 0, buffer.length);
}
@@ -151,7 +151,7 @@ public class GzipCompressorOutputStream extends CompressorOutputStream {
* @since 1.1
*/
@Override
- public void write(byte[] buffer, int offset, int length) throws IOException {
+ public void write(final byte[] buffer, final int offset, final int length) throws IOException {
if (deflater.finished()) {
throw new IOException("Cannot write more data, the end of the compressed data stream has been reached");
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/gzip/GzipParameters.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipParameters.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipParameters.java
index ef9a1af..ff3b41b 100644
--- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipParameters.java
+++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipParameters.java
@@ -47,7 +47,7 @@ public class GzipParameters {
* @see Deflater#DEFAULT_COMPRESSION
* @see Deflater#BEST_COMPRESSION
*/
- public void setCompressionLevel(int compressionLevel) {
+ public void setCompressionLevel(final int compressionLevel) {
if (compressionLevel < -1 || compressionLevel > 9) {
throw new IllegalArgumentException("Invalid gzip compression level: " + compressionLevel);
}
@@ -63,7 +63,7 @@ public class GzipParameters {
*
* @param modificationTime the modification time, in milliseconds
*/
- public void setModificationTime(long modificationTime) {
+ public void setModificationTime(final long modificationTime) {
this.modificationTime = modificationTime;
}
@@ -76,7 +76,7 @@ public class GzipParameters {
*
* @param filename the name of the file without the directory path
*/
- public void setFilename(String filename) {
+ public void setFilename(final String filename) {
this.filename = filename;
}
@@ -84,7 +84,7 @@ public class GzipParameters {
return comment;
}
- public void setComment(String comment) {
+ public void setComment(final String comment) {
this.comment = comment;
}
@@ -115,7 +115,7 @@ public class GzipParameters {
*
* @param operatingSystem the code of the operating system
*/
- public void setOperatingSystem(int operatingSystem) {
+ public void setOperatingSystem(final int operatingSystem) {
this.operatingSystem = operatingSystem;
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/gzip/GzipUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipUtils.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipUtils.java
index 40be437..154f1cb 100644
--- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipUtils.java
+++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipUtils.java
@@ -61,7 +61,7 @@ public class GzipUtils {
* @return {@code true} if the filename has a common gzip suffix,
* {@code false} otherwise
*/
- public static boolean isCompressedFilename(String filename) {
+ public static boolean isCompressedFilename(final String filename) {
return fileNameUtil.isCompressedFilename(filename);
}
@@ -78,7 +78,7 @@ public class GzipUtils {
* @param filename name of a file
* @return name of the corresponding uncompressed file
*/
- public static String getUncompressedFilename(String filename) {
+ public static String getUncompressedFilename(final String filename) {
return fileNameUtil.getUncompressedFilename(filename);
}
@@ -93,7 +93,7 @@ public class GzipUtils {
* @param filename name of a file
* @return name of the corresponding compressed file
*/
- public static String getCompressedFilename(String filename) {
+ public static String getCompressedFilename(final String filename) {
return fileNameUtil.getCompressedFilename(filename);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
index f9a8eae..ae23297 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
@@ -43,7 +43,7 @@ public class LZMACompressorInputStream extends CompressorInputStream {
* by this implementation, or the underlying
* <code>inputStream</code> throws an exception
*/
- public LZMACompressorInputStream(InputStream inputStream)
+ public LZMACompressorInputStream(final InputStream inputStream)
throws IOException {
in = new LZMAInputStream(inputStream);
}
@@ -58,7 +58,7 @@ public class LZMACompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
- public int read(byte[] buf, int off, int len) throws IOException {
+ public int read(final byte[] buf, final int off, final int len) throws IOException {
int ret = in.read(buf, off, len);
count(ret);
return ret;
@@ -66,7 +66,7 @@ public class LZMACompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
- public long skip(long n) throws IOException {
+ public long skip(final long n) throws IOException {
return in.skip(n);
}
@@ -93,7 +93,7 @@ public class LZMACompressorInputStream extends CompressorInputStream {
*
* @since 1.10
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (signature == null || length < 3) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/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 9d5af20..c1a653a 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
@@ -68,7 +68,7 @@ public class LZMAUtils {
* @param length the number of bytes to check
* @return true if signature matches the .lzma magic bytes, false otherwise
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < HEADER_MAGIC.length) {
return false;
}
@@ -111,7 +111,7 @@ public class LZMAUtils {
* @return {@code true} if the filename has a common lzma suffix,
* {@code false} otherwise
*/
- public static boolean isCompressedFilename(String filename) {
+ public static boolean isCompressedFilename(final String filename) {
return fileNameUtil.isCompressedFilename(filename);
}
@@ -125,7 +125,7 @@ public class LZMAUtils {
* @param filename name of a file
* @return name of the corresponding uncompressed file
*/
- public static String getUncompressedFilename(String filename) {
+ public static String getUncompressedFilename(final String filename) {
return fileNameUtil.getUncompressedFilename(filename);
}
@@ -136,7 +136,7 @@ public class LZMAUtils {
* @param filename name of a file
* @return name of the corresponding compressed file
*/
- public static String getCompressedFilename(String filename) {
+ public static String getCompressedFilename(final String filename) {
return fileNameUtil.getCompressedFilename(filename);
}
@@ -146,7 +146,7 @@ public class LZMAUtils {
* <p>This defaults to {@code false} in an OSGi environment and {@code true} otherwise.</p>
* @param doCache whether to cache the result
*/
- public static void setCacheLZMAAvailablity(boolean doCache) {
+ public static void setCacheLZMAAvailablity(final boolean doCache) {
if (!doCache) {
cachedLZMAAvailability = CachedAvailability.DONT_CACHE;
} else if (cachedLZMAAvailability == CachedAvailability.DONT_CACHE) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
index 89988c9..a102695 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
@@ -69,7 +69,7 @@ public abstract class LZWInputStream extends CompressorInputStream {
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
int bytesRead = readFromStack(b, off, len);
while (len - bytesRead > 0) {
int result = decompressNextSymbol();
@@ -107,7 +107,7 @@ public abstract class LZWInputStream extends CompressorInputStream {
* Sets the clear code based on the code size.
* @param codeSize code size
*/
- protected void setClearCode(int codeSize) {
+ protected void setClearCode(final int codeSize) {
clearCode = (1 << (codeSize - 1));
}
@@ -115,7 +115,7 @@ public abstract class LZWInputStream extends CompressorInputStream {
* Initializes the arrays based on the maximum code size.
* @param maxCodeSize maximum code size
*/
- protected void initializeTables(int maxCodeSize) {
+ protected void initializeTables(final int maxCodeSize) {
final int maxTableSize = 1 << maxCodeSize;
prefixes = new int[maxTableSize];
characters = new byte[maxTableSize];
@@ -148,7 +148,7 @@ public abstract class LZWInputStream extends CompressorInputStream {
* @param maxTableSize the maximum table size
* @return the new code
*/
- protected int addEntry(int previousCode, byte character, int maxTableSize) {
+ protected int addEntry(final int previousCode, final byte character, final int maxTableSize) {
if (tableSize < maxTableSize) {
prefixes[tableSize] = previousCode;
characters[tableSize] = character;
@@ -178,7 +178,7 @@ public abstract class LZWInputStream extends CompressorInputStream {
* @return the new location of the output stack
* @throws IOException on error
*/
- protected int expandCodeToOutputStack(int code, boolean addedUnfinishedEntry)
+ protected int expandCodeToOutputStack(final int code, final boolean addedUnfinishedEntry)
throws IOException {
for (int entry = code; entry >= 0; entry = prefixes[entry]) {
outputStack[--outputStackLocation] = characters[entry];
@@ -191,7 +191,7 @@ public abstract class LZWInputStream extends CompressorInputStream {
return outputStackLocation;
}
- private int readFromStack(byte[] b, int off, int len) {
+ private int readFromStack(final byte[] b, final int off, final int len) {
int remainingInStack = outputStack.length - outputStackLocation;
if (remainingInStack > 0) {
int maxLength = Math.min(remainingInStack, len);
@@ -210,7 +210,7 @@ public abstract class LZWInputStream extends CompressorInputStream {
setCodeSize(DEFAULT_CODE_SIZE);
}
- protected void setCodeSize(int cs) {
+ protected void setCodeSize(final int cs) {
this.codeSize = cs;
}
@@ -222,11 +222,11 @@ public abstract class LZWInputStream extends CompressorInputStream {
this.previousCode = -1;
}
- protected int getPrefix(int offset) {
+ protected int getPrefix(final int offset) {
return prefixes[offset];
}
- protected void setPrefix(int offset, int value) {
+ protected void setPrefix(final int offset, final int value) {
prefixes[offset] = value;
}
@@ -242,7 +242,7 @@ public abstract class LZWInputStream extends CompressorInputStream {
return tableSize;
}
- protected void setTableSize(int newSize) {
+ protected void setTableSize(final int newSize) {
tableSize = newSize;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java
index d88be88..3e28465 100644
--- a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java
@@ -197,12 +197,12 @@ public class Pack200CompressorInputStream extends CompressorInputStream {
}
@Override
- public int read(byte[] b) throws IOException {
+ public int read(final byte[] b) throws IOException {
return streamBridge.getInput().read(b);
}
@Override
- public int read(byte[] b, int off, int count) throws IOException {
+ public int read(final byte[] b, final int off, final int count) throws IOException {
return streamBridge.getInput().read(b, off, count);
}
@@ -221,7 +221,7 @@ public class Pack200CompressorInputStream extends CompressorInputStream {
}
@Override
- public void mark(int limit) {
+ public void mark(final int limit) {
try {
streamBridge.getInput().mark(limit);
} catch (IOException ex) {
@@ -235,7 +235,7 @@ public class Pack200CompressorInputStream extends CompressorInputStream {
}
@Override
- public long skip(long count) throws IOException {
+ public long skip(final long count) throws IOException {
return streamBridge.getInput().skip(count);
}
@@ -266,7 +266,7 @@ public class Pack200CompressorInputStream extends CompressorInputStream {
* @return true, if this stream is a pack200 compressed stream,
* false otherwise
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < SIG_LENGTH) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java
index 80da616..87a1d87 100644
--- a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java
@@ -99,17 +99,17 @@ public class Pack200CompressorOutputStream extends CompressorOutputStream {
}
@Override
- public void write(int b) throws IOException {
+ public void write(final int b) throws IOException {
streamBridge.write(b);
}
@Override
- public void write(byte[] b) throws IOException {
+ public void write(final byte[] b) throws IOException {
streamBridge.write(b);
}
@Override
- public void write(byte[] b, int from, int length) throws IOException {
+ public void write(final byte[] b, final int from, final int length) throws IOException {
streamBridge.write(b, from, length);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Utils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Utils.java b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Utils.java
index b76c75b..4659f42 100644
--- a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Utils.java
+++ b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Utils.java
@@ -55,7 +55,7 @@ public class Pack200Utils {
* @param jar the JAR archive to normalize
* @throws IOException if reading or writing fails
*/
- public static void normalize(File jar)
+ public static void normalize(final File jar)
throws IOException {
normalize(jar, jar, null);
}
@@ -76,7 +76,7 @@ public class Pack200Utils {
* method will implicitly set the segment limit to -1.
* @throws IOException if reading or writing fails
*/
- public static void normalize(File jar, Map<String, String> props)
+ public static void normalize(final File jar, final Map<String, String> props)
throws IOException {
normalize(jar, jar, props);
}
@@ -101,7 +101,7 @@ public class Pack200Utils {
* @param to the normalized archive
* @throws IOException if reading or writing fails
*/
- public static void normalize(File from, File to)
+ public static void normalize(final File from, final File to)
throws IOException {
normalize(from, to, null);
}
@@ -125,7 +125,7 @@ public class Pack200Utils {
* method will implicitly set the segment limit to -1.
* @throws IOException if reading or writing fails
*/
- public static void normalize(File from, File to, Map<String, String> props)
+ public static void normalize(final File from, final File to, Map<String, String> props)
throws IOException {
if (props == null) {
props = new HashMap<String, String>();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/pack200/StreamBridge.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/pack200/StreamBridge.java b/src/main/java/org/apache/commons/compress/compressors/pack200/StreamBridge.java
index 293e0bb..980cb7e 100644
--- a/src/main/java/org/apache/commons/compress/compressors/pack200/StreamBridge.java
+++ b/src/main/java/org/apache/commons/compress/compressors/pack200/StreamBridge.java
@@ -35,7 +35,7 @@ abstract class StreamBridge extends FilterOutputStream {
private InputStream input;
private final Object INPUT_LOCK = new Object();
- protected StreamBridge(OutputStream out) {
+ protected StreamBridge(final OutputStream out) {
super(out);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
index 8d245d4..3d51c9c 100644
--- a/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
@@ -75,7 +75,7 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
* @param in the InputStream from which to read the compressed data
* @throws IOException if reading fails
*/
- public FramedSnappyCompressorInputStream(InputStream in) throws IOException {
+ public FramedSnappyCompressorInputStream(final InputStream in) throws IOException {
this.in = new PushbackInputStream(in, 1);
readStreamIdentifier();
}
@@ -98,7 +98,7 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
int read = readOnce(b, off, len);
if (read == -1) {
readNextBlock();
@@ -129,7 +129,7 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
* read from the current chunk (which may be -1 if the end of the
* chunk is reached).
*/
- private int readOnce(byte[] b, int off, int len) throws IOException {
+ private int readOnce(final byte[] b, final int off, final int len) throws IOException {
int read = -1;
if (inUncompressedChunk) {
int amount = Math.min(uncompressedBytesRemaining, len);
@@ -273,7 +273,7 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
* @param length the number of bytes to check
* @return true if this is a .sz stream, false otherwise
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < SZ_SIGNATURE.length) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java b/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
index 506d86c..d01353c 100644
--- a/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
+++ b/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
@@ -54,7 +54,7 @@ public void reset() {
}
@Override
-public void update(byte[] b, int off, int len) {
+public void update(final byte[] b, int off, int len) {
int localCrc = crc;
while(len > 7) {
@@ -95,7 +95,7 @@ public void update(byte[] b, int off, int len) {
}
@Override
-final public void update(int b) {
+final public void update(final int b) {
crc = (crc >>> 8) ^ T[T8_0_start + ((crc ^ b) & 0xff)];
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
index 92e1cbc..fae3a42 100644
--- a/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
@@ -125,7 +125,7 @@ public class SnappyCompressorInputStream extends CompressorInputStream {
* {@inheritDoc}
*/
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
if (endReached) {
return -1;
}
@@ -152,7 +152,7 @@ public class SnappyCompressorInputStream extends CompressorInputStream {
*
* @param len the number of uncompressed bytes to read
*/
- private void fill(int len) throws IOException {
+ private void fill(final int len) throws IOException {
if (uncompressedBytesRemaining == 0) {
endReached = true;
}
@@ -265,7 +265,7 @@ public class SnappyCompressorInputStream extends CompressorInputStream {
* or 63 for 1-4 bytes, respectively. The literal itself follows
* after the length.
*/
- private int readLiteralLength(int b) throws IOException {
+ private int readLiteralLength(final int b) throws IOException {
int length;
switch (b >> 2) {
case 60:
@@ -336,7 +336,7 @@ public class SnappyCompressorInputStream extends CompressorInputStream {
* buffer
* @return True if the decompressed data should be flushed
*/
- private boolean expandCopy(final long off, int length) throws IOException {
+ private boolean expandCopy(final long off, final int length) throws IOException {
if (off > blockSize) {
throw new IOException("Offset is larger than block size");
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
index c6e4e9e..24fee7b 100644
--- a/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
@@ -40,7 +40,7 @@ public class XZCompressorInputStream extends CompressorInputStream {
* @param length the number of bytes to check
* @return true if signature matches the .xz magic bytes, false otherwise
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < XZ.HEADER_MAGIC.length) {
return false;
}
@@ -67,7 +67,7 @@ public class XZCompressorInputStream extends CompressorInputStream {
* by this implementation, or the underlying
* <code>inputStream</code> throws an exception
*/
- public XZCompressorInputStream(InputStream inputStream)
+ public XZCompressorInputStream(final InputStream inputStream)
throws IOException {
this(inputStream, false);
}
@@ -89,8 +89,8 @@ public class XZCompressorInputStream extends CompressorInputStream {
* by this implementation, or the underlying
* <code>inputStream</code> throws an exception
*/
- public XZCompressorInputStream(InputStream inputStream,
- boolean decompressConcatenated)
+ public XZCompressorInputStream(final InputStream inputStream,
+ final boolean decompressConcatenated)
throws IOException {
if (decompressConcatenated) {
in = new XZInputStream(inputStream);
@@ -107,14 +107,14 @@ public class XZCompressorInputStream extends CompressorInputStream {
}
@Override
- public int read(byte[] buf, int off, int len) throws IOException {
+ public int read(final byte[] buf, final int off, final int len) throws IOException {
int ret = in.read(buf, off, len);
count(ret);
return ret;
}
@Override
- public long skip(long n) throws IOException {
+ public long skip(final long n) throws IOException {
return in.skip(n);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorOutputStream.java
index 23cda28..6e9b70e 100644
--- a/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorOutputStream.java
@@ -38,7 +38,7 @@ public class XZCompressorOutputStream extends CompressorOutputStream {
* @param outputStream the stream to wrap
* @throws IOException on error
*/
- public XZCompressorOutputStream(OutputStream outputStream)
+ public XZCompressorOutputStream(final OutputStream outputStream)
throws IOException {
out = new XZOutputStream(outputStream, new LZMA2Options());
}
@@ -59,18 +59,18 @@ public class XZCompressorOutputStream extends CompressorOutputStream {
* @param preset the preset
* @throws IOException on error
*/
- public XZCompressorOutputStream(OutputStream outputStream, int preset)
+ public XZCompressorOutputStream(final OutputStream outputStream, final int preset)
throws IOException {
out = new XZOutputStream(outputStream, new LZMA2Options(preset));
}
@Override
- public void write(int b) throws IOException {
+ public void write(final int b) throws IOException {
out.write(b);
}
@Override
- public void write(byte[] buf, int off, int len) throws IOException {
+ public void write(final byte[] buf, final int off, final int len) throws IOException {
out.write(buf, off, len);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/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 d1742d9..db71b17 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
@@ -77,7 +77,7 @@ public class XZUtils {
* @return true if signature matches the .xz magic bytes, false otherwise
* @since 1.9
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < HEADER_MAGIC.length) {
return false;
}
@@ -120,7 +120,7 @@ public class XZUtils {
* @return {@code true} if the filename has a common xz suffix,
* {@code false} otherwise
*/
- public static boolean isCompressedFilename(String filename) {
+ public static boolean isCompressedFilename(final String filename) {
return fileNameUtil.isCompressedFilename(filename);
}
@@ -137,7 +137,7 @@ public class XZUtils {
* @param filename name of a file
* @return name of the corresponding uncompressed file
*/
- public static String getUncompressedFilename(String filename) {
+ public static String getUncompressedFilename(final String filename) {
return fileNameUtil.getUncompressedFilename(filename);
}
@@ -152,7 +152,7 @@ public class XZUtils {
* @param filename name of a file
* @return name of the corresponding compressed file
*/
- public static String getCompressedFilename(String filename) {
+ public static String getCompressedFilename(final String filename) {
return fileNameUtil.getCompressedFilename(filename);
}
@@ -163,7 +163,7 @@ public class XZUtils {
* @param doCache whether to cache the result
* @since 1.9
*/
- public static void setCacheXZAvailablity(boolean doCache) {
+ public static void setCacheXZAvailablity(final boolean doCache) {
if (!doCache) {
cachedXZAvailability = CachedAvailability.DONT_CACHE;
} else if (cachedXZAvailability == CachedAvailability.DONT_CACHE) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/z/ZCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/z/ZCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/z/ZCompressorInputStream.java
index e21df06..a7b028e 100644
--- a/src/main/java/org/apache/commons/compress/compressors/z/ZCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/z/ZCompressorInputStream.java
@@ -38,7 +38,7 @@ public class ZCompressorInputStream extends LZWInputStream {
private final int maxCodeSize;
private long totalCodesRead = 0;
- public ZCompressorInputStream(InputStream inputStream) throws IOException {
+ public ZCompressorInputStream(final InputStream inputStream) throws IOException {
super(inputStream, ByteOrder.LITTLE_ENDIAN);
int firstByte = (int) in.readBits(8);
int secondByte = (int) in.readBits(8);
@@ -96,7 +96,7 @@ public class ZCompressorInputStream extends LZWInputStream {
* change or disappear without warning.</strong></p>
*/
@Override
- protected int addEntry(int previousCode, byte character) throws IOException {
+ protected int addEntry(final int previousCode, final byte character) throws IOException {
final int maxTableSize = 1 << getCodeSize();
int r = addEntry(previousCode, character, maxTableSize);
if (getTableSize() == maxTableSize && getCodeSize() < maxCodeSize) {
@@ -159,7 +159,7 @@ public class ZCompressorInputStream extends LZWInputStream {
*
* @since 1.9
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
return length > 3 && signature[0] == MAGIC_1 && signature[1] == (byte) MAGIC_2;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/parallel/FileBasedScatterGatherBackingStore.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/parallel/FileBasedScatterGatherBackingStore.java b/src/main/java/org/apache/commons/compress/parallel/FileBasedScatterGatherBackingStore.java
index b8225a3..1a26d3d 100644
--- a/src/main/java/org/apache/commons/compress/parallel/FileBasedScatterGatherBackingStore.java
+++ b/src/main/java/org/apache/commons/compress/parallel/FileBasedScatterGatherBackingStore.java
@@ -34,7 +34,7 @@ public class FileBasedScatterGatherBackingStore implements ScatterGatherBackingS
private final FileOutputStream os;
private boolean closed;
- public FileBasedScatterGatherBackingStore(File target) throws FileNotFoundException {
+ public FileBasedScatterGatherBackingStore(final File target) throws FileNotFoundException {
this.target = target;
os = new FileOutputStream(target);
}
@@ -54,7 +54,7 @@ public class FileBasedScatterGatherBackingStore implements ScatterGatherBackingS
}
@Override
- public void writeOut(byte[] data, int offset, int length) throws IOException {
+ public void writeOut(final byte[] data, final int offset, final int length) throws IOException {
os.write(data, offset, length);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java b/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
index 8fee98c..8798274 100644
--- a/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
+++ b/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
@@ -43,7 +43,7 @@ public class ArchiveUtils {
* @param entry the entry
* @return the representation of the entry
*/
- public static String toString(ArchiveEntry entry){
+ public static String toString(final ArchiveEntry entry){
StringBuilder sb = new StringBuilder();
sb.append(entry.isDirectory()? 'd' : '-');// c.f. "ls -l" output
String size = Long.toString(entry.getSize());
@@ -67,7 +67,7 @@ public class ArchiveUtils {
* @return {@code true} if buffer is the same as the expected string
*/
public static boolean matchAsciiBuffer(
- String expected, byte[] buffer, int offset, int length){
+ final String expected, final byte[] buffer, final int offset, final int length){
byte[] buffer1;
try {
buffer1 = expected.getBytes(CharsetNames.US_ASCII);
@@ -84,7 +84,7 @@ public class ArchiveUtils {
* @param buffer the buffer
* @return {@code true} if buffer is the same as the expected string
*/
- public static boolean matchAsciiBuffer(String expected, byte[] buffer){
+ public static boolean matchAsciiBuffer(final String expected, final byte[] buffer){
return matchAsciiBuffer(expected, buffer, 0, buffer.length);
}
@@ -95,7 +95,7 @@ public class ArchiveUtils {
* @param inputString string to convert
* @return the bytes
*/
- public static byte[] toAsciiBytes(String inputString){
+ public static byte[] toAsciiBytes(final String inputString){
try {
return inputString.getBytes(CharsetNames.US_ASCII);
} catch (UnsupportedEncodingException e) {
@@ -125,7 +125,7 @@ public class ArchiveUtils {
* @param length length of array
* @return the bytes, interpreted as an Ascii string
*/
- public static String toAsciiString(final byte[] inputBytes, int offset, int length){
+ public static String toAsciiString(final byte[] inputBytes, final int offset, final int length){
try {
return new String(inputBytes, offset, length, CharsetNames.US_ASCII);
} catch (UnsupportedEncodingException e) {
@@ -148,7 +148,7 @@ public class ArchiveUtils {
public static boolean isEqual(
final byte[] buffer1, final int offset1, final int length1,
final byte[] buffer2, final int offset2, final int length2,
- boolean ignoreTrailingNulls){
+ final boolean ignoreTrailingNulls){
int minLen=length1 < length2 ? length1 : length2;
for (int i=0; i < minLen; i++){
if (buffer1[offset1+i] != buffer2[offset2+i]){
@@ -213,7 +213,7 @@ public class ArchiveUtils {
* @param ignoreTrailingNulls whether to ignore tariling nulls
* @return {@code true} if buffer1 and buffer2 have same contents
*/
- public static boolean isEqual(final byte[] buffer1, final byte[] buffer2, boolean ignoreTrailingNulls){
+ public static boolean isEqual(final byte[] buffer1, final byte[] buffer2, final boolean ignoreTrailingNulls){
return isEqual(buffer1, 0, buffer1.length, buffer2, 0, buffer2.length, ignoreTrailingNulls);
}
@@ -243,7 +243,7 @@ public class ArchiveUtils {
* The number of characters to check (not the size of the array)
* @return true if the first N bytes are zero
*/
- public static boolean isArrayZero(byte[] a, int size) {
+ public static boolean isArrayZero(final byte[] a, final int size) {
for (int i = 0; i < size; i++) {
if (a[i] != 0) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java b/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java
index 5b35667..978f09e 100644
--- a/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java
+++ b/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java
@@ -50,7 +50,7 @@ public class BoundedInputStream extends InputStream {
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
if (bytesRemaining == 0) {
return -1;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/utils/Charsets.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/Charsets.java b/src/main/java/org/apache/commons/compress/utils/Charsets.java
index 8c1559e..5808a64 100644
--- a/src/main/java/org/apache/commons/compress/utils/Charsets.java
+++ b/src/main/java/org/apache/commons/compress/utils/Charsets.java
@@ -68,7 +68,7 @@ public class Charsets {
* A charset or null.
* @return the given Charset or the default Charset if the given Charset is null
*/
- public static Charset toCharset(Charset charset) {
+ public static Charset toCharset(final Charset charset) {
return charset == null ? Charset.defaultCharset() : charset;
}
@@ -83,7 +83,7 @@ public class Charsets {
* @throws java.nio.charset.IllegalCharsetNameException
* If the given charset name is illegal
*/
- public static Charset toCharset(String charset) {
+ public static Charset toCharset(final String charset) {
return charset == null ? Charset.defaultCharset() : Charset.forName(charset);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java b/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
index 856e448..eb8619f 100644
--- a/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
+++ b/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
@@ -70,7 +70,7 @@ public class ChecksumVerifyingInputStream extends InputStream {
* value
*/
@Override
- public int read(byte[] b) throws IOException {
+ public int read(final byte[] b) throws IOException {
return read(b, 0, b.length);
}
@@ -81,7 +81,7 @@ public class ChecksumVerifyingInputStream extends InputStream {
* value
*/
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
int ret = in.read(b, off, len);
if (ret >= 0) {
checksum.update(b, off, ret);
@@ -94,7 +94,7 @@ public class ChecksumVerifyingInputStream extends InputStream {
}
@Override
- public long skip(long n) throws IOException {
+ public long skip(final long n) throws IOException {
// Can't really skip, we have to hash everything to verify the checksum
if (read() >= 0) {
return 1;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/utils/CountingInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/CountingInputStream.java b/src/main/java/org/apache/commons/compress/utils/CountingInputStream.java
index ab26d2d..c4905fa 100644
--- a/src/main/java/org/apache/commons/compress/utils/CountingInputStream.java
+++ b/src/main/java/org/apache/commons/compress/utils/CountingInputStream.java
@@ -43,11 +43,11 @@ public class CountingInputStream extends FilterInputStream {
return r;
}
@Override
- public int read(byte[] b) throws IOException {
+ public int read(final byte[] b) throws IOException {
return read(b, 0, b.length);
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
int r = in.read(b, off, len);
if (r >= 0) {
count(r);
@@ -60,7 +60,7 @@ public class CountingInputStream extends FilterInputStream {
*
* @param read the number of bytes read
*/
- protected final void count(long read) {
+ protected final void count(final long read) {
if (read != -1) {
bytesRead += read;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/utils/CountingOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/CountingOutputStream.java b/src/main/java/org/apache/commons/compress/utils/CountingOutputStream.java
index 3e62fde..e91de89 100644
--- a/src/main/java/org/apache/commons/compress/utils/CountingOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/utils/CountingOutputStream.java
@@ -35,16 +35,16 @@ public class CountingOutputStream extends FilterOutputStream {
}
@Override
- public void write(int b) throws IOException {
+ public void write(final int b) throws IOException {
out.write(b);
count(1);
}
@Override
- public void write(byte[] b) throws IOException {
+ public void write(final byte[] b) throws IOException {
write(b, 0, b.length);
}
@Override
- public void write(byte[] b, int off, int len) throws IOException {
+ public void write(final byte[] b, final int off, final int len) throws IOException {
out.write(b, off, len);
count(len);
}
@@ -55,7 +55,7 @@ public class CountingOutputStream extends FilterOutputStream {
*
* @param written the number of bytes written
*/
- protected void count(long written) {
+ protected void count(final long written) {
if (written != -1) {
bytesWritten += written;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/utils/IOUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/IOUtils.java b/src/main/java/org/apache/commons/compress/utils/IOUtils.java
index 940d29d..ee9989b 100644
--- a/src/main/java/org/apache/commons/compress/utils/IOUtils.java
+++ b/src/main/java/org/apache/commons/compress/utils/IOUtils.java
@@ -70,7 +70,7 @@ public final class IOUtils {
* @throws IOException
* if an error occurs
*/
- public static long copy(final InputStream input, final OutputStream output, int buffersize) throws IOException {
+ public static long copy(final InputStream input, final OutputStream output, final int buffersize) throws IOException {
final byte[] buffer = new byte[buffersize];
int n = 0;
long count=0;
@@ -97,7 +97,7 @@ public final class IOUtils {
* @return the number of bytes actually skipped
* @throws IOException on error
*/
- public static long skip(InputStream input, long numToSkip) throws IOException {
+ public static long skip(final InputStream input, long numToSkip) throws IOException {
long available = numToSkip;
while (numToSkip > 0) {
long skipped = input.skip(numToSkip);
@@ -130,7 +130,7 @@ public final class IOUtils {
* @return the number of bytes actually read
* @throws IOException on error
*/
- public static int readFully(InputStream input, byte[] b) throws IOException {
+ public static int readFully(final InputStream input, final byte[] b) throws IOException {
return readFully(input, b, 0, b.length);
}
@@ -150,7 +150,7 @@ public final class IOUtils {
* @throws IOException
* if an I/O error has occurred
*/
- public static int readFully(InputStream input, byte[] b, int offset, int len)
+ public static int readFully(final InputStream input, final byte[] b, final int offset, final int len)
throws IOException {
if (len < 0 || offset < 0 || len + offset > b.length) {
throw new IndexOutOfBoundsException();
@@ -195,7 +195,7 @@ public final class IOUtils {
* @param c Closeable to close, can be null
* @since 1.7
*/
- public static void closeQuietly(Closeable c) {
+ public static void closeQuietly(final Closeable c) {
if (c != null) {
try {
c.close();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/AbstractTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/AbstractTestCase.java b/src/test/java/org/apache/commons/compress/AbstractTestCase.java
index a17d03e..fda713d 100644
--- a/src/test/java/org/apache/commons/compress/AbstractTestCase.java
+++ b/src/test/java/org/apache/commons/compress/AbstractTestCase.java
@@ -60,14 +60,14 @@ public abstract class AbstractTestCase {
archive = null;
}
- public static File mkdir(String name) throws IOException {
+ public static File mkdir(final String name) throws IOException {
File f = File.createTempFile(name, "");
f.delete();
f.mkdir();
return f;
}
- public static File getFile(String path) throws IOException {
+ public static File getFile(final String path) throws IOException {
URL url = AbstractTestCase.class.getClassLoader().getResource(path);
if (url == null) {
throw new FileNotFoundException("couldn't find " + path);
@@ -95,7 +95,7 @@ public abstract class AbstractTestCase {
}
}
- public static void rmdir(File f) {
+ public static void rmdir(final File f) {
String[] s = f.list();
if (s != null) {
for (String element : s) {
@@ -126,7 +126,7 @@ public abstract class AbstractTestCase {
* @return whether deletion was successful
* @since Stolen from FileUtils in Ant 1.8.0
*/
- public static boolean tryHardToDelete(File f) {
+ public static boolean tryHardToDelete(final File f) {
if (f != null && f.exists() && !f.delete()) {
if (ON_WINDOWS) {
System.gc();
@@ -165,7 +165,7 @@ public abstract class AbstractTestCase {
* @throws Exception
* in case something goes wrong
*/
- protected File createArchive(String archivename) throws Exception {
+ protected File createArchive(final String archivename) throws Exception {
ArchiveOutputStream out = null;
OutputStream stream = null;
try {
@@ -212,7 +212,7 @@ public abstract class AbstractTestCase {
* @throws IOException
* @throws FileNotFoundException
*/
- private void addArchiveEntry(ArchiveOutputStream out, String filename, final File infile)
+ private void addArchiveEntry(final ArchiveOutputStream out, final String filename, final File infile)
throws IOException, FileNotFoundException {
ArchiveEntry entry = out.createArchiveEntry(infile, filename);
out.putArchiveEntry(entry);
@@ -227,7 +227,7 @@ public abstract class AbstractTestCase {
* @return the archive File
* @throws Exception
*/
- protected File createEmptyArchive(String archivename) throws Exception {
+ protected File createEmptyArchive(final String archivename) throws Exception {
ArchiveOutputStream out = null;
OutputStream stream = null;
archiveList = new ArrayList<String>();
@@ -254,7 +254,7 @@ public abstract class AbstractTestCase {
* @return the archive File
* @throws Exception
*/
- protected File createSingleEntryArchive(String archivename) throws Exception {
+ protected File createSingleEntryArchive(final String archivename) throws Exception {
ArchiveOutputStream out = null;
OutputStream stream = null;
archiveList = new ArrayList<String>();
@@ -285,7 +285,7 @@ public abstract class AbstractTestCase {
* a list with expected string filenames
* @throws Exception
*/
- protected void checkArchiveContent(File archive, List<String> expected)
+ protected void checkArchiveContent(final File archive, final List<String> expected)
throws Exception {
final InputStream is = new FileInputStream(archive);
try {
@@ -304,7 +304,7 @@ public abstract class AbstractTestCase {
* @param expected list of expected entries or {@code null} if no check of names desired
* @throws Exception
*/
- protected void checkArchiveContent(ArchiveInputStream in, List<String> expected)
+ protected void checkArchiveContent(final ArchiveInputStream in, final List<String> expected)
throws Exception {
checkArchiveContent(in, expected, true);
}
@@ -318,7 +318,7 @@ public abstract class AbstractTestCase {
* @return returns the created result file if cleanUp = false, or null otherwise
* @throws Exception
*/
- protected File checkArchiveContent(ArchiveInputStream in, List<String> expected, boolean cleanUp)
+ protected File checkArchiveContent(final ArchiveInputStream in, final List<String> expected, final boolean cleanUp)
throws Exception {
File result = mkdir("dir-result");
result.deleteOnExit();
@@ -374,7 +374,7 @@ public abstract class AbstractTestCase {
* @param entry
* @return returns the entry name
*/
- protected String getExpectedString(ArchiveEntry entry) {
+ protected String getExpectedString(final ArchiveEntry entry) {
return entry.getName();
}
@@ -402,7 +402,7 @@ public abstract class AbstractTestCase {
return tmpDir;
}
- protected void closeQuietly(Closeable closeable){
+ protected void closeQuietly(final Closeable closeable){
if (closeable != null) {
try {
closeable.close();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
index 4cd72d0..f9c3ce2 100644
--- a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
+++ b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
@@ -53,7 +53,7 @@ public class ArchiveReadTest extends AbstractTestCase {
private final File file;
- public ArchiveReadTest(String file){
+ public ArchiveReadTest(final String file){
this.file = new File(ARCDIR, file);
}
@@ -78,7 +78,7 @@ public class ArchiveReadTest extends AbstractTestCase {
Collection<Object[]> params = new ArrayList<Object[]>();
for (String f : ARCDIR.list(new FilenameFilter() {
@Override
- public boolean accept(File dir, String name) {
+ public boolean accept(final File dir, final String name) {
return !name.endsWith(".txt");
}
}))
@@ -90,7 +90,7 @@ public class ArchiveReadTest extends AbstractTestCase {
// files.txt contains size and filename
@Override
- protected String getExpectedString(ArchiveEntry entry) {
+ protected String getExpectedString(final ArchiveEntry entry) {
return entry.getSize() + " " + entry.getName();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java b/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java
index 113b287..7eb3318 100644
--- a/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java
@@ -67,11 +67,11 @@ public class ArchiveUtilsTest extends AbstractTestCase {
asciiToByteAndBackFail("\u8025");
}
- private void asciiToByteAndBackOK(String inputString) {
+ private void asciiToByteAndBackOK(final String inputString) {
assertEquals(inputString, ArchiveUtils.toAsciiString(ArchiveUtils.toAsciiBytes(inputString)));
}
- private void asciiToByteAndBackFail(String inputString) {
+ private void asciiToByteAndBackFail(final String inputString) {
assertFalse(inputString.equals(ArchiveUtils.toAsciiString(ArchiveUtils.toAsciiBytes(inputString))));
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java b/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java
index 8e1e7bf..68d12b6 100644
--- a/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java
+++ b/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java
@@ -96,7 +96,7 @@ public final class DetectArchiverTestCase extends AbstractTestCase {
}
- private ArchiveInputStream getStreamFor(String resource)
+ private ArchiveInputStream getStreamFor(final String resource)
throws ArchiveException, IOException {
return factory.createArchiveInputStream(
new BufferedInputStream(new FileInputStream(
@@ -129,7 +129,7 @@ public final class DetectArchiverTestCase extends AbstractTestCase {
checkEmptyArchive("zip");
}
- private void checkEmptyArchive(String type) throws Exception{
+ private void checkEmptyArchive(final String type) throws Exception{
File ar = createEmptyArchive(type); // will be deleted by tearDown()
ar.deleteOnExit(); // Just in case file cannot be deleted
ArchiveInputStream ais = null;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/IOMethodsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/IOMethodsTest.java b/src/test/java/org/apache/commons/compress/IOMethodsTest.java
index 2ba67a1..b962392 100644
--- a/src/test/java/org/apache/commons/compress/IOMethodsTest.java
+++ b/src/test/java/org/apache/commons/compress/IOMethodsTest.java
@@ -108,7 +108,7 @@ public class IOMethodsTest extends AbstractTestCase {
compareReads("zip");
}
- private void compareWrites(String archiverName, ArchiveEntry entry) throws Exception {
+ private void compareWrites(final String archiverName, final ArchiveEntry entry) throws Exception {
OutputStream out1 = new ByteArrayOutputStream();
OutputStream out2 = new ByteArrayOutputStream();
OutputStream out3 = new ByteArrayOutputStream();
@@ -139,7 +139,7 @@ public class IOMethodsTest extends AbstractTestCase {
assertEquals("out1!=out3",out1.toString(),out3.toString());
}
- private void compareReads(String archiverName) throws Exception {
+ private void compareReads(final String archiverName) throws Exception {
OutputStream out1 = new ByteArrayOutputStream();
OutputStream out2 = new ByteArrayOutputStream();
OutputStream out3 = new ByteArrayOutputStream();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
index 451d70d..a1c0243 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
@@ -134,7 +134,7 @@ public class ArchiveOutputStreamTest extends AbstractTestCase {
doCallSequence("Zip");
}
- private void doCallSequence(String archiveType) throws Exception {
+ private void doCallSequence(final String archiveType) throws Exception {
OutputStream out1 = new ByteArrayOutputStream();
File dummy = getFile("test1.xml"); // need a real file
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
index 338df54..ec1ead4 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
@@ -195,7 +195,7 @@ public class ArchiveStreamFactoryTest {
final String fieldName;
final String type;
final boolean hasOutputStream;
- TestData(String testFile, String type, boolean hasOut, String expectedEncoding, ArchiveStreamFactory fac, String fieldName) {
+ TestData(final String testFile, final String type, final boolean hasOut, final String expectedEncoding, final ArchiveStreamFactory fac, final String fieldName) {
this.testFile = testFile;
this.expectedEncoding = expectedEncoding;
this.fac = fac;
@@ -206,7 +206,7 @@ public class ArchiveStreamFactoryTest {
}
@SuppressWarnings("deprecation") // test of deprecated method
- static ArchiveStreamFactory getFactory(String entryEncoding) {
+ static ArchiveStreamFactory getFactory(final String entryEncoding) {
ArchiveStreamFactory fac = new ArchiveStreamFactory();
fac.setEntryEncoding(entryEncoding);
return fac;
@@ -342,14 +342,14 @@ public class ArchiveStreamFactoryTest {
}
// equals allowing null
- private static boolean eq(String exp, String act) {
+ private static boolean eq(final String exp, final String act) {
if (exp == null) {
return act == null;
}
return exp.equals(act);
}
- private static String getField(Object instance, String name) {
+ private static String getField(final Object instance, final String name) {
Class<?> cls = instance.getClass();
Field fld;
try {
@@ -383,14 +383,14 @@ public class ArchiveStreamFactoryTest {
}
}
- private ArchiveInputStream getInputStreamFor(String resource, ArchiveStreamFactory factory)
+ private ArchiveInputStream getInputStreamFor(final String resource, final ArchiveStreamFactory factory)
throws IOException, ArchiveException {
return factory.createArchiveInputStream(
new BufferedInputStream(new FileInputStream(
getFile(resource))));
}
- private ArchiveInputStream getInputStreamFor(String type, String resource, ArchiveStreamFactory factory)
+ private ArchiveInputStream getInputStreamFor(final String type, final String resource, final ArchiveStreamFactory factory)
throws IOException, ArchiveException {
return factory.createArchiveInputStream(
type,
@@ -398,7 +398,7 @@ public class ArchiveStreamFactoryTest {
getFile(resource))));
}
- private ArchiveOutputStream getOutputStreamFor(String type, ArchiveStreamFactory factory)
+ private ArchiveOutputStream getOutputStreamFor(final String type, final ArchiveStreamFactory factory)
throws IOException, ArchiveException {
return factory.createArchiveOutputStream(type, new ByteArrayOutputStream());
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
index 212cfb1..b7807dc 100644
--- a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
@@ -60,7 +60,7 @@ public class LongPathTest extends AbstractTestCase {
private final File file;
- public LongPathTest(String file){
+ public LongPathTest(final String file){
this.file = new File(ARCDIR, file);
}
@@ -84,7 +84,7 @@ public class LongPathTest extends AbstractTestCase {
Collection<Object[]> params = new ArrayList<Object[]>();
for (String f : ARCDIR.list(new FilenameFilter() {
@Override
- public boolean accept(File dir, String name) {
+ public boolean accept(final File dir, final String name) {
return !name.endsWith(".txt");
}
}))
@@ -95,7 +95,7 @@ public class LongPathTest extends AbstractTestCase {
}
@Override
- protected String getExpectedString(ArchiveEntry entry) {
+ protected String getExpectedString(final ArchiveEntry entry) {
if (entry instanceof TarArchiveEntry) {
TarArchiveEntry tarEntry = (TarArchiveEntry) entry;
if (tarEntry.isSymbolicLink()) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
index 61bfdea..e1612db 100644
--- a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
@@ -60,7 +60,7 @@ public class LongSymLinkTest extends AbstractTestCase {
private final File file;
- public LongSymLinkTest(String file){
+ public LongSymLinkTest(final String file){
this.file = new File(ARCDIR, file);
}
@@ -84,7 +84,7 @@ public class LongSymLinkTest extends AbstractTestCase {
Collection<Object[]> params = new ArrayList<Object[]>();
for (String f : ARCDIR.list(new FilenameFilter() {
@Override
- public boolean accept(File dir, String name) {
+ public boolean accept(final File dir, final String name) {
return !name.endsWith(".txt");
}
}))
@@ -96,7 +96,7 @@ public class LongSymLinkTest extends AbstractTestCase {
@Override
- protected String getExpectedString(ArchiveEntry entry) {
+ protected String getExpectedString(final ArchiveEntry entry) {
if (entry instanceof TarArchiveEntry) {
TarArchiveEntry tarEntry = (TarArchiveEntry) entry;
if (tarEntry.isSymbolicLink()) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/SevenZTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/SevenZTestCase.java b/src/test/java/org/apache/commons/compress/archivers/SevenZTestCase.java
index 16bedc1..505be6b 100644
--- a/src/test/java/org/apache/commons/compress/archivers/SevenZTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/SevenZTestCase.java
@@ -52,7 +52,7 @@ public class SevenZTestCase extends AbstractTestCase {
testSevenZArchiveCreation(SevenZMethod.DEFLATE);
}
- private void testSevenZArchiveCreation(SevenZMethod method) throws Exception {
+ private void testSevenZArchiveCreation(final SevenZMethod method) throws Exception {
final File output = new File(dir, "bla.7z");
final File file1 = getFile("test1.xml");
final File file2 = getFile("test2.xml");
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
index 4c952fb..b87b291 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
@@ -314,7 +314,7 @@ public final class ZipTestCase extends AbstractTestCase {
String second_payload = "AAAAAAAAAAAA";
ZipArchiveEntryPredicate allFilesPredicate = new ZipArchiveEntryPredicate() {
@Override
- public boolean test(ZipArchiveEntry zipArchiveEntry) {
+ public boolean test(final ZipArchiveEntry zipArchiveEntry) {
return true;
}
};
@@ -397,7 +397,7 @@ public final class ZipTestCase extends AbstractTestCase {
zf1.close();
}
- private File createReferenceFile(File directory, Zip64Mode zipMode, String prefix) throws IOException {
+ private File createReferenceFile(final File directory, final Zip64Mode zipMode, final String prefix) throws IOException {
File reference = File.createTempFile(prefix, ".zip", directory);
ZipArchiveOutputStream zos = new ZipArchiveOutputStream(reference);
zos.setUseZip64(zipMode);
@@ -407,18 +407,18 @@ public final class ZipTestCase extends AbstractTestCase {
return reference;
}
- private ZipArchiveOutputStream createFirstEntry(ZipArchiveOutputStream zos) throws IOException {
+ private ZipArchiveOutputStream createFirstEntry(final ZipArchiveOutputStream zos) throws IOException {
createArchiveEntry(first_payload, zos, "file1.txt");
return zos;
}
- private ZipArchiveOutputStream createSecondEntry(ZipArchiveOutputStream zos) throws IOException {
+ private ZipArchiveOutputStream createSecondEntry(final ZipArchiveOutputStream zos) throws IOException {
createArchiveEntry(second_payload, zos, "file2.txt");
return zos;
}
- private void assertSameFileContents(File expectedFile, File actualFile) throws IOException {
+ private void assertSameFileContents(final File expectedFile, final File actualFile) throws IOException {
int size = (int) Math.max(expectedFile.length(), actualFile.length());
ZipFile expected = new ZipFile(expectedFile);
ZipFile actual = new ZipFile(actualFile);
@@ -456,7 +456,7 @@ public final class ZipTestCase extends AbstractTestCase {
}
- private void createArchiveEntry(String payload, ZipArchiveOutputStream zos, String name)
+ private void createArchiveEntry(final String payload, final ZipArchiveOutputStream zos, final String name)
throws IOException {
ZipArchiveEntry in = new ZipArchiveEntry(name);
zos.putArchiveEntry(in);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
index d62d3a0..2f6625e 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
@@ -40,7 +40,7 @@ public class ArArchiveInputStreamTest extends AbstractTestCase {
checkLongNameEntry("longfile_bsd.ar");
}
- private void checkLongNameEntry(String archive) throws Exception {
+ private void checkLongNameEntry(final String archive) throws Exception {
FileInputStream fis = new FileInputStream(getFile(archive));
ArArchiveInputStream s = null;
try {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
index 7ed4f11..53320d8 100644
--- a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
@@ -92,7 +92,7 @@ public class SevenZFileTest extends AbstractTestCase {
}
}
- private byte[] readFully(SevenZFile archive) throws IOException {
+ private byte[] readFully(final SevenZFile archive) throws IOException {
byte [] buf = new byte [1024];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (int len = 0; (len = archive.read(buf)) > 0;) {
@@ -139,7 +139,7 @@ public class SevenZFileTest extends AbstractTestCase {
}
}
- private void test7zUnarchive(File f, SevenZMethod m) throws Exception {
+ private void test7zUnarchive(final File f, final SevenZMethod m) throws Exception {
test7zUnarchive(f, m, null);
}
@@ -260,7 +260,7 @@ public class SevenZFileTest extends AbstractTestCase {
}
}
- private void test7zUnarchive(File f, SevenZMethod m, byte[] password) throws Exception {
+ private void test7zUnarchive(final File f, final SevenZMethod m, final byte[] password) throws Exception {
SevenZFile sevenZFile = new SevenZFile(f, password);
try {
SevenZArchiveEntry entry = sevenZFile.getNextEntry();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java
index 9400e7a..3da4b2c 100644
--- a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java
@@ -369,7 +369,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
}
}
- private void testCompress252(int numberOfFiles, int numberOfNonEmptyFiles)
+ private void testCompress252(final int numberOfFiles, final int numberOfNonEmptyFiles)
throws Exception {
int nonEmptyModulus = numberOfNonEmptyFiles != 0
? numberOfFiles / numberOfNonEmptyFiles
@@ -389,7 +389,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
verifyCompress252(output, numberOfFiles, numberOfNonEmptyFiles);
}
- private void verifyCompress252(File output, int numberOfFiles, int numberOfNonEmptyFiles)
+ private void verifyCompress252(final File output, final int numberOfFiles, final int numberOfNonEmptyFiles)
throws Exception {
SevenZFile archive = new SevenZFile(output);
int filesFound = 0;
@@ -410,25 +410,25 @@ public class SevenZOutputFileTest extends AbstractTestCase {
assertEquals(numberOfNonEmptyFiles, nonEmptyFilesFound);
}
- private void addDir(SevenZOutputFile archive) throws Exception {
+ private void addDir(final SevenZOutputFile archive) throws Exception {
SevenZArchiveEntry entry = archive.createArchiveEntry(dir, "foo/");
archive.putArchiveEntry(entry);
archive.closeArchiveEntry();
}
- private void verifyDir(SevenZFile archive) throws Exception {
+ private void verifyDir(final SevenZFile archive) throws Exception {
SevenZArchiveEntry entry = archive.getNextEntry();
assertNotNull(entry);
assertEquals("foo/", entry.getName());
assertTrue(entry.isDirectory());
}
- private void addFile(SevenZOutputFile archive, int index, boolean nonEmpty)
+ private void addFile(final SevenZOutputFile archive, final int index, final boolean nonEmpty)
throws Exception {
addFile(archive, index, nonEmpty, null);
}
- private void addFile(SevenZOutputFile archive, int index, boolean nonEmpty, Iterable<SevenZMethodConfiguration> methods)
+ private void addFile(final SevenZOutputFile archive, final int index, final boolean nonEmpty, final Iterable<SevenZMethodConfiguration> methods)
throws Exception {
SevenZArchiveEntry entry = new SevenZArchiveEntry();
entry.setName("foo/" + index + ".txt");
@@ -438,12 +438,12 @@ public class SevenZOutputFileTest extends AbstractTestCase {
archive.closeArchiveEntry();
}
- private Boolean verifyFile(SevenZFile archive, int index) throws Exception {
+ private Boolean verifyFile(final SevenZFile archive, final int index) throws Exception {
return verifyFile(archive, index, null);
}
- private Boolean verifyFile(SevenZFile archive, int index,
- Iterable<SevenZMethodConfiguration> methods) throws Exception {
+ private Boolean verifyFile(final SevenZFile archive, final int index,
+ final Iterable<SevenZMethodConfiguration> methods) throws Exception {
SevenZArchiveEntry entry = archive.getNextEntry();
if (entry == null) {
return null;
@@ -462,14 +462,14 @@ public class SevenZOutputFileTest extends AbstractTestCase {
return Boolean.TRUE;
}
- private void testRoundTrip(SevenZMethod method) throws Exception {
+ private void testRoundTrip(final SevenZMethod method) throws Exception {
output = new File(dir, method + "-roundtrip.7z");
ArrayList<SevenZMethodConfiguration> methods = new ArrayList<SevenZMethodConfiguration>();
methods.add(new SevenZMethodConfiguration(method));
createAndReadBack(output, methods);
}
- private void testFilterRoundTrip(SevenZMethodConfiguration method) throws Exception {
+ private void testFilterRoundTrip(final SevenZMethodConfiguration method) throws Exception {
output = new File(dir, method.getMethod() + "-roundtrip.7z");
ArrayList<SevenZMethodConfiguration> methods = new ArrayList<SevenZMethodConfiguration>();
methods.add(method);
@@ -477,7 +477,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
createAndReadBack(output, methods);
}
- private void createAndReadBack(File output, Iterable<SevenZMethodConfiguration> methods) throws Exception {
+ private void createAndReadBack(final File output, final Iterable<SevenZMethodConfiguration> methods) throws Exception {
SevenZOutputFile outArchive = new SevenZOutputFile(output);
outArchive.setContentMethods(methods);
try {
@@ -494,8 +494,8 @@ public class SevenZOutputFileTest extends AbstractTestCase {
}
}
- private static void assertContentMethodsEquals(Iterable<? extends SevenZMethodConfiguration> expected,
- Iterable<? extends SevenZMethodConfiguration> actual) {
+ private static void assertContentMethodsEquals(final Iterable<? extends SevenZMethodConfiguration> expected,
+ final Iterable<? extends SevenZMethodConfiguration> actual) {
assertNotNull(actual);
Iterator<? extends SevenZMethodConfiguration> expectedIter = expected.iterator();
Iterator<? extends SevenZMethodConfiguration> actualIter = actual.iterator();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java b/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java
index b7faf79..e676062 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java
@@ -68,7 +68,7 @@ public class BigFilesIT {
}
}
- private void readFileBiggerThan8GByte(String name) throws Exception {
+ private void readFileBiggerThan8GByte(final String name) throws Exception {
InputStream in = null;
GzipCompressorInputStream gzin = null;
TarArchiveInputStream tin = null;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
index ad22750..ea70495 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
@@ -63,7 +63,7 @@ public class SparseFilesTest {
}
}
- private void assertPaxGNUEntry(TarArchiveInputStream tin, String suffix) throws Throwable {
+ private void assertPaxGNUEntry(final TarArchiveInputStream tin, final String suffix) throws Throwable {
TarArchiveEntry ae = tin.getNextTarEntry();
assertEquals("sparsefile-" + suffix, ae.getName());
assertTrue(ae.isGNUSparse());
[27/46] commons-compress git commit: take advantage of IOException
accepting cause in constructor
Posted by bo...@apache.org.
take advantage of IOException accepting cause in constructor
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/6cc5a2f1
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/6cc5a2f1
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/6cc5a2f1
Branch: refs/heads/COMPRESS-207
Commit: 6cc5a2f13e5214a766a328648afc80dfefa5f9aa
Parents: e7c50ce
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sat Apr 9 18:40:21 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sat Apr 9 18:40:21 2016 +0200
----------------------------------------------------------------------
.../archivers/sevenz/AES256SHA256Decoder.java | 19 +++++--------------
.../compress/archivers/sevenz/Coders.java | 9 ++++-----
.../archivers/tar/TarArchiveInputStream.java | 4 +---
.../commons/compress/AbstractTestCase.java | 5 +----
4 files changed, 11 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/6cc5a2f1/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
index e2ed5c2..c90a720 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
@@ -68,12 +68,8 @@ class AES256SHA256Decoder extends CoderBase {
try {
digest = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException noSuchAlgorithmException) {
- IOException ioe = new IOException("SHA-256 is unsupported by your Java implementation");
- ioe.initCause(noSuchAlgorithmException);
- throw ioe;
- // TODO: simplify when Compress requires Java 1.6
-// throw new IOException("SHA-256 is unsupported by your Java implementation",
-// noSuchAlgorithmException);
+ throw new IOException("SHA-256 is unsupported by your Java implementation",
+ noSuchAlgorithmException);
}
final byte[] extra = new byte[8];
for (long j = 0; j < (1L << numCyclesPower); j++) {
@@ -98,14 +94,9 @@ class AES256SHA256Decoder extends CoderBase {
isInitialized = true;
return cipherInputStream;
} catch (GeneralSecurityException generalSecurityException) {
- IOException ioe = new IOException("Decryption error " +
- "(do you have the JCE Unlimited Strength Jurisdiction Policy Files installed?)");
- ioe.initCause(generalSecurityException);
- throw ioe;
- // TODO: simplify when Compress requires Java 1.6
-// throw new IOException("Decryption error " +
-// "(do you have the JCE Unlimited Strength Jurisdiction Policy Files installed?)",
-// generalSecurityException);
+ throw new IOException("Decryption error " +
+ "(do you have the JCE Unlimited Strength Jurisdiction Policy Files installed?)",
+ generalSecurityException);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/6cc5a2f1/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
index 06802e4..0de5130 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
@@ -127,11 +127,10 @@ class Coders {
try {
return opts.getInputStream(in);
} catch (AssertionError e) {
- IOException ex = new IOException("BCJ filter used in " + archiveName
- + " needs XZ for Java > 1.4 - see "
- + "http://commons.apache.org/proper/commons-compress/limitations.html#7Z");
- ex.initCause(e);
- throw ex;
+ throw new IOException("BCJ filter used in " + archiveName
+ + " needs XZ for Java > 1.4 - see "
+ + "http://commons.apache.org/proper/commons-compress/limitations.html#7Z",
+ e);
}
}
@Override
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/6cc5a2f1/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
index 8b47bba..8dc8f79 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
@@ -283,9 +283,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
try {
currEntry = new TarArchiveEntry(headerBuf, zipEncoding);
} catch (IllegalArgumentException e) {
- IOException ioe = new IOException("Error detected parsing the header");
- ioe.initCause(e);
- throw ioe;
+ throw new IOException("Error detected parsing the header", e);
}
entryOffset = 0;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/6cc5a2f1/src/test/java/org/apache/commons/compress/AbstractTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/AbstractTestCase.java b/src/test/java/org/apache/commons/compress/AbstractTestCase.java
index a17d03e..93db1f3 100644
--- a/src/test/java/org/apache/commons/compress/AbstractTestCase.java
+++ b/src/test/java/org/apache/commons/compress/AbstractTestCase.java
@@ -76,10 +76,7 @@ public abstract class AbstractTestCase {
try {
uri = url.toURI();
} catch (java.net.URISyntaxException ex) {
-// throw new IOException(ex); // JDK 1.6+
- IOException ioe = new IOException();
- ioe.initCause(ex);
- throw ioe;
+ throw new IOException(ex);
}
return new File(uri);
}
[22/46] commons-compress git commit: Refactor magic string.
Posted by bo...@apache.org.
Refactor magic string.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/8954b8be
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/8954b8be
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/8954b8be
Branch: refs/heads/COMPRESS-207
Commit: 8954b8be675333bafc75f9c3ccbf1839bbff8c62
Parents: ac6b5f3
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 08:59:51 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 08:59:51 2016 -0700
----------------------------------------------------------------------
.../compress/archivers/arj/ArjArchiveEntry.java | 3 +-
.../archivers/arj/ArjArchiveInputStream.java | 10 +--
.../BoundedRandomAccessFileInputStream.java | 3 +-
.../archivers/sevenz/SevenZArchiveEntry.java | 15 ++--
.../compress/archivers/sevenz/SevenZFile.java | 85 +++++++++-----------
.../compress/archivers/zip/CircularBuffer.java | 3 +-
.../archivers/zip/FallbackZipEncoding.java | 6 +-
.../compress/archivers/zip/X000A_NTFS.java | 3 +-
.../archivers/zip/X5455_ExtendedTimestamp.java | 3 +-
.../archivers/zip/ZipArchiveInputStream.java | 5 +-
.../commons/compress/archivers/zip/ZipFile.java | 3 +-
.../commons/compress/archivers/zip/ZipUtil.java | 15 ++--
.../commons/compress/changes/ChangeSet.java | 5 +-
.../bzip2/BZip2CompressorInputStream.java | 83 +++++++++----------
.../compress/compressors/bzip2/BlockSort.java | 9 +--
.../compress/utils/BoundedInputStream.java | 3 +-
.../utils/ChecksumVerifyingInputStream.java | 3 +-
17 files changed, 107 insertions(+), 150 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
index 3ce49b5..a033a14 100644
--- a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
@@ -50,9 +50,8 @@ public class ArjArchiveEntry implements ArchiveEntry {
if ((localFileHeader.arjFlags & LocalFileHeader.Flags.PATHSYM) != 0) {
return localFileHeader.name.replaceAll("/",
Matcher.quoteReplacement(File.separator));
- } else {
- return localFileHeader.name;
}
+ return localFileHeader.name;
}
/**
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
index 96d1e8c..f049299 100644
--- a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
@@ -114,10 +114,9 @@ public class ArjArchiveInputStream extends ArchiveInputStream {
}
if (charsetName != null) {
return new String(buffer.toByteArray(), charsetName);
- } else {
- // intentionally using the default encoding as that's the contract for a null charsetName
- return new String(buffer.toByteArray());
}
+ // intentionally using the default encoding as that's the contract for a null charsetName
+ return new String(buffer.toByteArray());
}
private void readFully(final DataInputStream dataIn, byte[] b)
@@ -330,10 +329,9 @@ public class ArjArchiveInputStream extends ArchiveInputStream {
currentLocalFileHeader.originalSize, currentLocalFileHeader.originalCrc32);
}
return new ArjArchiveEntry(currentLocalFileHeader);
- } else {
- currentInputStream = null;
- return null;
}
+ currentInputStream = null;
+ return null;
}
@Override
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedRandomAccessFileInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedRandomAccessFileInputStream.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedRandomAccessFileInputStream.java
index 482bd7a..63cf4bb 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedRandomAccessFileInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedRandomAccessFileInputStream.java
@@ -36,9 +36,8 @@ class BoundedRandomAccessFileInputStream extends InputStream {
if (bytesRemaining > 0) {
--bytesRemaining;
return file.read();
- } else {
- return -1;
}
+ return -1;
}
@Override
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
index c3f2bb9..b15bb7d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
@@ -147,10 +147,9 @@ public class SevenZArchiveEntry implements ArchiveEntry {
public Date getCreationDate() {
if (hasCreationDate) {
return ntfsTimeToJavaTime(creationDate);
- } else {
- throw new UnsupportedOperationException(
- "The entry doesn't have this timestamp");
}
+ throw new UnsupportedOperationException(
+ "The entry doesn't have this timestamp");
}
/**
@@ -199,10 +198,9 @@ public class SevenZArchiveEntry implements ArchiveEntry {
public Date getLastModifiedDate() {
if (hasLastModifiedDate) {
return ntfsTimeToJavaTime(lastModifiedDate);
- } else {
- throw new UnsupportedOperationException(
- "The entry doesn't have this timestamp");
}
+ throw new UnsupportedOperationException(
+ "The entry doesn't have this timestamp");
}
/**
@@ -250,10 +248,9 @@ public class SevenZArchiveEntry implements ArchiveEntry {
public Date getAccessDate() {
if (hasAccessDate) {
return ntfsTimeToJavaTime(accessDate);
- } else {
- throw new UnsupportedOperationException(
- "The entry doesn't have this timestamp");
}
+ throw new UnsupportedOperationException(
+ "The entry doesn't have this timestamp");
}
/**
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index 0e47f8c..2512eec 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -381,10 +381,9 @@ public class SevenZFile implements Closeable {
final int external = header.readUnsignedByte();
if (external != 0) {
throw new IOException("External unsupported");
- } else {
- for (int i = 0; i < (int)numFolders; i++) {
- folders[i] = readFolder(header);
- }
+ }
+ for (int i = 0; i < (int)numFolders; i++) {
+ folders[i] = readFolder(header);
}
nid = header.readUnsignedByte();
@@ -647,24 +646,23 @@ public class SevenZFile implements Closeable {
final int external = header.readUnsignedByte();
if (external != 0) {
throw new IOException("Not implemented");
- } else {
- if (((size - 1) & 1) != 0) {
- throw new IOException("File names length invalid");
- }
- final byte[] names = new byte[(int)(size - 1)];
- header.readFully(names);
- int nextFile = 0;
- int nextName = 0;
- for (int i = 0; i < names.length; i += 2) {
- if (names[i] == 0 && names[i+1] == 0) {
- files[nextFile++].setName(new String(names, nextName, i-nextName, CharsetNames.UTF_16LE));
- nextName = i + 2;
- }
- }
- if (nextName != names.length || nextFile != files.length) {
- throw new IOException("Error parsing file names");
+ }
+ if (((size - 1) & 1) != 0) {
+ throw new IOException("File names length invalid");
+ }
+ final byte[] names = new byte[(int)(size - 1)];
+ header.readFully(names);
+ int nextFile = 0;
+ int nextName = 0;
+ for (int i = 0; i < names.length; i += 2) {
+ if (names[i] == 0 && names[i+1] == 0) {
+ files[nextFile++].setName(new String(names, nextName, i-nextName, CharsetNames.UTF_16LE));
+ nextName = i + 2;
}
}
+ if (nextName != names.length || nextFile != files.length) {
+ throw new IOException("Error parsing file names");
+ }
break;
}
case NID.kCTime: {
@@ -672,12 +670,11 @@ public class SevenZFile implements Closeable {
final int external = header.readUnsignedByte();
if (external != 0) {
throw new IOException("Unimplemented");
- } else {
- for (int i = 0; i < files.length; i++) {
- files[i].setHasCreationDate(timesDefined.get(i));
- if (files[i].getHasCreationDate()) {
- files[i].setCreationDate(Long.reverseBytes(header.readLong()));
- }
+ }
+ for (int i = 0; i < files.length; i++) {
+ files[i].setHasCreationDate(timesDefined.get(i));
+ if (files[i].getHasCreationDate()) {
+ files[i].setCreationDate(Long.reverseBytes(header.readLong()));
}
}
break;
@@ -687,12 +684,11 @@ public class SevenZFile implements Closeable {
final int external = header.readUnsignedByte();
if (external != 0) {
throw new IOException("Unimplemented");
- } else {
- for (int i = 0; i < files.length; i++) {
- files[i].setHasAccessDate(timesDefined.get(i));
- if (files[i].getHasAccessDate()) {
- files[i].setAccessDate(Long.reverseBytes(header.readLong()));
- }
+ }
+ for (int i = 0; i < files.length; i++) {
+ files[i].setHasAccessDate(timesDefined.get(i));
+ if (files[i].getHasAccessDate()) {
+ files[i].setAccessDate(Long.reverseBytes(header.readLong()));
}
}
break;
@@ -702,12 +698,11 @@ public class SevenZFile implements Closeable {
final int external = header.readUnsignedByte();
if (external != 0) {
throw new IOException("Unimplemented");
- } else {
- for (int i = 0; i < files.length; i++) {
- files[i].setHasLastModifiedDate(timesDefined.get(i));
- if (files[i].getHasLastModifiedDate()) {
- files[i].setLastModifiedDate(Long.reverseBytes(header.readLong()));
- }
+ }
+ for (int i = 0; i < files.length; i++) {
+ files[i].setHasLastModifiedDate(timesDefined.get(i));
+ if (files[i].getHasLastModifiedDate()) {
+ files[i].setLastModifiedDate(Long.reverseBytes(header.readLong()));
}
}
break;
@@ -717,12 +712,11 @@ public class SevenZFile implements Closeable {
final int external = header.readUnsignedByte();
if (external != 0) {
throw new IOException("Unimplemented");
- } else {
- for (int i = 0; i < files.length; i++) {
- files[i].setHasWindowsAttributes(attributesDefined.get(i));
- if (files[i].getHasWindowsAttributes()) {
- files[i].setWindowsAttributes(Integer.reverseBytes(header.readInt()));
- }
+ }
+ for (int i = 0; i < files.length; i++) {
+ files[i].setHasWindowsAttributes(attributesDefined.get(i));
+ if (files[i].getHasWindowsAttributes()) {
+ files[i].setWindowsAttributes(Integer.reverseBytes(header.readInt()));
}
}
break;
@@ -888,9 +882,8 @@ public class SevenZFile implements Closeable {
if (folder.hasCrc) {
return new CRC32VerifyingInputStream(inputStreamStack,
folder.getUnpackSize(), folder.crc);
- } else {
- return inputStreamStack;
}
+ return inputStreamStack;
}
/**
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java b/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
index af64a85..10a35a8 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
@@ -67,9 +67,8 @@ class CircularBuffer {
int value = buffer[readIndex];
readIndex = (readIndex + 1) % size;
return value & 0xFF;
- } else {
- return -1;
}
+ return -1;
}
/**
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java b/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
index 4baae8a..14bab4a 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
@@ -76,9 +76,8 @@ class FallbackZipEncoding implements ZipEncoding {
public ByteBuffer encode(String name) throws IOException {
if (this.charsetName == null) { // i.e. use default charset, see no-args constructor
return ByteBuffer.wrap(name.getBytes());
- } else {
- return ByteBuffer.wrap(name.getBytes(this.charsetName));
}
+ return ByteBuffer.wrap(name.getBytes(this.charsetName));
}
/**
@@ -88,8 +87,7 @@ class FallbackZipEncoding implements ZipEncoding {
public String decode(byte[] data) throws IOException {
if (this.charsetName == null) { // i.e. use default charset, see no-args constructor
return new String(data);
- } else {
- return new String(data,this.charsetName);
}
+ return new String(data,this.charsetName);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java b/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
index 0b5e419..e2bde27 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
@@ -321,9 +321,8 @@ public class X000A_NTFS implements ZipExtraField {
return (modifyTime == xf.modifyTime || (modifyTime != null && modifyTime.equals(xf.modifyTime))) &&
(accessTime == xf.accessTime || (accessTime != null && accessTime.equals(xf.accessTime))) &&
(createTime == xf.createTime || (createTime != null && createTime.equals(xf.createTime)));
- } else {
- return false;
}
+ return false;
}
@Override
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
index b1ac3ee..8a7c7df 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
@@ -562,9 +562,8 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
(modifyTime == xf.modifyTime || (modifyTime != null && modifyTime.equals(xf.modifyTime))) &&
(accessTime == xf.accessTime || (accessTime != null && accessTime.equals(xf.accessTime))) &&
(createTime == xf.createTime || (createTime != null && createTime.equals(xf.createTime)));
- } else {
- return false;
}
+ return false;
}
@Override
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
index f8df66b..be036e5 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
@@ -654,10 +654,9 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
long n = in.read(buf.array(), 0, (int) Math.min(buf.capacity(), remaining));
if (n < 0) {
throw new EOFException("Truncated ZIP entry: " + current.entry.getName());
- } else {
- count(n);
- remaining -= n;
}
+ count(n);
+ remaining -= n;
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
index f1bcbef..3b51b07 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
@@ -475,9 +475,8 @@ public class ZipFile implements Closeable {
in.close();
}
}
- } else {
- return null;
}
+ return null;
}
/**
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
index 7c21e29..757967d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
@@ -99,9 +99,8 @@ public abstract class ZipUtil {
public static long adjustToLong(int i) {
if (i < 0) {
return 2 * ((long) Integer.MAX_VALUE) + 2 + i;
- } else {
- return i;
}
+ return i;
}
/**
@@ -135,9 +134,8 @@ public abstract class ZipUtil {
static long bigToLong(BigInteger big) {
if (big.bitLength() <= 63) { // bitLength() doesn't count the sign bit.
return big.longValue();
- } else {
- throw new NumberFormatException("The BigInteger cannot fit inside a 64 bit java long: [" + big + "]");
}
+ throw new NumberFormatException("The BigInteger cannot fit inside a 64 bit java long: [" + big + "]");
}
/**
@@ -173,9 +171,8 @@ public abstract class ZipUtil {
public static int signedByteToUnsignedInt(byte b) {
if (b >= 0) {
return b;
- } else {
- return 256 + b;
}
+ return 256 + b;
}
/**
@@ -192,9 +189,8 @@ public abstract class ZipUtil {
}
if (i < 128) {
return (byte) i;
- } else {
- return (byte) (i - 256);
}
+ return (byte) (i - 256);
}
/**
@@ -354,9 +350,8 @@ public abstract class ZipUtil {
throw
new UnsupportedZipFeatureException(UnsupportedZipFeatureException
.Feature.METHOD, ze);
- } else {
- throw new UnsupportedZipFeatureException(m, ze);
}
+ throw new UnsupportedZipFeatureException(m, ze);
}
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/ChangeSet.java b/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
index a9be42d..72df166 100644
--- a/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
+++ b/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
@@ -108,10 +108,9 @@ public final class ChangeSet {
it.remove();
changes.add(pChange);
return;
- } else {
- // do not add this change
- return;
}
+ // do not add this change
+ return;
}
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/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 edf90cb..b4c7d9d 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
@@ -140,9 +140,8 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
int r = read0();
count(r < 0 ? -1 : 1);
return r;
- } else {
- throw new IOException("stream closed");
}
+ throw new IOException("stream closed");
}
/*
@@ -299,24 +298,23 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
) {
this.currentState = EOF;
throw new IOException("bad block header");
- } else {
- this.storedBlockCRC = bsGetInt();
- this.blockRandomised = bsR(1) == 1;
-
- /**
- * Allocate data here instead in constructor, so we do not allocate
- * it if the input file is empty.
- */
- if (this.data == null) {
- this.data = new Data(this.blockSize100k);
- }
-
- // currBlockNo++;
- getAndMoveToFrontDecode();
+ }
+ this.storedBlockCRC = bsGetInt();
+ this.blockRandomised = bsR(1) == 1;
- this.crc.initialiseCRC();
- this.currentState = START_BLOCK_STATE;
+ /**
+ * Allocate data here instead in constructor, so we do not allocate
+ * it if the input file is empty.
+ */
+ if (this.data == null) {
+ this.data = new Data(this.blockSize100k);
}
+
+ // currBlockNo++;
+ getAndMoveToFrontDecode();
+
+ this.crc.initialiseCRC();
+ this.currentState = START_BLOCK_STATE;
}
private void endBlock() throws IOException {
@@ -630,9 +628,8 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
bsBuffShadow = (bsBuffShadow << 8) | thech;
bsLiveShadow += 8;
continue;
- } else {
- throw new IOException("unexpected end of stream");
}
+ throw new IOException("unexpected end of stream");
}
int zvec = (bsBuffShadow >> (bsLiveShadow - zn))
& ((1 << zn) - 1);
@@ -646,10 +643,9 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
bsBuffShadow = (bsBuffShadow << 8) | thech;
bsLiveShadow += 8;
continue;
- } else {
- throw new IOException(
- "unexpected end of stream");
}
+ throw new IOException(
+ "unexpected end of stream");
}
bsLiveShadow--;
zvec = (zvec << 1)
@@ -713,9 +709,8 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
bsBuffShadow = (bsBuffShadow << 8) | thech;
bsLiveShadow += 8;
continue;
- } else {
- throw new IOException("unexpected end of stream");
}
+ throw new IOException("unexpected end of stream");
}
int zvec = (bsBuffShadow >> (bsLiveShadow - zn))
& ((1 << zn) - 1);
@@ -729,9 +724,8 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
bsBuffShadow = (bsBuffShadow << 8) | thech;
bsLiveShadow += 8;
continue;
- } else {
- throw new IOException("unexpected end of stream");
}
+ throw new IOException("unexpected end of stream");
}
bsLiveShadow--;
zvec = (zvec << 1) | ((bsBuffShadow >> bsLiveShadow) & 1);
@@ -764,9 +758,8 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
bsBuffShadow = (bsBuffShadow << 8) | thech;
bsLiveShadow += 8;
continue;
- } else {
- throw new IOException("unexpected end of stream");
}
+ throw new IOException("unexpected end of stream");
}
bsLiveShadow--;
zvec = (zvec << 1) | ((bsBuffShadow >> bsLiveShadow) & 1);
@@ -833,11 +826,10 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
this.currentState = RAND_PART_B_STATE;
this.crc.updateCRC(su_ch2Shadow);
return su_ch2Shadow;
- } else {
- endBlock();
- initBlock();
- return setupBlock();
}
+ endBlock();
+ initBlock();
+ return setupBlock();
}
private int setupNoRandPartA() throws IOException {
@@ -850,12 +842,11 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
this.currentState = NO_RAND_PART_B_STATE;
this.crc.updateCRC(su_ch2Shadow);
return su_ch2Shadow;
- } else {
- this.currentState = NO_RAND_PART_A_STATE;
- endBlock();
- initBlock();
- return setupBlock();
}
+ this.currentState = NO_RAND_PART_A_STATE;
+ endBlock();
+ initBlock();
+ return setupBlock();
}
private int setupRandPartB() throws IOException {
@@ -891,12 +882,11 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
this.crc.updateCRC(this.su_ch2);
this.su_j2++;
return this.su_ch2;
- } else {
- this.currentState = RAND_PART_A_STATE;
- this.su_i2++;
- this.su_count = 0;
- return setupRandPartA();
}
+ this.currentState = RAND_PART_A_STATE;
+ this.su_i2++;
+ this.su_count = 0;
+ return setupRandPartA();
}
private int setupNoRandPartB() throws IOException {
@@ -920,11 +910,10 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
this.su_j2++;
this.currentState = NO_RAND_PART_C_STATE;
return su_ch2Shadow;
- } else {
- this.su_i2++;
- this.su_count = 0;
- return setupNoRandPartA();
}
+ this.su_i2++;
+ this.su_count = 0;
+ return setupNoRandPartA();
}
private static final class Data {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
index c7c26b2..bafa9e5 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
@@ -725,13 +725,10 @@ class BlockSort {
}
break HAMMER;
} // while x > 0
- else {
- if ((block[i1] & 0xff) > (block[i2] & 0xff)) {
- continue HAMMER;
- } else {
- break HAMMER;
- }
+ if ((block[i1] & 0xff) > (block[i2] & 0xff)) {
+ continue HAMMER;
}
+ break HAMMER;
} else if ((block[i1 + 5] & 0xff) > (block[i2 + 5] & 0xff)) {
continue HAMMER;
} else {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java b/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java
index 791f08c..5b35667 100644
--- a/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java
+++ b/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java
@@ -45,9 +45,8 @@ public class BoundedInputStream extends InputStream {
if (bytesRemaining > 0) {
--bytesRemaining;
return in.read();
- } else {
- return -1;
}
+ return -1;
}
@Override
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8954b8be/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java b/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
index 69bf03c..856e448 100644
--- a/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
+++ b/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
@@ -98,9 +98,8 @@ public class ChecksumVerifyingInputStream extends InputStream {
// Can't really skip, we have to hash everything to verify the checksum
if (read() >= 0) {
return 1;
- } else {
- return 0;
}
+ return 0;
}
@Override
[40/46] commons-compress git commit: Add final modifier to local
variables.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/ExceptionMessageTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ExceptionMessageTest.java b/src/test/java/org/apache/commons/compress/archivers/ExceptionMessageTest.java
index 36289be..e64d792 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ExceptionMessageTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ExceptionMessageTest.java
@@ -35,9 +35,9 @@ public class ExceptionMessageTest {
try{
new ArchiveStreamFactory().createArchiveInputStream(null, System.in);
fail("Should raise an IllegalArgumentException.");
- }catch (IllegalArgumentException e) {
+ }catch (final IllegalArgumentException e) {
assertEquals(ARCHIVER_NULL_MESSAGE, e.getMessage());
- } catch (ArchiveException e) {
+ } catch (final ArchiveException e) {
fail("ArchiveException not expected");
}
}
@@ -47,9 +47,9 @@ public class ExceptionMessageTest {
try{
new ArchiveStreamFactory().createArchiveInputStream("zip", null);
fail("Should raise an IllegalArgumentException.");
- }catch (IllegalArgumentException e) {
+ }catch (final IllegalArgumentException e) {
assertEquals(INPUTSTREAM_NULL_MESSAGE, e.getMessage());
- } catch (ArchiveException e) {
+ } catch (final ArchiveException e) {
fail("ArchiveException not expected");
}
}
@@ -59,9 +59,9 @@ public class ExceptionMessageTest {
try{
new ArchiveStreamFactory().createArchiveOutputStream(null, System.out);
fail("Should raise an IllegalArgumentException.");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
assertEquals(ARCHIVER_NULL_MESSAGE, e.getMessage());
- } catch (ArchiveException e){
+ } catch (final ArchiveException e){
fail("ArchiveException not expected");
}
}
@@ -71,9 +71,9 @@ public class ExceptionMessageTest {
try{
new ArchiveStreamFactory().createArchiveOutputStream("zip", null);
fail("Should raise an IllegalArgumentException.");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
assertEquals(OUTPUTSTREAM_NULL_MESSAGE, e.getMessage());
- } catch (ArchiveException e) {
+ } catch (final ArchiveException e) {
fail("ArchiveException not expected");
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/JarTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/JarTestCase.java b/src/test/java/org/apache/commons/compress/archivers/JarTestCase.java
index ef06021..3717e7a 100644
--- a/src/test/java/org/apache/commons/compress/archivers/JarTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/JarTestCase.java
@@ -93,14 +93,14 @@ public final class JarTestCase extends AbstractTestCase {
ArchiveEntry entry = in.getNextEntry();
while (entry != null) {
- File archiveEntry = new File(dir, entry.getName());
+ final File archiveEntry = new File(dir, entry.getName());
archiveEntry.getParentFile().mkdirs();
if(entry.isDirectory()){
archiveEntry.mkdir();
entry = in.getNextEntry();
continue;
}
- OutputStream out = new FileOutputStream(archiveEntry);
+ final OutputStream out = new FileOutputStream(archiveEntry);
IOUtils.copy(in, out);
out.close();
entry = in.getNextEntry();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
index b7807dc..a363c3a 100644
--- a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
@@ -67,9 +67,9 @@ public class LongPathTest extends AbstractTestCase {
@BeforeClass
public static void setUpFileList() throws Exception {
assertTrue(ARCDIR.exists());
- File listing= new File(ARCDIR,"files.txt");
+ final File listing= new File(ARCDIR,"files.txt");
assertTrue("files.txt is readable",listing.canRead());
- BufferedReader br = new BufferedReader(new FileReader(listing));
+ final BufferedReader br = new BufferedReader(new FileReader(listing));
String line;
while ((line=br.readLine())!=null){
if (!line.startsWith("#")){
@@ -81,8 +81,8 @@ public class LongPathTest extends AbstractTestCase {
@Parameters(name = "file={0}")
public static Collection<Object[]> data() {
- Collection<Object[]> params = new ArrayList<Object[]>();
- for (String f : ARCDIR.list(new FilenameFilter() {
+ final Collection<Object[]> params = new ArrayList<Object[]>();
+ for (final String f : ARCDIR.list(new FilenameFilter() {
@Override
public boolean accept(final File dir, final String name) {
return !name.endsWith(".txt");
@@ -97,7 +97,7 @@ public class LongPathTest extends AbstractTestCase {
@Override
protected String getExpectedString(final ArchiveEntry entry) {
if (entry instanceof TarArchiveEntry) {
- TarArchiveEntry tarEntry = (TarArchiveEntry) entry;
+ final TarArchiveEntry tarEntry = (TarArchiveEntry) entry;
if (tarEntry.isSymbolicLink()) {
return tarEntry.getName() + " -> " + tarEntry.getLinkName();
}
@@ -108,13 +108,14 @@ public class LongPathTest extends AbstractTestCase {
@Test
public void testArchive() throws Exception {
@SuppressWarnings("unchecked") // fileList is of correct type
+ final
ArrayList<String> expected = (ArrayList<String>) FILELIST.clone();
- String name = file.getName();
+ final String name = file.getName();
if ("minotaur.jar".equals(name) || "minotaur-0.jar".equals(name)){
expected.add("META-INF/");
expected.add("META-INF/MANIFEST.MF");
}
- ArchiveInputStream ais = factory.createArchiveInputStream(new BufferedInputStream(new FileInputStream(file)));
+ final ArchiveInputStream ais = factory.createArchiveInputStream(new BufferedInputStream(new FileInputStream(file)));
// check if expected type recognised
if (name.endsWith(".tar")){
assertTrue(ais instanceof TarArchiveInputStream);
@@ -124,7 +125,7 @@ public class LongPathTest extends AbstractTestCase {
assertTrue(ais instanceof CpioArchiveInputStream);
// Hack: cpio does not add trailing "/" to directory names
for(int i=0; i < expected.size(); i++){
- String ent = expected.get(i);
+ final String ent = expected.get(i);
if (ent.endsWith("/")){
expected.set(i, ent.substring(0, ent.length()-1));
}
@@ -133,7 +134,7 @@ public class LongPathTest extends AbstractTestCase {
assertTrue(ais instanceof ArArchiveInputStream);
// CPIO does not store directories or directory names
expected.clear();
- for (String ent : FILELIST) {
+ for (final String ent : FILELIST) {
if (!ent.endsWith("/")) {// not a directory
final int lastSlash = ent.lastIndexOf('/');
if (lastSlash >= 0) { // extract path name
@@ -148,7 +149,7 @@ public class LongPathTest extends AbstractTestCase {
}
try {
checkArchiveContent(ais, expected);
- } catch (AssertionFailedError e) {
+ } catch (final AssertionFailedError e) {
fail("Error processing "+file.getName()+" "+e);
} finally {
ais.close();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
index e1612db..6237de8 100644
--- a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java
@@ -67,9 +67,9 @@ public class LongSymLinkTest extends AbstractTestCase {
@BeforeClass
public static void setUpFileList() throws Exception {
assertTrue(ARCDIR.exists());
- File listing= new File(ARCDIR,"files.txt");
+ final File listing= new File(ARCDIR,"files.txt");
assertTrue("files.txt is readable",listing.canRead());
- BufferedReader br = new BufferedReader(new FileReader(listing));
+ final BufferedReader br = new BufferedReader(new FileReader(listing));
String line;
while ((line=br.readLine())!=null){
if (!line.startsWith("#")){
@@ -81,8 +81,8 @@ public class LongSymLinkTest extends AbstractTestCase {
@Parameters(name = "file={0}")
public static Collection<Object[]> data() {
- Collection<Object[]> params = new ArrayList<Object[]>();
- for (String f : ARCDIR.list(new FilenameFilter() {
+ final Collection<Object[]> params = new ArrayList<Object[]>();
+ for (final String f : ARCDIR.list(new FilenameFilter() {
@Override
public boolean accept(final File dir, final String name) {
return !name.endsWith(".txt");
@@ -98,7 +98,7 @@ public class LongSymLinkTest extends AbstractTestCase {
@Override
protected String getExpectedString(final ArchiveEntry entry) {
if (entry instanceof TarArchiveEntry) {
- TarArchiveEntry tarEntry = (TarArchiveEntry) entry;
+ final TarArchiveEntry tarEntry = (TarArchiveEntry) entry;
if (tarEntry.isSymbolicLink()) {
return tarEntry.getName() + " -> " + tarEntry.getLinkName();
}
@@ -109,13 +109,14 @@ public class LongSymLinkTest extends AbstractTestCase {
@Test
public void testArchive() throws Exception {
@SuppressWarnings("unchecked") // fileList is of correct type
+ final
ArrayList<String> expected = (ArrayList<String>) FILELIST.clone();
- String name = file.getName();
+ final String name = file.getName();
if ("minotaur.jar".equals(name) || "minotaur-0.jar".equals(name)){
expected.add("META-INF/");
expected.add("META-INF/MANIFEST.MF");
}
- ArchiveInputStream ais = factory.createArchiveInputStream(new BufferedInputStream(new FileInputStream(file)));
+ final ArchiveInputStream ais = factory.createArchiveInputStream(new BufferedInputStream(new FileInputStream(file)));
// check if expected type recognised
if (name.endsWith(".tar")){
assertTrue(ais instanceof TarArchiveInputStream);
@@ -125,7 +126,7 @@ public class LongSymLinkTest extends AbstractTestCase {
assertTrue(ais instanceof CpioArchiveInputStream);
// Hack: cpio does not add trailing "/" to directory names
for(int i=0; i < expected.size(); i++){
- String ent = expected.get(i);
+ final String ent = expected.get(i);
if (ent.endsWith("/")){
expected.set(i, ent.substring(0, ent.length()-1));
}
@@ -134,7 +135,7 @@ public class LongSymLinkTest extends AbstractTestCase {
assertTrue(ais instanceof ArArchiveInputStream);
// CPIO does not store directories or directory names
expected.clear();
- for (String ent : FILELIST) {
+ for (final String ent : FILELIST) {
if (!ent.endsWith("/")) {// not a directory
final int lastSlash = ent.lastIndexOf('/');
if (lastSlash >= 0) { // extract path name
@@ -149,7 +150,7 @@ public class LongSymLinkTest extends AbstractTestCase {
}
try {
checkArchiveContent(ais, expected);
- } catch (AssertionFailedError e) {
+ } catch (final AssertionFailedError e) {
fail("Error processing "+file.getName()+" "+e);
} finally {
ais.close();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/TarTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/TarTestCase.java b/src/test/java/org/apache/commons/compress/archivers/TarTestCase.java
index f1d2b51..4792583 100644
--- a/src/test/java/org/apache/commons/compress/archivers/TarTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/TarTestCase.java
@@ -59,8 +59,8 @@ public final class TarTestCase extends AbstractTestCase {
@Test
public void testTarArchiveLongNameCreation() throws Exception {
- String name = "testdata/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456.xml";
- byte[] bytes = name.getBytes(CharsetNames.UTF_8);
+ final String name = "testdata/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456.xml";
+ final byte[] bytes = name.getBytes(CharsetNames.UTF_8);
assertEquals(bytes.length, 99);
final File output = new File(dir, "bla.tar");
@@ -76,7 +76,7 @@ public final class TarTestCase extends AbstractTestCase {
entry.setGroupName("excalibur");
entry.setMode(0100000);
os.putArchiveEntry(entry);
- FileInputStream in = new FileInputStream(file1);
+ final FileInputStream in = new FileInputStream(file1);
IOUtils.copy(in, os);
os.closeArchiveEntry();
os.close();
@@ -86,7 +86,7 @@ public final class TarTestCase extends AbstractTestCase {
ArchiveOutputStream os2 = null;
try {
- String toLongName = "testdata/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567.xml";
+ final String toLongName = "testdata/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567.xml";
final File output2 = new File(dir, "bla.tar");
final OutputStream out2 = new FileOutputStream(output2);
os2 = new ArchiveStreamFactory().createArchiveOutputStream("tar", out2);
@@ -101,7 +101,7 @@ public final class TarTestCase extends AbstractTestCase {
os2.putArchiveEntry(entry);
IOUtils.copy(new FileInputStream(file1), os2);
os2.closeArchiveEntry();
- } catch(IOException e) {
+ } catch(final IOException e) {
assertTrue(true);
} finally {
if (os2 != null){
@@ -137,7 +137,7 @@ public final class TarTestCase extends AbstractTestCase {
@Test
public void testDirectoryEntryFromFile() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
TarArchiveOutputStream tos = null;
TarArchiveInputStream tis = null;
@@ -145,14 +145,14 @@ public final class TarTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".tar", tmp[0]);
archive.deleteOnExit();
tos = new TarArchiveOutputStream(new FileOutputStream(archive));
- long beforeArchiveWrite = tmp[0].lastModified();
- TarArchiveEntry in = new TarArchiveEntry(tmp[0], "foo");
+ final long beforeArchiveWrite = tmp[0].lastModified();
+ final TarArchiveEntry in = new TarArchiveEntry(tmp[0], "foo");
tos.putArchiveEntry(in);
tos.closeArchiveEntry();
tos.close();
tos = null;
tis = new TarArchiveInputStream(new FileInputStream(archive));
- TarArchiveEntry out = tis.getNextTarEntry();
+ final TarArchiveEntry out = tis.getNextTarEntry();
tis.close();
tis = null;
assertNotNull(out);
@@ -177,7 +177,7 @@ public final class TarTestCase extends AbstractTestCase {
@Test
public void testExplicitDirectoryEntry() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
TarArchiveOutputStream tos = null;
TarArchiveInputStream tis = null;
@@ -185,15 +185,15 @@ public final class TarTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".tar", tmp[0]);
archive.deleteOnExit();
tos = new TarArchiveOutputStream(new FileOutputStream(archive));
- long beforeArchiveWrite = tmp[0].lastModified();
- TarArchiveEntry in = new TarArchiveEntry("foo/");
+ final long beforeArchiveWrite = tmp[0].lastModified();
+ final TarArchiveEntry in = new TarArchiveEntry("foo/");
in.setModTime(beforeArchiveWrite);
tos.putArchiveEntry(in);
tos.closeArchiveEntry();
tos.close();
tos = null;
tis = new TarArchiveInputStream(new FileInputStream(archive));
- TarArchiveEntry out = tis.getNextTarEntry();
+ final TarArchiveEntry out = tis.getNextTarEntry();
tis.close();
tis = null;
assertNotNull(out);
@@ -217,7 +217,7 @@ public final class TarTestCase extends AbstractTestCase {
@Test
public void testFileEntryFromFile() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
TarArchiveOutputStream tos = null;
TarArchiveInputStream tis = null;
@@ -226,9 +226,9 @@ public final class TarTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".tar", tmp[0]);
archive.deleteOnExit();
tos = new TarArchiveOutputStream(new FileOutputStream(archive));
- TarArchiveEntry in = new TarArchiveEntry(tmp[1], "foo");
+ final TarArchiveEntry in = new TarArchiveEntry(tmp[1], "foo");
tos.putArchiveEntry(in);
- byte[] b = new byte[(int) tmp[1].length()];
+ final byte[] b = new byte[(int) tmp[1].length()];
fis = new FileInputStream(tmp[1]);
while (fis.read(b) > 0) {
tos.write(b);
@@ -239,7 +239,7 @@ public final class TarTestCase extends AbstractTestCase {
tos.close();
tos = null;
tis = new TarArchiveInputStream(new FileInputStream(archive));
- TarArchiveEntry out = tis.getNextTarEntry();
+ final TarArchiveEntry out = tis.getNextTarEntry();
tis.close();
tis = null;
assertNotNull(out);
@@ -266,7 +266,7 @@ public final class TarTestCase extends AbstractTestCase {
@Test
public void testExplicitFileEntry() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
TarArchiveOutputStream tos = null;
TarArchiveInputStream tis = null;
@@ -275,11 +275,11 @@ public final class TarTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".tar", tmp[0]);
archive.deleteOnExit();
tos = new TarArchiveOutputStream(new FileOutputStream(archive));
- TarArchiveEntry in = new TarArchiveEntry("foo");
+ final TarArchiveEntry in = new TarArchiveEntry("foo");
in.setModTime(tmp[1].lastModified());
in.setSize(tmp[1].length());
tos.putArchiveEntry(in);
- byte[] b = new byte[(int) tmp[1].length()];
+ final byte[] b = new byte[(int) tmp[1].length()];
fis = new FileInputStream(tmp[1]);
while (fis.read(b) > 0) {
tos.write(b);
@@ -290,7 +290,7 @@ public final class TarTestCase extends AbstractTestCase {
tos.close();
tos = null;
tis = new TarArchiveInputStream(new FileInputStream(archive));
- TarArchiveEntry out = tis.getNextTarEntry();
+ final TarArchiveEntry out = tis.getNextTarEntry();
tis.close();
tis = null;
assertNotNull(out);
@@ -323,8 +323,8 @@ public final class TarTestCase extends AbstractTestCase {
try {
in.getNextEntry();
fail("Expected IOException");
- } catch (IOException e) {
- Throwable t = e.getCause();
+ } catch (final IOException e) {
+ final Throwable t = e.getCause();
assertTrue("Expected cause = IllegalArgumentException", t instanceof IllegalArgumentException);
}
in.close();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
index b87b291..88584fd 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
@@ -77,7 +77,7 @@ public final class ZipTestCase extends AbstractTestCase {
out.close();
// Unarchive the same
- List<File> results = new ArrayList<File>();
+ final List<File> results = new ArrayList<File>();
final InputStream is = new FileInputStream(output);
ArchiveInputStream in = null;
@@ -87,9 +87,9 @@ public final class ZipTestCase extends AbstractTestCase {
ZipArchiveEntry entry = null;
while((entry = (ZipArchiveEntry)in.getNextEntry()) != null) {
- File outfile = new File(resultDir.getCanonicalPath() + "/result/" + entry.getName());
+ final File outfile = new File(resultDir.getCanonicalPath() + "/result/" + entry.getName());
outfile.getParentFile().mkdirs();
- OutputStream o = new FileOutputStream(outfile);
+ final OutputStream o = new FileOutputStream(outfile);
try {
IOUtils.copy(in, o);
} finally {
@@ -135,8 +135,8 @@ public final class ZipTestCase extends AbstractTestCase {
@Test
public void testSkipsPK00Prefix() throws Exception {
final File input = getFile("COMPRESS-208.zip");
- InputStream is = new FileInputStream(input);
- ArrayList<String> al = new ArrayList<String>();
+ final InputStream is = new FileInputStream(input);
+ final ArrayList<String> al = new ArrayList<String>();
al.add("test1.xml");
al.add("test2.xml");
try {
@@ -159,8 +159,8 @@ public final class ZipTestCase extends AbstractTestCase {
bla.close();
*/
- ZipFile moby = new ZipFile(getFile("moby.zip"));
- ZipArchiveEntry entry = moby.getEntry("README");
+ final ZipFile moby = new ZipFile(getFile("moby.zip"));
+ final ZipArchiveEntry entry = moby.getEntry("README");
assertEquals("method", ZipMethod.TOKENIZATION.getCode(), entry.getMethod());
assertFalse(moby.canReadEntryData(entry));
moby.close();
@@ -177,16 +177,16 @@ public final class ZipTestCase extends AbstractTestCase {
@Test
public void testSkipEntryWithUnsupportedCompressionMethod()
throws IOException {
- ZipArchiveInputStream zip =
+ final ZipArchiveInputStream zip =
new ZipArchiveInputStream(new FileInputStream(getFile("moby.zip")));
try {
- ZipArchiveEntry entry = zip.getNextZipEntry();
+ final ZipArchiveEntry entry = zip.getNextZipEntry();
assertEquals("method", ZipMethod.TOKENIZATION.getCode(), entry.getMethod());
assertEquals("README", entry.getName());
assertFalse(zip.canReadEntryData(entry));
try {
assertNull(zip.getNextZipEntry());
- } catch (IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
fail("COMPRESS-93: Unable to skip an unsupported zip entry");
}
@@ -208,7 +208,7 @@ public final class ZipTestCase extends AbstractTestCase {
public void testListAllFilesWithNestedArchive() throws Exception {
final File input = getFile("OSX_ArchiveWithNestedArchive.zip");
- List<String> results = new ArrayList<String>();
+ final List<String> results = new ArrayList<String>();
final InputStream is = new FileInputStream(input);
ArchiveInputStream in = null;
@@ -219,7 +219,7 @@ public final class ZipTestCase extends AbstractTestCase {
while((entry = (ZipArchiveEntry)in.getNextEntry()) != null) {
results.add(entry.getName());
- ArchiveInputStream nestedIn = new ArchiveStreamFactory().createArchiveInputStream("zip", in);
+ final ArchiveInputStream nestedIn = new ArchiveStreamFactory().createArchiveInputStream("zip", in);
ZipArchiveEntry nestedEntry = null;
while((nestedEntry = (ZipArchiveEntry)nestedIn.getNextEntry()) != null) {
results.add(nestedEntry.getName());
@@ -241,7 +241,7 @@ public final class ZipTestCase extends AbstractTestCase {
@Test
public void testDirectoryEntryFromFile() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
ZipArchiveOutputStream zos = null;
ZipFile zf = null;
@@ -249,14 +249,14 @@ public final class ZipTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".zip", tmp[0]);
archive.deleteOnExit();
zos = new ZipArchiveOutputStream(archive);
- long beforeArchiveWrite = tmp[0].lastModified();
- ZipArchiveEntry in = new ZipArchiveEntry(tmp[0], "foo");
+ final long beforeArchiveWrite = tmp[0].lastModified();
+ final ZipArchiveEntry in = new ZipArchiveEntry(tmp[0], "foo");
zos.putArchiveEntry(in);
zos.closeArchiveEntry();
zos.close();
zos = null;
zf = new ZipFile(archive);
- ZipArchiveEntry out = zf.getEntry("foo/");
+ final ZipArchiveEntry out = zf.getEntry("foo/");
assertNotNull(out);
assertEquals("foo/", out.getName());
assertEquals(0, out.getSize());
@@ -277,7 +277,7 @@ public final class ZipTestCase extends AbstractTestCase {
@Test
public void testExplicitDirectoryEntry() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
ZipArchiveOutputStream zos = null;
ZipFile zf = null;
@@ -285,15 +285,15 @@ public final class ZipTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".zip", tmp[0]);
archive.deleteOnExit();
zos = new ZipArchiveOutputStream(archive);
- long beforeArchiveWrite = tmp[0].lastModified();
- ZipArchiveEntry in = new ZipArchiveEntry("foo/");
+ final long beforeArchiveWrite = tmp[0].lastModified();
+ final ZipArchiveEntry in = new ZipArchiveEntry("foo/");
in.setTime(beforeArchiveWrite);
zos.putArchiveEntry(in);
zos.closeArchiveEntry();
zos.close();
zos = null;
zf = new ZipFile(archive);
- ZipArchiveEntry out = zf.getEntry("foo/");
+ final ZipArchiveEntry out = zf.getEntry("foo/");
assertNotNull(out);
assertEquals("foo/", out.getName());
assertEquals(0, out.getSize());
@@ -323,23 +323,23 @@ public final class ZipTestCase extends AbstractTestCase {
public void testCopyRawEntriesFromFile()
throws IOException {
- File[] tmp = createTempDirAndFile();
- File reference = createReferenceFile(tmp[0], Zip64Mode.Never, "expected.");
+ final File[] tmp = createTempDirAndFile();
+ final File reference = createReferenceFile(tmp[0], Zip64Mode.Never, "expected.");
- File a1 = File.createTempFile("src1.", ".zip", tmp[0]);
- ZipArchiveOutputStream zos = new ZipArchiveOutputStream(a1);
+ final File a1 = File.createTempFile("src1.", ".zip", tmp[0]);
+ final ZipArchiveOutputStream zos = new ZipArchiveOutputStream(a1);
zos.setUseZip64(Zip64Mode.Never);
createFirstEntry(zos).close();
- File a2 = File.createTempFile("src2.", ".zip", tmp[0]);
- ZipArchiveOutputStream zos1 = new ZipArchiveOutputStream(a2);
+ final File a2 = File.createTempFile("src2.", ".zip", tmp[0]);
+ final ZipArchiveOutputStream zos1 = new ZipArchiveOutputStream(a2);
zos1.setUseZip64(Zip64Mode.Never);
createSecondEntry(zos1).close();
- ZipFile zf1 = new ZipFile(a1);
- ZipFile zf2 = new ZipFile(a2);
- File fileResult = File.createTempFile("file-actual.", ".zip", tmp[0]);
- ZipArchiveOutputStream zos2 = new ZipArchiveOutputStream(fileResult);
+ final ZipFile zf1 = new ZipFile(a1);
+ final ZipFile zf2 = new ZipFile(a2);
+ final File fileResult = File.createTempFile("file-actual.", ".zip", tmp[0]);
+ final ZipArchiveOutputStream zos2 = new ZipArchiveOutputStream(fileResult);
zf1.copyRawEntries(zos2, allFilesPredicate);
zf2.copyRawEntries(zos2, allFilesPredicate);
zos2.close();
@@ -355,21 +355,21 @@ public final class ZipTestCase extends AbstractTestCase {
public void testCopyRawZip64EntryFromFile()
throws IOException {
- File[] tmp = createTempDirAndFile();
- File reference = File.createTempFile("z64reference.", ".zip", tmp[0]);
- ZipArchiveOutputStream zos1 = new ZipArchiveOutputStream(reference);
+ final File[] tmp = createTempDirAndFile();
+ final File reference = File.createTempFile("z64reference.", ".zip", tmp[0]);
+ final ZipArchiveOutputStream zos1 = new ZipArchiveOutputStream(reference);
zos1.setUseZip64(Zip64Mode.Always);
createFirstEntry(zos1);
zos1.close();
- File a1 = File.createTempFile("zip64src.", ".zip", tmp[0]);
- ZipArchiveOutputStream zos = new ZipArchiveOutputStream(a1);
+ final File a1 = File.createTempFile("zip64src.", ".zip", tmp[0]);
+ final ZipArchiveOutputStream zos = new ZipArchiveOutputStream(a1);
zos.setUseZip64(Zip64Mode.Always);
createFirstEntry(zos).close();
- ZipFile zf1 = new ZipFile(a1);
- File fileResult = File.createTempFile("file-actual.", ".zip", tmp[0]);
- ZipArchiveOutputStream zos2 = new ZipArchiveOutputStream(fileResult);
+ final ZipFile zf1 = new ZipFile(a1);
+ final File fileResult = File.createTempFile("file-actual.", ".zip", tmp[0]);
+ final ZipArchiveOutputStream zos2 = new ZipArchiveOutputStream(fileResult);
zos2.setUseZip64(Zip64Mode.Always);
zf1.copyRawEntries(zos2, allFilesPredicate);
zos2.close();
@@ -380,26 +380,26 @@ public final class ZipTestCase extends AbstractTestCase {
@Test
public void testUnixModeInAddRaw() throws IOException {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
- File a1 = File.createTempFile("unixModeBits.", ".zip", tmp[0]);
- ZipArchiveOutputStream zos = new ZipArchiveOutputStream(a1);
+ final File a1 = File.createTempFile("unixModeBits.", ".zip", tmp[0]);
+ final ZipArchiveOutputStream zos = new ZipArchiveOutputStream(a1);
- ZipArchiveEntry archiveEntry = new ZipArchiveEntry("fred");
+ final ZipArchiveEntry archiveEntry = new ZipArchiveEntry("fred");
archiveEntry.setUnixMode(0664);
archiveEntry.setMethod(ZipEntry.DEFLATED);
zos.addRawArchiveEntry(archiveEntry, new ByteArrayInputStream("fud".getBytes()));
zos.close();
- ZipFile zf1 = new ZipFile(a1);
- ZipArchiveEntry fred = zf1.getEntry("fred");
+ final ZipFile zf1 = new ZipFile(a1);
+ final ZipArchiveEntry fred = zf1.getEntry("fred");
assertEquals(0664, fred.getUnixMode());
zf1.close();
}
private File createReferenceFile(final File directory, final Zip64Mode zipMode, final String prefix) throws IOException {
- File reference = File.createTempFile(prefix, ".zip", directory);
- ZipArchiveOutputStream zos = new ZipArchiveOutputStream(reference);
+ final File reference = File.createTempFile(prefix, ".zip", directory);
+ final ZipArchiveOutputStream zos = new ZipArchiveOutputStream(reference);
zos.setUseZip64(zipMode);
createFirstEntry(zos);
createSecondEntry(zos);
@@ -419,18 +419,18 @@ public final class ZipTestCase extends AbstractTestCase {
private void assertSameFileContents(final File expectedFile, final File actualFile) throws IOException {
- int size = (int) Math.max(expectedFile.length(), actualFile.length());
- ZipFile expected = new ZipFile(expectedFile);
- ZipFile actual = new ZipFile(actualFile);
- byte[] expectedBuf = new byte[size];
- byte[] actualBuf = new byte[size];
+ final int size = (int) Math.max(expectedFile.length(), actualFile.length());
+ final ZipFile expected = new ZipFile(expectedFile);
+ final ZipFile actual = new ZipFile(actualFile);
+ final byte[] expectedBuf = new byte[size];
+ final byte[] actualBuf = new byte[size];
- Enumeration<ZipArchiveEntry> actualInOrder = actual.getEntriesInPhysicalOrder();
- Enumeration<ZipArchiveEntry> expectedInOrder = expected.getEntriesInPhysicalOrder();
+ final Enumeration<ZipArchiveEntry> actualInOrder = actual.getEntriesInPhysicalOrder();
+ final Enumeration<ZipArchiveEntry> expectedInOrder = expected.getEntriesInPhysicalOrder();
while (actualInOrder.hasMoreElements()){
- ZipArchiveEntry actualElement = actualInOrder.nextElement();
- ZipArchiveEntry expectedElement = expectedInOrder.nextElement();
+ final ZipArchiveEntry actualElement = actualInOrder.nextElement();
+ final ZipArchiveEntry expectedElement = expectedInOrder.nextElement();
assertEquals( expectedElement.getName(), actualElement.getName());
// Don't compare timestamps since they may vary;
// there's no support for stubbed out clock (TimeSource) in ZipArchiveOutputStream
@@ -442,8 +442,8 @@ public final class ZipTestCase extends AbstractTestCase {
assertEquals( expectedElement.getExternalAttributes(), actualElement.getExternalAttributes());
assertEquals( expectedElement.getInternalAttributes(), actualElement.getInternalAttributes());
- InputStream actualIs = actual.getInputStream(actualElement);
- InputStream expectedIs = expected.getInputStream(expectedElement);
+ final InputStream actualIs = actual.getInputStream(actualElement);
+ final InputStream expectedIs = expected.getInputStream(expectedElement);
IOUtils.readFully(expectedIs, expectedBuf);
IOUtils.readFully(actualIs, actualBuf);
expectedIs.close();
@@ -458,7 +458,7 @@ public final class ZipTestCase extends AbstractTestCase {
private void createArchiveEntry(final String payload, final ZipArchiveOutputStream zos, final String name)
throws IOException {
- ZipArchiveEntry in = new ZipArchiveEntry(name);
+ final ZipArchiveEntry in = new ZipArchiveEntry(name);
zos.putArchiveEntry(in);
zos.write(payload.getBytes());
@@ -467,7 +467,7 @@ public final class ZipTestCase extends AbstractTestCase {
@Test
public void testFileEntryFromFile() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
ZipArchiveOutputStream zos = null;
ZipFile zf = null;
@@ -476,9 +476,9 @@ public final class ZipTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".zip", tmp[0]);
archive.deleteOnExit();
zos = new ZipArchiveOutputStream(archive);
- ZipArchiveEntry in = new ZipArchiveEntry(tmp[1], "foo");
+ final ZipArchiveEntry in = new ZipArchiveEntry(tmp[1], "foo");
zos.putArchiveEntry(in);
- byte[] b = new byte[(int) tmp[1].length()];
+ final byte[] b = new byte[(int) tmp[1].length()];
fis = new FileInputStream(tmp[1]);
while (fis.read(b) > 0) {
zos.write(b);
@@ -489,7 +489,7 @@ public final class ZipTestCase extends AbstractTestCase {
zos.close();
zos = null;
zf = new ZipFile(archive);
- ZipArchiveEntry out = zf.getEntry("foo");
+ final ZipArchiveEntry out = zf.getEntry("foo");
assertNotNull(out);
assertEquals("foo", out.getName());
assertEquals(tmp[1].length(), out.getSize());
@@ -512,7 +512,7 @@ public final class ZipTestCase extends AbstractTestCase {
@Test
public void testExplicitFileEntry() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
ZipArchiveOutputStream zos = null;
ZipFile zf = null;
@@ -521,11 +521,11 @@ public final class ZipTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".zip", tmp[0]);
archive.deleteOnExit();
zos = new ZipArchiveOutputStream(archive);
- ZipArchiveEntry in = new ZipArchiveEntry("foo");
+ final ZipArchiveEntry in = new ZipArchiveEntry("foo");
in.setTime(tmp[1].lastModified());
in.setSize(tmp[1].length());
zos.putArchiveEntry(in);
- byte[] b = new byte[(int) tmp[1].length()];
+ final byte[] b = new byte[(int) tmp[1].length()];
fis = new FileInputStream(tmp[1]);
while (fis.read(b) > 0) {
zos.write(b);
@@ -536,7 +536,7 @@ public final class ZipTestCase extends AbstractTestCase {
zos.close();
zos = null;
zf = new ZipFile(archive);
- ZipArchiveEntry out = zf.getEntry("foo");
+ final ZipArchiveEntry out = zf.getEntry("foo");
assertNotNull(out);
assertEquals("foo", out.getName());
assertEquals(tmp[1].length(), out.getSize());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
index 2f6625e..5221215 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
@@ -41,20 +41,20 @@ public class ArArchiveInputStreamTest extends AbstractTestCase {
}
private void checkLongNameEntry(final String archive) throws Exception {
- FileInputStream fis = new FileInputStream(getFile(archive));
+ final FileInputStream fis = new FileInputStream(getFile(archive));
ArArchiveInputStream s = null;
try {
s = new ArArchiveInputStream(new BufferedInputStream(fis));
ArchiveEntry e = s.getNextEntry();
assertEquals("this_is_a_long_file_name.txt", e.getName());
assertEquals(14, e.getSize());
- byte[] hello = new byte[14];
+ final byte[] hello = new byte[14];
s.read(hello);
assertEquals("Hello, world!\n", ArchiveUtils.toAsciiString(hello));
e = s.getNextEntry();
assertEquals("this_is_a_long_file_name_as_well.txt", e.getName());
assertEquals(4, e.getSize());
- byte[] bye = new byte[4];
+ final byte[] bye = new byte[4];
s.read(bye);
assertEquals("Bye\n", ArchiveUtils.toAsciiString(bye));
assertNull(s.getNextEntry());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStreamTest.java
index 6394ce6..d63283c 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStreamTest.java
@@ -37,11 +37,11 @@ public class ArArchiveOutputStreamTest extends AbstractTestCase {
ArArchiveOutputStream os = null;
try {
os = new ArArchiveOutputStream(new ByteArrayOutputStream());
- ArArchiveEntry ae = new ArArchiveEntry("this_is_a_long_name.txt",
+ final ArArchiveEntry ae = new ArArchiveEntry("this_is_a_long_name.txt",
0);
os.putArchiveEntry(ae);
fail("Expected an exception");
- } catch (IOException ex) {
+ } catch (final IOException ex) {
assertTrue(ex.getMessage().startsWith("filename too long"));
} finally {
closeQuietly(os);
@@ -52,12 +52,12 @@ public class ArArchiveOutputStreamTest extends AbstractTestCase {
public void testLongFileNamesWorkUsingBSDDialect() throws Exception {
FileOutputStream fos = null;
ArArchiveOutputStream os = null;
- File[] df = createTempDirAndFile();
+ final File[] df = createTempDirAndFile();
try {
fos = new FileOutputStream(df[1]);
os = new ArArchiveOutputStream(fos);
os.setLongFileMode(ArArchiveOutputStream.LONGFILE_BSD);
- ArArchiveEntry ae = new ArArchiveEntry("this_is_a_long_name.txt",
+ final ArArchiveEntry ae = new ArArchiveEntry("this_is_a_long_name.txt",
14);
os.putArchiveEntry(ae);
os.write(new byte[] {
@@ -69,7 +69,7 @@ public class ArArchiveOutputStreamTest extends AbstractTestCase {
os = null;
fos = null;
- List<String> expected = new ArrayList<String>();
+ final List<String> expected = new ArrayList<String>();
expected.add("this_is_a_long_name.txt");
checkArchiveContent(df[1], expected);
} finally {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStreamTest.java
index 40d8f14..1983f1b 100644
--- a/src/test/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStreamTest.java
@@ -32,16 +32,16 @@ public class ArjArchiveInputStreamTest extends AbstractTestCase {
@Test
public void testArjUnarchive() throws Exception {
- StringBuilder expected = new StringBuilder();
+ final StringBuilder expected = new StringBuilder();
expected.append("test1.xml<?xml version=\"1.0\"?>\n");
expected.append("<empty/>test2.xml<?xml version=\"1.0\"?>\n");
expected.append("<empty/>\n");
- ArjArchiveInputStream in = new ArjArchiveInputStream(new FileInputStream(getFile("bla.arj")));
+ final ArjArchiveInputStream in = new ArjArchiveInputStream(new FileInputStream(getFile("bla.arj")));
ArjArchiveEntry entry;
- StringBuilder result = new StringBuilder();
+ final StringBuilder result = new StringBuilder();
while ((entry = in.getNextEntry()) != null) {
result.append(entry.getName());
int tmp;
@@ -56,12 +56,12 @@ public class ArjArchiveInputStreamTest extends AbstractTestCase {
@Test
public void testReadingOfAttributesDosVersion() throws Exception {
- ArjArchiveInputStream in = new ArjArchiveInputStream(new FileInputStream(getFile("bla.arj")));
- ArjArchiveEntry entry = in.getNextEntry();
+ final ArjArchiveInputStream in = new ArjArchiveInputStream(new FileInputStream(getFile("bla.arj")));
+ final ArjArchiveEntry entry = in.getNextEntry();
assertEquals("test1.xml", entry.getName());
assertEquals(30, entry.getSize());
assertEquals(0, entry.getUnixMode());
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.set(2008, 9, 6, 23, 50, 52);
cal.set(Calendar.MILLISECOND, 0);
assertEquals(cal.getTime(), entry.getLastModifiedDate());
@@ -70,12 +70,12 @@ public class ArjArchiveInputStreamTest extends AbstractTestCase {
@Test
public void testReadingOfAttributesUnixVersion() throws Exception {
- ArjArchiveInputStream in = new ArjArchiveInputStream(new FileInputStream(getFile("bla.unix.arj")));
- ArjArchiveEntry entry = in.getNextEntry();
+ final ArjArchiveInputStream in = new ArjArchiveInputStream(new FileInputStream(getFile("bla.unix.arj")));
+ final ArjArchiveEntry entry = in.getNextEntry();
assertEquals("test1.xml", entry.getName());
assertEquals(30, entry.getSize());
assertEquals(0664, entry.getUnixMode() & 07777 /* UnixStat.PERM_MASK */);
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+0000"));
+ final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+0000"));
cal.set(2008, 9, 6, 21, 50, 52);
cal.set(Calendar.MILLISECOND, 0);
assertEquals(cal.getTime(), entry.getLastModifiedDate());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java
index 06570f7..f174405 100644
--- a/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java
@@ -29,16 +29,16 @@ public class CpioArchiveInputStreamTest extends AbstractTestCase {
@Test
public void testCpioUnarchive() throws Exception {
- StringBuilder expected = new StringBuilder();
+ final StringBuilder expected = new StringBuilder();
expected.append("./test1.xml<?xml version=\"1.0\"?>\n");
expected.append("<empty/>./test2.xml<?xml version=\"1.0\"?>\n");
expected.append("<empty/>\n");
- CpioArchiveInputStream in = new CpioArchiveInputStream(new FileInputStream(getFile("bla.cpio")));
+ final CpioArchiveInputStream in = new CpioArchiveInputStream(new FileInputStream(getFile("bla.cpio")));
CpioArchiveEntry entry;
- StringBuilder result = new StringBuilder();
+ final StringBuilder result = new StringBuilder();
while ((entry = (CpioArchiveEntry) in.getNextEntry()) != null) {
result.append(entry.getName());
int tmp;
@@ -52,7 +52,7 @@ public class CpioArchiveInputStreamTest extends AbstractTestCase {
@Test
public void testCpioUnarchiveCreatedByRedlineRpm() throws Exception {
- CpioArchiveInputStream in =
+ final CpioArchiveInputStream in =
new CpioArchiveInputStream(new FileInputStream(getFile("redline.cpio")));
CpioArchiveEntry entry= null;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java
index d2f66f9..ba83771 100644
--- a/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java
@@ -58,7 +58,7 @@ public class CpioArchiveOutputStreamTest extends AbstractTestCase {
try {
in = new CpioArchiveInputStream(new FileInputStream(output));
- CpioArchiveEntry e = ((CpioArchiveInputStream) in)
+ final CpioArchiveEntry e = ((CpioArchiveInputStream) in)
.getNextCPIOEntry();
assertEquals("test1.xml", e.getName());
assertNull(((CpioArchiveInputStream) in).getNextEntry());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntryTest.java b/src/test/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntryTest.java
index 8dad403..8cc8fd2 100644
--- a/src/test/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntryTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
public class DumpArchiveEntryTest {
@Test
public void publicNameAddsTrailingSlashForDirectories() {
- DumpArchiveEntry ent = new DumpArchiveEntry("foo", "bar", -1,
+ final DumpArchiveEntry ent = new DumpArchiveEntry("foo", "bar", -1,
DumpArchiveEntry.TYPE
.DIRECTORY);
assertEquals("bar", ent.getSimpleName());
@@ -35,7 +35,7 @@ public class DumpArchiveEntryTest {
@Test
public void publicNameRemovesLeadingDotSlash() {
- DumpArchiveEntry ent = new DumpArchiveEntry("./foo", "bar");
+ final DumpArchiveEntry ent = new DumpArchiveEntry("./foo", "bar");
assertEquals("bar", ent.getSimpleName());
assertEquals("./foo", ent.getOriginalName());
assertEquals("foo", ent.getName());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStreamTest.java
index e8f2928..bc6df9e 100644
--- a/src/test/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStreamTest.java
@@ -31,11 +31,11 @@ public class DumpArchiveInputStreamTest extends AbstractTestCase {
@Test
public void testNotADumpArchive() throws Exception {
- FileInputStream is = new FileInputStream(getFile("bla.zip"));
+ final FileInputStream is = new FileInputStream(getFile("bla.zip"));
try {
new DumpArchiveInputStream(is);
fail("expected an exception");
- } catch (ArchiveException ex) {
+ } catch (final ArchiveException ex) {
// expected
assertTrue(ex.getCause() instanceof ShortFileException);
} finally {
@@ -45,11 +45,11 @@ public class DumpArchiveInputStreamTest extends AbstractTestCase {
@Test
public void testNotADumpArchiveButBigEnough() throws Exception {
- FileInputStream is = new FileInputStream(getFile("zip64support.tar.bz2"));
+ final FileInputStream is = new FileInputStream(getFile("zip64support.tar.bz2"));
try {
new DumpArchiveInputStream(is);
fail("expected an exception");
- } catch (ArchiveException ex) {
+ } catch (final ArchiveException ex) {
// expected
assertTrue(ex.getCause() instanceof UnrecognizedFormatException);
} finally {
@@ -59,16 +59,16 @@ public class DumpArchiveInputStreamTest extends AbstractTestCase {
@Test
public void testConsumesArchiveCompletely() throws Exception {
- InputStream is = DumpArchiveInputStreamTest.class
+ final InputStream is = DumpArchiveInputStreamTest.class
.getResourceAsStream("/archive_with_trailer.dump");
- DumpArchiveInputStream dump = new DumpArchiveInputStream(is);
+ final DumpArchiveInputStream dump = new DumpArchiveInputStream(is);
while (dump.getNextDumpEntry() != null) {
// just consume the archive
}
- byte[] expected = new byte[] {
+ final byte[] expected = new byte[] {
'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\n'
};
- byte[] actual = new byte[expected.length];
+ final byte[] actual = new byte[expected.length];
is.read(actual);
assertArrayEquals(expected, actual);
dump.close();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java
index 111ebca..3008395 100644
--- a/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java
@@ -35,7 +35,7 @@ public class JarArchiveOutputStreamTest {
@Test
public void testJarMarker() throws IOException {
- File testArchive = File.createTempFile("jar-aostest", ".jar");
+ final File testArchive = File.createTempFile("jar-aostest", ".jar");
testArchive.deleteOnExit();
JarArchiveOutputStream out = null;
ZipFile zf = null;
@@ -65,7 +65,7 @@ public class JarArchiveOutputStreamTest {
if (out != null) {
try {
out.close();
- } catch (IOException e) { /* swallow */ }
+ } catch (final IOException e) { /* swallow */ }
}
ZipFile.closeQuietly(zf);
AbstractTestCase.tryHardToDelete(testArchive);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/memory/MemoryArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/memory/MemoryArchiveInputStream.java b/src/test/java/org/apache/commons/compress/archivers/memory/MemoryArchiveInputStream.java
index 31e1989..a3b8347 100644
--- a/src/test/java/org/apache/commons/compress/archivers/memory/MemoryArchiveInputStream.java
+++ b/src/test/java/org/apache/commons/compress/archivers/memory/MemoryArchiveInputStream.java
@@ -34,7 +34,7 @@ public final class MemoryArchiveInputStream extends ArchiveInputStream {
content = new String[pFiles.length];
for (int i = 0; i < pFiles.length; i++) {
- String[] nameAndContent = pFiles[i];
+ final String[] nameAndContent = pFiles[i];
filenames[i] = nameAndContent[0];
content[i] = nameAndContent[1];
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
index 53320d8..1c514d8 100644
--- a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
@@ -43,7 +43,7 @@ public class SevenZFileTest extends AbstractTestCase {
@Test
public void testRandomlySkippingEntries() throws Exception {
// Read sequential reference.
- Map<String, byte[]> entriesByName = new HashMap<String, byte[]>();
+ final Map<String, byte[]> entriesByName = new HashMap<String, byte[]>();
SevenZFile archive = new SevenZFile(getFile("COMPRESS-320/Copy.7z"));
SevenZArchiveEntry entry;
while ((entry = archive.getNextEntry()) != null) {
@@ -53,7 +53,7 @@ public class SevenZFileTest extends AbstractTestCase {
}
archive.close();
- String[] variants = {
+ final String[] variants = {
"BZip2-solid.7z",
"BZip2.7z",
"Copy-solid.7z",
@@ -70,8 +70,8 @@ public class SevenZFileTest extends AbstractTestCase {
};
// TODO: use randomizedtesting for predictable, but different, randomness.
- Random rnd = new Random(0xdeadbeef);
- for (String fileName : variants) {
+ final Random rnd = new Random(0xdeadbeef);
+ for (final String fileName : variants) {
archive = new SevenZFile(getFile("COMPRESS-320/" + fileName));
while ((entry = archive.getNextEntry()) != null) {
@@ -82,7 +82,7 @@ public class SevenZFileTest extends AbstractTestCase {
if (entry.hasStream()) {
assertTrue(entriesByName.containsKey(entry.getName()));
- byte [] content = readFully(archive);
+ final byte [] content = readFully(archive);
assertTrue("Content mismatch on: " + fileName + "!" + entry.getName(),
Arrays.equals(content, entriesByName.get(entry.getName())));
}
@@ -93,8 +93,8 @@ public class SevenZFileTest extends AbstractTestCase {
}
private byte[] readFully(final SevenZFile archive) throws IOException {
- byte [] buf = new byte [1024];
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final byte [] buf = new byte [1024];
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (int len = 0; (len = archive.read(buf)) > 0;) {
baos.write(buf, 0, len);
}
@@ -103,7 +103,7 @@ public class SevenZFileTest extends AbstractTestCase {
@Test
public void testAllEmptyFilesArchive() throws Exception {
- SevenZFile archive = new SevenZFile(getFile("7z-empty-mhc-off.7z"));
+ final SevenZFile archive = new SevenZFile(getFile("7z-empty-mhc-off.7z"));
try {
assertNotNull(archive.getNextEntry());
} finally {
@@ -148,8 +148,8 @@ public class SevenZFileTest extends AbstractTestCase {
try {
new SevenZFile(getFile("bla.encrypted.7z"));
fail("shouldn't decrypt without a password");
- } catch (PasswordRequiredException ex) {
- String msg = ex.getMessage();
+ } catch (final PasswordRequiredException ex) {
+ final String msg = ex.getMessage();
assertTrue("Should start with whining about being unable to decrypt",
msg.startsWith("Cannot read encrypted content from "));
assertTrue("Should finish the sentence properly",
@@ -164,7 +164,7 @@ public class SevenZFileTest extends AbstractTestCase {
*/
@Test
public void testCompressedHeaderWithNonDefaultDictionarySize() throws Exception {
- SevenZFile sevenZFile = new SevenZFile(getFile("COMPRESS-256.7z"));
+ final SevenZFile sevenZFile = new SevenZFile(getFile("COMPRESS-256.7z"));
try {
int count = 0;
while (sevenZFile.getNextEntry() != null) {
@@ -193,11 +193,11 @@ public class SevenZFileTest extends AbstractTestCase {
@Test
public void testReadingBackLZMA2DictSize() throws Exception {
- File output = new File(dir, "lzma2-dictsize.7z");
- SevenZOutputFile outArchive = new SevenZOutputFile(output);
+ final File output = new File(dir, "lzma2-dictsize.7z");
+ final SevenZOutputFile outArchive = new SevenZOutputFile(output);
try {
outArchive.setContentMethods(Arrays.asList(new SevenZMethodConfiguration(SevenZMethod.LZMA2, 1 << 20)));
- SevenZArchiveEntry entry = new SevenZArchiveEntry();
+ final SevenZArchiveEntry entry = new SevenZArchiveEntry();
entry.setName("foo.txt");
outArchive.putArchiveEntry(entry);
outArchive.write(new byte[] { 'A' });
@@ -206,10 +206,10 @@ public class SevenZFileTest extends AbstractTestCase {
outArchive.close();
}
- SevenZFile archive = new SevenZFile(output);
+ final SevenZFile archive = new SevenZFile(output);
try {
- SevenZArchiveEntry entry = archive.getNextEntry();
- SevenZMethodConfiguration m = entry.getContentMethods().iterator().next();
+ final SevenZArchiveEntry entry = archive.getNextEntry();
+ final SevenZMethodConfiguration m = entry.getContentMethods().iterator().next();
assertEquals(SevenZMethod.LZMA2, m.getMethod());
assertEquals(1 << 20, m.getOptions());
} finally {
@@ -219,12 +219,12 @@ public class SevenZFileTest extends AbstractTestCase {
@Test
public void testReadingBackDeltaDistance() throws Exception {
- File output = new File(dir, "delta-distance.7z");
- SevenZOutputFile outArchive = new SevenZOutputFile(output);
+ final File output = new File(dir, "delta-distance.7z");
+ final SevenZOutputFile outArchive = new SevenZOutputFile(output);
try {
outArchive.setContentMethods(Arrays.asList(new SevenZMethodConfiguration(SevenZMethod.DELTA_FILTER, 32),
new SevenZMethodConfiguration(SevenZMethod.LZMA2)));
- SevenZArchiveEntry entry = new SevenZArchiveEntry();
+ final SevenZArchiveEntry entry = new SevenZArchiveEntry();
entry.setName("foo.txt");
outArchive.putArchiveEntry(entry);
outArchive.write(new byte[] { 'A' });
@@ -233,10 +233,10 @@ public class SevenZFileTest extends AbstractTestCase {
outArchive.close();
}
- SevenZFile archive = new SevenZFile(output);
+ final SevenZFile archive = new SevenZFile(output);
try {
- SevenZArchiveEntry entry = archive.getNextEntry();
- SevenZMethodConfiguration m = entry.getContentMethods().iterator().next();
+ final SevenZArchiveEntry entry = archive.getNextEntry();
+ final SevenZMethodConfiguration m = entry.getContentMethods().iterator().next();
assertEquals(SevenZMethod.DELTA_FILTER, m.getMethod());
assertEquals(32, m.getOptions());
} finally {
@@ -246,10 +246,10 @@ public class SevenZFileTest extends AbstractTestCase {
@Test
public void getEntriesOfUnarchiveTest() throws IOException {
- SevenZFile sevenZFile = new SevenZFile(getFile("bla.7z"));
+ final SevenZFile sevenZFile = new SevenZFile(getFile("bla.7z"));
try {
- Iterable<SevenZArchiveEntry> entries = sevenZFile.getEntries();
- Iterator<SevenZArchiveEntry> iter = entries.iterator();
+ final Iterable<SevenZArchiveEntry> entries = sevenZFile.getEntries();
+ final Iterator<SevenZArchiveEntry> iter = entries.iterator();
SevenZArchiveEntry entry = iter.next();
assertEquals("test1.xml", entry.getName());
entry = iter.next();
@@ -261,7 +261,7 @@ public class SevenZFileTest extends AbstractTestCase {
}
private void test7zUnarchive(final File f, final SevenZMethod m, final byte[] password) throws Exception {
- SevenZFile sevenZFile = new SevenZFile(f, password);
+ final SevenZFile sevenZFile = new SevenZFile(f, password);
try {
SevenZArchiveEntry entry = sevenZFile.getNextEntry();
assertEquals("test1.xml", entry.getName());
@@ -269,10 +269,10 @@ public class SevenZFileTest extends AbstractTestCase {
entry = sevenZFile.getNextEntry();
assertEquals("test2.xml", entry.getName());
assertEquals(m, entry.getContentMethods().iterator().next().getMethod());
- byte[] contents = new byte[(int)entry.getSize()];
+ final byte[] contents = new byte[(int)entry.getSize()];
int off = 0;
while ((off < contents.length)) {
- int bytesRead = sevenZFile.read(contents, off, contents.length - off);
+ final int bytesRead = sevenZFile.read(contents, off, contents.length - off);
assert(bytesRead >= 0);
off += bytesRead;
}
@@ -284,14 +284,14 @@ public class SevenZFileTest extends AbstractTestCase {
}
private void checkHelloWorld(final String filename) throws Exception {
- SevenZFile sevenZFile = new SevenZFile(getFile(filename));
+ final SevenZFile sevenZFile = new SevenZFile(getFile(filename));
try {
- SevenZArchiveEntry entry = sevenZFile.getNextEntry();
+ final SevenZArchiveEntry entry = sevenZFile.getNextEntry();
assertEquals("Hello world.txt", entry.getName());
- byte[] contents = new byte[(int)entry.getSize()];
+ final byte[] contents = new byte[(int)entry.getSize()];
int off = 0;
while ((off < contents.length)) {
- int bytesRead = sevenZFile.read(contents, off, contents.length - off);
+ final int bytesRead = sevenZFile.read(contents, off, contents.length - off);
assert(bytesRead >= 0);
off += bytesRead;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java
index 3da4b2c..6c717ef 100644
--- a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java
@@ -56,12 +56,12 @@ public class SevenZOutputFileTest extends AbstractTestCase {
public void testDirectoriesAndEmptyFiles() throws Exception {
output = new File(dir, "empties.7z");
- Date accessDate = new Date();
- Calendar cal = Calendar.getInstance();
+ final Date accessDate = new Date();
+ final Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR, -1);
- Date creationDate = cal.getTime();
+ final Date creationDate = cal.getTime();
- SevenZOutputFile outArchive = new SevenZOutputFile(output);
+ final SevenZOutputFile outArchive = new SevenZOutputFile(output);
try {
SevenZArchiveEntry entry = outArchive.createArchiveEntry(dir, "foo/");
outArchive.putArchiveEntry(entry);
@@ -136,7 +136,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
assert(entry != null);
assertEquals("dada", entry.getName());
assertEquals(2, entry.getSize());
- byte[] content = new byte[2];
+ final byte[] content = new byte[2];
assertEquals(2, archive.read(content));
assertEquals(5, content[0]);
assertEquals(42, content[1]);
@@ -152,9 +152,9 @@ public class SevenZOutputFileTest extends AbstractTestCase {
@Test
public void testDirectoriesOnly() throws Exception {
output = new File(dir, "dirs.7z");
- SevenZOutputFile outArchive = new SevenZOutputFile(output);
+ final SevenZOutputFile outArchive = new SevenZOutputFile(output);
try {
- SevenZArchiveEntry entry = new SevenZArchiveEntry();
+ final SevenZArchiveEntry entry = new SevenZArchiveEntry();
entry.setName("foo/");
entry.setDirectory(true);
outArchive.putArchiveEntry(entry);
@@ -165,7 +165,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
final SevenZFile archive = new SevenZFile(output);
try {
- SevenZArchiveEntry entry = archive.getNextEntry();
+ final SevenZArchiveEntry entry = archive.getNextEntry();
assert(entry != null);
assertEquals("foo/", entry.getName());
assertTrue(entry.isDirectory());
@@ -181,12 +181,12 @@ public class SevenZOutputFileTest extends AbstractTestCase {
@Test
public void testCantFinishTwice() throws Exception {
output = new File(dir, "finish.7z");
- SevenZOutputFile outArchive = new SevenZOutputFile(output);
+ final SevenZOutputFile outArchive = new SevenZOutputFile(output);
try {
outArchive.finish();
outArchive.finish();
fail("shouldn't be able to call finish twice");
- } catch (IOException ex) {
+ } catch (final IOException ex) {
assertEquals("This archive has already been finished", ex.getMessage());
} finally {
outArchive.close();
@@ -307,7 +307,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
@Test
public void testStackOfContentCompressions() throws Exception {
output = new File(dir, "multiple-methods.7z");
- ArrayList<SevenZMethodConfiguration> methods = new ArrayList<SevenZMethodConfiguration>();
+ final ArrayList<SevenZMethodConfiguration> methods = new ArrayList<SevenZMethodConfiguration>();
methods.add(new SevenZMethodConfiguration(SevenZMethod.LZMA2));
methods.add(new SevenZMethodConfiguration(SevenZMethod.COPY));
methods.add(new SevenZMethodConfiguration(SevenZMethod.DEFLATE));
@@ -342,7 +342,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
@Test
public void testLzma2WithOptionsConfiguration() throws Exception {
output = new File(dir, "lzma2-options2.7z");
- LZMA2Options opts = new LZMA2Options(1);
+ final LZMA2Options opts = new LZMA2Options(1);
createAndReadBack(output, Collections
.singletonList(new SevenZMethodConfiguration(SevenZMethod.LZMA2, opts)));
}
@@ -350,7 +350,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
@Test
public void testArchiveWithMixedMethods() throws Exception {
output = new File(dir, "mixed-methods.7z");
- SevenZOutputFile outArchive = new SevenZOutputFile(output);
+ final SevenZOutputFile outArchive = new SevenZOutputFile(output);
try {
addFile(outArchive, 0, true);
addFile(outArchive, 1, true, Arrays.asList(new SevenZMethodConfiguration(SevenZMethod.BZIP2)));
@@ -358,7 +358,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
outArchive.close();
}
- SevenZFile archive = new SevenZFile(output);
+ final SevenZFile archive = new SevenZFile(output);
try {
assertEquals(Boolean.TRUE,
verifyFile(archive, 0, Arrays.asList(new SevenZMethodConfiguration(SevenZMethod.LZMA2))));
@@ -371,12 +371,12 @@ public class SevenZOutputFileTest extends AbstractTestCase {
private void testCompress252(final int numberOfFiles, final int numberOfNonEmptyFiles)
throws Exception {
- int nonEmptyModulus = numberOfNonEmptyFiles != 0
+ final int nonEmptyModulus = numberOfNonEmptyFiles != 0
? numberOfFiles / numberOfNonEmptyFiles
: numberOfFiles + 1;
int nonEmptyFilesAdded = 0;
output = new File(dir, "COMPRESS252-" + numberOfFiles + "-" + numberOfNonEmptyFiles + ".7z");
- SevenZOutputFile archive = new SevenZOutputFile(output);
+ final SevenZOutputFile archive = new SevenZOutputFile(output);
try {
addDir(archive);
for (int i = 0; i < numberOfFiles; i++) {
@@ -391,7 +391,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
private void verifyCompress252(final File output, final int numberOfFiles, final int numberOfNonEmptyFiles)
throws Exception {
- SevenZFile archive = new SevenZFile(output);
+ final SevenZFile archive = new SevenZFile(output);
int filesFound = 0;
int nonEmptyFilesFound = 0;
try {
@@ -411,13 +411,13 @@ public class SevenZOutputFileTest extends AbstractTestCase {
}
private void addDir(final SevenZOutputFile archive) throws Exception {
- SevenZArchiveEntry entry = archive.createArchiveEntry(dir, "foo/");
+ final SevenZArchiveEntry entry = archive.createArchiveEntry(dir, "foo/");
archive.putArchiveEntry(entry);
archive.closeArchiveEntry();
}
private void verifyDir(final SevenZFile archive) throws Exception {
- SevenZArchiveEntry entry = archive.getNextEntry();
+ final SevenZArchiveEntry entry = archive.getNextEntry();
assertNotNull(entry);
assertEquals("foo/", entry.getName());
assertTrue(entry.isDirectory());
@@ -430,7 +430,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
private void addFile(final SevenZOutputFile archive, final int index, final boolean nonEmpty, final Iterable<SevenZMethodConfiguration> methods)
throws Exception {
- SevenZArchiveEntry entry = new SevenZArchiveEntry();
+ final SevenZArchiveEntry entry = new SevenZArchiveEntry();
entry.setName("foo/" + index + ".txt");
entry.setContentMethods(methods);
archive.putArchiveEntry(entry);
@@ -444,7 +444,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
private Boolean verifyFile(final SevenZFile archive, final int index,
final Iterable<SevenZMethodConfiguration> methods) throws Exception {
- SevenZArchiveEntry entry = archive.getNextEntry();
+ final SevenZArchiveEntry entry = archive.getNextEntry();
if (entry == null) {
return null;
}
@@ -464,21 +464,21 @@ public class SevenZOutputFileTest extends AbstractTestCase {
private void testRoundTrip(final SevenZMethod method) throws Exception {
output = new File(dir, method + "-roundtrip.7z");
- ArrayList<SevenZMethodConfiguration> methods = new ArrayList<SevenZMethodConfiguration>();
+ final ArrayList<SevenZMethodConfiguration> methods = new ArrayList<SevenZMethodConfiguration>();
methods.add(new SevenZMethodConfiguration(method));
createAndReadBack(output, methods);
}
private void testFilterRoundTrip(final SevenZMethodConfiguration method) throws Exception {
output = new File(dir, method.getMethod() + "-roundtrip.7z");
- ArrayList<SevenZMethodConfiguration> methods = new ArrayList<SevenZMethodConfiguration>();
+ final ArrayList<SevenZMethodConfiguration> methods = new ArrayList<SevenZMethodConfiguration>();
methods.add(method);
methods.add(new SevenZMethodConfiguration(SevenZMethod.LZMA2));
createAndReadBack(output, methods);
}
private void createAndReadBack(final File output, final Iterable<SevenZMethodConfiguration> methods) throws Exception {
- SevenZOutputFile outArchive = new SevenZOutputFile(output);
+ final SevenZOutputFile outArchive = new SevenZOutputFile(output);
outArchive.setContentMethods(methods);
try {
addFile(outArchive, 0, true);
@@ -486,7 +486,7 @@ public class SevenZOutputFileTest extends AbstractTestCase {
outArchive.close();
}
- SevenZFile archive = new SevenZFile(output);
+ final SevenZFile archive = new SevenZFile(output);
try {
assertEquals(Boolean.TRUE, verifyFile(archive, 0, methods));
} finally {
@@ -497,12 +497,12 @@ public class SevenZOutputFileTest extends AbstractTestCase {
private static void assertContentMethodsEquals(final Iterable<? extends SevenZMethodConfiguration> expected,
final Iterable<? extends SevenZMethodConfiguration> actual) {
assertNotNull(actual);
- Iterator<? extends SevenZMethodConfiguration> expectedIter = expected.iterator();
- Iterator<? extends SevenZMethodConfiguration> actualIter = actual.iterator();
+ final Iterator<? extends SevenZMethodConfiguration> expectedIter = expected.iterator();
+ final Iterator<? extends SevenZMethodConfiguration> actualIter = actual.iterator();
while (expectedIter.hasNext()) {
assertTrue(actualIter.hasNext());
- SevenZMethodConfiguration expConfig = expectedIter.next();
- SevenZMethodConfiguration actConfig = actualIter.next();
+ final SevenZMethodConfiguration expConfig = expectedIter.next();
+ final SevenZMethodConfiguration actConfig = actualIter.next();
assertEquals(expConfig.getMethod(), actConfig.getMethod());
}
assertFalse(actualIter.hasNext());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java b/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java
index e676062..14cfe64 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java
@@ -52,7 +52,7 @@ public class BigFilesIT {
);
gzin = new GzipCompressorInputStream(in);
tin = new TarArchiveInputStream(gzin);
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertNotNull(e);
assertNull(tin.getNextTarEntry());
} finally {
@@ -77,19 +77,19 @@ public class BigFilesIT {
.getResourceAsStream(name));
gzin = new GzipCompressorInputStream(in);
tin = new TarArchiveInputStream(gzin);
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertNotNull(e);
assertEquals(8200l * 1024 * 1024, e.getSize());
long read = 0;
- Random r = new Random(System.currentTimeMillis());
+ final Random r = new Random(System.currentTimeMillis());
int readNow;
- byte[] buf = new byte[1024 * 1024];
+ final byte[] buf = new byte[1024 * 1024];
while ((readNow = tin.read(buf, 0, buf.length)) > 0) {
// testing all bytes for a value of 0 is going to take
// too long, just pick a few ones randomly
for (int i = 0; i < 100; i++) {
- int idx = r.nextInt(readNow);
+ final int idx = r.nextInt(readNow);
assertEquals("testing byte " + (read + idx), 0, buf[idx]);
}
read += readNow;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
index ea70495..56ac227 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
@@ -30,11 +30,11 @@ public class SparseFilesTest {
@Test
public void testOldGNU() throws Throwable {
- File file = getFile("oldgnu_sparse.tar");
+ final File file = getFile("oldgnu_sparse.tar");
TarArchiveInputStream tin = null;
try {
tin = new TarArchiveInputStream(new FileInputStream(file));
- TarArchiveEntry ae = tin.getNextTarEntry();
+ final TarArchiveEntry ae = tin.getNextTarEntry();
assertEquals("sparsefile", ae.getName());
assertTrue(ae.isOldGNUSparse());
assertTrue(ae.isGNUSparse());
@@ -49,7 +49,7 @@ public class SparseFilesTest {
@Test
public void testPaxGNU() throws Throwable {
- File file = getFile("pax_gnu_sparse.tar");
+ final File file = getFile("pax_gnu_sparse.tar");
TarArchiveInputStream tin = null;
try {
tin = new TarArchiveInputStream(new FileInputStream(file));
@@ -64,7 +64,7 @@ public class SparseFilesTest {
}
private void assertPaxGNUEntry(final TarArchiveInputStream tin, final String suffix) throws Throwable {
- TarArchiveEntry ae = tin.getNextTarEntry();
+ final TarArchiveEntry ae = tin.getNextTarEntry();
assertEquals("sparsefile-" + suffix, ae.getName());
assertTrue(ae.isGNUSparse());
assertTrue(ae.isPaxGNUSparse());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
index af0e4fd..ca0b4d9 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
@@ -43,13 +43,13 @@ public class TarArchiveEntryTest implements TarConstants {
*/
@Test
public void testFileSystemRoot() {
- TarArchiveEntry t = new TarArchiveEntry(new File(ROOT));
+ final TarArchiveEntry t = new TarArchiveEntry(new File(ROOT));
assertEquals("/", t.getName());
}
@Test
public void testTarFileWithFSRoot() throws IOException {
- File f = File.createTempFile("taetest", ".tar");
+ final File f = File.createTempFile("taetest", ".tar");
f.deleteOnExit();
TarArchiveOutputStream tout = null;
TarArchiveInputStream tin = null;
@@ -109,13 +109,13 @@ public class TarArchiveEntryTest implements TarConstants {
@Test
public void testMaxFileSize(){
- TarArchiveEntry t = new TarArchiveEntry("");
+ final TarArchiveEntry t = new TarArchiveEntry("");
t.setSize(0);
t.setSize(1);
try {
t.setSize(-1);
fail("Should have generated IllegalArgumentException");
- } catch (IllegalArgumentException expected) {
+ } catch (final IllegalArgumentException expected) {
}
t.setSize(077777777777L);
t.setSize(0100000000000L);
@@ -123,21 +123,21 @@ public class TarArchiveEntryTest implements TarConstants {
@Test
public void testLinkFlagConstructor() {
- TarArchiveEntry t = new TarArchiveEntry("/foo", LF_GNUTYPE_LONGNAME);
+ final TarArchiveEntry t = new TarArchiveEntry("/foo", LF_GNUTYPE_LONGNAME);
assertGnuMagic(t);
assertEquals("foo", t.getName());
}
@Test
public void testLinkFlagConstructorWithFileFlag() {
- TarArchiveEntry t = new TarArchiveEntry("/foo", LF_NORMAL);
+ final TarArchiveEntry t = new TarArchiveEntry("/foo", LF_NORMAL);
assertPosixMagic(t);
assertEquals("foo", t.getName());
}
@Test
public void testLinkFlagConstructorWithPreserve() {
- TarArchiveEntry t = new TarArchiveEntry("/foo", LF_GNUTYPE_LONGNAME,
+ final TarArchiveEntry t = new TarArchiveEntry("/foo", LF_GNUTYPE_LONGNAME,
true);
assertGnuMagic(t);
assertEquals("/foo", t.getName());
@@ -152,7 +152,7 @@ public class TarArchiveEntryTest implements TarConstants {
}
private String readMagic(final TarArchiveEntry t) {
- byte[] buf = new byte[512];
+ final byte[] buf = new byte[512];
t.writeEntryHeader(buf);
return new String(buf, MAGIC_OFFSET, MAGICLEN + VERSIONLEN);
}
[23/46] commons-compress git commit: [COMPRESS-349] Update
requirement from Java 5 to 6.
Posted by bo...@apache.org.
[COMPRESS-349] Update requirement from Java 5 to 6.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/35d616f8
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/35d616f8
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/35d616f8
Branch: refs/heads/COMPRESS-207
Commit: 35d616f8e3d5ac2af4e982bc5092f71ac67485ec
Parents: 8954b8b
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 09:02:59 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 09:02:59 2016 -0700
----------------------------------------------------------------------
pom.xml | 4 ++--
src/changes/changes.xml | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/35d616f8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5ad3f75..38f4be5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,8 +37,8 @@ jar, tar, zip, dump, 7z, arj.
</description>
<properties>
- <maven.compiler.source>1.5</maven.compiler.source>
- <maven.compiler.target>1.5</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+ <maven.compiler.target>1.6</maven.compiler.target>
<commons.componentid>compress</commons.componentid>
<commons.jira.id>COMPRESS</commons.jira.id>
<commons.jira.pid>12310904</commons.jira.pid>
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/35d616f8/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ca1ef94..86527c7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -44,6 +44,9 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="1.12" date="not released, yet"
description="Release 1.12">
+ <action issue="COMPRESS-349" type="update" date="2016-04-09">
+ Update requirement from Java 5 to 6.
+ </action>
</release>
<release version="1.11" date="2016-04-06"
description="Release 1.11">
[15/46] commons-compress git commit: Simplify
Posted by bo...@apache.org.
Simplify
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/999821c2
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/999821c2
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/999821c2
Branch: refs/heads/COMPRESS-207
Commit: 999821c2549e641bd9c9a223be04497982eebaca
Parents: 1935e35
Author: Sebb <se...@apache.org>
Authored: Sat Apr 9 01:42:34 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Sat Apr 9 01:42:34 2016 +0100
----------------------------------------------------------------------
.../compress/archivers/zip/Maven221MultiVolumeTest.java | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/999821c2/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
index 51910a6..3b3f78b 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
@@ -112,14 +112,9 @@ public class Maven221MultiVolumeTest {
}
}
- @Test
+ @Test(expected=IOException.class)
public void testRead7ZipMultiVolumeArchiveForFile() throws IOException {
File file = getFile("apache-maven-2.2.1.zip.001");
- try {
- new ZipFile(file);
- fail("Expected ZipFile to fail");
- } catch (IOException ex) {
- // expected
- }
+ new ZipFile(file);
}
}
[28/46] commons-compress git commit: statement similar to what we did
when we required Java5
Posted by bo...@apache.org.
statement similar to what we did when we required Java5
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/c84c34e8
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/c84c34e8
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/c84c34e8
Branch: refs/heads/COMPRESS-207
Commit: c84c34e862a02bcb43b7db77f9f6da9b93ed9d70
Parents: 6cc5a2f
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sat Apr 9 18:42:27 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sat Apr 9 18:42:27 2016 +0200
----------------------------------------------------------------------
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/c84c34e8/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 8632ce0..2e0dfc2 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -43,7 +43,7 @@ The <action> type attribute can be add,update,fix,remove.
</properties>
<body>
<release version="1.12" date="not released, yet"
- description="Release 1.12">
+ description="Release 1.12 - API compatible to 1.11 but requires Java6 at runtime">
<action issue="COMPRESS-349" type="update" date="2016-04-09" dev="ggregory">
Update requirement from Java 5 to 6.
</action>
[39/46] commons-compress git commit: Add final modifier to local
variables.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
index 1289c21..84f2e1d 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
@@ -49,7 +49,7 @@ public class TarArchiveInputStreamTest {
public void readSimplePaxHeader() throws Exception {
final InputStream is = new ByteArrayInputStream(new byte[1]);
final TarArchiveInputStream tais = new TarArchiveInputStream(is);
- Map<String, String> headers = tais
+ final Map<String, String> headers = tais
.parsePaxHeaders(new ByteArrayInputStream("30 atime=1321711775.972059463\n"
.getBytes(CharsetNames.UTF_8)));
assertEquals(1, headers.size());
@@ -61,7 +61,7 @@ public class TarArchiveInputStreamTest {
public void secondEntryWinsWhenPaxHeaderContainsDuplicateKey() throws Exception {
final InputStream is = new ByteArrayInputStream(new byte[1]);
final TarArchiveInputStream tais = new TarArchiveInputStream(is);
- Map<String, String> headers = tais
+ final Map<String, String> headers = tais
.parsePaxHeaders(new ByteArrayInputStream("11 foo=bar\n11 foo=baz\n"
.getBytes(CharsetNames.UTF_8)));
assertEquals(1, headers.size());
@@ -73,7 +73,7 @@ public class TarArchiveInputStreamTest {
public void paxHeaderEntryWithEmptyValueRemovesKey() throws Exception {
final InputStream is = new ByteArrayInputStream(new byte[1]);
final TarArchiveInputStream tais = new TarArchiveInputStream(is);
- Map<String, String> headers = tais
+ final Map<String, String> headers = tais
.parsePaxHeaders(new ByteArrayInputStream("11 foo=bar\n7 foo=\n"
.getBytes(CharsetNames.UTF_8)));
assertEquals(0, headers.size());
@@ -84,7 +84,7 @@ public class TarArchiveInputStreamTest {
public void readPaxHeaderWithEmbeddedNewline() throws Exception {
final InputStream is = new ByteArrayInputStream(new byte[1]);
final TarArchiveInputStream tais = new TarArchiveInputStream(is);
- Map<String, String> headers = tais
+ final Map<String, String> headers = tais
.parsePaxHeaders(new ByteArrayInputStream("28 comment=line1\nline2\nand3\n"
.getBytes(CharsetNames.UTF_8)));
assertEquals(1, headers.size());
@@ -94,12 +94,12 @@ public class TarArchiveInputStreamTest {
@Test
public void readNonAsciiPaxHeader() throws Exception {
- String ae = "\u00e4";
- String line = "11 path="+ ae + "\n";
+ final String ae = "\u00e4";
+ final String line = "11 path="+ ae + "\n";
assertEquals(11, line.getBytes(CharsetNames.UTF_8).length);
final InputStream is = new ByteArrayInputStream(new byte[1]);
final TarArchiveInputStream tais = new TarArchiveInputStream(is);
- Map<String, String> headers = tais
+ final Map<String, String> headers = tais
.parsePaxHeaders(new ByteArrayInputStream(line.getBytes(CharsetNames.UTF_8)));
assertEquals(1, headers.size());
assertEquals(ae, headers.get("path"));
@@ -139,9 +139,9 @@ public class TarArchiveInputStreamTest {
TarArchiveInputStream in = null;
try {
in = new TarArchiveInputStream(new FileInputStream(getFile(archive)));
- TarArchiveEntry tae = in.getNextTarEntry();
+ final TarArchiveEntry tae = in.getNextTarEntry();
assertEquals("foo", tae.getName());
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.set(1969, 11, 31, 23, 59, 59);
cal.set(Calendar.MILLISECOND, 0);
assertEquals(cal.getTime(), tae.getLastModifiedDate());
@@ -155,13 +155,13 @@ public class TarArchiveInputStreamTest {
@Test
public void testCompress197() throws Exception {
- TarArchiveInputStream tar = getTestStream("/COMPRESS-197.tar");
+ final TarArchiveInputStream tar = getTestStream("/COMPRESS-197.tar");
try {
TarArchiveEntry entry = tar.getNextTarEntry();
while (entry != null) {
entry = tar.getNextTarEntry();
}
- } catch (IOException e) {
+ } catch (final IOException e) {
fail("COMPRESS-197: " + e.getMessage());
} finally {
tar.close();
@@ -171,12 +171,12 @@ public class TarArchiveInputStreamTest {
@Test
public void shouldUseSpecifiedEncodingWhenReadingGNULongNames()
throws Exception {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- String encoding = CharsetNames.UTF_16;
- String name = "1234567890123456789012345678901234567890123456789"
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final String encoding = CharsetNames.UTF_16;
+ final String name = "1234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890\u00e4";
- TarArchiveOutputStream tos =
+ final TarArchiveOutputStream tos =
new TarArchiveOutputStream(bos, encoding);
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
TarArchiveEntry t = new TarArchiveEntry(name);
@@ -185,9 +185,9 @@ public class TarArchiveInputStreamTest {
tos.write(30);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
- ByteArrayInputStream bis = new ByteArrayInputStream(data);
- TarArchiveInputStream tis =
+ final byte[] data = bos.toByteArray();
+ final ByteArrayInputStream bis = new ByteArrayInputStream(data);
+ final TarArchiveInputStream tis =
new TarArchiveInputStream(bis, encoding);
t = tis.getNextTarEntry();
assertEquals(name, t.getName());
@@ -196,16 +196,16 @@ public class TarArchiveInputStreamTest {
@Test
public void shouldConsumeArchiveCompletely() throws Exception {
- InputStream is = TarArchiveInputStreamTest.class
+ final InputStream is = TarArchiveInputStreamTest.class
.getResourceAsStream("/archive_with_trailer.tar");
- TarArchiveInputStream tar = new TarArchiveInputStream(is);
+ final TarArchiveInputStream tar = new TarArchiveInputStream(is);
while (tar.getNextTarEntry() != null) {
// just consume the archive
}
- byte[] expected = new byte[] {
+ final byte[] expected = new byte[] {
'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\n'
};
- byte[] actual = new byte[expected.length];
+ final byte[] actual = new byte[expected.length];
is.read(actual);
assertArrayEquals(expected, actual);
tar.close();
@@ -213,11 +213,11 @@ public class TarArchiveInputStreamTest {
@Test
public void readsArchiveCompletely_COMPRESS245() throws Exception {
- InputStream is = TarArchiveInputStreamTest.class
+ final InputStream is = TarArchiveInputStreamTest.class
.getResourceAsStream("/COMPRESS-245.tar.gz");
try {
- InputStream gin = new GZIPInputStream(is);
- TarArchiveInputStream tar = new TarArchiveInputStream(gin);
+ final InputStream gin = new GZIPInputStream(is);
+ final TarArchiveInputStream tar = new TarArchiveInputStream(gin);
int count = 0;
TarArchiveEntry entry = tar.getNextTarEntry();
while (entry != null) {
@@ -226,7 +226,7 @@ public class TarArchiveInputStreamTest {
}
assertEquals(31, count);
tar.close();
- } catch (IOException e) {
+ } catch (final IOException e) {
fail("COMPRESS-245: " + e.getMessage());
} finally {
is.close();
@@ -235,8 +235,8 @@ public class TarArchiveInputStreamTest {
@Test(expected = IOException.class)
public void shouldThrowAnExceptionOnTruncatedEntries() throws Exception {
- File dir = mkdir("COMPRESS-279");
- TarArchiveInputStream is = getTestStream("/COMPRESS-279.tar");
+ final File dir = mkdir("COMPRESS-279");
+ final TarArchiveInputStream is = getTestStream("/COMPRESS-279.tar");
FileOutputStream out = null;
try {
TarArchiveEntry entry = is.getNextTarEntry();
@@ -260,8 +260,8 @@ public class TarArchiveInputStreamTest {
@Test
public void shouldReadBigGid() throws Exception {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
TarArchiveEntry t = new TarArchiveEntry("name");
t.setGroupId(4294967294l);
@@ -270,9 +270,9 @@ public class TarArchiveInputStreamTest {
tos.write(30);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
- ByteArrayInputStream bis = new ByteArrayInputStream(data);
- TarArchiveInputStream tis =
+ final byte[] data = bos.toByteArray();
+ final ByteArrayInputStream bis = new ByteArrayInputStream(data);
+ final TarArchiveInputStream tis =
new TarArchiveInputStream(bis);
t = tis.getNextTarEntry();
assertEquals(4294967294l, t.getLongGroupId());
@@ -284,9 +284,9 @@ public class TarArchiveInputStreamTest {
*/
@Test
public void shouldReadGNULongNameEntryWithWrongName() throws Exception {
- TarArchiveInputStream is = getTestStream("/COMPRESS-324.tar");
+ final TarArchiveInputStream is = getTestStream("/COMPRESS-324.tar");
try {
- TarArchiveEntry entry = is.getNextTarEntry();
+ final TarArchiveEntry entry = is.getNextTarEntry();
assertEquals("1234567890123456789012345678901234567890123456789012345678901234567890"
+ "1234567890123456789012345678901234567890123456789012345678901234567890"
+ "1234567890123456789012345678901234567890123456789012345678901234567890"
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
index 3996bf4..3465835 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
@@ -46,19 +46,19 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testCount() throws Exception {
- File f = File.createTempFile("commons-compress-tarcount", ".tar");
+ final File f = File.createTempFile("commons-compress-tarcount", ".tar");
f.deleteOnExit();
- FileOutputStream fos = new FileOutputStream(f);
+ final FileOutputStream fos = new FileOutputStream(f);
- ArchiveOutputStream tarOut = new ArchiveStreamFactory()
+ final ArchiveOutputStream tarOut = new ArchiveStreamFactory()
.createArchiveOutputStream(ArchiveStreamFactory.TAR, fos);
- File file1 = getFile("test1.xml");
- TarArchiveEntry sEntry = new TarArchiveEntry(file1, file1.getName());
+ final File file1 = getFile("test1.xml");
+ final TarArchiveEntry sEntry = new TarArchiveEntry(file1, file1.getName());
tarOut.putArchiveEntry(sEntry);
- FileInputStream in = new FileInputStream(file1);
- byte[] buf = new byte[8192];
+ final FileInputStream in = new FileInputStream(file1);
+ final byte[] buf = new byte[8192];
int read = 0;
while ((read = in.read(buf)) > 0) {
@@ -74,7 +74,7 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testMaxFileSizeError() throws Exception {
- TarArchiveEntry t = new TarArchiveEntry("foo");
+ final TarArchiveEntry t = new TarArchiveEntry("foo");
t.setSize(077777777777L);
TarArchiveOutputStream tos =
new TarArchiveOutputStream(new ByteArrayOutputStream());
@@ -84,29 +84,29 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
try {
tos.putArchiveEntry(t);
fail("Should have generated RuntimeException");
- } catch (RuntimeException expected) {
+ } catch (final RuntimeException expected) {
}
}
@Test
public void testBigNumberStarMode() throws Exception {
- TarArchiveEntry t = new TarArchiveEntry("foo");
+ final TarArchiveEntry t = new TarArchiveEntry("foo");
t.setSize(0100000000000L);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
tos.putArchiveEntry(t);
// make sure header is written to byte array
tos.write(new byte[10 * 1024]);
- byte[] data = bos.toByteArray();
+ final byte[] data = bos.toByteArray();
assertEquals(0x80,
data[TarConstants.NAMELEN
+ TarConstants.MODELEN
+ TarConstants.UIDLEN
+ TarConstants.GIDLEN] & 0x80);
- TarArchiveInputStream tin =
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals(0100000000000L, e.getSize());
tin.close();
// generates IOE because of unclosed entries.
@@ -116,15 +116,15 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testBigNumberPosixMode() throws Exception {
- TarArchiveEntry t = new TarArchiveEntry("foo");
+ final TarArchiveEntry t = new TarArchiveEntry("foo");
t.setSize(0100000000000L);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
tos.putArchiveEntry(t);
// make sure header is written to byte array
tos.write(new byte[10 * 1024]);
- byte[] data = bos.toByteArray();
+ final byte[] data = bos.toByteArray();
assertEquals("00000000000 ",
new String(data,
1024 + TarConstants.NAMELEN
@@ -132,9 +132,9 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
+ TarConstants.UIDLEN
+ TarConstants.GIDLEN, 12,
CharsetNames.UTF_8));
- TarArchiveInputStream tin =
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals(0100000000000L, e.getSize());
tin.close();
// generates IOE because of unclosed entries.
@@ -144,9 +144,9 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testWriteSimplePaxHeaders() throws Exception {
- Map<String, String> m = new HashMap<String, String>();
+ final Map<String, String> m = new HashMap<String, String>();
m.put("a", "b");
- byte[] data = writePaxHeader(m);
+ final byte[] data = writePaxHeader(m);
assertEquals("00000000006 ",
new String(data, TarConstants.NAMELEN
+ TarConstants.MODELEN
@@ -158,12 +158,12 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testPaxHeadersWithLength99() throws Exception {
- Map<String, String> m = new HashMap<String, String>();
+ final Map<String, String> m = new HashMap<String, String>();
m.put("a",
"0123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "012");
- byte[] data = writePaxHeader(m);
+ final byte[] data = writePaxHeader(m);
assertEquals("00000000143 ",
new String(data, TarConstants.NAMELEN
+ TarConstants.MODELEN
@@ -177,12 +177,12 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testPaxHeadersWithLength101() throws Exception {
- Map<String, String> m = new HashMap<String, String>();
+ final Map<String, String> m = new HashMap<String, String>();
m.put("a",
"0123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "0123");
- byte[] data = writePaxHeader(m);
+ final byte[] data = writePaxHeader(m);
assertEquals("00000000145 ",
new String(data, TarConstants.NAMELEN
+ TarConstants.MODELEN
@@ -195,12 +195,12 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
}
private byte[] writePaxHeader(final Map<String, String> m) throws Exception {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
tos.writePaxHeaders(new TarArchiveEntry("x"), "foo", m);
// add a dummy entry so data gets written
- TarArchiveEntry t = new TarArchiveEntry("foo");
+ final TarArchiveEntry t = new TarArchiveEntry("foo");
t.setSize(10 * 1024);
tos.putArchiveEntry(t);
tos.write(new byte[10 * 1024]);
@@ -212,24 +212,24 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testWriteLongFileNamePosixMode() throws Exception {
- String n = "01234567890123456789012345678901234567890123456789"
+ final String n = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789";
- TarArchiveEntry t =
+ final TarArchiveEntry t =
new TarArchiveEntry(n);
t.setSize(10 * 1024);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
tos.putArchiveEntry(t);
tos.write(new byte[10 * 1024]);
tos.closeArchiveEntry();
- byte[] data = bos.toByteArray();
+ final byte[] data = bos.toByteArray();
assertEquals("160 path=" + n + "\n",
new String(data, 512, 160, CharsetNames.UTF_8));
- TarArchiveInputStream tin =
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals(n, e.getName());
tin.close();
tos.close();
@@ -237,26 +237,26 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testOldEntryStarMode() throws Exception {
- TarArchiveEntry t = new TarArchiveEntry("foo");
+ final TarArchiveEntry t = new TarArchiveEntry("foo");
t.setSize(Integer.MAX_VALUE);
t.setModTime(-1000);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
tos.putArchiveEntry(t);
// make sure header is written to byte array
tos.write(new byte[10 * 1024]);
- byte[] data = bos.toByteArray();
+ final byte[] data = bos.toByteArray();
assertEquals((byte) 0xff,
data[TarConstants.NAMELEN
+ TarConstants.MODELEN
+ TarConstants.UIDLEN
+ TarConstants.GIDLEN
+ TarConstants.SIZELEN]);
- TarArchiveInputStream tin =
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ final TarArchiveEntry e = tin.getNextTarEntry();
+ final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.set(1969, 11, 31, 23, 59, 59);
cal.set(Calendar.MILLISECOND, 0);
assertEquals(cal.getTime(), e.getLastModifiedDate());
@@ -268,16 +268,16 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testOldEntryPosixMode() throws Exception {
- TarArchiveEntry t = new TarArchiveEntry("foo");
+ final TarArchiveEntry t = new TarArchiveEntry("foo");
t.setSize(Integer.MAX_VALUE);
t.setModTime(-1000);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
tos.putArchiveEntry(t);
// make sure header is written to byte array
tos.write(new byte[10 * 1024]);
- byte[] data = bos.toByteArray();
+ final byte[] data = bos.toByteArray();
assertEquals("00000000000 ",
new String(data,
1024 + TarConstants.NAMELEN
@@ -286,10 +286,10 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
+ TarConstants.GIDLEN
+ TarConstants.SIZELEN, 12,
CharsetNames.UTF_8));
- TarArchiveInputStream tin =
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ final TarArchiveEntry e = tin.getNextTarEntry();
+ final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.set(1969, 11, 31, 23, 59, 59);
cal.set(Calendar.MILLISECOND, 0);
assertEquals(cal.getTime(), e.getLastModifiedDate());
@@ -301,60 +301,60 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testOldEntryError() throws Exception {
- TarArchiveEntry t = new TarArchiveEntry("foo");
+ final TarArchiveEntry t = new TarArchiveEntry("foo");
t.setSize(Integer.MAX_VALUE);
t.setModTime(-1000);
- TarArchiveOutputStream tos =
+ final TarArchiveOutputStream tos =
new TarArchiveOutputStream(new ByteArrayOutputStream());
try {
tos.putArchiveEntry(t);
fail("Should have generated RuntimeException");
- } catch (RuntimeException expected) {
+ } catch (final RuntimeException expected) {
}
tos.close();
}
@Test
public void testWriteNonAsciiPathNamePaxHeader() throws Exception {
- String n = "\u00e4";
- TarArchiveEntry t = new TarArchiveEntry(n);
+ final String n = "\u00e4";
+ final TarArchiveEntry t = new TarArchiveEntry(n);
t.setSize(10 * 1024);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
tos.setAddPaxHeadersForNonAsciiNames(true);
tos.putArchiveEntry(t);
tos.write(new byte[10 * 1024]);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
+ final byte[] data = bos.toByteArray();
assertEquals("11 path=" + n + "\n",
new String(data, 512, 11, CharsetNames.UTF_8));
- TarArchiveInputStream tin =
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals(n, e.getName());
tin.close();
}
@Test
public void testWriteNonAsciiLinkPathNamePaxHeader() throws Exception {
- String n = "\u00e4";
- TarArchiveEntry t = new TarArchiveEntry("a", TarConstants.LF_LINK);
+ final String n = "\u00e4";
+ final TarArchiveEntry t = new TarArchiveEntry("a", TarConstants.LF_LINK);
t.setSize(10 * 1024);
t.setLinkName(n);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
tos.setAddPaxHeadersForNonAsciiNames(true);
tos.putArchiveEntry(t);
tos.write(new byte[10 * 1024]);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
+ final byte[] data = bos.toByteArray();
assertEquals("15 linkpath=" + n + "\n",
new String(data, 512, 15, CharsetNames.UTF_8));
- TarArchiveInputStream tin =
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals(n, e.getLinkName());
tin.close();
}
@@ -376,63 +376,63 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
}
private void testRoundtripWith67CharFileName(final int mode) throws Exception {
- String n = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+ final String n = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+ "AAAAAAA";
assertEquals(67, n.length());
- TarArchiveEntry t = new TarArchiveEntry(n);
+ final TarArchiveEntry t = new TarArchiveEntry(n);
t.setSize(10 * 1024);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
tos.setLongFileMode(mode);
tos.putArchiveEntry(t);
tos.write(new byte[10 * 1024]);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
- TarArchiveInputStream tin =
+ final byte[] data = bos.toByteArray();
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals(n, e.getName());
tin.close();
}
@Test
public void testWriteLongDirectoryNameErrorMode() throws Exception {
- String n = "01234567890123456789012345678901234567890123456789"
+ final String n = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/";
try {
- TarArchiveEntry t = new TarArchiveEntry(n);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
+ final TarArchiveEntry t = new TarArchiveEntry(n);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_ERROR);
tos.putArchiveEntry(t);
tos.closeArchiveEntry();
tos.close();
fail("Truncated name didn't throw an exception");
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
// expected
}
}
@Test
public void testWriteLongDirectoryNameTruncateMode() throws Exception {
- String n = "01234567890123456789012345678901234567890123456789"
+ final String n = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/";
- TarArchiveEntry t = new TarArchiveEntry(n);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
+ final TarArchiveEntry t = new TarArchiveEntry(n);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_TRUNCATE);
tos.putArchiveEntry(t);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
- TarArchiveInputStream tin =
+ final byte[] data = bos.toByteArray();
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals("Entry name", n.substring(0, TarConstants.NAMELEN) + "/", e.getName());
assertTrue("The entry is not a directory", e.isDirectory());
tin.close();
@@ -455,20 +455,20 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
}
private void testWriteLongDirectoryName(final int mode) throws Exception {
- String n = "01234567890123456789012345678901234567890123456789"
+ final String n = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/";
- TarArchiveEntry t = new TarArchiveEntry(n);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
+ final TarArchiveEntry t = new TarArchiveEntry(n);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
tos.setLongFileMode(mode);
tos.putArchiveEntry(t);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
- TarArchiveInputStream tin =
+ final byte[] data = bos.toByteArray();
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals(n, e.getName());
assertTrue(e.isDirectory());
tin.close();
@@ -479,18 +479,18 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
*/
@Test
public void testWriteNonAsciiDirectoryNamePosixMode() throws Exception {
- String n = "f\u00f6\u00f6/";
- TarArchiveEntry t = new TarArchiveEntry(n);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
+ final String n = "f\u00f6\u00f6/";
+ final TarArchiveEntry t = new TarArchiveEntry(n);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
tos.setAddPaxHeadersForNonAsciiNames(true);
tos.putArchiveEntry(t);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
- TarArchiveInputStream tin =
+ final byte[] data = bos.toByteArray();
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals(n, e.getName());
assertTrue(e.isDirectory());
tin.close();
@@ -501,18 +501,18 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
*/
@Test
public void testWriteNonAsciiNameWithUnfortunateNamePosixMode() throws Exception {
- String n = "f\u00f6\u00f6\u00dc";
- TarArchiveEntry t = new TarArchiveEntry(n);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
+ final String n = "f\u00f6\u00f6\u00dc";
+ final TarArchiveEntry t = new TarArchiveEntry(n);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
tos.setAddPaxHeadersForNonAsciiNames(true);
tos.putArchiveEntry(t);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
- TarArchiveInputStream tin =
+ final byte[] data = bos.toByteArray();
+ final TarArchiveInputStream tin =
new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals(n, e.getName());
assertFalse(e.isDirectory());
tin.close();
@@ -523,44 +523,44 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
*/
@Test
public void testWriteLongLinkNameErrorMode() throws Exception {
- String linkname = "01234567890123456789012345678901234567890123456789"
+ final String linkname = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/test";
- TarArchiveEntry entry = new TarArchiveEntry("test", TarConstants.LF_SYMLINK);
+ final TarArchiveEntry entry = new TarArchiveEntry("test", TarConstants.LF_SYMLINK);
entry.setLinkName(linkname);
try {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_ERROR);
tos.putArchiveEntry(entry);
tos.closeArchiveEntry();
tos.close();
fail("Truncated link name didn't throw an exception");
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
// expected
}
}
@Test
public void testWriteLongLinkNameTruncateMode() throws Exception {
- String linkname = "01234567890123456789012345678901234567890123456789"
+ final String linkname = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/";
- TarArchiveEntry entry = new TarArchiveEntry("test" , TarConstants.LF_SYMLINK);
+ final TarArchiveEntry entry = new TarArchiveEntry("test" , TarConstants.LF_SYMLINK);
entry.setLinkName(linkname);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_TRUNCATE);
tos.putArchiveEntry(entry);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
- TarArchiveInputStream tin = new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final byte[] data = bos.toByteArray();
+ final TarArchiveInputStream tin = new TarArchiveInputStream(new ByteArrayInputStream(data));
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals("Link name", linkname.substring(0, TarConstants.NAMELEN), e.getLinkName());
tin.close();
}
@@ -585,22 +585,22 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
* @see "https://issues.apache.org/jira/browse/COMPRESS-237"
*/
private void testWriteLongLinkName(final int mode) throws Exception {
- String linkname = "01234567890123456789012345678901234567890123456789"
+ final String linkname = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/test";
- TarArchiveEntry entry = new TarArchiveEntry("test", TarConstants.LF_SYMLINK);
+ final TarArchiveEntry entry = new TarArchiveEntry("test", TarConstants.LF_SYMLINK);
entry.setLinkName(linkname);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
tos.setLongFileMode(mode);
tos.putArchiveEntry(entry);
tos.closeArchiveEntry();
tos.close();
- byte[] data = bos.toByteArray();
- TarArchiveInputStream tin = new TarArchiveInputStream(new ByteArrayInputStream(data));
- TarArchiveEntry e = tin.getNextTarEntry();
+ final byte[] data = bos.toByteArray();
+ final TarArchiveInputStream tin = new TarArchiveInputStream(new ByteArrayInputStream(data));
+ final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals("Entry name", "test", e.getName());
assertEquals("Link name", linkname, e.getLinkName());
assertTrue("The entry is not a symbolic link", e.isSymbolicLink());
@@ -609,14 +609,14 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testPadsOutputToFullBlockLength() throws Exception {
- File f = File.createTempFile("commons-compress-padding", ".tar");
+ final File f = File.createTempFile("commons-compress-padding", ".tar");
f.deleteOnExit();
- FileOutputStream fos = new FileOutputStream(f);
- TarArchiveOutputStream tos = new TarArchiveOutputStream(fos);
- File file1 = getFile("test1.xml");
- TarArchiveEntry sEntry = new TarArchiveEntry(file1, file1.getName());
+ final FileOutputStream fos = new FileOutputStream(f);
+ final TarArchiveOutputStream tos = new TarArchiveOutputStream(fos);
+ final File file1 = getFile("test1.xml");
+ final TarArchiveEntry sEntry = new TarArchiveEntry(file1, file1.getName());
tos.putArchiveEntry(sEntry);
- FileInputStream in = new FileInputStream(file1);
+ final FileInputStream in = new FileInputStream(file1);
IOUtils.copy(in, tos);
in.close();
tos.closeArchiveEntry();
@@ -636,27 +636,27 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testLongNameMd5Hash() throws Exception {
final String longFileName = "a/considerably/longer/file/name/which/forces/use/of/the/long/link/header/which/appears/to/always/use/the/current/time/as/modification/date";
- String fname = longFileName;
+ final String fname = longFileName;
final Date modificationDate = new Date();
- byte[] archive1 = createTarArchiveContainingOneDirectory(fname, modificationDate);
- byte[] digest1 = MessageDigest.getInstance("MD5").digest(archive1);
+ final byte[] archive1 = createTarArchiveContainingOneDirectory(fname, modificationDate);
+ final byte[] digest1 = MessageDigest.getInstance("MD5").digest(archive1);
// let a second elapse otherwise the modification dates will be equal
Thread.sleep(1000L);
// now recreate exactly the same tar file
- byte[] archive2 = createTarArchiveContainingOneDirectory(fname, modificationDate);
+ final byte[] archive2 = createTarArchiveContainingOneDirectory(fname, modificationDate);
// and I would expect the MD5 hash to be the same, but for long names it isn't
- byte[] digest2 = MessageDigest.getInstance("MD5").digest(archive2);
+ final byte[] digest2 = MessageDigest.getInstance("MD5").digest(archive2);
Assert.assertArrayEquals(digest1, digest2);
// do I still have the correct modification date?
// let a second elapse so we don't get the current time
Thread.sleep(1000);
- TarArchiveInputStream tarIn = new TarArchiveInputStream(new ByteArrayInputStream(archive2));
- ArchiveEntry nextEntry = tarIn.getNextEntry();
+ final TarArchiveInputStream tarIn = new TarArchiveInputStream(new ByteArrayInputStream(archive2));
+ final ArchiveEntry nextEntry = tarIn.getNextEntry();
assertEquals(longFileName, nextEntry.getName());
// tar archive stores modification time to second granularity only (floored)
assertEquals(modificationDate.getTime() / 1000, nextEntry.getLastModifiedDate().getTime() / 1000);
@@ -664,10 +664,10 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
}
private static byte[] createTarArchiveContainingOneDirectory(final String fname, final Date modificationDate) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- TarArchiveOutputStream tarOut = new TarArchiveOutputStream(baos, 1024);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final TarArchiveOutputStream tarOut = new TarArchiveOutputStream(baos, 1024);
tarOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
- TarArchiveEntry tarEntry = new TarArchiveEntry("d");
+ final TarArchiveEntry tarEntry = new TarArchiveEntry("d");
tarEntry.setModTime(modificationDate);
tarEntry.setMode(TarArchiveEntry.DEFAULT_DIR_MODE);
tarEntry.setModTime(modificationDate.getTime());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/tar/TarLister.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarLister.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarLister.java
index 590e5c3..71c9641 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarLister.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarLister.java
@@ -39,11 +39,11 @@ public final class TarLister {
return;
}
System.out.println("Analysing " + args[0]);
- File f = new File(args[0]);
+ final File f = new File(args[0]);
if (!f.isFile()) {
System.err.println(f + " doesn't exist or is a directory");
}
- InputStream fis = new BufferedInputStream(new FileInputStream(f));
+ final InputStream fis = new BufferedInputStream(new FileInputStream(f));
TarArchiveInputStream ais;
if (args.length > 1) {
ais = new TarArchiveInputStream(fis, args[1]);
@@ -64,7 +64,7 @@ public final class TarLister {
}
private static void log(final TarArchiveEntry ae) {
- StringBuilder sb = new StringBuilder(Integer.toOctalString(ae.getMode()))
+ final StringBuilder sb = new StringBuilder(Integer.toOctalString(ae.getMode()))
.append(" ");
String name = ae.getUserName();
if (name != null && name.length() > 0) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
index e0649ac..a4ef25b 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
@@ -34,7 +34,7 @@ public class TarUtilsTest {
@Test
public void testName(){
byte [] buff = new byte[20];
- String sb1 = "abcdefghijklmnopqrstuvwxyz";
+ final String sb1 = "abcdefghijklmnopqrstuvwxyz";
int off = TarUtils.formatNameBytes(sb1, buff, 1, buff.length-1);
assertEquals(off, 20);
String sb2 = TarUtils.parseName(buff, 1, 10);
@@ -82,36 +82,36 @@ public class TarUtilsTest {
try {
TarUtils.parseOctal(buffer,0, buffer.length);
fail("Expected IllegalArgumentException - should be at least 2 bytes long");
- } catch (IllegalArgumentException expected) {
+ } catch (final IllegalArgumentException expected) {
}
buffer=new byte[]{0}; // 1-byte array
try {
TarUtils.parseOctal(buffer,0, buffer.length);
fail("Expected IllegalArgumentException - should be at least 2 bytes long");
- } catch (IllegalArgumentException expected) {
+ } catch (final IllegalArgumentException expected) {
}
buffer = "abcdef ".getBytes(CharsetNames.UTF_8); // Invalid input
try {
TarUtils.parseOctal(buffer,0, buffer.length);
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException expected) {
+ } catch (final IllegalArgumentException expected) {
}
buffer = " 0 07 ".getBytes(CharsetNames.UTF_8); // Invalid - embedded space
try {
TarUtils.parseOctal(buffer,0, buffer.length);
fail("Expected IllegalArgumentException - embedded space");
- } catch (IllegalArgumentException expected) {
+ } catch (final IllegalArgumentException expected) {
}
buffer = " 0\00007 ".getBytes(CharsetNames.UTF_8); // Invalid - embedded NUL
try {
TarUtils.parseOctal(buffer,0, buffer.length);
fail("Expected IllegalArgumentException - embedded NUL");
- } catch (IllegalArgumentException expected) {
+ } catch (final IllegalArgumentException expected) {
}
}
private void checkRoundTripOctal(final long value, final int bufsize) {
- byte [] buffer = new byte[bufsize];
+ final byte [] buffer = new byte[bufsize];
long parseValue;
TarUtils.formatLongOctalBytes(value, buffer, 0, buffer.length);
parseValue = TarUtils.parseOctal(buffer,0, buffer.length);
@@ -136,7 +136,7 @@ public class TarUtilsTest {
}
private void checkRoundTripOctalOrBinary(final long value, final int bufsize) {
- byte [] buffer = new byte[bufsize];
+ final byte [] buffer = new byte[bufsize];
long parseValue;
TarUtils.formatLongOctalOrBinaryBytes(value, buffer, 0, buffer.length);
parseValue = TarUtils.parseOctalOrBinary(buffer,0, buffer.length);
@@ -166,7 +166,7 @@ public class TarUtilsTest {
// Check correct trailing bytes are generated
@Test
public void testTrailers() {
- byte [] buffer = new byte[12];
+ final byte [] buffer = new byte[12];
TarUtils.formatLongOctalBytes(123, buffer, 0, buffer.length);
assertEquals(' ', buffer[buffer.length-1]);
assertEquals('3', buffer[buffer.length-2]); // end of number
@@ -182,20 +182,20 @@ public class TarUtilsTest {
@Test
public void testNegative() throws Exception {
- byte [] buffer = new byte[22];
+ final byte [] buffer = new byte[22];
TarUtils.formatUnsignedOctalString(-1, buffer, 0, buffer.length);
assertEquals("1777777777777777777777", new String(buffer, CharsetNames.UTF_8));
}
@Test
public void testOverflow() throws Exception {
- byte [] buffer = new byte[8-1]; // a lot of the numbers have 8-byte buffers (nul term)
+ final byte [] buffer = new byte[8-1]; // a lot of the numbers have 8-byte buffers (nul term)
TarUtils.formatUnsignedOctalString(07777777L, buffer, 0, buffer.length);
assertEquals("7777777", new String(buffer, CharsetNames.UTF_8));
try {
TarUtils.formatUnsignedOctalString(017777777L, buffer, 0, buffer.length);
fail("Should have cause IllegalArgumentException");
- } catch (IllegalArgumentException expected) {
+ } catch (final IllegalArgumentException expected) {
}
}
@@ -210,22 +210,22 @@ public class TarUtilsTest {
@Test
public void testRoundEncoding() throws Exception {
// COMPRESS-114
- ZipEncoding enc = ZipEncodingHelper.getZipEncoding(CharsetNames.ISO_8859_1);
- String s = "0302-0601-3\u00b1\u00b1\u00b1F06\u00b1W220\u00b1ZB\u00b1LALALA\u00b1\u00b1\u00b1\u00b1\u00b1\u00b1\u00b1\u00b1\u00b1\u00b1CAN\u00b1\u00b1DC\u00b1\u00b1\u00b104\u00b1060302\u00b1MOE.model";
- byte buff[] = new byte[100];
- int len = TarUtils.formatNameBytes(s, buff, 0, buff.length, enc);
+ final ZipEncoding enc = ZipEncodingHelper.getZipEncoding(CharsetNames.ISO_8859_1);
+ final String s = "0302-0601-3\u00b1\u00b1\u00b1F06\u00b1W220\u00b1ZB\u00b1LALALA\u00b1\u00b1\u00b1\u00b1\u00b1\u00b1\u00b1\u00b1\u00b1\u00b1CAN\u00b1\u00b1DC\u00b1\u00b1\u00b104\u00b1060302\u00b1MOE.model";
+ final byte buff[] = new byte[100];
+ final int len = TarUtils.formatNameBytes(s, buff, 0, buff.length, enc);
assertEquals(s, TarUtils.parseName(buff, 0, len, enc));
}
private void checkName(final String string) {
- byte buff[] = new byte[100];
- int len = TarUtils.formatNameBytes(string, buff, 0, buff.length);
+ final byte buff[] = new byte[100];
+ final int len = TarUtils.formatNameBytes(string, buff, 0, buff.length);
assertEquals(string, TarUtils.parseName(buff, 0, len));
}
@Test
public void testReadNegativeBinary8Byte() {
- byte[] b = new byte[] {
+ final byte[] b = new byte[] {
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xf1, (byte) 0xef,
};
@@ -234,7 +234,7 @@ public class TarUtilsTest {
@Test
public void testReadNegativeBinary12Byte() {
- byte[] b = new byte[] {
+ final byte[] b = new byte[] {
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xf1, (byte) 0xef,
@@ -245,7 +245,7 @@ public class TarUtilsTest {
@Test
public void testWriteNegativeBinary8Byte() {
- byte[] b = new byte[] {
+ final byte[] b = new byte[] {
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xf1, (byte) 0xef,
};
@@ -255,7 +255,7 @@ public class TarUtilsTest {
// https://issues.apache.org/jira/browse/COMPRESS-191
@Test
public void testVerifyHeaderCheckSum() {
- byte[] valid = { // from bla.tar
+ final byte[] valid = { // from bla.tar
116, 101, 115, 116, 49, 46, 120, 109, 108, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -285,7 +285,7 @@ public class TarUtilsTest {
0, 0, 0, 0 };
assertTrue(TarUtils.verifyCheckSum(valid));
- byte[] compress117 = { // from COMPRESS-117
+ final byte[] compress117 = { // from COMPRESS-117
(byte) 0x37, (byte) 0x7a, (byte) 0x43, (byte) 0x2e, (byte) 0x74, (byte) 0x78, (byte) 0x74, (byte) 0x00,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -326,7 +326,7 @@ public class TarUtilsTest {
};
assertTrue(TarUtils.verifyCheckSum(compress117));
- byte[] invalid = { // from the testAIFF.aif file in Tika
+ final byte[] invalid = { // from the testAIFF.aif file in Tika
70, 79, 82, 77, 0, 0, 15, 46, 65, 73, 70, 70, 67, 79, 77, 77,
0, 0, 0, 18, 0, 2, 0, 0, 3, -64, 0, 16, 64, 14, -84, 68, 0, 0,
0, 0, 0, 0, 83, 83, 78, 68, 0, 0, 15, 8, 0, 0, 0, 0, 0, 0, 0,
@@ -360,8 +360,8 @@ public class TarUtilsTest {
@Test
public void testParseOctalCompress330() throws Exception{
- long expected = 0100000;
- byte [] buffer = new byte[] {
+ final long expected = 0100000;
+ final byte [] buffer = new byte[] {
32, 32, 32, 32, 32, 49, 48, 48, 48, 48, 48, 32
};
assertEquals(expected, TarUtils.parseOctalOrBinary(buffer, 0, buffer.length));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/AsiExtraFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/AsiExtraFieldTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/AsiExtraFieldTest.java
index d4c14ec..bd17cea 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/AsiExtraFieldTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/AsiExtraFieldTest.java
@@ -33,7 +33,7 @@ public class AsiExtraFieldTest implements UnixStat {
*/
@Test
public void testModes() {
- AsiExtraField a = new AsiExtraField();
+ final AsiExtraField a = new AsiExtraField();
a.setMode(0123);
assertEquals("plain file", 0100123, a.getMode());
a.setDirectory(true);
@@ -47,7 +47,7 @@ public class AsiExtraFieldTest implements UnixStat {
*/
@Test
public void testContent() {
- AsiExtraField a = new AsiExtraField();
+ final AsiExtraField a = new AsiExtraField();
a.setMode(0123);
a.setUserId(5);
a.setGroupId(6);
@@ -135,7 +135,7 @@ public class AsiExtraFieldTest implements UnixStat {
try {
a.parseFromLocalFileData(data, 0, data.length);
fail("should raise bad CRC exception");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertEquals("bad CRC checksum 0 instead of ebf018e",
e.getMessage());
}
@@ -143,13 +143,13 @@ public class AsiExtraFieldTest implements UnixStat {
@Test
public void testClone() {
- AsiExtraField s1 = new AsiExtraField();
+ final AsiExtraField s1 = new AsiExtraField();
s1.setUserId(42);
s1.setGroupId(12);
s1.setLinkedFile("foo");
s1.setMode(0644);
s1.setDirectory(true);
- AsiExtraField s2 = (AsiExtraField) s1.clone();
+ final AsiExtraField s2 = (AsiExtraField) s1.clone();
assertNotSame(s1, s2);
assertEquals(s1.getUserId(), s2.getUserId());
assertEquals(s1.getGroupId(), s2.getGroupId());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/BinaryTreeTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/BinaryTreeTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/BinaryTreeTest.java
index de0e488..930df01 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/BinaryTreeTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/BinaryTreeTest.java
@@ -31,13 +31,13 @@ public class BinaryTreeTest {
@Test
public void testDecode() throws IOException {
- InputStream in = new ByteArrayInputStream(new byte[] { 0x02, 0x42, 0x01, 0x13 });
+ final InputStream in = new ByteArrayInputStream(new byte[] { 0x02, 0x42, 0x01, 0x13 });
- BinaryTree tree = BinaryTree.decode(in, 8);
+ final BinaryTree tree = BinaryTree.decode(in, 8);
assertNotNull(tree);
- BitStream stream = new BitStream(new ByteArrayInputStream(new byte[] { (byte) 0x8D, (byte) 0xC5, (byte) 0x11, 0x00 }));
+ final BitStream stream = new BitStream(new ByteArrayInputStream(new byte[] { (byte) 0x8D, (byte) 0xC5, (byte) 0x11, 0x00 }));
assertEquals(0, tree.read(stream));
assertEquals(1, tree.read(stream));
assertEquals(2, tree.read(stream));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/BitStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/BitStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/BitStreamTest.java
index 5bc182c..a0525fa 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/BitStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/BitStreamTest.java
@@ -29,7 +29,7 @@ public class BitStreamTest {
@Test
public void testEmptyStream() throws Exception {
- BitStream stream = new BitStream(new ByteArrayInputStream(new byte[0]));
+ final BitStream stream = new BitStream(new ByteArrayInputStream(new byte[0]));
assertEquals("next bit", -1, stream.nextBit());
assertEquals("next bit", -1, stream.nextBit());
assertEquals("next bit", -1, stream.nextBit());
@@ -38,7 +38,7 @@ public class BitStreamTest {
@Test
public void testStream() throws Exception {
- BitStream stream = new BitStream(new ByteArrayInputStream(new byte[] { (byte) 0xEA, 0x03 }));
+ final BitStream stream = new BitStream(new ByteArrayInputStream(new byte[] { (byte) 0xEA, 0x03 }));
assertEquals("bit 0", 0, stream.nextBit());
assertEquals("bit 1", 1, stream.nextBit());
@@ -64,7 +64,7 @@ public class BitStreamTest {
@Test
public void testNextByteFromEmptyStream() throws Exception {
- BitStream stream = new BitStream(new ByteArrayInputStream(new byte[0]));
+ final BitStream stream = new BitStream(new ByteArrayInputStream(new byte[0]));
assertEquals("next byte", -1, stream.nextByte());
assertEquals("next byte", -1, stream.nextByte());
stream.close();
@@ -72,7 +72,7 @@ public class BitStreamTest {
@Test
public void testReadAlignedBytes() throws Exception {
- BitStream stream = new BitStream(new ByteArrayInputStream(new byte[] { (byte) 0xEA, 0x35 }));
+ final BitStream stream = new BitStream(new ByteArrayInputStream(new byte[] { (byte) 0xEA, 0x35 }));
assertEquals("next byte", 0xEA, stream.nextByte());
assertEquals("next byte", 0x35, stream.nextByte());
assertEquals("next byte", -1, stream.nextByte());
@@ -81,7 +81,7 @@ public class BitStreamTest {
@Test
public void testNextByte() throws Exception {
- BitStream stream = new BitStream(new ByteArrayInputStream(new byte[] { (byte) 0xEA, 0x35 }));
+ final BitStream stream = new BitStream(new ByteArrayInputStream(new byte[] { (byte) 0xEA, 0x35 }));
assertEquals("bit 0", 0, stream.nextBit());
assertEquals("bit 1", 1, stream.nextBit());
assertEquals("bit 2", 0, stream.nextBit());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/CircularBufferTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/CircularBufferTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/CircularBufferTest.java
index cf5e1c8..442d5e6 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/CircularBufferTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/CircularBufferTest.java
@@ -27,8 +27,8 @@ public class CircularBufferTest {
@Test
public void testPutAndGet() throws Exception {
- int size = 16;
- CircularBuffer buffer = new CircularBuffer(size);
+ final int size = 16;
+ final CircularBuffer buffer = new CircularBuffer(size);
for (int i = 0; i < size / 2; i++) {
buffer.put(i);
}
@@ -45,7 +45,7 @@ public class CircularBufferTest {
@Test
public void testCopy() throws Exception {
- CircularBuffer buffer = new CircularBuffer(16);
+ final CircularBuffer buffer = new CircularBuffer(16);
buffer.put(1);
buffer.put(2);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/EncryptedArchiveTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/EncryptedArchiveTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/EncryptedArchiveTest.java
index cd88db0..8c04c52 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/EncryptedArchiveTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/EncryptedArchiveTest.java
@@ -32,18 +32,18 @@ public class EncryptedArchiveTest {
@Test
public void testReadPasswordEncryptedEntryViaZipFile()
throws IOException {
- File file = getFile("password-encrypted.zip");
+ final File file = getFile("password-encrypted.zip");
ZipFile zf = null;
try {
zf = new ZipFile(file);
- ZipArchiveEntry zae = zf.getEntry("LICENSE.txt");
+ final ZipArchiveEntry zae = zf.getEntry("LICENSE.txt");
assertTrue(zae.getGeneralPurposeBit().usesEncryption());
assertFalse(zae.getGeneralPurposeBit().usesStrongEncryption());
assertFalse(zf.canReadEntryData(zae));
try {
zf.getInputStream(zae);
fail("expected an exception");
- } catch (UnsupportedZipFeatureException ex) {
+ } catch (final UnsupportedZipFeatureException ex) {
assertSame(UnsupportedZipFeatureException.Feature.ENCRYPTION,
ex.getFeature());
}
@@ -55,20 +55,20 @@ public class EncryptedArchiveTest {
@Test
public void testReadPasswordEncryptedEntryViaStream()
throws IOException {
- File file = getFile("password-encrypted.zip");
+ final File file = getFile("password-encrypted.zip");
ZipArchiveInputStream zin = null;
try {
zin = new ZipArchiveInputStream(new FileInputStream(file));
- ZipArchiveEntry zae = zin.getNextZipEntry();
+ final ZipArchiveEntry zae = zin.getNextZipEntry();
assertEquals("LICENSE.txt", zae.getName());
assertTrue(zae.getGeneralPurposeBit().usesEncryption());
assertFalse(zae.getGeneralPurposeBit().usesStrongEncryption());
assertFalse(zin.canReadEntryData(zae));
try {
- byte[] buf = new byte[1024];
+ final byte[] buf = new byte[1024];
zin.read(buf, 0, buf.length);
fail("expected an exception");
- } catch (UnsupportedZipFeatureException ex) {
+ } catch (final UnsupportedZipFeatureException ex) {
assertSame(UnsupportedZipFeatureException.Feature.ENCRYPTION,
ex.getFeature());
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ExplodeSupportTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ExplodeSupportTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ExplodeSupportTest.java
index 3e21be2..5716fd7 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ExplodeSupportTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ExplodeSupportTest.java
@@ -35,14 +35,14 @@ import org.junit.Test;
public class ExplodeSupportTest {
private void testArchiveWithImplodeCompression(final String filename, final String entryName) throws IOException {
- ZipFile zip = new ZipFile(new File(filename));
- ZipArchiveEntry entry = zip.getEntries().nextElement();
+ final ZipFile zip = new ZipFile(new File(filename));
+ final ZipArchiveEntry entry = zip.getEntries().nextElement();
assertEquals("entry name", entryName, entry.getName());
assertTrue("entry can't be read", zip.canReadEntryData(entry));
assertEquals("method", ZipMethod.IMPLODING.getCode(), entry.getMethod());
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- CheckedOutputStream out = new CheckedOutputStream(bout, new CRC32());
+ final ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ final CheckedOutputStream out = new CheckedOutputStream(bout, new CRC32());
IOUtils.copy(zip.getInputStream(entry), out);
out.flush();
@@ -67,16 +67,16 @@ public class ExplodeSupportTest {
}
private void testZipStreamWithImplodeCompression(final String filename, final String entryName) throws IOException {
- ZipArchiveInputStream zin = new ZipArchiveInputStream(new FileInputStream(new File(filename)));
- ZipArchiveEntry entry = zin.getNextZipEntry();
+ final ZipArchiveInputStream zin = new ZipArchiveInputStream(new FileInputStream(new File(filename)));
+ final ZipArchiveEntry entry = zin.getNextZipEntry();
assertEquals("entry name", entryName, entry.getName());
assertTrue("entry can't be read", zin.canReadEntryData(entry));
assertEquals("method", ZipMethod.IMPLODING.getCode(), entry.getMethod());
- InputStream bio = new BoundedInputStream(zin, entry.getSize());
+ final InputStream bio = new BoundedInputStream(zin, entry.getSize());
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- CheckedOutputStream out = new CheckedOutputStream(bout, new CRC32());
+ final ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ final CheckedOutputStream out = new CheckedOutputStream(bout, new CRC32());
IOUtils.copy(bio, out);
out.flush();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtilsTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtilsTest.java
index 0573fa4..afa122e 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtilsTest.java
@@ -53,7 +53,7 @@ public class ExtraFieldUtilsTest implements UnixStat {
dummy.setCentralDirectoryData(new byte[] {0});
aLocal = a.getLocalFileDataData();
- byte[] dummyLocal = dummy.getLocalFileDataData();
+ final byte[] dummyLocal = dummy.getLocalFileDataData();
data = new byte[4 + aLocal.length + 4 + dummyLocal.length];
System.arraycopy(a.getHeaderId().getBytes(), 0, data, 0, 2);
System.arraycopy(a.getLocalFileDataLength().getBytes(), 0, data, 2, 2);
@@ -72,7 +72,7 @@ public class ExtraFieldUtilsTest implements UnixStat {
*/
@Test
public void testParse() throws Exception {
- ZipExtraField[] ze = ExtraFieldUtils.parse(data);
+ final ZipExtraField[] ze = ExtraFieldUtils.parse(data);
assertEquals("number of fields", 2, ze.length);
assertTrue("type field 1", ze[0] instanceof AsiExtraField);
assertEquals("mode field 1", 040755,
@@ -81,12 +81,12 @@ public class ExtraFieldUtilsTest implements UnixStat {
assertEquals("data length field 2", 1,
ze[1].getLocalFileDataLength().getValue());
- byte[] data2 = new byte[data.length-1];
+ final byte[] data2 = new byte[data.length-1];
System.arraycopy(data, 0, data2, 0, data2.length);
try {
ExtraFieldUtils.parse(data2);
fail("data should be invalid");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertEquals("message",
"bad extra field starting at "+(4 + aLocal.length)
+ ". Block length of 1 bytes exceeds remaining data of 0 bytes.",
@@ -107,7 +107,7 @@ public class ExtraFieldUtilsTest implements UnixStat {
assertEquals("data length field 2", 1,
ze[1].getLocalFileDataLength().getValue());
- byte[] data2 = new byte[data.length-1];
+ final byte[] data2 = new byte[data.length-1];
System.arraycopy(data, 0, data2, 0, data2.length);
ze = ExtraFieldUtils.parse(data2, true,
ExtraFieldUtils.UnparseableExtraField.READ);
@@ -138,7 +138,7 @@ public class ExtraFieldUtilsTest implements UnixStat {
assertEquals("data length field 2", 1,
ze[1].getLocalFileDataLength().getValue());
- byte[] data2 = new byte[data.length-1];
+ final byte[] data2 = new byte[data.length-1];
System.arraycopy(data, 0, data2, 0, data2.length);
ze = ExtraFieldUtils.parse(data2, true,
ExtraFieldUtils.UnparseableExtraField.SKIP);
@@ -153,15 +153,15 @@ public class ExtraFieldUtilsTest implements UnixStat {
*/
@Test
public void testMerge() {
- byte[] local =
+ final byte[] local =
ExtraFieldUtils.mergeLocalFileDataData(new ZipExtraField[] {a, dummy});
assertEquals("local length", data.length, local.length);
for (int i=0; i<local.length; i++) {
assertEquals("local byte "+i, data[i], local[i]);
}
- byte[] dummyCentral = dummy.getCentralDirectoryData();
- byte[] data2 = new byte[4 + aLocal.length + 4 + dummyCentral.length];
+ final byte[] dummyCentral = dummy.getCentralDirectoryData();
+ final byte[] data2 = new byte[4 + aLocal.length + 4 + dummyCentral.length];
System.arraycopy(data, 0, data2, 0, 4 + aLocal.length + 2);
System.arraycopy(dummy.getCentralDirectoryLength().getBytes(), 0,
data2, 4+aLocal.length+2, 2);
@@ -169,7 +169,7 @@ public class ExtraFieldUtilsTest implements UnixStat {
4+aLocal.length+4, dummyCentral.length);
- byte[] central =
+ final byte[] central =
ExtraFieldUtils.mergeCentralDirectoryData(new ZipExtraField[] {a, dummy});
assertEquals("central length", data2.length, central.length);
for (int i=0; i<central.length; i++) {
@@ -180,24 +180,24 @@ public class ExtraFieldUtilsTest implements UnixStat {
@Test
public void testMergeWithUnparseableData() throws Exception {
- ZipExtraField d = new UnparseableExtraFieldData();
- byte[] b = UNRECOGNIZED_HEADER.getBytes();
+ final ZipExtraField d = new UnparseableExtraFieldData();
+ final byte[] b = UNRECOGNIZED_HEADER.getBytes();
d.parseFromLocalFileData(new byte[] {b[0], b[1], 1, 0}, 0, 4);
- byte[] local =
+ final byte[] local =
ExtraFieldUtils.mergeLocalFileDataData(new ZipExtraField[] {a, d});
assertEquals("local length", data.length - 1, local.length);
for (int i = 0; i < local.length; i++) {
assertEquals("local byte " + i, data[i], local[i]);
}
- byte[] dCentral = d.getCentralDirectoryData();
- byte[] data2 = new byte[4 + aLocal.length + dCentral.length];
+ final byte[] dCentral = d.getCentralDirectoryData();
+ final byte[] data2 = new byte[4 + aLocal.length + dCentral.length];
System.arraycopy(data, 0, data2, 0, 4 + aLocal.length + 2);
System.arraycopy(dCentral, 0, data2,
4 + aLocal.length, dCentral.length);
- byte[] central =
+ final byte[] central =
ExtraFieldUtils.mergeCentralDirectoryData(new ZipExtraField[] {a, d});
assertEquals("central length", data2.length, central.length);
for (int i = 0; i < central.length; i++) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBitTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBitTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBitTest.java
index 4d62ff0..4fc119a 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBitTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBitTest.java
@@ -33,7 +33,7 @@ public class GeneralPurposeBitTest {
assertFalse(new GeneralPurposeBit().usesUTF8ForNames());
assertFalse(new GeneralPurposeBit().usesEncryption());
assertFalse(new GeneralPurposeBit().usesStrongEncryption());
- byte[] b = new byte[2];
+ final byte[] b = new byte[2];
assertTrue(Arrays.equals(b, new GeneralPurposeBit().encode()));
}
@@ -63,27 +63,27 @@ public class GeneralPurposeBitTest {
@Test
public void testDataDescriptor() {
- byte[] flags = new byte[] {(byte) 8, (byte) 0};
+ final byte[] flags = new byte[] {(byte) 8, (byte) 0};
assertTrue(GeneralPurposeBit.parse(flags, 0).usesDataDescriptor());
- GeneralPurposeBit b = new GeneralPurposeBit();
+ final GeneralPurposeBit b = new GeneralPurposeBit();
b.useDataDescriptor(true);
assertTrue(Arrays.equals(flags, b.encode()));
}
@Test
public void testLanguageEncodingFlag() {
- byte[] flags = new byte[] {(byte) 0, (byte) 8};
+ final byte[] flags = new byte[] {(byte) 0, (byte) 8};
assertTrue(GeneralPurposeBit.parse(flags, 0).usesUTF8ForNames());
- GeneralPurposeBit b = new GeneralPurposeBit();
+ final GeneralPurposeBit b = new GeneralPurposeBit();
b.useUTF8ForNames(true);
assertTrue(Arrays.equals(flags, b.encode()));
}
@Test
public void testEncryption() {
- byte[] flags = new byte[] {(byte) 1, (byte) 0};
+ final byte[] flags = new byte[] {(byte) 1, (byte) 0};
assertTrue(GeneralPurposeBit.parse(flags, 0).usesEncryption());
- GeneralPurposeBit b = new GeneralPurposeBit();
+ final GeneralPurposeBit b = new GeneralPurposeBit();
b.useEncryption(true);
assertTrue(Arrays.equals(flags, b.encode()));
}
@@ -92,7 +92,7 @@ public class GeneralPurposeBitTest {
public void testStrongEncryption() {
byte[] flags = new byte[] {(byte) 65, (byte) 0};
assertTrue(GeneralPurposeBit.parse(flags, 0).usesStrongEncryption());
- GeneralPurposeBit b = new GeneralPurposeBit();
+ final GeneralPurposeBit b = new GeneralPurposeBit();
b.useStrongEncryption(true);
assertTrue(b.usesEncryption());
assertTrue(Arrays.equals(flags, b.encode()));
@@ -103,7 +103,7 @@ public class GeneralPurposeBitTest {
@Test
public void testClone() {
- GeneralPurposeBit b = new GeneralPurposeBit();
+ final GeneralPurposeBit b = new GeneralPurposeBit();
b.useStrongEncryption(true);
b.useUTF8ForNames(true);
assertEquals(b, b.clone());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/Lister.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Lister.java b/src/test/java/org/apache/commons/compress/archivers/zip/Lister.java
index 3e792af..6638648 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/Lister.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/Lister.java
@@ -47,23 +47,23 @@ public final class Lister {
}
public static void main(final String[] args) throws IOException {
- CommandLine cl = parse(args);
- File f = new File(cl.archive);
+ final CommandLine cl = parse(args);
+ final File f = new File(cl.archive);
if (!f.isFile()) {
System.err.println(f + " doesn't exists or is a directory");
usage();
}
if (cl.useStream) {
- BufferedInputStream fs =
+ final BufferedInputStream fs =
new BufferedInputStream(new FileInputStream(f));
try {
- ZipArchiveInputStream zs =
+ final ZipArchiveInputStream zs =
new ZipArchiveInputStream(fs, cl.encoding, true,
cl.allowStoredEntriesWithDataDescriptor);
for (ArchiveEntry entry = zs.getNextEntry();
entry != null;
entry = zs.getNextEntry()) {
- ZipArchiveEntry ze = (ZipArchiveEntry) entry;
+ final ZipArchiveEntry ze = (ZipArchiveEntry) entry;
list(ze);
if (cl.dir != null) {
extract(cl.dir, ze, zs);
@@ -73,14 +73,14 @@ public final class Lister {
fs.close();
}
} else {
- ZipFile zf = new ZipFile(f, cl.encoding);
+ final ZipFile zf = new ZipFile(f, cl.encoding);
try {
- for (Enumeration<ZipArchiveEntry> entries = zf.getEntries();
+ for (final Enumeration<ZipArchiveEntry> entries = zf.getEntries();
entries.hasMoreElements(); ) {
- ZipArchiveEntry ze = entries.nextElement();
+ final ZipArchiveEntry ze = entries.nextElement();
list(ze);
if (cl.dir != null) {
- InputStream is = zf.getInputStream(ze);
+ final InputStream is = zf.getInputStream(ze);
try {
extract(cl.dir, ze, is);
} finally {
@@ -100,7 +100,7 @@ public final class Lister {
private static void extract(final String dir, final ZipArchiveEntry entry,
final InputStream is) throws IOException {
- File f = new File(dir, entry.getName());
+ final File f = new File(dir, entry.getName());
if (!f.getParentFile().exists()) {
f.getParentFile().mkdirs();
}
@@ -116,7 +116,7 @@ public final class Lister {
}
private static CommandLine parse(final String[] args) {
- CommandLine cl = new CommandLine();
+ final CommandLine cl = new CommandLine();
boolean error = false;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-enc")) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
index 3b3f78b..eec6c8e 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
@@ -68,7 +68,7 @@ public class Maven221MultiVolumeTest {
@Test
public void testRead7ZipMultiVolumeArchiveForStream() throws IOException {
- FileInputStream archive =
+ final FileInputStream archive =
new FileInputStream(getFile("apache-maven-2.2.1.zip.001"));
ZipArchiveInputStream zi = null;
try {
@@ -76,14 +76,14 @@ public class Maven221MultiVolumeTest {
// these are the entries that are supposed to be processed
// correctly without any problems
- for (String element : ENTRIES) {
+ for (final String element : ENTRIES) {
assertEquals(element, zi.getNextEntry().getName());
}
// this is the last entry that is truncated
- ArchiveEntry lastEntry = zi.getNextEntry();
+ final ArchiveEntry lastEntry = zi.getNextEntry();
assertEquals(LAST_ENTRY_NAME, lastEntry.getName());
- byte [] buffer = new byte [4096];
+ final byte [] buffer = new byte [4096];
// before the fix, we'd get 0 bytes on this read and all
// subsequent reads thus a client application might enter
@@ -92,7 +92,7 @@ public class Maven221MultiVolumeTest {
try {
while (zi.read(buffer) > 0) { }
fail("shouldn't be able to read from truncated entry");
- } catch (IOException e) {
+ } catch (final IOException e) {
assertEquals("Truncated ZIP file", e.getMessage());
}
@@ -102,7 +102,7 @@ public class Maven221MultiVolumeTest {
zi.getNextEntry();
fail("shouldn't be able to read another entry from truncated"
+ " file");
- } catch (IOException e) {
+ } catch (final IOException e) {
// this is to be expected
}
} finally {
@@ -114,7 +114,7 @@ public class Maven221MultiVolumeTest {
@Test(expected=IOException.class)
public void testRead7ZipMultiVolumeArchiveForFile() throws IOException {
- File file = getFile("apache-maven-2.2.1.zip.001");
+ final File file = getFile("apache-maven-2.2.1.zip.001");
new ZipFile(file);
}
}
[12/46] commons-compress git commit: SVNUID not needed;
class does not implement Serializable
Posted by bo...@apache.org.
SVNUID not needed; class does not implement Serializable
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/4bb50e3a
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/4bb50e3a
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/4bb50e3a
Branch: refs/heads/COMPRESS-207
Commit: 4bb50e3ab552c21f724926306806530b4ae96122
Parents: bda9057
Author: Sebb <se...@apache.org>
Authored: Sat Apr 9 01:28:10 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Sat Apr 9 01:28:10 2016 +0100
----------------------------------------------------------------------
.../commons/compress/archivers/zip/X0014_X509Certificates.java | 1 -
.../commons/compress/archivers/zip/X0015_CertificateIdForFile.java | 1 -
.../archivers/zip/X0016_CertificateIdForCentralDirectory.java | 1 -
.../compress/archivers/zip/X0017_StrongEncryptionHeader.java | 1 -
.../archivers/zip/X0019_EncryptionRecipientCertificateList.java | 1 -
5 files changed, 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/4bb50e3a/src/main/java/org/apache/commons/compress/archivers/zip/X0014_X509Certificates.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0014_X509Certificates.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0014_X509Certificates.java
index 79c3f18..3be7863 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0014_X509Certificates.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0014_X509Certificates.java
@@ -41,7 +41,6 @@ package org.apache.commons.compress.archivers.zip;
* @since 1.11
*/
public class X0014_X509Certificates extends PKWareExtraHeader {
- private static final long serialVersionUID = 1L;
public X0014_X509Certificates() {
super(new ZipShort(0x0014));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/4bb50e3a/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
index 0342dc3..1735bbb 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
@@ -42,7 +42,6 @@ package org.apache.commons.compress.archivers.zip;
* @since 1.11
*/
public class X0015_CertificateIdForFile extends PKWareExtraHeader {
- private static final long serialVersionUID = 1L;
public X0015_CertificateIdForFile() {
super(new ZipShort(0x0015));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/4bb50e3a/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
index 35fe25f8..788491d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
@@ -43,7 +43,6 @@ package org.apache.commons.compress.archivers.zip;
* @since 1.11
*/
public class X0016_CertificateIdForCentralDirectory extends PKWareExtraHeader {
- private static final long serialVersionUID = 1L;
public X0016_CertificateIdForCentralDirectory() {
super(new ZipShort(0x0016));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/4bb50e3a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
index 1d49d50..fb4dfd7 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
@@ -243,7 +243,6 @@ package org.apache.commons.compress.archivers.zip;
* @since 1.11
*/
public class X0017_StrongEncryptionHeader extends PKWareExtraHeader {
- private static final long serialVersionUID = 1L;
public X0017_StrongEncryptionHeader() {
super(new ZipShort(0x0017));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/4bb50e3a/src/main/java/org/apache/commons/compress/archivers/zip/X0019_EncryptionRecipientCertificateList.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0019_EncryptionRecipientCertificateList.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0019_EncryptionRecipientCertificateList.java
index 2218f45..8255079 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0019_EncryptionRecipientCertificateList.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0019_EncryptionRecipientCertificateList.java
@@ -49,7 +49,6 @@ package org.apache.commons.compress.archivers.zip;
* @since 1.11
*/
public class X0019_EncryptionRecipientCertificateList extends PKWareExtraHeader {
- private static final long serialVersionUID = 1L;
public X0019_EncryptionRecipientCertificateList() {
super(new ZipShort(0x0019));
[46/46] commons-compress git commit: Merge branch 'master' into
COMPRESS-207
Posted by bo...@apache.org.
Merge branch 'master' into COMPRESS-207
Conflicts:
src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ffc026d0
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ffc026d0
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ffc026d0
Branch: refs/heads/COMPRESS-207
Commit: ffc026d06b2cafcc77bb426a6a4e7d377afb97aa
Parents: 17501ed 2cc332c
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Apr 10 06:17:28 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Apr 10 06:17:28 2016 +0200
----------------------------------------------------------------------
.gitattributes | 12 +-
RELEASE-NOTES.txt | 74 ++++-
pom.xml | 19 +-
src/changes/changes.xml | 11 +-
.../compress/PasswordRequiredException.java | 2 +-
.../compress/archivers/ArchiveException.java | 4 +-
.../compress/archivers/ArchiveInputStream.java | 10 +-
.../compress/archivers/ArchiveOutputStream.java | 8 +-
.../archivers/ArchiveStreamFactory.java | 37 +--
.../commons/compress/archivers/Lister.java | 6 +-
.../StreamingNotSupportedException.java | 2 +-
.../compress/archivers/ar/ArArchiveEntry.java | 16 +-
.../archivers/ar/ArArchiveInputStream.java | 44 +--
.../archivers/ar/ArArchiveOutputStream.java | 10 +-
.../compress/archivers/arj/ArjArchiveEntry.java | 9 +-
.../archivers/arj/ArjArchiveInputStream.java | 24 +-
.../compress/archivers/arj/LocalFileHeader.java | 2 +-
.../archivers/cpio/CpioArchiveEntry.java | 20 +-
.../archivers/cpio/CpioArchiveInputStream.java | 44 +--
.../archivers/cpio/CpioArchiveOutputStream.java | 26 +-
.../compress/archivers/cpio/CpioUtil.java | 6 +-
.../commons/compress/archivers/dump/Dirent.java | 2 +-
.../archivers/dump/DumpArchiveConstants.java | 12 +-
.../archivers/dump/DumpArchiveEntry.java | 72 ++---
.../archivers/dump/DumpArchiveException.java | 6 +-
.../archivers/dump/DumpArchiveInputStream.java | 51 ++--
.../archivers/dump/DumpArchiveSummary.java | 28 +-
.../archivers/dump/DumpArchiveUtil.java | 20 +-
.../archivers/dump/InvalidFormatException.java | 2 +-
.../archivers/dump/TapeInputStream.java | 32 +-
...nsupportedCompressionAlgorithmException.java | 2 +-
.../compress/archivers/jar/JarArchiveEntry.java | 10 +-
.../archivers/jar/JarArchiveInputStream.java | 4 +-
.../archivers/jar/JarArchiveOutputStream.java | 2 +-
.../archivers/sevenz/AES256SHA256Decoder.java | 27 +-
.../compress/archivers/sevenz/Archive.java | 4 +-
.../BoundedRandomAccessFileInputStream.java | 5 +-
.../commons/compress/archivers/sevenz/CLI.java | 32 +-
.../compress/archivers/sevenz/CoderBase.java | 12 +-
.../compress/archivers/sevenz/Coders.java | 61 ++--
.../compress/archivers/sevenz/DeltaDecoder.java | 14 +-
.../compress/archivers/sevenz/Folder.java | 6 +-
.../compress/archivers/sevenz/LZMA2Decoder.java | 32 +-
.../archivers/sevenz/SevenZArchiveEntry.java | 69 ++---
.../compress/archivers/sevenz/SevenZFile.java | 122 ++++----
.../compress/archivers/sevenz/SevenZMethod.java | 8 +-
.../sevenz/SevenZMethodConfiguration.java | 4 +-
.../archivers/sevenz/SevenZOutputFile.java | 49 +--
.../compress/archivers/tar/TarArchiveEntry.java | 127 ++++----
.../archivers/tar/TarArchiveInputStream.java | 90 +++---
.../archivers/tar/TarArchiveOutputStream.java | 102 +++----
.../archivers/tar/TarArchiveSparseEntry.java | 2 +-
.../compress/archivers/tar/TarUtils.java | 63 ++--
.../zip/AbstractUnicodeExtraField.java | 26 +-
.../compress/archivers/zip/AsiExtraField.java | 47 +--
.../compress/archivers/zip/BinaryTree.java | 38 +--
.../compress/archivers/zip/BitStream.java | 2 +-
.../compress/archivers/zip/CircularBuffer.java | 15 +-
.../archivers/zip/ExplodingInputStream.java | 12 +-
.../compress/archivers/zip/ExtraFieldUtils.java | 66 ++---
.../archivers/zip/FallbackZipEncoding.java | 17 +-
.../archivers/zip/GeneralPurposeBit.java | 20 +-
.../compress/archivers/zip/JarMarker.java | 13 +-
.../compress/archivers/zip/NioZipEncoding.java | 19 +-
.../archivers/zip/PKWareExtraHeader.java | 37 ++-
.../zip/ParallelScatterZipCreator.java | 30 +-
.../archivers/zip/ScatterStatistics.java | 2 +-
.../archivers/zip/ScatterZipOutputStream.java | 25 +-
.../archivers/zip/Simple8BitZipEncoding.java | 48 +--
.../archivers/zip/StreamCompressor.java | 47 +--
.../archivers/zip/UnicodeCommentExtraField.java | 7 +-
.../archivers/zip/UnicodePathExtraField.java | 5 +-
.../zip/UnparseableExtraFieldData.java | 13 +-
.../archivers/zip/UnrecognizedExtraField.java | 23 +-
.../archivers/zip/UnshrinkingInputStream.java | 6 +-
.../zip/UnsupportedZipFeatureException.java | 12 +-
.../compress/archivers/zip/X000A_NTFS.java | 46 +--
.../archivers/zip/X0014_X509Certificates.java | 3 +-
.../zip/X0015_CertificateIdForFile.java | 5 +-
.../X0016_CertificateIdForCentralDirectory.java | 5 +-
.../zip/X0017_StrongEncryptionHeader.java | 27 +-
...0019_EncryptionRecipientCertificateList.java | 3 +-
.../archivers/zip/X5455_ExtendedTimestamp.java | 46 +--
.../compress/archivers/zip/X7875_NewUnix.java | 41 +--
.../zip/Zip64ExtendedInformationExtraField.java | 49 +--
.../archivers/zip/Zip64RequiredException.java | 4 +-
.../compress/archivers/zip/ZipArchiveEntry.java | 101 +++----
.../archivers/zip/ZipArchiveEntryRequest.java | 4 +-
.../archivers/zip/ZipArchiveInputStream.java | 119 ++++----
.../archivers/zip/ZipArchiveOutputStream.java | 186 ++++++------
.../archivers/zip/ZipEightByteInteger.java | 28 +-
.../archivers/zip/ZipEncodingHelper.java | 30 +-
.../commons/compress/archivers/zip/ZipFile.java | 164 +++++-----
.../commons/compress/archivers/zip/ZipLong.java | 22 +-
.../compress/archivers/zip/ZipMethod.java | 8 +-
.../compress/archivers/zip/ZipShort.java | 22 +-
.../commons/compress/archivers/zip/ZipUtil.java | 91 +++---
.../apache/commons/compress/changes/Change.java | 4 +-
.../commons/compress/changes/ChangeSet.java | 23 +-
.../compress/changes/ChangeSetPerformer.java | 48 +--
.../compress/changes/ChangeSetResults.java | 8 +-
.../compressors/CompressorException.java | 4 +-
.../compressors/CompressorInputStream.java | 6 +-
.../compressors/CompressorStreamFactory.java | 12 +-
.../compress/compressors/FileNameUtil.java | 22 +-
.../bzip2/BZip2CompressorInputStream.java | 131 ++++----
.../bzip2/BZip2CompressorOutputStream.java | 38 +--
.../compress/compressors/bzip2/BZip2Utils.java | 8 +-
.../compress/compressors/bzip2/BlockSort.java | 60 ++--
.../commons/compress/compressors/bzip2/CRC.java | 8 +-
.../compress/compressors/bzip2/Rand.java | 2 +-
.../deflate/DeflateCompressorInputStream.java | 16 +-
.../deflate/DeflateCompressorOutputStream.java | 10 +-
.../compressors/deflate/DeflateParameters.java | 4 +-
.../gzip/GzipCompressorInputStream.java | 38 +--
.../gzip/GzipCompressorOutputStream.java | 24 +-
.../compressors/gzip/GzipParameters.java | 10 +-
.../compress/compressors/gzip/GzipUtils.java | 8 +-
.../lzma/LZMACompressorInputStream.java | 12 +-
.../compress/compressors/lzma/LZMAUtils.java | 16 +-
.../compressors/lzw/LZWInputStream.java | 28 +-
.../pack200/Pack200CompressorInputStream.java | 18 +-
.../pack200/Pack200CompressorOutputStream.java | 8 +-
.../compressors/pack200/Pack200Utils.java | 14 +-
.../compressors/pack200/StreamBridge.java | 2 +-
.../FramedSnappyCompressorInputStream.java | 30 +-
.../compressors/snappy/PureJavaCrc32C.java | 14 +-
.../snappy/SnappyCompressorInputStream.java | 20 +-
.../compressors/xz/XZCompressorInputStream.java | 16 +-
.../xz/XZCompressorOutputStream.java | 8 +-
.../compress/compressors/xz/XZUtils.java | 16 +-
.../compressors/z/ZCompressorInputStream.java | 16 +-
.../FileBasedScatterGatherBackingStore.java | 8 +-
.../commons/compress/utils/ArchiveUtils.java | 30 +-
.../commons/compress/utils/BitInputStream.java | 1 +
.../compress/utils/BoundedInputStream.java | 5 +-
.../apache/commons/compress/utils/Charsets.java | 4 +-
.../utils/ChecksumVerifyingInputStream.java | 13 +-
.../compress/utils/CountingInputStream.java | 10 +-
.../compress/utils/CountingOutputStream.java | 8 +-
.../apache/commons/compress/utils/IOUtils.java | 18 +-
src/site/site.xml | 1 +
src/site/xdoc/download_compress.xml | 26 +-
src/site/xdoc/index.xml | 29 +-
.../commons/compress/AbstractTestCase.java | 63 ++--
.../commons/compress/ArchiveReadTest.java | 22 +-
.../commons/compress/ArchiveUtilsTest.java | 14 +-
.../commons/compress/ChainingTestCase.java | 4 +-
.../compress/DetectArchiverTestCase.java | 10 +-
.../apache/commons/compress/IOMethodsTest.java | 52 ++--
.../commons/compress/archivers/ArTestCase.java | 34 +--
.../archivers/ArchiveOutputStreamTest.java | 32 +-
.../archivers/ArchiveStreamFactoryTest.java | 89 +++---
.../compress/archivers/CpioTestCase.java | 36 +--
.../compress/archivers/DumpTestCase.java | 4 +-
.../archivers/ExceptionMessageTest.java | 16 +-
.../commons/compress/archivers/JarTestCase.java | 4 +-
.../compress/archivers/LongPathTest.java | 30 +-
.../compress/archivers/LongSymLinkTest.java | 30 +-
.../compress/archivers/SevenZTestCase.java | 2 +-
.../commons/compress/archivers/TarTestCase.java | 46 +--
.../commons/compress/archivers/ZipTestCase.java | 145 ++++-----
.../archivers/ar/ArArchiveInputStreamTest.java | 8 +-
.../archivers/ar/ArArchiveOutputStreamTest.java | 10 +-
.../arj/ArjArchiveInputStreamTest.java | 18 +-
.../cpio/CpioArchiveInputStreamTest.java | 8 +-
.../cpio/CpioArchiveOutputStreamTest.java | 2 +-
.../archivers/dump/DumpArchiveEntryTest.java | 4 +-
.../dump/DumpArchiveInputStreamTest.java | 16 +-
.../jar/JarArchiveOutputStreamTest.java | 4 +-
.../archivers/memory/MemoryArchiveEntry.java | 4 +
.../memory/MemoryArchiveInputStream.java | 2 +-
.../archivers/sevenz/SevenZFileTest.java | 72 ++---
.../archivers/sevenz/SevenZNativeHeapTest.java | 64 ++++
.../archivers/sevenz/SevenZOutputFileTest.java | 86 +++---
.../compress/archivers/tar/BigFilesIT.java | 12 +-
.../compress/archivers/tar/SparseFilesTest.java | 10 +-
.../archivers/tar/TarArchiveEntryTest.java | 22 +-
.../tar/TarArchiveInputStreamTest.java | 75 ++---
.../tar/TarArchiveOutputStreamTest.java | 296 +++++++++----------
.../compress/archivers/tar/TarLister.java | 10 +-
.../compress/archivers/tar/TarUtilsTest.java | 56 ++--
.../archivers/zip/AsiExtraFieldTest.java | 10 +-
.../compress/archivers/zip/BinaryTreeTest.java | 6 +-
.../compress/archivers/zip/BitStreamTest.java | 10 +-
.../archivers/zip/CircularBufferTest.java | 6 +-
.../archivers/zip/EncryptedArchiveTest.java | 14 +-
.../archivers/zip/ExplodeSupportTest.java | 22 +-
.../archivers/zip/ExtraFieldUtilsTest.java | 32 +-
.../archivers/zip/GeneralPurposeBitTest.java | 18 +-
.../commons/compress/archivers/zip/Lister.java | 32 +-
.../archivers/zip/Maven221MultiVolumeTest.java | 23 +-
.../zip/ParallelScatterZipCreatorTest.java | 53 ++--
.../compress/archivers/zip/ScatterSample.java | 9 +-
.../archivers/zip/ScatterSampleTest.java | 25 +-
.../zip/ScatterZipOutputStreamTest.java | 18 +-
.../archivers/zip/StreamCompressorTest.java | 10 +-
.../archivers/zip/UTF8ZipFilesTest.java | 76 ++---
.../compress/archivers/zip/X000A_NTFSTest.java | 6 +-
.../zip/X5455_ExtendedTimestampTest.java | 58 ++--
.../archivers/zip/X7875_NewUnixTest.java | 14 +-
.../Zip64ExtendedInformationExtraFieldTest.java | 54 ++--
.../compress/archivers/zip/Zip64SupportIT.java | 285 +++++++++---------
.../archivers/zip/ZipArchiveEntryTest.java | 58 ++--
.../zip/ZipArchiveInputStreamTest.java | 22 +-
.../archivers/zip/ZipEightByteIntegerTest.java | 24 +-
.../compress/archivers/zip/ZipEncodingTest.java | 16 +-
.../compress/archivers/zip/ZipFileTest.java | 58 ++--
.../compress/archivers/zip/ZipLongTest.java | 22 +-
.../compress/archivers/zip/ZipShortTest.java | 22 +-
.../compress/archivers/zip/ZipUtilTest.java | 80 ++---
.../compress/changes/ChangeSetTestCase.java | 242 +++++++--------
.../compress/compressors/BZip2TestCase.java | 6 +-
.../compress/compressors/DeflateTestCase.java | 4 +-
.../compressors/DetectCompressorTestCase.java | 28 +-
.../compressors/FramedSnappyTestCase.java | 13 +-
.../compress/compressors/GZipTestCase.java | 60 ++--
.../compress/compressors/LZMATestCase.java | 2 +-
.../compress/compressors/Pack200TestCase.java | 22 +-
.../compress/compressors/XZTestCase.java | 2 +-
.../commons/compress/compressors/ZTestCase.java | 11 +-
.../bzip2/BZip2CompressorInputStreamTest.java | 14 +-
.../compressors/bzip2/BlockSortTest.java | 32 +-
.../bzip2/PythonTruncatedBzip2Test.java | 22 +-
.../DeflateCompressorInputStreamTest.java | 8 +-
.../DeflateCompressorOutputStreamTest.java | 4 +-
.../deflate/DeflateParametersTest.java | 6 +-
.../compressors/lzma/LZMAUtilsTestCase.java | 2 +-
.../compressors/pack200/Pack200UtilsTest.java | 8 +-
.../FramedSnappyCompressorInputStreamTest.java | 22 +-
.../xz/XZCompressorInputStreamTest.java | 2 +-
.../compressors/xz/XZUtilsTestCase.java | 2 +-
.../compress/utils/BitInputStreamTest.java | 24 +-
.../compress/utils/CountingStreamTest.java | 8 +-
.../commons/compress/utils/IOUtilsTest.java | 17 +-
235 files changed, 3583 insertions(+), 3320 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ffc026d0/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ffc026d0/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
----------------------------------------------------------------------
diff --cc src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
index 9c36e81,cb697ab..42f3fac
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
@@@ -177,10 -174,10 +176,10 @@@ public class BZip2CompressorInputStrea
int b;
while (destOffs < hi && ((b = read0()) >= 0)) {
dest[destOffs++] = (byte) b;
- count(1);
}
- int c = (destOffs == offs) ? -1 : (destOffs - offs);
+ final int c = (destOffs == offs) ? -1 : (destOffs - offs);
+ count(c);
return c;
}
@@@ -231,25 -227,17 +230,25 @@@
}
}
+ private int read(InputStream in) throws IOException {
+ int r = in.read();
+ if (r != -1) {
+ compressedBytesRead++;
+ }
+ return r;
+ }
+
- private boolean init(boolean isFirstStream) throws IOException {
+ private boolean init(final boolean isFirstStream) throws IOException {
if (null == in) {
throw new IOException("No InputStream");
}
- int magic0 = read(this.in);
- final int magic0 = this.in.read();
++ final int magic0 = read(this.in);
if (magic0 == -1 && !isFirstStream) {
return false;
}
- int magic1 = read(this.in);
- int magic2 = read(this.in);
- final int magic1 = this.in.read();
- final int magic2 = this.in.read();
++ final int magic1 = read(this.in);
++ final int magic2 = read(this.in);
if (magic0 != 'B' || magic1 != 'Z' || magic2 != 'h') {
throw new IOException(isFirstStream
@@@ -257,7 -245,7 +256,7 @@@
: "Garbage after a valid BZip2 stream");
}
- int blockSize = read(this.in);
- final int blockSize = this.in.read();
++ final int blockSize = read(this.in);
if ((blockSize < '1') || (blockSize > '9')) {
throw new IOException("BZip2 block size is invalid");
}
@@@ -310,25 -298,23 +309,24 @@@
) {
this.currentState = EOF;
throw new IOException("bad block header");
- } else {
- // subtract block start magic bytes from compressedBytesRead
- fireProgress(currentBlock++, currentStream, compressedBytesRead - 6);
- this.storedBlockCRC = bsGetInt();
- this.blockRandomised = bsR(1) == 1;
-
- /**
- * Allocate data here instead in constructor, so we do not allocate
- * it if the input file is empty.
- */
- if (this.data == null) {
- this.data = new Data(this.blockSize100k);
- }
-
- getAndMoveToFrontDecode();
+ }
++ // subtract block start magic bytes from compressedBytesRead
++ fireProgress(currentBlock++, currentStream, compressedBytesRead - 6);
+ this.storedBlockCRC = bsGetInt();
+ this.blockRandomised = bsR(1) == 1;
- this.crc.initialiseCRC();
- this.currentState = START_BLOCK_STATE;
+ /**
+ * Allocate data here instead in constructor, so we do not allocate
+ * it if the input file is empty.
+ */
+ if (this.data == null) {
+ this.data = new Data(this.blockSize100k);
}
+
- // currBlockNo++;
+ getAndMoveToFrontDecode();
+
+ this.crc.initialiseCRC();
+ this.currentState = START_BLOCK_STATE;
}
private void endBlock() throws IOException {
@@@ -389,7 -372,7 +387,7 @@@
if (bsLiveShadow < n) {
final InputStream inShadow = this.in;
do {
- int thech = read(inShadow);
- final int thech = inShadow.read();
++ final int thech = read(inShadow);
if (thech < 0) {
throw new IOException("unexpected end of stream");
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ffc026d0/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java
----------------------------------------------------------------------
[14/46] commons-compress git commit: Not needed
Posted by bo...@apache.org.
Not needed
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/1935e354
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/1935e354
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/1935e354
Branch: refs/heads/COMPRESS-207
Commit: 1935e35490009d8fa1ca62f92a861ef6d958bd5b
Parents: ff0d651
Author: Sebb <se...@apache.org>
Authored: Sat Apr 9 01:32:33 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Sat Apr 9 01:32:33 2016 +0100
----------------------------------------------------------------------
.../compress/archivers/zip/ParallelScatterZipCreatorTest.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/1935e354/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
index e96dc31..63b0acb 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
@@ -40,7 +40,6 @@ import java.util.zip.ZipEntry;
import static org.apache.commons.compress.AbstractTestCase.tryHardToDelete;
import static org.junit.Assert.*;
-@SuppressWarnings("OctalInteger")
public class ParallelScatterZipCreatorTest {
private final int NUMITEMS = 5000;
[02/46] commons-compress git commit: prepare RC1 of Commons Compress
1.11
Posted by bo...@apache.org.
prepare RC1 of Commons Compress 1.11
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ff38bf57
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ff38bf57
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ff38bf57
Branch: refs/heads/COMPRESS-207
Commit: ff38bf57378c7cae8617b3c8df692a5ffbe7b83f
Parents: 21d1f01
Author: Stefan Bodewig <st...@freenet.de>
Authored: Wed Mar 30 15:12:33 2016 +0200
Committer: Stefan Bodewig <st...@freenet.de>
Committed: Wed Mar 30 15:12:33 2016 +0200
----------------------------------------------------------------------
RELEASE-NOTES.txt | 74 ++++++++++++++++++++++++++++++--
pom.xml | 2 +-
src/site/site.xml | 1 +
src/site/xdoc/download_compress.xml | 26 +++++------
src/site/xdoc/index.xml | 29 +++++--------
5 files changed, 96 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ff38bf57/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 3dc65a0..58f3b01 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -5,15 +5,81 @@ compression and archive formats. These include: bzip2, gzip, pack200,
lzma, xz, Snappy, traditional Unix Compress, DEFLATE and ar, cpio,
jar, tar, zip, dump, 7z, arj.
-Release 1.11 (not yet released)
+Release 1.11
------------
-Changes
-o Allow byte-for-byte replication of Zip entries
+New features:
+o TarArchiveInputStream now supports reading global PAX headers.
+ Issue: COMPRESS-347.
+o The PAX headers for sparse entries written by star are now
+ applied.
+ Issue: COMPRESS-346.
+o GNU sparse files using one of the PAX formats are now
+ detected, but cannot be extracted.
+ Issue: COMPRESS-345.
+o New method SevenZFile.getEntries can be used to list the
+ contents of a 7z archive.
+ Issue: COMPRESS-341.
+o When using Zip64Mode.Always also use ZIP64 extensions inside
+ the central directory.
+ GitHub Pull Request #10 Thanks to Matt Hovey.
+o ZipFile.getRawInputStream() is now part of the public API
+ Issue: COMPRESS-323.
+o Allow byte-for-byte replication of Zip entries.
+ GitHub Pull Request #6. Thanks to Jason van Zyl.
o TarArchiveEntry's preserveLeadingSlashes is now a property and used
on later calls to setName, too.
This behavior is a breaking change.
- Issue: COMPRESS-328
+ Issue: COMPRESS-328.
+o Added read-only support for bzip2 compression used inside of
+ ZIP archives.
+ GitHub Pull Request #4. Thanks to Sören Glimm.
+
+Fixed Bugs:
+o ArArchiveInputStream can now read GNU extended names that are
+ terminated with a NUL byte rather than a linefeed.
+ Issue: COMPRESS-344.
+o Native Memory Leak in Sevenz-DeflateDecoder.
+ Issue: COMPRESS-343. Thanks to Rene Preissel.
+o SevenZFile will now only try to drain an entry's content when
+ moving on to the next entry if data is read from the next
+ entry. This should improve performance for applications that
+ try to skip over entries.
+ Issue: COMPRESS-340. Thanks to Dawid Weiss.
+o file names of tar archives using the xstar format are now
+ parsed properly.
+ Issue: COMPRESS-336.
+o checksums of tars that pad the checksum field to the left are
+ now calculated properly.
+ Issue: COMPRESS-335.
+o ArArchiveInputStream failed to read past the first entry when
+ BSD long names have been used.
+ Issue: COMPRESS-334. Thanks to Jeremy Gustie.
+o Added buffering for random access which speeds up 7Z support.
+ Issue: COMPRESS-333. Thanks to Dawid Weiss.
+o The checksum validation of TararchiveEntry is now as strict as
+ the validation of GNU tar, which eliminates a few cases of
+ false positives of ArchiveStreamFactory.
+ This behavior is a breaking change since the check has become
+ more strict but any archive that fails the checksum test now
+ would also fail it when extracted with other tools and must be
+ considered an invalid archive.
+ Issue: COMPRESS-331.
+o SnappyCompressorInputStream and
+ FramedSnappyCompressorInputStream returned 0 at the end of the
+ stream under certain circumstances.
+ Issue: COMPRESS-332.
+o Adjusted unit test to updates in Java8 and later that change
+ the logic of ZipEntry#getTime.
+ Issue: COMPRESS-326.
+o TarArchiveOutputStream will now recognize GNU long name and
+ link entries even if the special entry has a different name
+ than GNU tar uses itself. This seems to be the case for
+ archives created by star.
+ Issue: COMPRESS-324.
+o ArrayIndexOutOfBoundsException when InfoZIP type 7875 extra
+ fields are read from the central directory.
+ Issue: COMPRESS-321.
Release 1.10
------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ff38bf57/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8cba58e..4551aaa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
- <version>1.11-SNAPSHOT</version>
+ <version>1.11</version>
<name>Apache Commons Compress</name>
<url>http://commons.apache.org/proper/commons-compress/</url>
<!-- The description is not indented to make it look better in the release notes -->
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ff38bf57/src/site/site.xml
----------------------------------------------------------------------
diff --git a/src/site/site.xml b/src/site/site.xml
index fb272fe..626d7d3 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -35,6 +35,7 @@
<item name="Download" href="/download_compress.cgi"/>
<item name="Security Reports" href="/security-reports.html"/>
<item name="Wiki" href="http://wiki.apache.org/commons/Compress"/>
+ <item name="Javadoc 1.11" href="javadocs/api-1.11/index.html"/>
<item name="Javadoc 1.10" href="javadocs/api-1.10/index.html"/>
<item name="Javadoc 1.9" href="javadocs/api-1.9/index.html"/>
<item name="Javadoc 1.8.1" href="javadocs/api-1.8.1/index.html"/>
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ff38bf57/src/site/xdoc/download_compress.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/download_compress.xml b/src/site/xdoc/download_compress.xml
index c8cfa4d..4a3b23b 100644
--- a/src/site/xdoc/download_compress.xml
+++ b/src/site/xdoc/download_compress.xml
@@ -95,32 +95,32 @@ limitations under the License.
</p>
</subsection>
</section>
- <section name="Apache Commons Compress 1.10 ">
+ <section name="Apache Commons Compress 1.11 ">
<subsection name="Binaries">
<table>
<tr>
- <td><a href="[preferred]/commons/compress/binaries/commons-compress-1.10-bin.tar.gz">commons-compress-1.10-bin.tar.gz</a></td>
- <td><a href="http://www.apache.org/dist/commons/compress/binaries/commons-compress-1.10-bin.tar.gz.md5">md5</a></td>
- <td><a href="http://www.apache.org/dist/commons/compress/binaries/commons-compress-1.10-bin.tar.gz.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/compress/binaries/commons-compress-1.11-bin.tar.gz">commons-compress-1.11-bin.tar.gz</a></td>
+ <td><a href="https://www.apache.org/dist/commons/compress/binaries/commons-compress-1.11-bin.tar.gz.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/compress/binaries/commons-compress-1.11-bin.tar.gz.asc">pgp</a></td>
</tr>
<tr>
- <td><a href="[preferred]/commons/compress/binaries/commons-compress-1.10-bin.zip">commons-compress-1.10-bin.zip</a></td>
- <td><a href="http://www.apache.org/dist/commons/compress/binaries/commons-compress-1.10-bin.zip.md5">md5</a></td>
- <td><a href="http://www.apache.org/dist/commons/compress/binaries/commons-compress-1.10-bin.zip.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/compress/binaries/commons-compress-1.11-bin.zip">commons-compress-1.11-bin.zip</a></td>
+ <td><a href="https://www.apache.org/dist/commons/compress/binaries/commons-compress-1.11-bin.zip.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/compress/binaries/commons-compress-1.11-bin.zip.asc">pgp</a></td>
</tr>
</table>
</subsection>
<subsection name="Source">
<table>
<tr>
- <td><a href="[preferred]/commons/compress/source/commons-compress-1.10-src.tar.gz">commons-compress-1.10-src.tar.gz</a></td>
- <td><a href="http://www.apache.org/dist/commons/compress/source/commons-compress-1.10-src.tar.gz.md5">md5</a></td>
- <td><a href="http://www.apache.org/dist/commons/compress/source/commons-compress-1.10-src.tar.gz.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/compress/source/commons-compress-1.11-src.tar.gz">commons-compress-1.11-src.tar.gz</a></td>
+ <td><a href="https://www.apache.org/dist/commons/compress/source/commons-compress-1.11-src.tar.gz.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/compress/source/commons-compress-1.11-src.tar.gz.asc">pgp</a></td>
</tr>
<tr>
- <td><a href="[preferred]/commons/compress/source/commons-compress-1.10-src.zip">commons-compress-1.10-src.zip</a></td>
- <td><a href="http://www.apache.org/dist/commons/compress/source/commons-compress-1.10-src.zip.md5">md5</a></td>
- <td><a href="http://www.apache.org/dist/commons/compress/source/commons-compress-1.10-src.zip.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/compress/source/commons-compress-1.11-src.zip">commons-compress-1.11-src.zip</a></td>
+ <td><a href="https://www.apache.org/dist/commons/compress/source/commons-compress-1.11-src.zip.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/compress/source/commons-compress-1.11-src.zip.asc">pgp</a></td>
</tr>
</table>
</subsection>
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ff38bf57/src/site/xdoc/index.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index aded934..3a5bfce 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -51,33 +51,26 @@
</section>
<section name="Status">
- <p>The current release is 1.10 and requires Java 5.</p>
+ <p>The current release is 1.11 and requires Java 5.</p>
<p>Below we highlight some new features, for a full list
of changes see the <a href="changes-report.html">Changes
Report</a>.</p>
- <subsection name="What's new in 1.10?">
+ <subsection name="What's new in 1.11?">
<ul>
- <li>The old
- <code>org.apache.commons.compress.compressors.z._internal_</code>
- now is
- <code>org.apache.commons.compress.compressors.lzw</code>
- and the code is now an official part of Commons
- Compress' API.</li>
- <li>Added support for parallel ZIP compression.</li>
- <li>Added support for raw transfer of entries from one ZIP file to another without uncompress/compress.</li>
- <li>Performance improvements for creating ZIP files with lots of small entries.</li>
- <li>Added auto-detection for LZMA.</li>
+ <li>Added read-only support for BZIP2 compression used
+ inside of ZIP archives.</li>
+ <li>Speed improvements in <code>SevenZFile</code></li>
+ <li>Various fixes and improvements for tar, ar, snappy
+ and zip.</li>
</ul>
</subsection>
- <subsection name="What's coming in 1.11?">
+ <!--subsection name="What's coming in 1.12?">
<ul>
- <li>Added read-only support for BZIP2 compression used
- inside of ZIP archives.</li>
</ul>
- </subsection>
+ </subsection-->
</section>
<section name="Documentation">
@@ -95,14 +88,14 @@
by the <code>java.util.jar</code> package of the Java
class library. XZ and lzma support is provided by the public
domain <a href="http://tukaani.org/xz/java.html">XZ for
- Java</a> library. As of Commons Compress 1.10 support for
+ Java</a> library. As of Commons Compress 1.11 support for
the lzma, Z and Snappy formats is read-only.</p>
<p>The ar, arj, cpio, dump, tar, 7z and zip formats are supported as
archivers where the <a href="zip.html">zip</a>
implementation provides capabilities that go beyond the
features found in java.util.zip. As of Commons Compress
- 1.10 support for the dump and arj formats is
+ 1.11 support for the dump and arj formats is
read-only - 7z can read most compressed and encrypted
archives but only write unencrypted ones. LZMA(2) support
in 7z requires <a href="http://tukaani.org/xz/java.html">XZ for
[34/46] commons-compress git commit: Add final modifier to method
parameters.
Posted by bo...@apache.org.
Add final modifier to method parameters.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/478bef36
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/478bef36
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/478bef36
Branch: refs/heads/COMPRESS-207
Commit: 478bef366f84544eb4ac89553eeb7d57680fc521
Parents: 9cc0604
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 10:06:38 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 10:06:38 2016 -0700
----------------------------------------------------------------------
.../compress/PasswordRequiredException.java | 2 +-
.../compress/archivers/ArchiveException.java | 4 +-
.../compress/archivers/ArchiveInputStream.java | 8 +-
.../compress/archivers/ArchiveOutputStream.java | 8 +-
.../archivers/ArchiveStreamFactory.java | 4 +-
.../commons/compress/archivers/Lister.java | 2 +-
.../StreamingNotSupportedException.java | 2 +-
.../compress/archivers/ar/ArArchiveEntry.java | 10 +-
.../archivers/ar/ArArchiveInputStream.java | 26 ++---
.../archivers/ar/ArArchiveOutputStream.java | 6 +-
.../archivers/arj/ArjArchiveInputStream.java | 8 +-
.../archivers/cpio/CpioArchiveEntry.java | 8 +-
.../archivers/cpio/CpioArchiveInputStream.java | 10 +-
.../archivers/cpio/CpioArchiveOutputStream.java | 8 +-
.../compress/archivers/cpio/CpioUtil.java | 2 +-
.../commons/compress/archivers/dump/Dirent.java | 2 +-
.../archivers/dump/DumpArchiveConstants.java | 8 +-
.../archivers/dump/DumpArchiveEntry.java | 54 +++++-----
.../archivers/dump/DumpArchiveException.java | 6 +-
.../archivers/dump/DumpArchiveInputStream.java | 12 +--
.../archivers/dump/DumpArchiveSummary.java | 26 ++---
.../archivers/dump/DumpArchiveUtil.java | 14 +--
.../archivers/dump/InvalidFormatException.java | 2 +-
.../archivers/dump/TapeInputStream.java | 12 +--
...nsupportedCompressionAlgorithmException.java | 2 +-
.../compress/archivers/jar/JarArchiveEntry.java | 8 +-
.../archivers/jar/JarArchiveInputStream.java | 2 +-
.../archivers/jar/JarArchiveOutputStream.java | 2 +-
.../archivers/sevenz/AES256SHA256Decoder.java | 4 +-
.../compress/archivers/sevenz/Archive.java | 4 +-
.../BoundedRandomAccessFileInputStream.java | 2 +-
.../commons/compress/archivers/sevenz/CLI.java | 12 +--
.../compress/archivers/sevenz/CoderBase.java | 10 +-
.../compress/archivers/sevenz/Coders.java | 38 +++----
.../compress/archivers/sevenz/DeltaDecoder.java | 10 +-
.../compress/archivers/sevenz/Folder.java | 2 +-
.../compress/archivers/sevenz/LZMA2Decoder.java | 16 +--
.../archivers/sevenz/SevenZArchiveEntry.java | 46 ++++-----
.../compress/archivers/sevenz/SevenZFile.java | 14 +--
.../compress/archivers/sevenz/SevenZMethod.java | 4 +-
.../sevenz/SevenZMethodConfiguration.java | 4 +-
.../archivers/sevenz/SevenZOutputFile.java | 12 +--
.../compress/archivers/tar/TarArchiveEntry.java | 80 +++++++--------
.../archivers/tar/TarArchiveInputStream.java | 34 +++----
.../archivers/tar/TarArchiveOutputStream.java | 68 ++++++-------
.../archivers/tar/TarArchiveSparseEntry.java | 2 +-
.../compress/archivers/tar/TarUtils.java | 34 +++----
.../zip/AbstractUnicodeExtraField.java | 14 +--
.../compress/archivers/zip/AsiExtraField.java | 18 ++--
.../compress/archivers/zip/BinaryTree.java | 8 +-
.../compress/archivers/zip/BitStream.java | 2 +-
.../compress/archivers/zip/CircularBuffer.java | 6 +-
.../archivers/zip/ExplodingInputStream.java | 2 +-
.../compress/archivers/zip/ExtraFieldUtils.java | 18 ++--
.../archivers/zip/FallbackZipEncoding.java | 8 +-
.../archivers/zip/GeneralPurposeBit.java | 12 +--
.../compress/archivers/zip/JarMarker.java | 6 +-
.../compress/archivers/zip/NioZipEncoding.java | 8 +-
.../archivers/zip/PKWareExtraHeader.java | 18 ++--
.../zip/ParallelScatterZipCreator.java | 14 +--
.../archivers/zip/ScatterStatistics.java | 2 +-
.../archivers/zip/ScatterZipOutputStream.java | 14 +--
.../archivers/zip/Simple8BitZipEncoding.java | 22 ++--
.../archivers/zip/StreamCompressor.java | 34 +++----
.../archivers/zip/UnicodeCommentExtraField.java | 6 +-
.../archivers/zip/UnicodePathExtraField.java | 4 +-
.../zip/UnparseableExtraFieldData.java | 6 +-
.../archivers/zip/UnrecognizedExtraField.java | 12 +--
.../archivers/zip/UnshrinkingInputStream.java | 4 +-
.../zip/UnsupportedZipFeatureException.java | 12 +--
.../compress/archivers/zip/X000A_NTFS.java | 22 ++--
.../zip/X0015_CertificateIdForFile.java | 2 +-
.../X0016_CertificateIdForCentralDirectory.java | 2 +-
.../zip/X0017_StrongEncryptionHeader.java | 8 +-
.../archivers/zip/X5455_ExtendedTimestamp.java | 20 ++--
.../compress/archivers/zip/X7875_NewUnix.java | 12 +--
.../zip/Zip64ExtendedInformationExtraField.java | 36 +++----
.../archivers/zip/Zip64RequiredException.java | 4 +-
.../compress/archivers/zip/ZipArchiveEntry.java | 54 +++++-----
.../archivers/zip/ZipArchiveEntryRequest.java | 4 +-
.../archivers/zip/ZipArchiveInputStream.java | 48 ++++-----
.../archivers/zip/ZipArchiveOutputStream.java | 102 +++++++++----------
.../archivers/zip/ZipEightByteInteger.java | 22 ++--
.../archivers/zip/ZipEncodingHelper.java | 8 +-
.../commons/compress/archivers/zip/ZipFile.java | 56 +++++-----
.../commons/compress/archivers/zip/ZipLong.java | 18 ++--
.../compress/archivers/zip/ZipMethod.java | 4 +-
.../compress/archivers/zip/ZipShort.java | 16 +--
.../commons/compress/archivers/zip/ZipUtil.java | 42 ++++----
.../apache/commons/compress/changes/Change.java | 4 +-
.../commons/compress/changes/ChangeSet.java | 4 +-
.../compress/changes/ChangeSetPerformer.java | 18 ++--
.../compress/changes/ChangeSetResults.java | 8 +-
.../compressors/CompressorException.java | 4 +-
.../compressors/CompressorInputStream.java | 6 +-
.../compressors/CompressorStreamFactory.java | 4 +-
.../compress/compressors/FileNameUtil.java | 10 +-
.../bzip2/BZip2CompressorInputStream.java | 8 +-
.../bzip2/BZip2CompressorOutputStream.java | 4 +-
.../compress/compressors/bzip2/BZip2Utils.java | 6 +-
.../compress/compressors/bzip2/BlockSort.java | 32 +++---
.../commons/compress/compressors/bzip2/CRC.java | 6 +-
.../compress/compressors/bzip2/Rand.java | 2 +-
.../deflate/DeflateCompressorInputStream.java | 12 +--
.../deflate/DeflateCompressorOutputStream.java | 10 +-
.../compressors/deflate/DeflateParameters.java | 4 +-
.../gzip/GzipCompressorInputStream.java | 16 +--
.../gzip/GzipCompressorOutputStream.java | 12 +--
.../compressors/gzip/GzipParameters.java | 10 +-
.../compress/compressors/gzip/GzipUtils.java | 6 +-
.../lzma/LZMACompressorInputStream.java | 8 +-
.../compress/compressors/lzma/LZMAUtils.java | 10 +-
.../compressors/lzw/LZWInputStream.java | 20 ++--
.../pack200/Pack200CompressorInputStream.java | 10 +-
.../pack200/Pack200CompressorOutputStream.java | 6 +-
.../compressors/pack200/Pack200Utils.java | 8 +-
.../compressors/pack200/StreamBridge.java | 2 +-
.../FramedSnappyCompressorInputStream.java | 8 +-
.../compressors/snappy/PureJavaCrc32C.java | 4 +-
.../snappy/SnappyCompressorInputStream.java | 8 +-
.../compressors/xz/XZCompressorInputStream.java | 12 +--
.../xz/XZCompressorOutputStream.java | 8 +-
.../compress/compressors/xz/XZUtils.java | 10 +-
.../compressors/z/ZCompressorInputStream.java | 6 +-
.../FileBasedScatterGatherBackingStore.java | 4 +-
.../commons/compress/utils/ArchiveUtils.java | 16 +--
.../compress/utils/BoundedInputStream.java | 2 +-
.../apache/commons/compress/utils/Charsets.java | 4 +-
.../utils/ChecksumVerifyingInputStream.java | 6 +-
.../compress/utils/CountingInputStream.java | 6 +-
.../compress/utils/CountingOutputStream.java | 8 +-
.../apache/commons/compress/utils/IOUtils.java | 10 +-
.../commons/compress/AbstractTestCase.java | 26 ++---
.../commons/compress/ArchiveReadTest.java | 6 +-
.../commons/compress/ArchiveUtilsTest.java | 4 +-
.../compress/DetectArchiverTestCase.java | 4 +-
.../apache/commons/compress/IOMethodsTest.java | 4 +-
.../archivers/ArchiveOutputStreamTest.java | 2 +-
.../archivers/ArchiveStreamFactoryTest.java | 14 +--
.../compress/archivers/LongPathTest.java | 6 +-
.../compress/archivers/LongSymLinkTest.java | 6 +-
.../compress/archivers/SevenZTestCase.java | 2 +-
.../commons/compress/archivers/ZipTestCase.java | 12 +--
.../archivers/ar/ArArchiveInputStreamTest.java | 2 +-
.../archivers/sevenz/SevenZFileTest.java | 6 +-
.../archivers/sevenz/SevenZOutputFileTest.java | 28 ++---
.../compress/archivers/tar/BigFilesIT.java | 2 +-
.../compress/archivers/tar/SparseFilesTest.java | 2 +-
.../archivers/tar/TarArchiveEntryTest.java | 6 +-
.../tar/TarArchiveInputStreamTest.java | 4 +-
.../tar/TarArchiveOutputStreamTest.java | 10 +-
.../compress/archivers/tar/TarLister.java | 4 +-
.../compress/archivers/tar/TarUtilsTest.java | 4 +-
.../archivers/zip/ExplodeSupportTest.java | 4 +-
.../commons/compress/archivers/zip/Lister.java | 10 +-
.../zip/ParallelScatterZipCreatorTest.java | 8 +-
.../compress/archivers/zip/ScatterSample.java | 4 +-
.../archivers/zip/ScatterSampleTest.java | 4 +-
.../archivers/zip/UTF8ZipFilesTest.java | 24 ++---
.../zip/X5455_ExtendedTimestampTest.java | 4 +-
.../archivers/zip/X7875_NewUnixTest.java | 2 +-
.../Zip64ExtendedInformationExtraFieldTest.java | 6 +-
.../compress/archivers/zip/Zip64SupportIT.java | 74 +++++++-------
.../compress/archivers/zip/ZipEncodingTest.java | 4 +-
.../compress/archivers/zip/ZipFileTest.java | 6 +-
.../compress/changes/ChangeSetTestCase.java | 4 +-
.../compressors/DetectCompressorTestCase.java | 6 +-
.../compressors/FramedSnappyTestCase.java | 8 +-
.../compress/compressors/GZipTestCase.java | 2 +-
.../compress/compressors/LZMATestCase.java | 2 +-
.../compress/compressors/Pack200TestCase.java | 4 +-
.../commons/compress/compressors/ZTestCase.java | 8 +-
.../compressors/bzip2/BlockSortTest.java | 12 +--
.../bzip2/PythonTruncatedBzip2Test.java | 4 +-
.../FramedSnappyCompressorInputStreamTest.java | 4 +-
.../commons/compress/utils/IOUtilsTest.java | 10 +-
176 files changed, 1057 insertions(+), 1057 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/PasswordRequiredException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/PasswordRequiredException.java b/src/main/java/org/apache/commons/compress/PasswordRequiredException.java
index 2be6f22..d876b96 100644
--- a/src/main/java/org/apache/commons/compress/PasswordRequiredException.java
+++ b/src/main/java/org/apache/commons/compress/PasswordRequiredException.java
@@ -34,7 +34,7 @@ public class PasswordRequiredException extends IOException {
* @param name name of the archive containing encrypted streams or
* the encrypted file.
*/
- public PasswordRequiredException(String name) {
+ public PasswordRequiredException(final String name) {
super("Cannot read encrypted content from " + name + " without a password.");
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/ArchiveException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ArchiveException.java b/src/main/java/org/apache/commons/compress/archivers/ArchiveException.java
index 0c2fce3..4732345 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ArchiveException.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ArchiveException.java
@@ -33,7 +33,7 @@ public class ArchiveException extends Exception {
* @param message
* the detail message
*/
- public ArchiveException(String message) {
+ public ArchiveException(final String message) {
super(message);
}
@@ -45,7 +45,7 @@ public class ArchiveException extends Exception {
* @param cause
* the cause
*/
- public ArchiveException(String message, Exception cause) {
+ public ArchiveException(final String message, final Exception cause) {
super(message);
this.initCause(cause);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
index 4d54c2d..2cd85c7 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
@@ -88,7 +88,7 @@ public abstract class ArchiveInputStream extends InputStream {
*
* @param read the number of bytes read
*/
- protected void count(int read) {
+ protected void count(final int read) {
count((long) read);
}
@@ -99,7 +99,7 @@ public abstract class ArchiveInputStream extends InputStream {
* @param read the number of bytes read
* @since 1.1
*/
- protected void count(long read) {
+ protected void count(final long read) {
if (read != -1) {
bytesRead = bytesRead + read;
}
@@ -111,7 +111,7 @@ public abstract class ArchiveInputStream extends InputStream {
* @param pushedBack the number of bytes pushed back.
* @since 1.1
*/
- protected void pushedBackBytes(long pushedBack) {
+ protected void pushedBackBytes(final long pushedBack) {
bytesRead -= pushedBack;
}
@@ -148,7 +148,7 @@ public abstract class ArchiveInputStream extends InputStream {
*
* @since 1.1
*/
- public boolean canReadEntryData(ArchiveEntry archiveEntry) {
+ public boolean canReadEntryData(final ArchiveEntry archiveEntry) {
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
index e2d325f..9ca9a83 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
@@ -104,7 +104,7 @@ public abstract class ArchiveOutputStream extends OutputStream {
* @throws IOException on error
*/
@Override
- public void write(int b) throws IOException {
+ public void write(final int b) throws IOException {
oneByte[0] = (byte) (b & BYTE_MASK);
write(oneByte, 0, 1);
}
@@ -115,7 +115,7 @@ public abstract class ArchiveOutputStream extends OutputStream {
*
* @param written the number of bytes written
*/
- protected void count(int written) {
+ protected void count(final int written) {
count((long) written);
}
@@ -126,7 +126,7 @@ public abstract class ArchiveOutputStream extends OutputStream {
* @param written the number of bytes written
* @since 1.1
*/
- protected void count(long written) {
+ protected void count(final long written) {
if (written != -1) {
bytesWritten = bytesWritten + written;
}
@@ -163,7 +163,7 @@ public abstract class ArchiveOutputStream extends OutputStream {
* @return This implementation always returns true.
* @since 1.1
*/
- public boolean canWriteEntryData(ArchiveEntry archiveEntry) {
+ public boolean canWriteEntryData(final ArchiveEntry archiveEntry) {
return true;
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java b/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
index b69cada..d5370c4 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
@@ -143,7 +143,7 @@ public class ArchiveStreamFactory {
*
* @since 1.10
*/
- public ArchiveStreamFactory(String encoding) {
+ public ArchiveStreamFactory(final String encoding) {
super();
this.encoding = encoding;
// Also set the original field so can continue to use it.
@@ -171,7 +171,7 @@ public class ArchiveStreamFactory {
* was used to specify the factory encoding.
*/
@Deprecated
- public void setEntryEncoding(String entryEncoding) {
+ public void setEntryEncoding(final String entryEncoding) {
// Note: this does not detect new ArchiveStreamFactory(null) but that does not set the encoding anyway
if (encoding != null) {
throw new IllegalStateException("Cannot overide encoding set by the constructor");
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/Lister.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/Lister.java b/src/main/java/org/apache/commons/compress/archivers/Lister.java
index f2eaeb9..8de2ac9 100644
--- a/src/main/java/org/apache/commons/compress/archivers/Lister.java
+++ b/src/main/java/org/apache/commons/compress/archivers/Lister.java
@@ -34,7 +34,7 @@ import java.io.InputStream;
public final class Lister {
private static final ArchiveStreamFactory factory = new ArchiveStreamFactory();
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
if (args.length == 0) {
usage();
return;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/StreamingNotSupportedException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/StreamingNotSupportedException.java b/src/main/java/org/apache/commons/compress/archivers/StreamingNotSupportedException.java
index 6fd11fd..eff0183 100644
--- a/src/main/java/org/apache/commons/compress/archivers/StreamingNotSupportedException.java
+++ b/src/main/java/org/apache/commons/compress/archivers/StreamingNotSupportedException.java
@@ -34,7 +34,7 @@ public class StreamingNotSupportedException extends ArchiveException {
*
* @param format the format that has been requested/detected.
*/
- public StreamingNotSupportedException(String format) {
+ public StreamingNotSupportedException(final String format) {
super("The " + format + " doesn't support streaming.");
this.format = format;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
index 36a8b40..c7d6f8e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
@@ -81,7 +81,7 @@ public class ArArchiveEntry implements ArchiveEntry {
* @param name name of the entry
* @param length length of the entry in bytes
*/
- public ArArchiveEntry(String name, long length) {
+ public ArArchiveEntry(final String name, final long length) {
this(name, length, 0, 0, DEFAULT_MODE,
System.currentTimeMillis() / 1000);
}
@@ -96,8 +96,8 @@ public class ArArchiveEntry implements ArchiveEntry {
* @param mode file mode
* @param lastModified last modified time in seconds since the epoch
*/
- public ArArchiveEntry(String name, long length, int userId, int groupId,
- int mode, long lastModified) {
+ public ArArchiveEntry(final String name, final long length, final int userId, final int groupId,
+ final int mode, final long lastModified) {
this.name = name;
this.length = length;
this.userId = userId;
@@ -111,7 +111,7 @@ public class ArArchiveEntry implements ArchiveEntry {
* @param inputFile the file to create an entry from
* @param entryName the name of the entry
*/
- public ArArchiveEntry(File inputFile, String entryName) {
+ public ArArchiveEntry(final File inputFile, final String entryName) {
// TODO sort out mode
this(entryName, inputFile.isFile() ? inputFile.length() : 0,
0, 0, DEFAULT_MODE, inputFile.lastModified() / 1000);
@@ -170,7 +170,7 @@ public class ArArchiveEntry implements ArchiveEntry {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
index 6298bc3..665112c 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
@@ -172,7 +172,7 @@ public class ArArchiveInputStream extends ArchiveInputStream {
* @return the extended file name; without trailing "/" if present.
* @throws IOException if name not found or buffer not set up
*/
- private String getExtendedName(int offset) throws IOException{
+ private String getExtendedName(final int offset) throws IOException{
if (namebuffer == null) {
throw new IOException("Cannot process GNU long filename as no // record was found");
}
@@ -186,23 +186,23 @@ public class ArArchiveInputStream extends ArchiveInputStream {
}
throw new IOException("Failed to read entry: "+offset);
}
- private long asLong(byte[] input) {
+ private long asLong(final byte[] input) {
return Long.parseLong(ArchiveUtils.toAsciiString(input).trim());
}
- private int asInt(byte[] input) {
+ private int asInt(final byte[] input) {
return asInt(input, 10, false);
}
- private int asInt(byte[] input, boolean treatBlankAsZero) {
+ private int asInt(final byte[] input, final boolean treatBlankAsZero) {
return asInt(input, 10, treatBlankAsZero);
}
- private int asInt(byte[] input, int base) {
+ private int asInt(final byte[] input, final int base) {
return asInt(input, base, false);
}
- private int asInt(byte[] input, int base, boolean treatBlankAsZero) {
+ private int asInt(final byte[] input, final int base, final boolean treatBlankAsZero) {
String string = ArchiveUtils.toAsciiString(input).trim();
if (string.length() == 0 && treatBlankAsZero) {
return 0;
@@ -241,7 +241,7 @@ public class ArArchiveInputStream extends ArchiveInputStream {
* @see java.io.InputStream#read(byte[], int, int)
*/
@Override
- public int read(byte[] b, final int off, final int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
int toRead = len;
if (currentEntry != null) {
final long entryEnd = entryOffset + currentEntry.getLength();
@@ -267,7 +267,7 @@ public class ArArchiveInputStream extends ArchiveInputStream {
* the number of bytes to check
* @return true, if this stream is an Ar archive stream, false otherwise
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
// 3c21 7261 6863 0a3e
if (length < 8) {
@@ -329,7 +329,7 @@ public class ArArchiveInputStream extends ArchiveInputStream {
*
* @since 1.3
*/
- private static boolean isBSDLongName(String name) {
+ private static boolean isBSDLongName(final String name) {
return name != null && name.matches(BSD_LONGNAME_PATTERN);
}
@@ -341,7 +341,7 @@ public class ArArchiveInputStream extends ArchiveInputStream {
*
* @since 1.3
*/
- private String getBSDLongName(String bsdLongName) throws IOException {
+ private String getBSDLongName(final String bsdLongName) throws IOException {
int nameLen =
Integer.parseInt(bsdLongName.substring(BSD_LONGNAME_PREFIX_LEN));
byte[] name = new byte[nameLen];
@@ -371,7 +371,7 @@ public class ArArchiveInputStream extends ArchiveInputStream {
* characters. Note that the decimal offsets are number of
* characters, not line or string number within the "//" file.</p>
*/
- private static boolean isGNUStringTable(String name) {
+ private static boolean isGNUStringTable(final String name) {
return GNU_STRING_TABLE_NAME.equals(name);
}
@@ -380,7 +380,7 @@ public class ArArchiveInputStream extends ArchiveInputStream {
*
* @see #isGNUStringTable
*/
- private ArArchiveEntry readGNUStringTable(byte[] length) throws IOException {
+ private ArArchiveEntry readGNUStringTable(final byte[] length) throws IOException {
int bufflen = asInt(length); // Assume length will fit in an int
namebuffer = new byte[bufflen];
int read = IOUtils.readFully(this, namebuffer, 0, bufflen);
@@ -399,7 +399,7 @@ public class ArArchiveInputStream extends ArchiveInputStream {
*
* @see #isGNUStringTable
*/
- private boolean isGNULongName(String name) {
+ private boolean isGNULongName(final String name) {
return name != null && name.matches(GNU_LONGNAME_PATTERN);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
index 3a869c4..00583a6 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
@@ -59,7 +59,7 @@ public class ArArchiveOutputStream extends ArchiveOutputStream {
* @param longFileMode the mode to use
* @since 1.3
*/
- public void setLongFileMode(int longFileMode) {
+ public void setLongFileMode(final int longFileMode) {
this.longFileMode = longFileMode;
}
@@ -195,7 +195,7 @@ public class ArArchiveOutputStream extends ArchiveOutputStream {
}
@Override
- public void write(byte[] b, int off, int len) throws IOException {
+ public void write(final byte[] b, final int off, final int len) throws IOException {
out.write(b, off, len);
count(len);
entryOffset += len;
@@ -214,7 +214,7 @@ public class ArArchiveOutputStream extends ArchiveOutputStream {
}
@Override
- public ArchiveEntry createArchiveEntry(File inputFile, String entryName)
+ public ArchiveEntry createArchiveEntry(final File inputFile, final String entryName)
throws IOException {
if(finished) {
throw new IOException("Stream has already been finished");
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
index f049299..db72a98 100644
--- a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
@@ -119,7 +119,7 @@ public class ArjArchiveInputStream extends ArchiveInputStream {
return new String(buffer.toByteArray());
}
- private void readFully(final DataInputStream dataIn, byte[] b)
+ private void readFully(final DataInputStream dataIn, final byte[] b)
throws IOException {
dataIn.readFully(b);
count(b.length);
@@ -266,8 +266,8 @@ public class ArjArchiveInputStream extends ArchiveInputStream {
return localFileHeader;
}
- private void readExtraData(int firstHeaderSize, DataInputStream firstHeader,
- LocalFileHeader localFileHeader) throws IOException {
+ private void readExtraData(final int firstHeaderSize, final DataInputStream firstHeader,
+ final LocalFileHeader localFileHeader) throws IOException {
if (firstHeaderSize >= 33) {
localFileHeader.extendedFilePosition = read32(firstHeader);
if (firstHeaderSize >= 45) {
@@ -335,7 +335,7 @@ public class ArjArchiveInputStream extends ArchiveInputStream {
}
@Override
- public boolean canReadEntryData(ArchiveEntry ae) {
+ public boolean canReadEntryData(final ArchiveEntry ae) {
return ae instanceof ArjArchiveEntry
&& ((ArjArchiveEntry) ae).getMethod() == LocalFileHeader.Methods.STORED;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
index 10d40d2..2b0aa7c 100644
--- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
@@ -309,7 +309,7 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry {
* @param entryName
* The name of this entry.
*/
- public CpioArchiveEntry(File inputFile, String entryName) {
+ public CpioArchiveEntry(final File inputFile, final String entryName) {
this(FORMAT_NEW, inputFile, entryName);
}
@@ -334,8 +334,8 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry {
*
* @since 1.1
*/
- public CpioArchiveEntry(final short format, File inputFile,
- String entryName) {
+ public CpioArchiveEntry(final short format, final File inputFile,
+ final String entryName) {
this(format, entryName, inputFile.isFile() ? inputFile.length() : 0);
if (inputFile.isDirectory()){
setMode(C_ISDIR);
@@ -877,7 +877,7 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry {
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
index 6a9ae98..afc91bb 100644
--- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
@@ -119,7 +119,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
* the platform's default.
* @since 1.6
*/
- public CpioArchiveInputStream(final InputStream in, String encoding) {
+ public CpioArchiveInputStream(final InputStream in, final String encoding) {
this(in, BLOCK_SIZE, encoding);
}
@@ -134,7 +134,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
* The block size of the archive.
* @since 1.5
*/
- public CpioArchiveInputStream(final InputStream in, int blockSize) {
+ public CpioArchiveInputStream(final InputStream in, final int blockSize) {
this(in, blockSize, CharsetNames.US_ASCII);
}
@@ -150,7 +150,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
* the platform's default.
* @since 1.6
*/
- public CpioArchiveInputStream(final InputStream in, int blockSize, String encoding) {
+ public CpioArchiveInputStream(final InputStream in, final int blockSize, final String encoding) {
this.in = in;
this.blockSize = blockSize;
this.encoding = encoding;
@@ -269,7 +269,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
return this.entry;
}
- private void skip(int bytes) throws IOException{
+ private void skip(final int bytes) throws IOException{
// bytes cannot be more than 3 bytes
if (bytes > 0) {
readFully(FOUR_BYTES_BUF, 0, bytes);
@@ -523,7 +523,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
* @param length length of data
* @return whether the buffer seems to contain CPIO data
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < 6) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
index fc829ff..13d4270 100644
--- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
@@ -186,7 +186,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
* the platform's default.
* @since 1.6
*/
- public CpioArchiveOutputStream(final OutputStream out, String encoding) {
+ public CpioArchiveOutputStream(final OutputStream out, final String encoding) {
this(out, FORMAT_NEW, BLOCK_SIZE, encoding);
}
@@ -217,7 +217,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
* @throws ClassCastException if entry is not an instance of CpioArchiveEntry
*/
@Override
- public void putArchiveEntry(ArchiveEntry entry) throws IOException {
+ public void putArchiveEntry(final ArchiveEntry entry) throws IOException {
if(finished) {
throw new IOException("Stream has already been finished");
}
@@ -491,7 +491,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
}
}
- private void pad(int count) throws IOException{
+ private void pad(final int count) throws IOException{
if (count > 0){
byte buff[] = new byte[count];
out.write(buff);
@@ -551,7 +551,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
* @see org.apache.commons.compress.archivers.ArchiveOutputStream#createArchiveEntry(java.io.File, java.lang.String)
*/
@Override
- public ArchiveEntry createArchiveEntry(File inputFile, String entryName)
+ public ArchiveEntry createArchiveEntry(final File inputFile, final String entryName)
throws IOException {
if(finished) {
throw new IOException("Stream has already been finished");
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/cpio/CpioUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioUtil.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioUtil.java
index 26b51fc..efc1584 100644
--- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioUtil.java
+++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioUtil.java
@@ -28,7 +28,7 @@ class CpioUtil {
/**
* Extracts the file type bits from a mode.
*/
- static long fileType(long mode) {
+ static long fileType(final long mode) {
return mode & CpioConstants.S_IFMT;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/dump/Dirent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/Dirent.java b/src/main/java/org/apache/commons/compress/archivers/dump/Dirent.java
index 7979b1d..ff9b53f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/Dirent.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/Dirent.java
@@ -35,7 +35,7 @@ class Dirent {
* @param type
* @param name
*/
- Dirent(int ino, int parentIno, int type, String name) {
+ Dirent(final int ino, final int parentIno, final int type, final String name) {
this.ino = ino;
this.parentIno = parentIno;
this.type = type;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveConstants.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveConstants.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveConstants.java
index 87ca8d9..15738e5 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveConstants.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveConstants.java
@@ -49,11 +49,11 @@ public final class DumpArchiveConstants {
int code;
- private SEGMENT_TYPE(int code) {
+ private SEGMENT_TYPE(final int code) {
this.code = code;
}
- public static SEGMENT_TYPE find(int code) {
+ public static SEGMENT_TYPE find(final int code) {
for (SEGMENT_TYPE t : values()) {
if (t.code == code) {
return t;
@@ -74,11 +74,11 @@ public final class DumpArchiveConstants {
int code;
- private COMPRESSION_TYPE(int code) {
+ private COMPRESSION_TYPE(final int code) {
this.code = code;
}
- public static COMPRESSION_TYPE find(int code) {
+ public static COMPRESSION_TYPE find(final int code) {
for (COMPRESSION_TYPE t : values()) {
if (t.code == code) {
return t;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/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 0a3d546..43fecde 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
@@ -219,7 +219,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* @param name pathname
* @param simpleName actual filename.
*/
- public DumpArchiveEntry(String name, String simpleName) {
+ public DumpArchiveEntry(final String name, final String simpleName) {
setName(name);
this.simpleName = simpleName;
}
@@ -232,8 +232,8 @@ public class DumpArchiveEntry implements ArchiveEntry {
* @param ino the ino
* @param type the type
*/
- protected DumpArchiveEntry(String name, String simpleName, int ino,
- TYPE type) {
+ protected DumpArchiveEntry(final String name, final String simpleName, final int ino,
+ final TYPE type) {
setType(type);
setName(name);
this.simpleName = simpleName;
@@ -253,7 +253,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Sets the path of the entry.
* @param simpleName the simple name
*/
- protected void setSimpleName(String simpleName) {
+ protected void setSimpleName(final String simpleName) {
this.simpleName = simpleName;
}
@@ -277,7 +277,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the number of hard links.
* @param nlink the number of hard links
*/
- public void setNlink(int nlink) {
+ public void setNlink(final int nlink) {
this.nlink = nlink;
}
@@ -293,7 +293,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the file creation time.
* @param ctime the creation time
*/
- public void setCreationTime(Date ctime) {
+ public void setCreationTime(final Date ctime) {
this.ctime = ctime.getTime();
}
@@ -309,7 +309,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the generation of the file.
* @param generation the generation
*/
- public void setGeneration(int generation) {
+ public void setGeneration(final int generation) {
this.generation = generation;
}
@@ -325,7 +325,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set whether this file has been deleted.
* @param isDeleted whether the file has been deleted
*/
- public void setDeleted(boolean isDeleted) {
+ public void setDeleted(final boolean isDeleted) {
this.isDeleted = isDeleted;
}
@@ -341,7 +341,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the offset within the archive.
* @param offset the offset
*/
- public void setOffset(long offset) {
+ public void setOffset(final long offset) {
this.offset = offset;
}
@@ -357,7 +357,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the tape volume.
* @param volume the volume
*/
- public void setVolume(int volume) {
+ public void setVolume(final int volume) {
this.volume = volume;
}
@@ -390,7 +390,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* @param idx index of the record to check
* @return whether this is a sparse record
*/
- public boolean isSparseRecord(int idx) {
+ public boolean isSparseRecord(final int idx) {
return (header.getCdata(idx) & 0x01) == 0;
}
@@ -400,7 +400,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (o == null || !o.getClass().equals(getClass())) {
@@ -436,7 +436,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
*
* @param buffer buffer to read content from
*/
- static DumpArchiveEntry parse(byte[] buffer) {
+ static DumpArchiveEntry parse(final byte[] buffer) {
DumpArchiveEntry entry = new DumpArchiveEntry();
TapeSegmentHeader header = entry.header;
@@ -503,7 +503,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
/**
* Update entry with information from next tape segment header.
*/
- void update(byte[] buffer) {
+ void update(final byte[] buffer) {
header.volume = DumpArchiveUtil.convert32(buffer, 16);
header.count = DumpArchiveUtil.convert32(buffer, 160);
@@ -542,7 +542,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
return ino;
}
- void setIno(int ino) {
+ void setIno(final int ino) {
this.ino = ino;
}
@@ -554,7 +554,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
return holes;
}
- public int getCdata(int idx) {
+ public int getCdata(final int idx) {
return cdata[idx];
}
}
@@ -663,7 +663,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the type of the entry.
* @param type the type
*/
- public void setType(TYPE type) {
+ public void setType(final TYPE type) {
this.type = type;
}
@@ -679,7 +679,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the access permissions on the entry.
* @param mode the access permissions
*/
- public void setMode(int mode) {
+ public void setMode(final int mode) {
this.mode = mode & 07777;
this.permissions = PERMISSION.find(mode);
}
@@ -712,7 +712,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the size of the entry.
* @param size the size
*/
- public void setSize(long size) {
+ public void setSize(final long size) {
this.size = size;
}
@@ -720,7 +720,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the time the file was last modified.
* @param mtime the last modified time
*/
- public void setLastModifiedDate(Date mtime) {
+ public void setLastModifiedDate(final Date mtime) {
this.mtime = mtime.getTime();
}
@@ -736,7 +736,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the time the file was last accessed.
* @param atime the access time
*/
- public void setAccessTime(Date atime) {
+ public void setAccessTime(final Date atime) {
this.atime = atime.getTime();
}
@@ -752,7 +752,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the user id.
* @param uid the user id
*/
- public void setUserId(int uid) {
+ public void setUserId(final int uid) {
this.uid = uid;
}
@@ -768,7 +768,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
* Set the group id.
* @param gid the group id
*/
- public void setGroupId(int gid) {
+ public void setGroupId(final int gid) {
this.gid = gid;
}
@@ -785,11 +785,11 @@ public class DumpArchiveEntry implements ArchiveEntry {
private int code;
- private TYPE(int code) {
+ private TYPE(final int code) {
this.code = code;
}
- public static TYPE find(int code) {
+ public static TYPE find(final int code) {
TYPE type = UNKNOWN;
for (TYPE t : TYPE.values()) {
@@ -818,11 +818,11 @@ public class DumpArchiveEntry implements ArchiveEntry {
private int code;
- private PERMISSION(int code) {
+ private PERMISSION(final int code) {
this.code = code;
}
- public static Set<PERMISSION> find(int code) {
+ public static Set<PERMISSION> find(final int code) {
Set<PERMISSION> set = new HashSet<PERMISSION>();
for (PERMISSION p : PERMISSION.values()) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveException.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveException.java
index 8e6a993..635b1d9 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveException.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveException.java
@@ -30,15 +30,15 @@ public class DumpArchiveException extends IOException {
public DumpArchiveException() {
}
- public DumpArchiveException(String msg) {
+ public DumpArchiveException(final String msg) {
super(msg);
}
- public DumpArchiveException(Throwable cause) {
+ public DumpArchiveException(final Throwable cause) {
initCause(cause);
}
- public DumpArchiveException(String msg, Throwable cause) {
+ public DumpArchiveException(final String msg, final Throwable cause) {
super(msg);
initCause(cause);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
index 1b4ac3f..3083678 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
@@ -86,7 +86,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
* @param is stream to read from
* @throws ArchiveException on error
*/
- public DumpArchiveInputStream(InputStream is) throws ArchiveException {
+ public DumpArchiveInputStream(final InputStream is) throws ArchiveException {
this(is, null);
}
@@ -99,7 +99,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
* @since 1.6
* @throws ArchiveException on error
*/
- public DumpArchiveInputStream(InputStream is, String encoding)
+ public DumpArchiveInputStream(final InputStream is, final String encoding)
throws ArchiveException {
this.raw = new TapeInputStream(is);
this.hasHitEOF = false;
@@ -139,7 +139,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
queue = new PriorityQueue<DumpArchiveEntry>(10,
new Comparator<DumpArchiveEntry>() {
@Override
- public int compare(DumpArchiveEntry p, DumpArchiveEntry q) {
+ public int compare(final DumpArchiveEntry p, final DumpArchiveEntry q) {
if (p.getOriginalName() == null || q.getOriginalName() == null) {
return Integer.MAX_VALUE;
}
@@ -412,7 +412,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
* @param entry
* @return full path for specified archive entry, or null if there's a gap.
*/
- private String getPath(DumpArchiveEntry entry) {
+ private String getPath(final DumpArchiveEntry entry) {
// build the stack of elements. It's possible that we're
// still missing an intermediate value and if so we
Stack<String> elements = new Stack<String>();
@@ -464,7 +464,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
* @throws IOException on error
*/
@Override
- public int read(byte[] buf, int off, int len) throws IOException {
+ public int read(final byte[] buf, int off, int len) throws IOException {
int totalRead = 0;
if (hasHitEOF || isClosed || entryOffset >= entrySize) {
@@ -542,7 +542,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
* @param length length of data
* @return whether the buffer seems to contain dump data
*/
- public static boolean matches(byte[] buffer, int length) {
+ public static boolean matches(final byte[] buffer, final int length) {
// do we have enough of the header?
if (length < 32) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java
index a030e00..6813608 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java
@@ -43,7 +43,7 @@ public class DumpArchiveSummary {
private int firstrec;
private int ntrec;
- DumpArchiveSummary(byte[] buffer, ZipEncoding encoding) throws IOException {
+ DumpArchiveSummary(final byte[] buffer, final ZipEncoding encoding) throws IOException {
dumpDate = 1000L * DumpArchiveUtil.convert32(buffer, 4);
previousDumpDate = 1000L * DumpArchiveUtil.convert32(buffer, 8);
volume = DumpArchiveUtil.convert32(buffer, 12);
@@ -71,7 +71,7 @@ public class DumpArchiveSummary {
* Set dump date.
* @param dumpDate the dump date
*/
- public void setDumpDate(Date dumpDate) {
+ public void setDumpDate(final Date dumpDate) {
this.dumpDate = dumpDate.getTime();
}
@@ -87,7 +87,7 @@ public class DumpArchiveSummary {
* Set previous dump date.
* @param previousDumpDate the previous dump dat
*/
- public void setPreviousDumpDate(Date previousDumpDate) {
+ public void setPreviousDumpDate(final Date previousDumpDate) {
this.previousDumpDate = previousDumpDate.getTime();
}
@@ -103,7 +103,7 @@ public class DumpArchiveSummary {
* Set volume (tape) number.
* @param volume the volume number
*/
- public void setVolume(int volume) {
+ public void setVolume(final int volume) {
this.volume = volume;
}
@@ -123,7 +123,7 @@ public class DumpArchiveSummary {
* Set level.
* @param level the level
*/
- public void setLevel(int level) {
+ public void setLevel(final int level) {
this.level = level;
}
@@ -140,7 +140,7 @@ public class DumpArchiveSummary {
* Set dump label.
* @param label the label
*/
- public void setLabel(String label) {
+ public void setLabel(final String label) {
this.label = label;
}
@@ -156,7 +156,7 @@ public class DumpArchiveSummary {
* Set the last mountpoint.
* @param filesystem the last mountpoint
*/
- public void setFilesystem(String filesystem) {
+ public void setFilesystem(final String filesystem) {
this.filesys = filesystem;
}
@@ -172,7 +172,7 @@ public class DumpArchiveSummary {
* Set the device name.
* @param devname the device name
*/
- public void setDevname(String devname) {
+ public void setDevname(final String devname) {
this.devname = devname;
}
@@ -188,7 +188,7 @@ public class DumpArchiveSummary {
* Set the hostname.
* @param hostname the host name
*/
- public void setHostname(String hostname) {
+ public void setHostname(final String hostname) {
this.hostname = hostname;
}
@@ -204,7 +204,7 @@ public class DumpArchiveSummary {
* Set the miscellaneous flags.
* @param flags flags
*/
- public void setFlags(int flags) {
+ public void setFlags(final int flags) {
this.flags = flags;
}
@@ -220,7 +220,7 @@ public class DumpArchiveSummary {
* Set the inode of the first record.
* @param firstrec the first record
*/
- public void setFirstRecord(int firstrec) {
+ public void setFirstRecord(final int firstrec) {
this.firstrec = firstrec;
}
@@ -237,7 +237,7 @@ public class DumpArchiveSummary {
* Set the number of records per tape block.
* @param ntrec the number of records per tape block
*/
- public void setNTRec(int ntrec) {
+ public void setNTRec(final int ntrec) {
this.ntrec = ntrec;
}
@@ -307,7 +307,7 @@ public class DumpArchiveSummary {
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
index 5b74944..315064a 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
@@ -37,7 +37,7 @@ class DumpArchiveUtil {
* @param buffer buffer containing tape segment header
* @returns checksum
*/
- public static int calculateChecksum(byte[] buffer) {
+ public static int calculateChecksum(final byte[] buffer) {
int calc = 0;
for (int i = 0; i < 256; i++) {
@@ -53,7 +53,7 @@ class DumpArchiveUtil {
*
* @param buffer
*/
- public static final boolean verify(byte[] buffer) {
+ public static final boolean verify(final byte[] buffer) {
// verify magic. for now only accept NFS_MAGIC.
int magic = convert32(buffer, 24);
@@ -76,7 +76,7 @@ class DumpArchiveUtil {
*
* @param buffer
*/
- public static final int getIno(byte[] buffer) {
+ public static final int getIno(final byte[] buffer) {
return convert32(buffer, 20);
}
@@ -87,7 +87,7 @@ class DumpArchiveUtil {
* @param offset
* @return the 8-byte entry as a long
*/
- public static final long convert64(byte[] buffer, int offset) {
+ public static final long convert64(final byte[] buffer, final int offset) {
long i = 0;
i += (((long) buffer[offset + 7]) << 56);
i += (((long) buffer[offset + 6] << 48) & 0x00FF000000000000L);
@@ -108,7 +108,7 @@ class DumpArchiveUtil {
* @param offset
* @return the 4-byte entry as an int
*/
- public static final int convert32(byte[] buffer, int offset) {
+ public static final int convert32(final byte[] buffer, final int offset) {
int i = 0;
i = buffer[offset + 3] << 24;
i += (buffer[offset + 2] << 16) & 0x00FF0000;
@@ -125,7 +125,7 @@ class DumpArchiveUtil {
* @param offset
* @return the 2-byte entry as an int
*/
- public static final int convert16(byte[] buffer, int offset) {
+ public static final int convert16(final byte[] buffer, final int offset) {
int i = 0;
i += (buffer[offset + 1] << 8) & 0x0000FF00;
i += buffer[offset] & 0x000000FF;
@@ -136,7 +136,7 @@ class DumpArchiveUtil {
/**
* Decodes a byte array to a string.
*/
- static String decode(ZipEncoding encoding, byte[] b, int offset, int len)
+ static String decode(final ZipEncoding encoding, final byte[] b, final int offset, final int len)
throws IOException {
byte[] copy = new byte[len];
System.arraycopy(b, offset, copy, 0, len);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/dump/InvalidFormatException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/InvalidFormatException.java b/src/main/java/org/apache/commons/compress/archivers/dump/InvalidFormatException.java
index 2d8a9ac..6169dfe 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/InvalidFormatException.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/InvalidFormatException.java
@@ -31,7 +31,7 @@ public class InvalidFormatException extends DumpArchiveException {
super("there was an error decoding a tape segment");
}
- public InvalidFormatException(long offset) {
+ public InvalidFormatException(final long offset) {
super("there was an error decoding a tape segment header at offset " +
offset + ".");
this.offset = offset;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/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 3534805..9a0b098 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
@@ -46,7 +46,7 @@ class TapeInputStream extends FilterInputStream {
/**
* Constructor
*/
- public TapeInputStream(InputStream in) {
+ public TapeInputStream(final InputStream in) {
super(in);
}
@@ -64,7 +64,7 @@ class TapeInputStream extends FilterInputStream {
* @throws IOException
* there was an error reading additional blocks.
*/
- public void resetBlockSize(int recsPerBlock, boolean isCompressed)
+ public void resetBlockSize(final int recsPerBlock, final boolean isCompressed)
throws IOException {
this.isCompressed = isCompressed;
@@ -113,7 +113,7 @@ class TapeInputStream extends FilterInputStream {
* record size
*/
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, int off, final int len) throws IOException {
if ((len % recordSize) != 0) {
throw new IllegalArgumentException(
"all reads must be multiple of record size (" + recordSize +
@@ -159,7 +159,7 @@ class TapeInputStream extends FilterInputStream {
* record size
*/
@Override
- public long skip(long len) throws IOException {
+ public long skip(final long len) throws IOException {
if ((len % recordSize) != 0) {
throw new IllegalArgumentException(
"all reads must be multiple of record size (" + recordSize +
@@ -254,7 +254,7 @@ class TapeInputStream extends FilterInputStream {
* This is an optimization for longer seeks.
* @return false if End-Of-File, else true
*/
- private boolean readBlock(boolean decompress) throws IOException {
+ private boolean readBlock(final boolean decompress) throws IOException {
boolean success = true;
if (in == null) {
@@ -334,7 +334,7 @@ class TapeInputStream extends FilterInputStream {
/**
* Read buffer
*/
- private boolean readFully(byte[] b, int off, int len)
+ private boolean readFully(final byte[] b, final int off, final int len)
throws IOException {
int count = IOUtils.readFully(in, b, off, len);
if (count < len) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/dump/UnsupportedCompressionAlgorithmException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/UnsupportedCompressionAlgorithmException.java b/src/main/java/org/apache/commons/compress/archivers/dump/UnsupportedCompressionAlgorithmException.java
index 3160feb..8c60403 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/UnsupportedCompressionAlgorithmException.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/UnsupportedCompressionAlgorithmException.java
@@ -31,7 +31,7 @@ public class UnsupportedCompressionAlgorithmException
super("this file uses an unsupported compression algorithm.");
}
- public UnsupportedCompressionAlgorithmException(String alg) {
+ public UnsupportedCompressionAlgorithmException(final String alg) {
super("this file uses an unsupported compression algorithm: " + alg +
".");
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/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 d284ad9..5974dce 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
@@ -36,19 +36,19 @@ public class JarArchiveEntry extends ZipArchiveEntry {
private final Attributes manifestAttributes = null;
private final Certificate[] certificates = null;
- public JarArchiveEntry(ZipEntry entry) throws ZipException {
+ public JarArchiveEntry(final ZipEntry entry) throws ZipException {
super(entry);
}
- public JarArchiveEntry(String name) {
+ public JarArchiveEntry(final String name) {
super(name);
}
- public JarArchiveEntry(ZipArchiveEntry entry) throws ZipException {
+ public JarArchiveEntry(final ZipArchiveEntry entry) throws ZipException {
super(entry);
}
- public JarArchiveEntry(JarEntry entry) throws ZipException {
+ public JarArchiveEntry(final JarEntry entry) throws ZipException {
super(entry);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
index 1ebac2f..6ed5249 100644
--- a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
@@ -72,7 +72,7 @@ public class JarArchiveInputStream extends ZipArchiveInputStream {
* the number of bytes to check
* @return true, if this stream is a jar archive stream, false otherwise
*/
- public static boolean matches(byte[] signature, int length ) {
+ public static boolean matches(final byte[] signature, final int length ) {
return ZipArchiveInputStream.matches(signature, length);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java
index 96d0fbf..8bbe890 100644
--- a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java
@@ -55,7 +55,7 @@ public class JarArchiveOutputStream extends ZipArchiveOutputStream {
// @throws ClassCastException if entry is not an instance of ZipArchiveEntry
@Override
- public void putArchiveEntry(ArchiveEntry ze) throws IOException {
+ public void putArchiveEntry(final ArchiveEntry ze) throws IOException {
if (!jarMarkerAdded) {
((ZipArchiveEntry)ze).addAsFirstExtraField(JarMarker.getInstance());
jarMarkerAdded = true;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
index e2ed5c2..f2840db 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
@@ -31,7 +31,7 @@ import org.apache.commons.compress.PasswordRequiredException;
class AES256SHA256Decoder extends CoderBase {
@Override
- InputStream decode(final String archiveName, final InputStream in, long uncompressedLength,
+ InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
final Coder coder, final byte[] passwordBytes) throws IOException {
return new InputStream() {
private boolean isInitialized = false;
@@ -115,7 +115,7 @@ class AES256SHA256Decoder extends CoderBase {
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
return init().read(b, off, len);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/Archive.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/Archive.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/Archive.java
index 132ba70..71288b0 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/Archive.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/Archive.java
@@ -45,11 +45,11 @@ class Archive {
+ " files and " + streamMap;
}
- private static String lengthOf(long[] a) {
+ private static String lengthOf(final long[] a) {
return a == null ? "(null)" : String.valueOf(a.length);
}
- private static String lengthOf(Object[] a) {
+ private static String lengthOf(final Object[] a) {
return a == null ? "(null)" : String.valueOf(a.length);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedRandomAccessFileInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedRandomAccessFileInputStream.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedRandomAccessFileInputStream.java
index 63cf4bb..c6cf743 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedRandomAccessFileInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedRandomAccessFileInputStream.java
@@ -41,7 +41,7 @@ class BoundedRandomAccessFileInputStream extends InputStream {
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
if (bytesRemaining == 0) {
return -1;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/CLI.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/CLI.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/CLI.java
index 95a9d41..4606f0c 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/CLI.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/CLI.java
@@ -28,7 +28,7 @@ public class CLI {
private static enum Mode {
LIST("Analysing") {
@Override
- public void takeAction(SevenZFile archive, SevenZArchiveEntry entry) {
+ public void takeAction(final SevenZFile archive, final SevenZArchiveEntry entry) {
System.out.print(entry.getName());
if (entry.isDirectory()) {
System.out.print(" dir");
@@ -48,7 +48,7 @@ public class CLI {
}
}
- private String getContentMethods(SevenZArchiveEntry entry) {
+ private String getContentMethods(final SevenZArchiveEntry entry) {
StringBuilder sb = new StringBuilder();
boolean first = true;
for (SevenZMethodConfiguration m : entry.getContentMethods()) {
@@ -66,7 +66,7 @@ public class CLI {
},
EXTRACT("Extracting") {
@Override
- public void takeAction(SevenZFile archive, SevenZArchiveEntry entry)
+ public void takeAction(final SevenZFile archive, final SevenZArchiveEntry entry)
throws IOException {
File outFile = new File(entry.getName());
if (entry.isDirectory()) {
@@ -106,7 +106,7 @@ public class CLI {
};
private final String message;
- private Mode(String message) {
+ private Mode(final String message) {
this.message = message;
}
public String getMessage() {
@@ -116,7 +116,7 @@ public class CLI {
throws IOException;
}
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
if (args.length == 0) {
usage();
return;
@@ -142,7 +142,7 @@ public class CLI {
System.out.println("Parameters: archive-name [list|extract]");
}
- private static Mode grabMode(String[] args) {
+ private static Mode grabMode(final String[] args) {
if (args.length < 2) {
return Mode.LIST;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
index 286cc03..fffef1d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
@@ -31,14 +31,14 @@ abstract class CoderBase {
/**
* @param acceptableOptions types that can be used as options for this codec.
*/
- protected CoderBase(Class<?>... acceptableOptions) {
+ protected CoderBase(final Class<?>... acceptableOptions) {
this.acceptableOptions = acceptableOptions;
}
/**
* @return whether this method can extract options from the given object.
*/
- boolean canAcceptOptions(Object opts) {
+ boolean canAcceptOptions(final Object opts) {
for (Class<?> c : acceptableOptions) {
if (c.isInstance(opts)) {
return true;
@@ -50,14 +50,14 @@ abstract class CoderBase {
/**
* @return property-bytes to write in a Folder block
*/
- byte[] getOptionsAsProperties(Object options) {
+ byte[] getOptionsAsProperties(final Object options) {
return NONE;
}
/**
* @return configuration options that have been used to create the given InputStream from the given Coder
*/
- Object getOptionsFromCoder(Coder coder, InputStream in) {
+ Object getOptionsFromCoder(final Coder coder, final InputStream in) {
return null;
}
@@ -79,7 +79,7 @@ abstract class CoderBase {
* If the option represents a number, return its integer
* value, otherwise return the given default value.
*/
- protected static int numberOptionOrDefault(Object options, int defaultValue) {
+ protected static int numberOptionOrDefault(final Object options, final int defaultValue) {
return options instanceof Number ? ((Number) options).intValue() : defaultValue;
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
index 06802e4..fe9e7dd 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
@@ -63,11 +63,11 @@ class Coders {
put(SevenZMethod.DELTA_FILTER, new DeltaDecoder());
}};
- static CoderBase findByMethod(SevenZMethod method) {
+ static CoderBase findByMethod(final SevenZMethod method) {
return CODER_MAP.get(method);
}
- static InputStream addDecoder(final String archiveName, final InputStream is, long uncompressedLength,
+ static InputStream addDecoder(final String archiveName, final InputStream is, final long uncompressedLength,
final Coder coder, final byte[] password) throws IOException {
CoderBase cb = findByMethod(SevenZMethod.byId(coder.decompressionMethodId));
if (cb == null) {
@@ -79,7 +79,7 @@ class Coders {
}
static OutputStream addEncoder(final OutputStream out, final SevenZMethod method,
- Object options) throws IOException {
+ final Object options) throws IOException {
CoderBase cb = findByMethod(method);
if (cb == null) {
throw new IOException("Unsupported compression method " + method);
@@ -89,8 +89,8 @@ class Coders {
static class CopyDecoder extends CoderBase {
@Override
- InputStream decode(final String archiveName, final InputStream in, long uncompressedLength,
- final Coder coder, byte[] password) throws IOException {
+ InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
+ final Coder coder, final byte[] password) throws IOException {
return in;
}
@Override
@@ -101,8 +101,8 @@ class Coders {
static class LZMADecoder extends CoderBase {
@Override
- InputStream decode(final String archiveName, final InputStream in, long uncompressedLength,
- final Coder coder, byte[] password) throws IOException {
+ InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
+ final Coder coder, final byte[] password) throws IOException {
byte propsByte = coder.properties[0];
long dictSize = coder.properties[1];
for (int i = 1; i < 4; i++) {
@@ -117,13 +117,13 @@ class Coders {
static class BCJDecoder extends CoderBase {
private final FilterOptions opts;
- BCJDecoder(FilterOptions opts) {
+ BCJDecoder(final FilterOptions opts) {
this.opts = opts;
}
@Override
- InputStream decode(final String archiveName, final InputStream in, long uncompressedLength,
- final Coder coder, byte[] password) throws IOException {
+ InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
+ final Coder coder, final byte[] password) throws IOException {
try {
return opts.getInputStream(in);
} catch (AssertionError e) {
@@ -151,7 +151,7 @@ class Coders {
}
@Override
- InputStream decode(final String archiveName, final InputStream in, long uncompressedLength,
+ InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
final Coder coder, final byte[] password)
throws IOException {
final Inflater inflater = new Inflater(true);
@@ -164,12 +164,12 @@ class Coders {
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
return inflaterInputStream.read(b, off, len);
}
@Override
- public int read(byte[] b) throws IOException {
+ public int read(final byte[] b) throws IOException {
return inflaterInputStream.read(b);
}
@@ -190,17 +190,17 @@ class Coders {
final DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(out, deflater);
return new OutputStream() {
@Override
- public void write(int b) throws IOException {
+ public void write(final int b) throws IOException {
deflaterOutputStream.write(b);
}
@Override
- public void write(byte[] b) throws IOException {
+ public void write(final byte[] b) throws IOException {
deflaterOutputStream.write(b);
}
@Override
- public void write(byte[] b, int off, int len) throws IOException {
+ public void write(final byte[] b, final int off, final int len) throws IOException {
deflaterOutputStream.write(b, off, len);
}
@@ -222,7 +222,7 @@ class Coders {
}
@Override
- InputStream decode(final String archiveName, final InputStream in, long uncompressedLength,
+ InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
final Coder coder, final byte[] password)
throws IOException {
return new BZip2CompressorInputStream(in);
@@ -244,7 +244,7 @@ class Coders {
private static class DummyByteAddingInputStream extends FilterInputStream {
private boolean addDummyByte = true;
- private DummyByteAddingInputStream(InputStream in) {
+ private DummyByteAddingInputStream(final InputStream in) {
super(in);
}
@@ -259,7 +259,7 @@ class Coders {
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
int result = super.read(b, off, len);
if (result == -1 && addDummyByte) {
addDummyByte = false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/DeltaDecoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/DeltaDecoder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/DeltaDecoder.java
index e458334..755b3e4 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/DeltaDecoder.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/DeltaDecoder.java
@@ -30,8 +30,8 @@ class DeltaDecoder extends CoderBase {
}
@Override
- InputStream decode(final String archiveName, final InputStream in, long uncompressedLength,
- final Coder coder, byte[] password) throws IOException {
+ InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
+ final Coder coder, final byte[] password) throws IOException {
return new DeltaOptions(getOptionsFromCoder(coder)).getInputStream(in);
}
@@ -46,18 +46,18 @@ class DeltaDecoder extends CoderBase {
}
@Override
- byte[] getOptionsAsProperties(Object options) {
+ byte[] getOptionsAsProperties(final Object options) {
return new byte[] {
(byte) (numberOptionOrDefault(options, 1) - 1)
};
}
@Override
- Object getOptionsFromCoder(Coder coder, InputStream in) {
+ Object getOptionsFromCoder(final Coder coder, final InputStream in) {
return getOptionsFromCoder(coder);
}
- private int getOptionsFromCoder(Coder coder) {
+ private int getOptionsFromCoder(final Coder coder) {
if (coder.properties == null || coder.properties.length == 0) {
return 1;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java
index 3aab7f4..3101293 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java
@@ -92,7 +92,7 @@ class Folder {
return 0;
}
- long getUnpackSizeForCoder(Coder coder) {
+ long getUnpackSizeForCoder(final Coder coder) {
if (coders != null) {
for (int i = 0; i < coders.length; i++) {
if (coders[i] == coder) {
[45/46] commons-compress git commit: Fix Javadoc typo.
Posted by bo...@apache.org.
Fix Javadoc typo.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/2cc332cc
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/2cc332cc
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/2cc332cc
Branch: refs/heads/COMPRESS-207
Commit: 2cc332cc20f1d988ce6b986ba63e6685709e9ecd
Parents: 3f2c760
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 10:13:03 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 10:13:03 2016 -0700
----------------------------------------------------------------------
.../org/apache/commons/compress/archivers/sevenz/SevenZFile.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/2cc332cc/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index a6aabe6..3e2113d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -113,7 +113,7 @@ public class SevenZFile implements Closeable {
}
/**
- * Reads a file as unecrypted 7z archive
+ * Reads a file as unencrypted 7z archive
*
* @param filename the file to read
* @throws IOException if reading the archive fails
[41/46] commons-compress git commit: Add final modifier to local
variables.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
index 6631e46..a20ea70 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
@@ -122,7 +122,7 @@ class CRC {
void updateCRC(final int inCh, int repeat) {
int globalCrcShadow = this.globalCrc;
while (repeat-- > 0) {
- int temp = (globalCrcShadow >> 24) ^ inCh;
+ final int temp = (globalCrcShadow >> 24) ^ inCh;
globalCrcShadow = (globalCrcShadow << 8) ^ crc32Table[(temp >= 0)
? temp
: (temp + 256)];
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
index 76a86d8..b10bd8a 100644
--- a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
@@ -66,7 +66,7 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
public int read() throws IOException {
- int ret = in.read();
+ final int ret = in.read();
count(ret == -1 ? 0 : 1);
return ret;
}
@@ -74,7 +74,7 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
public int read(final byte[] buf, final int off, final int len) throws IOException {
- int ret = in.read(buf, off, len);
+ final int ret = in.read(buf, off, len);
count(ret);
return ret;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
index 99aabf9..9f28c8a 100644
--- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
@@ -149,8 +149,8 @@ public class GzipCompressorInputStream extends CompressorInputStream {
assert isFirstMember || decompressConcatenated;
// Check the magic bytes without a possibility of EOFException.
- int magic0 = in.read();
- int magic1 = in.read();
+ final int magic0 = in.read();
+ final int magic1 = in.read();
// If end of input was reached after decompressing at least
// one .gz member, we have reached the end of the file successfully.
@@ -165,14 +165,14 @@ public class GzipCompressorInputStream extends CompressorInputStream {
}
// Parsing the rest of the header may throw EOFException.
- DataInputStream inData = new DataInputStream(in);
- int method = inData.readUnsignedByte();
+ final DataInputStream inData = new DataInputStream(in);
+ final int method = inData.readUnsignedByte();
if (method != Deflater.DEFLATED) {
throw new IOException("Unsupported compression method "
+ method + " in the .gz header");
}
- int flg = inData.readUnsignedByte();
+ final int flg = inData.readUnsignedByte();
if ((flg & FRESERVED) != 0) {
throw new IOException(
"Reserved flags are set in the .gz header");
@@ -234,7 +234,7 @@ public class GzipCompressorInputStream extends CompressorInputStream {
}
private byte[] readToNull(final DataInputStream inData) throws IOException {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
int b = 0;
while ((b = inData.readUnsignedByte()) != 0x00) { // NOPMD
bos.write(b);
@@ -284,7 +284,7 @@ public class GzipCompressorInputStream extends CompressorInputStream {
int ret;
try {
ret = inf.inflate(b, off, len);
- } catch (DataFormatException e) {
+ } catch (final DataFormatException e) {
throw new IOException("Gzip-compressed data is corrupt");
}
@@ -302,17 +302,17 @@ public class GzipCompressorInputStream extends CompressorInputStream {
// in.mark earler, it should always skip enough.
in.reset();
- int skipAmount = bufUsed - inf.getRemaining();
+ final int skipAmount = bufUsed - inf.getRemaining();
if (in.skip(skipAmount) != skipAmount) {
throw new IOException();
}
bufUsed = 0;
- DataInputStream inData = new DataInputStream(in);
+ final DataInputStream inData = new DataInputStream(in);
// CRC32
- long crcStored = readLittleEndianInt(inData);
+ final long crcStored = readLittleEndianInt(inData);
if (crcStored != crc.getValue()) {
throw new IOException("Gzip-compressed data is corrupt "
@@ -320,7 +320,7 @@ public class GzipCompressorInputStream extends CompressorInputStream {
}
// Uncompressed size modulo 2^32 (ISIZE in the spec)
- long isize = readLittleEndianInt(inData);
+ final long isize = readLittleEndianInt(inData);
if (isize != (inf.getBytesWritten() & 0xffffffffl)) {
throw new IOException("Gzip-compressed data is corrupt"
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
index d1afb5d..af79210 100644
--- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
@@ -86,10 +86,10 @@ public class GzipCompressorOutputStream extends CompressorOutputStream {
}
private void writeHeader(final GzipParameters parameters) throws IOException {
- String filename = parameters.getFilename();
- String comment = parameters.getComment();
+ final String filename = parameters.getFilename();
+ final String comment = parameters.getComment();
- ByteBuffer buffer = ByteBuffer.allocate(10);
+ final ByteBuffer buffer = ByteBuffer.allocate(10);
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) GZIPInputStream.GZIP_MAGIC);
buffer.put((byte) Deflater.DEFLATED); // compression method (8: deflate)
@@ -97,7 +97,7 @@ public class GzipCompressorOutputStream extends CompressorOutputStream {
buffer.putInt((int) (parameters.getModificationTime() / 1000));
// extra flags
- int compressionLevel = parameters.getCompressionLevel();
+ final int compressionLevel = parameters.getCompressionLevel();
if (compressionLevel == Deflater.BEST_COMPRESSION) {
buffer.put((byte) 2);
} else if (compressionLevel == Deflater.BEST_SPEED) {
@@ -122,7 +122,7 @@ public class GzipCompressorOutputStream extends CompressorOutputStream {
}
private void writeTrailer() throws IOException {
- ByteBuffer buffer = ByteBuffer.allocate(8);
+ final ByteBuffer buffer = ByteBuffer.allocate(8);
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt((int) crc.getValue());
buffer.putInt(deflater.getTotalIn());
@@ -167,7 +167,7 @@ public class GzipCompressorOutputStream extends CompressorOutputStream {
}
private void deflate() throws IOException {
- int length = deflater.deflate(deflateBuffer, 0, deflateBuffer.length);
+ final int length = deflater.deflate(deflateBuffer, 0, deflateBuffer.length);
if (length > 0) {
out.write(deflateBuffer, 0, length);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipUtils.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipUtils.java
index 154f1cb..ed801cf 100644
--- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipUtils.java
+++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipUtils.java
@@ -34,7 +34,7 @@ public class GzipUtils {
// using LinkedHashMap so .tgz is preferred over .taz as
// compressed extension of .tar as FileNameUtil will use the
// first one found
- Map<String, String> uncompressSuffix =
+ final Map<String, String> uncompressSuffix =
new LinkedHashMap<String, String>();
uncompressSuffix.put(".tgz", ".tar");
uncompressSuffix.put(".taz", ".tar");
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
index ae23297..556c78c 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
@@ -51,7 +51,7 @@ public class LZMACompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
public int read() throws IOException {
- int ret = in.read();
+ final int ret = in.read();
count(ret == -1 ? 0 : 1);
return ret;
}
@@ -59,7 +59,7 @@ public class LZMACompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
public int read(final byte[] buf, final int off, final int len) throws IOException {
- int ret = in.read(buf, off, len);
+ final int ret = in.read(buf, off, len);
count(ret);
return ret;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/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 c1a653a..f3323ba 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
@@ -45,14 +45,14 @@ public class LZMAUtils {
private static volatile CachedAvailability cachedLZMAAvailability;
static {
- Map<String, String> uncompressSuffix = new HashMap<String, String>();
+ final Map<String, String> uncompressSuffix = new HashMap<String, String>();
uncompressSuffix.put(".lzma", "");
uncompressSuffix.put("-lzma", "");
fileNameUtil = new FileNameUtil(uncompressSuffix, ".lzma");
cachedLZMAAvailability = CachedAvailability.DONT_CACHE;
try {
Class.forName("org.osgi.framework.BundleEvent");
- } catch (Exception ex) {
+ } catch (final Exception ex) {
setCacheLZMAAvailablity(true);
}
}
@@ -99,7 +99,7 @@ public class LZMAUtils {
try {
LZMACompressorInputStream.matches(null, 0);
return true;
- } catch (NoClassDefFoundError error) {
+ } catch (final NoClassDefFoundError error) {
return false;
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
index a102695..5967f66 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
@@ -61,7 +61,7 @@ public abstract class LZWInputStream extends CompressorInputStream {
@Override
public int read() throws IOException {
- int ret = read(oneByte);
+ final int ret = read(oneByte);
if (ret < 0) {
return ret;
}
@@ -72,7 +72,7 @@ public abstract class LZWInputStream extends CompressorInputStream {
public int read(final byte[] b, final int off, final int len) throws IOException {
int bytesRead = readFromStack(b, off, len);
while (len - bytesRead > 0) {
- int result = decompressNextSymbol();
+ final int result = decompressNextSymbol();
if (result < 0) {
if (bytesRead > 0) {
count(bytesRead);
@@ -192,9 +192,9 @@ public abstract class LZWInputStream extends CompressorInputStream {
}
private int readFromStack(final byte[] b, final int off, final int len) {
- int remainingInStack = outputStack.length - outputStackLocation;
+ final int remainingInStack = outputStack.length - outputStackLocation;
if (remainingInStack > 0) {
- int maxLength = Math.min(remainingInStack, len);
+ final int maxLength = Math.min(remainingInStack, len);
System.arraycopy(outputStack, outputStackLocation, b, off, maxLength);
outputStackLocation += maxLength;
return maxLength;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java
index 3e28465..93bc8c3 100644
--- a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java
@@ -171,8 +171,8 @@ public class Pack200CompressorInputStream extends CompressorInputStream {
throws IOException {
originalInput = in;
streamBridge = mode.newStreamBridge();
- JarOutputStream jarOut = new JarOutputStream(streamBridge);
- Pack200.Unpacker u = Pack200.newUnpacker();
+ final JarOutputStream jarOut = new JarOutputStream(streamBridge);
+ final Pack200.Unpacker u = Pack200.newUnpacker();
if (props != null) {
u.properties().putAll(props);
}
@@ -215,7 +215,7 @@ public class Pack200CompressorInputStream extends CompressorInputStream {
public boolean markSupported() {
try {
return streamBridge.getInput().markSupported();
- } catch (IOException ex) {
+ } catch (final IOException ex) {
return false;
}
}
@@ -224,7 +224,7 @@ public class Pack200CompressorInputStream extends CompressorInputStream {
public void mark(final int limit) {
try {
streamBridge.getInput().mark(limit);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
throw new RuntimeException(ex);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java
index 87a1d87..ca27100 100644
--- a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java
@@ -126,7 +126,7 @@ public class Pack200CompressorOutputStream extends CompressorOutputStream {
public void finish() throws IOException {
if (!finished) {
finished = true;
- Pack200.Packer p = Pack200.newPacker();
+ final Pack200.Packer p = Pack200.newPacker();
if (properties != null) {
p.properties().putAll(properties);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Utils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Utils.java b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Utils.java
index 4659f42..164fa2f 100644
--- a/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Utils.java
+++ b/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Utils.java
@@ -131,20 +131,20 @@ public class Pack200Utils {
props = new HashMap<String, String>();
}
props.put(Pack200.Packer.SEGMENT_LIMIT, "-1");
- File f = File.createTempFile("commons-compress", "pack200normalize");
+ final File f = File.createTempFile("commons-compress", "pack200normalize");
f.deleteOnExit();
try {
OutputStream os = new FileOutputStream(f);
JarFile j = null;
try {
- Pack200.Packer p = Pack200.newPacker();
+ final Pack200.Packer p = Pack200.newPacker();
p.properties().putAll(props);
p.pack(j = new JarFile(from), os);
j = null;
os.close();
os = null;
- Pack200.Unpacker u = Pack200.newUnpacker();
+ final Pack200.Unpacker u = Pack200.newUnpacker();
os = new JarOutputStream(new FileOutputStream(to));
u.unpack(f, (JarOutputStream) os);
} finally {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
index 3d51c9c..5a79387 100644
--- a/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
@@ -132,7 +132,7 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
private int readOnce(final byte[] b, final int off, final int len) throws IOException {
int read = -1;
if (inUncompressedChunk) {
- int amount = Math.min(uncompressedBytesRemaining, len);
+ final int amount = Math.min(uncompressedBytesRemaining, len);
if (amount == 0) {
return -1;
}
@@ -142,7 +142,7 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
count(read);
}
} else if (currentCompressedChunk != null) {
- long before = currentCompressedChunk.getBytesRead();
+ final long before = currentCompressedChunk.getBytesRead();
read = currentCompressedChunk.read(b, off, len);
if (read == -1) {
currentCompressedChunk.close();
@@ -160,7 +160,7 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
private void readNextBlock() throws IOException {
verifyLastChecksumAndReset();
inUncompressedChunk = false;
- int type = readOneByte();
+ final int type = readOneByte();
if (type == -1) {
endReached = true;
} else if (type == STREAM_IDENTIFIER_TYPE) {
@@ -181,7 +181,7 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
uncompressedBytesRemaining = readSize() - 4 /* CRC */;
expectedChecksum = unmask(readCrc());
} else if (type == COMPRESSED_CHUNK_TYPE) {
- long size = readSize() - 4 /* CRC */;
+ final long size = readSize() - 4 /* CRC */;
expectedChecksum = unmask(readCrc());
currentCompressedChunk =
new SnappyCompressorInputStream(new BoundedInputStream(in, size));
@@ -195,8 +195,8 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
}
private long readCrc() throws IOException {
- byte[] b = new byte[4];
- int read = IOUtils.readFully(in, b);
+ final byte[] b = new byte[4];
+ final int read = IOUtils.readFully(in, b);
count(read);
if (read != 4) {
throw new IOException("premature end of stream");
@@ -230,8 +230,8 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
}
private void skipBlock() throws IOException {
- int size = readSize();
- long read = IOUtils.skip(in, size);
+ final int size = readSize();
+ final long read = IOUtils.skip(in, size);
count(read);
if (read != size) {
throw new IOException("premature end of stream");
@@ -239,8 +239,8 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
}
private void readStreamIdentifier() throws IOException {
- byte[] b = new byte[10];
- int read = IOUtils.readFully(in, b);
+ final byte[] b = new byte[10];
+ final int read = IOUtils.readFully(in, b);
count(read);
if (10 != read || !matches(b, 10)) {
throw new IOException("Not a framed Snappy stream");
@@ -248,7 +248,7 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream {
}
private int readOneByte() throws IOException {
- int b = in.read();
+ final int b = in.read();
if (b != -1) {
count(1);
return b & 0xFF;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java b/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
index d01353c..53e5c55 100644
--- a/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
+++ b/src/main/java/org/apache/commons/compress/compressors/snappy/PureJavaCrc32C.java
@@ -44,7 +44,7 @@ class PureJavaCrc32C implements Checksum {
@Override
public long getValue() {
- long ret = crc;
+ final long ret = crc;
return (~ret) & 0xffffffffL;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
index fae3a42..db19bc8 100644
--- a/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
@@ -134,7 +134,7 @@ public class SnappyCompressorInputStream extends CompressorInputStream {
fill(len - avail);
}
- int readable = Math.min(len, available());
+ final int readable = Math.min(len, available());
if (readable == 0 && len > 0) {
return -1;
}
@@ -307,7 +307,7 @@ public class SnappyCompressorInputStream extends CompressorInputStream {
* @return True if the decompressed data should be flushed
*/
private boolean expandLiteral(final int length) throws IOException {
- int bytesRead = IOUtils.readFully(in, decompressBuf, writeIndex, length);
+ final int bytesRead = IOUtils.readFully(in, decompressBuf, writeIndex, length);
count(bytesRead);
if (length != bytesRead) {
throw new IOException("Premature end of stream");
@@ -340,10 +340,10 @@ public class SnappyCompressorInputStream extends CompressorInputStream {
if (off > blockSize) {
throw new IOException("Offset is larger than block size");
}
- int offset = (int) off;
+ final int offset = (int) off;
if (offset == 1) {
- byte lastChar = decompressBuf[writeIndex - 1];
+ final byte lastChar = decompressBuf[writeIndex - 1];
for (int i = 0; i < length; i++) {
decompressBuf[writeIndex++] = lastChar;
}
@@ -353,7 +353,7 @@ public class SnappyCompressorInputStream extends CompressorInputStream {
writeIndex += length;
} else {
int fullRotations = length / offset;
- int pad = length - (offset * fullRotations);
+ final int pad = length - (offset * fullRotations);
while (fullRotations-- != 0) {
System.arraycopy(decompressBuf, writeIndex - offset,
@@ -382,7 +382,7 @@ public class SnappyCompressorInputStream extends CompressorInputStream {
* EOF is reached or error reading the stream
*/
private int readOneByte() throws IOException {
- int b = in.read();
+ final int b = in.read();
if (b == -1) {
throw new IOException("Premature end of stream");
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
index 24fee7b..27d70d2 100644
--- a/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
@@ -101,14 +101,14 @@ public class XZCompressorInputStream extends CompressorInputStream {
@Override
public int read() throws IOException {
- int ret = in.read();
+ final int ret = in.read();
count(ret == -1 ? -1 : 1);
return ret;
}
@Override
public int read(final byte[] buf, final int off, final int len) throws IOException {
- int ret = in.read(buf, off, len);
+ final int ret = in.read(buf, off, len);
count(ret);
return ret;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/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 db71b17..4da6425 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
@@ -48,7 +48,7 @@ public class XZUtils {
private static volatile CachedAvailability cachedXZAvailability;
static {
- Map<String, String> uncompressSuffix = new HashMap<String, String>();
+ final Map<String, String> uncompressSuffix = new HashMap<String, String>();
uncompressSuffix.put(".txz", ".tar");
uncompressSuffix.put(".xz", "");
uncompressSuffix.put("-xz", "");
@@ -56,7 +56,7 @@ public class XZUtils {
cachedXZAvailability = CachedAvailability.DONT_CACHE;
try {
Class.forName("org.osgi.framework.BundleEvent");
- } catch (Exception ex) {
+ } catch (final Exception ex) {
setCacheXZAvailablity(true);
}
}
@@ -108,7 +108,7 @@ public class XZUtils {
try {
XZCompressorInputStream.matches(null, 0);
return true;
- } catch (NoClassDefFoundError error) {
+ } catch (final NoClassDefFoundError error) {
return false;
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/z/ZCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/z/ZCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/z/ZCompressorInputStream.java
index a7b028e..799e58d 100644
--- a/src/main/java/org/apache/commons/compress/compressors/z/ZCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/z/ZCompressorInputStream.java
@@ -40,9 +40,9 @@ public class ZCompressorInputStream extends LZWInputStream {
public ZCompressorInputStream(final InputStream inputStream) throws IOException {
super(inputStream, ByteOrder.LITTLE_ENDIAN);
- int firstByte = (int) in.readBits(8);
- int secondByte = (int) in.readBits(8);
- int thirdByte = (int) in.readBits(8);
+ final int firstByte = (int) in.readBits(8);
+ final int secondByte = (int) in.readBits(8);
+ final int thirdByte = (int) in.readBits(8);
if (firstByte != MAGIC_1 || secondByte != MAGIC_2 || thirdByte < 0) {
throw new IOException("Input is not in .Z format");
}
@@ -67,7 +67,7 @@ public class ZCompressorInputStream extends LZWInputStream {
*/
@Override
protected int readNextCode() throws IOException {
- int code = super.readNextCode();
+ final int code = super.readNextCode();
if (code >= 0) {
++totalCodesRead;
}
@@ -98,7 +98,7 @@ public class ZCompressorInputStream extends LZWInputStream {
@Override
protected int addEntry(final int previousCode, final byte character) throws IOException {
final int maxTableSize = 1 << getCodeSize();
- int r = addEntry(previousCode, character, maxTableSize);
+ final int r = addEntry(previousCode, character, maxTableSize);
if (getTableSize() == maxTableSize && getCodeSize() < maxCodeSize) {
reAlignReading();
incrementCodeSize();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java b/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
index 8798274..e39e4f3 100644
--- a/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
+++ b/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
@@ -44,9 +44,9 @@ public class ArchiveUtils {
* @return the representation of the entry
*/
public static String toString(final ArchiveEntry entry){
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append(entry.isDirectory()? 'd' : '-');// c.f. "ls -l" output
- String size = Long.toString(entry.getSize());
+ final String size = Long.toString(entry.getSize());
sb.append(' ');
// Pad output to 7 places, leading spaces
for(int i=7; i > size.length(); i--){
@@ -71,7 +71,7 @@ public class ArchiveUtils {
byte[] buffer1;
try {
buffer1 = expected.getBytes(CharsetNames.US_ASCII);
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
throw new RuntimeException(e); // Should not happen
}
return isEqual(buffer1, 0, buffer1.length, buffer, offset, length, false);
@@ -98,7 +98,7 @@ public class ArchiveUtils {
public static byte[] toAsciiBytes(final String inputString){
try {
return inputString.getBytes(CharsetNames.US_ASCII);
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
throw new RuntimeException(e); // Should never happen
}
}
@@ -112,7 +112,7 @@ public class ArchiveUtils {
public static String toAsciiString(final byte[] inputBytes){
try {
return new String(inputBytes, CharsetNames.US_ASCII);
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
throw new RuntimeException(e); // Should never happen
}
}
@@ -128,7 +128,7 @@ public class ArchiveUtils {
public static String toAsciiString(final byte[] inputBytes, final int offset, final int length){
try {
return new String(inputBytes, offset, length, CharsetNames.US_ASCII);
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
throw new RuntimeException(e); // Should never happen
}
}
@@ -149,7 +149,7 @@ public class ArchiveUtils {
final byte[] buffer1, final int offset1, final int length1,
final byte[] buffer2, final int offset2, final int length2,
final boolean ignoreTrailingNulls){
- int minLen=length1 < length2 ? length1 : length2;
+ final int minLen=length1 < length2 ? length1 : length2;
for (int i=0; i < minLen; i++){
if (buffer1[offset1+i] != buffer2[offset2+i]){
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java b/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
index eb8619f..de2bef4 100644
--- a/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
+++ b/src/main/java/org/apache/commons/compress/utils/ChecksumVerifyingInputStream.java
@@ -52,7 +52,7 @@ public class ChecksumVerifyingInputStream extends InputStream {
if (bytesRemaining <= 0) {
return -1;
}
- int ret = in.read();
+ final int ret = in.read();
if (ret >= 0) {
checksum.update(ret);
--bytesRemaining;
@@ -82,7 +82,7 @@ public class ChecksumVerifyingInputStream extends InputStream {
*/
@Override
public int read(final byte[] b, final int off, final int len) throws IOException {
- int ret = in.read(b, off, len);
+ final int ret = in.read(b, off, len);
if (ret >= 0) {
checksum.update(b, off, ret);
bytesRemaining -= ret;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/utils/CountingInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/CountingInputStream.java b/src/main/java/org/apache/commons/compress/utils/CountingInputStream.java
index c4905fa..f79b95b 100644
--- a/src/main/java/org/apache/commons/compress/utils/CountingInputStream.java
+++ b/src/main/java/org/apache/commons/compress/utils/CountingInputStream.java
@@ -36,7 +36,7 @@ public class CountingInputStream extends FilterInputStream {
@Override
public int read() throws IOException {
- int r = in.read();
+ final int r = in.read();
if (r >= 0) {
count(1);
}
@@ -48,7 +48,7 @@ public class CountingInputStream extends FilterInputStream {
}
@Override
public int read(final byte[] b, final int off, final int len) throws IOException {
- int r = in.read(b, off, len);
+ final int r = in.read(b, off, len);
if (r >= 0) {
count(r);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/utils/IOUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/IOUtils.java b/src/main/java/org/apache/commons/compress/utils/IOUtils.java
index ee9989b..d7979f1 100644
--- a/src/main/java/org/apache/commons/compress/utils/IOUtils.java
+++ b/src/main/java/org/apache/commons/compress/utils/IOUtils.java
@@ -98,9 +98,9 @@ public final class IOUtils {
* @throws IOException on error
*/
public static long skip(final InputStream input, long numToSkip) throws IOException {
- long available = numToSkip;
+ final long available = numToSkip;
while (numToSkip > 0) {
- long skipped = input.skip(numToSkip);
+ final long skipped = input.skip(numToSkip);
if (skipped == 0) {
break;
}
@@ -108,7 +108,7 @@ public final class IOUtils {
}
while (numToSkip > 0) {
- int read = readFully(input, SKIP_BUF, 0,
+ final int read = readFully(input, SKIP_BUF, 0,
(int) Math.min(numToSkip, SKIP_BUF_SIZE));
if (read < 1) {
break;
@@ -199,7 +199,7 @@ public final class IOUtils {
if (c != null) {
try {
c.close();
- } catch (IOException ignored) { // NOPMD
+ } catch (final IOException ignored) { // NOPMD
}
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/AbstractTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/AbstractTestCase.java b/src/test/java/org/apache/commons/compress/AbstractTestCase.java
index 31d0ab2..a151a26 100644
--- a/src/test/java/org/apache/commons/compress/AbstractTestCase.java
+++ b/src/test/java/org/apache/commons/compress/AbstractTestCase.java
@@ -61,21 +61,21 @@ public abstract class AbstractTestCase {
}
public static File mkdir(final String name) throws IOException {
- File f = File.createTempFile(name, "");
+ final File f = File.createTempFile(name, "");
f.delete();
f.mkdir();
return f;
}
public static File getFile(final String path) throws IOException {
- URL url = AbstractTestCase.class.getClassLoader().getResource(path);
+ final URL url = AbstractTestCase.class.getClassLoader().getResource(path);
if (url == null) {
throw new FileNotFoundException("couldn't find " + path);
}
URI uri = null;
try {
uri = url.toURI();
- } catch (java.net.URISyntaxException ex) {
+ } catch (final java.net.URISyntaxException ex) {
throw new IOException(ex);
}
return new File(uri);
@@ -93,14 +93,14 @@ public abstract class AbstractTestCase {
}
public static void rmdir(final File f) {
- String[] s = f.list();
+ final String[] s = f.list();
if (s != null) {
- for (String element : s) {
+ for (final String element : s) {
final File file = new File(f, element);
if (file.isDirectory()){
rmdir(file);
}
- boolean ok = tryHardToDelete(file);
+ final boolean ok = tryHardToDelete(file);
if (!ok && file.exists()){
System.out.println("Failed to delete "+element+" in "+f.getPath());
}
@@ -130,7 +130,7 @@ public abstract class AbstractTestCase {
}
try {
Thread.sleep(10);
- } catch (InterruptedException ex) {
+ } catch (final InterruptedException ex) {
// Ignore Exception
}
return f.delete();
@@ -211,7 +211,7 @@ public abstract class AbstractTestCase {
*/
private void addArchiveEntry(final ArchiveOutputStream out, final String filename, final File infile)
throws IOException, FileNotFoundException {
- ArchiveEntry entry = out.createArchiveEntry(infile, filename);
+ final ArchiveEntry entry = out.createArchiveEntry(infile, filename);
out.putArchiveEntry(entry);
IOUtils.copy(new FileInputStream(infile), out);
out.closeArchiveEntry();
@@ -317,20 +317,20 @@ public abstract class AbstractTestCase {
*/
protected File checkArchiveContent(final ArchiveInputStream in, final List<String> expected, final boolean cleanUp)
throws Exception {
- File result = mkdir("dir-result");
+ final File result = mkdir("dir-result");
result.deleteOnExit();
try {
ArchiveEntry entry = null;
while ((entry = in.getNextEntry()) != null) {
- File outfile = new File(result.getCanonicalPath() + "/result/"
+ final File outfile = new File(result.getCanonicalPath() + "/result/"
+ entry.getName());
long copied=0;
if (entry.isDirectory()){
outfile.mkdirs();
} else {
outfile.getParentFile().mkdirs();
- OutputStream out = new FileOutputStream(outfile);
+ final OutputStream out = new FileOutputStream(outfile);
try {
copied=IOUtils.copy(in, out);
} finally {
@@ -381,10 +381,10 @@ public abstract class AbstractTestCase {
* element of the two element array).
*/
protected File[] createTempDirAndFile() throws IOException {
- File tmpDir = createTempDir();
- File tmpFile = File.createTempFile("testfile", "", tmpDir);
+ final File tmpDir = createTempDir();
+ final File tmpFile = File.createTempFile("testfile", "", tmpDir);
tmpFile.deleteOnExit();
- FileOutputStream fos = new FileOutputStream(tmpFile);
+ final FileOutputStream fos = new FileOutputStream(tmpFile);
try {
fos.write(new byte[] {'f', 'o', 'o'});
return new File[] {tmpDir, tmpFile};
@@ -394,7 +394,7 @@ public abstract class AbstractTestCase {
}
protected File createTempDir() throws IOException {
- File tmpDir = mkdir("testdir");
+ final File tmpDir = mkdir("testdir");
tmpDir.deleteOnExit();
return tmpDir;
}
@@ -403,7 +403,7 @@ public abstract class AbstractTestCase {
if (closeable != null) {
try {
closeable.close();
- } catch (IOException ignored) {
+ } catch (final IOException ignored) {
// ignored
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
index f9c3ce2..30d9896 100644
--- a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
+++ b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
@@ -60,9 +60,9 @@ public class ArchiveReadTest extends AbstractTestCase {
@BeforeClass
public static void setUpFileList() throws Exception {
assertTrue(ARCDIR.exists());
- File listing= new File(ARCDIR,"files.txt");
+ final File listing= new File(ARCDIR,"files.txt");
assertTrue("files.txt is readable",listing.canRead());
- BufferedReader br = new BufferedReader(new FileReader(listing));
+ final BufferedReader br = new BufferedReader(new FileReader(listing));
String line;
while ((line=br.readLine())!=null){
if (!line.startsWith("#")){
@@ -75,8 +75,8 @@ public class ArchiveReadTest extends AbstractTestCase {
@Parameters(name = "file={0}")
public static Collection<Object[]> data() {
assertTrue(ARCDIR.exists());
- Collection<Object[]> params = new ArrayList<Object[]>();
- for (String f : ARCDIR.list(new FilenameFilter() {
+ final Collection<Object[]> params = new ArrayList<Object[]>();
+ for (final String f : ARCDIR.list(new FilenameFilter() {
@Override
public boolean accept(final File dir, final String name) {
return !name.endsWith(".txt");
@@ -97,12 +97,13 @@ public class ArchiveReadTest extends AbstractTestCase {
@Test
public void testArchive() throws Exception{
@SuppressWarnings("unchecked") // fileList is correct type already
+ final
ArrayList<String> expected= (ArrayList<String>) FILELIST.clone();
try {
checkArchiveContent(file, expected);
- } catch (ArchiveException e) {
+ } catch (final ArchiveException e) {
fail("Problem checking "+file);
- } catch (AssertionError e) { // show error in context
+ } catch (final AssertionError e) { // show error in context
fail("Problem checking " + file + " " +e);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java b/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java
index 7eb3318..413b52b 100644
--- a/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java
@@ -37,9 +37,9 @@ public class ArchiveUtilsTest extends AbstractTestCase {
@Test
public void testCompareBA(){
- byte[] buffer1 = {1,2,3};
- byte[] buffer2 = {1,2,3,0};
- byte[] buffer3 = {1,2,3};
+ final byte[] buffer1 = {1,2,3};
+ final byte[] buffer2 = {1,2,3,0};
+ final byte[] buffer3 = {1,2,3};
assertTrue(ArchiveUtils.isEqual(buffer1, buffer2, true));
assertFalse(ArchiveUtils.isEqual(buffer1, buffer2, false));
assertFalse(ArchiveUtils.isEqual(buffer1, buffer2));
@@ -52,8 +52,8 @@ public class ArchiveUtilsTest extends AbstractTestCase {
@Test
public void testCompareAscii(){
- byte[] buffer1 = {'a','b','c'};
- byte[] buffer2 = {'d','e','f',0};
+ final byte[] buffer1 = {'a','b','c'};
+ final byte[] buffer2 = {'d','e','f',0};
assertTrue(ArchiveUtils.matchAsciiBuffer("abc", buffer1));
assertFalse(ArchiveUtils.matchAsciiBuffer("abc\0", buffer1));
assertTrue(ArchiveUtils.matchAsciiBuffer("def\0", buffer2));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/ChainingTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/ChainingTestCase.java b/src/test/java/org/apache/commons/compress/ChainingTestCase.java
index cc82d9f..69e67fa 100644
--- a/src/test/java/org/apache/commons/compress/ChainingTestCase.java
+++ b/src/test/java/org/apache/commons/compress/ChainingTestCase.java
@@ -34,7 +34,7 @@ public class ChainingTestCase extends AbstractTestCase {
@Test
public void testTarGzip() throws Exception {
- File file = getFile("bla.tgz");
+ final File file = getFile("bla.tgz");
final TarArchiveInputStream is = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream(file)));
final TarArchiveEntry entry = (TarArchiveEntry)is.getNextEntry();
assertNotNull(entry);
@@ -44,7 +44,7 @@ public class ChainingTestCase extends AbstractTestCase {
@Test
public void testTarBzip2() throws Exception {
- File file = getFile("bla.tar.bz2");
+ final File file = getFile("bla.tar.bz2");
final TarArchiveInputStream is = new TarArchiveInputStream(new BZip2CompressorInputStream(new FileInputStream(file)));
final TarArchiveEntry entry = (TarArchiveEntry)is.getNextEntry();
assertNotNull(entry);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java b/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java
index 68d12b6..767b2e9 100644
--- a/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java
+++ b/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java
@@ -43,7 +43,7 @@ public final class DetectArchiverTestCase extends AbstractTestCase {
try {
getStreamFor("test.txt");
fail("Expected ArchiveException");
- } catch (ArchiveException e) {
+ } catch (final ArchiveException e) {
// expected
}
}
@@ -130,14 +130,14 @@ public final class DetectArchiverTestCase extends AbstractTestCase {
}
private void checkEmptyArchive(final String type) throws Exception{
- File ar = createEmptyArchive(type); // will be deleted by tearDown()
+ final File ar = createEmptyArchive(type); // will be deleted by tearDown()
ar.deleteOnExit(); // Just in case file cannot be deleted
ArchiveInputStream ais = null;
BufferedInputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(ar));
ais = factory.createArchiveInputStream(in);
- } catch (ArchiveException ae) {
+ } catch (final ArchiveException ae) {
fail("Should have recognised empty archive for "+type);
} finally {
if (ais != null) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/IOMethodsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/IOMethodsTest.java b/src/test/java/org/apache/commons/compress/IOMethodsTest.java
index b962392..cb2c260 100644
--- a/src/test/java/org/apache/commons/compress/IOMethodsTest.java
+++ b/src/test/java/org/apache/commons/compress/IOMethodsTest.java
@@ -54,32 +54,32 @@ public class IOMethodsTest extends AbstractTestCase {
@Test
public void testWriteAr() throws Exception {
- ArchiveEntry entry = new ArArchiveEntry("dummy", bytesToTest);
+ final ArchiveEntry entry = new ArArchiveEntry("dummy", bytesToTest);
compareWrites("ar", entry);
}
@Test
public void testWriteCpio() throws Exception {
- ArchiveEntry entry = new CpioArchiveEntry("dummy", bytesToTest);
+ final ArchiveEntry entry = new CpioArchiveEntry("dummy", bytesToTest);
compareWrites("cpio", entry);
}
@Test
public void testWriteJar() throws Exception {
- ArchiveEntry entry = new JarArchiveEntry("dummy");
+ final ArchiveEntry entry = new JarArchiveEntry("dummy");
compareWrites("jar", entry);
}
@Test
public void testWriteTar() throws Exception {
- TarArchiveEntry entry = new TarArchiveEntry("dummy");
+ final TarArchiveEntry entry = new TarArchiveEntry("dummy");
entry.setSize(bytesToTest);
compareWrites("tar", entry);
}
@Test
public void testWriteZip() throws Exception {
- ArchiveEntry entry = new ZipArchiveEntry("dummy");
+ final ArchiveEntry entry = new ZipArchiveEntry("dummy");
compareWrites("zip", entry);
}
@@ -109,16 +109,16 @@ public class IOMethodsTest extends AbstractTestCase {
}
private void compareWrites(final String archiverName, final ArchiveEntry entry) throws Exception {
- OutputStream out1 = new ByteArrayOutputStream();
- OutputStream out2 = new ByteArrayOutputStream();
- OutputStream out3 = new ByteArrayOutputStream();
- ArchiveOutputStream aos1 = factory.createArchiveOutputStream(archiverName, out1);
+ final OutputStream out1 = new ByteArrayOutputStream();
+ final OutputStream out2 = new ByteArrayOutputStream();
+ final OutputStream out3 = new ByteArrayOutputStream();
+ final ArchiveOutputStream aos1 = factory.createArchiveOutputStream(archiverName, out1);
aos1.putArchiveEntry(entry);
- ArchiveOutputStream aos2 = factory.createArchiveOutputStream(archiverName, out2);
+ final ArchiveOutputStream aos2 = factory.createArchiveOutputStream(archiverName, out2);
aos2.putArchiveEntry(entry);
- ArchiveOutputStream aos3 = factory.createArchiveOutputStream(archiverName, out3);
+ final ArchiveOutputStream aos3 = factory.createArchiveOutputStream(archiverName, out3);
aos3.putArchiveEntry(entry);
- for (byte element : byteTest) {
+ for (final byte element : byteTest) {
aos1.write(element);
}
aos1.closeArchiveEntry();
@@ -140,31 +140,31 @@ public class IOMethodsTest extends AbstractTestCase {
}
private void compareReads(final String archiverName) throws Exception {
- OutputStream out1 = new ByteArrayOutputStream();
- OutputStream out2 = new ByteArrayOutputStream();
- OutputStream out3 = new ByteArrayOutputStream();
- File file = createSingleEntryArchive(archiverName);
+ final OutputStream out1 = new ByteArrayOutputStream();
+ final OutputStream out2 = new ByteArrayOutputStream();
+ final OutputStream out3 = new ByteArrayOutputStream();
+ final File file = createSingleEntryArchive(archiverName);
file.deleteOnExit();
- InputStream is1 = new FileInputStream(file);
- ArchiveInputStream ais1 = factory.createArchiveInputStream(archiverName, is1);
+ final InputStream is1 = new FileInputStream(file);
+ final ArchiveInputStream ais1 = factory.createArchiveInputStream(archiverName, is1);
final ArchiveEntry nextEntry = ais1.getNextEntry();
assertNotNull(nextEntry);
- byte [] buff = new byte[10]; // small so multiple reads are needed;
- long size = nextEntry.getSize();
+ final byte [] buff = new byte[10]; // small so multiple reads are needed;
+ final long size = nextEntry.getSize();
if (size != ArchiveEntry.SIZE_UNKNOWN) {
assertTrue("Size should be > 0, found: "+size, size > 0);
}
- InputStream is2 = new FileInputStream(file);
- ArchiveInputStream ais2 = factory.createArchiveInputStream(archiverName, is2);
+ final InputStream is2 = new FileInputStream(file);
+ final ArchiveInputStream ais2 = factory.createArchiveInputStream(archiverName, is2);
final ArchiveEntry nextEntry2 = ais2.getNextEntry();
assertNotNull(nextEntry2);
assertEquals("Expected same entry size", size, nextEntry2.getSize());
- InputStream is3 = new FileInputStream(file);
- ArchiveInputStream ais3 = factory.createArchiveInputStream(archiverName, is3);
+ final InputStream is3 = new FileInputStream(file);
+ final ArchiveInputStream ais3 = factory.createArchiveInputStream(archiverName, is3);
final ArchiveEntry nextEntry3 = ais3.getNextEntry();
assertNotNull(nextEntry3);
assertEquals("Expected same entry size", size, nextEntry3.getSize());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java b/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
index 8eac9bb..62674d4 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
@@ -84,7 +84,7 @@ public final class ArTestCase extends AbstractTestCase {
final ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream(new BufferedInputStream(is));
final ArArchiveEntry entry = (ArArchiveEntry)in.getNextEntry();
- File target = new File(dir, entry.getName());
+ final File target = new File(dir, entry.getName());
final OutputStream out = new FileOutputStream(target);
IOUtils.copy(in, out);
@@ -192,7 +192,7 @@ public final class ArTestCase extends AbstractTestCase {
@Ignore
@Test
public void XtestDirectoryEntryFromFile() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
ArArchiveOutputStream aos = null;
ArArchiveInputStream ais = null;
@@ -200,14 +200,14 @@ public final class ArTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".ar", tmp[0]);
archive.deleteOnExit();
aos = new ArArchiveOutputStream(new FileOutputStream(archive));
- long beforeArchiveWrite = tmp[0].lastModified();
- ArArchiveEntry in = new ArArchiveEntry(tmp[0], "foo");
+ final long beforeArchiveWrite = tmp[0].lastModified();
+ final ArArchiveEntry in = new ArArchiveEntry(tmp[0], "foo");
aos.putArchiveEntry(in);
aos.closeArchiveEntry();
aos.close();
aos = null;
ais = new ArArchiveInputStream(new FileInputStream(archive));
- ArArchiveEntry out = ais.getNextArEntry();
+ final ArArchiveEntry out = ais.getNextArEntry();
ais.close();
ais = null;
assertNotNull(out);
@@ -234,7 +234,7 @@ public final class ArTestCase extends AbstractTestCase {
@Ignore
@Test
public void XtestExplicitDirectoryEntry() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
ArArchiveOutputStream aos = null;
ArArchiveInputStream ais = null;
@@ -242,15 +242,15 @@ public final class ArTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".ar", tmp[0]);
archive.deleteOnExit();
aos = new ArArchiveOutputStream(new FileOutputStream(archive));
- long beforeArchiveWrite = tmp[0].lastModified();
- ArArchiveEntry in = new ArArchiveEntry("foo", 0, 0, 0, 0,
+ final long beforeArchiveWrite = tmp[0].lastModified();
+ final ArArchiveEntry in = new ArArchiveEntry("foo", 0, 0, 0, 0,
tmp[1].lastModified() / 1000);
aos.putArchiveEntry(in);
aos.closeArchiveEntry();
aos.close();
aos = null;
ais = new ArArchiveInputStream(new FileInputStream(archive));
- ArArchiveEntry out = ais.getNextArEntry();
+ final ArArchiveEntry out = ais.getNextArEntry();
ais.close();
ais = null;
assertNotNull(out);
@@ -274,7 +274,7 @@ public final class ArTestCase extends AbstractTestCase {
@Test
public void testFileEntryFromFile() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
ArArchiveOutputStream aos = null;
ArArchiveInputStream ais = null;
@@ -283,9 +283,9 @@ public final class ArTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".ar", tmp[0]);
archive.deleteOnExit();
aos = new ArArchiveOutputStream(new FileOutputStream(archive));
- ArArchiveEntry in = new ArArchiveEntry(tmp[1], "foo");
+ final ArArchiveEntry in = new ArArchiveEntry(tmp[1], "foo");
aos.putArchiveEntry(in);
- byte[] b = new byte[(int) tmp[1].length()];
+ final byte[] b = new byte[(int) tmp[1].length()];
fis = new FileInputStream(tmp[1]);
while (fis.read(b) > 0) {
aos.write(b);
@@ -296,7 +296,7 @@ public final class ArTestCase extends AbstractTestCase {
aos.close();
aos = null;
ais = new ArArchiveInputStream(new FileInputStream(archive));
- ArArchiveEntry out = ais.getNextArEntry();
+ final ArArchiveEntry out = ais.getNextArEntry();
ais.close();
ais = null;
assertNotNull(out);
@@ -324,7 +324,7 @@ public final class ArTestCase extends AbstractTestCase {
@Test
public void testExplicitFileEntry() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
ArArchiveOutputStream aos = null;
ArArchiveInputStream ais = null;
@@ -333,11 +333,11 @@ public final class ArTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".ar", tmp[0]);
archive.deleteOnExit();
aos = new ArArchiveOutputStream(new FileOutputStream(archive));
- ArArchiveEntry in = new ArArchiveEntry("foo", tmp[1].length(),
+ final ArArchiveEntry in = new ArArchiveEntry("foo", tmp[1].length(),
0, 0, 0,
tmp[1].lastModified() / 1000);
aos.putArchiveEntry(in);
- byte[] b = new byte[(int) tmp[1].length()];
+ final byte[] b = new byte[(int) tmp[1].length()];
fis = new FileInputStream(tmp[1]);
while (fis.read(b) > 0) {
aos.write(b);
@@ -348,7 +348,7 @@ public final class ArTestCase extends AbstractTestCase {
aos.close();
aos = null;
ais = new ArArchiveInputStream(new FileInputStream(archive));
- ArArchiveEntry out = ais.getNextArEntry();
+ final ArArchiveEntry out = ais.getNextArEntry();
ais.close();
ais = null;
assertNotNull(out);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
index a1c0243..37606bd 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
@@ -40,14 +40,14 @@ public class ArchiveOutputStreamTest extends AbstractTestCase {
@Test
public void testFinish() throws Exception {
- OutputStream out1 = new ByteArrayOutputStream();
+ final OutputStream out1 = new ByteArrayOutputStream();
ArchiveOutputStream aos1 = factory.createArchiveOutputStream("zip", out1);
aos1.putArchiveEntry(new ZipArchiveEntry("dummy"));
try {
aos1.finish();
fail("After putArchive should follow closeArchive");
- } catch (IOException io) {
+ } catch (final IOException io) {
// Exception expected
}
@@ -56,7 +56,7 @@ public class ArchiveOutputStreamTest extends AbstractTestCase {
try {
aos1.finish();
fail("After putArchive should follow closeArchive");
- } catch (IOException io) {
+ } catch (final IOException io) {
// Exception expected
}
@@ -65,7 +65,7 @@ public class ArchiveOutputStreamTest extends AbstractTestCase {
try {
aos1.finish();
fail("After putArchive should follow closeArchive");
- } catch (IOException io) {
+ } catch (final IOException io) {
// Exception expected
}
@@ -74,7 +74,7 @@ public class ArchiveOutputStreamTest extends AbstractTestCase {
try {
aos1.finish();
fail("After putArchive should follow closeArchive");
- } catch (IOException io) {
+ } catch (final IOException io) {
// Exception expected
}
@@ -83,14 +83,14 @@ public class ArchiveOutputStreamTest extends AbstractTestCase {
try {
aos1.finish();
fail("After putArchive should follow closeArchive");
- } catch (IOException io) {
+ } catch (final IOException io) {
// Exception expected
}
}
@Test
public void testOptionalFinish() throws Exception {
- OutputStream out1 = new ByteArrayOutputStream();
+ final OutputStream out1 = new ByteArrayOutputStream();
ArchiveOutputStream aos1 = factory.createArchiveOutputStream("zip", out1);
aos1.putArchiveEntry(new ZipArchiveEntry("dummy"));
@@ -104,7 +104,7 @@ public class ArchiveOutputStreamTest extends AbstractTestCase {
try {
aos1.finish();
fail("finish() cannot follow close()");
- } catch (IOException io) {
+ } catch (final IOException io) {
// Exception expected
}
}
@@ -135,8 +135,8 @@ public class ArchiveOutputStreamTest extends AbstractTestCase {
}
private void doCallSequence(final String archiveType) throws Exception {
- OutputStream out1 = new ByteArrayOutputStream();
- File dummy = getFile("test1.xml"); // need a real file
+ final OutputStream out1 = new ByteArrayOutputStream();
+ final File dummy = getFile("test1.xml"); // need a real file
ArchiveOutputStream aos1;
aos1 = factory.createArchiveOutputStream(archiveType, out1);
@@ -153,7 +153,7 @@ public class ArchiveOutputStreamTest extends AbstractTestCase {
try {
aos1.closeArchiveEntry();
fail("Should have raised IOException - closeArchiveEntry() called before putArchiveEntry()");
- } catch (IOException expected) {
+ } catch (final IOException expected) {
}
aos1.putArchiveEntry(aos1.createArchiveEntry(dummy, "dummy"));
@@ -166,25 +166,25 @@ public class ArchiveOutputStreamTest extends AbstractTestCase {
try {
aos1.finish();
fail("Should have raised IOException - finish() called before closeArchiveEntry()");
- } catch (IOException expected) {
+ } catch (final IOException expected) {
}
try {
aos1.close();
fail("Should have raised IOException - close() called before closeArchiveEntry()");
- } catch (IOException expected) {
+ } catch (final IOException expected) {
}
aos1.closeArchiveEntry();
try {
aos1.closeArchiveEntry();
fail("Should have raised IOException - closeArchiveEntry() called with no open entry");
- } catch (IOException expected) {
+ } catch (final IOException expected) {
}
aos1.finish();
aos1.close();
try {
aos1.finish();
fail("Should have raised IOException - finish() called after close()");
- } catch (IOException expected) {
+ } catch (final IOException expected) {
}
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
index ec1ead4..4c78f93 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
@@ -53,7 +53,7 @@ public class ArchiveStreamFactoryTest {
new ArchiveStreamFactory()
.createArchiveInputStream(new ByteArrayInputStream("This certainly is not a tar archive, really, no kidding".getBytes()));
fail("created an input stream for a non-archive");
- } catch (ArchiveException ae) {
+ } catch (final ArchiveException ae) {
assertTrue(ae.getMessage().startsWith("No Archiver found"));
}
}
@@ -63,13 +63,13 @@ public class ArchiveStreamFactoryTest {
*/
@Test
public void aiffFilesAreNoTARs() throws Exception {
- FileInputStream fis = new FileInputStream("src/test/resources/testAIFF.aif");
+ final FileInputStream fis = new FileInputStream("src/test/resources/testAIFF.aif");
try {
- InputStream is = new BufferedInputStream(fis);
+ final InputStream is = new BufferedInputStream(fis);
try {
new ArchiveStreamFactory().createArchiveInputStream(is);
fail("created an input stream for a non-archive");
- } catch (ArchiveException ae) {
+ } catch (final ArchiveException ae) {
assertTrue(ae.getMessage().startsWith("No Archiver found"));
} finally {
is.close();
@@ -81,13 +81,13 @@ public class ArchiveStreamFactoryTest {
@Test
public void testCOMPRESS209() throws Exception {
- FileInputStream fis = new FileInputStream("src/test/resources/testCompress209.doc");
+ final FileInputStream fis = new FileInputStream("src/test/resources/testCompress209.doc");
try {
- InputStream bis = new BufferedInputStream(fis);
+ final InputStream bis = new BufferedInputStream(fis);
try {
new ArchiveStreamFactory().createArchiveInputStream(bis);
fail("created an input stream for a non-archive");
- } catch (ArchiveException ae) {
+ } catch (final ArchiveException ae) {
assertTrue(ae.getMessage().startsWith("No Archiver found"));
} finally {
bis.close();
@@ -118,13 +118,13 @@ public class ArchiveStreamFactoryTest {
*/
@Test
public void detectsAndThrowsFor7z() throws Exception {
- FileInputStream fis = new FileInputStream("src/test/resources/bla.7z");
+ final FileInputStream fis = new FileInputStream("src/test/resources/bla.7z");
try {
- InputStream bis = new BufferedInputStream(fis);
+ final InputStream bis = new BufferedInputStream(fis);
try {
new ArchiveStreamFactory().createArchiveInputStream(bis);
fail("Expected a StreamingNotSupportedException");
- } catch (StreamingNotSupportedException ex) {
+ } catch (final StreamingNotSupportedException ex) {
assertEquals(ArchiveStreamFactory.SEVEN_Z, ex.getFormat());
} finally {
bis.close();
@@ -141,11 +141,11 @@ public class ArchiveStreamFactoryTest {
*/
@Test
public void skipsPK00Prefix() throws Exception {
- FileInputStream fis = new FileInputStream("src/test/resources/COMPRESS-208.zip");
+ final FileInputStream fis = new FileInputStream("src/test/resources/COMPRESS-208.zip");
try {
- InputStream bis = new BufferedInputStream(fis);
+ final InputStream bis = new BufferedInputStream(fis);
try {
- ArchiveInputStream ais = new ArchiveStreamFactory().createArchiveInputStream(bis);
+ final ArchiveInputStream ais = new ArchiveStreamFactory().createArchiveInputStream(bis);
try {
assertTrue(ais instanceof ZipArchiveInputStream);
} finally {
@@ -183,7 +183,7 @@ public class ArchiveStreamFactoryTest {
try {
fac.setEntryEncoding("US_ASCII");
fail("Expected IllegalStateException");
- } catch (IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
}
@@ -207,7 +207,7 @@ public class ArchiveStreamFactoryTest {
@SuppressWarnings("deprecation") // test of deprecated method
static ArchiveStreamFactory getFactory(final String entryEncoding) {
- ArchiveStreamFactory fac = new ArchiveStreamFactory();
+ final ArchiveStreamFactory fac = new ArchiveStreamFactory();
fac.setEntryEncoding(entryEncoding);
return fac;
}
@@ -233,18 +233,18 @@ public class ArchiveStreamFactoryTest {
dflt = UNKNOWN;
try {
dflt = getField(new ArjArchiveInputStream(new FileInputStream(getFile("bla.arj"))), "charsetName");
- } catch (ArchiveException e) {
+ } catch (final ArchiveException e) {
e.printStackTrace();
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
ARJ_DEFAULT = dflt;
dflt = UNKNOWN;
try {
dflt = getField(new DumpArchiveInputStream(new FileInputStream(getFile("bla.dump"))), "encoding");
- } catch (ArchiveException e) {
+ } catch (final ArchiveException e) {
e.printStackTrace();
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
DUMP_DEFAULT = dflt;
@@ -292,8 +292,8 @@ public class ArchiveStreamFactoryTest {
public void testEncodingInputStreamAutodetect() throws Exception {
int failed = 0;
for(int i = 1; i <= TESTS.length; i++) {
- TestData test = TESTS[i-1];
- ArchiveInputStream ais = getInputStreamFor(test.testFile, test.fac);
+ final TestData test = TESTS[i-1];
+ final ArchiveInputStream ais = getInputStreamFor(test.testFile, test.fac);
final String field = getField(ais,test.fieldName);
if (!eq(test.expectedEncoding,field)) {
System.out.println("Failed test " + i + ". expected: " + test.expectedEncoding + " actual: " + field + " type: " + test.type);
@@ -309,8 +309,8 @@ public class ArchiveStreamFactoryTest {
public void testEncodingInputStream() throws Exception {
int failed = 0;
for(int i = 1; i <= TESTS.length; i++) {
- TestData test = TESTS[i-1];
- ArchiveInputStream ais = getInputStreamFor(test.type, test.testFile, test.fac);
+ final TestData test = TESTS[i-1];
+ final ArchiveInputStream ais = getInputStreamFor(test.type, test.testFile, test.fac);
final String field = getField(ais,test.fieldName);
if (!eq(test.expectedEncoding,field)) {
System.out.println("Failed test " + i + ". expected: " + test.expectedEncoding + " actual: " + field + " type: " + test.type);
@@ -326,9 +326,9 @@ public class ArchiveStreamFactoryTest {
public void testEncodingOutputStream() throws Exception {
int failed = 0;
for(int i = 1; i <= TESTS.length; i++) {
- TestData test = TESTS[i-1];
+ final TestData test = TESTS[i-1];
if (test.hasOutputStream) {
- ArchiveOutputStream ais = getOutputStreamFor(test.type, test.fac);
+ final ArchiveOutputStream ais = getOutputStreamFor(test.type, test.fac);
final String field = getField(ais, test.fieldName);
if (!eq(test.expectedEncoding, field)) {
System.out.println("Failed test " + i + ". expected: " + test.expectedEncoding + " actual: " + field + " type: " + test.type);
@@ -350,19 +350,19 @@ public class ArchiveStreamFactoryTest {
}
private static String getField(final Object instance, final String name) {
- Class<?> cls = instance.getClass();
+ final Class<?> cls = instance.getClass();
Field fld;
try {
fld = cls.getDeclaredField(name);
- } catch (NoSuchFieldException nsfe) {
+ } catch (final NoSuchFieldException nsfe) {
try {
fld = cls.getSuperclass().getDeclaredField(name);
- } catch (NoSuchFieldException e) {
+ } catch (final NoSuchFieldException e) {
System.out.println("Cannot find " + name + " in class " + instance.getClass().getSimpleName());
return UNKNOWN;
}
}
- boolean isAccessible = fld.isAccessible();
+ final boolean isAccessible = fld.isAccessible();
try {
if (!isAccessible) {
fld.setAccessible(true);
@@ -373,7 +373,7 @@ public class ArchiveStreamFactoryTest {
}
System.out.println("Wrong type: " + object.getClass().getCanonicalName() + " for " + name + " in class " + instance.getClass().getSimpleName());
return UNKNOWN;
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
return UNKNOWN;
} finally {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/CpioTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/CpioTestCase.java b/src/test/java/org/apache/commons/compress/archivers/CpioTestCase.java
index 248a52f..5f623ca 100644
--- a/src/test/java/org/apache/commons/compress/archivers/CpioTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/CpioTestCase.java
@@ -92,10 +92,10 @@ public final class CpioTestCase extends AbstractTestCase {
final ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream("cpio", is);
- Map<String, File> result = new HashMap<String, File>();
+ final Map<String, File> result = new HashMap<String, File>();
ArchiveEntry entry = null;
while ((entry = in.getNextEntry()) != null) {
- File cpioget = new File(dir, entry.getName());
+ final File cpioget = new File(dir, entry.getName());
final OutputStream out = new FileOutputStream(cpioget);
IOUtils.copy(in, out);
out.close();
@@ -115,7 +115,7 @@ public final class CpioTestCase extends AbstractTestCase {
@Test
public void testDirectoryEntryFromFile() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
CpioArchiveOutputStream tos = null;
CpioArchiveInputStream tis = null;
@@ -123,14 +123,14 @@ public final class CpioTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".cpio", tmp[0]);
archive.deleteOnExit();
tos = new CpioArchiveOutputStream(new FileOutputStream(archive));
- long beforeArchiveWrite = tmp[0].lastModified();
- CpioArchiveEntry in = new CpioArchiveEntry(tmp[0], "foo");
+ final long beforeArchiveWrite = tmp[0].lastModified();
+ final CpioArchiveEntry in = new CpioArchiveEntry(tmp[0], "foo");
tos.putArchiveEntry(in);
tos.closeArchiveEntry();
tos.close();
tos = null;
tis = new CpioArchiveInputStream(new FileInputStream(archive));
- CpioArchiveEntry out = tis.getNextCPIOEntry();
+ final CpioArchiveEntry out = tis.getNextCPIOEntry();
tis.close();
tis = null;
assertNotNull(out);
@@ -155,7 +155,7 @@ public final class CpioTestCase extends AbstractTestCase {
@Test
public void testExplicitDirectoryEntry() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
CpioArchiveOutputStream tos = null;
CpioArchiveInputStream tis = null;
@@ -163,8 +163,8 @@ public final class CpioTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".cpio", tmp[0]);
archive.deleteOnExit();
tos = new CpioArchiveOutputStream(new FileOutputStream(archive));
- long beforeArchiveWrite = tmp[0].lastModified();
- CpioArchiveEntry in = new CpioArchiveEntry("foo/");
+ final long beforeArchiveWrite = tmp[0].lastModified();
+ final CpioArchiveEntry in = new CpioArchiveEntry("foo/");
in.setTime(beforeArchiveWrite / 1000);
in.setMode(CpioConstants.C_ISDIR);
tos.putArchiveEntry(in);
@@ -172,7 +172,7 @@ public final class CpioTestCase extends AbstractTestCase {
tos.close();
tos = null;
tis = new CpioArchiveInputStream(new FileInputStream(archive));
- CpioArchiveEntry out = tis.getNextCPIOEntry();
+ final CpioArchiveEntry out = tis.getNextCPIOEntry();
tis.close();
tis = null;
assertNotNull(out);
@@ -196,7 +196,7 @@ public final class CpioTestCase extends AbstractTestCase {
@Test
public void testFileEntryFromFile() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
CpioArchiveOutputStream tos = null;
CpioArchiveInputStream tis = null;
@@ -205,9 +205,9 @@ public final class CpioTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".cpio", tmp[0]);
archive.deleteOnExit();
tos = new CpioArchiveOutputStream(new FileOutputStream(archive));
- CpioArchiveEntry in = new CpioArchiveEntry(tmp[1], "foo");
+ final CpioArchiveEntry in = new CpioArchiveEntry(tmp[1], "foo");
tos.putArchiveEntry(in);
- byte[] b = new byte[(int) tmp[1].length()];
+ final byte[] b = new byte[(int) tmp[1].length()];
fis = new FileInputStream(tmp[1]);
while (fis.read(b) > 0) {
tos.write(b);
@@ -218,7 +218,7 @@ public final class CpioTestCase extends AbstractTestCase {
tos.close();
tos = null;
tis = new CpioArchiveInputStream(new FileInputStream(archive));
- CpioArchiveEntry out = tis.getNextCPIOEntry();
+ final CpioArchiveEntry out = tis.getNextCPIOEntry();
tis.close();
tis = null;
assertNotNull(out);
@@ -245,7 +245,7 @@ public final class CpioTestCase extends AbstractTestCase {
@Test
public void testExplicitFileEntry() throws Exception {
- File[] tmp = createTempDirAndFile();
+ final File[] tmp = createTempDirAndFile();
File archive = null;
CpioArchiveOutputStream tos = null;
CpioArchiveInputStream tis = null;
@@ -254,12 +254,12 @@ public final class CpioTestCase extends AbstractTestCase {
archive = File.createTempFile("test.", ".cpio", tmp[0]);
archive.deleteOnExit();
tos = new CpioArchiveOutputStream(new FileOutputStream(archive));
- CpioArchiveEntry in = new CpioArchiveEntry("foo");
+ final CpioArchiveEntry in = new CpioArchiveEntry("foo");
in.setTime(tmp[1].lastModified() / 1000);
in.setSize(tmp[1].length());
in.setMode(CpioConstants.C_ISREG);
tos.putArchiveEntry(in);
- byte[] b = new byte[(int) tmp[1].length()];
+ final byte[] b = new byte[(int) tmp[1].length()];
fis = new FileInputStream(tmp[1]);
while (fis.read(b) > 0) {
tos.write(b);
@@ -270,7 +270,7 @@ public final class CpioTestCase extends AbstractTestCase {
tos.close();
tos = null;
tis = new CpioArchiveInputStream(new FileInputStream(archive));
- CpioArchiveEntry out = tis.getNextCPIOEntry();
+ final CpioArchiveEntry out = tis.getNextCPIOEntry();
tis.close();
tis = null;
assertNotNull(out);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java b/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java
index f8155f0..899fdcd 100644
--- a/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java
@@ -55,7 +55,7 @@ public final class DumpTestCase extends AbstractTestCase {
ArchiveEntry entry = in.getNextEntry();
while (entry != null) {
- File archiveEntry = new File(dir, entry.getName());
+ final File archiveEntry = new File(dir, entry.getName());
archiveEntry.getParentFile().mkdirs();
if (entry.isDirectory()) {
archiveEntry.mkdir();
@@ -112,7 +112,7 @@ public final class DumpTestCase extends AbstractTestCase {
}
private void checkDumpArchive(final File f) throws Exception {
- ArrayList<String> expected = new ArrayList<String>();
+ final ArrayList<String> expected = new ArrayList<String>();
expected.add("");
expected.add("lost+found/");
expected.add("test1.xml");
[10/46] commons-compress git commit: Some more lost EOL properties
Posted by bo...@apache.org.
Some more lost EOL properties
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/7d07cb3f
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/7d07cb3f
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/7d07cb3f
Branch: refs/heads/COMPRESS-207
Commit: 7d07cb3f05e6cc8237831c74447d97577bffdde5
Parents: 74e4301
Author: Sebb <se...@apache.org>
Authored: Fri Apr 8 19:21:59 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Fri Apr 8 19:21:59 2016 +0100
----------------------------------------------------------------------
.gitattributes | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/7d07cb3f/.gitattributes
----------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes
index a1de9b4..631f41a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4,3 +4,7 @@ src/test/resources/longpath/minotaur.ar eol=lf
# These must be identical to the copies in SHRUNK.ZIP
src/test/resources/test1.xml eol=lf
src/test/resources/test2.xml eol=lf
+src/test/resources/test3.xml eol=lf
+src/test/resources/test4.xml eol=lf
+src/test/resources/test?with?spaces.txt eol=lf
+src/test/resources/test.txt eol=lf
[38/46] commons-compress git commit: Add final modifier to local
variables.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
index c4eabeb..0d9cd3e 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
@@ -57,11 +57,11 @@ public class ParallelScatterZipCreatorTest {
public void concurrent()
throws Exception {
result = File.createTempFile("parallelScatterGather1", "");
- ZipArchiveOutputStream zos = new ZipArchiveOutputStream(result);
+ final ZipArchiveOutputStream zos = new ZipArchiveOutputStream(result);
zos.setEncoding("UTF-8");
- ParallelScatterZipCreator zipCreator = new ParallelScatterZipCreator();
+ final ParallelScatterZipCreator zipCreator = new ParallelScatterZipCreator();
- Map<String, byte[]> entries = writeEntries(zipCreator);
+ final Map<String, byte[]> entries = writeEntries(zipCreator);
zipCreator.writeTo(zos);
zos.close();
removeEntriesFoundInZipFile(result, entries);
@@ -73,19 +73,19 @@ public class ParallelScatterZipCreatorTest {
public void callableApi()
throws Exception {
result = File.createTempFile("parallelScatterGather2", "");
- ZipArchiveOutputStream zos = new ZipArchiveOutputStream(result);
+ final ZipArchiveOutputStream zos = new ZipArchiveOutputStream(result);
zos.setEncoding("UTF-8");
- ExecutorService es = Executors.newFixedThreadPool(1);
+ final ExecutorService es = Executors.newFixedThreadPool(1);
- ScatterGatherBackingStoreSupplier supp = new ScatterGatherBackingStoreSupplier() {
+ final ScatterGatherBackingStoreSupplier supp = new ScatterGatherBackingStoreSupplier() {
@Override
public ScatterGatherBackingStore get() throws IOException {
return new FileBasedScatterGatherBackingStore(tmp = File.createTempFile("parallelscatter", "n1"));
}
};
- ParallelScatterZipCreator zipCreator = new ParallelScatterZipCreator(es, supp);
- Map<String, byte[]> entries = writeEntriesAsCallable(zipCreator);
+ final ParallelScatterZipCreator zipCreator = new ParallelScatterZipCreator(es, supp);
+ final Map<String, byte[]> entries = writeEntriesAsCallable(zipCreator);
zipCreator.writeTo(zos);
zos.close();
@@ -96,23 +96,23 @@ public class ParallelScatterZipCreatorTest {
}
private void removeEntriesFoundInZipFile(final File result, final Map<String, byte[]> entries) throws IOException {
- ZipFile zf = new ZipFile(result);
- Enumeration<ZipArchiveEntry> entriesInPhysicalOrder = zf.getEntriesInPhysicalOrder();
+ final ZipFile zf = new ZipFile(result);
+ final Enumeration<ZipArchiveEntry> entriesInPhysicalOrder = zf.getEntriesInPhysicalOrder();
while (entriesInPhysicalOrder.hasMoreElements()){
- ZipArchiveEntry zipArchiveEntry = entriesInPhysicalOrder.nextElement();
- InputStream inputStream = zf.getInputStream(zipArchiveEntry);
- byte[] actual = IOUtils.toByteArray(inputStream);
- byte[] expected = entries.remove(zipArchiveEntry.getName());
+ final ZipArchiveEntry zipArchiveEntry = entriesInPhysicalOrder.nextElement();
+ final InputStream inputStream = zf.getInputStream(zipArchiveEntry);
+ final byte[] actual = IOUtils.toByteArray(inputStream);
+ final byte[] expected = entries.remove(zipArchiveEntry.getName());
assertArrayEquals( "For " + zipArchiveEntry.getName(), expected, actual);
}
zf.close();
}
private Map<String, byte[]> writeEntries(final ParallelScatterZipCreator zipCreator) {
- Map<String, byte[]> entries = new HashMap<String, byte[]>();
+ final Map<String, byte[]> entries = new HashMap<String, byte[]>();
for (int i = 0; i < NUMITEMS; i++){
final byte[] payloadBytes = ("content" + i).getBytes();
- ZipArchiveEntry za = createZipArchiveEntry(entries, i, payloadBytes);
+ final ZipArchiveEntry za = createZipArchiveEntry(entries, i, payloadBytes);
zipCreator.addArchiveEntry(za, new InputStreamSupplier() {
@Override
public InputStream get() {
@@ -124,10 +124,10 @@ public class ParallelScatterZipCreatorTest {
}
private Map<String, byte[]> writeEntriesAsCallable(final ParallelScatterZipCreator zipCreator) {
- Map<String, byte[]> entries = new HashMap<String, byte[]>();
+ final Map<String, byte[]> entries = new HashMap<String, byte[]>();
for (int i = 0; i < NUMITEMS; i++){
final byte[] payloadBytes = ("content" + i).getBytes();
- ZipArchiveEntry za = createZipArchiveEntry(entries, i, payloadBytes);
+ final ZipArchiveEntry za = createZipArchiveEntry(entries, i, payloadBytes);
final Callable<Object> callable = zipCreator.createCallable(za, new InputStreamSupplier() {
@Override
public InputStream get() {
@@ -140,7 +140,7 @@ public class ParallelScatterZipCreatorTest {
}
private ZipArchiveEntry createZipArchiveEntry(final Map<String, byte[]> entries, final int i, final byte[] payloadBytes) {
- ZipArchiveEntry za = new ZipArchiveEntry( "file" + i);
+ final ZipArchiveEntry za = new ZipArchiveEntry( "file" + i);
entries.put( za.getName(), payloadBytes);
za.setMethod(ZipEntry.DEFLATED);
za.setSize(payloadBytes.length);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
index 8125576..d94f294 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
@@ -34,17 +34,17 @@ public class ScatterSampleTest {
@Test
public void testSample() throws Exception {
- File result = File.createTempFile("testSample", "fe");
+ final File result = File.createTempFile("testSample", "fe");
createFile(result);
checkFile(result);
}
private void createFile(final File result) throws IOException, ExecutionException, InterruptedException {
- ScatterSample scatterSample = new ScatterSample();
- ZipArchiveEntry archiveEntry = new ZipArchiveEntry("test1.xml");
+ final ScatterSample scatterSample = new ScatterSample();
+ final ZipArchiveEntry archiveEntry = new ZipArchiveEntry("test1.xml");
archiveEntry.setMethod(ZipEntry.DEFLATED);
- InputStreamSupplier supp = new InputStreamSupplier() {
+ final InputStreamSupplier supp = new InputStreamSupplier() {
@Override
public InputStream get() {
return new ByteArrayInputStream("Hello".getBytes());
@@ -52,18 +52,18 @@ public class ScatterSampleTest {
};
scatterSample.addEntry(archiveEntry, supp);
- ZipArchiveOutputStream zipArchiveOutputStream = new ZipArchiveOutputStream(result);
+ final ZipArchiveOutputStream zipArchiveOutputStream = new ZipArchiveOutputStream(result);
scatterSample.writeTo(zipArchiveOutputStream);
zipArchiveOutputStream.close();
}
private void checkFile(final File result) throws IOException {
- ZipFile zf = new ZipFile(result);
- ZipArchiveEntry archiveEntry1 = zf.getEntries().nextElement();
+ final ZipFile zf = new ZipFile(result);
+ final ZipArchiveEntry archiveEntry1 = zf.getEntries().nextElement();
assertEquals( "test1.xml", archiveEntry1.getName());
- InputStream inputStream = zf.getInputStream(archiveEntry1);
- byte[] b = new byte[6];
- int i = IOUtils.readFully(inputStream, b);
+ final InputStream inputStream = zf.getInputStream(archiveEntry1);
+ final byte[] b = new byte[6];
+ final int i = IOUtils.readFully(inputStream, b);
assertEquals(5, i);
assertEquals('H', b[0]);
assertEquals('o', b[4]);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
index f7550ce..388b2ca 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
@@ -46,27 +46,27 @@ public class ScatterZipOutputStreamTest {
@Test
public void putArchiveEntry() throws Exception {
scatterFile = File.createTempFile("scattertest", ".notzip");
- ScatterZipOutputStream scatterZipOutputStream = ScatterZipOutputStream.fileBased(scatterFile);
+ final ScatterZipOutputStream scatterZipOutputStream = ScatterZipOutputStream.fileBased(scatterFile);
final byte[] B_PAYLOAD = "RBBBBBBS".getBytes();
final byte[] A_PAYLOAD = "XAAY".getBytes();
- ZipArchiveEntry zab = new ZipArchiveEntry("b.txt");
+ final ZipArchiveEntry zab = new ZipArchiveEntry("b.txt");
zab.setMethod(ZipEntry.DEFLATED);
final ByteArrayInputStream payload = new ByteArrayInputStream(B_PAYLOAD);
scatterZipOutputStream.addArchiveEntry(createZipArchiveEntryRequest(zab, createPayloadSupplier(payload)));
- ZipArchiveEntry zae = new ZipArchiveEntry("a.txt");
+ final ZipArchiveEntry zae = new ZipArchiveEntry("a.txt");
zae.setMethod(ZipEntry.DEFLATED);
- ByteArrayInputStream payload1 = new ByteArrayInputStream(A_PAYLOAD);
+ final ByteArrayInputStream payload1 = new ByteArrayInputStream(A_PAYLOAD);
scatterZipOutputStream.addArchiveEntry(createZipArchiveEntryRequest(zae, createPayloadSupplier(payload1)));
target = File.createTempFile("scattertest", ".zip");
- ZipArchiveOutputStream outputStream = new ZipArchiveOutputStream(target);
+ final ZipArchiveOutputStream outputStream = new ZipArchiveOutputStream(target);
scatterZipOutputStream.writeTo( outputStream);
outputStream.close();
scatterZipOutputStream.close();
- ZipFile zf = new ZipFile(target);
+ final ZipFile zf = new ZipFile(target);
final ZipArchiveEntry b_entry = zf.getEntries("b.txt").iterator().next();
assertEquals(8, b_entry.getSize());
assertArrayEquals(B_PAYLOAD, IOUtils.toByteArray(zf.getInputStream(b_entry)));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/StreamCompressorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/StreamCompressorTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/StreamCompressorTest.java
index 905751f..27505c4 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/StreamCompressorTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/StreamCompressorTest.java
@@ -30,8 +30,8 @@ public class StreamCompressorTest {
@Test
public void storedEntries() throws Exception {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- StreamCompressor sc = StreamCompressor.create( baos);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final StreamCompressor sc = StreamCompressor.create( baos);
sc.deflate(new ByteArrayInputStream("A".getBytes()), ZipEntry.STORED);
sc.deflate(new ByteArrayInputStream("BAD".getBytes()), ZipEntry.STORED);
assertEquals(3, sc.getBytesRead());
@@ -43,15 +43,15 @@ public class StreamCompressorTest {
@Test
public void deflatedEntries() throws Exception {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- StreamCompressor sc = StreamCompressor.create( baos);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final StreamCompressor sc = StreamCompressor.create( baos);
sc.deflate(new ByteArrayInputStream("AAAAAABBBBBB".getBytes()), ZipEntry.DEFLATED);
assertEquals(12, sc.getBytesRead());
assertEquals(8, sc.getBytesWrittenForLastEntry());
assertEquals(3299542, sc.getCrc32());
final byte[] actuals = baos.toByteArray();
- byte[] expected = new byte[]{115,116,4,1,39,48,0,0};
+ final byte[] expected = new byte[]{115,116,4,1,39,48,0,0};
// Note that this test really asserts stuff about the java Deflater, which might be a little bit brittle
assertArrayEquals(expected, actuals);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
index 27d1889..aecc005 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
@@ -96,7 +96,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
*/
@Test
public void testRead7ZipArchive() throws IOException {
- File archive = getFile("utf8-7zip-test.zip");
+ final File archive = getFile("utf8-7zip-test.zip");
ZipFile zf = null;
try {
zf = new ZipFile(archive, CP437, false);
@@ -110,7 +110,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
@Test
public void testRead7ZipArchiveForStream() throws IOException {
- FileInputStream archive =
+ final FileInputStream archive =
new FileInputStream(getFile("utf8-7zip-test.zip"));
ZipArchiveInputStream zi = null;
try {
@@ -131,7 +131,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
*/
@Test
public void testReadWinZipArchive() throws IOException {
- File archive = getFile("utf8-winzip-test.zip");
+ final File archive = getFile("utf8-winzip-test.zip");
ZipFile zf = null;
try {
zf = new ZipFile(archive, null, true);
@@ -144,9 +144,9 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
}
private void assertCanRead(final ZipFile zf, final String fileName) throws IOException {
- ZipArchiveEntry entry = zf.getEntry(fileName);
+ final ZipArchiveEntry entry = zf.getEntry(fileName);
assertNotNull("Entry doesn't exist", entry);
- InputStream is = zf.getInputStream(entry);
+ final InputStream is = zf.getInputStream(entry);
assertNotNull("InputStream is null", is);
try {
is.read();
@@ -157,7 +157,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
@Test
public void testReadWinZipArchiveForStream() throws IOException {
- FileInputStream archive =
+ final FileInputStream archive =
new FileInputStream(getFile("utf8-winzip-test.zip"));
ZipArchiveInputStream zi = null;
try {
@@ -174,12 +174,12 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
@Test
public void testZipFileReadsUnicodeFields() throws IOException {
- File file = File.createTempFile("unicode-test", ".zip");
+ final File file = File.createTempFile("unicode-test", ".zip");
file.deleteOnExit();
ZipArchiveInputStream zi = null;
try {
createTestFile(file, CharsetNames.US_ASCII, false, true);
- FileInputStream archive = new FileInputStream(file);
+ final FileInputStream archive = new FileInputStream(file);
zi = new ZipArchiveInputStream(archive, CharsetNames.US_ASCII, true);
assertEquals(OIL_BARREL_TXT, zi.getNextEntry().getName());
assertEquals(EURO_FOR_DOLLAR_TXT, zi.getNextEntry().getName());
@@ -195,7 +195,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
@Test
public void testZipArchiveInputStreamReadsUnicodeFields()
throws IOException {
- File file = File.createTempFile("unicode-test", ".zip");
+ final File file = File.createTempFile("unicode-test", ".zip");
file.deleteOnExit();
ZipFile zf = null;
try {
@@ -213,7 +213,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
@Test
public void testRawNameReadFromZipFile()
throws IOException {
- File archive = getFile("utf8-7zip-test.zip");
+ final File archive = getFile("utf8-7zip-test.zip");
ZipFile zf = null;
try {
zf = new ZipFile(archive, CP437, false);
@@ -226,7 +226,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
@Test
public void testRawNameReadFromStream()
throws IOException {
- FileInputStream archive =
+ final FileInputStream archive =
new FileInputStream(getFile("utf8-7zip-test.zip"));
ZipArchiveInputStream zi = null;
try {
@@ -243,7 +243,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
final boolean withExplicitUnicodeExtra)
throws IOException {
- File file = File.createTempFile(encoding + "-test", ".zip");
+ final File file = File.createTempFile(encoding + "-test", ".zip");
file.deleteOnExit();
try {
createTestFile(file, encoding, withEFS, withExplicitUnicodeExtra);
@@ -258,7 +258,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
final boolean withExplicitUnicodeExtra)
throws UnsupportedEncodingException, IOException {
- ZipEncoding zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
+ final ZipEncoding zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
ZipArchiveOutputStream zos = null;
try {
@@ -275,7 +275,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
if (withExplicitUnicodeExtra
&& !zipEncoding.canEncode(ze.getName())) {
- ByteBuffer en = zipEncoding.encode(ze.getName());
+ final ByteBuffer en = zipEncoding.encode(ze.getName());
ze.addExtraField(new UnicodePathExtraField(ze.getName(),
en.array(),
@@ -292,7 +292,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
if (withExplicitUnicodeExtra
&& !zipEncoding.canEncode(ze.getName())) {
- ByteBuffer en = zipEncoding.encode(ze.getName());
+ final ByteBuffer en = zipEncoding.encode(ze.getName());
ze.addExtraField(new UnicodePathExtraField(ze.getName(),
en.array(),
@@ -310,7 +310,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
if (withExplicitUnicodeExtra
&& !zipEncoding.canEncode(ze.getName())) {
- ByteBuffer en = zipEncoding.encode(ze.getName());
+ final ByteBuffer en = zipEncoding.encode(ze.getName());
ze.addExtraField(new UnicodePathExtraField(ze.getName(),
en.array(),
@@ -328,7 +328,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
if (zos != null) {
try {
zos.close();
- } catch (IOException e) { /* swallow */ }
+ } catch (final IOException e) { /* swallow */ }
}
}
}
@@ -339,9 +339,9 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
try {
zf = new ZipFile(file, encoding, false);
- Enumeration<ZipArchiveEntry> e = zf.getEntries();
+ final Enumeration<ZipArchiveEntry> e = zf.getEntries();
while (e.hasMoreElements()) {
- ZipArchiveEntry ze = e.nextElement();
+ final ZipArchiveEntry ze = e.nextElement();
if (ze.getName().endsWith("sser.txt")) {
assertUnicodeName(ze, OIL_BARREL_TXT, encoding);
@@ -368,13 +368,13 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
final String encoding)
throws IOException {
if (!expectedName.equals(ze.getName())) {
- UnicodePathExtraField ucpf = findUniCodePath(ze);
+ final UnicodePathExtraField ucpf = findUniCodePath(ze);
assertNotNull(ucpf);
- ZipEncoding enc = ZipEncodingHelper.getZipEncoding(encoding);
- ByteBuffer ne = enc.encode(ze.getName());
+ final ZipEncoding enc = ZipEncodingHelper.getZipEncoding(encoding);
+ final ByteBuffer ne = enc.encode(ze.getName());
- CRC32 crc = new CRC32();
+ final CRC32 crc = new CRC32();
crc.update(ne.array(), ne.arrayOffset(),
ne.limit() - ne.position());
@@ -386,8 +386,8 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
@Test
public void testUtf8Interoperability() throws IOException {
- File file1 = getFile("utf8-7zip-test.zip");
- File file2 = getFile("utf8-winzip-test.zip");
+ final File file1 = getFile("utf8-7zip-test.zip");
+ final File file2 = getFile("utf8-winzip-test.zip");
testFile(file1,CP437);
testFile(file2,CP437);
@@ -395,7 +395,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
}
private static void assertRawNameOfAcsiiTxt(final ZipArchiveEntry ze) {
- byte[] b = ze.getRawName();
+ final byte[] b = ze.getRawName();
assertNotNull(b);
final int len = ASCII_TXT.length();
assertEquals(len, b.length);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/X000A_NTFSTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/X000A_NTFSTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/X000A_NTFSTest.java
index 76f4317..277d360 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/X000A_NTFSTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/X000A_NTFSTest.java
@@ -27,14 +27,14 @@ public class X000A_NTFSTest {
@Test
public void simpleRountrip() throws Exception {
- X000A_NTFS xf = new X000A_NTFS();
+ final X000A_NTFS xf = new X000A_NTFS();
xf.setModifyJavaTime(new Date(0));
// one second past midnight
xf.setAccessJavaTime(new Date(-11644473601000l));
xf.setCreateJavaTime(null);
- byte[] b = xf.getLocalFileDataData();
+ final byte[] b = xf.getLocalFileDataData();
- X000A_NTFS xf2 = new X000A_NTFS();
+ final X000A_NTFS xf2 = new X000A_NTFS();
xf2.parseFromLocalFileData(b, 0, b.length);
assertEquals(new Date(0), xf2.getModifyJavaTime());
assertEquals(new Date(-11644473601000l), xf2.getAccessJavaTime());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
index 17ec460..06c77d3 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
@@ -107,37 +107,37 @@ public class X5455_ExtendedTimestampTest {
http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/90df6756406f
*/
- File archive = getFile("COMPRESS-210_unix_time_zip_test.zip");
+ final File archive = getFile("COMPRESS-210_unix_time_zip_test.zip");
ZipFile zf = null;
try {
zf = new ZipFile(archive);
- Enumeration<ZipArchiveEntry> en = zf.getEntries();
+ final Enumeration<ZipArchiveEntry> en = zf.getEntries();
// We expect EVERY entry of this zip file
// to contain extra field 0x5455.
while (en.hasMoreElements()) {
- ZipArchiveEntry zae = en.nextElement();
- String name = zae.getName();
- X5455_ExtendedTimestamp xf = (X5455_ExtendedTimestamp) zae.getExtraField(X5455);
- Date rawZ = zae.getLastModifiedDate();
- Date m = xf.getModifyJavaTime();
- boolean zipTimeUsesExtendedTimestamp = rawZ.equals(m);
- Date z = zipTimeUsesExtendedTimestamp ? rawZ : adjustFromGMTToExpectedOffset(rawZ);
- Date a = xf.getAccessJavaTime();
+ final ZipArchiveEntry zae = en.nextElement();
+ final String name = zae.getName();
+ final X5455_ExtendedTimestamp xf = (X5455_ExtendedTimestamp) zae.getExtraField(X5455);
+ final Date rawZ = zae.getLastModifiedDate();
+ final Date m = xf.getModifyJavaTime();
+ final boolean zipTimeUsesExtendedTimestamp = rawZ.equals(m);
+ final Date z = zipTimeUsesExtendedTimestamp ? rawZ : adjustFromGMTToExpectedOffset(rawZ);
+ final Date a = xf.getAccessJavaTime();
- String zipTime = DATE_FORMAT.format(z);
- String modTime = DATE_FORMAT.format(m);
- String accTime = DATE_FORMAT.format(a);
+ final String zipTime = DATE_FORMAT.format(z);
+ final String modTime = DATE_FORMAT.format(m);
+ final String accTime = DATE_FORMAT.format(a);
if (!zae.isDirectory()) {
- int x = name.lastIndexOf('/');
- String yearString = name.substring(x + 1);
+ final int x = name.lastIndexOf('/');
+ final String yearString = name.substring(x + 1);
int year;
try {
year = Integer.parseInt(yearString);
- } catch (NumberFormatException nfe) {
+ } catch (final NumberFormatException nfe) {
year = -1;
}
if (year >= 0) {
@@ -229,22 +229,22 @@ public class X5455_ExtendedTimestampTest {
public void testGettersSetters() {
// X5455 is concerned with time, so let's
// get a timestamp to play with (Jan 1st, 2000).
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+ final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
cal.set(Calendar.YEAR, 2000);
cal.set(Calendar.MONTH, Calendar.JANUARY);
cal.set(Calendar.DATE, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
- Date timeMillis = cal.getTime();
- ZipLong time = new ZipLong(timeMillis.getTime() / 1000);
+ final Date timeMillis = cal.getTime();
+ final ZipLong time = new ZipLong(timeMillis.getTime() / 1000);
// set too big
try {
// Java time is 1000 x larger (milliseconds).
xf.setModifyJavaTime(new Date(1000L * (MAX_TIME_SECONDS.getValue() + 1L)));
fail("Time too big for 32 bits!");
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
// All is good.
}
@@ -423,13 +423,13 @@ public class X5455_ExtendedTimestampTest {
@Test
public void testWriteReadRoundtrip() throws IOException {
tmpDir = mkdir("X5455");
- File output = new File(tmpDir, "write_rewrite.zip");
+ final File output = new File(tmpDir, "write_rewrite.zip");
final OutputStream out = new FileOutputStream(output);
- Date d = new Date(97, 8, 24, 15, 10, 2);
+ final Date d = new Date(97, 8, 24, 15, 10, 2);
ZipArchiveOutputStream os = null;
try {
os = new ZipArchiveOutputStream(out);
- ZipArchiveEntry ze = new ZipArchiveEntry("foo");
+ final ZipArchiveEntry ze = new ZipArchiveEntry("foo");
xf.setModifyJavaTime(d);
xf.setFlags((byte) 1);
ze.addExtraField(xf);
@@ -442,9 +442,9 @@ public class X5455_ExtendedTimestampTest {
}
out.close();
- ZipFile zf = new ZipFile(output);
- ZipArchiveEntry ze = zf.getEntry("foo");
- X5455_ExtendedTimestamp ext =
+ final ZipFile zf = new ZipFile(output);
+ final ZipArchiveEntry ze = zf.getEntry("foo");
+ final X5455_ExtendedTimestamp ext =
(X5455_ExtendedTimestamp) ze.getExtraField(X5455);
assertNotNull(ext);
assertTrue(ext.isBit0_modifyTimePresent());
@@ -548,7 +548,7 @@ public class X5455_ExtendedTimestampTest {
* with GMT-8 so we need to adjust for the difference.
*/
private static Date adjustFromGMTToExpectedOffset(final Date from) {
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.setTime(from);
cal.add(Calendar.MILLISECOND, cal.get(Calendar.ZONE_OFFSET));
if (cal.getTimeZone().inDaylightTime(from)) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/X7875_NewUnixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/X7875_NewUnixTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/X7875_NewUnixTest.java
index db53171..b148809 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/X7875_NewUnixTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/X7875_NewUnixTest.java
@@ -46,20 +46,20 @@ public class X7875_NewUnixTest {
@Test
public void testSampleFile() throws Exception {
- File archive = getFile("COMPRESS-211_uid_gid_zip_test.zip");
+ final File archive = getFile("COMPRESS-211_uid_gid_zip_test.zip");
ZipFile zf = null;
try {
zf = new ZipFile(archive);
- Enumeration<ZipArchiveEntry> en = zf.getEntries();
+ final Enumeration<ZipArchiveEntry> en = zf.getEntries();
// We expect EVERY entry of this zip file (dir & file) to
// contain extra field 0x7875.
while (en.hasMoreElements()) {
- ZipArchiveEntry zae = en.nextElement();
- String name = zae.getName();
- X7875_NewUnix xf = (X7875_NewUnix) zae.getExtraField(X7875);
+ final ZipArchiveEntry zae = en.nextElement();
+ final String name = zae.getName();
+ final X7875_NewUnix xf = (X7875_NewUnix) zae.getExtraField(X7875);
// The directory entry in the test zip file is uid/gid 1000.
long expected = 1000;
@@ -97,7 +97,7 @@ public class X7875_NewUnixTest {
public void testMisc() throws Exception {
assertFalse(xf.equals(new Object()));
assertTrue(xf.toString().startsWith("0x7875 Zip Extra Field"));
- Object o = xf.clone();
+ final Object o = xf.clone();
assertEquals(o.hashCode(), xf.hashCode());
assertTrue(xf.equals(o));
xf.setUID(12345);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraFieldTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraFieldTest.java
index 8e2f23b..e366ffa 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraFieldTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraFieldTest.java
@@ -39,20 +39,20 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testWriteCDOnlySizes() {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField(SIZE, CSIZE);
assertEquals(new ZipShort(16), f.getCentralDirectoryLength());
- byte[] b = f.getCentralDirectoryData();
+ final byte[] b = f.getCentralDirectoryData();
assertEquals(16, b.length);
checkSizes(b);
}
@Test
public void testWriteCDSizeAndOffset() {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField(SIZE, CSIZE, OFF, null);
assertEquals(new ZipShort(24), f.getCentralDirectoryLength());
- byte[] b = f.getCentralDirectoryData();
+ final byte[] b = f.getCentralDirectoryData();
assertEquals(24, b.length);
checkSizes(b);
checkOffset(b, 16);
@@ -60,10 +60,10 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testWriteCDSizeOffsetAndDisk() {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField(SIZE, CSIZE, OFF, DISK);
assertEquals(new ZipShort(28), f.getCentralDirectoryLength());
- byte[] b = f.getCentralDirectoryData();
+ final byte[] b = f.getCentralDirectoryData();
assertEquals(28, b.length);
checkSizes(b);
checkOffset(b, 16);
@@ -72,10 +72,10 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testWriteCDSizeAndDisk() {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField(SIZE, CSIZE, null, DISK);
assertEquals(new ZipShort(20), f.getCentralDirectoryLength());
- byte[] b = f.getCentralDirectoryData();
+ final byte[] b = f.getCentralDirectoryData();
assertEquals(20, b.length);
checkSizes(b);
checkDisk(b, 16);
@@ -83,9 +83,9 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testReadLFHSizesOnly() throws ZipException {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField();
- byte[] b = new byte[16];
+ final byte[] b = new byte[16];
System.arraycopy(SIZE.getBytes(), 0, b, 0, 8);
System.arraycopy(CSIZE.getBytes(), 0, b, 8, 8);
f.parseFromLocalFileData(b, 0, b.length);
@@ -97,9 +97,9 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testReadLFHSizesAndOffset() throws ZipException {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField();
- byte[] b = new byte[24];
+ final byte[] b = new byte[24];
System.arraycopy(SIZE.getBytes(), 0, b, 0, 8);
System.arraycopy(CSIZE.getBytes(), 0, b, 8, 8);
System.arraycopy(OFF.getBytes(), 0, b, 16, 8);
@@ -112,9 +112,9 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testReadLFHSizesOffsetAndDisk() throws ZipException {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField();
- byte[] b = new byte[28];
+ final byte[] b = new byte[28];
System.arraycopy(SIZE.getBytes(), 0, b, 0, 8);
System.arraycopy(CSIZE.getBytes(), 0, b, 8, 8);
System.arraycopy(OFF.getBytes(), 0, b, 16, 8);
@@ -128,9 +128,9 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testReadLFHSizesAndDisk() throws ZipException {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField();
- byte[] b = new byte[20];
+ final byte[] b = new byte[20];
System.arraycopy(SIZE.getBytes(), 0, b, 0, 8);
System.arraycopy(CSIZE.getBytes(), 0, b, 8, 8);
System.arraycopy(DISK.getBytes(), 0, b, 16, 4);
@@ -143,9 +143,9 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testReadCDSizesOffsetAndDisk() throws ZipException {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField();
- byte[] b = new byte[28];
+ final byte[] b = new byte[28];
System.arraycopy(SIZE.getBytes(), 0, b, 0, 8);
System.arraycopy(CSIZE.getBytes(), 0, b, 8, 8);
System.arraycopy(OFF.getBytes(), 0, b, 16, 8);
@@ -159,9 +159,9 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testReadCDSizesAndOffset() throws ZipException {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField();
- byte[] b = new byte[24];
+ final byte[] b = new byte[24];
System.arraycopy(SIZE.getBytes(), 0, b, 0, 8);
System.arraycopy(CSIZE.getBytes(), 0, b, 8, 8);
System.arraycopy(OFF.getBytes(), 0, b, 16, 8);
@@ -174,9 +174,9 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testReadCDSomethingAndDisk() throws ZipException {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField();
- byte[] b = new byte[12];
+ final byte[] b = new byte[12];
System.arraycopy(SIZE.getBytes(), 0, b, 0, 8);
System.arraycopy(DISK.getBytes(), 0, b, 8, 4);
f.parseFromCentralDirectoryData(b, 0, b.length);
@@ -188,9 +188,9 @@ public class Zip64ExtendedInformationExtraFieldTest {
@Test
public void testReparseCDSingleEightByteData() throws ZipException {
- Zip64ExtendedInformationExtraField f =
+ final Zip64ExtendedInformationExtraField f =
new Zip64ExtendedInformationExtraField();
- byte[] b = new byte[8];
+ final byte[] b = new byte[8];
System.arraycopy(SIZE.getBytes(), 0, b, 0, 8);
f.parseFromCentralDirectoryData(b, 0, b.length);
f.reparseCentralDirectoryData(true, false, false, false);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
index 821329b..6a39623 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
@@ -143,12 +143,12 @@ public class Zip64SupportIT {
}
private static File write5GBZerosFile(final String testName) throws Throwable {
- File f = getTempFile(testName);
- ZipArchiveOutputStream zos = new ZipArchiveOutputStream(f);
+ final File f = getTempFile(testName);
+ final ZipArchiveOutputStream zos = new ZipArchiveOutputStream(f);
try {
zos.setUseZip64(Zip64Mode.Always);
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("5GB_of_Zeros");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("5GB_of_Zeros");
zae.setSize(FIVE_BILLION);
zae.setMethod(ZipEntry.DEFLATED);
zae.setCrc(0x8a408f16L);
@@ -158,7 +158,7 @@ public class Zip64SupportIT {
}
zos.closeArchiveEntry();
zos.close();
- } catch (IOException ex) {
+ } catch (final IOException ex) {
System.err.println("Failed to write archive because of: "
+ ex.getMessage()
+ " - likely not enough disk space.");
@@ -211,7 +211,7 @@ public class Zip64SupportIT {
zos.setUseZip64(mode);
}
write100KFilesToStream(zos);
- RandomAccessFile a = new RandomAccessFile(f, "r");
+ final RandomAccessFile a = new RandomAccessFile(f, "r");
try {
final long end = a.length();
@@ -220,7 +220,7 @@ public class Zip64SupportIT {
// value 0xFFFF as "number of entries".
a.seek(end
- 22 /* length of EOCD without file comment */);
- byte[] eocd = new byte[12];
+ final byte[] eocd = new byte[12];
a.readFully(eocd);
assertArrayEquals(new byte[] {
// sig
@@ -236,13 +236,13 @@ public class Zip64SupportIT {
// locator" is right in front of the EOCD and
// the location of the "Zip64 end of central
// directory record" seems correct
- long expectedZ64EocdOffset = end - 22 /* eocd.length */
+ final long expectedZ64EocdOffset = end - 22 /* eocd.length */
- 20 /* z64 eocd locator.length */
- 56 /* z64 eocd without extensible data sector */;
- byte[] loc =
+ final byte[] loc =
ZipEightByteInteger.getBytes(expectedZ64EocdOffset);
a.seek(end - 22 - 20);
- byte[] z64EocdLoc = new byte[20];
+ final byte[] z64EocdLoc = new byte[20];
a.readFully(z64EocdLoc);
assertArrayEquals(new byte[] {
// sig
@@ -261,7 +261,7 @@ public class Zip64SupportIT {
// known values are fine and read the location
// of the central directory from it
a.seek(expectedZ64EocdOffset);
- byte[] z64EocdStart = new byte[40];
+ final byte[] z64EocdStart = new byte[40];
a.readFully(z64EocdStart);
assertArrayEquals(new byte[] {
// sig
@@ -283,14 +283,14 @@ public class Zip64SupportIT {
0, 0, 0, 0,
}, z64EocdStart);
a.seek(expectedZ64EocdOffset + 48 /* skip size */);
- byte[] cdOffset = new byte[8];
+ final byte[] cdOffset = new byte[8];
a.readFully(cdOffset);
- long cdLoc = ZipEightByteInteger.getLongValue(cdOffset);
+ final long cdLoc = ZipEightByteInteger.getLongValue(cdOffset);
// finally verify there really is a central
// directory entry where the Zip64 EOCD claims
a.seek(cdLoc);
- byte[] sig = new byte[4];
+ final byte[] sig = new byte[4];
a.readFully(sig);
assertArrayEquals(new byte[] {
(byte) 0x50, (byte) 0x4b, 1, 2,
@@ -329,7 +329,7 @@ public class Zip64SupportIT {
try {
write100KFilesToStream(zos);
fail("expected a Zip64RequiredException");
- } catch (Zip64RequiredException ex) {
+ } catch (final Zip64RequiredException ex) {
assertEquals(Zip64RequiredException.TOO_MANY_ENTRIES_MESSAGE,
ex.getMessage());
}
@@ -383,7 +383,7 @@ public class Zip64SupportIT {
}
write3EntriesCreatingBigArchiveToStream(zos);
- RandomAccessFile a = new RandomAccessFile(f, "r");
+ final RandomAccessFile a = new RandomAccessFile(f, "r");
try {
getLengthAndPositionAtCentralDirectory(a);
// skip first two entries
@@ -397,7 +397,7 @@ public class Zip64SupportIT {
// grab third entry, verify offset is
// 0xFFFFFFFF and it has a ZIP64 extended
// information extra field
- byte[] header = new byte[12];
+ final byte[] header = new byte[12];
a.readFully(header);
assertArrayEquals(new byte[] {
// sig
@@ -413,7 +413,7 @@ public class Zip64SupportIT {
}, header);
// ignore timestamp, CRC, compressed size
a.skipBytes(12);
- byte[] rest = new byte[23];
+ final byte[] rest = new byte[23];
a.readFully(rest);
assertArrayEquals(new byte[] {
// Original Size
@@ -435,7 +435,7 @@ public class Zip64SupportIT {
// file name
(byte) '2'
}, rest);
- byte[] extra = new byte[4];
+ final byte[] extra = new byte[4];
a.readFully(extra);
assertArrayEquals(new byte[] {
// Header-ID
@@ -445,11 +445,11 @@ public class Zip64SupportIT {
}, extra);
// read offset of LFH
- byte[] offset = new byte[8];
+ final byte[] offset = new byte[8];
a.readFully(offset);
// verify there is a LFH where the CD claims it
a.seek(ZipEightByteInteger.getLongValue(offset));
- byte[] sig = new byte[4];
+ final byte[] sig = new byte[4];
a.readFully(sig);
assertArrayEquals(new byte[] {
(byte) 0x50, (byte) 0x4b, 3, 4,
@@ -496,7 +496,7 @@ public class Zip64SupportIT {
try {
write3EntriesCreatingBigArchiveToStream(zos);
fail("expected a Zip64RequiredException");
- } catch (Zip64RequiredException ex) {
+ } catch (final Zip64RequiredException ex) {
assertEquals(Zip64RequiredException.ARCHIVE_TOO_BIG_MESSAGE,
ex.getMessage());
}
@@ -530,10 +530,10 @@ public class Zip64SupportIT {
try {
zf = new ZipFile(f);
int idx = 0;
- for (Enumeration<ZipArchiveEntry> e =
+ for (final Enumeration<ZipArchiveEntry> e =
zf.getEntriesInPhysicalOrder();
e.hasMoreElements(); ) {
- ZipArchiveEntry zae = e.nextElement();
+ final ZipArchiveEntry zae = e.nextElement();
assertEquals(String.valueOf(idx),
zae.getName());
if (idx++ < 2) {
@@ -542,7 +542,7 @@ public class Zip64SupportIT {
} else {
assertEquals(1,
zae.getSize());
- InputStream i =
+ final InputStream i =
zf.getInputStream(zae);
try {
assertNotNull(i);
@@ -582,8 +582,8 @@ public class Zip64SupportIT {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
}
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(FIVE_BILLION);
zae.setCrc(0x5c316f50L);
@@ -596,7 +596,7 @@ public class Zip64SupportIT {
zos.closeArchiveEntry();
zos.close();
- RandomAccessFile a = new RandomAccessFile(f, "r");
+ final RandomAccessFile a = new RandomAccessFile(f, "r");
try {
getLengthAndPositionAtCentralDirectory(a);
@@ -644,7 +644,7 @@ public class Zip64SupportIT {
// file name
(byte) '0'
}, rest);
- byte[] extra = new byte[20];
+ final byte[] extra = new byte[20];
a.readFully(extra);
// 5e9 == 0x12A05F200
assertArrayEquals(new byte[] {
@@ -763,8 +763,8 @@ public class Zip64SupportIT {
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
try {
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(FIVE_BILLION);
zae.setCrc(0x5c316f50L);
@@ -776,7 +776,7 @@ public class Zip64SupportIT {
}
zos.closeArchiveEntry();
fail("expected a Zip64RequiredException");
- } catch (Zip64RequiredException ex) {
+ } catch (final Zip64RequiredException ex) {
assertTrue(ex.getMessage().startsWith("0's size"));
}
}
@@ -823,8 +823,8 @@ public class Zip64SupportIT {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
}
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(FIVE_BILLION);
}
@@ -836,12 +836,12 @@ public class Zip64SupportIT {
zos.closeArchiveEntry();
zos.close();
- RandomAccessFile a =
+ final RandomAccessFile a =
new RandomAccessFile(f, "r");
try {
getLengthAndPositionAtCentralDirectory(a);
- long cfhPos = a.getFilePointer();
+ final long cfhPos = a.getFilePointer();
// grab first entry, verify
// sizes are 0xFFFFFFFF and
// it has a ZIP64 extended
@@ -887,7 +887,7 @@ public class Zip64SupportIT {
// file name
(byte) '0'
}, rest);
- byte[] extra = new byte[20];
+ final byte[] extra = new byte[20];
a.readFully(extra);
// 5e9 == 0x12A05F200
assertArrayEquals(new byte[] {
@@ -1010,8 +1010,8 @@ public class Zip64SupportIT {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
}
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
zae.setMethod(ZipEntry.DEFLATED);
zos.putArchiveEntry(zae);
for (int j = 0; j < FIVE_BILLION / 1000 / 1000; j++) {
@@ -1019,7 +1019,7 @@ public class Zip64SupportIT {
}
zos.closeArchiveEntry();
fail("expected a Zip64RequiredException");
- } catch (Zip64RequiredException ex) {
+ } catch (final Zip64RequiredException ex) {
assertTrue(ex.getMessage().startsWith("0's size"));
}
}
@@ -1066,8 +1066,8 @@ public class Zip64SupportIT {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
}
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(FIVE_BILLION);
}
@@ -1081,7 +1081,7 @@ public class Zip64SupportIT {
zos.closeArchiveEntry();
zos.close();
- RandomAccessFile a = new RandomAccessFile(f, "r");
+ final RandomAccessFile a = new RandomAccessFile(f, "r");
try {
getLengthAndPositionAtCentralDirectory(a);
@@ -1238,14 +1238,14 @@ public class Zip64SupportIT {
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
try {
- ZipArchiveEntry zae =
+ final ZipArchiveEntry zae =
new ZipArchiveEntry("0");
zae.setSize(FIVE_BILLION);
zae.setMethod(ZipEntry.DEFLATED);
zos.putArchiveEntry(zae);
fail("expected a"
+ " Zip64RequiredException");
- } catch (Zip64RequiredException ex) {
+ } catch (final Zip64RequiredException ex) {
assertTrue(ex.getMessage()
.startsWith("0's size"));
}
@@ -1271,8 +1271,8 @@ public class Zip64SupportIT {
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
try {
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(FIVE_BILLION);
}
@@ -1285,7 +1285,7 @@ public class Zip64SupportIT {
}
zos.closeArchiveEntry();
fail("expected a Zip64RequiredException");
- } catch (Zip64RequiredException ex) {
+ } catch (final Zip64RequiredException ex) {
assertTrue(ex.getMessage().startsWith("0's size"));
}
}
@@ -1328,8 +1328,8 @@ public class Zip64SupportIT {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
}
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(ONE_MILLION);
zae.setCrc(0x1279CB9EL);
@@ -1340,7 +1340,7 @@ public class Zip64SupportIT {
zos.closeArchiveEntry();
zos.close();
- RandomAccessFile a = new RandomAccessFile(f, "r");
+ final RandomAccessFile a = new RandomAccessFile(f, "r");
try {
getLengthAndPositionAtCentralDirectory(a);
@@ -1394,7 +1394,7 @@ public class Zip64SupportIT {
// has a ZIP64 extra field if and only if size was
// unknown and mode was not Never or the mode was
// Always (regardless of size)
- boolean hasExtra = mode == Zip64Mode.Always
+ final boolean hasExtra = mode == Zip64Mode.Always
|| (mode == Zip64Mode.AsNeeded && !knownSize);
a.seek(0);
header = new byte[10];
@@ -1429,7 +1429,7 @@ public class Zip64SupportIT {
(byte) '0'
}, rest);
if (hasExtra) {
- byte[] extra = new byte[20];
+ final byte[] extra = new byte[20];
a.readFully(extra);
assertArrayEquals(new byte[] {
// Header-ID
@@ -1505,8 +1505,8 @@ public class Zip64SupportIT {
public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Always);
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(ONE_MILLION);
zae.setCrc(0x1279CB9EL);
@@ -1517,7 +1517,7 @@ public class Zip64SupportIT {
zos.closeArchiveEntry();
zos.close();
- RandomAccessFile a = new RandomAccessFile(f, "r");
+ final RandomAccessFile a = new RandomAccessFile(f, "r");
try {
getLengthAndPositionAtCentralDirectory(a);
@@ -1670,8 +1670,8 @@ public class Zip64SupportIT {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
}
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(ONE_MILLION);
}
@@ -1681,11 +1681,11 @@ public class Zip64SupportIT {
zos.closeArchiveEntry();
zos.close();
- RandomAccessFile a = new RandomAccessFile(f, "r");
+ final RandomAccessFile a = new RandomAccessFile(f, "r");
try {
getLengthAndPositionAtCentralDirectory(a);
- long cfhPos = a.getFilePointer();
+ final long cfhPos = a.getFilePointer();
// grab first entry, verify sizes are not
// 0xFFFFFFF and it has no ZIP64 extended
// information extra field
@@ -1705,7 +1705,7 @@ public class Zip64SupportIT {
}, header);
// ignore timestamp
a.skipBytes(4);
- byte[] crc = new byte[4];
+ final byte[] crc = new byte[4];
a.readFully(crc);
assertArrayEquals(new byte[] {
(byte) 0x9E, (byte) 0xCB,
@@ -1841,8 +1841,8 @@ public class Zip64SupportIT {
public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Always);
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(ONE_MILLION);
}
@@ -1852,11 +1852,11 @@ public class Zip64SupportIT {
zos.closeArchiveEntry();
zos.close();
- RandomAccessFile a = new RandomAccessFile(f, "r");
+ final RandomAccessFile a = new RandomAccessFile(f, "r");
try {
getLengthAndPositionAtCentralDirectory(a);
- long cfhPos = a.getFilePointer();
+ final long cfhPos = a.getFilePointer();
// grab first entry, verify sizes are not
// 0xFFFFFFF and it has an empty ZIP64 extended
// information extra field
@@ -1876,7 +1876,7 @@ public class Zip64SupportIT {
}, header);
// ignore timestamp
a.skipBytes(4);
- byte[] crc = new byte[4];
+ final byte[] crc = new byte[4];
a.readFully(crc);
assertArrayEquals(new byte[] {
(byte) 0x9E, (byte) 0xCB,
@@ -2026,8 +2026,8 @@ public class Zip64SupportIT {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
}
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(ONE_MILLION);
}
@@ -2037,7 +2037,7 @@ public class Zip64SupportIT {
zos.closeArchiveEntry();
zos.close();
- RandomAccessFile a = new RandomAccessFile(f, "r");
+ final RandomAccessFile a = new RandomAccessFile(f, "r");
try {
getLengthAndPositionAtCentralDirectory(a);
@@ -2117,7 +2117,7 @@ public class Zip64SupportIT {
rest = new byte[9];
a.readFully(rest);
- boolean hasExtra =
+ final boolean hasExtra =
mode == Zip64Mode.AsNeeded && !knownSize;
assertArrayEquals(new byte[] {
@@ -2131,7 +2131,7 @@ public class Zip64SupportIT {
(byte) '0'
}, rest);
if (hasExtra) {
- byte[] extra = new byte[12];
+ final byte[] extra = new byte[12];
a.readFully(extra);
assertArrayEquals(new byte[] {
// Header-ID
@@ -2199,8 +2199,8 @@ public class Zip64SupportIT {
public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Always);
- byte[] buf = new byte[ONE_MILLION];
- ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ final byte[] buf = new byte[ONE_MILLION];
+ final ZipArchiveEntry zae = new ZipArchiveEntry("0");
if (knownSize) {
zae.setSize(ONE_MILLION);
}
@@ -2210,7 +2210,7 @@ public class Zip64SupportIT {
zos.closeArchiveEntry();
zos.close();
- RandomAccessFile a = new RandomAccessFile(f, "r");
+ final RandomAccessFile a = new RandomAccessFile(f, "r");
try {
getLengthAndPositionAtCentralDirectory(a);
@@ -2352,14 +2352,14 @@ public class Zip64SupportIT {
final ZipOutputTest test,
final boolean useRandomAccessFile)
throws Throwable {
- File f = getTempFile(testName);
+ final File f = getTempFile(testName);
BufferedOutputStream os = null;
- ZipArchiveOutputStream zos = useRandomAccessFile
+ final ZipArchiveOutputStream zos = useRandomAccessFile
? new ZipArchiveOutputStream(f)
: new ZipArchiveOutputStream(os = new BufferedOutputStream(new FileOutputStream(f)));
try {
test.test(f, zos);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
System.err.println("Failed to write archive because of: "
+ ex.getMessage()
+ " - likely not enough disk space.");
@@ -2421,14 +2421,14 @@ public class Zip64SupportIT {
}
private static File getTempFile(final String testName) throws Throwable {
- File f = File.createTempFile("commons-compress-" + testName, ".zip");
+ final File f = File.createTempFile("commons-compress-" + testName, ".zip");
f.deleteOnExit();
return f;
}
private static void read5GBOfZerosImpl(final File f, final String expectedName)
throws IOException {
- FileInputStream fin = new FileInputStream(f);
+ final FileInputStream fin = new FileInputStream(f);
ZipArchiveInputStream zin = null;
try {
zin = new ZipArchiveInputStream(fin);
@@ -2437,15 +2437,15 @@ public class Zip64SupportIT {
zae = zin.getNextZipEntry();
}
assertEquals(expectedName, zae.getName());
- byte[] buf = new byte[1024 * 1024];
+ final byte[] buf = new byte[1024 * 1024];
long read = 0;
- Random r = new Random(System.currentTimeMillis());
+ final Random r = new Random(System.currentTimeMillis());
int readNow;
while ((readNow = zin.read(buf, 0, buf.length)) > 0) {
// testing all bytes for a value of 0 is going to take
// too long, just pick a few ones randomly
for (int i = 0; i < 1024; i++) {
- int idx = r.nextInt(readNow);
+ final int idx = r.nextInt(readNow);
assertEquals("testing byte " + (read + idx), 0, buf[idx]);
}
read += readNow;
@@ -2467,7 +2467,7 @@ public class Zip64SupportIT {
ZipFile zf = null;
try {
zf = new ZipFile(f);
- Enumeration<ZipArchiveEntry> e = zf.getEntries();
+ final Enumeration<ZipArchiveEntry> e = zf.getEntries();
assertTrue(e.hasMoreElements());
ZipArchiveEntry zae = e.nextElement();
while (zae.isDirectory()) {
@@ -2475,17 +2475,17 @@ public class Zip64SupportIT {
}
assertEquals(expectedName, zae.getName());
assertEquals(FIVE_BILLION, zae.getSize());
- byte[] buf = new byte[1024 * 1024];
+ final byte[] buf = new byte[1024 * 1024];
long read = 0;
- Random r = new Random(System.currentTimeMillis());
+ final Random r = new Random(System.currentTimeMillis());
int readNow;
- InputStream zin = zf.getInputStream(zae);
+ final InputStream zin = zf.getInputStream(zae);
try {
while ((readNow = zin.read(buf, 0, buf.length)) > 0) {
// testing all bytes for a value of 0 is going to take
// too long, just pick a few ones randomly
for (int i = 0; i < 1024; i++) {
- int idx = r.nextInt(readNow);
+ final int idx = r.nextInt(readNow);
assertEquals("testing byte " + (read + idx), 0, buf[idx]);
}
read += readNow;
@@ -2501,7 +2501,7 @@ public class Zip64SupportIT {
}
private static void read100KFilesImpl(final File f) throws IOException {
- FileInputStream fin = new FileInputStream(f);
+ final FileInputStream fin = new FileInputStream(f);
ZipArchiveInputStream zin = null;
try {
zin = new ZipArchiveInputStream(fin);
@@ -2528,8 +2528,8 @@ public class Zip64SupportIT {
try {
zf = new ZipFile(f);
int files = 0;
- for (Enumeration<ZipArchiveEntry> e = zf.getEntries(); e.hasMoreElements(); ) {
- ZipArchiveEntry zae = e.nextElement();
+ for (final Enumeration<ZipArchiveEntry> e = zf.getEntries(); e.hasMoreElements(); ) {
+ final ZipArchiveEntry zae = e.nextElement();
if (!zae.isDirectory()) {
files++;
assertEquals(0, zae.getSize());
@@ -2545,7 +2545,7 @@ public class Zip64SupportIT {
throws IOException {
final long end = a.length();
a.seek(end - 22 - 20);
- byte[] sig = new byte[4];
+ final byte[] sig = new byte[4];
a.readFully(sig);
if (sig[0] != (byte) 0x50 || sig[1] != (byte) 0x4b
|| sig[2] != 6 || sig[3] != 7) {
@@ -2553,10 +2553,10 @@ public class Zip64SupportIT {
return getLengthAndPositionAtCentralDirectory32(a, end);
}
- long cdOffsetLoc = end - 22 - 20 - 56 + 48;
+ final long cdOffsetLoc = end - 22 - 20 - 56 + 48;
// seek to central directory locator
a.seek(cdOffsetLoc);
- byte[] cdOffset = new byte[8];
+ final byte[] cdOffset = new byte[8];
a.readFully(cdOffset);
a.seek(ZipEightByteInteger.getLongValue(cdOffset));
return end;
@@ -2565,7 +2565,7 @@ public class Zip64SupportIT {
private static long getLengthAndPositionAtCentralDirectory32(final RandomAccessFile a, final long end)
throws IOException {
a.seek(end - 22 + 16);
- byte[] cdOffset = new byte[4];
+ final byte[] cdOffset = new byte[4];
a.readFully(cdOffset);
a.seek(ZipLong.getValue(cdOffset));
return end;
@@ -2574,7 +2574,7 @@ public class Zip64SupportIT {
private static void write100KFilesToStream(final ZipArchiveOutputStream zos)
throws IOException {
for (int i = 0; i < ONE_HUNDRED_THOUSAND; i++) {
- ZipArchiveEntry zae = new ZipArchiveEntry(String.valueOf(i));
+ final ZipArchiveEntry zae = new ZipArchiveEntry(String.valueOf(i));
zae.setSize(0);
zos.putArchiveEntry(zae);
zos.closeArchiveEntry();
@@ -2585,7 +2585,7 @@ public class Zip64SupportIT {
private static void
write3EntriesCreatingBigArchiveToStream(final ZipArchiveOutputStream zos)
throws IOException {
- byte[] buf = new byte[ONE_MILLION];
+ final byte[] buf = new byte[ONE_MILLION];
ZipArchiveEntry zae = null;
for (int i = 0; i < 2; i++) {
zae = new ZipArchiveEntry(String.valueOf(i));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
index a0b4024..320b2ff 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
@@ -36,34 +36,34 @@ public class ZipArchiveEntryTest {
*/
@Test
public void testExtraFields() {
- AsiExtraField a = new AsiExtraField();
+ final AsiExtraField a = new AsiExtraField();
a.setDirectory(true);
a.setMode(0755);
- UnrecognizedExtraField u = new UnrecognizedExtraField();
+ final UnrecognizedExtraField u = new UnrecognizedExtraField();
u.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
u.setLocalFileDataData(new byte[0]);
- ZipArchiveEntry ze = new ZipArchiveEntry("test/");
+ final ZipArchiveEntry ze = new ZipArchiveEntry("test/");
ze.setExtraFields(new ZipExtraField[] {a, u});
- byte[] data1 = ze.getExtra();
+ final byte[] data1 = ze.getExtra();
ZipExtraField[] result = ze.getExtraFields();
assertEquals("first pass", 2, result.length);
assertSame(a, result[0]);
assertSame(u, result[1]);
- UnrecognizedExtraField u2 = new UnrecognizedExtraField();
+ final UnrecognizedExtraField u2 = new UnrecognizedExtraField();
u2.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
u2.setLocalFileDataData(new byte[] {1});
ze.addExtraField(u2);
- byte[] data2 = ze.getExtra();
+ final byte[] data2 = ze.getExtra();
result = ze.getExtraFields();
assertEquals("second pass", 2, result.length);
assertSame(a, result[0]);
assertSame(u2, result[1]);
assertEquals("length second pass", data1.length+1, data2.length);
- UnrecognizedExtraField u3 = new UnrecognizedExtraField();
+ final UnrecognizedExtraField u3 = new UnrecognizedExtraField();
u3.setHeaderId(new ZipShort(2));
u3.setLocalFileDataData(new byte[] {1});
ze.addExtraField(u3);
@@ -71,7 +71,7 @@ public class ZipArchiveEntryTest {
assertEquals("third pass", 3, result.length);
ze.removeExtraField(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
- byte[] data3 = ze.getExtra();
+ final byte[] data3 = ze.getExtra();
result = ze.getExtraFields();
assertEquals("fourth pass", 2, result.length);
assertSame(a, result[0]);
@@ -81,7 +81,7 @@ public class ZipArchiveEntryTest {
try {
ze.removeExtraField(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
fail("should be no such element");
- } catch (java.util.NoSuchElementException nse) {
+ } catch (final java.util.NoSuchElementException nse) {
}
}
@@ -90,19 +90,19 @@ public class ZipArchiveEntryTest {
*/
@Test
public void testExtraFieldMerging() {
- AsiExtraField a = new AsiExtraField();
+ final AsiExtraField a = new AsiExtraField();
a.setDirectory(true);
a.setMode(0755);
- UnrecognizedExtraField u = new UnrecognizedExtraField();
+ final UnrecognizedExtraField u = new UnrecognizedExtraField();
u.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
u.setLocalFileDataData(new byte[0]);
- ZipArchiveEntry ze = new ZipArchiveEntry("test/");
+ final ZipArchiveEntry ze = new ZipArchiveEntry("test/");
ze.setExtraFields(new ZipExtraField[] {a, u});
// merge
// Header-ID 1 + length 1 + one byte of data
- byte[] b = ExtraFieldUtilsTest.UNRECOGNIZED_HEADER.getBytes();
+ final byte[] b = ExtraFieldUtilsTest.UNRECOGNIZED_HEADER.getBytes();
ze.setCentralDirectoryExtra(new byte[] {b[0], b[1], 1, 0, 127});
ZipExtraField[] result = ze.getExtraFields();
@@ -137,30 +137,30 @@ public class ZipArchiveEntryTest {
*/
@Test
public void testAddAsFirstExtraField() {
- AsiExtraField a = new AsiExtraField();
+ final AsiExtraField a = new AsiExtraField();
a.setDirectory(true);
a.setMode(0755);
- UnrecognizedExtraField u = new UnrecognizedExtraField();
+ final UnrecognizedExtraField u = new UnrecognizedExtraField();
u.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
u.setLocalFileDataData(new byte[0]);
- ZipArchiveEntry ze = new ZipArchiveEntry("test/");
+ final ZipArchiveEntry ze = new ZipArchiveEntry("test/");
ze.setExtraFields(new ZipExtraField[] {a, u});
- byte[] data1 = ze.getExtra();
+ final byte[] data1 = ze.getExtra();
- UnrecognizedExtraField u2 = new UnrecognizedExtraField();
+ final UnrecognizedExtraField u2 = new UnrecognizedExtraField();
u2.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
u2.setLocalFileDataData(new byte[] {1});
ze.addAsFirstExtraField(u2);
- byte[] data2 = ze.getExtra();
+ final byte[] data2 = ze.getExtra();
ZipExtraField[] result = ze.getExtraFields();
assertEquals("second pass", 2, result.length);
assertSame(u2, result[0]);
assertSame(a, result[1]);
assertEquals("length second pass", data1.length + 1, data2.length);
- UnrecognizedExtraField u3 = new UnrecognizedExtraField();
+ final UnrecognizedExtraField u3 = new UnrecognizedExtraField();
u3.setHeaderId(new ZipShort(2));
u3.setLocalFileDataData(new byte[] {1});
ze.addAsFirstExtraField(u3);
@@ -209,9 +209,9 @@ public class ZipArchiveEntryTest {
*/
@Test
public void testCompressionMethod() throws Exception {
- ZipArchiveOutputStream zos =
+ final ZipArchiveOutputStream zos =
new ZipArchiveOutputStream(new ByteArrayOutputStream());
- ZipArchiveEntry entry = new ZipArchiveEntry("foo");
+ final ZipArchiveEntry entry = new ZipArchiveEntry("foo");
assertEquals(-1, entry.getMethod());
assertFalse(zos.canWriteEntryData(entry));
@@ -237,8 +237,8 @@ public class ZipArchiveEntryTest {
*/
@Test
public void testNotEquals() {
- ZipArchiveEntry entry1 = new ZipArchiveEntry("foo");
- ZipArchiveEntry entry2 = new ZipArchiveEntry("bar");
+ final ZipArchiveEntry entry1 = new ZipArchiveEntry("foo");
+ final ZipArchiveEntry entry2 = new ZipArchiveEntry("bar");
assertFalse(entry1.equals(entry2));
}
@@ -248,9 +248,9 @@ public class ZipArchiveEntryTest {
*/
@Test
public void testNullCommentEqualsEmptyComment() {
- ZipArchiveEntry entry1 = new ZipArchiveEntry("foo");
- ZipArchiveEntry entry2 = new ZipArchiveEntry("foo");
- ZipArchiveEntry entry3 = new ZipArchiveEntry("foo");
+ final ZipArchiveEntry entry1 = new ZipArchiveEntry("foo");
+ final ZipArchiveEntry entry2 = new ZipArchiveEntry("foo");
+ final ZipArchiveEntry entry3 = new ZipArchiveEntry("foo");
entry1.setComment(null);
entry2.setComment("");
entry3.setComment("bar");
@@ -261,11 +261,11 @@ public class ZipArchiveEntryTest {
@Test
public void testCopyConstructor() throws Exception {
- ZipArchiveEntry archiveEntry = new ZipArchiveEntry("fred");
+ final ZipArchiveEntry archiveEntry = new ZipArchiveEntry("fred");
archiveEntry.setUnixMode(0664);
archiveEntry.setMethod(ZipEntry.DEFLATED);
archiveEntry.getGeneralPurposeBit().useStrongEncryption(true);
- ZipArchiveEntry copy = new ZipArchiveEntry(archiveEntry);
+ final ZipArchiveEntry copy = new ZipArchiveEntry(archiveEntry);
assertEquals(archiveEntry, copy);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java
index 1a9bb5d..c0abdcc 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java
@@ -62,7 +62,7 @@ public class ZipArchiveInputStreamTest {
ZipArchiveInputStream in = null;
try {
zf = new ZipFile(getFile("COMPRESS-189.zip"));
- ZipArchiveEntry zae = zf.getEntry("USD0558682-20080101.ZIP");
+ final ZipArchiveEntry zae = zf.getEntry("USD0558682-20080101.ZIP");
in = new ZipArchiveInputStream(new BufferedInputStream(zf.getInputStream(zae)));
ZipArchiveEntry innerEntry;
while ((innerEntry = in.getNextZipEntry()) != null) {
@@ -82,16 +82,16 @@ public class ZipArchiveInputStreamTest {
@Test
public void shouldConsumeArchiveCompletely() throws Exception {
- InputStream is = ZipArchiveInputStreamTest.class
+ final InputStream is = ZipArchiveInputStreamTest.class
.getResourceAsStream("/archive_with_trailer.zip");
- ZipArchiveInputStream zip = new ZipArchiveInputStream(is);
+ final ZipArchiveInputStream zip = new ZipArchiveInputStream(is);
while (zip.getNextZipEntry() != null) {
// just consume the archive
}
- byte[] expected = new byte[] {
+ final byte[] expected = new byte[] {
'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\n'
};
- byte[] actual = new byte[expected.length];
+ final byte[] actual = new byte[expected.length];
is.read(actual);
assertArrayEquals(expected, actual);
zip.close();
@@ -126,7 +126,7 @@ public class ZipArchiveInputStreamTest {
@Test
public void testUnshrinkEntry() throws Exception {
- ZipArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(getFile("SHRUNK.ZIP")));
+ final ZipArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(getFile("SHRUNK.ZIP")));
ZipArchiveEntry entry = in.getNextZipEntry();
assertEquals("method", ZipMethod.UNSHRINKING.getCode(), entry.getMethod());
@@ -159,10 +159,10 @@ public class ZipArchiveInputStreamTest {
*/
@Test
public void testReadingOfFirstStoredEntry() throws Exception {
- ZipArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(getFile("COMPRESS-264.zip")));
+ final ZipArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(getFile("COMPRESS-264.zip")));
try {
- ZipArchiveEntry ze = in.getNextZipEntry();
+ final ZipArchiveEntry ze = in.getNextZipEntry();
assertEquals(5, ze.getSize());
assertArrayEquals(new byte[] {'d', 'a', 't', 'a', '\n'},
IOUtils.toByteArray(in));
@@ -173,12 +173,12 @@ public class ZipArchiveInputStreamTest {
@Test
public void testUnzipBZip2CompressedEntry() throws Exception {
- ZipArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(getFile("bzip2-zip.zip")));
+ final ZipArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(getFile("bzip2-zip.zip")));
try {
- ZipArchiveEntry ze = in.getNextZipEntry();
+ final ZipArchiveEntry ze = in.getNextZipEntry();
assertEquals(42, ze.getSize());
- byte[] expected = new byte[42];
+ final byte[] expected = new byte[42];
Arrays.fill(expected , (byte)'a');
assertArrayEquals(expected, IOUtils.toByteArray(in));
} finally {
[42/46] commons-compress git commit: Add final modifier to local
variables.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
index d66d068..e9c78c6 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
@@ -115,7 +115,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
public ZipArchiveEntry(final java.util.zip.ZipEntry entry) throws ZipException {
super(entry);
setName(entry.getName());
- byte[] extra = entry.getExtra();
+ final byte[] extra = entry.getExtra();
if (extra != null) {
setExtraFields(ExtraFieldUtils.parse(extra, true,
ExtraFieldUtils
@@ -143,7 +143,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
setExternalAttributes(entry.getExternalAttributes());
setExtraFields(getAllExtraFieldsNoCopy());
setPlatform(entry.getPlatform());
- GeneralPurposeBit other = entry.getGeneralPurposeBit();
+ final GeneralPurposeBit other = entry.getGeneralPurposeBit();
setGeneralPurposeBit(other == null ? null :
(GeneralPurposeBit) other.clone());
}
@@ -181,7 +181,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
*/
@Override
public Object clone() {
- ZipArchiveEntry e = (ZipArchiveEntry) super.clone();
+ final ZipArchiveEntry e = (ZipArchiveEntry) super.clone();
e.setInternalAttributes(getInternalAttributes());
e.setExternalAttributes(getExternalAttributes());
@@ -321,8 +321,8 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @param fields an array of extra fields
*/
public void setExtraFields(final ZipExtraField[] fields) {
- List<ZipExtraField> newFields = new ArrayList<ZipExtraField>();
- for (ZipExtraField field : fields) {
+ final List<ZipExtraField> newFields = new ArrayList<ZipExtraField>();
+ for (final ZipExtraField field : fields) {
if (field instanceof UnparseableExtraFieldData) {
unparseableExtra = (UnparseableExtraFieldData) field;
} else {
@@ -390,7 +390,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
}
private ZipExtraField[] copyOf(final ZipExtraField[] src, final int length) {
- ZipExtraField[] cpy = new ZipExtraField[length];
+ final ZipExtraField[] cpy = new ZipExtraField[length];
System.arraycopy(src, 0, cpy, 0, Math.min(src.length, length));
return cpy;
}
@@ -449,8 +449,8 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
if (getExtraField(ze.getHeaderId()) != null){
removeExtraField(ze.getHeaderId());
}
- ZipExtraField[] copy = extraFields;
- int newLen = extraFields != null ? extraFields.length + 1: 1;
+ final ZipExtraField[] copy = extraFields;
+ final int newLen = extraFields != null ? extraFields.length + 1: 1;
extraFields = new ZipExtraField[newLen];
extraFields[0] = ze;
if (copy != null){
@@ -469,8 +469,8 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
throw new java.util.NoSuchElementException();
}
- List<ZipExtraField> newResult = new ArrayList<ZipExtraField>();
- for (ZipExtraField extraField : extraFields) {
+ final List<ZipExtraField> newResult = new ArrayList<ZipExtraField>();
+ for (final ZipExtraField extraField : extraFields) {
if (!type.equals(extraField.getHeaderId())){
newResult.add( extraField);
}
@@ -503,7 +503,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
*/
public ZipExtraField getExtraField(final ZipShort type) {
if (extraFields != null) {
- for (ZipExtraField extraField : extraFields) {
+ for (final ZipExtraField extraField : extraFields) {
if (type.equals(extraField.getHeaderId())) {
return extraField;
}
@@ -534,11 +534,11 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
@Override
public void setExtra(final byte[] extra) throws RuntimeException {
try {
- ZipExtraField[] local =
+ final ZipExtraField[] local =
ExtraFieldUtils.parse(extra, true,
ExtraFieldUtils.UnparseableExtraField.READ);
mergeExtraFields(local, true);
- } catch (ZipException e) {
+ } catch (final ZipException e) {
// actually this is not possible as of Commons Compress 1.1
throw new RuntimeException("Error parsing extra fields for entry: "
+ getName() + " - " + e.getMessage(), e);
@@ -561,11 +561,11 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
*/
public void setCentralDirectoryExtra(final byte[] b) {
try {
- ZipExtraField[] central =
+ final ZipExtraField[] central =
ExtraFieldUtils.parse(b, false,
ExtraFieldUtils.UnparseableExtraField.READ);
mergeExtraFields(central, false);
- } catch (ZipException e) {
+ } catch (final ZipException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
@@ -575,7 +575,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @return the extra data for local file
*/
public byte[] getLocalFileDataExtra() {
- byte[] extra = getExtra();
+ final byte[] extra = getExtra();
return extra != null ? extra : EMPTY;
}
@@ -671,7 +671,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
*/
public byte[] getRawName() {
if (rawName != null) {
- byte[] b = new byte[rawName.length];
+ final byte[] b = new byte[rawName.length];
System.arraycopy(rawName, 0, b, 0, rawName.length);
return b;
}
@@ -723,7 +723,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
if (extraFields == null) {
setExtraFields(f);
} else {
- for (ZipExtraField element : f) {
+ for (final ZipExtraField element : f) {
ZipExtraField existing;
if (element instanceof UnparseableExtraFieldData) {
existing = unparseableExtra;
@@ -734,10 +734,10 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
addExtraField(element);
} else {
if (local) {
- byte[] b = element.getLocalFileDataData();
+ final byte[] b = element.getLocalFileDataData();
existing.parseFromLocalFileData(b, 0, b.length);
} else {
- byte[] b = element.getCentralDirectoryData();
+ final byte[] b = element.getCentralDirectoryData();
existing.parseFromCentralDirectoryData(b, 0, b.length);
}
}
@@ -770,9 +770,9 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
if (obj == null || getClass() != obj.getClass()) {
return false;
}
- ZipArchiveEntry other = (ZipArchiveEntry) obj;
- String myName = getName();
- String otherName = other.getName();
+ final ZipArchiveEntry other = (ZipArchiveEntry) obj;
+ final String myName = getName();
+ final String otherName = other.getName();
if (myName == null) {
if (otherName != null) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
index d0eb5f1..d64ae4e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
@@ -235,11 +235,11 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
} else {
readFully(LFH_BUF);
}
- } catch (EOFException e) {
+ } catch (final EOFException e) {
return null;
}
- ZipLong sig = new ZipLong(LFH_BUF);
+ final ZipLong sig = new ZipLong(LFH_BUF);
if (sig.equals(ZipLong.CFH_SIG) || sig.equals(ZipLong.AED_SIG)) {
hitCentralDirectory = true;
skipRemainderOfArchive();
@@ -251,7 +251,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
int off = WORD;
current = new CurrentEntry();
- int versionMadeBy = ZipShort.getValue(LFH_BUF, off);
+ final int versionMadeBy = ZipShort.getValue(LFH_BUF, off);
off += SHORT;
current.entry.setPlatform((versionMadeBy >> ZipFile.BYTE_SHIFT) & ZipFile.NIBLET_MASK);
@@ -266,7 +266,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
current.entry.setMethod(ZipShort.getValue(LFH_BUF, off));
off += SHORT;
- long time = ZipUtil.dosToJavaTime(ZipLong.getValue(LFH_BUF, off));
+ final long time = ZipUtil.dosToJavaTime(ZipLong.getValue(LFH_BUF, off));
current.entry.setTime(time);
off += WORD;
@@ -284,18 +284,18 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
off += 3 * WORD;
}
- int fileNameLen = ZipShort.getValue(LFH_BUF, off);
+ final int fileNameLen = ZipShort.getValue(LFH_BUF, off);
off += SHORT;
- int extraLen = ZipShort.getValue(LFH_BUF, off);
+ final int extraLen = ZipShort.getValue(LFH_BUF, off);
off += SHORT;
- byte[] fileName = new byte[fileNameLen];
+ final byte[] fileName = new byte[fileNameLen];
readFully(fileName);
current.entry.setName(entryEncoding.decode(fileName), fileName);
- byte[] extraData = new byte[extraLen];
+ final byte[] extraData = new byte[extraLen];
readFully(extraData);
current.entry.setExtra(extraData);
@@ -329,7 +329,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
*/
private void readFirstLocalFileHeader(final byte[] lfh) throws IOException {
readFully(lfh);
- ZipLong sig = new ZipLong(lfh);
+ final ZipLong sig = new ZipLong(lfh);
if (sig.equals(ZipLong.DD_SIG)) {
throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException.Feature.SPLITTING);
}
@@ -337,7 +337,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
if (sig.equals(ZipLong.SINGLE_SEGMENT_SPLIT_MARKER)) {
// The archive is not really split as only one segment was
// needed in the end. Just skip over the marker.
- byte[] missedLfhBytes = new byte[4];
+ final byte[] missedLfhBytes = new byte[4];
readFully(missedLfhBytes);
System.arraycopy(lfh, 4, lfh, 0, LFH_LEN - 4);
System.arraycopy(missedLfhBytes, 0, lfh, LFH_LEN - 4, 4);
@@ -350,7 +350,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* doesn't use a data descriptor.
*/
private void processZip64Extra(final ZipLong size, final ZipLong cSize) {
- Zip64ExtendedInformationExtraField z64 =
+ final Zip64ExtendedInformationExtraField z64 =
(Zip64ExtendedInformationExtraField)
current.entry.getExtraField(Zip64ExtendedInformationExtraField.HEADER_ID);
current.usesZip64 = z64 != null;
@@ -381,7 +381,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
@Override
public boolean canReadEntryData(final ArchiveEntry ae) {
if (ae instanceof ZipArchiveEntry) {
- ZipArchiveEntry ze = (ZipArchiveEntry) ae;
+ final ZipArchiveEntry ze = (ZipArchiveEntry) ae;
return ZipUtil.canHandleEntryData(ze)
&& supportsDataDescriptorFor(ze);
@@ -443,14 +443,14 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
return lastStoredEntry.read(buffer, offset, length);
}
- long csize = current.entry.getSize();
+ final long csize = current.entry.getSize();
if (current.bytesRead >= csize) {
return -1;
}
if (buf.position() >= buf.limit()) {
buf.position(0);
- int l = in.read(buf.array());
+ final int l = in.read(buf.array());
if (l == -1) {
return -1;
}
@@ -474,7 +474,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* Implementation of read for DEFLATED entries.
*/
private int readDeflated(final byte[] buffer, final int offset, final int length) throws IOException {
- int read = readFromInflater(buffer, offset, length);
+ final int read = readFromInflater(buffer, offset, length);
if (read <= 0) {
if (inf.finished()) {
return -1;
@@ -497,7 +497,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
int read = 0;
do {
if (inf.needsInput()) {
- int l = fill();
+ final int l = fill();
if (l > 0) {
current.bytesReadFromStream += buf.limit();
} else if (l == -1) {
@@ -508,7 +508,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
}
try {
read = inf.inflate(buffer, offset, length);
- } catch (DataFormatException e) {
+ } catch (final DataFormatException e) {
throw (IOException) new ZipException(e.getMessage()).initCause(e);
}
} while (read == 0 && inf.needsInput());
@@ -547,8 +547,8 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
if (value >= 0) {
long skipped = 0;
while (skipped < value) {
- long rem = value - skipped;
- int x = read(SKIP_BUF, 0, (int) (SKIP_BUF.length > rem ? rem : SKIP_BUF.length));
+ final long rem = value - skipped;
+ final int x = read(SKIP_BUF, 0, (int) (SKIP_BUF.length > rem ? rem : SKIP_BUF.length));
if (x == -1) {
return skipped;
}
@@ -621,12 +621,12 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
} else {
skip(Long.MAX_VALUE);
- long inB = current.entry.getMethod() == ZipArchiveOutputStream.DEFLATED
+ final long inB = current.entry.getMethod() == ZipArchiveOutputStream.DEFLATED
? getBytesInflated() : current.bytesRead;
// this is at most a single read() operation and can't
// exceed the range of int
- int diff = (int) (current.bytesReadFromStream - inB);
+ final int diff = (int) (current.bytesReadFromStream - inB);
// Pushback any required bytes
if (diff > 0) {
@@ -651,7 +651,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
private void drainCurrentEntryData() throws IOException {
long remaining = current.entry.getCompressedSize() - current.bytesReadFromStream;
while (remaining > 0) {
- long n = in.read(buf.array(), 0, (int) Math.min(buf.capacity(), remaining));
+ final long n = in.read(buf.array(), 0, (int) Math.min(buf.capacity(), remaining));
if (n < 0) {
throw new EOFException("Truncated ZIP entry: " + current.entry.getName());
}
@@ -689,7 +689,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
if (closed) {
throw new IOException("The stream is closed");
}
- int length = in.read(buf.array());
+ final int length = in.read(buf.array());
if (length > 0) {
buf.limit(length);
count(buf.limit());
@@ -699,7 +699,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
}
private void readFully(final byte[] b) throws IOException {
- int count = IOUtils.readFully(in, b);
+ final int count = IOUtils.readFully(in, b);
count(count);
if (count < b.length) {
throw new EOFException();
@@ -728,7 +728,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
// If so, push back eight bytes and assume sizes are four
// bytes, otherwise sizes are eight bytes each.
readFully(TWO_DWORD_BUF);
- ZipLong potentialSig = new ZipLong(TWO_DWORD_BUF, DWORD);
+ final ZipLong potentialSig = new ZipLong(TWO_DWORD_BUF, DWORD);
if (potentialSig.equals(ZipLong.CFH_SIG) || potentialSig.equals(ZipLong.LFH_SIG)) {
pushback(TWO_DWORD_BUF, DWORD, DWORD);
current.entry.setCompressedSize(ZipLong.getValue(TWO_DWORD_BUF));
@@ -771,15 +771,15 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* next local file or central directory header.</p>
*/
private void readStoredEntry() throws IOException {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
int off = 0;
boolean done = false;
// length of DD without signature
- int ddLen = current.usesZip64 ? WORD + 2 * DWORD : 3 * WORD;
+ final int ddLen = current.usesZip64 ? WORD + 2 * DWORD : 3 * WORD;
while (!done) {
- int r = in.read(buf.array(), off, ZipArchiveOutputStream.BUFFER_SIZE - off);
+ final int r = in.read(buf.array(), off, ZipArchiveOutputStream.BUFFER_SIZE - off);
if (r <= 0) {
// read the whole archive without ever finding a
// central directory
@@ -797,7 +797,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
}
}
- byte[] b = bos.toByteArray();
+ final byte[] b = bos.toByteArray();
lastStoredEntry = new ByteArrayInputStream(b);
}
@@ -952,8 +952,8 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
if (value >= 0) {
long skipped = 0;
while (skipped < value) {
- long rem = value - skipped;
- int x = in.read(SKIP_BUF, 0, (int) (SKIP_BUF.length > rem ? rem : SKIP_BUF.length));
+ final long rem = value - skipped;
+ final int x = in.read(SKIP_BUF, 0, (int) (SKIP_BUF.length > rem ? rem : SKIP_BUF.length));
if (x == -1) {
return;
}
@@ -972,7 +972,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* Also updates bytes-read counter.
*/
private int readOneByte() throws IOException {
- int b = in.read();
+ final int b = in.read();
if (b != -1) {
count(1);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/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 873de5c..68b962d 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
@@ -285,7 +285,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
try {
_raf = new RandomAccessFile(file, "rw");
_raf.setLength(0);
- } catch (IOException e) {
+ } catch (final IOException e) {
IOUtils.closeQuietly(_raf);
_raf = null;
o = new FileOutputStream(file);
@@ -451,10 +451,10 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
}
private void writeCentralDirectoryInChunks() throws IOException {
- int NUM_PER_WRITE = 1000;
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(70 * NUM_PER_WRITE);
+ final int NUM_PER_WRITE = 1000;
+ final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(70 * NUM_PER_WRITE);
int count = 0;
- for (ZipArchiveEntry ze : entries) {
+ for (final ZipArchiveEntry ze : entries) {
byteArrayOutputStream.write(createCentralFileHeader(ze));
if (++count > NUM_PER_WRITE){
writeCounted(byteArrayOutputStream.toByteArray());
@@ -478,8 +478,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
flushDeflater();
- long bytesWritten = streamCompressor.getTotalBytesWritten() - entry.dataStart;
- long realCrc = streamCompressor.getCrc32();
+ final long bytesWritten = streamCompressor.getTotalBytesWritten() - entry.dataStart;
+ final long realCrc = streamCompressor.getCrc32();
entry.bytesRead = streamCompressor.getBytesRead();
final Zip64Mode effectiveMode = getEffectiveZip64Mode(entry.entry);
final boolean actuallyNeedsZip64 = handleSizesAndCrc(bytesWritten, realCrc, effectiveMode);
@@ -500,8 +500,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
private void closeCopiedEntry(final boolean phased) throws IOException {
preClose();
entry.bytesRead = entry.entry.getSize();
- Zip64Mode effectiveMode = getEffectiveZip64Mode(entry.entry);
- boolean actuallyNeedsZip64 = checkIfNeedsZip64(effectiveMode);
+ final Zip64Mode effectiveMode = getEffectiveZip64Mode(entry.entry);
+ final boolean actuallyNeedsZip64 = checkIfNeedsZip64(effectiveMode);
closeEntry(actuallyNeedsZip64, phased);
}
@@ -543,14 +543,14 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
*/
public void addRawArchiveEntry(final ZipArchiveEntry entry, final InputStream rawStream)
throws IOException {
- ZipArchiveEntry ae = new ZipArchiveEntry(entry);
+ final ZipArchiveEntry ae = new ZipArchiveEntry(entry);
if (hasZip64Extra(ae)) {
// Will be re-added as required. this may make the file generated with this method
// somewhat smaller than standard mode,
// since standard mode is unable to remove the zip 64 header.
ae.removeExtraField(Zip64ExtendedInformationExtraField.HEADER_ID);
}
- boolean is2PhaseSource = ae.getCrc() != ZipArchiveEntry.CRC_UNKNOWN
+ final boolean is2PhaseSource = ae.getCrc() != ZipArchiveEntry.CRC_UNKNOWN
&& ae.getSize() != ArchiveEntry.SIZE_UNKNOWN
&& ae.getCompressedSize() != ArchiveEntry.SIZE_UNKNOWN;
putArchiveEntry(ae, is2PhaseSource);
@@ -640,7 +640,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
*/
private void rewriteSizesAndCrc(final boolean actuallyNeedsZip64)
throws IOException {
- long save = raf.getFilePointer();
+ final long save = raf.getFilePointer();
raf.seek(entry.localDataStart);
writeOut(ZipLong.getBytes(entry.entry.getCrc()));
@@ -653,8 +653,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
}
if (hasZip64Extra(entry.entry)) {
- ByteBuffer name = getName(entry.entry);
- int nameLen = name.limit() - name.position();
+ final ByteBuffer name = getName(entry.entry);
+ final int nameLen = name.limit() - name.position();
// seek to ZIP64 extra, skip header and size information
raf.seek(entry.localDataStart + 3 * WORD + 2 * SHORT
+ nameLen + 2 * SHORT);
@@ -728,7 +728,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
if (shouldAddZip64Extra(entry.entry, effectiveMode)) {
- Zip64ExtendedInformationExtraField z64 = getZip64Extra(entry.entry);
+ final Zip64ExtendedInformationExtraField z64 = getZip64Extra(entry.entry);
// just a placeholder, real data will be in data
// descriptor or inserted later via RandomAccessFile
@@ -867,7 +867,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
@Override
public boolean canWriteEntryData(final ArchiveEntry ae) {
if (ae instanceof ZipArchiveEntry) {
- ZipArchiveEntry zae = (ZipArchiveEntry) ae;
+ final ZipArchiveEntry zae = (ZipArchiveEntry) ae;
return zae.getMethod() != ZipMethod.IMPLODING.getCode()
&& zae.getMethod() != ZipMethod.UNSHRINKING.getCode()
&& ZipUtil.canHandleEntryData(zae);
@@ -888,7 +888,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
throw new IllegalStateException("No current entry");
}
ZipUtil.checkRequestedFeatures(entry.entry);
- long writtenThisTime = streamCompressor.write(b, offset, length, entry.entry.getMethod());
+ final long writtenThisTime = streamCompressor.write(b, offset, length, entry.entry.getMethod());
count(writtenThisTime);
}
@@ -991,15 +991,15 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
}
private void writeLocalFileHeader(final ZipArchiveEntry ze, final boolean phased) throws IOException {
- boolean encodable = zipEncoding.canEncode(ze.getName());
- ByteBuffer name = getName(ze);
+ final boolean encodable = zipEncoding.canEncode(ze.getName());
+ final ByteBuffer name = getName(ze);
if (createUnicodeExtraFields != UnicodeExtraFieldPolicy.NEVER) {
addUnicodeExtraFields(ze, encodable, name);
}
final byte[] localHeader = createLocalFileHeader(ze, name, encodable, phased);
- long localHeaderStart = streamCompressor.getTotalBytesWritten();
+ final long localHeaderStart = streamCompressor.getTotalBytesWritten();
offsets.put(ze, localHeaderStart);
entry.localDataStart = localHeaderStart + LFH_CRC_OFFSET; // At crc offset
writeCounted(localHeader);
@@ -1009,10 +1009,10 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
private byte[] createLocalFileHeader(final ZipArchiveEntry ze, final ByteBuffer name, final boolean encodable,
final boolean phased) {
- byte[] extra = ze.getLocalFileDataExtra();
+ final byte[] extra = ze.getLocalFileDataExtra();
final int nameLen = name.limit() - name.position();
- int len= LFH_FILENAME_OFFSET + nameLen + extra.length;
- byte[] buf = new byte[len];
+ final int len= LFH_FILENAME_OFFSET + nameLen + extra.length;
+ final byte[] buf = new byte[len];
System.arraycopy(LFH_SIG, 0, buf, LFH_SIG_OFFSET, WORD);
@@ -1025,7 +1025,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
putShort(versionNeededToExtract(zipMethod, hasZip64Extra(ze)), buf, LFH_VERSION_NEEDED_OFFSET);
}
- GeneralPurposeBit generalPurposeBit = getGeneralPurposeBits(zipMethod, !encodable && fallbackToUTF8);
+ final GeneralPurposeBit generalPurposeBit = getGeneralPurposeBits(zipMethod, !encodable && fallbackToUTF8);
generalPurposeBit.encode(buf, LFH_GPB_OFFSET);
// compression method
@@ -1091,14 +1091,14 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
- name.position()));
}
- String comm = ze.getComment();
+ final String comm = ze.getComment();
if (comm != null && !"".equals(comm)) {
- boolean commentEncodable = zipEncoding.canEncode(comm);
+ final boolean commentEncodable = zipEncoding.canEncode(comm);
if (createUnicodeExtraFields == UnicodeExtraFieldPolicy.ALWAYS
|| !commentEncodable) {
- ByteBuffer commentB = getEntryEncoding(ze).encode(comm);
+ final ByteBuffer commentB = getEntryEncoding(ze).encode(comm);
ze.addExtraField(new UnicodeCommentExtraField(comm,
commentB.array(),
commentB.arrayOffset(),
@@ -1138,7 +1138,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Zip64Mode#Never}.
*/
protected void writeCentralFileHeader(final ZipArchiveEntry ze) throws IOException {
- byte[] centralFileHeader = createCentralFileHeader(ze);
+ final byte[] centralFileHeader = createCentralFileHeader(ze);
writeCounted(centralFileHeader);
}
@@ -1174,7 +1174,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
*/
private byte[] createCentralFileHeader(final ZipArchiveEntry ze, final ByteBuffer name, final long lfhOffset,
final boolean needsZip64Extra) throws IOException {
- byte[] extra = ze.getCentralDirectoryExtra();
+ final byte[] extra = ze.getCentralDirectoryExtra();
// file comment length
String comm = ze.getComment();
@@ -1182,11 +1182,11 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
comm = "";
}
- ByteBuffer commentB = getEntryEncoding(ze).encode(comm);
+ final ByteBuffer commentB = getEntryEncoding(ze).encode(comm);
final int nameLen = name.limit() - name.position();
final int commentLen = commentB.limit() - commentB.position();
- int len= CFH_FILENAME_OFFSET + nameLen + extra.length + commentLen;
- byte[] buf = new byte[len];
+ final int len= CFH_FILENAME_OFFSET + nameLen + extra.length + commentLen;
+ final byte[] buf = new byte[len];
System.arraycopy(CFH_SIG, 0, buf, CFH_SIG_OFFSET, WORD);
@@ -1247,10 +1247,10 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
// file name
System.arraycopy(name.array(), name.arrayOffset(), buf, CFH_FILENAME_OFFSET, nameLen);
- int extraStart = CFH_FILENAME_OFFSET + nameLen;
+ final int extraStart = CFH_FILENAME_OFFSET + nameLen;
System.arraycopy(extra, 0, buf, extraStart, extra.length);
- int commentStart = extraStart + extra.length;
+ final int commentStart = extraStart + extra.length;
// file comment
System.arraycopy(commentB.array(), commentB.arrayOffset(), buf, commentStart, commentLen);
@@ -1264,7 +1264,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
private void handleZip64Extra(final ZipArchiveEntry ze, final long lfhOffset,
final boolean needsZip64Extra) {
if (needsZip64Extra) {
- Zip64ExtendedInformationExtraField z64 = getZip64Extra(ze);
+ final Zip64ExtendedInformationExtraField z64 = getZip64Extra(ze);
if (ze.getCompressedSize() >= ZIP64_MAGIC
|| ze.getSize() >= ZIP64_MAGIC
|| zip64Mode == Zip64Mode.Always) {
@@ -1297,7 +1297,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
writeCounted(ZERO);
// number of entries
- int numberOfEntries = entries.size();
+ final int numberOfEntries = entries.size();
if (numberOfEntries > ZIP64_MAGIC_SHORT
&& zip64Mode == Zip64Mode.Never) {
throw new Zip64RequiredException(Zip64RequiredException
@@ -1308,7 +1308,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
.ARCHIVE_TOO_BIG_MESSAGE);
}
- byte[] num = ZipShort.getBytes(Math.min(numberOfEntries,
+ final byte[] num = ZipShort.getBytes(Math.min(numberOfEntries,
ZIP64_MAGIC_SHORT));
writeCounted(num);
writeCounted(num);
@@ -1318,8 +1318,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
writeCounted(ZipLong.getBytes(Math.min(cdOffset, ZIP64_MAGIC)));
// ZIP file comment
- ByteBuffer data = this.zipEncoding.encode(comment);
- int dataLen = data.limit() - data.position();
+ final ByteBuffer data = this.zipEncoding.encode(comment);
+ final int dataLen = data.limit() - data.position();
writeCounted(ZipShort.getBytes(dataLen));
streamCompressor.writeCounted(data.array(), data.arrayOffset(), dataLen);
}
@@ -1346,7 +1346,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
return;
}
- long offset = streamCompressor.getTotalBytesWritten();
+ final long offset = streamCompressor.getTotalBytesWritten();
writeOut(ZIP64_EOCD_SIG);
// size, we don't have any variable length as we don't support
@@ -1371,7 +1371,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
writeOut(LZERO);
// number of entries
- byte[] num = ZipEightByteInteger.getBytes(entries.size());
+ final byte[] num = ZipEightByteInteger.getBytes(entries.size());
writeOut(num);
writeOut(num);
@@ -1416,7 +1416,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
private GeneralPurposeBit getGeneralPurposeBits(final int zipMethod, final boolean utfFallback) {
- GeneralPurposeBit b = new GeneralPurposeBit();
+ final GeneralPurposeBit b = new GeneralPurposeBit();
b.useUTF8ForNames(useUTF8Flag || utfFallback);
if (isDeflatedToOutputStream(zipMethod)) {
b.useDataDescriptor(true);
@@ -1522,7 +1522,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
}
private ZipEncoding getEntryEncoding(final ZipArchiveEntry ze) {
- boolean encodable = zipEncoding.canEncode(ze.getName());
+ final boolean encodable = zipEncoding.canEncode(ze.getName());
return !encodable && fallbackToUTF8
? ZipEncodingHelper.UTF8_ZIP_ENCODING : zipEncoding;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
index baf99ea..c564460 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
@@ -139,8 +139,8 @@ public final class ZipEightByteInteger implements Serializable {
* @return value as eight bytes in big endian byte order
*/
public static byte[] getBytes(final BigInteger value) {
- byte[] result = new byte[8];
- long val = value.longValue();
+ final byte[] result = new byte[8];
+ final long val = value.longValue();
result[0] = (byte) ((val & BYTE_MASK));
result[BYTE_1] = (byte) ((val & BYTE_1_MASK) >> BYTE_1_SHIFT);
result[BYTE_2] = (byte) ((val & BYTE_2_MASK) >> BYTE_2_SHIFT);
@@ -182,7 +182,7 @@ public final class ZipEightByteInteger implements Serializable {
value += ((long) bytes[offset + BYTE_2] << BYTE_2_SHIFT) & BYTE_2_MASK;
value += ((long) bytes[offset + BYTE_1] << BYTE_1_SHIFT) & BYTE_1_MASK;
value += ((long) bytes[offset] & BYTE_MASK);
- BigInteger val = BigInteger.valueOf(value);
+ final BigInteger val = BigInteger.valueOf(value);
return (bytes[offset + BYTE_7] & LEFTMOST_BIT) == LEFTMOST_BIT
? val.setBit(LEFTMOST_BIT_SHIFT) : val;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
index 63af448..bc3f9d2 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
@@ -68,10 +68,10 @@ public abstract class ZipEncodingHelper {
private static final Map<String, SimpleEncodingHolder> simpleEncodings;
static {
- Map<String, SimpleEncodingHolder> se =
+ final Map<String, SimpleEncodingHolder> se =
new HashMap<String, SimpleEncodingHolder>();
- char[] cp437_high_chars =
+ final char[] cp437_high_chars =
new char[] { 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0,
0x00e5, 0x00e7, 0x00ea, 0x00eb, 0x00e8, 0x00ef,
0x00ee, 0x00ec, 0x00c4, 0x00c5, 0x00c9, 0x00e6,
@@ -95,7 +95,7 @@ public abstract class ZipEncodingHelper {
0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2,
0x25a0, 0x00a0 };
- SimpleEncodingHolder cp437 = new SimpleEncodingHolder(cp437_high_chars);
+ final SimpleEncodingHolder cp437 = new SimpleEncodingHolder(cp437_high_chars);
se.put("CP437", cp437);
se.put("Cp437", cp437);
@@ -103,7 +103,7 @@ public abstract class ZipEncodingHelper {
se.put("IBM437", cp437);
se.put("ibm437", cp437);
- char[] cp850_high_chars =
+ final char[] cp850_high_chars =
new char[] { 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0,
0x00e5, 0x00e7, 0x00ea, 0x00eb, 0x00e8, 0x00ef,
0x00ee, 0x00ec, 0x00c4, 0x00c5, 0x00c9, 0x00e6,
@@ -127,7 +127,7 @@ public abstract class ZipEncodingHelper {
0x00b0, 0x00a8, 0x00b7, 0x00b9, 0x00b3, 0x00b2,
0x25a0, 0x00a0 };
- SimpleEncodingHolder cp850 = new SimpleEncodingHolder(cp850_high_chars);
+ final SimpleEncodingHolder cp850 = new SimpleEncodingHolder(cp850_high_chars);
se.put("CP850", cp850);
se.put("Cp850", cp850);
@@ -153,8 +153,8 @@ public abstract class ZipEncodingHelper {
b.limit(b.position());
b.rewind();
- int c2 = b.capacity() * 2;
- ByteBuffer on = ByteBuffer.allocate(c2 < newCapacity ? newCapacity : c2);
+ final int c2 = b.capacity() * 2;
+ final ByteBuffer on = ByteBuffer.allocate(c2 < newCapacity ? newCapacity : c2);
on.put(b);
return on;
@@ -218,7 +218,7 @@ public abstract class ZipEncodingHelper {
return new FallbackZipEncoding();
}
- SimpleEncodingHolder h = simpleEncodings.get(name);
+ final SimpleEncodingHolder h = simpleEncodings.get(name);
if (h!=null) {
return h.getEncoding();
@@ -226,10 +226,10 @@ public abstract class ZipEncodingHelper {
try {
- Charset cs = Charset.forName(name);
+ final Charset cs = Charset.forName(name);
return new NioZipEncoding(cs);
- } catch (UnsupportedCharsetException e) {
+ } catch (final UnsupportedCharsetException e) {
return new FallbackZipEncoding(name);
}
}
@@ -248,7 +248,7 @@ public abstract class ZipEncodingHelper {
if (Charsets.UTF_8.name().equalsIgnoreCase(charsetName)) {
return true;
}
- for (String alias : Charsets.UTF_8.aliases()) {
+ for (final String alias : Charsets.UTF_8.aliases()) {
if (alias.equalsIgnoreCase(charsetName)) {
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
index 36fa63b..7647ead 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
@@ -214,7 +214,7 @@ public class ZipFile implements Closeable {
archive = new RandomAccessFile(f, "r");
boolean success = false;
try {
- Map<ZipArchiveEntry, NameAndComment> entriesWithoutUTF8Flag =
+ final Map<ZipArchiveEntry, NameAndComment> entriesWithoutUTF8Flag =
populateFromCentralDirectory();
resolveLocalFileHeaderData(entriesWithoutUTF8Flag);
success = true;
@@ -281,7 +281,7 @@ public class ZipFile implements Closeable {
* @since 1.1
*/
public Enumeration<ZipArchiveEntry> getEntriesInPhysicalOrder() {
- ZipArchiveEntry[] allEntries = entries.toArray(new ZipArchiveEntry[entries.size()]);
+ final ZipArchiveEntry[] allEntries = entries.toArray(new ZipArchiveEntry[entries.size()]);
Arrays.sort(allEntries, OFFSET_COMPARATOR);
return Collections.enumeration(Arrays.asList(allEntries));
}
@@ -299,7 +299,7 @@ public class ZipFile implements Closeable {
* {@code null} if not present.
*/
public ZipArchiveEntry getEntry(final String name) {
- LinkedList<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
+ final LinkedList<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
return entriesOfThatName != null ? entriesOfThatName.getFirst() : null;
}
@@ -313,7 +313,7 @@ public class ZipFile implements Closeable {
* @since 1.6
*/
public Iterable<ZipArchiveEntry> getEntries(final String name) {
- List<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
+ final List<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
return entriesOfThatName != null ? entriesOfThatName
: Collections.<ZipArchiveEntry>emptyList();
}
@@ -363,8 +363,8 @@ public class ZipFile implements Closeable {
if (!(ze instanceof Entry)) {
return null;
}
- OffsetEntry offsetEntry = ((Entry) ze).getOffsetEntry();
- long start = offsetEntry.dataOffset;
+ final OffsetEntry offsetEntry = ((Entry) ze).getOffsetEntry();
+ final long start = offsetEntry.dataOffset;
return new BoundedInputStream(start, ze.getCompressedSize());
}
@@ -380,9 +380,9 @@ public class ZipFile implements Closeable {
*/
public void copyRawEntries(final ZipArchiveOutputStream target, final ZipArchiveEntryPredicate predicate)
throws IOException {
- Enumeration<ZipArchiveEntry> src = getEntriesInPhysicalOrder();
+ final Enumeration<ZipArchiveEntry> src = getEntriesInPhysicalOrder();
while (src.hasMoreElements()) {
- ZipArchiveEntry entry = src.nextElement();
+ final ZipArchiveEntry entry = src.nextElement();
if (predicate.test( entry)) {
target.addRawArchiveEntry(entry, getRawInputStream(entry));
}
@@ -403,10 +403,10 @@ public class ZipFile implements Closeable {
return null;
}
// cast valididty is checked just above
- OffsetEntry offsetEntry = ((Entry) ze).getOffsetEntry();
+ final OffsetEntry offsetEntry = ((Entry) ze).getOffsetEntry();
ZipUtil.checkRequestedFeatures(ze);
- long start = offsetEntry.dataOffset;
- BoundedInputStream bis =
+ final long start = offsetEntry.dataOffset;
+ final BoundedInputStream bis =
new BoundedInputStream(start, ze.getCompressedSize());
switch (ZipMethod.getMethodByCode(ze.getMethod())) {
case STORED:
@@ -469,7 +469,7 @@ public class ZipFile implements Closeable {
InputStream in = null;
try {
in = getInputStream(entry);
- byte[] symlinkBytes = IOUtils.toByteArray(in);
+ final byte[] symlinkBytes = IOUtils.toByteArray(in);
return zipEncoding.decode(symlinkBytes);
} finally {
if (in != null) {
@@ -536,7 +536,7 @@ public class ZipFile implements Closeable {
*/
private Map<ZipArchiveEntry, NameAndComment> populateFromCentralDirectory()
throws IOException {
- HashMap<ZipArchiveEntry, NameAndComment> noUTF8Flag =
+ final HashMap<ZipArchiveEntry, NameAndComment> noUTF8Flag =
new HashMap<ZipArchiveEntry, NameAndComment>();
positionAtCentralDirectory();
@@ -571,10 +571,10 @@ public class ZipFile implements Closeable {
throws IOException {
archive.readFully(CFH_BUF);
int off = 0;
- OffsetEntry offset = new OffsetEntry();
- Entry ze = new Entry(offset);
+ final OffsetEntry offset = new OffsetEntry();
+ final Entry ze = new Entry(offset);
- int versionMadeBy = ZipShort.getValue(CFH_BUF, off);
+ final int versionMadeBy = ZipShort.getValue(CFH_BUF, off);
off += SHORT;
ze.setVersionMadeBy(versionMadeBy);
ze.setPlatform((versionMadeBy >> BYTE_SHIFT) & NIBLET_MASK);
@@ -595,7 +595,7 @@ public class ZipFile implements Closeable {
ze.setMethod(ZipShort.getValue(CFH_BUF, off));
off += SHORT;
- long time = ZipUtil.dosToJavaTime(ZipLong.getValue(CFH_BUF, off));
+ final long time = ZipUtil.dosToJavaTime(ZipLong.getValue(CFH_BUF, off));
ze.setTime(time);
off += WORD;
@@ -608,16 +608,16 @@ public class ZipFile implements Closeable {
ze.setSize(ZipLong.getValue(CFH_BUF, off));
off += WORD;
- int fileNameLen = ZipShort.getValue(CFH_BUF, off);
+ final int fileNameLen = ZipShort.getValue(CFH_BUF, off);
off += SHORT;
- int extraLen = ZipShort.getValue(CFH_BUF, off);
+ final int extraLen = ZipShort.getValue(CFH_BUF, off);
off += SHORT;
- int commentLen = ZipShort.getValue(CFH_BUF, off);
+ final int commentLen = ZipShort.getValue(CFH_BUF, off);
off += SHORT;
- int diskStart = ZipShort.getValue(CFH_BUF, off);
+ final int diskStart = ZipShort.getValue(CFH_BUF, off);
off += SHORT;
ze.setInternalAttributes(ZipShort.getValue(CFH_BUF, off));
@@ -626,7 +626,7 @@ public class ZipFile implements Closeable {
ze.setExternalAttributes(ZipLong.getValue(CFH_BUF, off));
off += WORD;
- byte[] fileName = new byte[fileNameLen];
+ final byte[] fileName = new byte[fileNameLen];
archive.readFully(fileName);
ze.setName(entryEncoding.decode(fileName), fileName);
@@ -635,13 +635,13 @@ public class ZipFile implements Closeable {
// data offset will be filled later
entries.add(ze);
- byte[] cdExtraData = new byte[extraLen];
+ final byte[] cdExtraData = new byte[extraLen];
archive.readFully(cdExtraData);
ze.setCentralDirectoryExtra(cdExtraData);
setSizesAndOffsetFromZip64Extra(ze, offset, diskStart);
- byte[] comment = new byte[commentLen];
+ final byte[] comment = new byte[commentLen];
archive.readFully(comment);
ze.setComment(entryEncoding.decode(comment));
@@ -666,13 +666,13 @@ public class ZipFile implements Closeable {
final OffsetEntry offset,
final int diskStart)
throws IOException {
- Zip64ExtendedInformationExtraField z64 =
+ final Zip64ExtendedInformationExtraField z64 =
(Zip64ExtendedInformationExtraField)
ze.getExtraField(Zip64ExtendedInformationExtraField.HEADER_ID);
if (z64 != null) {
- boolean hasUncompressedSize = ze.getSize() == ZIP64_MAGIC;
- boolean hasCompressedSize = ze.getCompressedSize() == ZIP64_MAGIC;
- boolean hasRelativeHeaderOffset =
+ final boolean hasUncompressedSize = ze.getSize() == ZIP64_MAGIC;
+ final boolean hasCompressedSize = ze.getCompressedSize() == ZIP64_MAGIC;
+ final boolean hasRelativeHeaderOffset =
offset.headerOffset == ZIP64_MAGIC;
z64.reparseCentralDirectoryData(hasUncompressedSize,
hasCompressedSize,
@@ -800,7 +800,7 @@ public class ZipFile implements Closeable {
throws IOException {
positionAtEndOfCentralDirectoryRecord();
boolean found = false;
- boolean searchedForZip64EOCD =
+ final boolean searchedForZip64EOCD =
archive.getFilePointer() > ZIP64_EOCDL_LENGTH;
if (searchedForZip64EOCD) {
archive.seek(archive.getFilePointer() - ZIP64_EOCDL_LENGTH);
@@ -865,7 +865,7 @@ public class ZipFile implements Closeable {
*/
private void positionAtEndOfCentralDirectoryRecord()
throws IOException {
- boolean found = tryToLocateSignature(MIN_EOCD_SIZE, MAX_EOCD_SIZE,
+ final boolean found = tryToLocateSignature(MIN_EOCD_SIZE, MAX_EOCD_SIZE,
ZipArchiveOutputStream.EOCD_SIG);
if (!found) {
throw new ZipException("archive is not a ZIP archive");
@@ -919,7 +919,7 @@ public class ZipFile implements Closeable {
private void skipBytes(final int count) throws IOException {
int totalSkipped = 0;
while (totalSkipped < count) {
- int skippedNow = archive.skipBytes(count - totalSkipped);
+ final int skippedNow = archive.skipBytes(count - totalSkipped);
if (skippedNow <= 0) {
throw new EOFException();
}
@@ -952,39 +952,39 @@ public class ZipFile implements Closeable {
private void resolveLocalFileHeaderData(final Map<ZipArchiveEntry, NameAndComment>
entriesWithoutUTF8Flag)
throws IOException {
- for (ZipArchiveEntry zipArchiveEntry : entries) {
+ for (final ZipArchiveEntry zipArchiveEntry : entries) {
// entries is filled in populateFromCentralDirectory and
// never modified
- Entry ze = (Entry) zipArchiveEntry;
- OffsetEntry offsetEntry = ze.getOffsetEntry();
- long offset = offsetEntry.headerOffset;
+ final Entry ze = (Entry) zipArchiveEntry;
+ final OffsetEntry offsetEntry = ze.getOffsetEntry();
+ final long offset = offsetEntry.headerOffset;
archive.seek(offset + LFH_OFFSET_FOR_FILENAME_LENGTH);
archive.readFully(SHORT_BUF);
- int fileNameLen = ZipShort.getValue(SHORT_BUF);
+ final int fileNameLen = ZipShort.getValue(SHORT_BUF);
archive.readFully(SHORT_BUF);
- int extraFieldLen = ZipShort.getValue(SHORT_BUF);
+ final int extraFieldLen = ZipShort.getValue(SHORT_BUF);
int lenToSkip = fileNameLen;
while (lenToSkip > 0) {
- int skipped = archive.skipBytes(lenToSkip);
+ final int skipped = archive.skipBytes(lenToSkip);
if (skipped <= 0) {
throw new IOException("failed to skip file name in"
+ " local file header");
}
lenToSkip -= skipped;
}
- byte[] localExtraData = new byte[extraFieldLen];
+ final byte[] localExtraData = new byte[extraFieldLen];
archive.readFully(localExtraData);
ze.setExtra(localExtraData);
offsetEntry.dataOffset = offset + LFH_OFFSET_FOR_FILENAME_LENGTH
+ SHORT + SHORT + fileNameLen + extraFieldLen;
if (entriesWithoutUTF8Flag.containsKey(ze)) {
- NameAndComment nc = entriesWithoutUTF8Flag.get(ze);
+ final NameAndComment nc = entriesWithoutUTF8Flag.get(ze);
ZipUtil.setNameAndCommentFromExtraFields(ze, nc.name,
nc.comment);
}
- String name = ze.getName();
+ final String name = ze.getName();
LinkedList<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
if (entriesOfThatName == null) {
entriesOfThatName = new LinkedList<ZipArchiveEntry>();
@@ -1098,15 +1098,15 @@ public class ZipFile implements Closeable {
return 0;
}
- Entry ent1 = e1 instanceof Entry ? (Entry) e1 : null;
- Entry ent2 = e2 instanceof Entry ? (Entry) e2 : null;
+ final Entry ent1 = e1 instanceof Entry ? (Entry) e1 : null;
+ final Entry ent2 = e2 instanceof Entry ? (Entry) e2 : null;
if (ent1 == null) {
return 1;
}
if (ent2 == null) {
return -1;
}
- long val = (ent1.getOffsetEntry().headerOffset
+ final long val = (ent1.getOffsetEntry().headerOffset
- ent2.getOffsetEntry().headerOffset);
return val == 0 ? 0 : val < 0 ? -1 : +1;
}
@@ -1137,7 +1137,7 @@ public class ZipFile implements Closeable {
public boolean equals(final Object other) {
if (super.equals(other)) {
// super.equals would return false if other were not an Entry
- Entry otherEntry = (Entry) other;
+ final Entry otherEntry = (Entry) other;
return offsetEntry.headerOffset
== otherEntry.offsetEntry.headerOffset
&& offsetEntry.dataOffset
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
index 3b2e278..e3e3f86 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
@@ -133,7 +133,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @return value as four bytes in big endian byte order
*/
public static byte[] getBytes(final long value) {
- byte[] result = new byte[WORD];
+ final byte[] result = new byte[WORD];
putLong(value, result, 0);
return result;
}
@@ -207,7 +207,7 @@ public final class ZipLong implements Cloneable, Serializable {
public Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException cnfe) {
+ } catch (final CloneNotSupportedException cnfe) {
// impossible
throw new RuntimeException(cnfe);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
index 8848370..5f7bb41 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
@@ -173,8 +173,8 @@ public enum ZipMethod {
private static final Map<Integer, ZipMethod> codeToEnum;
static {
- Map<Integer, ZipMethod> cte = new HashMap<Integer, ZipMethod>();
- for (ZipMethod method : values()) {
+ final Map<Integer, ZipMethod> cte = new HashMap<Integer, ZipMethod>();
+ for (final ZipMethod method : values()) {
cte.put(method.getCode(), method);
}
codeToEnum = Collections.unmodifiableMap(cte);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
index 39f5274..f3c2e06 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
@@ -64,7 +64,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @return the value as a a two byte array in big endian byte order
*/
public byte[] getBytes() {
- byte[] result = new byte[2];
+ final byte[] result = new byte[2];
result[0] = (byte) (value & BYTE_MASK);
result[1] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
return result;
@@ -84,7 +84,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @return the converted int as a byte array in big endian byte order
*/
public static byte[] getBytes(final int value) {
- byte[] result = new byte[2];
+ final byte[] result = new byte[2];
putShort(value, result, 0);
return result;
}
@@ -149,7 +149,7 @@ public final class ZipShort implements Cloneable, Serializable {
public Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException cnfe) {
+ } catch (final CloneNotSupportedException cnfe) {
// impossible
throw new RuntimeException(cnfe);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
index 847678f..cc3660b 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
@@ -51,7 +51,7 @@ public abstract class ZipUtil {
* @return the date as a byte array
*/
public static byte[] toDosTime(final long t) {
- byte[] result = new byte[4];
+ final byte[] result = new byte[4];
toDosTime(t, result, 0);
return result;
}
@@ -73,13 +73,13 @@ public abstract class ZipUtil {
static void toDosTime(final Calendar c, final long t, final byte[] buf, final int offset) {
c.setTimeInMillis(t);
- int year = c.get(Calendar.YEAR);
+ final int year = c.get(Calendar.YEAR);
if (year < 1980) {
System.arraycopy(DOS_TIME_MIN, 0, buf, offset, DOS_TIME_MIN.length);// stop callers from changing the array
return;
}
- int month = c.get(Calendar.MONTH) + 1;
- long value = ((year - 1980) << 25)
+ final int month = c.get(Calendar.MONTH) + 1;
+ final long value = ((year - 1980) << 25)
| (month << 21)
| (c.get(Calendar.DAY_OF_MONTH) << 16)
| (c.get(Calendar.HOUR_OF_DAY) << 11)
@@ -117,7 +117,7 @@ public abstract class ZipUtil {
public static byte[] reverse(final byte[] array) {
final int z = array.length - 1; // position of last element
for (int i = 0; i < array.length / 2; i++) {
- byte x = array[i];
+ final byte x = array[i];
array[i] = array[z - i];
array[z - i] = x;
}
@@ -200,7 +200,7 @@ public abstract class ZipUtil {
* @return a Date instance corresponding to the given time.
*/
public static Date fromDosTime(final ZipLong zipDosTime) {
- long dosTime = zipDosTime.getValue();
+ final long dosTime = zipDosTime.getValue();
return new Date(dosToJavaTime(dosTime));
}
@@ -211,7 +211,7 @@ public abstract class ZipUtil {
* @return converted time
*/
public static long dosToJavaTime(final long dosTime) {
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
// CheckStyle:MagicNumberCheck OFF - no point
cal.set(Calendar.YEAR, (int) ((dosTime >> 25) & 0x7f) + 1980);
cal.set(Calendar.MONTH, (int) ((dosTime >> 21) & 0x0f) - 1);
@@ -232,19 +232,19 @@ public abstract class ZipUtil {
static void setNameAndCommentFromExtraFields(final ZipArchiveEntry ze,
final byte[] originalNameBytes,
final byte[] commentBytes) {
- UnicodePathExtraField name = (UnicodePathExtraField)
+ final UnicodePathExtraField name = (UnicodePathExtraField)
ze.getExtraField(UnicodePathExtraField.UPATH_ID);
- String originalName = ze.getName();
- String newName = getUnicodeStringIfOriginalMatches(name,
+ final String originalName = ze.getName();
+ final String newName = getUnicodeStringIfOriginalMatches(name,
originalNameBytes);
if (newName != null && !originalName.equals(newName)) {
ze.setName(newName);
}
if (commentBytes != null && commentBytes.length > 0) {
- UnicodeCommentExtraField cmt = (UnicodeCommentExtraField)
+ final UnicodeCommentExtraField cmt = (UnicodeCommentExtraField)
ze.getExtraField(UnicodeCommentExtraField.UCOM_ID);
- String newComment =
+ final String newComment =
getUnicodeStringIfOriginalMatches(cmt, commentBytes);
if (newComment != null) {
ze.setComment(newComment);
@@ -263,15 +263,15 @@ public abstract class ZipUtil {
String getUnicodeStringIfOriginalMatches(final AbstractUnicodeExtraField f,
final byte[] orig) {
if (f != null) {
- CRC32 crc32 = new CRC32();
+ final CRC32 crc32 = new CRC32();
crc32.update(orig);
- long origCRC32 = crc32.getValue();
+ final long origCRC32 = crc32.getValue();
if (origCRC32 == f.getNameCRC32()) {
try {
return ZipEncodingHelper
.UTF8_ZIP_ENCODING.decode(f.getUnicodeName());
- } catch (IOException ex) {
+ } catch (final IOException ex) {
// UTF-8 unsupported? should be impossible the
// Unicode*ExtraField must contain some bad bytes
@@ -289,7 +289,7 @@ public abstract class ZipUtil {
*/
static byte[] copy(final byte[] from) {
if (from != null) {
- byte[] to = new byte[from.length];
+ final byte[] to = new byte[from.length];
System.arraycopy(from, 0, to, 0, to.length);
return to;
}
@@ -345,7 +345,7 @@ public abstract class ZipUtil {
.Feature.ENCRYPTION, ze);
}
if (!supportsMethodOf(ze)) {
- ZipMethod m = ZipMethod.getMethodByCode(ze.getMethod());
+ final ZipMethod m = ZipMethod.getMethodByCode(ze.getMethod());
if (m == null) {
throw
new UnsupportedZipFeatureException(UnsupportedZipFeatureException
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/ChangeSet.java b/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
index 7c899d0..c69c6de 100644
--- a/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
+++ b/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
@@ -97,11 +97,11 @@ public final class ChangeSet {
}
if (!changes.isEmpty()) {
- for (Iterator<Change> it = changes.iterator(); it.hasNext();) {
- Change change = it.next();
+ for (final Iterator<Change> it = changes.iterator(); it.hasNext();) {
+ final Change change = it.next();
if (change.type() == Change.TYPE_ADD
&& change.getEntry() != null) {
- ArchiveEntry entry = change.getEntry();
+ final ArchiveEntry entry = change.getEntry();
if(entry.equals(pChange.getEntry())) {
if(pChange.isReplaceMode()) {
@@ -130,14 +130,14 @@ public final class ChangeSet {
pChange.targetFile() == null) {
return;
}
- String source = pChange.targetFile();
+ final String source = pChange.targetFile();
if (source != null && !changes.isEmpty()) {
- for (Iterator<Change> it = changes.iterator(); it.hasNext();) {
- Change change = it.next();
+ for (final Iterator<Change> it = changes.iterator(); it.hasNext();) {
+ final Change change = it.next();
if (change.type() == Change.TYPE_ADD
&& change.getEntry() != null) {
- String target = change.getEntry().getName();
+ final String target = change.getEntry().getName();
if (target == null) {
continue;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java b/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
index 46891d3..f3bac85 100644
--- a/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
+++ b/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
@@ -111,12 +111,12 @@ public class ChangeSetPerformer {
private ChangeSetResults perform(final ArchiveEntryIterator entryIterator,
final ArchiveOutputStream out)
throws IOException {
- ChangeSetResults results = new ChangeSetResults();
+ final ChangeSetResults results = new ChangeSetResults();
- Set<Change> workingSet = new LinkedHashSet<Change>(changes);
+ final Set<Change> workingSet = new LinkedHashSet<Change>(changes);
- for (Iterator<Change> it = workingSet.iterator(); it.hasNext();) {
- Change change = it.next();
+ for (final Iterator<Change> it = workingSet.iterator(); it.hasNext();) {
+ final Change change = it.next();
if (change.type() == Change.TYPE_ADD && change.isReplaceMode()) {
copyStream(change.getInput(), out, change.getEntry());
@@ -126,11 +126,11 @@ public class ChangeSetPerformer {
}
while (entryIterator.hasNext()) {
- ArchiveEntry entry = entryIterator.next();
+ final ArchiveEntry entry = entryIterator.next();
boolean copy = true;
- for (Iterator<Change> it = workingSet.iterator(); it.hasNext();) {
- Change change = it.next();
+ for (final Iterator<Change> it = workingSet.iterator(); it.hasNext();) {
+ final Change change = it.next();
final int type = change.type();
final String name = entry.getName();
@@ -160,8 +160,8 @@ public class ChangeSetPerformer {
}
// Adds files which hasn't been added from the original and do not have replace mode on
- for (Iterator<Change> it = workingSet.iterator(); it.hasNext();) {
- Change change = it.next();
+ for (final Iterator<Change> it = workingSet.iterator(); it.hasNext();) {
+ final Change change = it.next();
if (change.type() == Change.TYPE_ADD &&
!change.isReplaceMode() &&
@@ -185,12 +185,12 @@ public class ChangeSetPerformer {
* @return true, if this entry has an deletion change later, false otherwise
*/
private boolean isDeletedLater(final Set<Change> workingSet, final ArchiveEntry entry) {
- String source = entry.getName();
+ final String source = entry.getName();
if (!workingSet.isEmpty()) {
- for (Change change : workingSet) {
+ for (final Change change : workingSet) {
final int type = change.type();
- String target = change.targetFile();
+ final String target = change.targetFile();
if (type == Change.TYPE_DELETE && source.equals(target)) {
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
index 8f7e057..5a7160f 100644
--- a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
+++ b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
@@ -214,7 +214,7 @@ public class CompressorStreamFactory {
final byte[] signature = new byte[12];
in.mark(signature.length);
try {
- int signatureLength = IOUtils.readFully(in, signature);
+ final int signatureLength = IOUtils.readFully(in, signature);
in.reset();
if (BZip2CompressorInputStream.matches(signature, signatureLength)) {
@@ -251,7 +251,7 @@ public class CompressorStreamFactory {
return new LZMACompressorInputStream(in);
}
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new CompressorException("Failed to detect Compressor from InputStream.", e);
}
@@ -315,7 +315,7 @@ public class CompressorStreamFactory {
return new DeflateCompressorInputStream(in);
}
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new CompressorException(
"Could not create CompressorInputStream.", e);
}
@@ -363,7 +363,7 @@ public class CompressorStreamFactory {
return new DeflateCompressorOutputStream(out);
}
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new CompressorException(
"Could not create CompressorOutputStream", e);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java b/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
index 44735b5..22205d8 100644
--- a/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
+++ b/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
@@ -93,8 +93,8 @@ public class FileNameUtil {
this.uncompressSuffix = Collections.unmodifiableMap(uncompressSuffix);
int lc = Integer.MIN_VALUE, sc = Integer.MAX_VALUE;
int lu = Integer.MIN_VALUE, su = Integer.MAX_VALUE;
- for (Map.Entry<String, String> ent : uncompressSuffix.entrySet()) {
- int cl = ent.getKey().length();
+ for (final Map.Entry<String, String> ent : uncompressSuffix.entrySet()) {
+ final int cl = ent.getKey().length();
if (cl > lc) {
lc = cl;
}
@@ -102,8 +102,8 @@ public class FileNameUtil {
sc = cl;
}
- String u = ent.getValue();
- int ul = u.length();
+ final String u = ent.getValue();
+ final int ul = u.length();
if (ul > 0) {
if (!compressSuffix.containsKey(u)) {
compressSuffix.put(u, ent.getKey());
@@ -160,7 +160,7 @@ public class FileNameUtil {
final int n = lower.length();
for (int i = shortestCompressedSuffix;
i <= longestCompressedSuffix && i < n; i++) {
- String suffix = uncompressSuffix.get(lower.substring(n - i));
+ final String suffix = uncompressSuffix.get(lower.substring(n - i));
if (suffix != null) {
return filename.substring(0, n - i) + suffix;
}
@@ -184,7 +184,7 @@ public class FileNameUtil {
final int n = lower.length();
for (int i = shortestUncompressedSuffix;
i <= longestUncompressedSuffix && i < n; i++) {
- String suffix = compressSuffix.get(lower.substring(n - i));
+ final String suffix = compressSuffix.get(lower.substring(n - i));
if (suffix != null) {
return filename.substring(0, n - i) + suffix;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/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 9c7938a..cb697ab 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
@@ -137,7 +137,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
@Override
public int read() throws IOException {
if (this.in != null) {
- int r = read0();
+ final int r = read0();
count(r < 0 ? -1 : 1);
return r;
}
@@ -177,7 +177,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
count(1);
}
- int c = (destOffs == offs) ? -1 : (destOffs - offs);
+ final int c = (destOffs == offs) ? -1 : (destOffs - offs);
return c;
}
@@ -232,12 +232,12 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
throw new IOException("No InputStream");
}
- int magic0 = this.in.read();
+ final int magic0 = this.in.read();
if (magic0 == -1 && !isFirstStream) {
return false;
}
- int magic1 = this.in.read();
- int magic2 = this.in.read();
+ final int magic1 = this.in.read();
+ final int magic2 = this.in.read();
if (magic0 != 'B' || magic1 != 'Z' || magic2 != 'h') {
throw new IOException(isFirstStream
@@ -245,7 +245,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
: "Garbage after a valid BZip2 stream");
}
- int blockSize = this.in.read();
+ final int blockSize = this.in.read();
if ((blockSize < '1') || (blockSize > '9')) {
throw new IOException("BZip2 block size is invalid");
}
@@ -352,7 +352,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
@Override
public void close() throws IOException {
- InputStream inShadow = this.in;
+ final InputStream inShadow = this.in;
if (inShadow != null) {
try {
if (inShadow != System.in) {
@@ -372,7 +372,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
if (bsLiveShadow < n) {
final InputStream inShadow = this.in;
do {
- int thech = inShadow.read();
+ final int thech = inShadow.read();
if (thech < 0) {
throw new IOException("unexpected end of stream");
@@ -835,7 +835,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
private int setupNoRandPartA() throws IOException {
if (this.su_i2 <= this.last) {
this.su_chPrev = this.su_ch2;
- int su_ch2Shadow = this.data.ll8[this.su_tPos] & 0xff;
+ final int su_ch2Shadow = this.data.ll8[this.su_tPos] & 0xff;
this.su_ch2 = su_ch2Shadow;
this.su_tPos = this.data.tt[this.su_tPos];
this.su_i2++;
@@ -905,7 +905,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
private int setupNoRandPartC() throws IOException {
if (this.su_j2 < this.su_z) {
- int su_ch2Shadow = this.su_ch2;
+ final int su_ch2Shadow = this.su_ch2;
this.crc.updateCRC(su_ch2Shadow);
this.su_j2++;
this.currentState = NO_RAND_PART_C_STATE;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
index 315c6fe..9de51d4 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
@@ -168,7 +168,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
heap[nHeap] = i;
int zz = nHeap;
- int tmp = heap[zz];
+ final int tmp = heap[zz];
while (weight[tmp] < weight[heap[zz >> 1]]) {
heap[zz] = heap[zz >> 1];
zz >>= 1;
@@ -177,7 +177,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
}
while (nHeap > 1) {
- int n1 = heap[1];
+ final int n1 = heap[1];
heap[1] = heap[nHeap];
nHeap--;
@@ -207,7 +207,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
heap[zz] = tmp;
- int n2 = heap[1];
+ final int n2 = heap[1];
heap[1] = heap[nHeap];
nHeap--;
@@ -496,7 +496,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
@Override
public void close() throws IOException {
if (out != null) {
- OutputStream outShadow = this.out;
+ final OutputStream outShadow = this.out;
finish();
outShadow.close();
}
@@ -504,7 +504,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
@Override
public void flush() throws IOException {
- OutputStream outShadow = this.out;
+ final OutputStream outShadow = this.out;
if (outShadow != null) {
outShadow.flush();
}
@@ -537,7 +537,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
this.last = -1;
// ch = 0;
- boolean[] inUse = this.data.inUse;
+ final boolean[] inUse = this.data.inUse;
for (int i = 256; --i >= 0;) {
inUse[i] = false;
}
@@ -629,7 +629,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
throw new IOException("stream closed");
}
- for (int hi = offs + len; offs < hi;) {
+ for (final int hi = offs + len; offs < hi;) {
write0(buf[offs++]);
}
}
@@ -676,7 +676,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
private void bsFinishedWithStream() throws IOException {
while (this.bsLive > 0) {
- int ch = this.bsBuff >> 24;
+ final int ch = this.bsBuff >> 24;
this.out.write(ch); // write 8-bit
this.bsBuff <<= 8;
this.bsLive -= 8;
@@ -714,7 +714,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
final int alphaSize = this.nInUse + 2;
for (int t = N_GROUPS; --t >= 0;) {
- byte[] len_t = len[t];
+ final byte[] len_t = len[t];
for (int v = alphaSize; --v >= 0;) {
len_t[v] = GREATER_ICOST;
}
@@ -808,7 +808,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
for (int iter = 0; iter < N_ITERS; iter++) {
for (int t = nGroups; --t >= 0;) {
fave[t] = 0;
- int[] rfreqt = rfreq[t];
+ final int[] rfreqt = rfreq[t];
for (int i = alphaSize; --i >= 0;) {
rfreqt[i] = 0;
}
@@ -909,7 +909,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
// assert (nGroups < 8) : nGroups;
final Data dataShadow = this.data;
- byte[] pos = dataShadow.sendMTFValues2_pos;
+ final byte[] pos = dataShadow.sendMTFValues2_pos;
for (int i = nGroups; --i >= 0;) {
pos[i] = (byte) i;
@@ -922,7 +922,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
while (ll_i != tmp) {
j++;
- byte tmp2 = tmp;
+ final byte tmp2 = tmp;
tmp = pos[j];
pos[j] = tmp2;
}
@@ -933,8 +933,8 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
}
private void sendMTFValues3(final int nGroups, final int alphaSize) {
- int[][] code = this.data.sendMTFValues_code;
- byte[][] len = this.data.sendMTFValues_len;
+ final int[][] code = this.data.sendMTFValues_code;
+ final byte[][] len = this.data.sendMTFValues_len;
for (int t = 0; t < nGroups; t++) {
int minLen = 32;
@@ -1047,7 +1047,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
int bsBuffShadow = this.bsBuff;
for (int t = 0; t < nGroups; t++) {
- byte[] len_t = len[t];
+ final byte[] len_t = len[t];
int curr = len_t[0] & 0xff;
// inlined: bsW(5, curr);
@@ -1060,7 +1060,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
bsLiveShadow += 5;
for (int i = 0; i < alphaSize; i++) {
- int lti = len_t[i] & 0xff;
+ final int lti = len_t[i] & 0xff;
while (curr < lti) {
// inlined: bsW(2, 2);
while (bsLiveShadow >= 8) {
@@ -1207,7 +1207,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
while (ll_i != tmp) {
j++;
- byte tmp2 = tmp;
+ final byte tmp2 = tmp;
tmp = yy[j];
yy[j] = tmp2;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
index 2aed7e5..2a8c04f 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
@@ -32,7 +32,7 @@ public abstract class BZip2Utils {
private static final FileNameUtil fileNameUtil;
static {
- Map<String, String> uncompressSuffix =
+ final Map<String, String> uncompressSuffix =
new LinkedHashMap<String, String>();
// backwards compatibilty: BZip2Utils never created the short
// tbz form, so .tar.bz2 has to be added explicitly
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
index ffe77d4..63a3da3 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
@@ -275,8 +275,8 @@ class BlockSort {
int j;
if (hi - lo > 3) {
for (int i = hi - 4; i >= lo; i--) {
- int tmp = fmap[i];
- int ec_tmp = eclass[tmp];
+ final int tmp = fmap[i];
+ final int ec_tmp = eclass[tmp];
for (j = i + 4; j <= hi && ec_tmp > eclass[fmap[j]];
j += 4) {
fmap[j - 4] = fmap[j];
@@ -286,8 +286,8 @@ class BlockSort {
}
for (int i = hi - 1; i >= lo; i--) {
- int tmp = fmap[i];
- int ec_tmp = eclass[tmp];
+ final int tmp = fmap[i];
+ final int ec_tmp = eclass[tmp];
for (j = i + 1; j <= hi && ec_tmp > eclass[fmap[j]]; j++) {
fmap[j - 1] = fmap[j];
}
@@ -301,7 +301,7 @@ class BlockSort {
* swaps two values in fmap
*/
private void fswap(final int[] fmap, final int zz1, final int zz2) {
- int zztmp = fmap[zz1];
+ final int zztmp = fmap[zz1];
fmap[zz1] = fmap[zz2];
fmap[zz2] = zztmp;
}
@@ -350,7 +350,7 @@ class BlockSort {
fpush(sp++, loSt, hiSt);
while (sp > 0) {
- int[] s = fpop(--sp);
+ final int[] s = fpop(--sp);
lo = s[0]; hi = s[1];
if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) {
@@ -366,7 +366,8 @@ class BlockSort {
book, chapter 35.
*/
r = ((r * 7621) + 1) % 32768;
- long r3 = r % 3, med;
+ final long r3 = r % 3;
+ long med;
if (r3 == 0) {
med = eclass[fmap[lo]];
} else if (r3 == 1) {
@@ -496,7 +497,7 @@ class BlockSort {
}
nBhtab = 64 + nblock;
- BitSet bhtab = new BitSet(nBhtab);
+ final BitSet bhtab = new BitSet(nBhtab);
for (i = 0; i < 256; i++) {
bhtab.set(ftab[i]);
}
@@ -783,7 +784,7 @@ class BlockSort {
private static void vswap(final int[] fmap, int p1, int p2, int n) {
n += p1;
while (p1 < n) {
- int t = fmap[p1];
+ final int t = fmap[p1];
fmap[p1++] = fmap[p2];
fmap[p2++] = t;
}
[44/46] commons-compress git commit: Add final modifier to local
variables.
Posted by bo...@apache.org.
Add final modifier to local variables.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/3f2c760a
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/3f2c760a
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/3f2c760a
Branch: refs/heads/COMPRESS-207
Commit: 3f2c760a4eb82d880e62a03cb9450d9dcf2793f7
Parents: bf85a64
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 10:10:28 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 10:10:28 2016 -0700
----------------------------------------------------------------------
.../compress/archivers/ArchiveInputStream.java | 2 +-
.../archivers/ArchiveStreamFactory.java | 6 +-
.../commons/compress/archivers/Lister.java | 4 +-
.../compress/archivers/ar/ArArchiveEntry.java | 2 +-
.../archivers/ar/ArArchiveInputStream.java | 18 +-
.../archivers/ar/ArArchiveOutputStream.java | 4 +-
.../compress/archivers/arj/ArjArchiveEntry.java | 2 +-
.../archivers/arj/ArjArchiveInputStream.java | 6 +-
.../compress/archivers/arj/LocalFileHeader.java | 2 +-
.../archivers/cpio/CpioArchiveEntry.java | 8 +-
.../archivers/cpio/CpioArchiveInputStream.java | 34 +--
.../archivers/cpio/CpioArchiveOutputStream.java | 18 +-
.../compress/archivers/cpio/CpioUtil.java | 4 +-
.../archivers/dump/DumpArchiveConstants.java | 4 +-
.../archivers/dump/DumpArchiveEntry.java | 14 +-
.../archivers/dump/DumpArchiveInputStream.java | 38 +--
.../archivers/dump/DumpArchiveSummary.java | 2 +-
.../archivers/dump/DumpArchiveUtil.java | 6 +-
.../archivers/dump/TapeInputStream.java | 20 +-
.../compress/archivers/jar/JarArchiveEntry.java | 2 +-
.../archivers/jar/JarArchiveInputStream.java | 2 +-
.../archivers/sevenz/AES256SHA256Decoder.java | 4 +-
.../commons/compress/archivers/sevenz/CLI.java | 20 +-
.../compress/archivers/sevenz/CoderBase.java | 2 +-
.../compress/archivers/sevenz/Coders.java | 14 +-
.../compress/archivers/sevenz/DeltaDecoder.java | 4 +-
.../compress/archivers/sevenz/Folder.java | 4 +-
.../compress/archivers/sevenz/LZMA2Decoder.java | 16 +-
.../archivers/sevenz/SevenZArchiveEntry.java | 4 +-
.../compress/archivers/sevenz/SevenZFile.java | 18 +-
.../compress/archivers/sevenz/SevenZMethod.java | 4 +-
.../archivers/sevenz/SevenZOutputFile.java | 36 +--
.../compress/archivers/tar/TarArchiveEntry.java | 36 +--
.../archivers/tar/TarArchiveInputStream.java | 52 ++--
.../archivers/tar/TarArchiveOutputStream.java | 34 +--
.../compress/archivers/tar/TarUtils.java | 26 +-
.../zip/AbstractUnicodeExtraField.java | 6 +-
.../compress/archivers/zip/AsiExtraField.java | 22 +-
.../compress/archivers/zip/BinaryTree.java | 30 +-
.../compress/archivers/zip/CircularBuffer.java | 6 +-
.../archivers/zip/ExplodingInputStream.java | 10 +-
.../compress/archivers/zip/ExtraFieldUtils.java | 48 ++--
.../archivers/zip/GeneralPurposeBit.java | 8 +-
.../compress/archivers/zip/NioZipEncoding.java | 8 +-
.../archivers/zip/PKWareExtraHeader.java | 12 +-
.../zip/ParallelScatterZipCreator.java | 14 +-
.../archivers/zip/ScatterZipOutputStream.java | 10 +-
.../archivers/zip/Simple8BitZipEncoding.java | 22 +-
.../archivers/zip/StreamCompressor.java | 4 +-
.../archivers/zip/UnrecognizedExtraField.java | 4 +-
.../archivers/zip/UnshrinkingInputStream.java | 2 +-
.../compress/archivers/zip/X000A_NTFS.java | 14 +-
.../zip/X0017_StrongEncryptionHeader.java | 10 +-
.../archivers/zip/X5455_ExtendedTimestamp.java | 16 +-
.../compress/archivers/zip/X7875_NewUnix.java | 22 +-
.../zip/Zip64ExtendedInformationExtraField.java | 6 +-
.../compress/archivers/zip/ZipArchiveEntry.java | 46 +--
.../archivers/zip/ZipArchiveInputStream.java | 64 ++---
.../archivers/zip/ZipArchiveOutputStream.java | 84 +++---
.../archivers/zip/ZipEightByteInteger.java | 6 +-
.../archivers/zip/ZipEncodingHelper.java | 22 +-
.../commons/compress/archivers/zip/ZipFile.java | 90 +++---
.../commons/compress/archivers/zip/ZipLong.java | 4 +-
.../compress/archivers/zip/ZipMethod.java | 4 +-
.../compress/archivers/zip/ZipShort.java | 6 +-
.../commons/compress/archivers/zip/ZipUtil.java | 34 +--
.../commons/compress/changes/ChangeSet.java | 14 +-
.../compress/changes/ChangeSetPerformer.java | 24 +-
.../compressors/CompressorStreamFactory.java | 8 +-
.../compress/compressors/FileNameUtil.java | 12 +-
.../bzip2/BZip2CompressorInputStream.java | 20 +-
.../bzip2/BZip2CompressorOutputStream.java | 34 +--
.../compress/compressors/bzip2/BZip2Utils.java | 2 +-
.../compress/compressors/bzip2/BlockSort.java | 19 +-
.../commons/compress/compressors/bzip2/CRC.java | 2 +-
.../deflate/DeflateCompressorInputStream.java | 4 +-
.../gzip/GzipCompressorInputStream.java | 22 +-
.../gzip/GzipCompressorOutputStream.java | 12 +-
.../compress/compressors/gzip/GzipUtils.java | 2 +-
.../lzma/LZMACompressorInputStream.java | 4 +-
.../compress/compressors/lzma/LZMAUtils.java | 6 +-
.../compressors/lzw/LZWInputStream.java | 8 +-
.../pack200/Pack200CompressorInputStream.java | 8 +-
.../pack200/Pack200CompressorOutputStream.java | 2 +-
.../compressors/pack200/Pack200Utils.java | 6 +-
.../FramedSnappyCompressorInputStream.java | 22 +-
.../compressors/snappy/PureJavaCrc32C.java | 2 +-
.../snappy/SnappyCompressorInputStream.java | 12 +-
.../compressors/xz/XZCompressorInputStream.java | 4 +-
.../compress/compressors/xz/XZUtils.java | 6 +-
.../compressors/z/ZCompressorInputStream.java | 10 +-
.../commons/compress/utils/ArchiveUtils.java | 14 +-
.../utils/ChecksumVerifyingInputStream.java | 4 +-
.../compress/utils/CountingInputStream.java | 4 +-
.../apache/commons/compress/utils/IOUtils.java | 8 +-
.../commons/compress/AbstractTestCase.java | 32 +--
.../commons/compress/ArchiveReadTest.java | 13 +-
.../commons/compress/ArchiveUtilsTest.java | 10 +-
.../commons/compress/ChainingTestCase.java | 4 +-
.../compress/DetectArchiverTestCase.java | 6 +-
.../apache/commons/compress/IOMethodsTest.java | 48 ++--
.../commons/compress/archivers/ArTestCase.java | 34 +--
.../archivers/ArchiveOutputStreamTest.java | 30 +-
.../archivers/ArchiveStreamFactoryTest.java | 60 ++--
.../compress/archivers/CpioTestCase.java | 36 +--
.../compress/archivers/DumpTestCase.java | 4 +-
.../archivers/ExceptionMessageTest.java | 16 +-
.../commons/compress/archivers/JarTestCase.java | 4 +-
.../compress/archivers/LongPathTest.java | 21 +-
.../compress/archivers/LongSymLinkTest.java | 21 +-
.../commons/compress/archivers/TarTestCase.java | 46 +--
.../commons/compress/archivers/ZipTestCase.java | 132 ++++-----
.../archivers/ar/ArArchiveInputStreamTest.java | 6 +-
.../archivers/ar/ArArchiveOutputStreamTest.java | 10 +-
.../arj/ArjArchiveInputStreamTest.java | 18 +-
.../cpio/CpioArchiveInputStreamTest.java | 8 +-
.../cpio/CpioArchiveOutputStreamTest.java | 2 +-
.../archivers/dump/DumpArchiveEntryTest.java | 4 +-
.../dump/DumpArchiveInputStreamTest.java | 16 +-
.../jar/JarArchiveOutputStreamTest.java | 4 +-
.../memory/MemoryArchiveInputStream.java | 2 +-
.../archivers/sevenz/SevenZFileTest.java | 66 ++---
.../archivers/sevenz/SevenZOutputFileTest.java | 58 ++--
.../compress/archivers/tar/BigFilesIT.java | 10 +-
.../compress/archivers/tar/SparseFilesTest.java | 8 +-
.../archivers/tar/TarArchiveEntryTest.java | 16 +-
.../tar/TarArchiveInputStreamTest.java | 70 ++---
.../tar/TarArchiveOutputStreamTest.java | 286 +++++++++----------
.../compress/archivers/tar/TarLister.java | 6 +-
.../compress/archivers/tar/TarUtilsTest.java | 52 ++--
.../archivers/zip/AsiExtraFieldTest.java | 10 +-
.../compress/archivers/zip/BinaryTreeTest.java | 6 +-
.../compress/archivers/zip/BitStreamTest.java | 10 +-
.../archivers/zip/CircularBufferTest.java | 6 +-
.../archivers/zip/EncryptedArchiveTest.java | 14 +-
.../archivers/zip/ExplodeSupportTest.java | 18 +-
.../archivers/zip/ExtraFieldUtilsTest.java | 32 +--
.../archivers/zip/GeneralPurposeBitTest.java | 18 +-
.../commons/compress/archivers/zip/Lister.java | 22 +-
.../archivers/zip/Maven221MultiVolumeTest.java | 14 +-
.../zip/ParallelScatterZipCreatorTest.java | 38 +--
.../archivers/zip/ScatterSampleTest.java | 20 +-
.../zip/ScatterZipOutputStreamTest.java | 12 +-
.../archivers/zip/StreamCompressorTest.java | 10 +-
.../archivers/zip/UTF8ZipFilesTest.java | 52 ++--
.../compress/archivers/zip/X000A_NTFSTest.java | 6 +-
.../zip/X5455_ExtendedTimestampTest.java | 54 ++--
.../archivers/zip/X7875_NewUnixTest.java | 12 +-
.../Zip64ExtendedInformationExtraFieldTest.java | 48 ++--
.../compress/archivers/zip/Zip64SupportIT.java | 192 ++++++-------
.../archivers/zip/ZipArchiveEntryTest.java | 58 ++--
.../zip/ZipArchiveInputStreamTest.java | 22 +-
.../archivers/zip/ZipEightByteIntegerTest.java | 24 +-
.../compress/archivers/zip/ZipEncodingTest.java | 12 +-
.../compress/archivers/zip/ZipFileTest.java | 52 ++--
.../compress/archivers/zip/ZipLongTest.java | 22 +-
.../compress/archivers/zip/ZipShortTest.java | 22 +-
.../compress/archivers/zip/ZipUtilTest.java | 80 +++---
.../compress/changes/ChangeSetTestCase.java | 238 +++++++--------
.../compress/compressors/BZip2TestCase.java | 6 +-
.../compress/compressors/DeflateTestCase.java | 4 +-
.../compressors/DetectCompressorTestCase.java | 22 +-
.../compressors/FramedSnappyTestCase.java | 2 +-
.../compress/compressors/GZipTestCase.java | 58 ++--
.../compress/compressors/Pack200TestCase.java | 18 +-
.../compress/compressors/XZTestCase.java | 2 +-
.../bzip2/BZip2CompressorInputStreamTest.java | 14 +-
.../compressors/bzip2/BlockSortTest.java | 20 +-
.../bzip2/PythonTruncatedBzip2Test.java | 18 +-
.../DeflateCompressorInputStreamTest.java | 8 +-
.../DeflateCompressorOutputStreamTest.java | 4 +-
.../deflate/DeflateParametersTest.java | 6 +-
.../compressors/lzma/LZMAUtilsTestCase.java | 2 +-
.../compressors/pack200/Pack200UtilsTest.java | 8 +-
.../FramedSnappyCompressorInputStreamTest.java | 18 +-
.../xz/XZCompressorInputStreamTest.java | 2 +-
.../compressors/xz/XZUtilsTestCase.java | 2 +-
.../compress/utils/BitInputStreamTest.java | 24 +-
.../compress/utils/CountingStreamTest.java | 8 +-
.../commons/compress/utils/IOUtilsTest.java | 4 +-
180 files changed, 1969 insertions(+), 1965 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
index 2cd85c7..afd3c4a 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
@@ -78,7 +78,7 @@ public abstract class ArchiveInputStream extends InputStream {
*/
@Override
public int read() throws IOException {
- int num = read(SINGLE, 0, 1);
+ final int num = read(SINGLE, 0, 1);
return num == -1 ? -1 : SINGLE[0] & BYTE_MASK;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java b/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
index d5370c4..cff42ee 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
@@ -275,7 +275,7 @@ public class ArchiveStreamFactory {
return new ArArchiveOutputStream(out);
}
if (ZIP.equalsIgnoreCase(archiverName)) {
- ZipArchiveOutputStream zip = new ZipArchiveOutputStream(out);
+ final ZipArchiveOutputStream zip = new ZipArchiveOutputStream(out);
if (entryEncoding != null) {
zip.setEncoding(entryEncoding);
}
@@ -372,7 +372,7 @@ public class ArchiveStreamFactory {
if (tais.getNextTarEntry().isCheckSumOK()) {
return createArchiveInputStream(TAR, in);
}
- } catch (Exception e) { // NOPMD
+ } catch (final Exception e) { // NOPMD
// can generate IllegalArgumentException as well
// as IOException
// autodetection, simply not a TAR
@@ -381,7 +381,7 @@ public class ArchiveStreamFactory {
IOUtils.closeQuietly(tais);
}
}
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new ArchiveException("Could not use reset and mark operations.", e);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/Lister.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/Lister.java b/src/main/java/org/apache/commons/compress/archivers/Lister.java
index 8de2ac9..c832e66 100644
--- a/src/main/java/org/apache/commons/compress/archivers/Lister.java
+++ b/src/main/java/org/apache/commons/compress/archivers/Lister.java
@@ -40,11 +40,11 @@ public final class Lister {
return;
}
System.out.println("Analysing "+args[0]);
- File f = new File(args[0]);
+ final File f = new File(args[0]);
if (!f.isFile()) {
System.err.println(f + " doesn't exist or is a directory");
}
- InputStream fis = new BufferedInputStream(new FileInputStream(f));
+ final InputStream fis = new BufferedInputStream(new FileInputStream(f));
ArchiveInputStream ais;
if (args.length > 1) {
ais = factory.createArchiveInputStream(args[1], fis);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
index c7d6f8e..adf5d86 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
@@ -177,7 +177,7 @@ public class ArArchiveEntry implements ArchiveEntry {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
- ArArchiveEntry other = (ArArchiveEntry) obj;
+ final ArArchiveEntry other = (ArArchiveEntry) obj;
if (name == null) {
if (other.name != null) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
index 665112c..bcd159d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
@@ -112,7 +112,7 @@ public class ArArchiveInputStream extends ArchiveInputStream {
IOUtils.readFully(this, NAME_BUF);
IOUtils.readFully(this, LAST_MODIFIED_BUF);
IOUtils.readFully(this, ID_BUF);
- int userId = asInt(ID_BUF, true);
+ final int userId = asInt(ID_BUF, true);
IOUtils.readFully(this, ID_BUF);
IOUtils.readFully(this, FILE_MODE_BUF);
IOUtils.readFully(this, LENGTH_BUF);
@@ -146,14 +146,14 @@ public class ArArchiveInputStream extends ArchiveInputStream {
if (temp.endsWith("/")) { // GNU terminator
temp = temp.substring(0, temp.length() - 1);
} else if (isGNULongName(temp)) {
- int off = Integer.parseInt(temp.substring(1));// get the offset
+ final int off = Integer.parseInt(temp.substring(1));// get the offset
temp = getExtendedName(off); // convert to the long name
} else if (isBSDLongName(temp)) {
temp = getBSDLongName(temp);
// entry length contained the length of the file name in
// addition to the real length of the entry.
// assume file name was ASCII, there is no "standard" otherwise
- int nameLen = temp.length();
+ final int nameLen = temp.length();
len -= nameLen;
entryOffset += nameLen;
}
@@ -203,7 +203,7 @@ public class ArArchiveInputStream extends ArchiveInputStream {
}
private int asInt(final byte[] input, final int base, final boolean treatBlankAsZero) {
- String string = ArchiveUtils.toAsciiString(input).trim();
+ final String string = ArchiveUtils.toAsciiString(input).trim();
if (string.length() == 0 && treatBlankAsZero) {
return 0;
}
@@ -342,10 +342,10 @@ public class ArArchiveInputStream extends ArchiveInputStream {
* @since 1.3
*/
private String getBSDLongName(final String bsdLongName) throws IOException {
- int nameLen =
+ final int nameLen =
Integer.parseInt(bsdLongName.substring(BSD_LONGNAME_PREFIX_LEN));
- byte[] name = new byte[nameLen];
- int read = IOUtils.readFully(this, name);
+ final byte[] name = new byte[nameLen];
+ final int read = IOUtils.readFully(this, name);
if (read != nameLen) {
throw new EOFException();
}
@@ -381,9 +381,9 @@ public class ArArchiveInputStream extends ArchiveInputStream {
* @see #isGNUStringTable
*/
private ArArchiveEntry readGNUStringTable(final byte[] length) throws IOException {
- int bufflen = asInt(length); // Assume length will fit in an int
+ final int bufflen = asInt(length); // Assume length will fit in an int
namebuffer = new byte[bufflen];
- int read = IOUtils.readFully(this, namebuffer, 0, bufflen);
+ final int read = IOUtils.readFully(this, namebuffer, 0, bufflen);
if (read != bufflen){
throw new IOException("Failed to read complete // record: expected="
+ bufflen + " read=" + read);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
index 00583a6..aa3a0db 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
@@ -64,7 +64,7 @@ public class ArArchiveOutputStream extends ArchiveOutputStream {
}
private long writeArchiveHeader() throws IOException {
- byte [] header = ArchiveUtils.toAsciiBytes(ArArchiveEntry.HEADER);
+ final byte [] header = ArchiveUtils.toAsciiBytes(ArArchiveEntry.HEADER);
out.write(header);
return header.length;
}
@@ -89,7 +89,7 @@ public class ArArchiveOutputStream extends ArchiveOutputStream {
throw new IOException("Stream has already been finished");
}
- ArArchiveEntry pArEntry = (ArArchiveEntry)pEntry;
+ final ArArchiveEntry pArEntry = (ArArchiveEntry)pEntry;
if (prevEntry == null) {
writeArchiveHeader();
} else {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
index 4a080b2..a275a43 100644
--- a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
@@ -91,7 +91,7 @@ public class ArjArchiveEntry implements ArchiveEntry {
*/
@Override
public Date getLastModifiedDate() {
- long ts = isHostOsUnix() ? localFileHeader.dateTimeModified * 1000l
+ final long ts = isHostOsUnix() ? localFileHeader.dateTimeModified * 1000l
: ZipUtil.dosToJavaTime(0xFFFFFFFFL & localFileHeader.dateTimeModified);
return new Date(ts);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
index db72a98..b1fd223 100644
--- a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
@@ -67,7 +67,7 @@ public class ArjArchiveInputStream extends ArchiveInputStream {
if ((mainHeader.arjFlags & MainHeader.Flags.VOLUME) != 0) {
throw new ArchiveException("Multi-volume ARJ files are unsupported");
}
- } catch (IOException ioException) {
+ } catch (final IOException ioException) {
throw new ArchiveException(ioException.getMessage(), ioException);
}
}
@@ -89,7 +89,7 @@ public class ArjArchiveInputStream extends ArchiveInputStream {
}
private int read8(final DataInputStream dataIn) throws IOException {
- int value = dataIn.readUnsignedByte();
+ final int value = dataIn.readUnsignedByte();
count(1);
return value;
}
@@ -248,7 +248,7 @@ public class ArjArchiveInputStream extends ArchiveInputStream {
localFileHeader.name = readString(basicHeader);
localFileHeader.comment = readString(basicHeader);
- ArrayList<byte[]> extendedHeaders = new ArrayList<byte[]>();
+ final ArrayList<byte[]> extendedHeaders = new ArrayList<byte[]>();
int extendedHeaderSize;
while ((extendedHeaderSize = read16(in)) > 0) {
final byte[] extendedHeaderBytes = new byte[extendedHeaderSize];
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/arj/LocalFileHeader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/arj/LocalFileHeader.java b/src/main/java/org/apache/commons/compress/archivers/arj/LocalFileHeader.java
index d48dc17..4629213 100644
--- a/src/main/java/org/apache/commons/compress/archivers/arj/LocalFileHeader.java
+++ b/src/main/java/org/apache/commons/compress/archivers/arj/LocalFileHeader.java
@@ -72,7 +72,7 @@ class LocalFileHeader {
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
+ final StringBuilder builder = new StringBuilder();
builder.append("LocalFileHeader [archiverVersionNumber=");
builder.append(archiverVersionNumber);
builder.append(", minVersionToExtract=");
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
index 2b0aa7c..f625dcf 100644
--- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java
@@ -474,7 +474,7 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry {
if (name != null) {
size += name.length();
}
- int remain = size % this.alignmentBoundary;
+ final int remain = size % this.alignmentBoundary;
if (remain > 0){
return this.alignmentBoundary - remain;
}
@@ -488,8 +488,8 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry {
*/
public int getDataPadCount(){
if (this.alignmentBoundary == 0) { return 0; }
- long size = this.filesize;
- int remain = (int) (size % this.alignmentBoundary);
+ final long size = this.filesize;
+ final int remain = (int) (size % this.alignmentBoundary);
if (remain > 0){
return this.alignmentBoundary - remain;
}
@@ -884,7 +884,7 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
- CpioArchiveEntry other = (CpioArchiveEntry) obj;
+ final CpioArchiveEntry other = (CpioArchiveEntry) obj;
if (name == null) {
if (other.name != null) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
index afc91bb..8c69bce 100644
--- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
@@ -245,7 +245,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
TWO_BYTES_BUF.length);
readFully(SIX_BYTES_BUF, TWO_BYTES_BUF.length,
FOUR_BYTES_BUF.length);
- String magicString = ArchiveUtils.toAsciiString(SIX_BYTES_BUF);
+ final String magicString = ArchiveUtils.toAsciiString(SIX_BYTES_BUF);
if (magicString.equals(MAGIC_NEW)) {
this.entry = readNewEntry(false);
} else if (magicString.equals(MAGIC_NEW_CRC)) {
@@ -315,13 +315,13 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
}
return -1; // EOF for this entry
}
- int tmplength = (int) Math.min(len, this.entry.getSize()
+ final int tmplength = (int) Math.min(len, this.entry.getSize()
- this.entryBytesRead);
if (tmplength < 0) {
return -1;
}
- int tmpread = readFully(b, off, tmplength);
+ final int tmpread = readFully(b, off, tmplength);
if (this.entry.getFormat() == FORMAT_NEW_CRC) {
for (int pos = 0; pos < tmpread; pos++) {
this.crc += b[pos] & 0xFF;
@@ -334,7 +334,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
private final int readFully(final byte[] b, final int off, final int len)
throws IOException {
- int count = IOUtils.readFully(in, b, off, len);
+ final int count = IOUtils.readFully(in, b, off, len);
count(count);
if (count < len) {
throw new EOFException();
@@ -344,14 +344,14 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
private long readBinaryLong(final int length, final boolean swapHalfWord)
throws IOException {
- byte tmp[] = new byte[length];
+ final byte tmp[] = new byte[length];
readFully(tmp, 0, tmp.length);
return CpioUtil.byteArray2long(tmp, swapHalfWord);
}
private long readAsciiLong(final int length, final int radix)
throws IOException {
- byte tmpBuffer[] = new byte[length];
+ final byte tmpBuffer[] = new byte[length];
readFully(tmpBuffer, 0, tmpBuffer.length);
return Long.parseLong(ArchiveUtils.toAsciiString(tmpBuffer), radix);
}
@@ -366,7 +366,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
}
ret.setInode(readAsciiLong(8, 16));
- long mode = readAsciiLong(8, 16);
+ final long mode = readAsciiLong(8, 16);
if (CpioUtil.fileType(mode) != 0){ // mode is initialised to 0
ret.setMode(mode);
}
@@ -379,9 +379,9 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
ret.setDeviceMin(readAsciiLong(8, 16));
ret.setRemoteDeviceMaj(readAsciiLong(8, 16));
ret.setRemoteDeviceMin(readAsciiLong(8, 16));
- long namesize = readAsciiLong(8, 16);
+ final long namesize = readAsciiLong(8, 16);
ret.setChksum(readAsciiLong(8, 16));
- String name = readCString((int) namesize);
+ final String name = readCString((int) namesize);
ret.setName(name);
if (CpioUtil.fileType(mode) == 0 && !name.equals(CPIO_TRAILER)){
throw new IOException("Mode 0 only allowed in the trailer. Found entry name: "+name + " Occured at byte: " + getBytesRead());
@@ -392,7 +392,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
}
private CpioArchiveEntry readOldAsciiEntry() throws IOException {
- CpioArchiveEntry ret = new CpioArchiveEntry(FORMAT_OLD_ASCII);
+ final CpioArchiveEntry ret = new CpioArchiveEntry(FORMAT_OLD_ASCII);
ret.setDevice(readAsciiLong(6, 8));
ret.setInode(readAsciiLong(6, 8));
@@ -405,7 +405,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
ret.setNumberOfLinks(readAsciiLong(6, 8));
ret.setRemoteDevice(readAsciiLong(6, 8));
ret.setTime(readAsciiLong(11, 8));
- long namesize = readAsciiLong(6, 8);
+ final long namesize = readAsciiLong(6, 8);
ret.setSize(readAsciiLong(11, 8));
final String name = readCString((int) namesize);
ret.setName(name);
@@ -418,7 +418,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
private CpioArchiveEntry readOldBinaryEntry(final boolean swapHalfWord)
throws IOException {
- CpioArchiveEntry ret = new CpioArchiveEntry(FORMAT_OLD_BINARY);
+ final CpioArchiveEntry ret = new CpioArchiveEntry(FORMAT_OLD_BINARY);
ret.setDevice(readBinaryLong(2, swapHalfWord));
ret.setInode(readBinaryLong(2, swapHalfWord));
@@ -431,7 +431,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
ret.setNumberOfLinks(readBinaryLong(2, swapHalfWord));
ret.setRemoteDevice(readBinaryLong(2, swapHalfWord));
ret.setTime(readBinaryLong(4, swapHalfWord));
- long namesize = readBinaryLong(2, swapHalfWord);
+ final long namesize = readBinaryLong(2, swapHalfWord);
ret.setSize(readBinaryLong(4, swapHalfWord));
final String name = readCString((int) namesize);
ret.setName(name);
@@ -445,7 +445,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
private String readCString(final int length) throws IOException {
// don't include trailing NUL in file name to decode
- byte tmpBuffer[] = new byte[length - 1];
+ final byte tmpBuffer[] = new byte[length - 1];
readFully(tmpBuffer, 0, tmpBuffer.length);
this.in.read();
return zipEncoding.decode(tmpBuffer);
@@ -468,7 +468,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
throw new IllegalArgumentException("negative skip length");
}
ensureOpen();
- int max = (int) Math.min(n, Integer.MAX_VALUE);
+ final int max = (int) Math.min(n, Integer.MAX_VALUE);
int total = 0;
while (total < max) {
@@ -495,11 +495,11 @@ public class CpioArchiveInputStream extends ArchiveInputStream implements
* Skips the padding zeros written after the TRAILER!!! entry.
*/
private void skipRemainderOfLastBlock() throws IOException {
- long readFromLastBlock = getBytesRead() % blockSize;
+ final long readFromLastBlock = getBytesRead() % blockSize;
long remainingBytes = readFromLastBlock == 0 ? 0
: blockSize - readFromLastBlock;
while (remainingBytes > 0) {
- long skipped = skip(blockSize - readFromLastBlock);
+ final long skipped = skip(blockSize - readFromLastBlock);
if (skipped <= 0) {
break;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
index 13d4270..eb51484 100644
--- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
@@ -222,7 +222,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
throw new IOException("Stream has already been finished");
}
- CpioArchiveEntry e = (CpioArchiveEntry) entry;
+ final CpioArchiveEntry e = (CpioArchiveEntry) entry;
ensureOpen();
if (this.entry != null) {
closeArchiveEntry(); // close previous entry
@@ -263,7 +263,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
writeOldAsciiEntry(e);
break;
case FORMAT_OLD_BINARY:
- boolean swapHalfWord = true;
+ final boolean swapHalfWord = true;
writeBinaryLong(MAGIC_OLD_BINARY, 2, swapHalfWord);
writeOldBinaryEntry(e, swapHalfWord);
break;
@@ -464,7 +464,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
writeHeader(this.entry);
closeArchiveEntry();
- int lengthOfLastBlock = (int) (getBytesWritten() % blockSize);
+ final int lengthOfLastBlock = (int) (getBytesWritten() % blockSize);
if (lengthOfLastBlock != 0) {
pad(blockSize - lengthOfLastBlock);
}
@@ -493,7 +493,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
private void pad(final int count) throws IOException{
if (count > 0){
- byte buff[] = new byte[count];
+ final byte buff[] = new byte[count];
out.write(buff);
count(count);
}
@@ -501,14 +501,14 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
private void writeBinaryLong(final long number, final int length,
final boolean swapHalfWord) throws IOException {
- byte tmp[] = CpioUtil.long2byteArray(number, length, swapHalfWord);
+ final byte tmp[] = CpioUtil.long2byteArray(number, length, swapHalfWord);
out.write(tmp);
count(tmp.length);
}
private void writeAsciiLong(final long number, final int length,
final int radix) throws IOException {
- StringBuilder tmp = new StringBuilder();
+ final StringBuilder tmp = new StringBuilder();
String tmpStr;
if (radix == 16) {
tmp.append(Long.toHexString(number));
@@ -519,7 +519,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
}
if (tmp.length() <= length) {
- long insertLength = length - tmp.length();
+ final long insertLength = length - tmp.length();
for (int pos = 0; pos < insertLength; pos++) {
tmp.insert(0, "0");
}
@@ -527,7 +527,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
} else {
tmpStr = tmp.substring(tmp.length() - length);
}
- byte[] b = ArchiveUtils.toAsciiBytes(tmpStr);
+ final byte[] b = ArchiveUtils.toAsciiBytes(tmpStr);
out.write(b);
count(b.length);
}
@@ -538,7 +538,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStream implements
* @throws IOException if the string couldn't be written
*/
private void writeCString(final String str) throws IOException {
- ByteBuffer buf = zipEncoding.encode(str);
+ final ByteBuffer buf = zipEncoding.encode(str);
final int len = buf.limit() - buf.position();
out.write(buf.array(), buf.arrayOffset(), len);
out.write('\0');
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioUtil.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioUtil.java
index efc1584..aba485f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioUtil.java
+++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioUtil.java
@@ -50,7 +50,7 @@ class CpioUtil {
long ret = 0;
int pos = 0;
- byte tmp_number[] = new byte[number.length];
+ final byte tmp_number[] = new byte[number.length];
System.arraycopy(number, 0, tmp_number, 0, number.length);
if (!swapHalfWord) {
@@ -86,7 +86,7 @@ class CpioUtil {
*/
static byte[] long2byteArray(final long number, final int length,
final boolean swapHalfWord) {
- byte[] ret = new byte[length];
+ final byte[] ret = new byte[length];
int pos = 0;
long tmp_number = 0;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveConstants.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveConstants.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveConstants.java
index 15738e5..f51914b 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveConstants.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveConstants.java
@@ -54,7 +54,7 @@ public final class DumpArchiveConstants {
}
public static SEGMENT_TYPE find(final int code) {
- for (SEGMENT_TYPE t : values()) {
+ for (final SEGMENT_TYPE t : values()) {
if (t.code == code) {
return t;
}
@@ -79,7 +79,7 @@ public final class DumpArchiveConstants {
}
public static COMPRESSION_TYPE find(final int code) {
- for (COMPRESSION_TYPE t : values()) {
+ for (final COMPRESSION_TYPE t : values()) {
if (t.code == code) {
return t;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/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 43fecde..caeb25a 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
@@ -407,7 +407,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
return false;
}
- DumpArchiveEntry rhs = (DumpArchiveEntry) o;
+ final DumpArchiveEntry rhs = (DumpArchiveEntry) o;
if ((header == null) || (rhs.header == null)) {
return false;
@@ -437,8 +437,8 @@ public class DumpArchiveEntry implements ArchiveEntry {
* @param buffer buffer to read content from
*/
static DumpArchiveEntry parse(final byte[] buffer) {
- DumpArchiveEntry entry = new DumpArchiveEntry();
- TapeSegmentHeader header = entry.header;
+ final DumpArchiveEntry entry = new DumpArchiveEntry();
+ final TapeSegmentHeader header = entry.header;
header.type = DumpArchiveConstants.SEGMENT_TYPE.find(DumpArchiveUtil.convert32(
buffer, 0));
@@ -452,7 +452,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
//header.magic = DumpArchiveUtil.convert32(buffer, 24);
//header.checksum = DumpArchiveUtil.convert32(buffer, 28);
- int m = DumpArchiveUtil.convert16(buffer, 32);
+ final int m = DumpArchiveUtil.convert16(buffer, 32);
// determine the type of the file.
entry.setType(TYPE.find((m >> 12) & 0x0F));
@@ -792,7 +792,7 @@ public class DumpArchiveEntry implements ArchiveEntry {
public static TYPE find(final int code) {
TYPE type = UNKNOWN;
- for (TYPE t : TYPE.values()) {
+ for (final TYPE t : TYPE.values()) {
if (code == t.code) {
type = t;
}
@@ -823,9 +823,9 @@ public class DumpArchiveEntry implements ArchiveEntry {
}
public static Set<PERMISSION> find(final int code) {
- Set<PERMISSION> set = new HashSet<PERMISSION>();
+ final Set<PERMISSION> set = new HashSet<PERMISSION>();
- for (PERMISSION p : PERMISSION.values()) {
+ for (final PERMISSION p : PERMISSION.values()) {
if ((code & p.code) == p.code) {
set.add(p);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
index 3083678..23d7245 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
@@ -108,7 +108,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
try {
// read header, verify it's a dump archive.
- byte[] headerBytes = raw.readRecord();
+ final byte[] headerBytes = raw.readRecord();
if (!DumpArchiveUtil.verify(headerBytes)) {
throw new UnrecognizedFormatException();
@@ -126,12 +126,12 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
// skip past CLRI and BITS segments since we don't handle them yet.
readCLRI();
readBITS();
- } catch (IOException ex) {
+ } catch (final IOException ex) {
throw new ArchiveException(ex.getMessage(), ex);
}
// put in a dummy record for the root node.
- Dirent root = new Dirent(2, 2, 4, ".");
+ final Dirent root = new Dirent(2, 2, 4, ".");
names.put(2, root);
// use priority based on queue to ensure parent directories are
@@ -172,7 +172,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
* Read CLRI (deleted inode) segment.
*/
private void readCLRI() throws IOException {
- byte[] buffer = raw.readRecord();
+ final byte[] buffer = raw.readRecord();
if (!DumpArchiveUtil.verify(buffer)) {
throw new InvalidFormatException();
@@ -196,7 +196,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
* Read BITS segment.
*/
private void readBITS() throws IOException {
- byte[] buffer = raw.readRecord();
+ final byte[] buffer = raw.readRecord();
if (!DumpArchiveUtil.verify(buffer)) {
throw new InvalidFormatException();
@@ -338,7 +338,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
pending.put(entry.getIno(), entry);
}
- int datalen = DumpArchiveConstants.TP_SIZE * entry.getHeaderCount();
+ final int datalen = DumpArchiveConstants.TP_SIZE * entry.getHeaderCount();
if (blockBuffer.length < datalen) {
blockBuffer = new byte[datalen];
@@ -352,19 +352,19 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
for (int i = 0; i < datalen - 8 && i < size - 8;
i += reclen) {
- int ino = DumpArchiveUtil.convert32(blockBuffer, i);
+ final int ino = DumpArchiveUtil.convert32(blockBuffer, i);
reclen = DumpArchiveUtil.convert16(blockBuffer, i + 4);
- byte type = blockBuffer[i + 6];
+ final byte type = blockBuffer[i + 6];
- String name = DumpArchiveUtil.decode(zipEncoding, blockBuffer, i + 8, blockBuffer[i + 7]);
+ final String name = DumpArchiveUtil.decode(zipEncoding, blockBuffer, i + 8, blockBuffer[i + 7]);
if (".".equals(name) || "..".equals(name)) {
// do nothing...
continue;
}
- Dirent d = new Dirent(ino, entry.getIno(), type, name);
+ final Dirent d = new Dirent(ino, entry.getIno(), type, name);
/*
if ((type == 4) && names.containsKey(ino)) {
@@ -376,8 +376,8 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
names.put(ino, d);
// check whether this allows us to fill anything in the pending list.
- for (Map.Entry<Integer, DumpArchiveEntry> e : pending.entrySet()) {
- String path = getPath(e.getValue());
+ for (final Map.Entry<Integer, DumpArchiveEntry> e : pending.entrySet()) {
+ final String path = getPath(e.getValue());
if (path != null) {
e.getValue().setName(path);
@@ -389,12 +389,12 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
// remove anything that we found. (We can't do it earlier
// because of concurrent modification exceptions.)
- for (DumpArchiveEntry e : queue) {
+ for (final DumpArchiveEntry e : queue) {
pending.remove(e.getIno());
}
}
- byte[] peekBytes = raw.peek();
+ final byte[] peekBytes = raw.peek();
if (!DumpArchiveUtil.verify(peekBytes)) {
throw new InvalidFormatException();
@@ -415,7 +415,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
private String getPath(final DumpArchiveEntry entry) {
// build the stack of elements. It's possible that we're
// still missing an intermediate value and if so we
- Stack<String> elements = new Stack<String>();
+ final Stack<String> elements = new Stack<String>();
Dirent dirent = null;
for (int i = entry.getIno();; i = dirent.getParentIno()) {
@@ -440,7 +440,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
}
// generate full path from stack of elements.
- StringBuilder sb = new StringBuilder(elements.pop());
+ final StringBuilder sb = new StringBuilder(elements.pop());
while (!elements.isEmpty()) {
sb.append('/');
@@ -480,7 +480,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
}
while (len > 0) {
- int sz = len > readBuf.length - recordOffset
+ final int sz = len > readBuf.length - recordOffset
? readBuf.length - recordOffset : len;
// copy any data we have
@@ -495,7 +495,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
// load next block if necessary.
if (len > 0) {
if (readIdx >= 512) {
- byte[] headerBytes = raw.readRecord();
+ final byte[] headerBytes = raw.readRecord();
if (!DumpArchiveUtil.verify(headerBytes)) {
throw new InvalidFormatException();
@@ -506,7 +506,7 @@ public class DumpArchiveInputStream extends ArchiveInputStream {
}
if (!active.isSparseRecord(readIdx++)) {
- int r = raw.read(readBuf, 0, readBuf.length);
+ final int r = raw.read(readBuf, 0, readBuf.length);
if (r != readBuf.length) {
throw new EOFException();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java
index 6813608..f17e70f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java
@@ -316,7 +316,7 @@ public class DumpArchiveSummary {
return false;
}
- DumpArchiveSummary rhs = (DumpArchiveSummary) o;
+ final DumpArchiveSummary rhs = (DumpArchiveSummary) o;
if (dumpDate != rhs.dumpDate) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
index 315064a..6d52ceb 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
@@ -55,14 +55,14 @@ class DumpArchiveUtil {
*/
public static final boolean verify(final byte[] buffer) {
// verify magic. for now only accept NFS_MAGIC.
- int magic = convert32(buffer, 24);
+ final int magic = convert32(buffer, 24);
if (magic != DumpArchiveConstants.NFS_MAGIC) {
return false;
}
//verify checksum...
- int checksum = convert32(buffer, 28);
+ final int checksum = convert32(buffer, 28);
if (checksum != calculateChecksum(buffer)) {
return false;
@@ -138,7 +138,7 @@ class DumpArchiveUtil {
*/
static String decode(final ZipEncoding encoding, final byte[] b, final int offset, final int len)
throws IOException {
- byte[] copy = new byte[len];
+ final byte[] copy = new byte[len];
System.arraycopy(b, offset, copy, 0, len);
return encoding.decode(copy);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/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 9a0b098..08c6a00 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
@@ -71,7 +71,7 @@ class TapeInputStream extends FilterInputStream {
blockSize = recordSize * recsPerBlock;
// save first block in case we need it again
- byte[] oldBuffer = blockBuffer;
+ final byte[] oldBuffer = blockBuffer;
// read rest of new block
blockBuffer = new byte[blockSize];
@@ -223,7 +223,7 @@ class TapeInputStream extends FilterInputStream {
}
// copy data, increment counters.
- byte[] b = new byte[recordSize];
+ final byte[] b = new byte[recordSize];
System.arraycopy(blockBuffer, readOffset, b, 0, b.length);
return b;
@@ -236,7 +236,7 @@ class TapeInputStream extends FilterInputStream {
* @throws IOException on error
*/
public byte[] readRecord() throws IOException {
- byte[] result = new byte[recordSize];
+ final byte[] result = new byte[recordSize];
// the read implementation will loop internally as long as
// input is available
@@ -271,8 +271,8 @@ class TapeInputStream extends FilterInputStream {
}
bytesRead += 4;
- int h = DumpArchiveUtil.convert32(blockBuffer, 0);
- boolean compressed = (h & 0x01) == 0x01;
+ final int h = DumpArchiveUtil.convert32(blockBuffer, 0);
+ final boolean compressed = (h & 0x01) == 0x01;
if (!compressed) {
// file is compressed but this block is not.
@@ -280,9 +280,9 @@ class TapeInputStream extends FilterInputStream {
bytesRead += blockSize;
} else {
// this block is compressed.
- int flags = (h >> 1) & 0x07;
+ final int flags = (h >> 1) & 0x07;
int length = (h >> 4) & 0x0FFFFFFF;
- byte[] compBuffer = new byte[length];
+ final byte[] compBuffer = new byte[length];
success = readFully(compBuffer, 0, length);
bytesRead += length;
@@ -294,7 +294,7 @@ class TapeInputStream extends FilterInputStream {
0x03)) {
case ZLIB:
- Inflater inflator = new Inflater();
+ final Inflater inflator = new Inflater();
try {
inflator.setInput(compBuffer, 0, compBuffer.length);
length = inflator.inflate(blockBuffer);
@@ -302,7 +302,7 @@ class TapeInputStream extends FilterInputStream {
if (length != blockSize) {
throw new ShortFileException();
}
- } catch (DataFormatException e) {
+ } catch (final DataFormatException e) {
throw new DumpArchiveException("bad data", e);
} finally {
inflator.end();
@@ -336,7 +336,7 @@ class TapeInputStream extends FilterInputStream {
*/
private boolean readFully(final byte[] b, final int off, final int len)
throws IOException {
- int count = IOUtils.readFully(in, b, off, len);
+ final int count = IOUtils.readFully(in, b, off, len);
if (count < len) {
throw new ShortFileException();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/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 5974dce..835c840 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
@@ -75,7 +75,7 @@ public class JarArchiveEntry extends ZipArchiveEntry {
@Deprecated
public Certificate[] getCertificates() {
if (certificates != null) { // never true currently
- Certificate[] certs = new Certificate[certificates.length];
+ final Certificate[] certs = new Certificate[certificates.length];
System.arraycopy(certificates, 0, certs, 0, certs.length);
return certs;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
index 6ed5249..95f4788 100644
--- a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
@@ -53,7 +53,7 @@ public class JarArchiveInputStream extends ZipArchiveInputStream {
}
public JarArchiveEntry getNextJarEntry() throws IOException {
- ZipArchiveEntry entry = getNextZipEntry();
+ final ZipArchiveEntry entry = getNextZipEntry();
return entry == null ? null : new JarArchiveEntry(entry);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
index 6406e16..c320d9f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
@@ -67,7 +67,7 @@ class AES256SHA256Decoder extends CoderBase {
final MessageDigest digest;
try {
digest = MessageDigest.getInstance("SHA-256");
- } catch (NoSuchAlgorithmException noSuchAlgorithmException) {
+ } catch (final NoSuchAlgorithmException noSuchAlgorithmException) {
throw new IOException("SHA-256 is unsupported by your Java implementation",
noSuchAlgorithmException);
}
@@ -93,7 +93,7 @@ class AES256SHA256Decoder extends CoderBase {
cipherInputStream = new CipherInputStream(in, cipher);
isInitialized = true;
return cipherInputStream;
- } catch (GeneralSecurityException generalSecurityException) {
+ } catch (final GeneralSecurityException generalSecurityException) {
throw new IOException("Decryption error " +
"(do you have the JCE Unlimited Strength Jurisdiction Policy Files installed?)",
generalSecurityException);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/CLI.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/CLI.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/CLI.java
index 4606f0c..1252fcf 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/CLI.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/CLI.java
@@ -49,9 +49,9 @@ public class CLI {
}
private String getContentMethods(final SevenZArchiveEntry entry) {
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
boolean first = true;
- for (SevenZMethodConfiguration m : entry.getContentMethods()) {
+ for (final SevenZMethodConfiguration m : entry.getContentMethods()) {
if (!first) {
sb.append(", ");
}
@@ -68,7 +68,7 @@ public class CLI {
@Override
public void takeAction(final SevenZFile archive, final SevenZArchiveEntry entry)
throws IOException {
- File outFile = new File(entry.getName());
+ final File outFile = new File(entry.getName());
if (entry.isDirectory()) {
if (!outFile.isDirectory() && !outFile.mkdirs()) {
throw new IOException("Cannot create directory " + outFile);
@@ -78,17 +78,17 @@ public class CLI {
}
System.out.println("extracting to " + outFile);
- File parent = outFile.getParentFile();
+ final File parent = outFile.getParentFile();
if (parent != null && !parent.exists() && !parent.mkdirs()) {
throw new IOException("Cannot create " + parent);
}
- FileOutputStream fos = new FileOutputStream(outFile);
+ final FileOutputStream fos = new FileOutputStream(outFile);
try {
final long total = entry.getSize();
long off = 0;
while (off < total) {
- int toRead = (int) Math.min(total - off, BUF.length);
- int bytesRead = archive.read(BUF, 0, toRead);
+ final int toRead = (int) Math.min(total - off, BUF.length);
+ final int bytesRead = archive.read(BUF, 0, toRead);
if (bytesRead < 1) {
throw new IOException("reached end of entry "
+ entry.getName()
@@ -121,13 +121,13 @@ public class CLI {
usage();
return;
}
- Mode mode = grabMode(args);
+ final Mode mode = grabMode(args);
System.out.println(mode.getMessage() + " " + args[0]);
- File f = new File(args[0]);
+ final File f = new File(args[0]);
if (!f.isFile()) {
System.err.println(f + " doesn't exist or is a directory");
}
- SevenZFile archive = new SevenZFile(f);
+ final SevenZFile archive = new SevenZFile(f);
try {
SevenZArchiveEntry ae;
while((ae=archive.getNextEntry()) != null) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
index fffef1d..153f58c 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
@@ -39,7 +39,7 @@ abstract class CoderBase {
* @return whether this method can extract options from the given object.
*/
boolean canAcceptOptions(final Object opts) {
- for (Class<?> c : acceptableOptions) {
+ for (final Class<?> c : acceptableOptions) {
if (c.isInstance(opts)) {
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
index 727989c..1d7244b 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
@@ -69,7 +69,7 @@ class Coders {
static InputStream addDecoder(final String archiveName, final InputStream is, final long uncompressedLength,
final Coder coder, final byte[] password) throws IOException {
- CoderBase cb = findByMethod(SevenZMethod.byId(coder.decompressionMethodId));
+ final CoderBase cb = findByMethod(SevenZMethod.byId(coder.decompressionMethodId));
if (cb == null) {
throw new IOException("Unsupported compression method " +
Arrays.toString(coder.decompressionMethodId)
@@ -80,7 +80,7 @@ class Coders {
static OutputStream addEncoder(final OutputStream out, final SevenZMethod method,
final Object options) throws IOException {
- CoderBase cb = findByMethod(method);
+ final CoderBase cb = findByMethod(method);
if (cb == null) {
throw new IOException("Unsupported compression method " + method);
}
@@ -103,7 +103,7 @@ class Coders {
@Override
InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
final Coder coder, final byte[] password) throws IOException {
- byte propsByte = coder.properties[0];
+ final byte propsByte = coder.properties[0];
long dictSize = coder.properties[1];
for (int i = 1; i < 4; i++) {
dictSize |= (coder.properties[i + 1] & 0xffl) << (8 * i);
@@ -126,7 +126,7 @@ class Coders {
final Coder coder, final byte[] password) throws IOException {
try {
return opts.getInputStream(in);
- } catch (AssertionError e) {
+ } catch (final AssertionError e) {
throw new IOException("BCJ filter used in " + archiveName
+ " needs XZ for Java > 1.4 - see "
+ "http://commons.apache.org/proper/commons-compress/limitations.html#7Z",
@@ -184,7 +184,7 @@ class Coders {
}
@Override
OutputStream encode(final OutputStream out, final Object options) {
- int level = numberOptionOrDefault(options, 9);
+ final int level = numberOptionOrDefault(options, 9);
final Deflater deflater = new Deflater(level, true);
final DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(out, deflater);
return new OutputStream() {
@@ -229,7 +229,7 @@ class Coders {
@Override
OutputStream encode(final OutputStream out, final Object options)
throws IOException {
- int blockSize = numberOptionOrDefault(options, BZip2CompressorOutputStream.MAX_BLOCKSIZE);
+ final int blockSize = numberOptionOrDefault(options, BZip2CompressorOutputStream.MAX_BLOCKSIZE);
return new BZip2CompressorOutputStream(out, blockSize);
}
}
@@ -259,7 +259,7 @@ class Coders {
@Override
public int read(final byte[] b, final int off, final int len) throws IOException {
- int result = super.read(b, off, len);
+ final int result = super.read(b, off, len);
if (result == -1 && addDummyByte) {
addDummyByte = false;
b[off] = 0;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/DeltaDecoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/DeltaDecoder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/DeltaDecoder.java
index 755b3e4..e109b02 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/DeltaDecoder.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/DeltaDecoder.java
@@ -37,10 +37,10 @@ class DeltaDecoder extends CoderBase {
@Override
OutputStream encode(final OutputStream out, final Object options) throws IOException {
- int distance = numberOptionOrDefault(options, 1);
+ final int distance = numberOptionOrDefault(options, 1);
try {
return new DeltaOptions(distance).getOutputStream(new FinishableWrapperOutputStream(out));
- } catch (UnsupportedOptionsException ex) {
+ } catch (final UnsupportedOptionsException ex) {
throw new IOException(ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java
index 3101293..5cffd0d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java
@@ -52,11 +52,11 @@ class Folder {
* from the output of the first and so on.</p>
*/
Iterable<Coder> getOrderedCoders() {
- LinkedList<Coder> l = new LinkedList<Coder>();
+ final LinkedList<Coder> l = new LinkedList<Coder>();
int current = (int) packedStreams[0]; // more that 2^31 coders?
while (current != -1) {
l.addLast(coders[current]);
- int pair = findBindPairForOutStream(current);
+ final int pair = findBindPairForOutStream(current);
current = pair != -1 ? (int) bindPairs[pair].inIndex : -1;
}
return l;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java
index 72dade4..0f13ca9 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java
@@ -35,9 +35,9 @@ class LZMA2Decoder extends CoderBase {
InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
final Coder coder, final byte[] password) throws IOException {
try {
- int dictionarySize = getDictionarySize(coder);
+ final int dictionarySize = getDictionarySize(coder);
return new LZMA2InputStream(in, dictionarySize);
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
throw new IOException(ex.getMessage());
}
}
@@ -45,16 +45,16 @@ class LZMA2Decoder extends CoderBase {
@Override
OutputStream encode(final OutputStream out, final Object opts)
throws IOException {
- LZMA2Options options = getOptions(opts);
- FinishableOutputStream wrapped = new FinishableWrapperOutputStream(out);
+ final LZMA2Options options = getOptions(opts);
+ final FinishableOutputStream wrapped = new FinishableWrapperOutputStream(out);
return options.getOutputStream(wrapped);
}
@Override
byte[] getOptionsAsProperties(final Object opts) {
- int dictSize = getDictSize(opts);
- int lead = Integer.numberOfLeadingZeros(dictSize);
- int secondBit = (dictSize >>> (30 - lead)) - 2;
+ final int dictSize = getDictSize(opts);
+ final int lead = Integer.numberOfLeadingZeros(dictSize);
+ final int secondBit = (dictSize >>> (30 - lead)) - 2;
return new byte[] {
(byte) ((19 - lead) * 2 + secondBit)
};
@@ -90,7 +90,7 @@ class LZMA2Decoder extends CoderBase {
if (opts instanceof LZMA2Options) {
return (LZMA2Options) opts;
}
- LZMA2Options options = new LZMA2Options();
+ final LZMA2Options options = new LZMA2Options();
options.setDictSize(numberOptionOrDefault(opts));
return options;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
index 5764ec7..098e306 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
@@ -455,8 +455,8 @@ public class SevenZArchiveEntry implements ArchiveEntry {
*/
public void setContentMethods(final Iterable<? extends SevenZMethodConfiguration> methods) {
if (methods != null) {
- LinkedList<SevenZMethodConfiguration> l = new LinkedList<SevenZMethodConfiguration>();
- for (SevenZMethodConfiguration m : methods) {
+ final LinkedList<SevenZMethodConfiguration> l = new LinkedList<SevenZMethodConfiguration>();
+ for (final SevenZMethodConfiguration m : methods) {
l.addLast(m);
}
contentMethods = Collections.unmodifiableList(l);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index 91017bc..a6aabe6 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -510,7 +510,7 @@ public class SevenZFile implements Closeable {
long totalOutStreams = 0;
for (int i = 0; i < coders.length; i++) {
coders[i] = new Coder();
- int bits = header.readUnsignedByte();
+ final int bits = header.readUnsignedByte();
final int idSize = bits & 0xf;
final boolean isSimple = (bits & 0x10) == 0;
final boolean hasAttributes = (bits & 0x20) != 0;
@@ -623,7 +623,7 @@ public class SevenZFile implements Closeable {
if (propertyType == 0) {
break;
}
- long size = readUint64(header);
+ final long size = readUint64(header);
switch (propertyType) {
case NID.kEmptyStream: {
isEmptyStream = readBits(header, files.length);
@@ -868,12 +868,12 @@ public class SevenZFile implements Closeable {
new BufferedInputStream(
new BoundedRandomAccessFileInputStream(file,
archive.packSizes[firstPackStreamIndex]));
- LinkedList<SevenZMethodConfiguration> methods = new LinkedList<SevenZMethodConfiguration>();
+ final LinkedList<SevenZMethodConfiguration> methods = new LinkedList<SevenZMethodConfiguration>();
for (final Coder coder : folder.getOrderedCoders()) {
if (coder.numInStreams != 1 || coder.numOutStreams != 1) {
throw new IOException("Multi input/output stream coders are not yet supported");
}
- SevenZMethod method = SevenZMethod.byId(coder.decompressionMethodId);
+ final SevenZMethod method = SevenZMethod.byId(coder.decompressionMethodId);
inputStreamStack = Coders.addDecoder(fileName, inputStreamStack,
folder.getUnpackSizeForCoder(coder), coder, password);
methods.addFirst(new SevenZMethodConfiguration(method,
@@ -907,7 +907,7 @@ public class SevenZFile implements Closeable {
// In solid compression mode we need to decompress all leading folder'
// streams to get access to an entry. We defer this until really needed
// so that entire blocks can be skipped without wasting time for decompression.
- InputStream stream = deferredBlockStreams.remove(0);
+ final InputStream stream = deferredBlockStreams.remove(0);
IOUtils.skip(stream, Long.MAX_VALUE);
stream.close();
}
@@ -943,14 +943,14 @@ public class SevenZFile implements Closeable {
private static long readUint64(final DataInput in) throws IOException {
// long rather than int as it might get shifted beyond the range of an int
- long firstByte = in.readUnsignedByte();
+ final long firstByte = in.readUnsignedByte();
int mask = 0x80;
long value = 0;
for (int i = 0; i < 8; i++) {
if ((firstByte & mask) == 0) {
return value | ((firstByte & (mask - 1)) << (8 * i));
}
- long nextByte = in.readUnsignedByte();
+ final long nextByte = in.readUnsignedByte();
value |= nextByte << (8 * i);
mask >>>= 1;
}
@@ -986,7 +986,7 @@ public class SevenZFile implements Closeable {
}
long skipped = 0;
while (bytesToSkip > Integer.MAX_VALUE) {
- long skippedNow = skipBytesFully(input, Integer.MAX_VALUE);
+ final long skippedNow = skipBytesFully(input, Integer.MAX_VALUE);
if (skippedNow == 0) {
return skipped;
}
@@ -994,7 +994,7 @@ public class SevenZFile implements Closeable {
bytesToSkip -= skippedNow;
}
while (bytesToSkip > 0) {
- int skippedNow = input.skipBytes((int) bytesToSkip);
+ final int skippedNow = input.skipBytes((int) bytesToSkip);
if (skippedNow == 0) {
return skipped;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethod.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethod.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethod.java
index 4092cee..25a2e24 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethod.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethod.java
@@ -92,13 +92,13 @@ public enum SevenZMethod {
}
byte[] getId() {
- byte[] copy = new byte[id.length];
+ final byte[] copy = new byte[id.length];
System.arraycopy(id, 0, copy, 0, id.length);
return copy;
}
static SevenZMethod byId(final byte[] id) {
- for (SevenZMethod m : SevenZMethod.class.getEnumConstants()) {
+ for (final SevenZMethod m : SevenZMethod.class.getEnumConstants()) {
if (Arrays.equals(m.id, id)) {
return m;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
index 9b23326..bbd5549 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
@@ -166,7 +166,7 @@ public class SevenZOutputFile implements Closeable {
entry.setCompressedCrcValue(compressedCrc32.getValue());
entry.setHasCrc(true);
if (additionalCountingStreams != null) {
- long[] sizes = new long[additionalCountingStreams.length];
+ final long[] sizes = new long[additionalCountingStreams.length];
for (int i = 0; i < additionalCountingStreams.length; i++) {
sizes[i] = additionalCountingStreams[i].getBytesWritten();
}
@@ -280,11 +280,11 @@ public class SevenZOutputFile implements Closeable {
}
OutputStream out = new OutputStreamWrapper();
- ArrayList<CountingOutputStream> moreStreams = new ArrayList<CountingOutputStream>();
+ final ArrayList<CountingOutputStream> moreStreams = new ArrayList<CountingOutputStream>();
boolean first = true;
- for (SevenZMethodConfiguration m : getContentMethods(files.get(files.size() - 1))) {
+ for (final SevenZMethodConfiguration m : getContentMethods(files.get(files.size() - 1))) {
if (!first) {
- CountingOutputStream cos = new CountingOutputStream(out);
+ final CountingOutputStream cos = new CountingOutputStream(out);
moreStreams.add(cos);
out = cos;
}
@@ -317,7 +317,7 @@ public class SevenZOutputFile implements Closeable {
}
private Iterable<? extends SevenZMethodConfiguration> getContentMethods(final SevenZArchiveEntry entry) {
- Iterable<? extends SevenZMethodConfiguration> ms = entry.getContentMethods();
+ final Iterable<? extends SevenZMethodConfiguration> ms = entry.getContentMethods();
return ms == null ? contentMethods : ms;
}
@@ -371,7 +371,7 @@ public class SevenZOutputFile implements Closeable {
header.write(NID.kFolder);
writeUint64(header, numNonEmptyStreams);
header.write(0);
- for (SevenZArchiveEntry entry : files) {
+ for (final SevenZArchiveEntry entry : files) {
if (entry.hasStream()) {
writeFolder(header, entry);
}
@@ -380,9 +380,9 @@ public class SevenZOutputFile implements Closeable {
header.write(NID.kCodersUnpackSize);
for (final SevenZArchiveEntry entry : files) {
if (entry.hasStream()) {
- long[] moreSizes = additionalSizes.get(entry);
+ final long[] moreSizes = additionalSizes.get(entry);
if (moreSizes != null) {
- for (long s : moreSizes) {
+ for (final long s : moreSizes) {
writeUint64(header, s);
}
}
@@ -402,9 +402,9 @@ public class SevenZOutputFile implements Closeable {
}
private void writeFolder(final DataOutput header, final SevenZArchiveEntry entry) throws IOException {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
int numCoders = 0;
- for (SevenZMethodConfiguration m : getContentMethods(entry)) {
+ for (final SevenZMethodConfiguration m : getContentMethods(entry)) {
numCoders++;
writeSingleCodec(m, bos);
}
@@ -418,8 +418,8 @@ public class SevenZOutputFile implements Closeable {
}
private void writeSingleCodec(final SevenZMethodConfiguration m, final OutputStream bos) throws IOException {
- byte[] id = m.getMethod().getId();
- byte[] properties = Coders.findByMethod(m.getMethod())
+ final byte[] id = m.getMethod().getId();
+ final byte[] properties = Coders.findByMethod(m.getMethod())
.getOptionsAsProperties(m.getOptions());
int codecFlags = id.length;
@@ -493,9 +493,9 @@ public class SevenZOutputFile implements Closeable {
boolean hasEmptyFiles = false;
int emptyStreamCounter = 0;
final BitSet emptyFiles = new BitSet(0);
- for (SevenZArchiveEntry file1 : files) {
+ for (final SevenZArchiveEntry file1 : files) {
if (!file1.hasStream()) {
- boolean isDir = file1.isDirectory();
+ final boolean isDir = file1.isDirectory();
emptyFiles.set(emptyStreamCounter++, !isDir);
hasEmptyFiles |= !isDir;
}
@@ -516,9 +516,9 @@ public class SevenZOutputFile implements Closeable {
boolean hasAntiItems = false;
final BitSet antiItems = new BitSet(0);
int antiItemCounter = 0;
- for (SevenZArchiveEntry file1 : files) {
+ for (final SevenZArchiveEntry file1 : files) {
if (!file1.hasStream()) {
- boolean isAnti = file1.isAntiItem();
+ final boolean isAnti = file1.isAntiItem();
antiItems.set(antiItemCounter++, isAnti);
hasAntiItems |= isAnti;
}
@@ -730,8 +730,8 @@ public class SevenZOutputFile implements Closeable {
}
private static <T> Iterable<T> reverse(final Iterable<T> i) {
- LinkedList<T> l = new LinkedList<T>();
- for (T t : i) {
+ final LinkedList<T> l = new LinkedList<T>();
+ for (final T t : i) {
l.addFirst(t);
}
return l;
[32/46] commons-compress git commit: Add final modifier to method
parameters.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java b/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
index ce52c6f..3faea06 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
@@ -77,7 +77,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
*/
private byte[] centralData;
- protected PKWareExtraHeader(ZipShort headerId) {
+ protected PKWareExtraHeader(final ZipShort headerId) {
this.headerId = headerId;
}
@@ -98,7 +98,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
* @param data
* the field data to use
*/
- public void setLocalFileDataData(byte[] data) {
+ public void setLocalFileDataData(final byte[] data) {
localData = ZipUtil.copy(data);
}
@@ -128,7 +128,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
* @param data
* the data to use
*/
- public void setCentralDirectoryData(byte[] data) {
+ public void setCentralDirectoryData(final byte[] data) {
centralData = ZipUtil.copy(data);
}
@@ -169,7 +169,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
* @see ZipExtraField#parseFromLocalFileData(byte[], int, int)
*/
@Override
- public void parseFromLocalFileData(byte[] data, int offset, int length) {
+ public void parseFromLocalFileData(final byte[] data, final int offset, final int length) {
byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
setLocalFileDataData(tmp);
@@ -185,7 +185,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
* @see ZipExtraField#parseFromCentralDirectoryData(byte[], int, int)
*/
@Override
- public void parseFromCentralDirectoryData(byte[] data, int offset, int length) {
+ public void parseFromCentralDirectoryData(final byte[] data, final int offset, final int length) {
byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
setCentralDirectoryData(tmp);
@@ -226,7 +226,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
/**
* private constructor for enum style class.
*/
- EncryptionAlgorithm(int code) {
+ EncryptionAlgorithm(final int code) {
this.code = code;
}
@@ -246,7 +246,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
* @return the EncryptionAlgorithm for the given code or null
* if the method is not known
*/
- public static EncryptionAlgorithm getAlgorithmByCode(int code) {
+ public static EncryptionAlgorithm getAlgorithmByCode(final int code) {
return codeToEnum.get(Integer.valueOf(code));
}
}
@@ -281,7 +281,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
/**
* private constructor for enum style class.
*/
- HashAlgorithm(int code) {
+ HashAlgorithm(final int code) {
this.code = code;
}
@@ -301,7 +301,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
* @return the HashAlgorithm for the given code or null
* if the method is not known
*/
- public static HashAlgorithm getAlgorithmByCode(int code) {
+ public static HashAlgorithm getAlgorithmByCode(final int code) {
return codeToEnum.get(Integer.valueOf(code));
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java b/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
index 26d9807..49e1906 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
@@ -71,7 +71,7 @@ public class ParallelScatterZipCreator {
}
}
- private ScatterZipOutputStream createDeferred(ScatterGatherBackingStoreSupplier scatterGatherBackingStoreSupplier)
+ private ScatterZipOutputStream createDeferred(final ScatterGatherBackingStoreSupplier scatterGatherBackingStoreSupplier)
throws IOException {
ScatterGatherBackingStore bs = scatterGatherBackingStoreSupplier.get();
StreamCompressor sc = StreamCompressor.create(Deflater.DEFAULT_COMPRESSION, bs);
@@ -105,7 +105,7 @@ public class ParallelScatterZipCreator {
* @param executorService The executorService to use for parallel scheduling. For technical reasons,
* this will be shut down by this class.
*/
- public ParallelScatterZipCreator(ExecutorService executorService) {
+ public ParallelScatterZipCreator(final ExecutorService executorService) {
this(executorService, new DefaultBackingStoreSupplier());
}
@@ -116,8 +116,8 @@ public class ParallelScatterZipCreator {
* by this class.
* @param backingStoreSupplier The supplier of backing store which shall be used
*/
- public ParallelScatterZipCreator(ExecutorService executorService,
- ScatterGatherBackingStoreSupplier backingStoreSupplier) {
+ public ParallelScatterZipCreator(final ExecutorService executorService,
+ final ScatterGatherBackingStoreSupplier backingStoreSupplier) {
this.backingStoreSupplier = backingStoreSupplier;
es = executorService;
}
@@ -143,7 +143,7 @@ public class ParallelScatterZipCreator {
*
* @param callable The callable to run, created by {@link #createCallable createCallable}, possibly wrapped by caller.
*/
- public final void submit(Callable<Object> callable) {
+ public final void submit(final Callable<Object> callable) {
futures.add(es.submit(callable));
}
@@ -165,7 +165,7 @@ public class ParallelScatterZipCreator {
* will be propagated through the callable.
*/
- public final Callable<Object> createCallable(ZipArchiveEntry zipArchiveEntry, InputStreamSupplier source) {
+ public final Callable<Object> createCallable(final ZipArchiveEntry zipArchiveEntry, final InputStreamSupplier source) {
final int method = zipArchiveEntry.getMethod();
if (method == ZipMethod.UNKNOWN_CODE) {
throw new IllegalArgumentException("Method must be set on zipArchiveEntry: " + zipArchiveEntry);
@@ -193,7 +193,7 @@ public class ParallelScatterZipCreator {
* @throws InterruptedException If we get interrupted
* @throws ExecutionException If something happens in the parallel execution
*/
- public void writeTo(ZipArchiveOutputStream targetStream)
+ public void writeTo(final ZipArchiveOutputStream targetStream)
throws IOException, InterruptedException, ExecutionException {
// Make sure we catch any exceptions from parallel phase
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ScatterStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterStatistics.java b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterStatistics.java
index 3839af1..83c5bb5 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterStatistics.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterStatistics.java
@@ -27,7 +27,7 @@ public class ScatterStatistics {
private final long compressionElapsed;
private final long mergingElapsed;
- ScatterStatistics(long compressionElapsed, long mergingElapsed) {
+ ScatterStatistics(final long compressionElapsed, final long mergingElapsed) {
this.compressionElapsed = compressionElapsed;
this.mergingElapsed = mergingElapsed;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
index 0edaa3f..ed7195f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
@@ -56,7 +56,7 @@ public class ScatterZipOutputStream implements Closeable {
final long compressedSize;
final long size;
- public CompressedEntry(ZipArchiveEntryRequest zipArchiveEntryRequest, long crc, long compressedSize, long size) {
+ public CompressedEntry(final ZipArchiveEntryRequest zipArchiveEntryRequest, final long crc, final long compressedSize, final long size) {
this.zipArchiveEntryRequest = zipArchiveEntryRequest;
this.crc = crc;
this.compressedSize = compressedSize;
@@ -79,8 +79,8 @@ public class ScatterZipOutputStream implements Closeable {
}
}
- public ScatterZipOutputStream(ScatterGatherBackingStore backingStore,
- StreamCompressor streamCompressor) {
+ public ScatterZipOutputStream(final ScatterGatherBackingStore backingStore,
+ final StreamCompressor streamCompressor) {
this.backingStore = backingStore;
this.streamCompressor = streamCompressor;
}
@@ -91,7 +91,7 @@ public class ScatterZipOutputStream implements Closeable {
* @param zipArchiveEntryRequest The entry to write.
* @throws IOException If writing fails
*/
- public void addArchiveEntry(ZipArchiveEntryRequest zipArchiveEntryRequest) throws IOException {
+ public void addArchiveEntry(final ZipArchiveEntryRequest zipArchiveEntryRequest) throws IOException {
final InputStream payloadStream = zipArchiveEntryRequest.getPayloadStream();
try {
streamCompressor.deflate(payloadStream, zipArchiveEntryRequest.getMethod());
@@ -108,7 +108,7 @@ public class ScatterZipOutputStream implements Closeable {
* @param target The archive to receive the contents of this {@link ScatterZipOutputStream}.
* @throws IOException If writing fails
*/
- public void writeTo(ZipArchiveOutputStream target) throws IOException {
+ public void writeTo(final ZipArchiveOutputStream target) throws IOException {
backingStore.closeForWriting();
InputStream data = backingStore.getInputStream();
for (CompressedEntry compressedEntry : items) {
@@ -136,7 +136,7 @@ public class ScatterZipOutputStream implements Closeable {
* @return A ScatterZipOutputStream that is ready for use.
* @throws FileNotFoundException if the file cannot be found
*/
- public static ScatterZipOutputStream fileBased(File file) throws FileNotFoundException {
+ public static ScatterZipOutputStream fileBased(final File file) throws FileNotFoundException {
return fileBased(file, Deflater.DEFAULT_COMPRESSION);
}
@@ -148,7 +148,7 @@ public class ScatterZipOutputStream implements Closeable {
* @return A ScatterZipOutputStream that is ready for use.
* @throws FileNotFoundException if the file cannot be found
*/
- public static ScatterZipOutputStream fileBased(File file, int compressionLevel) throws FileNotFoundException {
+ public static ScatterZipOutputStream fileBased(final File file, final int compressionLevel) throws FileNotFoundException {
ScatterGatherBackingStore bs = new FileBasedScatterGatherBackingStore(file);
StreamCompressor sc = StreamCompressor.create(compressionLevel, bs);
return new ScatterZipOutputStream(bs, sc);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java b/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
index f6f7b35..56c4007 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
@@ -54,13 +54,13 @@ class Simple8BitZipEncoding implements ZipEncoding {
public final char unicode;
public final byte code;
- Simple8BitChar(byte code, char unicode) {
+ Simple8BitChar(final byte code, final char unicode) {
this.code = code;
this.unicode = unicode;
}
@Override
- public int compareTo(Simple8BitChar a) {
+ public int compareTo(final Simple8BitChar a) {
return this.unicode - a.unicode;
}
@@ -71,7 +71,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o instanceof Simple8BitChar) {
Simple8BitChar other = (Simple8BitChar) o;
return unicode == other.unicode && code == other.code;
@@ -102,7 +102,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* @param highChars The characters for byte values of 128 to 255
* stored as an array of 128 chars.
*/
- public Simple8BitZipEncoding(char[] highChars) {
+ public Simple8BitZipEncoding(final char[] highChars) {
this.highChars = highChars.clone();
List<Simple8BitChar> temp =
new ArrayList<Simple8BitChar>(this.highChars.length);
@@ -123,7 +123,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* @param b The byte to decode.
* @return The associated character value.
*/
- public char decodeByte(byte b) {
+ public char decodeByte(final byte b) {
// code 0-127
if (b >= 0) {
return (char) b;
@@ -137,7 +137,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* @param c The character to encode.
* @return Whether the given unicode character is covered by this encoding.
*/
- public boolean canEncodeChar(char c) {
+ public boolean canEncodeChar(final char c) {
if (c >= 0 && c < 128) {
return true;
@@ -156,7 +156,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* If {@code false} is returned, nothing is pushed to the
* byte buffer.
*/
- public boolean pushEncodedChar(ByteBuffer bb, char c) {
+ public boolean pushEncodedChar(final ByteBuffer bb, final char c) {
if (c >= 0 && c < 128) {
bb.put((byte) c);
@@ -177,7 +177,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* A {@code null} value is returned, if this character is not
* covered by this encoding.
*/
- private Simple8BitChar encodeHighChar(char c) {
+ private Simple8BitChar encodeHighChar(final char c) {
// for performance an simplicity, yet another reincarnation of
// binary search...
int i0 = 0;
@@ -218,7 +218,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* org.apache.commons.compress.archivers.zip.ZipEncoding#canEncode(java.lang.String)
*/
@Override
- public boolean canEncode(String name) {
+ public boolean canEncode(final String name) {
for (int i=0;i<name.length();++i) {
@@ -237,7 +237,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* org.apache.commons.compress.archivers.zip.ZipEncoding#encode(java.lang.String)
*/
@Override
- public ByteBuffer encode(String name) {
+ public ByteBuffer encode(final String name) {
ByteBuffer out = ByteBuffer.allocate(name.length()
+ 6 + (name.length() + 1) / 2);
@@ -265,7 +265,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
* org.apache.commons.compress.archivers.zip.ZipEncoding#decode(byte[])
*/
@Override
- public String decode(byte[] data) throws IOException {
+ public String decode(final byte[] data) throws IOException {
char [] ret = new char[data.length];
for (int i=0;i<data.length;++i) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
index d4925c1..aef35d9 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
@@ -58,7 +58,7 @@ public abstract class StreamCompressor implements Closeable {
private final byte[] outputBuffer = new byte[bufferSize];
private final byte[] readerBuf = new byte[bufferSize];
- StreamCompressor(Deflater deflater) {
+ StreamCompressor(final Deflater deflater) {
this.def = deflater;
}
@@ -69,7 +69,7 @@ public abstract class StreamCompressor implements Closeable {
* @param deflater The deflater to use
* @return A stream compressor
*/
- static StreamCompressor create(OutputStream os, Deflater deflater) {
+ static StreamCompressor create(final OutputStream os, final Deflater deflater) {
return new OutputStreamCompressor(deflater, os);
}
@@ -79,7 +79,7 @@ public abstract class StreamCompressor implements Closeable {
* @param os The stream to receive output
* @return A stream compressor
*/
- static StreamCompressor create(OutputStream os) {
+ static StreamCompressor create(final OutputStream os) {
return create(os, new Deflater(Deflater.DEFAULT_COMPRESSION, true));
}
@@ -90,7 +90,7 @@ public abstract class StreamCompressor implements Closeable {
* @param deflater The deflater to use for the compressor
* @return A stream compressor
*/
- static StreamCompressor create(DataOutput os, Deflater deflater) {
+ static StreamCompressor create(final DataOutput os, final Deflater deflater) {
return new DataOutputCompressor(deflater, os);
}
@@ -101,7 +101,7 @@ public abstract class StreamCompressor implements Closeable {
* @param bs The ScatterGatherBackingStore to receive output
* @return A stream compressor
*/
- public static StreamCompressor create(int compressionLevel, ScatterGatherBackingStore bs) {
+ public static StreamCompressor create(final int compressionLevel, final ScatterGatherBackingStore bs) {
final Deflater deflater = new Deflater(compressionLevel, true);
return new ScatterGatherBackingStoreCompressor(deflater, bs);
}
@@ -112,7 +112,7 @@ public abstract class StreamCompressor implements Closeable {
* @param bs The ScatterGatherBackingStore to receive output
* @return A stream compressor
*/
- public static StreamCompressor create(ScatterGatherBackingStore bs) {
+ public static StreamCompressor create(final ScatterGatherBackingStore bs) {
return create(Deflater.DEFAULT_COMPRESSION, bs);
}
@@ -162,7 +162,7 @@ public abstract class StreamCompressor implements Closeable {
* @throws IOException When failures happen
*/
- public void deflate(InputStream source, int method) throws IOException {
+ public void deflate(final InputStream source, final int method) throws IOException {
reset();
int length;
@@ -184,7 +184,7 @@ public abstract class StreamCompressor implements Closeable {
* @return the number of bytes written to the stream this time
* @throws IOException on error
*/
- long write(byte[] b, int offset, int length, int method) throws IOException {
+ long write(final byte[] b, final int offset, final int length, final int method) throws IOException {
long current = writtenToOutputStreamForLastEntry;
crc.update(b, offset, length);
if (method == ZipEntry.DEFLATED) {
@@ -216,7 +216,7 @@ public abstract class StreamCompressor implements Closeable {
}
}
- private void writeDeflated(byte[] b, int offset, int length)
+ private void writeDeflated(final byte[] b, final int offset, final int length)
throws IOException {
if (length > 0 && !def.finished()) {
if (length <= DEFLATER_BLOCK_SIZE) {
@@ -251,11 +251,11 @@ public abstract class StreamCompressor implements Closeable {
}
}
- public void writeCounted(byte[] data) throws IOException {
+ public void writeCounted(final byte[] data) throws IOException {
writeCounted(data, 0, data.length);
}
- public void writeCounted(byte[] data, int offset, int length) throws IOException {
+ public void writeCounted(final byte[] data, final int offset, final int length) throws IOException {
writeOut(data, offset, length);
writtenToOutputStreamForLastEntry += length;
totalWrittenToOutputStream += length;
@@ -266,13 +266,13 @@ public abstract class StreamCompressor implements Closeable {
private static final class ScatterGatherBackingStoreCompressor extends StreamCompressor {
private final ScatterGatherBackingStore bs;
- public ScatterGatherBackingStoreCompressor(Deflater deflater, ScatterGatherBackingStore bs) {
+ public ScatterGatherBackingStoreCompressor(final Deflater deflater, final ScatterGatherBackingStore bs) {
super(deflater);
this.bs = bs;
}
@Override
- protected final void writeOut(byte[] data, int offset, int length)
+ protected final void writeOut(final byte[] data, final int offset, final int length)
throws IOException {
bs.writeOut(data, offset, length);
}
@@ -281,13 +281,13 @@ public abstract class StreamCompressor implements Closeable {
private static final class OutputStreamCompressor extends StreamCompressor {
private final OutputStream os;
- public OutputStreamCompressor(Deflater deflater, OutputStream os) {
+ public OutputStreamCompressor(final Deflater deflater, final OutputStream os) {
super(deflater);
this.os = os;
}
@Override
- protected final void writeOut(byte[] data, int offset, int length)
+ protected final void writeOut(final byte[] data, final int offset, final int length)
throws IOException {
os.write(data, offset, length);
}
@@ -296,13 +296,13 @@ public abstract class StreamCompressor implements Closeable {
private static final class DataOutputCompressor extends StreamCompressor {
private final DataOutput raf;
- public DataOutputCompressor(Deflater deflater, DataOutput raf) {
+ public DataOutputCompressor(final Deflater deflater, final DataOutput raf) {
super(deflater);
this.raf = raf;
}
@Override
- protected final void writeOut(byte[] data, int offset, int length)
+ protected final void writeOut(final byte[] data, final int offset, final int length)
throws IOException {
raf.write(data, offset, length);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java
index 1289583..b961114 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java
@@ -46,8 +46,8 @@ public class UnicodeCommentExtraField extends AbstractUnicodeExtraField {
* @param len The length of the encoded comment or comment in
* <code>bytes</code>.
*/
- public UnicodeCommentExtraField(String text, byte[] bytes, int off,
- int len) {
+ public UnicodeCommentExtraField(final String text, final byte[] bytes, final int off,
+ final int len) {
super(text, bytes, off, len);
}
@@ -58,7 +58,7 @@ public class UnicodeCommentExtraField extends AbstractUnicodeExtraField {
* @param comment The file comment
* @param bytes the bytes actually written to the archive
*/
- public UnicodeCommentExtraField(String comment, byte[] bytes) {
+ public UnicodeCommentExtraField(final String comment, final byte[] bytes) {
super(comment, bytes);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java
index 35935f3..f1cf6c1 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java
@@ -46,7 +46,7 @@ public class UnicodePathExtraField extends AbstractUnicodeExtraField {
* @param len The length of the encoded filename or comment in
* <code>bytes</code>.
*/
- public UnicodePathExtraField(String text, byte[] bytes, int off, int len) {
+ public UnicodePathExtraField(final String text, final byte[] bytes, final int off, final int len) {
super(text, bytes, off, len);
}
@@ -57,7 +57,7 @@ public class UnicodePathExtraField extends AbstractUnicodeExtraField {
* @param name The file name
* @param bytes the bytes actually written to the archive
*/
- public UnicodePathExtraField(String name, byte[] bytes) {
+ public UnicodePathExtraField(final String name, final byte[] bytes) {
super(name, bytes);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java
index b4a92bb..55deea7 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java
@@ -95,7 +95,7 @@ public final class UnparseableExtraFieldData implements ZipExtraField {
* @param length the length of data
*/
@Override
- public void parseFromLocalFileData(byte[] buffer, int offset, int length) {
+ public void parseFromLocalFileData(final byte[] buffer, final int offset, final int length) {
localFileData = new byte[length];
System.arraycopy(buffer, offset, localFileData, 0, length);
}
@@ -108,8 +108,8 @@ public final class UnparseableExtraFieldData implements ZipExtraField {
* @param length the length of data
*/
@Override
- public void parseFromCentralDirectoryData(byte[] buffer, int offset,
- int length) {
+ public void parseFromCentralDirectoryData(final byte[] buffer, final int offset,
+ final int length) {
centralDirectoryData = new byte[length];
System.arraycopy(buffer, offset, centralDirectoryData, 0, length);
if (localFileData == null) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
index a4a532d..aec800d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
@@ -37,7 +37,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* Set the header id.
* @param headerId the header id to use
*/
- public void setHeaderId(ZipShort headerId) {
+ public void setHeaderId(final ZipShort headerId) {
this.headerId = headerId;
}
@@ -61,7 +61,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* without Header-ID or length specifier.
* @param data the field data to use
*/
- public void setLocalFileDataData(byte[] data) {
+ public void setLocalFileDataData(final byte[] data) {
localData = ZipUtil.copy(data);
}
@@ -93,7 +93,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* Set the extra field data in central directory.
* @param data the data to use
*/
- public void setCentralDirectoryData(byte[] data) {
+ public void setCentralDirectoryData(final byte[] data) {
centralData = ZipUtil.copy(data);
}
@@ -129,7 +129,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
* @see ZipExtraField#parseFromLocalFileData(byte[], int, int)
*/
@Override
- public void parseFromLocalFileData(byte[] data, int offset, int length) {
+ public void parseFromLocalFileData(final byte[] data, final int offset, final int length) {
byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
setLocalFileDataData(tmp);
@@ -142,8 +142,8 @@ public class UnrecognizedExtraField implements ZipExtraField {
* @see ZipExtraField#parseFromCentralDirectoryData(byte[], int, int)
*/
@Override
- public void parseFromCentralDirectoryData(byte[] data, int offset,
- int length) {
+ public void parseFromCentralDirectoryData(final byte[] data, final int offset,
+ final int length) {
byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
setCentralDirectoryData(tmp);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java
index a09b72e..3e223e8 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java
@@ -34,7 +34,7 @@ class UnshrinkingInputStream extends LZWInputStream {
private static final int MAX_TABLE_SIZE = 1 << MAX_CODE_SIZE;
private final boolean[] isUsed;
- public UnshrinkingInputStream(InputStream inputStream) throws IOException {
+ public UnshrinkingInputStream(final InputStream inputStream) throws IOException {
super(inputStream, ByteOrder.LITTLE_ENDIAN);
setClearCode(DEFAULT_CODE_SIZE);
initializeTables(MAX_CODE_SIZE);
@@ -46,7 +46,7 @@ class UnshrinkingInputStream extends LZWInputStream {
}
@Override
- protected int addEntry(int previousCode, byte character) throws IOException {
+ protected int addEntry(final int previousCode, final byte character) throws IOException {
int tableSize = getTableSize();
while ((tableSize < MAX_TABLE_SIZE) && isUsed[tableSize]) {
tableSize++;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/UnsupportedZipFeatureException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnsupportedZipFeatureException.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnsupportedZipFeatureException.java
index 8316ab4..a808c51 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnsupportedZipFeatureException.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnsupportedZipFeatureException.java
@@ -36,8 +36,8 @@ public class UnsupportedZipFeatureException extends ZipException {
* @param reason the feature that is not supported
* @param entry the entry using the feature
*/
- public UnsupportedZipFeatureException(Feature reason,
- ZipArchiveEntry entry) {
+ public UnsupportedZipFeatureException(final Feature reason,
+ final ZipArchiveEntry entry) {
super("unsupported feature " + reason + " used in entry "
+ entry.getName());
this.reason = reason;
@@ -51,8 +51,8 @@ public class UnsupportedZipFeatureException extends ZipException {
* @param entry the entry using the feature
* @since 1.5
*/
- public UnsupportedZipFeatureException(ZipMethod method,
- ZipArchiveEntry entry) {
+ public UnsupportedZipFeatureException(final ZipMethod method,
+ final ZipArchiveEntry entry) {
super("unsupported feature method '" + method.name()
+ "' used in entry " + entry.getName());
this.reason = Feature.METHOD;
@@ -66,7 +66,7 @@ public class UnsupportedZipFeatureException extends ZipException {
* @param reason the feature that is not supported
* @since 1.5
*/
- public UnsupportedZipFeatureException(Feature reason) {
+ public UnsupportedZipFeatureException(final Feature reason) {
super("unsupported feature " + reason + " used in archive.");
this.reason = reason;
this.entry = null;
@@ -113,7 +113,7 @@ public class UnsupportedZipFeatureException extends ZipException {
private final String name;
- private Feature(String name) {
+ private Feature(final String name) {
this.name = name;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java b/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
index e020720..ee08d0a 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
@@ -154,7 +154,7 @@ public class X000A_NTFS implements ZipExtraField {
*/
@Override
public void parseFromLocalFileData(
- byte[] data, int offset, int length
+ final byte[] data, int offset, final int length
) throws ZipException {
final int len = offset + length;
@@ -179,7 +179,7 @@ public class X000A_NTFS implements ZipExtraField {
*/
@Override
public void parseFromCentralDirectoryData(
- byte[] buffer, int offset, int length
+ final byte[] buffer, final int offset, final int length
) throws ZipException {
reset();
parseFromLocalFileData(buffer, offset, length);
@@ -249,7 +249,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @param t ZipEightByteInteger of the modify time
*/
- public void setModifyTime(ZipEightByteInteger t) {
+ public void setModifyTime(final ZipEightByteInteger t) {
modifyTime = t == null ? ZipEightByteInteger.ZERO : t;
}
@@ -259,7 +259,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @param t ZipEightByteInteger of the access time
*/
- public void setAccessTime(ZipEightByteInteger t) {
+ public void setAccessTime(final ZipEightByteInteger t) {
accessTime = t == null ? ZipEightByteInteger.ZERO : t;
}
@@ -269,7 +269,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @param t ZipEightByteInteger of the create time
*/
- public void setCreateTime(ZipEightByteInteger t) {
+ public void setCreateTime(final ZipEightByteInteger t) {
createTime = t == null ? ZipEightByteInteger.ZERO : t;
}
@@ -278,7 +278,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @param d modify time as java.util.Date
*/
- public void setModifyJavaTime(Date d) { setModifyTime(dateToZip(d)); }
+ public void setModifyJavaTime(final Date d) { setModifyTime(dateToZip(d)); }
/**
* Sets the access time as a java.util.Date
@@ -286,7 +286,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @param d access time as java.util.Date
*/
- public void setAccessJavaTime(Date d) { setAccessTime(dateToZip(d)); }
+ public void setAccessJavaTime(final Date d) { setAccessTime(dateToZip(d)); }
/**
* <p>
@@ -301,7 +301,7 @@ public class X000A_NTFS implements ZipExtraField {
*
* @param d create time as java.util.Date
*/
- public void setCreateJavaTime(Date d) { setCreateTime(dateToZip(d)); }
+ public void setCreateJavaTime(final Date d) { setCreateTime(dateToZip(d)); }
/**
* Returns a String representation of this class useful for
@@ -321,7 +321,7 @@ public class X000A_NTFS implements ZipExtraField {
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o instanceof X000A_NTFS) {
X000A_NTFS xf = (X000A_NTFS) o;
@@ -359,7 +359,7 @@ public class X000A_NTFS implements ZipExtraField {
this.createTime = ZipEightByteInteger.ZERO;
}
- private void readTimeAttr(byte[] data, int offset, int length) {
+ private void readTimeAttr(final byte[] data, int offset, final int length) {
if (length >= 2 + 3 * 8) {
ZipShort tagValueLength = new ZipShort(data, offset);
if (TIME_ATTR_SIZE.equals(tagValueLength)) {
@@ -385,7 +385,7 @@ public class X000A_NTFS implements ZipExtraField {
return new ZipEightByteInteger((d.getTime() * 10000l) - EPOCH_OFFSET);
}
- private static Date zipToDate(ZipEightByteInteger z) {
+ private static Date zipToDate(final ZipEightByteInteger z) {
if (z == null || ZipEightByteInteger.ZERO.equals(z)) { return null; }
long l = (z.getLongValue() + EPOCH_OFFSET) / 10000l;
return new Date(l);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
index 1735bbb..89b327b 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
@@ -67,7 +67,7 @@ public class X0015_CertificateIdForFile extends PKWareExtraHeader {
}
@Override
- public void parseFromCentralDirectoryData(byte[] data, int offset, int length) {
+ public void parseFromCentralDirectoryData(final byte[] data, final int offset, final int length) {
super.parseFromCentralDirectoryData(data, offset, length);
this.rcount = ZipShort.getValue(data, offset);
this.hashAlg = HashAlgorithm.getAlgorithmByCode(ZipShort.getValue(data, offset + 2));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
index 788491d..bab1e61 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
@@ -68,7 +68,7 @@ public class X0016_CertificateIdForCentralDirectory extends PKWareExtraHeader {
}
@Override
- public void parseFromCentralDirectoryData(byte[] data, int offset, int length) {
+ public void parseFromCentralDirectoryData(final byte[] data, final int offset, final int length) {
this.rcount = ZipShort.getValue(data, offset);
this.hashAlg = HashAlgorithm.getAlgorithmByCode(ZipShort.getValue(data, offset + 2));
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
index e45abd8..1a9a46e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
@@ -299,7 +299,7 @@ public class X0017_StrongEncryptionHeader extends PKWareExtraHeader {
* @param offset offset into buffer to read data
* @param length the length of data
*/
- public void parseCentralDirectoryFormat(byte[] data, int offset, int length) {
+ public void parseCentralDirectoryFormat(final byte[] data, final int offset, final int length) {
this.format = ZipShort.getValue(data, offset);
this.algId = EncryptionAlgorithm.getAlgorithmByCode(ZipShort.getValue(data, offset + 2));
this.bitlen = ZipShort.getValue(data, offset + 4);
@@ -327,7 +327,7 @@ public class X0017_StrongEncryptionHeader extends PKWareExtraHeader {
* @param offset offset into buffer to read data
* @param length the length of data
*/
- public void parseFileFormat(byte[] data, int offset, int length) {
+ public void parseFileFormat(final byte[] data, final int offset, final int length) {
int ivSize = ZipShort.getValue(data, offset);
this.ivData = new byte[ivSize];
System.arraycopy(data, offset + 4, this.ivData, 0, ivSize);
@@ -369,13 +369,13 @@ public class X0017_StrongEncryptionHeader extends PKWareExtraHeader {
}
@Override
- public void parseFromLocalFileData(byte[] data, int offset, int length) {
+ public void parseFromLocalFileData(final byte[] data, final int offset, final int length) {
super.parseFromLocalFileData(data, offset, length);
parseFileFormat(data, offset, length);
}
@Override
- public void parseFromCentralDirectoryData(byte[] data, int offset, int length) {
+ public void parseFromCentralDirectoryData(final byte[] data, final int offset, final int length) {
super.parseFromCentralDirectoryData(data, offset, length);
parseCentralDirectoryFormat(data, offset, length);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
index 81bd9ca..612ace6 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
@@ -219,7 +219,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*/
@Override
public void parseFromLocalFileData(
- byte[] data, int offset, int length
+ final byte[] data, int offset, final int length
) throws ZipException {
reset();
final int len = offset + length;
@@ -247,7 +247,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*/
@Override
public void parseFromCentralDirectoryData(
- byte[] buffer, int offset, int length
+ final byte[] buffer, final int offset, final int length
) throws ZipException {
reset();
parseFromLocalFileData(buffer, offset, length);
@@ -278,7 +278,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
* @param flags flags byte indicating which of the
* three datestamp fields are present.
*/
- public void setFlags(byte flags) {
+ public void setFlags(final byte flags) {
this.flags = flags;
this.bit0_modifyTimePresent = (flags & MODIFY_TIME_BIT) == MODIFY_TIME_BIT;
this.bit1_accessTimePresent = (flags & ACCESS_TIME_BIT) == ACCESS_TIME_BIT;
@@ -415,7 +415,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @param l ZipLong of the modify time (seconds per epoch)
*/
- public void setModifyTime(ZipLong l) {
+ public void setModifyTime(final ZipLong l) {
bit0_modifyTimePresent = l != null;
flags = (byte) (l != null ? (flags | MODIFY_TIME_BIT)
: (flags & ~MODIFY_TIME_BIT));
@@ -434,7 +434,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @param l ZipLong of the access time (seconds per epoch)
*/
- public void setAccessTime(ZipLong l) {
+ public void setAccessTime(final ZipLong l) {
bit1_accessTimePresent = l != null;
flags = (byte) (l != null ? (flags | ACCESS_TIME_BIT)
: (flags & ~ACCESS_TIME_BIT));
@@ -453,7 +453,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @param l ZipLong of the create time (seconds per epoch)
*/
- public void setCreateTime(ZipLong l) {
+ public void setCreateTime(final ZipLong l) {
bit2_createTimePresent = l != null;
flags = (byte) (l != null ? (flags | CREATE_TIME_BIT)
: (flags & ~CREATE_TIME_BIT));
@@ -473,7 +473,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @param d modify time as java.util.Date
*/
- public void setModifyJavaTime(Date d) { setModifyTime(dateToZipLong(d)); }
+ public void setModifyJavaTime(final Date d) { setModifyTime(dateToZipLong(d)); }
/**
* <p>
@@ -488,7 +488,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @param d access time as java.util.Date
*/
- public void setAccessJavaTime(Date d) { setAccessTime(dateToZipLong(d)); }
+ public void setAccessJavaTime(final Date d) { setAccessTime(dateToZipLong(d)); }
/**
* <p>
@@ -503,7 +503,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*
* @param d create time as java.util.Date
*/
- public void setCreateJavaTime(Date d) { setCreateTime(dateToZipLong(d)); }
+ public void setCreateJavaTime(final Date d) { setCreateTime(dateToZipLong(d)); }
/**
* Utility method converts java.util.Date (milliseconds since epoch)
@@ -559,7 +559,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o instanceof X5455_ExtendedTimestamp) {
X5455_ExtendedTimestamp xf = (X5455_ExtendedTimestamp) o;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/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 007ca50..4d5397c 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
@@ -111,7 +111,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*
* @param l UID value to set on this extra field.
*/
- public void setUID(long l) {
+ public void setUID(final long l) {
this.uid = ZipUtil.longToBig(l);
}
@@ -120,7 +120,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*
* @param l GID value to set on this extra field.
*/
- public void setGID(long l) {
+ public void setGID(final long l) {
this.gid = ZipUtil.longToBig(l);
}
@@ -209,7 +209,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*/
@Override
public void parseFromLocalFileData(
- byte[] data, int offset, int length
+ final byte[] data, int offset, final int length
) throws ZipException {
reset();
this.version = signedByteToUnsignedInt(data[offset++]);
@@ -231,7 +231,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*/
@Override
public void parseFromCentralDirectoryData(
- byte[] buffer, int offset, int length
+ final byte[] buffer, final int offset, final int length
) throws ZipException {
}
@@ -263,7 +263,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o instanceof X7875_NewUnix) {
X7875_NewUnix xf = (X7875_NewUnix) o;
// We assume uid and gid can never be null.
@@ -292,7 +292,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
* @param array byte[] array to trim & pad.
* @return trimmed & padded byte[] array.
*/
- static byte[] trimLeadingZeroesForceMinLength(byte[] array) {
+ static byte[] trimLeadingZeroesForceMinLength(final byte[] array) {
if (array == null) {
return array;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
index 0c5ec02..9f77e89 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
@@ -78,8 +78,8 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
*
* @throws IllegalArgumentException if size or compressedSize is null
*/
- public Zip64ExtendedInformationExtraField(ZipEightByteInteger size,
- ZipEightByteInteger compressedSize) {
+ public Zip64ExtendedInformationExtraField(final ZipEightByteInteger size,
+ final ZipEightByteInteger compressedSize) {
this(size, compressedSize, null, null);
}
@@ -93,10 +93,10 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
*
* @throws IllegalArgumentException if size or compressedSize is null
*/
- public Zip64ExtendedInformationExtraField(ZipEightByteInteger size,
- ZipEightByteInteger compressedSize,
- ZipEightByteInteger relativeHeaderOffset,
- ZipLong diskStart) {
+ public Zip64ExtendedInformationExtraField(final ZipEightByteInteger size,
+ final ZipEightByteInteger compressedSize,
+ final ZipEightByteInteger relativeHeaderOffset,
+ final ZipLong diskStart) {
this.size = size;
this.compressedSize = compressedSize;
this.relativeHeaderOffset = relativeHeaderOffset;
@@ -150,7 +150,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
}
@Override
- public void parseFromLocalFileData(byte[] buffer, int offset, int length)
+ public void parseFromLocalFileData(final byte[] buffer, int offset, final int length)
throws ZipException {
if (length == 0) {
// no local file data at all, may happen if an archive
@@ -180,8 +180,8 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
}
@Override
- public void parseFromCentralDirectoryData(byte[] buffer, int offset,
- int length)
+ public void parseFromCentralDirectoryData(final byte[] buffer, int offset,
+ final int length)
throws ZipException {
// store for processing in reparseCentralDirectoryData
rawCentralDirectoryData = new byte[length];
@@ -221,10 +221,10 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
* @param hasDiskStart flag to read from central directory
* @throws ZipException on error
*/
- public void reparseCentralDirectoryData(boolean hasUncompressedSize,
- boolean hasCompressedSize,
- boolean hasRelativeHeaderOffset,
- boolean hasDiskStart)
+ public void reparseCentralDirectoryData(final boolean hasUncompressedSize,
+ final boolean hasCompressedSize,
+ final boolean hasRelativeHeaderOffset,
+ final boolean hasDiskStart)
throws ZipException {
if (rawCentralDirectoryData != null) {
int expectedLength = (hasUncompressedSize ? DWORD : 0)
@@ -273,7 +273,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
* The uncompressed size stored in this extra field.
* @param size The uncompressed size stored in this extra field.
*/
- public void setSize(ZipEightByteInteger size) {
+ public void setSize(final ZipEightByteInteger size) {
this.size = size;
}
@@ -289,7 +289,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
* The uncompressed size stored in this extra field.
* @param compressedSize The uncompressed size stored in this extra field.
*/
- public void setCompressedSize(ZipEightByteInteger compressedSize) {
+ public void setCompressedSize(final ZipEightByteInteger compressedSize) {
this.compressedSize = compressedSize;
}
@@ -305,7 +305,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
* The relative header offset stored in this extra field.
* @param rho The relative header offset stored in this extra field.
*/
- public void setRelativeHeaderOffset(ZipEightByteInteger rho) {
+ public void setRelativeHeaderOffset(final ZipEightByteInteger rho) {
relativeHeaderOffset = rho;
}
@@ -321,11 +321,11 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
* The disk start number stored in this extra field.
* @param ds The disk start number stored in this extra field.
*/
- public void setDiskStartNumber(ZipLong ds) {
+ public void setDiskStartNumber(final ZipLong ds) {
diskStart = ds;
}
- private int addSizes(byte[] data) {
+ private int addSizes(final byte[] data) {
int off = 0;
if (size != null) {
System.arraycopy(size.getBytes(), 0, data, 0, DWORD);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/Zip64RequiredException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/Zip64RequiredException.java b/src/main/java/org/apache/commons/compress/archivers/zip/Zip64RequiredException.java
index 677b4e6..1ec7e70 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/Zip64RequiredException.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/Zip64RequiredException.java
@@ -33,7 +33,7 @@ public class Zip64RequiredException extends ZipException {
/**
* Helper to format "entry too big" messages.
*/
- static String getEntryTooBigMessage(ZipArchiveEntry ze) {
+ static String getEntryTooBigMessage(final ZipArchiveEntry ze) {
return ze.getName() + "'s size exceeds the limit of 4GByte.";
}
@@ -43,7 +43,7 @@ public class Zip64RequiredException extends ZipException {
static final String TOO_MANY_ENTRIES_MESSAGE =
"archive contains more than 65535 entries.";
- public Zip64RequiredException(String reason) {
+ public Zip64RequiredException(final String reason) {
super(reason);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
index 504646d..d66d068 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
@@ -98,7 +98,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
*
* @param name the name of the entry
*/
- public ZipArchiveEntry(String name) {
+ public ZipArchiveEntry(final String name) {
super(name);
setName(name);
}
@@ -112,7 +112,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @param entry the entry to get fields from
* @throws ZipException on error
*/
- public ZipArchiveEntry(java.util.zip.ZipEntry entry) throws ZipException {
+ public ZipArchiveEntry(final java.util.zip.ZipEntry entry) throws ZipException {
super(entry);
setName(entry.getName());
byte[] extra = entry.getExtra();
@@ -137,7 +137,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @param entry the entry to get fields from
* @throws ZipException on error
*/
- public ZipArchiveEntry(ZipArchiveEntry entry) throws ZipException {
+ public ZipArchiveEntry(final ZipArchiveEntry entry) throws ZipException {
this((java.util.zip.ZipEntry) entry);
setInternalAttributes(entry.getInternalAttributes());
setExternalAttributes(entry.getExternalAttributes());
@@ -165,7 +165,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @param inputFile file to create the entry from
* @param entryName name of the entry
*/
- public ZipArchiveEntry(File inputFile, String entryName) {
+ public ZipArchiveEntry(final File inputFile, final String entryName) {
this(inputFile.isDirectory() && !entryName.endsWith("/") ?
entryName + "/" : entryName);
if (inputFile.isFile()){
@@ -210,7 +210,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @since 1.1
*/
@Override
- public void setMethod(int method) {
+ public void setMethod(final int method) {
if (method < 0) {
throw new IllegalArgumentException(
"ZIP compression method can not be negative: " + method);
@@ -235,7 +235,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* Sets the internal file attributes.
* @param value an <code>int</code> value
*/
- public void setInternalAttributes(int value) {
+ public void setInternalAttributes(final int value) {
internalAttributes = value;
}
@@ -256,7 +256,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* Sets the external file attributes.
* @param value an <code>long</code> value
*/
- public void setExternalAttributes(long value) {
+ public void setExternalAttributes(final long value) {
externalAttributes = value;
}
@@ -265,7 +265,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* unzip command.
* @param mode an <code>int</code> value
*/
- public void setUnixMode(int mode) {
+ public void setUnixMode(final int mode) {
// CheckStyle:MagicNumberCheck OFF - no point
setExternalAttributes((mode << SHORT_SHIFT)
// MS-DOS read-only attribute
@@ -312,7 +312,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* Set the platform (UNIX or FAT).
* @param platform an <code>int</code> value - 0 is FAT, 3 is UNIX
*/
- protected void setPlatform(int platform) {
+ protected void setPlatform(final int platform) {
this.platform = platform;
}
@@ -320,7 +320,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* Replaces all currently attached extra fields with the new array.
* @param fields an array of extra fields
*/
- public void setExtraFields(ZipExtraField[] fields) {
+ public void setExtraFields(final ZipExtraField[] fields) {
List<ZipExtraField> newFields = new ArrayList<ZipExtraField>();
for (ZipExtraField field : fields) {
if (field instanceof UnparseableExtraFieldData) {
@@ -356,7 +356,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
*
* @since 1.1
*/
- public ZipExtraField[] getExtraFields(boolean includeUnparseable) {
+ public ZipExtraField[] getExtraFields(final boolean includeUnparseable) {
return includeUnparseable ?
getAllExtraFields() :
getParseableExtraFields();
@@ -385,11 +385,11 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
return unparseableExtra != null ? getMergedFields() : extraFields;
}
- private ZipExtraField[] copyOf(ZipExtraField[] src){
+ private ZipExtraField[] copyOf(final ZipExtraField[] src){
return copyOf(src, src.length);
}
- private ZipExtraField[] copyOf(ZipExtraField[] src, int length) {
+ private ZipExtraField[] copyOf(final ZipExtraField[] src, final int length) {
ZipExtraField[] cpy = new ZipExtraField[length];
System.arraycopy(src, 0, cpy, 0, Math.min(src.length, length));
return cpy;
@@ -417,7 +417,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* added as last field.</p>
* @param ze an extra field
*/
- public void addExtraField(ZipExtraField ze) {
+ public void addExtraField(final ZipExtraField ze) {
if (ze instanceof UnparseableExtraFieldData) {
unparseableExtra = (UnparseableExtraFieldData) ze;
} else {
@@ -442,7 +442,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* <p>The new extra field will be the first one.</p>
* @param ze an extra field
*/
- public void addAsFirstExtraField(ZipExtraField ze) {
+ public void addAsFirstExtraField(final ZipExtraField ze) {
if (ze instanceof UnparseableExtraFieldData) {
unparseableExtra = (UnparseableExtraFieldData) ze;
} else {
@@ -464,7 +464,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* Remove an extra field.
* @param type the type of extra field to remove
*/
- public void removeExtraField(ZipShort type) {
+ public void removeExtraField(final ZipShort type) {
if (extraFields == null) {
throw new java.util.NoSuchElementException();
}
@@ -501,7 +501,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @param type the header id
* @return null if no such field exists.
*/
- public ZipExtraField getExtraField(ZipShort type) {
+ public ZipExtraField getExtraField(final ZipShort type) {
if (extraFields != null) {
for (ZipExtraField extraField : extraFields) {
if (type.equals(extraField.getHeaderId())) {
@@ -532,7 +532,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @throws RuntimeException on error
*/
@Override
- public void setExtra(byte[] extra) throws RuntimeException {
+ public void setExtra(final byte[] extra) throws RuntimeException {
try {
ZipExtraField[] local =
ExtraFieldUtils.parse(extra, true,
@@ -559,7 +559,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* Sets the central directory part of extra fields.
* @param b an array of bytes to be parsed into extra fields
*/
- public void setCentralDirectoryExtra(byte[] b) {
+ public void setCentralDirectoryExtra(final byte[] b) {
try {
ZipExtraField[] central =
ExtraFieldUtils.parse(b, false,
@@ -638,7 +638,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* than 0
*/
@Override
- public void setSize(long size) {
+ public void setSize(final long size) {
if (size < 0) {
throw new IllegalArgumentException("invalid entry size");
}
@@ -654,7 +654,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* archive
* @since 1.2
*/
- protected void setName(String name, byte[] rawName) {
+ protected void setName(final String name, final byte[] rawName) {
setName(name);
this.rawName = rawName;
}
@@ -706,7 +706,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @param b the general purpose bit
* @since 1.1
*/
- public void setGeneralPurposeBit(GeneralPurposeBit b) {
+ public void setGeneralPurposeBit(final GeneralPurposeBit b) {
gpb = b;
}
@@ -718,7 +718,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @param f the extra fields to merge
* @param local whether the new fields originate from local data
*/
- private void mergeExtraFields(ZipExtraField[] f, boolean local)
+ private void mergeExtraFields(final ZipExtraField[] f, final boolean local)
throws ZipException {
if (extraFields == null) {
setExtraFields(f);
@@ -763,7 +763,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
@@ -809,7 +809,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @param versionMadeBy "version made by" field
* @since 1.11
*/
- public void setVersionMadeBy(int versionMadeBy) {
+ public void setVersionMadeBy(final int versionMadeBy) {
this.versionMadeBy = versionMadeBy;
}
@@ -818,7 +818,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @param versionRequired "version required to expand" field
* @since 1.11
*/
- public void setVersionRequired(int versionRequired) {
+ public void setVersionRequired(final int versionRequired) {
this.versionRequired = versionRequired;
}
@@ -854,7 +854,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
* @param rawFlag content of the flags field
* @since 1.11
*/
- public void setRawFlag(int rawFlag) {
+ public void setRawFlag(final int rawFlag) {
this.rawFlag = rawFlag;
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryRequest.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryRequest.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryRequest.java
index 06bb791..9c13f7e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryRequest.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryRequest.java
@@ -37,7 +37,7 @@ public class ZipArchiveEntryRequest {
private final int method;
- private ZipArchiveEntryRequest(ZipArchiveEntry zipArchiveEntry, InputStreamSupplier payloadSupplier) {
+ private ZipArchiveEntryRequest(final ZipArchiveEntry zipArchiveEntry, final InputStreamSupplier payloadSupplier) {
// this constructor has "safe" access to all member variables on zipArchiveEntry
this.zipArchiveEntry = zipArchiveEntry;
this.payloadSupplier = payloadSupplier;
@@ -50,7 +50,7 @@ public class ZipArchiveEntryRequest {
* @param payloadSupplier The payload that will be added to the zip entry.
* @return The newly created request
*/
- public static ZipArchiveEntryRequest createZipArchiveEntryRequest(ZipArchiveEntry zipArchiveEntry, InputStreamSupplier payloadSupplier) {
+ public static ZipArchiveEntryRequest createZipArchiveEntryRequest(final ZipArchiveEntry zipArchiveEntry, final InputStreamSupplier payloadSupplier) {
return new ZipArchiveEntryRequest(zipArchiveEntry, payloadSupplier);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
index be036e5..d0eb5f1 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
@@ -163,7 +163,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* Create an instance using UTF-8 encoding
* @param inputStream the stream to wrap
*/
- public ZipArchiveInputStream(InputStream inputStream) {
+ public ZipArchiveInputStream(final InputStream inputStream) {
this(inputStream, ZipEncodingHelper.UTF8);
}
@@ -174,7 +174,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* for the platform's default encoding
* @since 1.5
*/
- public ZipArchiveInputStream(InputStream inputStream, String encoding) {
+ public ZipArchiveInputStream(final InputStream inputStream, final String encoding) {
this(inputStream, encoding, true);
}
@@ -186,7 +186,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* @param useUnicodeExtraFields whether to use InfoZIP Unicode
* Extra Fields (if present) to set the file names.
*/
- public ZipArchiveInputStream(InputStream inputStream, String encoding, boolean useUnicodeExtraFields) {
+ public ZipArchiveInputStream(final InputStream inputStream, final String encoding, final boolean useUnicodeExtraFields) {
this(inputStream, encoding, useUnicodeExtraFields, false);
}
@@ -201,10 +201,10 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* will try to read STORED entries that use a data descriptor
* @since 1.1
*/
- public ZipArchiveInputStream(InputStream inputStream,
- String encoding,
- boolean useUnicodeExtraFields,
- boolean allowStoredEntriesWithDataDescriptor) {
+ public ZipArchiveInputStream(final InputStream inputStream,
+ final String encoding,
+ final boolean useUnicodeExtraFields,
+ final boolean allowStoredEntriesWithDataDescriptor) {
this.encoding = encoding;
zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
this.useUnicodeExtraFields = useUnicodeExtraFields;
@@ -327,7 +327,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* deals with splitting/spanning markers that may prefix the first
* LFH.
*/
- private void readFirstLocalFileHeader(byte[] lfh) throws IOException {
+ private void readFirstLocalFileHeader(final byte[] lfh) throws IOException {
readFully(lfh);
ZipLong sig = new ZipLong(lfh);
if (sig.equals(ZipLong.DD_SIG)) {
@@ -349,7 +349,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* information from it if sizes are 0xFFFFFFFF and the entry
* doesn't use a data descriptor.
*/
- private void processZip64Extra(ZipLong size, ZipLong cSize) {
+ private void processZip64Extra(final ZipLong size, final ZipLong cSize) {
Zip64ExtendedInformationExtraField z64 =
(Zip64ExtendedInformationExtraField)
current.entry.getExtraField(Zip64ExtendedInformationExtraField.HEADER_ID);
@@ -379,7 +379,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* @since 1.1
*/
@Override
- public boolean canReadEntryData(ArchiveEntry ae) {
+ public boolean canReadEntryData(final ArchiveEntry ae) {
if (ae instanceof ZipArchiveEntry) {
ZipArchiveEntry ze = (ZipArchiveEntry) ae;
return ZipUtil.canHandleEntryData(ze)
@@ -390,7 +390,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
}
@Override
- public int read(byte[] buffer, int offset, int length) throws IOException {
+ public int read(final byte[] buffer, final int offset, final int length) throws IOException {
if (closed) {
throw new IOException("The stream is closed");
}
@@ -434,7 +434,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
/**
* Implementation of read for STORED entries.
*/
- private int readStored(byte[] buffer, int offset, int length) throws IOException {
+ private int readStored(final byte[] buffer, final int offset, final int length) throws IOException {
if (current.hasDataDescriptor) {
if (lastStoredEntry == null) {
@@ -473,7 +473,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
/**
* Implementation of read for DEFLATED entries.
*/
- private int readDeflated(byte[] buffer, int offset, int length) throws IOException {
+ private int readDeflated(final byte[] buffer, final int offset, final int length) throws IOException {
int read = readFromInflater(buffer, offset, length);
if (read <= 0) {
if (inf.finished()) {
@@ -493,7 +493,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* Potentially reads more bytes to fill the inflater's buffer and
* reads from it.
*/
- private int readFromInflater(byte[] buffer, int offset, int length) throws IOException {
+ private int readFromInflater(final byte[] buffer, final int offset, final int length) throws IOException {
int read = 0;
do {
if (inf.needsInput()) {
@@ -543,7 +543,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* @throws IllegalArgumentException - if value is negative.
*/
@Override
- public long skip(long value) throws IOException {
+ public long skip(final long value) throws IOException {
if (value >= 0) {
long skipped = 0;
while (skipped < value) {
@@ -568,7 +568,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* @param length the number of bytes to check
* @return true, if this stream is a zip archive stream, false otherwise
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < ZipArchiveOutputStream.LFH_SIG.length) {
return false;
}
@@ -579,7 +579,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
|| checksig(signature, ZipLong.SINGLE_SEGMENT_SPLIT_MARKER.getBytes());
}
- private static boolean checksig(byte[] signature, byte[] expected) {
+ private static boolean checksig(final byte[] signature, final byte[] expected) {
for (int i = 0; i < expected.length; i++) {
if (signature[i] != expected[i]) {
return false;
@@ -698,7 +698,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
return length;
}
- private void readFully(byte[] b) throws IOException {
+ private void readFully(final byte[] b) throws IOException {
int count = IOUtils.readFully(in, b);
count(count);
if (count < b.length) {
@@ -746,7 +746,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* the entry doesn't require any data descriptor or the method is
* DEFLATED.
*/
- private boolean supportsDataDescriptorFor(ZipArchiveEntry entry) {
+ private boolean supportsDataDescriptorFor(final ZipArchiveEntry entry) {
return !entry.getGeneralPurposeBit().usesDataDescriptor()
|| (allowStoredEntriesWithDataDescriptor && entry.getMethod() == ZipEntry.STORED)
@@ -813,7 +813,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* <p>If it contains such a signature, reads the data descriptor
* and positions the stream right after the data descriptor.</p>
*/
- private boolean bufferContainsSignature(ByteArrayOutputStream bos, int offset, int lastRead, int expectedDDLen)
+ private boolean bufferContainsSignature(final ByteArrayOutputStream bos, final int offset, final int lastRead, final int expectedDDLen)
throws IOException {
boolean done = false;
@@ -854,7 +854,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
* <p>Data descriptor plus incomplete signature (3 bytes in the
* worst case) can be 20 bytes max.</p>
*/
- private int cacheBytesRead(ByteArrayOutputStream bos, int offset, int lastRead, int expecteDDLen) {
+ private int cacheBytesRead(final ByteArrayOutputStream bos, int offset, final int lastRead, final int expecteDDLen) {
final int cacheable = offset + lastRead - expecteDDLen - 3;
if (cacheable > 0) {
bos.write(buf.array(), 0, cacheable);
@@ -866,7 +866,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
return offset;
}
- private void pushback(byte[] buf, int offset, int length) throws IOException {
+ private void pushback(final byte[] buf, final int offset, final int length) throws IOException {
((PushbackInputStream) in).unread(buf, offset, length);
pushedBackBytes(length);
}
@@ -948,7 +948,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
*
* Also updates bytes-read counter.
*/
- private void realSkip(long value) throws IOException {
+ private void realSkip(final long value) throws IOException {
if (value >= 0) {
long skipped = 0;
while (skipped < value) {
@@ -979,7 +979,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream {
return b;
}
- private boolean isFirstByteOfEocdSig(int b) {
+ private boolean isFirstByteOfEocdSig(final int b) {
return b == ZipArchiveOutputStream.EOCD_SIG[0];
}
[19/46] commons-compress git commit: Use blocks.
Posted by bo...@apache.org.
Use blocks.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/05bb97bf
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/05bb97bf
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/05bb97bf
Branch: refs/heads/COMPRESS-207
Commit: 05bb97bf769913d05fc4c49b625149c8ba92bf66
Parents: 8d72635
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 01:00:23 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 01:00:23 2016 -0700
----------------------------------------------------------------------
.../apache/commons/compress/archivers/zip/ScatterSample.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/05bb97bf/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSample.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSample.java b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSample.java
index cede94f..7802137 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSample.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSample.java
@@ -32,10 +32,11 @@ public class ScatterSample {
}
public void addEntry(ZipArchiveEntry zipArchiveEntry, InputStreamSupplier streamSupplier) throws IOException {
- if (zipArchiveEntry.isDirectory() && !zipArchiveEntry.isUnixSymlink())
+ if (zipArchiveEntry.isDirectory() && !zipArchiveEntry.isUnixSymlink()) {
dirs.addArchiveEntry(ZipArchiveEntryRequest.createZipArchiveEntryRequest(zipArchiveEntry, streamSupplier));
- else
+ } else {
scatterZipCreator.addArchiveEntry( zipArchiveEntry, streamSupplier);
+ }
}
public void writeTo(ZipArchiveOutputStream zipArchiveOutputStream)
[13/46] commons-compress git commit: TODO
Posted by bo...@apache.org.
TODO
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ff0d6514
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ff0d6514
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ff0d6514
Branch: refs/heads/COMPRESS-207
Commit: ff0d651478eaa36358185e2f7552145e657e111b
Parents: 4bb50e3
Author: Sebb <se...@apache.org>
Authored: Sat Apr 9 01:30:55 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Sat Apr 9 01:30:55 2016 +0100
----------------------------------------------------------------------
.../compress/archivers/zip/X0017_StrongEncryptionHeader.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ff0d6514/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
index fb4dfd7..e45abd8 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
@@ -248,10 +248,10 @@ public class X0017_StrongEncryptionHeader extends PKWareExtraHeader {
super(new ZipShort(0x0017));
}
- private int format;
+ private int format; // TODO written but not read
private EncryptionAlgorithm algId;
- private int bitlen;
- private int flags;
+ private int bitlen; // TODO written but not read
+ private int flags; // TODO written but not read
private long rcount;
private HashAlgorithm hashAlg;
private int hashSize;
[03/46] commons-compress git commit: Merge tag 'rel/1.11' and bump
version
Posted by bo...@apache.org.
Merge tag 'rel/1.11' and bump version
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/3cbd999c
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/3cbd999c
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/3cbd999c
Branch: refs/heads/COMPRESS-207
Commit: 3cbd999cfb7a92e5b5cc536cc3c0e1089460ab2c
Parents: 21d1f01 ff38bf5
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Apr 6 06:17:14 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Apr 6 06:22:23 2016 +0200
----------------------------------------------------------------------
RELEASE-NOTES.txt | 74 ++++++++++++++++++++++++++++++--
pom.xml | 2 +-
src/changes/changes.xml | 5 ++-
src/site/site.xml | 1 +
src/site/xdoc/download_compress.xml | 26 +++++------
src/site/xdoc/index.xml | 29 +++++--------
6 files changed, 100 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3cbd999c/pom.xml
----------------------------------------------------------------------
diff --cc pom.xml
index 8cba58e,4551aaa..5ad3f75
--- a/pom.xml
+++ b/pom.xml
@@@ -25,7 -25,7 +25,7 @@@
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
- <version>1.11-SNAPSHOT</version>
- <version>1.11</version>
++ <version>1.12-SNAPSHOT</version>
<name>Apache Commons Compress</name>
<url>http://commons.apache.org/proper/commons-compress/</url>
<!-- The description is not indented to make it look better in the release notes -->
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3cbd999c/src/changes/changes.xml
----------------------------------------------------------------------
diff --cc src/changes/changes.xml
index c902d29,c902d29..ca1ef94
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@@ -42,7 -42,7 +42,10 @@@ The <action> type attribute can be add,
<title>commons-compress</title>
</properties>
<body>
-- <release version="1.11" date="not released, yet"
++ <release version="1.12" date="not released, yet"
++ description="Release 1.12">
++ </release>
++ <release version="1.11" date="2016-04-06"
description="Release 1.11">
<action issue="COMPRESS-347" type="add" date="2016-03-23">
TarArchiveInputStream now supports reading global PAX headers.
[36/46] commons-compress git commit: Add final modifier to local
variables.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
index d15d74a..0a2a3b5 100644
--- a/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
@@ -31,7 +31,7 @@ public class BZip2CompressorInputStreamTest {
@Test(expected = IOException.class)
public void shouldThrowAnIOExceptionWhenAppliedToAZipFile() throws Exception {
- FileInputStream in = new FileInputStream(getFile("bla.zip"));
+ final FileInputStream in = new FileInputStream(getFile("bla.zip"));
try {
new BZip2CompressorInputStream(in);
} finally {
@@ -45,14 +45,14 @@ public class BZip2CompressorInputStreamTest {
@Test
public void readOfLength0ShouldReturn0() throws Exception {
// Create a big random piece of data
- byte[] rawData = new byte[1048576];
+ final byte[] rawData = new byte[1048576];
for (int i=0; i < rawData.length; ++i) {
rawData[i] = (byte) Math.floor(Math.random()*256);
}
// Compress it
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- BZip2CompressorOutputStream bzipOut = new BZip2CompressorOutputStream(baos);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final BZip2CompressorOutputStream bzipOut = new BZip2CompressorOutputStream(baos);
bzipOut.write(rawData);
bzipOut.flush();
bzipOut.close();
@@ -60,9 +60,9 @@ public class BZip2CompressorInputStreamTest {
baos.close();
// Try to read it back in
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- BZip2CompressorInputStream bzipIn = new BZip2CompressorInputStream(bais);
- byte[] buffer = new byte[1024];
+ final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ final BZip2CompressorInputStream bzipIn = new BZip2CompressorInputStream(bais);
+ final byte[] buffer = new byte[1024];
Assert.assertEquals(1024, bzipIn.read(buffer, 0, 1024));
Assert.assertEquals(0, bzipIn.read(buffer, 1024, 0));
Assert.assertEquals(1024, bzipIn.read(buffer, 0, 1024));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java b/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
index c69b2d0..ee30d37 100644
--- a/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
@@ -79,7 +79,7 @@ public class BlockSortTest {
@Test
public void testSortFixture() {
- DS ds = setUpFixture();
+ final DS ds = setUpFixture();
ds.s.blockSort(ds.data, FIXTURE.length - 1);
assertFixtureSorted(ds.data);
assertEquals(0, ds.data.origPtr);
@@ -87,21 +87,21 @@ public class BlockSortTest {
@Test
public void testSortFixtureMainSort() {
- DS ds = setUpFixture();
+ final DS ds = setUpFixture();
ds.s.mainSort(ds.data, FIXTURE.length - 1);
assertFixtureSorted(ds.data);
}
@Test
public void testSortFixtureFallbackSort() {
- DS ds = setUpFixture();
+ final DS ds = setUpFixture();
ds.s.fallbackSort(ds.data, FIXTURE.length - 1);
assertFixtureSorted(ds.data);
}
@Test
public void testSortFixture2() {
- DS ds = setUpFixture2();
+ final DS ds = setUpFixture2();
ds.s.blockSort(ds.data, FIXTURE2.length - 1);
assertFixture2Sorted(ds.data);
assertEquals(1, ds.data.origPtr);
@@ -109,23 +109,23 @@ public class BlockSortTest {
@Test
public void testSortFixture2MainSort() {
- DS ds = setUpFixture2();
+ final DS ds = setUpFixture2();
ds.s.mainSort(ds.data, FIXTURE2.length - 1);
assertFixture2Sorted(ds.data);
}
@Test
public void testSortFixture2FallbackSort() {
- DS ds = setUpFixture2();
+ final DS ds = setUpFixture2();
ds.s.fallbackSort(ds.data, FIXTURE2.length - 1);
assertFixture2Sorted(ds.data);
}
@Test
public void testFallbackSort() {
- BZip2CompressorOutputStream.Data data = new BZip2CompressorOutputStream.Data(1);
- BlockSort s = new BlockSort(data);
- int[] fmap = new int[FIXTURE.length];
+ final BZip2CompressorOutputStream.Data data = new BZip2CompressorOutputStream.Data(1);
+ final BlockSort s = new BlockSort(data);
+ final int[] fmap = new int[FIXTURE.length];
s.fallbackSort(fmap, FIXTURE, FIXTURE.length);
assertArrayEquals(FIXTURE_SORTED, fmap);
}
@@ -147,7 +147,7 @@ public class BlockSortTest {
}
private DS setUpFixture(final byte[] fixture) {
- BZip2CompressorOutputStream.Data data = new BZip2CompressorOutputStream.Data(1);
+ final BZip2CompressorOutputStream.Data data = new BZip2CompressorOutputStream.Data(1);
System.arraycopy(fixture, 0, data.block, 1, fixture.length);
return new DS(data, new BlockSort(data));
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java b/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
index cf06ade..2bdd014 100644
--- a/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
+++ b/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
@@ -48,8 +48,8 @@ public class PythonTruncatedBzip2Test {
@BeforeClass
public static void initializeTestData() throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- BZip2CompressorOutputStream bz2out = new BZip2CompressorOutputStream(out);
+ final ByteArrayOutputStream out = new ByteArrayOutputStream();
+ final BZip2CompressorOutputStream bz2out = new BZip2CompressorOutputStream(out);
bz2out.write(TEXT.getBytes(), 0, TEXT.getBytes().length);
bz2out.close();
DATA = out.toByteArray();
@@ -60,7 +60,7 @@ public class PythonTruncatedBzip2Test {
@Before
public void initializeChannel() throws IOException {
- InputStream source = new ByteArrayInputStream(TRUNCATED_DATA);
+ final InputStream source = new ByteArrayInputStream(TRUNCATED_DATA);
this.bz2Channel = makeBZ2C(source);
}
@@ -75,7 +75,7 @@ public class PythonTruncatedBzip2Test {
//with BZ2File(self.filename) as f:
// self.assertRaises(EOFError, f.read)
System.out.println("Attempt to read the whole thing in, should throw ...");
- ByteBuffer buffer = ByteBuffer.allocate(8192);
+ final ByteBuffer buffer = ByteBuffer.allocate(8192);
bz2Channel.read(buffer);
}
@@ -97,14 +97,14 @@ public class PythonTruncatedBzip2Test {
try {
bz2Channel.read(buffer);
Assert.fail("The read should have thrown.");
- } catch (IOException e) {
+ } catch (final IOException e) {
// pass
}
}
private static ReadableByteChannel makeBZ2C(final InputStream source) throws IOException {
- BufferedInputStream bin = new BufferedInputStream(source);
- BZip2CompressorInputStream bZin = new BZip2CompressorInputStream(bin, true);
+ final BufferedInputStream bin = new BufferedInputStream(source);
+ final BZip2CompressorInputStream bZin = new BZip2CompressorInputStream(bin, true);
return Channels.newChannel(bZin);
}
@@ -112,8 +112,8 @@ public class PythonTruncatedBzip2Test {
// Helper method since Arrays#copyOfRange is Java 1.6+
// Does not check parameters, so may fail if they are incompatible
private static byte[] copyOfRange(final byte[] original, final int from, final int to) {
- int length = to - from;
- byte buff[] = new byte[length];
+ final int length = to - from;
+ final byte buff[] = new byte[length];
System.arraycopy(original, from, buff, 0, length);
return buff;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStreamTest.java
index 8cfeb29..e17b6a0 100644
--- a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStreamTest.java
@@ -35,7 +35,7 @@ public class DeflateCompressorInputStreamTest {
final File input = AbstractTestCase.getFile("bla.tar.deflatez");
final InputStream is = new FileInputStream(input);
try {
- DeflateCompressorInputStream in =
+ final DeflateCompressorInputStream in =
new DeflateCompressorInputStream(is);
Assert.assertTrue(in.available() > 0);
in.close();
@@ -49,7 +49,7 @@ public class DeflateCompressorInputStreamTest {
final File input = AbstractTestCase.getFile("bla.tar.deflatez");
final InputStream is = new FileInputStream(input);
try {
- DeflateCompressorInputStream in =
+ final DeflateCompressorInputStream in =
new DeflateCompressorInputStream(is);
Assert.assertEquals(1, in.skip(1));
in.close();
@@ -63,7 +63,7 @@ public class DeflateCompressorInputStreamTest {
final File input = AbstractTestCase.getFile("bla.tar.deflatez");
final InputStream is = new FileInputStream(input);
try {
- DeflateCompressorInputStream in =
+ final DeflateCompressorInputStream in =
new DeflateCompressorInputStream(is);
// tar header starts with filename "test1.xml"
Assert.assertEquals('t', in.read());
@@ -78,7 +78,7 @@ public class DeflateCompressorInputStreamTest {
final File input = AbstractTestCase.getFile("bla.tar.deflatez");
final InputStream is = new FileInputStream(input);
try {
- DeflateCompressorInputStream in =
+ final DeflateCompressorInputStream in =
new DeflateCompressorInputStream(is);
IOUtils.toByteArray(in);
Assert.assertEquals(-1, in.read());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStreamTest.java
index 658bd8f..c606615 100644
--- a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStreamTest.java
@@ -28,8 +28,8 @@ public class DeflateCompressorOutputStreamTest {
@Test
public void canReadASingleByteFlushAndFinish() throws IOException {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- DeflateCompressorOutputStream cos = new DeflateCompressorOutputStream(bos);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final DeflateCompressorOutputStream cos = new DeflateCompressorOutputStream(bos);
cos.write(99);
cos.flush();
cos.finish();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateParametersTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateParametersTest.java b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateParametersTest.java
index 6b20146..0a43798 100644
--- a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateParametersTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateParametersTest.java
@@ -25,20 +25,20 @@ public class DeflateParametersTest {
@Test
public void shouldBeAbleToSetCompressionLevel() {
- DeflateParameters p = new DeflateParameters();
+ final DeflateParameters p = new DeflateParameters();
p.setCompressionLevel(5);
Assert.assertEquals(5, p.getCompressionLevel());
}
@Test(expected = IllegalArgumentException.class)
public void shouldNotBeAbleToSetCompressionLevelToANegativeValue() {
- DeflateParameters p = new DeflateParameters();
+ final DeflateParameters p = new DeflateParameters();
p.setCompressionLevel(-2);
}
@Test(expected = IllegalArgumentException.class)
public void shouldNotBeAbleToSetCompressionLevelToADoubleDigitValue() {
- DeflateParameters p = new DeflateParameters();
+ final DeflateParameters p = new DeflateParameters();
p.setCompressionLevel(12);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/lzma/LZMAUtilsTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/lzma/LZMAUtilsTestCase.java b/src/test/java/org/apache/commons/compress/compressors/lzma/LZMAUtilsTestCase.java
index 357c9fb..17b3806 100644
--- a/src/test/java/org/apache/commons/compress/compressors/lzma/LZMAUtilsTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/lzma/LZMAUtilsTestCase.java
@@ -66,7 +66,7 @@ public class LZMAUtilsTestCase {
@Test
public void testMatches() {
- byte[] data = {
+ final byte[] data = {
(byte) 0x5D, 0, 0,
};
assertFalse(LZMAUtils.matches(data, 2));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200UtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200UtilsTest.java b/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200UtilsTest.java
index 2a75a08..83f8d32 100644
--- a/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200UtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200UtilsTest.java
@@ -47,14 +47,14 @@ public final class Pack200UtilsTest extends AbstractTestCase {
ArchiveEntry entry = in.getNextEntry();
while (entry != null) {
- File archiveEntry = new File(dir, entry.getName());
+ final File archiveEntry = new File(dir, entry.getName());
archiveEntry.getParentFile().mkdirs();
if (entry.isDirectory()) {
archiveEntry.mkdir();
entry = in.getNextEntry();
continue;
}
- OutputStream out = new FileOutputStream(archiveEntry);
+ final OutputStream out = new FileOutputStream(archiveEntry);
IOUtils.copy(in, out);
out.close();
entry = in.getNextEntry();
@@ -95,14 +95,14 @@ public final class Pack200UtilsTest extends AbstractTestCase {
ArchiveEntry entry = in.getNextEntry();
while (entry != null) {
- File archiveEntry = new File(dir, entry.getName());
+ final File archiveEntry = new File(dir, entry.getName());
archiveEntry.getParentFile().mkdirs();
if (entry.isDirectory()) {
archiveEntry.mkdir();
entry = in.getNextEntry();
continue;
}
- OutputStream out = new FileOutputStream(archiveEntry);
+ final OutputStream out = new FileOutputStream(archiveEntry);
IOUtils.copy(in, out);
out.close();
entry = in.getNextEntry();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
index ec4eb2f..3126c4d 100644
--- a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
@@ -38,9 +38,9 @@ public final class FramedSnappyCompressorInputStreamTest
@Test
public void testMatches() throws IOException {
assertFalse(FramedSnappyCompressorInputStream.matches(new byte[10], 10));
- byte[] b = new byte[12];
+ final byte[] b = new byte[12];
final File input = getFile("bla.tar.sz");
- FileInputStream in = new FileInputStream(input);
+ final FileInputStream in = new FileInputStream(input);
try {
IOUtils.readFully(in, b);
} finally {
@@ -92,7 +92,7 @@ public final class FramedSnappyCompressorInputStreamTest
final FileInputStream sz = new FileInputStream(outputSz);
try {
- FileInputStream gz = new FileInputStream(outputGz);
+ final FileInputStream gz = new FileInputStream(outputGz);
try {
assertArrayEquals(IOUtils.toByteArray(sz),
IOUtils.toByteArray(gz));
@@ -107,9 +107,9 @@ public final class FramedSnappyCompressorInputStreamTest
@Test
public void testRemainingChunkTypes() throws Exception {
final FileInputStream isSz = new FileInputStream(getFile("mixed.txt.sz"));
- ByteArrayOutputStream out = new ByteArrayOutputStream();
+ final ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
- FramedSnappyCompressorInputStream in = new FramedSnappyCompressorInputStream(isSz);
+ final FramedSnappyCompressorInputStream in = new FramedSnappyCompressorInputStream(isSz);
IOUtils.copy(in, out);
out.close();
} finally {
@@ -131,7 +131,7 @@ public final class FramedSnappyCompressorInputStreamTest
public void testAvailable() throws Exception {
final FileInputStream isSz = new FileInputStream(getFile("mixed.txt.sz"));
try {
- FramedSnappyCompressorInputStream in = new FramedSnappyCompressorInputStream(isSz);
+ final FramedSnappyCompressorInputStream in = new FramedSnappyCompressorInputStream(isSz);
assertEquals(0, in.available()); // no chunk read so far
assertEquals('1', in.read());
assertEquals(3, in.available()); // remainder of first uncompressed block
@@ -149,17 +149,17 @@ public final class FramedSnappyCompressorInputStreamTest
@Test
public void testUnskippableChunk() {
- byte[] input = new byte[] {
+ final byte[] input = new byte[] {
(byte) 0xff, 6, 0, 0, 's', 'N', 'a', 'P', 'p', 'Y',
2, 2, 0, 0, 1, 1
};
try {
- FramedSnappyCompressorInputStream in =
+ final FramedSnappyCompressorInputStream in =
new FramedSnappyCompressorInputStream(new ByteArrayInputStream(input));
in.read();
fail("expected an exception");
in.close();
- } catch (IOException ex) {
+ } catch (final IOException ex) {
assertTrue(ex.getMessage().contains("unskippable chunk"));
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
index 7279a95..6b8ab13 100644
--- a/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
@@ -24,7 +24,7 @@ import org.junit.Test;
public class XZCompressorInputStreamTest {
@Test
public void redundantTestOfAlmostDeprecatedMatchesMethod() {
- byte[] data = {
+ final byte[] data = {
(byte) 0xFD, '7', 'z', 'X', 'Z', '\0'
};
Assert.assertFalse(XZCompressorInputStream.matches(data, 5));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/xz/XZUtilsTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/xz/XZUtilsTestCase.java b/src/test/java/org/apache/commons/compress/compressors/xz/XZUtilsTestCase.java
index f5867d6..e706961 100644
--- a/src/test/java/org/apache/commons/compress/compressors/xz/XZUtilsTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/xz/XZUtilsTestCase.java
@@ -70,7 +70,7 @@ public class XZUtilsTestCase {
@Test
public void testMatches() {
- byte[] data = {
+ final byte[] data = {
(byte) 0xFD, '7', 'z', 'X', 'Z', '\0'
};
assertFalse(XZUtils.matches(data, 5));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/utils/BitInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/utils/BitInputStreamTest.java b/src/test/java/org/apache/commons/compress/utils/BitInputStreamTest.java
index 793d6fa..6f90af3 100644
--- a/src/test/java/org/apache/commons/compress/utils/BitInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/BitInputStreamTest.java
@@ -30,42 +30,42 @@ public class BitInputStreamTest {
@Test(expected = IllegalArgumentException.class)
public void shouldNotAllowReadingOfANegativeAmountOfBits() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
bis.readBits(-1);
bis.close();
}
@Test(expected = IllegalArgumentException.class)
public void shouldNotAllowReadingOfMoreThan63BitsAtATime() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
bis.readBits(64);
bis.close();
}
@Test
public void testReading24BitsInLittleEndian() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
assertEquals(0x000140f8, bis.readBits(24));
bis.close();
}
@Test
public void testReading24BitsInBigEndian() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
assertEquals(0x00f84001, bis.readBits(24));
bis.close();
}
@Test
public void testReading17BitsInLittleEndian() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
assertEquals(0x000140f8, bis.readBits(17));
bis.close();
}
@Test
public void testReading17BitsInBigEndian() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
// 1-11110000-10000000
assertEquals(0x0001f080, bis.readBits(17));
bis.close();
@@ -73,14 +73,14 @@ public class BitInputStreamTest {
@Test
public void testReading30BitsInLittleEndian() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
assertEquals(0x2f0140f8, bis.readBits(30));
bis.close();
}
@Test
public void testReading30BitsInBigEndian() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
// 111110-00010000-00000000-01001011
assertEquals(0x3e10004b, bis.readBits(30));
bis.close();
@@ -88,14 +88,14 @@ public class BitInputStreamTest {
@Test
public void testReading31BitsInLittleEndian() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
assertEquals(0x2f0140f8, bis.readBits(31));
bis.close();
}
@Test
public void testReading31BitsInBigEndian() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
// 1111100-00100000-00000000-10010111
assertEquals(0x7c200097, bis.readBits(31));
bis.close();
@@ -103,7 +103,7 @@ public class BitInputStreamTest {
@Test
public void testClearBitCache() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
assertEquals(0x08, bis.readBits(4));
bis.clearBitCache();
assertEquals(0, bis.readBits(1));
@@ -112,7 +112,7 @@ public class BitInputStreamTest {
@Test
public void testEOF() throws IOException {
- BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+ final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
assertEquals(0x2f0140f8, bis.readBits(30));
assertEquals(-1, bis.readBits(3));
bis.close();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java b/src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java
index 82e06de..70e70b7 100644
--- a/src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java
@@ -32,8 +32,8 @@ public class CountingStreamTest {
public void output() throws Exception {
// I don't like "test all at once" tests either, but the class
// is so trivial
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- CountingOutputStream o = new CountingOutputStream(bos);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final CountingOutputStream o = new CountingOutputStream(bos);
o.write(1);
assertEquals(1, o.getBytesWritten());
o.write(new byte[] { 2, 3 });
@@ -52,9 +52,9 @@ public class CountingStreamTest {
public void input() throws Exception {
// I don't like "test all at once" tests either, but the class
// is so trivial
- ByteArrayInputStream bis =
+ final ByteArrayInputStream bis =
new ByteArrayInputStream(new byte[] { 1, 2, 3, 4 });
- CountingInputStream i = new CountingInputStream(bis);
+ final CountingInputStream i = new CountingInputStream(bis);
assertEquals(1, i.read());
assertEquals(1, i.getBytesRead());
byte[] b = new byte[2];
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
index 33ef7b9..47bd0b0 100644
--- a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
@@ -78,10 +78,10 @@ public class IOUtilsTest {
}
private void skip(final StreamWrapper wrapper) throws Exception {
- ByteArrayInputStream in = new ByteArrayInputStream(new byte[] {
+ final ByteArrayInputStream in = new ByteArrayInputStream(new byte[] {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
});
- InputStream sut = wrapper.wrap(in);
+ final InputStream sut = wrapper.wrap(in);
Assert.assertEquals(10, IOUtils.skip(sut, 10));
Assert.assertEquals(11, sut.read());
}
[31/46] commons-compress git commit: Add final modifier to method
parameters.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/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 65d6bad..873de5c 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
@@ -266,7 +266,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Creates a new ZIP OutputStream filtering the underlying stream.
* @param out the outputstream to zip
*/
- public ZipArchiveOutputStream(OutputStream out) {
+ public ZipArchiveOutputStream(final OutputStream out) {
this.out = out;
this.raf = null;
def = new Deflater(level, true);
@@ -279,7 +279,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param file the file to zip to
* @throws IOException on error
*/
- public ZipArchiveOutputStream(File file) throws IOException {
+ public ZipArchiveOutputStream(final File file) throws IOException {
OutputStream o = null;
RandomAccessFile _raf = null;
try {
@@ -344,7 +344,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param b whether to set the language encoding flag if the file
* name encoding is UTF-8
*/
- public void setUseLanguageEncodingFlag(boolean b) {
+ public void setUseLanguageEncodingFlag(final boolean b) {
useUTF8Flag = b && ZipEncodingHelper.isUTF8(encoding);
}
@@ -355,7 +355,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
*
* @param b whether to create Unicode Extra Fields.
*/
- public void setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy b) {
+ public void setCreateUnicodeExtraFields(final UnicodeExtraFieldPolicy b) {
createUnicodeExtraFields = b;
}
@@ -369,7 +369,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* flag if the file name cannot be encoded using the specified
* encoding.
*/
- public void setFallbackToUTF8(boolean b) {
+ public void setFallbackToUTF8(final boolean b) {
fallbackToUTF8 = b;
}
@@ -418,7 +418,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @since 1.3
* @param mode Whether Zip64 extensions will be used.
*/
- public void setUseZip64(Zip64Mode mode) {
+ public void setUseZip64(final Zip64Mode mode) {
zip64Mode = mode;
}
@@ -497,7 +497,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param phased This entry is second phase of a 2-phase zip creation, size, compressed size and crc
* are known in ZipArchiveEntry
*/
- private void closeCopiedEntry(boolean phased) throws IOException {
+ private void closeCopiedEntry(final boolean phased) throws IOException {
preClose();
entry.bytesRead = entry.entry.getSize();
Zip64Mode effectiveMode = getEffectiveZip64Mode(entry.entry);
@@ -505,7 +505,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
closeEntry(actuallyNeedsZip64, phased);
}
- private void closeEntry(boolean actuallyNeedsZip64, boolean phased) throws IOException {
+ private void closeEntry(final boolean actuallyNeedsZip64, final boolean phased) throws IOException {
if (!phased && raf != null) {
rewriteSizesAndCrc(actuallyNeedsZip64);
}
@@ -541,7 +541,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param rawStream The raw input stream of a different entry. May be compressed/encrypted.
* @throws IOException If copying fails
*/
- public void addRawArchiveEntry(ZipArchiveEntry entry, InputStream rawStream)
+ public void addRawArchiveEntry(final ZipArchiveEntry entry, final InputStream rawStream)
throws IOException {
ZipArchiveEntry ae = new ZipArchiveEntry(entry);
if (hasZip64Extra(ae)) {
@@ -573,8 +573,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Zip64Mode.Never case and returns whether the entry would
* require a Zip64 extra field.
*/
- private boolean handleSizesAndCrc(long bytesWritten, long crc,
- Zip64Mode effectiveMode)
+ private boolean handleSizesAndCrc(final long bytesWritten, final long crc,
+ final Zip64Mode effectiveMode)
throws ZipException {
if (entry.entry.getMethod() == DEFLATED) {
/* It turns out def.getBytesRead() returns wrong values if
@@ -616,7 +616,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Zip64Mode.Never case and returns whether the entry would
* require a Zip64 extra field.
*/
- private boolean checkIfNeedsZip64(Zip64Mode effectiveMode)
+ private boolean checkIfNeedsZip64(final Zip64Mode effectiveMode)
throws ZipException {
final boolean actuallyNeedsZip64 = isZip64Required(entry.entry, effectiveMode);
if (actuallyNeedsZip64 && effectiveMode == Zip64Mode.Never) {
@@ -625,11 +625,11 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
return actuallyNeedsZip64;
}
- private boolean isZip64Required(ZipArchiveEntry entry1, Zip64Mode requestedMode) {
+ private boolean isZip64Required(final ZipArchiveEntry entry1, final Zip64Mode requestedMode) {
return requestedMode == Zip64Mode.Always || isTooLageForZip32(entry1);
}
- private boolean isTooLageForZip32(ZipArchiveEntry zipArchiveEntry){
+ private boolean isTooLageForZip32(final ZipArchiveEntry zipArchiveEntry){
return zipArchiveEntry.getSize() >= ZIP64_MAGIC || zipArchiveEntry.getCompressedSize() >= ZIP64_MAGIC;
}
@@ -638,7 +638,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* and potentiall the ZIP64 extra containing the correct CRC and
* compressed/uncompressed sizes.
*/
- private void rewriteSizesAndCrc(boolean actuallyNeedsZip64)
+ private void rewriteSizesAndCrc(final boolean actuallyNeedsZip64)
throws IOException {
long save = raf.getFilePointer();
@@ -693,7 +693,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* is {@link Zip64Mode#Never}.
*/
@Override
- public void putArchiveEntry(ArchiveEntry archiveEntry) throws IOException {
+ public void putArchiveEntry(final ArchiveEntry archiveEntry) throws IOException {
putArchiveEntry(archiveEntry, false);
}
@@ -709,7 +709,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* compressed size is known to exceed 4 GByte and {@link #setUseZip64}
* is {@link Zip64Mode#Never}.
*/
- private void putArchiveEntry(ArchiveEntry archiveEntry, boolean phased) throws IOException {
+ private void putArchiveEntry(final ArchiveEntry archiveEntry, final boolean phased) throws IOException {
if (finished) {
throw new IOException("Stream has already been finished");
}
@@ -759,7 +759,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Provides default values for compression method and last
* modification time.
*/
- private void setDefaults(ZipArchiveEntry entry) {
+ private void setDefaults(final ZipArchiveEntry entry) {
if (entry.getMethod() == -1) { // not specified
entry.setMethod(method);
}
@@ -775,7 +775,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* big to be written without Zip64 extra but the mode has been set
* to Never.
*/
- private void validateSizeInformation(Zip64Mode effectiveMode)
+ private void validateSizeInformation(final Zip64Mode effectiveMode)
throws ZipException {
// Size/CRC not required if RandomAccessFile is used
if (entry.entry.getMethod() == STORED && raf == null) {
@@ -813,7 +813,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* usage</li>
* </ul>
*/
- private boolean shouldAddZip64Extra(ZipArchiveEntry entry, Zip64Mode mode) {
+ private boolean shouldAddZip64Extra(final ZipArchiveEntry entry, final Zip64Mode mode) {
return mode == Zip64Mode.Always
|| entry.getSize() >= ZIP64_MAGIC
|| entry.getCompressedSize() >= ZIP64_MAGIC
@@ -825,7 +825,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Set the file comment.
* @param comment the comment
*/
- public void setComment(String comment) {
+ public void setComment(final String comment) {
this.comment = comment;
}
@@ -837,7 +837,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @throws IllegalArgumentException if an invalid compression
* level is specified.
*/
- public void setLevel(int level) {
+ public void setLevel(final int level) {
if (level < Deflater.DEFAULT_COMPRESSION
|| level > Deflater.BEST_COMPRESSION) {
throw new IllegalArgumentException("Invalid compression level: "
@@ -853,7 +853,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* <p>Default is DEFLATED.</p>
* @param method an <code>int</code> from java.util.zip.ZipEntry
*/
- public void setMethod(int method) {
+ public void setMethod(final int method) {
this.method = method;
}
@@ -865,7 +865,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @since 1.1
*/
@Override
- public boolean canWriteEntryData(ArchiveEntry ae) {
+ public boolean canWriteEntryData(final ArchiveEntry ae) {
if (ae instanceof ZipArchiveEntry) {
ZipArchiveEntry zae = (ZipArchiveEntry) ae;
return zae.getMethod() != ZipMethod.IMPLODING.getCode()
@@ -883,7 +883,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @throws IOException on error
*/
@Override
- public void write(byte[] b, int offset, int length) throws IOException {
+ public void write(final byte[] b, final int offset, final int length) throws IOException {
if (entry == null) {
throw new IllegalStateException("No current entry");
}
@@ -897,11 +897,11 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param data the byte array to write
* @throws IOException on error
*/
- private void writeCounted(byte[] data) throws IOException {
+ private void writeCounted(final byte[] data) throws IOException {
streamCompressor.writeCounted(data);
}
- private void copyFromZipInputStream(InputStream src) throws IOException {
+ private void copyFromZipInputStream(final InputStream src) throws IOException {
if (entry == null) {
throw new IllegalStateException("No current entry");
}
@@ -986,11 +986,11 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param ze the entry to write
* @throws IOException on error
*/
- protected void writeLocalFileHeader(ZipArchiveEntry ze) throws IOException {
+ protected void writeLocalFileHeader(final ZipArchiveEntry ze) throws IOException {
writeLocalFileHeader(ze, false);
}
- private void writeLocalFileHeader(ZipArchiveEntry ze, boolean phased) throws IOException {
+ private void writeLocalFileHeader(final ZipArchiveEntry ze, final boolean phased) throws IOException {
boolean encodable = zipEncoding.canEncode(ze.getName());
ByteBuffer name = getName(ze);
@@ -1007,8 +1007,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
}
- private byte[] createLocalFileHeader(ZipArchiveEntry ze, ByteBuffer name, boolean encodable,
- boolean phased) {
+ private byte[] createLocalFileHeader(final ZipArchiveEntry ze, final ByteBuffer name, final boolean encodable,
+ final boolean phased) {
byte[] extra = ze.getLocalFileDataExtra();
final int nameLen = name.limit() - name.position();
int len= LFH_FILENAME_OFFSET + nameLen + extra.length;
@@ -1079,8 +1079,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* ALWAYS or the data cannot be encoded using the configured
* encoding.
*/
- private void addUnicodeExtraFields(ZipArchiveEntry ze, boolean encodable,
- ByteBuffer name)
+ private void addUnicodeExtraFields(final ZipArchiveEntry ze, final boolean encodable,
+ final ByteBuffer name)
throws IOException {
if (createUnicodeExtraFields == UnicodeExtraFieldPolicy.ALWAYS
|| !encodable) {
@@ -1114,7 +1114,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param ze the entry to write
* @throws IOException on error
*/
- protected void writeDataDescriptor(ZipArchiveEntry ze) throws IOException {
+ protected void writeDataDescriptor(final ZipArchiveEntry ze) throws IOException {
if (ze.getMethod() != DEFLATED || raf != null) {
return;
}
@@ -1137,12 +1137,12 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* GByte and {@link Zip64Mode #setUseZip64} is {@link
* Zip64Mode#Never}.
*/
- protected void writeCentralFileHeader(ZipArchiveEntry ze) throws IOException {
+ protected void writeCentralFileHeader(final ZipArchiveEntry ze) throws IOException {
byte[] centralFileHeader = createCentralFileHeader(ze);
writeCounted(centralFileHeader);
}
- private byte[] createCentralFileHeader(ZipArchiveEntry ze) throws IOException {
+ private byte[] createCentralFileHeader(final ZipArchiveEntry ze) throws IOException {
final long lfhOffset = offsets.get(ze);
final boolean needsZip64Extra = hasZip64Extra(ze)
@@ -1172,8 +1172,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param lfhOffset Local file header offset for this file
* @throws IOException on error
*/
- private byte[] createCentralFileHeader(ZipArchiveEntry ze, ByteBuffer name, long lfhOffset,
- boolean needsZip64Extra) throws IOException {
+ private byte[] createCentralFileHeader(final ZipArchiveEntry ze, final ByteBuffer name, final long lfhOffset,
+ final boolean needsZip64Extra) throws IOException {
byte[] extra = ze.getCentralDirectoryExtra();
// file comment length
@@ -1261,8 +1261,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* If the entry needs Zip64 extra information inside the central
* directory then configure its data.
*/
- private void handleZip64Extra(ZipArchiveEntry ze, long lfhOffset,
- boolean needsZip64Extra) {
+ private void handleZip64Extra(final ZipArchiveEntry ze, final long lfhOffset,
+ final boolean needsZip64Extra) {
if (needsZip64Extra) {
Zip64ExtendedInformationExtraField z64 = getZip64Extra(ze);
if (ze.getCompressedSize() >= ZIP64_MAGIC
@@ -1397,7 +1397,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param data the byte array to write
* @throws IOException on error
*/
- protected final void writeOut(byte[] data) throws IOException {
+ protected final void writeOut(final byte[] data) throws IOException {
streamCompressor.writeOut(data, 0, data.length);
}
@@ -1409,7 +1409,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param length the number of bytes to write
* @throws IOException on error
*/
- protected final void writeOut(byte[] data, int offset, int length)
+ protected final void writeOut(final byte[] data, final int offset, final int length)
throws IOException {
streamCompressor.writeOut(data, offset, length);
}
@@ -1435,7 +1435,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
INITIAL_VERSION;
}
- private boolean isDeflatedToOutputStream(int zipMethod) {
+ private boolean isDeflatedToOutputStream(final int zipMethod) {
return zipMethod == DEFLATED && raf == null;
}
@@ -1452,7 +1452,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* <p>Must not be used if the stream has already been closed.</p>
*/
@Override
- public ArchiveEntry createArchiveEntry(File inputFile, String entryName)
+ public ArchiveEntry createArchiveEntry(final File inputFile, final String entryName)
throws IOException {
if (finished) {
throw new IOException("Stream has already been finished");
@@ -1467,7 +1467,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @since 1.3
*/
private Zip64ExtendedInformationExtraField
- getZip64Extra(ZipArchiveEntry ze) {
+ getZip64Extra(final ZipArchiveEntry ze) {
if (entry != null) {
entry.causedUseOfZip64 = !hasUsedZip64;
}
@@ -1498,7 +1498,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
*
* @since 1.3
*/
- private boolean hasZip64Extra(ZipArchiveEntry ze) {
+ private boolean hasZip64Extra(final ZipArchiveEntry ze) {
return ze.getExtraField(Zip64ExtendedInformationExtraField
.HEADER_ID)
!= null;
@@ -1511,7 +1511,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
*
* @since 1.3
*/
- private Zip64Mode getEffectiveZip64Mode(ZipArchiveEntry ze) {
+ private Zip64Mode getEffectiveZip64Mode(final ZipArchiveEntry ze) {
if (zip64Mode != Zip64Mode.AsNeeded
|| raf != null
|| ze.getMethod() != DEFLATED
@@ -1521,13 +1521,13 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
return Zip64Mode.Never;
}
- private ZipEncoding getEntryEncoding(ZipArchiveEntry ze) {
+ private ZipEncoding getEntryEncoding(final ZipArchiveEntry ze) {
boolean encodable = zipEncoding.canEncode(ze.getName());
return !encodable && fallbackToUTF8
? ZipEncodingHelper.UTF8_ZIP_ENCODING : zipEncoding;
}
- private ByteBuffer getName(ZipArchiveEntry ze) throws IOException {
+ private ByteBuffer getName(final ZipArchiveEntry ze) throws IOException {
return getEntryEncoding(ze).encode(ze.getName());
}
@@ -1568,7 +1568,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
new UnicodeExtraFieldPolicy("not encodeable");
private final String name;
- private UnicodeExtraFieldPolicy(String n) {
+ private UnicodeExtraFieldPolicy(final String n) {
name = n;
}
@Override
@@ -1582,7 +1582,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* currently being written.
*/
private static final class CurrentEntry {
- private CurrentEntry(ZipArchiveEntry entry) {
+ private CurrentEntry(final ZipArchiveEntry entry) {
this.entry = entry;
}
/**
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
index 0803e65..baf99ea 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
@@ -71,7 +71,7 @@ public final class ZipEightByteInteger implements Serializable {
* Create instance from a number.
* @param value the long to store as a ZipEightByteInteger
*/
- public ZipEightByteInteger(long value) {
+ public ZipEightByteInteger(final long value) {
this(BigInteger.valueOf(value));
}
@@ -79,7 +79,7 @@ public final class ZipEightByteInteger implements Serializable {
* Create instance from a number.
* @param value the BigInteger to store as a ZipEightByteInteger
*/
- public ZipEightByteInteger(BigInteger value) {
+ public ZipEightByteInteger(final BigInteger value) {
this.value = value;
}
@@ -87,7 +87,7 @@ public final class ZipEightByteInteger implements Serializable {
* Create instance from bytes.
* @param bytes the bytes to store as a ZipEightByteInteger
*/
- public ZipEightByteInteger (byte[] bytes) {
+ public ZipEightByteInteger (final byte[] bytes) {
this(bytes, 0);
}
@@ -96,7 +96,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param bytes the bytes to store as a ZipEightByteInteger
* @param offset the offset to start
*/
- public ZipEightByteInteger (byte[] bytes, int offset) {
+ public ZipEightByteInteger (final byte[] bytes, final int offset) {
value = ZipEightByteInteger.getValue(bytes, offset);
}
@@ -129,7 +129,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param value the value to convert
* @return value as eight bytes in big endian byte order
*/
- public static byte[] getBytes(long value) {
+ public static byte[] getBytes(final long value) {
return getBytes(BigInteger.valueOf(value));
}
@@ -138,7 +138,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param value the value to convert
* @return value as eight bytes in big endian byte order
*/
- public static byte[] getBytes(BigInteger value) {
+ public static byte[] getBytes(final BigInteger value) {
byte[] result = new byte[8];
long val = value.longValue();
result[0] = (byte) ((val & BYTE_MASK));
@@ -162,7 +162,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param offset the offset to start
* @return the corresponding Java long value
*/
- public static long getLongValue(byte[] bytes, int offset) {
+ public static long getLongValue(final byte[] bytes, final int offset) {
return getValue(bytes, offset).longValue();
}
@@ -173,7 +173,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param offset the offset to start
* @return the corresponding Java BigInteger value
*/
- public static BigInteger getValue(byte[] bytes, int offset) {
+ public static BigInteger getValue(final byte[] bytes, final int offset) {
long value = ((long) bytes[offset + BYTE_7] << BYTE_7_SHIFT) & BYTE_7_MASK;
value += ((long) bytes[offset + BYTE_6] << BYTE_6_SHIFT) & BYTE_6_MASK;
value += ((long) bytes[offset + BYTE_5] << BYTE_5_SHIFT) & BYTE_5_MASK;
@@ -192,7 +192,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param bytes the array of bytes
* @return the corresponding Java long value
*/
- public static long getLongValue(byte[] bytes) {
+ public static long getLongValue(final byte[] bytes) {
return getLongValue(bytes, 0);
}
@@ -201,7 +201,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param bytes the array of bytes
* @return the corresponding Java BigInteger value
*/
- public static BigInteger getValue(byte[] bytes) {
+ public static BigInteger getValue(final byte[] bytes) {
return getValue(bytes, 0);
}
@@ -211,7 +211,7 @@ public final class ZipEightByteInteger implements Serializable {
* @return true if the objects are equal
*/
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o == null || !(o instanceof ZipEightByteInteger)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
index a4f0f80..63af448 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
@@ -49,7 +49,7 @@ public abstract class ZipEncodingHelper {
*
* @see Simple8BitZipEncoding#Simple8BitZipEncoding(char[])
*/
- SimpleEncodingHolder(char [] highChars) {
+ SimpleEncodingHolder(final char [] highChars) {
this.highChars = highChars;
}
@@ -149,7 +149,7 @@ public abstract class ZipEncodingHelper {
* of <code>r</code>.
*
*/
- static ByteBuffer growBuffer(ByteBuffer b, int newCapacity) {
+ static ByteBuffer growBuffer(final ByteBuffer b, final int newCapacity) {
b.limit(b.position());
b.rewind();
@@ -178,7 +178,7 @@ public abstract class ZipEncodingHelper {
* @param bb The byte buffer to write to.
* @param c The character to write.
*/
- static void appendSurrogate(ByteBuffer bb, char c) {
+ static void appendSurrogate(final ByteBuffer bb, final char c) {
bb.put((byte) '%');
bb.put((byte) 'U');
@@ -207,7 +207,7 @@ public abstract class ZipEncodingHelper {
* the platform's default encoding.
* @return A zip encoding for the given encoding name.
*/
- public static ZipEncoding getZipEncoding(String name) {
+ public static ZipEncoding getZipEncoding(final String name) {
// fallback encoding is good enough for UTF-8.
if (isUTF8(name)) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
index 95e8c4c..36fa63b 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
@@ -150,7 +150,7 @@ public class ZipFile implements Closeable {
*
* @throws IOException if an error occurs while reading the file.
*/
- public ZipFile(File f) throws IOException {
+ public ZipFile(final File f) throws IOException {
this(f, ZipEncodingHelper.UTF8);
}
@@ -161,7 +161,7 @@ public class ZipFile implements Closeable {
*
* @throws IOException if an error occurs while reading the file.
*/
- public ZipFile(String name) throws IOException {
+ public ZipFile(final String name) throws IOException {
this(new File(name), ZipEncodingHelper.UTF8);
}
@@ -175,7 +175,7 @@ public class ZipFile implements Closeable {
*
* @throws IOException if an error occurs while reading the file.
*/
- public ZipFile(String name, String encoding) throws IOException {
+ public ZipFile(final String name, final String encoding) throws IOException {
this(new File(name), encoding, true);
}
@@ -189,7 +189,7 @@ public class ZipFile implements Closeable {
*
* @throws IOException if an error occurs while reading the file.
*/
- public ZipFile(File f, String encoding) throws IOException {
+ public ZipFile(final File f, final String encoding) throws IOException {
this(f, encoding, true);
}
@@ -205,7 +205,7 @@ public class ZipFile implements Closeable {
*
* @throws IOException if an error occurs while reading the file.
*/
- public ZipFile(File f, String encoding, boolean useUnicodeExtraFields)
+ public ZipFile(final File f, final String encoding, final boolean useUnicodeExtraFields)
throws IOException {
this.archiveName = f.getAbsolutePath();
this.encoding = encoding;
@@ -254,7 +254,7 @@ public class ZipFile implements Closeable {
* on a null parameter
* @param zipfile file to close, can be null
*/
- public static void closeQuietly(ZipFile zipfile) {
+ public static void closeQuietly(final ZipFile zipfile) {
IOUtils.closeQuietly(zipfile);
}
@@ -298,7 +298,7 @@ public class ZipFile implements Closeable {
* @return the ZipArchiveEntry corresponding to the given name - or
* {@code null} if not present.
*/
- public ZipArchiveEntry getEntry(String name) {
+ public ZipArchiveEntry getEntry(final String name) {
LinkedList<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
return entriesOfThatName != null ? entriesOfThatName.getFirst() : null;
}
@@ -312,7 +312,7 @@ public class ZipFile implements Closeable {
* given name
* @since 1.6
*/
- public Iterable<ZipArchiveEntry> getEntries(String name) {
+ public Iterable<ZipArchiveEntry> getEntries(final String name) {
List<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
return entriesOfThatName != null ? entriesOfThatName
: Collections.<ZipArchiveEntry>emptyList();
@@ -327,7 +327,7 @@ public class ZipFile implements Closeable {
* given name
* @since 1.6
*/
- public Iterable<ZipArchiveEntry> getEntriesInPhysicalOrder(String name) {
+ public Iterable<ZipArchiveEntry> getEntriesInPhysicalOrder(final String name) {
ZipArchiveEntry[] entriesOfThatName = new ZipArchiveEntry[0];
if (nameMap.containsKey(name)) {
entriesOfThatName = nameMap.get(name).toArray(entriesOfThatName);
@@ -345,7 +345,7 @@ public class ZipFile implements Closeable {
* @param ze the entry
* @return whether this class is able to read the given entry.
*/
- public boolean canReadEntryData(ZipArchiveEntry ze) {
+ public boolean canReadEntryData(final ZipArchiveEntry ze) {
return ZipUtil.canHandleEntryData(ze);
}
@@ -359,7 +359,7 @@ public class ZipFile implements Closeable {
* @return The raw input stream containing (possibly) compressed data.
* @since 1.11
*/
- public InputStream getRawInputStream(ZipArchiveEntry ze) {
+ public InputStream getRawInputStream(final ZipArchiveEntry ze) {
if (!(ze instanceof Entry)) {
return null;
}
@@ -378,7 +378,7 @@ public class ZipFile implements Closeable {
* @param predicate A predicate that selects which entries to write
* @throws IOException on error
*/
- public void copyRawEntries(ZipArchiveOutputStream target, ZipArchiveEntryPredicate predicate)
+ public void copyRawEntries(final ZipArchiveOutputStream target, final ZipArchiveEntryPredicate predicate)
throws IOException {
Enumeration<ZipArchiveEntry> src = getEntriesInPhysicalOrder();
while (src.hasMoreElements()) {
@@ -397,7 +397,7 @@ public class ZipFile implements Closeable {
* @throws IOException if unable to create an input stream from the zipentry
* @throws ZipException if the zipentry uses an unsupported feature
*/
- public InputStream getInputStream(ZipArchiveEntry ze)
+ public InputStream getInputStream(final ZipArchiveEntry ze)
throws IOException, ZipException {
if (!(ze instanceof Entry)) {
return null;
@@ -464,7 +464,7 @@ public class ZipFile implements Closeable {
* @throws IOException problem with content's input stream
* @since 1.5
*/
- public String getUnixSymlink(ZipArchiveEntry entry) throws IOException {
+ public String getUnixSymlink(final ZipArchiveEntry entry) throws IOException {
if (entry != null && entry.isUnixSymlink()) {
InputStream in = null;
try {
@@ -567,7 +567,7 @@ public class ZipFile implements Closeable {
* added to this map.
*/
private void
- readCentralDirectoryEntry(Map<ZipArchiveEntry, NameAndComment> noUTF8Flag)
+ readCentralDirectoryEntry(final Map<ZipArchiveEntry, NameAndComment> noUTF8Flag)
throws IOException {
archive.readFully(CFH_BUF);
int off = 0;
@@ -662,9 +662,9 @@ public class ZipFile implements Closeable {
* even if they are never used - and here a field with only one
* size would be invalid.</p>
*/
- private void setSizesAndOffsetFromZip64Extra(ZipArchiveEntry ze,
- OffsetEntry offset,
- int diskStart)
+ private void setSizesAndOffsetFromZip64Extra(final ZipArchiveEntry ze,
+ final OffsetEntry offset,
+ final int diskStart)
throws IOException {
Zip64ExtendedInformationExtraField z64 =
(Zip64ExtendedInformationExtraField)
@@ -877,9 +877,9 @@ public class ZipFile implements Closeable {
* for the given signature, positions the RandomaccessFile right
* at the signature if it has been found.
*/
- private boolean tryToLocateSignature(long minDistanceFromEnd,
- long maxDistanceFromEnd,
- byte[] sig) throws IOException {
+ private boolean tryToLocateSignature(final long minDistanceFromEnd,
+ final long maxDistanceFromEnd,
+ final byte[] sig) throws IOException {
boolean found = false;
long off = archive.length() - minDistanceFromEnd;
final long stopSearching =
@@ -949,7 +949,7 @@ public class ZipFile implements Closeable {
* <p>Also records the offsets for the data to read from the
* entries.</p>
*/
- private void resolveLocalFileHeaderData(Map<ZipArchiveEntry, NameAndComment>
+ private void resolveLocalFileHeaderData(final Map<ZipArchiveEntry, NameAndComment>
entriesWithoutUTF8Flag)
throws IOException {
for (ZipArchiveEntry zipArchiveEntry : entries) {
@@ -1014,7 +1014,7 @@ public class ZipFile implements Closeable {
private long loc;
private boolean addDummyByte = false;
- BoundedInputStream(long start, long remaining) {
+ BoundedInputStream(final long start, final long remaining) {
this.remaining = remaining;
loc = start;
}
@@ -1035,7 +1035,7 @@ public class ZipFile implements Closeable {
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, int len) throws IOException {
if (remaining <= 0) {
if (addDummyByte) {
addDummyByte = false;
@@ -1076,7 +1076,7 @@ public class ZipFile implements Closeable {
private static final class NameAndComment {
private final byte[] name;
private final byte[] comment;
- private NameAndComment(byte[] name, byte[] comment) {
+ private NameAndComment(final byte[] name, final byte[] comment) {
this.name = name;
this.comment = comment;
}
@@ -1093,7 +1093,7 @@ public class ZipFile implements Closeable {
private final Comparator<ZipArchiveEntry> OFFSET_COMPARATOR =
new Comparator<ZipArchiveEntry>() {
@Override
- public int compare(ZipArchiveEntry e1, ZipArchiveEntry e2) {
+ public int compare(final ZipArchiveEntry e1, final ZipArchiveEntry e2) {
if (e1 == e2) {
return 0;
}
@@ -1119,7 +1119,7 @@ public class ZipFile implements Closeable {
private final OffsetEntry offsetEntry;
- Entry(OffsetEntry offset) {
+ Entry(final OffsetEntry offset) {
this.offsetEntry = offset;
}
@@ -1134,7 +1134,7 @@ public class ZipFile implements Closeable {
}
@Override
- public boolean equals(Object other) {
+ public boolean equals(final Object other) {
if (super.equals(other)) {
// super.equals would return false if other were not an Entry
Entry otherEntry = (Entry) other;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
index bf717fc..3b2e278 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
@@ -90,7 +90,7 @@ public final class ZipLong implements Cloneable, Serializable {
* Create instance from a number.
* @param value the long to store as a ZipLong
*/
- public ZipLong(long value) {
+ public ZipLong(final long value) {
this.value = value;
}
@@ -98,7 +98,7 @@ public final class ZipLong implements Cloneable, Serializable {
* Create instance from bytes.
* @param bytes the bytes to store as a ZipLong
*/
- public ZipLong (byte[] bytes) {
+ public ZipLong (final byte[] bytes) {
this(bytes, 0);
}
@@ -107,7 +107,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @param bytes the bytes to store as a ZipLong
* @param offset the offset to start
*/
- public ZipLong (byte[] bytes, int offset) {
+ public ZipLong (final byte[] bytes, final int offset) {
value = ZipLong.getValue(bytes, offset);
}
@@ -132,7 +132,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @param value the value to convert
* @return value as four bytes in big endian byte order
*/
- public static byte[] getBytes(long value) {
+ public static byte[] getBytes(final long value) {
byte[] result = new byte[WORD];
putLong(value, result, 0);
return result;
@@ -147,14 +147,14 @@ public final class ZipLong implements Cloneable, Serializable {
* must be non-negative and no larger than <tt>buf.length-4</tt>
*/
- public static void putLong(long value, byte[] buf, int offset) {
+ public static void putLong(final long value, final byte[] buf, int offset) {
buf[offset++] = (byte) ((value & BYTE_MASK));
buf[offset++] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
buf[offset++] = (byte) ((value & BYTE_2_MASK) >> BYTE_2_SHIFT);
buf[offset] = (byte) ((value & BYTE_3_MASK) >> BYTE_3_SHIFT);
}
- public void putLong(byte[] buf, int offset) {
+ public void putLong(final byte[] buf, final int offset) {
putLong(value, buf, offset);
}
@@ -164,7 +164,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @param offset the offset to start
* @return the corresponding Java long value
*/
- public static long getValue(byte[] bytes, int offset) {
+ public static long getValue(final byte[] bytes, final int offset) {
long value = (bytes[offset + BYTE_3] << BYTE_3_SHIFT) & BYTE_3_MASK;
value += (bytes[offset + BYTE_2] << BYTE_2_SHIFT) & BYTE_2_MASK;
value += (bytes[offset + BYTE_1] << BYTE_1_SHIFT) & BYTE_1_MASK;
@@ -177,7 +177,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @param bytes the array of bytes
* @return the corresponding Java long value
*/
- public static long getValue(byte[] bytes) {
+ public static long getValue(final byte[] bytes) {
return getValue(bytes, 0);
}
@@ -187,7 +187,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @return true if the objects are equal
*/
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o == null || !(o instanceof ZipLong)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
index efe59e4..8848370 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
@@ -187,7 +187,7 @@ public enum ZipMethod {
/**
* private constructor for enum style class.
*/
- ZipMethod(int code) {
+ ZipMethod(final int code) {
this.code = code;
}
@@ -210,7 +210,7 @@ public enum ZipMethod {
* @return the {@link ZipMethod} for the given code or null if the
* method is not known.
*/
- public static ZipMethod getMethodByCode(int code) {
+ public static ZipMethod getMethodByCode(final int code) {
return codeToEnum.get(code);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
index 53d6c98..39f5274 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
@@ -38,7 +38,7 @@ public final class ZipShort implements Cloneable, Serializable {
* Create instance from a number.
* @param value the int to store as a ZipShort
*/
- public ZipShort (int value) {
+ public ZipShort (final int value) {
this.value = value;
}
@@ -46,7 +46,7 @@ public final class ZipShort implements Cloneable, Serializable {
* Create instance from bytes.
* @param bytes the bytes to store as a ZipShort
*/
- public ZipShort (byte[] bytes) {
+ public ZipShort (final byte[] bytes) {
this(bytes, 0);
}
@@ -55,7 +55,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @param bytes the bytes to store as a ZipShort
* @param offset the offset to start
*/
- public ZipShort (byte[] bytes, int offset) {
+ public ZipShort (final byte[] bytes, final int offset) {
value = ZipShort.getValue(bytes, offset);
}
@@ -83,7 +83,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @param value the Java int to convert to bytes
* @return the converted int as a byte array in big endian byte order
*/
- public static byte[] getBytes(int value) {
+ public static byte[] getBytes(final int value) {
byte[] result = new byte[2];
putShort(value, result, 0);
return result;
@@ -97,7 +97,7 @@ public final class ZipShort implements Cloneable, Serializable {
* The offset within the output buffer of the first byte to be written.
* must be non-negative and no larger than <tt>buf.length-2</tt>
*/
- public static void putShort(int value, byte[] buf, int offset) {
+ public static void putShort(final int value, final byte[] buf, final int offset) {
buf[offset] = (byte) (value & BYTE_MASK);
buf[offset+1] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
}
@@ -108,7 +108,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @param offset the offset to start
* @return the corresponding java int value
*/
- public static int getValue(byte[] bytes, int offset) {
+ public static int getValue(final byte[] bytes, final int offset) {
int value = (bytes[offset + 1] << BYTE_1_SHIFT) & BYTE_1_MASK;
value += (bytes[offset] & BYTE_MASK);
return value;
@@ -119,7 +119,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @param bytes the array of bytes
* @return the corresponding java int value
*/
- public static int getValue(byte[] bytes) {
+ public static int getValue(final byte[] bytes) {
return getValue(bytes, 0);
}
@@ -129,7 +129,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @return true if the objects are equal
*/
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o == null || !(o instanceof ZipShort)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
index 757967d..847678f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
@@ -39,7 +39,7 @@ public abstract class ZipUtil {
* @param time the <code>Date</code> to convert
* @return the date as a <code>ZipLong</code>
*/
- public static ZipLong toDosTime(Date time) {
+ public static ZipLong toDosTime(final Date time) {
return new ZipLong(toDosTime(time.getTime()));
}
@@ -50,7 +50,7 @@ public abstract class ZipUtil {
* @param t number of milliseconds since the epoch
* @return the date as a byte array
*/
- public static byte[] toDosTime(long t) {
+ public static byte[] toDosTime(final long t) {
byte[] result = new byte[4];
toDosTime(t, result, 0);
return result;
@@ -66,11 +66,11 @@ public abstract class ZipUtil {
* The offset within the output buffer of the first byte to be written.
* must be non-negative and no larger than <tt>buf.length-4</tt>
*/
- public static void toDosTime(long t, byte[] buf, int offset) {
+ public static void toDosTime(final long t, final byte[] buf, final int offset) {
toDosTime(Calendar.getInstance(), t, buf, offset);
}
- static void toDosTime(Calendar c, long t, byte[] buf, int offset) {
+ static void toDosTime(final Calendar c, final long t, final byte[] buf, final int offset) {
c.setTimeInMillis(t);
int year = c.get(Calendar.YEAR);
@@ -96,7 +96,7 @@ public abstract class ZipUtil {
* @param i the value to treat as unsigned int.
* @return the unsigned int as a long.
*/
- public static long adjustToLong(int i) {
+ public static long adjustToLong(final int i) {
if (i < 0) {
return 2 * ((long) Integer.MAX_VALUE) + 2 + i;
}
@@ -131,7 +131,7 @@ public abstract class ZipUtil {
* @param big BigInteger to convert.
* @return long representation of the BigInteger.
*/
- static long bigToLong(BigInteger big) {
+ static long bigToLong(final BigInteger big) {
if (big.bitLength() <= 63) { // bitLength() doesn't count the sign bit.
return big.longValue();
}
@@ -168,7 +168,7 @@ public abstract class ZipUtil {
* @return int representation of the provided byte
* @since 1.5
*/
- public static int signedByteToUnsignedInt(byte b) {
+ public static int signedByteToUnsignedInt(final byte b) {
if (b >= 0) {
return b;
}
@@ -183,7 +183,7 @@ public abstract class ZipUtil {
* @throws IllegalArgumentException if the provided integer is not inside the range [0,255].
* @since 1.5
*/
- public static byte unsignedIntToSignedByte(int i) {
+ public static byte unsignedIntToSignedByte(final int i) {
if (i > 255 || i < 0) {
throw new IllegalArgumentException("Can only convert non-negative integers between [0,255] to byte: [" + i + "]");
}
@@ -199,7 +199,7 @@ public abstract class ZipUtil {
* @param zipDosTime contains the stored DOS time.
* @return a Date instance corresponding to the given time.
*/
- public static Date fromDosTime(ZipLong zipDosTime) {
+ public static Date fromDosTime(final ZipLong zipDosTime) {
long dosTime = zipDosTime.getValue();
return new Date(dosToJavaTime(dosTime));
}
@@ -210,7 +210,7 @@ public abstract class ZipUtil {
* @param dosTime time to convert
* @return converted time
*/
- public static long dosToJavaTime(long dosTime) {
+ public static long dosToJavaTime(final long dosTime) {
Calendar cal = Calendar.getInstance();
// CheckStyle:MagicNumberCheck OFF - no point
cal.set(Calendar.YEAR, (int) ((dosTime >> 25) & 0x7f) + 1980);
@@ -229,9 +229,9 @@ public abstract class ZipUtil {
* names/comments match those of the extra fields, transfer the
* known Unicode values from the extra field.
*/
- static void setNameAndCommentFromExtraFields(ZipArchiveEntry ze,
- byte[] originalNameBytes,
- byte[] commentBytes) {
+ static void setNameAndCommentFromExtraFields(final ZipArchiveEntry ze,
+ final byte[] originalNameBytes,
+ final byte[] commentBytes) {
UnicodePathExtraField name = (UnicodePathExtraField)
ze.getExtraField(UnicodePathExtraField.UPATH_ID);
String originalName = ze.getName();
@@ -260,8 +260,8 @@ public abstract class ZipUtil {
* instead.</p>
*/
private static
- String getUnicodeStringIfOriginalMatches(AbstractUnicodeExtraField f,
- byte[] orig) {
+ String getUnicodeStringIfOriginalMatches(final AbstractUnicodeExtraField f,
+ final byte[] orig) {
if (f != null) {
CRC32 crc32 = new CRC32();
crc32.update(orig);
@@ -287,7 +287,7 @@ public abstract class ZipUtil {
* Create a copy of the given array - or return null if the
* argument is null.
*/
- static byte[] copy(byte[] from) {
+ static byte[] copy(final byte[] from) {
if (from != null) {
byte[] to = new byte[from.length];
System.arraycopy(from, 0, to, 0, to.length);
@@ -295,7 +295,7 @@ public abstract class ZipUtil {
}
return null;
}
- static void copy(byte[] from, byte[] to, int offset) {
+ static void copy(final byte[] from, final byte[] to, final int offset) {
if (from != null) {
System.arraycopy(from, 0, to, offset, from.length);
}
@@ -305,7 +305,7 @@ public abstract class ZipUtil {
/**
* Whether this library is able to read or write the given entry.
*/
- static boolean canHandleEntryData(ZipArchiveEntry entry) {
+ static boolean canHandleEntryData(final ZipArchiveEntry entry) {
return supportsEncryptionOf(entry) && supportsMethodOf(entry);
}
@@ -315,7 +315,7 @@ public abstract class ZipUtil {
*
* @return true if the entry isn't encrypted at all
*/
- private static boolean supportsEncryptionOf(ZipArchiveEntry entry) {
+ private static boolean supportsEncryptionOf(final ZipArchiveEntry entry) {
return !entry.getGeneralPurposeBit().usesEncryption();
}
@@ -325,7 +325,7 @@ public abstract class ZipUtil {
*
* @return true if the compression method is STORED or DEFLATED
*/
- private static boolean supportsMethodOf(ZipArchiveEntry entry) {
+ private static boolean supportsMethodOf(final ZipArchiveEntry entry) {
return entry.getMethod() == ZipEntry.STORED
|| entry.getMethod() == ZipMethod.UNSHRINKING.getCode()
|| entry.getMethod() == ZipMethod.IMPLODING.getCode()
@@ -337,7 +337,7 @@ public abstract class ZipUtil {
* Checks whether the entry requires features not (yet) supported
* by the library and throws an exception if it does.
*/
- static void checkRequestedFeatures(ZipArchiveEntry ze)
+ static void checkRequestedFeatures(final ZipArchiveEntry ze)
throws UnsupportedZipFeatureException {
if (!supportsEncryptionOf(ze)) {
throw
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/changes/Change.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/Change.java b/src/main/java/org/apache/commons/compress/changes/Change.java
index c1b0a4c..8db217c 100644
--- a/src/main/java/org/apache/commons/compress/changes/Change.java
+++ b/src/main/java/org/apache/commons/compress/changes/Change.java
@@ -46,7 +46,7 @@ class Change {
* from the stream as argument.
* @param pFilename the filename of the file to delete
*/
- Change(final String pFilename, int type) {
+ Change(final String pFilename, final int type) {
if(pFilename == null) {
throw new NullPointerException();
}
@@ -63,7 +63,7 @@ class Change {
* @param pEntry the entry details
* @param pInput the InputStream for the entry data
*/
- Change(final ArchiveEntry pEntry, final InputStream pInput, boolean replace) {
+ Change(final ArchiveEntry pEntry, final InputStream pInput, final boolean replace) {
if(pEntry == null || pInput == null) {
throw new NullPointerException();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/ChangeSet.java b/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
index 72df166..7c899d0 100644
--- a/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
+++ b/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
@@ -90,7 +90,7 @@ public final class ChangeSet {
* @param pChange
* the change which should result in an addition
*/
- private void addAddition(Change pChange) {
+ private void addAddition(final Change pChange) {
if (Change.TYPE_ADD != pChange.type() ||
pChange.getInput() == null) {
return;
@@ -124,7 +124,7 @@ public final class ChangeSet {
* @param pChange
* the change which should result in a deletion
*/
- private void addDeletion(Change pChange) {
+ private void addDeletion(final Change pChange) {
if ((Change.TYPE_DELETE != pChange.type() &&
Change.TYPE_DELETE_DIR != pChange.type()) ||
pChange.targetFile() == null) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java b/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
index 865fc09..46891d3 100644
--- a/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
+++ b/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
@@ -67,7 +67,7 @@ public class ChangeSetPerformer {
* if an read/write error occurs
* @return the results of this operation
*/
- public ChangeSetResults perform(ArchiveInputStream in, ArchiveOutputStream out)
+ public ChangeSetResults perform(final ArchiveInputStream in, final ArchiveOutputStream out)
throws IOException {
return perform(new ArchiveInputStreamIterator(in), out);
}
@@ -88,7 +88,7 @@ public class ChangeSetPerformer {
* @return the results of this operation
* @since 1.5
*/
- public ChangeSetResults perform(ZipFile in, ArchiveOutputStream out)
+ public ChangeSetResults perform(final ZipFile in, final ArchiveOutputStream out)
throws IOException {
return perform(new ZipFileIterator(in), out);
}
@@ -108,8 +108,8 @@ public class ChangeSetPerformer {
* if an read/write error occurs
* @return the results of this operation
*/
- private ChangeSetResults perform(ArchiveEntryIterator entryIterator,
- ArchiveOutputStream out)
+ private ChangeSetResults perform(final ArchiveEntryIterator entryIterator,
+ final ArchiveOutputStream out)
throws IOException {
ChangeSetResults results = new ChangeSetResults();
@@ -184,7 +184,7 @@ public class ChangeSetPerformer {
* the entry to check
* @return true, if this entry has an deletion change later, false otherwise
*/
- private boolean isDeletedLater(Set<Change> workingSet, ArchiveEntry entry) {
+ private boolean isDeletedLater(final Set<Change> workingSet, final ArchiveEntry entry) {
String source = entry.getName();
if (!workingSet.isEmpty()) {
@@ -215,8 +215,8 @@ public class ChangeSetPerformer {
* @throws IOException
* if data cannot be read or written
*/
- private void copyStream(InputStream in, ArchiveOutputStream out,
- ArchiveEntry entry) throws IOException {
+ private void copyStream(final InputStream in, final ArchiveOutputStream out,
+ final ArchiveEntry entry) throws IOException {
out.putArchiveEntry(entry);
IOUtils.copy(in, out);
out.closeArchiveEntry();
@@ -241,7 +241,7 @@ public class ChangeSetPerformer {
implements ArchiveEntryIterator {
private final ArchiveInputStream in;
private ArchiveEntry next;
- ArchiveInputStreamIterator(ArchiveInputStream in) {
+ ArchiveInputStreamIterator(final ArchiveInputStream in) {
this.in = in;
}
@Override
@@ -263,7 +263,7 @@ public class ChangeSetPerformer {
private final ZipFile in;
private final Enumeration<ZipArchiveEntry> nestedEnum;
private ZipArchiveEntry current;
- ZipFileIterator(ZipFile in) {
+ ZipFileIterator(final ZipFile in) {
this.in = in;
nestedEnum = in.getEntriesInPhysicalOrder();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/changes/ChangeSetResults.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/ChangeSetResults.java b/src/main/java/org/apache/commons/compress/changes/ChangeSetResults.java
index d4f4cc2..e3e4d49 100644
--- a/src/main/java/org/apache/commons/compress/changes/ChangeSetResults.java
+++ b/src/main/java/org/apache/commons/compress/changes/ChangeSetResults.java
@@ -33,7 +33,7 @@ public class ChangeSetResults {
* Adds the filename of a recently deleted file to the result list.
* @param fileName the file which has been deleted
*/
- void deleted(String fileName) {
+ void deleted(final String fileName) {
deleted.add(fileName);
}
@@ -42,7 +42,7 @@ public class ChangeSetResults {
* copied from the source stream to the target stream.
* @param fileName the file name which has been added from the original stream
*/
- void addedFromStream(String fileName) {
+ void addedFromStream(final String fileName) {
addedFromStream.add(fileName);
}
@@ -51,7 +51,7 @@ public class ChangeSetResults {
* copied from the changeset to the target stream
* @param fileName the name of the file
*/
- void addedFromChangeSet(String fileName) {
+ void addedFromChangeSet(final String fileName) {
addedFromChangeSet.add(fileName);
}
@@ -84,7 +84,7 @@ public class ChangeSetResults {
* @param filename the filename to check
* @return true, if this filename already has been added
*/
- boolean hasBeenAdded(String filename) {
+ boolean hasBeenAdded(final String filename) {
if(addedFromChangeSet.contains(filename) || addedFromStream.contains(filename)) {
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/CompressorException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorException.java b/src/main/java/org/apache/commons/compress/compressors/CompressorException.java
index aea05b3..7c1a356 100644
--- a/src/main/java/org/apache/commons/compress/compressors/CompressorException.java
+++ b/src/main/java/org/apache/commons/compress/compressors/CompressorException.java
@@ -33,7 +33,7 @@ public class CompressorException extends Exception {
* @param message
* the detail message
*/
- public CompressorException(String message) {
+ public CompressorException(final String message) {
super(message);
}
@@ -45,7 +45,7 @@ public class CompressorException extends Exception {
* @param cause
* the cause
*/
- public CompressorException(String message, Throwable cause) {
+ public CompressorException(final String message, final Throwable cause) {
super(message, cause);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
index 52b161b..0b2be21 100644
--- a/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
@@ -31,7 +31,7 @@ public abstract class CompressorInputStream extends InputStream {
*
* @since 1.1
*/
- protected void count(int read) {
+ protected void count(final int read) {
count((long) read);
}
@@ -41,7 +41,7 @@ public abstract class CompressorInputStream extends InputStream {
*
* @param read the number of bytes read
*/
- protected void count(long read) {
+ protected void count(final long read) {
if (read != -1) {
bytesRead = bytesRead + read;
}
@@ -53,7 +53,7 @@ public abstract class CompressorInputStream extends InputStream {
* @param pushedBack the number of bytes pushed back.
* @since 1.7
*/
- protected void pushedBackBytes(long pushedBack) {
+ protected void pushedBackBytes(final long pushedBack) {
bytesRead -= pushedBack;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
index 8f374f7..8f7e057 100644
--- a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
+++ b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
@@ -160,7 +160,7 @@ public class CompressorStreamFactory {
* This setting applies to the gzip, bzip2 and xz formats only.
* @since 1.10
*/
- public CompressorStreamFactory(boolean decompressUntilEOF) {
+ public CompressorStreamFactory(final boolean decompressUntilEOF) {
this.decompressUntilEOF = Boolean.valueOf(decompressUntilEOF);
// Also copy to existing variable so can continue to use that as the current value
this.decompressConcatenated = decompressUntilEOF;
@@ -183,7 +183,7 @@ public class CompressorStreamFactory {
* was used to create the factory
*/
@Deprecated
- public void setDecompressConcatenated(boolean decompressConcatenated) {
+ public void setDecompressConcatenated(final boolean decompressConcatenated) {
if (this.decompressUntilEOF != null) {
throw new IllegalStateException("Cannot override the setting defined by the constructor");
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java b/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
index 6accafd..44735b5 100644
--- a/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
+++ b/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
@@ -88,8 +88,8 @@ public class FileNameUtil {
*
* @param defaultExtension the format's default extension like ".gz"
*/
- public FileNameUtil(Map<String, String> uncompressSuffix,
- String defaultExtension) {
+ public FileNameUtil(final Map<String, String> uncompressSuffix,
+ final String defaultExtension) {
this.uncompressSuffix = Collections.unmodifiableMap(uncompressSuffix);
int lc = Integer.MIN_VALUE, sc = Integer.MAX_VALUE;
int lu = Integer.MIN_VALUE, su = Integer.MAX_VALUE;
@@ -130,7 +130,7 @@ public class FileNameUtil {
* @return {@code true} if the filename has a common format suffix,
* {@code false} otherwise
*/
- public boolean isCompressedFilename(String filename) {
+ public boolean isCompressedFilename(final String filename) {
final String lower = filename.toLowerCase(Locale.ENGLISH);
final int n = lower.length();
for (int i = shortestCompressedSuffix;
@@ -155,7 +155,7 @@ public class FileNameUtil {
* @param filename name of a file
* @return name of the corresponding uncompressed file
*/
- public String getUncompressedFilename(String filename) {
+ public String getUncompressedFilename(final String filename) {
final String lower = filename.toLowerCase(Locale.ENGLISH);
final int n = lower.length();
for (int i = shortestCompressedSuffix;
@@ -179,7 +179,7 @@ public class FileNameUtil {
* @param filename name of a file
* @return name of the corresponding compressed file
*/
- public String getCompressedFilename(String filename) {
+ public String getCompressedFilename(final String filename) {
final String lower = filename.toLowerCase(Locale.ENGLISH);
final int n = lower.length();
for (int i = shortestUncompressedSuffix;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/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 b4c7d9d..9c7938a 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
@@ -227,7 +227,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
}
}
- private boolean init(boolean isFirstStream) throws IOException {
+ private boolean init(final boolean isFirstStream) throws IOException {
if (null == in) {
throw new IOException("No InputStream");
}
@@ -951,7 +951,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
// 4560782 byte
// ===============
- Data(int blockSize100k) {
+ Data(final int blockSize100k) {
this.ll8 = new byte[blockSize100k * BZip2Constants.BASEBLOCKSIZE];
}
@@ -962,7 +962,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
* I don't initialize it at construction time to avoid unneccessary
* memory allocation when compressing small files.
*/
- int[] initTT(int length) {
+ int[] initTT(final int length) {
int[] ttShadow = this.tt;
// tt.length should always be >= length, but theoretically
@@ -989,7 +989,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
*
* @since 1.1
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < 3) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
index 486ae8d..315c6fe 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
@@ -335,7 +335,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
* The length of the data which will be compressed by
* {@code BZip2CompressorOutputStream}.
*/
- public static int chooseBlockSize(long inputLength) {
+ public static int chooseBlockSize(final long inputLength) {
return (inputLength > 0) ? (int) Math
.min((inputLength / 132000) + 1, 9) : MAX_BLOCKSIZE;
}
@@ -1318,7 +1318,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
*/
int origPtr;
- Data(int blockSize100k) {
+ Data(final int blockSize100k) {
final int n = blockSize100k * BZip2Constants.BASEBLOCKSIZE;
this.block = new byte[(n + 1 + NUM_OVERSHOOT_BYTES)];
this.fmap = new int[n];
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
index e562835..2aed7e5 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
@@ -55,7 +55,7 @@ public abstract class BZip2Utils {
* @return {@code true} if the filename has a common bzip2 suffix,
* {@code false} otherwise
*/
- public static boolean isCompressedFilename(String filename) {
+ public static boolean isCompressedFilename(final String filename) {
return fileNameUtil.isCompressedFilename(filename);
}
@@ -72,7 +72,7 @@ public abstract class BZip2Utils {
* @param filename name of a file
* @return name of the corresponding uncompressed file
*/
- public static String getUncompressedFilename(String filename) {
+ public static String getUncompressedFilename(final String filename) {
return fileNameUtil.getUncompressedFilename(filename);
}
@@ -86,7 +86,7 @@ public abstract class BZip2Utils {
* @param filename name of a file
* @return name of the corresponding compressed file
*/
- public static String getCompressedFilename(String filename) {
+ public static String getCompressedFilename(final String filename) {
return fileNameUtil.getCompressedFilename(filename);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
index bafa9e5..ffe77d4 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
@@ -264,10 +264,10 @@ class BlockSort {
* @param lo lower boundary of the fmap-interval to be sorted
* @param hi upper boundary of the fmap-interval to be sorted
*/
- private void fallbackSimpleSort(int[] fmap,
- int[] eclass,
- int lo,
- int hi) {
+ private void fallbackSimpleSort(final int[] fmap,
+ final int[] eclass,
+ final int lo,
+ final int hi) {
if (lo == hi) {
return;
}
@@ -300,7 +300,7 @@ class BlockSort {
/**
* swaps two values in fmap
*/
- private void fswap(int[] fmap, int zz1, int zz2) {
+ private void fswap(final int[] fmap, final int zz1, final int zz2) {
int zztmp = fmap[zz1];
fmap[zz1] = fmap[zz2];
fmap[zz2] = zztmp;
@@ -309,23 +309,23 @@ class BlockSort {
/**
* swaps two intervals starting at yyp1 and yyp2 of length yyn inside fmap.
*/
- private void fvswap(int[] fmap, int yyp1, int yyp2, int yyn) {
+ private void fvswap(final int[] fmap, int yyp1, int yyp2, int yyn) {
while (yyn > 0) {
fswap(fmap, yyp1, yyp2);
yyp1++; yyp2++; yyn--;
}
}
- private int fmin(int a, int b) {
+ private int fmin(final int a, final int b) {
return a < b ? a : b;
}
- private void fpush(int sp, int lz, int hz) {
+ private void fpush(final int sp, final int lz, final int hz) {
stack_ll[sp] = lz;
stack_hh[sp] = hz;
}
- private int[] fpop(int sp) {
+ private int[] fpop(final int sp) {
return new int[] { stack_ll[sp], stack_hh[sp] };
}
@@ -339,10 +339,10 @@ class BlockSort {
* @param loSt lower boundary of the fmap-interval to be sorted
* @param hiSt upper boundary of the fmap-interval to be sorted
*/
- private void fallbackQSort3(int[] fmap,
- int[] eclass,
- int loSt,
- int hiSt) {
+ private void fallbackQSort3(final int[] fmap,
+ final int[] eclass,
+ final int loSt,
+ final int hiSt) {
int lo, unLo, ltLo, hi, unHi, gtHi, n;
long r = 0;
@@ -467,7 +467,7 @@ class BlockSort {
* @param nblock size of the block
* @param off offset of first byte to sort in block
*/
- final void fallbackSort(int[] fmap, byte[] block, int nblock) {
+ final void fallbackSort(final int[] fmap, final byte[] block, final int nblock) {
final int[] ftab = new int[257];
int H, i, j, k, l, r, cc, cc1;
int nNotDone;
@@ -780,7 +780,7 @@ class BlockSort {
Sedgewick and Jon L. Bentley.
--*/
- private static void vswap(int[] fmap, int p1, int p2, int n) {
+ private static void vswap(final int[] fmap, int p1, int p2, int n) {
n += p1;
while (p1 < n) {
int t = fmap[p1];
@@ -789,7 +789,7 @@ class BlockSort {
}
}
- private static byte med3(byte a, byte b, byte c) {
+ private static byte med3(final byte a, final byte b, final byte c) {
return (a < b) ? (b < c ? b : a < c ? c : a) : (b > c ? b : a > c ? c
: a);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
index ec0502b..6631e46 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
@@ -107,11 +107,11 @@ class CRC {
return globalCrc;
}
- void setGlobalCRC(int newCrc) {
+ void setGlobalCRC(final int newCrc) {
globalCrc = newCrc;
}
- void updateCRC(int inCh) {
+ void updateCRC(final int inCh) {
int temp = (globalCrc >> 24) ^ inCh;
if (temp < 0) {
temp = 256 + temp;
@@ -119,7 +119,7 @@ class CRC {
globalCrc = (globalCrc << 8) ^ CRC.crc32Table[temp];
}
- void updateCRC(int inCh, int repeat) {
+ void updateCRC(final int inCh, int repeat) {
int globalCrcShadow = this.globalCrc;
while (repeat-- > 0) {
int temp = (globalCrcShadow >> 24) ^ inCh;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/Rand.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/Rand.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/Rand.java
index 0c08d1f..5358b3a 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/Rand.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/Rand.java
@@ -85,7 +85,7 @@ final class Rand {
* @param i the index
* @return the random number
*/
- static int rNums(int i){
+ static int rNums(final int i){
return RNUMS[i];
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
index f7b8dd0..76a86d8 100644
--- a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
@@ -46,7 +46,7 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
* @param inputStream where to read the compressed data
*
*/
- public DeflateCompressorInputStream(InputStream inputStream) {
+ public DeflateCompressorInputStream(final InputStream inputStream) {
this(inputStream, new DeflateParameters());
}
@@ -57,8 +57,8 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
* @param inputStream where to read the compressed data
* @param parameters parameters
*/
- public DeflateCompressorInputStream(InputStream inputStream,
- DeflateParameters parameters) {
+ public DeflateCompressorInputStream(final InputStream inputStream,
+ final DeflateParameters parameters) {
inflater = new Inflater(!parameters.withZlibHeader());
in = new InflaterInputStream(inputStream, inflater);
}
@@ -73,7 +73,7 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
- public int read(byte[] buf, int off, int len) throws IOException {
+ public int read(final byte[] buf, final int off, final int len) throws IOException {
int ret = in.read(buf, off, len);
count(ret);
return ret;
@@ -81,7 +81,7 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
- public long skip(long n) throws IOException {
+ public long skip(final long n) throws IOException {
return in.skip(n);
}
@@ -114,7 +114,7 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
*
* @since 1.10
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
return length > 3 && signature[0] == MAGIC_1 && (
signature[1] == (byte) MAGIC_2a ||
signature[1] == (byte) MAGIC_2b ||
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
index 3e354d6..a315605 100644
--- a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
@@ -38,7 +38,7 @@ public class DeflateCompressorOutputStream extends CompressorOutputStream {
* @param outputStream the stream to wrap
* @throws IOException on error
*/
- public DeflateCompressorOutputStream(OutputStream outputStream) throws IOException {
+ public DeflateCompressorOutputStream(final OutputStream outputStream) throws IOException {
this(outputStream, new DeflateParameters());
}
@@ -48,19 +48,19 @@ public class DeflateCompressorOutputStream extends CompressorOutputStream {
* @param parameters the deflate parameters to apply
* @throws IOException on error
*/
- public DeflateCompressorOutputStream(OutputStream outputStream,
- DeflateParameters parameters) throws IOException {
+ public DeflateCompressorOutputStream(final OutputStream outputStream,
+ final DeflateParameters parameters) throws IOException {
this.deflater = new Deflater(parameters.getCompressionLevel(), !parameters.withZlibHeader());
this.out = new DeflaterOutputStream(outputStream, deflater);
}
@Override
- public void write(int b) throws IOException {
+ public void write(final int b) throws IOException {
out.write(b);
}
@Override
- public void write(byte[] buf, int off, int len) throws IOException {
+ public void write(final byte[] buf, final int off, final int len) throws IOException {
out.write(buf, off, len);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
index 1d32f7e..7679942 100644
--- a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
+++ b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
@@ -47,7 +47,7 @@ public class DeflateParameters {
*
* @param zlibHeader true if zlib header shall be written
*/
- public void setWithZlibHeader(boolean zlibHeader) {
+ public void setWithZlibHeader(final boolean zlibHeader) {
this.zlibHeader = zlibHeader;
}
@@ -69,7 +69,7 @@ public class DeflateParameters {
* @see Deflater#DEFAULT_COMPRESSION
* @see Deflater#BEST_COMPRESSION
*/
- public void setCompressionLevel(int compressionLevel) {
+ public void setCompressionLevel(final int compressionLevel) {
if (compressionLevel < -1 || compressionLevel > 9) {
throw new IllegalArgumentException("Invalid Deflate compression level: " + compressionLevel);
}
[29/46] commons-compress git commit: Add final modifier to method
parameters.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
index 4d0e85b..af0e4fd 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
@@ -143,15 +143,15 @@ public class TarArchiveEntryTest implements TarConstants {
assertEquals("/foo", t.getName());
}
- private void assertGnuMagic(TarArchiveEntry t) {
+ private void assertGnuMagic(final TarArchiveEntry t) {
assertEquals(MAGIC_GNU + VERSION_GNU_SPACE, readMagic(t));
}
- private void assertPosixMagic(TarArchiveEntry t) {
+ private void assertPosixMagic(final TarArchiveEntry t) {
assertEquals(MAGIC_POSIX + VERSION_POSIX, readMagic(t));
}
- private String readMagic(TarArchiveEntry t) {
+ private String readMagic(final TarArchiveEntry t) {
byte[] buf = new byte[512];
t.writeEntryHeader(buf);
return new String(buf, MAGIC_OFFSET, MAGICLEN + VERSIONLEN);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
index 11232c6..1289c21 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
@@ -135,7 +135,7 @@ public class TarArchiveInputStreamTest {
datePriorToEpoch("preepoch-posix.tar");
}
- private void datePriorToEpoch(String archive) throws Exception {
+ private void datePriorToEpoch(final String archive) throws Exception {
TarArchiveInputStream in = null;
try {
in = new TarArchiveInputStream(new FileInputStream(getFile(archive)));
@@ -297,7 +297,7 @@ public class TarArchiveInputStreamTest {
}
}
- private TarArchiveInputStream getTestStream(String name) {
+ private TarArchiveInputStream getTestStream(final String name) {
return new TarArchiveInputStream(
TarArchiveInputStreamTest.class.getResourceAsStream(name));
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
index 3f80be9..3996bf4 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
@@ -194,7 +194,7 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
+ "0123\n", new String(data, 512, 101, CharsetNames.UTF_8));
}
- private byte[] writePaxHeader(Map<String, String> m) throws Exception {
+ private byte[] writePaxHeader(final Map<String, String> m) throws Exception {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII");
tos.writePaxHeaders(new TarArchiveEntry("x"), "foo", m);
@@ -375,7 +375,7 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
testRoundtripWith67CharFileName(TarArchiveOutputStream.LONGFILE_POSIX);
}
- private void testRoundtripWith67CharFileName(int mode) throws Exception {
+ private void testRoundtripWith67CharFileName(final int mode) throws Exception {
String n = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+ "AAAAAAA";
assertEquals(67, n.length());
@@ -454,7 +454,7 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
testWriteLongDirectoryName(TarArchiveOutputStream.LONGFILE_POSIX);
}
- private void testWriteLongDirectoryName(int mode) throws Exception {
+ private void testWriteLongDirectoryName(final int mode) throws Exception {
String n = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/";
@@ -584,7 +584,7 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
/**
* @see "https://issues.apache.org/jira/browse/COMPRESS-237"
*/
- private void testWriteLongLinkName(int mode) throws Exception {
+ private void testWriteLongLinkName(final int mode) throws Exception {
String linkname = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/test";
@@ -663,7 +663,7 @@ public class TarArchiveOutputStreamTest extends AbstractTestCase {
tarIn.close();
}
- private static byte[] createTarArchiveContainingOneDirectory(String fname, Date modificationDate) throws IOException {
+ private static byte[] createTarArchiveContainingOneDirectory(final String fname, final Date modificationDate) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
TarArchiveOutputStream tarOut = new TarArchiveOutputStream(baos, 1024);
tarOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/tar/TarLister.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarLister.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarLister.java
index 090bd77..590e5c3 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarLister.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarLister.java
@@ -33,7 +33,7 @@ import java.io.InputStream;
*/
public final class TarLister {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
if (args.length == 0) {
usage();
return;
@@ -63,7 +63,7 @@ public final class TarLister {
System.out.println("Parameters: archive-name [encoding]");
}
- private static void log(TarArchiveEntry ae) {
+ private static void log(final TarArchiveEntry ae) {
StringBuilder sb = new StringBuilder(Integer.toOctalString(ae.getMode()))
.append(" ");
String name = ae.getUserName();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
index ed77194..e0649ac 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
@@ -155,7 +155,7 @@ public class TarUtilsTest {
checkRoundTripOctalOrBinary(Long.MIN_VALUE + 1, 12);
}
- private void testRoundTripOctalOrBinary(int length) {
+ private void testRoundTripOctalOrBinary(final int length) {
checkRoundTripOctalOrBinary(0, length);
checkRoundTripOctalOrBinary(1, length);
checkRoundTripOctalOrBinary(TarConstants.MAXSIZE, length); // will need binary format
@@ -217,7 +217,7 @@ public class TarUtilsTest {
assertEquals(s, TarUtils.parseName(buff, 0, len, enc));
}
- private void checkName(String string) {
+ private void checkName(final String string) {
byte buff[] = new byte[100];
int len = TarUtils.formatNameBytes(string, buff, 0, buff.length);
assertEquals(string, TarUtils.parseName(buff, 0, len));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/ExplodeSupportTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ExplodeSupportTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ExplodeSupportTest.java
index 4c8d39a..3e21be2 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ExplodeSupportTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ExplodeSupportTest.java
@@ -34,7 +34,7 @@ import org.junit.Test;
public class ExplodeSupportTest {
- private void testArchiveWithImplodeCompression(String filename, String entryName) throws IOException {
+ private void testArchiveWithImplodeCompression(final String filename, final String entryName) throws IOException {
ZipFile zip = new ZipFile(new File(filename));
ZipArchiveEntry entry = zip.getEntries().nextElement();
assertEquals("entry name", entryName, entry.getName());
@@ -66,7 +66,7 @@ public class ExplodeSupportTest {
testArchiveWithImplodeCompression("target/test-classes/moby-imploded.zip", "README");
}
- private void testZipStreamWithImplodeCompression(String filename, String entryName) throws IOException {
+ private void testZipStreamWithImplodeCompression(final String filename, final String entryName) throws IOException {
ZipArchiveInputStream zin = new ZipArchiveInputStream(new FileInputStream(new File(filename)));
ZipArchiveEntry entry = zin.getNextZipEntry();
assertEquals("entry name", entryName, entry.getName());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/Lister.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Lister.java b/src/test/java/org/apache/commons/compress/archivers/zip/Lister.java
index 2233b69..3e792af 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/Lister.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/Lister.java
@@ -46,7 +46,7 @@ public final class Lister {
String dir;
}
- public static void main(String[] args) throws IOException {
+ public static void main(final String[] args) throws IOException {
CommandLine cl = parse(args);
File f = new File(cl.archive);
if (!f.isFile()) {
@@ -94,12 +94,12 @@ public final class Lister {
}
}
- private static void list(ZipArchiveEntry entry) {
+ private static void list(final ZipArchiveEntry entry) {
System.out.println(entry.getName());
}
- private static void extract(String dir, ZipArchiveEntry entry,
- InputStream is) throws IOException {
+ private static void extract(final String dir, final ZipArchiveEntry entry,
+ final InputStream is) throws IOException {
File f = new File(dir, entry.getName());
if (!f.getParentFile().exists()) {
f.getParentFile().mkdirs();
@@ -115,7 +115,7 @@ public final class Lister {
}
}
- private static CommandLine parse(String[] args) {
+ private static CommandLine parse(final String[] args) {
CommandLine cl = new CommandLine();
boolean error = false;
for (int i = 0; i < args.length; i++) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
index f99b8fa..c4eabeb 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
@@ -95,7 +95,7 @@ public class ParallelScatterZipCreatorTest {
assertNotNull(zipCreator.getStatisticsMessage());
}
- private void removeEntriesFoundInZipFile(File result, Map<String, byte[]> entries) throws IOException {
+ private void removeEntriesFoundInZipFile(final File result, final Map<String, byte[]> entries) throws IOException {
ZipFile zf = new ZipFile(result);
Enumeration<ZipArchiveEntry> entriesInPhysicalOrder = zf.getEntriesInPhysicalOrder();
while (entriesInPhysicalOrder.hasMoreElements()){
@@ -108,7 +108,7 @@ public class ParallelScatterZipCreatorTest {
zf.close();
}
- private Map<String, byte[]> writeEntries(ParallelScatterZipCreator zipCreator) {
+ private Map<String, byte[]> writeEntries(final ParallelScatterZipCreator zipCreator) {
Map<String, byte[]> entries = new HashMap<String, byte[]>();
for (int i = 0; i < NUMITEMS; i++){
final byte[] payloadBytes = ("content" + i).getBytes();
@@ -123,7 +123,7 @@ public class ParallelScatterZipCreatorTest {
return entries;
}
- private Map<String, byte[]> writeEntriesAsCallable(ParallelScatterZipCreator zipCreator) {
+ private Map<String, byte[]> writeEntriesAsCallable(final ParallelScatterZipCreator zipCreator) {
Map<String, byte[]> entries = new HashMap<String, byte[]>();
for (int i = 0; i < NUMITEMS; i++){
final byte[] payloadBytes = ("content" + i).getBytes();
@@ -139,7 +139,7 @@ public class ParallelScatterZipCreatorTest {
return entries;
}
- private ZipArchiveEntry createZipArchiveEntry(Map<String, byte[]> entries, int i, byte[] payloadBytes) {
+ private ZipArchiveEntry createZipArchiveEntry(final Map<String, byte[]> entries, final int i, final byte[] payloadBytes) {
ZipArchiveEntry za = new ZipArchiveEntry( "file" + i);
entries.put( za.getName(), payloadBytes);
za.setMethod(ZipEntry.DEFLATED);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSample.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSample.java b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSample.java
index 7802137..deb7a7e 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSample.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSample.java
@@ -31,7 +31,7 @@ public class ScatterSample {
public ScatterSample() throws IOException {
}
- public void addEntry(ZipArchiveEntry zipArchiveEntry, InputStreamSupplier streamSupplier) throws IOException {
+ public void addEntry(final ZipArchiveEntry zipArchiveEntry, final InputStreamSupplier streamSupplier) throws IOException {
if (zipArchiveEntry.isDirectory() && !zipArchiveEntry.isUnixSymlink()) {
dirs.addArchiveEntry(ZipArchiveEntryRequest.createZipArchiveEntryRequest(zipArchiveEntry, streamSupplier));
} else {
@@ -39,7 +39,7 @@ public class ScatterSample {
}
}
- public void writeTo(ZipArchiveOutputStream zipArchiveOutputStream)
+ public void writeTo(final ZipArchiveOutputStream zipArchiveOutputStream)
throws IOException, ExecutionException, InterruptedException {
dirs.writeTo(zipArchiveOutputStream);
dirs.close();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
index 1d26789..8125576 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterSampleTest.java
@@ -40,7 +40,7 @@ public class ScatterSampleTest {
checkFile(result);
}
- private void createFile(File result) throws IOException, ExecutionException, InterruptedException {
+ private void createFile(final File result) throws IOException, ExecutionException, InterruptedException {
ScatterSample scatterSample = new ScatterSample();
ZipArchiveEntry archiveEntry = new ZipArchiveEntry("test1.xml");
archiveEntry.setMethod(ZipEntry.DEFLATED);
@@ -57,7 +57,7 @@ public class ScatterSampleTest {
zipArchiveOutputStream.close();
}
- private void checkFile(File result) throws IOException {
+ private void checkFile(final File result) throws IOException {
ZipFile zf = new ZipFile(result);
ZipArchiveEntry archiveEntry1 = zf.getEntries().nextElement();
assertEquals( "test1.xml", archiveEntry1.getName());
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
index c1a5294..27d1889 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
@@ -143,7 +143,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
}
}
- private void assertCanRead(ZipFile zf, String fileName) throws IOException {
+ private void assertCanRead(final ZipFile zf, final String fileName) throws IOException {
ZipArchiveEntry entry = zf.getEntry(fileName);
assertNotNull("Entry doesn't exist", entry);
InputStream is = zf.getInputStream(entry);
@@ -239,8 +239,8 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
}
}
- private static void testFileRoundtrip(String encoding, boolean withEFS,
- boolean withExplicitUnicodeExtra)
+ private static void testFileRoundtrip(final String encoding, final boolean withEFS,
+ final boolean withExplicitUnicodeExtra)
throws IOException {
File file = File.createTempFile(encoding + "-test", ".zip");
@@ -253,9 +253,9 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
}
}
- private static void createTestFile(File file, String encoding,
- boolean withEFS,
- boolean withExplicitUnicodeExtra)
+ private static void createTestFile(final File file, final String encoding,
+ final boolean withEFS,
+ final boolean withExplicitUnicodeExtra)
throws UnsupportedEncodingException, IOException {
ZipEncoding zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
@@ -333,7 +333,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
}
}
- private static void testFile(File file, String encoding)
+ private static void testFile(final File file, final String encoding)
throws IOException {
ZipFile zf = null;
try {
@@ -358,14 +358,14 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
}
}
- private static UnicodePathExtraField findUniCodePath(ZipArchiveEntry ze) {
+ private static UnicodePathExtraField findUniCodePath(final ZipArchiveEntry ze) {
return (UnicodePathExtraField)
ze.getExtraField(UnicodePathExtraField.UPATH_ID);
}
- private static void assertUnicodeName(ZipArchiveEntry ze,
- String expectedName,
- String encoding)
+ private static void assertUnicodeName(final ZipArchiveEntry ze,
+ final String expectedName,
+ final String encoding)
throws IOException {
if (!expectedName.equals(ze.getName())) {
UnicodePathExtraField ucpf = findUniCodePath(ze);
@@ -394,7 +394,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
}
- private static void assertRawNameOfAcsiiTxt(ZipArchiveEntry ze) {
+ private static void assertRawNameOfAcsiiTxt(final ZipArchiveEntry ze) {
byte[] b = ze.getRawName();
assertNotNull(b);
final int len = ASCII_TXT.length();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
index 8447669..17ec460 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
@@ -537,7 +537,7 @@ public class X5455_ExtendedTimestampTest {
}
}
- private static boolean isFlagSet(byte data, byte flag) { return (data & flag) == flag; }
+ private static boolean isFlagSet(final byte data, final byte flag) { return (data & flag) == flag; }
/**
* InfoZIP seems to adjust the time stored inside the LFH and CD
@@ -547,7 +547,7 @@ public class X5455_ExtendedTimestampTest {
* The archive read in {@link #testSampleFile} has been created
* with GMT-8 so we need to adjust for the difference.
*/
- private static Date adjustFromGMTToExpectedOffset(Date from) {
+ private static Date adjustFromGMTToExpectedOffset(final Date from) {
Calendar cal = Calendar.getInstance();
cal.setTime(from);
cal.add(Calendar.MILLISECOND, cal.get(Calendar.ZONE_OFFSET));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/X7875_NewUnixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/X7875_NewUnixTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/X7875_NewUnixTest.java
index 03326f1..db53171 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/X7875_NewUnixTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/X7875_NewUnixTest.java
@@ -133,7 +133,7 @@ public class X7875_NewUnixTest {
assertTrue(Arrays.equals(SEQUENCE6, trimTest(SEQUENCE6_LEADING_ZERO)));
}
- private static byte[] trimTest(byte[] b) { return X7875_NewUnix.trimLeadingZeroesForceMinLength(b); }
+ private static byte[] trimTest(final byte[] b) { return X7875_NewUnix.trimLeadingZeroesForceMinLength(b); }
@Test
public void testParseReparse() throws ZipException {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraFieldTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraFieldTest.java
index 07eb700..8e2f23b 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraFieldTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraFieldTest.java
@@ -212,7 +212,7 @@ public class Zip64ExtendedInformationExtraFieldTest {
assertNull(f.getDiskStartNumber());
}
- private static void checkSizes(byte[] b) {
+ private static void checkSizes(final byte[] b) {
assertEquals(0x78, b[0]);
assertEquals(0x56, b[1]);
assertEquals(0x34, b[2]);
@@ -231,7 +231,7 @@ public class Zip64ExtendedInformationExtraFieldTest {
assertEquals(0x00, b[15]);
}
- private static void checkOffset(byte[] b, int off) {
+ private static void checkOffset(final byte[] b, final int off) {
assertEquals(0x78, b[0 + off]);
assertEquals(0x56, b[1 + off]);
assertEquals(0x34, b[2 + off]);
@@ -242,7 +242,7 @@ public class Zip64ExtendedInformationExtraFieldTest {
assertEquals((byte) 0xAB, b[7 + off]);
}
- private static void checkDisk(byte[] b, int off) {
+ private static void checkDisk(final byte[] b, final int off) {
assertEquals(0x12, b[0 + off]);
assertEquals(0x00, b[1 + off]);
assertEquals(0x00, b[2 + off]);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
index 0dc521d..821329b 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
@@ -142,7 +142,7 @@ public class Zip64SupportIT {
}
}
- private static File write5GBZerosFile(String testName) throws Throwable {
+ private static File write5GBZerosFile(final String testName) throws Throwable {
File f = getTempFile(testName);
ZipArchiveOutputStream zos = new ZipArchiveOutputStream(f);
try {
@@ -205,7 +205,7 @@ public class Zip64SupportIT {
private static ZipOutputTest write100KFiles(final Zip64Mode mode) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
@@ -323,7 +323,7 @@ public class Zip64SupportIT {
private static final ZipOutputTest write100KFilesModeNever =
new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
try {
@@ -351,8 +351,8 @@ public class Zip64SupportIT {
withTemporaryArchive("readSelfGenerated100KFilesUsingZipFile()",
new ZipOutputTest() {
@Override
- public void test(File f,
- ZipArchiveOutputStream zos)
+ public void test(final File f,
+ final ZipArchiveOutputStream zos)
throws IOException {
write100KFilesToStream(zos);
read100KFilesUsingZipFileImpl(f);
@@ -376,7 +376,7 @@ public class Zip64SupportIT {
write3EntriesCreatingBigArchive(final Zip64Mode mode) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
@@ -490,7 +490,7 @@ public class Zip64SupportIT {
private static final ZipOutputTest write3EntriesCreatingBigArchiveModeNever =
new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
try {
@@ -522,8 +522,8 @@ public class Zip64SupportIT {
withTemporaryArchive("read3EntriesCreatingBigArchiveFileUsingZipFile",
new ZipOutputTest() {
@Override
- public void test(File f,
- ZipArchiveOutputStream zos)
+ public void test(final File f,
+ final ZipArchiveOutputStream zos)
throws IOException {
write3EntriesCreatingBigArchiveToStream(zos);
ZipFile zf = null;
@@ -577,7 +577,7 @@ public class Zip64SupportIT {
final Zip64Mode mode) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
@@ -759,7 +759,7 @@ public class Zip64SupportIT {
writeBigStoredEntryModeNever(final boolean knownSize) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
try {
@@ -817,8 +817,8 @@ public class Zip64SupportIT {
final Zip64Mode mode) {
return new ZipOutputTest() {
@Override
- public void test(File f,
- ZipArchiveOutputStream zos)
+ public void test(final File f,
+ final ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
@@ -1004,7 +1004,7 @@ public class Zip64SupportIT {
writeBigDeflatedEntryUnknownSizeToStream(final Zip64Mode mode) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
try {
if (mode != Zip64Mode.AsNeeded) {
@@ -1061,7 +1061,7 @@ public class Zip64SupportIT {
final Zip64Mode mode) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
@@ -1233,8 +1233,8 @@ public class Zip64SupportIT {
withTemporaryArchive("writeBigDeflatedEntryKnownSizeToStreamModeNever",
new ZipOutputTest() {
@Override
- public void test(File f,
- ZipArchiveOutputStream zos)
+ public void test(final File f,
+ final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
try {
@@ -1267,7 +1267,7 @@ public class Zip64SupportIT {
writeBigDeflatedEntryToFileModeNever(final boolean knownSize) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Never);
try {
@@ -1323,7 +1323,7 @@ public class Zip64SupportIT {
final Zip64Mode mode) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
@@ -1502,7 +1502,7 @@ public class Zip64SupportIT {
writeSmallStoredEntryModeAlways(final boolean knownSize) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Always);
byte[] buf = new byte[ONE_MILLION];
@@ -1665,7 +1665,7 @@ public class Zip64SupportIT {
final Zip64Mode mode) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
@@ -1838,7 +1838,7 @@ public class Zip64SupportIT {
writeSmallDeflatedEntryToStreamModeAlways(final boolean knownSize) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Always);
byte[] buf = new byte[ONE_MILLION];
@@ -2021,7 +2021,7 @@ public class Zip64SupportIT {
final Zip64Mode mode) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
if (mode != Zip64Mode.AsNeeded) {
zos.setUseZip64(mode);
@@ -2196,7 +2196,7 @@ public class Zip64SupportIT {
writeSmallDeflatedEntryToFileModeAlways(final boolean knownSize) {
return new ZipOutputTest() {
@Override
- public void test(File f, ZipArchiveOutputStream zos)
+ public void test(final File f, final ZipArchiveOutputStream zos)
throws IOException {
zos.setUseZip64(Zip64Mode.Always);
byte[] buf = new byte[ONE_MILLION];
@@ -2348,9 +2348,9 @@ public class Zip64SupportIT {
void test(File f, ZipArchiveOutputStream zos) throws IOException;
}
- private static void withTemporaryArchive(String testName,
- ZipOutputTest test,
- boolean useRandomAccessFile)
+ private static void withTemporaryArchive(final String testName,
+ final ZipOutputTest test,
+ final boolean useRandomAccessFile)
throws Throwable {
File f = getTempFile(testName);
BufferedOutputStream os = null;
@@ -2420,13 +2420,13 @@ public class Zip64SupportIT {
return getFile("100k_Files_PKZip.zip");
}
- private static File getTempFile(String testName) throws Throwable {
+ private static File getTempFile(final String testName) throws Throwable {
File f = File.createTempFile("commons-compress-" + testName, ".zip");
f.deleteOnExit();
return f;
}
- private static void read5GBOfZerosImpl(File f, String expectedName)
+ private static void read5GBOfZerosImpl(final File f, final String expectedName)
throws IOException {
FileInputStream fin = new FileInputStream(f);
ZipArchiveInputStream zin = null;
@@ -2461,8 +2461,8 @@ public class Zip64SupportIT {
}
}
- private static void read5GBOfZerosUsingZipFileImpl(File f,
- String expectedName)
+ private static void read5GBOfZerosUsingZipFileImpl(final File f,
+ final String expectedName)
throws IOException {
ZipFile zf = null;
try {
@@ -2500,7 +2500,7 @@ public class Zip64SupportIT {
}
}
- private static void read100KFilesImpl(File f) throws IOException {
+ private static void read100KFilesImpl(final File f) throws IOException {
FileInputStream fin = new FileInputStream(f);
ZipArchiveInputStream zin = null;
try {
@@ -2522,7 +2522,7 @@ public class Zip64SupportIT {
}
}
- private static void read100KFilesUsingZipFileImpl(File f)
+ private static void read100KFilesUsingZipFileImpl(final File f)
throws IOException {
ZipFile zf = null;
try {
@@ -2541,7 +2541,7 @@ public class Zip64SupportIT {
}
}
- private static long getLengthAndPositionAtCentralDirectory(RandomAccessFile a)
+ private static long getLengthAndPositionAtCentralDirectory(final RandomAccessFile a)
throws IOException {
final long end = a.length();
a.seek(end - 22 - 20);
@@ -2562,7 +2562,7 @@ public class Zip64SupportIT {
return end;
}
- private static long getLengthAndPositionAtCentralDirectory32(RandomAccessFile a, final long end)
+ private static long getLengthAndPositionAtCentralDirectory32(final RandomAccessFile a, final long end)
throws IOException {
a.seek(end - 22 + 16);
byte[] cdOffset = new byte[4];
@@ -2571,7 +2571,7 @@ public class Zip64SupportIT {
return end;
}
- private static void write100KFilesToStream(ZipArchiveOutputStream zos)
+ private static void write100KFilesToStream(final ZipArchiveOutputStream zos)
throws IOException {
for (int i = 0; i < ONE_HUNDRED_THOUSAND; i++) {
ZipArchiveEntry zae = new ZipArchiveEntry(String.valueOf(i));
@@ -2583,7 +2583,7 @@ public class Zip64SupportIT {
}
private static void
- write3EntriesCreatingBigArchiveToStream(ZipArchiveOutputStream zos)
+ write3EntriesCreatingBigArchiveToStream(final ZipArchiveOutputStream zos)
throws IOException {
byte[] buf = new byte[ONE_MILLION];
ZipArchiveEntry zae = null;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
index a2d204f..237adf2 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
@@ -112,7 +112,7 @@ public class ZipEncodingTest {
doSimpleEncodingTest("Cp1252",b);
}
- private static void assertEquals(byte[] expected, ByteBuffer actual) {
+ private static void assertEquals(final byte[] expected, final ByteBuffer actual) {
Assert.assertEquals(expected.length, actual.limit());
@@ -123,7 +123,7 @@ public class ZipEncodingTest {
}
- private void doSimpleEncodingTest(String name, byte[] testBytes)
+ private void doSimpleEncodingTest(final String name, byte[] testBytes)
throws IOException {
ZipEncoding enc = ZipEncodingHelper.getZipEncoding(name);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
index c9e512a..8a35b5d 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
@@ -311,9 +311,9 @@ public class ZipFileTest {
zf = new ZipFile(archive);
}
- private static void assertEntryName(ArrayList<ZipArchiveEntry> entries,
- int index,
- String expectedName) {
+ private static void assertEntryName(final ArrayList<ZipArchiveEntry> entries,
+ final int index,
+ final String expectedName) {
ZipArchiveEntry ze = entries.get(index);
assertEquals("src/main/java/org/apache/commons/compress/archivers/zip/"
+ expectedName + ".java",
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java b/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java
index ea3f115..b9edb0b 100644
--- a/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java
+++ b/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java
@@ -49,7 +49,7 @@ import org.junit.Test;
public final class ChangeSetTestCase extends AbstractTestCase {
// Delete a directory tree
- private void archiveListDeleteDir(String prefix){
+ private void archiveListDeleteDir(final String prefix){
Iterator<String> it = archiveList.iterator();
while(it.hasNext()){
String entry = it.next();
@@ -60,7 +60,7 @@ public final class ChangeSetTestCase extends AbstractTestCase {
}
// Delete a single file
- private void archiveListDelete(String prefix){
+ private void archiveListDelete(final String prefix){
Iterator<String> it = archiveList.iterator();
while(it.hasNext()){
String entry = it.next();
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java b/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java
index 218d913..eccbd5e 100644
--- a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java
@@ -59,7 +59,7 @@ public final class DetectCompressorTestCase {
final char[] entryNames; // expected entries ...
final CompressorStreamFactory factory; // ... when using this factory
final boolean concat; // expected value for decompressConcatenated
- TestData(String name, char[] names, CompressorStreamFactory factory, boolean concat) {
+ TestData(final String name, final char[] names, final CompressorStreamFactory factory, final boolean concat) {
this.fileName = name;
this.entryNames = names;
this.factory = factory;
@@ -160,14 +160,14 @@ public final class DetectCompressorTestCase {
}
}
- private CompressorInputStream getStreamFor(String resource)
+ private CompressorInputStream getStreamFor(final String resource)
throws CompressorException, IOException {
return factory.createCompressorInputStream(
new BufferedInputStream(new FileInputStream(
getFile(resource))));
}
- private CompressorInputStream getStreamFor(String resource, CompressorStreamFactory factory)
+ private CompressorInputStream getStreamFor(final String resource, final CompressorStreamFactory factory)
throws CompressorException, IOException {
return factory.createCompressorInputStream(
new BufferedInputStream(new FileInputStream(
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java b/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
index 3e15d52..67b5c82 100644
--- a/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/FramedSnappyTestCase.java
@@ -39,7 +39,7 @@ public final class FramedSnappyTestCase
public void testDefaultExtraction() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
@Override
- public CompressorInputStream wrap(InputStream is) throws IOException {
+ public CompressorInputStream wrap(final InputStream is) throws IOException {
return new FramedSnappyCompressorInputStream(is);
}
});
@@ -49,7 +49,7 @@ public final class FramedSnappyTestCase
public void testDefaultExtractionViaFactory() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
@Override
- public CompressorInputStream wrap(InputStream is) throws Exception {
+ public CompressorInputStream wrap(final InputStream is) throws Exception {
return new CompressorStreamFactory()
.createCompressorInputStream(CompressorStreamFactory.SNAPPY_FRAMED,
is);
@@ -61,13 +61,13 @@ public final class FramedSnappyTestCase
public void testDefaultExtractionViaFactoryAutodetection() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
@Override
- public CompressorInputStream wrap(InputStream is) throws Exception {
+ public CompressorInputStream wrap(final InputStream is) throws Exception {
return new CompressorStreamFactory().createCompressorInputStream(is);
}
});
}
- private void testUnarchive(StreamWrapper<CompressorInputStream> wrapper) throws Exception {
+ private void testUnarchive(final StreamWrapper<CompressorInputStream> wrapper) throws Exception {
final File input = getFile("bla.tar.sz");
final File output = new File(dir, "bla.tar");
final FileInputStream is = new FileInputStream(input);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java b/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
index 58d9f2f..5f133ab 100644
--- a/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
@@ -237,7 +237,7 @@ public final class GZipTestCase extends AbstractTestCase {
}
}
- private void testExtraFlags(int compressionLevel, int flag) throws Exception {
+ private void testExtraFlags(final int compressionLevel, final int flag) throws Exception {
FileInputStream fis = new FileInputStream(getFile("test3.xml"));
byte[] content;
try {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/compressors/LZMATestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/LZMATestCase.java b/src/test/java/org/apache/commons/compress/compressors/LZMATestCase.java
index 56b5c71..12381bd 100644
--- a/src/test/java/org/apache/commons/compress/compressors/LZMATestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/LZMATestCase.java
@@ -59,7 +59,7 @@ public final class LZMATestCase extends AbstractTestCase {
}
}
- private void copy(InputStream in, File output) throws IOException {
+ private void copy(final InputStream in, final File output) throws IOException {
FileOutputStream out = null;
try {
out = new FileOutputStream(output);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java b/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java
index c2dc7a1..3f30f0d 100644
--- a/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java
@@ -64,7 +64,7 @@ public final class Pack200TestCase extends AbstractTestCase {
jarUnarchiveAll(true, Pack200Strategy.TEMP_FILE);
}
- private void jarUnarchiveAll(boolean useFile, Pack200Strategy mode)
+ private void jarUnarchiveAll(final boolean useFile, final Pack200Strategy mode)
throws Exception {
final File input = getFile("bla.pack");
final InputStream is = useFile
@@ -106,7 +106,7 @@ public final class Pack200TestCase extends AbstractTestCase {
jarArchiveCreation(Pack200Strategy.TEMP_FILE);
}
- private void jarArchiveCreation(Pack200Strategy mode) throws Exception {
+ private void jarArchiveCreation(final Pack200Strategy mode) throws Exception {
final File output = new File(dir, "bla.pack");
final File file1 = getFile("test1.xml");
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/compressors/ZTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/ZTestCase.java b/src/test/java/org/apache/commons/compress/compressors/ZTestCase.java
index 92f01bd..f2804a9 100644
--- a/src/test/java/org/apache/commons/compress/compressors/ZTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/ZTestCase.java
@@ -38,7 +38,7 @@ public final class ZTestCase extends AbstractTestCase {
public void testZUnarchive() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
@Override
- public CompressorInputStream wrap(InputStream is) throws IOException {
+ public CompressorInputStream wrap(final InputStream is) throws IOException {
return new ZCompressorInputStream(is);
}
});
@@ -48,7 +48,7 @@ public final class ZTestCase extends AbstractTestCase {
public void testZUnarchiveViaFactory() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
@Override
- public CompressorInputStream wrap(InputStream is) throws Exception {
+ public CompressorInputStream wrap(final InputStream is) throws Exception {
return new CompressorStreamFactory()
.createCompressorInputStream(CompressorStreamFactory.Z, is);
}
@@ -59,7 +59,7 @@ public final class ZTestCase extends AbstractTestCase {
public void testZUnarchiveViaAutoDetection() throws Exception {
testUnarchive(new StreamWrapper<CompressorInputStream>() {
@Override
- public CompressorInputStream wrap(InputStream is) throws Exception {
+ public CompressorInputStream wrap(final InputStream is) throws Exception {
return new CompressorStreamFactory()
.createCompressorInputStream(new BufferedInputStream(is));
}
@@ -78,7 +78,7 @@ public final class ZTestCase extends AbstractTestCase {
4));
}
- private void testUnarchive(StreamWrapper<CompressorInputStream> wrapper) throws Exception {
+ private void testUnarchive(final StreamWrapper<CompressorInputStream> wrapper) throws Exception {
final File input = getFile("bla.tar.Z");
final File output = new File(dir, "bla.tar");
final InputStream is = new FileInputStream(input);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java b/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
index 8af9b0f..c69b2d0 100644
--- a/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
@@ -134,7 +134,7 @@ public class BlockSortTest {
return setUpFixture(FIXTURE);
}
- private void assertFixtureSorted(BZip2CompressorOutputStream.Data data) {
+ private void assertFixtureSorted(final BZip2CompressorOutputStream.Data data) {
assertFixtureSorted(data, FIXTURE, FIXTURE_BWT);
}
@@ -142,18 +142,18 @@ public class BlockSortTest {
return setUpFixture(FIXTURE2);
}
- private void assertFixture2Sorted(BZip2CompressorOutputStream.Data data) {
+ private void assertFixture2Sorted(final BZip2CompressorOutputStream.Data data) {
assertFixtureSorted(data, FIXTURE2, FIXTURE2_BWT);
}
- private DS setUpFixture(byte[] fixture) {
+ private DS setUpFixture(final byte[] fixture) {
BZip2CompressorOutputStream.Data data = new BZip2CompressorOutputStream.Data(1);
System.arraycopy(fixture, 0, data.block, 1, fixture.length);
return new DS(data, new BlockSort(data));
}
- private void assertFixtureSorted(BZip2CompressorOutputStream.Data data,
- byte[] fixture, byte[] fixtureBwt) {
+ private void assertFixtureSorted(final BZip2CompressorOutputStream.Data data,
+ final byte[] fixture, final byte[] fixtureBwt) {
assertEquals(fixture[fixture.length - 1], data.block[0]);
for (int i = 0; i < fixture.length; i++) {
assertEquals(fixtureBwt[i], data.block[data.fmap[i]]);
@@ -163,7 +163,7 @@ public class BlockSortTest {
private static class DS {
private final BZip2CompressorOutputStream.Data data;
private final BlockSort s;
- DS(BZip2CompressorOutputStream.Data data, BlockSort s) {
+ DS(final BZip2CompressorOutputStream.Data data, final BlockSort s) {
this.data = data;
this.s = s;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java b/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
index 6d4e900..cf06ade 100644
--- a/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
+++ b/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
@@ -102,7 +102,7 @@ public class PythonTruncatedBzip2Test {
}
}
- private static ReadableByteChannel makeBZ2C(InputStream source) throws IOException {
+ private static ReadableByteChannel makeBZ2C(final InputStream source) throws IOException {
BufferedInputStream bin = new BufferedInputStream(source);
BZip2CompressorInputStream bZin = new BZip2CompressorInputStream(bin, true);
@@ -111,7 +111,7 @@ public class PythonTruncatedBzip2Test {
// Helper method since Arrays#copyOfRange is Java 1.6+
// Does not check parameters, so may fail if they are incompatible
- private static byte[] copyOfRange(byte[] original, int from, int to) {
+ private static byte[] copyOfRange(final byte[] original, final int from, final int to) {
int length = to - from;
byte buff[] = new byte[length];
System.arraycopy(original, from, buff, 0, length);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
index 6a73c3b..ec4eb2f 100644
--- a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
@@ -170,13 +170,13 @@ public final class FramedSnappyCompressorInputStreamTest
testChecksumUnmasking(0xffffc757l);
}
- private void testChecksumUnmasking(long x) {
+ private void testChecksumUnmasking(final long x) {
assertEquals(Long.toHexString(x),
Long.toHexString(FramedSnappyCompressorInputStream
.unmask(mask(x))));
}
- private long mask(long x) {
+ private long mask(final long x) {
return (((x >>> 15) | (x << 17))
+ FramedSnappyCompressorInputStream.MASK_OFFSET)
& 0xffffFFFFL;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
index e468bd5..33ef7b9 100644
--- a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
@@ -35,7 +35,7 @@ public class IOUtilsTest {
public void skipUsingSkip() throws Exception {
skip(new StreamWrapper() {
@Override
- public InputStream wrap(InputStream toWrap) {
+ public InputStream wrap(final InputStream toWrap) {
return toWrap;
}
});
@@ -45,10 +45,10 @@ public class IOUtilsTest {
public void skipUsingRead() throws Exception {
skip(new StreamWrapper() {
@Override
- public InputStream wrap(InputStream toWrap) {
+ public InputStream wrap(final InputStream toWrap) {
return new FilterInputStream(toWrap) {
@Override
- public long skip(long s) {
+ public long skip(final long s) {
return 0;
}
};
@@ -64,7 +64,7 @@ public class IOUtilsTest {
return new FilterInputStream(toWrap) {
boolean skipped;
@Override
- public long skip(long s) throws IOException {
+ public long skip(final long s) throws IOException {
if (!skipped) {
toWrap.skip(5);
skipped = true;
@@ -77,7 +77,7 @@ public class IOUtilsTest {
});
}
- private void skip(StreamWrapper wrapper) throws Exception {
+ private void skip(final StreamWrapper wrapper) throws Exception {
ByteArrayInputStream in = new ByteArrayInputStream(new byte[] {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
});
[05/46] commons-compress git commit: The static field should be
accessed directly.
Posted by bo...@apache.org.
The static field should be accessed directly.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/18dcf384
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/18dcf384
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/18dcf384
Branch: refs/heads/COMPRESS-207
Commit: 18dcf384371013df8b79da55e258bb5ddbb4d5f0
Parents: 9045ef9
Author: ggregory <gg...@apache.org>
Authored: Wed Apr 6 02:06:40 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Wed Apr 6 02:06:40 2016 -0700
----------------------------------------------------------------------
.../compress/archivers/zip/ParallelScatterZipCreatorTest.java | 3 ++-
.../compress/archivers/zip/ScatterZipOutputStreamTest.java | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/18dcf384/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
index a6d6df4..e96dc31 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java
@@ -35,6 +35,7 @@ import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.zip.ZipEntry;
import static org.apache.commons.compress.AbstractTestCase.tryHardToDelete;
import static org.junit.Assert.*;
@@ -139,7 +140,7 @@ public class ParallelScatterZipCreatorTest {
private ZipArchiveEntry createZipArchiveEntry(Map<String, byte[]> entries, int i, byte[] payloadBytes) {
ZipArchiveEntry za = new ZipArchiveEntry( "file" + i);
entries.put( za.getName(), payloadBytes);
- za.setMethod(ZipArchiveEntry.DEFLATED);
+ za.setMethod(ZipEntry.DEFLATED);
za.setSize(payloadBytes.length);
za.setUnixMode(UnixStat.FILE_FLAG | 0664);
return za;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/18dcf384/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
index 6ac094b..88836e4 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStreamTest.java
@@ -25,6 +25,7 @@ import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
+import java.util.zip.ZipEntry;
import static org.apache.commons.compress.AbstractTestCase.tryHardToDelete;
import static org.apache.commons.compress.archivers.zip.ZipArchiveEntryRequest.createZipArchiveEntryRequest;
@@ -50,12 +51,12 @@ public class ScatterZipOutputStreamTest {
final byte[] A_PAYLOAD = "XAAY".getBytes();
ZipArchiveEntry zab = new ZipArchiveEntry("b.txt");
- zab.setMethod(ZipArchiveEntry.DEFLATED);
+ zab.setMethod(ZipEntry.DEFLATED);
final ByteArrayInputStream payload = new ByteArrayInputStream(B_PAYLOAD);
scatterZipOutputStream.addArchiveEntry(createZipArchiveEntryRequest(zab, createPayloadSupplier(payload)));
ZipArchiveEntry zae = new ZipArchiveEntry("a.txt");
- zae.setMethod(ZipArchiveEntry.DEFLATED);
+ zae.setMethod(ZipEntry.DEFLATED);
ByteArrayInputStream payload1 = new ByteArrayInputStream(A_PAYLOAD);
scatterZipOutputStream.addArchiveEntry(createZipArchiveEntryRequest(zae, createPayloadSupplier(payload1)));
[43/46] commons-compress git commit: Add final modifier to local
variables.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
index 0e4fa50..941bbbd 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
@@ -259,7 +259,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
this.preserveLeadingSlashes = preserveLeadingSlashes;
name = normalizeFileName(name, preserveLeadingSlashes);
- boolean isDir = name.endsWith("/");
+ final boolean isDir = name.endsWith("/");
this.name = name;
this.mode = isDir ? DEFAULT_DIR_MODE : DEFAULT_FILE_MODE;
@@ -316,14 +316,14 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param fileName the name to be used for the entry.
*/
public TarArchiveEntry(final File file, final String fileName) {
- String normalizedName = normalizeFileName(fileName, false);
+ final String normalizedName = normalizeFileName(fileName, false);
this.file = file;
if (file.isDirectory()) {
this.mode = DEFAULT_DIR_MODE;
this.linkFlag = LF_DIR;
- int nameLength = normalizedName.length();
+ final int nameLength = normalizedName.length();
if (nameLength == 0 || normalizedName.charAt(nameLength - 1) != '/') {
this.name = normalizedName + "/";
} else {
@@ -950,11 +950,11 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
return EMPTY_TAR_ARCHIVE_ENTRIES;
}
- String[] list = file.list();
+ final String[] list = file.list();
if (list == null) {
return EMPTY_TAR_ARCHIVE_ENTRIES;
}
- TarArchiveEntry[] result = new TarArchiveEntry[list.length];
+ final TarArchiveEntry[] result = new TarArchiveEntry[list.length];
for (int i = 0; i < result.length; ++i) {
result[i] = new TarArchiveEntry(new File(file, list[i]));
@@ -973,10 +973,10 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
public void writeEntryHeader(final byte[] outbuf) {
try {
writeEntryHeader(outbuf, TarUtils.DEFAULT_ENCODING, false);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
try {
writeEntryHeader(outbuf, TarUtils.FALLBACK_ENCODING, false);
- } catch (IOException ex2) {
+ } catch (final IOException ex2) {
// impossible
throw new RuntimeException(ex2);
}
@@ -1009,7 +1009,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
offset = writeEntryHeaderField(modTime, outbuf, offset, MODTIMELEN,
starMode);
- int csOffset = offset;
+ final int csOffset = offset;
for (int c = 0; c < CHKSUMLEN; ++c) {
outbuf[offset++] = (byte) ' ';
@@ -1033,7 +1033,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
outbuf[offset++] = 0;
}
- long chk = TarUtils.computeCheckSum(outbuf);
+ final long chk = TarUtils.computeCheckSum(outbuf);
TarUtils.formatCheckSumOctalBytes(chk, outbuf, csOffset, CHKSUMLEN);
}
@@ -1060,10 +1060,10 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
public void parseTarHeader(final byte[] header) {
try {
parseTarHeader(header, TarUtils.DEFAULT_ENCODING);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
try {
parseTarHeader(header, TarUtils.DEFAULT_ENCODING, true);
- } catch (IOException ex2) {
+ } catch (final IOException ex2) {
// not really possible
throw new RuntimeException(ex2);
}
@@ -1124,7 +1124,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
devMinor = (int) TarUtils.parseOctalOrBinary(header, offset, DEVLEN);
offset += DEVLEN;
- int type = evaluateType(header);
+ final int type = evaluateType(header);
switch (type) {
case FORMAT_OLDGNU: {
offset += ATIMELEN_GNU;
@@ -1140,7 +1140,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
break;
}
case FORMAT_XSTAR: {
- String xstarPrefix = oldStyle
+ final String xstarPrefix = oldStyle
? TarUtils.parseName(header, offset, PREFIXLEN_XSTAR)
: TarUtils.parseName(header, offset, PREFIXLEN_XSTAR, encoding);
if (xstarPrefix.length() > 0) {
@@ -1150,7 +1150,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
}
case FORMAT_POSIX:
default: {
- String prefix = oldStyle
+ final String prefix = oldStyle
? TarUtils.parseName(header, offset, PREFIXLEN)
: TarUtils.parseName(header, offset, PREFIXLEN, encoding);
// SunOS tar -E does not add / to directory names, so fix
@@ -1171,7 +1171,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*/
private static String normalizeFileName(String fileName,
final boolean preserveLeadingSlashes) {
- String osname = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
+ final String osname = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if (osname != null) {
@@ -1180,8 +1180,8 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
if (osname.startsWith("windows")) {
if (fileName.length() > 2) {
- char ch1 = fileName.charAt(0);
- char ch2 = fileName.charAt(1);
+ final char ch1 = fileName.charAt(0);
+ final char ch2 = fileName.charAt(1);
if (ch2 == ':'
&& (ch1 >= 'a' && ch1 <= 'z'
@@ -1190,7 +1190,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
}
}
} else if (osname.contains("netware")) {
- int colon = fileName.indexOf(':');
+ final int colon = fileName.indexOf(':');
if (colon != -1) {
fileName = fileName.substring(colon + 1);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
index 3859e43..61b908f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
@@ -272,7 +272,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
skipRecordPadding();
}
- byte[] headerBuf = getRecord();
+ final byte[] headerBuf = getRecord();
if (headerBuf == null) {
/* hit EOF */
@@ -282,7 +282,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
try {
currEntry = new TarArchiveEntry(headerBuf, zipEncoding);
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
throw new IOException("Error detected parsing the header", e);
}
@@ -290,7 +290,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
entrySize = currEntry.getSize();
if (currEntry.isGNULongLinkEntry()) {
- byte[] longLinkData = getLongNameData();
+ final byte[] longLinkData = getLongNameData();
if (longLinkData == null) {
// Bugzilla: 40334
// Malformed tar file - long link entry name not followed by
@@ -301,7 +301,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
}
if (currEntry.isGNULongNameEntry()) {
- byte[] longNameData = getLongNameData();
+ final byte[] longNameData = getLongNameData();
if (longNameData == null) {
// Bugzilla: 40334
// Malformed tar file - long entry name not followed by
@@ -340,9 +340,9 @@ public class TarArchiveInputStream extends ArchiveInputStream {
*/
private void skipRecordPadding() throws IOException {
if (!isDirectory() && this.entrySize > 0 && this.entrySize % this.recordSize != 0) {
- long numRecords = (this.entrySize / this.recordSize) + 1;
- long padding = (numRecords * this.recordSize) - this.entrySize;
- long skipped = IOUtils.skip(is, padding);
+ final long numRecords = (this.entrySize / this.recordSize) + 1;
+ final long padding = (numRecords * this.recordSize) - this.entrySize;
+ final long skipped = IOUtils.skip(is, padding);
count(skipped);
}
}
@@ -355,7 +355,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
*/
protected byte[] getLongNameData() throws IOException {
// read in the name
- ByteArrayOutputStream longName = new ByteArrayOutputStream();
+ final ByteArrayOutputStream longName = new ByteArrayOutputStream();
int length = 0;
while ((length = read(SMALL_BUF)) >= 0) {
longName.write(SMALL_BUF, 0, length);
@@ -373,7 +373,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
--length;
}
if (length != longNameData.length) {
- byte[] l = new byte[length];
+ final byte[] l = new byte[length];
System.arraycopy(longNameData, 0, l, 0, length);
longNameData = l;
}
@@ -424,9 +424,9 @@ public class TarArchiveInputStream extends ArchiveInputStream {
*/
protected byte[] readRecord() throws IOException {
- byte[] record = new byte[recordSize];
+ final byte[] record = new byte[recordSize];
- int readNow = IOUtils.readFully(is, record);
+ final int readNow = IOUtils.readFully(is, record);
count(readNow);
if (readNow != recordSize) {
return null;
@@ -441,7 +441,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
}
private void paxHeaders() throws IOException{
- Map<String, String> headers = parsePaxHeaders(this);
+ final Map<String, String> headers = parsePaxHeaders(this);
getNextEntry(); // Get the actual file entry
applyPaxHeadersToCurrentEntry(headers);
}
@@ -451,7 +451,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
// https://www.gnu.org/software/tar/manual/html_section/tar_92.html#SEC188
Map<String, String> parsePaxHeaders(final InputStream i)
throws IOException {
- Map<String, String> headers = new HashMap<String, String>(globalPaxHeaders);
+ final Map<String, String> headers = new HashMap<String, String>(globalPaxHeaders);
// Format is "length keyword=value\n";
while(true){ // get length
int ch;
@@ -461,18 +461,18 @@ public class TarArchiveInputStream extends ArchiveInputStream {
read++;
if (ch == ' '){ // End of length string
// Get keyword
- ByteArrayOutputStream coll = new ByteArrayOutputStream();
+ final ByteArrayOutputStream coll = new ByteArrayOutputStream();
while((ch = i.read()) != -1) {
read++;
if (ch == '='){ // end of keyword
- String keyword = coll.toString(CharsetNames.UTF_8);
+ final String keyword = coll.toString(CharsetNames.UTF_8);
// Get rest of entry
final int restLen = len - read;
if (restLen == 1) { // only NL
headers.remove(keyword);
} else {
- byte[] rest = new byte[restLen];
- int got = IOUtils.readFully(i, rest);
+ final byte[] rest = new byte[restLen];
+ final int got = IOUtils.readFully(i, rest);
if (got != restLen) {
throw new IOException("Failed to read "
+ "Paxheader. Expected "
@@ -481,7 +481,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
+ got);
}
// Drop trailing NL
- String value = new String(rest, 0,
+ final String value = new String(rest, 0,
restLen - 1, CharsetNames.UTF_8);
headers.put(keyword, value);
}
@@ -520,9 +520,9 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* star files use additional members of which we use
* SCHILY.filetype in order to detect star sparse files.
*/
- for (Entry<String, String> ent : headers.entrySet()){
- String key = ent.getKey();
- String val = ent.getValue();
+ for (final Entry<String, String> ent : headers.entrySet()){
+ final String key = ent.getKey();
+ final String val = ent.getValue();
if ("path".equals(key)){
currEntry.setName(val);
} else if ("linkpath".equals(key)){
@@ -569,7 +569,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
if (currEntry.isExtended()) {
TarArchiveSparseEntry entry;
do {
- byte[] headerBuf = getRecord();
+ final byte[] headerBuf = getRecord();
if (headerBuf == null) {
currEntry = null;
break;
@@ -610,7 +610,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
*/
private void tryToConsumeSecondEOFRecord() throws IOException {
boolean shouldReset = true;
- boolean marked = is.markSupported();
+ final boolean marked = is.markSupported();
if (marked) {
is.mark(recordSize);
}
@@ -674,7 +674,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
@Override
public boolean canReadEntryData(final ArchiveEntry ae) {
if (ae instanceof TarArchiveEntry) {
- TarArchiveEntry te = (TarArchiveEntry) ae;
+ final TarArchiveEntry te = (TarArchiveEntry) ae;
return !te.isSparse();
}
return false;
@@ -707,9 +707,9 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* the tool creating this archive has padded the last block.
*/
private void consumeRemainderOfLastBlock() throws IOException {
- long bytesReadOfLastBlock = getBytesRead() % blockSize;
+ final long bytesReadOfLastBlock = getBytesRead() % blockSize;
if (bytesReadOfLastBlock > 0) {
- long skipped = IOUtils.skip(is, blockSize - bytesReadOfLastBlock);
+ final long skipped = IOUtils.skip(is, blockSize - bytesReadOfLastBlock);
count(skipped);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/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 4702711..af5c307 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
@@ -274,14 +274,14 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
if (finished) {
throw new IOException("Stream has already been finished");
}
- TarArchiveEntry entry = (TarArchiveEntry) archiveEntry;
- Map<String, String> paxHeaders = new HashMap<String, String>();
+ final TarArchiveEntry entry = (TarArchiveEntry) archiveEntry;
+ final Map<String, String> paxHeaders = new HashMap<String, String>();
final String entryName = entry.getName();
- boolean paxHeaderContainsPath = handleLongName(entry, entryName, paxHeaders, "path",
+ final boolean paxHeaderContainsPath = handleLongName(entry, entryName, paxHeaders, "path",
TarConstants.LF_GNUTYPE_LONGNAME, "file name");
final String linkName = entry.getLinkName();
- boolean paxHeaderContainsLinkPath = linkName != null && linkName.length() > 0
+ final boolean paxHeaderContainsLinkPath = linkName != null && linkName.length() > 0
&& handleLongName(entry, linkName, paxHeaders, "linkpath",
TarConstants.LF_GNUTYPE_LONGLINK, "link name");
@@ -395,7 +395,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
if (assemLen > 0) {
if (assemLen + numToWrite >= recordBuf.length) {
- int aLen = recordBuf.length - assemLen;
+ final int aLen = recordBuf.length - assemLen;
System.arraycopy(assemBuf, 0, recordBuf, 0,
assemLen);
@@ -434,7 +434,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
writeRecord(wBuf, wOffset);
- int num = recordBuf.length;
+ final int num = recordBuf.length;
currBytes += num;
numToWrite -= num;
@@ -453,14 +453,14 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
if (name.length() >= TarConstants.NAMELEN) {
name = name.substring(0, TarConstants.NAMELEN - 1);
}
- TarArchiveEntry pex = new TarArchiveEntry(name,
+ final TarArchiveEntry pex = new TarArchiveEntry(name,
TarConstants.LF_PAX_EXTENDED_HEADER_LC);
transferModTime(entry, pex);
- StringWriter w = new StringWriter();
- for (Map.Entry<String, String> h : headers.entrySet()) {
- String key = h.getKey();
- String value = h.getValue();
+ final StringWriter w = new StringWriter();
+ for (final Map.Entry<String, String> h : headers.entrySet()) {
+ final String key = h.getKey();
+ final String value = h.getValue();
int len = key.length() + value.length()
+ 3 /* blank, equals and newline */
+ 2 /* guess 9 < actual length < 100 */;
@@ -478,7 +478,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
}
w.write(line);
}
- byte[] data = w.toString().getBytes(CharsetNames.UTF_8);
+ final byte[] data = w.toString().getBytes(CharsetNames.UTF_8);
pex.setSize(data.length);
putArchiveEntry(pex);
write(data);
@@ -487,9 +487,9 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
private String stripTo7Bits(final String name) {
final int length = name.length();
- StringBuilder result = new StringBuilder(length);
+ final StringBuilder result = new StringBuilder(length);
for (int i = 0; i < length; i++) {
- char stripped = (char) (name.charAt(i) & 0x7F);
+ final char stripped = (char) (name.charAt(i) & 0x7F);
if (shouldBeReplaced(stripped)) {
result.append("_");
} else {
@@ -573,7 +573,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
}
private void padAsNeeded() throws IOException {
- int start = recordsWritten % recordsPerBlock;
+ final int start = recordsWritten % recordsPerBlock;
if (start != 0) {
for (int i = start; i < recordsPerBlock; i++) {
writeEOFRecord();
@@ -675,7 +675,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
} else if (longFileMode == LONGFILE_GNU) {
// create a TarEntry for the LongLink, the contents
// of which are the link's name
- TarArchiveEntry longLinkEntry = new TarArchiveEntry(TarConstants.GNU_LONGLINK, linkType);
+ final TarArchiveEntry longLinkEntry = new TarArchiveEntry(TarConstants.GNU_LONGLINK, linkType);
longLinkEntry.setSize(len + 1); // +1 for NUL
transferModTime(entry, longLinkEntry);
@@ -694,7 +694,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
private void transferModTime(final TarArchiveEntry from, final TarArchiveEntry to) {
Date fromModTime = from.getModTime();
- long fromModTimeSeconds = fromModTime.getTime() / 1000;
+ final long fromModTimeSeconds = fromModTime.getTime() / 1000;
if (fromModTimeSeconds < 0 || fromModTimeSeconds > TarConstants.MAXSIZE) {
fromModTime = new Date(0);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
index 1138fd1..90e7294 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
@@ -51,7 +51,7 @@ public class TarUtils {
@Override
public ByteBuffer encode(final String name) {
final int length = name.length();
- byte[] buf = new byte[length];
+ final byte[] buf = new byte[length];
// copy until end of input or output is reached.
for (int i = 0; i < length; ++i) {
@@ -63,9 +63,9 @@ public class TarUtils {
@Override
public String decode(final byte[] buffer) {
final int length = buffer.length;
- StringBuilder result = new StringBuilder(length);
+ final StringBuilder result = new StringBuilder(length);
- for (byte b : buffer) {
+ for (final byte b : buffer) {
if (b == 0) { // Trailing null
break;
}
@@ -202,7 +202,7 @@ public class TarUtils {
final int offset,
final int length,
final boolean negative) {
- byte[] remainder = new byte[length - 1];
+ final byte[] remainder = new byte[length - 1];
System.arraycopy(buffer, offset + 1, remainder, 0, length - 1);
BigInteger val = new BigInteger(remainder);
if (negative) {
@@ -262,10 +262,10 @@ public class TarUtils {
public static String parseName(final byte[] buffer, final int offset, final int length) {
try {
return parseName(buffer, offset, length, DEFAULT_ENCODING);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
try {
return parseName(buffer, offset, length, FALLBACK_ENCODING);
- } catch (IOException ex2) {
+ } catch (final IOException ex2) {
// impossible
throw new RuntimeException(ex2);
}
@@ -297,7 +297,7 @@ public class TarUtils {
}
}
if (len > 0) {
- byte[] b = new byte[len];
+ final byte[] b = new byte[len];
System.arraycopy(buffer, offset, b, 0, len);
return encoding.decode(b);
}
@@ -322,11 +322,11 @@ public class TarUtils {
public static int formatNameBytes(final String name, final byte[] buf, final int offset, final int length) {
try {
return formatNameBytes(name, buf, offset, length, DEFAULT_ENCODING);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
try {
return formatNameBytes(name, buf, offset, length,
FALLBACK_ENCODING);
- } catch (IOException ex2) {
+ } catch (final IOException ex2) {
// impossible
throw new RuntimeException(ex2);
}
@@ -446,7 +446,7 @@ public class TarUtils {
*/
public static int formatLongOctalBytes(final long value, final byte[] buf, final int offset, final int length) {
- int idx=length-1; // For space
+ final int idx=length-1; // For space
formatUnsignedOctalString(value, buf, offset, idx);
buf[offset + idx] = (byte) ' '; // Trailing space
@@ -516,7 +516,7 @@ public class TarUtils {
final int offset,
final int length,
final boolean negative) {
- BigInteger val = BigInteger.valueOf(value);
+ final BigInteger val = BigInteger.valueOf(value);
final byte[] b = val.toByteArray();
final int len = b.length;
final int off = offset + length - len;
@@ -561,7 +561,7 @@ public class TarUtils {
public static long computeCheckSum(final byte[] buf) {
long sum = 0;
- for (byte element : buf) {
+ for (final byte element : buf) {
sum += BYTE_MASK & element;
}
@@ -594,7 +594,7 @@ public class TarUtils {
* @since 1.5
*/
public static boolean verifyCheckSum(final byte[] header) {
- long storedSum = parseOctal(header, CHKSUM_OFFSET, CHKSUMLEN);
+ final long storedSum = parseOctal(header, CHKSUM_OFFSET, CHKSUMLEN);
long unsignedSum = 0;
long signedSum = 0;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
index ac7bbba..3510cc4 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
@@ -49,13 +49,13 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
* <code>bytes</code>.
*/
protected AbstractUnicodeExtraField(final String text, final byte[] bytes, final int off, final int len) {
- CRC32 crc32 = new CRC32();
+ final CRC32 crc32 = new CRC32();
crc32.update(bytes, off, len);
nameCRC32 = crc32.getValue();
try {
unicodeName = text.getBytes(CharsetNames.UTF_8);
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
throw new RuntimeException("FATAL: UTF-8 encoding not supported.", e);
}
}
@@ -166,7 +166,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
throw new ZipException("UniCode path extra data must have at least 5 bytes.");
}
- int version = buffer[offset];
+ final int version = buffer[offset];
if (version != 0x01) {
throw new ZipException("Unsupported version [" + version
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
index de5ad31..faf84cd 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
@@ -127,10 +127,10 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
@Override
public byte[] getLocalFileDataData() {
// CRC will be added later
- byte[] data = new byte[getLocalFileDataLength().getValue() - WORD];
+ final byte[] data = new byte[getLocalFileDataLength().getValue() - WORD];
System.arraycopy(ZipShort.getBytes(getMode()), 0, data, 0, 2);
- byte[] linkArray = getLinkedFile().getBytes(); // Uses default charset - see class Javadoc
+ final byte[] linkArray = getLinkedFile().getBytes(); // Uses default charset - see class Javadoc
// CheckStyle:MagicNumber OFF
System.arraycopy(ZipLong.getBytes(linkArray.length),
0, data, 2, WORD);
@@ -145,9 +145,9 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
crc.reset();
crc.update(data);
- long checksum = crc.getValue();
+ final long checksum = crc.getValue();
- byte[] result = new byte[data.length + WORD];
+ final byte[] result = new byte[data.length + WORD];
System.arraycopy(ZipLong.getBytes(checksum), 0, result, 0, WORD);
System.arraycopy(data, 0, result, WORD, data.length);
return result;
@@ -267,12 +267,12 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
public void parseFromLocalFileData(final byte[] data, final int offset, final int length)
throws ZipException {
- long givenChecksum = ZipLong.getValue(data, offset);
- byte[] tmp = new byte[length - WORD];
+ final long givenChecksum = ZipLong.getValue(data, offset);
+ final byte[] tmp = new byte[length - WORD];
System.arraycopy(data, offset + WORD, tmp, 0, length - WORD);
crc.reset();
crc.update(tmp);
- long realChecksum = crc.getValue();
+ final long realChecksum = crc.getValue();
if (givenChecksum != realChecksum) {
throw new ZipException("bad CRC checksum "
+ Long.toHexString(givenChecksum)
@@ -280,9 +280,9 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
+ Long.toHexString(realChecksum));
}
- int newMode = ZipShort.getValue(tmp, 0);
+ final int newMode = ZipShort.getValue(tmp, 0);
// CheckStyle:MagicNumber OFF
- byte[] linkArray = new byte[(int) ZipLong.getValue(tmp, 2)];
+ final byte[] linkArray = new byte[(int) ZipLong.getValue(tmp, 2)];
uid = ZipShort.getValue(tmp, 6);
gid = ZipShort.getValue(tmp, 8);
@@ -326,10 +326,10 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
@Override
public Object clone() {
try {
- AsiExtraField cloned = (AsiExtraField) super.clone();
+ final AsiExtraField cloned = (AsiExtraField) super.clone();
cloned.crc = new CRC32();
return cloned;
- } catch (CloneNotSupportedException cnfe) {
+ } catch (final CloneNotSupportedException cnfe) {
// impossible
throw new RuntimeException(cnfe);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/BinaryTree.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/BinaryTree.java b/src/main/java/org/apache/commons/compress/archivers/zip/BinaryTree.java
index 494fae8..c73e3d5 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/BinaryTree.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/BinaryTree.java
@@ -70,7 +70,7 @@ class BinaryTree {
tree[node] = NODE;
// move down the path recursively
- int nextChild = 2 * node + 1 + (path & 1);
+ final int nextChild = 2 * node + 1 + (path & 1);
addLeaf(nextChild, path >>> 1, depth - 1, value);
}
}
@@ -85,13 +85,13 @@ class BinaryTree {
int currentIndex = 0;
while (true) {
- int bit = stream.nextBit();
+ final int bit = stream.nextBit();
if (bit == -1) {
return -1;
}
- int childIndex = 2 * currentIndex + 1 + bit;
- int value = tree[childIndex];
+ final int childIndex = 2 * currentIndex + 1 + bit;
+ final int value = tree[childIndex];
if (value == NODE) {
// consume the next bit
currentIndex = childIndex;
@@ -109,23 +109,23 @@ class BinaryTree {
*/
static BinaryTree decode(final InputStream in, final int totalNumberOfValues) throws IOException {
// the first byte contains the size of the structure minus one
- int size = in.read() + 1;
+ final int size = in.read() + 1;
if (size == 0) {
throw new IOException("Cannot read the size of the encoded tree, unexpected end of stream");
}
- byte[] encodedTree = new byte[size];
+ final byte[] encodedTree = new byte[size];
new DataInputStream(in).readFully(encodedTree);
/** The maximum bit length for a value (16 or lower) */
int maxLength = 0;
- int[] originalBitLengths = new int[totalNumberOfValues];
+ final int[] originalBitLengths = new int[totalNumberOfValues];
int pos = 0;
- for (byte b : encodedTree) {
+ for (final byte b : encodedTree) {
// each byte encodes the number of values (upper 4 bits) for a bit length (lower 4 bits)
- int numberOfValues = ((b & 0xF0) >> 4) + 1;
- int bitLength = (b & 0x0F) + 1;
+ final int numberOfValues = ((b & 0xF0) >> 4) + 1;
+ final int bitLength = (b & 0x0F) + 1;
for (int j = 0; j < numberOfValues; j++) {
originalBitLengths[pos++] = bitLength;
@@ -135,13 +135,13 @@ class BinaryTree {
}
// sort the array of bit lengths and memorize the permutation used to restore the order of the codes
- int[] permutation = new int[originalBitLengths.length];
+ final int[] permutation = new int[originalBitLengths.length];
for (int k = 0; k < permutation.length; k++) {
permutation[k] = k;
}
int c = 0;
- int[] sortedBitLengths = new int[originalBitLengths.length];
+ final int[] sortedBitLengths = new int[originalBitLengths.length];
for (int k = 0; k < originalBitLengths.length; k++) {
// iterate over the values
for (int l = 0; l < originalBitLengths.length; l++) {
@@ -163,7 +163,7 @@ class BinaryTree {
int codeIncrement = 0;
int lastBitLength = 0;
- int[] codes = new int[totalNumberOfValues];
+ final int[] codes = new int[totalNumberOfValues];
for (int i = totalNumberOfValues - 1; i >= 0; i--) {
code = code + codeIncrement;
@@ -175,10 +175,10 @@ class BinaryTree {
}
// build the tree
- BinaryTree tree = new BinaryTree(maxLength);
+ final BinaryTree tree = new BinaryTree(maxLength);
for (int k = 0; k < codes.length; k++) {
- int bitLength = originalBitLengths[k];
+ final int bitLength = originalBitLengths[k];
if (bitLength > 0) {
tree.addLeaf(0, Integer.reverse(codes[k] << 16), bitLength, k);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java b/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
index ad50bd6..69b980f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
@@ -64,7 +64,7 @@ class CircularBuffer {
*/
public int get() {
if (available()) {
- int value = buffer[readIndex];
+ final int value = buffer[readIndex];
readIndex = (readIndex + 1) % size;
return value & 0xFF;
}
@@ -78,8 +78,8 @@ class CircularBuffer {
* @param length the number of bytes to copy
*/
public void copy(final int distance, final int length) {
- int pos1 = writeIndex - distance;
- int pos2 = pos1 + length;
+ final int pos1 = writeIndex - distance;
+ final int pos2 = pos1 + length;
for (int i = pos1; i < pos2; i++) {
buffer[writeIndex] = buffer[(i + size) % size];
writeIndex = (writeIndex + 1) % size;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
index 5949c60..01dd4e2 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
@@ -117,7 +117,7 @@ class ExplodingInputStream extends InputStream {
private void fillBuffer() throws IOException {
init();
- int bit = bits.nextBit();
+ final int bit = bits.nextBit();
if (bit == 1) {
// literal value
int literal;
@@ -136,14 +136,14 @@ class ExplodingInputStream extends InputStream {
} else if (bit == 0) {
// back reference
- int distanceLowSize = dictionarySize == 4096 ? 6 : 7;
- int distanceLow = (int) bits.nextBits(distanceLowSize);
- int distanceHigh = distanceTree.read(bits);
+ final int distanceLowSize = dictionarySize == 4096 ? 6 : 7;
+ final int distanceLow = (int) bits.nextBits(distanceLowSize);
+ final int distanceHigh = distanceTree.read(bits);
if (distanceHigh == -1 && distanceLow <= 0) {
// end of stream reached, nothing left to decode
return;
}
- int distance = distanceHigh << distanceLowSize | distanceLow;
+ final int distance = distanceHigh << distanceLowSize | distanceLow;
int length = lengthTree.read(bits);
if (length == 63) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java b/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java
index 9cff3c2..c9e5997 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java
@@ -63,13 +63,13 @@ public class ExtraFieldUtils {
*/
public static void register(final Class<?> c) {
try {
- ZipExtraField ze = (ZipExtraField) c.newInstance();
+ final ZipExtraField ze = (ZipExtraField) c.newInstance();
implementations.put(ze.getHeaderId(), c);
- } catch (ClassCastException cc) {
+ } catch (final ClassCastException cc) {
throw new RuntimeException(c + " doesn\'t implement ZipExtraField");
- } catch (InstantiationException ie) {
+ } catch (final InstantiationException ie) {
throw new RuntimeException(c + " is not a concrete class");
- } catch (IllegalAccessException ie) {
+ } catch (final IllegalAccessException ie) {
throw new RuntimeException(c + "\'s no-arg constructor is not public");
}
}
@@ -84,11 +84,11 @@ public class ExtraFieldUtils {
*/
public static ZipExtraField createExtraField(final ZipShort headerId)
throws InstantiationException, IllegalAccessException {
- Class<?> c = implementations.get(headerId);
+ final Class<?> c = implementations.get(headerId);
if (c != null) {
return (ZipExtraField) c.newInstance();
}
- UnrecognizedExtraField u = new UnrecognizedExtraField();
+ final UnrecognizedExtraField u = new UnrecognizedExtraField();
u.setHeaderId(headerId);
return u;
}
@@ -135,12 +135,12 @@ public class ExtraFieldUtils {
public static ZipExtraField[] parse(final byte[] data, final boolean local,
final UnparseableExtraField onUnparseableData)
throws ZipException {
- List<ZipExtraField> v = new ArrayList<ZipExtraField>();
+ final List<ZipExtraField> v = new ArrayList<ZipExtraField>();
int start = 0;
LOOP:
while (start <= data.length - WORD) {
- ZipShort headerId = new ZipShort(data, start);
- int length = new ZipShort(data, start + 2).getValue();
+ final ZipShort headerId = new ZipShort(data, start);
+ final int length = new ZipShort(data, start + 2).getValue();
if (start + WORD + length > data.length) {
switch(onUnparseableData.getKey()) {
case UnparseableExtraField.THROW_KEY:
@@ -151,7 +151,7 @@ public class ExtraFieldUtils {
+ (data.length - start - WORD)
+ " bytes.");
case UnparseableExtraField.READ_KEY:
- UnparseableExtraFieldData field =
+ final UnparseableExtraFieldData field =
new UnparseableExtraFieldData();
if (local) {
field.parseFromLocalFileData(data, start,
@@ -173,7 +173,7 @@ public class ExtraFieldUtils {
}
}
try {
- ZipExtraField ze = createExtraField(headerId);
+ final ZipExtraField ze = createExtraField(headerId);
if (local) {
ze.parseFromLocalFileData(data, start + WORD, length);
} else {
@@ -181,15 +181,15 @@ public class ExtraFieldUtils {
length);
}
v.add(ze);
- } catch (InstantiationException ie) {
+ } catch (final InstantiationException ie) {
throw (ZipException) new ZipException(ie.getMessage()).initCause(ie);
- } catch (IllegalAccessException iae) {
+ } catch (final IllegalAccessException iae) {
throw (ZipException) new ZipException(iae.getMessage()).initCause(iae);
}
start += length + WORD;
}
- ZipExtraField[] result = new ZipExtraField[v.size()];
+ final ZipExtraField[] result = new ZipExtraField[v.size()];
return v.toArray(result);
}
@@ -201,15 +201,15 @@ public class ExtraFieldUtils {
public static byte[] mergeLocalFileDataData(final ZipExtraField[] data) {
final boolean lastIsUnparseableHolder = data.length > 0
&& data[data.length - 1] instanceof UnparseableExtraFieldData;
- int regularExtraFieldCount =
+ final int regularExtraFieldCount =
lastIsUnparseableHolder ? data.length - 1 : data.length;
int sum = WORD * regularExtraFieldCount;
- for (ZipExtraField element : data) {
+ for (final ZipExtraField element : data) {
sum += element.getLocalFileDataLength().getValue();
}
- byte[] result = new byte[sum];
+ final byte[] result = new byte[sum];
int start = 0;
for (int i = 0; i < regularExtraFieldCount; i++) {
System.arraycopy(data[i].getHeaderId().getBytes(),
@@ -217,14 +217,14 @@ public class ExtraFieldUtils {
System.arraycopy(data[i].getLocalFileDataLength().getBytes(),
0, result, start + 2, 2);
start += WORD;
- byte[] local = data[i].getLocalFileDataData();
+ final byte[] local = data[i].getLocalFileDataData();
if (local != null) {
System.arraycopy(local, 0, result, start, local.length);
start += local.length;
}
}
if (lastIsUnparseableHolder) {
- byte[] local = data[data.length - 1].getLocalFileDataData();
+ final byte[] local = data[data.length - 1].getLocalFileDataData();
if (local != null) {
System.arraycopy(local, 0, result, start, local.length);
}
@@ -240,14 +240,14 @@ public class ExtraFieldUtils {
public static byte[] mergeCentralDirectoryData(final ZipExtraField[] data) {
final boolean lastIsUnparseableHolder = data.length > 0
&& data[data.length - 1] instanceof UnparseableExtraFieldData;
- int regularExtraFieldCount =
+ final int regularExtraFieldCount =
lastIsUnparseableHolder ? data.length - 1 : data.length;
int sum = WORD * regularExtraFieldCount;
- for (ZipExtraField element : data) {
+ for (final ZipExtraField element : data) {
sum += element.getCentralDirectoryLength().getValue();
}
- byte[] result = new byte[sum];
+ final byte[] result = new byte[sum];
int start = 0;
for (int i = 0; i < regularExtraFieldCount; i++) {
System.arraycopy(data[i].getHeaderId().getBytes(),
@@ -255,14 +255,14 @@ public class ExtraFieldUtils {
System.arraycopy(data[i].getCentralDirectoryLength().getBytes(),
0, result, start + 2, 2);
start += WORD;
- byte[] local = data[i].getCentralDirectoryData();
+ final byte[] local = data[i].getCentralDirectoryData();
if (local != null) {
System.arraycopy(local, 0, result, start, local.length);
start += local.length;
}
}
if (lastIsUnparseableHolder) {
- byte[] local = data[data.length - 1].getCentralDirectoryData();
+ final byte[] local = data[data.length - 1].getCentralDirectoryData();
if (local != null) {
System.arraycopy(local, 0, result, start, local.length);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBit.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBit.java b/src/main/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBit.java
index 73c13d5..6bca5bf 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBit.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBit.java
@@ -169,7 +169,7 @@ public final class GeneralPurposeBit implements Cloneable {
* @return the encoded general purpose bits
*/
public byte[] encode() {
- byte[] result = new byte[2];
+ final byte[] result = new byte[2];
encode(result, 0);
return result;
}
@@ -203,7 +203,7 @@ public final class GeneralPurposeBit implements Cloneable {
*/
public static GeneralPurposeBit parse(final byte[] data, final int offset) {
final int generalPurposeFlag = ZipShort.getValue(data, offset);
- GeneralPurposeBit b = new GeneralPurposeBit();
+ final GeneralPurposeBit b = new GeneralPurposeBit();
b.useDataDescriptor((generalPurposeFlag & DATA_DESCRIPTOR_FLAG) != 0);
b.useUTF8ForNames((generalPurposeFlag & UFT8_NAMES_FLAG) != 0);
b.useStrongEncryption((generalPurposeFlag & STRONG_ENCRYPTION_FLAG) != 0);
@@ -226,7 +226,7 @@ public final class GeneralPurposeBit implements Cloneable {
if (!(o instanceof GeneralPurposeBit)) {
return false;
}
- GeneralPurposeBit g = (GeneralPurposeBit) o;
+ final GeneralPurposeBit g = (GeneralPurposeBit) o;
return g.encryptionFlag == encryptionFlag
&& g.strongEncryptionFlag == strongEncryptionFlag
&& g.languageEncodingFlag == languageEncodingFlag
@@ -237,7 +237,7 @@ public final class GeneralPurposeBit implements Cloneable {
public Object clone() {
try {
return super.clone();
- } catch (CloneNotSupportedException ex) {
+ } catch (final CloneNotSupportedException ex) {
// impossible
throw new RuntimeException("GeneralPurposeBit is not Cloneable?", ex);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java b/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
index 8cea9c7..ffd2efd 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
@@ -57,7 +57,7 @@ class NioZipEncoding implements ZipEncoding {
*/
@Override
public boolean canEncode(final String name) {
- CharsetEncoder enc = this.charset.newEncoder();
+ final CharsetEncoder enc = this.charset.newEncoder();
enc.onMalformedInput(CodingErrorAction.REPORT);
enc.onUnmappableCharacter(CodingErrorAction.REPORT);
@@ -70,17 +70,17 @@ class NioZipEncoding implements ZipEncoding {
*/
@Override
public ByteBuffer encode(final String name) {
- CharsetEncoder enc = this.charset.newEncoder();
+ final CharsetEncoder enc = this.charset.newEncoder();
enc.onMalformedInput(CodingErrorAction.REPORT);
enc.onUnmappableCharacter(CodingErrorAction.REPORT);
- CharBuffer cb = CharBuffer.wrap(name);
+ final CharBuffer cb = CharBuffer.wrap(name);
ByteBuffer out = ByteBuffer.allocate(name.length()
+ (name.length() + 1) / 2);
while (cb.remaining() > 0) {
- CoderResult res = enc.encode(cb, out,true);
+ final CoderResult res = enc.encode(cb, out,true);
if (res.isUnmappable() || res.isMalformed()) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java b/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
index 3faea06..89bebd1 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/PKWareExtraHeader.java
@@ -170,7 +170,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
*/
@Override
public void parseFromLocalFileData(final byte[] data, final int offset, final int length) {
- byte[] tmp = new byte[length];
+ final byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
setLocalFileDataData(tmp);
}
@@ -186,7 +186,7 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
*/
@Override
public void parseFromCentralDirectoryData(final byte[] data, final int offset, final int length) {
- byte[] tmp = new byte[length];
+ final byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
setCentralDirectoryData(tmp);
if (localData == null) {
@@ -216,8 +216,8 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
private static final Map<Integer, EncryptionAlgorithm> codeToEnum;
static {
- Map<Integer, EncryptionAlgorithm> cte = new HashMap<Integer, EncryptionAlgorithm>();
- for (EncryptionAlgorithm method : values()) {
+ final Map<Integer, EncryptionAlgorithm> cte = new HashMap<Integer, EncryptionAlgorithm>();
+ for (final EncryptionAlgorithm method : values()) {
cte.put(Integer.valueOf(method.getCode()), method);
}
codeToEnum = Collections.unmodifiableMap(cte);
@@ -271,8 +271,8 @@ public abstract class PKWareExtraHeader implements ZipExtraField {
private static final Map<Integer, HashAlgorithm> codeToEnum;
static {
- Map<Integer, HashAlgorithm> cte = new HashMap<Integer, HashAlgorithm>();
- for (HashAlgorithm method : values()) {
+ final Map<Integer, HashAlgorithm> cte = new HashMap<Integer, HashAlgorithm>();
+ for (final HashAlgorithm method : values()) {
cte.put(Integer.valueOf(method.getCode()), method);
}
codeToEnum = Collections.unmodifiableMap(cte);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java b/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
index 49e1906..43a56a4 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java
@@ -66,15 +66,15 @@ public class ParallelScatterZipCreator {
@Override
public ScatterGatherBackingStore get() throws IOException {
- File tempFile = File.createTempFile("parallelscatter", "n" + storeNum.incrementAndGet());
+ final File tempFile = File.createTempFile("parallelscatter", "n" + storeNum.incrementAndGet());
return new FileBasedScatterGatherBackingStore(tempFile);
}
}
private ScatterZipOutputStream createDeferred(final ScatterGatherBackingStoreSupplier scatterGatherBackingStoreSupplier)
throws IOException {
- ScatterGatherBackingStore bs = scatterGatherBackingStoreSupplier.get();
- StreamCompressor sc = StreamCompressor.create(Deflater.DEFAULT_COMPRESSION, bs);
+ final ScatterGatherBackingStore bs = scatterGatherBackingStoreSupplier.get();
+ final StreamCompressor sc = StreamCompressor.create(Deflater.DEFAULT_COMPRESSION, bs);
return new ScatterZipOutputStream(bs, sc);
}
@@ -82,10 +82,10 @@ public class ParallelScatterZipCreator {
@Override
protected ScatterZipOutputStream initialValue() {
try {
- ScatterZipOutputStream scatterStream = createDeferred(backingStoreSupplier);
+ final ScatterZipOutputStream scatterStream = createDeferred(backingStoreSupplier);
streams.add(scatterStream);
return scatterStream;
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new RuntimeException(e);
}
}
@@ -197,7 +197,7 @@ public class ParallelScatterZipCreator {
throws IOException, InterruptedException, ExecutionException {
// Make sure we catch any exceptions from parallel phase
- for (Future<?> future : futures) {
+ for (final Future<?> future : futures) {
future.get();
}
@@ -207,7 +207,7 @@ public class ParallelScatterZipCreator {
// It is important that all threads terminate before we go on, ensure happens-before relationship
compressionDoneAt = System.currentTimeMillis();
- for (ScatterZipOutputStream scatterStream : streams) {
+ for (final ScatterZipOutputStream scatterStream : streams) {
scatterStream.writeTo(targetStream);
scatterStream.close();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
index ed7195f..9179707 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
@@ -70,7 +70,7 @@ public class ScatterZipOutputStream implements Closeable {
*/
public ZipArchiveEntry transferToArchiveEntry(){
- ZipArchiveEntry entry = zipArchiveEntryRequest.getZipArchiveEntry();
+ final ZipArchiveEntry entry = zipArchiveEntryRequest.getZipArchiveEntry();
entry.setCompressedSize(compressedSize);
entry.setSize(size);
entry.setCrc(crc);
@@ -110,8 +110,8 @@ public class ScatterZipOutputStream implements Closeable {
*/
public void writeTo(final ZipArchiveOutputStream target) throws IOException {
backingStore.closeForWriting();
- InputStream data = backingStore.getInputStream();
- for (CompressedEntry compressedEntry : items) {
+ final InputStream data = backingStore.getInputStream();
+ for (final CompressedEntry compressedEntry : items) {
final BoundedInputStream rawStream = new BoundedInputStream(data, compressedEntry.compressedSize);
target.addRawArchiveEntry(compressedEntry.transferToArchiveEntry(), rawStream);
rawStream.close();
@@ -149,8 +149,8 @@ public class ScatterZipOutputStream implements Closeable {
* @throws FileNotFoundException if the file cannot be found
*/
public static ScatterZipOutputStream fileBased(final File file, final int compressionLevel) throws FileNotFoundException {
- ScatterGatherBackingStore bs = new FileBasedScatterGatherBackingStore(file);
- StreamCompressor sc = StreamCompressor.create(compressionLevel, bs);
+ final ScatterGatherBackingStore bs = new FileBasedScatterGatherBackingStore(file);
+ final StreamCompressor sc = StreamCompressor.create(compressionLevel, bs);
return new ScatterZipOutputStream(bs, sc);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java b/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
index 56c4007..f8958da 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java
@@ -73,7 +73,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
@Override
public boolean equals(final Object o) {
if (o instanceof Simple8BitChar) {
- Simple8BitChar other = (Simple8BitChar) o;
+ final Simple8BitChar other = (Simple8BitChar) o;
return unicode == other.unicode && code == other.code;
}
return false;
@@ -104,12 +104,12 @@ class Simple8BitZipEncoding implements ZipEncoding {
*/
public Simple8BitZipEncoding(final char[] highChars) {
this.highChars = highChars.clone();
- List<Simple8BitChar> temp =
+ final List<Simple8BitChar> temp =
new ArrayList<Simple8BitChar>(this.highChars.length);
byte code = 127;
- for (char highChar : this.highChars) {
+ for (final char highChar : this.highChars) {
temp.add(new Simple8BitChar(++code, highChar));
}
@@ -143,7 +143,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
return true;
}
- Simple8BitChar r = this.encodeHighChar(c);
+ final Simple8BitChar r = this.encodeHighChar(c);
return r != null;
}
@@ -163,7 +163,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
return true;
}
- Simple8BitChar r = this.encodeHighChar(c);
+ final Simple8BitChar r = this.encodeHighChar(c);
if (r == null) {
return false;
}
@@ -185,9 +185,9 @@ class Simple8BitZipEncoding implements ZipEncoding {
while (i1 > i0) {
- int i = i0 + (i1 - i0) / 2;
+ final int i = i0 + (i1 - i0) / 2;
- Simple8BitChar m = this.reverseMapping.get(i);
+ final Simple8BitChar m = this.reverseMapping.get(i);
if (m.unicode == c) {
return m;
@@ -204,7 +204,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
return null;
}
- Simple8BitChar r = this.reverseMapping.get(i0);
+ final Simple8BitChar r = this.reverseMapping.get(i0);
if (r.unicode != c) {
return null;
@@ -222,7 +222,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
for (int i=0;i<name.length();++i) {
- char c = name.charAt(i);
+ final char c = name.charAt(i);
if (!this.canEncodeChar(c)) {
return false;
@@ -243,7 +243,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
for (int i=0;i<name.length();++i) {
- char c = name.charAt(i);
+ final char c = name.charAt(i);
if (out.remaining() < 6) {
out = ZipEncodingHelper.growBuffer(out,out.position() + 6);
@@ -266,7 +266,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
*/
@Override
public String decode(final byte[] data) throws IOException {
- char [] ret = new char[data.length];
+ final char [] ret = new char[data.length];
for (int i=0;i<data.length;++i) {
ret[i] = this.decodeByte(data[i]);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
index aef35d9..e54781e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
@@ -185,7 +185,7 @@ public abstract class StreamCompressor implements Closeable {
* @throws IOException on error
*/
long write(final byte[] b, final int offset, final int length, final int method) throws IOException {
- long current = writtenToOutputStreamForLastEntry;
+ final long current = writtenToOutputStreamForLastEntry;
crc.update(b, offset, length);
if (method == ZipEntry.DEFLATED) {
writeDeflated(b, offset, length);
@@ -245,7 +245,7 @@ public abstract class StreamCompressor implements Closeable {
}
void deflate() throws IOException {
- int len = def.deflate(outputBuffer, 0, outputBuffer.length);
+ final int len = def.deflate(outputBuffer, 0, outputBuffer.length);
if (len > 0) {
writeCounted(outputBuffer, 0, len);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
index aec800d..f8ea8b9 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java
@@ -130,7 +130,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
*/
@Override
public void parseFromLocalFileData(final byte[] data, final int offset, final int length) {
- byte[] tmp = new byte[length];
+ final byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
setLocalFileDataData(tmp);
}
@@ -144,7 +144,7 @@ public class UnrecognizedExtraField implements ZipExtraField {
@Override
public void parseFromCentralDirectoryData(final byte[] data, final int offset,
final int length) {
- byte[] tmp = new byte[length];
+ final byte[] tmp = new byte[length];
System.arraycopy(data, offset, tmp, 0, length);
setCentralDirectoryData(tmp);
if (localData == null) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java
index 3e223e8..63d2156 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java
@@ -52,7 +52,7 @@ class UnshrinkingInputStream extends LZWInputStream {
tableSize++;
}
setTableSize(tableSize);
- int idx = addEntry(previousCode, character, MAX_TABLE_SIZE);
+ final int idx = addEntry(previousCode, character, MAX_TABLE_SIZE);
if (idx >= 0) {
isUsed[idx] = true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java b/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
index ee08d0a..d5939c3 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X000A_NTFS.java
@@ -119,7 +119,7 @@ public class X000A_NTFS implements ZipExtraField {
*/
@Override
public byte[] getLocalFileDataData() {
- byte[] data = new byte[getLocalFileDataLength().getValue()];
+ final byte[] data = new byte[getLocalFileDataLength().getValue()];
int pos = 4;
System.arraycopy(TIME_ATTR_TAG.getBytes(), 0, data, pos, 2);
pos += 2;
@@ -162,13 +162,13 @@ public class X000A_NTFS implements ZipExtraField {
offset += 4;
while (offset + 4 <= len) {
- ZipShort tag = new ZipShort(data, offset);
+ final ZipShort tag = new ZipShort(data, offset);
offset += 2;
if (tag.equals(TIME_ATTR_TAG)) {
readTimeAttr(data, offset, len - offset);
break;
}
- ZipShort size = new ZipShort(data, offset);
+ final ZipShort size = new ZipShort(data, offset);
offset += 2 + size.getValue();
}
}
@@ -312,7 +312,7 @@ public class X000A_NTFS implements ZipExtraField {
*/
@Override
public String toString() {
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
buf.append("0x000A Zip Extra Field:")
.append(" Modify:[").append(getModifyJavaTime()).append("] ")
.append(" Access:[").append(getAccessJavaTime()).append("] ")
@@ -323,7 +323,7 @@ public class X000A_NTFS implements ZipExtraField {
@Override
public boolean equals(final Object o) {
if (o instanceof X000A_NTFS) {
- X000A_NTFS xf = (X000A_NTFS) o;
+ final X000A_NTFS xf = (X000A_NTFS) o;
return (modifyTime == xf.modifyTime || (modifyTime != null && modifyTime.equals(xf.modifyTime))) &&
(accessTime == xf.accessTime || (accessTime != null && accessTime.equals(xf.accessTime))) &&
@@ -361,7 +361,7 @@ public class X000A_NTFS implements ZipExtraField {
private void readTimeAttr(final byte[] data, int offset, final int length) {
if (length >= 2 + 3 * 8) {
- ZipShort tagValueLength = new ZipShort(data, offset);
+ final ZipShort tagValueLength = new ZipShort(data, offset);
if (TIME_ATTR_SIZE.equals(tagValueLength)) {
offset += 2;
modifyTime = new ZipEightByteInteger(data, offset);
@@ -387,7 +387,7 @@ public class X000A_NTFS implements ZipExtraField {
private static Date zipToDate(final ZipEightByteInteger z) {
if (z == null || ZipEightByteInteger.ZERO.equals(z)) { return null; }
- long l = (z.getLongValue() + EPOCH_OFFSET) / 10000l;
+ final long l = (z.getLongValue() + EPOCH_OFFSET) / 10000l;
return new Date(l);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
index 1a9a46e..0feb9c9 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
@@ -328,7 +328,7 @@ public class X0017_StrongEncryptionHeader extends PKWareExtraHeader {
* @param length the length of data
*/
public void parseFileFormat(final byte[] data, final int offset, final int length) {
- int ivSize = ZipShort.getValue(data, offset);
+ final int ivSize = ZipShort.getValue(data, offset);
this.ivData = new byte[ivSize];
System.arraycopy(data, offset + 4, this.ivData, 0, ivSize);
@@ -337,14 +337,14 @@ public class X0017_StrongEncryptionHeader extends PKWareExtraHeader {
this.bitlen = ZipShort.getValue(data, offset + ivSize + 10);
this.flags = ZipShort.getValue(data, offset + ivSize + 12);
- int erdSize = ZipShort.getValue(data, offset + ivSize + 14);
+ final int erdSize = ZipShort.getValue(data, offset + ivSize + 14);
this.erdData = new byte[erdSize];
System.arraycopy(data, offset + ivSize + 16, this.erdData, 0, erdSize);
this.rcount = ZipLong.getValue(data, offset + ivSize + 16 + erdSize);
System.out.println("rcount: " + rcount);
if (rcount == 0) {
- int vSize = ZipShort.getValue(data, offset + ivSize + 20 + erdSize);
+ final int vSize = ZipShort.getValue(data, offset + ivSize + 20 + erdSize);
this.vData = new byte[vSize - 4];
this.vCRC32 = new byte[4];
System.arraycopy(data, offset + ivSize + 22 + erdSize , this.vData, 0, vSize - 4);
@@ -352,13 +352,13 @@ public class X0017_StrongEncryptionHeader extends PKWareExtraHeader {
} else {
this.hashAlg = HashAlgorithm.getAlgorithmByCode(ZipShort.getValue(data, offset + ivSize + 20 + erdSize));
this.hashSize = ZipShort.getValue(data, offset + ivSize + 22 + erdSize);
- int resize = ZipShort.getValue(data, offset + ivSize + 24 + erdSize);
+ final int resize = ZipShort.getValue(data, offset + ivSize + 24 + erdSize);
this.recipientKeyHash = new byte[this.hashSize];
this.keyBlob = new byte[resize - this.hashSize];
System.arraycopy(data, offset + ivSize + 24 + erdSize, this.recipientKeyHash, 0, this.hashSize);
System.arraycopy(data, offset + ivSize + 24 + erdSize + this.hashSize, this.keyBlob, 0, resize - this.hashSize);
- int vSize = ZipShort.getValue(data, offset + ivSize + 26 + erdSize + resize);
+ final int vSize = ZipShort.getValue(data, offset + ivSize + 26 + erdSize + resize);
this.vData = new byte[vSize - 4];
this.vCRC32 = new byte[4];
System.arraycopy(data, offset + ivSize + 22 + erdSize + resize, this.vData, 0, vSize - 4);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
index 612ace6..4c7746c 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
@@ -171,7 +171,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*/
@Override
public byte[] getLocalFileDataData() {
- byte[] data = new byte[getLocalFileDataLength().getValue()];
+ final byte[] data = new byte[getLocalFileDataLength().getValue()];
int pos = 0;
data[pos++] = 0;
if (bit0_modifyTimePresent) {
@@ -200,8 +200,8 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*/
@Override
public byte[] getCentralDirectoryData() {
- byte[] centralData = new byte[getCentralDirectoryLength().getValue()];
- byte[] localData = getLocalFileDataData();
+ final byte[] centralData = new byte[getCentralDirectoryLength().getValue()];
+ final byte[] localData = getLocalFileDataData();
// Truncate out create & access time (last 8 bytes) from
// the copy of the local data we obtained:
@@ -535,19 +535,19 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
*/
@Override
public String toString() {
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
buf.append("0x5455 Zip Extra Field: Flags=");
buf.append(Integer.toBinaryString(ZipUtil.unsignedIntToSignedByte(flags))).append(" ");
if (bit0_modifyTimePresent && modifyTime != null) {
- Date m = getModifyJavaTime();
+ final Date m = getModifyJavaTime();
buf.append(" Modify:[").append(m).append("] ");
}
if (bit1_accessTimePresent && accessTime != null) {
- Date a = getAccessJavaTime();
+ final Date a = getAccessJavaTime();
buf.append(" Access:[").append(a).append("] ");
}
if (bit2_createTimePresent && createTime != null) {
- Date c = getCreateJavaTime();
+ final Date c = getCreateJavaTime();
buf.append(" Create:[").append(c).append("] ");
}
return buf.toString();
@@ -561,7 +561,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
@Override
public boolean equals(final Object o) {
if (o instanceof X5455_ExtendedTimestamp) {
- X5455_ExtendedTimestamp xf = (X5455_ExtendedTimestamp) o;
+ final X5455_ExtendedTimestamp xf = (X5455_ExtendedTimestamp) o;
// The ZipLong==ZipLong clauses handle the cases where both are null.
// and only last 3 bits of flags matter.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/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 4d5397c..9e1c01c 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,8 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*/
@Override
public ZipShort getLocalFileDataLength() {
- int uidSize = trimLeadingZeroesForceMinLength(uid.toByteArray()).length;
- int gidSize = trimLeadingZeroesForceMinLength(gid.toByteArray()).length;
+ final int uidSize = trimLeadingZeroesForceMinLength(uid.toByteArray()).length;
+ final int gidSize = trimLeadingZeroesForceMinLength(gid.toByteArray()).length;
// The 3 comes from: version=1 + uidsize=1 + gidsize=1
return new ZipShort(3 + uidSize + gidSize);
@@ -172,7 +172,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
// optimization is the root of all...
//
// The 3 comes from: version=1 + uidsize=1 + gidsize=1
- byte[] data = new byte[3 + uidBytes.length + gidBytes.length];
+ final byte[] data = new byte[3 + uidBytes.length + gidBytes.length];
// reverse() switches byte array from big-endian to little-endian.
reverse(uidBytes);
@@ -213,14 +213,14 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
) throws ZipException {
reset();
this.version = signedByteToUnsignedInt(data[offset++]);
- int uidSize = signedByteToUnsignedInt(data[offset++]);
- byte[] uidBytes = new byte[uidSize];
+ final int uidSize = signedByteToUnsignedInt(data[offset++]);
+ final byte[] uidBytes = new byte[uidSize];
System.arraycopy(data, offset, uidBytes, 0, uidSize);
offset += uidSize;
this.uid = new BigInteger(1, reverse(uidBytes)); // sign-bit forced positive
- int gidSize = signedByteToUnsignedInt(data[offset++]);
- byte[] gidBytes = new byte[gidSize];
+ final int gidSize = signedByteToUnsignedInt(data[offset++]);
+ final byte[] gidBytes = new byte[gidSize];
System.arraycopy(data, offset, gidBytes, 0, gidSize);
this.gid = new BigInteger(1, reverse(gidBytes)); // sign-bit forced positive
}
@@ -265,7 +265,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
@Override
public boolean equals(final Object o) {
if (o instanceof X7875_NewUnix) {
- X7875_NewUnix xf = (X7875_NewUnix) o;
+ final X7875_NewUnix xf = (X7875_NewUnix) o;
// We assume uid and gid can never be null.
return version == xf.version && uid.equals(xf.uid) && gid.equals(xf.gid);
}
@@ -298,7 +298,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
}
int pos = 0;
- for (byte b : array) {
+ for (final byte b : array) {
if (b == 0) {
pos++;
} else {
@@ -345,8 +345,8 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable {
*/
final int MIN_LENGTH = 1;
- byte[] trimmedArray = new byte[Math.max(MIN_LENGTH, array.length - pos)];
- int startPos = trimmedArray.length - (array.length - pos);
+ final byte[] trimmedArray = new byte[Math.max(MIN_LENGTH, array.length - pos)];
+ final int startPos = trimmedArray.length - (array.length - pos);
System.arraycopy(array, pos, trimmedArray, startPos, trimmedArray.length - startPos);
return trimmedArray;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
index 9f77e89..9913547 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
@@ -127,7 +127,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
if (size == null || compressedSize == null) {
throw new IllegalArgumentException(LFH_MUST_HAVE_BOTH_SIZES_MSG);
}
- byte[] data = new byte[2 * DWORD];
+ final byte[] data = new byte[2 * DWORD];
addSizes(data);
return data;
}
@@ -136,7 +136,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
@Override
public byte[] getCentralDirectoryData() {
- byte[] data = new byte[getCentralDirectoryLength().getValue()];
+ final byte[] data = new byte[getCentralDirectoryLength().getValue()];
int off = addSizes(data);
if (relativeHeaderOffset != null) {
System.arraycopy(relativeHeaderOffset.getBytes(), 0, data, off, DWORD);
@@ -227,7 +227,7 @@ public class Zip64ExtendedInformationExtraField implements ZipExtraField {
final boolean hasDiskStart)
throws ZipException {
if (rawCentralDirectoryData != null) {
- int expectedLength = (hasUncompressedSize ? DWORD : 0)
+ final int expectedLength = (hasUncompressedSize ? DWORD : 0)
+ (hasCompressedSize ? DWORD : 0)
+ (hasRelativeHeaderOffset ? DWORD : 0)
+ (hasDiskStart ? WORD : 0);
[25/46] commons-compress git commit: [COMPRESS-350] TarArchiveEntry
wastefully allocates empty arrays.
Posted by bo...@apache.org.
[COMPRESS-350] TarArchiveEntry wastefully allocates empty arrays.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/9cc0604f
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/9cc0604f
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/9cc0604f
Branch: refs/heads/COMPRESS-207
Commit: 9cc0604f7fdab2b23ead5f72a93feb2196660736
Parents: ab17a70
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 09:10:36 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 09:10:36 2016 -0700
----------------------------------------------------------------------
src/changes/changes.xml | 5 ++++-
.../commons/compress/archivers/tar/TarArchiveEntry.java | 9 +++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/9cc0604f/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 86527c7..8632ce0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -44,9 +44,12 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="1.12" date="not released, yet"
description="Release 1.12">
- <action issue="COMPRESS-349" type="update" date="2016-04-09">
+ <action issue="COMPRESS-349" type="update" date="2016-04-09" dev="ggregory">
Update requirement from Java 5 to 6.
</action>
+ <action issue="COMPRESS-350" type="update" date="2016-04-09" dev="ggregory">
+ TarArchiveEntry wastefully allocates empty arrays.
+ </action>
</release>
<release version="1.11" date="2016-04-06"
description="Release 1.11">
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/9cc0604f/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
index 4fac7d5..00a3edd 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
@@ -143,6 +143,8 @@ import org.apache.commons.compress.utils.ArchiveUtils;
*/
public class TarArchiveEntry implements TarConstants, ArchiveEntry {
+ private static final TarArchiveEntry[] EMPTY_TAR_ARCHIVE_ENTRIES = new TarArchiveEntry[0];
+
/** The entry's name. */
private String name = "";
@@ -945,11 +947,14 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*/
public TarArchiveEntry[] getDirectoryEntries() {
if (file == null || !file.isDirectory()) {
- return new TarArchiveEntry[0];
+ return EMPTY_TAR_ARCHIVE_ENTRIES;
}
String[] list = file.list();
- TarArchiveEntry[] result = new TarArchiveEntry[list == null ? 0 : list.length];
+ if (list == null) {
+ return EMPTY_TAR_ARCHIVE_ENTRIES;
+ }
+ TarArchiveEntry[] result = new TarArchiveEntry[list.length];
for (int i = 0; i < result.length; ++i) {
result[i] = new TarArchiveEntry(new File(file, list[i]));
[33/46] commons-compress git commit: Add final modifier to method
parameters.
Posted by bo...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java
index d3ffe31..72dade4 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java
@@ -32,8 +32,8 @@ class LZMA2Decoder extends CoderBase {
}
@Override
- InputStream decode(final String archiveName, final InputStream in, long uncompressedLength,
- final Coder coder, byte[] password) throws IOException {
+ InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
+ final Coder coder, final byte[] password) throws IOException {
try {
int dictionarySize = getDictionarySize(coder);
return new LZMA2InputStream(in, dictionarySize);
@@ -51,7 +51,7 @@ class LZMA2Decoder extends CoderBase {
}
@Override
- byte[] getOptionsAsProperties(Object opts) {
+ byte[] getOptionsAsProperties(final Object opts) {
int dictSize = getDictSize(opts);
int lead = Integer.numberOfLeadingZeros(dictSize);
int secondBit = (dictSize >>> (30 - lead)) - 2;
@@ -61,18 +61,18 @@ class LZMA2Decoder extends CoderBase {
}
@Override
- Object getOptionsFromCoder(Coder coder, InputStream in) {
+ Object getOptionsFromCoder(final Coder coder, final InputStream in) {
return getDictionarySize(coder);
}
- private int getDictSize(Object opts) {
+ private int getDictSize(final Object opts) {
if (opts instanceof LZMA2Options) {
return ((LZMA2Options) opts).getDictSize();
}
return numberOptionOrDefault(opts);
}
- private int getDictionarySize(Coder coder) throws IllegalArgumentException {
+ private int getDictionarySize(final Coder coder) throws IllegalArgumentException {
final int dictionarySizeBits = 0xff & coder.properties[0];
if ((dictionarySizeBits & (~0x3f)) != 0) {
throw new IllegalArgumentException("Unsupported LZMA2 property bits");
@@ -86,7 +86,7 @@ class LZMA2Decoder extends CoderBase {
return (2 | (dictionarySizeBits & 0x1)) << (dictionarySizeBits / 2 + 11);
}
- private LZMA2Options getOptions(Object opts) throws IOException {
+ private LZMA2Options getOptions(final Object opts) throws IOException {
if (opts instanceof LZMA2Options) {
return (LZMA2Options) opts;
}
@@ -95,7 +95,7 @@ class LZMA2Decoder extends CoderBase {
return options;
}
- private int numberOptionOrDefault(Object opts) {
+ private int numberOptionOrDefault(final Object opts) {
return numberOptionOrDefault(opts, LZMA2Options.DICT_SIZE_DEFAULT);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
index c6317ce..5764ec7 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.java
@@ -67,7 +67,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
*
* @param name This entry's new name.
*/
- public void setName(String name) {
+ public void setName(final String name) {
this.name = name;
}
@@ -83,7 +83,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* Sets whether there is any content associated with this entry.
* @param hasStream whether there is any content associated with this entry.
*/
- public void setHasStream(boolean hasStream) {
+ public void setHasStream(final boolean hasStream) {
this.hasStream = hasStream;
}
@@ -102,7 +102,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
*
* @param isDirectory True if this entry is a directory.
*/
- public void setDirectory(boolean isDirectory) {
+ public void setDirectory(final boolean isDirectory) {
this.isDirectory = isDirectory;
}
@@ -120,7 +120,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* meaning it should delete the same file from a previous backup.
* @param isAntiItem true if it is an anti-item, false otherwise
*/
- public void setAntiItem(boolean isAntiItem) {
+ public void setAntiItem(final boolean isAntiItem) {
this.isAntiItem = isAntiItem;
}
@@ -136,7 +136,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* Sets whether this entry has got a creation date at all.
* @param hasCreationDate whether the entry has got a creation date
*/
- public void setHasCreationDate(boolean hasCreationDate) {
+ public void setHasCreationDate(final boolean hasCreationDate) {
this.hasCreationDate = hasCreationDate;
}
@@ -159,7 +159,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* since 1 January 1601)
* @param ntfsCreationDate the creation date
*/
- public void setCreationDate(long ntfsCreationDate) {
+ public void setCreationDate(final long ntfsCreationDate) {
this.creationDate = ntfsCreationDate;
}
@@ -167,7 +167,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* Sets the creation date,
* @param creationDate the creation date
*/
- public void setCreationDate(Date creationDate) {
+ public void setCreationDate(final Date creationDate) {
hasCreationDate = creationDate != null;
if (hasCreationDate) {
this.creationDate = javaTimeToNtfsTime(creationDate);
@@ -187,7 +187,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* @param hasLastModifiedDate whether this entry has got a last
* modified date at all
*/
- public void setHasLastModifiedDate(boolean hasLastModifiedDate) {
+ public void setHasLastModifiedDate(final boolean hasLastModifiedDate) {
this.hasLastModifiedDate = hasLastModifiedDate;
}
@@ -211,7 +211,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* units since 1 January 1601)
* @param ntfsLastModifiedDate the last modified date
*/
- public void setLastModifiedDate(long ntfsLastModifiedDate) {
+ public void setLastModifiedDate(final long ntfsLastModifiedDate) {
this.lastModifiedDate = ntfsLastModifiedDate;
}
@@ -219,7 +219,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* Sets the last modified date,
* @param lastModifiedDate the last modified date
*/
- public void setLastModifiedDate(Date lastModifiedDate) {
+ public void setLastModifiedDate(final Date lastModifiedDate) {
hasLastModifiedDate = lastModifiedDate != null;
if (hasLastModifiedDate) {
this.lastModifiedDate = javaTimeToNtfsTime(lastModifiedDate);
@@ -238,7 +238,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* Sets whether this entry has got an access date at all.
* @param hasAcessDate whether this entry has got an access date at all.
*/
- public void setHasAccessDate(boolean hasAcessDate) {
+ public void setHasAccessDate(final boolean hasAcessDate) {
this.hasAccessDate = hasAcessDate;
}
@@ -261,7 +261,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* since 1 January 1601)
* @param ntfsAccessDate the access date
*/
- public void setAccessDate(long ntfsAccessDate) {
+ public void setAccessDate(final long ntfsAccessDate) {
this.accessDate = ntfsAccessDate;
}
@@ -269,7 +269,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* Sets the access date,
* @param accessDate the access date
*/
- public void setAccessDate(Date accessDate) {
+ public void setAccessDate(final Date accessDate) {
hasAccessDate = accessDate != null;
if (hasAccessDate) {
this.accessDate = javaTimeToNtfsTime(accessDate);
@@ -288,7 +288,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* Sets whether this entry has windows attributes.
* @param hasWindowsAttributes whether this entry has windows attributes.
*/
- public void setHasWindowsAttributes(boolean hasWindowsAttributes) {
+ public void setHasWindowsAttributes(final boolean hasWindowsAttributes) {
this.hasWindowsAttributes = hasWindowsAttributes;
}
@@ -304,7 +304,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* Sets the windows attributes.
* @param windowsAttributes the windows attributes
*/
- public void setWindowsAttributes(int windowsAttributes) {
+ public void setWindowsAttributes(final int windowsAttributes) {
this.windowsAttributes = windowsAttributes;
}
@@ -322,7 +322,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* Sets whether this entry has got a crc.
* @param hasCrc whether this entry has got a crc.
*/
- public void setHasCrc(boolean hasCrc) {
+ public void setHasCrc(final boolean hasCrc) {
this.hasCrc = hasCrc;
}
@@ -342,7 +342,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* @param crc the CRC
*/
@Deprecated
- public void setCrc(int crc) {
+ public void setCrc(final int crc) {
this.crc = crc;
}
@@ -360,7 +360,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* @since Compress 1.7
* @param crc the CRC
*/
- public void setCrcValue(long crc) {
+ public void setCrcValue(final long crc) {
this.crc = crc;
}
@@ -380,7 +380,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* @param crc the CRC
*/
@Deprecated
- void setCompressedCrc(int crc) {
+ void setCompressedCrc(final int crc) {
this.compressedCrc = crc;
}
@@ -398,7 +398,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* @since Compress 1.7
* @param crc the CRC
*/
- void setCompressedCrcValue(long crc) {
+ void setCompressedCrcValue(final long crc) {
this.compressedCrc = crc;
}
@@ -417,7 +417,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
*
* @param size This entry's new file size.
*/
- public void setSize(long size) {
+ public void setSize(final long size) {
this.size = size;
}
@@ -435,7 +435,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
*
* @param size This entry's new compressed file size.
*/
- void setCompressedSize(long size) {
+ void setCompressedSize(final long size) {
this.compressedSize = size;
}
@@ -453,7 +453,7 @@ public class SevenZArchiveEntry implements ArchiveEntry {
* @param methods the methods to use for the content
* @since 1.8
*/
- public void setContentMethods(Iterable<? extends SevenZMethodConfiguration> methods) {
+ public void setContentMethods(final Iterable<? extends SevenZMethodConfiguration> methods) {
if (methods != null) {
LinkedList<SevenZMethodConfiguration> l = new LinkedList<SevenZMethodConfiguration>();
for (SevenZMethodConfiguration m : methods) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index ab6198e..91017bc 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -175,7 +175,7 @@ public class SevenZFile implements Closeable {
return Arrays.asList(archive.files);
}
- private Archive readHeaders(byte[] password) throws IOException {
+ private Archive readHeaders(final byte[] password) throws IOException {
final byte[] signature = new byte[6];
file.readFully(signature);
if (!Arrays.equals(signature, sevenZSignature)) {
@@ -283,7 +283,7 @@ public class SevenZFile implements Closeable {
}
private DataInputStream readEncodedHeader(final DataInputStream header, final Archive archive,
- byte[] password) throws IOException {
+ final byte[] password) throws IOException {
readStreamsInfo(header, archive);
// FIXME: merge with buildDecodingStream()/buildDecoderStack() at some stage?
@@ -862,7 +862,7 @@ public class SevenZFile implements Closeable {
}
private InputStream buildDecoderStack(final Folder folder, final long folderOffset,
- final int firstPackStreamIndex, SevenZArchiveEntry entry) throws IOException {
+ final int firstPackStreamIndex, final SevenZArchiveEntry entry) throws IOException {
file.seek(folderOffset);
InputStream inputStreamStack =
new BufferedInputStream(
@@ -923,7 +923,7 @@ public class SevenZFile implements Closeable {
* @throws IOException
* if an I/O error has occurred
*/
- public int read(byte[] b) throws IOException {
+ public int read(final byte[] b) throws IOException {
return read(b, 0, b.length);
}
@@ -937,7 +937,7 @@ public class SevenZFile implements Closeable {
* @throws IOException
* if an I/O error has occurred
*/
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws IOException {
return getCurrentStream().read(b, off, len);
}
@@ -967,7 +967,7 @@ public class SevenZFile implements Closeable {
* @return true, if this is the signature of a 7z archive.
* @since 1.8
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < sevenZSignature.length) {
return false;
}
@@ -980,7 +980,7 @@ public class SevenZFile implements Closeable {
return true;
}
- private static long skipBytesFully(DataInput input, long bytesToSkip) throws IOException {
+ private static long skipBytesFully(final DataInput input, long bytesToSkip) throws IOException {
if (bytesToSkip < 1) {
return 0;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethod.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethod.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethod.java
index 43232ca..4092cee 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethod.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethod.java
@@ -87,7 +87,7 @@ public enum SevenZMethod {
private final byte[] id;
- private SevenZMethod(byte[] id) {
+ private SevenZMethod(final byte[] id) {
this.id = id;
}
@@ -97,7 +97,7 @@ public enum SevenZMethod {
return copy;
}
- static SevenZMethod byId(byte[] id) {
+ static SevenZMethod byId(final byte[] id) {
for (SevenZMethod m : SevenZMethod.class.getEnumConstants()) {
if (Arrays.equals(m.id, id)) {
return m;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethodConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethodConfiguration.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethodConfiguration.java
index 59aa2e4..bc47ee0 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethodConfiguration.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZMethodConfiguration.java
@@ -43,7 +43,7 @@ public class SevenZMethodConfiguration {
* Doesn't configure any additional options.
* @param method the method to use
*/
- public SevenZMethodConfiguration(SevenZMethod method) {
+ public SevenZMethodConfiguration(final SevenZMethod method) {
this(method, null);
}
@@ -53,7 +53,7 @@ public class SevenZMethodConfiguration {
* @param options the options to use
* @throws IllegalArgumentException if the method doesn't understand the options specified.
*/
- public SevenZMethodConfiguration(SevenZMethod method, Object options) {
+ public SevenZMethodConfiguration(final SevenZMethod method, final Object options) {
this.method = method;
this.options = options;
if (options != null && !Coders.findByMethod(method).canAcceptOptions(options)) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
index 4e273a2..9b23326 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java
@@ -79,7 +79,7 @@ public class SevenZOutputFile implements Closeable {
* to {@link #setContentMethods}.</p>
* @param method the default compression method
*/
- public void setContentCompression(SevenZMethod method) {
+ public void setContentCompression(final SevenZMethod method) {
setContentMethods(Collections.singletonList(new SevenZMethodConfiguration(method)));
}
@@ -97,7 +97,7 @@ public class SevenZOutputFile implements Closeable {
* @since 1.8
* @param methods the default (compression) methods
*/
- public void setContentMethods(Iterable<? extends SevenZMethodConfiguration> methods) {
+ public void setContentMethods(final Iterable<? extends SevenZMethodConfiguration> methods) {
this.contentMethods = reverse(methods);
}
@@ -316,7 +316,7 @@ public class SevenZOutputFile implements Closeable {
};
}
- private Iterable<? extends SevenZMethodConfiguration> getContentMethods(SevenZArchiveEntry entry) {
+ private Iterable<? extends SevenZMethodConfiguration> getContentMethods(final SevenZArchiveEntry entry) {
Iterable<? extends SevenZMethodConfiguration> ms = entry.getContentMethods();
return ms == null ? contentMethods : ms;
}
@@ -401,7 +401,7 @@ public class SevenZOutputFile implements Closeable {
header.write(NID.kEnd);
}
- private void writeFolder(final DataOutput header, SevenZArchiveEntry entry) throws IOException {
+ private void writeFolder(final DataOutput header, final SevenZArchiveEntry entry) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
int numCoders = 0;
for (SevenZMethodConfiguration m : getContentMethods(entry)) {
@@ -417,7 +417,7 @@ public class SevenZOutputFile implements Closeable {
}
}
- private void writeSingleCodec(SevenZMethodConfiguration m, OutputStream bos) throws IOException {
+ private void writeSingleCodec(final SevenZMethodConfiguration m, final OutputStream bos) throws IOException {
byte[] id = m.getMethod().getId();
byte[] properties = Coders.findByMethod(m.getMethod())
.getOptionsAsProperties(m.getOptions());
@@ -729,7 +729,7 @@ public class SevenZOutputFile implements Closeable {
}
}
- private static <T> Iterable<T> reverse(Iterable<T> i) {
+ private static <T> Iterable<T> reverse(final Iterable<T> i) {
LinkedList<T> l = new LinkedList<T>();
for (T t : i) {
l.addFirst(t);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
index 00a3edd..0e4fa50 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
@@ -239,7 +239,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param name the entry name
*/
- public TarArchiveEntry(String name) {
+ public TarArchiveEntry(final String name) {
this(name, false);
}
@@ -253,7 +253,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @since 1.1
*/
- public TarArchiveEntry(String name, boolean preserveLeadingSlashes) {
+ public TarArchiveEntry(String name, final boolean preserveLeadingSlashes) {
this();
this.preserveLeadingSlashes = preserveLeadingSlashes;
@@ -274,7 +274,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param name the entry name
* @param linkFlag the entry link flag.
*/
- public TarArchiveEntry(String name, byte linkFlag) {
+ public TarArchiveEntry(final String name, final byte linkFlag) {
this(name, linkFlag, false);
}
@@ -288,7 +288,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @since 1.5
*/
- public TarArchiveEntry(String name, byte linkFlag, boolean preserveLeadingSlashes) {
+ public TarArchiveEntry(final String name, final byte linkFlag, final boolean preserveLeadingSlashes) {
this(name, preserveLeadingSlashes);
this.linkFlag = linkFlag;
if (linkFlag == LF_GNUTYPE_LONGNAME) {
@@ -304,7 +304,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param file The file that the entry represents.
*/
- public TarArchiveEntry(File file) {
+ public TarArchiveEntry(final File file) {
this(file, file.getPath());
}
@@ -315,7 +315,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param file The file that the entry represents.
* @param fileName the name to be used for the entry.
*/
- public TarArchiveEntry(File file, String fileName) {
+ public TarArchiveEntry(final File file, final String fileName) {
String normalizedName = normalizeFileName(fileName, false);
this.file = file;
@@ -347,7 +347,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param headerBuf The header bytes from a tar archive entry.
* @throws IllegalArgumentException if any of the numeric fields have an invalid format
*/
- public TarArchiveEntry(byte[] headerBuf) {
+ public TarArchiveEntry(final byte[] headerBuf) {
this();
parseTarHeader(headerBuf);
}
@@ -362,7 +362,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @throws IllegalArgumentException if any of the numeric fields have an invalid format
* @throws IOException on error
*/
- public TarArchiveEntry(byte[] headerBuf, ZipEncoding encoding)
+ public TarArchiveEntry(final byte[] headerBuf, final ZipEncoding encoding)
throws IOException {
this();
parseTarHeader(headerBuf, encoding);
@@ -375,7 +375,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param it Entry to be checked for equality.
* @return True if the entries are equal.
*/
- public boolean equals(TarArchiveEntry it) {
+ public boolean equals(final TarArchiveEntry it) {
return getName().equals(it.getName());
}
@@ -387,7 +387,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @return True if the entries are equal.
*/
@Override
- public boolean equals(Object it) {
+ public boolean equals(final Object it) {
if (it == null || getClass() != it.getClass()) {
return false;
}
@@ -412,7 +412,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param desc Entry to be checked as a descendent of this.
* @return True if entry is a descendant of this.
*/
- public boolean isDescendent(TarArchiveEntry desc) {
+ public boolean isDescendent(final TarArchiveEntry desc) {
return desc.getName().startsWith(getName());
}
@@ -431,7 +431,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param name This entry's new name.
*/
- public void setName(String name) {
+ public void setName(final String name) {
this.name = normalizeFileName(name, this.preserveLeadingSlashes);
}
@@ -440,7 +440,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param mode the mode for this entry
*/
- public void setMode(int mode) {
+ public void setMode(final int mode) {
this.mode = mode;
}
@@ -460,7 +460,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @since 1.1
*/
- public void setLinkName(String link) {
+ public void setLinkName(final String link) {
this.linkName = link;
}
@@ -481,7 +481,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param userId This entry's new user id.
*/
- public void setUserId(int userId) {
+ public void setUserId(final int userId) {
setUserId((long) userId);
}
@@ -501,7 +501,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param userId This entry's new user id.
* @since 1.10
*/
- public void setUserId(long userId) {
+ public void setUserId(final long userId) {
this.userId = userId;
}
@@ -522,7 +522,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param groupId This entry's new group id.
*/
- public void setGroupId(int groupId) {
+ public void setGroupId(final int groupId) {
setGroupId((long) groupId);
}
@@ -542,7 +542,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @since 1.10
* @param groupId This entry's new group id.
*/
- public void setGroupId(long groupId) {
+ public void setGroupId(final long groupId) {
this.groupId = groupId;
}
@@ -560,7 +560,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param userName This entry's new user name.
*/
- public void setUserName(String userName) {
+ public void setUserName(final String userName) {
this.userName = userName;
}
@@ -578,7 +578,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param groupName This entry's new group name.
*/
- public void setGroupName(String groupName) {
+ public void setGroupName(final String groupName) {
this.groupName = groupName;
}
@@ -588,7 +588,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param userId This entry's new user id.
* @param groupId This entry's new group id.
*/
- public void setIds(int userId, int groupId) {
+ public void setIds(final int userId, final int groupId) {
setUserId(userId);
setGroupId(groupId);
}
@@ -599,7 +599,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param userName This entry's new user name.
* @param groupName This entry's new group name.
*/
- public void setNames(String userName, String groupName) {
+ public void setNames(final String userName, final String groupName) {
setUserName(userName);
setGroupName(groupName);
}
@@ -610,7 +610,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param time This entry's new modification time.
*/
- public void setModTime(long time) {
+ public void setModTime(final long time) {
modTime = time / MILLIS_PER_SECOND;
}
@@ -619,7 +619,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param time This entry's new modification time.
*/
- public void setModTime(Date time) {
+ public void setModTime(final Date time) {
modTime = time.getTime() / MILLIS_PER_SECOND;
}
@@ -682,7 +682,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param size This entry's new file size.
* @throws IllegalArgumentException if the size is < 0.
*/
- public void setSize(long size) {
+ public void setSize(final long size) {
if (size < 0){
throw new IllegalArgumentException("Size is out of range: "+size);
}
@@ -706,7 +706,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @throws IllegalArgumentException if the devNo is < 0.
* @since 1.4
*/
- public void setDevMajor(int devNo) {
+ public void setDevMajor(final int devNo) {
if (devNo < 0){
throw new IllegalArgumentException("Major device number is out of "
+ "range: " + devNo);
@@ -731,7 +731,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @throws IllegalArgumentException if the devNo is < 0.
* @since 1.4
*/
- public void setDevMinor(int devNo) {
+ public void setDevMinor(final int devNo) {
if (devNo < 0){
throw new IllegalArgumentException("Minor device number is out of "
+ "range: " + devNo);
@@ -970,7 +970,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
*
* @param outbuf The tar entry header buffer to fill in.
*/
- public void writeEntryHeader(byte[] outbuf) {
+ public void writeEntryHeader(final byte[] outbuf) {
try {
writeEntryHeader(outbuf, TarUtils.DEFAULT_ENCODING, false);
} catch (IOException ex) {
@@ -994,8 +994,8 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @since 1.4
* @throws IOException on error
*/
- public void writeEntryHeader(byte[] outbuf, ZipEncoding encoding,
- boolean starMode) throws IOException {
+ public void writeEntryHeader(final byte[] outbuf, final ZipEncoding encoding,
+ final boolean starMode) throws IOException {
int offset = 0;
offset = TarUtils.formatNameBytes(name, outbuf, offset, NAMELEN,
@@ -1038,8 +1038,8 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
TarUtils.formatCheckSumOctalBytes(chk, outbuf, csOffset, CHKSUMLEN);
}
- private int writeEntryHeaderField(long value, byte[] outbuf, int offset,
- int length, boolean starMode) {
+ private int writeEntryHeaderField(final long value, final byte[] outbuf, final int offset,
+ final int length, final boolean starMode) {
if (!starMode && (value < 0
|| value >= 1l << 3 * (length - 1))) {
// value doesn't fit into field when written as octal
@@ -1057,7 +1057,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param header The tar entry header buffer to get information from.
* @throws IllegalArgumentException if any of the numeric fields have an invalid format
*/
- public void parseTarHeader(byte[] header) {
+ public void parseTarHeader(final byte[] header) {
try {
parseTarHeader(header, TarUtils.DEFAULT_ENCODING);
} catch (IOException ex) {
@@ -1080,12 +1080,12 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* have an invalid format
* @throws IOException on error
*/
- public void parseTarHeader(byte[] header, ZipEncoding encoding)
+ public void parseTarHeader(final byte[] header, final ZipEncoding encoding)
throws IOException {
parseTarHeader(header, encoding, false);
}
- private void parseTarHeader(byte[] header, ZipEncoding encoding,
+ private void parseTarHeader(final byte[] header, final ZipEncoding encoding,
final boolean oldStyle)
throws IOException {
int offset = 0;
@@ -1170,7 +1170,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* turns path separators into forward slahes.
*/
private static String normalizeFileName(String fileName,
- boolean preserveLeadingSlashes) {
+ final boolean preserveLeadingSlashes) {
String osname = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if (osname != null) {
@@ -1214,7 +1214,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
* @param header The tar entry header buffer to evaluate the format for.
* @return format type
*/
- private int evaluateType(byte[] header) {
+ private int evaluateType(final byte[] header) {
if (ArchiveUtils.matchAsciiBuffer(MAGIC_GNU, header, MAGIC_OFFSET, MAGICLEN)) {
return FORMAT_OLDGNU;
}
@@ -1228,7 +1228,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
return 0;
}
- void fillGNUSparse0xData(Map<String, String> headers) {
+ void fillGNUSparse0xData(final Map<String, String> headers) {
paxGNUSparse = true;
realSize = Integer.parseInt(headers.get("GNU.sparse.size"));
if (headers.containsKey("GNU.sparse.name")) {
@@ -1237,13 +1237,13 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
}
}
- void fillGNUSparse1xData(Map<String, String> headers) {
+ void fillGNUSparse1xData(final Map<String, String> headers) {
paxGNUSparse = true;
realSize = Integer.parseInt(headers.get("GNU.sparse.realsize"));
name = headers.get("GNU.sparse.name");
}
- void fillStarSparseData(Map<String, String> headers) {
+ void fillStarSparseData(final Map<String, String> headers) {
starSparse = true;
if (headers.containsKey("SCHILY.realsize")) {
realSize = Long.parseLong(headers.get("SCHILY.realsize"));
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
index 8b47bba..8e0159e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
@@ -85,7 +85,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* Constructor for TarInputStream.
* @param is the input stream to use
*/
- public TarArchiveInputStream(InputStream is) {
+ public TarArchiveInputStream(final InputStream is) {
this(is, TarConstants.DEFAULT_BLKSIZE, TarConstants.DEFAULT_RCDSIZE);
}
@@ -95,7 +95,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* @param encoding name of the encoding to use for file names
* @since 1.4
*/
- public TarArchiveInputStream(InputStream is, String encoding) {
+ public TarArchiveInputStream(final InputStream is, final String encoding) {
this(is, TarConstants.DEFAULT_BLKSIZE, TarConstants.DEFAULT_RCDSIZE,
encoding);
}
@@ -105,7 +105,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* @param is the input stream to use
* @param blockSize the block size to use
*/
- public TarArchiveInputStream(InputStream is, int blockSize) {
+ public TarArchiveInputStream(final InputStream is, final int blockSize) {
this(is, blockSize, TarConstants.DEFAULT_RCDSIZE);
}
@@ -116,8 +116,8 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* @param encoding name of the encoding to use for file names
* @since 1.4
*/
- public TarArchiveInputStream(InputStream is, int blockSize,
- String encoding) {
+ public TarArchiveInputStream(final InputStream is, final int blockSize,
+ final String encoding) {
this(is, blockSize, TarConstants.DEFAULT_RCDSIZE, encoding);
}
@@ -127,7 +127,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* @param blockSize the block size to use
* @param recordSize the record size to use
*/
- public TarArchiveInputStream(InputStream is, int blockSize, int recordSize) {
+ public TarArchiveInputStream(final InputStream is, final int blockSize, final int recordSize) {
this(is, blockSize, recordSize, null);
}
@@ -139,8 +139,8 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* @param encoding name of the encoding to use for file names
* @since 1.4
*/
- public TarArchiveInputStream(InputStream is, int blockSize, int recordSize,
- String encoding) {
+ public TarArchiveInputStream(final InputStream is, final int blockSize, final int recordSize,
+ final String encoding) {
this.is = is;
this.hasHitEOF = false;
this.encoding = encoding;
@@ -236,7 +236,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* @param markLimit The limit to mark.
*/
@Override
- public void mark(int markLimit) {
+ public void mark(final int markLimit) {
}
/**
@@ -414,7 +414,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* @param record The record data to check.
* @return true if the record data is an End of Archive
*/
- protected boolean isEOFRecord(byte[] record) {
+ protected boolean isEOFRecord(final byte[] record) {
return record == null || ArchiveUtils.isArrayZero(record, recordSize);
}
@@ -451,7 +451,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
// NOTE, using a Map here makes it impossible to ever support GNU
// sparse files using the PAX Format 0.0, see
// https://www.gnu.org/software/tar/manual/html_section/tar_92.html#SEC188
- Map<String, String> parsePaxHeaders(InputStream i)
+ Map<String, String> parsePaxHeaders(final InputStream i)
throws IOException {
Map<String, String> headers = new HashMap<String, String>(globalPaxHeaders);
// Format is "length keyword=value\n";
@@ -503,7 +503,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
return headers;
}
- private void applyPaxHeadersToCurrentEntry(Map<String, String> headers) {
+ private void applyPaxHeadersToCurrentEntry(final Map<String, String> headers) {
/*
* The following headers are defined for Pax.
* atime, ctime, charset: cannot use these without changing TarArchiveEntry fields
@@ -640,7 +640,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* @throws IOException on error
*/
@Override
- public int read(byte[] buf, int offset, int numToRead) throws IOException {
+ public int read(final byte[] buf, final int offset, int numToRead) throws IOException {
int totalRead = 0;
if (hasHitEOF || isDirectory() || entryOffset >= entrySize) {
@@ -674,7 +674,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* <p>May return false if the current entry is a sparse file.</p>
*/
@Override
- public boolean canReadEntryData(ArchiveEntry ae) {
+ public boolean canReadEntryData(final ArchiveEntry ae) {
if (ae instanceof TarArchiveEntry) {
TarArchiveEntry te = (TarArchiveEntry) ae;
return !te.isSparse();
@@ -691,7 +691,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
return currEntry;
}
- protected final void setCurrentEntry(TarArchiveEntry e) {
+ protected final void setCurrentEntry(final TarArchiveEntry e) {
currEntry = e;
}
@@ -699,7 +699,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
return hasHitEOF;
}
- protected final void setAtEOF(boolean b) {
+ protected final void setAtEOF(final boolean b) {
hasHitEOF = b;
}
@@ -725,7 +725,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
* the number of bytes to check
* @return true, if this stream is a tar archive stream, false otherwise
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < TarConstants.VERSION_OFFSET+TarConstants.VERSIONLEN) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/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 803f6d2..4702711 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
@@ -97,7 +97,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* Constructor for TarInputStream.
* @param os the output stream to use
*/
- public TarArchiveOutputStream(OutputStream os) {
+ public TarArchiveOutputStream(final OutputStream os) {
this(os, TarConstants.DEFAULT_BLKSIZE, TarConstants.DEFAULT_RCDSIZE);
}
@@ -107,7 +107,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @param encoding name of the encoding to use for file names
* @since 1.4
*/
- public TarArchiveOutputStream(OutputStream os, String encoding) {
+ public TarArchiveOutputStream(final OutputStream os, final String encoding) {
this(os, TarConstants.DEFAULT_BLKSIZE, TarConstants.DEFAULT_RCDSIZE, encoding);
}
@@ -116,7 +116,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @param os the output stream to use
* @param blockSize the block size to use
*/
- public TarArchiveOutputStream(OutputStream os, int blockSize) {
+ public TarArchiveOutputStream(final OutputStream os, final int blockSize) {
this(os, blockSize, TarConstants.DEFAULT_RCDSIZE);
}
@@ -127,8 +127,8 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @param encoding name of the encoding to use for file names
* @since 1.4
*/
- public TarArchiveOutputStream(OutputStream os, int blockSize,
- String encoding) {
+ public TarArchiveOutputStream(final OutputStream os, final int blockSize,
+ final String encoding) {
this(os, blockSize, TarConstants.DEFAULT_RCDSIZE, encoding);
}
@@ -138,7 +138,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @param blockSize the block size to use
* @param recordSize the record size to use
*/
- public TarArchiveOutputStream(OutputStream os, int blockSize, int recordSize) {
+ public TarArchiveOutputStream(final OutputStream os, final int blockSize, final int recordSize) {
this(os, blockSize, recordSize, null);
}
@@ -150,8 +150,8 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @param encoding name of the encoding to use for file names
* @since 1.4
*/
- public TarArchiveOutputStream(OutputStream os, int blockSize,
- int recordSize, String encoding) {
+ public TarArchiveOutputStream(final OutputStream os, final int blockSize,
+ final int recordSize, final String encoding) {
out = new CountingOutputStream(os);
this.encoding = encoding;
this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
@@ -170,7 +170,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* Default is LONGFILE_ERROR.
* @param longFileMode the mode to use
*/
- public void setLongFileMode(int longFileMode) {
+ public void setLongFileMode(final int longFileMode) {
this.longFileMode = longFileMode;
}
@@ -182,7 +182,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @param bigNumberMode the mode to use
* @since 1.4
*/
- public void setBigNumberMode(int bigNumberMode) {
+ public void setBigNumberMode(final int bigNumberMode) {
this.bigNumberMode = bigNumberMode;
}
@@ -191,7 +191,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @since 1.4
* @param b whether to add a PAX extension header for non-ASCII file names.
*/
- public void setAddPaxHeadersForNonAsciiNames(boolean b) {
+ public void setAddPaxHeadersForNonAsciiNames(final boolean b) {
addPaxHeadersForNonAsciiNames = b;
}
@@ -270,7 +270,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @throws ClassCastException if archiveEntry is not an instance of TarArchiveEntry
*/
@Override
- public void putArchiveEntry(ArchiveEntry archiveEntry) throws IOException {
+ public void putArchiveEntry(final ArchiveEntry archiveEntry) throws IOException {
if (finished) {
throw new IOException("Stream has already been finished");
}
@@ -374,7 +374,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @throws IOException on error
*/
@Override
- public void write(byte[] wBuf, int wOffset, int numToWrite) throws IOException {
+ public void write(final byte[] wBuf, int wOffset, int numToWrite) throws IOException {
if (!haveUnclosedEntry) {
throw new IllegalStateException("No current tar entry");
}
@@ -446,9 +446,9 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* Writes a PAX extended header with the given map as contents.
* @since 1.4
*/
- void writePaxHeaders(TarArchiveEntry entry,
- String entryName,
- Map<String, String> headers) throws IOException {
+ void writePaxHeaders(final TarArchiveEntry entry,
+ final String entryName,
+ final Map<String, String> headers) throws IOException {
String name = "./PaxHeaders.X/" + stripTo7Bits(entryName);
if (name.length() >= TarConstants.NAMELEN) {
name = name.substring(0, TarConstants.NAMELEN - 1);
@@ -485,7 +485,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
closeArchiveEntry();
}
- private String stripTo7Bits(String name) {
+ private String stripTo7Bits(final String name) {
final int length = name.length();
StringBuilder result = new StringBuilder(length);
for (int i = 0; i < length; i++) {
@@ -503,7 +503,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @return true if the character could lead to problems when used
* inside a TarArchiveEntry name for a PAX header.
*/
- private boolean shouldBeReplaced(char c) {
+ private boolean shouldBeReplaced(final char c) {
return c == 0 // would be read as Trailing null
|| c == '/' // when used as last character TAE will consider the PAX header a directory
|| c == '\\'; // same as '/' as slashes get "normalized" on Windows
@@ -524,7 +524,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
}
@Override
- public ArchiveEntry createArchiveEntry(File inputFile, String entryName)
+ public ArchiveEntry createArchiveEntry(final File inputFile, final String entryName)
throws IOException {
if(finished) {
throw new IOException("Stream has already been finished");
@@ -538,7 +538,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @param record The record data to write to the archive.
* @throws IOException on error
*/
- private void writeRecord(byte[] record) throws IOException {
+ private void writeRecord(final byte[] record) throws IOException {
if (record.length != recordSize) {
throw new IOException("record to write has length '"
+ record.length
@@ -559,7 +559,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @param offset The offset of the record data within buf.
* @throws IOException on error
*/
- private void writeRecord(byte[] buf, int offset) throws IOException {
+ private void writeRecord(final byte[] buf, final int offset) throws IOException {
if (offset + recordSize > buf.length) {
throw new IOException("record has length '" + buf.length
@@ -581,8 +581,8 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
}
}
- private void addPaxHeadersForBigNumbers(Map<String, String> paxHeaders,
- TarArchiveEntry entry) {
+ private void addPaxHeadersForBigNumbers(final Map<String, String> paxHeaders,
+ final TarArchiveEntry entry) {
addPaxHeaderForBigNumber(paxHeaders, "size", entry.getSize(),
TarConstants.MAXSIZE);
addPaxHeaderForBigNumber(paxHeaders, "gid", entry.getLongGroupId(),
@@ -601,15 +601,15 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
failForBigNumber("mode", entry.getMode(), TarConstants.MAXID);
}
- private void addPaxHeaderForBigNumber(Map<String, String> paxHeaders,
- String header, long value,
- long maxValue) {
+ private void addPaxHeaderForBigNumber(final Map<String, String> paxHeaders,
+ final String header, final long value,
+ final long maxValue) {
if (value < 0 || value > maxValue) {
paxHeaders.put(header, String.valueOf(value));
}
}
- private void failForBigNumbers(TarArchiveEntry entry) {
+ private void failForBigNumbers(final TarArchiveEntry entry) {
failForBigNumber("entry size", entry.getSize(), TarConstants.MAXSIZE);
failForBigNumberWithPosixMessage("group id", entry.getLongGroupId(), TarConstants.MAXID);
failForBigNumber("last modification time",
@@ -623,15 +623,15 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
TarConstants.MAXID);
}
- private void failForBigNumber(String field, long value, long maxValue) {
+ private void failForBigNumber(final String field, final long value, final long maxValue) {
failForBigNumber(field, value, maxValue, "");
}
- private void failForBigNumberWithPosixMessage(String field, long value, long maxValue) {
+ private void failForBigNumberWithPosixMessage(final String field, final long value, final long maxValue) {
failForBigNumber(field, value, maxValue, " Use STAR or POSIX extensions to overcome this limit");
}
- private void failForBigNumber(String field, long value, long maxValue, String additionalMsg) {
+ private void failForBigNumber(final String field, final long value, final long maxValue, final String additionalMsg) {
if (value < 0 || value > maxValue) {
throw new RuntimeException(field + " '" + value
+ "' is too big ( > "
@@ -661,9 +661,9 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
* @param fieldName the name of the field
* @return whether a pax header has been written.
*/
- private boolean handleLongName(TarArchiveEntry entry , String name,
- Map<String, String> paxHeaders,
- String paxHeaderName, byte linkType, String fieldName)
+ private boolean handleLongName(final TarArchiveEntry entry , final String name,
+ final Map<String, String> paxHeaders,
+ final String paxHeaderName, final byte linkType, final String fieldName)
throws IOException {
final ByteBuffer encodedName = zipEncoding.encode(name);
final int len = encodedName.limit() - encodedName.position();
@@ -692,7 +692,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream {
return false;
}
- private void transferModTime(TarArchiveEntry from, TarArchiveEntry to) {
+ private void transferModTime(final TarArchiveEntry from, final TarArchiveEntry to) {
Date fromModTime = from.getModTime();
long fromModTimeSeconds = fromModTime.getTime() / 1000;
if (fromModTimeSeconds < 0 || fromModTimeSeconds > TarConstants.MAXSIZE) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveSparseEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveSparseEntry.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveSparseEntry.java
index 79b36ac..a49e718 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveSparseEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveSparseEntry.java
@@ -51,7 +51,7 @@ public class TarArchiveSparseEntry implements TarConstants {
* @param headerBuf The header bytes from a tar archive entry.
* @throws IOException on unknown format
*/
- public TarArchiveSparseEntry(byte[] headerBuf) throws IOException {
+ public TarArchiveSparseEntry(final byte[] headerBuf) throws IOException {
int offset = 0;
offset += SPARSELEN_GNU_SPARSE;
isExtended = TarUtils.parseBoolean(headerBuf, offset);
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
index ba850a5..1138fd1 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
@@ -46,10 +46,10 @@ public class TarUtils {
*/
static final ZipEncoding FALLBACK_ENCODING = new ZipEncoding() {
@Override
- public boolean canEncode(String name) { return true; }
+ public boolean canEncode(final String name) { return true; }
@Override
- public ByteBuffer encode(String name) {
+ public ByteBuffer encode(final String name) {
final int length = name.length();
byte[] buf = new byte[length];
@@ -61,7 +61,7 @@ public class TarUtils {
}
@Override
- public String decode(byte[] buffer) {
+ public String decode(final byte[] buffer) {
final int length = buffer.length;
StringBuilder result = new StringBuilder(length);
@@ -233,8 +233,8 @@ public class TarUtils {
}
// Helper method to generate the exception message
- private static String exceptionMessage(byte[] buffer, final int offset,
- final int length, int current, final byte currentByte) {
+ private static String exceptionMessage(final byte[] buffer, final int offset,
+ final int length, final int current, final byte currentByte) {
// default charset is good enough for an exception message,
//
// the alternative was to modify parseOctal and
@@ -259,7 +259,7 @@ public class TarUtils {
* @param length The maximum number of bytes to parse.
* @return The entry name.
*/
- public static String parseName(byte[] buffer, final int offset, final int length) {
+ public static String parseName(final byte[] buffer, final int offset, final int length) {
try {
return parseName(buffer, offset, length, DEFAULT_ENCODING);
} catch (IOException ex) {
@@ -285,7 +285,7 @@ public class TarUtils {
* @return The entry name.
* @throws IOException on error
*/
- public static String parseName(byte[] buffer, final int offset,
+ public static String parseName(final byte[] buffer, final int offset,
final int length,
final ZipEncoding encoding)
throws IOException {
@@ -319,7 +319,7 @@ public class TarUtils {
* @param length The maximum number of header bytes to copy.
* @return The updated offset, i.e. offset + length
*/
- public static int formatNameBytes(String name, byte[] buf, final int offset, final int length) {
+ public static int formatNameBytes(final String name, final byte[] buf, final int offset, final int length) {
try {
return formatNameBytes(name, buf, offset, length, DEFAULT_ENCODING);
} catch (IOException ex) {
@@ -351,7 +351,7 @@ public class TarUtils {
* @return The updated offset, i.e. offset + length
* @throws IOException on error
*/
- public static int formatNameBytes(String name, byte[] buf, final int offset,
+ public static int formatNameBytes(final String name, final byte[] buf, final int offset,
final int length,
final ZipEncoding encoding)
throws IOException {
@@ -380,7 +380,7 @@ public class TarUtils {
* @param length length of buffer to fill
* @throws IllegalArgumentException if the value will not fit in the buffer
*/
- public static void formatUnsignedOctalString(final long value, byte[] buffer,
+ public static void formatUnsignedOctalString(final long value, final byte[] buffer,
final int offset, final int length) {
int remaining = length;
remaining--;
@@ -419,7 +419,7 @@ public class TarUtils {
* @return The updated offset, i.e offset+length
* @throws IllegalArgumentException if the value (and trailer) will not fit in the buffer
*/
- public static int formatOctalBytes(final long value, byte[] buf, final int offset, final int length) {
+ public static int formatOctalBytes(final long value, final byte[] buf, final int offset, final int length) {
int idx=length-2; // For space and trailing null
formatUnsignedOctalString(value, buf, offset, idx);
@@ -444,7 +444,7 @@ public class TarUtils {
* @return The updated offset
* @throws IllegalArgumentException if the value (and trailer) will not fit in the buffer
*/
- public static int formatLongOctalBytes(final long value, byte[] buf, final int offset, final int length) {
+ public static int formatLongOctalBytes(final long value, final byte[] buf, final int offset, final int length) {
int idx=length-1; // For space
@@ -472,7 +472,7 @@ public class TarUtils {
* @since 1.4
*/
public static int formatLongOctalOrBinaryBytes(
- final long value, byte[] buf, final int offset, final int length) {
+ final long value, final byte[] buf, final int offset, final int length) {
// Check whether we are dealing with UID/GID or SIZE field
final long maxAsOctalChar = length == TarConstants.UIDLEN ? TarConstants.MAXID : TarConstants.MAXSIZE;
@@ -491,7 +491,7 @@ public class TarUtils {
return offset + length;
}
- private static void formatLongBinary(final long value, byte[] buf,
+ private static void formatLongBinary(final long value, final byte[] buf,
final int offset, final int length,
final boolean negative) {
final int bits = (length - 1) * 8;
@@ -512,7 +512,7 @@ public class TarUtils {
}
}
- private static void formatBigIntegerBinary(final long value, byte[] buf,
+ private static void formatBigIntegerBinary(final long value, final byte[] buf,
final int offset,
final int length,
final boolean negative) {
@@ -541,7 +541,7 @@ public class TarUtils {
* @return The updated value of offset, i.e. offset+length
* @throws IllegalArgumentException if the value (and trailer) will not fit in the buffer
*/
- public static int formatCheckSumOctalBytes(final long value, byte[] buf, final int offset, final int length) {
+ public static int formatCheckSumOctalBytes(final long value, final byte[] buf, final int offset, final int length) {
int idx=length-2; // for NUL and space
formatUnsignedOctalString(value, buf, offset, idx);
@@ -593,7 +593,7 @@ public class TarUtils {
* @see <a href="https://issues.apache.org/jira/browse/COMPRESS-191">COMPRESS-191</a>
* @since 1.5
*/
- public static boolean verifyCheckSum(byte[] header) {
+ public static boolean verifyCheckSum(final byte[] header) {
long storedSum = parseOctal(header, CHKSUM_OFFSET, CHKSUMLEN);
long unsignedSum = 0;
long signedSum = 0;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
index 21d5edf..ac7bbba 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java
@@ -48,7 +48,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
* @param len The length of the encoded filename or commentin
* <code>bytes</code>.
*/
- protected AbstractUnicodeExtraField(String text, byte[] bytes, int off, int len) {
+ protected AbstractUnicodeExtraField(final String text, final byte[] bytes, final int off, final int len) {
CRC32 crc32 = new CRC32();
crc32.update(bytes, off, len);
nameCRC32 = crc32.getValue();
@@ -68,7 +68,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
* @param bytes The encoded of the filename or comment in the zip
* file.
*/
- protected AbstractUnicodeExtraField(String text, byte[] bytes) {
+ protected AbstractUnicodeExtraField(final String text, final byte[] bytes) {
this(text, bytes, 0, bytes.length);
}
@@ -96,7 +96,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
* @param nameCRC32 The CRC32 checksum of the filename as encoded
* in the central directory of the zip file to set.
*/
- public void setNameCRC32(long nameCRC32) {
+ public void setNameCRC32(final long nameCRC32) {
this.nameCRC32 = nameCRC32;
data = null;
}
@@ -116,7 +116,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
/**
* @param unicodeName The UTF-8 encoded name to set.
*/
- public void setUnicodeName(byte[] unicodeName) {
+ public void setUnicodeName(final byte[] unicodeName) {
if (unicodeName != null) {
this.unicodeName = new byte[unicodeName.length];
System.arraycopy(unicodeName, 0, this.unicodeName, 0,
@@ -159,7 +159,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
}
@Override
- public void parseFromLocalFileData(byte[] buffer, int offset, int length)
+ public void parseFromLocalFileData(final byte[] buffer, final int offset, final int length)
throws ZipException {
if (length < 5) {
@@ -184,8 +184,8 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
* same data in central directory and local file data.
*/
@Override
- public void parseFromCentralDirectoryData(byte[] buffer, int offset,
- int length)
+ public void parseFromCentralDirectoryData(final byte[] buffer, final int offset,
+ final int length)
throws ZipException {
parseFromLocalFileData(buffer, offset, length);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java b/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
index 983422a..de5ad31 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/AsiExtraField.java
@@ -166,7 +166,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* Set the user id.
* @param uid the user id
*/
- public void setUserId(int uid) {
+ public void setUserId(final int uid) {
this.uid = uid;
}
@@ -182,7 +182,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* Set the group id.
* @param gid the group id
*/
- public void setGroupId(int gid) {
+ public void setGroupId(final int gid) {
this.gid = gid;
}
@@ -200,7 +200,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* @param name Name of the file this entry links to, empty String
* if it is not a symbolic link.
*/
- public void setLinkedFile(String name) {
+ public void setLinkedFile(final String name) {
link = name;
mode = getMode(mode);
}
@@ -227,7 +227,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* File mode of this file.
* @param mode the file mode
*/
- public void setMode(int mode) {
+ public void setMode(final int mode) {
this.mode = getMode(mode);
}
@@ -243,7 +243,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* Indicate whether this entry is a directory.
* @param dirFlag if true, this entry is a directory
*/
- public void setDirectory(boolean dirFlag) {
+ public void setDirectory(final boolean dirFlag) {
this.dirFlag = dirFlag;
mode = getMode(mode);
}
@@ -264,7 +264,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* @throws ZipException on error
*/
@Override
- public void parseFromLocalFileData(byte[] data, int offset, int length)
+ public void parseFromLocalFileData(final byte[] data, final int offset, final int length)
throws ZipException {
long givenChecksum = ZipLong.getValue(data, offset);
@@ -302,8 +302,8 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* same data in central directory and local file data.
*/
@Override
- public void parseFromCentralDirectoryData(byte[] buffer, int offset,
- int length)
+ public void parseFromCentralDirectoryData(final byte[] buffer, final int offset,
+ final int length)
throws ZipException {
parseFromLocalFileData(buffer, offset, length);
}
@@ -313,7 +313,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* @param mode the mode
* @return the type with the mode
*/
- protected int getMode(int mode) {
+ protected int getMode(final int mode) {
int type = FILE_FLAG;
if (isLink()) {
type = LINK_FLAG;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/BinaryTree.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/BinaryTree.java b/src/main/java/org/apache/commons/compress/archivers/zip/BinaryTree.java
index a4ac4b5..494fae8 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/BinaryTree.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/BinaryTree.java
@@ -44,7 +44,7 @@ class BinaryTree {
*/
private final int[] tree;
- public BinaryTree(int depth) {
+ public BinaryTree(final int depth) {
tree = new int[(1 << (depth + 1)) - 1];
Arrays.fill(tree, UNDEFINED);
}
@@ -57,7 +57,7 @@ class BinaryTree {
* @param depth the number of nodes in the path
* @param value the value of the leaf (must be positive)
*/
- public void addLeaf(int node, int path, int depth, int value) {
+ public void addLeaf(final int node, final int path, final int depth, final int value) {
if (depth == 0) {
// end of the path reached, add the value to the current node
if (tree[node] == UNDEFINED) {
@@ -81,7 +81,7 @@ class BinaryTree {
* @param stream
* @return the value decoded, or -1 if the end of the stream is reached
*/
- public int read(BitStream stream) throws IOException {
+ public int read(final BitStream stream) throws IOException {
int currentIndex = 0;
while (true) {
@@ -107,7 +107,7 @@ class BinaryTree {
/**
* Decodes the packed binary tree from the specified stream.
*/
- static BinaryTree decode(InputStream in, final int totalNumberOfValues) throws IOException {
+ static BinaryTree decode(final InputStream in, final int totalNumberOfValues) throws IOException {
// the first byte contains the size of the structure minus one
int size = in.read() + 1;
if (size == 0) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/BitStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/BitStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/BitStream.java
index d40c1ad..98e80fe 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/BitStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/BitStream.java
@@ -32,7 +32,7 @@ import java.nio.ByteOrder;
*/
class BitStream extends BitInputStream {
- BitStream(InputStream in) {
+ BitStream(final InputStream in) {
super(in, ByteOrder.LITTLE_ENDIAN);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java b/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
index 10a35a8..ad50bd6 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/CircularBuffer.java
@@ -39,7 +39,7 @@ class CircularBuffer {
/** Index of the next data written in the buffer */
private int writeIndex;
- CircularBuffer(int size) {
+ CircularBuffer(final int size) {
this.size = size;
buffer = new byte[size];
}
@@ -54,7 +54,7 @@ class CircularBuffer {
/**
* Writes a byte to the buffer.
*/
- public void put(int value) {
+ public void put(final int value) {
buffer[writeIndex] = (byte) value;
writeIndex = (writeIndex + 1) % size;
}
@@ -77,7 +77,7 @@ class CircularBuffer {
* @param distance the distance from the current write position
* @param length the number of bytes to copy
*/
- public void copy(int distance, int length) {
+ public void copy(final int distance, final int length) {
int pos1 = writeIndex - distance;
int pos2 = pos1 + length;
for (int i = pos1; i < pos2; i++) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
index 87d3c52..5949c60 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
@@ -70,7 +70,7 @@ class ExplodingInputStream extends InputStream {
* @param numberOfTrees the number of trees (2 or 3)
* @param in the compressed data stream
*/
- public ExplodingInputStream(int dictionarySize, int numberOfTrees, InputStream in) {
+ public ExplodingInputStream(final int dictionarySize, final int numberOfTrees, final InputStream in) {
if (dictionarySize != 4096 && dictionarySize != 8192) {
throw new IllegalArgumentException("The dictionary size must be 4096 or 8192");
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java b/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java
index c1e17d6..9cff3c2 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java
@@ -61,7 +61,7 @@ public class ExtraFieldUtils {
* the {@link ZipExtraField ZipExtraField interface}.</p>
* @param c the class to register
*/
- public static void register(Class<?> c) {
+ public static void register(final Class<?> c) {
try {
ZipExtraField ze = (ZipExtraField) c.newInstance();
implementations.put(ze.getHeaderId(), c);
@@ -82,7 +82,7 @@ public class ExtraFieldUtils {
* @exception InstantiationException if unable to instantiate the class
* @exception IllegalAccessException if not allowed to instantiate the class
*/
- public static ZipExtraField createExtraField(ZipShort headerId)
+ public static ZipExtraField createExtraField(final ZipShort headerId)
throws InstantiationException, IllegalAccessException {
Class<?> c = implementations.get(headerId);
if (c != null) {
@@ -101,7 +101,7 @@ public class ExtraFieldUtils {
* @return an array of ExtraFields
* @throws ZipException on error
*/
- public static ZipExtraField[] parse(byte[] data) throws ZipException {
+ public static ZipExtraField[] parse(final byte[] data) throws ZipException {
return parse(data, true, UnparseableExtraField.THROW);
}
@@ -114,7 +114,7 @@ public class ExtraFieldUtils {
* @return an array of ExtraFields
* @throws ZipException on error
*/
- public static ZipExtraField[] parse(byte[] data, boolean local)
+ public static ZipExtraField[] parse(final byte[] data, final boolean local)
throws ZipException {
return parse(data, local, UnparseableExtraField.THROW);
}
@@ -132,8 +132,8 @@ public class ExtraFieldUtils {
*
* @since 1.1
*/
- public static ZipExtraField[] parse(byte[] data, boolean local,
- UnparseableExtraField onUnparseableData)
+ public static ZipExtraField[] parse(final byte[] data, final boolean local,
+ final UnparseableExtraField onUnparseableData)
throws ZipException {
List<ZipExtraField> v = new ArrayList<ZipExtraField>();
int start = 0;
@@ -198,7 +198,7 @@ public class ExtraFieldUtils {
* @param data an array of ExtraFiles
* @return an array of bytes
*/
- public static byte[] mergeLocalFileDataData(ZipExtraField[] data) {
+ public static byte[] mergeLocalFileDataData(final ZipExtraField[] data) {
final boolean lastIsUnparseableHolder = data.length > 0
&& data[data.length - 1] instanceof UnparseableExtraFieldData;
int regularExtraFieldCount =
@@ -237,7 +237,7 @@ public class ExtraFieldUtils {
* @param data an array of ExtraFields
* @return an array of bytes
*/
- public static byte[] mergeCentralDirectoryData(ZipExtraField[] data) {
+ public static byte[] mergeCentralDirectoryData(final ZipExtraField[] data) {
final boolean lastIsUnparseableHolder = data.length > 0
&& data[data.length - 1] instanceof UnparseableExtraFieldData;
int regularExtraFieldCount =
@@ -312,7 +312,7 @@ public class ExtraFieldUtils {
private final int key;
- private UnparseableExtraField(int k) {
+ private UnparseableExtraField(final int k) {
key = k;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java b/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
index 4551b79..757bcbd 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java
@@ -57,7 +57,7 @@ class FallbackZipEncoding implements ZipEncoding {
* @param charsetName The name of the charset or {@code null} for
* the platform's default character set.
*/
- public FallbackZipEncoding(String charsetName) {
+ public FallbackZipEncoding(final String charsetName) {
this.charsetName = charsetName;
}
@@ -66,7 +66,7 @@ class FallbackZipEncoding implements ZipEncoding {
* org.apache.commons.compress.archivers.zip.ZipEncoding#canEncode(java.lang.String)
*/
@Override
- public boolean canEncode(String name) {
+ public boolean canEncode(final String name) {
return true;
}
@@ -75,7 +75,7 @@ class FallbackZipEncoding implements ZipEncoding {
* org.apache.commons.compress.archivers.zip.ZipEncoding#encode(java.lang.String)
*/
@Override
- public ByteBuffer encode(String name) throws IOException {
+ public ByteBuffer encode(final String name) throws IOException {
if (this.charsetName == null) { // i.e. use default charset, see no-args constructor
return ByteBuffer.wrap(name.getBytes());
}
@@ -87,7 +87,7 @@ class FallbackZipEncoding implements ZipEncoding {
* org.apache.commons.compress.archivers.zip.ZipEncoding#decode(byte[])
*/
@Override
- public String decode(byte[] data) throws IOException {
+ public String decode(final byte[] data) throws IOException {
if (this.charsetName == null) { // i.e. use default charset, see no-args constructor
return new String(data);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBit.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBit.java b/src/main/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBit.java
index 07775db..73c13d5 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBit.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/GeneralPurposeBit.java
@@ -91,7 +91,7 @@ public final class GeneralPurposeBit implements Cloneable {
* whether the current entry will use UTF8 for file name and comment.
* @param b whether the current entry will use UTF8 for file name and comment.
*/
- public void useUTF8ForNames(boolean b) {
+ public void useUTF8ForNames(final boolean b) {
languageEncodingFlag = b;
}
@@ -111,7 +111,7 @@ public final class GeneralPurposeBit implements Cloneable {
* @param b whether the current entry will use the data descriptor to store
* CRC and size information
*/
- public void useDataDescriptor(boolean b) {
+ public void useDataDescriptor(final boolean b) {
dataDescriptorFlag = b;
}
@@ -127,7 +127,7 @@ public final class GeneralPurposeBit implements Cloneable {
* whether the current entry will be encrypted.
* @param b whether the current entry will be encrypted
*/
- public void useEncryption(boolean b) {
+ public void useEncryption(final boolean b) {
encryptionFlag = b;
}
@@ -143,7 +143,7 @@ public final class GeneralPurposeBit implements Cloneable {
* whether the current entry will be encrypted using strong encryption.
* @param b whether the current entry will be encrypted using strong encryption
*/
- public void useStrongEncryption(boolean b) {
+ public void useStrongEncryption(final boolean b) {
strongEncryptionFlag = b;
if (b) {
useEncryption(true);
@@ -183,7 +183,7 @@ public final class GeneralPurposeBit implements Cloneable {
* The offset within the output buffer of the first byte to be written.
* must be non-negative and no larger than <tt>buf.length-2</tt>
*/
- public void encode(byte[] buf, int offset) {
+ public void encode(final byte[] buf, final int offset) {
ZipShort.putShort((dataDescriptorFlag ? DATA_DESCRIPTOR_FLAG : 0)
|
(languageEncodingFlag ? UFT8_NAMES_FLAG : 0)
@@ -222,7 +222,7 @@ public final class GeneralPurposeBit implements Cloneable {
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (!(o instanceof GeneralPurposeBit)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java b/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java
index 81d9053..ad12f37 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java
@@ -102,7 +102,7 @@ public final class JarMarker implements ZipExtraField {
* @throws ZipException on error
*/
@Override
- public void parseFromLocalFileData(byte[] data, int offset, int length)
+ public void parseFromLocalFileData(final byte[] data, final int offset, final int length)
throws ZipException {
if (length != 0) {
throw new ZipException("JarMarker doesn't expect any data");
@@ -114,8 +114,8 @@ public final class JarMarker implements ZipExtraField {
* same data in central directory and local file data.
*/
@Override
- public void parseFromCentralDirectoryData(byte[] buffer, int offset,
- int length)
+ public void parseFromCentralDirectoryData(final byte[] buffer, final int offset,
+ final int length)
throws ZipException {
parseFromLocalFileData(buffer, offset, length);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java b/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
index 9ec15a5..8cea9c7 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java
@@ -47,7 +47,7 @@ class NioZipEncoding implements ZipEncoding {
*
* @param charset The NIO charset to wrap.
*/
- public NioZipEncoding(Charset charset) {
+ public NioZipEncoding(final Charset charset) {
this.charset = charset;
}
@@ -56,7 +56,7 @@ class NioZipEncoding implements ZipEncoding {
* org.apache.commons.compress.archivers.zip.ZipEncoding#canEncode(java.lang.String)
*/
@Override
- public boolean canEncode(String name) {
+ public boolean canEncode(final String name) {
CharsetEncoder enc = this.charset.newEncoder();
enc.onMalformedInput(CodingErrorAction.REPORT);
enc.onUnmappableCharacter(CodingErrorAction.REPORT);
@@ -69,7 +69,7 @@ class NioZipEncoding implements ZipEncoding {
* org.apache.commons.compress.archivers.zip.ZipEncoding#encode(java.lang.String)
*/
@Override
- public ByteBuffer encode(String name) {
+ public ByteBuffer encode(final String name) {
CharsetEncoder enc = this.charset.newEncoder();
enc.onMalformedInput(CodingErrorAction.REPORT);
@@ -117,7 +117,7 @@ class NioZipEncoding implements ZipEncoding {
* org.apache.commons.compress.archivers.zip.ZipEncoding#decode(byte[])
*/
@Override
- public String decode(byte[] data) throws IOException {
+ public String decode(final byte[] data) throws IOException {
return this.charset.newDecoder()
.onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT)
[04/46] commons-compress git commit: Remove redundant superinterface.
Posted by bo...@apache.org.
Remove redundant superinterface.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/9045ef93
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/9045ef93
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/9045ef93
Branch: refs/heads/COMPRESS-207
Commit: 9045ef9367f390434eb7b4b0e16a92413ef6c304
Parents: 3cbd999
Author: ggregory <gg...@apache.org>
Authored: Wed Apr 6 02:04:33 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Wed Apr 6 02:04:33 2016 -0700
----------------------------------------------------------------------
.../commons/compress/archivers/zip/X0014_X509Certificates.java | 2 +-
.../commons/compress/archivers/zip/X0015_CertificateIdForFile.java | 2 +-
.../archivers/zip/X0016_CertificateIdForCentralDirectory.java | 2 +-
.../compress/archivers/zip/X0017_StrongEncryptionHeader.java | 2 +-
.../archivers/zip/X0019_EncryptionRecipientCertificateList.java | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/9045ef93/src/main/java/org/apache/commons/compress/archivers/zip/X0014_X509Certificates.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0014_X509Certificates.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0014_X509Certificates.java
index 2a13d88..79c3f18 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0014_X509Certificates.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0014_X509Certificates.java
@@ -40,7 +40,7 @@ package org.apache.commons.compress.archivers.zip;
* @NotThreadSafe
* @since 1.11
*/
-public class X0014_X509Certificates extends PKWareExtraHeader implements ZipExtraField {
+public class X0014_X509Certificates extends PKWareExtraHeader {
private static final long serialVersionUID = 1L;
public X0014_X509Certificates() {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/9045ef93/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
index 3253482..0342dc3 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0015_CertificateIdForFile.java
@@ -41,7 +41,7 @@ package org.apache.commons.compress.archivers.zip;
* @NotThreadSafe
* @since 1.11
*/
-public class X0015_CertificateIdForFile extends PKWareExtraHeader implements ZipExtraField {
+public class X0015_CertificateIdForFile extends PKWareExtraHeader {
private static final long serialVersionUID = 1L;
public X0015_CertificateIdForFile() {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/9045ef93/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
index ae79b07..35fe25f8 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0016_CertificateIdForCentralDirectory.java
@@ -42,7 +42,7 @@ package org.apache.commons.compress.archivers.zip;
* @NotThreadSafe
* @since 1.11
*/
-public class X0016_CertificateIdForCentralDirectory extends PKWareExtraHeader implements ZipExtraField {
+public class X0016_CertificateIdForCentralDirectory extends PKWareExtraHeader {
private static final long serialVersionUID = 1L;
public X0016_CertificateIdForCentralDirectory() {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/9045ef93/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
index 790731c..1d49d50 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0017_StrongEncryptionHeader.java
@@ -242,7 +242,7 @@ package org.apache.commons.compress.archivers.zip;
* @NotThreadSafe
* @since 1.11
*/
-public class X0017_StrongEncryptionHeader extends PKWareExtraHeader implements ZipExtraField {
+public class X0017_StrongEncryptionHeader extends PKWareExtraHeader {
private static final long serialVersionUID = 1L;
public X0017_StrongEncryptionHeader() {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/9045ef93/src/main/java/org/apache/commons/compress/archivers/zip/X0019_EncryptionRecipientCertificateList.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X0019_EncryptionRecipientCertificateList.java b/src/main/java/org/apache/commons/compress/archivers/zip/X0019_EncryptionRecipientCertificateList.java
index 935933a..2218f45 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X0019_EncryptionRecipientCertificateList.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X0019_EncryptionRecipientCertificateList.java
@@ -48,7 +48,7 @@ package org.apache.commons.compress.archivers.zip;
* @NotThreadSafe
* @since 1.11
*/
-public class X0019_EncryptionRecipientCertificateList extends PKWareExtraHeader implements ZipExtraField {
+public class X0019_EncryptionRecipientCertificateList extends PKWareExtraHeader {
private static final long serialVersionUID = 1L;
public X0019_EncryptionRecipientCertificateList() {
[20/46] commons-compress git commit: Statement unnecessarily nested
within else clause.
Posted by bo...@apache.org.
Statement unnecessarily nested within else clause.
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/e21728ce
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/e21728ce
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/e21728ce
Branch: refs/heads/COMPRESS-207
Commit: e21728cef4e89ff5fb173c230d56d16d424dc6c2
Parents: 05bb97b
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 08:54:32 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 08:54:32 2016 -0700
----------------------------------------------------------------------
.../commons/compress/archivers/ArchiveStreamFactoryTest.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/e21728ce/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
index 0352fed..a64b9a6 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
@@ -368,10 +368,9 @@ public class ArchiveStreamFactoryTest {
final Object object = fld.get(instance);
if (object instanceof String || object == null) {
return (String) object;
- } else {
- System.out.println("Wrong type: " + object.getClass().getCanonicalName() + " for " + name + " in class " + instance.getClass().getSimpleName());
- return "??";
}
+ System.out.println("Wrong type: " + object.getClass().getCanonicalName() + " for " + name + " in class " + instance.getClass().getSimpleName());
+ return "??";
} catch (Exception e) {
e.printStackTrace();
return "??";