JDK-4402886 : (cs) JCK13: api/java_io/PrintWriter/index.html --> PrWWriter1,3,4,5,Merlin,Sparc
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS:
    linux,solaris_2.6,solaris_7,solaris_8,windows_2000 linux,solaris_2.6,solaris_7,solaris_8,windows_2000
  • CPU: x86,sparc
  • Submitted: 2001-01-09
  • Updated: 2001-07-20
  • Resolved: 2001-07-20
Related Reports
Duplicate :  
Duplicate :  
Description
The following test failed on merlin build 46 and passed on build 44. 

Failing Test:
=============

1) api/java_io/PrintWriter/index.html#PrWWrite1Test
2) api/java_io/PrintWriter/index.html#PrWWrite3Test
3) api/java_io/PrintWriter/index.html#PrWWrite4Test
4) api/java_io/PrintWriter/index.html#PrWWrite5Test

Test source location:
=====================

1)/net/jdk/export/disk8/local.java/jck1.3/JCK-runtime-13fcs/tests/api/java_io/PrintWriter/PrWWrite1Test.javacd /
2)/net/jdk/export/disk8/local.java/jck1.3/JCK-runtime-13fcs/tests/api/java_io/PrintWriter/PrWWrite3Test.java
3)/net/jdk/export/disk8/local.java/jck1.3/JCK-runtime-13fcs/tests/api/java_io/PrintWriter/PrWWrite4Test.java
4)/net/jdk/export/disk8/local.java/jck1.3/JCK-runtime-13fcs/tests/api/java_io/PrintWriter/PrWWrite5Test.java

Platforms:
=============
Failed only on sparc 5.7 and passed on x86 5.6. 
Haven't checked on other OSs.

JDK, switches Info:
===================
jdk1.4.0/bin/java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b46)
Java HotSpot(TM) Client VM (build 1.4beta-B45, mixed mode)

Failed for -client.

jtr file location:
==================

1)file:/net/jtg-s117/export/home/jtg-test/JH_jdk14_b46_jck13/workDir/api/java_io/PrintWriter/index_PrWWrite1Test.jtr
2)file:/net/jtg-s117/export/home/jtg-test/JH_jdk14_b46_jck13/workDir/api/java_io/PrintWriter/index_PrWWrite3Test.jtr
3)file:/net/jtg-s117/export/home/jtg-test/JH_jdk14_b46_jck13/workDir/api/java_io/PrintWriter/index_PrWWrite4Test.jtr
4)file:/net/jtg-s117/export/home/jtg-test/JH_jdk14_b46_jck13/workDir/api/java_io/PrintWriter/index_PrWWrite5Test.jtr

(This jtr file is also in the attachment.)

How to reproduce:
=================
Run the attached script:

1) PrintWriterPrWWrite1.ksh
2) PrintWriterPrWWrite3.ksh
3) PrintWriterPrWWrite4.ksh
4) PrintWriterPrWWrite5.ksh

System Info:
============

SPARC:
-------
jtg-s117% uname -a
SunOS jtg-s117 5.7 Generic_106541-12 sun4u sparc SUNW,Ultra-60
jtg-s117% psrinfo -v
Status of processor 0 as of: 12/21/00 16:16:07
  Processor has been on-line since 12/20/00 10:44:13.
  The sparcv9 processor operates at 296 MHz,
        and has a sparcv9 floating point processor.
Status of processor 2 as of: 12/21/00 16:16:07
  Processor has been on-line since 12/20/00 10:44:14.
  The sparcv9 processor operates at 296 MHz,
        and has a sparcv9 floating point processor.


Additional JCK related info:
============================
URL to find JCK test owners: http://javaweb.eng/jck/usr/owners.jto



srilakshmi.chappidi@Eng 2001-01-08


I distilled the failures down to this test:

import java.io.*;

public class Blah {

    private static PrintWriter pw = null;
    private static ByteArrayOutputStream baos = null;

    public static void main(String[] args) throws Exception {
        baos = new ByteArrayOutputStream();
        pw = new PrintWriter(baos);
        char[] chars = { (char)0, (char)32, (char)65, 
                         (char)127,(char)128, (char)255 };
        writeTest(chars, chars.length);
    }

    private static void writeTest(char[] streamChars, int num) 
        throws Exception {
            pw.write(streamChars, 0, num);
            if (pw.checkError())
                throw new RuntimeException("test failed");
                
	    String expectedText = new String(streamChars, 0, num);
            String outText = baos.toString();
            
            if (outText.length() != expectedText.length())
                throw new RuntimeException("test failed");
    }
}

michael.mccloskey@eng 2001-03-02

Comments
EVALUATION This seems to be due to a change in String(byte bytes[], int offset, int length) I added a smaller test case to the description. michael.mccloskey@eng 2001-03-02 In the distilled test, String(char value[], int offset, int count) is throws an exception because the passed char array char[] chars = { (char)0, (char)32, (char)65, (char)127,(char)128, (char)255 }; contains unmapped characters. Each unmapped character has the potential to skip at least one subsequent character. The test calls String(streamChars, 0, chars.length), where chars.length is the number of characters to decode. Since the skipping caused us to not have chars.length characters, the test fails. Bug 4402765 describes an almost identical situation with bytes. That bug was closed as a duplicate of 4457851. Information about these jck failures has been included 4457851. iag@eng 2001-07-20
20-07-2001