summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-05-07 10:23:13 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-05-07 10:24:12 +0100
commitd0a0da717682a0e57f733d75d9d0700cfb198823 (patch)
tree9aeb92b5cc3177d09f0598574ff5ed5b51b9d59b /i18npool
parent220c9fc2e9fa8c83a1851e3f73682d8300f6dff1 (diff)
Resolves: tdf#91057 transliterateChar2Char throws MultipleCharsOutputException
for ß, but toTitle only allows RuntimeException, which is our usual awesomeness Change-Id: Ib5618a55a369fa5cd1d323f657f0798776828386
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/characterclassification/cclass_unicode.cxx56
1 files changed, 36 insertions, 20 deletions
diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx b/i18npool/source/characterclassification/cclass_unicode.cxx
index b65fd18324f4..95a6c5787111 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