harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r738846 - in /harmony/enhanced/classlib/trunk/modules/pack200/src: main/java/org/apache/harmony/pack200/Archive.java test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
Date Thu, 29 Jan 2009 12:57:56 GMT
Author: sjanuary
Date: Thu Jan 29 12:57:55 2009
New Revision: 738846

URL: http://svn.apache.org/viewvc?rev=738846&view=rev
Log:
Pack200 - fix bug where only one class is ever packed with Harmony VM

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java?rev=738846&r1=738845&r2=738846&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
Thu Jan 29 12:57:55 2009
@@ -74,32 +74,31 @@
             files.add(new File("META-INF/MANIFEST.MF", baos.toByteArray(), 0));
         }
         if (inputStream != null) {
-            while (inputStream.available() > 0) {
-                JarEntry jarEntry = inputStream.getNextJarEntry();
-                if (jarEntry != null) {
-                    boolean added = addJarEntry(jarEntry,
-                            new BufferedInputStream(inputStream), classes,
-                            files);
-                    if (!added) { // not added because segment has reached
-                        // maximum size
-                        if(classes.size() > 0 || files.size() > 0) {
-                            new Segment().pack(classes, files, outputStream);
-                            classes = new ArrayList();
-                            files = new ArrayList();
-                            currentSegmentSize = 0;
-                        }
-                        if (!addJarEntry(jarEntry, new BufferedInputStream(
-                                inputStream), classes, files)) {
-                            throw new Pack200Exception(
-                                    "Segment limit is too small for the files you are trying
to pack");
-                        }
-                    } else if (segmentLimit == 0) {
-                        // create a new segment for each class
+            JarEntry jarEntry = inputStream.getNextJarEntry();
+            while (jarEntry != null) {
+                boolean added = addJarEntry(jarEntry,
+                        new BufferedInputStream(inputStream), classes,
+                        files);
+                if (!added) { // not added because segment has reached
+                    // maximum size
+                    if(classes.size() > 0 || files.size() > 0) {
                         new Segment().pack(classes, files, outputStream);
                         classes = new ArrayList();
                         files = new ArrayList();
+                        currentSegmentSize = 0;
                     }
+                    if (!addJarEntry(jarEntry, new BufferedInputStream(
+                            inputStream), classes, files)) {
+                        throw new Pack200Exception(
+                                "Segment limit is too small for the files you are trying
to pack");
+                    }
+                } else if (segmentLimit == 0) {
+                    // create a new segment for each class
+                    new Segment().pack(classes, files, outputStream);
+                    classes = new ArrayList();
+                    files = new ArrayList();
                 }
+                jarEntry = inputStream.getNextJarEntry();
             }
         } else {
             Enumeration jarEntries = jarFile.entries();

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java?rev=738846&r1=738845&r2=738846&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
Thu Jan 29 12:57:55 2009
@@ -112,8 +112,11 @@
         JarFile jarFile = new JarFile(file2);
         file2.deleteOnExit();
 
-        JarFile jarFile2 = new JarFile(new File(Archive.class.getResource(
-                "/org/apache/harmony/pack200/tests/sqlUnpacked.jar").toURI()));
+        File compareFile = new File(Archive.class.getResource(
+                "/org/apache/harmony/pack200/tests/sqlUnpacked.jar").toURI());
+        JarFile jarFile2 = new JarFile(compareFile);
+
+        assertEquals(jarFile2.size(), jarFile.size());
 
         compareFiles(jarFile, jarFile2);
     }



Mime
View raw message