[ https://issues.apache.org/jira/browse/CXF-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12894061#action_12894061 ]
Glen Mazza commented on CXF-2919: --------------------------------- Why is this "critical"--it seems oxymoronic for a XML Schema to contain a DTD declaration. (Are they even permitted to have them?) What do you propose as a solution--are you just asking for a wrapping of the NPE (reasonable enough) or for CXF to somehow handle DTD's within XML Schemas? (Are there specifications for that? -- I don't know.) > 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.