commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1444819 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers: cpio/CpioArchiveInputStream.java dump/TapeInputStream.java zip/ZipArchiveEntry.java
Date Mon, 11 Feb 2013 15:13:21 GMT
Author: bodewig
Date: Mon Feb 11 15:13:08 2013
New Revision: 1444819

URL: http://svn.apache.org/r1444819
Log:
make PMD and findbugs a bit less unhappy

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java?rev=1444819&r1=1444818&r2=1444819&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
Mon Feb 11 15:13:08 2013
@@ -455,9 +455,15 @@ public class CpioArchiveInputStream exte
      * Skips the padding zeros written after the TRAILER!!! entry.
      */
     private void skipRemainderOfLastBlock() throws IOException {
-        long readFromLastBlock = (getBytesRead() % blockSize);
-        if (readFromLastBlock != 0) {
-            skip(blockSize - readFromLastBlock);
+        long readFromLastBlock = getBytesRead() % blockSize;
+        long remainingBytes = readFromLastBlock == 0 ? 0
+            : blockSize - readFromLastBlock;
+        while (remainingBytes > 0) {
+            long skipped = skip(blockSize - readFromLastBlock);
+            if (skipped <= 0) {
+                break;
+            }
+            remainingBytes -= skipped;
         }
     }
 

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java?rev=1444819&r1=1444818&r2=1444819&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
Mon Feb 11 15:13:08 2013
@@ -37,7 +37,7 @@ class TapeInputStream extends FilterInpu
     private byte[] blockBuffer = new byte[DumpArchiveConstants.TP_SIZE];
     private int currBlkIdx = -1;
     private int blockSize = DumpArchiveConstants.TP_SIZE;
-    private final int recordSize = DumpArchiveConstants.TP_SIZE;
+    private static final int recordSize = DumpArchiveConstants.TP_SIZE;
     private int readOffset = DumpArchiveConstants.TP_SIZE;
     private boolean isCompressed = false;
     private long bytesRead = 0;

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java?rev=1444819&r1=1444818&r2=1444819&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
Mon Feb 11 15:13:08 2013
@@ -20,8 +20,6 @@ package org.apache.commons.compress.arch
 import org.apache.commons.compress.archivers.ArchiveEntry;
 
 import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;



Mime
View raw message