Author: grobmeier Date: Thu Apr 23 05:45:30 2009 New Revision: 767808 URL: http://svn.apache.org/viewvc?rev=767808&view=rev Log: COMPRESS-63: entry name is stored in ASCII
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java?rev=767808&r1=767807&r2=767808&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java Thu Apr 23 05:45:30 2009 @@ -82,8 +82,7 @@ } if (offset == 0) { - final byte[] expected = ArchiveUtils - .toAsciiBytes(ArArchiveEntry.HEADER); + final byte[] expected = ArchiveUtils.toAsciiBytes(ArArchiveEntry.HEADER); final byte[] realized = new byte[expected.length]; final int read = read(realized); if (read != expected.length) { @@ -92,8 +91,7 @@ } for (int i = 0; i < expected.length; i++) { if (expected[i] != realized[i]) { - throw new IOException("invalid header " - + ArchiveUtils.toAsciiString(realized)); + throw new IOException("invalid header " + ArchiveUtils.toAsciiString(realized)); } } } @@ -124,8 +122,7 @@ read(length); { - final byte[] expected = ArchiveUtils - .toAsciiBytes(ArArchiveEntry.TRAILER); + final byte[] expected = ArchiveUtils.toAsciiBytes(ArArchiveEntry.TRAILER); final byte[] realized = new byte[expected.length]; final int read = read(realized); if (read != expected.length) { @@ -145,14 +142,14 @@ entryOffset = offset; // SVR4/GNU adds a trailing "/" to names - String temp = new String(name).trim(); // TODO is it correct to use the - // default charset here? + // entry name is stored as ASCII string + String temp = ArchiveUtils.toAsciiString(name).trim(); if (temp.endsWith("/")) { temp = temp.substring(0, temp.length() - 1); } - currentEntry = new ArArchiveEntry(temp, // TODO is it correct to use the - // default charset here? - Long.parseLong(new String(length).trim())); + currentEntry = new ArArchiveEntry(temp, + Long.parseLong( + new String(length).trim())); return currentEntry; }