Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java Mon Aug 22 10:48:26 2016 @@ -22,7 +22,7 @@ public class ArrayElementValue extends E // For array types, this is the array private final ElementValue[] evalues; - ArrayElementValue(int type, ElementValue[] datums, ConstantPool cpool) + ArrayElementValue(final int type, final ElementValue[] datums, final ConstantPool cpool) { super(type, cpool); if (type != ARRAY) { @@ -35,7 +35,7 @@ public class ArrayElementValue extends E @Override public String stringifyValue() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("["); for (int i = 0; i < evalues.length; i++) {
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java Mon Aug 22 10:48:26 2016 @@ -17,7 +17,7 @@ */ package org.apache.tomcat.util.bcel.classfile; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; public class ClassElementValue extends ElementValue { @@ -26,7 +26,7 @@ public class ClassElementValue extends E // For 'class' this points to the class entry in the cpool private final int idx; - ClassElementValue(int type, int idx, ConstantPool cpool) { + ClassElementValue(final int type, final int idx, final ConstantPool cpool) { super(type, cpool); this.idx = idx; } @@ -35,8 +35,8 @@ public class ClassElementValue extends E @Override public String stringifyValue() { - ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(idx, - Constants.CONSTANT_Utf8); + final ConstantUtf8 cu8 = (ConstantUtf8) super.getConstantPool().getConstant(idx, + Const.CONSTANT_Utf8); return cu8.getBytes(); } } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java Mon Aug 22 10:48:26 2016 @@ -17,12 +17,10 @@ */ package org.apache.tomcat.util.bcel.classfile; -/** +/** * Thrown when the BCEL attempts to read a class file and determines * that the file is malformed or otherwise cannot be interpreted as a * class file. - * - * @author <A HREF="mailto:[email protected]">M. Dahm</A> */ public class ClassFormatException extends RuntimeException { @@ -33,7 +31,7 @@ public class ClassFormatException extend } - public ClassFormatException(String s) { + public ClassFormatException(final String s) { super(s); } } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java Mon Aug 22 10:48:26 2016 @@ -23,7 +23,7 @@ import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; /** * Wrapper class that parses a given Java .class file. The method <A @@ -36,8 +36,6 @@ import org.apache.tomcat.util.bcel.Const * exactly with the <A href="http://docs.oracle.com/javase/specs/"> * JVM specification 1.0</a>. See this paper for * further details about the structure of a bytecode file. - * - * @author <A HREF="mailto:[email protected]">M. Dahm</A> */ public final class ClassParser { @@ -58,7 +56,7 @@ public final class ClassParser { * * @param inputStream Input stream */ - public ClassParser(InputStream inputStream) { + public ClassParser(final InputStream inputStream) { this.dataInputStream = new DataInputStream(new BufferedInputStream(inputStream, BUFSIZE)); } @@ -71,8 +69,8 @@ public final class ClassParser { * is performed by the java interpreter). * * @return Class object representing the parsed class file - * @throws IOException - * @throws ClassFormatException + * @throws IOException If an I/O occurs reading the byte code + * @throws ClassFormatException If the byte code is invalid */ public JavaClass parse() throws IOException, ClassFormatException { /****************** Read headers ********************************/ @@ -108,7 +106,7 @@ public final class ClassParser { * @throws ClassFormatException */ private void readAttributes() throws IOException, ClassFormatException { - int attributes_count = dataInputStream.readUnsignedShort(); + final int attributes_count = dataInputStream.readUnsignedShort(); for (int i = 0; i < attributes_count; i++) { ConstantUtf8 c; String name; @@ -117,7 +115,7 @@ public final class ClassParser { // Get class name from constant pool via `name_index' indirection name_index = dataInputStream.readUnsignedShort(); c = (ConstantUtf8) constant_pool.getConstant(name_index, - Constants.CONSTANT_Utf8); + Const.CONSTANT_Utf8); name = c.getBytes(); // Length of data in bytes length = dataInputStream.readInt(); @@ -146,11 +144,11 @@ public final class ClassParser { /* Interfaces are implicitely abstract, the flag should be set * according to the JVM specification. */ - if ((access_flags & Constants.ACC_INTERFACE) != 0) { - access_flags |= Constants.ACC_ABSTRACT; + if ((access_flags & Const.ACC_INTERFACE) != 0) { + access_flags |= Const.ACC_ABSTRACT; } - if (((access_flags & Constants.ACC_ABSTRACT) != 0) - && ((access_flags & Constants.ACC_FINAL) != 0)) { + if (((access_flags & Const.ACC_ABSTRACT) != 0) + && ((access_flags & Const.ACC_FINAL) != 0)) { throw new ClassFormatException("Class can't be both final and abstract"); } @@ -183,7 +181,7 @@ public final class ClassParser { * @throws ClassFormatException */ private void readFields() throws IOException, ClassFormatException { - int fields_count = dataInputStream.readUnsignedShort(); + final int fields_count = dataInputStream.readUnsignedShort(); for (int i = 0; i < fields_count; i++) { Utility.swallowFieldOrMethod(dataInputStream); } @@ -210,7 +208,7 @@ public final class ClassParser { * @throws ClassFormatException */ private void readInterfaces() throws IOException, ClassFormatException { - int interfaces_count = dataInputStream.readUnsignedShort(); + final int interfaces_count = dataInputStream.readUnsignedShort(); if (interfaces_count > 0) { interface_names = new String[interfaces_count]; for (int i = 0; i < interfaces_count; i++) { @@ -229,7 +227,7 @@ public final class ClassParser { * @throws ClassFormatException */ private void readMethods() throws IOException, ClassFormatException { - int methods_count = dataInputStream.readUnsignedShort(); + final int methods_count = dataInputStream.readUnsignedShort(); for (int i = 0; i < methods_count; i++) { Utility.swallowFieldOrMethod(dataInputStream); } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java Mon Aug 22 10:48:26 2016 @@ -20,7 +20,7 @@ package org.apache.tomcat.util.bcel.clas import java.io.DataInput; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; /** * Abstract superclass for classes to represent the different constant types @@ -36,13 +36,13 @@ public abstract class Constant { * places we will use the tag for switch()es anyway. * * First, we want match the specification as closely as possible. Second we - * need the tag as an index to select the corresponding class name from the + * need the tag as an index to select the corresponding class name from the * `CONSTANT_NAMES' array. */ protected final byte tag; - Constant(byte tag) { + Constant(final byte tag) { this.tag = tag; } @@ -62,35 +62,35 @@ public abstract class Constant { * @param input Input stream * @return Constant object */ - static Constant readConstant(DataInput input) throws IOException, + static Constant readConstant(final DataInput input) throws IOException, ClassFormatException { - byte b = input.readByte(); // Read tag byte + final byte b = input.readByte(); // Read tag byte int skipSize; switch (b) { - case Constants.CONSTANT_Class: + case Const.CONSTANT_Class: return new ConstantClass(input); - case Constants.CONSTANT_Integer: + case Const.CONSTANT_Integer: return new ConstantInteger(input); - case Constants.CONSTANT_Float: + case Const.CONSTANT_Float: return new ConstantFloat(input); - case Constants.CONSTANT_Long: + case Const.CONSTANT_Long: return new ConstantLong(input); - case Constants.CONSTANT_Double: + case Const.CONSTANT_Double: return new ConstantDouble(input); - case Constants.CONSTANT_Utf8: + case Const.CONSTANT_Utf8: return ConstantUtf8.getInstance(input); - case Constants.CONSTANT_String: - case Constants.CONSTANT_MethodType: + case Const.CONSTANT_String: + case Const.CONSTANT_MethodType: skipSize = 2; // unsigned short break; - case Constants.CONSTANT_MethodHandle: + case Const.CONSTANT_MethodHandle: skipSize = 3; // unsigned byte, unsigned short break; - case Constants.CONSTANT_Fieldref: - case Constants.CONSTANT_Methodref: - case Constants.CONSTANT_InterfaceMethodref: - case Constants.CONSTANT_NameAndType: - case Constants.CONSTANT_InvokeDynamic: + case Const.CONSTANT_Fieldref: + case Const.CONSTANT_Methodref: + case Const.CONSTANT_InterfaceMethodref: + case Const.CONSTANT_NameAndType: + case Const.CONSTANT_InvokeDynamic: skipSize = 4; // unsigned short, unsigned short break; default: @@ -101,7 +101,6 @@ public abstract class Constant { } - @Override public String toString() { return "[" + tag + "]"; Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java Mon Aug 22 10:48:26 2016 @@ -20,14 +20,12 @@ package org.apache.tomcat.util.bcel.clas import java.io.DataInput; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; -/** - * This class is derived from the abstract - * <A HREF="org.apache.tomcat.util.bcel.classfile.Constant.html">Constant</A> class +/** + * This class is derived from the abstract {@link Constant} * and represents a reference to a (external) class. * - * @author <A HREF="mailto:[email protected]">M. Dahm</A> * @see Constant */ public final class ConstantClass extends Constant { @@ -41,13 +39,13 @@ public final class ConstantClass extends * @param file Input stream * @throws IOException */ - ConstantClass(DataInput file) throws IOException { - super(Constants.CONSTANT_Class); + ConstantClass(final DataInput file) throws IOException { + super(Const.CONSTANT_Class); this.name_index = file.readUnsignedShort(); } - /** + /** * @return Name index in constant pool of class name. */ public final int getNameIndex() { Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java Mon Aug 22 10:48:26 2016 @@ -20,14 +20,12 @@ package org.apache.tomcat.util.bcel.clas import java.io.DataInput; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; -/** - * This class is derived from the abstract - * <A HREF="org.apache.tomcat.util.bcel.classfile.Constant.html">Constant</A> class +/** + * This class is derived from the abstract {@link Constant} * and represents a reference to a Double object. * - * @author <A HREF="mailto:[email protected]">M. Dahm</A> * @see Constant */ public final class ConstantDouble extends Constant { @@ -35,14 +33,14 @@ public final class ConstantDouble extend private final double bytes; - /** + /** * Initialize instance from file data. * * @param file Input stream * @throws IOException */ - ConstantDouble(DataInput file) throws IOException { - super(Constants.CONSTANT_Double); + ConstantDouble(final DataInput file) throws IOException { + super(Const.CONSTANT_Double); this.bytes = file.readDouble(); } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java Mon Aug 22 10:48:26 2016 @@ -20,14 +20,12 @@ package org.apache.tomcat.util.bcel.clas import java.io.DataInput; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; -/** - * This class is derived from the abstract - * <A HREF="org.apache.tomcat.util.bcel.classfile.Constant.html">Constant</A> class +/** + * This class is derived from the abstract {@link Constant} * and represents a reference to a float object. * - * @author <A HREF="mailto:[email protected]">M. Dahm</A> * @see Constant */ public final class ConstantFloat extends Constant { @@ -35,18 +33,18 @@ public final class ConstantFloat extends private final float bytes; - /** + /** * Initialize instance from file data. * * @param file Input stream * @throws IOException */ - ConstantFloat(DataInput file) throws IOException { - super(Constants.CONSTANT_Float); + ConstantFloat(final DataInput file) throws IOException { + super(Const.CONSTANT_Float); this.bytes = file.readFloat(); } - + /** * @return data, i.e., 4 bytes. */ Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java Mon Aug 22 10:48:26 2016 @@ -20,14 +20,12 @@ package org.apache.tomcat.util.bcel.clas import java.io.DataInput; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; -/** - * This class is derived from the abstract - * <A HREF="org.apache.tomcat.util.bcel.classfile.Constant.html">Constant</A> class +/** + * This class is derived from the abstract {@link Constant} * and represents a reference to an int object. * - * @author <A HREF="mailto:[email protected]">M. Dahm</A> * @see Constant */ public final class ConstantInteger extends Constant { @@ -35,14 +33,14 @@ public final class ConstantInteger exten private final int bytes; - /** + /** * Initialize instance from file data. * * @param file Input stream * @throws IOException */ - ConstantInteger(DataInput file) throws IOException { - super(Constants.CONSTANT_Integer); + ConstantInteger(final DataInput file) throws IOException { + super(Const.CONSTANT_Integer); this.bytes = file.readInt(); } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java Mon Aug 22 10:48:26 2016 @@ -20,14 +20,12 @@ package org.apache.tomcat.util.bcel.clas import java.io.DataInput; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; -/** - * This class is derived from the abstract - * <A HREF="org.apache.tomcat.util.bcel.classfile.Constant.html">Constant</A> class +/** + * This class is derived from the abstract {@link Constant} * and represents a reference to a long object. * - * @author <A HREF="mailto:[email protected]">M. Dahm</A> * @see Constant */ public final class ConstantLong extends Constant { @@ -35,14 +33,14 @@ public final class ConstantLong extends private final long bytes; - /** + /** * Initialize instance from file data. * * @param file Input stream * @throws IOException */ - ConstantLong(DataInput input) throws IOException { - super(Constants.CONSTANT_Long); + ConstantLong(final DataInput input) throws IOException { + super(Const.CONSTANT_Long); this.bytes = input.readLong(); } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java Mon Aug 22 10:48:26 2016 @@ -20,7 +20,7 @@ package org.apache.tomcat.util.bcel.clas import java.io.DataInput; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; /** * This class represents the constant pool, i.e., a table of constants, of @@ -31,7 +31,6 @@ import org.apache.tomcat.util.bcel.Const * ConstantPoolGen</a>. * @see Constant - * @author <A HREF="mailto:[email protected]">M. Dahm</A> */ public class ConstantPool { @@ -45,8 +44,8 @@ public class ConstantPool { * @throws IOException * @throws ClassFormatException */ - ConstantPool(DataInput input) throws IOException, ClassFormatException { - int constant_pool_count = input.readUnsignedShort(); + ConstantPool(final DataInput input) throws IOException, ClassFormatException { + final int constant_pool_count = input.readUnsignedShort(); constant_pool = new Constant[constant_pool_count]; /* constant_pool[0] is unused by the compiler and may be used freely * by the implementation. @@ -57,12 +56,12 @@ public class ConstantPool { * "All eight byte constants take up two spots in the constant pool. * If this is the n'th byte in the constant pool, then the next item * will be numbered n+2" - * + * * Thus we have to increment the index counter. */ if (constant_pool[i] != null) { byte tag = constant_pool[i].getTag(); - if ((tag == Constants.CONSTANT_Double) || (tag == Constants.CONSTANT_Long)) { + if ((tag == Const.CONSTANT_Double) || (tag == Const.CONSTANT_Long)) { i++; } } @@ -77,7 +76,7 @@ public class ConstantPool { * @return Constant value * @see Constant */ - public Constant getConstant( int index ) { + public Constant getConstant( final int index ) { if (index >= constant_pool.length || index < 0) { throw new ClassFormatException("Invalid constant pool reference: " + index + ". Constant pool size is: " + constant_pool.length); @@ -94,16 +93,16 @@ public class ConstantPool { * @param tag Tag of expected constant, i.e., its type * @return Constant value * @see Constant - * @throws ClassFormatException + * @throws ClassFormatException If the constant is not of the expected type */ - public Constant getConstant( int index, byte tag ) throws ClassFormatException { + public Constant getConstant( final int index, final byte tag ) throws ClassFormatException { Constant c; c = getConstant(index); if (c == null) { throw new ClassFormatException("Constant pool at index " + index + " is null."); } if (c.getTag() != tag) { - throw new ClassFormatException("Expected class `" + Constants.CONSTANT_NAMES[tag] + throw new ClassFormatException("Expected class `" + Const.getConstantName(tag) + "' at index " + index + " and got " + c); } return c; Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java Mon Aug 22 10:48:26 2016 @@ -19,14 +19,13 @@ package org.apache.tomcat.util.bcel.clas import java.io.DataInput; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; -/** - * This class is derived from the abstract - * <A HREF="org.apache.tomcat.util.bcel.classfile.Constant.html">Constant</A> class +/** + * This class is derived from the abstract + * <A HREF="org.apache.tomcat.util.bcel.classfile.Constant.html">Constant</A> class * and represents a reference to a Utf8 encoded string. * - * @author <A HREF="mailto:[email protected]">M. Dahm</A> * @see Constant */ public final class ConstantUtf8 extends Constant { @@ -34,7 +33,7 @@ public final class ConstantUtf8 extends private final String bytes; - static ConstantUtf8 getInstance(DataInput input) throws IOException { + static ConstantUtf8 getInstance(final DataInput input) throws IOException { return new ConstantUtf8(input.readUTF()); } @@ -42,8 +41,8 @@ public final class ConstantUtf8 extends /** * @param bytes Data */ - private ConstantUtf8(String bytes) { - super(Constants.CONSTANT_Utf8); + private ConstantUtf8(final String bytes) { + super(Const.CONSTANT_Utf8); if (bytes == null) { throw new IllegalArgumentException("bytes must not be null!"); } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java Mon Aug 22 10:48:26 2016 @@ -19,18 +19,14 @@ package org.apache.tomcat.util.bcel.clas import java.io.DataInput; import java.io.IOException; -/** - * @author <A HREF="mailto:[email protected]">D. Brosius</A> - * @since 6.0 - */ public abstract class ElementValue { - protected final int type; + private final int type; - protected final ConstantPool cpool; + private final ConstantPool cpool; - ElementValue(int type, ConstantPool cpool) { + ElementValue(final int type, final ConstantPool cpool) { this.type = type; this.cpool = cpool; } @@ -51,9 +47,9 @@ public abstract class ElementValue public static final byte PRIMITIVE_SHORT = 'S'; public static final byte PRIMITIVE_BOOLEAN = 'Z'; - public static ElementValue readElementValue(DataInput input, ConstantPool cpool) throws IOException + public static ElementValue readElementValue(final DataInput input, final ConstantPool cpool) throws IOException { - byte type = input.readByte(); + final byte type = input.readByte(); switch (type) { case PRIMITIVE_BYTE: @@ -79,8 +75,8 @@ public abstract class ElementValue return new AnnotationElementValue(ANNOTATION, new AnnotationEntry(input, cpool), cpool); case ARRAY: - int numArrayVals = input.readUnsignedShort(); - ElementValue[] evalues = new ElementValue[numArrayVals]; + final int numArrayVals = input.readUnsignedShort(); + final ElementValue[] evalues = new ElementValue[numArrayVals]; for (int j = 0; j < numArrayVals; j++) { evalues[j] = ElementValue.readElementValue(input, cpool); @@ -92,4 +88,12 @@ public abstract class ElementValue "Unexpected element value kind in annotation: " + type); } } + + final ConstantPool getConstantPool() { + return cpool; + } + + final int getType() { + return type; + } } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java Mon Aug 22 10:48:26 2016 @@ -20,12 +20,11 @@ package org.apache.tomcat.util.bcel.clas import java.io.DataInput; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; /** * an annotation's element value pair - * - * @author <A HREF="mailto:[email protected]">D. Brosius</A> + * * @since 6.0 */ public class ElementValuePair @@ -36,7 +35,7 @@ public class ElementValuePair private final int elementNameIndex; - ElementValuePair(DataInput file, ConstantPool constantPool) throws IOException { + ElementValuePair(final DataInput file, final ConstantPool constantPool) throws IOException { this.constantPool = constantPool; this.elementNameIndex = file.readUnsignedShort(); this.elementValue = ElementValue.readElementValue(file, constantPool); @@ -44,8 +43,8 @@ public class ElementValuePair public String getNameString() { - ConstantUtf8 c = (ConstantUtf8) constantPool.getConstant( - elementNameIndex, Constants.CONSTANT_Utf8); + final ConstantUtf8 c = (ConstantUtf8) constantPool.getConstant( + elementNameIndex, Const.CONSTANT_Utf8); return c.getBytes(); } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java Mon Aug 22 10:48:26 2016 @@ -17,13 +17,13 @@ */ package org.apache.tomcat.util.bcel.classfile; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; public class EnumElementValue extends ElementValue { private final int valueIdx; - EnumElementValue(int type, int valueIdx, ConstantPool cpool) { + EnumElementValue(final int type, final int valueIdx, final ConstantPool cpool) { super(type, cpool); if (type != ENUM_CONSTANT) throw new RuntimeException( @@ -34,8 +34,8 @@ public class EnumElementValue extends El @Override public String stringifyValue() { - ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(valueIdx, - Constants.CONSTANT_Utf8); + final ConstantUtf8 cu8 = (ConstantUtf8) super.getConstantPool().getConstant(valueIdx, + Const.CONSTANT_Utf8); return cu8.getBytes(); } } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java Mon Aug 22 10:48:26 2016 @@ -24,8 +24,6 @@ package org.apache.tomcat.util.bcel.clas * The intent of this class is to represent a parsed or otherwise existing * class file. Those interested in programatically generating classes * should see the <a href="../generic/ClassGen.html">ClassGen</a> class. - - * @author <A HREF="mailto:[email protected]">M. Dahm</A> */ public class JavaClass { @@ -45,9 +43,9 @@ public class JavaClass { * @param interfaces Implemented interfaces * @param runtimeVisibleAnnotations "RuntimeVisibleAnnotations" attribute defined on the Class, or null */ - JavaClass(String class_name, String superclass_name, - int access_flags, ConstantPool constant_pool, String[] interface_names, - Annotations runtimeVisibleAnnotations) { + JavaClass(final String class_name, final String superclass_name, + final int access_flags, final ConstantPool constant_pool, final String[] interface_names, + final Annotations runtimeVisibleAnnotations) { this.access_flags = access_flags; this.runtimeVisibleAnnotations = runtimeVisibleAnnotations; this.class_name = class_name; Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java Mon Aug 22 10:48:26 2016 @@ -17,13 +17,13 @@ */ package org.apache.tomcat.util.bcel.classfile; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; public class SimpleElementValue extends ElementValue { private final int index; - SimpleElementValue(int type, int index, ConstantPool cpool) { + SimpleElementValue(final int type, final int index, final ConstantPool cpool) { super(type, cpool); this.index = index; } @@ -35,57 +35,57 @@ public class SimpleElementValue extends { return index; } - + // Whatever kind of value it is, return it as a string @Override public String stringifyValue() { - switch (type) + final ConstantPool cpool = super.getConstantPool(); + final int _type = super.getType(); + switch (_type) { case PRIMITIVE_INT: - ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(), - Constants.CONSTANT_Integer); + final ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(), + Const.CONSTANT_Integer); return Integer.toString(c.getBytes()); case PRIMITIVE_LONG: - ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(), - Constants.CONSTANT_Long); + final ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(), + Const.CONSTANT_Long); return Long.toString(j.getBytes()); case PRIMITIVE_DOUBLE: - ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(), - Constants.CONSTANT_Double); + final ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(), + Const.CONSTANT_Double); return Double.toString(d.getBytes()); case PRIMITIVE_FLOAT: - ConstantFloat f = (ConstantFloat) cpool.getConstant(getIndex(), - Constants.CONSTANT_Float); + final ConstantFloat f = (ConstantFloat) cpool.getConstant(getIndex(), + Const.CONSTANT_Float); return Float.toString(f.getBytes()); case PRIMITIVE_SHORT: - ConstantInteger s = (ConstantInteger) cpool.getConstant(getIndex(), - Constants.CONSTANT_Integer); + final ConstantInteger s = (ConstantInteger) cpool.getConstant(getIndex(), + Const.CONSTANT_Integer); return Integer.toString(s.getBytes()); case PRIMITIVE_BYTE: - ConstantInteger b = (ConstantInteger) cpool.getConstant(getIndex(), - Constants.CONSTANT_Integer); + final ConstantInteger b = (ConstantInteger) cpool.getConstant(getIndex(), + Const.CONSTANT_Integer); return Integer.toString(b.getBytes()); case PRIMITIVE_CHAR: - ConstantInteger ch = (ConstantInteger) cpool.getConstant( - getIndex(), Constants.CONSTANT_Integer); + final ConstantInteger ch = (ConstantInteger) cpool.getConstant( + getIndex(), Const.CONSTANT_Integer); return String.valueOf((char)ch.getBytes()); case PRIMITIVE_BOOLEAN: - ConstantInteger bo = (ConstantInteger) cpool.getConstant( - getIndex(), Constants.CONSTANT_Integer); + final ConstantInteger bo = (ConstantInteger) cpool.getConstant( + getIndex(), Const.CONSTANT_Integer); if (bo.getBytes() == 0) { return "false"; } return "true"; case STRING: - ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(getIndex(), - Constants.CONSTANT_Utf8); + final ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(getIndex(), + Const.CONSTANT_Utf8); return cu8.getBytes(); default: - throw new RuntimeException( - "SimpleElementValue class does not know how to stringify type " - + type); + throw new RuntimeException("SimpleElementValue class does not know how to stringify type " + _type); } } } Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Mon Aug 22 10:48:26 2016 @@ -20,12 +20,10 @@ import java.io.DataInput; import java.io.EOFException; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; +import org.apache.tomcat.util.bcel.Const; /** * Utility functions that do not really belong to any class in particular. - * - * @author <A HREF="mailto:[email protected]">M. Dahm</A> */ final class Utility { @@ -42,29 +40,29 @@ final class Utility { * @param str The long class name * @return Compacted class name */ - static String compactClassName(String str) { + static String compactClassName(final String str) { return str.replace('/', '.'); // Is `/' on all systems, even DOS } - static String getClassName(ConstantPool constant_pool, int index) { - Constant c = constant_pool.getConstant(index, Constants.CONSTANT_Class); + static String getClassName(final ConstantPool constant_pool, final int index) { + Constant c = constant_pool.getConstant(index, Const.CONSTANT_Class); int i = ((ConstantClass) c).getNameIndex(); // Finally get the string from the constant pool - c = constant_pool.getConstant(i, Constants.CONSTANT_Utf8); + c = constant_pool.getConstant(i, Const.CONSTANT_Utf8); String name = ((ConstantUtf8) c).getBytes(); return compactClassName(name); } - static void skipFully(DataInput file, int length) throws IOException { + static void skipFully(final DataInput file, final int length) throws IOException { int total = file.skipBytes(length); if (total != length) { throw new EOFException(); } } - static void swallowFieldOrMethod(DataInput file) + static void swallowFieldOrMethod(final DataInput file) throws IOException { // file.readUnsignedShort(); // Unused access flags // file.readUnsignedShort(); // name index @@ -77,7 +75,7 @@ final class Utility { } } - static void swallowAttribute(DataInput file) + static void swallowAttribute(final DataInput file) throws IOException { //file.readUnsignedShort(); // Unused name index skipFully(file, 2); Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1757144&r1=1757143&r2=1757144&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Aug 22 10:48:26 2016 @@ -269,6 +269,10 @@ <fix> Fixed typos in mbeans-descriptors.xml files. (violetagg) </fix> + <update> + Update the internal fork of Commons BCEL to r1757132 to align with the + BCEL 6 release. (markt) + </update> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
