summaryrefslogtreecommitdiff
path: root/xmerge
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-03-01 10:13:07 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-03-01 10:13:07 +0000
commitc900c820a054ff0e8cb45cc7064716f3e53432b8 (patch)
tree4cd7ebac325ee27daf898c0340de20adde550e16 /xmerge
parent1fb6a3aa87f6f68194246f8de0d62796a98ddce2 (diff)
coverity#1326460 Dereference null return value
Change-Id: I15e41410064ad6957237e8e79fceb48e152681af
Diffstat (limited to 'xmerge')
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java31
1 files changed, 12 insertions, 19 deletions
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 acc4d8eabc6e..aaa690412f45 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
+}