JDK-4407455 : (cs) JCK13a :api/java_io/FileReader ,Merlin-b48 ,Solaris
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS:
    generic,linux,solaris_2.6,solaris_7,windows_nt generic,linux,solaris_2.6,solaris_7,windows_nt
  • CPU: x86,sparc
  • Submitted: 2001-01-24
  • Updated: 2001-07-19
  • Resolved: 2001-07-19
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
The following tests failed with java_io, using the jdk1.4 Merlin-b48 on solaris 7/sparc.

Bug description 
================

Failing Test:
=============
1)api/java_io/FileReader/index.html#FRRead1Test: FileReader api method read(char[],int,int) testcase 
2)api/java_io/FileReader/index.html#FRRead3Test: FileReader api method read(char[]) testcase 

JCK : 
=====
JCK13a

Test source location:
======================
1)/net/jdk/export/disk8/local.java/jck1.3a/JCK-runtime-13a/tests/api/java_io/FileReader/FRRead1Test.java
2)file:/net/jtg-s117/export/home/jtg-test/JH_jdk14_b48_jck13a/workDir/api/java_io/FileReader/index_FRRead3Test.jtr

Platforms:
=============
Solaris 7 - sparc

JDK, switches Info:
===================
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b48)
Java HotSpot(TM) Client VM (build 1.4beta-B48, mixed mode)


jtr file location:
==================
1)/net/jtg-s117/export/home/jtg-test/JH_jdk14_b48_jck13a/workDir/api/java_io/FileReader/index_FRRead1Test.jtr
2)file:/net/jtg-s117/export/home/jtg-test/JH_jdk14_b48_jck13a/workDir/api/java_io/FileReader/index_FRRead3Test.jtr


How to reproduce:
====================
run the attached script:
1)FileReader_FRRead1.ksh 
2)FileReader_FRRead3.ksh

Test output:
=============
1)  Starting Testcase Read1Test0007...
For byte array input values, checks if they are read properly. Length of byte array to read is 10000
Creating the temporary file...
Constructing FileReader( String ) with the default encoding
Constructor successful
The underlying stream has 10000 characters
Calling read(char[], int, int) with array size : 10000
Verifying return value, which was -1
Testcase failed. Actually read 5064 instead of the expected value 10000
Testcase Read1Test0007 done 

Read1Test0007: Failed. Invalid number of characters were read.
STATUS:Failed.tests: 1; failed: 1; first test case failure: Read1Test0007

2)  Starting Testcase Read3Test0007...
For character input values, checks if they are read properly. File length 10000.
Creating the temporary file...
Constructing FileReader( String ) with the default encoding.
Constructor successful
The underlying stream has 10000 characters
Calling read(char[]) method with char array size : 10000
Verifying return value, which was -1
Testcase failed. Actually read 5064 instead of the expected value 10000
Testcase Read3Test0007 done 

Read3Test0007: Failed. Invalid number of characters were read.
STATUS:Failed.tests: 1; failed: 1; first test case failure: Read3Test0007


Specific Machine Info:
=====================

Hostname: jtg-s117
Hostid: 808fe83f
Release: 5.7
Kernel architecture: sun4u
Application architecture: sparc
Hardware provider: Sun_Microsystems
Domain: javasoft.eng.sun.com
Kernel version: SunOS 5.7 Generic 106541-12 May 2000
===========
Status of processor 0 as of: 01/22/01 17:04:31
  Processor has been on-line since 01/17/01 13:34:53.
  The sparcv9 processor operates at 296 MHz,
        and has a sparcv9 floating point processor.
Status of processor 2 as of: 01/22/01 17:04:31
  Processor has been on-line since 01/17/01 13:34:54.
  The sparcv9 processor operates at 296 MHz,
        and has a sparcv9 floating point processor.
===========
                    Solaris 7 11/99 s998s_u4SunServer_10 SPARC
           Copyright 1999 Sun Microsystems, Inc.  All Rights Reserved.
                            Assembled 15 October 1999


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




sureshchandar.subramaniam@Eng 2001-01-23
sureshchandar.subramaniam@Eng 2001-02-21

Comments
EVALUATION The JCK test takes a big buffer full of characters that have a value of the index of the buffer and writes them out to a file with FileWriter and reads them back with FileReader. The problem begins when FileWriter encodes the chars since it needs to convert the character buffer into a bunch of bytes to write out. So it is using the ASCII encoder (which surprised me since I thought our default was supposed to be 8859-1) and the encoder chugs along happily for a while until the characters exceed 0x80 at which time it tries to find a surrogate character, fails, and throws a UnmappableCharacterException which is caught by Charset-X-Coder which then outputs a subst (which I assume is a question mark but I didn't check) and advances the position of the character buffer by one, skipping an input character altogether. It continues to skip every other character after that, exhausting the input buffer prematurely and writing out a smaller file than was expected. That is why the test failed with 5064 characters read out of 10000, because the file was truncated to 5064 characters because it wrote out 128 characters normally followed by exactly half of the remaining 9872 characters which is 128 + 4936 = 5064. michael.mccloskey@eng 2001-03-30 Actually the default encoding will be the default machine encoding which is determined during the Solaris installation. Based on how machines are typically configured (at least for those of us who want a US_EN installation), the default machine encoding will be ASCII. This is a duplicate of 4457851. I have included information about the failing jck tests there. iag@eng 2001-07-19
19-07-2001