code: private String createPrintableCommand(final List<String> cmd) {
          final List<String> cmdToOutput = new ArrayList<>();
          cmdToOutput.addAll(cmd);
  
          int passwordIndex = cmdToOutput.indexOf("--password");
          if (passwordIndex > -1) {
              // The User's password will be at the next index
              passwordIndex++;
          }
  
          int proxyPasswordIndex = -1;
          for (int commandIndex = 0; commandIndex < cmdToOutput.size(); commandIndex++) {
              final String commandParameter = cmdToOutput.get(commandIndex);
              if (commandParameter.contains("-Dhttp.proxyPassword=")) {
                  proxyPasswordIndex = commandIndex;
              }
          }
  
          maskIndex(cmdToOutput, passwordIndex);
          maskIndex(cmdToOutput, proxyPasswordIndex);
  
          return StringUtils.join(cmdToOutput, " ");
      }
docs: Code to mask passwords in the logs