diff options
Diffstat (limited to 'client/client-editor/src/main')
3 files changed, 57 insertions, 58 deletions
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java index ea4f206ce..4d0959977 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java @@ -65,20 +65,6 @@ public class ApexEditorMain { private final PrintStream outStream; /** - * Main method, main entry point for command. - * - * @param args The command line arguments for the editor - */ - public static void main(final String[] args) { - try { - final ApexEditorMain editorMain = new ApexEditorMain(args, System.out); - editorMain.init(); - } catch (final Exception e) { - LOGGER.error("start failed", e); - } - } - - /** * Constructor, kicks off the editor. * * @param args The command line arguments for the editor @@ -212,4 +198,18 @@ public class ApexEditorMain { } } } + + /** + * Main method, main entry point for command. + * + * @param args The command line arguments for the editor + */ + public static void main(final String[] args) { + try { + final ApexEditorMain editorMain = new ApexEditorMain(args, System.out); + editorMain.init(); + } catch (final Exception e) { + LOGGER.error("start failed", e); + } + } } diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java index 72c294169..fed1a50ce 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java @@ -536,10 +536,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -646,10 +646,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -690,10 +690,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -728,10 +728,10 @@ public class ApexEditorRestResource { String version1 = version; LOGGER.entry(name1, version1); try { - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -849,10 +849,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -893,10 +893,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -931,10 +931,10 @@ public class ApexEditorRestResource { String version1 = version; LOGGER.entry(name1, version1); try { - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -1037,8 +1037,8 @@ public class ApexEditorRestResource { final BeanEvent jsonbean = RestUtils.getJsonParameters(jsonString, BeanEvent.class); - if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null - || jsonbean.getVersion().equals("")) { + if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null + || "".equals(jsonbean.getVersion())) { ret = new ApexApiResult(Result.FAILED, "Null/Empty event name/version (\"" + jsonbean.getName() + ":" + jsonbean.getVersion() + "\" passed to UpdateEvent"); return ret; @@ -1085,10 +1085,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -1124,10 +1124,10 @@ public class ApexEditorRestResource { String version1 = version; LOGGER.entry(name1, version1); try { - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -1171,10 +1171,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -1374,8 +1374,8 @@ public class ApexEditorRestResource { final BeanTask jsonbean = RestUtils.getJsonParameters(jsonString, BeanTask.class); - if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null - || jsonbean.getVersion().equals("")) { + if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null + || "".equals(jsonbean.getVersion())) { ret = new ApexApiResult(Result.FAILED, "Null/Empty task name/version (\"" + jsonbean.getName() + ":" + jsonbean.getVersion() + "\" passed to UpdateTask"); return ret; @@ -1422,10 +1422,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -1466,10 +1466,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -1511,10 +1511,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -1777,8 +1777,8 @@ public class ApexEditorRestResource { final BeanPolicy jsonbean = RestUtils.getJsonParameters(jsonString, BeanPolicy.class); - if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null - || jsonbean.getVersion().equals("")) { + if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null + || "".equals(jsonbean.getVersion())) { ret = new ApexApiResult(Result.FAILED, "Null/Empty Policy name/version (\"" + jsonbean.getName() + ":" + jsonbean.getVersion() + "\" passed to UpdatePolicy"); return ret; @@ -1839,10 +1839,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } @@ -1884,10 +1884,10 @@ public class ApexEditorRestResource { return ret; } - if (name1 == null || name1.equals("")) { + if (name1 == null || "".equals(name1)) { name1 = null; } - if (version1 == null || version1.equals("")) { + if (version1 == null || "".equals(version1)) { version1 = null; } diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java index 2bd47238a..2888b0376 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java @@ -49,6 +49,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; * @author Liam Fallon (liam.fallon@ericsson.com) */ public abstract class RestUtils { + // Regular expressions for checking input types + private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; //starts with <?xml...> + /** + * starts with some kind of bracket [ or ( or {, then has something, then has bracket. + */ + private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]"; /** * Constructor, block inheritance. @@ -77,7 +83,7 @@ public abstract class RestUtils { } if (val.isJsonPrimitive() && ((JsonPrimitive) val).isString()) { final String v = ((JsonPrimitive) val).getAsString(); - if (v == null || v.equals("")) { + if (v == null || "".equals(v)) { return JsonNull.INSTANCE; } } @@ -137,13 +143,6 @@ public abstract class RestUtils { return gb.create().fromJson(jsonObject, clz); } - // Regular expressions for checking input types - private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; //starts with <?xml...> - /** - * starts with some kind of bracket [ or ( or {, then has something, then has bracket. - */ - private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]"; - /** * Gets the concept from JSON. * |