[
https://jira.jboss.org/jira/browse/RF-4498?page=com.atlassian.jira.plugin...
]
andreas_back commented on RF-4498:
----------------------------------
Hello Nick,
some further investigation has shown that the
the endless loop occurred while the string /** was processed during the
handling of a background-image while compressing the file extended_classes.xcss.
Your code change has fixed this case and our application does start.
The string /*/ just served as an example to show that the loop
indeed could cycle for ever.
One suggestion for the further improvement of the code.
The concrete loop does not terminate if during one iteration
(A1) neither to buffer sb is changed by delete statement
(A2) nor the value of the startIndex is changed.
The Css - Compression and the removal of the
the comments is optimization.
Therefore it might be an option to excape from the loop by
a break-statement if none of the actions (A1) or (A2) has
been taken.
The returned string would not be space-optimal but it would prevent
a critical error.
EndlessLoop in CssCompressor
----------------------------
Key: RF-4498
URL:
https://jira.jboss.org/jira/browse/RF-4498
Project: RichFaces
Issue Type: Bug
Affects Versions: 3.2.2
Environment: Browser independent
Reporter: andreas_back
Assignee: Tsikhon Kuprevich
Priority: Critical
Fix For: 3.3.0
When starting our application under RF 3.2.2 GA Tomcat consumes (on a
Quad-Core-Processor) 25 % of the overall CPU performance, if the first page of the
application is requested.
After adding
set CATALINA_OPTS="-Dcom.sun.management.jmxremote"
to the startup.bat and starting jconsole it was found the time is consumed in line 41 of
CssCompressor.java,
see the code fragment.
sb = new StringBuffer(srcsb.toString());
while ((startIndex = sb.indexOf("/*")) >= 0) {
endIndex = sb.indexOf("*/", startIndex + 2);
if (endIndex >= startIndex + 2)
sb.delete(startIndex, endIndex + 2);
}
A simple code analysis shows that the code starts an endless loop for example for
the string
/*/
If the parameter org.ajax4jsf.COMPRESS_STYLE is set to false
then the endless loop disappears.
It could be noted that the single string in the CssCompressorTest class
does not contain the comment /* or */.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira