diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-03-18 08:41:46 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-03-18 08:41:46 +0000 |
commit | 6490246da875f3946b5f74e1c1971786e71fd7c7 (patch) | |
tree | 2013a241c7d98b9b160cf4e1cda6326bff3ca71e /src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java | |
parent | 01934b63d373ec070032436359756bc2de9ec45d (diff) | |
download | jitsi-6490246da875f3946b5f74e1c1971786e71fd7c7.zip jitsi-6490246da875f3946b5f74e1c1971786e71fd7c7.tar.gz jitsi-6490246da875f3946b5f74e1c1971786e71fd7c7.tar.bz2 |
Cleans up source code, provides tiny optimization.
Diffstat (limited to 'src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java')
-rw-r--r-- | src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java b/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java index fd4a877..0794c9d 100644 --- a/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java +++ b/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java @@ -16,12 +16,16 @@ import org.jitsi.util.*; /** * An implementation of the <tt>CommandNotificationHandler</tt> interface. - * + * * @author Yana Stamcheva */ public class CommandNotificationHandlerImpl implements CommandNotificationHandler { + /** + * The <tt>Logger</tt> used by this <tt>CommandNotificationHandlerImpl</tt> + * instance to log debugging information. + */ private Logger logger = Logger.getLogger(CommandNotificationHandlerImpl.class); @@ -34,30 +38,29 @@ public class CommandNotificationHandlerImpl } /** - * Executes the command, given by the <tt>commandDescriptor</tt> of the - * action. - * + * Executes the command, given by the <tt>descriptor</tt> of a specific + * <tt>CommandNotificationAction</tt>. + * * @param action the action to act upon. * @param cmdargs command-line arguments. */ - public void execute(CommandNotificationAction action, - Map<String,String> cmdargs) + public void execute( + CommandNotificationAction action, + Map<String,String> cmdargs) { - if(StringUtils.isNullOrEmpty(action.getDescriptor(), true)) + String actionDescriptor = action.getDescriptor(); + + if(StringUtils.isNullOrEmpty(actionDescriptor, true)) return; - String actionDescriptor = action.getDescriptor(); if (cmdargs != null) { - for (Map.Entry<String, String> entry : cmdargs.entrySet()) + for (Map.Entry<String, String> cmdarg : cmdargs.entrySet()) { - if(actionDescriptor.indexOf("${" + entry.getKey() + "}") != -1) - { - actionDescriptor = actionDescriptor.replace( - "${" + entry.getKey() + "}", - entry.getValue() - ); - } + actionDescriptor + = actionDescriptor.replace( + "${" + cmdarg.getKey() + "}", + cmdarg.getValue()); } } @@ -65,10 +68,12 @@ public class CommandNotificationHandlerImpl { Runtime.getRuntime().exec(actionDescriptor); } - catch (IOException e) + catch (IOException ioe) { - logger.error("Failed execute the following command: " - + action.getDescriptor(), e); + logger.error( + "Failed to execute the following command: " + + action.getDescriptor(), + ioe); } } } |