diff options
author | prakash.e <prakash.e@huawei.com> | 2018-01-05 12:15:29 +0530 |
---|---|---|
committer | prakash eswaramoorthy <prakash.e@huawei.com> | 2018-01-08 14:29:39 +0000 |
commit | 25a55717cf3d16c3bbaf0efdf197e5ccd68123da (patch) | |
tree | 8865d9e72b7392d65dbd8cef3e71bafe1a546c70 /ueb-listener | |
parent | df299c18dc8c00878dccdf3086556a08ca202896 (diff) |
Exception issue
*deployList is used before initialization which results in
NullPointer Exception.
Change-Id: I53d43d7656577368ac35db78ba27c015a2c8ac52
Issue-ID: CCSDK-170
Signed-off-by: prakash.e <prakash.e@huawei.com>
Diffstat (limited to 'ueb-listener')
-rw-r--r-- | ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java index b9df86ef3..35e62f88c 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java @@ -326,6 +326,15 @@ public class SdncUebCallback implements INotificationCallback { } } + // Deploy scheduled deployments + int numPasses = config.getMaxPasses(); + + deployList = new LinkedList[numPasses]; + + for (int i = 0 ; i < numPasses ; i++) { + deployList[i] = new LinkedList<>(); + } + LOG.debug("Scanning {} - {} for downloaded files", incomingDir.getPath(), incomingDir.toPath()); try (DirectoryStream<Path> stream = Files.newDirectoryStream(incomingDir.toPath())) { for (Path file: stream) { @@ -337,14 +346,6 @@ public class SdncUebCallback implements INotificationCallback { LOG.warn("Cannot process spool file", x); } - // Deploy scheduled deployments - int numPasses = config.getMaxPasses(); - - deployList = new LinkedList[numPasses]; - - for (int i = 0 ; i < numPasses ; i++) { - deployList[i] = new LinkedList<>(); - } for (int pass = 0 ; pass < config.getMaxPasses() ; pass++) { if (deployList[pass] != null) { @@ -854,24 +855,22 @@ public class SdncUebCallback implements INotificationCallback { } private void scheduleDeployment(SdncArtifactType type, String svcName, String resourceName, IArtifactInfo artifactInfo, String spoolFileName, File spoolFile) { - if (deployList != null) { - if (type.getPass() < deployList.length) { + if (type.getPass() < deployList.length) { - if (artifactInfo != null) { - LOG.debug("Scheduling "+artifactInfo.getArtifactName()+" version "+artifactInfo.getArtifactVersion()+" for deployment"); + if (artifactInfo != null) { + LOG.debug("Scheduling " + artifactInfo.getArtifactName() + " version " + artifactInfo.getArtifactVersion() + " for deployment"); - deployList[type.getPass()].add(new DeployableArtifact(type, svcName, resourceName, artifactInfo, spoolFile)); - } else { - SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS");//dd/MM/yyyy - Date now = new Date(); - String artifactVersion = sdfDate.format(now); - LOG.debug("Scheduling "+spoolFileName+" version "+artifactVersion+" for deployment"); - deployList[type.getPass()].add(new DeployableArtifact(type, svcName, resourceName, spoolFileName, - artifactVersion, spoolFile)); - } + deployList[type.getPass()].add(new org.onap.ccsdk.sli.northbound.uebclient.SdncUebCallback.DeployableArtifact(type, svcName, resourceName, artifactInfo, spoolFile)); } else { - LOG.info("Pass for type "+type.getTag()+" is "+type.getPass()+" which is not <= "+deployList.length); + SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS");//dd/MM/yyyy + Date now = new Date(); + String artifactVersion = sdfDate.format(now); + LOG.debug("Scheduling " + spoolFileName + " version " + artifactVersion + " for deployment"); + deployList[type.getPass()].add(new org.onap.ccsdk.sli.northbound.uebclient.SdncUebCallback.DeployableArtifact(type, svcName, resourceName, spoolFileName, + artifactVersion, spoolFile)); } + } else { + LOG.info("Pass for type " + type.getTag() + " is " + type.getPass() + " which is not <= " + deployList.length); } } |