United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4737614 sun.nio.cs.ext.ISO2022_CN_CNS.newDecoder() returns null
JDK-4737614 : sun.nio.cs.ext.ISO2022_CN_CNS.newDecoder() returns null

Details
Type:
Bug
Submit Date:
2002-08-27
Status:
Closed
Updated Date:
2002-11-22
Project Name:
JDK
Resolved Date:
2002-11-20
Component:
core-libs
OS:
generic
Sub-Component:
java.nio.charsets
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.4.1
Fixed Versions:
1.4.2 (mantis)

Related Reports
Relates:

Sub Tasks

Description

Name: pa48320			Date: 08/27/2002


sun.nio.cs.ext.ISO2022_CN_CNS.newDecoder() returns null to signal a desupported encoding which causes a NPE in java.lang.StringCoding$CharsetSD.CharsetSD(Charset cs, String rcn)
(the code is "this.cd = cs.newDecoder().onMalformedInput()...").
It believe it should throw UnsupportedEncodingException instead.

The exact version of the JDK is j2sdk-1_4_1-rc-src-b19-solwin-08_aug_2002


java.lang.NullPointerException
        at java.lang.StringCoding$CharsetSD.<init>(StringCoding.java:164)
        at java.lang.StringCoding$CharsetSD.<init>(StringCoding.java:155)
        at java.lang.StringCoding.decode(StringCoding.java:211)
        at java.lang.String.<init>(String.java:327)
        at java.lang.String.<init>(String.java:356)
        at oracle.ide.util.Encodings.searchForEncodings(Encodings.java:299)
        at oracle.ide.util.Encodings.initEncodingsListImpl(Encodings.java:268)
        at oracle.ide.util.Encodings.ensureInit(Encodings.java:243)
        at oracle.ide.util.Encodings.convertJdk2IanaEncoding(Encodings.java:114)
        at oracle.ide.util.Encodings.getDefaultIanaEncoding(Encodings.java:102)
        at oracle.ide.xml.XMLUtil.loadXSLT(XMLUtil.java:149)
        at oracle.ide.marshal.xml.Object2Dom.applyTransforms(Object2Dom.java:1218)
        at oracle.ide.marshal.xml.Object2Dom.open(Object2Dom.java:563)
...
(Review ID: 163561) 
======================================================================

                                    

Comments
PUBLIC COMMENTS

Verified in Mantis Build 08.
###@###.### 2002-11-22
                                     
2002-11-22
WORK AROUND



Name: pa48320			Date: 08/27/2002


When invoking "new String( string, encoding )", the caller must catch both UnsupportedEncodingException and NullPointerExceptions
======================================================================
                                     
2004-06-11
EVALUATION

It's not clear to me why ISO2022_CN_CNS.newDecoder() is returning null, but we
should resolve this in Mantis.  -- ###@###.### 2002/8/27

ISO2022_CN_CNS and ISO_2022_CN_GB provide encoder implementations only. In some respects this is not different to the situation for 1.3.1 and earlier.
See BugID 4140796. It turns out that historically the reason why these
named encodings don't provide ByteToChar converters is that the 
ISO2022_CN Byte->Char converter will decode a stream containing both
escape sequences (CN_CNS and CN_GB). 
The NIO implementation should probably throw an UnsupportedOperationException
for the moment but going forward an invokation of newDecoder() should 
probably instantiate a ISO2022_CN decoder instance and pass back a reference
to it. In 1.4.1 no NIO ISO2022_CN decoder was provided. This should be added
for 1.4.2 as part of the cleanup of the handling of the NIO ISO2022 coders.
###@###.### 2002-08-28

Rather than provide an incomplete ISO-2022-CN NIO Charset solution it is 
proposed that the existing neutered encoder only implementations for 
ISO-2022-CN-CNS and ISO-2022-CN-GB be removed from the NIO charset
provider class, sun.nio.cs.ext.ExtendedCharsets. A full ISO-2022-CN-*
implementation will be tracked into J2SE 1.5.
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis

FIXED IN:
mantis

INTEGRATED IN:
mantis
mantis-b08

VERIFIED IN:
mantis


                                     
2004-06-14



Hardware and Software, Engineered to Work Together