Fix : The exception handling according to the situation
[platform/framework/native/content.git] / src / FCnt_ContentManagerImpl.cpp
index 7e79bf5..07614cb 100644 (file)
@@ -299,16 +299,21 @@ _ContentManagerImpl::CreateContent(const ContentInfo& contentInfo)
        SysTryReturn(NID_CNT, pInfoImpl != null, UuId::GetInvalidUuId(), E_INVALID_ARG,
                        "[E_INVALID_ARG] Invalid argument is used. ContentInfo is invalid.");
 
-       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(pInfoImpl->GetContentPath(), true), UuId::GetInvalidUuId(),
-                       E_INVALID_ARG, "[E_INVALID_ARG] The contentPath is not compatible.");
-       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(pInfoImpl->GetContentPath()), UuId::GetInvalidUuId(), E_FILE_NOT_FOUND,
-                       "[E_FILE_NOT_FOUND] The file corresponding to contentInfo could not be found.");
+       String contentPath(pInfoImpl->GetPhysicalContentPath());
+       String changedPath(L"");
+
+       result r = ChangeTizenPathToCompat(contentPath, changedPath);
+       SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] Failed to perform ChangeTizenPathToCompat.", GetErrorMessage(r));
+
+       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(changedPath), UuId::GetInvalidUuId(), E_FILE_NOT_FOUND,
+                       "[%s] The file cound not be found.", GetErrorMessage(E_FILE_NOT_FOUND));
+
        SysTryReturn(NID_CNT, pInfoImpl->GetContentId() == UuId::GetInvalidUuId(), UuId::GetInvalidUuId(),
                        E_INVALID_ARG, "[E_INVALID_ARG] The contentId is not empty.");
 
        // Compare the type of input parameter and system
        ContentType inputType = pInfoImpl->GetContentType();
-       ContentType sysType = _ContentManagerUtilImpl::CheckContentType(pInfoImpl->GetContentPath(), true);
+       ContentType sysType = _ContentManagerUtilImpl::CheckContentType(contentPath, true);
 
        ClearLastResult();
 
@@ -323,7 +328,7 @@ _ContentManagerImpl::CreateContent(const ContentInfo& contentInfo)
        }
 
        // Save data to database with contentPath.
-       unique_ptr<char[]> pStr(_StringConverter::CopyToCharArrayN(contentInfo.GetContentPath()));
+       unique_ptr<char[]> pStr(_StringConverter::CopyToCharArrayN(contentPath));
        SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                        "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -337,7 +342,7 @@ _ContentManagerImpl::CreateContent(const ContentInfo& contentInfo)
        pMediaInfo.reset(tempMediaInfo);
 
        ContentId contentId = SaveDataToDatabase(pMediaInfo.get(), pInfoImpl);
-       result r = GetLastResult();
+       r = GetLastResult();
        SysTryCatch(NID_CNT, contentId != UuId::GetInvalidUuId(), , r,
                        "[%s] The registration to database failed.", GetErrorMessage(r));
 
@@ -346,7 +351,20 @@ _ContentManagerImpl::CreateContent(const ContentInfo& contentInfo)
 CATCH:
        // There are two steps(insert and update) for content registration.
        // If the update failed after inserting, the inserted data SHOULD be deleted from here.
-       val = media_info_delete_from_db(pStr.get());
+       char* pTempMediaId = null;
+       unique_ptr<char, CharDeleter> pMediaId(null);
+       val = media_info_get_media_id(pMediaInfo.get(), &pTempMediaId);
+       if (pTempMediaId != null)
+       {
+               pMediaId.reset(pTempMediaId);
+       }
+       else
+       {
+               SysLog(NID_CNT, "Failed to perform media_info_get_media_id operation.");
+               return UuId::GetInvalidUuId();
+       }
+
+       val = media_info_delete_from_db(pMediaId.get());
        SysLog(NID_CNT, "The result of deletion from database[%d].", val);
 
        return UuId::GetInvalidUuId();
@@ -363,7 +381,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                        "[E_INVALID_ARG] byteBuffer is invalid.");
 
        // Check parameters(for path compatibility)
-       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(destinationPath, false), UuId::GetInvalidUuId(),
+       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(destinationPath), UuId::GetInvalidUuId(),
                        E_INVALID_ARG, "[E_INVALID_ARG] %ls is not compatible.", destinationPath.GetPointer());
        SysTryReturn(NID_CNT, !_FileImpl::IsFileExist(destinationPath), UuId::GetInvalidUuId(), E_FILE_ALREADY_EXIST,
                        "[E_FILE_ALREADY_EXIST] The specified file already exists.");
