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

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Sun Jun 14 11:21:46 UTC 2020


 i18npool/source/calendar/calendarImpl.cxx |   62 ++++++++++++++----------------
 1 file changed, 30 insertions(+), 32 deletions(-)

New commits:
commit 19ac9f49a215a45e3cde835d06d37e3fec4ba4af
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Fri Jun 12 17:20:14 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jun 14 13:21:11 2020 +0200

    Replace ERROR macro and trace exception (i18npool/calendarImpl)
    
    Change-Id: Ie06a19b902e4dc12914fe0f2328a5abafa85368e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96208
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx
index 8a288bcb6c31..f2959f0b3d46 100644
--- a/i18npool/source/calendar/calendarImpl.cxx
+++ b/i18npool/source/calendar/calendarImpl.cxx
@@ -31,8 +31,6 @@ using namespace ::com::sun::star::i18n;
 
 namespace i18npool {
 
-#define ERROR RuntimeException()
-
 CalendarImpl::CalendarImpl() : m_xContext(comphelper::getProcessComponentContext())
 {
 }
@@ -40,7 +38,7 @@ CalendarImpl::CalendarImpl() : m_xContext(comphelper::getProcessComponentContext
 CalendarImpl::CalendarImpl(const Reference< XComponentContext > &rxContext) : m_xContext(rxContext)
 {
     if (!m_xContext.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::CalendarImpl: empty m_xContext");
 }
 
 CalendarImpl::~CalendarImpl()
@@ -53,7 +51,7 @@ CalendarImpl::loadDefaultCalendarTZ( const css::lang::Locale& rLocale, const OUS
     const Sequence< Calendar2 > xC = LocaleDataImpl::get()->getAllCalendars2(rLocale);
     auto pCal = std::find_if(xC.begin(), xC.end(), [](const Calendar2& rCal) { return rCal.Default; });
     if (pCal == xC.end())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::loadDefaultCalendarTZ: no default calendar found for this locale");
     loadCalendarTZ(pCal->Name, rLocale, rTimeZone);
 }
 
@@ -85,7 +83,7 @@ CalendarImpl::loadCalendarTZ( const OUString& uniqueID, const css::lang::Locale&
         }
 
         if ( !xI.is() )
-            throw ERROR;
+            throw RuntimeException("CalendarImpl::loadCalendarTZ: no calendar found for this locale");
         xCalendar.set(xI, UNO_QUERY);
 
         if (!rTimeZone.isEmpty())
@@ -103,7 +101,7 @@ CalendarImpl::loadCalendarTZ( const OUString& uniqueID, const css::lang::Locale&
     if ( !xCalendar.is() )
     {
         xCalendar = xOldCalendar;
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::loadCalendarTZ: no calendar found for this locale, should use old one?");
     }
 
     try
@@ -118,14 +116,14 @@ CalendarImpl::loadCalendarTZ( const OUString& uniqueID, const css::lang::Locale&
 
     if (!bTimeZone)
         // The calendar is usable but is not in the expected time zone.
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::loadCalendarTZ: the calendar is usable but is not in the expected time zone");
 }
 
 Calendar2 SAL_CALL
 CalendarImpl::getLoadedCalendar2()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getLoadedCalendar2: no calendar");
     return xCalendar->getLoadedCalendar2();
 }
 
@@ -133,7 +131,7 @@ CalendarImpl::getLoadedCalendar2()
 CalendarImpl::getLoadedCalendar()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getLoadedCalendar: no calendar");
     return xCalendar->getLoadedCalendar();
 }
 
@@ -151,7 +149,7 @@ void SAL_CALL
 CalendarImpl::setDateTime( double fTimeInDays )
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::setDateTime: no calendar");
     xCalendar->setDateTime( fTimeInDays );
 }
 
@@ -159,7 +157,7 @@ double SAL_CALL
 CalendarImpl::getDateTime()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getDateTime: no calendar");
     return xCalendar->getDateTime();
 }
 
@@ -167,7 +165,7 @@ void SAL_CALL
 CalendarImpl::setLocalDateTime( double fTimeInDays )
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::setLocalDateTime: no calendar");
     xCalendar->setLocalDateTime( fTimeInDays );
 }
 
@@ -175,7 +173,7 @@ double SAL_CALL
 CalendarImpl::getLocalDateTime()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getLocalDateTime: no calendar");
     return xCalendar->getLocalDateTime();
 }
 
@@ -193,7 +191,7 @@ OUString SAL_CALL
 CalendarImpl::getUniqueID()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getUniqueID: no calendar");
     return xCalendar->getUniqueID();
 }
 
