@Test public void testRemovePasswordArgs() { AbstractClient.init(); String[] input = new String[]{"-h", "127.0.0.1", "-p", "6667", "-u", "root", "-pw", "root"}; String[] res = new String[]{"-h", "127.0.0.1", "-p", "6667", "-u", "root", "-pw", "root"}; isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input)); input = new String[]{"-h", "127.0.0.1", "-p", "6667", "-pw", "root", "-u", "root"}; res = new String[]{"-h", "127.0.0.1", "-p", "6667", "-pw", "root", "-u", "root"}; isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input)); input = new String[]{"-h", "127.0.0.1", "-p", "6667", "root", "-u", "root", "-pw"}; res = new String[]{"-h", "127.0.0.1", "-p", "6667", "root", "-u", "root"}; isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input)); input = new String[]{"-h", "127.0.0.1", "-p", "6667", "-pw", "-u", "root"}; res = new String[]{"-h", "127.0.0.1", "-p", "6667", "-u", "root"}; isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input)); input = new String[]{"-pw", "-h", "127.0.0.1", "-p", "6667", "root", "-u", "root"}; res = new String[]{"-h", "127.0.0.1", "-p", "6667", "root", "-u", "root"}; isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input)); input = new String[]{}; res = new String[]{}; isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input)); }
protected static String[] removePasswordArgs(String[] args) { int index = -1; for (int i = 0; i < args.length; i++) { if (args[i].equals("-" + PASSWORD_ARGS)) { index = i; break; } } if (index >= 0) { if ((index + 1 >= args.length) || (index + 1 < args.length && keywordSet .contains(args[index + 1]))) { return ArrayUtils.remove(args, index); } } return args; }
AbstractClient { protected static String[] removePasswordArgs(String[] args) { int index = -1; for (int i = 0; i < args.length; i++) { if (args[i].equals("-" + PASSWORD_ARGS)) { index = i; break; } } if (index >= 0) { if ((index + 1 >= args.length) || (index + 1 < args.length && keywordSet .contains(args[index + 1]))) { return ArrayUtils.remove(args, index); } } return args; } }
AbstractClient { protected static String[] removePasswordArgs(String[] args) { int index = -1; for (int i = 0; i < args.length; i++) { if (args[i].equals("-" + PASSWORD_ARGS)) { index = i; break; } } if (index >= 0) { if ((index + 1 >= args.length) || (index + 1 < args.length && keywordSet .contains(args[index + 1]))) { return ArrayUtils.remove(args, index); } } return args; }  }
AbstractClient { protected static String[] removePasswordArgs(String[] args) { int index = -1; for (int i = 0; i < args.length; i++) { if (args[i].equals("-" + PASSWORD_ARGS)) { index = i; break; } } if (index >= 0) { if ((index + 1 >= args.length) || (index + 1 < args.length && keywordSet .contains(args[index + 1]))) { return ArrayUtils.remove(args, index); } } return args; }  static void output(ResultSet res, boolean printToConsole, String statement, ZoneId zoneId); }
AbstractClient { protected static String[] removePasswordArgs(String[] args) { int index = -1; for (int i = 0; i < args.length; i++) { if (args[i].equals("-" + PASSWORD_ARGS)) { index = i; break; } } if (index >= 0) { if ((index + 1 >= args.length) || (index + 1 < args.length && keywordSet .contains(args[index + 1]))) { return ArrayUtils.remove(args, index); } } return args; }  static void output(ResultSet res, boolean printToConsole, String statement, ZoneId zoneId);  }