You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Xiaoming Shi (JIRA)" <ji...@apache.org> on 2011/02/17 17:50:24 UTC

[jira] Created: (WW-3578) replace function is called multiple times, which can be done in one run

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

                 Key: WW-3578
                 URL: https://issues.apache.org/jira/browse/WW-3578
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - JasperReports
    Affects Versions: 2.2.1.1
            Reporter: Xiaoming Shi


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(i); 
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 .

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WW-3578) replace function is called multiple times, which can be done in one run

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995909#comment-12995909 ] 

Dave Newton commented on WW-3578:
---------------------------------

Why did you close one and open another?

> replace function is called multiple times, which can be done in one run
> -----------------------------------------------------------------------
>
>                 Key: WW-3578
>                 URL: https://issues.apache.org/jira/browse/WW-3578
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JasperReports
>    Affects Versions: 2.2.1.1
>            Reporter: Xiaoming Shi
>
> 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(i); 
> 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 .

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WW-3578) replace function is called multiple times, which can be done in one run

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995920#comment-12995920 ] 

Dave Newton commented on WW-3578:
---------------------------------

Do you not have an "edit" link?

> replace function is called multiple times, which can be done in one run
> -----------------------------------------------------------------------
>
>                 Key: WW-3578
>                 URL: https://issues.apache.org/jira/browse/WW-3578
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JasperReports
>    Affects Versions: 2.2.1.1
>            Reporter: Xiaoming Shi
>
> 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(i); 
> 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 .

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WW-3578) replace function is called multiple times, which can be done in one run

Posted by "Xiaoming Shi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995923#comment-12995923 ] 

Xiaoming Shi commented on WW-3578:
----------------------------------

I see, thanks :-)

> replace function is called multiple times, which can be done in one run
> -----------------------------------------------------------------------
>
>                 Key: WW-3578
>                 URL: https://issues.apache.org/jira/browse/WW-3578
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JasperReports
>    Affects Versions: 2.2.1.1
>            Reporter: Xiaoming Shi
>
> 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(i); 
> 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 .

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WW-3578) replace function is called multiple times, which can be done in one run

Posted by "Lukasz Lenart (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart updated WW-3578:
------------------------------

    Fix Version/s: 3.x
    
> replace function is called multiple times, which can be done in one run
> -----------------------------------------------------------------------
>
>                 Key: WW-3578
>                 URL: https://issues.apache.org/jira/browse/WW-3578
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JasperReports
>    Affects Versions: 2.2.1.1
>            Reporter: Xiaoming Shi
>             Fix For: 3.x
>
>
> 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(i); 
> 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)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (WW-3578) replace function is called multiple times, which can be done in one run

Posted by "Xiaoming Shi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Xiaoming Shi updated WW-3578:
-----------------------------

    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(i); 
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)




  was:
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(i); 
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 .


> replace function is called multiple times, which can be done in one run
> -----------------------------------------------------------------------
>
>                 Key: WW-3578
>                 URL: https://issues.apache.org/jira/browse/WW-3578
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JasperReports
>    Affects Versions: 2.2.1.1
>            Reporter: Xiaoming Shi
>
> 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(i); 
> 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)

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WW-3578) replace function is called multiple times, which can be done in one run

Posted by "Xiaoming Shi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995917#comment-12995917 ] 

Xiaoming Shi commented on WW-3578:
----------------------------------

Hi Dave, 

Sorry for the spam. just now I noticed that the previous one is in the NEW FEATURE category which should be in the improvement or bug category.

> replace function is called multiple times, which can be done in one run
> -----------------------------------------------------------------------
>
>                 Key: WW-3578
>                 URL: https://issues.apache.org/jira/browse/WW-3578
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JasperReports
>    Affects Versions: 2.2.1.1
>            Reporter: Xiaoming Shi
>
> 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(i); 
> 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 .

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira