upload tizen1.0 source
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Contact / ContactConverter.cpp
index c736d6d..402a9c4 100755 (executable)
@@ -237,10 +237,10 @@ ContactPtr ContactConverter::toContactFromInit(const JSValueRef &jsValue)
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
        }
 
-       if (!validator.checkArrayKeys(m_allowedContactInit, jsValue)) {
-               LogError("invalid properties in ContactInit object");
-               ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
-       }
+//     if (!validator.checkArrayKeys(m_allowedContactInit, jsValue)) {
+//             LogError("invalid properties in ContactInit object");
+//             ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
+//     }
 
        const ScopedJSStringRef nameStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_NAME));
        const ScopedJSStringRef accountStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_ACCOUNT));
@@ -459,10 +459,10 @@ ContactNamePtr ContactConverter::toContactNameFromInit(const JSValueRef &jsValue
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
        }
 
-       if (!validator.checkArrayKeys(m_allowedContactNameInit, jsValue)) {
-               LogError("invalid properties in ContactNameInit object");
-               ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
-       }
+//     if (!validator.checkArrayKeys(m_allowedContactNameInit, jsValue)) {
+//             LogError("invalid properties in ContactNameInit object");
+//             ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
+//     }
 
        const ScopedJSStringRef prefixStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_PREFIX));
        const ScopedJSStringRef firstNameStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_FIRST_NAME));
@@ -575,10 +575,10 @@ ContactOrganizationPtr ContactConverter::toContactOrganizationFromInit(const JSV
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
        }
 
-       if (!validator.checkArrayKeys(m_allowedContactOrganizationInit, jsValue)) {
-               LogError("invalid properties in ContactOrganizationInit object");
-               ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
-       }
+//     if (!validator.checkArrayKeys(m_allowedContactOrganizationInit, jsValue)) {
+//             LogError("invalid properties in ContactOrganizationInit object");
+//             ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
+//     }
 
        // NOTE: Currently not support office and logoURI fields
        const ScopedJSStringRef nameStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_NAME));
@@ -781,10 +781,10 @@ ContactAddressPtr ContactConverter::toContactAddressFromInit(const JSValueRef &j
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
        }
 
-       if (!validator.checkArrayKeys(m_allowedContactAddressInit, jsValue)) {
-               LogError("invalid properties in ContactAddressInit object");
-               ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
-       }
+//     if (!validator.checkArrayKeys(m_allowedContactAddressInit, jsValue)) {
+//             LogError("invalid properties in ContactAddressInit object");
+//             ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
+//     }
 
        const ScopedJSStringRef countryStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_COUNTRY));
        const ScopedJSStringRef regionStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_REGION));
@@ -1180,7 +1180,11 @@ ContactPhoneNumberTypeArrayPtr ContactConverter::toContactPhoneNumberTypeArray(c
        JSObjectRef jsObject = toJSObjectRef(jsValue);
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, jsObject); ++i) {
         JSValueRef element = JSGetArrayElement(m_context, jsObject, i);
-        result->push_back(toContactPhoneNumberType(element));
+        Try {
+               result->push_back(toContactPhoneNumberType(element));
+        } Catch (Exception) {
+               // nothing
+        }
     }
     return result;
 }
@@ -1247,7 +1251,11 @@ ContactEmailAddressTypeArrayPtr ContactConverter::toContactEmailAddressTypeArray
        JSObjectRef jsObject = toJSObjectRef(jsValue);
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, jsObject); ++i) {
         JSValueRef element = JSGetArrayElement(m_context, jsObject, i);
-        result->push_back(toContactEmailAddressType(element));
+        Try {
+               result->push_back(toContactEmailAddressType(element));
+        } Catch (Exception) {
+               // nothing
+        }
     }
     return result;
 }