aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2018-07-13 10:05:50 -0500
committerJorge Hernandez <jh1730@att.com>2018-07-13 10:08:19 -0500
commit2db31606da32d9f5d3a16854385de8e496cd28f6 (patch)
tree801d0c77ac09f342b91eb491113dafad4fc70da4 /POLICY-SDK-APP
parent240bbdbdc76e0e91af9f18164eadb2708d14c6fb (diff)
Reverting "Merge "fix try block""
This reverts commit 240bbdbdc76e0e91af9f18164eadb2708d14c6fb, reversing changes made to 3ee69f1af0acddd1e06060ad88c0029fe7ceeaaf. Change-Id: I61f07ead1d7d3e89c512a2224efecf9ac440df10 Issue-ID: POLICY-961 Signed-off-by: Jorge Hernandez <jh1730@att.com>
Diffstat (limited to 'POLICY-SDK-APP')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java15
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java11
2 files changed, 8 insertions, 18 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
index 21f15bb8a..8df9d1b89 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
@@ -338,17 +338,10 @@ public class PolicyRestController extends RestrictedBaseController{
// get the response content into a String
String responseJson = null;
// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
- try(java.util.Scanner scanner = new java.util.Scanner(connection.getInputStream())) {
- scanner.useDelimiter("\\A");
- responseJson = scanner.hasNext() ? scanner.next() : "";
- } catch (Exception e) {
- //Reason for rethrowing the exception is if any exception occurs during reading of inputsteam
- //then the exception handling is done by the outer block without returning the response immediately
- //Also finally block is existing only in outer block and not here so all exception handling is
- //done in only one place
- policyLogger.error("Exception Occured"+e);
- throw e;
- }
+ java.util.Scanner scanner = new java.util.Scanner(connection.getInputStream());
+ scanner.useDelimiter("\\A");
+ responseJson = scanner.hasNext() ? scanner.next() : "";
+ scanner.close();
policyLogger.info("JSON response from PAP: " + responseJson);
return responseJson;
}
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java
index b14a8815e..a8831eaaf 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java
@@ -455,13 +455,10 @@ public class RESTfulPAPEngine extends StdPDPItemSetChangeNotifier implements PAP
// get the response content into a String
String json = null;
// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
- try(java.util.Scanner scanner = new java.util.Scanner(connection.getInputStream())) {
- scanner.useDelimiter("\\A");
- json = scanner.hasNext() ? scanner.next() : "";
- }catch(Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to read inputStream from connection: " + e, e);
- throw e;
- }
+ java.util.Scanner scanner = new java.util.Scanner(connection.getInputStream());
+ scanner.useDelimiter("\\A");
+ json = scanner.hasNext() ? scanner.next() : "";
+ scanner.close();
LOGGER.info("JSON response from PAP: " + json);
// convert Object sent as JSON into local object