summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2021-03-29 23:37:44 +0000
committerGerrit Code Review <gerrit@onap.org>2021-03-29 23:37:44 +0000
commit4855a220b07a6199516beb3bc406fa52c98eea10 (patch)
treec50c7e54bed858285603c56632cff8e1b8313976
parentc1e2be87038ba1297a24809bc17073e764870722 (diff)
parent67c2febb7337aa93c5144437088fce26ae03a10f (diff)
Merge "SO BPMN Infra is not crashing when tomcat can't start - aim of this patch is to return non zero exit code when an exception occur in bpmn-infra" into honolulu
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index 477dce1072..8d6e133a1c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -79,6 +79,7 @@ public class MSOInfrastructureApplication {
private static final String LOGS_DIR = "logs_dir";
private static final String BPMN_SUFFIX = ".bpmn";
private static final String SDC_SOURCE = "sdc";
+ private static final int CANNOT_INVOKE_COMMAND = 126;
private static void setLogsDir() {
@@ -88,9 +89,14 @@ public class MSOInfrastructureApplication {
}
public static void main(String... args) {
- SpringApplication.run(MSOInfrastructureApplication.class, args);
- System.getProperties().setProperty("mso.config.path", ".");
- setLogsDir();
+ try {
+ SpringApplication.run(MSOInfrastructureApplication.class, args);
+ System.getProperties().setProperty("mso.config.path", ".");
+ setLogsDir();
+ } catch (Exception e) {
+ logger.error("Exception has occurred during application startup. App will exit. ", e);
+ System.exit(CANNOT_INVOKE_COMMAND);
+ }
}
@PostConstruct