X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=BRMSGateway%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2FbrmsInterface%2FBRMSPush.java;h=fd864fded42cf831b54ea70a346873120e237879;hb=c4d332355b0b2b2463c586e8934cfe55dea0ec00;hp=b76812b00a69bb42776e3d57455107ca415fa491;hpb=eefb77c4343190c7dff60f5ab506454dbd702b32;p=policy%2Fengine.git 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 b76812b00..fd864fded 100644 --- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java +++ b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java @@ -571,14 +571,17 @@ public class BRMSPush { String fileName = "rule.jar"; try { website = new URL(artifact.getResourceURI()); - ReadableByteChannel rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(fileName); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - extractJar(fileName, dirName); - new File(fileName).delete(); - } catch (IOException e) { - LOGGER.error("Error while downloading the project to File System. " + e.getMessage(), e); + try( ReadableByteChannel rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(fileName)){ + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + extractJar(fileName, dirName); + new File(fileName).delete(); + }catch (IOException e) { + LOGGER.error("Error while downloading the project to File System. " + e.getMessage(), e); + } + + } catch (IOException e1) { + LOGGER.error("Error while retrieve the artifact. " + e1.getMessage(), e1); } }