tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1384063 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/
Date Wed, 12 Sep 2012 18:01:20 GMT
Author: markt
Date: Wed Sep 12 18:01:17 2012
New Revision: 1384063

URL: http://svn.apache.org/viewvc?rev=1384063&view=rev
Log:
Revert r1384055 & r1384051. While toString() isn't used, stringifyValue() is.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumber.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java Wed Sep 12 18:01:17 2012
@@ -32,7 +32,6 @@ import org.apache.tomcat.util.bcel.Const
 public class AnnotationDefault extends Attribute
 {
     private static final long serialVersionUID = 6715933396664171543L;
-    ElementValue default_value;
 
     /**
      * @param name_index
@@ -50,7 +49,8 @@ public class AnnotationDefault extends A
     {
         this(name_index, length, (ElementValue) null,
                 constant_pool);
-        default_value = ElementValue.readElementValue(file, constant_pool);
+        // Default value
+        ElementValue.readElementValue(file, constant_pool);
     }
 
     /**
@@ -67,16 +67,6 @@ public class AnnotationDefault extends A
             ElementValue defaultValue, ConstantPool constant_pool)
     {
         super(Constants.ATTR_ANNOTATION_DEFAULT, name_index, length, constant_pool);
-        setDefaultValue(defaultValue);
-    }
-
-    /**
-     * @param defaultValue
-     *            the default value of this methodinfo's annotation
-     */
-    public final void setDefaultValue(ElementValue defaultValue)
-    {
-        default_value = defaultValue;
     }
 
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java Wed Sep 12 18:01:17 2012
@@ -42,6 +42,18 @@ public class AnnotationElementValue exte
         annotationEntry.dump(dos);
     }
 
+    @Override
+    public String stringifyValue()
+    {
+        return annotationEntry.toString();
+    }
+
+    @Override
+    public String toString()
+    {
+        return stringifyValue();
+    }
+
     public AnnotationEntry getAnnotationEntry()
     {
         return annotationEntry;

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java Wed Sep 12 18:01:17 2012
@@ -25,6 +25,21 @@ public class ArrayElementValue extends E
     // For array types, this is the array
     private ElementValue[] evalues;
 
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+        sb.append("{");
+        for (int i = 0; i < evalues.length; i++)
+        {
+            sb.append(evalues[i].toString());
+            if ((i + 1) < evalues.length)
+                sb.append(",");
+        }
+        sb.append("}");
+        return sb.toString();
+    }
+
     public ArrayElementValue(int type, ElementValue[] datums, ConstantPool cpool)
     {
         super(type, cpool);
@@ -45,6 +60,21 @@ public class ArrayElementValue extends E
         }
     }
 
