summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKisub Song <kisubs.song@samsung.com>2012-09-11 19:16:41 +0900
committerKisub Song <kisubs.song@samsung.com>2012-09-11 19:16:41 +0900
commitcf56c1a5ce6351214e6672918a7b43e3bd559f1d (patch)
tree99ab2d55773c31d7955988f54cd48eadc0c52914
parent1783df6de25346b6a6b1e47ec78a467c97391cce (diff)
downloadwrt-plugins-tizen-cf56c1a5ce6351214e6672918a7b43e3bd559f1d.tar.gz
wrt-plugins-tizen-cf56c1a5ce6351214e6672918a7b43e3bd559f1d.tar.bz2
wrt-plugins-tizen-cf56c1a5ce6351214e6672918a7b43e3bd559f1d.zip
Update change log and spec for wrt-plugins-tizen_0.2.82
Changed Modules : Calendar and TimeUtil [Version] 0.2.82 [Project] GT-I8800, Public [Title] SEL Verification [Team] WebAPI [BinType] PDA [Customer] Open [Issue#] S1-8507 [Problem] Calendar - Crash while converting recurrent event to web event [Cause] missing null check before strtok [Solution] Add null check [Issue#] N_SE-9207 [Problem] TimeUtil - addDuration(new tizen.TimeDuration(2222222222, DAYS)) result has minus value. [Cause] The type of TimeDuration's length is long long. But the parameter type of add in ICU is int32. So type conversion problem occurs. [Solution] If TimeDuration's length is over int32's max/min value, it will be added first within the limits of the possible and the rest will be added next. And If result is over max/min value that can be handled in ICU, it will raise an UNKNOWN Exception. [SCMRequest] N/A Change-Id: I47418cd43b86a724b034afbfa1d3b1322179aac5
-rw-r--r--debian/changelog8
-rwxr-xr-xpackaging/wrt-plugins-tizen.spec2
-rwxr-xr-xsrc/platform/Tizen/Calendar/EventWrapper.cpp69
-rwxr-xr-xsrc/platform/Tizen/TimeUtil/TZDate.cpp80
-rwxr-xr-xsrc/standards/Tizen/TimeUtil/JSTZDate.cpp7
5 files changed, 124 insertions, 42 deletions
diff --git a/debian/changelog b/debian/changelog
index c192f2c..3833d99 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,13 @@
wrt-plugins-tizen (0.2.81) unstable; urgency=low
+ * Bug fix on Calendar and TimeUtil
+ * Git : framework/web/wrt-plugins-tizen
+ * Tag : wrt-plugins-tizen_0.2.82
+
+ -- Kisub Song <kisubs.song@samsung.com> Tue, 11 Sep 2012 18:29:57 +0900
+
+wrt-plugins-tizen (0.2.81) unstable; urgency=low
+
* Bug fix on Device, Contact
* git : slp/pkgs/w/wrt-plugins-tizen
* Tag : wrt-plugins-tizen_0.2.81
diff --git a/packaging/wrt-plugins-tizen.spec b/packaging/wrt-plugins-tizen.spec
index 7e9f159..b46028c 100755
--- a/packaging/wrt-plugins-tizen.spec
+++ b/packaging/wrt-plugins-tizen.spec
@@ -1,6 +1,6 @@
Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.2.81
+Version: 0.2.82
Release: 0
Group: TO_BE_FILLED
License: TO_BE_FILLED
diff --git a/src/platform/Tizen/Calendar/EventWrapper.cpp b/src/platform/Tizen/Calendar/EventWrapper.cpp
index 3a52c91..9065f34 100755
--- a/src/platform/Tizen/Calendar/EventWrapper.cpp
+++ b/src/platform/Tizen/Calendar/EventWrapper.cpp
@@ -1234,16 +1234,16 @@ void EventWrapper::setCompletedDateToPlatformEvent()
void EventWrapper::setProgressToPlatformEvent()
{
- if (!m_platformEvent) {
- ThrowMsg(UnknownException, "Null platform pointer.");
- }
+ if (!m_platformEvent) {
+ ThrowMsg(UnknownException, "Null platform pointer.");
+ }
- int progress = m_abstractEvent->getProgress();
- if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
- CAL_VALUE_INT_PROGRESS,
- progress)) {
- ThrowMsg(PlatformException, "Can't set visibility.");
- }
+ int progress = m_abstractEvent->getProgress();
+ if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
+ CAL_VALUE_INT_PROGRESS,
+ progress)) {
+ ThrowMsg(PlatformException, "Can't set visibility.");
+ }
}
CalendarEventPtr EventWrapper::convertPlatformEventToAbstractEvent()
@@ -1385,10 +1385,13 @@ void EventWrapper::setRecurrenceRuleFromPlatformEvent()
std::vector<std::string> daysOfTheWeek;
char* byday = calendar_svc_struct_get_str(m_platformEvent, CALS_VALUE_TXT_RRULE_BYDAY);
LogInfo("Loaded byday: "<<byday);
- char* pch = strtok(byday, ",");
- while (NULL != pch) {
- daysOfTheWeek.push_back(pch);
- pch = strtok(NULL, ",");
+ if (byday) {
+ char *saveptr = NULL;
+ char* pch = strtok_r(byday, ",", &saveptr);
+ while (NULL != pch) {
+ daysOfTheWeek.push_back(pch);
+ pch = strtok_r(NULL, ",", &saveptr);
+ }
}
rrule->setDaysOfTheWeek(daysOfTheWeek);
LogInfo("Number of daysOfTheWeek: "<<rrule->getDaysOfTheWeek().size());
@@ -1404,19 +1407,22 @@ void EventWrapper::setRecurrenceRuleFromPlatformEvent()
// load the recurrence end date
long long int endDate = calendar_svc_struct_get_lli(m_platformEvent, CALS_VALUE_LLI_RRULE_UNTIL_UTIME);
rrule->setEndDate(endDate);
- LogDebug("endDate from platform = " << endDate);
+ LogDebug("endDate from platform = " << endDate);
// load the exceptions
std::vector<long long int> exceptions;
char* exdate = calendar_svc_struct_get_str(m_platformEvent, CAL_VALUE_TXT_EXDATE);
LogInfo("Loaded exdate: "<<exdate);
- pch = strtok(exdate, ",");
- while (NULL != pch) {
- std::stringstream ss(pch);
- long long int oneException;
- ss>>oneException;
- exceptions.push_back(oneException);
- pch = strtok(NULL, ",");
+ if (exdate) {
+ char *saveptr = NULL;
+ char *pch = strtok_r(exdate, ",", &saveptr);
+ while (NULL != pch) {
+ std::stringstream ss(pch);
+ long long int oneException;
+ ss>>oneException;
+ exceptions.push_back(oneException);
+ pch = strtok_r(NULL, ",", &saveptr);
+ }
}
rrule->setExceptions(exceptions);
LogInfo("Number of exceptions: "<<rrule->getExceptions().size());
@@ -1531,15 +1537,16 @@ void EventWrapper::setCategoriesFromPlatformEvent()
m_platformEvent,
CAL_VALUE_TXT_CATEGORIES);
- if( categories ) {
- LogInfo("Loaded categories: "<<categories);
+ if( categories ) {
+ LogInfo("Loaded categories: "<<categories);
- char* pch = strtok(categories, ",");
- while (NULL != pch) {
- m_abstractEvent->getCategories()->push_back(pch);
- pch = strtok(NULL, ",");
- }
- }
+ char *saveptr = NULL;
+ char* pch = strtok_r(categories, ",", &saveptr);
+ while (NULL != pch) {
+ m_abstractEvent->getCategories()->push_back(pch);
+ pch = strtok_r(NULL, ",", &saveptr);
+ }
+ }
LogInfo("Number of categories: "<<m_abstractEvent->getCategories()->size());
}
@@ -1563,8 +1570,8 @@ void EventWrapper::setParentIdFromPlatformEvent()
ThrowMsg(UnknownException, "Null platform pointer.");
}
- int parentId = calendar_svc_struct_get_int(m_platformEvent,
- CAL_VALUE_INT_ORIGINAL_EVENT_ID);
+ int parentId = calendar_svc_struct_get_int(m_platformEvent,
+ CAL_VALUE_INT_ORIGINAL_EVENT_ID);
m_abstractEvent->setParentId(parentId);
}
diff --git a/src/platform/Tizen/TimeUtil/TZDate.cpp b/src/platform/Tizen/TimeUtil/TZDate.cpp
index cfb92d6..6d04085 100755
--- a/src/platform/Tizen/TimeUtil/TZDate.cpp
+++ b/src/platform/Tizen/TimeUtil/TZDate.cpp
@@ -372,17 +372,77 @@ TZDateProperties TZDate::addDuration(const DurationProperties &duration) {
TimeUtilTools util;
Calendar *cal = myCalendar->clone();
- if (duration.unit == DAYS_UNIT) {
- cal->add(UCAL_DATE, util.toint32_t(duration.length), ec);
- } else if (duration.unit == MINUTES_UNIT) {
- cal->add(UCAL_MINUTE, util.toint32_t(duration.length), ec);
- } else if (duration.unit == HOURS_UNIT) {
- cal->add(UCAL_HOUR_OF_DAY, util.toint32_t(duration.length), ec);
- } else if (duration.unit == MSECS_UNIT) {
- cal->add(UCAL_MILLISECOND, util.toint32_t(duration.length), ec);
- } else {
- cal->add(UCAL_SECOND, util.toint32_t(duration.length), ec);
+ long long length = duration.length;
+ short unit = duration.unit;
+ int msec=0, sec=0, min=0, hour=0;
+ long long day=0;
+
+ if (unit == MSECS_UNIT) {
+ msec = length % 1000;
+ length /= 1000;
+ unit = SECONDS_UNIT;
+ }
+ if ((length != 0) && (unit == SECONDS_UNIT)) {
+ sec = length % 60;
+ length /= 60;
+ unit = MINUTES_UNIT;
+ }
+ if ((length != 0) && (unit == MINUTES_UNIT)) {
+ min = length % 60;
+ length /= 60;
+ unit = HOURS_UNIT;
+ }
+ if ((length != 0) && (unit == HOURS_UNIT)) {
+ hour = length % 24;
+ length /= 24;
+ unit = DAYS_UNIT;
+ }
+ day = length;
+ LogDebug("day:"<<day<<" hour:"<<hour<<" min:"<<min<<" sec:"<<sec<<" msec:"<<msec);
+ try {
+ if (msec != 0) {
+ cal->add(UCAL_MILLISECOND, util.toint32_t(msec), ec);
+ if (!U_SUCCESS(ec))
+ Throw(Commons::PlatformException);
+ }
+ if (sec != 0) {
+ cal->add(UCAL_SECOND, util.toint32_t(sec), ec);
+ if (!U_SUCCESS(ec))
+ Throw(Commons::PlatformException);
+ }
+ if (min != 0) {
+ cal->add(UCAL_MINUTE, util.toint32_t(min), ec);
+ if (!U_SUCCESS(ec))
+ Throw(Commons::PlatformException);
+ }
+ if (hour != 0) {
+ cal->add(UCAL_HOUR_OF_DAY, util.toint32_t(hour), ec);
+ if (!U_SUCCESS(ec))
+ Throw(Commons::PlatformException);
+ }
+ while (day != 0) {
+ LogDebug("1st day : " << day);
+ int amount = 0;
+
+ if (day < INT_MIN)
+ amount = INT_MIN;
+ else if (day > INT_MAX)
+ amount = INT_MAX;
+ else
+ amount = day;
+
+ day -= amount;
+ LogDebug("amount : " << amount);
+ LogDebug("2nd day : " << day);
+ cal->add(UCAL_DATE, util.toint32_t(amount), ec);
+ if (!U_SUCCESS(ec))
+ Throw(Commons::PlatformException);
+ } ;
+ } catch (Commons::PlatformException) {
+ delete cal;
+ ThrowMsg(Commons::PlatformException, "Calendar error in addDuration");
}
+
TZDateProperties result = _makeProperties(cal);
util.printDate(cal);
delete cal;
diff --git a/src/standards/Tizen/TimeUtil/JSTZDate.cpp b/src/standards/Tizen/TimeUtil/JSTZDate.cpp
index 1706c5f..0151ee8 100755
--- a/src/standards/Tizen/TimeUtil/JSTZDate.cpp
+++ b/src/standards/Tizen/TimeUtil/JSTZDate.cpp
@@ -595,6 +595,13 @@ JSValueRef JSTZDate::addDuration(JSContextRef context, JSObjectRef function,
ITZDatePtr tzDate(privateObject->getObject());
TZDateProperties result = tzDate->addDuration(duration);
+
+ long long diff = -(tzDate->difference(result));
+ long long durationtoMsec = converter.convertDurationLength(duration, MSECS_UNIT);
+ if (diff != durationtoMsec) {
+ LogError("result - orignal != duration diff:"<<diff <<"durationtoMsec:" << durationtoMsec);
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "The result is beyond the scope that TZDate can handle.");
+ }
return (static_cast<JSValueRef>(createJSObject(context, result)));
} Catch(NullPointerException) {
LogError("Exception: " << _rethrown_exception.GetMessage());