[Libreoffice-commits] core.git: 13 commits - javaunohelper/com qadevOOo/runner reportbuilder/java scripting/java wizards/com xmerge/source

Caolán McNamara caolanm at redhat.com
Thu Feb 4 15:47:35 UTC 2016


 javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java                                   |   12 ++--
 qadevOOo/runner/helper/APIDescGetter.java                                                    |   15 +++--
 qadevOOo/runner/helper/OfficeProvider.java                                                   |    3 -
 qadevOOo/runner/util/utils.java                                                              |   21 +------
 reportbuilder/java/org/libreoffice/report/pentaho/output/OfficeDocumentReportTarget.java     |    4 +
 scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java         |    4 +
 wizards/com/sun/star/wizards/common/Desktop.java                                             |   28 +++-------
 wizards/com/sun/star/wizards/document/OfficeDocument.java                                    |    2 
 xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java |   10 ++-
 9 files changed, 48 insertions(+), 51 deletions(-)

New commits:
commit 1fc4cb57755cdfb9ab65c112435997874fb057cd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:45:06 2016 +0000

    coverity#1326404 Dereference null return value
    
    Change-Id: I1e7605b20716a48bc7a65e76f43fa0061e0d8176

diff --git a/qadevOOo/runner/helper/OfficeProvider.java b/qadevOOo/runner/helper/OfficeProvider.java
index 62ac34f..26d0528 100644
--- a/qadevOOo/runner/helper/OfficeProvider.java
+++ b/qadevOOo/runner/helper/OfficeProvider.java
@@ -744,7 +744,8 @@ public class OfficeProvider implements AppProvider
         if(f.isDirectory())
         {
             File files[] = f.listFiles();
-            for(int i = 0; i < files.length; i++)
+            int filesLength = files != null ? files.length : 0;
+            for(int i = 0; i < filesLength; ++i)
             {
                 deleteFilesAndDirector(files[i]);
             }
commit ef2061233d2948e5cdc970277adec2159aae88f8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:43:38 2016 +0000

    coverity#1326401 Dereference null return value
    
    Change-Id: I7d19233bb0f63f55c87d83e50b7f865f5c7a8ea4

diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java
index 62b3ea6..b19d1f3 100644
--- a/wizards/com/sun/star/wizards/common/Desktop.java
+++ b/wizards/com/sun/star/wizards/common/Desktop.java
@@ -82,33 +82,25 @@ public class Desktop
         return null;
     }
 
-    private static com.sun.star.util.URL getDispatchURL(XMultiServiceFactory xMSF, String _sURL)
+    private static com.sun.star.util.URL getDispatchURL(XMultiServiceFactory xMSF, String _sURL) throws com.sun.star.uno.Exception
     {
-        try
-        {
-            Object oTransformer = xMSF.createInstance("com.sun.star.util.URLTransformer");
-            XURLTransformer xTransformer = UnoRuntime.queryInterface(XURLTransformer.class, oTransformer);
-            com.sun.star.util.URL[] oURL = new com.sun.star.util.URL[1];
-            oURL[0] = new com.sun.star.util.URL();
-            oURL[0].Complete = _sURL;
-            xTransformer.parseStrict(oURL);
-            return oURL[0];
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace(System.err);
-        }
-        return null;
+        Object oTransformer = xMSF.createInstance("com.sun.star.util.URLTransformer");
+        XURLTransformer xTransformer = UnoRuntime.queryInterface(XURLTransformer.class, oTransformer);
+        com.sun.star.util.URL[] oURL = new com.sun.star.util.URL[1];
+        oURL[0] = new com.sun.star.util.URL();
+        oURL[0].Complete = _sURL;
+        xTransformer.parseStrict(oURL);
+        return oURL[0];
     }
 
-    private static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame, String _stargetframe)
+    private static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame, String _stargetframe) throws com.sun.star.uno.Exception
     {
         com.sun.star.util.URL oURL = getDispatchURL(xMSF, sURL);
         XDispatch xDispatch = getDispatcher(xFrame, _stargetframe, oURL);
         dispatchURL(xDispatch, oURL);
     }
 