+    @Override
+    public String stringifyValue()
+    {
+        StringBuilder sb = new StringBuilder();
+        sb.append("[");
+        for (int i = 0; i < evalues.length; i++)
+        {
+            sb.append(evalues[i].stringifyValue());
+            if ((i + 1) < evalues.length)
+                sb.append(",");
+        }
+        sb.append("]");
+        return sb.toString();
+    }
+
     public ElementValue[] getElementValuesArray()
     {
         return evalues;

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Wed Sep 12 18:01:17 2012
@@ -215,4 +215,13 @@ public abstract class Attribute implemen
      * @return deep copy of this attribute
      */
     public abstract Attribute copy(ConstantPool _constant_pool);
+
+    /**
+     * @return attribute name.
+     */
+    @Override
+    public String toString()
+    {
+        return Constants.ATTRIBUTE_NAMES[tag];
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java Wed Sep 12 18:01:17 2012
@@ -20,6 +20,8 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.apache.tomcat.util.bcel.Constants;
+
 public class ClassElementValue extends ElementValue
 {
     // For primitive types and string type, this points to the value entry in
@@ -35,6 +37,14 @@ public class ClassElementValue extends E
 
 
     @Override
+    public String stringifyValue()
+    {
+        ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(idx,
+                Constants.CONSTANT_Utf8);
+        return cu8.getBytes();
+    }
+
+    @Override
     public void dump(DataOutputStream dos) throws IOException
     {
         dos.writeByte(type); // u1 kind of value

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java Wed Sep 12 18:01:17 2012
@@ -44,6 +44,8 @@ import org.apache.tomcat.util.bcel.Const
 public final class Code extends Attribute {
 
     private static final long serialVersionUID = 8936843273318969602L;
+    private int max_stack; // Maximum size of stack used by this method
+    private int max_locals; // Number of local variables
     private int code_length; // Length of code in bytes
     private byte[] code; // Actual byte code
     private int exception_table_length;
@@ -103,6 +105,8 @@ public final class Code extends Attribut
     public Code(int name_index, int length, int max_stack, int max_locals, byte[] code,
             CodeException[] exception_table, Attribute[] attributes, ConstantPool constant_pool) {
         super(Constants.ATTR_CODE, name_index, length, constant_pool);
+        this.max_stack = max_stack;
+        this.max_locals = max_locals;
         setCode(code);
         setExceptionTable(exception_table);
         setAttributes(attributes); // Overwrites length!
@@ -179,6 +183,39 @@ public final class Code extends Attribut
 
 
     /**
+     * @return String representation of code chunk.
+     */
+    public final String toString( boolean verbose ) {
+        StringBuilder buf = new StringBuilder(100);
+        buf.append("Code(max_stack = ").append(max_stack).append(", max_locals = ").append(
+                max_locals).append(", code_length = ").append(code_length).append(")\n").append(
+                Utility.codeToString(code, constant_pool, 0, -1, verbose));
+        if (exception_table_length > 0) {
+            buf.append("\nException handler(s) = \n").append("From\tTo\tHandler\tType\n");
+            for (int i = 0; i < exception_table_length; i++) {
+                buf.append(exception_table[i].toString(constant_pool, verbose)).append("\n");
+            }
+        }
+        if (attributes_count > 0) {
+            buf.append("\nAttribute(s) = \n");
+            for (int i = 0; i < attributes_count; i++) {
+                buf.append(attributes[i].toString()).append("\n");
+            }
+        }
+        return buf.toString();
+    }
+
+
+    /**
+     * @return String representation of code chunk.
+     */
+    @Override
+    public final String toString() {
+        return toString(true);
+    }
+
+
+    /**
      * @return deep copy of this attribute
      *
      * @param _constant_pool the constant pool to duplicate

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java Wed Sep 12 18:01:17 2012
@@ -93,6 +93,16 @@ public final class CodeException impleme
     /**
      * @return String representation.
      */
+    @Override
+    public final String toString() {
+        return "CodeException(start_pc = " + start_pc + ", end_pc = " + end_pc + ", handler_pc = "
+                + handler_pc + ", catch_type = " + catch_type + ")";
+    }
+
+
+    /**
+     * @return String representation.
+     */
     public final String toString( ConstantPool cp, boolean verbose ) {
         String str;
         if (catch_type == 0) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java Wed Sep 12 18:01:17 2012
@@ -76,6 +76,15 @@ public abstract class Constant implement
     }
 
 
+    /**
+     * @return String representation.
+     */
+    @Override
+    public String toString() {
+        return Constants.CONSTANT_NAMES[tag] + "[" + tag + "]";
+    }
+
+
     @Override
     public Object clone() throws CloneNotSupportedException {
         return super.clone();

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java Wed Sep 12 18:01:17 2012
@@ -74,4 +74,14 @@ public abstract class ConstantCP extends
     public final int getNameAndTypeIndex() {
         return name_and_type_index;
     }
+
+
+    /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(class_index = " + class_index + ", name_and_type_index = "
+                + name_and_type_index + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java Wed Sep 12 18:01:17 2012
@@ -64,4 +64,13 @@ public final class ConstantClass extends
     public final int getNameIndex() {
         return name_index;
     }
+
+
+    /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(name_index = " + name_index + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java Wed Sep 12 18:01:17 2012
@@ -63,4 +63,13 @@ public final class ConstantDouble extend
     public final double getBytes() {
         return bytes;
     }
+
+
+    /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(bytes = " + bytes + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java Wed Sep 12 18:01:17 2012
@@ -63,4 +63,13 @@ public final class ConstantFloat extends
     public final float getBytes() {
         return bytes;
     }
+
+
+    /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(bytes = " + bytes + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java Wed Sep 12 18:01:17 2012
@@ -63,4 +63,13 @@ public final class ConstantInteger exten
     public final int getBytes() {
         return bytes;
     }
+
+
+    /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(bytes = " + bytes + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java Wed Sep 12 18:01:17 2012
@@ -81,4 +81,15 @@ public final class ConstantInvokeDynamic
     public void setNameAndTypeIndex(int name_and_type_index) {
         this.name_and_type_index = name_and_type_index;
     }
+
+
+    /**
+     * @return String representation
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(bootstrap_method_attr_index = " +
+                bootstrap_method_attr_index + ", name_and_type_index = " +
+                name_and_type_index + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java Wed Sep 12 18:01:17 2012
@@ -63,4 +63,13 @@ public final class ConstantLong extends 
     public final long getBytes() {
         return bytes;
     }
+
+
+    /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(bytes = " + bytes + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java Wed Sep 12 18:01:17 2012
@@ -80,4 +80,14 @@ public final class ConstantMethodHandle 
     public void setReferenceIndex(int reference_index) {
         this.reference_index = reference_index;
     }
+
+
+    /**
+     * @return String representation
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(reference_kind = " + reference_kind +
+                ", reference_index = " + reference_index + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java Wed Sep 12 18:01:17 2012
@@ -68,4 +68,13 @@ public final class ConstantMethodType ex
     public void setDescriptorIndex(int descriptor_index) {
         this.descriptor_index = descriptor_index;
     }
+
+
+    /**
+     * @return String representation
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(descriptor_index = " + descriptor_index + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java Wed Sep 12 18:01:17 2012
@@ -75,4 +75,14 @@ public final class ConstantNameAndType e
     public final int getSignatureIndex() {
         return signature_index;
     }
+
+
+    /**
+     * @return String representation
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(name_index = " + name_index + ", signature_index = "
+                + signature_index + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java Wed Sep 12 18:01:17 2012
@@ -258,4 +258,19 @@ public class ConstantPool implements Clo
     public int getLength() {
         return constant_pool_count;
     }
+
+
+    /**
+     * @return String representation.
+     */
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder();
+        for (int i = 1; i < constant_pool_count; i++) {
+            buf.append(i).append(")").append(constant_pool[i]).append("\n");
+        }
+        return buf.toString();
+    }
+
+
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java Wed Sep 12 18:01:17 2012
@@ -63,4 +63,13 @@ public final class ConstantString extend
     public final int getStringIndex() {
         return string_index;
     }
+
+
+    /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(string_index = " + string_index + ")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java Wed Sep 12 18:01:17 2012
@@ -54,4 +54,13 @@ public final class ConstantUtf8 extends 
     public final String getBytes() {
         return bytes;
     }
+
+
+    /**
+     * @return String representation
+     */
+    @Override
+    public final String toString() {
+        return super.toString() + "(\"" + Utility.replace(bytes, "\n", "\\n") + "\")";
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java Wed Sep 12 18:01:17 2012
@@ -33,6 +33,7 @@ import org.apache.tomcat.util.bcel.Const
 public final class ConstantValue extends Attribute {
 
     private static final long serialVersionUID = -388222612752527969L;
+    private int constantvalue_index;
 
 
     /**
@@ -58,6 +59,41 @@ public final class ConstantValue extends
     public ConstantValue(int name_index, int length, int constantvalue_index,
             ConstantPool constant_pool) {
         super(Constants.ATTR_CONSTANT_VALUE, name_index, length, constant_pool);
+        this.constantvalue_index = constantvalue_index;
+    }
+
+
+    /**
+     * @return String representation of constant value.
+     */
+    @Override
+    public final String toString() {
+        Constant c = constant_pool.getConstant(constantvalue_index);
+        String buf;
+        int i;
+        // Print constant to string depending on its type
+        switch (c.getTag()) {
+            case Constants.CONSTANT_Long:
+                buf = String.valueOf(((ConstantLong) c).getBytes());
+                break;
+            case Constants.CONSTANT_Float:
+                buf = String.valueOf(((ConstantFloat) c).getBytes());
+                break;
+            case Constants.CONSTANT_Double:
+                buf = String.valueOf(((ConstantDouble) c).getBytes());
+                break;
+            case Constants.CONSTANT_Integer:
+                buf = String.valueOf(((ConstantInteger) c).getBytes());
+                break;
+            case Constants.CONSTANT_String:
+                i = ((ConstantString) c).getStringIndex();
+                c = constant_pool.getConstant(i, Constants.CONSTANT_Utf8);
+                buf = "\"" + Utility.convertString(((ConstantUtf8) c).getBytes()) + "\"";
+                break;
+            default:
+                throw new IllegalStateException("Type of ConstValue invalid: " + c);
+        }
+        return buf;
     }
 
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java Wed Sep 12 18:01:17 2012
@@ -69,6 +69,15 @@ public final class Deprecated extends At
 
 
     /**
+     * @return attribute name
+     */
+    @Override
+    public final String toString() {
+        return Constants.ATTRIBUTE_NAMES[Constants.ATTR_DEPRECATED];
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java Wed Sep 12 18:01:17 2012
@@ -32,12 +32,21 @@ public abstract class ElementValue
 
     protected ConstantPool cpool;
 
+    @Override
+    public String toString()
+    {
+        return stringifyValue();
+    }
+
     protected ElementValue(int type, ConstantPool cpool)
     {
         this.type = type;
         this.cpool = cpool;
     }
 
+
+    public abstract String stringifyValue();
+
     public abstract void dump(DataOutputStream dos) throws IOException;
 
     public static final int STRING = 's';

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java Wed Sep 12 18:01:17 2012
@@ -20,6 +20,8 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.apache.tomcat.util.bcel.Constants;
+
 public class EnumElementValue extends ElementValue
 {
     // For enum types, these two indices point to the type and value
@@ -45,4 +47,12 @@ public class EnumElementValue extends El
         dos.writeShort(typeIdx); // u2
         dos.writeShort(valueIdx); // u2
     }
+
+    @Override
+    public String stringifyValue()
+    {
+        ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(valueIdx,
+                Constants.CONSTANT_Utf8);
+        return cu8.getBytes();
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java Wed Sep 12 18:01:17 2012
@@ -84,6 +84,25 @@ public final class ExceptionTable extend
 
 
     /**
+     * @return String representation, i.e., a list of thrown exceptions.
+     */
+    @Override
+    public final String toString() {
+        StringBuilder buf = new StringBuilder();
+        String str;
+        for (int i = 0; i < number_of_exceptions; i++) {
+            str = constant_pool.getConstantString(exception_index_table[i],
+                    Constants.CONSTANT_Class);
+            buf.append(Utility.compactClassName(str, false));
+            if (i < number_of_exceptions - 1) {
+                buf.append(", ");
+            }
+        }
+        return buf.toString();
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java Wed Sep 12 18:01:17 2012
@@ -76,6 +76,36 @@ public final class Field extends FieldOr
 
 
     /**
+     * Return string representation close to declaration format,
+     * `public static final short MAX = 100', e.g..
+     *
+     * @return String representation of field, including the signature.
+     */
+    @Override
+    public final String toString() {
+        String name, signature, access; // Short cuts to constant pool
+        // Get names from constant pool
+        access = Utility.accessToString(access_flags);
+        access = access.equals("") ? "" : (access + " ");
+        signature = Utility.signatureToString(getSignature());
+        name = getName();
+        StringBuilder buf = new StringBuilder(64);
+        buf.append(access).append(signature).append(" ").append(name);
+        ConstantValue cv = getConstantValue();
+        if (cv != null) {
+            buf.append(" = ").append(cv);
+        }
+        for (int i = 0; i < attributes_count; i++) {
+            Attribute a = attributes[i];
+            if (!(a instanceof ConstantValue)) {
+                buf.append(" [").append(a.toString()).append("]");
+            }
+        }
+        return buf.toString();
+    }
+
+
+    /**
      * Return value as defined by given BCELComparator strategy.
      * By default two Field objects are said to be equal when
      * their names and signatures are equal.

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java Wed Sep 12 18:01:17 2012
@@ -22,6 +22,8 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.Serializable;
 
+import org.apache.tomcat.util.bcel.Constants;
+
 /**
  * This class represents a inner class attribute, i.e., the class
  * indices of the inner and outer classes, the name and the attributes
@@ -81,6 +83,44 @@ public final class InnerClass implements
 
 
     /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        return "InnerClass(" + inner_class_index + ", " + outer_class_index + ", "
+                + inner_name_index + ", " + inner_access_flags + ")";
+    }
+
+
+    /**
+     * @return Resolved string representation
+     */
+    public final String toString( ConstantPool constant_pool ) {
+        String inner_class_name, outer_class_name, inner_name, access;
+        inner_class_name = constant_pool.getConstantString(inner_class_index,
+                Constants.CONSTANT_Class);
+        inner_class_name = Utility.compactClassName(inner_class_name);
+        if (outer_class_index != 0) {
+            outer_class_name = constant_pool.getConstantString(outer_class_index,
+                    Constants.CONSTANT_Class);
+            outer_class_name = Utility.compactClassName(outer_class_name);
+        } else {
+            outer_class_name = "<not a member>";
+        }
+        if (inner_name_index != 0) {
+            inner_name = ((ConstantUtf8) constant_pool.getConstant(inner_name_index,
+                    Constants.CONSTANT_Utf8)).getBytes();
+        } else {
+            inner_name = "<anonymous>";
+        }
+        access = Utility.accessToString(inner_access_flags, true);
+        access = access.equals("") ? "" : (access + " ");
+        return "InnerClass:" + access + inner_class_name + "(\"" + outer_class_name + "\", \""
+                + inner_name + "\")";
+    }
+
+
+    /**
      * @return deep copy of this object
      */
     public InnerClass copy() {

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java Wed Sep 12 18:01:17 2012
@@ -82,6 +82,19 @@ public final class InnerClasses extends 
 
 
     /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        StringBuilder buf = new StringBuilder();
+        for (int i = 0; i < number_of_classes; i++) {
+            buf.append(inner_classes[i].toString(constant_pool)).append("\n");
+        }
+        return buf.toString();
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java Wed Sep 12 18:01:17 2012
@@ -19,6 +19,7 @@ package org.apache.tomcat.util.bcel.clas
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.StringTokenizer;
 
 import org.apache.tomcat.util.bcel.Constants;
 import org.apache.tomcat.util.bcel.util.BCELComparator;
@@ -38,9 +39,16 @@ public class JavaClass extends AccessFla
         implements Cloneable, Comparable<JavaClass> {
 
     private static final long serialVersionUID = 7029227708237523236L;
+    private String file_name;
+    private String source_file_name = "<Unknown>";
     private String class_name;
     private String superclass_name;
+    private int major, minor; // Compiler version
+    private ConstantPool constant_pool; // Constant pool
+    private int[] interfaces; // implemented interfaces
     private String[] interface_names;
+    private Field[] fields; // Fields, i.e., variables of class
+    private Method[] methods; // methods defined in the class
     private Attribute[] attributes; // attributes defined in the class
     private AnnotationEntry[] annotations;   // annotations defined on the class
 
@@ -98,10 +106,23 @@ public class JavaClass extends AccessFla
         if (methods == null) {
             methods = new Method[0];
         }
+        this.file_name = file_name;
+        this.major = major;
+        this.minor = minor;
         this.access_flags = access_flags;
+        this.constant_pool = constant_pool;
+        this.interfaces = interfaces;
+        this.fields = fields;
+        this.methods = methods;
         this.attributes = attributes;
         annotationsOutOfDate = true;
-
+        // Get source file name if available
+        for (int i = 0; i < attributes.length; i++) {
+            if (attributes[i] instanceof SourceFile) {
+                source_file_name = ((SourceFile) attributes[i]).getSourceFileName();
+                break;
+            }
+        }
         /* According to the specification the following entries must be of type
          * `ConstantClass' but we check that anyway via the
          * `ConstPool.getConstant' method.
@@ -178,6 +199,72 @@ public class JavaClass extends AccessFla
     }
 
 
+    /**
+     * @return String representing class contents.
+     */
+    @Override
+    public String toString() {
+        String access = Utility.accessToString(access_flags, true);
+        access = access.equals("") ? "" : (access + " ");
+        StringBuilder buf = new StringBuilder(128);
+        buf.append(access).append(Utility.classOrInterface(access_flags)).append(" ").append(
+                class_name).append(" extends ").append(
+                Utility.compactClassName(superclass_name, false)).append('\n');
+        int size = interfaces.length;
+        if (size > 0) {
+            buf.append("implements\t\t");
+            for (int i = 0; i < size; i++) {
+                buf.append(interface_names[i]);
+                if (i < size - 1) {
+                    buf.append(", ");
+                }
+            }
+            buf.append('\n');
+        }
+        buf.append("filename\t\t").append(file_name).append('\n');
+        buf.append("compiled from\t\t").append(source_file_name).append('\n');
+        buf.append("compiler version\t").append(major).append(".").append(minor).append('\n');
+        buf.append("access flags\t\t").append(access_flags).append('\n');
+        buf.append("constant pool\t\t").append(constant_pool.getLength()).append(" entries\n");
+        buf.append("ACC_SUPER flag\t\t").append(isSuper()).append("\n");
+        if (attributes.length > 0) {
+            buf.append("\nAttribute(s):\n");
+            for (int i = 0; i < attributes.length; i++) {
+                buf.append(indent(attributes[i]));
+            }
+        }
+        AnnotationEntry[] annotations = getAnnotationEntries();
+        if (annotations!=null && annotations.length>0) {
+            buf.append("\nAnnotation(s):\n");
+            for (int i=0; i<annotations.length; i++)
+                buf.append(indent(annotations[i]));
+        }
+        if (fields.length > 0) {
+            buf.append("\n").append(fields.length).append(" fields:\n");
+            for (int i = 0; i < fields.length; i++) {
+                buf.append("\t").append(fields[i]).append('\n');
+            }
+        }
+        if (methods.length > 0) {
+            buf.append("\n").append(methods.length).append(" methods:\n");
+            for (int i = 0; i < methods.length; i++) {
+                buf.append("\t").append(methods[i]).append('\n');
+            }
+        }
+        return buf.toString();
+    }
+
+
+    private static final String indent( Object obj ) {
+        StringTokenizer tok = new StringTokenizer(obj.toString(), "\n");
+        StringBuilder buf = new StringBuilder();
+        while (tok.hasMoreTokens()) {
+            buf.append("\t").append(tok.nextToken()).append("\n");
+        }
+        return buf.toString();
+    }
+
+
     public final boolean isSuper() {
         return (access_flags & Constants.ACC_SUPER) != 0;
     }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumber.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumber.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumber.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumber.java Wed Sep 12 18:01:17 2012
@@ -71,6 +71,15 @@ public final class LineNumber implements
 
 
     /**
+     * @return String representation
+     */
+    @Override
+    public final String toString() {
+        return "LineNumber(" + start_pc + ", " + line_number + ")";
+    }
+
+
+    /**
      * @return deep copy of this object
      */
     public LineNumber copy() {

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java Wed Sep 12 18:01:17 2012
@@ -81,6 +81,30 @@ public final class LineNumberTable exten
 
 
     /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        StringBuilder buf = new StringBuilder();
+        StringBuilder line = new StringBuilder();
+        String newLine = System.getProperty("line.separator", "\n");
+        for (int i = 0; i < line_number_table_length; i++) {
+            line.append(line_number_table[i].toString());
+            if (i < line_number_table_length - 1) {
+                line.append(", ");
+            }
+            if (line.length() > 72) {
+                line.append(newLine);
+                buf.append(line.toString());
+                line.setLength(0);
+            }
+        }
+        buf.append(line);
+        return buf.toString();
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java Wed Sep 12 18:01:17 2012
@@ -119,6 +119,17 @@ public final class LocalVariable impleme
 
 
     /**
+     * @return string representation.
+     */
+    @Override
+    public final String toString() {
+        String name = getName(), signature = Utility.signatureToString(getSignature());
+        return "LocalVariable(start_pc = " + start_pc + ", length = " + length + ", index = "
+                + index + ":" + signature + " " + name + ")";
+    }
+
+
+    /**
      * @return deep copy of this object
      */
     public LocalVariable copy() {

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java Wed Sep 12 18:01:17 2012
@@ -98,6 +98,22 @@ public class LocalVariableTable extends 
 
 
     /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        StringBuilder buf = new StringBuilder();
+        for (int i = 0; i < local_variable_table_length; i++) {
+            buf.append(local_variable_table[i].toString());
+            if (i < local_variable_table_length - 1) {
+                buf.append('\n');
+            }
+        }
+        return buf.toString();
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java Wed Sep 12 18:01:17 2012
@@ -79,6 +79,22 @@ private int             local_variable_t
   }
 
   /**
+   * @return String representation.
+   */
+  @Override
+  public final String toString() {
+      StringBuilder buf = new StringBuilder();
+
+    for(int i=0; i < local_variable_type_table_length; i++) {
+      buf.append(local_variable_type_table[i].toString());
+
+      if(i < local_variable_type_table_length - 1) buf.append('\n');
+    }
+
+    return buf.toString();
+  }
+
+  /**
    * @return deep copy of this attribute
    */
   @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java Wed Sep 12 18:01:17 2012
@@ -20,6 +20,7 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
+import org.apache.tomcat.util.bcel.Constants;
 import org.apache.tomcat.util.bcel.util.BCELComparator;
 
 /**
@@ -112,6 +113,43 @@ public final class Method extends FieldO
 
 
     /**
+     * Return string representation close to declaration format,
+     * `public static void main(String[] args) throws IOException', e.g.
+     *
+     * @return String representation of the method.
+     */
+    @Override
+    public final String toString() {
+        ConstantUtf8 c;
+        String name, signature, access; // Short cuts to constant pool
+        StringBuilder buf;
+        access = Utility.accessToString(access_flags);
+        // Get name and signature from constant pool
+        c = (ConstantUtf8) constant_pool.getConstant(signature_index, Constants.CONSTANT_Utf8);
+        signature = c.getBytes();
+        c = (ConstantUtf8) constant_pool.getConstant(name_index, Constants.CONSTANT_Utf8);
+        name = c.getBytes();
+        signature = Utility.methodSignatureToString(signature, name, access, true,
+                getLocalVariableTable());
+        buf = new StringBuilder(signature);
+        for (int i = 0; i < attributes_count; i++) {
+            Attribute a = attributes[i];
+            if (!((a instanceof Code) || (a instanceof ExceptionTable))) {
+                buf.append(" [").append(a.toString()).append("]");
+            }
+        }
+        ExceptionTable e = getExceptionTable();
+        if (e != null) {
+            String str = e.toString();
+            if (!str.equals("")) {
+                buf.append("\n\t\tthrows ").append(str);
+            }
+        }
+        return buf.toString();
+    }
+
+
+    /**
      * Return value as defined by given BCELComparator strategy.
      * By default two method objects are said to be equal when
      * their names and signatures are equal.

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java Wed Sep 12 18:01:17 2012
@@ -86,6 +86,15 @@ public final class PMGClass extends Attr
 
 
     /**
+     * @return String representation
+     */
+    @Override
+    public final String toString() {
+        return "PMGClass(" + getPMGName() + ", " + getPMGClassName() + ")";
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java Wed Sep 12 18:01:17 2012
@@ -72,6 +72,16 @@ public final class Signature extends Att
     }
 
     /**
+     * @return String representation
+     */
+    @Override
+    public final String toString() {
+        String s = getSignature();
+        return "Signature(" + s + ")";
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java Wed Sep 12 18:01:17 2012
@@ -20,6 +20,8 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.apache.tomcat.util.bcel.Constants;
+
 public class SimpleElementValue extends ElementValue
 {
     private int index;
@@ -40,6 +42,64 @@ public class SimpleElementValue extends 
 
 
     @Override
+    public String toString()
+    {
+        return stringifyValue();
+    }
+
+    // Whatever kind of value it is, return it as a string
+    @Override
+    public String stringifyValue()
+    {
+        switch (type)
+        {
+        case PRIMITIVE_INT:
+            ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Integer);
+            return Integer.toString(c.getBytes());
+        case PRIMITIVE_LONG:
+            ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Long);
+            return Long.toString(j.getBytes());
+        case PRIMITIVE_DOUBLE:
+            ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Double);
+            return Double.toString(d.getBytes());
+        case PRIMITIVE_FLOAT:
+            ConstantFloat f = (ConstantFloat) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Float);
+            return Float.toString(f.getBytes());
+        case PRIMITIVE_SHORT:
+            ConstantInteger s = (ConstantInteger) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Integer);
+            return Integer.toString(s.getBytes());
+        case PRIMITIVE_BYTE:
+            ConstantInteger b = (ConstantInteger) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Integer);
+            return Integer.toString(b.getBytes());
+        case PRIMITIVE_CHAR:
+            ConstantInteger ch = (ConstantInteger) cpool.getConstant(
+                    getIndex(), Constants.CONSTANT_Integer);
+            return String.valueOf((char)ch.getBytes());
+        case PRIMITIVE_BOOLEAN:
+            ConstantInteger bo = (ConstantInteger) cpool.getConstant(
+                    getIndex(), Constants.CONSTANT_Integer);
+            if (bo.getBytes() == 0) {
+                return "false";
+            }
+            return "true";
+        case STRING:
+            ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Utf8);
+            return cu8.getBytes();
+        default:
+            throw new RuntimeException(
+                    "SimpleElementValue class does not know how to stringify type "
+                            + type);
+        }
+    }
+
+    @Override
     public void dump(DataOutputStream dos) throws IOException
     {
         dos.writeByte(type); // u1 kind of value

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java Wed Sep 12 18:01:17 2012
@@ -82,6 +82,15 @@ public final class SourceFile extends At
 
 
     /**
+     * @return String representation
+     */
+    @Override
+    public final String toString() {
+        return "SourceFile(" + getSourceFileName() + ")";
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java Wed Sep 12 18:01:17 2012
@@ -70,7 +70,7 @@ public final class StackMap extends Attr
         map_length = file.readUnsignedShort();
         map = new StackMapEntry[map_length];
         for (int i = 0; i < map_length; i++) {
-            map[i] = new StackMapEntry(file);
+            map[i] = new StackMapEntry(file, constant_pool);
         }
     }
 
@@ -85,6 +85,23 @@ public final class StackMap extends Attr
 
 
     /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        StringBuilder buf = new StringBuilder("StackMap(");
+        for (int i = 0; i < map_length; i++) {
+            buf.append(map[i].toString());
+            if (i < map_length - 1) {
+                buf.append(", ");
+            }
+        }
+        buf.append(')');
+        return buf.toString();
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java Wed Sep 12 18:01:17 2012
@@ -48,16 +48,16 @@ public final class StackMapEntry impleme
      * @param file Input stream
      * @throws IOException
      */
-    StackMapEntry(DataInputStream file) throws IOException {
+    StackMapEntry(DataInputStream file, ConstantPool constant_pool) throws IOException {
         this(file.readShort(), file.readShort(), null, -1, null);
         types_of_locals = new StackMapType[number_of_locals];
         for (int i = 0; i < number_of_locals; i++) {
-            types_of_locals[i] = new StackMapType(file);
+            types_of_locals[i] = new StackMapType(file, constant_pool);
         }
         number_of_stack_items = file.readShort();
         types_of_stack_items = new StackMapType[number_of_stack_items];
         for (int i = 0; i < number_of_stack_items; i++) {
-            types_of_stack_items[i] = new StackMapType(file);
+            types_of_stack_items[i] = new StackMapType(file, constant_pool);
         }
     }
 
@@ -93,6 +93,38 @@ public final class StackMapEntry impleme
 
 
     /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        StringBuilder buf = new StringBuilder(64);
+        buf.append("(offset=").append(byte_code_offset);
+        if (number_of_locals > 0) {
+            buf.append(", locals={");
+            for (int i = 0; i < number_of_locals; i++) {
+                buf.append(types_of_locals[i]);
+                if (i < number_of_locals - 1) {
+                    buf.append(", ");
+                }
+            }
+            buf.append("}");
+        }
+        if (number_of_stack_items > 0) {
+            buf.append(", stack items={");
+            for (int i = 0; i < number_of_stack_items; i++) {
+                buf.append(types_of_stack_items[i]);
+                if (i < number_of_stack_items - 1) {
+                    buf.append(", ");
+                }
+            }
+            buf.append("}");
+        }
+        buf.append(")");
+        return buf.toString();
+    }
+
+
+    /**
      * @return deep copy of this object
      */
     public StackMapEntry copy() {

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java Wed Sep 12 18:01:17 2012
@@ -70,7 +70,7 @@ public final class StackMapTable extends
         map_length = file.readUnsignedShort();
         map = new StackMapTableEntry[map_length];
         for (int i = 0; i < map_length; i++) {
-            map[i] = new StackMapTableEntry(file);
+            map[i] = new StackMapTableEntry(file, constant_pool);
         }
     }
 
@@ -85,6 +85,23 @@ public final class StackMapTable extends
 
 
     /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        StringBuilder buf = new StringBuilder("StackMapTable(");
+        for (int i = 0; i < map_length; i++) {
+            buf.append(map[i].toString());
+            if (i < map_length - 1) {
+                buf.append(", ");
+            }
+        }
+        buf.append(')');
+        return buf.toString();
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java Wed Sep 12 18:01:17 2012
@@ -51,7 +51,7 @@ public final class StackMapTableEntry im
      * @param file Input stream
      * @throws IOException
      */
-    StackMapTableEntry(DataInputStream file) throws IOException {
+    StackMapTableEntry(DataInputStream file, ConstantPool constant_pool) throws IOException {
         this(file.read(), -1, -1, null, -1, null);
 
         if (frame_type >= Constants.SAME_FRAME && frame_type <= Constants.SAME_FRAME_MAX) {
@@ -60,12 +60,12 @@ public final class StackMapTableEntry im
             byte_code_offset_delta = frame_type - Constants.SAME_LOCALS_1_STACK_ITEM_FRAME;
             number_of_stack_items = 1;
             types_of_stack_items = new StackMapType[1];
-            types_of_stack_items[0] = new StackMapType(file);
+            types_of_stack_items[0] = new StackMapType(file, constant_pool);
         } else if (frame_type == Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
             byte_code_offset_delta = file.readShort();
             number_of_stack_items = 1;
             types_of_stack_items = new StackMapType[1];
-            types_of_stack_items[0] = new StackMapType(file);
+            types_of_stack_items[0] = new StackMapType(file, constant_pool);
         } else if (frame_type >= Constants.CHOP_FRAME && frame_type <= Constants.CHOP_FRAME_MAX) {
             byte_code_offset_delta = file.readShort();
         } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
@@ -75,19 +75,19 @@ public final class StackMapTableEntry im
             number_of_locals = frame_type - 251;
             types_of_locals = new StackMapType[number_of_locals];
             for (int i = 0; i < number_of_locals; i++) {
-                types_of_locals[i] = new StackMapType(file);
+                types_of_locals[i] = new StackMapType(file, constant_pool);
             }
         } else if (frame_type == Constants.FULL_FRAME) {
             byte_code_offset_delta = file.readShort();
             number_of_locals = file.readShort();
             types_of_locals = new StackMapType[number_of_locals];
             for (int i = 0; i < number_of_locals; i++) {
-                types_of_locals[i] = new StackMapType(file);
+                types_of_locals[i] = new StackMapType(file, constant_pool);
             }
             number_of_stack_items = file.readShort();
             types_of_stack_items = new StackMapType[number_of_stack_items];
             for (int i = 0; i < number_of_stack_items; i++) {
-                types_of_stack_items[i] = new StackMapType(file);
+                types_of_stack_items[i] = new StackMapType(file, constant_pool);
             }
         } else {
             /* Can't happen */
@@ -150,6 +150,56 @@ public final class StackMapTableEntry im
 
 
     /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        StringBuilder buf = new StringBuilder(64);
+        buf.append("(");
+        if (frame_type >= Constants.SAME_FRAME && frame_type <= Constants.SAME_FRAME_MAX) {
+            buf.append("SAME");
+        } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
+            buf.append("SAME_LOCALS_1_STACK");
+        } else if (frame_type == Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
+            buf.append("SAME_LOCALS_1_STACK_EXTENDED");
+        } else if (frame_type >= Constants.CHOP_FRAME && frame_type <= Constants.CHOP_FRAME_MAX) {
+            buf.append("CHOP "+(251-frame_type));
+        } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
+            buf.append("SAME_EXTENDED");
+        } else if (frame_type >= Constants.APPEND_FRAME && frame_type <= Constants.APPEND_FRAME_MAX) {
+            buf.append("APPEND "+(frame_type-251));
+        } else if (frame_type == Constants.FULL_FRAME) {
+            buf.append("FULL");
+        } else {
+            buf.append("UNKNOWN");
+        }
+        buf.append(", offset delta=").append(byte_code_offset_delta);
+        if (number_of_locals > 0) {
+            buf.append(", locals={");
+            for (int i = 0; i < number_of_locals; i++) {
+                buf.append(types_of_locals[i]);
+                if (i < number_of_locals - 1) {
+                    buf.append(", ");
+                }
+            }
+            buf.append("}");
+        }
+        if (number_of_stack_items > 0) {
+            buf.append(", stack items={");
+            for (int i = 0; i < number_of_stack_items; i++) {
+                buf.append(types_of_stack_items[i]);
+                if (i < number_of_stack_items - 1) {
+                    buf.append(", ");
+                }
+            }
+            buf.append("}");
+        }
+        buf.append(")");
+        return buf.toString();
+    }
+
+
+    /**
      * @return deep copy of this object
      */
     public StackMapTableEntry copy() {

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java Wed Sep 12 18:01:17 2012
@@ -40,6 +40,7 @@ public final class StackMapType implemen
 
     private byte type;
     private int index = -1; // Index to CONSTANT_Class or offset
+    private ConstantPool constant_pool;
 
 
     /**
@@ -47,11 +48,12 @@ public final class StackMapType implemen
      * @param file Input stream
      * @throws IOException
      */
-    StackMapType(DataInput file) throws IOException {
-        this(file.readByte(), -1);
+    StackMapType(DataInput file, ConstantPool constant_pool) throws IOException {
+        this(file.readByte(), -1, constant_pool);
         if (hasIndex()) {
             setIndex(file.readShort());
         }
+        setConstantPool(constant_pool);
     }
 
 
@@ -59,9 +61,10 @@ public final class StackMapType implemen
      * @param type type tag as defined in the Constants interface
      * @param index index to constant pool, or byte code offset
      */
-    public StackMapType(byte type, int index) {
+    public StackMapType(byte type, int index, ConstantPool constant_pool) {
         setType(type);
         setIndex(index);
+        setConstantPool(constant_pool);
     }
 
 
@@ -105,4 +108,35 @@ public final class StackMapType implemen
     public final boolean hasIndex() {
         return ((type == Constants.ITEM_Object) || (type == Constants.ITEM_NewObject));
     }
+
+
+    private String printIndex() {
+        if (type == Constants.ITEM_Object) {
+            if (index < 0) {
+                return ", class=<unknown>";
+            }
+            return ", class=" + constant_pool.constantToString(index, Constants.CONSTANT_Class);
+        } else if (type == Constants.ITEM_NewObject) {
+            return ", offset=" + index;
+        } else {
+            return "";
+        }
+    }
+
+
+    /**
+     * @return String representation
+     */
+    @Override
+    public final String toString() {
+        return "(type=" + Constants.ITEM_NAMES[type] + printIndex() + ")";
+    }
+
+
+    /**
+     * @param constant_pool Constant pool to be used for this object.
+     */
+    public final void setConstantPool( ConstantPool constant_pool ) {
+        this.constant_pool = constant_pool;
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java Wed Sep 12 18:01:17 2012
@@ -75,6 +75,19 @@ public final class Synthetic extends Att
 
 
     /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        StringBuilder buf = new StringBuilder("Synthetic");
+        if (length > 0) {
+            buf.append(" ").append(Utility.toHexString(bytes));
+        }
+        return buf.toString();
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java?rev=1384063&r1=1384062&r2=1384063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java Wed Sep 12 18:01:17 2012
@@ -94,6 +94,26 @@ public final class Unknown extends Attri
 
 
     /**
+     * @return String representation.
+     */
+    @Override
+    public final String toString() {
+        if (length == 0 || bytes == null) {
+            return "(Unknown attribute " + name + ")";
+        }
+        String hex;
+        if (length > 10) {
+            byte[] tmp = new byte[10];
+            System.arraycopy(bytes, 0, tmp, 0, 10);
+            hex = Utility.toHexString(tmp) + "... (truncated)";
+        } else {
+            hex = Utility.toHexString(bytes);
+        }
+        return "(Unknown attribute " + name + ": " + hex + ")";
+    }
+
+
+    /**
      * @return deep copy of this attribute
      */
     @Override



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message