Pkgname (tizen id) - not null
authorJan Olszak <j.olszak@samsung.com>
Wed, 21 Nov 2012 08:24:48 +0000 (09:24 +0100)
committerJan Olszak <j.olszak@samsung.com>
Wed, 28 Nov 2012 09:49:56 +0000 (10:49 +0100)
[Issue#] It was possible for pkgname to be null.
[Bug] N/A
[Cause] N/A
[Solution] Changed Column deffinition in db file and replaced DPL:Optional<DPL::String> with DPL::String.
[Verification] Build installer.

Change-Id: Ic557877d3048e20357360e24e19c221c115d12cc

12 files changed:
src/configuration_parser/WidgetConfigurationManager.cpp
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/task_certificates.cpp
src/jobs/widget_install/task_encrypt_resource.cpp
src/jobs/widget_install/task_file_manipulation.cpp
src/jobs/widget_install/task_manifest_file.cpp
src/jobs/widget_install/task_private_storage.cpp
src/jobs/widget_install/task_smack.cpp
src/jobs/widget_install/task_widget_config.cpp
src/jobs/widget_uninstall/task_smack.cpp
src/pkg-manager/backendlib.cpp
src/wrt-installer/wrt_installer_api.cpp

index 54b458c..30b47bc 100644 (file)
@@ -36,21 +36,20 @@ IMPLEMENT_SINGLETON(WidgetConfigurationManager)
 //TODO Rewrite this as steps/tasks
 namespace // anonymous
 {
-const char *const DEFAULT_LANGUAGE = "default";
+const char * const DEFAULT_LANGUAGE = "default";
 const size_t MAX_WIDGET_PATH_SIZE = 1024;
 
 //#define WRT_WIDGET_DEFAULT_ICON_WIDTH 80
 //#define WRT_WIDGET_DEFAULT_ICON_HEIGHT 80
 
 //#define WRT_WIDGET_CONFIG_BASE_LOCALE "locales"
-const char *const WRT_WIDGET_CONFIG_FILE_NAME = "config.xml";
+const char * const WRT_WIDGET_CONFIG_FILE_NAME = "config.xml";
 }
 
 bool WidgetConfigurationManager::locateAndParseConfigurationFile(
         const std::string& _currentPath,
         WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
-        const std::string& baseFolder,
-        int* pErrCode)
+        const std::string& baseFolder, int* pErrCode)
 {
     using namespace WrtDB;
 
@@ -63,7 +62,7 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
     // check if this installation from browser, or not.
     size_t pos = _currentPath.rfind("/");
     std::ostringstream infoPath;
-    infoPath << _currentPath.substr(pos+1);
+    infoPath << _currentPath.substr(pos + 1);
 
     ParserRunner parser;
     std::string language = "";
@@ -95,39 +94,35 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
         while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based on its name
             if (ptr->d_type == DT_REG) {
                 if (!strcmp(ptr->d_name, WRT_WIDGET_CONFIG_FILE_NAME)) {
-                    _WrtUtilSetAbsolutePath(cfgAbsPath,
-                                            _currentPath.c_str(), ptr->d_name);
+                    _WrtUtilSetAbsolutePath(cfgAbsPath, _currentPath.c_str(),
+                            ptr->d_name);
                     //Parse widget configuration file
                     LogDebug("Found config: " << cfgAbsPath);
 
                     Try
                     {
-                        parser.Parse(cfgAbsPath, ElementParserPtr(new
-                                                                  RootParser<
-                                                                      WidgetParser>(
-                                                                      configInfo,
-                                                                      DPL
-                                                                          ::
-                                                                          FromUTF32String(
-                                                                          L"widget"))));
-                    }
-                    Catch(ElementParser::Exception::Base)
-                    {
-                        LogDebug("Invalid widget configuration file!");
-                        //                    _rethrown_exception.Dump();
-                        *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
-                        closedir(dir);
-                        return false;
+                        parser.Parse(cfgAbsPath,
+                                ElementParserPtr(
+                                        new RootParser<WidgetParser>(configInfo,
+                                                DPL::FromUTF32String(
+                                                        L"widget"))));
                     }
+                    Catch(ElementParser::Exception::Base){
+                    LogDebug("Invalid widget configuration file!");
+                    //                    _rethrown_exception.Dump();
+                    *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
+                    closedir(dir);
+                    return false;
+                }
 
-                    //
-                    //                WidgetConfigurationParser & parser = WidgetConfigurationParserSingleton::Instance();
-                    //                if (!parser.parseConfigurationFile(cfgAbsPath, configInfo, baseFolder.c_str(), pWidgetConfigInfo.signature_type)) {
-                    //                    LogDebug("Invalid widget configuration file!");
-                    //                    *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
-                    //                    closedir(dir);
-                    //                    return false;
-                    //                }
+                //
+                //                WidgetConfigurationParser & parser = WidgetConfigurationParserSingleton::Instance();
+                //                if (!parser.parseConfigurationFile(cfgAbsPath, configInfo, baseFolder.c_str(), pWidgetConfigInfo.signature_type)) {
+                //                    LogDebug("Invalid widget configuration file!");
+                //                    *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
+                //                    closedir(dir);
+                //                    return false;
+                //                }
 
                     has_config_xml = true;
                     break;
@@ -146,22 +141,18 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
         // in case of browser installation
         Try
         {
-            parser.Parse(_currentPath, ElementParserPtr(new
-                                                      RootParser<
-                                                          WidgetParser>(
-                                                          configInfo,
-                                                          DPL::FromUTF32String(
-                                                              L"widget"))));
-        }
-        Catch(ElementParser::Exception::Base)
-        {
-            LogDebug("Invalid widget configuration file!");
-            //                    _rethrown_exception.Dump();
-            *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
-            return false;
+            parser.Parse(_currentPath,
+                    ElementParserPtr(
+                            new RootParser<WidgetParser>(configInfo,
+                                    DPL::FromUTF32String(L"widget"))));
         }
+        Catch(ElementParser::Exception::Base){
+        LogDebug("Invalid widget configuration file!");
+        //                    _rethrown_exception.Dump();
+        *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
+        return false;
     }
-
+}
 
     char *tmp_language;
     if (!_WrtUtilStringToLower(baseFolder.c_str(), &tmp_language)) {
@@ -189,14 +180,10 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
     }
 
     if (!!configInfo.tizenId) {
-        if (!pWidgetConfigInfo.pkgname) {
-            pWidgetConfigInfo.pkgname = configInfo.tizenId;
-        } else {
-            if (pWidgetConfigInfo.pkgname != configInfo.tizenId) {
-                *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
-                LogDebug("Invalid archive - Tizen ID not same error");
-                return false;
-            }
+        if (pWidgetConfigInfo.pkgname_NOTNULL != *configInfo.tizenId) {
+            *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
+            LogDebug("Invalid archive - Tizen ID not same error");
+            return false;
         }
     }
 
@@ -227,7 +214,7 @@ void WidgetConfigurationManager::processFile(const std::string& path,
     int pErrCode;
 
     if (!locateAndParseConfigurationFile(path, widgetConfiguration,
-                                         DEFAULT_LANGUAGE, &pErrCode)) {
+            DEFAULT_LANGUAGE, &pErrCode)) {
         LogWarning("Widget archive: Failed while parsing config file");
         ThrowMsg(Exception::ProcessFailed, path);
     }
index 96aa5bb..6c11b64 100644 (file)
@@ -312,7 +312,7 @@ bool JobWidgetInstall::setTizenId(
             regfree(&reg);
             return false;
         }
-        m_installerContext.widgetConfig.pkgname = configInfo.tizenId;
+        m_installerContext.widgetConfig.pkgname_NOTNULL = *configInfo.tizenId;
 
     } else {
         WidgetPkgName tizenId = WidgetDAOReadOnly::generateTizenId();
@@ -338,13 +338,13 @@ bool JobWidgetInstall::setTizenId(
                 break;
             }
 
-            m_installerContext.widgetConfig.pkgname = tizenId;
+            m_installerContext.widgetConfig.pkgname_NOTNULL = tizenId;
         }
         LogInfo("tizen_id name was generated by WRT: " << tizenId);
     }
     regfree(&reg);
 
-    LogInfo("Tizen Id : " << m_installerContext.widgetConfig.pkgname);
+    LogInfo("Tizen Id : " << m_installerContext.widgetConfig.pkgname_NOTNULL);
     LogInfo("W3C Widget GUID : " << m_installerContext.widgetConfig.guid);
     return true;
 }
