cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mauro Molinari (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-2919) NullPointerException at org.apache.cxf.staxutils.StaxUtils.writeNode(Node, XMLStreamWriter, boolean) when DOCTYPE is in a XML Schema
Date Fri, 30 Jul 2010 16:32:37 GMT

    [ https://issues.apache.org/jira/browse/CXF-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12894069#action_12894069
] 

Mauro Molinari commented on CXF-2919:
-------------------------------------

"Critical" because I find it quite normal that a XSD (which is an XML) may contain a DOCTYPE.
I'm trying to expose the XSD of WS-Addressing (ws-addr.xsd - "W3C XML Schema defined in the
Web Services Addressing 1.0 specification") provided by JBoss Transactions XTS, which comes
with a DOCTYPE and I have to edit it (removing the DOCTYPE) in order to avoid CXF to throw
the NPE.

I think CXF should handle the DOCTYPE by either skipping it (if it's useless with regards
to WDSL publishing) or by just printing it out as-is.

> NullPointerException at org.apache.cxf.staxutils.StaxUtils.writeNode(Node, XMLStreamWriter,
boolean) when DOCTYPE is in a XML Schema
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-2919
>                 URL: https://issues.apache.org/jira/browse/CXF-2919
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.9
>            Reporter: Mauro Molinari
>            Priority: Critical
>
> Following a contract first approach, if I expose a WSDL which imports a XSD with a DOCTYPE
declaration, for instance:
> <?xml version="1.0" encoding="utf-8"?>
> <!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd">
> <!--
>    [...]
> -->
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" [...]>
> then, when invoking the CXFServlet to show this XSD I get the following exception:
> java.lang.NullPointerException
> 	at com.sun.xml.internal.stream.writers.UTF8OutputStreamWriter.write(UTF8OutputStreamWriter.java:127)
> 	at com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeDTD(XMLStreamWriterImpl.java:722)
> 	at org.apache.cxf.staxutils.StaxUtils.writeNode(StaxUtils.java:775)
> 	at org.apache.cxf.staxutils.StaxUtils.writeDocument(StaxUtils.java:600)
> 	at org.apache.cxf.staxutils.StaxUtils.writeDocument(StaxUtils.java:588)
> 	at org.apache.cxf.staxutils.StaxUtils.writeNode(StaxUtils.java:762)
> 	at org.apache.cxf.transport.http.WSDLQueryHandler.writeResponse(WSDLQueryHandler.java:230)
> 	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:162)
> 	at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
> 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
> 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
> 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
> 	at java.lang.Thread.run(Thread.java:619)
> This is because org.apache.cxf.staxutils.StaxUtils.writeNode(Node, XMLStreamWriter, boolean)
does the following for a Node of type DOCUMENT_TYPE_NODE:
>             try {
>                 writer.writeDTD(((DocumentType)n).getTextContent());
>             } catch (UnsupportedOperationException ex) {
>                 //can we ignore?  DOM writers really don't allow this
>                 //as there isn't a way to write a DTD in dom
>             }
> However, org.w3c.dom.Node.getTextContent() by contract returns NULL for a Node of type
DOCUMENT_TYPE_NODE. This causes the NPE.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message