aboutsummaryrefslogtreecommitdiffstats
path: root/asdctool/src/main/java/org
diff options
context:
space:
mode:
authorParshad Patel <pars.patel@samsung.com>2019-02-18 18:55:32 +0900
committerOfir Sonsino <ofir.sonsino@intl.att.com>2019-02-26 09:50:47 +0000
commit31c9fe30b5cc64354ac4d5c0cf9c02efc66d888b (patch)
treee777d1eaee1ac476c6c9e89f530eee6f2a3f1f09 /asdctool/src/main/java/org
parentc48ee4ae63dba6a1e6b7764e1894487447a68374 (diff)
Fix Blocker & Critical Sonar issues in asdctool
Fix NullPointerException issues Update test case Issue-ID: SDC-1895 Change-Id: I183b0bee127efa4331e79a1b76df558dbc9ca33a Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'asdctool/src/main/java/org')
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java18
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java2
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java4
3 files changed, 13 insertions, 11 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
index 8c704357ff..03f3e41bd9 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
@@ -381,7 +381,7 @@ public class ArtifactUuidFix {
return true;
}
- if (artifacts.size() < artifactsUuid.size()) {
+ if ((artifactsUuid != null) && (artifacts.size() < artifactsUuid.size())) {
log.info(" artifacts.size() < artifactsUuid.size() group {} in resource {} ", gr.getName(), resourceName);
return true;
}
@@ -391,7 +391,7 @@ public class ArtifactUuidFix {
gr.getName(), resourceName);
return true;
}
- if (artifactsUuid.contains(null)) {
+ if (artifactsUuid != null && artifactsUuid.contains(null)) {
log.info(" artifactsUuid.contains(null) group {} in resource {} ", gr.getName(), resourceName);
return true;
}
@@ -412,7 +412,7 @@ public class ArtifactUuidFix {
artifactlabel, artifactId, gr.getName(), resourceName);
return true;
}
- if (!artifactsUuid.contains(artifactDefinition.getArtifactUUID())) {
+ if (artifactsUuid != null && !artifactsUuid.contains(artifactDefinition.getArtifactUUID())) {
log.info(
" artifactsUuid.contains(artifactDefinition.getArtifactUUID() label {} group {} in resource {} ",
artifactlabel, gr.getName(), resourceName);
@@ -454,7 +454,7 @@ public class ArtifactUuidFix {
instArtifatIdSet.addAll(instArtifactsId);
}
- if (artifacts.size() < artifactsUuid.size()) {
+ if ((artifactsUuid != null) && (artifacts.size() < artifactsUuid.size())) {
log.info(" artifacts.size() < artifactsUuid.size() inst {} in service {} ", instName, servicename);
return true;
}
@@ -464,7 +464,7 @@ public class ArtifactUuidFix {
instName, servicename);
return true;
}
- if (artifactsUuid.contains(null)) {
+ if (artifactsUuid != null && artifactsUuid.contains(null)) {
log.info(" artifactsUuid.contains(null) inst {} in service {} ", instName, servicename);
return true;
}
@@ -496,7 +496,7 @@ public class ArtifactUuidFix {
artifactlabel, artifactId, instName, servicename);
return true;
}
- if (!artifactsUuid.contains(artifactDefinition.getArtifactUUID())) {
+ if (artifactsUuid != null && !artifactsUuid.contains(artifactDefinition.getArtifactUUID())) {
log.info(
" artifactsUuid.contains(artifactDefinition.getArtifactUUID() label {} inst {} in service {} ",
artifactlabel, instName, servicename);
@@ -522,7 +522,7 @@ public class ArtifactUuidFix {
return true;
}
}
- if(vfModule != null ){
+ if(vfModule != null && artifactsUuid != null){
return isProblematicVFModule(vfModule, artifactsUuid, instArtifactsUuid);
}
@@ -658,7 +658,7 @@ public class ArtifactUuidFix {
writer.flush();
}
} catch (IOException e) {
- log.error(e.getMessage());
+ log.error(e.getMessage());
} finally {
titanDao.commit();
}
@@ -1043,7 +1043,7 @@ public class ArtifactUuidFix {
}
} catch (IOException e) {
- log.error(e.getMessage());
+ log.error(e.getMessage());
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
index 48421639bf..ebd2e2e108 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
@@ -159,7 +159,7 @@ public class DataMigration {
try {
elasticSearchClient.initialize();
} catch (URISyntaxException e) {
- e.printStackTrace();
+ log.error(e.getMessage());
return false;
}
return true;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
index de23c69a3a..d8b8936dca 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
@@ -76,7 +76,9 @@ public class ProductLogic {
return productsToDelete;
} catch (Exception e) {
log.info("get All Products failed - {}" , e);
- graph.tx().rollback();
+ if(graph != null) {
+ graph.tx().rollback();
+ }
return null;
} finally {