Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Fix callback bug
Browse files Browse the repository at this point in the history
The same callback instance is now used for pre and post actions.
  • Loading branch information
cr0 committed Nov 1, 2014
1 parent 187fa1d commit 6021650
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ private void askNormalPluginSettings(TransferSettings settings, PluginOption opt
throws StorageException, InstantiationException, IllegalAccessException {

Class<? extends PluginOptionCallback> optionCallbackClass = option.getCallback();
PluginOptionCallback optionClassBackInstance = optionCallbackClass != null ? optionCallbackClass.newInstance() : null;
Class<? extends PluginOptionConverter> optionConverterClass = option.getConverter();

if (!isInteractive && !knownPluginSettings.containsKey(nestPrefix + option.getName())) {
Expand All @@ -195,8 +196,8 @@ else if (knownPluginSettings.containsKey(nestPrefix + option.getName())) {
settings.setField(option.getField().getName(), knownPluginSettings.get(nestPrefix + option.getName()));
}
else {
if (optionCallbackClass != null) {
out.println(optionCallbackClass.newInstance().preQueryCallback());
if (optionClassBackInstance != null) {
out.println(optionClassBackInstance.preQueryCallback());
}

String optionValue = askPluginOption(settings, option);
Expand All @@ -207,8 +208,8 @@ else if (knownPluginSettings.containsKey(nestPrefix + option.getName())) {

settings.setField(option.getField().getName(), optionValue);

if (optionCallbackClass != null) {
out.println(optionCallbackClass.newInstance().postQueryCallback(optionValue));
if (optionClassBackInstance != null) {
out.println(optionClassBackInstance.postQueryCallback(optionValue));
}
}
}
Expand Down

0 comments on commit 6021650

Please sign in to comment.