Kaydet (Commit) de024170 authored tarafından rbuj's avatar rbuj Kaydeden (comit) David Tardon

xmerge: Avoid a possible null pointer exception

Change-Id: Ib6ce07aef1ae27f4e5db376667617432de9f41ef
Reviewed-on: https://gerrit.libreoffice.org/10686Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 2479db76
...@@ -182,17 +182,11 @@ public class DOMDocument ...@@ -182,17 +182,11 @@ public class DOMDocument
*/ */
public void read(InputStream is) throws IOException { public void read(InputStream is) throws IOException {
Debug.log(Debug.INFO, "reading file"); Debug.log(Debug.INFO, "reading file");
DocumentBuilder builder = null;
try { try {
builder = factory.newDocumentBuilder(); DocumentBuilder builder = factory.newDocumentBuilder();
contentDoc = builder.parse(is);
} catch (ParserConfigurationException ex) { } catch (ParserConfigurationException ex) {
System.out.println("Error:"+ ex); System.out.println("Error:"+ ex);
}
try {
contentDoc= builder.parse(is);
} catch (SAXException ex) { } catch (SAXException ex) {
System.out.println("Error:"+ ex); System.out.println("Error:"+ ex);
} }
...@@ -371,20 +365,14 @@ public class DOMDocument ...@@ -371,20 +365,14 @@ public class DOMDocument
Document doc = null; Document doc = null;
try { try {
DocumentBuilder builder = factory.newDocumentBuilder(); DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.newDocument(); doc = builder.newDocument();
Element root = doc.createElement(rootName);
doc.appendChild(root);
} catch (ParserConfigurationException ex) { } catch (ParserConfigurationException ex) {
System.out.println("Error:"+ ex); System.out.println("Error:"+ ex);
} }
Element root = doc.createElement(rootName);
doc.appendChild(root);
return doc; return doc;
} }
......
...@@ -81,14 +81,15 @@ public class ActiveSyncDriver { ...@@ -81,14 +81,15 @@ public class ActiveSyncDriver {
* Because they can be installed separately, though, the MIME types need * Because they can be installed separately, though, the MIME types need
* to be check to see which one to load. * to be check to see which one to load.
*/ */
File pluginJar = null; File pluginJar;
if (srcMime.equals("staroffice/sxw") || srcMime.equals("application/x-pocket-word")) if (srcMime.equals("staroffice/sxw") || srcMime.equals("application/x-pocket-word")) {
{
pluginJar = new File(ooClassDir + "pocketWord.jar"); pluginJar = new File(ooClassDir + "pocketWord.jar");
} } else {
else if (srcMime.equals("staroffice/sxc") || srcMime.equals("application/x-pocket-excel")) if (srcMime.equals("staroffice/sxc") || srcMime.equals("application/x-pocket-excel")) {
{
pluginJar = new File(ooClassDir + "pexcel.jar"); pluginJar = new File(ooClassDir + "pexcel.jar");
} else {
return false;
}
} }
ConverterInfoReader cirPlugin = new ConverterInfoReader(pluginJar.toURI().toURL().toString(), false); ConverterInfoReader cirPlugin = new ConverterInfoReader(pluginJar.toURI().toURL().toString(), false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment