diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-02-16 09:32:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-02-16 09:50:16 +0000 |
commit | 7e6696672c416453f1daf796fef1890603c14b17 (patch) | |
tree | ce3fd5b6635b4cb985867caa64de9ce55ca540d0 /xmerge | |
parent | 90acf2bd3b7726d87e9b054fdcb13204da0e1efa (diff) |
coverity#1326280 Explicit null dereferenced
Change-Id: I68b88accb5518292af0b3c3418609c93371bf9cf
Diffstat (limited to 'xmerge')
-rw-r--r-- | xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java index a7b54636cc86..72b65453029b 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java @@ -88,17 +88,19 @@ public final class DocumentDeserializerImpl while (enumerate.hasNext()) { docOut = (DOMDocument) enumerate.next(); } - try { - domDoc = docOut.getContentDOM(); - baos = transform(domDoc); - sxwDoc.initContentDOM(); - DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); - dFactory.setNamespaceAware(true); - DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); - sxwDoc.setContentDOM(dBuilder.parse(new ByteArrayInputStream(baos.toByteArray()))); - - } catch (Exception e) { - System.out.println("The following error occurred:" + e); + if (docOut != null) { + try { + domDoc = docOut.getContentDOM(); + baos = transform(domDoc); + sxwDoc.initContentDOM(); + DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); + dFactory.setNamespaceAware(true); + DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); + sxwDoc.setContentDOM(dBuilder.parse(new ByteArrayInputStream(baos.toByteArray()))); + + } catch (Exception e) { + System.out.println("The following error occurred:" + e); + } } return sxwDoc; } |