@@ -353,7 +353,7 @@ void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath,
                                                const std::string& tempPath)
 {
     m_installerContext.locations =
-        WidgetLocation(DPL::ToUTF8String(*m_installerContext.widgetConfig.pkgname),
+        WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.pkgname_NOTNULL),
                 widgetPath, tempPath,
                 m_installerContext.widgetConfig.packagingType);
 
@@ -384,19 +384,14 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
         LogInfo("Widget info exists. PkgName: " <<
                 update.existingWidgetInfo.pkgname);
 
-        DPL::OptionalString pkgname = update.existingWidgetInfo.pkgname;
-
-        if(pkgname.IsNull()) {
-            LogInfo("But package name doesn't exist");
-            return ConfigureResult::Failed;
-        }
+        DPL::String pkgname = update.existingWidgetInfo.pkgname;
 
         LogInfo("Widget model exists. package name: " << pkgname);
 
         // Check running state
         int retval = APP_MANAGER_ERROR_NONE;
         bool isRunning = false;
-        retval = app_manager_is_running(DPL::ToUTF8String(*pkgname).c_str(), &isRunning);
+        retval = app_manager_is_running(DPL::ToUTF8String(pkgname).c_str(), &isRunning);
         if (APP_MANAGER_ERROR_NONE != retval) {
             LogError("Fail to get running state");
             return ConfigureResult::Failed;
@@ -418,7 +413,7 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
             }
         }
 
