[Libreoffice-commits] core.git: 5 commits - scripting/java sc/source xmerge/source

Caolán McNamara caolanm at redhat.com
Tue Feb 16 09:50:45 UTC 2016


 sc/source/ui/vba/vbaformat.cxx                                                                   |    6 +-
 sc/source/ui/vba/vbaformat.hxx                                                                   |    6 +-
 sc/source/ui/vba/vbarange.cxx                                                                    |    2 
 sc/source/ui/vba/vbarange.hxx                                                                    |    2 
 scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java                        |   11 +---
 xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java                |   14 ++++-
 xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java |   24 +++++-----
 7 files changed, 35 insertions(+), 30 deletions(-)

New commits:
commit e384e3851de8d5c82c64be579456eccfa4c75959
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 16 09:48:38 2016 +0000

    coverity#1326200 Explicit null dereferenced
    
    Change-Id: I39ed18b55657e375b1c22f97c49a0e43aedce4f5

diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
index c84d4b7..90d66e3 100644
--- a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
+++ b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
@@ -215,6 +215,7 @@ public abstract class ScriptProvider implements
                         isPkgProvider = true;
 
                         if (!originalContextURL.equals(contextUrl)
+                            && extensionRepository != null
                             && !extensionRepository.equals("bundled")) {
 
                             contextUrl = PathUtils.make_url(contextUrl, "uno_packages");
commit 84d126c6b64f156527abcc47a508a0127505147d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 16 09:46:58 2016 +0000

    coverity#1326199 Explicit null dereferenced
    
    extensionDb is always the same
    
    Change-Id: I57b59f09b3f55757844a6aab6c6698857da2e15b

diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
index 9e7c4b6..c84d4b7 100644
--- a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
+++ b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
@@ -194,24 +194,20 @@ public abstract class ScriptProvider implements
                     m_container = new ParcelContainer(m_xContext, contextUrl, language);
                     m_xModel = getModelFromDocUrl(originalContextURL);
                 } else {
-                    String extensionDb = null;
+                    String extensionDb = "vnd.sun.star.expand:${$BRAND_INI_DIR/"
+                                   + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user";
+
                     String extensionRepository = null;
 
                     if (originalContextURL.startsWith("bundled")) {
                         contextUrl = "vnd.sun.star.expand:$BUNDLED_EXTENSIONS";
-                        extensionDb = "vnd.sun.star.expand:${$BRAND_INI_DIR/"
-                                      + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user";
                         extensionRepository = "bundled";
                     } else if (originalContextURL.startsWith("share")) {
                         contextUrl = "vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR";
-                        extensionDb = "vnd.sun.star.expand:${$BRAND_INI_DIR/"
-                                      + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user";
                         extensionRepository = "shared";
                     } else if (originalContextURL.startsWith("user")) {
                         contextUrl = "vnd.sun.star.expand:${$BRAND_INI_DIR/"
                                      + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user";
-                        extensionDb = "vnd.sun.star.expand:${$BRAND_INI_DIR/"
-                                      + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user";
                         extensionRepository = "user";
                     }
 
commit bd7759e0e0e3ac40668adc2f21df13ebc13598e7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 16 09:39:21 2016 +0000

    coverity#1326257 Dereference after null check
    
    Change-Id: I6159d6a9be17ceaffaa3e3a905abf87a8cf434ed

diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java
index 9fe83a2..7fb3efe 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java
@@ -315,6 +315,10 @@ public abstract class OfficeDocument
             }
         }
 
+        if (embeddedObjects == null) {
+            return null;
+        }
+
         return embeddedObjects.values().iterator();
     }
 
@@ -566,11 +570,13 @@ public abstract class OfficeDocument
 
         // The EmbeddedObjects come first.
         Iterator<EmbeddedObject> embObjs = getEmbeddedObjects();
