Message: The following issue has been re-assigned.
Assignee: peter royal (mailto:[EMAIL PROTECTED]) --------------------------------------------------------------------- View the issue: http://jira.codehaus.org/secure/ViewIssue.jspa?key=JELLY-43 Here is an overview of the issue: --------------------------------------------------------------------- Key: JELLY-43 Summary: [jelly] Bug in TransformTag with nested ImportTag Type: Bug Status: Assigned Priority: Major Time Spent: Unknown Estimate: 0 minutes Project: jelly Components: tags Assignee: peter royal Reporter: Vincenz Braun Created: Thu, 20 Mar 2003 1:45 PM Updated: Sun, 22 Jun 2003 9:29 PM Description: when transforming an imported jelly file an exception is thrown: Use case; import.jelly: <?xml version="1.0" encoding="ISO-8859-1"?> <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" > <x:transform xslt="import.xsl"> <j:import inherit="true" uri="imported.jelly"/> </x:transform> </j:jelly> imported.jelly: <?xml version="1.0" encoding="ISO-8859-1"?> <j:jelly xmlns:j="jelly:core"> <root/> </j:jelly> imported.xsl: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE xsl:stylesheet> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="root"> <html></html> </xsl:template> </xsl:stylesheet> The exception is: [snip] <j:import> could not import script at org.apache.commons.jelly.tags.xml.TransformTag.doTag (TransformTag.java:204) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) at org.apache.commons.jelly.tags.core.JellyTag.doTag(JellyTag.java:91) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.JellyContext.runScript (JellyContext.java:623) at org.apache.commons.jelly.JellyContext.runScript (JellyContext.java:529) [snip] [snip] <j:import> could not import script at org.apache.commons.jelly.tags.xml.TransformTag$TagBodyXMLReader.doInvokeBody (TransformTag.java:527) at org.apache.commons.jelly.tags.xml.TransformTag$TagBodyXMLReader.parse (TransformTag.java:482) at org.apache.commons.jelly.tags.xml.TransformTag.doTag (TransformTag.java:190) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) at org.apache.commons.jelly.tags.core.JellyTag.doTag(JellyTag.java:91) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.JellyContext.runScript (JellyContext.java:623) at org.apache.commons.jelly.JellyContext.runScript (JellyContext.java:529) [snip] Root cause Exception in thread "main" This script works: import2.jelly: <?xml version="1.0" encoding="ISO-8859-1"?> <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" > <j:import inherit="true" uri="imported.jelly"/> </j:jelly> ----- After some investigation I found the following: The root cause of this exception is an ArrayIndexOutOfBoundsException in xalan. (Unfortunately you can not see this root exception in the stacktrace. I had to use the debugger...) My first guess was that is due to inproper setup of the TransformContentHandler. This is right because the nested import tag does not fire startDocument() and endDocument() events that the xalan content handler depends on to setup itself. This works with import and content that needs parsing. in TagBodyXMLReader /** * Actually invoke the tag body to generate the SAX events * * @throws SAXException - * Any SAX exception, possibly wrapping another exception. */ private void doInvokeBody() throws SAXException { try { if (this.shouldParseBody()) { XMLReader anXMLReader = XMLReaderFactory.createXMLReader(); anXMLReader.setContentHandler(this.xmlOutput); anXMLReader.setProperty (LEXICAL_HANDLER_PROPERTY,this.xmlOutput); StringWriter writer = new StringWriter(); this.tag.invokeBody(XMLOutput.createXMLOutput(writer)); Reader reader = new StringReader(writer.toString()); anXMLReader.parse(new InputSource(reader)); } else { this.xmlOutput.startDocument(); this.tag.invokeBody(this.xmlOutput); this.xmlOutput.endDocument(); } } catch (Exception ex) { throw new SAXException(ex); } } --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
