From df299c18dc8c00878dccdf3086556a08ca202896 Mon Sep 17 00:00:00 2001 From: "prakash.e" Date: Tue, 2 Jan 2018 12:48:58 +0530 Subject: Exception issue fix Change-Id: I75eafe5267909dc1102287ef9bc8dffdb1d5dcba Issue-ID: CCSDK-151 Signed-off-by: prakash.e --- .../sli/northbound/uebclient/SdncUebCallback.java | 35 +++++++++++----------- 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'ueb-listener') 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 89459bcdf..b9df86ef3 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 @@ -325,18 +325,16 @@ public class SdncUebCallback implements INotificationCallback { archiveDir.mkdirs(); } } - - String curFileName = ""; + LOG.debug("Scanning {} - {} for downloaded files", incomingDir.getPath(), incomingDir.toPath()); try (DirectoryStream stream = Files.newDirectoryStream(incomingDir.toPath())) { for (Path file: stream) { - curFileName = file.toString(); handleSuccessfulDownload(null,null, null, null, file.toFile(), archiveDir); } - } catch (Exception x) { + } catch (IOException x) { // IOException can never be thrown by the iteration. // In this snippet, it can only be thrown by newDirectoryStream. - LOG.warn("Cannot process spool file {}", curFileName, x); + LOG.warn("Cannot process spool file", x); } // Deploy scheduled deployments @@ -856,23 +854,24 @@ 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)); + 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)); + } } 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)); + LOG.info("Pass for type "+type.getTag()+" is "+type.getPass()+" which is not <= "+deployList.length); } - } else { - LOG.info("Pass for type "+type.getTag()+" is "+type.getPass()+" which is not <= "+deployList.length); } } -- cgit 1.2.3-korg