Bug 40653

Summary: Issue with XML stream writer and namespaces
Product: classpath Reporter: Ludovic Claude <ludovic.claude>
Component: xmlAssignee: chris burdess <dog>
Status: RESOLVED FIXED    
Severity: normal CC: bug-classpath, gnu_andrew
Priority: P3    
Version: 0.98   
Target Milestone: 0.99   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Attachments: TestCase
Patch for bug 40653
Updated patch, passes my testcase

Description Ludovic Claude 2009-07-05 13:27:41 UTC
I have an issue with XMLStreamWriter. I have a test case which works perfectly with Sun 6 and Sun 5 + StAX reference implementation from stax.codehaus.org, but it fails on GNU Classpath. The issue is that the validation seems too strong for the namespace, and it doesn't like writeNamespace() with a null prefix argument, although the documentation says:

> Writes a namespace to the output stream If the prefix argument to this method is the empty string, "xmlns", or null this method will delegate to writeDefaultNamespace

This is the result of running my test:

1) testWriter(gnu.xml.stream.XMLStreamWriterTest)java.lang.IllegalArgumentException: illegal NCName: null
   at gnu.xml.stream.XMLStreamWriterImpl.writeNamespace(libgcj.so.90)
   at gnu.xml.stream.XMLStreamWriterTest.testWriter(XMLStreamWriterTest.java:26)
   at gnu.xml.stream.XMLStreamWriterTest.main(XMLStreamWriterTest.java:37)
Comment 1 Ludovic Claude 2009-07-05 13:29:04 UTC
Created attachment 18139 [details]
TestCase
Comment 2 chris burdess 2009-07-06 08:45:53 UTC
Created attachment 18141 [details]
Patch for bug 40653
Comment 3 chris burdess 2009-07-06 08:47:04 UTC
Please can you test with the supplied patch, if so I will submit it.
Comment 4 Ludovic Claude 2009-07-06 17:08:35 UTC
Created attachment 18142 [details]
Updated patch, passes my testcase

Hi Chris, I have created an updated patch which fixes this bug. There may be more issues with the XML Stream, in particular support for the XML stream 1.0.1 API is missing
Comment 5 Andrew John Hughes 2009-07-07 11:53:02 UTC
CVSROOT:        /sources/classpath
Module name:    classpath
Changes by:     Andrew John Hughes <gnu_andrew> 09/07/07 11:52:15

Modified files:
       .              : ChangeLog
       gnu/xml/stream : XMLStreamWriterImpl.java

Log message:
       2009-07-06  Ludovic Claude  <ludovic.claude@laposte.net>

               PR xml/40653
               * gnu/xml/stream/XMLStreamWriterImpl.java:
               Weaken testing of namespace prefix to match
               reference implementation and spec.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.9770&r2=1.9771
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/xml/stream/XMLStreamWriterImpl.java?cvsroot=classpath&r1=1.6&r2=1.7
Comment 6 Andrew John Hughes 2010-10-12 17:31:59 UTC
Merged to gcj in libgcj-snapshot-20100921.