@@ -398,6 +416,10 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
        media_info_h tempMediaInfo = null;
        unique_ptr<media_info_s, _MediaInfoDeleter> pMediaInfo(null);
        unique_ptr<char[]> pStr(null);
+       String destPath(L"");
+
+       r = ChangeCompatPathToTizen(destinationPath, destPath);
+       SysTryCatch(NID_CNT, !IsFailed(r), , r, "[%s] Failed to perform ChangedCompatPathToTizen.", GetErrorMessage(r));
 
        if (pContentInfo != null)
        {
@@ -426,7 +448,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                }
 
                // Sets the content path
-               pInfoImpl->SetContentPath(destinationPath);
+               pInfoImpl->SetContentPath(destPath);
        }
        else
        {
@@ -441,7 +463,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for ImageContentInfoImpl.");
 
-                       imageContentInfoImpl.SetContentPath(destinationPath);
+                       imageContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&imageContentInfoImpl);
                }
                else if (contentType == CONTENT_TYPE_AUDIO)
@@ -450,7 +472,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for AudioContentInfoImpl.");
 
-                       audioContentInfoImpl.SetContentPath(destinationPath);
+                       audioContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&audioContentInfoImpl);
                }
                else if (contentType == CONTENT_TYPE_VIDEO)
@@ -459,7 +481,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for VideoContentInfoImpl.");
 
-                       videoContentInfoImpl.SetContentPath(destinationPath);
+                       videoContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&videoContentInfoImpl);
                }
                else
@@ -468,13 +490,13 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for OtherContentInfoImpl.");
 
-                       otherContentInfoImpl.SetContentPath(destinationPath);
+                       otherContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&otherContentInfoImpl);
                }
        }
 
        // Register the content to database directly.
-       pStr.reset(_StringConverter::CopyToCharArrayN(destinationPath));
+       pStr.reset(_StringConverter::CopyToCharArrayN(destPath));
        SysTryCatch(NID_CNT, pStr != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
        val = media_info_insert_to_db(pStr.get(), &tempMediaInfo);
@@ -499,7 +521,20 @@ CATCH:
 
        if (pMediaInfo != null)
        {
-               val = media_info_delete_from_db(pStr.get());
+               char* pTempMediaId = null;
+               unique_ptr<char, CharDeleter> pMediaId(null);
+               val = media_info_get_media_id(pMediaInfo.get(), &pTempMediaId);
+               if (pTempMediaId != null)
+               {
+                       pMediaId.reset(pTempMediaId);
+               }
+               else
+               {
+                       SysLog(NID_CNT, "Failed to perform media_info_get_media_id operation.");
+                       return UuId::GetInvalidUuId();
+               }
+
+               val = media_info_delete_from_db(pMediaId.get());
                SysLog(NID_CNT, "The result of deletion from database[%d].", val);
        }
 
@@ -520,24 +555,11 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
        // Check parameters(for path compatibility)
        SysTryReturn(NID_CNT, VerifyHomeFilePathCompatibility(sourcePath), UuId::GetInvalidUuId(), E_INVALID_ARG,
                        "[E_INVALID_ARG] %ls is not compatible.", sourcePath.GetPointer());
-       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(destinationPath, false), UuId::GetInvalidUuId(),
+       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(destinationPath), UuId::GetInvalidUuId(),
                        E_INVALID_ARG, "[E_INVALID_ARG] %ls is not compatible.", destinationPath.GetPointer());
 
-       result r = E_SUCCESS;
-       bool isCopy = false;
-
-       if (deleteSource) // move
-       {
-               r = _FileImpl::Move(sourcePath, destinationPath);
-               SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r, "[%s] Moving the file failed.", GetErrorMessage(r));
-       }
-       else // copy
-       {
-               r = _FileImpl::Copy(sourcePath, destinationPath, true);
-               SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r, "[%s] Copying the file failed.", GetErrorMessage(r));
-
-               isCopy = true;
-       }
+       result r = _FileImpl::Copy(sourcePath, destinationPath, true);
+       SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r, "[%s] Copying the file failed.", GetErrorMessage(r));
 
        int val = 0;
        ContentId contentId;
