aboutsummaryrefslogtreecommitdiffstats
path: root/aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java
diff options
context:
space:
mode:
authorDileep Ranganathan <dileep.ranganathan@intel.com>2017-08-30 19:36:12 -0700
committerDileep Ranganathan <dileep.ranganathan@intel.com>2017-08-30 20:22:02 -0700
commitab726b4ca4019f308168a21895e9199fa5f9718c (patch)
tree0ec46bec1a652a7d34c7dcb51ae7d54da501e9ef /aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java
parent2220bc4b234ba7c4a19ef77be861052ee824e394 (diff)
Fix Blocker and Critical Sonar issues/bugs.
Includes ad-hoc fixes for sonar issues within the files modified. Change-Id: Ide181bbe3e05cbc969706a3d798cd99c5609a0b2 Issue-id: AAI-246 Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
Diffstat (limited to 'aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java')
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java40
1 files changed, 19 insertions, 21 deletions
diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java
index 458c4c90..9a90ea28 100644
--- a/aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java
+++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java
@@ -36,7 +36,7 @@ import com.thinkaurelius.titan.core.TitanGraph;
public class ScriptDriver {
-
+
/**
* The main method.
*
@@ -46,7 +46,7 @@ public class ScriptDriver {
* @throws JsonMappingException the json mapping exception
* @throws IOException Signals that an I/O exception has occurred.
*/
- public static void main (String[] args) throws AAIException, JsonGenerationException, JsonMappingException, IOException {
+ public static void main (String[] args) throws AAIException, IOException {
CommandLineArgs cArgs = new CommandLineArgs();
new JCommander(cArgs, args);
@@ -56,26 +56,24 @@ public class ScriptDriver {
}
String config = cArgs.config;
AAIConfig.init();
- TitanGraph graph = TitanFactory.open(config);
- if (!(cArgs.type.equals("oxm") || cArgs.type.equals("graph"))) {
- System.out.println("type: " + cArgs.type + " not recognized.");
- System.exit(1);
- }
-
- Auditor a = null;
- if (cArgs.type.equals("oxm")) {
- a = AuditorFactory.getOXMAuditor(Version.v8);
- } else if (cArgs.type.equals("graph")) {
- a = AuditorFactory.getGraphAuditor(graph);
+ try (TitanGraph graph = TitanFactory.open(config)) {
+ if (!("oxm".equals(cArgs.type) || "graph".equals(cArgs.type))) {
+ System.out.println("type: " + cArgs.type + " not recognized.");
+ System.exit(1);
+ }
+
+ AuditDoc doc = null;
+ if ("oxm".equals(cArgs.type)) {
+ doc = AuditorFactory.getOXMAuditor(Version.v8).getAuditDoc();
+ } else if ("graph".equals(cArgs.type)) {
+ doc = AuditorFactory.getGraphAuditor(graph).getAuditDoc();
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(doc);
+ System.out.println(json);
}
-
- AuditDoc doc = a.getAuditDoc();
-
- ObjectMapper mapper = new ObjectMapper();
-
- String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(doc);
- System.out.println(json);
-
}
}