aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java
diff options
context:
space:
mode:
authorRavindra Bakkamanthala <rb7147@att.com>2017-05-23 14:56:12 -0400
committerRavindra Bakkamanthala <rb7147@att.com>2017-05-23 16:49:56 -0400
commit87c95be02a8a4d77e165dede90777e811b59dcae (patch)
tree4712199fc3520b530dda0c4d3b074c327df547f2 /POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java
parent7e547eaa55920dfbc9691eab33bb728395b50cf2 (diff)
Commit includes ControlLoopPolicy API and bugfixes
Change-Id: I3e18bb8b4c31a0d908bb0cff4c85e2a3fb450a63 Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
Diffstat (limited to 'POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java
index 6e40c2be2..f5cc5d0fa 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java
@@ -86,11 +86,11 @@ public class PolicyImportWindow{
try {
extractFile = new TarArchiveInputStream (new FileInputStream(this.newfile.toFile()));
} catch (FileNotFoundException e1) {
- e1.printStackTrace();
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Exception while Importing Polcies"+e1);
}
//Create a loop to read every single entry in TAR file
try {
- while ((entry = extractFile.getNextTarEntry()) != null) {
+ while (extractFile!=null && (entry = extractFile.getNextTarEntry()) != null) {
this.superadmin = true;
try{
copyFileToLocation(extractFile, entry, xacmlFiles, null, superadmin);
@@ -100,6 +100,14 @@ public class PolicyImportWindow{
}
} catch (IOException e) {
LOGGER.error("Exception Occured"+e);
+ }finally{
+ try {
+ if(extractFile != null){
+ extractFile.close();
+ }
+ } catch (IOException e) {
+ LOGGER.error("Exception Occured"+e);
+ }
}
}
@@ -149,7 +157,9 @@ public class PolicyImportWindow{
// Close Output Stream
try {
- outputFile.close();
+ if(outputFile != null){
+ outputFile.close();
+ }
} catch (IOException e) {
LOGGER.info("IOException:" +e);
LOGGER.error("Exception Occured"+e);