This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git


The following commit(s) were added to refs/heads/master by this push:
     new abde81d  Fix bug. Constant pool size is defined as u2
abde81d is described below

commit abde81dfa60b1e390c82e4b30240a59ea1b0596e
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Feb 10 09:55:51 2021 +0000

    Fix bug. Constant pool size is defined as u2
    
    u2 is an unsigned 2-byte integer but short is a signed 2-byte integer.
    Therefore use int.
---
 src/main/java/org/apache/tomcat/jakartaee/ClassConverter.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/tomcat/jakartaee/ClassConverter.java 
b/src/main/java/org/apache/tomcat/jakartaee/ClassConverter.java
index 173ea8e..1b15652 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/ClassConverter.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/ClassConverter.java
@@ -49,7 +49,8 @@ public class ClassConverter implements Converter {
 
         // Loop through constant pool
         Constant[] constantPool = 
javaClass.getConstantPool().getConstantPool();
-        for (short i = 0; i < constantPool.length; i++) {
+        // Need an int as the maximum pool size is 2^16
+        for (int i = 0; i < constantPool.length; i++) {
             if (constantPool[i] instanceof ConstantUtf8) {
                 ConstantUtf8 c = (ConstantUtf8) constantPool[i];
                 String str = c.getBytes();


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

Reply via email to