i18npool/source/characterclassification/cclass_unicode.cxx |   56 ++++++++-----
 1 file changed, 36 insertions(+), 20 deletions(-)

New commits:
commit d0a0da717682a0e57f733d75d9d0700cfb198823
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu May 7 10:23:13 2015 +0100

    Resolves: tdf#91057 transliterateChar2Char throws 
MultipleCharsOutputException
    
    for ß, but toTitle only allows RuntimeException, which is our usual
    awesomeness
    
    Change-Id: Ib5618a55a369fa5cd1d323f657f0798776828386

diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx 
b/i18npool/source/characterclassification/cclass_unicode.cxx
index b65fd18..95a6c57 100644
--- a/i18npool/source/characterclassification/cclass_unicode.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode.cxx
@@ -21,8 +21,10 @@
 #include <com/sun/star/i18n/UnicodeScript.hpp>
 #include <com/sun/star/i18n/UnicodeType.hpp>
 #include <com/sun/star/i18n/KCharacterType.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
 #include <unicode/uchar.h>
 #include <comphelper/string.hxx>
+#include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <breakiteratorImpl.hxx>
 
@@ -79,27 +81,41 @@ cclass_Unicode::toLower( const OUString& Text, sal_Int32 
nPos, sal_Int32 nCount,
 
 OUString SAL_CALL
 cclass_Unicode::toTitle( const OUString& Text, sal_Int32 nPos, sal_Int32 
nCount, const Locale& rLocale ) throw(RuntimeException, std::exception) {
-    sal_Int32 len = Text.getLength();
-    if (nPos >= len)
-        return OUString();
-    if (nCount + nPos > len)
-        nCount = len - nPos;
-
-    trans->setMappingType(MappingTypeToTitle, rLocale);
-    rtl_uString* pStr = rtl_uString_alloc(nCount);
-    sal_Unicode* out = pStr->buffer;
-    BreakIteratorImpl brk(m_xContext);
-    Boundary bdy = brk.getWordBoundary(Text, nPos, rLocale,
-                WordType::ANYWORD_IGNOREWHITESPACES, sal_True);
-    for (sal_Int32 i = nPos; i < nCount + nPos; i++, out++) {
-        if (i >= bdy.endPos)
-            bdy = brk.nextWord(Text, bdy.endPos, rLocale,
-                        WordType::ANYWORD_IGNOREWHITESPACES);
-        *out = (i == bdy.startPos) ?
-            trans->transliterateChar2Char(Text[i]) : Text[i];
+    try
+    {
+        sal_Int32 len = Text.getLength();
+        if (nPos >= len)
+            return OUString();
+        if (nCount + nPos > len)
+            nCount = len - nPos;
+
+        trans->setMappingType(MappingTypeToTitle, rLocale);
+        rtl_uString* pStr = rtl_uString_alloc(nCount);
+        sal_Unicode* out = pStr->buffer;
+        BreakIteratorImpl brk(m_xContext);
+        Boundary bdy = brk.getWordBoundary(Text, nPos, rLocale,
+                    WordType::ANYWORD_IGNOREWHITESPACES, sal_True);
+        for (sal_Int32 i = nPos; i < nCount + nPos; i++, out++) {
+            if (i >= bdy.endPos)
+                bdy = brk.nextWord(Text, bdy.endPos, rLocale,
+                            WordType::ANYWORD_IGNOREWHITESPACES);
+            *out = (i == bdy.startPos) ?
+                trans->transliterateChar2Char(Text[i]) : Text[i];
+        }
+        *out = 0;
+        return OUString( pStr, SAL_NO_ACQUIRE );
+    }
+    catch (const RuntimeException&)
+    {
+        throw;
+    }
+    catch (const Exception& e)
+    {
+        uno::Any a(cppu::getCaughtException());
+        throw lang::WrappedTargetRuntimeException(
+            "wrapped Exception " + e.Message,
+            uno::Reference<uno::XInterface>(), a);
     }
-    *out = 0;
-    return OUString( pStr, SAL_NO_ACQUIRE );
 }
 
 sal_Int16 SAL_CALL
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to