aboutsummaryrefslogtreecommitdiffstats
path: root/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
diff options
context:
space:
mode:
authorrb7147 <rb7147@att.com>2017-06-09 15:11:06 -0400
committerrb7147 <rb7147@att.com>2017-06-12 16:59:35 -0400
commit685ed1545ed28b777a3ba6e7d315b78f355154cb (patch)
tree1e37d639242c5f1e9cbf5623821f8498542b81dc /ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
parentfc5c07705edc4dcb7083b39116a43844bb6a1490 (diff)
[Policy-20] getConfig & Policy resolved blockers
Change-Id: If08e4c90d419e8d6e1426d817a12dde5b7cafba3 Signed-off-by: rb7147 <rb7147@att.com>
Diffstat (limited to 'ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java')
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java24
1 files changed, 10 insertions, 14 deletions
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
index 536f8e6b3..a0746439f 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
@@ -215,12 +215,14 @@ public abstract class Policy {
new JSONObject(data);
InputStream stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
jsonReader = Json.createReader(stream);
- System.out.println("Json Value is: " + jsonReader.read().toString() );
+ LOGGER.info("Json Value is: " + jsonReader.read().toString() );
} catch (Exception e) {
LOGGER.error("Exception Occured while reading json"+e);
return false;
}finally{
- jsonReader.close();
+ if(jsonReader != null){
+ jsonReader.close();
+ }
}
return true;
}
@@ -302,8 +304,9 @@ public abstract class Policy {
//
//Does not need to be XACMLPolicyWriterWithPapNotify since it is already in the PAP
//and this transaction is intercepted up stream.
- InputStream inputStream = XACMLPolicyWriter.getXmlAsInputStream((PolicyType) policyData);
+ InputStream inputStream = null;
try {
+ inputStream = XACMLPolicyWriter.getXmlAsInputStream((PolicyType) policyData);
PolicyDef policyDef = DOMPolicyDef.load(inputStream);
if (policyDef == null) {
success.put("validation", "PolicyDef Validation Failed");
@@ -311,10 +314,12 @@ public abstract class Policy {
success.put("success", "success");
}
} catch (Exception e) {
+ LOGGER.error("PolicyDef Validation failed"+e);
success.put("error", "Validation Failed");
}finally{
try {
- inputStream.close();
+ if(inputStream != null)
+ inputStream.close();
} catch (IOException e) {
LOGGER.error("Exception Occured while closing the input stream"+e);
}
@@ -379,16 +384,7 @@ public abstract class Policy {
configHome = webappsPathConfig.toString();
}
}
-
- protected String getParentPathSubScopeDir() {
- final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
- String policyDir = policyAdapter.getParentPath().toString();
- int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
- policyDir = policyDir.substring(startIndex, policyDir.length());
- return policyDir;
- }
-
-
+
public boolean validateConfigForm() {
return true;
}