commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r942577 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Date Sun, 09 May 2010 18:47:16 GMT
Author: sebb
Date: Sun May  9 18:47:16 2010
New Revision: 942577

URL: http://svn.apache.org/viewvc?rev=942577&view=rev
Log:
Handle archives containing directories
Report actual missing entry

Modified:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java?rev=942577&r1=942576&r2=942577&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Sun May  9 18:47:16 2010
@@ -289,15 +289,18 @@ public abstract class AbstractTestCase e
             while ((entry = in.getNextEntry()) != null) {
                 File outfile = new File(result.getCanonicalPath() + "/result/"
                         + entry.getName());
-                outfile.getParentFile().mkdirs();
-                OutputStream out = new FileOutputStream(outfile);
                 long copied=0;
-                try {
-                    copied=IOUtils.copy(in, out);
-                } finally {
-                    out.close();
+                if (entry.isDirectory()){
+                    outfile.mkdirs();
+                } else {
+                    outfile.getParentFile().mkdirs();
+                    OutputStream out = new FileOutputStream(outfile);
+                    try {
+                        copied=IOUtils.copy(in, out);
+                    } finally {
+                        out.close();
+                    }                    
                 }
-
                 final long size = entry.getSize();
                 if (size != ArchiveEntry.SIZE_UNKNOWN) {
                     assertEquals("Entry.size should equal bytes read.",size, copied);
@@ -307,7 +310,7 @@ public abstract class AbstractTestCase e
                     fail("extraction failed: " + entry.getName());
                 }
                 if (expected != null && !expected.remove(getExpectedString(entry)))
{
-                    fail("unexpected entry: " + entry.getName());
+                    fail("unexpected entry: " + getExpectedString(entry));
                 }
             }
             in.close();



Mime
View raw message