summaryrefslogtreecommitdiff
path: root/xmerge
diff options
context:
space:
mode:
authorrbuj <robert.buj@gmail.com>2014-08-02 11:04:48 +0200
committerDavid Tardon <dtardon@redhat.com>2014-08-02 11:36:15 +0000
commitde024170a51b993109f27469ae869fc67548fc63 (patch)
treed677a5edf1f3734d1fb6cafc99244c5900e7716a /xmerge
parent2479db76517cacb1b52ae07392b4b039f840aace (diff)
xmerge: Avoid a possible null pointer exception
Change-Id: Ib6ce07aef1ae27f4e5db376667617432de9f41ef Reviewed-on: https://gerrit.libreoffice.org/10686 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'xmerge')
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java20
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java15
2 files changed, 12 insertions, 23 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java
index f91658b65f08..3cb80341ac7e 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java
@@ -182,17 +182,11 @@ public class DOMDocument
*/
public void read(InputStream is) throws IOException {
Debug.log(Debug.INFO, "reading file");
- DocumentBuilder builder = null;
try {
- builder = factory.newDocumentBuilder();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ contentDoc = builder.parse(is);
} catch (ParserConfigurationException ex) {
System.out.println("Error:"+ ex);
- }
- try {
-
- contentDoc= builder.parse(is);
-
-
} catch (SAXException ex) {
System.out.println("Error:"+ ex);
}
@@ -371,20 +365,14 @@ public class DOMDocument
Document doc = null;
try {
-
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.newDocument();
-
+ Element root = doc.createElement(rootName);
+ doc.appendChild(root);
} catch (ParserConfigurationException ex) {
System.out.println("Error:"+ ex);
-
-
}
- Element root = doc.createElement(rootName);
- doc.appendChild(root);
-
-
return doc;
}
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java
index a06dca7b3cd7..7c543f19c1e5 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java
@@ -81,14 +81,15 @@ public class ActiveSyncDriver {
* Because they can be installed separately, though, the MIME types need
* to be check to see which one to load.
*/
- File pluginJar = null;
- if (srcMime.equals("staroffice/sxw") || srcMime.equals("application/x-pocket-word"))
- {
+ File pluginJar;
+ if (srcMime.equals("staroffice/sxw") || srcMime.equals("application/x-pocket-word")) {
pluginJar = new File(ooClassDir + "pocketWord.jar");
- }
- else if (srcMime.equals("staroffice/sxc") || srcMime.equals("application/x-pocket-excel"))
- {
- pluginJar = new File(ooClassDir + "pexcel.jar");
+ } else {
+ if (srcMime.equals("staroffice/sxc") || srcMime.equals("application/x-pocket-excel")) {
+ pluginJar = new File(ooClassDir + "pexcel.jar");
+ } else {
+ return false;
+ }
}
ConverterInfoReader cirPlugin = new ConverterInfoReader(pluginJar.toURI().toURL().toString(), false);