JDK-4737614 : sun.nio.cs.ext.ISO2022_CN_CNS.newDecoder() returns null
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Affected Version: 1.4.1
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2002-08-27
  • Updated: 2002-11-22
  • Resolved: 2002-11-20
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 Availabitlity Release.

To download the current JDK release, click here.
Other
1.4.2 mantisFixed
Related Reports
Relates :  
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
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis FIXED IN: mantis INTEGRATED IN: mantis mantis-b08 VERIFIED IN: mantis
2004-06-14

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

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

PUBLIC COMMENTS Verified in Mantis Build 08. ###@###.### 2002-11-22
2002-11-22