summaryrefslogtreecommitdiffstats
path: root/vnfmarket-be/vnf-sdk-marketplace
diff options
context:
space:
mode:
authorAvinashS <avinash.s@huawei.com>2017-09-13 14:19:07 +0530
committerAvinashS <avinash.s@huawei.com>2017-09-13 14:19:07 +0530
commitc8b371f8a27d39e6a5bf93b24264cb07b6230339 (patch)
treedd29492287d865a550a5cd6b9b6ea5670b0eb9ff /vnfmarket-be/vnf-sdk-marketplace
parent5ee588e9f10fc3806ea869d365cdfacad3929b70 (diff)
Blocker and critical sonar fix
Few Blocker and critical sonar fixes to help proceed with code reorganization and milestone requirement. Change-Id: Id8c8570d538a40fa910f4cceeca9d04c7d244d2f IssueId: VNFSDK-80 Signed-off-by: AvinashS <avinash.s@huawei.com>
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace')
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java20
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/http/HttpFileManagerImpl.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java9
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestfulClient.java10
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java4
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java8
6 files changed, 27 insertions, 26 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java
index 815acb71..564e7d79 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java
@@ -156,7 +156,7 @@ public final class FileUtil {
inputStream.close();
}
} catch (Exception e1) {
- logger.info("close InputStream error!");
+ logger.info("error while closing InputStream!", e1);
}
}
@@ -171,7 +171,7 @@ public final class FileUtil {
outputStream.close();
}
} catch (Exception e1) {
- logger.info("close OutputStream error!");
+ logger.info("error while closing OutputStream!", e1);
}
}
@@ -181,7 +181,7 @@ public final class FileUtil {
ifs.close();
}
} catch (Exception e1) {
- logger.info("close OutputStream error!");
+ logger.info("error while closing OutputStream", e1);
}
}
@@ -197,7 +197,7 @@ public final class FileUtil {
zipFile = null;
}
} catch (IOException e1) {
- logger.info("close ZipFile error!");
+ logger.info("close ZipFile error!", e1);
}
}
@@ -231,15 +231,15 @@ public final class FileUtil {
}
catch (JsonGenerationException e)
{
- logger.info("JsonGenerationException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+ logger.info("JsonGenerationException Exception: writeJsonDatatoFile-->"+fileAbsPath, e);
}
catch (JsonMappingException e)
{
- logger.info("JsonMappingException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+ logger.info("JsonMappingException Exception: writeJsonDatatoFile-->"+fileAbsPath, e);
}
catch (IOException e)
{
- logger.info("IOException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+ logger.info("IOException Exception: writeJsonDatatoFile-->"+fileAbsPath, e);
}
return bResult;
}
@@ -263,15 +263,15 @@ public final class FileUtil {
}
catch (JsonParseException e1)
{
- logger.info("JsonParseException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+ logger.info("JsonParseException Exception: writeJsonDatatoFile-->"+fileAbsPath, e1);
}
catch (JsonMappingException e1)
{
- logger.info("JsonMappingException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+ logger.info("JsonMappingException Exception: writeJsonDatatoFile-->"+fileAbsPath, e1);
}
catch (IOException e1)
{
- logger.info("IOException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+ logger.info("IOException Exception: writeJsonDatatoFile-->"+fileAbsPath, e1);
}
return obj;
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/http/HttpFileManagerImpl.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/http/HttpFileManagerImpl.java
index d45e1755..24090937 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/http/HttpFileManagerImpl.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/http/HttpFileManagerImpl.java
@@ -41,7 +41,7 @@ public class HttpFileManagerImpl implements FileManager {
ToolUtil.copyDirectory(srcPath, targetDir, true);
} catch (IOException e1) {
flag = false;
- LOGGER.error("copy file failed.errorMsg:" + e1.getMessage());
+ LOGGER.error("ErrorMsg: failed to copy file:", e1);
}
LOGGER.info("upload file success!");
return flag;
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java
index 69f46751..38ca5794 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java
@@ -145,12 +145,15 @@ public class LifecycleTestExceutor
{
dataMap = (Map<String, String>)mapper.readValue(strJsonData, Map.class);
} catch(JsonParseException e) {
- logger.error("JsonParseException:Failed to upload package to catalouge:");
+ logger.error("JsonParseException:Failed to upload package to catalouge:", e);
} catch(JsonMappingException e) {
- logger.error("JsonMappingException:Failed to upload package to catalouge:");
+ logger.error("JsonMappingException:Failed to upload package to catalouge:", e);
} catch(IOException e) {
- logger.error("IOException:Failed to upload package to catalouge:");
+ logger.error("IOException:Failed to upload package to catalouge:", e);
}
+ if(dataMap.get("csarId") != null){
return dataMap.get("csarId");
+ }
+ return "";
}
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestfulClient.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestfulClient.java
index ecc79a1e..093afce2 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestfulClient.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestfulClient.java
@@ -75,15 +75,13 @@ public class RestfulClient {
result.setResult(EntityUtils.toString(entity));
}
} catch (Exception e1) {
- logger.error("send get rest request error:", e1.getMessage());
+ logger.error("send get rest request error:", e1);
} finally {
- if (httpclient != null) {
try {
httpclient.close();
} catch (IOException e2) {
- logger.error("close httpclient error:", e2.getMessage());
+ logger.error("close httpclient error:", e2);
}
- }
}
return result;
}
@@ -150,7 +148,7 @@ public class RestfulClient {
}
catch (Exception ex)
{
- logger.error("Send Post request error:", ex.getMessage());
+ logger.error("Send Post request error:", ex);
}
finally
{
@@ -160,7 +158,7 @@ public class RestfulClient {
}
}
catch(IOException e){
- logger.error("IOException :Send Post request error:", e.getMessage());
+ logger.error("IOException :Send Post request error:", e);
}
}
return result;
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java
index 3bb383fd..8545aa65 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java
@@ -145,7 +145,7 @@ public class PackageWrapper {
result = PackageWrapperUtil.packageDataList2PackageMetaList(dbresult);
return Response.ok(ToolUtil.objectToString(result)).build();
} catch (MarketplaceResourceException e1) {
- LOG.error("query package by csarId from db error ! " + e1.getMessage());
+ LOG.error("query package by csarId from db error ! ", e1);
return RestUtil.getRestException(e1.getMessage());
}
}
@@ -594,7 +594,7 @@ public class PackageWrapper {
}
catch (InterruptedException e)
{
- LOG.info("handleDelayExex response : " + e.getMessage());
+ LOG.info("handleDelayExex response : ", e);
}
}
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java
index a133490f..707f5e61 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java
@@ -114,7 +114,7 @@ public class PackageWrapperUtil {
result = PackageManager.getInstance().queryPackageByCsarId(csarId).get(0);
}
} catch (MarketplaceResourceException e1) {
- LOG.error("query package by csarId from db error ! " + e1.getMessage());
+ LOG.error("query package by csarId from db error ! ", e1);
}
return result;
}
@@ -171,7 +171,7 @@ public class PackageWrapperUtil {
packageList = PackageManager.getInstance().queryPackageByCsarId(csarId);
downloadUri = packageList.get(0).getDownloadUri();
} catch (MarketplaceResourceException e1) {
- LOG.error("Query CSAR package by ID failed ! csarId = " + csarId);
+ LOG.error("Query CSAR package by ID failed ! csarId = " + csarId, e1);
}
return downloadUri;
}
@@ -289,7 +289,7 @@ public class PackageWrapperUtil {
}
}
} catch (IOException e1) {
- LOG.error("judge package type error ! " + e1.getMessage());
+ LOG.error("judge package type error ! ", e1);
}
if (isXmlCsar) {
basicInfo.setFormat(CommonConstant.PACKAGE_XML_FORMAT);
@@ -332,7 +332,7 @@ public class PackageWrapperUtil {
try {
reader.close();
} catch (IOException e1) {
- LOG.error("close reader failed ! " + e1.getMessage());
+ LOG.error("close reader failed ! ", e1);
}
}
}