diff options
-rw-r--r-- | BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java | 19 | ||||
-rw-r--r-- | PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientEnd.java | 4 |
2 files changed, 11 insertions, 12 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 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); } } diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientEnd.java b/PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientEnd.java index e69f007d8..6a1c58650 100644 --- a/PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientEnd.java +++ b/PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientEnd.java @@ -56,10 +56,6 @@ public class AutoClientEnd { private static boolean error = false; private static Logger logger = FlexLogger.getLogger(AutoClientEnd.class.getName()); - private AutoClientEnd() { - // Empty constructor - } - public static void setAuto(NotificationScheme scheme, NotificationHandler handler) { AutoClientEnd.scheme = scheme; |