summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMurali <murali.p@huawei.com>2017-09-27 10:02:17 +0000
committerMurali <murali.p@huawei.com>2017-09-27 10:05:12 +0000
commitd5633dd617cb6d5992b65c0d1135ec20bfa2b451 (patch)
tree07209ce818bafda7d2c72b2e462003c2fe1d2d5a
parent4d1268b8f2a6d7eaf06211dc5ef5ef8541d2f7d4 (diff)
Remove duplicate literal
Change-Id: I9ed63ea586c8047cf241fbbafb2ac3055c92f648 Jira:VNFSDK-85 Signed-off-by: Murali <murali.p@huawei.com>
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/ToolUtil.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/ToolUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/ToolUtil.java
index 1f3a79d6..777a39d7 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/ToolUtil.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/ToolUtil.java
@@ -42,6 +42,8 @@ public class ToolUtil {
public static final String CATALOGUE_CSAR_DIR_NAME = "csar";
public static final String CATALOGUE_IMAGE_DIR_NAME = "image";
+
+ public static final String CSAR_EXTENSION = ".csar";
public static final int FILE_PERCENT = 1024 * 1024; // 1M
@@ -123,12 +125,12 @@ public class ToolUtil {
*/
public static String getTempDir(String dirName, String fileName) {
return Thread.currentThread().getContextClassLoader().getResource("/").getPath() + dirName + File.separator
- + fileName.replace(".csar", "");
+ + fileName.replace(CSAR_EXTENSION, "");
}
public static String getUnzipDir(String dirName) {
File tmpDir = new File(File.separator + dirName);
- return tmpDir.getAbsolutePath().replace(".csar", "");
+ return tmpDir.getAbsolutePath().replace(CSAR_EXTENSION, "");
}
/**
@@ -199,8 +201,8 @@ public class ToolUtil {
*/
public static String formatCsar(String csarId) {
String result = csarId;
- if (csarId.indexOf(".csar") < 0) {
- result += ".csar";
+ if (csarId.indexOf(CSAR_EXTENSION) < 0) {
+ result += CSAR_EXTENSION;
}
return result;
}
@@ -245,7 +247,7 @@ public class ToolUtil {
* @return String
*/
public static String removeCsarSuffix(String csarName) {
- return csarName.replaceAll(".csar", "");
+ return csarName.replaceAll(CSAR_EXTENSION, "");
}
/**
@@ -255,8 +257,8 @@ public class ToolUtil {
* @return String
*/
public static String addCsarSuffix(String csarName) {
- if (csarName.indexOf(".csar") == -1) {
- return csarName + ".csar";
+ if (csarName.indexOf(CSAR_EXTENSION) == -1) {
+ return csarName + CSAR_EXTENSION;
}
return csarName;
}
@@ -287,8 +289,8 @@ public class ToolUtil {
return "";
}
Gson gson = new Gson();
- String str = gson.toJson(obj);
- return str;
+
+ return gson.toJson(obj);
}
public static String generateId() {