[Libreoffice-commits] core.git: xmerge/source
rbuj
robert.buj at gmail.com
Sat Aug 2 04:36:37 PDT 2014
xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java | 20 ++--------
xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java | 15 ++++---
2 files changed, 12 insertions(+), 23 deletions(-)
New commits:
commit de024170a51b993109f27469ae869fc67548fc63
Author: rbuj <robert.buj at gmail.com>
Date: Sat Aug 2 11:04:48 2014 +0200
xmerge: Avoid a possible null pointer exception
Change-Id: Ib6ce07aef1ae27f4e5db376667617432de9f41ef
Reviewed-on: https://gerrit.libreoffice.org/10686
Reviewed-by: David Tardon <dtardon at redhat.com>
Tested-by: David Tardon <dtardon at redhat.com>
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 f91658b..3cb8034 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 a06dca7..7c543f1 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);
More information about the Libreoffice-commits
mailing list