-        m_installerContext.widgetConfig.pkgname = pkgname;
+        m_installerContext.widgetConfig.pkgname_NOTNULL = pkgname;
         OptionalWidgetVersion existingVersion;
         existingVersion = update.existingWidgetInfo.existingVersion;
         OptionalWidgetVersion incomingVersion = update.incomingVersion;
@@ -441,17 +436,15 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
         return ConfigureResult::Failed;
     } else {
         using namespace PackageManager;
-        LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname);
+        LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname_NOTNULL);
 
         configureWidgetLocation(widgetSource, tempPath);
 
         // send start signal of pkgmgr
         PkgmgrSignalSingleton::Instance().setPkgname(
-                    DPL::ToUTF8String(
-                        *m_installerContext.widgetConfig.pkgname));
-        PkgmgrSignalSingleton::Instance().sendSignal(
-                    PKGMGR_START_KEY,
-                    PKGMGR_START_INSTALL);
+                DPL::ToUTF8String(m_installerContext.widgetConfig.pkgname_NOTNULL));
+        PkgmgrSignalSingleton::Instance().sendSignal(PKGMGR_START_KEY,
+                PKGMGR_START_INSTALL);
     }
 
     // Init installer context
@@ -624,7 +617,7 @@ WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
             widgetGUID,
             widgetVersion,
             WidgetUpdateInfo::ExistingWidgetInfo(
-                *dao.getPkgname(), dao.getVersion()));
+                dao.getPkgname_NOTNULL(), dao.getVersion()));
     }
     Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
     {
@@ -667,7 +660,7 @@ void JobWidgetInstall::SendFinishedSuccess()
     //inform widget info
     JobWidgetInstall::displayWidgetInfo();
 
-    DPL::OptionalString & tizenId = m_installerContext.widgetConfig.pkgname;
+    DPL::String & tizenId = m_installerContext.widgetConfig.pkgname_NOTNULL;
 
     // send signal of pkgmgr
     PkgmgrSignalSingleton::Instance().sendSignal(
@@ -676,7 +669,7 @@ void JobWidgetInstall::SendFinishedSuccess()
 
     LogDebug("Call widget install successfinishedCallback");
     getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
-            tizenId.IsNull() ? "" : DPL::ToUTF8String(*tizenId), Exceptions::Success);
+            DPL::ToUTF8String(tizenId), Exceptions::Success);
 }
 
 void JobWidgetInstall::SendFinishedFailure()
@@ -687,7 +680,7 @@ void JobWidgetInstall::SendFinishedFailure()
 
     LogError("Error in installation step: " << m_exceptionCaught);
     LogError("Message: " << m_exceptionMessage);
-    DPL::OptionalString & tizenId = m_installerContext.widgetConfig.pkgname;
+    DPL::String & tizenId = m_installerContext.widgetConfig.pkgname_NOTNULL;
 
     LogDebug("Call widget install failure finishedCallback");
 
@@ -697,7 +690,7 @@ void JobWidgetInstall::SendFinishedFailure()
                 PKGMGR_END_FAILURE);
 
     getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
