i18npool/source/indexentry/indexentrysupplier_default.cxx |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 8ad6257d456c595a47669846fc3ef5337653bd03
Author:     Aditya Pratap Singh <adityapratapsing...@gmail.com>
AuthorDate: Mon Feb 1 21:57:25 2021 +0530
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Feb 12 14:01:45 2021 +0100

    tdf#42982 Add descriptions to some runtime exceptions
    
    Change-Id: Ie970367f1b3df3324cc56e467ae93eb7155e05eb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110261
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/i18npool/source/indexentry/indexentrysupplier_default.cxx 
b/i18npool/source/indexentry/indexentrysupplier_default.cxx
index 5e541f139708..d3f4acb83924 100644
--- a/i18npool/source/indexentry/indexentrysupplier_default.cxx
+++ b/i18npool/source/indexentry/indexentrysupplier_default.cxx
@@ -173,7 +173,8 @@ void Index::makeIndexKeys(const lang::Locale &rLocale, 
std::u16string_view algor
         keyStr = LocaleDataImpl::get()->getIndexKeysByAlgorithm(LOCALE_EN,
                     
LocaleDataImpl::get()->getDefaultIndexAlgorithm(LOCALE_EN));
         if (keyStr.isEmpty())
-            throw RuntimeException();
+            throw RuntimeException(
+                "Index::makeIndexKeys: No index keys returned by algorithm");
     }
 
     sal_Int16 len = sal::static_int_cast<sal_Int16>( keyStr.getLength() );
@@ -192,7 +193,8 @@ void Index::makeIndexKeys(const lang::Locale &rLocale, 
std::u16string_view algor
         switch(curr) {
             case u'-': {
                     if (key_count <= 0 || i + 1 >= len)
-                        throw RuntimeException();
+                        throw RuntimeException("Index::makeIndexKeys: 
key_count<=0||"
+                                                "'-' is the last char of 
KeyString");
                     for (curr = keyStr[++i]; key_count < MAX_KEYS && 
keys[key_count-1].key < curr; key_count++) {
                         keys[key_count].key = keys[key_count-1].key+1;
                         keys[key_count].desc.clear();
@@ -217,13 +219,13 @@ void Index::makeIndexKeys(const lang::Locale &rLocale, 
std::u16string_view algor
                 [[fallthrough]];
             case u'(': {
                     if (key_count <= 0)
-                        throw RuntimeException();
+                        throw RuntimeException("Index::makeIndexKeys: 
key_count<=0");
 
                     sal_Int16 end = i+1;
                     for (; end < len && keyStr[end] != close; end++) ;
 
                     if (end >= len) // no found
-                        throw RuntimeException();
+                        throw RuntimeException("Index::makeIndexKeys: Closing 
bracket not found");
                     if (close == ')')
                         keys[key_count-1].desc = keyStr.copy(i+1, end-i-1);
                     else {
@@ -261,12 +263,12 @@ void Index::init(const lang::Locale &rLocale, const 
OUString& algorithm)
     if (!scriptList.hasElements()) {
         scriptList = LocaleDataImpl::get()->getUnicodeScripts(LOCALE_EN);
         if (!scriptList.hasElements())
-            throw RuntimeException();
+            throw RuntimeException("Index::init: scriptList is empty");
     }
 
     table_count = sal::static_int_cast<sal_Int16>( scriptList.getLength() );
     if (table_count > MAX_TABLES)
-        throw RuntimeException();
+        throw RuntimeException("Index::init: Length of scriptList is too big");
 
     collator->loadCollatorAlgorithm(algorithm, rLocale, 
CollatorOptions::CollatorOptions_IGNORE_CASE_ACCENT);
     sal_Int16 j=0;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to