Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 29804 invoked from network); 12 Nov 2009 22:43:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Nov 2009 22:43:30 -0000 Received: (qmail 64536 invoked by uid 500); 12 Nov 2009 22:43:30 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 64460 invoked by uid 500); 12 Nov 2009 22:43:29 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 64451 invoked by uid 99); 12 Nov 2009 22:43:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Nov 2009 22:43:29 +0000 X-ASF-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Nov 2009 22:43:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0103E238899B; Thu, 12 Nov 2009 22:43:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r835615 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java Date: Thu, 12 Nov 2009 22:43:06 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091112224307.0103E238899B@eris.apache.org> Author: dkulp Date: Thu Nov 12 22:43:06 2009 New Revision: 835615 URL: http://svn.apache.org/viewvc?rev=835615&view=rev Log: Add some NPE checks Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=835615&r1=835614&r2=835615&view=diff ============================================================================== --- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original) +++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Thu Nov 12 22:43:06 2009 @@ -743,7 +743,9 @@ } public static Document read(XMLStreamReader reader, boolean recordLoc) throws XMLStreamException { Document doc = DOMUtils.createDocument(); - doc.setDocumentURI(new String(reader.getLocation().getSystemId())); + if (reader.getLocation().getSystemId() != null) { + doc.setDocumentURI(new String(reader.getLocation().getSystemId())); + } readDocElements(doc, doc, reader, true, recordLoc); return doc; } @@ -751,7 +753,9 @@ public static Document read(DocumentBuilder builder, XMLStreamReader reader, boolean repairing) throws XMLStreamException { Document doc = builder.newDocument(); - doc.setDocumentURI(new String(reader.getLocation().getSystemId())); + if (reader.getLocation().getSystemId() != null) { + doc.setDocumentURI(new String(reader.getLocation().getSystemId())); + } readDocElements(doc, reader, repairing); return doc; } @@ -944,16 +948,18 @@ node.setAttributeNodeNS(attr); } public static XMLStreamReader createXMLStreamReader(InputSource src) { + String sysId = src.getSystemId() == null ? null : new String(src.getSystemId()); + String pubId = src.getPublicId() == null ? null : new String(src.getPublicId()); if (src.getByteStream() != null) { if (src.getEncoding() == null) { - StreamSource ss = new StreamSource(src.getByteStream(), src.getSystemId()); - ss.setPublicId(src.getPublicId()); + StreamSource ss = new StreamSource(src.getByteStream(), sysId); + ss.setPublicId(pubId); return createXMLStreamReader(ss); } return createXMLStreamReader(src.getByteStream(), src.getEncoding()); } else if (src.getCharacterStream() != null) { - StreamSource ss = new StreamSource(src.getCharacterStream(), src.getSystemId()); - ss.setPublicId(src.getPublicId()); + StreamSource ss = new StreamSource(src.getCharacterStream(), sysId); + ss.setPublicId(pubId); return createXMLStreamReader(ss); } throw new IllegalArgumentException("InputSource must have a ByteStream or CharacterStream"); Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java?rev=835615&r1=835614&r2=835615&view=diff ============================================================================== --- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java (original) +++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java Thu Nov 12 22:43:06 2009 @@ -222,7 +222,9 @@ Document doc; try { doc = StaxUtils.read(StaxUtils.createXMLStreamReader(src), true); - doc.setDocumentURI(new String(src.getSystemId())); + if (src.getSystemId() != null) { + doc.setDocumentURI(new String(src.getSystemId())); + } } catch (Exception e) { throw new WSDLException(WSDLException.PARSER_ERROR, e.getMessage(), e); }