You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2014/09/12 22:54:58 UTC

svn commit: r1624645 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: ConstantPool.java Utility.java

Author: kkolinko
Date: Fri Sep 12 20:54:57 2014
New Revision: 1624645

URL: http://svn.apache.org/r1624645
Log:
Inline ConstantPool.getConstantString() method.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

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=1624645&r1=1624644&r2=1624645&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 Fri Sep 12 20:54:57 2014
@@ -108,31 +108,4 @@ public class ConstantPool {
         }
         return c;
     }
-
-
-    /**
-     * Get string from constant pool and bypass the indirection of
-     * `ConstantClass' and `ConstantString' objects. I.e. these classes have
-     * an index field that points to another entry of the constant pool of
-     * type `ConstantUtf8' which contains the real data.
-     *
-     * @param  index Index in constant pool
-     * @param  tag Tag of expected constant, either ConstantClass or ConstantString
-     * @return Contents of string reference
-     * @see    ConstantClass
-     * @throws  ClassFormatException
-     */
-    public String getConstantString( int index, byte tag ) throws ClassFormatException {
-        Constant c = getConstant(index, tag);
-
-        if (Constants.CONSTANT_Class != tag) {
-            throw new RuntimeException("getConstantString called with illegal tag " + tag);
-        }
-
-        int i = ((ConstantClass) c).getNameIndex();
-
-        // Finally get the string from the constant pool
-        c = getConstant(i, Constants.CONSTANT_Utf8);
-        return ((ConstantUtf8) c).getBytes();
-    }
 }

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=1624645&r1=1624644&r2=1624645&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 Fri Sep 12 20:54:57 2014
@@ -48,7 +48,13 @@ final class Utility {
     }
 
     static String getClassName(ConstantPool constant_pool, int index) {
-        String name = constant_pool.getConstantString(index, Constants.CONSTANT_Class);
+        Constant c = constant_pool.getConstant(index, Constants.CONSTANT_Class);
+        int i = ((ConstantClass) c).getNameIndex();
+
+        // Finally get the string from the constant pool
+        c = constant_pool.getConstant(i, Constants.CONSTANT_Utf8);
+        String name = ((ConstantUtf8) c).getBytes();
+
         return compactClassName(name);
     }
 



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