-            tizenId.IsNull() ? "" : DPL::ToUTF8String(*tizenId), m_exceptionCaught);
+            DPL::ToUTF8String(tizenId), m_exceptionCaught);
 }
 
 void JobWidgetInstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
@@ -712,18 +705,18 @@ void JobWidgetInstall::displayWidgetInfo()
 
     std::ostringstream out;
     WidgetLocalizedInfo localizedInfo =
-        W3CFileLocalization::getLocalizedInfo(*dao.getPkgname());
+        W3CFileLocalization::getLocalizedInfo(dao.getPkgname_NOTNULL());
 
     out << std::endl <<
         "===================================== INSTALLED WIDGET INFO ========="\
         "============================";
     out << std::endl << "Name:                        " << localizedInfo.name;
-    out << std::endl << "PkgName:                     " << dao.getPkgname();
+    out << std::endl << "PkgName:                     " << dao.getPkgname_NOTNULL();
     WidgetSize size = dao.getPreferredSize();
     out << std::endl << "Width:                       " << size.width;
     out << std::endl << "Height:                      " << size.height;
     out << std::endl << "Start File:                  " <<
-        W3CFileLocalization::getStartFile(*dao.getPkgname());
+        W3CFileLocalization::getStartFile(dao.getPkgname_NOTNULL());
     out << std::endl << "Version:                     " << dao.getVersion();
     out << std::endl << "Licence:                     " <<
         localizedInfo.license;
@@ -738,7 +731,7 @@ void JobWidgetInstall::displayWidgetInfo()
         dao.isDistributorSigned();
     out << std::endl << "Widget trusted:              " << dao.isTrusted();
 
-    OptionalWidgetIcon icon = W3CFileLocalization::getIcon(*dao.getPkgname());
+    OptionalWidgetIcon icon = W3CFileLocalization::getIcon(dao.getPkgname_NOTNULL());
     DPL::OptionalString iconSrc =
         !!icon ? icon->src : DPL::OptionalString::Null;
     out << std::endl << "Icon:                        " << iconSrc;
index 644419e..99b613d 100755 (executable)
@@ -61,7 +61,7 @@ void TaskCertificates::StepSetCertiInfo()
 
     if ((pkgmgr_installer_save_certinfo(
                     const_cast<char*>(DPL::ToUTF8String(
-                            *m_context.widgetConfig.pkgname).c_str()),
+                            m_context.widgetConfig.pkgname_NOTNULL).c_str()),
                     m_pkgHandle)) < 0) {
         LogError("pkgmgrInstallerSaveCertinfo fail");
         ThrowMsg(Exceptions::SetCertificateInfoFailed,
@@ -163,7 +163,7 @@ void TaskCertificates::StepAbortCertiInfo()
 {
     if ((pkgmgr_installer_delete_certinfo(
                     const_cast<char*>(DPL::ToUTF8String(
-                            *m_context.widgetConfig.pkgname).c_str()))) < 0) {
+                            m_context.widgetConfig.pkgname_NOTNULL).c_str()))) < 0) {
         LogError("pkgmgr_installer_delete_certinfo fail");
     }
 }
index 2ea97ee..bee8e00 100644 (file)
@@ -78,8 +78,8 @@ void TaskEncryptResource::StepEncryptResource()
 {
     LogDebug("Step Encrypt resource");
     m_resEnc = new ResourceEncryptor;
-    m_resEnc->CreateEncryptionKey(DPL::ToUTF8String(*m_context.
-                widgetConfig.pkgname));
+    m_resEnc->CreateEncryptionKey(DPL::ToUTF8String(m_context.
+                widgetConfig.pkgname_NOTNULL));
 
     EncryptDirectory(m_context.locations->getTemporaryRootDir());
 }