-    public static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame)
+    public static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame) throws com.sun.star.uno.Exception
     {
         dispatchURL(xMSF, sURL, xFrame, PropertyNames.EMPTY_STRING);
     }
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java
index 8a85e68..965e640 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.java
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java
@@ -66,7 +66,7 @@ public class OfficeDocument
                 Desktop.dispatchURL(xMSF, ".uno:CloseDoc", xFrame);
             }
         }
-        catch (PropertyVetoException exception)
+        catch (Exception exception)
         {
             exception.printStackTrace(System.err);
         }
commit 72f0f535d322850bc1b8d44dd1dc71ebe313470b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:39:46 2016 +0000

    coverity#1326400 Dereference null return value
    
    Change-Id: Ie28d817d7be24b2de19f51e11786c0396a2e016f

diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java
index 3279958..38f704c 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java
@@ -896,9 +896,9 @@ XMultiPropertySet
                     lc= aVetoableLC.getContainer(arEvts[i].PropertyName);
                 else
                     lc= aBoundLC.getContainer(arEvts[i].PropertyName);
-                if (lc != null)
+                Iterator it = lc != null ? lc.iterator() : null;
+                if (it != null)
                 {
-                    Iterator it= lc.iterator();
                     while( it.hasNext())
                     {
                         Object listener= it.next();
@@ -913,9 +913,9 @@ XMultiPropertySet
                     lc= listenerContainer.getContainer(XVetoableChangeListener.class);
                 else
                     lc= listenerContainer.getContainer(XPropertyChangeListener.class);
-                if(lc != null)
+                it = lc != null ? lc.iterator() : null;
+                if (it != null)
                 {
-                    Iterator it= lc.iterator();
                     while(it.hasNext() )
                     {
                         Object listener= it.next();
@@ -934,9 +934,9 @@ XMultiPropertySet
                 PropertyChangeEvent[] arReduced= new PropertyChangeEvent[nAffectedProps];
                 System.arraycopy(arEvts, 0, arReduced, 0, nAffectedProps);
                 InterfaceContainer lc= listenerContainer.getContainer(XPropertiesChangeListener.class);
-                if (lc != null)
+                Iterator it = lc != null ? lc.iterator() : null;
+                if (it != null)
                 {
-                    Iterator it= lc.iterator();
                     while (it.hasNext())
                     {
                         XPropertiesChangeListener listener = (XPropertiesChangeListener) it.next();
commit 1cf6890ac8e7fb97af6509b4dbcaf5776833154e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:30:15 2016 +0000

    coverity#1326406 Dereference null return value
    
    Change-Id: Ifedb32769551949fdda7d203812b803353a3f487

diff --git a/qadevOOo/runner/helper/APIDescGetter.java b/qadevOOo/runner/helper/APIDescGetter.java
index 68f6430..d7a6728 100644
--- a/qadevOOo/runner/helper/APIDescGetter.java
+++ b/qadevOOo/runner/helper/APIDescGetter.java
@@ -628,7 +628,7 @@ public class APIDescGetter extends DescGetter
 
         DescEntry[] subEntries = getSubEntries(csvFile, theEntry);
 
-        theEntry.SubEntryCount = subEntries.length;
+        theEntry.SubEntryCount = subEntries != null ? subEntries.length : 0;
         theEntry.SubEntries = subEntries;
 
         return theEntry;
commit 569522be6296aa21e4ccd459343ebb5fffd60a13
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:29:33 2016 +0000

    coverity#1326407 Dereference null return value
    
    Change-Id: Ie9336625f9f5733f9da96b8e7f1aa95228922a8a

diff --git a/qadevOOo/runner/helper/APIDescGetter.java b/qadevOOo/runner/helper/APIDescGetter.java
index 60d7330..68f6430 100644
--- a/qadevOOo/runner/helper/APIDescGetter.java
+++ b/qadevOOo/runner/helper/APIDescGetter.java
@@ -715,7 +715,7 @@ public class APIDescGetter extends DescGetter
 
         DescEntry[] subEntries = getSubEntries(csvFile, aEntry);
 
-        aEntry.SubEntryCount = subEntries.length;
+        aEntry.SubEntryCount = subEntries != null ? subEntries.length : 0;
         aEntry.SubEntries = subEntries;
 
         return aEntry;
commit 1359b5635c4531495d2ed82b1385de99a3c1a864
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:28:32 2016 +0000

    coverity#1326425 Dereference null return value
    
    Change-Id: I3fda64e652310463e5a634341713562830babb87

diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java
index 4c573a7..501059f 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java
@@ -498,7 +498,7 @@ public abstract class SxcDocumentSerializer implements OfficeConstants,
                                 SxcConstants.COLUMN_STYLE_FAMILY, null,
                                 ColumnStyle.class);
 
-            columnWidth = cStyle.getColWidth();
+            columnWidth = cStyle != null ? cStyle.getColWidth() : 0;
             col.setSize(columnWidth);
             Debug.log(Debug.TRACE, "traverseColumn() Column Width : " + columnWidth);
 
commit 4ed467ccc8f69c056a380f9b07ad8871e11f7d37
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:27:51 2016 +0000

    coverity#1326426 Dereference null return value
    
    Change-Id: I8ac0a0df5e111b72db181ee1b8043e6f65fbaf25

diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java
index 2604bf7..4c573a7 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java
@@ -537,16 +537,20 @@ public abstract class SxcDocumentSerializer implements OfficeConstants,
             styleName = tableStyleNode.getNodeValue();
         }
 
+        CellStyle cStyle = null;
+
         if(styleName.equalsIgnoreCase("Default")) {
 
             Debug.log(Debug.TRACE, "No defined Style Attribute was found");
 
         } else if(styleName.length()!=0) {
 
-            CellStyle cStyle = (CellStyle)styleCat.lookup(styleName,
+            cStyle = (CellStyle)styleCat.lookup(styleName,
                                 SxcConstants.TABLE_CELL_STYLE_FAMILY, null,
                                 CellStyle.class);
+        }
 
+        if (cStyle != null) {
             Format definedFormat = cStyle.getFormat();
             fmt = new Format(definedFormat);
         }
commit 28fc15b3d35561bd2ed55526691c92689d9227dc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:25:57 2016 +0000

    coverity#1326427 Dereference null return value
    
    Change-Id: Id4ff5ab007e9ddbc28018570fe38abe9e5acb54b

diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java
index 5f02557..2604bf7 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java
@@ -366,7 +366,7 @@ public abstract class SxcDocumentSerializer implements OfficeConstants,
                                         SxcConstants.ROW_STYLE_FAMILY, null,
                                         RowStyle.class);
 
-                int rowHeight = rStyle.getRowHeight();
+                int rowHeight = rStyle != null ? rStyle.getRowHeight() : 0;
 
                 Debug.log(Debug.TRACE, "traverseTableRow() Row Height : " + rowHeight);
                 ColumnRowInfo ri = new ColumnRowInfo(   rowHeight,
commit 84db01965ef701c829d54d278663f7cf8d670cba
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:24:38 2016 +0000

    coverity#1326216 Explicit null dereferenced
    
    Change-Id: I1c65e776580b03a658c61c3c680f63d5c35fa52a

diff --git a/qadevOOo/runner/helper/APIDescGetter.java b/qadevOOo/runner/helper/APIDescGetter.java
index 217e241..60d7330 100644
--- a/qadevOOo/runner/helper/APIDescGetter.java
+++ b/qadevOOo/runner/helper/APIDescGetter.java
@@ -802,7 +802,9 @@ public class APIDescGetter extends DescGetter
             }
         }
 
-        for (int i = 0; i < modules.length; i++)
+        int moduleLength = modules != null ? modules.length : 0;
+
+        for (int i = 0; i < moduleLength; ++i)
         {
             if (!isUnusedModule(modules[i]))
             {
commit 04fa668d1020622969f99f817ccc4aa39d92577c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:23:23 2016 +0000

    coverity#1326217 Explicit null dereferenced
    
    Change-Id: Id1c35c5022eddfd1d7bca88c4833a0cba01b9cfa

diff --git a/qadevOOo/runner/helper/APIDescGetter.java b/qadevOOo/runner/helper/APIDescGetter.java
index 0320fb5..217e241 100644
--- a/qadevOOo/runner/helper/APIDescGetter.java
+++ b/qadevOOo/runner/helper/APIDescGetter.java
@@ -361,11 +361,14 @@ public class APIDescGetter extends DescGetter
             {
                 parent.hasErrorMsg = true;
                 parent.ErrorMsg = "IOException while reading the description";
-
-                return null;
+                break;
             }
         }
 
+        if (ifcDesc == null) {
+            return null;
+        }
+
         ifcDesc.SubEntries = getDescArray(meth_names.toArray());
         ifcDesc.SubEntryCount = meth_names.size();
 
commit bf4ee8ee31cbaea1360eb5681d4cecd04844eb3a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:08:49 2016 +0000

    coverity#1326386 Dereference null return value
    
    Change-Id: Ifd1cd2cfb6032e7a2d14d926d4de8be22160daee

diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/output/OfficeDocumentReportTarget.java b/reportbuilder/java/org/libreoffice/report/pentaho/output/OfficeDocumentReportTarget.java
index e629d43..3f23ab3 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/output/OfficeDocumentReportTarget.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/output/OfficeDocumentReportTarget.java
@@ -1254,6 +1254,10 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
 
         final LexicalUnit cssValue = styleSheetParserUtil.parseLexicalStyleValue(
                 text);
+        if (cssValue == null) {
+            CSSNumericValue zeroLength = CSSNumericValue.createValue(CSSNumericType.CM, 0);
+            return zeroLength;
+        }
         return CSSValueFactory.createLengthValue(cssValue);
     }
 
commit b3e0bd62f5c2223101ee693e042c8c400528803f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 11:05:05 2016 +0000

    coverity#1326399 Dereference null return value
    
    Change-Id: I7828cdfcda5d4065fc3dafee744757292753abb5

diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java
index 89ef8c9..34aac4c 100644
--- a/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java
+++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java
@@ -71,7 +71,9 @@ public class PlainSourceView extends JScrollPane implements
         try {
             int line = ta.getLineStartOffset(model.getCurrentPosition());
             Rectangle rect = ta.modelToView(line);
-            ta.scrollRectToVisible(rect);
+            if (rect != null) {
+                ta.scrollRectToVisible(rect);
+            }
         } catch (BadLocationException e) {
             // couldn't scroll to line, do nothing
         }
commit 1a84fb8f92ea941214fc9d3a6773aabcfca865e2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 4 10:55:38 2016 +0000

    coverity#1326388 Dereference null return value
    
    Change-Id: I08955a20e0566f56701bef85a4a9d4de79ca7b1f

diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java
index 8582f5f..4788e3e 100644
--- a/qadevOOo/runner/util/utils.java
+++ b/qadevOOo/runner/util/utils.java
@@ -193,10 +193,6 @@ public class utils {
         return fulldocURL;
     }
 
-
-
-
-
     /**
      *
      * This method get's the user dir of the connected office
@@ -229,22 +225,15 @@ public class utils {
      * @return the value as String
      */
     private static String getOfficeSettingsValue(XMultiServiceFactory msf, String setting) {
-
-        String settingPath = null;
         try {
             Object settings = msf.createInstance("com.sun.star.comp.framework.PathSettings");
-            try {
-                XPropertySet pthSettings = (XPropertySet) AnyConverter.toObject(
-                    new Type(XPropertySet.class), settings);
-                settingPath = (String) pthSettings.getPropertyValue(setting);
-            } catch (com.sun.star.lang.IllegalArgumentException iae) {
-                System.out.println("### couldn't get Office Settings");
-            }
-        } catch (Exception e) {
-            System.out.println("Couldn't get string value for " + setting);
+            XPropertySet pthSettings = (XPropertySet) AnyConverter.toObject(
+                new Type(XPropertySet.class), settings);
+            return (String) pthSettings.getPropertyValue(setting);
+        } catch (com.sun.star.uno.Exception e) {
             e.printStackTrace();
+            throw new RuntimeException(e);
         }
-        return settingPath;
     }
 
     /**


More information about the Libreoffice-commits mailing list