Problem in the Configuration Render
-----------------------------------

                 Key: FELIX-2338
                 URL: https://issues.apache.org/jira/browse/FELIX-2338
             Project: Felix
          Issue Type: Bug
          Components: Web Console
    Affects Versions: webconsole-3.0.0
         Environment: Skelmir CEE-J 4 VM
            Reporter: Valentin Valchev
         Attachments: config-render-skelmir.patch

With some JVM implementation like Skelmir CEE-J, the configurations will not be 
printed correctly and the server will generate internal server error.

In the log there is a long stack trace:
--- cut here --
Wed, 12 May 2010 13:42:40 GMT  8    ERROR          [HTTP] Problem while making 
answer to request /system/console/config/Configurations.nfo from client address 
null
java.lang.StackOverflowError
        at java/io/PrintWriter.write (Unknown Source, bco=33)
        at java/io/PrintStream.write (Unknown Source, bco=88)
        at java/io/PrintStream.writeInternal (Unknown Source, bco=20)
        at java/io/PrintStream.print (Unknown Source, bco=5)
        at java/io/PrintStream.println (Unknown Source, bco=9)
        at 
org/apache/felix/webconsole/internal/misc/ConfigurationRender$HtmlConfigurationWriter.write
 (ConfigurationRender.java:508)
        at java/io/PrintWriter.write (Unknown Source, bco=25)
        at 
org/apache/felix/webconsole/internal/misc/ConfigurationRender$HtmlConfigurationWriter.writeFiltered
 (ConfigurationRender.java:540)
        at 
org/apache/felix/webconsole/internal/misc/ConfigurationRender$HtmlConfigurationWriter.write
 (ConfigurationRender.java:510)
        at java/io/PrintWriter.write (Unknown Source, bco=25)
        at 
org/apache/felix/webconsole/internal/misc/ConfigurationRender$HtmlConfigurationWriter.writeFiltered
 (ConfigurationRender.java:540)
        at 
org/apache/felix/webconsole/internal/misc/ConfigurationRender$HtmlConfigurationWriter.write
 (ConfigurationRender.java:510)
        at java/io/PrintWriter.write (Unknown Source, bco=25)
        at 
org/apache/felix/webconsole/internal/misc/ConfigurationRender$HtmlConfigurationWriter.writeFiltered
 (ConfigurationRender.java:540)
        at 
org/apache/felix/webconsole/internal/misc/ConfigurationRender$HtmlConfigurationWriter.write
 (ConfigurationRender.java:510)
        at java/io/PrintWriter.write (Unknown Source, bco=25)
--- cut here --

These are the first few lines only. Obviously the different implementation of 
PrintWriter makes an endless loop between methods.

I'm attaching a patch that:
1. fixes the above problem
2. optimizes the writer by escaping the symbols on the fly one by one (writing 
char by char is not a problem, because the Servet output is already buffered)
3. because of 2 it doesn't escape the string /using 
WebConsoleUtil.escapeHtml()/ and then write escaped one; and doesn't create a 
new StringBuffer + String objects. This reduces the used temporary memory and 
should have also influence on performance.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to