tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Danno Ferrin" <DFER...@novell.com>
Subject Bug in Taglibs
Date Fri, 12 Nov 1999 00:08:01 GMT
An interesting compiler/verfier bug of 1.1 and 1.2 causes a legit taglib definition to fail
on a verification error.  Basically jasper creates a code block 
try {
    do {
        // end
        // begin
    } while (false);
} catch (Throwable t) {
    System.err.println("Caught: ");
    t.printStackTrace();
} finally {
}
which makes the verifier freak out (but not under JDK 1.3 say the sun bug people... but I
am not sure if it is compiling under one and running under the other or all 1.3) .  Basically
the empty try block maps an exception to a single jump instruction, which in essense would
make the catch block un-readable.   A current work around is to use and make no empty or functionally
empty tags.

Possible fixes include putting a bogus instruction in there to add at lease one more jvm instruction.
 Another is to get rid of the try block since the exact same code block seems to be in great
abundance... but that allows the page authot to catch exceptions coming out from opening and
closing tags rather than silently failing.  The best fix is to not write the block if the
tag has no content, but that would require some co-operation between TagBeginGenerator and
TagEndGenerator.  

Perhaps a special TagEmptyGenerator?  Or an extra constructor parameter to TagBeginGenerator
and TagEndGenerator?  The parsing code would also need to look ahead to see if the current
tag is an empty tag or if the next immedate content is the corresponding close tag.

Attached is code that can make it freak out.
--Danno


Mime
View raw message