JDK-4495331 : Swing and swing demos should not use default version of InputStreamReader()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-08-23
  • Updated: 2004-10-13
  • Resolved: 2004-09-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 betaFixed
Related Reports
Relates :  
Relates :  
Description
Swing and swing demos should not use the default encoding version of 
InputStreamReader() constructor when reading ASCI files. This completely breaks
Swing and all Swing demos on Hindi locale, since Hindi locale uses 
utf-16le encoding as default. Anywhere where the default encoding version of 
InputSteamReader is used with ASCI files, one should make a change
and explicitely specify the encoding to be Cp1252 or UTF-8.

To find out instances of this, put Thread.dumpStack() into the default
encoding version of InputStreamReader() and run Swing demos. With
SwingSet2 it produces:


        at java.lang.Thread.dumpStack(Thread.java:1105)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:108)
        at javax.swing.text.html.HTMLEditorKit.getStyleSheet(HTMLEditorKit.java:
359)
        at javax.swing.text.html.HTMLEditorKit.createDefaultDocument(HTMLEditorK
it.java:188)
        at javax.swing.JEditorPane.setEditorKit(JEditorPane.java:943)
        at javax.swing.JEditorPane.setContentType(JEditorPane.java:869)
        at javax.swing.JEditorPane.<init>(JEditorPane.java:267)
        at SwingSet2.initializeDemo(SwingSet2.java:269)
        at SwingSet2.<init>(SwingSet2.java:205)
        at SwingSet2.main(SwingSet2.java:228)
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Thread.java:1105)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:108)
        at DemoModule.loadSourceCode(DemoModule.java:169)
        at DemoModule.<init>(DemoModule.java:105)
        at InternalFrameDemo.<init>(InternalFrameDemo.java:101)
        at SwingSet2.preloadFirstDemo(SwingSet2.java:559)
        at SwingSet2.<init>(SwingSet2.java:206)
        at SwingSet2.main(SwingSet2.java:228)
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Thread.java:1105)
"swinghindi" 38 lines, 1950 characters
        at java.io.InputStreamReader.<init>(InputStreamReader.java:108)
        at DemoModule.loadSourceCode(DemoModule.java:169)
        at DemoModule.<init>(DemoModule.java:105)
        at ButtonDemo.<init>(ButtonDemo.java:98)
        at sun.reflect.GeneratedConstructorAccessor109.newInstance(Unknown Sourc
e)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:263)
        at SwingSet2.loadDemo(SwingSet2.java:695)
        at SwingSet2.loadDemos(SwingSet2.java:83)
        at SwingSet2$DemoLoadThread.run(SwingSet2.java:1205)
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Thread.java:1105)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:108)
###@###.### 10/13/04 17:55 GMT

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang FIXED IN: mustang INTEGRATED IN: mustang
14-09-2004

EVALUATION The demos will need to be fixed to specify the encoding. ###@###.### 2001-09-26 Name: anR10225 Date: 11/24/2003 The default encoding is used in the following demos for reading resource files : 1. applets/MoleculeViewer/XYZApp.java 2. applets/WireFrame/ThreeD.java 3. jfc/SwingSet2/DemoModule.java 4. jfc/SwingSet2/TreeDemo.java The problem with the default encoding in the HTMLEditorKit has been already fixed (bug #4310802) We should explicitly specify the ISO-8859-1 encoding when creating a Reader since the resource files included in Demos are in this encoding. ====================================================================== We should use UTF-8 encoding. see http://java.sun.com/j2se/corejava/intl/reference/faqs/index.html#recommended-charset updated the fix ###@###.### 2004-08-31
31-08-2004