You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sj...@apache.org on 2008/08/28 11:21:31 UTC

svn commit: r689764 - /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/BcBands.java

Author: sjanuary
Date: Thu Aug 28 02:21:31 2008
New Revision: 689764

URL: http://svn.apache.org/viewvc?rev=689764&view=rev
Log:
Fix for HARMONY-5960 ([pack200][classlib] IndexOutOfBounds exception in BcBands.unpack()
)

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/BcBands.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/BcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/BcBands.java?rev=689764&r1=689763&r2=689764&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/BcBands.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/BcBands.java Thu Aug 28 02:21:31 2008
@@ -459,16 +459,18 @@
                     }
                     methodAttributesList.add(indexForCodeAttr, codeAttr);
                     codeAttr.renumber(codeAttr.byteCodeOffsets);
-                    ArrayList currentAttributes = (ArrayList) orderedCodeAttributes
-                            .get(i);
-                    for (int index = 0; index < currentAttributes.size(); index++) {
-                        Attribute currentAttribute = (Attribute) currentAttributes
-                                .get(index);
-                        codeAttr.addAttribute(currentAttribute);
-                        // Fix up the line numbers if needed
-                        if (currentAttribute.hasBCIRenumbering()) {
-                            ((BCIRenumberedAttribute) currentAttribute)
-                                    .renumber(codeAttr.byteCodeOffsets);
+                    if(orderedCodeAttributes.size() > 0) {
+                        ArrayList currentAttributes = (ArrayList) orderedCodeAttributes
+                                .get(i);
+                        for (int index = 0; index < currentAttributes.size(); index++) {
+                            Attribute currentAttribute = (Attribute) currentAttributes
+                                    .get(index);
+                            codeAttr.addAttribute(currentAttribute);
+                            // Fix up the line numbers if needed
+                            if (currentAttribute.hasBCIRenumbering()) {
+                                ((BCIRenumberedAttribute) currentAttribute)
+                                        .renumber(codeAttr.byteCodeOffsets);
+                            }
                         }
                     }
                     i++;