Author: markt Date: Thu Sep 11 22:17:31 2014 New Revision: 1624408 URL: http://svn.apache.org/r1624408 Log: Annotations and ParameterAnnotations have a different structure
Modified: 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/Utility.java 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=1624408&r1=1624407&r2=1624408&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 Thu Sep 11 22:17:31 2014 @@ -139,7 +139,7 @@ public abstract class Attribute implemen return new RuntimeVisibleParameterAnnotations(name_index, length, file, constant_pool); case Constants.ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS: - Utility.swallowAnnotations(file); + Utility.swallowParameterAnnotations(file); return null; case Constants.ATTR_ANNOTATION_DEFAULT: return new AnnotationDefault(name_index, length, file, 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=1624408&r1=1624407&r2=1624408&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 Thu Sep 11 22:17:31 2014 @@ -173,8 +173,7 @@ public final class ClassParser { * @throws ClassFormatException */ private void readFields() throws IOException, ClassFormatException { - int fields_count; - fields_count = file.readUnsignedShort(); + int fields_count = file.readUnsignedShort(); for (int i = 0; i < fields_count; i++) { Utility.swallowFieldOrMethod(file, constant_pool); } 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=1624408&r1=1624407&r2=1624408&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 Thu Sep 11 22:17:31 2014 @@ -296,8 +296,7 @@ final class Utility { file.readUnsignedShort(); // Unused name_and_type_index } - static void swallowAnnotations(DataInput file) - throws IOException { + static void swallowAnnotations(DataInput file) throws IOException { final int annotation_table_length = (file.readUnsignedShort()); for (int i = 0; i < annotation_table_length; i++) { swallowAnnotationEntry(file); @@ -307,13 +306,28 @@ final class Utility { static void swallowAnnotationEntry(DataInput file) throws IOException { file.readUnsignedShort(); // Unused type index - final int num_element_value_pairs = (file.readUnsignedShort()); + final int num_element_value_pairs = file.readUnsignedShort(); for (int i = 0; i < num_element_value_pairs; i++) { file.readUnsignedShort(); // Unused name index swallowElementValue(file); } } + static void swallowParameterAnnotations(DataInput file) throws IOException { + final int annotation_table_length = (file.readUnsignedByte()); + for (int i = 0; i < annotation_table_length; i++) { + swallowParameterAnnotationEntry(file); + } + } + + static void swallowParameterAnnotationEntry(DataInput file) + throws IOException { + final int annotation_table_length = file.readUnsignedShort(); + for (int i = 0; i < annotation_table_length; i++) { + swallowAnnotationEntry(file); + } + } + static void swallowElementValue(DataInput file) throws IOException { byte type = file.readByte(); @@ -423,9 +437,11 @@ final class Utility { break; case Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS: case Constants.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS: + swallowAnnotations(file); + break; case Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS: case Constants.ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS: - swallowAnnotations(file); + swallowParameterAnnotations(file); break; case Constants.ATTR_ANNOTATION_DEFAULT: swallowAnnotationDefault(file); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org