Mantis - Resin
Viewing Issue Advanced Details
451 minor always 11-09-05 00:00 01-10-06 15:48
mate  
 
urgent  
closed 3.0.14  
3.0.14 no change required  
none    
none  
0000451: Resin XSL: Attributes local name is blank
RSN-500
Not entirely sure whether the problem lies with Resin or with JDOM, but it works fine with Resin 2.x so my guess is Resin.

When the stylesheet contains attributes without namespace (on elements with namespace) the local name of the attribute will be blank, while the qName will be set. JDOM assumes the local name to be the same as the qName if no prefix/namespace is used.

org.jdom.SAXHandler
536: if (!attQName.equals(attLocalName)) {
537: String attPrefix = attQName.substring(0, attQName.indexOf(":"));

Attached is a serlvet with an example (requiring JDOM).

This bug hinders us from migrating to Resin 3.
Resin 3.0.14, JDOM 1.0, JDK 1.5

Notes
(0000477)
mate   
11-09-05 00:00   
Here is the top of the stack trace:



java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1768)
    at org.jdom.input.SAXHandler.startElement(SAXHandler.java:537)
    at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
    at org.jdom.transform.JDOMResult$DocumentBuilder.startElement(JDOMResult.java:519)
    at com.caucho.xml.SAXBuilder.popElement(SAXBuilder.java:314)
    at com.caucho.xml.SAXBuilder.pop(SAXBuilder.java:294)
    at com.caucho.xml.SAXBuilder.endDocument(SAXBuilder.java:121)
    at com.caucho.xsl.XslWriter.close(XslWriter.java:383)
    at com.caucho.xsl.StylesheetImpl.transform(StylesheetImpl.java:210)
    at com.caucho.xsl.TransformerImpl.transform(TransformerImpl.java:476)
    at com.caucho.xsl.TransformerImpl.transform(TransformerImpl.java:312)
    at resin3Test.XslProblemServlet.service(XslProblemServlet.java:32)
(0000478)
mate   
11-09-05 00:00   
Looking at the API documentation, http://java.sun.com/j2se/1.5.0/docs/api/org/xml/sax/Attributes.html#getLocalName(int), [^] I'm leaning towards JDOM being the problem. Although Xalan works as Resin 2 did.

I have posted a bug report and patch to JDOM's mailing list. I'll post here when answered.
(0000479)
mate   
11-09-05 00:00   
There will be a fix for this in JDOM 1.0.1, so this issue can be closed.