harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r631935 - in /harmony/enhanced/classlib/trunk/modules/pack200/src: main/java/org/apache/harmony/pack200/ test/java/org/apache/harmony/pack200/tests/ test/resources/org/apache/harmony/pack200/tests/
Date Thu, 28 Feb 2008 11:51:08 GMT
Author: sjanuary
Date: Thu Feb 28 03:50:52 2008
New Revision: 631935

URL: http://svn.apache.org/viewvc?rev=631935&view=rev
Log:
Fix and test for HARMONY-5470 ([classlib][pack200] Error decoding large class)

Added:
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/LargeClass.pack.gz
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java?rev=631935&r1=631934&r2=631935&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
Thu Feb 28 03:50:52 2008
@@ -255,12 +255,12 @@
                             int nextInstruction = 0xff & methodByteCodePacked[c][m][i+1];
                             wideByteCodes.add(new Integer(nextInstruction));
                             if (nextInstruction == 132) { // iinc
-                                bcLocalCount += 2;
+                                bcLocalCount ++;
                                 bcShortCount++;
                             } else if (endsWithLoad(nextInstruction)
                                     || endsWithStore(nextInstruction)
                                     || nextInstruction == 169) {
-                                bcLocalCount += 2;
+                                bcLocalCount ++;
                             } else {
                                 debug("Found unhandled " + ByteCode.getByteCode(nextInstruction));
                             }

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=631935&r1=631934&r2=631935&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 Feb 28 03:50:52 2008
@@ -106,6 +106,17 @@
         archive.unpack();
     }
 
+    // Test with a class containing lots of local variables (regression test for
+    // HARMONY-5470)
+    public void testWithLargeClass() throws Exception {
+        in = Archive.class
+                .getResourceAsStream("/org/apache/harmony/pack200/tests/LargeClass.pack.gz");
+        out = new JarOutputStream(new FileOutputStream(File.createTempFile(
+                "largeclass", ".jar")));
+        Archive archive = new Archive(in, out);
+        archive.unpack();
+    }
+
     protected void tearDown() throws Exception {
         super.tearDown();
         try {
@@ -127,8 +138,4 @@
         }
     }
 
-
-
-
-
-}
+}
\ No newline at end of file

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java?rev=631935&r1=631934&r2=631935&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java
Thu Feb 28 03:50:52 2008
@@ -343,12 +343,12 @@
     	//TODO: Need to fix this testcase so it has enough data to pass.
         byte[] bytes = new byte[] {17, (byte)196, (byte)132, (byte)255,
                 8, 8,// bc_short band
-                8, 8, 8, 8}; // bc_locals band (required by wide iinc (196, 132))
+                8}; // bc_locals band (required by wide iinc (196, 132))
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(3, bcBands.getMethodByteCodePacked()[0][0].length);
         assertEquals(2, bcBands.getBcShort().length);
-        assertEquals(2, bcBands.getBcLocal().length);
+        assertEquals(1, bcBands.getBcLocal().length);
     }
 
     /**
@@ -393,11 +393,11 @@
                 (byte) 196, (byte) 132, // wide iinc
                 (byte) 255,
                 0, // bc_short band
-                0, 0, 0, 1}; // bc_locals band
+                0, 1}; // bc_locals band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(4, bcBands.getMethodByteCodePacked()[0][0].length);
-        assertEquals(4, bcBands.getBcLocal().length);
+        assertEquals(2, bcBands.getBcLocal().length);
         assertEquals(1, bcBands.getBcShort().length);
     }
 

Added: harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/LargeClass.pack.gz
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/LargeClass.pack.gz?rev=631935&view=auto
==============================================================================
Binary file - no diff available.

Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/LargeClass.pack.gz
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message