Author: markt
Date: Wed Sep 10 20:33:20 2014
New Revision: 1624115

URL: http://svn.apache.org/r1624115
Log:
Remove unused code (Code)

Removed:
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java
Modified:
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java
    
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.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=1624115&r1=1624114&r2=1624115&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 10 20:33:20 2014
@@ -32,7 +32,6 @@ import org.apache.tomcat.util.bcel.Const
  * attribute stands for non-standard-attributes.
  *
  * @author <A HREF="mailto:m.d...@gmx.de";>M. Dahm</A>
- * @see Code
  * @see ExceptionTable
  * @see LineNumberTable
  * @see LocalVariableTable
@@ -106,7 +105,8 @@ public abstract class Attribute implemen
             Utility.swallowSourceFile(file);
             return null;
         case Constants.ATTR_CODE:
-            return new Code(name_index, length, file, constant_pool);
+            Utility.swallowCode(file, constant_pool);
+            return null;
         case Constants.ATTR_EXCEPTIONS:
             return new ExceptionTable(name_index, length, file, constant_pool);
         case Constants.ATTR_LINE_NUMBER_TABLE:

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=1624115&r1=1624114&r2=1624115&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 10 20:33:20 2014
@@ -29,7 +29,6 @@ import java.io.IOException;
  * with the other classes).
  *
  * @author  <A HREF="mailto:m.d...@gmx.de";>M. Dahm</A>
- * @see     Code
  */
 public final class ExceptionTable extends Attribute {
 

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=1624115&r1=1624114&r2=1624115&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 10 20:33:20 2014
@@ -26,7 +26,6 @@ import java.io.IOException;
  * contains pairs of PCs and line numbers.
  *
  * @author  <A HREF="mailto:m.d...@gmx.de";>M. Dahm</A>
- * @see     Code
  */
 public final class LineNumberTable extends Attribute {
 

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=1624115&r1=1624114&r2=1624115&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 10 20:33:20 2014
@@ -25,7 +25,6 @@ import java.io.IOException;
  * method. This attribute is contained in the <em>Code</em> attribute.
  *
  * @author  <A HREF="mailto:m.d...@gmx.de";>M. Dahm</A>
- * @see     Code
  */
 public class LocalVariableTable extends Attribute {
 

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=1624115&r1=1624114&r2=1624115&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 Wed 
Sep 10 20:33:20 2014
@@ -196,4 +196,27 @@ final class Utility {
     static void swallowConstantValue(DataInput file) throws IOException {
         file.readUnsignedShort();   // Unused constantvalue_index
     }
+
+    static void swallowCode(DataInputStream file, ConstantPool constant_pool) 
throws IOException {
+        file.readUnsignedShort();   // Unused max_stack
+        file.readUnsignedShort();   // Unused max_locals
+        int code_length = file.readInt();
+        byte[] code = new byte[code_length]; // Read byte code
+        file.readFully(code);
+        /* Read exception table that contains all regions where an exception
+         * handler is active, i.e., a try { ... } catch() block.
+         */
+        int exception_table_length = file.readUnsignedShort();
+        for (int i = 0; i < exception_table_length; i++) {
+            Utility.swallowCodeException(file);
+        }
+        /* Read all attributes, currently `LineNumberTable' and
+         * `LocalVariableTable'
+         */
+        int attributes_count = file.readUnsignedShort();
+        for (int i = 0; i < attributes_count; i++) {
+            Attribute.readAttribute(file, constant_pool);
+        }
+
+    }
 }



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

Reply via email to