@@ -549,6 +571,10 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
        media_info_h tempMediaInfo = null;
        unique_ptr<media_info_s, _MediaInfoDeleter> pMediaInfo(null);
        unique_ptr<char[]> pStr(null);
+       String destPath(L"");
+
+       r = ChangeCompatPathToTizen(destinationPath, destPath);
+       SysTryCatch(NID_CNT, !IsFailed(r), , r, "[%s] Failed to perform ChangedCompatPathToTizen.", GetErrorMessage(r));
 
        if (pContentInfo != null)
        {
@@ -577,7 +603,7 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                }
 
                // Set the content path
-               pInfoImpl->SetContentPath(destinationPath);
+               pInfoImpl->SetContentPath(destPath);
        }
        else
        {
@@ -592,7 +618,7 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for ImageContentInfoImpl.");
 
-                       imageContentInfoImpl.SetContentPath(destinationPath);
+                       imageContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&imageContentInfoImpl);
                }
                else if (contentType == CONTENT_TYPE_AUDIO)
@@ -601,7 +627,7 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for AudioContentInfoImpl.");
 
-                       audioContentInfoImpl.SetContentPath(destinationPath);
+                       audioContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&audioContentInfoImpl);
                }
                else if (contentType == CONTENT_TYPE_VIDEO)
@@ -610,7 +636,7 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for VideoContentInfoImpl.");
 
-                       videoContentInfoImpl.SetContentPath(destinationPath);
+                       videoContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&videoContentInfoImpl);
                }
                else
@@ -619,12 +645,12 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for OtherContentInfoImpl.");
 
-                       otherContentInfoImpl.SetContentPath(destinationPath);
+                       otherContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&otherContentInfoImpl);
                }
        }
 
-       pStr.reset(_StringConverter::CopyToCharArrayN(destinationPath));
+       pStr.reset(_StringConverter::CopyToCharArrayN(destPath));
        SysTryCatch(NID_CNT, pStr != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
        val = media_info_insert_to_db(pStr.get(), &tempMediaInfo);
@@ -638,25 +664,42 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
        SysTryCatch(NID_CNT, contentId != UuId::GetInvalidUuId(), , r,
                        "[%s] SaveDataToDatabase failed.", GetErrorMessage(r));
 
+       if (deleteSource)
+       {
+               unique_ptr<char[]> pContentPath(_StringConverter::CopyToCharArrayN(sourcePath));
+               SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY, "[%s] pContentPath is null.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+               r = _FileImpl::Remove(sourcePath);
+               SysTryCatch(NID_CNT, !IsFailed(r), , r, "[%s] Failed to perform Remove operation.", GetErrorMessage(r));
+
+               val = media_content_scan_file(pContentPath.get());
+               SysTryLog(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, "Failed to perform media_content_scan_file[%d].", val);
+       }
+
        return contentId;
 
 CATCH:
        result saveResult = GetLastResult();
 
-       if (isCopy)
-       {
-               r = _FileImpl::Remove(destinationPath);
-               SysLog(NID_CNT, "Remove[%s].", GetErrorMessage(r));
-       }
-       else
-       {
-               r = _FileImpl::Move(destinationPath, sourcePath);
-               SysLog(NID_CNT, "Move[%s].", GetErrorMessage(r));
-       }
+       r = _FileImpl::Remove(destinationPath);
+       SysLog(NID_CNT, "Remove[%s].", GetErrorMessage(r));
 
        if (pMediaInfo != null)
        {
-               val = media_info_delete_from_db(pStr.get());
+               char* pTempMediaId = null;
+               unique_ptr<char, CharDeleter> pMediaId(null);
+               val = media_info_get_media_id(pMediaInfo.get(), &pTempMediaId);
+               if (pTempMediaId != null)
+               {
+                       pMediaId.reset(pTempMediaId);
+               }
+               else
+               {
+                       SysLog(NID_CNT, "Failed to perform media_info_get_media_id operation.");
+                       return UuId::GetInvalidUuId();
+               }
+
+               val = media_info_delete_from_db(pMediaId.get());
                SysLog(NID_CNT, "The result of deletion from database[%d].", val);
        }
 
@@ -695,19 +738,23 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
 
        unique_ptr<char, CharDeleter> pFilePath(pTempFilePath);
        String contentPath(pFilePath.get());
-
-       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(contentPath), null, E_FILE_NOT_FOUND,
-                       "[E_FILE_NOT_FOUND] The file corresponding to contentId could not be found.");
+       String changedPath(L"");
 
        result r = E_SUCCESS;
 
