lookat howMuch, before reading attributes

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@729 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 9f716c1462
commit b7051a7a87
  1. 6
      jode/jode/bytecode/BytecodeInfo.java
  2. 2
      jode/jode/bytecode/FieldInfo.java
  3. 9
      jode/jode/bytecode/MethodInfo.java

@ -64,7 +64,8 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
protected void readAttribute(String name, int length, ConstantPool cp, protected void readAttribute(String name, int length, ConstantPool cp,
DataInputStream input, DataInputStream input,
int howMuch) throws IOException { int howMuch) throws IOException {
if (name.equals("LocalVariableTable")) { if ((howMuch & ALL_ATTRIBUTES) != 0
&& name.equals("LocalVariableTable")) {
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_LVT) != 0) if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_LVT) != 0)
GlobalOptions.err.println("LocalVariableTable of "+methodInfo.clazzInfo.getName() + "." + methodInfo.getName()); GlobalOptions.err.println("LocalVariableTable of "+methodInfo.clazzInfo.getName() + "." + methodInfo.getName());
int count = input.readUnsignedShort(); int count = input.readUnsignedShort();
@ -120,7 +121,8 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
+" range "+start+" - "+end +" range "+start+" - "+end
+" slot "+slot); +" slot "+slot);
} }
} else if (name.equals("LineNumberTable")) { } else if ((howMuch & ALL_ATTRIBUTES) != 0
&& name.equals("LineNumberTable")) {
int count = input.readUnsignedShort(); int count = input.readUnsignedShort();
if (length != 2 + count * 4) { if (length != 2 + count * 4) {
GlobalOptions.err.println GlobalOptions.err.println

@ -47,7 +47,7 @@ public class FieldInfo extends BinaryInfo {
ConstantPool cp, ConstantPool cp,
DataInputStream input, DataInputStream input,
int howMuch) throws IOException { int howMuch) throws IOException {
if (name.equals("ConstantValue")) { if ((howMuch & ALL_ATTRIBUTES) != 0 && name.equals("ConstantValue")) {
if (length != 2) if (length != 2)
throw new ClassFormatException("ConstantValue attribute" throw new ClassFormatException("ConstantValue attribute"
+ " has wrong length"); + " has wrong length");

@ -49,10 +49,11 @@ public class MethodInfo extends BinaryInfo {
protected void readAttribute(String name, int length, ConstantPool cp, protected void readAttribute(String name, int length, ConstantPool cp,
DataInputStream input, DataInputStream input,
int howMuch) throws IOException { int howMuch) throws IOException {
if (name.equals("Code")) { if ((howMuch & ALL_ATTRIBUTES) != 0 && name.equals("Code")) {
bytecode = new BytecodeInfo(this); bytecode = new BytecodeInfo(this);
bytecode.read(cp, input); bytecode.read(cp, input);
} else if (name.equals("Exceptions")) { } else if ((howMuch & ALL_ATTRIBUTES) != 0
&& name.equals("Exceptions")) {
int count = input.readUnsignedShort(); int count = input.readUnsignedShort();
exceptions = new String[count]; exceptions = new String[count];
for (int i=0; i< count; i++) for (int i=0; i< count; i++)
@ -153,6 +154,10 @@ public class MethodInfo extends BinaryInfo {
writeAttributes(constantPool, output); writeAttributes(constantPool, output);
} }
public ClassInfo getClazzInfo() {
return clazzInfo;
}
public String getName() { public String getName() {
return name; return name;
} }

Loading…
Cancel
Save