commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r760187 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
Date Mon, 30 Mar 2009 21:33:43 GMT
Author: sebb
Date: Mon Mar 30 21:33:36 2009
New Revision: 760187

URL: http://svn.apache.org/viewvc?rev=760187&view=rev
Log:
Fix TODOs

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.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=760187&r1=760186&r2=760187&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 Mar 30 21:33:36 2009
@@ -249,8 +249,7 @@
             return -1;
         }
 
-        int tmpread = this.in.read(b, off, tmplength);
-        // TODO - what about EOF or short reads?
+        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;
@@ -319,8 +318,7 @@
         String name = readCString((int) namesize);
         ret.setName(name);
         if (mode == 0 && !name.equals(CPIO_TRAILER)){
-            // TODO - change this to throw
-            new IOException("Mode 0 only allowed in the trailer. Found: "+name).printStackTrace();
+            throw new IOException("Mode 0 only allowed in the trailer. Found entry name:
"+name);
         }
         skip(ret.getHeaderPadCount());
 
@@ -346,8 +344,7 @@
         final String name = readCString((int) namesize);
         ret.setName(name);
         if (mode == 0 && !name.equals(CPIO_TRAILER)){
-            // TODO - change this to throw
-            new IOException("Mode 0 only allowed in the trailer. Found: "+name).printStackTrace();
+            throw new IOException("Mode 0 only allowed in the trailer. Found entry: "+name);
         }
 
         return ret;
@@ -373,8 +370,7 @@
         final String name = readCString((int) namesize);
         ret.setName(name);
         if (mode == 0 && !name.equals(CPIO_TRAILER)){
-            // TODO - change this to throw
-            new IOException("Mode 0 only allowed in the trailer. Found: "+name).printStackTrace();
+            throw new IOException("Mode 0 only allowed in the trailer. Found entry: "+name);
         }
         skip(ret.getHeaderPadCount());
 



Mime
View raw message