From ff0146fb327dbe5f27b0bd29640f3ace54006d92 Mon Sep 17 00:00:00 2001 From: "Wang,Frank(gw1218)" Date: Tue, 3 Apr 2018 16:17:54 -0500 Subject: Add More Validations on TOSCA Model Format Add more validations on TOSCA MS model file name and content format Issue-ID: POLICY-721 Change-Id: Ic3dfe1887791be1e11bca5695866a77909334536 Signed-off-by: Wang,Frank(gw1218) --- .../policy/controller/CreateDcaeMicroServiceController.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'POLICY-SDK-APP/src/main/java/org') diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java index 0f315a392..c4c822005 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java @@ -1177,7 +1177,17 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { fileList = listModelFiles(this.directory); }else if (yml==true){ - msMLUtils.parseTosca(this.newFile); + errorMsg = msMLUtils.parseTosca(this.newFile); + if(errorMsg != null){ + PrintWriter out = response.getWriter(); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + JSONObject j = new JSONObject(); + j.put("errorMsg", errorMsg); + out.write(j.toString()); + return; + } }else { File file = new File(this.newFile); -- cgit 1.2.3-korg