You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Antonio Gallardo (JIRA)" <xa...@xml.apache.org> on 2005/04/23 09:43:25 UTC

[jira] Created: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

NPE in o.a.xml.serializer.ToHTMLStream.endElement()
---------------------------------------------------

         Key: XALANJ-2111
         URL: http://issues.apache.org/jira/browse/XALANJ-2111
     Project: XalanJ2
        Type: Bug
  Components: Serialization  
    Versions: 2.6    
 Environment: Cocoon 2.1.7
    Reporter: Antonio Gallardo


See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386

The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
org.apache.xml.serializer.ToHTMLStream.java (current CVS).

This makes the serializer to service the SAX events as XML and this seems to be
the cause of the trouble.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=comments#action_64382 ]
     
Brian Minchau commented on XALANJ-2111:
---------------------------------------

We will be resolving this one as "incomplete" if no testcase is provided.

> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo

>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=comments#action_64506 ]
     
Brian Minchau commented on XALANJ-2111:
---------------------------------------

Antonio, thanks for the testcase. Unfortunately, both for 2.6.0 and for current CVS development state of Xalan-J I did not get a NPE.

For the testcase that you point to, the current code in CVS, and the code in the 2.6.0 release does not use ToHTMLStream at all, as reported by you. When I run all output is through ToXMLStream, and there is good reason for this.

The sytlesheet you give starts like this:
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="page">
   <html>
   ...
   ...

Note the default namespace that you have specified, "http://www.w3.org/1999/xhtml", which makes the output literal element <html> to be in that default namespace. Section 16 of the XSLT 1.0 recommendation, http://www.w3.org/TR/xslt#output , says this about when no <xsl:output method... />
 is specified, and a default value is used for the value of method attribute:
<<
The default for the method attribute is chosen as follows. If

- the root node of the result tree has an element child,

- the expanded-name of the first element child of the root node (i.e. the document element) of the result tree has local part html (in any combination of upper and lower case) and a null namespace URI, and

- any text nodes preceding the first element child of the root node of the result tree contain only whitespace characters,

then the default output method is html; otherwise, the default output method is xml. 
>>

We choose a default output method of xml because the expanded-name of the first element output is <html> but in a non null namespace, the default one you gave, so the output method is xml.

I modified the stylesheet you pointed to, and added this:
    <xsl:output method="html" />

With this change the code did run through startElement() in ToHTMLStream. The literal elements in the stylesheet are in a non-null namespace and treated as XML elements.  This is because section 16.2, http://www.w3.org/TR/xslt#section-HTML-Output-Method , says this:

<<
The html output method should not output an element differently from the xml output method unless the expanded-name of the element has a null namespace URI; an element whose expanded-name has a non-null namespace URI should be output as XML. 
>>

However the <b> copied from your input XML file where it had a null namespace, and was copied to the output tree, where it still has no namespace associated with it, so it is treated as an HTML element in this case.  But I still get no NPE, both for current CVS and for 2.6.0

I'm suspecting that you are not running 2.6. Please you run org.apache.xalan.Version and see what you get out. I get this:
Xalan Java 2.6.0




> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo
>  Attachments: dump.txt, dump.txt, output.txt
>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Updated: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Antonio Gallardo (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=all ]

Antonio Gallardo updated XALANJ-2111:
-------------------------------------

    Attachment: dump.txt

Sorry. I forgot to save it.

> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo
>  Attachments: dump.txt, dump.txt, output.txt
>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Updated: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Antonio Gallardo (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=all ]

Antonio Gallardo updated XALANJ-2111:
-------------------------------------

    Attachment: output.txt

This is the output on the console screen.

> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo
>  Attachments: dump.txt, dump.txt, output.txt
>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=comments#action_63669 ]
     
Brian Minchau commented on XALANJ-2111:
---------------------------------------

Just in case these lines slide around, the lines refered to by Antonio are these in the SAX startElement() method:

        // if this element has a namespace then treat it like XML
        if (null != namespaceURI && namespaceURI.length() > 0)
        {
            super.startElement(namespaceURI, localName, name, atts);

            return;
        }

and these in the endElement() method:

        // if the element has a namespace, treat it like XML, not HTML
        if (null != namespaceURI && namespaceURI.length() > 0)
        {
            super.endElement(namespaceURI, localName, name);

            return;
        }

I agree with Henry, we need to follow 16.2 of XSLT 1.0, so we can't just cut them out. We need a testcase to investigate the NPE. 

> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo

