xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java
 |   31 +++-------
 1 file changed, 12 insertions(+), 19 deletions(-)

New commits:
commit c900c820a054ff0e8cb45cc7064716f3e53432b8
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Mar 1 10:13:07 2016 +0000

    coverity#1326460 Dereference null return value
    
    Change-Id: I15e41410064ad6957237e8e79fceb48e152681af

diff --git 
a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java
 
b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java
index acc4d8e..aaa6904 100644
--- 
a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java
+++ 
b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java
@@ -73,33 +73,26 @@ public class ConverterInfoReader {
         ParserConfigurationException, org.xml.sax.SAXException,
         RegistryException  {
 
-        InputStream            istream;
-        InputSource            isource;
-        DocumentBuilderFactory builderFactory;
-        DocumentBuilder        builder;
-        JarURLConnection       jarConnection;
-        JarEntry               jarentry;
-        JarFile                jarfile;
-        URL                    url;
-
         converterInfoList = new ArrayList<ConverterInfo>();
         jarfilename       = jar;
 
         // Get Jar via URL
+        URL url           = new URL("jar:" + jar + "!/META-INF/converter.xml");
+        JarURLConnection jarConnection = 
(JarURLConnection)url.openConnection();
+        JarEntry jarentry = jarConnection.getJarEntry();
+        JarFile jarfile   = jarConnection.getJarFile();
 
-        url               = new URL("jar:" + jar + "!/META-INF/converter.xml");
-        jarConnection     = (JarURLConnection)url.openConnection();
-        jarentry          = jarConnection.getJarEntry();
-        jarfile           = jarConnection.getJarFile();
+        if (jarfile == null) {
+            throw new IOException("Missing jar file");
+        }
 
         // Build the InputSource
-
-        istream           = jarfile.getInputStream(jarentry);
-        isource           = new InputSource(istream);
+        InputStream istream = jarfile.getInputStream(jarentry);
+        InputSource isource = new InputSource(istream);
 
         // Get the DOM builder and build the document.
 
-        builderFactory    = DocumentBuilderFactory.newInstance();
+        DocumentBuilderFactory builderFactory = 
DocumentBuilderFactory.newInstance();
 
         //DTD validation
 
@@ -108,7 +101,7 @@ public class ConverterInfoReader {
             builderFactory.setValidating(true);
         }
 
-        builder = builderFactory.newDocumentBuilder();
+        DocumentBuilder builder = builderFactory.newDocumentBuilder();
         document = builder.parse(isource);
 
         // Parse the document.
@@ -249,4 +242,4 @@ public class ConverterInfoReader {
     public Iterator<ConverterInfo> getConverterInfoEnumeration() {
        return converterInfoList.iterator();
     }
-}
\ No newline at end of file
+}
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to