Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-3158 NPE when starting asadmin multimode tool when DAS isn't accessible #3300

Merged
merged 2 commits into from
Oct 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.text.*;
import java.util.*;
import java.util.logging.Level;
import static java.util.logging.Level.SEVERE;
import java.util.logging.Logger;
import org.glassfish.api.ActionReport;
import org.glassfish.api.ActionReport.MessagePart;
Expand All @@ -61,6 +62,8 @@ public class CLIUtil {

private static final LocalStringsImpl strings = new LocalStringsImpl(CLIUtil.class);

protected static final Logger LOGGER = Logger.getLogger(CLIUtil.class.getPackage().getName());

/**
* Read passwords from the password file and save them in a java.util.Map.
* @param passwordFileName password file name
Expand Down Expand Up @@ -195,24 +198,25 @@ private static String[] getMatchedCommands(final String pattern,
* Return all commands, local and remote.
*
* @param container
* @param po Options to get the command i.e. admin port
* @param options Options to get the command i.e. admin port
* @param env
* @return the commands as a String array, sorted
*/
public static String[] getAllCommands(CLIContainer container, ProgramOptions po, Environment env) {
public static String[] getAllCommands(CLIContainer container, ProgramOptions options, Environment env) {
String[] remoteCommands, localCommands, allCommands;

try {
String[] remoteCommands = getRemoteCommands(container, po, env);
String[] localCommands = getLocalCommands(container);
String[] allCommands = new String[localCommands.length + remoteCommands.length];
System.arraycopy(localCommands, 0, allCommands, 0, localCommands.length);
System.arraycopy(remoteCommands, 0, allCommands, localCommands.length, remoteCommands.length);
Arrays.sort(allCommands);
return allCommands;
} catch (CommandValidationException cve) {
return null;
} catch (CommandException ce) {
return null;
remoteCommands = getRemoteCommands(container, options, env);
} catch (CommandException ex) {
LOGGER.log(SEVERE, "Remote commands not fetched : {0}", ex.getMessage());
remoteCommands = new String[]{};
}
localCommands = getLocalCommands(container);
allCommands = new String[localCommands.length + remoteCommands.length];
System.arraycopy(localCommands, 0, allCommands, 0, localCommands.length);
System.arraycopy(remoteCommands, 0, allCommands, localCommands.length, remoteCommands.length);
Arrays.sort(allCommands);
return allCommands;
}

/**
Expand Down