Skip to content

Commit

Permalink
Fix NPE on standalone plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasponce committed Feb 12, 2016
1 parent cc518a4 commit a71c453
Showing 1 changed file with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void process(Action action) {
return;
}
String actionPlugin = action.getActionPlugin();
ActionPluginListener plugin = plugins.get(actionPlugin);
final ActionPluginListener plugin = plugins.get(actionPlugin);
Set<String> globals = ActionPlugins.getGlobals();
if (plugin == null && ActionPlugins.getGlobals().isEmpty()) {
if (log.isDebugEnabled()) {
Expand All @@ -79,26 +79,30 @@ public void process(Action action) {
}

ActionMessage pluginMessage = new StandaloneActionMessage(action);
executorService.execute(() -> {
try {
plugin.process(pluginMessage);
} catch (Exception e) {
log.debug("Error processing action: " + action.getActionPlugin(), e);
msgLog.errorProcessingAction(e.getMessage());
}
});
if (plugin != null) {
executorService.execute(() -> {
try {
plugin.process(pluginMessage);
} catch (Exception e) {
log.debug("Error processing action: " + action.getActionPlugin(), e);
msgLog.errorProcessingAction(e.getMessage());
}
});
}
// Check if the plugin is executed twice
if (!globals.contains(actionPlugin)) {
for (String global : globals) {
ActionPluginListener globalPlugin = ActionPlugins.getPlugins().get(global);
executorService.execute(() -> {
try {
globalPlugin.process(pluginMessage);
} catch (Exception e) {
log.debug("Error processing action: " + action.getActionPlugin(), e);
msgLog.errorProcessingAction(e.getMessage());
}
});
if (globalPlugin != null) {
executorService.execute(() -> {
try {
globalPlugin.process(pluginMessage);
} catch (Exception e) {
log.debug("Error processing action: " + action.getActionPlugin(), e);
msgLog.errorProcessingAction(e.getMessage());
}
});
}
}
}

Expand Down

0 comments on commit a71c453

Please sign in to comment.