[Libreoffice-commits] core.git: 6 commits - nlpsolver/src qadevOOo/tests reportbuilder/java vcl/source

Caolán McNamara caolanm at redhat.com
Thu Jan 21 07:16:21 PST 2016


 nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java                             |   20 ++----
 qadevOOo/tests/java/ifc/configuration/backend/_XBackend.java                                       |   32 ++++------
 qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java                                              |    9 --
 reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java                               |    4 -
 reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java |   12 +++
 vcl/source/window/menu.cxx                                                                         |   12 ++-
 6 files changed, 45 insertions(+), 44 deletions(-)

New commits:
commit 08680c58de1271ce42a72ce4105e5a3337d0498c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 21 14:47:53 2016 +0000

    coverity#1326438 Dereference null return value
    
    and
    
    coverity#1326439 Dereference null return value
    
    Change-Id: Idf7e6f34accfb5d5b98a62f6ad221c325e24586a

diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java
index 8933adf..5f8b91c 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java
@@ -109,6 +109,12 @@ public class OfficeGroupLayoutController extends SectionLayoutController
 
             final OfficeGroup group = (OfficeGroup) getElement();
             final OfficeGroupSection header = group.getHeader();
+
+            if (header == null)
+            {
+                return controller;
+            }
+
             controller.waitForJoin = true;
             return processChild(controller, header, getFlowController());
         }
@@ -127,6 +133,12 @@ public class OfficeGroupLayoutController extends SectionLayoutController
 
             final OfficeGroup group = (OfficeGroup) getElement();
             final OfficeGroupSection footer = group.getFooter();
+
+            if (footer == null)
+            {
+                return controller;
+            }
+
             controller.waitForJoin = true;
             return processChild(controller, footer, getFlowController());
         }
commit 524c99524f15672d402be8cf14a6c8393ad71b54
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 21 14:39:59 2016 +0000

    coverity#1326447 Dereference null return value
    
    Change-Id: I76f81e86cdeb33ec99f4aade314bbb719a0b1ef4

diff --git a/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java b/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java
index cd41f19..c8e1560 100644
--- a/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java
+++ b/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java
@@ -94,19 +94,14 @@ public class MutableTreeNode extends TestCase {
         return tEnv;
     } // finish method getTestEnvironment
 
-    private void fillNode( XMutableTreeNode xNode ){
+    private void fillNode( XMutableTreeNode xNode ) throws com.sun.star.uno.Exception {
 
         if( xNode.getChildCount() == 0 )
         {
             xNode.getDataValue();
 
             String officeUserPath = utils.getOfficeUserPath(mxMSF);
-            Object fileacc = null;
-            try {
-                fileacc = mxMSF.createInstance("com.sun.star.comp.ucb.SimpleFileAccess");
-            } catch (com.sun.star.uno.Exception ex) {
-                ex.printStackTrace();
-            }
+            Object fileacc = mxMSF.createInstance("com.sun.star.comp.ucb.SimpleFileAccess");
             UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc);
 
 
commit 4d95bd62613344de9cba32e09c37fe60d6383dc4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 21 14:37:23 2016 +0000

    coverity#1326449 Dereference null return value
    
    and
    
    coverity#1326448 Dereference null return value
    
    Change-Id: I8e26c9c57264b654a5a7c3dc56c658f23291e357

diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java
index 36fdd4d..d10ad34 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java
@@ -71,20 +71,16 @@ public abstract class BaseDialog extends BaseControl {
         return xMSF;
     }
 
-    private XFrame getCurrentFrame() {
-        try {
-            Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", context);
-            XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, oDesktop);
-            XComponent xComponent = xDesktop.getCurrentComponent();
-            XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent);
-            XController xController = xModel.getCurrentController();
-            return xController.getFrame();
-        } catch (Exception e) {
-            return null;
-        }
+    private XFrame getCurrentFrame() throws Exception {
+        Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", context);
+        XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, oDesktop);
+        XComponent xComponent = xDesktop.getCurrentComponent();
+        XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent);
+        XController xController = xModel.getCurrentController();
+        return xController.getFrame();
     }
 
