[Libreoffice-commits] .: framework/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Dec 20 04:06:03 PST 2011


 framework/source/loadenv/loadenv.cxx |   36 +++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

New commits:
commit 80cc772841dc3b03f0a629215858d0a44f5419a1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 20 10:00:36 2011 +0000

    pretty up exception message for display in StarBasic dialogs

diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index ef65152..090b6aa 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -193,24 +193,32 @@ css::uno::Reference< css::lang::XComponent > LoadEnv::loadComponentFromURL(const
         switch(ex.m_nID)
         {
             case LoadEnvException::ID_INVALID_MEDIADESCRIPTOR:
-                    throw css::lang::IllegalArgumentException(
-                            ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Optional list of arguments seem to be corrupted.")),
-                            xLoader,
-                            4);
+                throw css::lang::IllegalArgumentException(
+                    ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Optional list of arguments seem to be corrupted.")),
+                    xLoader,
+                    4);
 
             case LoadEnvException::ID_UNSUPPORTED_CONTENT:
-                throw css::lang::IllegalArgumentException(
-                    (rtl::OUString(
-                        RTL_CONSTASCII_USTRINGPARAM("Unsupported URL <")) +
-                     sURL +
-                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">: \"")) +
-                     rtl::OStringToOUString(
-                         ex.m_sMessage, RTL_TEXTENCODING_UTF8) +
-                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\""))),
+            {
+                rtl::OUStringBuffer aMsg;
+                aMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM("Unsupported URL <")).
+                    append(sURL).append('>');
+
+                if (!ex.m_sMessage.isEmpty())
+                {
+                    aMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(": \"")).
+                        append(rtl::OStringToOUString(
+                             ex.m_sMessage, RTL_TEXTENCODING_UTF8)).
+                        appendAscii(RTL_CONSTASCII_STRINGPARAM("\""));
+                }
+
+                throw css::lang::IllegalArgumentException(aMsg.makeStringAndClear(),
                     xLoader, 1);
+            }
 
-            default: xComponent.clear();
-                    break;
+            default:
+                xComponent.clear();
+                break;
         }
     }
 


More information about the Libreoffice-commits mailing list