From: Kajur, Harish (vk250x) Date: Mon, 15 Apr 2019 16:16:43 +0000 (-0400) Subject: Fix GenTester by moving the commit earlier X-Git-Tag: 1.1.0~3 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=5dc2f95ceb355d2e6db4ee35ec14fdfd86a1cb3d;p=aai%2Fgraphadmin.git Fix GenTester by moving the commit earlier so if an exception is thrown during commit it gets caught properly and is handled Issue-ID: AAI-2377 Change-Id: I529edcabad4afe803ff387c1a186d9daba44ddc7 Signed-off-by: Kajur, Harish (vk250x) --- diff --git a/src/main/java/org/onap/aai/schema/GenTester.java b/src/main/java/org/onap/aai/schema/GenTester.java index ebc0aba..04ade0a 100644 --- a/src/main/java/org/onap/aai/schema/GenTester.java +++ b/src/main/java/org/onap/aai/schema/GenTester.java @@ -154,23 +154,25 @@ public class GenTester { System.out.println(imsg); LOGGER.info(imsg); SchemaGenerator.loadSchemaIntoJanusGraph(graph, graphMgt, null); + + if( graph != null ){ + imsg = "-- graph commit"; + System.out.println(imsg); + LOGGER.info(imsg); + graph.tx().commit(); + + imsg = "-- graph shutdown "; + System.out.println(imsg); + LOGGER.info(imsg); + graph.close(); + } + } catch(Exception ex) { ErrorLogHelper.logError("AAI_4000", ex.getMessage()); System.exit(1); } - if( graph != null ){ - String imsg = "-- graph commit"; - System.out.println(imsg); - LOGGER.info(imsg); - graph.tx().commit(); - - imsg = "-- graph shutdown "; - System.out.println(imsg); - LOGGER.info(imsg); - graph.close(); - } LOGGER.auditEvent("-- all done, if program does not exit, please kill."); System.exit(0);