index 759510e..e8fccb4 100644 (file)
@@ -47,10 +47,7 @@ TaskFileManipulation::TaskFileManipulation(InstallerContext& context) :
 void TaskFileManipulation::StepCreateDirs()
 {
     std::string widgetPath;
-    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
-    if (pkgname.IsNull()) {
-        ThrowMsg(Exceptions::InternalError, "No Package name exists.");
-    }
+    DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL;
 
     widgetPath = m_context.locations->getPackageInstallationDir();
 
@@ -77,10 +74,7 @@ void TaskFileManipulation::StepCreateDirs()
 void TaskFileManipulation::StepRenamePath()
 {
     std::string instDir;
-    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
-    if (pkgname.IsNull()) {
-        ThrowMsg(Exceptions::InternalError, "No Package name exists.");
-    }
+    DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL;
 
     if (m_context.widgetConfig.packagingType == PKG_TYPE_HYBRID_WEB_APP) {
         instDir = m_context.locations->getPackageInstallationDir();
index 3acb023..6c583dc 100644 (file)
@@ -307,12 +307,9 @@ DPL::String TaskManifestFile::getIconTargetFilename(
         const DPL::String& languageTag) const
 {
     DPL::OStringStream filename;
-    DPL::Optional<DPL::String> pkgname = m_context.widgetConfig.pkgname;
-    if (pkgname.IsNull()) {
-        ThrowMsg(Exceptions::InternalError, "No Package name exists.");
-    }
+    DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL;
 
-    filename << DPL::ToUTF8String(*pkgname).c_str();
+    filename << DPL::ToUTF8String(pkgname).c_str();
 
     if (!languageTag.empty()) {
         DPL::OptionalString tag = getLangTag(languageTag); // translate en -> en_US etc
@@ -356,7 +353,7 @@ void TaskManifestFile::updateAilInfo()
 {
     // Update ail for desktop
     std::string cfgPkgname =
-        DPL::ToUTF8String(*m_context.widgetConfig.pkgname);
+        DPL::ToUTF8String(m_context.widgetConfig.pkgname_NOTNULL);
     const char* pkgname = cfgPkgname.c_str();
 
     LogDebug("Update ail desktop : " << pkgname );
@@ -391,7 +388,7 @@ void TaskManifestFile::backupIconFiles()
 
     std::list<std::string> fileList;
     getFileList(GlobalConfig::GetUserWidgetDesktopIconPath(), fileList);
-    std::string pkgname = DPL::ToUTF8String(*m_context.widgetConfig.pkgname);
+    std::string pkgname = DPL::ToUTF8String(m_context.widgetConfig.pkgname_NOTNULL);
 
     FOREACH(it, fileList)
     {
@@ -460,7 +457,7 @@ void TaskManifestFile::getFileList(const char* path,
 
 void TaskManifestFile::stepGenerateManifest()
 {
-    DPL::String pkgname = *m_context.widgetConfig.pkgname;
+    DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL;
     manifest_name = pkgname + L".xml";
     manifest_file += L"/tmp/" + manifest_name;
 
@@ -588,11 +585,9 @@ void TaskManifestFile::setWidgetName(Manifest & manifest, UiApplication & uiApp)
     }
     //appid
     DPL::String pkgname;
-    if(!!m_context.widgetConfig.pkgname)
-    {
-        pkgname = *m_context.widgetConfig.pkgname;
-        uiApp.setAppid(pkgname);
-    }
+
+    pkgname = m_context.widgetConfig.pkgname_NOTNULL;
+    uiApp.setAppid(pkgname);
 
     //extraid
     if(!!m_context.widgetConfig.guid) {
@@ -637,10 +632,7 @@ void TaskManifestFile::generateWidgetName(Manifest & manifest, UiApplication &ui
 
 void TaskManifestFile::setWidgetIcons(UiApplication & uiApp)
 {
-    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
-    if (pkgname.IsNull()) {
-        ThrowMsg(Exceptions::InternalError, "No Package name exists.");
-    }
+    DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL;
 
     //TODO this file will need to be updated when user locale preferences
     //changes.
@@ -708,10 +700,8 @@ void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp, const DPL::Opti
 
 void TaskManifestFile::setWidgetManifest(Manifest & manifest)
 {
-    if(!!m_context.widgetConfig.pkgname)
-    {
-        manifest.setPackage(*m_context.widgetConfig.pkgname);
-    }
+    manifest.setPackage(m_context.widgetConfig.pkgname_NOTNULL);
+
     if(!!m_context.widgetConfig.version)
     {
         manifest.setVersion(*m_context.widgetConfig.version);
index 8d9934f..4dae81e 100644 (file)
@@ -64,12 +64,9 @@ void TaskPrivateStorage::StepCreateDirectory()
         InstallerContext::INSTALL_CREATE_PRIVATE_STORAGE;
 
     std::ostringstream widgetPath;
-    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
-    if(!pkgname.IsNull()) {
-        widgetPath << m_context.locations->getPackageInstallationDir() << "/";
-    } else {
-        ThrowMsg(Exceptions::InternalError, "No Package name exists.");
-    }
+    DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL;
+
+    widgetPath << m_context.locations->getPackageInstallationDir() << "/";
 
     if (euidaccess(widgetPath.str().c_str(), W_OK | X_OK) != 0) {
         ThrowMsg(Exceptions::InternalError, DPL::GetErrnoString());
index 7c36c65..98b55a4 100644 (file)
@@ -53,10 +53,9 @@ void TaskSmack::Step()
             devcaps << utf8;
         }
     }
-    DPL::OptionalString pkgName = m_context.widgetConfig.Pkgname;
-    Assert(!pkgName.IsNull() && "widget doesn't have a pkg name");
+    DPL::String pkgName = m_context.widgetConfig.pkgname;
     int result = handle_access_control_conf_forWAC(
-                     DPL::ToUTF8String(*pkgName).c_str(),
+                     DPL::ToUTF8String(pkgName).c_str(),
                      devcaps.str().c_str(),
                      OPERATION_INSTALL);
     Assert(result==PC_OPERATION_SUCCESS && "access control setup failed");
index 8423144..149f833 100644 (file)
@@ -801,13 +801,9 @@ bool TaskWidgetConfig::fillWidgetConfig(WrtDB::WidgetRegisterInfo& pWidgetConfig
         }
     }
     if (!!configInfo.tizenId) {
-        if (!pWidgetConfigInfo.pkgname) {
-            pWidgetConfigInfo.pkgname = configInfo.tizenId;
-        } else {
-            if (pWidgetConfigInfo.pkgname != configInfo.tizenId) {
-                LogError("Invalid archive - Tizen ID not same error");
-                return false;
-            }
+        if (pWidgetConfigInfo.pkgname_NOTNULL != *configInfo.tizenId) {
+            LogError("Invalid archive - Tizen ID not same error");
+            return false;
         }
     }
     if (!!configInfo.version) {
index c6c1a57..0dcf75a 100644 (file)
@@ -43,11 +43,10 @@ void TaskSmack::Step()
 #ifdef WRT_SMACK_ENABLED
     try {
       WrtDB::WidgetDAOReadOnly dao(m_context.locations->getPkgname());
-      DPL::OptionalString pkgName = dao.getPkgname();
-      Assert(!pkgName.IsNull() && "widget doesn't have a pkg name");
+      DPL::String pkgName = dao.getPkgname_NOTNULL();
       const char *devCap = "";
       int result = handle_access_control_conf_forWAC(
-                       DPL::ToUTF8String(*pkgName).c_str(),
+                       DPL::ToUTF8String(pkgName).c_str(),
                        NULL,
                        OPERATION_UNINSTALL);
       Assert(result==PC_OPERATION_SUCCESS && "access control setup failed");
index 27af8cb..1861b94 100644 (file)
@@ -91,7 +91,7 @@ static int pkg_plugin_get_installed_apps_list(const char * /*category*/,
 
 
     WrtDB::WrtDatabase::attachToThreadRO();
-    WidgetPkgNameList pkgnameslList = WidgetDAOReadOnly::getPkgnameList();
+    WidgetPkgNameList_NOTNULL pkgnameslList = WidgetDAOReadOnly::getPkgnameList_NOTNULL();
     *count = 0;
 
     FOREACH(iterator, pkgnameslList) {
@@ -106,7 +106,7 @@ static int pkg_plugin_get_installed_apps_list(const char * /*category*/,
             pkg_last->next = pkg_info;
         }
 
-        WidgetPkgName pkgname = **iterator;
+        WidgetPkgName pkgname = *iterator;
         WidgetDAOReadOnly widget(pkgname);
         strncpy(pkg_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX);
         snprintf(pkg_info->pkg_name, PKG_NAME_STRING_LEN_MAX, "%s",
index 95d59ab..259ca7d 100755 (executable)
@@ -582,7 +582,7 @@ extern "C"
 
             WidgetGUID widget_guid = DPL::FromUTF8String(guid);
             WrtDB::WidgetDAOReadOnly dao(widget_guid);
-            pkgname = DPL::ToUTF8String(*dao.getPkgname());
+            pkgname = DPL::ToUTF8String(dao.getPkgname_NOTNULL());
             return WRT_SUCCESS;
         }
         catch (WidgetDAOReadOnly::Exception::WidgetNotExist)