United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4263816 : -Dfile.encoding does not work

Details
Type:
Bug
Submit Date:
1999-08-19
Status:
Closed
Updated Date:
1999-08-20
Project Name:
JDK
Resolved Date:
1999-08-20
Component:
hotspot
OS:
generic
Sub-Component:
runtime
CPU:
generic
Priority:
P4
Resolution:
Duplicate
Affected Versions:
1.3.0
Fixed Versions:

Related Reports
Duplicate:
Relates:

Sub Tasks

Description

Name: dkC59003			Date: 08/19/99



Classic VMs (from 1.2 to Kestrel fcs) fail to pass the test below (return value is 97)
both on win32 and Solaris: setting the file encoding on the command line does not
affect the default file Encoding classes used by the sun.io ByteToCharConverter and 
CharToByteConverter classes.
For instance:

$ java -classic -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-A)
Classic VM (build 1.3.0-A, green threads, nojit)
$ java -classic -Dfile.encoding=8859_1 b4242737
encProperty == '8859_1'
Default ByteToChar Class == 'sun.io.ByteToCharISO8859_5'
Default CharToByte Class == 'sun.io.CharToByteISO8859_5'
$ echo $status
97

As well the test is failed by HotSpot VMs 1.3beta and by HotSpot 1.0.1fcs-G.
The test is passed by classic VM 1.1.8 on Solaris. 

The test was developed as a regression test for the bug filed against 
HotSpot 1.0_fcs:
#4242737 Synopsis: 1.1: -Dfile.encoding does not work with HOTSPOT and JAVA2 (1.2.1) 
(Integrated in releases: 1.1_alpha).

----------------------------------------------------------- b4242737.java
import java.io.PrintStream;
import sun.io.*;

public class b4242737 {

    public static void main(String argv[]) {
        System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
    }

    public static int run(String args[], PrintStream out) {
	String encProperty = System.getProperty("file.encoding");
   	String byteToCharClass = 
sun.io.ByteToCharConverter.getDefault().getClass().getName();
   	String charToByteClass = 
sun.io.CharToByteConverter.getDefault().getClass().getName();
	boolean res = true;

	out.println("encProperty == '" + encProperty + "'");
	if (! byteToCharClass.equals("sun.io.ByteToCharISO8859_1")) {
	    out.println("Default ByteToChar Class == '" + byteToCharClass + "'");
	    res = false;
	}
	if (! charToByteClass.equals("sun.io.CharToByteISO8859_1")) {
	    out.println("Default CharToByte Class == '" + charToByteClass + "'");
	    res = false;
	}
	return (res ? 0/*STATUS_PASSED*/ : 2/*STATUS_FAILED*/);
    }
}

======================================================================

                                    

Comments
EVALUATION

Not a bug.  See 4163515.  The file.encoding property is read-only, so changing
its value on the command line is not intended to have any effect.

-- mr@eng 1999/8/19
                                     
185-07-08 0



Hardware and Software, Engineered to Work Together