-    private Rectangle getWorkspaceDimensions() {
+    private Rectangle getWorkspaceDimensions() throws Exception {
         return getCurrentFrame().getComponentWindow().getPosSize();
     }
 
commit 683d193327b49971098517758d6d3f79c5d94a4f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 21 14:34:46 2016 +0000

    coverity#1326456 Dereference null return value
    
    and
    
    coverity#1326455 Dereference null return value
    
    Change-Id: I48f18483c82dafed6352434e98d5b49120fdcfc5

diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XBackend.java b/qadevOOo/tests/java/ifc/configuration/backend/_XBackend.java
index c55c457..eb8a09c 100644
--- a/qadevOOo/tests/java/ifc/configuration/backend/_XBackend.java
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XBackend.java
@@ -118,6 +118,9 @@ public class _XBackend extends MultiMethodTest {
         } catch (com.sun.star.container.NoSuchElementException e) {
             log.println("unexpected Exception " + e + " -- FAILED");
             res = false;
+        } catch (com.sun.star.uno.Exception e) {
+            log.println("unexpected Exception " + e + " -- FAILED");
+            res = false;
         }
 
         tRes.tested("getUpdateHandler()", res);
@@ -127,8 +130,7 @@ public class _XBackend extends MultiMethodTest {
         boolean res = true;
 
         try {
-            XStringSubstitution sts = createStringSubstitution(
-                                              tParam.getMSF());
+            XStringSubstitution sts = createStringSubstitution(tParam.getMSF());
             String ent = sts.getSubstituteVariableValue("$(inst)") +
                          "/share/registry";
             XLayer[] Layers = oObj.listLayers(
@@ -147,6 +149,9 @@ public class _XBackend extends MultiMethodTest {
         } catch (com.sun.star.container.NoSuchElementException e) {
             log.println("unexpected Exception " + e + " -- FAILED");
             res = false;
+        } catch (com.sun.star.uno.Exception e) {
+            log.println("unexpected Exception " + e + " -- FAILED");
+            res = false;
         }
 
         tRes.tested("listLayers()", res);
@@ -236,21 +241,10 @@ public class _XBackend extends MultiMethodTest {
         return res;
     }
 
-    public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF) {
-        Object xPathSubst = null;
-
-        try {
-            xPathSubst = xMSF.createInstance(
-                                 "com.sun.star.util.PathSubstitution");
-        } catch (com.sun.star.uno.Exception e) {
-            e.printStackTrace();
-        }
-
-        if (xPathSubst != null) {
-            return UnoRuntime.queryInterface(
-                           XStringSubstitution.class, xPathSubst);
-        } else {
-            return null;
-        }
+    public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF) throws com.sun.star.uno.Exception
+    {
+        Object xPathSubst = xMSF.createInstance(
+                    "com.sun.star.util.PathSubstitution");
+        return UnoRuntime.queryInterface(XStringSubstitution.class, xPathSubst);
     }
-}
\ No newline at end of file
+}
commit 2043556e6c9ebe4bfaaa887309a3637493b63caf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 21 14:30:37 2016 +0000

    coverity#1326551 Dereference before null check
    
    Change-Id: I11a65723909b7ed78a487ece7456c0e5a4d1aa8b

diff --git a/reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java b/reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java
index 899e740..26eb495 100644
--- a/reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java
+++ b/reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java
@@ -94,7 +94,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
                 return false;
             }
             final RowSetProperties other = (RowSetProperties) obj;
-            if (this.escapeProcessing != other.escapeProcessing && (this.escapeProcessing == null || !this.escapeProcessing.equals(other.escapeProcessing)))
+            if ((this.escapeProcessing == null) ? (other.escapeProcessing != null) : !this.escapeProcessing.equals(other.escapeProcessing))
             {
                 return false;
             }
@@ -102,7 +102,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
             {
                 return false;
             }
-            if (this.maxRows != other.maxRows && (this.maxRows == null || !this.maxRows.equals(other.maxRows)))
+            if ((this.maxRows == null) ? (other.maxRows != null) : !this.maxRows.equals(other.maxRows))
             {
                 return false;
             }
commit 5f6e18f5475c8daa101aad22b9dea17c8b048389
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 21 14:15:06 2016 +0000

    coverity#1349758 rework to avoid bugus Dereference null warning
    
    Change-Id: Ia91b312449b5593a78b11337bd17f5d87903ff8d

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 01b4241..d14d1a3 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2514,12 +2514,16 @@ void MenuBar::ClosePopup(Menu *pMenu)
 void MenuBar::DeactivateMenuBar(VclPtr<vcl::Window>& xFocusId)
 {
     MenuBarWindow* pMenuWin = getMenuBarWindow();
-    xFocusId = pMenuWin ? pMenuWin->GetFocusId() : nullptr;
-    if (xFocusId != nullptr)
+    if (!pMenuWin)
     {
-        pMenuWin->SetFocusId(nullptr);
-        ImplGetSVData()->maWinData.mbNoDeactivate = false;
+        xFocusId = nullptr;
+        return;
     }
+    xFocusId = pMenuWin->GetFocusId();
+    if (xFocusId == nullptr)
+        return;
+    pMenuWin->SetFocusId(nullptr);
+    ImplGetSVData()->maWinData.mbNoDeactivate = false;
 }
 
 void MenuBar::MenuBarKeyInput(const KeyEvent& rEvent)


More information about the Libreoffice-commits mailing list