Update change log and spec for wrt-plugins-tizen_0.4.58
authorDongjin Choi <milkelf.choi@samsung.com>
Thu, 1 Aug 2013 05:50:19 +0000 (14:50 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Thu, 1 Aug 2013 05:50:19 +0000 (14:50 +0900)
[model] REDWOOD
[binary_type] PDA
[customer] OPEN

[Issue#] N/A
[Problem] TCT issues
[Cause] exception policy
[Solution] remove exception generating code

[Issue#] N/A
[Problem] Two TCT cases failed.
[Cause] No error thrown when "undefined" is passed to the optional, nullable argument.
[Solution] Throw "TypeMismatch" exception in every such cases.

[Issue] N/A
[Problem] loadMessageBody call on smsService error with email message
[Cause] loadMessageBody call on smsService error with email message
[Solution] compare message type with service type

[Issue] N/A
[Problem] Add Attachment crash with invalid mimetype
[Cause] mimeType check routine bug
[Solution] mimeType check routine change

[Issue] N/A
[Problem] If constructing TZDate or TimeDuration, exception is raised.
[Cause] When constructing TZDate or TimeDuration it checks if unit value is valid or not. And if it is not valid, it sends an exception.
[Solution] It will not send exception in the case. It will use default values instead of invalid arguments when setting attributes or constructing TZDate or TimeDuration with invalid ones

[Issue#] N/A
[Problem] Intensive TCs failed regarding duration and status attributes.
[Cause] Duration/endDate/dueDate auto-calculated. Wrong status management.
[Solution] Do not auto-calculate duration as per spec. Fix status attribute find routine.

[Issue#] CID-23443, CID-19775
[Problem] N/A
[Solution] modify code

[SecureStorage] remove secure storage module.

[Issue#] N/A
[Problem] getScreenBrightness was not reflect auto brightness value
[Solution] update getting screen brightness function
[SCMRequest] N/A

[Issue] N_SE-47519
[Problem] Web process has closed unexpectedly when try to select Enter phone number number field in Chatter
[Cause] get email message exception is not checked
[Solution] get email message exception check

[Issue] N_SE-47437
[Problem] Message notification disappear although message is not shown in Chatter
[Cause] Msg F/W update isRead status always
[Solution] use other Msg F/W API

[Notification] fixed Intensive issue.

[Issue#] N/A
[Problem] Binary size was too big
[Cause] optimization level
[Solution] Adjusted optimization level to -Os

[Issue#] DCM-2201
[Problem] exit and hide api is not working in iframe
[Cause] scheme callback is not working in iframe
[Solution] use IPC API instead of scheme callback

[team] WebAPI
[request] N/A
[horizontal_expansion] N/A

UnitTC passed.

45 files changed:
packaging/wrt-plugins-tizen.spec
src/Application/JSApplication.cpp
src/Application/JSApplicationManager.cpp
src/Application/JSApplicationManager.h
src/Calendar/CalendarConverter.cpp
src/Calendar/CalendarFilter.cpp [changed mode: 0644->0755]
src/Calendar/EventWrapper.cpp
src/Calendar/JSCalendar.cpp
src/Calendar/JSCalendarEvent.cpp
src/Calendar/JSCalendarItemProperties.cpp
src/Calendar/JSCalendarTask.cpp
src/Contact/JSAddressBook.cpp
src/Contact/JSContact.cpp
src/Contact/JSContactAddress.cpp
src/Contact/JSContactAnniversary.cpp [changed mode: 0644->0755]
src/Contact/JSContactEmailAddress.cpp
src/Contact/JSContactGroup.cpp [changed mode: 0644->0755]
src/Contact/JSContactName.cpp
src/Contact/JSContactOrganization.cpp
src/Contact/JSContactPhoneNumber.cpp
src/Contact/JSContactRef.cpp [changed mode: 0644->0755]
src/Contact/JSContactWebSite.cpp
src/Contact/JSPerson.cpp
src/Messaging/Conversation.cpp
src/Messaging/JSMessagingService.cpp
src/Messaging/Messaging.cpp
src/Messaging/Mms.cpp
src/Notification/JSNotificationDetailInfo.cpp
src/Notification/JSNotificationManager.cpp [changed mode: 0644->0755]
src/Notification/JSStatusNotification.cpp
src/Notification/NotificationDetailInfo.h
src/Notification/StatusNotification.cpp
src/Notification/StatusNotification.h
src/Power/PowerManager.cpp
src/Systeminfo/JSDeviceCapabilitiesInfo.cpp
src/Systeminfo/Systeminfo.cpp
src/TimeUtil/DurationProperties.h
src/TimeUtil/JSTZDate.cpp
src/TimeUtil/JSTZDate.h
src/TimeUtil/JSTimeDuration.cpp
src/TimeUtil/JSTimeUtil.cpp
src/TimeUtil/TZDate.cpp
src/TimeUtil/TZDate.h
src/TimeUtil/TimeUtilConverter.cpp
src/TimeUtil/TimeUtilConverter.h

index 58c1415..2625109 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.57
+Version:    0.4.58
 Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 46a7f90..141b250 100644 (file)
 #include "ApplicationController.h"
 #include "ApplicationConverter.h"
 #include "plugin_config.h"
-#include "JSApplicationManager.h"
 #include "JSApplication.h"
 
 #include <TimeTracer.h>
 #include <Export.h>
 #include <Logger.h>
 
+#include <plugins-ipc-message/ipc_message_support.h>
+
 namespace DeviceAPI {
 namespace Application {        
 
@@ -122,7 +123,7 @@ JSValueRef JSApplication::exit(JSContextRef context,
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
        try {
-               JSApplicationManager::setTitleProperty(context, "tizen://exit");
+               IPCMessageSupport::sendAsyncMessageToUiProcess(IPCMessageSupport::TIZEN_EXIT, NULL, NULL, NULL);
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return JSValueMakeUndefined(context);
 
@@ -144,7 +145,7 @@ JSValueRef JSApplication::hide(JSContextRef context,
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
        try {
-               JSApplicationManager::setTitleProperty(context, "tizen://hide");
+               IPCMessageSupport::sendAsyncMessageToUiProcess(IPCMessageSupport::TIZEN_HIDE, NULL, NULL, NULL);
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return JSValueMakeUndefined(context);
 
index 4de7f85..2fdea69 100644 (file)
@@ -52,6 +52,8 @@
 #include <Export.h>
 #include <Logger.h>
 
+#include <plugins-ipc-message/ipc_message_support.h>
+
 namespace DeviceAPI {
 namespace Application {
 
@@ -305,8 +307,8 @@ JSValueRef JSApplicationManager::setUserAgent(JSContextRef context,
         std::string userAgent = validator.toString(0);         
 
                // perform
-               std::string propertyValue = "tizen://changeUA?ua=" + userAgent;
-               setTitleProperty(context, propertyValue);
+               IPCMessageSupport::sendAsyncMessageToUiProcess(IPCMessageSupport::TIZEN_CHANGE_USERAGENT, userAgent.c_str(), NULL, NULL);
+
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return JSValueMakeUndefined(context);
 
@@ -892,6 +894,8 @@ JSValueRef JSApplicationManager::getAppMetaData(JSContextRef context,
     }
 }
 
+
+/* scheme-callback using title is not working on iframe. So, use IPC API instead of below API.
 void JSApplicationManager::setTitleProperty(JSContextRef context, std::string propertyValue){
 
        WrtDeviceApis::CommonsJavaScript::Converter converter(context);
@@ -918,6 +922,7 @@ void JSApplicationManager::setTitleProperty(JSContextRef context, std::string pr
                        kJSPropertyAttributeNone,
                        NULL);
 }
+*/
 
 }
 }
index 9cb9088..873be7c 100644 (file)
@@ -36,7 +36,7 @@ public:
 
        static const JSClassRef getClassRef();
 
-       static void setTitleProperty(JSContextRef context, std::string propertyValue);
+       //static void setTitleProperty(JSContextRef context, std::string propertyValue);
 
 private:
        /**
index 920a6d6..314ec78 100755 (executable)
@@ -833,7 +833,6 @@ CalendarEventPtr CalendarConverter::toItem(const JSValueRef value, bool updateMo
         result->setSubject(toString(summaryData));
     }
 
-    //It's important to set startTime before duration to set end date
     if (!JSValueIsUndefined(m_context, startTimeData) && !JSValueIsNull(m_context, startTimeData)) {
         result->setStartTime((long long int) (timeUtilConverter.getTimeInMilliseconds(startTimeData)/1000));
         result->setTimeZone(timeUtilConverter.getPropertiesInTZDate(startTimeData).timezone);
old mode 100644 (file)
new mode 100755 (executable)
index 0f27ff5..7915f68
@@ -820,7 +820,11 @@ int CalendarFilter::convertStringToIntValue(const std::string attrName, const st
         } else if(valueString=="CONFIRMED") {
             return CALENDAR_EVENT_STATUS_CONFIRMED;
         } else if(valueString=="CANCELLED") {
-            return CALENDAR_EVENT_STATUS_CANCELLED;
+                       if(CalendarEvent::TASK_TYPE==m_type) {
+                               return CALENDAR_TODO_STATUS_CANCELED;
+                       } else {
+                               return CALENDAR_EVENT_STATUS_CANCELLED;
+                       }
         } else if(valueString=="NEEDS_ACTION") {
             return CALENDAR_TODO_STATUS_NEEDS_ACTION;
         } else if(valueString=="IN_PROCESS") {
index b60b730..47fd459 100755 (executable)
@@ -370,7 +370,7 @@ calendar_record_h EventWrapper::convertAbstractEventToPlatformEvent(bool loadBef
     setDescriptionToPlatformEvent();
     setSummaryToPlatformEvent();
     setStartTimeToPlatformEvent();
-    setEndTimeToPlatformEvent(); // replacement for duration
+    setEndTimeToPlatformEvent();
     setLocationToPlatformEvent();
     setCategoriesToPlatformEvent();
     setStatusToPlatformEvent();
@@ -1346,7 +1346,7 @@ CalendarEventPtr EventWrapper::convertPlatformEventToAbstractEvent()
     setDescriptionFromPlatformEvent();
     setSummaryFromPlatformEvent();
     setStartTimeFromPlatformEvent();
-    setEndTimeFromPlatformEvent(); // replace for duration
+    setEndTimeFromPlatformEvent();
     setLocationFromPlatformEvent();
     setCategoriesFromPlatformEvent();
     setStatusFromPlatformEvent();
index b0f9e20..803d450 100755 (executable)
@@ -753,7 +753,7 @@ JSValueRef JSCalendar::find(JSContextRef context,
         if (argumentCount>=3) {
             if (JSValueIsObject(context, arguments[2])) {
                 dplEvent->setGenericFilter(filterConverter->toFilter(arguments[2]));
-            } else if (JSValueIsNull(context, arguments[2]) || JSValueIsUndefined(context, arguments[2])) {
+            } else if (JSValueIsNull(context, arguments[2])) {
                                LoggerD("Use default filter.");
             } else {
                 ThrowMsg(ConversionException, "Wrong third parameter type.");
@@ -765,7 +765,7 @@ JSValueRef JSCalendar::find(JSContextRef context,
                 DeviceAPI::Tizen::SortModeArrayPtr sortModes(new DeviceAPI::Tizen::SortModeArray());
                 sortModes->push_back(filterConverter->toSortMode(arguments[3]));
                 dplEvent->setSortModes(sortModes);
-                       } else if (JSValueIsNull(context, arguments[3]) || JSValueIsUndefined(context, arguments[3])) {
+                       } else if (JSValueIsNull(context, arguments[3])) {
                                LoggerD("Use default sort mode.");
             } else {
                 ThrowMsg(ConversionException, "Wrong fourth parameter type.");
index a0b9144..cef3516 100755 (executable)
@@ -499,11 +499,10 @@ bool JSCalendarEvent::setPropertyRecurrenceRule(JSContextRef context,
         }
 
                if (JSValueIsNull(context, value)) {
-                       EventRecurrenceRulePtr rrule(NULL);
-                       event->setRecurrenceRule(rrule);
-               } else if (JSValueIsUndefined(context, value)) {
                        EventRecurrenceRulePtr rrule( new EventRecurrenceRule() );
                        event->setRecurrenceRule(rrule);
+        } else if (!JSValueIsObjectOfClass(context, value, JSCalendarRecurrenceRule::getClassRef())) {
+            ThrowMsg(ConversionException, "Wrong parameter type.");
                } else {
                event->setRecurrenceRule(JSCalendarRecurrenceRule::getPrivateObject(JSValueToObject(context, value, NULL)));
                }
index 02ff81b..e373f1f 100755 (executable)
@@ -451,11 +451,15 @@ bool JSCalendarItemProperties::setPropertyStartDate(JSContextRef context,
 {
     Try
     {
-        if (!JSValueIsObjectOfClass(context, value, JSTZDate::getClassRef())) {
-            ThrowMsg(ConversionException, "Wrong parameter type.");
-        }
-
         CalendarEventPtr item = getPrivateObject(object);
+
+               if (JSValueIsNull(context, value)) {
+                       item->setStartTime(UNDEFINED_TIME);
+                       return true;
+               } else if (!JSValueIsObjectOfClass(context, value, JSTZDate::getClassRef())) {
+                       ThrowMsg(ConversionException, "Wrong parameter type.");
+               }
+
         TimeUtilConverter timeConverter(context);
 
         long long int startTime = (long long int) (timeConverter.getTimeInMilliseconds(value)/1000);
@@ -777,7 +781,7 @@ bool JSCalendarItemProperties::setPropertyGeolocation(JSContextRef context,
     {
         CalendarEventPtr item = getPrivateObject(object);
 
-               if (JSValueIsNull(context, value) || JSValueIsUndefined(context, value)) {
+               if (JSValueIsNull(context, value)) {
                item->getGeolocation()->setLatitude(UNDEFINED_GEO);
                item->getGeolocation()->setLongitude(UNDEFINED_GEO);
                } else {
@@ -808,22 +812,6 @@ JSValueRef JSCalendarItemProperties::getPropertyDuration(JSContextRef context,
                        LoggerD("Duration length: "<<item->getDuration()->length<<", unit: "<<item->getDuration()->unit);
                        return JSTimeDuration::createJSObject(context, item->getDuration());
                }
-
-               // Alternatively generate the duration object using start/end time.
-               if(UNDEFINED_TIME==item->getStartTime() || UNDEFINED_TIME==item->getEndTime()) {
-                       LoggerD("Start or end time is not defined.");
-                   return JSValueMakeUndefined(context);
-               }
-
-        long long length = item->getEndTime() - item->getStartTime(); // in seconds only
-        LoggerD("item->getStartTime():"<< item->getStartTime() << ", length:" << length);
-
-               DurationPropertiesPtr durationPtr(new DurationProperties());
-               durationPtr->length = length;
-               durationPtr->unit = SECONDS_UNIT;
-               item->setDuration(durationPtr);
-
-               return JSTimeDuration::createJSObject(context, durationPtr);
     }
     Catch(Exception)
     {
@@ -841,6 +829,14 @@ bool JSCalendarItemProperties::setPropertyDuration(JSContextRef context,
     Try
     {
         CalendarEventPtr item = getPrivateObject(object);
+
+               if (JSValueIsNull(context, value)) {
+                       DurationPropertiesPtr duration(new DeviceAPI::Time::DurationProperties());
+                       item->setDuration(duration);
+                       item->setEndTime(UNDEFINED_TIME);
+                       return true;
+               }
+
         TimeUtilConverter timeUtilConverter(context);
 
                DurationPropertiesPtr duration = timeUtilConverter.getDuration(value);
@@ -854,24 +850,7 @@ bool JSCalendarItemProperties::setPropertyDuration(JSContextRef context,
         LoggerD("length: "<<length<< ", unit:" <<unit);
                item->setDuration(duration);
 
-               // Adjust the endDate because the endDate has priority over duration when saving the item.
-           long long int endDate;
-        if( DeviceAPI::Time::SECONDS_UNIT==unit ) {
-            endDate = item->getStartTime() + length;
-        } else if ( DeviceAPI::Time::MINUTES_UNIT==unit ) {
-            endDate = item->getStartTime() + length*60;
-        } else if ( DeviceAPI::Time::HOURS_UNIT==unit ) {
-            endDate = item->getStartTime() + length*60*60;
-        } else if ( DeviceAPI::Time::DAYS_UNIT==unit ) {
-            endDate = item->getStartTime() + length*24*60*60;
-        } else if ( DeviceAPI::Time::MSECS_UNIT==unit ) {
-            endDate = item->getStartTime() + length/1000;
-        } else {
-            LoggerW("Wrong duration unit: "<<unit);
-                       return true;
-        }
-               item->setEndTime(endDate);
-               LoggerD("Set the endDate from the duration: "<<endDate);
+               item->setEndTime(UNDEFINED_TIME);
 
         return true;
     }
@@ -1018,7 +997,11 @@ bool JSCalendarItemProperties::setPropertyDueDate(JSContextRef context,
         if(CalendarEvent::TASK_TYPE != task->getCalendarType()) {
             ThrowMsg(InvalidArgumentException, "Wrong type of calendar.");
         }
-        if (!JSValueIsObjectOfClass(context, value, JSTZDate::getClassRef())) {
+
+               if (JSValueIsNull(context, value)) {
+                       task->setEndTime(UNDEFINED_TIME);
+                       return true;
+        } else if (!JSValueIsObjectOfClass(context, value, JSTZDate::getClassRef())) {
             ThrowMsg(ConversionException, "Wrong parameter type.");
         }
 
@@ -1027,6 +1010,9 @@ bool JSCalendarItemProperties::setPropertyDueDate(JSContextRef context,
 
         task->setEndTime(dueDate);
 
+               DurationPropertiesPtr duration(new DeviceAPI::Time::DurationProperties());
+               task->setDuration(duration);
+
         if( task->getTimeZone().empty() ) {
             std::string timeZone = converter.getPropertiesInTZDate(value).timezone;
             task->setTimeZone(timeZone);
@@ -1133,7 +1119,11 @@ bool JSCalendarItemProperties::setPropertyEndDate(JSContextRef context,
         if(CalendarEvent::EVENT_TYPE != event->getCalendarType()) {
             ThrowMsg(InvalidArgumentException, "Wrong calendar type.");
         }
-        if (!JSValueIsObjectOfClass(context, value, JSTZDate::getClassRef())) {
+
+               if (JSValueIsNull(context, value)) {
+                       event->setEndTime(UNDEFINED_TIME);
+                       return true;
+               } else if (!JSValueIsObjectOfClass(context, value, JSTZDate::getClassRef())) {
             ThrowMsg(ConversionException, "Wrong parameter type.");
         }
 
@@ -1142,6 +1132,9 @@ bool JSCalendarItemProperties::setPropertyEndDate(JSContextRef context,
 
         event->setEndTime(endDate);
 
+               DurationPropertiesPtr duration(new DeviceAPI::Time::DurationProperties());
+               event->setDuration(duration);
+
         if( event->getTimeZone().empty() ) {
             std::string timeZone = converter.getPropertiesInTZDate(value).timezone;
             event->setTimeZone(timeZone);
index 812f90a..155c4fc 100755 (executable)
@@ -309,7 +309,10 @@ bool JSCalendarTask::setPropertyCompletedDate(JSContextRef context,
             ThrowMsg(NullPointerException, "Task object is NULL.");
         }
 
-        if (!JSValueIsObjectOfClass(context, value, JSTZDate::getClassRef())) {
+               if (JSValueIsNull(context, value)) {
+                       task->setCompletedDate(UNDEFINED_TIME);
+                       return true;
+        } else if (!JSValueIsObjectOfClass(context, value, JSTZDate::getClassRef())) {
             ThrowMsg(ConversionException, "Wrong parameter type.");
         }
 
index 139bfbe..280a0da 100755 (executable)
@@ -693,7 +693,7 @@ JSValueRef JSAddressBook::updateBatch(JSContextRef context,
                dplEvent->setContacts(converter->toContactArray(arguments[0]));
        } Catch(ConversionException) {
                LoggerE("Error on conversion : " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "3rd argument must be an array of 'Contact object'");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "First argument must be an array of 'Contact object'");
        }
 
        // set event handler's data
index b26820e..c2cf3c9 100755 (executable)
@@ -221,7 +221,7 @@ JSObjectRef JSContact::constructor(JSContextRef context,
                else
                {
                        LoggerE("Argument type mismatch : 1nd argument must be ContactInit object or string");
-                       *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "2nd argument must be 'ContactTextFormat'");
+//                     *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "2nd argument must be 'ContactTextFormat'");
                        return NULL;
                }
        }
@@ -236,11 +236,11 @@ JSObjectRef JSContact::constructor(JSContextRef context,
 
                } Catch(ConversionException) {
                        LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-                       *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be 'ContactInit object'");
+//                     *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be 'ContactInit object'");
                        return NULL;
                } Catch(Exception) {
                        LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-                       *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
+//                     *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
                        return NULL;
                }
        }
@@ -256,19 +256,19 @@ JSObjectRef JSContact::constructor(JSContextRef context,
 
                } Catch(ConversionException) {
                        LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-                       *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "2nd argument must be 'ContactTextFormat'");
+//                     *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "2nd argument must be 'ContactTextFormat'");
                        return NULL;
                } Catch(InvalidArgumentException) {
                        LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-                       *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "1st argument must be vCard string");
+//                     *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "1st argument must be vCard string");
                        return NULL;
                } Catch(UnsupportedException) {
                        LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-                       *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR, "Only support vCard 3.0");
+//                     *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR, "Only support vCard 3.0");
                        return NULL;
                } Catch(Exception) {
                        LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-                       *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
+//                     *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
                        return NULL;
                }
        }
@@ -278,7 +278,7 @@ JSObjectRef JSContact::constructor(JSContextRef context,
                        contact = ContactFactory::getInstance().createContact();
                } Catch(Exception) {
                        LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-                       *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
+//                     *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
                        return NULL;
                }
        }
@@ -289,7 +289,7 @@ JSObjectRef JSContact::constructor(JSContextRef context,
                jsobject = createJSObject(gContext, contact);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
                return NULL;
        }
 
@@ -455,14 +455,14 @@ bool JSContact::setName(JSContextRef context,
                ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contact->unsetName();
+                       return true;//contact->unsetName();
                else
                        contact->setName(converter->toContactName(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -524,7 +524,7 @@ bool JSContact::setAddresses(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -567,14 +567,14 @@ bool JSContact::setPhotoURI(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contact->unsetPhotoURI();
+                       return true;//contact->unsetPhotoURI();
                else
                        contact->setPhotoURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -636,7 +636,7 @@ bool JSContact::setPhoneNumbers(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -700,7 +700,7 @@ bool JSContact::setEmails(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -743,14 +743,14 @@ bool JSContact::setBirthday(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contact->unsetBirthday();
+                       return true;//contact->unsetBirthday();
                else
                        contact->setBirthday(converter->toDateTm(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -813,7 +813,7 @@ bool JSContact::setAnniversaries(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -876,7 +876,7 @@ bool JSContact::setOrganizations(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -945,7 +945,7 @@ bool JSContact::setNotes(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -1008,7 +1008,7 @@ bool JSContact::setUrls(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -1051,14 +1051,14 @@ bool JSContact::setRingtoneURI(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contact->unsetRingtoneURI();
+                       return true;//contact->unsetRingtoneURI();
                else
                        contact->setRingtoneURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -1122,7 +1122,7 @@ bool JSContact::setGroupIds(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
index 2c9b9f8..12c11cf 100755 (executable)
@@ -191,7 +191,7 @@ JSObjectRef JSContactAddress::constructor(JSContextRef context,
 
        } Catch(Exception ) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be a 'ContactAddressInit object'");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be a 'ContactAddressInit object'");
                return NULL;
        }
 
@@ -207,7 +207,7 @@ JSObjectRef JSContactAddress::constructor(JSContextRef context,
 
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be a 'ContactAddressInit object'");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be a 'ContactAddressInit object'");
                return NULL;
        }
 
@@ -217,7 +217,7 @@ JSObjectRef JSContactAddress::constructor(JSContextRef context,
                jsobject = createJSObject(gContext, contactAddress);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
                return NULL;
        }
 
@@ -268,14 +268,14 @@ bool JSContactAddress::setCountry(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactAddress->unsetCountry();
+                       return true;//contactAddress->unsetCountry();
                else
                        contactAddress->setCountry(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -317,14 +317,14 @@ bool JSContactAddress::setRegion(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactAddress->unsetRegion();
+                       return true;//contactAddress->unsetRegion();
                else
                        contactAddress->setRegion(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -365,14 +365,14 @@ bool JSContactAddress::setCity(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactAddress->unsetCity();
+                       return true;//contactAddress->unsetCity();
                else
                        contactAddress->setCity(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -414,14 +414,14 @@ bool JSContactAddress::setStreetAddress(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactAddress->unsetStreetAddress();
+                       return true;//contactAddress->unsetStreetAddress();
                else
                        contactAddress->setStreetAddress(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -463,14 +463,14 @@ bool JSContactAddress::setAdditionalInformation(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactAddress->unsetAdditionalInformation();
+                       return true;//contactAddress->unsetAdditionalInformation();
                else
                        contactAddress->setAdditionalInformation(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -512,14 +512,14 @@ bool JSContactAddress::setPostalCode(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactAddress->unsetPostalCode();
+                       return true;//contactAddress->unsetPostalCode();
                else
                        contactAddress->setPostalCode(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -562,7 +562,7 @@ bool JSContactAddress::setIsDefault(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -623,7 +623,7 @@ bool JSContactAddress::setTypes(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -661,12 +661,15 @@ bool JSContactAddress::setLabel(JSContextRef context,
                ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               contactAddress->setLabel(converter->toString(value));
+               if(validator->isNullOrUndefined(value))
+                       return true;//contactAddress->unsetLabel();
+               else
+                       contactAddress->setLabel(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
old mode 100644 (file)
new mode 100755 (executable)
index 2009e85..330b7ff
@@ -174,16 +174,16 @@ JSObjectRef JSContactAnniversary::constructor(JSContextRef context,
                        contactAnniversary->setLabel(label);
                }
        } catch (const TypeMismatchException& err ) {
-               JSWebAPIErrorFactory::postException(context, exception, err);
+//             JSWebAPIErrorFactory::postException(context, exception, err);
                return NULL;
        } catch(const BasePlatformException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, err);
+//             JSWebAPIErrorFactory::postException(context, exception, err);
                return NULL;
        } catch(const ConversionException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
                return NULL;
        } catch(const NullPointerException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
                return NULL;
        }
 
@@ -193,7 +193,7 @@ JSObjectRef JSContactAnniversary::constructor(JSContextRef context,
                contactAnniversary->setDate(date);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be a 'Date object'");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be a 'Date object'");
                return NULL;
        }
 
@@ -203,7 +203,7 @@ JSObjectRef JSContactAnniversary::constructor(JSContextRef context,
                jsobject = createJSObject(gContext, contactAnniversary);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
                return NULL;
        }
 
@@ -253,7 +253,7 @@ bool JSContactAnniversary::setDate(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -294,14 +294,14 @@ bool JSContactAnniversary::setLabel(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       anniversary->unsetLabel();
+                       return true;//anniversary->unsetLabel();
                else
                        anniversary->setLabel(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
index c1b527c..d4b0d2a 100755 (executable)
@@ -192,16 +192,16 @@ JSObjectRef JSContactEmailAddress::constructor(JSContextRef context,
                        label = Argvalidator.toString(3, false);
 
        } catch (const TypeMismatchException& err ) {
-               JSWebAPIErrorFactory::postException(context, exception, err);
+//             JSWebAPIErrorFactory::postException(context, exception, err);
                return NULL;
        } catch(const BasePlatformException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, err);
+//             JSWebAPIErrorFactory::postException(context, exception, err);
                return NULL;
        } catch(const ConversionException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
                return NULL;
        } catch(const NullPointerException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
                return NULL;
        }
 
@@ -267,7 +267,7 @@ bool JSContactEmailAddress::setEmail(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -310,7 +310,7 @@ bool JSContactEmailAddress::setIsDefault(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -372,7 +372,7 @@ bool JSContactEmailAddress::setTypes(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -410,7 +410,7 @@ bool JSContactEmailAddress::setLabel(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
old mode 100644 (file)
new mode 100755 (executable)
index e39e517..7210e73
@@ -186,16 +186,16 @@ JSObjectRef JSContactGroup::constructor(JSContextRef context,
                        contactGroup->setPhotoURI(Argvalidator.toString(2, true));
 
        } catch (const TypeMismatchException& err ) {
-               JSWebAPIErrorFactory::postException(context, exception, err);
+//             JSWebAPIErrorFactory::postException(context, exception, err);
                return NULL;
        } catch(const BasePlatformException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, err);
+//             JSWebAPIErrorFactory::postException(context, exception, err);
                return NULL;
        } catch(const ConversionException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
                return NULL;
        } catch(const NullPointerException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
                return NULL;
        }
 
@@ -205,7 +205,7 @@ JSObjectRef JSContactGroup::constructor(JSContextRef context,
                jsobject = createJSObject(gContext, contactGroup);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
                return NULL;
        }
 
@@ -257,7 +257,7 @@ bool JSContactGroup::setId(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactGroup->unsetId();
+                       return true;//contactGroup->unsetId();
                else
                        contactGroup->setId(converter->toString(value));
                return true;
@@ -308,14 +308,14 @@ bool JSContactGroup::setAddressBookId(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactGroup->unsetAddressBookId();
+                       return true;//contactGroup->unsetAddressBookId();
                else
                        contactGroup->setAddressBookId(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -358,14 +358,14 @@ bool JSContactGroup::setName(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactGroup->unsetName();
+                       return true;//contactGroup->unsetName();
                else
                        contactGroup->setName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -408,14 +408,14 @@ bool JSContactGroup::setRingtoneURI(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactGroup->unsetRingtoneURI();
+                       return true;//contactGroup->unsetRingtoneURI();
                else
                        contactGroup->setRingtoneURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -458,14 +458,14 @@ bool JSContactGroup::setPhotoURI(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactGroup->unsetRingtoneURI();
+                       return true;//contactGroup->unsetRingtoneURI();
                else
                        contactGroup->setPhotoURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
index c304ac9..a001a5d 100755 (executable)
@@ -201,7 +201,7 @@ JSObjectRef JSContactName::constructor(JSContextRef context,
 
        } Catch(Exception ) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be 'object'");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be 'object'");
                return NULL;
        }
 
@@ -216,7 +216,7 @@ JSObjectRef JSContactName::constructor(JSContextRef context,
 
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
                return NULL;
        }
 
@@ -226,7 +226,7 @@ JSObjectRef JSContactName::constructor(JSContextRef context,
                jsobject = createJSObject(gContext, contactName);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
                return NULL;
        }
 
@@ -278,14 +278,14 @@ bool JSContactName::setPrefix(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactName->unsetPrefix();
+                       return true;//contactName->unsetPrefix();
                else
                        contactName->setPrefix(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -326,14 +326,14 @@ bool JSContactName::setSuffix(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactName->unsetSuffix();
+                       return true;//contactName->unsetSuffix();
                else
                        contactName->setSuffix(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -373,14 +373,14 @@ bool JSContactName::setFirstName(JSContextRef context,
                ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactName->unsetFirstName();
+                       return true;//contactName->unsetFirstName();
                else
                        contactName->setFirstName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -423,14 +423,14 @@ bool JSContactName::setMiddleName(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactName->unsetMiddleName();
+                       return true;//contactName->unsetMiddleName();
                else
                        contactName->setMiddleName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -473,14 +473,14 @@ bool JSContactName::setLastName(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactName->unsetLastName();
+                       return true;//contactName->unsetLastName();
                else
                        contactName->setLastName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -542,7 +542,7 @@ bool JSContactName::setNicknames(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -604,14 +604,14 @@ bool JSContactName::setPhoneticFirstName(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactName->unsetPhoneticFirstName();
+                       return true;//contactName->unsetPhoneticFirstName();
                else
                        contactName->setPhoneticFirstName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -654,14 +654,14 @@ bool JSContactName::setPhoneticMiddleName(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactName->unsetPhoneticMiddleName();
+                       return true;//contactName->unsetPhoneticMiddleName();
                else
                        contactName->setPhoneticMiddleName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -704,14 +704,14 @@ bool JSContactName::setPhoneticLastName(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       contactName->unsetPhoneticLastName();
+                       return true;//contactName->unsetPhoneticLastName();
                else
                        contactName->setPhoneticLastName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
index 39ceb8f..a0b5e1e 100755 (executable)
@@ -196,7 +196,7 @@ JSObjectRef JSContactOrganization::constructor(JSContextRef context,
 
        } Catch(Exception ) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be a 'object'");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "1st argument must be a 'object'");
                return NULL;
        }
 
@@ -211,7 +211,7 @@ JSObjectRef JSContactOrganization::constructor(JSContextRef context,
 
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
                return NULL;
        }
 
@@ -221,7 +221,7 @@ JSObjectRef JSContactOrganization::constructor(JSContextRef context,
                jsobject = createJSObject(gContext, contactOrganization);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
                return NULL;
        }
 
@@ -272,14 +272,14 @@ bool JSContactOrganization::setName(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetName();
+                       return true;//organization->unsetName();
                else
                        organization->setName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -321,14 +321,14 @@ bool JSContactOrganization::setDepartment(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetDepartment();
+                       return true;//organization->unsetDepartment();
                else
                        organization->setDepartment(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -369,14 +369,14 @@ bool JSContactOrganization::setTitle(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetTitle();
+                       return true;//organization->unsetTitle();
                else
                        organization->setTitle(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -417,14 +417,14 @@ bool JSContactOrganization::setRole(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetRole();
+                       return true;//organization->unsetRole();
                else
                        organization->setRole(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -465,14 +465,14 @@ bool JSContactOrganization::setLogoURI(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetLogoURI();
+                       return true;//organization->unsetLogoURI();
                else
                        organization->setLogoURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -513,14 +513,14 @@ bool JSContactOrganization::setAssistant(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetAssistant();
+                       return true;//organization->unsetAssistant();
                else
                        organization->setAssistant(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -558,14 +558,14 @@ bool JSContactOrganization::setLocation(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetLocation();
+                       return true;//organization->unsetLocation();
                else
                        organization->setLocation(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -606,14 +606,14 @@ bool JSContactOrganization::setDescription(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetDescription();
+                       return true;//organization->unsetDescription();
                else
                        organization->setDescription(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -654,14 +654,14 @@ bool JSContactOrganization::setPhoneticName(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetPhoneticName();
+                       return true;//organization->unsetPhoneticName();
                else
                        organization->setPhoneticName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -702,14 +702,14 @@ bool JSContactOrganization::setType(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetType();
+                       return true;//organization->unsetType();
                else
                        organization->setType(converter->toContactOrganizationType(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -747,14 +747,14 @@ bool JSContactOrganization::setLabel(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       organization->unsetLabel();
+                       return true;//organization->unsetLabel();
                else
                        organization->setLabel(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
index 557b2c9..4446b00 100755 (executable)
@@ -190,16 +190,16 @@ JSObjectRef JSContactPhoneNumber::constructor(JSContextRef context,
                        label = Argvalidator.toString(3, false);
 
        } catch (const TypeMismatchException& err ) {
-               JSWebAPIErrorFactory::postException(context, exception, err);
+//             JSWebAPIErrorFactory::postException(context, exception, err);
                return NULL;
        } catch(const BasePlatformException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, err);
+//             JSWebAPIErrorFactory::postException(context, exception, err);
                return NULL;
        } catch(const ConversionException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
                return NULL;
        } catch(const NullPointerException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
                return NULL;
        }
 
@@ -215,7 +215,7 @@ JSObjectRef JSContactPhoneNumber::constructor(JSContextRef context,
                jsobject = createJSObject(gContext, contactPhoneNumber);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
                return NULL;
        }
 
@@ -265,7 +265,7 @@ bool JSContactPhoneNumber::setNumber(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -310,7 +310,7 @@ bool JSContactPhoneNumber::setIsDefault(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -370,7 +370,7 @@ bool JSContactPhoneNumber::setTypes(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -409,7 +409,7 @@ bool JSContactPhoneNumber::setLabel(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
old mode 100644 (file)
new mode 100755 (executable)
index dc74feb..3b75596
@@ -181,7 +181,7 @@ JSObjectRef JSContactRef::constructor(JSContextRef context,
 
        } Catch(Exception ) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Wrong arguments");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Wrong arguments");
                return NULL;
        }
 
@@ -194,7 +194,7 @@ JSObjectRef JSContactRef::constructor(JSContextRef context,
                addressBookId = converter->toString(arguments[0]);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
                return NULL;
        }
 
@@ -202,7 +202,7 @@ JSObjectRef JSContactRef::constructor(JSContextRef context,
                contactId = converter->toString(arguments[1]);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
                return NULL;
        }
 
@@ -216,7 +216,7 @@ JSObjectRef JSContactRef::constructor(JSContextRef context,
                jsobject = createJSObject(gContext, contactRef);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
                return NULL;
        }
 
@@ -270,7 +270,7 @@ bool JSContactRef::setAddressBookId(JSContextRef context,
                LoggerW("trying to set incorrect value");
        }
 
-       JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//     JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        return false;
 }
 
@@ -313,7 +313,7 @@ bool JSContactRef::setContactId(JSContextRef context,
                LoggerW("trying to set incorrect value");
        }
 
-       JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//     JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        return false;
 }
 
index 588fd26..5301aeb 100755 (executable)
@@ -182,16 +182,16 @@ JSObjectRef JSContactWebSite::constructor(JSContextRef context,
                }
 
        } catch (const TypeMismatchException& err ) {
-               JSWebAPIErrorFactory::postException(context, exception, err);
+//             JSWebAPIErrorFactory::postException(context, exception, err);
                return NULL;
        } catch(const BasePlatformException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, err);
+//             JSWebAPIErrorFactory::postException(context, exception, err);
                return NULL;
        } catch(const ConversionException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
                return NULL;
        } catch(const NullPointerException& err) {
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "");
                return NULL;
        }
 
@@ -206,7 +206,7 @@ JSObjectRef JSContactWebSite::constructor(JSContextRef context,
                jsobject = createJSObject(gContext, contactWebSite);
        } Catch(Exception) {
                LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
+//             *exception = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong arguments");
                return NULL;
        }
 
@@ -256,7 +256,7 @@ bool JSContactWebSite::setUrl(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -299,7 +299,7 @@ bool JSContactWebSite::setType(JSContextRef context,
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       webSite->unsetType();
+                       return true;//webSite->unsetType();
                else
                {
                        ContactWebSiteType type = converter->toContactWebSiteType(converter->toString(value));
@@ -309,7 +309,7 @@ bool JSContactWebSite::setType(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
@@ -347,7 +347,7 @@ bool JSContactWebSite::setLabel(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
        return true;
 }
index 88a97af..0d2acdd 100755 (executable)
@@ -325,7 +325,7 @@ bool JSPerson::setIsFavorite(JSContextRef context,
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -367,14 +367,14 @@ bool JSPerson::setPhotoURI(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       person->unsetPhotoURI();
+                       return true;//person->unsetPhotoURI();
                else
                        person->setPhotoURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -416,14 +416,14 @@ bool JSPerson::setRingtoneURI(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       person->unsetRingtoneURI();
+                       return true;//person->unsetRingtoneURI();
                else
                        person->setRingtoneURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
@@ -463,14 +463,14 @@ bool JSPerson::setDisplayContactId(JSContextRef context,
                ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
-                       person->unsetDisplayContactId();
+                       return true;//person->unsetDisplayContactId();
                else
                        person->setDisplayContactId(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
                LoggerW("trying to set incorrect value");
-               JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
+//             JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch");
        }
 
        return true;
index 19ab7c7..462cb84 100644 (file)
@@ -41,10 +41,11 @@ Conversation::Conversation()
 Conversation::Conversation(unsigned int threadId, MessageType msgType)
 {
        LoggerD("Enter");
+       bool result = false;
        
        if (msgType == EMAIL)
        {
-               makeConversationFromEmailThreadId(threadId);
+               result = makeConversationFromEmailThreadId(threadId);
        }
        else if((msgType == EMPTY_MESSAGE_CONVERSATION)||(msgType == EMPTY_EMAIL_CONVERSATION))
        {
@@ -52,7 +53,13 @@ Conversation::Conversation(unsigned int threadId, MessageType msgType)
        }
        else
        {
-               makeConversationFromMsgId(threadId, msgType);
+               result = makeConversationFromMsgId(threadId, msgType);
+       }
+
+       if(result == false)
+       {
+               LoggerE("fail to make conversation");
+               ThrowMsg(WrtDeviceApis::Commons::PlatformException,     "fail to make conversation");
        }
 }
        
@@ -69,6 +76,7 @@ Conversation::Conversation(std::string threadId, MessageType msgType)
        result = makeConversationFromMsgId(number, msgType);
        if(result == FALSE)
        {
+               LoggerE("fail to make conversation");
                ThrowMsg(WrtDeviceApis::Commons::PlatformException,     "fail to make conversation");
        }
 }
@@ -495,7 +503,8 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg
 
        msg_struct_t msg_thread = NULL;
 
-       msg_struct_list_s convViewList;
+//     msg_struct_list_s convViewList;
+       msg_struct_list_s msgList;
        msg_struct_list_s *addr_list = NULL;
        
        msg_error_t err = MSG_SUCCESS;
@@ -516,7 +525,7 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg
                //      get msg from msgId
                msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
                sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT);
-               
+
                if (msg_get_message(handle, (msg_message_id_t)msgId, msgInfo, sendOpt) != MSG_SUCCESS)
                {
                        ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get message fail");
@@ -573,7 +582,9 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg
                }
                LoggerD("m_preview : " << m_preview);
 
-               err = msg_get_conversation_view_list(handle, m_Id, &convViewList);
+
+//             err = msg_get_conversation_view_list(handle, m_Id, &convViewList);
+               err = msg_get_message_list(handle, 0, m_Id, 0, 0, &msgList);
                        
                if (err != MSG_SUCCESS)
                {
@@ -581,17 +592,21 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg
                }
 
                //      get thread message count
-               lastMsgIndex = convViewList.nCount - 1;
-               m_messageCount = convViewList.nCount;
+//             lastMsgIndex = convViewList.nCount - 1;
+//             m_messageCount = convViewList.nCount;
+               lastMsgIndex = msgList.nCount - 1;
+               m_messageCount = msgList.nCount;
                LoggerD("m_messageCount : " << m_messageCount);
 
                //      get thread read status
-               msg_get_bool_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_READ_BOOL, &tempBool);
+//             msg_get_bool_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_READ_BOOL, &tempBool);
+               msg_get_bool_value(msgList.msg_struct_info[lastMsgIndex], MSG_MESSAGE_READ_BOOL, &tempBool);
                m_read = tempBool;
                LoggerD("m_read : " << m_read);
 
                //      get thread last message Id
-               msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_ID_INT, &tempInt);
+//             msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_ID_INT, &tempInt);
+               msg_get_int_value(msgList.msg_struct_info[lastMsgIndex], MSG_MESSAGE_ID_INT, &tempInt);
                m_lastMessageId = tempInt;
                LoggerD("m_lastMessageId : " << m_lastMessageId);
 
@@ -601,7 +616,8 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg
                        ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get message fail");
                }
 
-               msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_DIRECTION_INT, &tempInt);
+//             msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_DIRECTION_INT, &tempInt);
+               msg_get_int_value(msgList.msg_struct_info[lastMsgIndex], MSG_MESSAGE_DIRECTION_INT, &tempInt);
                int type = tempInt;
                LoggerD("direction : " << type);
                m_direction = type;
@@ -678,7 +694,8 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg
                LoggerE("Exception: " << ex.GetMessage());
        }
 
-       msg_release_list_struct(&convViewList);
+//     msg_release_list_struct(&convViewList);
+       msg_release_list_struct(&msgList);
        msg_release_struct(&msgInfo);
        msg_release_struct(&sendOpt);
        msg_release_struct(&msg_thread);
index b64d599..87bc9c8 100644 (file)
@@ -540,6 +540,16 @@ JSValueRef JSMessagingService::loadMessageBody(JSContextRef context,
         }
         IMessagePtr msg = converter->toIMessage(messageArg);
 
+        if (msg->getMessageType() != priv->getObject()->getType()) {
+            std::ostringstream str;
+            str << "Message type: "
+                << msg->getMessageType()
+                << " doesn't match message service type: "
+                << priv->getObject()->getType();
+            LoggerW(str.str());
+            throw DeviceAPI::Common::TypeMismatchException(str.str().c_str());
+        }
+
         // argu 2. Success callback
         callbackManager->setOnSuccess(validator.toFunction(1));
 
index 28c9e72..75a2dd0 100644 (file)
@@ -1296,256 +1296,260 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event)
        EventMessageReceivedPtr jsEvent(new EventMessageReceived());
        DBus::MessagePtr message = event.GetArg0();
 
-       if (!message) 
-       {
-               jsEvent->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::PlatformException);
-               m_onMessageReceived.emit(jsEvent);
-       } 
-       else 
-       {
-               if (message->getInterface() == DBUS_INTERFACE_EMAIL_RECEIVED) 
-               {
-                       int account_id = 0, mail_id = 0, thread_id = 0, status = 0;
-                       std::string name;
-                       email_mailbox_t m_mailboxes;            
+       Try {
 
-                       DBus::Message::ReadIterator it = message->getReadIterator();
-                       for (int i = 0; it->isValid(); it->next(), ++i) 
+               if (!message)
+               {
+                       jsEvent->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::PlatformException);
+                       m_onMessageReceived.emit(jsEvent);
+               }
+               else
+               {
+                       if (message->getInterface() == DBUS_INTERFACE_EMAIL_RECEIVED)
                        {
-                               if ((i == 0) && (it->getArgType() == DBUS_TYPE_INT32)) 
-                               {
-                                       status = it->getInt();
-                                       LoggerI("status: " << status);                                  
-                               } 
-                               else if ((i == 1) && (it->getArgType() == DBUS_TYPE_INT32)) 
-                               {
-                                       account_id = it->getInt();
-                                       LoggerI("account_id: " << account_id);                                  
-                               } 
-                               else if ((i == 2) && (it->getArgType() == DBUS_TYPE_INT32)) 
-                               {
-                                       mail_id = it->getInt();
-                                       LoggerI("mail_id: " << mail_id);                                                                                
-                               } 
-                               else if ((i == 3) && (it->getArgType() == DBUS_TYPE_STRING)) 
-                               {
-                                       name = it->getString();
-                                       LoggerI("name: " << name);                                                                              
-                               } 
-                               else if ((i == 4) && (it->getArgType() == DBUS_TYPE_INT32)) 
+                               int account_id = 0, mail_id = 0, thread_id = 0, status = 0;
+                               std::string name;
+                               email_mailbox_t m_mailboxes;
+
+                               DBus::Message::ReadIterator it = message->getReadIterator();
+                               for (int i = 0; it->isValid(); it->next(), ++i)
                                {
-                                       thread_id = it->getInt();
-                                       LoggerI("thread_id: " << thread_id);                                                                            
+                                       if ((i == 0) && (it->getArgType() == DBUS_TYPE_INT32))
+                                       {
+                                               status = it->getInt();
+                                               LoggerI("status: " << status);
+                                       }
+                                       else if ((i == 1) && (it->getArgType() == DBUS_TYPE_INT32))
+                                       {
+                                               account_id = it->getInt();
+                                               LoggerI("account_id: " << account_id);
+                                       }
+                                       else if ((i == 2) && (it->getArgType() == DBUS_TYPE_INT32))
+                                       {
+                                               mail_id = it->getInt();
+                                               LoggerI("mail_id: " << mail_id);
+                                       }
+                                       else if ((i == 3) && (it->getArgType() == DBUS_TYPE_STRING))
+                                       {
+                                               name = it->getString();
+                                               LoggerI("name: " << name);
+                                       }
+                                       else if ((i == 4) && (it->getArgType() == DBUS_TYPE_INT32))
+                                       {
+                                               thread_id = it->getInt();
+                                               LoggerI("thread_id: " << thread_id);
+                                       }
                                }
-                       }
 
-                       jsEvent->setMsg_Type(EMAIL);
-                       jsEvent->setAccount_Id(account_id);
+                               jsEvent->setMsg_Type(EMAIL);
+                               jsEvent->setAccount_Id(account_id);
 
-                       if ((mail_id > 0) && (NOTI_MAIL_ADD == status)) 
-                       { // TODO also RECEIVE_THREAD_ITEM?
-                               LoggerI("Email received. mail_id: " << mail_id);
+                               if ((mail_id > 0) && (NOTI_MAIL_ADD == status))
+                               { // TODO also RECEIVE_THREAD_ITEM?
+                                       LoggerI("Email received. mail_id: " << mail_id);
 
-                               IMessagePtr msg = MessageFactory::createMessage(EMAIL, mail_id);
-                               IConversationPtr conversation(new Conversation(thread_id, EMAIL));
+                                       IMessagePtr msg = MessageFactory::createMessage(EMAIL, mail_id);
+                                       IConversationPtr conversation(new Conversation(thread_id, EMAIL));
 
-                               // TODO Temporary fix: ignore messages from OUTBOX, SENTBOX & DRAFTBOX -> most probably we added them
-                               FolderType folder = msg->getCurrentFolder();
-                               jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
+                                       // TODO Temporary fix: ignore messages from OUTBOX, SENTBOX & DRAFTBOX -> most probably we added them
+                                       FolderType folder = msg->getCurrentFolder();
+                                       jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
 
-                               LoggerI("Added message is in folder: " << folder);
+                                       LoggerI("Added message is in folder: " << folder);
 
-                               jsEvent->setMessage(msg);
-                               jsEvent->setConversation(conversation);
-                               
-                               if(m_onMessageReceived.size() > 0){
-                                       m_onMessageReceived.emit(jsEvent);
-                               }
-                               
-                               if(m_onConversationReceived.size() > 0){
-                                       if(mail_id != thread_id)
-                                       {
-                                               jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+                                       jsEvent->setMessage(msg);
+                                       jsEvent->setConversation(conversation);
+
+                                       if(m_onMessageReceived.size() > 0){
+                                               m_onMessageReceived.emit(jsEvent);
                                        }
-                                       m_onConversationReceived.emit(jsEvent);
-                               }
-                       }
-                       else if ((name.size() > 0) && (NOTI_MAIL_DELETE == status))
-                       { // TODO also RECEIVE_THREAD_ITEM?
-                               LoggerI("name.size(): " << name.size());
 
-                               unsigned foundLocation = name.rfind(0x01);
-                               LoggerI("foundLocation: " << foundLocation);
-                               if(foundLocation != std::string::npos)
-                               {
-                                       LoggerI("name: " << name);
-                                       name = name.substr(foundLocation+1);
-                                       LoggerI("name: " << name);
+                                       if(m_onConversationReceived.size() > 0){
+                                               if(mail_id != thread_id)
+                                               {
+                                                       jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+                                               }
+                                               m_onConversationReceived.emit(jsEvent);
+                                       }
                                }
+                               else if ((name.size() > 0) && (NOTI_MAIL_DELETE == status))
+                               { // TODO also RECEIVE_THREAD_ITEM?
+                                       LoggerI("name.size(): " << name.size());
 
-                               std::vector<std::string> strIds = String::split(name, ',');
-
-                               std::stringstream stream;
-                               for (std::vector<std::string>::iterator it = strIds.begin(); it != strIds.end(); ++it)
-                               {
-                                       LoggerD("ID is :" << *it);
-
-                                       if ( (*it).length() > 0 ) //vaild id
+                                       unsigned foundLocation = name.rfind(0x01);
+                                       LoggerI("foundLocation: " << foundLocation);
+                                       if(foundLocation != std::string::npos)
                                        {
-                                               stream<< *it;
-                                               int id;
-                                               stream >> id;
-
-                                               IMessagePtr msg = MessageFactory::createMessage(EMPTY_MESSAGE, id);
-                                               IConversationPtr conversation(new Conversation(mail_id, EMPTY_EMAIL_CONVERSATION));
+                                               LoggerI("name: " << name);
+                                               name = name.substr(foundLocation+1);
+                                               LoggerI("name: " << name);
+                                       }
 
-                                               FolderType folder = msg->getCurrentFolder();
-                                               jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_DELETED);
+                                       std::vector<std::string> strIds = String::split(name, ',');
 
-                                               if (true) { // if (OUTBOX != folder && SENTBOX != folder && DRAFTBOX != folder)
-                                                       jsEvent->setMessage(msg);
-                                                       jsEvent->setConversation(conversation);
-                                                       if(m_onMessageReceived.size() > 0){
-                                                               m_onMessageReceived.emit(jsEvent);
+                                       std::stringstream stream;
+                                       for (std::vector<std::string>::iterator it = strIds.begin(); it != strIds.end(); ++it)
+                                       {
+                                               LoggerD("ID is :" << *it);
+
+                                               if ( (*it).length() > 0 ) //vaild id
+                                               {
+                                                       stream<< *it;
+                                                       int id;
+                                                       stream >> id;
+
+                                                       IMessagePtr msg = MessageFactory::createMessage(EMPTY_MESSAGE, id);
+                                                       IConversationPtr conversation(new Conversation(mail_id, EMPTY_EMAIL_CONVERSATION));
+
+                                                       FolderType folder = msg->getCurrentFolder();
+                                                       jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_DELETED);
+
+                                                       if (true) { // if (OUTBOX != folder && SENTBOX != folder && DRAFTBOX != folder)
+                                                               jsEvent->setMessage(msg);
+                                                               jsEvent->setConversation(conversation);
+                                                               if(m_onMessageReceived.size() > 0){
+                                                                       m_onMessageReceived.emit(jsEvent);
+                                                               }
+                                                       }
+                                                       else {
+                                                               LoggerW("New email message in ignored folder: " << folder);
                                                        }
                                                }
-                                               else {
-                                                       LoggerW("New email message in ignored folder: " << folder);
-                                               }
-                                       }
 
-                                       stream.clear();
-                               } //for
+                                               stream.clear();
+                                       } //for
 
-                       }
-                       else if ((mail_id > 0) && (NOTI_MAIL_UPDATE == status)) 
-                       { // TODO also RECEIVE_THREAD_ITEM?
-                               LoggerI("Email received. mail_id: " << mail_id);
+                               }
+                               else if ((mail_id > 0) && (NOTI_MAIL_UPDATE == status))
+                               { // TODO also RECEIVE_THREAD_ITEM?
+                                       LoggerI("Email received. mail_id: " << mail_id);
 
-                               IMessagePtr msg = MessageFactory::createMessage(EMAIL, mail_id);
-                               IConversationPtr conversation(new Conversation(mail_id, EMAIL));
+                                       IMessagePtr msg = MessageFactory::createMessage(EMAIL, mail_id);
+                                       IConversationPtr conversation(new Conversation(mail_id, EMAIL));
 
-                               FolderType folder = msg->getCurrentFolder();
-                               jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+                                       FolderType folder = msg->getCurrentFolder();
+                                       jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
 
-                               if (true) { // if (OUTBOX != folder && SENTBOX != folder && DRAFTBOX != folder)
-                                       jsEvent->setMessage(msg);
-                                       jsEvent->setConversation(conversation);
-                                       if(m_onMessageReceived.size() > 0)
-                                               m_onMessageReceived.emit(jsEvent);
-                                       if(m_onConversationReceived.size() > 0)
-                                               m_onConversationReceived.emit(jsEvent);
-                               } else {
-                                       LoggerW("New email message in ignored folder: " << folder);
+                                       if (true) { // if (OUTBOX != folder && SENTBOX != folder && DRAFTBOX != folder)
+                                               jsEvent->setMessage(msg);
+                                               jsEvent->setConversation(conversation);
+                                               if(m_onMessageReceived.size() > 0)
+                                                       m_onMessageReceived.emit(jsEvent);
+                                               if(m_onConversationReceived.size() > 0)
+                                                       m_onConversationReceived.emit(jsEvent);
+                                       } else {
+                                               LoggerW("New email message in ignored folder: " << folder);
+                                       }
                                }
-                       }
-                       else if ((mail_id > 0) && (NOTI_THREAD_DELETE == status))
-                       { // TODO also RECEIVE_THREAD_ITEM?
-                               LoggerI("Email received. delete thread Id : " << mail_id);
+                               else if ((mail_id > 0) && (NOTI_THREAD_DELETE == status))
+                               { // TODO also RECEIVE_THREAD_ITEM?
+                                       LoggerI("Email received. delete thread Id : " << mail_id);
 
-                               IConversationPtr conversation(new Conversation(mail_id, EMPTY_EMAIL_CONVERSATION));
-                               conversation->setConvId(mail_id);
-                               jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_DELETED);
-                               jsEvent->setConversation(conversation);
+                                       IConversationPtr conversation(new Conversation(mail_id, EMPTY_EMAIL_CONVERSATION));
+                                       conversation->setConvId(mail_id);
+                                       jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_DELETED);
+                                       jsEvent->setConversation(conversation);
 
-                               if(m_onConversationReceived.size() > 0){
-                                       m_onConversationReceived.emit(jsEvent);
+                                       if(m_onConversationReceived.size() > 0){
+                                               m_onConversationReceived.emit(jsEvent);
+                                       }
                                }
-                       }
-                       else if (NOTI_MAILBOX_ADD == status)
-                       {
-                               LoggerI("Emailbox received. account Id: " << account_id);
-                               LoggerI("name Id: " << name);
-                               LoggerI("mailBox Id: " << mail_id);
+                               else if (NOTI_MAILBOX_ADD == status)
+                               {
+                                       LoggerI("Emailbox received. account Id: " << account_id);
+                                       LoggerI("name Id: " << name);
+                                       LoggerI("mailBox Id: " << mail_id);
 
-                               email_mailbox_t* mail_box = NULL;
+                                       email_mailbox_t* mail_box = NULL;
 
-                               if (EMAIL_ERROR_NONE != email_get_mailbox_by_mailbox_id(mail_id, &mail_box)) {
-                                       LoggerE("Couldn't retrieve message or it has been malformed.");
-                               }
+                                       if (EMAIL_ERROR_NONE != email_get_mailbox_by_mailbox_id(mail_id, &mail_box)) {
+                                               LoggerE("Couldn't retrieve message or it has been malformed.");
+                                       }
 
-                               if(mail_box != NULL)
-                               {
-                                       m_mailboxes = *mail_box;
-                                       IMessageFolderPtr folderPtr(new MessageFolder(m_mailboxes));
-                                       jsEvent->setMessageFolder(folderPtr);
-                                       jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
-                                       if(m_onFolderReceived.size() > 0)
+                                       if(mail_box != NULL)
                                        {
-                                               m_onFolderReceived.emit(jsEvent);
+                                               m_mailboxes = *mail_box;
+                                               IMessageFolderPtr folderPtr(new MessageFolder(m_mailboxes));
+                                               jsEvent->setMessageFolder(folderPtr);
+                                               jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
+                                               if(m_onFolderReceived.size() > 0)
+                                               {
+                                                       m_onFolderReceived.emit(jsEvent);
+                                               }
+                                       }
+
+                                       if ( mail_box )
+                                       {
+                                               if(  EMAIL_ERROR_NONE != email_free_mailbox( &mail_box , 1) )
+                                                       LoggerD("fail to email_free_mailbox - err ");
                                        }
-                               
-                               }
 
-                               if ( mail_box )
-                               {
-                                       if(  EMAIL_ERROR_NONE != email_free_mailbox( &mail_box , 1) )
-                                               LoggerD("fail to email_free_mailbox - err ");
                                }
+                               else if ((NOTI_MAILBOX_UPDATE == status) || (NOTI_MAILBOX_FIELD_UPDATE == status) || (NOTI_MAILBOX_RENAME == status))
+                               {
+                                       LoggerI("Emailbox received. account Id: " << account_id);
+                                       LoggerI("name Id: " << name);
+                                       LoggerI("mailBox Id: " << mail_id);
 
-                       }
-                       else if ((NOTI_MAILBOX_UPDATE == status) || (NOTI_MAILBOX_FIELD_UPDATE == status) || (NOTI_MAILBOX_RENAME == status)) 
-                       {
-                               LoggerI("Emailbox received. account Id: " << account_id);
-                               LoggerI("name Id: " << name);
-                               LoggerI("mailBox Id: " << mail_id);
+                                       email_mailbox_t* mail_box = NULL;
 
-                               email_mailbox_t* mail_box = NULL;
+                                       if (EMAIL_ERROR_NONE != email_get_mailbox_by_mailbox_id(mail_id, &mail_box)) {
+                                               LoggerE("Couldn't retrieve message or it has been malformed.");
+                                       }
 
-                               if (EMAIL_ERROR_NONE != email_get_mailbox_by_mailbox_id(mail_id, &mail_box)) {
-                                       LoggerE("Couldn't retrieve message or it has been malformed.");
-                               }
+                                       if(mail_box != NULL)
+                                       {
+                                               m_mailboxes = *mail_box;
+
+                                               IMessageFolderPtr folderPtr(new MessageFolder(m_mailboxes));
+                                               jsEvent->setMessageFolder(folderPtr);
+                                               jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
 
-                               if(mail_box != NULL)
+                                               if(m_onFolderReceived.size() > 0)
+                                               {
+                                                       m_onFolderReceived.emit(jsEvent);
+                                               }
+                                       }
+
+                                       if ( mail_box )
+                                       {
+                                               if(  EMAIL_ERROR_NONE != email_free_mailbox( &mail_box , 1) )
+                                                       LoggerD("fail to email_free_mailbox - err ");
+                                       }
+                               }
+                               else if (NOTI_MAILBOX_DELETE == status)
                                {
-                                       m_mailboxes = *mail_box;
+                                       LoggerI("Emailbox received. account Id: " << account_id);
+                                       LoggerI("name Id: " << name);
+                                       LoggerI("mailBox Id: " << mail_id);
+
+                                       // make empty mailbox
+                                       m_mailboxes.mailbox_id = mail_id;
+                                       m_mailboxes.account_id = account_id;
+                                       m_mailboxes.alias = (char *)"";
+                                       m_mailboxes.mailbox_name = (char *)"";
 
                                        IMessageFolderPtr folderPtr(new MessageFolder(m_mailboxes));
                                        jsEvent->setMessageFolder(folderPtr);
-                                       jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
-                                       
+                                       jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_DELETED);
+
                                        if(m_onFolderReceived.size() > 0)
                                        {
                                                m_onFolderReceived.emit(jsEvent);
                                        }
                                }
-
-                               if ( mail_box )
+                               else
                                {
-                                       if(  EMAIL_ERROR_NONE != email_free_mailbox( &mail_box , 1) )
-                                               LoggerD("fail to email_free_mailbox - err ");
-                               }               
-                       }
-                       else if (NOTI_MAILBOX_DELETE == status) 
-                       {
-                               LoggerI("Emailbox received. account Id: " << account_id);
-                               LoggerI("name Id: " << name);
-                               LoggerI("mailBox Id: " << mail_id);
-
-                               // make empty mailbox
-                               m_mailboxes.mailbox_id = mail_id;
-                               m_mailboxes.account_id = account_id;
-                               m_mailboxes.alias = (char *)"";
-                               m_mailboxes.mailbox_name = (char *)"";
-
-                               IMessageFolderPtr folderPtr(new MessageFolder(m_mailboxes));
-                               jsEvent->setMessageFolder(folderPtr);
-                               jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_DELETED);
-
-                               if(m_onFolderReceived.size() > 0)
-                               {
-                                       m_onFolderReceived.emit(jsEvent);
+                                       LoggerE("Couldn't retrieve message or it has been malformed.");
                                }
-                       }
-                       else 
+                       } 
+                       else // DBUS_INTERFACE_EMAIL_RECEIVED
                        {
-                               LoggerE("Couldn't retrieve message or it has been malformed.");
+                               LoggerD("Wrong DBus interface, skipping it.");
                        }
-               } 
-               else // DBUS_INTERFACE_EMAIL_RECEIVED
-               {
-                       LoggerD("Wrong DBus interface, skipping it.");
                }
+       }Catch(WrtDeviceApis::Commons::Exception) {
+               LoggerE("Couldn't retrieve message or it has been malformed.");
        }
 }
 
index c7344b4..016831e 100644 (file)
@@ -1665,7 +1665,7 @@ MimeType Mms::mimeTypeStringToIndexInt(std::string inputString)
 
        LoggerD("szMimeStr " << szMimeStr);
 
-       for(int idx =0; mimeTable[idx].szMIME != NULL ; idx++)
+       for(int idx =0; mimeTable[idx].szMIME != "" ; idx++)
        {
                if (!strcmp(mimeTable[idx].szMIME, szMimeStr)) {
                        retInt = mimeTable[idx].mime;
index dbcfca6..957c491 100755 (executable)
@@ -100,13 +100,13 @@ JSObjectRef JSNotificationDetailInfo::constructor(JSContextRef context,
     NotificationDetailInfo *priv = new NotificationDetailInfo();
 
     try {
-        priv->setMainText(validator.toString(0, false, ""));
+        priv->setMainText(validator.toString(0, false));
     } catch (const BasePlatformException& err) {
         LoggerW("mainText convertion is failed. %s", err.getMessage().c_str());
     }
 
     try {
-        priv->setSubText(validator.toString(1, true, ""));
+        priv->setSubText(validator.toString(1, true));
     } catch (const BasePlatformException& err) {
         LoggerW("subText convertion is failed. %s", err.getMessage().c_str());
     }
@@ -137,6 +137,9 @@ NotificationDetailInfo* JSNotificationDetailInfo::getPrivateObject(JSContextRef
     JSValueRef subText = JSUtil::getProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT);
     priv->setSubText(JSUtil::JSValueToString(context, subText));
 
+    if (!subText)
+       LoggerI("Sub Text is NULL");
+
     return priv;
 }
 
@@ -156,15 +159,9 @@ void JSNotificationDetailInfo::setPrivateObject(JSContextRef context, JSObjectRe
     // subText
     std::string subText = priv->getSubText();
 
-    if ( subText.empty())
-    {
-        JSUtil::setProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT,  JSValueMakeNull(context), kJSPropertyAttributeNone);
-    }
-    else
-    {
-        JSUtil::setProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT,
+    JSUtil::setProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT,
                 JSUtil::toJSValueRef(context, priv->getSubText()), kJSPropertyAttributeNone);
-    }
+
 }
 
 
old mode 100644 (file)
new mode 100755 (executable)
index f637443..6d773b4
@@ -123,11 +123,7 @@ JSValueRef JSNotificationManager::post(JSContextRef context,
 
         // notification
         JSObjectRef notificationObj = validator.toObject(0, JSStatusNotification::getClassRef());
-       LoggerI("Notification Obj: " << notificationObj);       
-        StatusNotification *notification = JSStatusNotification::getPrivateObject(context, notificationObj);
-
-       LoggerI("Notification : " << notification);
-       
+        StatusNotification *notification = JSStatusNotification::getPrivateObject(context, notificationObj);   
         if (!notification) {
             throw TypeMismatchException("Notification's private object is NULL.");
         }
@@ -146,7 +142,7 @@ JSValueRef JSNotificationManager::post(JSContextRef context,
            LoggerI ("posted notification id : " << stream.str());      
 
             //delete notificaiton ID
-        JSStringRef propertyIDName = JSStringCreateWithUTF8CString(NOTIFICATION_ID);
+            JSStringRef propertyIDName = JSStringCreateWithUTF8CString(NOTIFICATION_ID);
            JSObjectDeleteProperty(context, notificationObj, propertyIDName, 0);
            JSStringRelease(propertyIDName);
                
@@ -159,10 +155,10 @@ JSValueRef JSNotificationManager::post(JSContextRef context,
                    throw DeviceAPI::Common::UnknownException("Notification ID value is invalied.");
                }
 
-               //delete posted time
-               JSStringRef propertyPostedTimeName = JSStringCreateWithUTF8CString(NOTIFICATION_POSTED_TIME);
-               JSObjectDeleteProperty(context, notificationObj, propertyPostedTimeName, 0);
-               JSStringRelease(propertyPostedTimeName);
+       //delete posted time
+       JSStringRef propertyPostedTimeName = JSStringCreateWithUTF8CString(NOTIFICATION_POSTED_TIME);
+       JSObjectDeleteProperty(context, notificationObj, propertyPostedTimeName, 0);
+       JSStringRelease(propertyPostedTimeName);
 
         //posted time
         JSUtil::setProperty(context, notificationObj, NOTIFICATION_POSTED_TIME,
index b270a59..6e0287e 100755 (executable)
@@ -281,7 +281,7 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context,
         else if( strStatusType.compare(TIZEN_STATUS_NOTIFICATION_TYPE_PROGRESS) == 0)
             notiType = NOTI_TYPE_PROGRESS;
         else
-            throw TypeMismatchException("notification status type mismatch.");
+            notiType = NOTI_TYPE_NONE;
         
         StatusNotification *priv = new StatusNotification(notiType);
         
@@ -310,14 +310,8 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context,
             }
            catch (...)
            {
-               throw InvalidValuesException("Icon file path is invaild");
+               LoggerW("Icon file path is invaild");
            }
-#if 0                  
-            catch ( const BasePlatformException& err) 
-            {
-                LoggerW("notification's icon path convertion is failed."  << err.getMessage());
-            }
-#endif
             
             //sound
             try {                 
@@ -330,94 +324,129 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context,
             }
            catch (...)
             {
-                throw InvalidValuesException("sound file path is invaild");
+                LoggerW("sound file path is invaild");
            }
-       
-            //vibration
-            JSValueRef vibrationValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_VIBRATION);
-            priv->setDefaultVibration(JSUtil::JSValueToBoolean(context, vibrationValue));
-            
-            //appControl
-            JSValueRef appControlValue  = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_APP_CONTROL);
-           if (!JSValueIsUndefined(context, appControlValue))
-               priv->setApplicationControl(DeviceAPI::Application::JSApplicationControl::getApplicationControl(context, JSUtil::JSValueToObject(context, appControlValue) ));
-            
-            //appID               
-            JSValueRef appIdValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_APP_ID);
-            if (!JSValueIsUndefined(context, appIdValue))
-                priv->setApplicationId(JSUtil::JSValueToString(context, appIdValue));
-
-            //Light
-           JSValueRef lightValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_LIGHT);
-           LoggerI("Light :" << JSUtil::JSValueToString(context, lightValue));
-           if (!JSValueIsUndefined(context, lightValue))
-                priv->setLight(JSUtil::JSValueToString(context, lightValue));
-
-            //onTime
-            JSValueRef onTimeValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_LIGHT_ONTIME);
-            if (!JSValueIsUndefined(context, onTimeValue))
-               priv->setLightOnTime(JSUtil::JSValueToLong(context, onTimeValue));
-
-            //offTime
-            JSValueRef offTimeValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_LIGHT_OFFTIME);
-            if (!JSValueIsUndefined(context, offTimeValue))
-               priv->setLightOffTime(JSUtil::JSValueToLong(context, offTimeValue));                    
-               
+
+          try {
+                   //vibration
+                   JSValueRef vibrationValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_VIBRATION);
+                   priv->setDefaultVibration(JSUtil::JSValueToBoolean(context, vibrationValue));
+            }
+           catch (...)
+            {
+                LoggerW("sound file path is invaild");
+           }
+
+           try { 
+                   //appControl
+                   JSValueRef appControlValue  = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_APP_CONTROL);
+                   if (!JSValueIsUndefined(context, appControlValue))
+                       priv->setApplicationControl(DeviceAPI::Application::JSApplicationControl::getApplicationControl(context, JSUtil::JSValueToObject(context, appControlValue) ));
+            }
+           catch (...)
+            {
+                LoggerW("sound file path is invaild");
+           }
+
+           try {
+                   //appID                
+                   JSValueRef appIdValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_APP_ID);
+                   if (!JSValueIsUndefined(context, appIdValue))
+                       priv->setApplicationId(JSUtil::JSValueToString(context, appIdValue));
+           }
+           catch (...)
+          {
+                LoggerW("sound file path is invaild");
+          }    
+
+          try{
+                   //Light
+                   JSValueRef lightValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_LIGHT);
+                   LoggerI("Light :" << JSUtil::JSValueToString(context, lightValue));
+                   if (!JSValueIsUndefined(context, lightValue))
+                       priv->setLight(JSUtil::JSValueToString(context, lightValue));
+          }
+          catch(...)
+          {
+               LoggerW("The LED value is invalid ");
+          }
+
+
+          try{
+                   //onTime
+                   JSValueRef onTimeValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_LIGHT_ONTIME);
+                   if (!JSValueIsUndefined(context, onTimeValue))
+                       priv->setLightOnTime(JSUtil::JSValueToLong(context, onTimeValue));
+          }
+          catch(...)
+          {
+               LoggerW("The LED value is invalid ");
+          }
+
+          try {
+                   //offTime
+                   JSValueRef offTimeValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_LIGHT_OFFTIME);
+                   if (!JSValueIsUndefined(context, offTimeValue))
+                       priv->setLightOffTime(JSUtil::JSValueToLong(context, offTimeValue));    
+
+          }
+          catch(...)
+          {
+               LoggerW("The LED value is invalid ");
+          }
+               
             //progressType
             NotificationProgressType progressType = NOTI_PROGRESS_TYPE_PERCENTAGE;
 
-           JSStringRef propertyName = JSStringCreateWithUTF8CString(STATUS_NOTIFICATION_PROGRESS_TYPE);
-            bool has = JSObjectHasProperty(context, notiInitDict, propertyName);
-            JSStringRelease(propertyName);
-           if (has)
+           try {
+                   JSStringRef propertyName = JSStringCreateWithUTF8CString(STATUS_NOTIFICATION_PROGRESS_TYPE);
+                   bool has = JSObjectHasProperty(context, notiInitDict, propertyName);
+                   JSStringRelease(propertyName);
+                   if (has)
+                   {
+                       JSValueRef progressTypeValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_PROGRESS_TYPE);
+                       std::string strProgressType = JSUtil::JSValueToString(context, progressTypeValue);
+                       LoggerI("==Progress Type : " << strProgressType);       
+                       if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE) == 0)
+                               progressType = NOTI_PROGRESS_TYPE_PERCENTAGE;
+                       else if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
+                               progressType = NOTI_PROGRESS_TYPE_SIZE;
+                       else
+                               progressType = NOTI_PROGRESS_TYPE_NONE;
+                   }
+                   priv->setProgressType(progressType);
+           }
+           catch(...)
            {
-                JSValueRef progressTypeValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_PROGRESS_TYPE);
-               std::string strProgressType = JSUtil::JSValueToString(context, progressTypeValue);
-               LoggerI("==Progress Type : " << strProgressType);       
-               if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE) == 0)
-                       progressType = NOTI_PROGRESS_TYPE_PERCENTAGE;
-               else if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
-                       progressType = NOTI_PROGRESS_TYPE_SIZE;
-               else
-                       throw TypeMismatchException("Invalid Progress Type.");          
+                //throw TypeMismatchException("The backgound image path is invalid ");
+                LoggerW("The progress type is invalid ");
            }
-           priv->setProgressType(progressType);
 
-#if 0                  
-            JSValueRef progressTypeValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_PROGRESS_TYPE);
-           if (progressTypeValue)
-           {
 
+           try {
+                   //ProgressValue
+                   JSValueRef progressValue    = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_PROGRESS_VALUE);          
+                   if (!JSValueIsUndefined(context, progressValue))
+                   {
+                       if ( progressType == NOTI_PROGRESS_TYPE_PERCENTAGE)
+                      {
+                           if ( 100 < JSUtil::JSValueToULong(context, progressValue) )
+                           {
+                               LoggerW("The percentage progress value must be between 0 and 100");
+                           }
+                               priv->setProgressValue((double)JSUtil::JSValueToULong(context, progressValue)/(double)100);
+                       }
+                       else 
+                      {
+                           priv->setProgressValue((double)JSUtil::JSValueToULong(context, progressValue));
+                      }
+                   }
            }
-            if (!JSValueIsUndefined(context, progressTypeValue))
-            {      
-                   std::string strProgressType = JSUtil::JSValueToString(context, progressTypeValue);
-                   LoggerI("==Progress Type : " << strProgressType);   
-                   if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE) == 0)
-                          progressType = NOTI_PROGRESS_TYPE_PERCENTAGE;
-                   else if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
-                           progressType = NOTI_PROGRESS_TYPE_SIZE;
-                   else
-                           throw TypeMismatchException("Invalid Progress Type.");
-            }
-            priv->setProgressType(progressType);
-#endif                                         
-            //ProgressValue
-            JSValueRef progressValue    = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_PROGRESS_VALUE);         
-            if (!JSValueIsUndefined(context, progressValue))
-            {
-               if ( progressType == NOTI_PROGRESS_TYPE_PERCENTAGE)
-              {
-                   if ( 100 < JSUtil::JSValueToULong(context, progressValue) )
-                       throw TypeMismatchException("The percentage progress value must be between 0 and 100");
-                   priv->setProgressValue((double)JSUtil::JSValueToULong(context, progressValue)/(double)100);
-               }
-               else 
-              {
-                   priv->setProgressValue((double)JSUtil::JSValueToULong(context, progressValue));
-              }
-            }
-             
+           catch (...) 
+           {
+               LoggerW("The progress value is invalid ");
+           }
+
             //DetailInfo
             JSValueRef detailInfoValue  = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_DETAIL_INFO);
 
@@ -431,18 +460,28 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context,
                    JSObjectRef object = JSUtil::JSValueToObject(context, element);
                    if (object)
                    {
-                       NotificationDetailInfo* item = static_cast<NotificationDetailInfo*>(JSObjectGetPrivate(object));
-                       std::string main = item->getMainText();
-                       std::string sub = item->getSubText();
-                       LoggerI("Main : " << main << " Sub : " << sub);
-            
-                       NotificationDetailInfo *detailinfo = new NotificationDetailInfo(NULL, (int)i, main, sub);
-                       detailInfos.push_back(detailinfo);      
+                       NotificationDetailInfo* item = static_cast<NotificationDetailInfo*>(JSObjectGetPrivate(object));
+                       if (item)
+                       {
+                               std::string main = item->getMainText();
+                               std::string sub = item->getSubText();   
+                               NotificationDetailInfo *detailinfo = new NotificationDetailInfo(NULL, (int)i, main,  sub);                      
+                               detailInfos.push_back(detailinfo);      
+                       }
+                       else
+                       {
+                               //mainText
+                               std::string main =  JSUtil::JSValueToString(context, JSUtil::getProperty(context, object, NOTIFICATION_DETAIL_INFO_MAIN_TEXT));
+                               std::string sub =  JSUtil::JSValueToString(context, JSUtil::getProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT));
+                               NotificationDetailInfo *detailinfo = new NotificationDetailInfo(NULL, (int)i, main,  sub);                      
+                               detailInfos.push_back(detailinfo);
+                       }
+                       
                    }
                 }
             }
-            priv->setDetailInfos(detailInfos);  
-    
+            priv->setDetailInfos(detailInfos); 
+       
             //backgroundimage
             try {                 
                 JSValueRef backgroundImageValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_BACKGROUND_IMAGE_PATH);
@@ -454,16 +493,22 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context,
             }
            catch(...)
            {
-                throw TypeMismatchException("The backgound image path is invalid : ");
+                //throw TypeMismatchException("The backgound image path is invalid ");
+                LoggerW("The backgound image path is invalid ");
            }
-       
-            //number
-            JSValueRef numberValue  = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_NUMBER);
-           if (!JSValueIsUndefined(context, numberValue))
-           {
-                 priv->setNumber(JSUtil::JSValueToLong(context, numberValue));
+
+           try {
+                   //number
+                   JSValueRef numberValue  = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_NUMBER);
+                   if (!JSValueIsUndefined(context, numberValue))
+                   {
+                        priv->setNumber(JSUtil::JSValueToLong(context, numberValue));
+                   }
            }
-           
+           catch (...) {
+                        LoggerW("The number is invalid ");
+           }
+               
             //thumbnail
             try {                 
                 JSValueRef thumbnailsValue  = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_THUMBNAILS);
@@ -486,7 +531,8 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context,
             }
             catch ( ... ) 
             {
-                throw TypeMismatchException("thumbnail path convertion is failed.");
+                //throw TypeMismatchException("thumbnail path convertion is failed.");
+                LoggerW("thumbnail path convertion is failed.");
             }
 
             //subIconPath
@@ -500,20 +546,20 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context,
             }
             catch (...) 
             {
-                throw TypeMismatchException("subIcon path convertion is failed.");
+                //throw TypeMismatchException("subIcon path convertion is failed.");
+                LoggerW("subIcon path convertion is failed.");
             }
                     
         }
                
-        setPrivateObject(context, obj, priv);
-               
+        setPrivateObject(context, obj, priv);          
     } 
      catch ( const BasePlatformException& err) 
     {
         LoggerW(" notification convertion is failed. "   << err.getName().c_str() << ":"  << err.getMessage().c_str());
-       JSObjectRef error = JSWebAPIErrorFactory::makeErrorObject(context, err);
-       *exception = error;
-       return error;
+       //JSObjectRef error = JSWebAPIErrorFactory::makeErrorObject(context, err);
+       //*exception = error;
+       //return error;
     }
 
     return obj;      
@@ -555,10 +601,6 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context,
         DeviceAPI::Filesystem::IPathPtr icon = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, JSUtil::JSValueToString(context, iconPath));
         priv->setIconPath(icon->getFullPath());
     }
-    //else
-    //{
-    //    priv->setIconPath("");
-    //}
 
     // subIconPath
     JSValueRef subIconPath = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_SUB_ICON_PATH);
@@ -567,10 +609,6 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context,
         DeviceAPI::Filesystem::IPathPtr subIcon = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, JSUtil::JSValueToString(context, subIconPath));
         priv->setSubIconPath(subIcon->getFullPath());
     }
-    //else
-    //{
-    //    priv->setSubIconPath("");
-    //}
 
     // number
     JSValueRef number = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_NUMBER);
@@ -602,10 +640,6 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context,
         DeviceAPI::Filesystem::IPathPtr backgroundImage = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, JSUtil::JSValueToString(context, backgroundImagePath));
         priv->setBackground(backgroundImage->getFullPath());
     }
-    //else
-    //{
-    //    priv->setBackground("");
-    //}
     
     // thumbnails
     JSValueRef thumbnails = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_THUMBNAILS);
@@ -630,10 +664,6 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context,
         DeviceAPI::Filesystem::IPathPtr sound = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, JSUtil::JSValueToString(context, soundPath));
         priv->setSoundPath(sound->getFullPath());
     }
-    //else
-    //{
-    //    priv->setSoundPath("");
-    //}
     
     // vibration
     JSValueRef vibration = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_VIBRATION);
@@ -663,36 +693,7 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context,
     JSValueRef offTime = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_LIGHT_OFFTIME);
     if (!JSValueIsNull(context, offTime))
        priv->setLightOffTime(JSUtil::JSValueToLong(context, offTime));
-
-#if 0
-    // progressType
-    JSValueRef progressType = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_PROGRESS_TYPE);
-    std::string strProgressType = JSUtil::JSValueToString(context, progressType);
-    LoggerI("Progress Type : " << strProgressType);
-    
-    NotificationProgressType progType = NOTI_PROGRESS_TYPE_NONE;
-    if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE) == 0)
-        progType = NOTI_PROGRESS_TYPE_PERCENTAGE;
-    else if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
-        progType = NOTI_PROGRESS_TYPE_SIZE;
-    else
-        throw InvalidValuesException("Invalid Progress Type.");
-    priv->setProgressType(progType);
-    
-    // progressValue
-    JSValueRef progressValue = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_PROGRESS_VALUE);
-    LoggerI(" Progress Value in Private Object = " << JSUtil::JSValueToULong(context, progressValue));
-    if ( progType == NOTI_PROGRESS_TYPE_PERCENTAGE)
-    {
-       if ( 100 < JSUtil::JSValueToULong(context, progressValue) )
-                       throw InvalidValuesException("The percentage progress value must be between 0 and 100");
-       priv->setProgressValue((double)JSUtil::JSValueToULong(context, progressValue)/(double)100);
-    }
-    else 
-    {
-       priv->setProgressValue((double)JSUtil::JSValueToULong(context, progressValue));
-    }
- #endif   
     return priv;
 }
 
@@ -760,7 +761,7 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob
             JSUtil::toJSValueRef(context, priv->getTitle()), kJSPropertyAttributeNone);
 
     //content
-    if (priv->getStrContent())
+    if (!priv->getContent().empty())
        JSUtil::setProperty(context, object, NOTIFICATION_CONTENT,
                  JSUtil::toJSValueRef(context, priv->getContent()), kJSPropertyAttributeNone);
     else
@@ -828,15 +829,16 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob
             JSUtil::toJSValueRef(context, priv->getDefaultVibration()), kJSPropertyAttributeNone);
 
     // appId
-    if (!priv->getApplicationId().empty())
-        JSUtil::setProperty(context, object, STATUS_NOTIFICATION_APP_ID,
+    JSUtil::setProperty(context, object, STATUS_NOTIFICATION_APP_ID,
             JSUtil::toJSValueRef(context, priv->getApplicationId()), kJSPropertyAttributeNone);
-    else
-       JSUtil::setProperty(context, object, STATUS_NOTIFICATION_APP_ID, JSValueMakeNull(context), kJSPropertyAttributeNone);
-
+    
    //Light
-   JSUtil::setProperty(context, object, STATUS_NOTIFICATION_LIGHT,
-               JSUtil::toJSValueRef(context, priv->getLight()), kJSPropertyAttributeNone);
+   if (!priv->getLight().empty())
+          JSUtil::setProperty(context, object, STATUS_NOTIFICATION_LIGHT,
+                       JSUtil::toJSValueRef(context, priv->getLight()), kJSPropertyAttributeNone);
+   else
+         JSUtil::setProperty(context, object, STATUS_NOTIFICATION_LIGHT,
+                       JSValueMakeNull(context), kJSPropertyAttributeNone);    
 
    JSUtil::setProperty(context, object, STATUS_NOTIFICATION_LIGHT_ONTIME,
                JSUtil::toJSValueRef(context, priv->getLightOnTime()), kJSPropertyAttributeNone);
index ee5b835..33e3b82 100755 (executable)
@@ -32,10 +32,11 @@ class NotificationDetailInfo
 {
 public:
     NotificationDetailInfo();
-     NotificationDetailInfo(notification_h noti);      
+    NotificationDetailInfo(notification_h noti);       
     NotificationDetailInfo(std::string &mainText, std::string &subText);
+    //NotificationDetailInfo(notification_h noti, int index, std::string &mainText);
     NotificationDetailInfo(notification_h noti, int index, std::string &mainText, std::string &subText);
-       
+
     virtual ~NotificationDetailInfo();
 
     std::string getMainText() const;
index 777f32c..6e57f94 100755 (executable)
@@ -989,13 +989,10 @@ void StatusNotification::setApplicationId(const std::string& appId)
 
        if (m_service)
        {
-               if (!appId.empty())
+               m_launchFlag = true;
+               if (service_set_app_id(m_service, appId.c_str())!= SERVICE_ERROR_NONE)
                {
-                       m_launchFlag = true;
-                       if (service_set_app_id(m_service, appId.c_str())!= SERVICE_ERROR_NONE)
-                       {
-                               throw UnknownException("service set appId error");      
-                       }
+                       throw UnknownException("service set appId error");      
                }
        }
 
@@ -1949,11 +1946,16 @@ void StatusNotification::loadDetailInfos()
         {
                for ( int idx = 0; idx < MAX_NOTIFICATION_DETAIL_INFO_LENGTH; idx++)
                {
-                   std::string main = getInformation(idx);
-                   std::string sub = getSubInformation(idx);
-                   LoggerI("Main : " << main << " Sub : " << sub);
-                   NotificationDetailInfo *info = new NotificationDetailInfo(m_notiHandle, idx, main, sub);
-                   m_detailInfos.push_back(info);
+                   if (!isNullInformation(idx))
+                   {
+                           std::string main = getInformation(idx);
+                           std::string sub = getSubInformation(idx);
+
+                           LoggerI("Main : [" << main << "] Sub : ['" << sub <<"]");      
+                           
+                           NotificationDetailInfo *info = new NotificationDetailInfo(m_notiHandle, idx, main, sub);
+                           m_detailInfos.push_back(info);
+                   }
                }
         }
         else
@@ -1983,6 +1985,7 @@ void StatusNotification::setDetailInfos(const std::vector<NotificationDetailInfo
             NotificationDetailInfo* info = *it;
             if ( idx < MAX_NOTIFICATION_DETAIL_INFO_LENGTH )
             {
+            
                 LoggerI("main " << info->getMainText() << " sub " << info->getSubText() );
                setInformation(info->getMainText(), idx);
                setSubInformation(info->getSubText(), idx);
@@ -2065,6 +2068,51 @@ std::string StatusNotification::getInformation(int index)
        
 }
 
+bool StatusNotification::isNullInformation(int index)
+{
+       if (m_notiHandle)
+       {
+               notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; 
+               switch (index)
+               {
+                       case 0:
+                               type = NOTIFICATION_TEXT_TYPE_INFO_1;
+                               break;
+                       case 1:
+                               type = NOTIFICATION_TEXT_TYPE_INFO_2;
+                               break;
+                       case 2:
+                               type = NOTIFICATION_TEXT_TYPE_INFO_3;
+                               break;
+                       default :
+                               type = NOTIFICATION_TEXT_TYPE_NONE;
+               }
+               char *info = NULL;
+               
+               if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &info) != NOTIFICATION_ERROR_NONE)
+               {
+                       throw UnknownException("Detail Info index value is invalid or mainText value getting is failed in Detail Info.");
+               }
+               
+               if (info)
+               {
+                       LoggerI("is not null");
+                       return false;
+               }
+               else
+               {
+                       LoggerI("is null");
+                       return true;
+               }
+
+       }
+       else
+       {       
+               LoggerW("noti Handle is NULL");
+               throw UnknownException( "notification handle is null");
+       }
+}
+
 std::string StatusNotification::getSubInformation(int index)
 {
        if (m_notiHandle)
@@ -2133,7 +2181,7 @@ void StatusNotification::setInformation( const std::string& info, int index)
 
                if ( type != NOTIFICATION_TEXT_TYPE_NONE)
                {
-                       if (getInformation(idx).compare(info))
+                       if (getInformation(idx).compare(info) || isNullInformation(idx))
                        {
                                if (notification_set_text(m_notiHandle, type, info.c_str(),
                                        NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
index 49ebc43..e9362a4 100755 (executable)
@@ -149,10 +149,11 @@ private:
        void setThumbnail( const std::string& info, int index);
        std::string getThumbnail(int index);
 
-       std::string getInformation(int index)  ;
+       std::string getInformation(int index);
+       bool isNullInformation(int index);
        void setInformation( const std::string& info, int index) ;
-
-       std::string getSubInformation(int index)  ;
+       
+       std::string getSubInformation(int index);
        void setSubInformation( const std::string& info, int index) ;   
        
        void loadDetailInfos();
index af4e39c..2784c10 100755 (executable)
@@ -281,22 +281,34 @@ void PowerManager::setPlatformBrightness(int brightness){
 }
 
 int PowerManager::getPlatformBrightness(){
+    int currentPowerState = 1;
     int brightness = 0;
+    int isCustomMode = 0;
+    int isAutoBrightness = 0;
     int ret = 0;
 
-    int isCustomMode = 0;
+    vconf_get_int(VCONFKEY_PM_STATE, &currentPowerState);
+    if( currentPowerState == VCONFKEY_PM_STATE_NORMAL){
+        vconf_get_int(VCONFKEY_PM_CURRENT_BRIGHTNESS, &brightness);
+        LOGD("[PM_STATE_NORMAL] return VCONFKEY_PM_CURRENT_BRIGHTNESS %d", brightness);
+        return brightness;
+    }
+
     vconf_get_int(VCONFKEY_PM_CUSTOM_BRIGHTNESS_STATUS, &isCustomMode);
     if( (isCustomMode && mCurrentBrightness != -1) || mShouldBeReadFromCache ){
-        LOGI("return custom brightness %d", mCurrentBrightness);
+        LOGD("return custom brightness %d", mCurrentBrightness);
         return mCurrentBrightness;
     }
 
-    ret = vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &brightness);
-    if( ret != 0 ){
-        LoggerE("Platform error while getting brightness: %d", ret);
-        throw UnknownException("Platform error while getting brightness");
+    vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &isAutoBrightness);
+    if( isAutoBrightness == 1 ){
+        ret = vconf_get_int(VCONFKEY_SETAPPL_PREFIX"/automatic_brightness_level" /*prevent RSA build error*/, &brightness);
+        if( ret != 0 ) //RSA binary has no AUTOMATIC_BRIGHTNESS
+            vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &brightness);
+    }else{
+        vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &brightness);
     }
-    LoggerE("VCONFKEY_SETAPPL_LCD_BRIGHTNESS %d", brightness);
+    LOGD("BRIGHTNESS(%s) %d", isAutoBrightness == 1 ? "auto" : "fix" , brightness);
 
     return brightness;
 }
index 27e8e09..ed90aa4 100755 (executable)
@@ -699,8 +699,10 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR
                     token = strtok_r(duid, "=\r\n", &ptr);
                     if (token != NULL) {
                         token = strtok_r(NULL, "=\r\n", &ptr);
-                        deviceCapabilitiesInfo->duid = token;
-                        LoggerD("deviceCapabilitiesInfo->duid : " << deviceCapabilitiesInfo->duid);
+                        if (token != NULL) {
+                            deviceCapabilitiesInfo->duid = token;
+                            LoggerD("deviceCapabilitiesInfo->duid : " << deviceCapabilitiesInfo->duid);
+                        }
                     }
                     break;
                 }
index e606390..69ee5cb 100755 (executable)
@@ -653,7 +653,6 @@ void Systeminfo::OnRequestReceived(const EventGetSysteminfoPtr& event)
                 EventRequestReceiver<EventGetSysteminfo>::ManualAnswer(event);
             }
             if (simState) {
-                LoggerD("simState : " << simState);
                 free(simState);
             }
         } else {
index fc05c1e..41bb7cc 100755 (executable)
@@ -34,17 +34,15 @@ namespace {
        const short MINUTES_UNIT = 2;
        const short HOURS_UNIT = 3;
        const short DAYS_UNIT = 4;
-       const short WRONG_UNIT = 0xff;
 }
 
 struct DurationProperties
 {
        long long length;
        short unit;
-       std::string unitStr;
        DurationProperties()
                : length(0),
-               unit(MSECS_UNIT), unitStr("MSECS")
+               unit(MSECS_UNIT)
        {
        }
 };
index 4cd51e1..5549a51 100644 (file)
@@ -124,9 +124,9 @@ JSStaticFunction JSTZDate::m_function[] = {
 
 JSClassRef JSTZDate::m_jsClassRef = JSClassCreate(JSTZDate::getClassInfo());
 
-JSObjectRef JSTZDate::createJSObject(JSContextRef context) {
+JSObjectRef JSTZDate::createJSObject(JSContextRef context, const bool isNotNull) {
        LoggerD("entered");
-       TZDatePtr tzDate(new TZDate());
+       TZDatePtr tzDate(new TZDate(isNotNull));
        TZDatePrivObject *priv = new TZDatePrivObject(context, tzDate);
        if (!priv) {
                ThrowMsg(NullPointerException, "Can not new an object");
@@ -206,30 +206,26 @@ void JSTZDate::finalize(JSObjectRef object)
 {
     LoggerD( "entered" );
     TZDatePrivObject *priv =
-        static_cast<TZDatePrivObject*>( JSObjectGetPrivate( object ) ) ;
-    delete priv;
+        static_cast<TZDatePrivObject*>(JSObjectGetPrivate(object));
+       if (priv)
+       delete priv;
 }
 
 JSObjectRef JSTZDate::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
        LoggerD("entered");
        TZDateProperties prop;
-       TimeUtilConverter converter(ctx);
-
+       JSObjectRef tzDate = NULL;
        Try {
-               JSObjectRef tzDate = NULL;
-
-               if (argumentCount == 0) {
+               if (argumentCount == 0)
                        tzDate = createJSObject(ctx);
-               } else if (argumentCount <= 2) {
+               else if (argumentCount <= 2) {
+                       TimeUtilConverter converter(ctx);
                        std::string timezone = "";
-                       if ((argumentCount == 2) && !JSValueIsNull(ctx, arguments[1]) && !JSValueIsUndefined(ctx, arguments[1])) {
-                               timezone = converter.toString(arguments[1]);
-                       }
+                       try {
+                               if ((argumentCount == 2) && !JSValueIsNull(ctx, arguments[1]) && !JSValueIsUndefined(ctx, arguments[1]))
+                                       timezone = converter.toString(arguments[1]);
 
-                       if (JSValueIsNull(ctx, arguments[0]) || JSValueIsUndefined(ctx, arguments[0])) {
-                               tzDate = createJSObject(ctx, timezone);
-                       } else {
                                struct tm date = converter.toDateTm(arguments[0]);
                                LoggerD("date = " << date.tm_year << "." << date.tm_mon << "." << date.tm_mday);
                                LoggerD(date.tm_hour << ":" << date.tm_min << ":" << date.tm_sec);
@@ -252,56 +248,44 @@ JSObjectRef JSTZDate::constructor(JSContextRef ctx, JSObjectRef constructor, siz
                                        prop.milliseconds = converter.toLong(result);
                                        LoggerD("getMilliseconds = " << prop.milliseconds);
                                }
-                               tzDate = createJSObject(ctx, prop);
+                       } catch (...) {
+                               LoggerE("fail to convert optional arguments");
+                               tzDate = createJSObject(ctx, timezone);
                        }
+                       if (tzDate == NULL)
+                               tzDate = createJSObject(ctx, prop);
                } else {
-                       prop.year = converter.toLong(arguments[0]);
+                       ArgumentValidator validator(ctx, argumentCount, arguments);
+                       prop.year = validator.toLong(0);
                        if ((prop.year >= 0) && (prop.year <= 99))
                                prop.year += 1900;
-                       prop.month = converter.toLong(arguments[1]);
-                       prop.day = converter.toLong(arguments[2]);
-                       if (argumentCount > 3) {
-                               if (!JSValueIsUndefined(ctx, arguments[3]) && !JSValueIsNull(ctx, arguments[3]))
-                                       prop.hours = converter.toLong(arguments[3]);
-                               if (argumentCount > 4) {
-                                       if (!JSValueIsUndefined(ctx, arguments[4]) && !JSValueIsNull(ctx, arguments[4]))
-                                               prop.minutes = converter.toLong(arguments[4]);
-                                       if (argumentCount > 5) {
-                                               if (!JSValueIsUndefined(ctx, arguments[5]) && !JSValueIsNull(ctx, arguments[5]))
-                                                       prop.seconds = converter.toLong(arguments[5]);
-                                               if (argumentCount > 6) {
-                                                       if (!JSValueIsUndefined(ctx, arguments[6]) && !JSValueIsNull(ctx, arguments[6]))
-                                                               prop.milliseconds= converter.toLong(arguments[6]);
-                                                       if (argumentCount > 7) {
-                                                               if (!JSValueIsUndefined(ctx, arguments[7]) && !JSValueIsNull(ctx, arguments[7]))
-                                                                       prop.timezone = converter.toString(arguments[7]);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
+                       prop.month = validator.toLong(1);
+                       prop.day = validator.toLong(2);
+                       prop.hours = validator.toLong(3, true);
+                       prop.minutes = validator.toLong(4, true);
+                       prop.seconds = validator.toLong(5, true);
+                       prop.milliseconds= validator.toLong(6, true);
+                       prop.timezone = validator.toString(7, true);
                        tzDate = createJSObject(ctx, prop);
                }
-
-               if (tzDate) {
-                       JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor");
-                   JSObjectSetProperty(ctx, tzDate, ctorName, constructor,
-                       kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL);
-               JSStringRelease(ctorName);
-                       return tzDate;
-               }
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(ctx, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (InvalidArgumentException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(ctx, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
-       return JSWebAPIErrorFactory::postException(ctx, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+
+       if (tzDate == NULL)
+               tzDate = createJSObject(ctx, false);
+
+       JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor");
+    JSObjectSetProperty(ctx, tzDate, ctorName, constructor,
+        kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL);
+       JSStringRelease(ctorName);
+       return tzDate;
 }
 const JSClassRef JSTZDate::getClassRef()
 {
@@ -319,6 +303,7 @@ const JSClassDefinition* JSTZDate::getClassInfo()
 JSValueRef JSTZDate::getTimezone(JSContextRef context, JSObjectRef function,
        JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
        LoggerD("entered");
+       TimeUtilConverter converter(context);
 
        Try {
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(thisObject));
@@ -329,7 +314,6 @@ JSValueRef JSTZDate::getTimezone(JSContextRef context, JSObjectRef function,
 
                TZDatePtr tzDate(privateObject->getObject());
                std::string timezone = tzDate->getTimezone();
-               TimeUtilConverter converter(context);
 
                return converter.toJSValueRef(timezone);
        } Catch(NullPointerException) {
@@ -337,14 +321,11 @@ JSValueRef JSTZDate::getTimezone(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return converter.toJSValueRef("Invalid Date");
 }
 
 JSValueRef JSTZDate::toTimezone(JSContextRef context, JSObjectRef function,
@@ -362,6 +343,9 @@ JSValueRef JSTZDate::toTimezone(JSContextRef context, JSObjectRef function,
                }
 
                TZDatePtr tzDate(privateObject->getObject());
+               if ((timezone == "")  || (!tzDate->isAvailableTimezone(timezone)))
+                       ThrowMsg(InvalidArgumentException, "Unsupported Timezone.");
+       
                return createJSObject(context, tzDate->getTime(), timezone);
        } catch(const BasePlatformException& err){
         return JSWebAPIErrorFactory::postException(context, exception, err);
@@ -370,9 +354,10 @@ JSValueRef JSTZDate::toTimezone(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch (InvalidArgumentException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
@@ -435,14 +420,12 @@ JSValueRef JSTZDate::difference(JSContextRef context, JSObjectRef function,
                return diffTZDate(context, thisObject, argumentCount,  arguments, exception, DIFFERENCE);
        } catch(const BasePlatformException& err){
         return JSWebAPIErrorFactory::postException(context, exception, err);
-    } Catch(InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch(NullPointerException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
@@ -466,9 +449,7 @@ JSValueRef JSTZDate::equalsTo(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
@@ -491,9 +472,7 @@ JSValueRef JSTZDate::earlierThan(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
@@ -518,9 +497,7 @@ JSValueRef JSTZDate::laterThan(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
@@ -560,9 +537,7 @@ JSValueRef JSTZDate::addDuration(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
@@ -570,7 +545,7 @@ JSValueRef JSTZDate::addDuration(JSContextRef context, JSObjectRef function,
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch (OutOfRangeException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "The result is beyond the scope that TZDate can handle.");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "The result is beyond the scope that TZDate can handle.");
        }
 
        return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
@@ -594,6 +569,7 @@ JSValueRef JSTZDate::toUTC(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch (InvalidArgumentException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
@@ -622,9 +598,7 @@ JSValueRef JSTZDate::toLocalTimezone(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
@@ -634,6 +608,7 @@ JSValueRef JSTZDate::toLocalTimezone(JSContextRef context, JSObjectRef function,
 JSValueRef JSTZDate::toLocaleDateString(JSContextRef context, JSObjectRef function,
        JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
        LoggerD("Entered");
+       TimeUtilConverter converter(context);
        Try {
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
@@ -641,8 +616,6 @@ JSValueRef JSTZDate::toLocaleDateString(JSContextRef context, JSObjectRef functi
                        ThrowMsg(NullPointerException, "Private object not initialized");
                }
 
-               TimeUtilConverter converter(context);
-
                TZDatePtr tzDate(privateObject->getObject());
                std::string result = tzDate->toDateString(true);
                return converter.toJSValueRef(result);
@@ -651,19 +624,17 @@ JSValueRef JSTZDate::toLocaleDateString(JSContextRef context, JSObjectRef functi
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return converter.toJSValueRef("Invalid Date");
 }
 
 JSValueRef JSTZDate::toLocaleTimeString(JSContextRef context, JSObjectRef function,
        JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
        LoggerD("Entered");
+       TimeUtilConverter converter(context);
        Try {
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
@@ -671,8 +642,6 @@ JSValueRef JSTZDate::toLocaleTimeString(JSContextRef context, JSObjectRef functi
                        ThrowMsg(NullPointerException, "Private object not initialized");
                }
 
-               TimeUtilConverter converter(context);
-
                TZDatePtr tzDate(privateObject->getObject());
                std::string result = tzDate->toTimeString(true);
                return converter.toJSValueRef(result);
@@ -681,19 +650,17 @@ JSValueRef JSTZDate::toLocaleTimeString(JSContextRef context, JSObjectRef functi
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return converter.toJSValueRef("Invalid Date");
 }
 
 JSValueRef JSTZDate::toLocaleString(JSContextRef context, JSObjectRef function,
        JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
        LoggerD("Entered");
+       TimeUtilConverter converter(context);
        Try {
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
@@ -701,8 +668,6 @@ JSValueRef JSTZDate::toLocaleString(JSContextRef context, JSObjectRef function,
                        ThrowMsg(NullPointerException, "Private object not initialized");
                }
 
-               TimeUtilConverter converter(context);
-
                TZDatePtr tzDate(privateObject->getObject());
                std::string result = tzDate->toString(true);
                return converter.toJSValueRef(result);
@@ -711,19 +676,17 @@ JSValueRef JSTZDate::toLocaleString(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return converter.toJSValueRef("Invalid Date");
 }
 
 JSValueRef JSTZDate::toDateString(JSContextRef context, JSObjectRef function,
        JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
        LoggerD("Entered");
+       TimeUtilConverter converter(context);
        Try {
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
@@ -731,8 +694,6 @@ JSValueRef JSTZDate::toDateString(JSContextRef context, JSObjectRef function,
                        ThrowMsg(NullPointerException, "Private object not initialized");
                }
 
-               TimeUtilConverter converter(context);
-
                TZDatePtr tzDate(privateObject->getObject());
                std::string result = tzDate->toDateString();
                return converter.toJSValueRef(result);
@@ -741,19 +702,17 @@ JSValueRef JSTZDate::toDateString(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return converter.toJSValueRef("Invalid Date");
 }
 
 JSValueRef JSTZDate::toTimeString(JSContextRef context, JSObjectRef function,
        JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
        LoggerD("Entered");
+       TimeUtilConverter converter(context);
        Try {
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
@@ -761,8 +720,6 @@ JSValueRef JSTZDate::toTimeString(JSContextRef context, JSObjectRef function,
                        ThrowMsg(NullPointerException, "Private object not initialized");
                }
 
-               TimeUtilConverter converter(context);
-
                TZDatePtr tzDate(privateObject->getObject());
                std::string result = tzDate->toTimeString();
                return converter.toJSValueRef(result);
@@ -771,20 +728,18 @@ JSValueRef JSTZDate::toTimeString(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return converter.toJSValueRef("Invalid Date");
 }
 
 
 JSValueRef JSTZDate::toString(JSContextRef context, JSObjectRef function,
        JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
        LoggerD("Entered");
+       TimeUtilConverter converter(context);
        Try {
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
@@ -792,8 +747,6 @@ JSValueRef JSTZDate::toString(JSContextRef context, JSObjectRef function,
                        ThrowMsg(NullPointerException, "Private object not initialized");
                }
 
-               TimeUtilConverter converter(context);
-
                TZDatePtr tzDate(privateObject->getObject());
                std::string result = tzDate->toString();
                return converter.toJSValueRef(result);
@@ -802,14 +755,11 @@ JSValueRef JSTZDate::toString(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return converter.toJSValueRef("Invalid Date");
 }
 
 JSValueRef JSTZDate::getDate(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
@@ -877,6 +827,7 @@ JSValueRef JSTZDate::getSeconds(JSContextRef context, JSObjectRef function, JSOb
 
 JSValueRef JSTZDate::getTZDateValue(JSContextRef context, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception,
         TZDate::TZDateFields dateFields) {
+       TimeUtilConverter converter(context);
        try {
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*> (JSObjectGetPrivate(thisObject));
 
@@ -888,7 +839,6 @@ JSValueRef JSTZDate::getTZDateValue(JSContextRef context, JSObjectRef thisObject
                TZDatePtr tzDate(privateObject->getObject());
                long retVal = tzDate->get(dateFields);
 
-               TimeUtilConverter converter(context);
                LoggerD(">>> retVal:" << retVal);
                return converter.toJSValueRef(static_cast<int> (retVal));
        } Catch(NullPointerException) {
@@ -896,14 +846,11 @@ JSValueRef JSTZDate::getTZDateValue(JSContextRef context, JSObjectRef thisObject
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return converter.toJSValueRef(0);
 }
 
 JSValueRef JSTZDate::setDate(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
@@ -921,19 +868,15 @@ JSValueRef JSTZDate::setDate(JSContextRef context, JSObjectRef function, JSObjec
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
        } Catch (InvalidArgumentException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
        }
 
-       return JSValueMakeNull(context);
+       return JSValueMakeUndefined(context);
 } //setDate()
 
 JSValueRef JSTZDate::setFullYear(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
@@ -951,19 +894,13 @@ JSValueRef JSTZDate::setFullYear(JSContextRef context, JSObjectRef function, JSO
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
        }
 
-       return JSValueMakeNull(context);
+       return JSValueMakeUndefined(context);
 } //setFullYear()
 
 JSValueRef JSTZDate::setHours(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
@@ -981,19 +918,13 @@ JSValueRef JSTZDate::setHours(JSContextRef context, JSObjectRef function, JSObje
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
        }
 
-       return JSValueMakeNull(context);
+       return JSValueMakeUndefined(context);
 } //setHours()
 
 JSValueRef JSTZDate::setMilliseconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
@@ -1011,19 +942,13 @@ JSValueRef JSTZDate::setMilliseconds(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
        }
 
-       return JSValueMakeNull(context);
+       return JSValueMakeUndefined(context);
 } //setMilliseconds()
 
 JSValueRef JSTZDate::setMinutes(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
@@ -1041,19 +966,13 @@ JSValueRef JSTZDate::setMinutes(JSContextRef context, JSObjectRef function, JSOb
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
        }
 
-       return JSValueMakeNull(context);
+       return JSValueMakeUndefined(context);
 } //setMinutes()
 
 JSValueRef JSTZDate::setMonth(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
@@ -1071,19 +990,13 @@ JSValueRef JSTZDate::setMonth(JSContextRef context, JSObjectRef function, JSObje
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
        }
 
-       return JSValueMakeNull(context);
+       return JSValueMakeUndefined(context);
 } //setMonth()
 
 JSValueRef JSTZDate::setSeconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
@@ -1101,19 +1014,13 @@ JSValueRef JSTZDate::setSeconds(JSContextRef context, JSObjectRef function, JSOb
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
        }
 
-       return JSValueMakeNull(context);
+       return JSValueMakeUndefined(context);
 } //setSeconds()
 
 
@@ -1122,8 +1029,6 @@ JSValueRef JSTZDate::setTZDateValue(JSContextRef context, JSObjectRef thisObject
        ArgumentValidator validator(context, argumentCount, arguments);
        long data = validator.toLong(0);
 
-       if ((dateFields == TZDate::TZDATE_YEAR) && (data < 0))
-               ThrowMsg(InvalidArgumentException, "Invalid Argument:Year can't be set to negative");
 
        TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*> (JSObjectGetPrivate(thisObject));
 
@@ -1135,7 +1040,7 @@ JSValueRef JSTZDate::setTZDateValue(JSContextRef context, JSObjectRef thisObject
        TZDatePtr tzDate(privateObject->getObject());
        tzDate->set(dateFields,data);
 
-       return JSValueMakeNull(context);
+       return JSValueMakeUndefined(context);
 }      //setTZDateValue
 
 JSValueRef JSTZDate::getUTCDate(JSContextRef context, JSObjectRef function,
@@ -1188,6 +1093,7 @@ JSValueRef JSTZDate::getUTCSeconds(JSContextRef context, JSObjectRef function,
 
 JSValueRef JSTZDate::getUTCTZDateValue(JSContextRef context, JSObjectRef thisObject, size_t argumentCount, TZDate::TZDateFields DateFields, JSValueRef * exception) {
        LoggerD("Entered");
+       TimeUtilConverter converter(context);
        Try {
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
@@ -1195,8 +1101,6 @@ JSValueRef JSTZDate::getUTCTZDateValue(JSContextRef context, JSObjectRef thisObj
                        ThrowMsg(NullPointerException, "Private object not initialized");
                }
 
-               TimeUtilConverter converter(context);
-
                TZDatePtr tzDate(privateObject->getObject());
                long result = tzDate->getUTC(DateFields);
 
@@ -1208,12 +1112,11 @@ JSValueRef JSTZDate::getUTCTZDateValue(JSContextRef context, JSObjectRef thisObj
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch (InvalidArgumentException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return converter.toJSValueRef(0);
 }
 
 JSValueRef JSTZDate::setUTCDate(JSContextRef context, JSObjectRef function,
@@ -1277,8 +1180,6 @@ JSValueRef JSTZDate::setUTCTZDateValue(JSContextRef context, JSObjectRef thisObj
                else
                        data = converter.toLong(arguments[0]);
 
-               if ((dateFields == TZDate::TZDATE_YEAR) && (data < 0))
-                       ThrowMsg(InvalidArgumentException, "Invalid Argument:Year can't be set to negative");
 
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
@@ -1288,28 +1189,23 @@ JSValueRef JSTZDate::setUTCTZDateValue(JSContextRef context, JSObjectRef thisObj
 
                TZDatePtr tzDate(privateObject->getObject());
                tzDate->setUTC(dateFields, data);
-
-               return JSValueMakeNull(context);
        } Catch(NullPointerException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return JSValueMakeUndefined(context);
 }
 
 JSValueRef JSTZDate::getTimezoneAbbreviation(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
        LoggerD("entered");
+       TimeUtilConverter converter(context);
        Try {
                TZDatePrivObject* privateObject = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
@@ -1317,8 +1213,6 @@ JSValueRef JSTZDate::getTimezoneAbbreviation(JSContextRef context, JSObjectRef f
                        ThrowMsg(NullPointerException, "Private object not initialized");
                }
 
-               TimeUtilConverter converter(context);
-
                TZDatePtr tzDate(privateObject->getObject());
 
                std::string result;
@@ -1329,13 +1223,10 @@ JSValueRef JSTZDate::getTimezoneAbbreviation(JSContextRef context, JSObjectRef f
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
-       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       return converter.toJSValueRef("Invalid Date");
 }
 
 JSValueRef JSTZDate::secondsFromUTC(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
@@ -1358,9 +1249,7 @@ JSValueRef JSTZDate::secondsFromUTC(JSContextRef context, JSObjectRef function,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
@@ -1385,9 +1274,7 @@ JSValueRef JSTZDate::isDST(JSContextRef context, JSObjectRef function, JSObjectR
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
@@ -1418,9 +1305,7 @@ JSValueRef JSTZDate::getPreviousDSTTransition(JSContextRef context, JSObjectRef
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
@@ -1451,9 +1336,7 @@ JSValueRef JSTZDate::getNextDSTTransition(JSContextRef context, JSObjectRef func
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
index dbdcc97..cae01f4 100755 (executable)
@@ -37,7 +37,7 @@ public:
     static const JSClassDefinition* getClassInfo();
 
     static const JSClassRef getClassRef();
-    static JSObjectRef createJSObject(JSContextRef context);
+    static JSObjectRef createJSObject(JSContextRef context, const bool isNotNull = true);
     static JSObjectRef createJSObject(JSContextRef context, const std::string &timezone);
     static JSObjectRef createJSObject(JSContextRef context, const double milliseconds, const std::string &timezone);
     static JSObjectRef createJSObject(JSContextRef context, const TZDateProperties &properties);
index 20b7521..ebcde92 100755 (executable)
@@ -114,17 +114,7 @@ JSValueRef JSTimeDuration::getProperty(JSContextRef context, JSObjectRef object,
                if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_TIMEDURATION_LENGTH)) {
                        return convert.toJSValueRef(static_cast<double>(convert.getDurationLength(object)));
                } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_TIMEDURATION_UNIT)) {
-                       TimeDurationPrivObject* privateObject = static_cast<TimeDurationPrivObject*>(JSObjectGetPrivate(object));
-                       if (!privateObject) {
-                               LoggerE("Private object is not set.");
-                               ThrowMsg(ConversionException, "Private object not initialized");
-                       }
-
-                       DurationPropertiesPtr duration = privateObject->getObject();
-                       std::string unitStr = duration->unitStr;
-                       if (duration->unit != WRONG_UNIT)
-                               duration->unitStr = convert.toDurationUnitString(duration->unit);
-                       return convert.toJSValueRef(duration->unitStr);
+                       return convert.toJSValueRef(convert.toDurationUnitString(convert.getDurationUnit(object))); 
                }
        } Catch (ConversionException) {
                LoggerE("ConversionException: " << _rethrown_exception.GetMessage());
@@ -153,15 +143,15 @@ bool JSTimeDuration::setProperty(JSContextRef context, JSObjectRef object,
 
                if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_TIMEDURATION_LENGTH)) {
                        duration->length = convert.toLongLong(value);
+                       return true;
                } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_TIMEDURATION_UNIT)) {
-                       duration->unitStr = convert.toString(value);
-                       duration->unit = convert.toDurationUnit(duration->unitStr);
-                       if (duration->unit == WRONG_UNIT)
-                               LoggerE("Wrong Unit");
-               } else
-                       return false;
-
-               return true;
+                       std::string unitStr = convert.toString(value);
+                       short unit = convert.toDurationUnit(unitStr);
+                       if ((unit == MSECS_UNIT) && (unitStr != "MSECS"))
+                               ThrowMsg(InvalidArgumentException, unitStr + "is not one of TimeDurationUnit");
+                       duration->unit = unit;
+                       return true;
+               }
        } Catch (NullPointerException) {
                LoggerE("NullPointerException: " << _rethrown_exception.GetMessage());
        } Catch (ConversionException) {
@@ -199,6 +189,7 @@ JSObjectRef JSTimeDuration::createJSObject(JSContextRef context,
 JSObjectRef JSTimeDuration::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
        LoggerD("entered");
        TimeUtilConverter convert(ctx);
+       JSObjectRef timeDuration = NULL;
        Try {
                DurationProperties duration;
                if (argumentCount == 0)
@@ -208,36 +199,29 @@ JSObjectRef JSTimeDuration::constructor(JSContextRef ctx, JSObjectRef constructo
 
                if (argumentCount > 1) {
                        if (!JSValueIsUndefined(ctx, arguments[1]) && !JSValueIsNull(ctx, arguments[1])) {
-                               duration.unitStr = convert.toString(arguments[1]);
-                               duration.unit = convert.toDurationUnit(duration.unitStr);
-                               if (duration.unit == WRONG_UNIT)
-                                       ThrowMsg(ConversionException, "Argument(unit) is invalid(wrong type unit)");
+                               duration.unit = convert.toDurationUnit(convert.toString(arguments[1]));
                        }
                }
-               JSObjectRef timeDuration = createJSObject(ctx, duration);
-               if (timeDuration) {
-                       JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor");
-                   JSObjectSetProperty(ctx, timeDuration, ctorName, constructor,
-                       kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL);
-               JSStringRelease(ctorName);
-                       return timeDuration;
-               }
+               timeDuration = createJSObject(ctx, duration);
        } Catch(NullPointerException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(ctx, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch(WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(ctx, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(ctx, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (InvalidArgumentException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(ctx, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (WrtDeviceApis::Commons::Exception) {
            LoggerW("Trying to get incorrect value");
        }
-       return JSWebAPIErrorFactory::postException(ctx, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
+       if (timeDuration == NULL)
+               timeDuration = JSObjectMake(ctx, getClassRef(), NULL);
+
+       JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor");
+    JSObjectSetProperty(ctx, timeDuration, ctorName, constructor,
+        kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL);
+       JSStringRelease(ctorName);
+       return timeDuration;
 }
 
 JSValueRef JSTimeDuration::diffTimeDuration(JSContextRef context, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception, CompareType type) {
@@ -305,12 +289,6 @@ JSValueRef JSTimeDuration::difference(JSContextRef context, JSObjectRef function
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
-       } Catch (UnsupportedException) {
-               LoggerE("JSTimeUtil::hasInstance NotSupportedException");
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR , "Not Support");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
@@ -327,12 +305,6 @@ JSValueRef JSTimeDuration::equalsTo(JSContextRef context, JSObjectRef function,
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
-       } Catch (UnsupportedException) {
-               LoggerE("JSTimeUtil::hasInstance NotSupportedException");
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR , "Not Support");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
@@ -349,12 +321,6 @@ JSValueRef JSTimeDuration::lessThan(JSContextRef context, JSObjectRef function,
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
-       } Catch (UnsupportedException) {
-               LoggerE("JSTimeUtil::hasInstance NotSupportedException");
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR , "Not Support");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
@@ -371,12 +337,6 @@ JSValueRef JSTimeDuration::greaterThan(JSContextRef context, JSObjectRef functio
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
-       } Catch (UnsupportedException) {
-               LoggerE("JSTimeUtil::hasInstance NotSupportedException");
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR , "Not Support");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
index a43dfff..72561d1 100644 (file)
@@ -101,7 +101,8 @@ void JSTimeUtil::finalize(JSObjectRef object)
        TimeUtilPrivObject* priv = static_cast<TimeUtilPrivObject*>(JSObjectGetPrivate(object));
        JSObjectSetPrivate(object, NULL);
        LoggerD("Deleting timeutil");
-       delete priv;
+       if (priv)
+               delete priv;
 }
 
 bool JSTimeUtil::hasInstance(JSContextRef context,
@@ -132,7 +133,6 @@ JSValueRef JSTimeUtil::getCurrentDateTime(JSContextRef context,
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch(NullPointerException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (WrtDeviceApis::Commons::Exception) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
@@ -202,12 +202,6 @@ JSValueRef JSTimeUtil::getAvailableTimezones(JSContextRef context,
                }
                
                return converter.toJSValueRef(timezonesArray);
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");;
-       } Catch (UnsupportedException) {
-               LoggerE("JSTimeUtil::hasInstance NotSupportedException");
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR , "Not Support");
        } Catch (NullPointerException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
@@ -249,12 +243,6 @@ JSValueRef JSTimeUtil::getDateFormat(JSContextRef context,
     } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");;
-       } Catch (UnsupportedException) {
-               LoggerE("JSTimeUtil::hasInstance NotSupportedException");
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR , "Not Support");
        } Catch (NullPointerException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
@@ -288,12 +276,6 @@ JSValueRef JSTimeUtil::getTimeFormat(JSContextRef context,
                TimeUtilConverter converter(context);
                
                return converter.toJSValueRef(timeFormat);
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
-       } Catch (UnsupportedException) {
-               LoggerE("JSTimeUtil::hasInstance NotSupportedException");
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR , "Not Support");
        } Catch (NullPointerException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
@@ -326,12 +308,6 @@ JSValueRef JSTimeUtil::isLeapYear(JSContextRef context, JSObjectRef function,
        } Catch(ConversionException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LoggerE("Exception: " << _rethrown_exception.GetMessage());
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid Values");
-       } Catch (UnsupportedException) {
-               LoggerE("JSTimeUtil::hasInstance NotSupportedException");
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR , "Not Support");
        } Catch (PlatformException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
index bb04c8b..e80dd2f 100755 (executable)
@@ -44,7 +44,6 @@ TZDate::TZDate(const bool isNotNull)
                }
                else {
                        myCalendar = NULL;
-                       ThrowMsg(Commons::PlatformException, "Can't make to ICU Calendar");
                }
        }
 }
@@ -55,18 +54,19 @@ TZDate::TZDate(const std::string &timezone)
 
        UErrorCode ec = U_ZERO_ERROR;
        TimeUtilTools util;
-       myCalendar = Calendar::createInstance(util.makeTimeZone(timezone) ,ec);
+       TimeZone *tz = util.makeTimeZone(timezone);
+       if (isAvailableTimezone(tz))
+               myCalendar = Calendar::createInstance(tz ,ec);
+       else {
+               if (tz)
+                       delete tz;
+               myCalendar = Calendar::createInstance(ec);
+       }
 
        if (U_SUCCESS(ec)) {
-               TimeUtilTools util;
                util.printDate(myCalendar);
-               if (!util.compareTimeZoneName(myCalendar, timezone)) {
-                       myCalendar = NULL;
-                       ThrowMsg(Commons::InvalidArgumentException, "Unsupported Timezone.");
-               }
        } else {
                myCalendar = NULL;
-               ThrowMsg(Commons::PlatformException, "Can't make to ICU Calendar");
        }
 
 }
@@ -77,14 +77,6 @@ TZDate::TZDate(const TZDateProperties &properties)
 
        TimeUtilTools util;
        myCalendar = _makeCalendar(properties);
-       if (myCalendar != NULL) {
-               if (!util.compareTimeZoneName(myCalendar, properties.timezone)) {
-                       delete myCalendar;
-                       myCalendar = NULL;
-                       ThrowMsg(Commons::InvalidArgumentException, "Unsupported Timezone.");
-               }
-       } else
-               ThrowMsg(Commons::PlatformException, "Can't make to ICU Calendar");
 }
 
 TZDate::~TZDate()
@@ -105,6 +97,29 @@ bool  TZDate::isNull()
        return FALSE;
 }
 
+bool TZDate::isAvailableTimezone(const std::string &timezone) {
+       TimeUtilTools util;
+       TimeZone *tz = util.makeTimeZone(timezone);
+
+       bool result = isAvailableTimezone(tz);
+       
+       if (tz)
+               delete tz;
+       return result;
+}
+
+bool TZDate::isAvailableTimezone(TimeZone *tz) {
+       TimeUtilTools util;
+       bool result = true;
+       UnicodeString id;
+       tz->getID(id);
+
+       if (util.toString(id) == "Etc/Unknown")
+               result = false;
+
+       return result;
+}
+
 Calendar *TZDate::_makeCalendar(const TZDateProperties &properties)
 {
        LoggerD("entered");
@@ -112,7 +127,7 @@ Calendar *TZDate::_makeCalendar(const TZDateProperties &properties)
        TimeUtilTools util;
 
        Calendar *cal = NULL;
-       if (properties.timezone == "")
+       if ((properties.timezone == "") || !isAvailableTimezone(properties.timezone))
                cal = Calendar::createInstance(ec);
        else
                cal = Calendar::createInstance(util.makeTimeZone(properties.timezone) ,ec);
@@ -129,6 +144,9 @@ Calendar *TZDate::_makeCalendar(const TZDateProperties &properties)
 
 std::string TZDate::_getTimezoneName(Calendar *cal)
 {
+       if (cal == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        UnicodeString id;
        TimeUtilTools util;
 
@@ -224,16 +242,17 @@ std::string TZDate::getTimezone()
 }
 
 TZDateProperties TZDate::toTimezone(const std::string timezone) {
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        TimeUtilTools util;
        Calendar *newCalendar = myCalendar->clone();
-       newCalendar->setTimeZone(*(util.makeTimeZone(timezone)));
+       if (newCalendar == NULL)
+               ThrowMsg(Commons::PlatformException, "Can't create new calendar");
 
-       if (!util.compareTimeZoneName(newCalendar, timezone)) {
-               delete newCalendar;
-               ThrowMsg(Commons::InvalidArgumentException, "Unsupported Timezone.");
-       }
+       newCalendar->setTimeZone(*(util.makeTimeZone(timezone)));
 
-       TZDateProperties newProps =  _makeProperties(newCalendar);
+       TZDateProperties newProps = _makeProperties(newCalendar);
        delete newCalendar;
 
        return newProps;
@@ -243,6 +262,9 @@ long TZDate::_get(const TZDateFields field, Calendar *cal)
 {
        LoggerD("<<<");
 
+       if (cal == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        if (_convertDateField(field) == UCAL_FIELD_COUNT){
                LoggerD(">>> UCAL_FIELD_COUNT");
                return -1;
@@ -274,6 +296,15 @@ void TZDate::set(const TZDateFields field, const long value)
        if (_convertDateField(field) == UCAL_FIELD_COUNT)
                return;
 
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
+       if ((field == TZDATE_YEAR) && (value < 0)) {
+               LoggerE("Invalid Argument:Year can't be set to negative");
+               delete myCalendar;
+               myCalendar = NULL;
+               return;
+       }
        TimeUtilTools util;
        myCalendar->set(_convertDateField(field), util.toint32_t(value));
        LoggerD("Field : " << field << " value : " << get(field));
@@ -289,9 +320,12 @@ long TZDate::getUTC(const TZDateFields field)
 
        try {
                utcCalendar = Calendar::createInstance(*(TimeZone::getGMT()),ec);
-               if (!U_SUCCESS(ec))
+               if (!U_SUCCESS(ec) || (utcCalendar == NULL))
                        ThrowMsg(Commons::PlatformException, "Can't create utcCalendar");
 
+               if (myCalendar == NULL)
+                       ThrowMsg(Commons::UnknownException, "Invalid Date");
+
                UDate date = myCalendar->getTime(ec);
                if (!U_SUCCESS(ec))
                        ThrowMsg(Commons::PlatformException, "Can't get time of myCalendar");
@@ -349,8 +383,14 @@ long long TZDate::difference(const TZDateProperties &prop) {
        TimeUtilTools util;
        UErrorCode ec = U_ZERO_ERROR;
 
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        Calendar *otherCalendar = _makeCalendar(prop);
 
+       if (otherCalendar == NULL)
+               ThrowMsg(Commons::PlatformException, "Other calendar is null");
+
        if (!util.compareTimeZoneName(otherCalendar, prop.timezone)) {
                delete otherCalendar;
                ThrowMsg(Commons::InvalidArgumentException, "Unsupported Timezone.");
@@ -379,11 +419,17 @@ long long TZDate::difference(const TZDateProperties &prop) {
 
 TZDateProperties TZDate::addDuration(const DurationProperties &duration) {
        LoggerD("entered");
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        UErrorCode ec = U_ZERO_ERROR;
 
        TimeUtilTools util;
 
        Calendar *cal = myCalendar->clone();
+       if (cal == NULL)
+               ThrowMsg(Commons::PlatformException, "Can't clone my calendar");
+
        long long length = duration.length;
        short unit = duration.unit;
        int msec=0, sec=0, min=0, hour=0;
@@ -505,6 +551,9 @@ std::string TZDate::getLocalTimezoneName() {
 
 double TZDate::getTime() {
        LoggerD("entered");
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        UErrorCode ec = U_ZERO_ERROR;
 
        UDate date = myCalendar->getTime(ec);
@@ -516,6 +565,9 @@ double TZDate::getTime() {
 
 bool TZDate::setTime(const double time) {
        LoggerD("entered");
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        UErrorCode ec = U_ZERO_ERROR;
 
        myCalendar->setTime(static_cast<UDate>(time), ec);
@@ -526,6 +578,9 @@ bool TZDate::setTime(const double time) {
 }
 
  std::string TZDate::toDateString(bool bLocale)  {
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        UErrorCode ec = U_ZERO_ERROR;
        UnicodeString str;
        TimeUtilTools util;
@@ -549,7 +604,10 @@ bool TZDate::setTime(const double time) {
        ThrowMsg(Commons::PlatformException, "can't make SimpleDateFormat or can't get time");
  }
 
-  std::string TZDate::toTimeString(bool bLocale)  {
+ std::string TZDate::toTimeString(bool bLocale)  {
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        UErrorCode ec = U_ZERO_ERROR;
        UnicodeString str;
        TimeUtilTools util;
@@ -573,6 +631,9 @@ bool TZDate::setTime(const double time) {
  }
  
  std::string TZDate::toString(bool bLocale) {
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        LoggerD("entered");
 
        UErrorCode ec = U_ZERO_ERROR;
@@ -598,6 +659,8 @@ bool TZDate::setTime(const double time) {
 
 std::string TZDate::getTimezoneAbbreviation() {
        LoggerD("entered");
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
 
        UErrorCode ec = U_ZERO_ERROR;
        UnicodeString str;
@@ -623,6 +686,9 @@ std::string TZDate::getTimezoneAbbreviation() {
 
 long TZDate::secondsFromUTC() {
        LoggerD("entered");
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        UErrorCode ec = U_ZERO_ERROR;
        TimeUtilTools util;
 
@@ -642,6 +708,9 @@ long TZDate::secondsFromUTC() {
 
 bool TZDate::isDST() {
        LoggerD("entered");
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        UErrorCode ec = U_ZERO_ERROR;
        TimeUtilTools util;
        UBool result = myCalendar->inDaylightTime(ec);
@@ -654,6 +723,9 @@ bool TZDate::isDST() {
 
 TZDateProperties TZDate::getDSTTransition(DSTTransition trans) {
        LoggerD("entered");
+       if (myCalendar == NULL)
+               ThrowMsg(Commons::UnknownException, "Invalid Date");
+
        TimeUtilTools util;
        UErrorCode ec = U_ZERO_ERROR;
        TZDateProperties props;
index 7fe7995..ba4650d 100755 (executable)
@@ -25,6 +25,7 @@
 #include <ctime>
 
 #include <unicode/calendar.h>
+#include <unicode/timezone.h>
 
 #include "TZDateProperties.h"
 #include "DurationProperties.h"
@@ -63,37 +64,38 @@ class TZDate
                NEXT_TRANSITION
        };
 
-               TZDate(const bool isNotNull = TRUE);
+               TZDate(const bool isNotNull = true);
                TZDate(const std::string &timezone);
                TZDate(const TZDateProperties &properties); 
                virtual      ~TZDate();
 
-               virtual bool  isNull();
-               virtual long get(const TZDateFields field);
-               virtual std::string getTimezone();
-               virtual TZDateProperties toTimezone(const std::string timezone);
-               virtual void set(const TZDateFields field, const long value);
-
-               virtual long getUTC(const TZDateFields field);
-               virtual void setUTC(const TZDateFields field, const long value);
-
-               virtual long long difference(const TZDateProperties &prop);
-               virtual TZDateProperties addDuration(const DurationProperties &duration);
-               virtual std::string getUTCTimezoneName();
-               virtual std::string getLocalTimezoneName();
-               virtual TZDateProperties makeProperties();
-
-               virtual double getTime();
-               virtual bool setTime(const double time);
-               virtual std::string toDateString(bool bLocale = false) ;
-               virtual std::string toTimeString(bool bLocale = false);
-               virtual std::string toString(bool bLocale = false);
-
-               virtual std::string getTimezoneAbbreviation();
-               virtual long secondsFromUTC();          
-               virtual bool isDST();
-               virtual TZDateProperties getDSTTransition(DSTTransition trans);
-
+               bool  isNull();
+               long get(const TZDateFields field);
+               std::string getTimezone();
+               TZDateProperties toTimezone(const std::string timezone);
+               void set(const TZDateFields field, const long value);
+
+               long getUTC(const TZDateFields field);
+               void setUTC(const TZDateFields field, const long value);
+
+               long long difference(const TZDateProperties &prop);
+               TZDateProperties addDuration(const DurationProperties &duration);
+               std::string getUTCTimezoneName();
+               std::string getLocalTimezoneName();
+               TZDateProperties makeProperties();
+
+               double getTime();
+               bool setTime(const double time);
+               std::string toDateString(bool bLocale = false) ;
+               std::string toTimeString(bool bLocale = false);
+               std::string toString(bool bLocale = false);
+
+               std::string getTimezoneAbbreviation();
+               long secondsFromUTC();          
+               bool isDST();
+               TZDateProperties getDSTTransition(DSTTransition trans);
+               bool isAvailableTimezone(const std::string &timezone);
+               bool isAvailableTimezone(icu::TimeZone *tz);
        private:
                long _get(const TZDateFields field, icu::Calendar *cal);
                std::string _getTimezoneName(icu::Calendar *cal);
index e5e1024..9fbac1c 100755 (executable)
@@ -112,8 +112,6 @@ DurationProperties TimeUtilConverter::getDurationProperties(JSValueRef value) {
        DurationProperties duration;
        duration.length = getDurationLength(value);
        duration.unit = getDurationUnit(value);
-       if (duration.unit == WRONG_UNIT)
-               ThrowMsg(Commons::ConversionException, "Wrong Unit");
        return duration;
 }
 
@@ -160,28 +158,6 @@ short TimeUtilConverter::getDurationUnit(JSObjectRef object) {
 
 }
 
-std::string TimeUtilConverter::getDurationUnitString(JSValueRef value) {
-       if (JSValueIsNull(m_context, value) || JSValueIsUndefined(m_context, value) || !JSValueIsObjectOfClass(m_context, value, JSTimeDuration::getClassRef())) {
-               ThrowMsg(Commons::ConversionException,
-                        "Wrong input type");
-       }
-       JSObjectRef obj = toJSObjectRef(value);
-       return getDurationUnitString(obj);
-}
-
-std::string TimeUtilConverter::getDurationUnitString(JSObjectRef object) {
-       TimeDurationPrivObject* privateObject = static_cast<TimeDurationPrivObject*>(JSObjectGetPrivate(object));
-       if (!privateObject) {
-               LoggerE("Private object is not set.");
-               ThrowMsg(Commons::ConversionException, "Private object not initialized");
-       }
-
-       DurationPropertiesPtr duration = privateObject->getObject();
-
-       return duration->unitStr;
-
-}
-
 short TimeUtilConverter::toDurationUnit(std::string strUnit) {
        if (!strUnit.compare("DAYS"))
                return DAYS_UNIT;
@@ -191,10 +167,8 @@ short TimeUtilConverter::toDurationUnit(std::string strUnit) {
                return MINUTES_UNIT;
        else if (!strUnit.compare("HOURS"))
                return HOURS_UNIT;
-       else if (!strUnit.compare("MSECS"))
-               return  MSECS_UNIT;
        else
-               return WRONG_UNIT;
+               return  MSECS_UNIT;
 }
 
 std::string TimeUtilConverter::toDurationUnitString(short unit) {
@@ -208,15 +182,12 @@ std::string TimeUtilConverter::toDurationUnitString(short unit) {
                case HOURS_UNIT:
                        return "HOURS";
                case MSECS_UNIT:
-                       return "MSECS";
                default:
-                       return "";
+                       return "MSECS";
        }
 }
 
 long long TimeUtilConverter::convertDurationLength(DurationProperties duration, short unit) {
-       if ((duration.unit == WRONG_UNIT) || (unit == WRONG_UNIT))
-               ThrowMsg(Commons::ConversionException, "Wrong Unit");
        if (duration.unit < unit)
                ThrowMsg(Commons::ConversionException, "Unit is larger than duration's unit");
 
@@ -286,7 +257,6 @@ DurationProperties TimeUtilConverter::optimizedTimeDuration(DurationProperties o
                        result.length /= 24;
                        // intentional fall-through
        }       
-       result.unitStr = toDurationUnitString(result.unit);
        return result;
 }
 
index a28d716..e29d558 100755 (executable)
@@ -55,8 +55,6 @@ class TimeUtilConverter : public Converter
        long long getDurationLength(JSObjectRef object);
        short getDurationUnit(JSValueRef value);
        short getDurationUnit(JSObjectRef object);
-       std::string getDurationUnitString(JSValueRef value);
-       std::string getDurationUnitString(JSObjectRef object);
        short toDurationUnit(std::string strUnit);
        std::string toDurationUnitString(short unit);
        long long convertDurationLength(DurationProperties duration, short unit);