aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-03-14 15:43:56 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-14 15:43:56 +0000
commit44fd25bcbb86f8600ec88eeeac6bb8312672c470 (patch)
tree4017d460eb41d902f0490137e9ab0e5c0fb87f85
parent77e2f154dbe8d17dbf09a98a8e42497e9cf25969 (diff)
parentd1aa00c101648ecfea24f01b379d3c1cfaff7b4c (diff)
Merge "Policy:Blocker"
-rw-r--r--BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
index a1113f53d..86cd066b8 100644
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
+++ b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
@@ -586,8 +586,8 @@ public class BRMSPush {
}
}
- private void extractJar(String jarFileName, String artifactId) throws IOException {
- JarFile jar = new JarFile(jarFileName);
+private void extractJar(String jarFileName, String artifactId){
+ try (JarFile jar = new JarFile(jarFileName)) {
Enumeration<?> enumEntries = jar.entries();
while (enumEntries.hasMoreElements()) {
JarEntry file = (JarEntry) enumEntries.nextElement();
@@ -613,18 +613,20 @@ public class BRMSPush {
f = new File(path + File.separator + fileName);
}
if (f != null) {
- InputStream is = jar.getInputStream(file);
- FileOutputStream fos = new FileOutputStream(f);
+ try (InputStream is = jar.getInputStream(file); FileOutputStream fos = new FileOutputStream(f)) {
while (is.available() > 0) {
fos.write(is.read());
}
- fos.close();
- is.close();
LOGGER.info(fileName + " Created..");
+ } catch (IOException e) {
+ LOGGER.info("exception Occured" + e);
+ }
}
- }
- jar.close();
- }
+ }
+ } catch (IOException e) {
+ LOGGER.info("exception Occured" + e);
+ }
+ }
private NexusArtifact getLatestArtifactFromNexus(String selectedName) {
List<NexusArtifact> artifacts = getArtifactFromNexus(selectedName, null);