Author: markt Date: Sun Aug 1 11:13:10 2010 New Revision: 981203 URL: http://svn.apache.org/viewvc?rev=981203&view=rev Log: Update packaged re-named Jakarta BCEL
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/ (props changed) tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java tomcat/trunk/webapps/docs/changelog.xml Propchange: tomcat/trunk/java/org/apache/tomcat/util/bcel/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Sun Aug 1 11:13:10 2010 @@ -0,0 +1,2 @@ +/jakarta/bcel/trunk/src/main/java/org/apache/bcel:886845-981191 +/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/bcel:742915 Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java?rev=981203&r1=981202&r2=981203&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java Sun Aug 1 11:13:10 2010 @@ -32,105 +32,4 @@ public abstract class AccessFlags implem public AccessFlags() { } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } 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=981203&r1=981202&r2=981203&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 Sun Aug 1 11:13:10 2010 @@ -34,8 +34,6 @@ public class AnnotationDefault extends A ElementValue default_value; /** - * @param annotation_type - * the subclass type of the annotation * @param name_index * Index pointing to the name <em>Code</em> * @param length @@ -55,8 +53,6 @@ public class AnnotationDefault extends A } /** - * @param annotation_type - * the subclass type of the annotation * @param name_index * Index pointing to the name <em>Code</em> * @param length Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=981203&r1=981202&r2=981203&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java Sun Aug 1 11:13:10 2010 @@ -35,41 +35,46 @@ import org.apache.tomcat.util.bcel.Const */ public class AnnotationEntry implements Constants, Serializable { + private static final long serialVersionUID = 1L; + private int type_index; - private int num_element_value_pairs; - private List element_value_pairs; private ConstantPool constant_pool; private boolean isRuntimeVisible; - + private List element_value_pairs; + /** - * Construct object from file stream. - * @param file Input stream + * Factory method to create an AnnotionEntry from a DataInputStream + * + * @param file + * @param constant_pool + * @param isRuntimeVisible + * @return + * @throws IOException */ - public AnnotationEntry(int type_index, ConstantPool constant_pool, boolean isRuntimeVisible) { - this.type_index = type_index; + public static AnnotationEntry read(DataInputStream file, ConstantPool constant_pool, boolean isRuntimeVisible) throws IOException { - this.constant_pool = constant_pool; - this.isRuntimeVisible = isRuntimeVisible; - } - - public static AnnotationEntry read(DataInputStream file, ConstantPool constant_pool, boolean isRuntimeVisible) throws IOException - { - AnnotationEntry annotationEntry = new AnnotationEntry(file.readUnsignedShort(), constant_pool, isRuntimeVisible); - annotationEntry.num_element_value_pairs = (file.readUnsignedShort()); + final AnnotationEntry annotationEntry = new AnnotationEntry(file.readUnsignedShort(), constant_pool, isRuntimeVisible); + final int num_element_value_pairs = (file.readUnsignedShort()); annotationEntry.element_value_pairs = new ArrayList(); - for (int i = 0; i < annotationEntry.num_element_value_pairs; i++) { - annotationEntry.element_value_pairs.add(new ElementValuePair(file.readUnsignedShort(), ElementValue.readElementValue(file, constant_pool), constant_pool)); + for (int i = 0; i < num_element_value_pairs; i++) { + annotationEntry.element_value_pairs.add(new ElementValuePair(file.readUnsignedShort(), ElementValue.readElementValue(file, constant_pool), + constant_pool)); } return annotationEntry; } + public AnnotationEntry(int type_index, ConstantPool constant_pool, boolean isRuntimeVisible) { + this.type_index = type_index; + this.constant_pool = constant_pool; + this.isRuntimeVisible = isRuntimeVisible; + } + /** * @return the annotation type name */ public String getAnnotationType() { - ConstantUtf8 c; - c = (ConstantUtf8) constant_pool.getConstant(type_index, CONSTANT_Utf8); + final ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(type_index, CONSTANT_Utf8); return c.getBytes(); } Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=981203&r1=981202&r2=981203&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java Sun Aug 1 11:13:10 2010 @@ -30,10 +30,10 @@ import java.io.IOException; */ public abstract class Annotations extends Attribute { - private int annotation_table_length; - private AnnotationEntry[] annotation_table; // Table of annotations - - + private static final long serialVersionUID = 1L; + + private AnnotationEntry[] annotation_table; + /** * @param annotation_type the subclass type of the annotation * @param name_index Index pointing to the name <em>Code</em> @@ -41,10 +41,9 @@ public abstract class Annotations extend * @param file Input stream * @param constant_pool Array of constants */ - public Annotations(byte annotation_type, int name_index, int length, DataInputStream file, - ConstantPool constant_pool, boolean isRuntimeVisible) throws IOException { + public Annotations(byte annotation_type, int name_index, int length, DataInputStream file, ConstantPool constant_pool, boolean isRuntimeVisible) throws IOException { this(annotation_type, name_index, length, (AnnotationEntry[]) null, constant_pool); - annotation_table_length = (file.readUnsignedShort()); + final int annotation_table_length = (file.readUnsignedShort()); annotation_table = new AnnotationEntry[annotation_table_length]; for (int i = 0; i < annotation_table_length; i++) { annotation_table[i] = AnnotationEntry.read(file, constant_pool, isRuntimeVisible); @@ -59,32 +58,18 @@ public abstract class Annotations extend * @param annotation_table the actual annotations * @param constant_pool Array of constants */ - public Annotations(byte annotation_type, int name_index, int length, - AnnotationEntry[] annotation_table, ConstantPool constant_pool) { + public Annotations(byte annotation_type, int name_index, int length, AnnotationEntry[] annotation_table, ConstantPool constant_pool) { super(annotation_type, name_index, length, constant_pool); setAnnotationTable(annotation_table); } - /** * @param annotation_table the entries to set in this annotation */ public final void setAnnotationTable( AnnotationEntry[] annotation_table ) { this.annotation_table = annotation_table; - annotation_table_length = (annotation_table == null) ? 0 : annotation_table.length; } - - // TODO: update method names - /** - * @return the annotation entry table - */ - /* - public final AnnotationEntry[] getAnnotationTable() { - return annotation_table; - }*/ - - /** * returns the array of annotation entries in this annotation */ @@ -92,15 +77,12 @@ public abstract class Annotations extend return annotation_table; } - - - - - - protected void writeAnnotations(DataOutputStream dos) throws IOException - { - dos.writeShort(annotation_table_length); - for (int i = 0; i < annotation_table_length; i++) + protected void writeAnnotations(DataOutputStream dos) throws IOException { + if (annotation_table == null) { + return; + } + dos.writeShort(annotation_table.length); + for (int i = 0; i < annotation_table.length; i++) annotation_table[i].dump(dos); } } 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=981203&r1=981202&r2=981203&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 Sun Aug 1 11:13:10 2010 @@ -80,11 +80,7 @@ public abstract class Attribute implemen file.writeInt(length); } - private static Map readers = new HashMap(); - - - - + private static final Map readers = new HashMap(); /* * Class method reads one attribute from the input data stream. This method Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=981203&r1=981202&r2=981203&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java Sun Aug 1 11:13:10 2010 @@ -103,6 +103,11 @@ public final class ClassParser { if (is_zip) { zip = new ZipFile(zip_file); ZipEntry entry = zip.getEntry(file_name); + + if (entry == null) { + throw new IOException("File " + file_name + " not found"); + } + file = new DataInputStream(new BufferedInputStream(zip.getInputStream(entry), BUFSIZE)); } else { Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java?rev=981203&r1=981202&r2=981203&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java Sun Aug 1 11:13:10 2010 @@ -55,10 +55,6 @@ public class ElementValuePair { return elementValue; } - - - - protected void dump(DataOutputStream dos) throws IOException { dos.writeShort(elementNameIndex); // u2 name of the element 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=981203&r1=981202&r2=981203&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 Sun Aug 1 11:13:10 2010 @@ -91,7 +91,6 @@ public class LocalVariableTable extends /** - * @return first matching variable using index * * @param index the variable slot * @@ -109,10 +108,6 @@ public class LocalVariableTable extends return null; } - - - - public final void setLocalVariableTable( LocalVariable[] local_variable_table ) { this.local_variable_table = local_variable_table; local_variable_table_length = (local_variable_table == null) Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java?rev=981203&r1=981202&r2=981203&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java Sun Aug 1 11:13:10 2010 @@ -47,13 +47,5 @@ public class ParameterAnnotationEntry im annotation_table[i] = AnnotationEntry.read(file, constant_pool, false); } } - - - - - - - - } Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java?rev=981203&r1=981202&r2=981203&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java Sun Aug 1 11:13:10 2010 @@ -76,13 +76,5 @@ public abstract class ParameterAnnotatio ? 0 : parameter_annotation_table.length; } - - - - - - - - } 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=981203&r1=981202&r2=981203&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 Sun Aug 1 11:13:10 2010 @@ -113,20 +113,22 @@ public final class StackMapTableEntry im */ public final void dump( DataOutputStream file ) throws IOException { file.write(frame_type); - if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) { + if (frame_type >= Constants.SAME_FRAME && frame_type <= Constants.SAME_FRAME_MAX) { + // nothing to be done + } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) { types_of_stack_items[0].dump(file); } else if (frame_type == Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) { - file.write(byte_code_offset_delta); + file.writeShort(byte_code_offset_delta); types_of_stack_items[0].dump(file); } else if (frame_type >= Constants.CHOP_FRAME && frame_type <= Constants.CHOP_FRAME_MAX) { - file.write(byte_code_offset_delta); + file.writeShort(byte_code_offset_delta); } else if (frame_type == Constants.SAME_FRAME_EXTENDED) { - file.write(byte_code_offset_delta); + file.writeShort(byte_code_offset_delta); } else if (frame_type >= Constants.APPEND_FRAME && frame_type <= Constants.APPEND_FRAME_MAX) { - file.write(byte_code_offset_delta); + file.writeShort(byte_code_offset_delta); for (int i = 0; i < number_of_locals; i++) { types_of_locals[i].dump(file); - } + } } else if (frame_type == Constants.FULL_FRAME) { file.writeShort(byte_code_offset_delta); file.writeShort(number_of_locals); 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=981203&r1=981202&r2=981203&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 Sun Aug 1 11:13:10 2010 @@ -44,7 +44,7 @@ public final class Unknown extends Attri private byte[] bytes; private String name; - private static Map unknown_attributes = new HashMap(); + private static final Map unknown_attributes = new HashMap(); Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=981203&r1=981202&r2=981203&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Sun Aug 1 11:13:10 2010 @@ -18,6 +18,7 @@ package org.apache.tomcat.util.bcel.classfile; import java.io.IOException; + import org.apache.tomcat.util.bcel.Constants; import org.apache.tomcat.util.bcel.util.ByteSequence; @@ -104,6 +105,8 @@ public abstract class Utility { /** + * @param access_flags the class flags + * * @return "class" or "interface", depending on the ACC_INTERFACE flag */ public static final String classOrInterface( int access_flags ) { @@ -160,6 +163,8 @@ public abstract class Utility { * @param constant_pool Array of constants * @param verbose be verbose, e.g. print constant pool index * @return String representation of byte code + * + * @throws IOException if a failure from reading from the bytes argument occurs */ public static final String codeToString( ByteSequence bytes, ConstantPool constant_pool, boolean verbose ) throws IOException { @@ -306,7 +311,7 @@ public abstract class Utility { case Constants.NEW: case Constants.CHECKCAST: buf.append("\t"); - /* FALL THRU */ + //$FALL-THROUGH$ case Constants.INSTANCEOF: index = bytes.readUnsignedShort(); buf.append("\t<").append( @@ -458,37 +463,6 @@ public abstract class Utility { return compactClassName(str, "java.lang.", chopit); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** * A returntype signature represents the return value from a method. * It is a series of bytes in the following grammar: @@ -513,6 +487,8 @@ public abstract class Utility { * @param signature Method signature * @param name Method name * @param access Method access rights + * @param chopit + * @param vars * @return Java type declaration * @throws ClassFormatException */ @@ -579,7 +555,7 @@ public abstract class Utility { public static final String replace( String str, String old, String new_ ) { int index, old_index; try { - if ((index = str.indexOf(old)) != -1) { // `old' found in str + if (str.indexOf(old) != -1) { // `old' found in str StringBuffer buf = new StringBuffer(); old_index = 0; // String start offset // While we have something to replace @@ -702,16 +678,6 @@ public abstract class Utility { } } - - - - - - - - - - /** * Convert (signed) byte to (unsigned) short value, i.e., all negative * values become positive. @@ -721,9 +687,11 @@ public abstract class Utility { } - /** Convert bytes into hexidecimal string + /** Convert bytes into hexadecimal string * - * @return bytes as hexidecimal string, e.g. 00 FA 12 ... + * @param bytes an array of bytes to convert to hexadecimal + * + * @return bytes as hexadecimal string, e.g. 00 FA 12 ... */ public static final String toHexString( byte[] bytes ) { StringBuffer buf = new StringBuffer(); @@ -741,10 +709,6 @@ public abstract class Utility { return buf.toString(); } - - - - /** * Fillup char with up to length characters with char `fill' and justify it left or right. * @@ -766,33 +730,6 @@ public abstract class Utility { return new String(buf) + str; } - - - - - - - - - - - - - - - - - - - - - - - - - - - // A-Z, g-z, _, $ private static final int FREE_CHARS = 48; static int[] CHAR_MAP = new int[FREE_CHARS]; Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=981203&r1=981202&r2=981203&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Sun Aug 1 11:13:10 2010 @@ -333,6 +333,10 @@ original commons-fileupload layout to make merging of future updates easier. (markt) </update> + <update> + Update the re-packaged version of Jakarta BCEL from trunk revision + 880760 to trunk revision 978831. (markt) + </update> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org