summaryrefslogtreecommitdiffstats
path: root/appc-directed-graph/dg-loader/provider/src/main
diff options
context:
space:
mode:
authorburdziak <olaf.burdziakowski@nokia.com>2018-01-26 13:54:34 +0100
committerPatrick Brady <pb071s@att.com>2018-01-26 16:43:05 +0000
commit5cd7ee0c6e5e1e52577c399fd2a3da4da589f59b (patch)
tree07416ed476b17aee01980ae45f34a9c5410c8b50 /appc-directed-graph/dg-loader/provider/src/main
parent208f7d5d83f5d36ddecb82dbf96b4d59a664f0af (diff)
Fixes in DGXMLGenerator
Change-Id: I98821612d8a2ad0aea4484fbb12568301db70a37 Issue-ID: APPC-542 Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
Diffstat (limited to 'appc-directed-graph/dg-loader/provider/src/main')
-rw-r--r--appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLGenerator.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLGenerator.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLGenerator.java
index f9722a04d..b7ff22251 100644
--- a/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLGenerator.java
+++ b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLGenerator.java
@@ -25,6 +25,7 @@
package org.onap.sdnc.dg.loader;
import java.io.File;
+import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.List;
import javax.script.Invocable;
@@ -39,13 +40,13 @@ import org.slf4j.LoggerFactory;
public class DGXMLGenerator {
private final static Logger logger = LoggerFactory.getLogger(DGXMLGenerator.class);
- public static String STRING_ENCODING = "utf-8";
- public static String JS_INTERFACE_DG_CONVERTOR = "dgconverter";
- public static String JS_METHOD_GET_NODE_TO_XML = "getNodeToXml";
- public static String GENERATOR_TEMPLATE_FILE = "js/dg_xml2json.js";
+ public static final String STRING_ENCODING = "utf-8";
+ public static final String JS_INTERFACE_DG_CONVERTOR = "dgconverter";
+ public static final String JS_METHOD_GET_NODE_TO_XML = "getNodeToXml";
+ public static final String GENERATOR_TEMPLATE_FILE = "js/dg_xml2json.js";
public void generateXMLFromJSON(String jsonPath, String xmlpath, String propertyPath)
- throws Exception {
+ throws InvalidParameterException {
try {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("JavaScript");
@@ -71,7 +72,7 @@ public class DGXMLGenerator {
} else if (jsonPathFile.isFile()) {
files.add(jsonPathFile);
} else {
- throw new Exception("Failed to get the nature of the JSON path :" + jsonPath);
+ throw new InvalidParameterException("Failed to get the nature of the JSON path :" + jsonPath);
}
logger.info("JSON Files identified " + files.size());
@@ -122,7 +123,7 @@ public class DGXMLGenerator {
jsonPath = args[0];
xmlPath = args[1];
} else {
- throw new Exception("Sufficient inputs are missing <jsonPath> <xmlPath>");
+ throw new InvalidParameterException("Required inputs are missing <jsonPath> <xmlPath>");
}
application.generateXMLFromJSON(jsonPath, xmlPath, propertyPath);