[Libreoffice-commits] core.git: 6 commits - bean/com wizards/com xmerge/source
Caolán McNamara
caolanm at redhat.com
Fri Mar 4 11:24:51 UTC 2016
bean/com/sun/star/comp/beans/LocalOfficeWindow.java | 2 -
wizards/com/sun/star/wizards/document/GridControl.java | 5 ++
xmerge/source/bridge/java/XMergeBridge.java | 19 +++++++---
xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentDeserializer.java | 7 +++
xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java | 14 ++++---
xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java | 4 +-
6 files changed, 37 insertions(+), 14 deletions(-)
New commits:
commit 0b9ceae7da92709637c4ee65b62901b346209d16
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 4 10:20:02 2016 +0000
coverity#1326474 Resource leak on an exceptional path
Change-Id: I13047e59fc10ab169072f84c75ba88c569d16bd6
diff --git a/xmerge/source/bridge/java/XMergeBridge.java b/xmerge/source/bridge/java/XMergeBridge.java
index bbe3e2a..0f04483 100644
--- a/xmerge/source/bridge/java/XMergeBridge.java
+++ b/xmerge/source/bridge/java/XMergeBridge.java
@@ -364,6 +364,11 @@ public class XMergeBridge {
}
+ private static void close(FileOutputStream c) throws IOException {
+ if (c == null) return;
+ c.close();
+ }
+
private void convert (com.sun.star.io.XInputStream xml,com.sun.star.io.XOutputStream device,
boolean convertFromOffice,String pluginUrl,String FileName,String offMime,String sdMime) throws com.sun.star.uno.RuntimeException, IOException {
@@ -436,11 +441,15 @@ public class XMergeBridge {
newFile =new File(newFileName.concat(String.valueOf(i)));
}
- FileOutputStream fos = new FileOutputStream(newFile);
- docOut = (Document)docEnum.next();
- docOut.write(fos);
- fos.flush();
- fos.close();
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(newFile);
+ docOut = (Document)docEnum.next();
+ docOut.write(fos);
+ fos.flush();
+ } finally {
+ close(fos);
+ }
i++;
}
commit 1e83fab9b47dc34129035ca1660a27c6a00b15d9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 4 10:13:12 2016 +0000
coverity#1326516 Resource leak on an exceptional path
Change-Id: I91cc5614fb0db76eabd46cbe7e39ae33227728b7
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java
index 9d3ae7c..506b754 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java
@@ -184,12 +184,16 @@ public final class Driver {
Document convertedFile = (Document)mergeDocEnum.next();
merger.merge(convertedFile);
- mergeIS.close();
+ mergeIS.close();
- FileOutputStream fos = new FileOutputStream(mergeFile);
- mergeDoc.write(fos);
- fos.flush();
- fos.close();
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(mergeFile);
+ mergeDoc.write(fos);
+ fos.flush();
+ } finally {
+ close(fos);
+ }
} catch (Exception mergeExcept) {
System.out.println("\nThere was an error in the merge");
mergeExcept.printStackTrace();
commit b08e200c3dfa964f257c8b7719ef9c801fb107d7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 4 10:08:35 2016 +0000
coverity#1326237 Dereference after null check
Change-Id: Iac84adff096c5b847b2a63ac57ddf5b2f5e34e11
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentDeserializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentDeserializer.java
index bfd7fb3..1523b908 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentDeserializer.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentDeserializer.java
@@ -490,11 +490,16 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants,
Debug.log(Debug.TRACE, "<tr>");
}
+ if (rowElement == null) {
+ //utterly busted
+ break;
+ }
+
// Get the column number of the current cell
int newCol = decoder.getColNumber();
// Check to see if some columns were skipped
- if (newCol != col && rowElement != null) {
+ if (newCol != col) {
// How many columns have we skipped?
int numColsSkipped = newCol - col;
commit 5adfcaaadc45b38ed0358a3dde4c39d79b6ceedc
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 4 09:53:13 2016 +0000
coverity#1326304 Explicit null dereferenced
Change-Id: I9eb58884e41d9669d2413f7b5b63bddf6a4b4320
diff --git a/wizards/com/sun/star/wizards/document/GridControl.java b/wizards/com/sun/star/wizards/document/GridControl.java
index cca5de9..3813708 100644
--- a/wizards/com/sun/star/wizards/document/GridControl.java
+++ b/wizards/com/sun/star/wizards/document/GridControl.java
@@ -57,6 +57,11 @@ public class GridControl extends Shape
"Error: GridModel does not export XControlModel interface");
}
+ if (xControlShape == null) {
+ throw new Exception(
+ "Error: GridModel does not have a XControlShape");
+ }
+
xControlShape.setControl(xControlModel);
xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, oGridModel );
oFormHandler.xDrawPage.add(xShape);
commit 8a1c6cba0a7cd579274826f1831934f67d957fe4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 4 09:35:51 2016 +0000
coverity#1326460 Dereference null return value
Change-Id: I18a80d7695f081c6f274dd7de68bd4dee1054be4
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 aaa6904..21831a6 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
@@ -82,8 +82,8 @@ public class ConverterInfoReader {
JarEntry jarentry = jarConnection.getJarEntry();
JarFile jarfile = jarConnection.getJarFile();
- if (jarfile == null) {
- throw new IOException("Missing jar file");
+ if (jarfile == null || jarentry == null) {
+ throw new IOException("Missing jar entry");
}
// Build the InputSource
commit 1ffa92cfe374b1f479166300bc7e27e41ad48acd
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 4 09:32:53 2016 +0000
coverity#1326333 Unguarded write
Change-Id: I94026a7b66a0cac01a1e42d8eee0ec7b4d5fc513
diff --git a/bean/com/sun/star/comp/beans/LocalOfficeWindow.java b/bean/com/sun/star/comp/beans/LocalOfficeWindow.java
index e7e4b94..0f5d9bf 100644
--- a/bean/com/sun/star/comp/beans/LocalOfficeWindow.java
+++ b/bean/com/sun/star/comp/beans/LocalOfficeWindow.java
@@ -81,7 +81,7 @@ public class LocalOfficeWindow
*
* @param source The event object.
*/
- public void disposing(EventObject source)
+ public synchronized void disposing(EventObject source)
{
// the window will be disposed by the framework
mWindow = null;
More information about the Libreoffice-commits
mailing list