JDK-4464220 : (cs) print_chars_02_x (pm) test throws Unexpected Exception
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux,solaris,solaris_8
  • CPU: x86,sparc
  • Submitted: 2001-05-30
  • Updated: 2001-07-23
  • Resolved: 2001-07-19
Related Reports
Duplicate :  
Description
TEST      : plumhall-99a/jvs/io/PrintStream/println_chars_02_x
TestBase  : /net/sqesvr.eng/export/vsn/VM/testbase/testbase_vm
Mode      : -Xcomp, -Xmixed, -Xint
Platform  : Solsparc 5.8, 5.9, solx86, linux RH 6.2
JAVA_HOME : /net/sqesvr.eng/export/vsn/VM/merlin/weekahead/jdk/latest/{OS}

Steps to reproduce
1) cd /net/sqesvr.eng/export/vsn/GammaBase/Bugs/{Buid}
2) ksh doit

{OR}
run the following command-line.
set JAVA_HOME to /net/sqesvr.eng/export/vsn/VM/merlin/weekahead/jdk/latest/{OS}

${JAVA_HOME}/bin/java -server -Xint -classpath .:/net/sqesvr.eng/export/vsn/VM/testbase/testbase_vm/src/plumhall-99a/classes jvs.io.PrintStream.print_chars_02_x.print_chars_02_x

Output:
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Server VM (build 20010524124025.jcoomes.baseline-debug, interpreted mode)

*** JVS(R): The Plum Hall Test Suite for The Java(tm) Language, Util(513)
#Begin Case (jvs.io.PrintStream.print_chars_02_x.print_chars_02_x)
#Reached first test (line 62)

Unexpected Exception java.lang.ArrayIndexOutOfBoundsException

*****************************************************************
NOTE: Test passes with ladybird & the output is follwed by.
*****************************************************************
Output:
java version "1.3.1-rc2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-rc2-b23)
Java HotSpot(TM) Server VM (build 1.3.1-rc2-b23, interpreted mode)

*** JVS(R): The Plum Hall Test Suite for The Java(tm) Language, Util(513)
#Begin Case (jvs.io.PrintStream.print_chars_02_x.print_chars_02_x)
#Reached first test (line 62)

#End Case: jvs.io.PrintStream.print_chars_02_x.print_chars_02_x,7,0

*** 7 Successful test items in print_chars_02_x ***
*** 0 Errors detected in print_chars_02_x ***
*** 7 Total test items in print_chars_02_x ***




Use this testcase to attached to re-produce i18n issue

import java.io.*;


public class F {

    public static void main(String[] args) {

	char[] obj = {(char) 0xAAcf, (char) 0xFFF0, (char) 0x0E2E};
	System.out.println("obj.length=" + obj.length);

	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	PrintStream out = new PrintStream(baos);
	out.print(obj);
	System.out.println("baos.size()=" + baos.size());
    }
}

gary.collins@East 2001-06-12

Comments
EVALUATION It appears the char array is not being translated correctly. char[] obj = {(char) 0xAAcf, (char) 0xFFF0, (char) 0x0E2E} out.print(obj) makes a call to io_h.java write(b[], off, len) When I print out the size for off and len I get the following off=0 len=2 It should be: off=0 len=3 This is what Ladybird does. It seems to be throwing away last value from char array defined above. The ArrayIndexOutOfBoundsException is a valid error since the test hard codes printing of array values. When it gets to the 3 element it crashes with exception above. This could be some kind of an i18n issue. gary.collins@East 2001-06-12 Passing this bug over to I18n team. Looks to be a character encoding bug. Please run attached testcase. and you will see size differences. import java.io.*; public class F { public static void main(String[] args) { char[] obj = {(char) 0xAAcf, (char) 0xFFF0, (char) 0x0E2E}; System.out.println("obj.length=" + obj.length); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream out = new PrintStream(baos); out.print(obj); System.out.println("baos.size()=" + baos.size()); } } gary.collins@East 2001-06-12 Character conversion is actually handled by the Libraries team. norbert.lindenberg@Eng 2001-06-12 Duplicate of 4457851. When the unmapped character 0xAAcf is encountered, java.nio.charset.CharsetEncoder is skipping the next character. iag@eng 2001-07-19
12-06-2001