-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b32
-
generic, sparc
-
generic, solaris_2.6
-
Verified
Name: sdR10048 Date: 11/28/2003
Filed By : SPB JCK team (###@###.###)
JDK : java full version "1.5.0-beta-b29"
JCK : 1.5
Platform[s] : Solaris
switch/Mode :
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test [s] :
api/java_awt/datatransfer/DataFlavor/index.html#rclass[DataFlavor0152]
Specification excerpt:
======================
--------- J2SE API spec v.1.5 ---------
...
public String getEncoding()
Return the name of the character encoding being used by this stream.
If the encoding has an historical name then that name is returned;
otherwise the encoding's canonical name is returned.
If this instance was created with the InputStreamReader(InputStream, String)
constructor then the returned name, being unique for the encoding, may differ
from the name passed to the constructor. This method may return null if the
stream has been closed.
Returns:
The historical name of this encoding, or possibly null if the stream has been
closed
SeeAlso:
Charset
...
---------- end-of-excerpt ---------------
Problem description
===================
The designated method returns canonical encoding name in JDK1.5
but should return historical one (as spec says).
This is true in case "KOI8-R" (canonical in JDK1.5)/"KOI8_R" (historical).
Please see mini-demo.
Running demo under JDK1.3 shows that "KOI8_R" should be treated as a historical
encoding name.
Running demo under JDK1.5 shows that getEncoding() returns canonical encoding name "KOI8-R".
Minimized test:
===============
------- J.java -------
import java.io.*;
public class J {
public static void main(String[] args) {
byte bytes[] = {1};
try {
InputStreamReader r1 =
new InputStreamReader(new ByteArrayInputStream(bytes), "KOI8-R");
InputStreamReader r2 =
new InputStreamReader(new ByteArrayInputStream(bytes), "KOI8_R");
System.out.println("r1.getEncoding(): "+r1.getEncoding());
System.out.println("r2.getEncoding(): "+r2.getEncoding());
} catch (Exception e) {
e.printStackTrace();
}
}
}
------- end-of-J.java -------
Minimized test output:
======================
] (archer) ~/tmp
] /set/jdk-builds/J2SDK1.3.1-b24/solaris/bin/java -showversion J
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
r1.getEncoding(): KOI8_R
r2.getEncoding(): KOI8_R
] (archer) ~/tmp
] /set/jdk-builds/JDK1.5.0b29/solaris-sparc/bin/java -showversion J
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b29)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b29, mixed mode)
r1.getEncoding(): KOI8-R
r2.getEncoding(): KOI8-R
JCK test source location:
==========================
/java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests
======================================================================
Filed By : SPB JCK team (###@###.###)
JDK : java full version "1.5.0-beta-b29"
JCK : 1.5
Platform[s] : Solaris
switch/Mode :
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test [s] :
api/java_awt/datatransfer/DataFlavor/index.html#rclass[DataFlavor0152]
Specification excerpt:
======================
--------- J2SE API spec v.1.5 ---------
...
public String getEncoding()
Return the name of the character encoding being used by this stream.
If the encoding has an historical name then that name is returned;
otherwise the encoding's canonical name is returned.
If this instance was created with the InputStreamReader(InputStream, String)
constructor then the returned name, being unique for the encoding, may differ
from the name passed to the constructor. This method may return null if the
stream has been closed.
Returns:
The historical name of this encoding, or possibly null if the stream has been
closed
SeeAlso:
Charset
...
---------- end-of-excerpt ---------------
Problem description
===================
The designated method returns canonical encoding name in JDK1.5
but should return historical one (as spec says).
This is true in case "KOI8-R" (canonical in JDK1.5)/"KOI8_R" (historical).
Please see mini-demo.
Running demo under JDK1.3 shows that "KOI8_R" should be treated as a historical
encoding name.
Running demo under JDK1.5 shows that getEncoding() returns canonical encoding name "KOI8-R".
Minimized test:
===============
------- J.java -------
import java.io.*;
public class J {
public static void main(String[] args) {
byte bytes[] = {1};
try {
InputStreamReader r1 =
new InputStreamReader(new ByteArrayInputStream(bytes), "KOI8-R");
InputStreamReader r2 =
new InputStreamReader(new ByteArrayInputStream(bytes), "KOI8_R");
System.out.println("r1.getEncoding(): "+r1.getEncoding());
System.out.println("r2.getEncoding(): "+r2.getEncoding());
} catch (Exception e) {
e.printStackTrace();
}
}
}
------- end-of-J.java -------
Minimized test output:
======================
] (archer) ~/tmp
] /set/jdk-builds/J2SDK1.3.1-b24/solaris/bin/java -showversion J
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
r1.getEncoding(): KOI8_R
r2.getEncoding(): KOI8_R
] (archer) ~/tmp
] /set/jdk-builds/JDK1.5.0b29/solaris-sparc/bin/java -showversion J
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b29)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b29, mixed mode)
r1.getEncoding(): KOI8-R
r2.getEncoding(): KOI8-R
JCK test source location:
==========================
/java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests
======================================================================