예제 #1
0
 public static String escapeHtml(String string) {
   return string == null
       ? null
       : StringUtils.replaceAll(
           StringEscapeUtils.escapeHtml(string),
           "\\x22",
           """, // double quote
           "\\x27",
           "'"); // single quote
 }
예제 #2
0
  /**
   * Processes the given {@code path} under the given {@code root} and adds all associated class
   * files to the given {@code classNames}.
   */
  private void processFile(Set<String> classNames, File root, String path) {
    File file = new File(root, path);

    if (file.isDirectory()) {
      for (File child : file.listFiles()) {
        processFile(
            classNames,
            root,
            path.isEmpty() ? child.getName() : path + File.separator + child.getName());
      }

    } else {
      if (path.endsWith(CLASS_FILE_SUFFIX)) {
        String className = path.substring(0, path.length() - CLASS_FILE_SUFFIX.length());
        className = StringUtils.replaceAll(className, Pattern.quote(File.separator), ".");
        classNames.add(className);
      }
    }
  }