Remove the check empty token and add catch the exception 41/182841/3 accepted/tizen/4.0/unified/20180629.000210 submit/tizen_4.0/20180628.091646
authorseolheui kim <s414.kim@samsung.com>
Thu, 28 Jun 2018 08:53:18 +0000 (17:53 +0900)
committerseolheui kim <s414.kim@samsung.com>
Thu, 28 Jun 2018 09:13:17 +0000 (18:13 +0900)
Change-Id: I2b1e66c4ad138d8d210c70e9e5801c34360e059d
Signed-off-by: seolheui kim <s414.kim@samsung.com>
server/upgrade-support.cpp

index 91c1263..2195603 100644 (file)
@@ -238,16 +238,14 @@ void removeMasterKey(const std::string &device)
        runtime::File file(getTokenFileName(device));
        readToken(file, token);
 
-       // already removed
-       if (token.empty()) {
-               INFO(SINK, "Token for " + device + " does not exist. Ignoring.");
-               return;
-       }
-
        auto& up = KeyStoragePlugin::Instance();
        up.remove(token);
 
-       file.remove();
+       try {
+               file.remove();
+       } catch (runtime::Exception &e) {
+               ERROR(SINK, "Failed to remove token: " + std::string(e.what()));
+       }
 }
 
 } // namespace UpgradeSupport