Skip to content

Commit

Permalink
When a module activator's started() method throws an exception, the
Browse files Browse the repository at this point in the history
module should stop - TRUNK-3738
  • Loading branch information
wluyima committed Mar 8, 2013
1 parent 5410b7e commit 58ac620
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions api/src/main/java/org/openmrs/module/ModuleUtil.java
Expand Up @@ -807,12 +807,18 @@ public static AbstractRefreshableApplicationContext refreshApplicationContext(Ab

if (module.getModuleActivator() != null) {
module.getModuleActivator().contextRefreshed();
//if it is system start up, call the started method for all started modules
if (isOpenmrsStartup)
module.getModuleActivator().started();
//if refreshing the context after a user started or uploaded a new module
else if (!isOpenmrsStartup && module.equals(startedModule))
module.getModuleActivator().started();
try {
//if it is system start up, call the started method for all started modules
if (isOpenmrsStartup)
module.getModuleActivator().started();
//if refreshing the context after a user started or uploaded a new module
else if (!isOpenmrsStartup && module.equals(startedModule))
module.getModuleActivator().started();
}
catch (Exception e) {
log.warn("Unable to invoke started() method on the module's activator", e);
ModuleFactory.stopModule(module);
}
}

}
Expand Down

0 comments on commit 58ac620

Please sign in to comment.