Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3578

replace function is called multiple times, which can be done in one run

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.2.1.1
    • None
    • Plugin - JasperReports
    • None

    Description

      In the function "makeXmlJavaIdentifier"

      (./struts-2.2.1/src/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java line: 1059)

      The replace function is called 3 times, which can be done in one run with a for loop.

      StringBuilder sb = new StringBuilder(name.length());
      for(int i = 0; i < name.length(); i++)
      {
      char c = name.charAt;
      if (c == '-')
      sb.append("$1");
      else if (c == '.')
      sb.append("$2");
      else if (c == ':')
      sb.append("$3");
      else
      sb.append(c);
      }
      return sb.toString();

      The second method can be much faster.
      (Similar to the MySQL bug http://bugs.mysql.com/bug.php?id=45699)

      Attachments

        Activity

          People

            Unassigned Unassigned
            nancyesmis Xiaoming Shi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: