Whenever I try to use any EL (either $ or # syntax) in a taglib tag's dynamic attribute in Tomcat 6.0.7, I get the following exception:

java.lang.NullPointerException
at org.apache.jasper.compiler.Generator$GenerateVisitor.evaluateAttribute(Generator.java:2777) at org.apache.jasper.compiler.Generator$GenerateVisitor.generateSetters(Generator.java:2988) at org.apache.jasper.compiler.Generator$GenerateVisitor.generateCustomStart(Generator.java:2169) at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1689)
   at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
   at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
   at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1705)
   at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
   at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)

I traced into the source code of Tomcat 6.0.7 with a debugger and found out the exception is caused by the code at the mentioned line 2777 of Generator.java, which is trying to request a TagAttributeInfo from the current attribute, but for a dynamic attribute the JspAttribute.tai field is always null.

When I debug the evaluateAttribute method in question, I see that for Node.JspAttribute attr, the "dynamic" field (attr.dynamic) is correctly set to true and attr.getLocalName() returns the correct name of the dynamic attribute. At line 2771 attr.isELInterpreterInput() returns true, since attr.el != null. When I inspect attr.el, I see the EL expresion is correctly parsed. Only, a few lines below that the code fails with the NPE upon accessing the TagAttributeInfo object tai (which is, as said always null for dynamic attributes).

--
It's a cult. If you've coded for any length of time, you've run across someone 
from this warped brotherhood. Their creed: if you can write complicated code, 
you must be good.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to