Fix IndexOutOfBoundsException

master
Graham 5 years ago
parent 8cac28ae99
commit 526b168925
  1. 4
      src/main/java/org/apache/harmony/pack200/ClassBands.java

@ -1027,14 +1027,16 @@ public class ClassBands extends BandSet {
} }
if(codeFlags.size() > 0) { if(codeFlags.size() > 0) {
long latestCodeFlag = ((Long)codeFlags.get(codeFlags.size() - 1)).longValue(); long latestCodeFlag = ((Long)codeFlags.get(codeFlags.size() - 1)).longValue();
if (latestCodeFlag == (1 << 2)) {
int latestLocalVariableTableN = codeLocalVariableTableN.get(codeLocalVariableTableN.size() - 1); int latestLocalVariableTableN = codeLocalVariableTableN.get(codeLocalVariableTableN.size() - 1);
if(latestCodeFlag == (1 << 2) && latestLocalVariableTableN == 0) { if (latestLocalVariableTableN == 0) {
codeLocalVariableTableN.remove(codeLocalVariableTableN.size() - 1); codeLocalVariableTableN.remove(codeLocalVariableTableN.size() - 1);
codeFlags.remove(codeFlags.size() - 1); codeFlags.remove(codeFlags.size() - 1);
codeFlags.add(new Long(0)); codeFlags.add(new Long(0));
} }
} }
} }
}
protected static int countArgs(String descriptor) { protected static int countArgs(String descriptor) {
int bra = descriptor.indexOf('('); int bra = descriptor.indexOf('(');

Loading…
Cancel
Save