Author: markt
Date: Wed Sep 17 12:27:52 2014
New Revision: 1625554

URL: http://svn.apache.org/r1625554
Log:
Inline ConstantPool.getConstantString() method.
Port of r1624645 from trunk

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1624645

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
------------------------------------------------------------------------------
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624645

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=1625554&r1=1625553&r2=1625554&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
 Wed Sep 17 12:27:52 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/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=1625554&r1=1625553&r2=1625554&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 
Wed Sep 17 12:27:52 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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to