+       r = ChangeTizenPathToCompat(contentPath, changedPath);
+       SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] Failed to perform ChangeTizenPathToCompat.", GetErrorMessage(r));
+
+       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(changedPath), null, E_FILE_NOT_FOUND,
+                       "[E_FILE_NOT_FOUND] The file corresponding to contentId could not be found.");
+
        if (systemType == SYSTEM_TYPE_IMAGE)
        {
                unique_ptr< ImageContentInfo > pImageContentInfo(new (nothrow) ImageContentInfo);
                SysTryReturn(NID_CNT, pImageContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = pImageContentInfo->Construct(&contentPath);
+               r = pImageContentInfo->Construct(&changedPath);
                r = ConvertErrorToResult(r);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r,
                                "[%s] Failed to perform Construct operation to ImageContentInfo.", GetErrorMessage(r));
@@ -727,7 +774,7 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
                SysTryReturn(NID_CNT, pAudioContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = pAudioContentInfo->Construct(&contentPath);
+               r = pAudioContentInfo->Construct(&changedPath);
                r = ConvertErrorToResult(r);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r,
                                "[%s] Failed to perform Construct operation to AudioContentInfo.", GetErrorMessage(r));
@@ -747,7 +794,7 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
                SysTryReturn(NID_CNT, pVideoContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = pVideoContentInfo->Construct(&contentPath);
+               r = pVideoContentInfo->Construct(&changedPath);
                r = ConvertErrorToResult(r);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r,
                                "[%s] Failed to perform Construct operation to VideoContentInfo.", GetErrorMessage(r));
@@ -767,7 +814,7 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
                SysTryReturn(NID_CNT, pOtherContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = pOtherContentInfo->Construct(&contentPath);
+               r = pOtherContentInfo->Construct(&changedPath);
                r = ConvertErrorToResult(r);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r,
                                "[%s] Failed to perform Construct operation to OtherContentInfo.", GetErrorMessage(r));
@@ -791,14 +838,14 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
 result
 _ContentManagerImpl::UpdateContent(const ContentInfo& contentInfo)
 {
-       ContentId contentId = contentInfo.GetContentId();
-       SysTryReturnResult(NID_CNT, contentId != UuId::GetInvalidUuId(), E_INVALID_ARG, "The content id is invalid.");
-       SysTryReturnResult(NID_CNT, _FileImpl::IsFileExist(contentInfo.GetContentPath()), E_FILE_NOT_FOUND,
-                       "The file corresponding to contentInfo could not be found.");
-
        const _ContentInfoImpl* pInfoImpl = _ContentInfoImpl::GetInstance(contentInfo);
        SysTryReturnResult(NID_CNT, pInfoImpl != null, E_INVALID_ARG, "Invalid argument is used. ContentInfo is invalid.");
 
+       ContentId contentId = pInfoImpl->GetContentId();
+       SysTryReturnResult(NID_CNT, contentId != UuId::GetInvalidUuId(), E_INVALID_ARG, "The content id is invalid.");
+       SysTryReturnResult(NID_CNT, _FileImpl::IsFileExist(pInfoImpl->GetContentPath()), E_FILE_NOT_FOUND,
+                       "The file corresponding to contentInfo could not be found.");
+
        result r = UpdateDataToDatabase(pInfoImpl);
        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "UpdateDataToDatabase failed.");
 
@@ -831,16 +878,20 @@ _ContentManagerImpl::DeleteContent(const ContentId& contentId)
                        "media_info_get_file_path failed[%d].", val);
 
        unique_ptr<char, CharDeleter> pContentPath(pTempPath);
+       String contentPath(pContentPath.get());
+       String changedPath(L"");
 
-       String contentPath = String(pContentPath.get());
-       SysTryReturnResult(NID_CNT, _FileImpl::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+       r = ChangeTizenPathToCompat(contentPath, changedPath);
+       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "[%s] Failed to perform ChangeTizenPathToCompat.", GetErrorMessage(r));
+
+       SysTryReturnResult(NID_CNT, _FileImpl::IsFileExist(changedPath), E_FILE_NOT_FOUND,
                        "The file corresponding to contentId could not be found.");
 
        val = media_info_delete_from_db(pContentId.get());
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_delete_From_db failed[%d].", val);
 
-       r = _FileImpl::Remove(contentPath);
+       r = _FileImpl::Remove(changedPath);
        SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "The file is not deleted.");
 
        return r;