-        while (embObjs.hasNext()) {
-            EmbeddedObject obj = embObjs.next();
-            obj.writeManifestData(manifestDoc);
+        if (embObjs != null) {
+            while (embObjs.hasNext()) {
+                EmbeddedObject obj = embObjs.next();
+                obj.writeManifestData(manifestDoc);
 
-            obj.write(zip);
+                obj.write(zip);
+            }
         }
 
         // Add in the entry for the Pictures directory.  Always present.
commit 7e6696672c416453f1daf796fef1890603c14b17
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 16 09:32:23 2016 +0000

    coverity#1326280 Explicit null dereferenced
    
    Change-Id: I68b88accb5518292af0b3c3418609c93371bf9cf

diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java
index a7b5463..72b6545 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java
@@ -88,17 +88,19 @@ public final class DocumentDeserializerImpl
         while (enumerate.hasNext()) {
             docOut = (DOMDocument) enumerate.next();
         }
-        try {
-            domDoc = docOut.getContentDOM();
-            baos = transform(domDoc);
-            sxwDoc.initContentDOM();
-            DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
-            dFactory.setNamespaceAware(true);
-            DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
-            sxwDoc.setContentDOM(dBuilder.parse(new ByteArrayInputStream(baos.toByteArray())));
-
-        } catch (Exception e) {
-            System.out.println("The following error occurred:" + e);
+        if (docOut != null) {
+            try {
+                domDoc = docOut.getContentDOM();
+                baos = transform(domDoc);
+                sxwDoc.initContentDOM();
+                DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
+                dFactory.setNamespaceAware(true);
+                DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
+                sxwDoc.setContentDOM(dBuilder.parse(new ByteArrayInputStream(baos.toByteArray())));
+
+            } catch (Exception e) {
+                System.out.println("The following error occurred:" + e);
+            }
         }
         return sxwDoc;
     }
commit 90acf2bd3b7726d87e9b054fdcb13204da0e1efa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 16 09:20:42 2016 +0000

    coverity#1352645 Uncaught exception
    
    and
    
    coverity#1352646 Uncaught exception
    coverity#1352647 Uncaught exception
    
    Change-Id: Ic96e93d219476eeb458ddab6372368f91bbd0398

diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx
index c511304..0353354 100644
--- a/sc/source/ui/vba/vbaformat.cxx
+++ b/sc/source/ui/vba/vbaformat.cxx
@@ -323,7 +323,7 @@ ScVbaFormat< Ifc... >::setWrapText( const uno::Any& _aWrapText ) throw (script::
 
 template< typename... Ifc >
 uno::Any SAL_CALL
-ScVbaFormat< Ifc... >::getWrapText(  ) throw (script::BasicErrorException, uno::RuntimeException)
+ScVbaFormat< Ifc... >::getWrapText(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
 {
     uno::Any aWrap = aNULL();
     try
@@ -552,7 +552,7 @@ ScVbaFormat< Ifc... >::setFormulaHidden( const uno::Any& FormulaHidden ) throw (
 
 template< typename... Ifc >
 uno::Any SAL_CALL
-ScVbaFormat< Ifc... >::getLocked(  ) throw (script::BasicErrorException, uno::RuntimeException)
+ScVbaFormat< Ifc... >::getLocked(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
 {
     uno::Any aCellProtection = aNULL();
     try
@@ -586,7 +586,7 @@ ScVbaFormat< Ifc... >::getLocked(  ) throw (script::BasicErrorException, uno::Ru
 
 template< typename... Ifc >
 uno::Any SAL_CALL
-ScVbaFormat< Ifc... >::getFormulaHidden(  ) throw (script::BasicErrorException, uno::RuntimeException)
+ScVbaFormat< Ifc... >::getFormulaHidden(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
 {
     uno::Any aBoolRet = aNULL();
     try
diff --git a/sc/source/ui/vba/vbaformat.hxx b/sc/source/ui/vba/vbaformat.hxx
index 15aba86..78b0416 100644
--- a/sc/source/ui/vba/vbaformat.hxx
+++ b/sc/source/ui/vba/vbaformat.hxx
@@ -78,11 +78,11 @@ public:
     virtual void SAL_CALL setShrinkToFit( const css::uno::Any& ShrinkToFit ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
     virtual css::uno::Any SAL_CALL getShrinkToFit(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
     virtual void SAL_CALL setWrapText( const css::uno::Any& WrapText ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-    virtual css::uno::Any SAL_CALL getWrapText(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+    virtual css::uno::Any SAL_CALL getWrapText(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception);
     virtual void SAL_CALL setLocked( const css::uno::Any& Locked ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-    virtual css::uno::Any SAL_CALL getLocked(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+    virtual css::uno::Any SAL_CALL getLocked(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception);
     virtual void SAL_CALL setFormulaHidden( const css::uno::Any& FormulaHidden ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-    virtual css::uno::Any SAL_CALL getFormulaHidden(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+    virtual css::uno::Any SAL_CALL getFormulaHidden(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception);
     virtual void SAL_CALL setMergeCells( const css::uno::Any& MergeCells ) throw (css::script::BasicErrorException, css::uno::RuntimeException) = 0;
     virtual css::uno::Any SAL_CALL getMergeCells(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) = 0;
     virtual void SAL_CALL setReadingOrder( const css::uno::Any& ReadingOrder ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 578eda4..1216134 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -2632,7 +2632,7 @@ ScVbaRange::setWrapText( const uno::Any& aIsWrapped ) throw (script::BasicErrorE
 }
 
 uno::Any
-ScVbaRange::getWrapText() throw (script::BasicErrorException, uno::RuntimeException)
+ScVbaRange::getWrapText() throw (script::BasicErrorException, uno::RuntimeException, std::exception)
 {
     if ( m_Areas->getCount() > 1 )
     {
diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx
index ba964dea..f2b7645 100644
--- a/sc/source/ui/vba/vbarange.hxx
+++ b/sc/source/ui/vba/vbarange.hxx
@@ -167,7 +167,7 @@ public:
     virtual void SAL_CALL setMergeCells( const css::uno::Any& bMerge ) throw (css::script::BasicErrorException, css::uno::RuntimeException) override;
     virtual css::uno::Any SAL_CALL getMergeCells() throw (css::script::BasicErrorException, css::uno::RuntimeException) override;
     virtual void SAL_CALL setWrapText( const css::uno::Any& bIsWrapped ) throw (css::script::BasicErrorException, css::uno::RuntimeException) override;
-    virtual css::uno::Any SAL_CALL getWrapText() throw (css::script::BasicErrorException, css::uno::RuntimeException) override;
+    virtual css::uno::Any SAL_CALL getWrapText() throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) override;
     virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getEntireRow() throw (css::uno::RuntimeException, std::exception) override;
     virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getEntireColumn() throw (css::uno::RuntimeException, std::exception) override;
     virtual css::uno::Reference< ov::excel::XComment > SAL_CALL getComment() throw (css::uno::RuntimeException, std::exception) override;


More information about the Libreoffice-commits mailing list