[Libreoffice-commits] core.git: framework/source

Stephan Bergmann sbergman at redhat.com
Wed Nov 19 23:35:20 PST 2014


 framework/source/services/modulemanager.cxx |   86 ++++++++++++----------------
 1 file changed, 38 insertions(+), 48 deletions(-)

New commits:
commit 9dc7bae64d1c08e06c755ea97c21e50bd6a8eec1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Nov 19 18:36:49 2014 +0100

    Revert "coverity#1169848 Uncaught exception"
    
    This reverts commit b0a7722ebfa720255b6ce1e383a3aacae0ce5e9f, now that
    fced31697bcc2a2a4da34d804582002de0320302 "comphelper::SequenceAsHashMap: throw
    IllegalArgumentException" made the underlying problem go away.
    
    Conflicts:
    	framework/source/services/modulemanager.cxx
    
    Change-Id: I6599cf25d4f28d2bab19da67d5de5caacd84a622

diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx
index 7a3cee7..cdb1763 100644
--- a/framework/source/services/modulemanager.cxx
+++ b/framework/source/services/modulemanager.cxx
@@ -235,59 +235,49 @@ void SAL_CALL ModuleManager::replaceByName(const OUString& sName ,
            css::lang::WrappedTargetException     ,
            css::uno::RuntimeException, std::exception            )
 {
-    try
+    ::comphelper::SequenceAsHashMap lProps(aValue);
+    if (lProps.empty() )
     {
-        ::comphelper::SequenceAsHashMap lProps(aValue);
-        if (lProps.empty() )
-        {
-            throw css::lang::IllegalArgumentException(
-                    OUString("No properties given to replace part of module."),
-                    static_cast< cppu::OWeakObject * >(this),
-                    2);
-        }
-
-        // get access to the element
-        // Note: Dont use impl_getConfig() method here. Because it creates a readonly access only, further
-        // it cache it as a member of this module manager instance. If we change some props there ... but dont
-        // flush changes (because an error occurred) we will read them later. If we use a different config access
-        // we can close it without a flush ... and our read data wont be affected .-)
-        css::uno::Reference< css::uno::XInterface >         xCfg      = ::comphelper::ConfigurationHelper::openConfig(
-                                                                            m_xContext,
-                                                                            "/org.openoffice.Setup/Office/Factories",
-                                                                            ::comphelper::ConfigurationHelper::E_STANDARD);
-        css::uno::Reference< css::container::XNameAccess >  xModules (xCfg, css::uno::UNO_QUERY_THROW);
-        css::uno::Reference< css::container::XNameReplace > xModule;
-
-        xModules->getByName(sName) >>= xModule;
-        if (!xModule.is())
-        {
-            throw css::uno::RuntimeException(
-                    OUString("Was not able to get write access to the requested module entry inside configuration."),
-                    static_cast< cppu::OWeakObject * >(this));
-        }
-
-        ::comphelper::SequenceAsHashMap::const_iterator pProp;
-        for (  pProp  = lProps.begin();
-               pProp != lProps.end();
-             ++pProp                  )
-        {
-            const OUString& sPropName  = pProp->first;
-            const css::uno::Any&   aPropValue = pProp->second;
-
-            // let "NoSuchElementException" out ! We support the same API ...
-            // and without a flush() at the end all changed data before will be ignored !
-            xModule->replaceByName(sPropName, aPropValue);
-        }
+        throw css::lang::IllegalArgumentException(
+                OUString("No properties given to replace part of module."),
+                static_cast< cppu::OWeakObject * >(this),
+                2);
+    }
 
-        ::comphelper::ConfigurationHelper::flush(xCfg);
+    // get access to the element
+    // Note: Dont use impl_getConfig() method here. Because it creates a readonly access only, further
+    // it cache it as a member of this module manager instance. If we change some props there ... but dont
+    // flush changes (because an error occurred) we will read them later. If we use a different config access
+    // we can close it without a flush ... and our read data wont be affected .-)
+    css::uno::Reference< css::uno::XInterface >         xCfg      = ::comphelper::ConfigurationHelper::openConfig(
+                                                                        m_xContext,
+                                                                        "/org.openoffice.Setup/Office/Factories",
+                                                                        ::comphelper::ConfigurationHelper::E_STANDARD);
+    css::uno::Reference< css::container::XNameAccess >  xModules (xCfg, css::uno::UNO_QUERY_THROW);
+    css::uno::Reference< css::container::XNameReplace > xModule  ;
+
+    xModules->getByName(sName) >>= xModule;
+    if (!xModule.is())
+    {
+        throw css::uno::RuntimeException(
+                OUString("Was not able to get write access to the requested module entry inside configuration."),
+                static_cast< cppu::OWeakObject * >(this));
     }
-    catch (const css::beans::IllegalTypeException& e)
+
+    ::comphelper::SequenceAsHashMap::const_iterator pProp;
+    for (  pProp  = lProps.begin();
+           pProp != lProps.end()  ;
+         ++pProp                  )
     {
-        css::uno::Any a(e);
-        throw css::lang::WrappedTargetException(
-                OUString("ModuleManager::replaceByName: IllegalType exception"),
-                css::uno::Reference<css::uno::XInterface>(*this), a);
+        const OUString& sPropName  = pProp->first;
+        const css::uno::Any&   aPropValue = pProp->second;
+
+        // let "NoSuchElementException" out ! We support the same API ...
+        // and without a flush() at the end all changed data before will be ignored !
+        xModule->replaceByName(sPropName, aPropValue);
     }
+
+    ::comphelper::ConfigurationHelper::flush(xCfg);
 }
 
 css::uno::Any SAL_CALL ModuleManager::getByName(const OUString& sName)


More information about the Libreoffice-commits mailing list