code: private String fillPattern(String pattern, String[] parameters) {
          boolean containsSingleQuote = false;
          boolean containsDoubleQuote = false;
          Object[] escapedParams = new Object[parameters.length];
          for (int i = 0; i < parameters.length; i++) {
              String param = parameters[i];
              containsSingleQuote = containsSingleQuote || param.contains("'");
              containsDoubleQuote = containsDoubleQuote || param.contains("\"");
              escapedParams[i] = param;
          }
          if (containsDoubleQuote && containsSingleQuote) {
              throw new RuntimeException("Unsupported combination of single and double quotes");
          }
          String patternToUse;
          if (containsSingleQuote) {
              patternToUse = SINGLE_QUOTE_PATTERN.matcher(pattern).replaceAll("\"");
          } else {
              patternToUse = pattern;
          }
          return String.format(patternToUse, escapedParams);
      }
docs: Fills in placeholders in pattern using the supplied parameters.
  @param pattern pattern to fill (in String.format style).
  @param parameters parameters to use.
  @return filled in pattern.