@@ -946,78 +997,71 @@ _ContentManagerImpl::UpdateDataToDatabase(const _ContentInfoImpl* pContentInfoIm
        result r = E_SUCCESS;
        unique_ptr<char[]> pValue(null);
 
-       if (!pContentInfoImpl->GetAuthor().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetAuthor()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       // author
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetAuthor()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-               val = media_info_set_author(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_author failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetCategory().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetCategory()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       val = media_info_set_author(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_author failed[%d].", val);
 
-               val = media_info_set_category(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_category failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetContentName().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentName()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       // category
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetCategory()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-               val = media_info_set_content_name(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_content_name failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetDescription().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetDescription()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       val = media_info_set_category(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_category failed[%d].", val);
 
-               val = media_info_set_description(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_description failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetKeyword().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetKeyword()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       // content name
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentName()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-               val = media_info_set_keyword(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_keyword failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetLocationTag().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetLocationTag()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       val = media_info_set_content_name(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_content_name failed[%d].", val);
 
-               val = media_info_set_location_tag(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_location_tag failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetProvider().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetProvider()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       // description
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetDescription()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-               val = media_info_set_provider(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_provider failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetRating().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetRating()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       val = media_info_set_description(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_description failed[%d].", val);
 
-               val = media_info_set_age_rating(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_age_rating failed[%d].", val);
-       }
+       // keyword
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetKeyword()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+       val = media_info_set_keyword(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_keyword failed[%d].", val);
+
+       // location tag
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetLocationTag()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+       val = media_info_set_location_tag(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_location_tag failed[%d].", val);
+
+       // provider
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetProvider()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+       val = media_info_set_provider(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_provider failed[%d].", val);
+
+       // rating
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetRating()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+       val = media_info_set_age_rating(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_age_rating failed[%d].", val);
+
+       // latitude, longitude, altitude
        if (Double::Compare(pContentInfoImpl->GetLatitude(), DEFAULT_COORDINATE) != 0 &&
                        Double::Compare(pContentInfoImpl->GetLongitude(), DEFAULT_COORDINATE) != 0)
        {
@@ -1049,20 +1093,28 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                                                                                                _ContentInfoImpl* pContentInfoImpl) const
 {
        ClearLastResult();
+       result r = E_SUCCESS;
 
        SysTryReturn(NID_CNT, pContentInfoImpl != null, UuId::GetInvalidUuId(), E_INVALID_ARG,
                        "[E_INVALID_ARG] Invalid argument is used. ContentInfo is invalid.");
 
+       String contentPath(pContentInfoImpl->GetPhysicalContentPath());
+       String changedPath(L"");
+
+       r = ChangeTizenPathToCompat(contentPath, changedPath);
+       SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r,
+                       "[%s] Failed to perform ChangeTizenPathToCompat.", GetErrorMessage(r));
+
        String mimeType(L"");
-       String extension = _FileImpl::GetFileExtension(pContentInfoImpl->GetContentPath());
-       result r = GetLastResult();
+       String extension = _FileImpl::GetFileExtension(changedPath);
+       r = GetLastResult();
        if (IsFailed(r))
        {
                ClearLastResult();
 
                SysLog(NID_CNT, "[%s] Failed to perform GetFileExtension operation.", GetErrorMessage(r));
 
-               unique_ptr<char[]> pTempPath(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentPath()));
+               unique_ptr<char[]> pTempPath(_StringConverter::CopyToCharArrayN(contentPath));
                SysTryReturn(NID_CNT, pTempPath != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1082,7 +1134,7 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
        {
                SysLog(NID_CNT, "The format of content is jpg.");
 
-               ImageMetadata* pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(pContentInfoImpl->GetContentPath(), true);
+               ImageMetadata* pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(changedPath, true);
                if (pImageMetadata != null)
                {
                        pContentInfoImpl->SetLatitude(pImageMetadata->GetLatitude());
@@ -1097,86 +1149,79 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
        int val = 0;
        unique_ptr<char[]> pStr(null);
 
-       if (pContentInfoImpl->GetAuthor() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetAuthor()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       // author
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetAuthor()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               val = media_info_set_author(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_author failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetCategory() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetCategory()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       val = media_info_set_author(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_author failed[%d].", val);
 
-               val = media_info_set_category(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_category failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetContentName() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentName()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       // category
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetCategory()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               val = media_info_set_content_name(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_content_name failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetDescription() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetDescription()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       val = media_info_set_category(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_category failed[%d].", val);
 
-               val = media_info_set_description(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_description failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetKeyword() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetKeyword()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       // content name
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentName()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               val = media_info_set_keyword(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_keyword failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetLocationTag() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetLocationTag()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       val = media_info_set_content_name(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_content_name failed[%d].", val);
 
-               val = media_info_set_location_tag(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_location_tag failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetProvider() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetProvider()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       // description
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetDescription()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               val = media_info_set_provider(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_provider failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetRating() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetRating()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       val = media_info_set_description(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_description failed[%d].", val);
 
-               val = media_info_set_age_rating(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_age_rating failed[%d].", val);
-       }
+       // keyword
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetKeyword()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+       val = media_info_set_keyword(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_keyword failed[%d].", val);
+
+       // location tag
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetLocationTag()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+       val = media_info_set_location_tag(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_location_tag failed[%d].", val);
+
+       // provider
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetProvider()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+       val = media_info_set_provider(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_provider failed[%d].", val);
+
+       // rating
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetRating()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+       val = media_info_set_age_rating(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_age_rating failed[%d].", val);
+
+       // latitude, longitude, altitude
        if (Double::Compare(pContentInfoImpl->GetLatitude(), DEFAULT_COORDINATE) != 0 &&
                        Double::Compare(pContentInfoImpl->GetLongitude(), DEFAULT_COORDINATE) != 0)
        {
@@ -1267,30 +1312,8 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, int systemTy
 
                String strFilePath(pStrValue.get());
 
-               // If the api version is 2.0, the content path has to be changed.
-               if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
-               {
-                       if (strFilePath.StartsWith(Environment::GetMediaPath(), 0))
-                       {
-                               r = strFilePath.Replace(Environment::GetMediaPath(), OSP_MEDIA_PHONE);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "The content path is not changed.");
-                       }
-                       else if (strFilePath.StartsWith(Environment::GetExternalStoragePath(), 0))
-                       {
-                               r = strFilePath.Replace(Environment::GetExternalStoragePath(), OSP_MEDIA_MMC);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Replace failed.");
-                       }
-                       else
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] The content path is not supported.");
-                               return E_INVALID_ARG;
-                       }
-               }
-
                pContentInfoImpl->SetContentPath(strFilePath);
-
-               SysSecureLog(NID_CNT, "INFO: contentPath[%ls]", strFilePath.GetPointer());
+               SysSecureLog(NID_CNT, "INFO: contentPath[%ls]", (pContentInfoImpl->GetContentPath()).GetPointer());
        }
 
        // mimeType
@@ -1374,7 +1397,6 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, int systemTy
                String thumbnailPath(pStrValue.get());
 
                pContentInfoImpl->SetThumbnailPath(thumbnailPath);
-
                SysLog(NID_CNT, "INFO: thumbnailPath[%ls]", (pContentInfoImpl->GetThumbnailPath()).GetPointer());
        }
 
@@ -1651,13 +1673,25 @@ _ContentManagerImpl::MakeImageContentInfo(const media_info_h pMediaInfo, void* p
                String dateTaken(pStrValue.get());
                String newDateTaken(L"");
 
-               String delim(L": ");
+               // detour the unexpected datetaken format
+               String tempDelim(L"+-Z");
                String token;
 
+               StringTokenizer tempStrTok(dateTaken, tempDelim);
+
+               r = tempStrTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               dateTaken = token;
+
+               String delim(L": ");
                String year(L"");
 
                StringTokenizer strTok(dateTaken, delim);
 
+               r = strTok.SetDelimiters(delim);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform SetDelimiters operation.");
+
                r = strTok.GetNextToken(token);
                SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
 
@@ -2015,14 +2049,7 @@ _ContentManagerImpl::MakeVideoContentInfo(const media_info_h pMediaInfo, void* p
        pVideoContentInfoImpl->SetDuration(intValue);
        SysLog(NID_CNT, "META: duration[%d]", intValue);
 
-       // Get from metadata extractor (framerate, audio bitrate, video bitrate)
-       VideoMetadata* pVideoMetadata = ContentManagerUtil::GetVideoMetaN(pVideoContentInfoImpl->GetContentPath());
-       result r = GetLastResult();
-       SysTryReturnResult(NID_CNT, pVideoMetadata != null, r, "GetVideoMetadata() failed.");
-
-       pVideoContentInfoImpl->SetFramerate(pVideoMetadata->GetFramerate());
-       pVideoContentInfoImpl->SetAudioBitrate(pVideoMetadata->GetAudioBitrate());
-       pVideoContentInfoImpl->SetVideoBitrate(pVideoMetadata->GetVideoBitrate());
+       // Get some information from metadata extractor when calling VideoContentInfo (framerate, audio bitrate, video bitrate)
 
        return E_SUCCESS;
 }
@@ -2055,57 +2082,67 @@ _ContentManagerImpl::VerifyHomeFilePathCompatibility(const String& contentPath)
 }
 
 bool
-_ContentManagerImpl::VerifyMediaFilePathCompatibility(const String& contentPath, bool checkVersion) const
+_ContentManagerImpl::VerifyMediaFilePathCompatibility(const String& contentPath) const
 {
        ClearLastResult();
 
-       result r = E_SUCCESS;
-
        if (!_AppInfo::IsOspCompat())
        {
-               if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0) || contentPath.StartsWith(OSP_MEDIA_MMC, 0))
-               {
-                       SysLogException(NID_CNT, E_INVALID_ARG, "[E_INVALID_ARG] /Media or /Storagecard/Media is not supported.");
-                       return false;
-               }
                if (!(contentPath.StartsWith(Environment::GetMediaPath(), 0) ||
                                contentPath.StartsWith(Environment::GetExternalStoragePath(), 0)))
                {
-                       SysLogException(NID_CNT, E_INVALID_ARG, "[E_INVALID_ARG] This path is not supported.");
+                       SysLogException(NID_CNT, E_INVALID_ARG, "[%s] This path is not supported.", GetErrorMessage(E_INVALID_ARG));
                        return false;
                }
        }
        else
        {
-               String tempPath(contentPath);
-
                // prior to 2.0
-               if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0))
+               if (!(contentPath.StartsWith(OSP_MEDIA_PHONE, 0)) ||
+                               (contentPath.StartsWith(OSP_MEDIA_MMC, 0)))
                {
-                       r = tempPath.Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
-                       SysTryReturn(NID_CNT, !IsFailed(r), false, E_INVALID_ARG, "[E_INVALID_ARG] Replace failed.");
-               }
-               else if (contentPath.StartsWith(OSP_MEDIA_MMC, 0))
-               {
-                       r = tempPath.Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
-                       SysTryReturn(NID_CNT, !IsFailed(r), false, E_INVALID_ARG, "[E_INVALID_ARG] Replace failed.");
-               }
-               else
-               {
-                       // CreateContent(const ByteBuffer&, ...) and CreateContent (const Sring&, ...) can receive old path like /Media/.
-                       // but CreateContent(const ContentInfo&) always receive new path like /opt/media/ because ContentInfo class convert the path from /Media/ to /opt/media.
-                       if (!checkVersion)
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] The path should start with /Home, /Media, or /Storagecard/Media.");
-                               return false;
-                       }
+                       SysLogException(NID_CNT, E_INVALID_ARG, "[%s] The path should start with /Media, or /Storagecard/Media.", GetErrorMessage(E_INVALID_ARG));
+                       return false;
                }
        }
 
        return true;
 }
 
+result
+_ContentManagerImpl::ChangeTizenPathToCompat(const String& contentPath, String& changedPath) const
+{
+       result r = E_SUCCESS;
+       changedPath = contentPath;
+
+       // If the api version is 2.0, the content path has to be changed.
+       if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+       {
+               r = _FileImpl::ConvertPhysicalToVirtualPath(contentPath, changedPath);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG,
+                               "[%s] Failed to convert physical path to virtual path.", GetErrorMessage(E_INVALID_ARG));
+       }
+
+       return r;
+}
+
+result
+_ContentManagerImpl::ChangeCompatPathToTizen(const String& contentPath, String& changedPath) const
+{
+       result r = E_SUCCESS;
+       changedPath = contentPath;
+
+       // If the api version is 2.0, the content path has to be changed.
+       if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+       {
+               r = _FileImpl::ConvertVirtualToPhysicalPath(contentPath, changedPath);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG,
+                               "[%s] Failed to convert virtual path to physical path.", GetErrorMessage(E_INVALID_ARG));
+       }
+
+       return r;
+}
+
 void
 _ContentManagerImpl::SetListener(IContentUpdateEventListener* pListener)
 {