diff options
author | Dan Timoney <dtimoney@att.com> | 2017-09-11 15:21:41 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-11 15:21:41 +0000 |
commit | 43348099556e047d28a1cdbf85fedf9e7e8a6d47 (patch) | |
tree | d2f6c13257fdc8c66d00dd4cb90b4d35652267a8 /ueb-listener | |
parent | 4493acc059a2e3adc8f2b02bfa22402da1e78e16 (diff) | |
parent | c78bab01fa4667e840aad907ee37fa67b4fe8239 (diff) |
Merge "Fix few Blocker sonar issues"
Diffstat (limited to 'ueb-listener')
-rw-r--r-- | ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java | 18 |
1 files changed, 4 insertions, 14 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 73e8fe55b..e7a42bcb8 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 @@ -208,12 +208,8 @@ public class SdncUebCallback implements INotificationCallback { Properties props = new Properties(); props.load(new FileInputStream(propFile)); - try { - jdbcDataSource = new DBResourceManager(props); - } catch(Throwable exc) { - LOG.error("", exc); - } - + jdbcDataSource = new DBResourceManager(props); + if(((DBResourceManager)jdbcDataSource).isActive()){ LOG.warn( "DBLIB: JDBC DataSource has been initialized."); } else { @@ -405,8 +401,7 @@ public class SdncUebCallback implements INotificationCallback { boolean writeSucceeded = false; - try { - FileWriter spoolFileWriter = new FileWriter(spoolFile); + try (FileWriter spoolFileWriter = new FileWriter(spoolFile)) { spoolFileWriter.write(payload); spoolFileWriter.close(); writeSucceeded = true; @@ -916,11 +911,8 @@ public class SdncUebCallback implements INotificationCallback { msgBuffer.append("<artifact-version>"+artifact.getArtifactVersion()+"</artifact-version>\n"); - try { - BufferedReader rdr = new BufferedReader(new FileReader(artifact.getFile())); - + try (BufferedReader rdr = new BufferedReader(new FileReader(artifact.getFile()))){ String curLine = rdr.readLine(); - while (curLine != null) { if (!curLine.startsWith("<?")) { @@ -928,8 +920,6 @@ public class SdncUebCallback implements INotificationCallback { } curLine = rdr.readLine(); } - rdr.close(); - } catch (Exception e) { LOG.error("Could not process spool file "+artifact.getFile().getName(), e); return(DistributionStatusEnum.DEPLOY_ERROR); |