@@ -201,7 +199,7 @@ void SAL_CALL
 CalendarImpl::setValue( sal_Int16 fieldIndex, sal_Int16 value )
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::setValue: no calendar");
     xCalendar->setValue( fieldIndex, value );
 }
 
@@ -209,7 +207,7 @@ sal_Int16 SAL_CALL
 CalendarImpl::getValue( sal_Int16 fieldIndex )
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getValue: no calendar");
     return xCalendar->getValue( fieldIndex );
 }
 
@@ -217,7 +215,7 @@ void SAL_CALL
 CalendarImpl::addValue( sal_Int16 fieldIndex, sal_Int32 amount )
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::addValue: no calendar");
     xCalendar->addValue( fieldIndex, amount);
 }
 
@@ -225,7 +223,7 @@ sal_Int16 SAL_CALL
 CalendarImpl::getFirstDayOfWeek()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getFirstDayOfWeek: no calendar");
     return xCalendar->getFirstDayOfWeek();
 }
 
@@ -233,7 +231,7 @@ void SAL_CALL
 CalendarImpl::setFirstDayOfWeek( sal_Int16 day )
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::setFirstDayOfWeek: no calendar");
     xCalendar->setFirstDayOfWeek(day);
 }
 
@@ -241,7 +239,7 @@ void SAL_CALL
 CalendarImpl::setMinimumNumberOfDaysForFirstWeek( sal_Int16 days )
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::setMinimumNumberOfDaysForFirstWeek: no calendar");
     xCalendar->setMinimumNumberOfDaysForFirstWeek(days);
 }
 
@@ -249,7 +247,7 @@ sal_Int16 SAL_CALL
 CalendarImpl::getMinimumNumberOfDaysForFirstWeek()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getMinimumNumberOfDaysForFirstWeek: no calendar");
     return xCalendar->getMinimumNumberOfDaysForFirstWeek();
 }
 
@@ -258,7 +256,7 @@ OUString SAL_CALL
 CalendarImpl::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16 nameType )
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getDisplayName: no calendar");
     return xCalendar->getDisplayName( displayIndex, idx, nameType );
 }
 
@@ -266,7 +264,7 @@ sal_Int16 SAL_CALL
 CalendarImpl::getNumberOfMonthsInYear()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::setDisplayName: no calendar");
     return xCalendar->getNumberOfMonthsInYear();
 }
 
@@ -275,7 +273,7 @@ sal_Int16 SAL_CALL
 CalendarImpl::getNumberOfDaysInWeek()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getNumberOfDaysInWeek: no calendar");
     return xCalendar->getNumberOfDaysInWeek();
 }
 
@@ -284,7 +282,7 @@ Sequence< CalendarItem > SAL_CALL
 CalendarImpl::getDays()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::setNumberOfDaysInWeek: no calendar");
     return xCalendar->getDays();
 }
 
@@ -293,7 +291,7 @@ Sequence< CalendarItem > SAL_CALL
 CalendarImpl::getMonths()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getMonths: no calendar");
     return xCalendar->getMonths();
 }
 
@@ -302,7 +300,7 @@ Sequence< CalendarItem2 > SAL_CALL
 CalendarImpl::getDays2()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getDays2: no calendar");
     return xCalendar->getDays2();
 }
 
@@ -311,7 +309,7 @@ Sequence< CalendarItem2 > SAL_CALL
 CalendarImpl::getMonths2()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getMonths2: no calendar");
     return xCalendar->getMonths2();
 }
 
@@ -320,7 +318,7 @@ Sequence< CalendarItem2 > SAL_CALL
 CalendarImpl::getGenitiveMonths2()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getGenitiveMonths2: no calendar");
     return xCalendar->getGenitiveMonths2();
 }
 
@@ -329,7 +327,7 @@ Sequence< CalendarItem2 > SAL_CALL
 CalendarImpl::getPartitiveMonths2()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getPartitiveMonths2: no calendar");
     return xCalendar->getPartitiveMonths2();
 }
 
@@ -338,7 +336,7 @@ sal_Bool SAL_CALL
 CalendarImpl::isValid()
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::isValid: no calendar");
     return xCalendar->isValid();
 }
 
@@ -346,7 +344,7 @@ OUString SAL_CALL
 CalendarImpl::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode )
 {
     if (!xCalendar.is())
-        throw ERROR;
+        throw RuntimeException("CalendarImpl::getDisplayString: no calendar");
     return xCalendar->getDisplayString(nCalendarDisplayCode, nNativeNumberMode);
 }
 


More information about the Libreoffice-commits mailing list