fix possible npe in karaf commands

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@963240 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Guillaume Nodet 2010-07-12 11:03:26 +00:00
parent cee683f84c
commit 67699f2a18
1 changed files with 2 additions and 4 deletions

View File

@ -34,18 +34,16 @@ public class ActiveMQCommandSupport extends OsgiCommandSupport {
private Command command;
@Argument(index=0, multiValued=true, required=true)
private Collection<String> arguments = null;
private Collection<String> arguments;
protected Object doExecute() throws Exception {
final String[] args = toStringArray(arguments.toArray());
CommandContext context2 = new CommandContext();
context2.setFormatter(new CommandShellOutputFormatter(System.out));
Command currentCommand = command.getClass().newInstance();
try {
currentCommand.setCommandContext(context2);
currentCommand.execute(new ArrayList<String>(Arrays.asList(args)));
currentCommand.execute(arguments != null ? new ArrayList<String>(arguments) : new ArrayList<String>());
return null;
} catch (Throwable e) {
Throwable cur = e;