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

A few problems with ImageIO.read(File)

XMLWordPrintable

    • hopper
    • x86, sparc
    • solaris_8, windows_2000
    • Verified



      Name: agR10195 Date: 03/29/2002



      Alexey Gibadullin, ###@###.###

      The following test reveals a few problems with ImageIO.read(File) method
      on 64-bit Solsparc and Windows (build 1.4.1-beta-b06):

      import java.io.*;
      import javax.imageio.*;
      import java.awt.image.*;

      public class Test {
          public static void main(String args[]) {
              File fileSource = new File(args[0]);

              System.out.println("fileSource = " + fileSource);
              try {
                  BufferedImage bufferedImage = ImageIO.read(fileSource);
                  System.out.println("bufferedImage = " + bufferedImage);
              } catch(Exception e) {
                  System.out.println("Unexpected exception.");
                  e.printStackTrace(System.out);
              }
              System.out.println("End of the test.");
              System.exit(1);
          }
      }

      To reproduce the failures you should pass any jpeg or gif image to Test class.

      1. The test crashes VM on 64-bit Solsparc (with -d64 -server -Xcomp options).

         % ../jdk1.4.1-b06/solsparcv9/bin/java -version
         java version "1.4.1-beta"
         Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b06)
         Java HotSpot(TM) Client VM (build 1.4.1-beta-b06, mixed mode)

         % ../jdk1.4.1-b06/solsparcv9/bin/java -d64 -server -Xcomp Test Test.jpg
         fileSource = Test.jpg
         #
         # HotSpot Virtual Machine Error, Internal Error
         # Please report this error at
         # http://java.sun.com/cgi-bin/bugreport.cgi
         #
         # Java VM: Java HotSpot(TM) 64-Bit Server VM (1.4.1-beta-b06 compiled mode)
         #
         # Error ID: 4D4154434845520E435050013A 01
         #
         # Problematic Thread: prio=5 tid=0x1001f2970 nid=0xb runnable
         #
         Abort
         
         (matcher.cpp, 314)
         
         
         % ../jdk1.4.1-b06/solsparcv9/bin/java_g -d64 -server -Xcomp Test Test.jpg
         fileSource = Test.jpg
         #
         # HotSpot Virtual Machine Error, assertion failure
         # Please report this error at
         # http://java.sun.com/cgi-bin/bugreport.cgi
         #
         # Java VM: Java HotSpot(TM) 64-Bit Server VM (1.4.1-beta-b06-debug compiled mode)
         #
         # assert(reg < CHUNK_SIZE, "")
         #
         # Error ID: /BUILD_AREA/jdk1.4.1_64bit/hotspot/src/share/vm/opto/regmask.hpp, 171 [ Patched ]
         #
         # Problematic Thread: prio=5 tid=0x10023b1f8 nid=0xb runnable
         #
         Dumping core....
         Abort
         
         Please, also, see the bug
         
             4501529 JAVA VM crashes uses Java Advanced Imaging
             
         that was closed as duplicate of
         
             4520884 ImageI/O JPEG encoder causes VM crash on Win32
             
         I borrowed the source code (and cut it) from 4501529. #4501529 reveals
         the crash during writing an image. However, my test observes the crash
         even earlier - during reading an image.
         

      2. The test completes, but hangs up on Windows. This failure was
         observed with java_g wrapper against Client and Server VMs. I
         used a machine with "Microsoft Windows 2000 [Version 5.00.2195]".
         
         > ../jdk1.4.1-b06/win/bin/java_g -server Test Test.jpg
         fileSource = Test.jpg
         new structures: data is 18556518, cinfo is 26f580
         In readImageHeader, data is 18556518 cinfo is 26f580
         clearFirst is 0
         Filling input buffer, remaining skip is 0, Buffer length is 4096
         Buffer filled. ret = 4096
         In readImageHeader, data is 18556518 cinfo is 26f580
         clearFirst is 1
         Filling input buffer, remaining skip is 0, Buffer length is 4096
         Buffer filled. ret = 4096
         ---- in reader.read ----
         numBands is 3
         bands array: 0 1 2
         jq table 0 at 958750
         Filling input buffer, remaining skip is 0, Buffer length is 4096
         Buffer filled. ret = 2109
         bufferedImage = BufferedImage@2c84d9: type = 5 ColorModel: #pixelBits = 24 numComponents = 3 color s
         pace = java.awt.color.ICC_ColorSpace@1f436f5 transparency = 1 has alpha = false isAlphaPre = false B
         yteInterleavedRaster: width = 205 height = 141 #numDataElements 3 dataOff[0] = 2
         End of the test.
         
         "End of the test." string means that the last line of Test class has
         been reached. However, the test hangs up and I could not stop it even
         with Ctrl+C.


      This bug affects the test

          nsk/regression/b4501529
          
      from testbase_nsk.

      The test will appear in the r14 release of testbase located at

          /net/sqesvr.sfbay/export/vsn/VM/testbase/testbase_nsk

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

            azeemj Azeem Jiva
            gazsunw Gaz Gaz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: