fix TC failure
authorGwangbok Kim <gwangbok.kim@samsung.com>
Mon, 1 Jul 2013 14:31:55 +0000 (23:31 +0900)
committerGwangbok Kim <gwangbok.kim@samsung.com>
Mon, 1 Jul 2013 15:03:14 +0000 (00:03 +0900)
Change-Id: I3499ed89a5abbdcb93375ee2eb0465c28497baba
Signed-off-by: Gwangbok Kim <gwangbok.kim@samsung.com>
src/FSclReminder.cpp
src/FScl_ContactImpl.cpp

index d4d001f..65da1e1 100644 (file)
@@ -166,23 +166,30 @@ Reminder::SetMinutesBefore(int minutes)
 result
 Reminder::SetSoundFile(const String& filePath)
 {
-       String tmpFilePath;
-       if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+       if (filePath.IsEmpty())
        {
-               _FileImpl::ConvertVirtualToPhysicalPath(filePath, tmpFilePath);
+               __soundFilePath.Clear();
        }
        else
        {
-               tmpFilePath = filePath;
-       }
+               result r = E_SUCCESS;
+               String tmpFilePath;
+
+               if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+               {
+                       r = _FileImpl::ConvertVirtualToPhysicalPath(filePath, tmpFilePath);
+                       SysTryReturn(NID_SCL, r == E_SUCCESS, E_INVALID_ARG,  E_INVALID_ARG, "[%s] Invalid argument is used.", GetErrorMessage(E_INVALID_ARG));
+               }
+               else
+               {
+                       tmpFilePath = filePath;
+               }
 
-       if (!tmpFilePath.IsEmpty())
-       {
                SysTryReturnResult(NID_SCL, File::IsFileExist(tmpFilePath), E_INVALID_ARG
-                               , "Invalid argument is used. The length of the filePath exceeds the maximum length or the file path is invalid or the file does not exist.");
-       }
+                                       , "Invalid argument is used. The length of the filePath exceeds the maximum length or the file path is invalid or the file does not exist.");
 
-       __soundFilePath = tmpFilePath;
+               __soundFilePath = tmpFilePath;
+       }
 
        return E_SUCCESS;
 }
index f780275..331f331 100644 (file)
@@ -304,14 +304,18 @@ _ContactImpl::GetThumbnailN(void) const
        }
 
        String thumbnailPath(pCharValue);
+       if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+       {
+               _FileImpl::ConvertPhysicalToVirtualPath(pCharValue, thumbnailPath);
+       }
 
        Image image;
-        result r = image.Construct();
-        SysTryReturn(NID_SCL, r != E_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
-        SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Failed to construct Image.", GetErrorMessage(E_SYSTEM));
+       result r = image.Construct();
+       SysTryReturn(NID_SCL, r != E_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Failed to construct Image.", GetErrorMessage(E_SYSTEM));
 
        ImageFormat imageFormat = image.GetImageFormat(thumbnailPath);
-        SysTryReturn(NID_SCL, GetLastResult() != E_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+       SysTryReturn(NID_SCL, GetLastResult() != E_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
        SysTryReturn(NID_SCL, GetLastResult() == E_SUCCESS, null, E_SYSTEM, "[%s] Failed to get the format of the thumbnail image.", GetErrorMessage(E_SYSTEM));
 
        BitmapPixelFormat bitmapPixelFormat = BITMAP_PIXEL_FORMAT_RGB565;
@@ -1144,22 +1148,22 @@ _ContactImpl::SetValue(ContactPropertyId id, const String& value)
 
        case CONTACT_PROPERTY_ID_RINGTONE:
        {
+               SysTryReturn(NID_SCL, value.IsEmpty() || File::IsFileExist(value), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used.", GetErrorMessage(E_INVALID_ARG));
+
                String ringtonePath;
                if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
                {
-                       _FileImpl::ConvertVirtualToPhysicalPath(value, ringtonePath);
+                       if (!value.IsEmpty())
+                       {
+                               result r = _FileImpl::ConvertVirtualToPhysicalPath(value, ringtonePath);
+                               SysTryReturn(NID_SCL, r != E_INVALID_ARG, E_INVALID_ARG,  E_INVALID_ARG, "[%s] Invalid argument is used.", GetErrorMessage(E_INVALID_ARG));
+                       }
                }
                else
                {
                        ringtonePath = value;
                }
 
-               if (!ringtonePath.IsEmpty() && !File::IsFileExist(ringtonePath))
-               {
-                       SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. The specified ringtone file does not exist.", GetErrorMessage(E_INVALID_ARG));
-                       return E_INVALID_ARG;
-               }
-
                std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(ringtonePath));
 
                contacts_record_set_str(__contactHandle, _contacts_contact.ringtone_path, pCharArray.get());