>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Antonio Gallardo (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=comments#action_64421 ]
     
Antonio Gallardo commented on XALANJ-2111:
------------------------------------------

I am trying to build a test case. Since it is not my main job. I can only works on this over weekends or at night.

> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo

>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Updated: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Antonio Gallardo (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=all ]

Antonio Gallardo updated XALANJ-2111:
-------------------------------------

    Attachment: dump.txt

This is the dump from eclipse on the NPE. Is this useful?

> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo
>  Attachments: dump.txt
>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Antonio Gallardo (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=comments#action_64448 ]
     
Antonio Gallardo commented on XALANJ-2111:
------------------------------------------

Sorry for the lot loud before this comment. I'm not a Jira expert. ;-)

For all of this I used the xalan as is in CVS now.

I added 2 attachments:

1- dump.txt  - created using eclipse and setting a breakpoint on first NPE. This is why the first line said the Thread was suspended.

2- output.txt - the exception message in the console. Here shows the exception is throw in other place but the cause is the same NPE as in dump.txt

Please note the Cocoon TraxTransformer and other related classes works good and is used in production in a lot of sites. I tried to create a show case of this bug using:

java -Djava.endorsed.dirs=. -cp xalan.jar:xml-apis.jar:xercesImpl-2.6.2.jar org.apache.xalan.xslt.Process -IN hello.xml -XSL page2html.xsl -HTML

But is was imposible to me to reproduce it.

                                 - 0 -

A- Here is the input XML file that works:
http://svn.apache.org/viewcvs.cgi/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/hello-world/content/hello.xml?view=markup

B- Here is the XSLT file:

http://svn.apache.org/viewcvs.cgi/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/hello-world/style/xsl/page2html.xsl?view=markup


If (A) is used "AS IS", then everything works good. But is we replace in (A) the line: 

<para>This is my first Cocoon page!</para>

with:

<para>This is my <b>first</b> Cocoon page!</para>

(Note the added <b> elements). Then throws the exception.

Since we have a default namespace, that means every element including the <b> element should the considered as an XML element. My question is, why is the code going to line 852 if this will go throught line 840?

Here is a snipet of ToHTMLStream.java:

line 839: // if the element has a namespace, treat it like XML, not HTML
line 840: if (null != namespaceURI && namespaceURI.length() > 0)
line 841: {
line 842:     super.endElement(namespaceURI, localName, name);
line 843:
line 844:     return;
line 845:  }
line 846:
line 847:  try
line 848:  {
line 849:
line 850:     ElemContext elemContext = m_elemContext;
line 851:     final ElemDesc elemDesc = elemContext.m_elementDesc;
line 852:     final int elemFlags = elemDesc.getFlags();
line 853:     final boolean elemEmpty = (elemFlags & ElemDesc.EMPTY) != 0;



> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo
>  Attachments: dump.txt, dump.txt, output.txt
>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Antonio Gallardo (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=comments#action_65849 ]
     
Antonio Gallardo commented on XALANJ-2111:
------------------------------------------

Please don't close the bug. It exists in cocoon. I am still working on this bug. Now, I am suspecting this bug is related to:

http://issues.apache.org/jira/browse/XALANJ-1901

wich is related to:

http://issues.apache.org/jira/browse/XALANJ-1628

Please forget to my "initial fix" it was most a first sight workaround and I agree this is not a real solution.

Soon I will put more info.

> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo
>  Attachments: dump.txt, dump.txt, output.txt
>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=comments#action_63651 ]
     
Henry Zongaro commented on XALANJ-2111:
---------------------------------------

Do you have a complete, standalone XSLT test case (stylesheet and XML document) that demonstrates this problem?  It's not clear to me what's wrong with the code you've pointed to.

I should point out that section 16.2 of XSLT 1.0[1] states, "The html output method should not output an element differently from the xml output method unless the expanded-name of the element has a null namespace URI; an element whose expanded-name has a non-null namespace URI should be output as XML."  The code in question checks whether an element is in some namespace, and outputs it as XML, as is required, so I don't believe we'll be able to simply comment it out.

[1] http://www.w3.org/TR/xslt#section-HTML-Output-Method

> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo

>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=comments#action_65062 ]
     
Brian Minchau commented on XALANJ-2111:
---------------------------------------

Antonio,
I'll have to close this one as "cannot reproduce" unless I get some new information.

Did you run org.apache.xalan.Version to confirm your version? 
Did you run the latest code from CVS?

> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo
>  Attachments: dump.txt, dump.txt, output.txt
>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2111) NPE in o.a.xml.serializer.ToHTMLStream.endElement()

Posted by "Antonio Gallardo (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2111?page=comments#action_65855 ]
     
Antonio Gallardo commented on XALANJ-2111:
------------------------------------------

I am using java 1.4.2_08, using an endorsed dir where there are the xalan.jars from the CVS. I also copied the xalan jars to cocon libs. Doing this, I think is imposible I am running a diferent xalan version. But let me know if this is posible after all. I truly want to learn how to debug xalan. ;-)

Here is more info of the problem:

1- Given the XML input:

<page>
 <title>Hello</title>
 <content>
  <para>This is my <b>first</b> Cocoon page!</para>
 </content>
</page>

2- Knowing we are using in the XSLT:

xmlns="http://www.w3.org/1999/xhtml"

3- Debugging the code, in org.apache.templates.ElemCopy, lines 160-164:

160: super.execute(transformer);
161: rthandler.processNSDecls(sourceNode, nodeType, dtm);
162: transformer.executeChildTemplates(this, true);
163:
164: String ns = dtm.getNamespaceURI(sourceNode);

The namespace becomes null only for <b> in line 164! I wonder why this happen inside the transformation inside cocoon and not using the command line. The namespace should be the default namespace or not? (See point 2, above).

Since the namespace there becomes null for <b> (a nested tag), the NPE raises later inside org.apache.xml.serializer.ToHTMLStream in line 852. In 851 elemDesc is initialized with a null value and in 852 we cannot call the method getFlags():

851: final ElemDesc elemDesc = elemContext.m_elementDesc;
852: final int elemFlags = elemDesc.getFlags();


4-If I remove from the input XML file the tags "<b>" and "</b>", then the transformation success. Why it does not works with the <b> (or whatever tags?). As I pointed before, I was unable to reproduce this using the command line.

***************************************************************

If you wish, I can write down exactly what you need to do (using cocoon) to see the error. It is part of the cocoon samples, where we need to add the <b> tags.


> NPE in o.a.xml.serializer.ToHTMLStream.endElement()
> ---------------------------------------------------
>
>          Key: XALANJ-2111
>          URL: http://issues.apache.org/jira/browse/XALANJ-2111
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Cocoon 2.1.7
>     Reporter: Antonio Gallardo
>  Attachments: dump.txt, dump.txt, output.txt
>
> See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386
> The solution is to comment lines blocks from 726 to 731 and 840 to 845 in
> org.apache.xml.serializer.ToHTMLStream.java (current CVS).
> This makes the serializer to service the SAX events as XML and this seems to be
> the cause of the trouble.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org