commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@codehaus.org
Subject [jira] Updated: (JELLY-43) [jelly] Bug in TransformTag with nested ImportTag
Date Thu, 04 Sep 2003 18:28:11 GMT
The following issue has been updated:

    Updater: Morgan Delagrange (mailto:mdelagra@yahoo.com)
       Date: Thu, 4 Sep 2003 1:27 PM
    Changes:
             timeoriginalestimate changed from 0
             timeestimate changed from 0 minutes
             Component changed to taglib.xml
             Component changed from tags
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=JELLY-43&page=history

---------------------------------------------------------------------
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
  Remaining: Unknown

    Project: jelly
 Components: 
             taglib.xml

   Assignee: peter royal
   Reporter: Vincenz Braun

    Created: Thu, 20 Mar 2003 1:45 PM
    Updated: Thu, 4 Sep 2003 1:27 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/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message