Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4407092

(cs) JCK: InputStreamReader.read behaves incorrectly

XMLWordPrintable

    • x86
    • linux, windows_nt



      Name: asR10013 Date: 01/23/2001



      Bug description ---> Method read() of class java.io.ImputStreamReader
      reads characters from stream containing invalid bytes for selected
      encoding instead of throwing exception.
      ****************************************************************************
      Failing Test:
      =============
      api/java_io/Reader/index.html#read
      api/java_io/InputStreamReader/index.html#read1
      api/java_io/InputStreamReader/index.html#read

      JCK :
      =====
      jck1.3a

      Test source location:
      ====================
      /net/jdk/export/disk8/local.java/jck1.3a/JCK-runtime-13a/tests/ ...

      Platforms:
      =============
      RedHat Linux 6.2
      Windows NT 4.0

      JDK, switches Info:
      ===================
      jre1.4.0beta-b48 plugin for Netscape 4.7
      jdk1.4.0beta-b48:
         -client -Xmixed
         -server -Xmixed
           
      jtr file location:
      ==================

      /net/jtgb4u4c.eng/export/sail7/JavaWebServer1.1.3/public_html/QA/merlin/b48/jck13a/linux/redhat6.2_single_kde_plugin_ns4.7_linux-12/workDir/api/java_io/Reader/index_read.jtr
      /net/jtgb4u4c.eng/export/sail7/JavaWebServer1.1.3/public_html/QA/merlin/b48/jck13a/linux/redhat6.2_single_kde_plugin_ns4.7_linux-12/workDir/api/java_io/InputStreamReader/index_read1.jtr
      /net/jtgb4u4c.eng/export/sail7/JavaWebServer1.1.3/public_html/QA/merlin/b48/jck13a/linux/redhat6.2_single_kde_plugin_ns4.7_linux-12/workDir/api/java_io/InputStreamReader/index_read.jtr
      How to reproduce:
      ====================
      Compile and execute the following program.
      It constructs InputStreamReader with UTF8 encoding and tries to
      read invalid (in UTF8 encoding) bytes. Read method should throw
      exception.

      import java.io.*;

      class test {
          public static void main(String args[]) throws Exception{
              byte[] bytes = { (byte)230, 10, (byte)128 };
              InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(bytes), "UTF8");
              try {
                  isr.read();
              } catch (IOException ioe) {
      System.err.println(ioe);
      return;
              }
      System.out.println("Exception not thrown");
          }
      }

      Test output:
      =============
      api/java_io/Reader/index.html#read:
          Read3Test0010: Failed. read should have thrown IOException
      api/java_io/InputStreamReader/index.html#read1:
          Read2Test0007: Failed. IOException not thrown as expected.
      api/java_io/InputStreamReader/index.html#read:
          Read1Test0012: Failed. read should have thrown IOException

      Specific Machine Info:
      =====================
      Hostname: linux-12

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


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

            mr Mark Reinhold
            alssunw Als Als (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: