X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fcontroller%2FCreateBRMSParamController.java;h=8258b8bed18f50b7455963a781b0b319d687643d;hp=68dff19bd100a768578cab82cde734ade1d5c9e0;hb=fc5c07705edc4dcb7083b39116a43844bb6a1490;hpb=d9007d680d19734d5dc106479784c420236cca4b diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java index 68dff19bd..8258b8bed 100644 --- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java +++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java @@ -20,7 +20,12 @@ package org.openecomp.policy.controller; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; import java.io.PrintWriter; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -355,11 +360,25 @@ public class CreateBRMSParamController extends RestrictedBaseController { private void paramUIGenerate(PolicyRestAdapter policyAdapter, PolicyEntity entity) { String data = entity.getConfigurationData().getConfigBody(); if(data != null){ + File file = new File(PolicyController.getConfigHome() +File.separator+ entity.getConfigurationData().getConfigurationName()); + if(file.exists()){ + try (BufferedReader br = new BufferedReader(new FileReader(file))) { + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + while (line != null) { + sb.append(line); + sb.append("\n"); + line = br.readLine(); + } + }catch(Exception e){ + policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+ e.getMessage() + e); + } + } try { StringBuilder params = new StringBuilder(""); Boolean flag = false; Boolean comment = false; - for (String line : data.split("\n")) { + for (String line : Files.readAllLines(Paths.get(file.toString()))) { if (line.isEmpty() || line.startsWith("//")) { continue; }