Fix GenTester by moving the commit earlier 46/85346/2
authorKajur, Harish (vk250x) <vk250x@att.com>
Mon, 15 Apr 2019 16:16:43 +0000 (12:16 -0400)
committerKajur, Harish (vk250x) <vk250x@att.com>
Mon, 15 Apr 2019 17:00:01 +0000 (13:00 -0400)
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) <vk250x@att.com>
src/main/java/org/onap/aai/schema/GenTester.java

index ebc0aba..04ade0a 100644 (file)
@@ -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);