JDK-6363748 : api/javax_imageio/stream/FileCacheImageInputStream/index.html#close[close002] fails
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-12-15
  • Updated: 2012-03-23
  • Resolved: 2006-02-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b73Fixed
Description
JCK	       : runtime b14
J2SE	       : FAIL - b63
                 PASS - before b63
Platform[s]    : FAIL - solaris-i586, windows-amd64, windows-i586

JCK test owner : http://javaweb.sfbay/jcce/tcks/jck/docs/others/owners.jto

Failing Tests:
===============
api/javax_imageio/stream/FileCacheImageInputStream/index.html#close[close002] 

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

How to reproduce:
====================
JAVA=/set/stt/jdk_promotions/JDK6.0/b59a/binaries/linux-i586/jre1.6.0 #put path to java
JCK=/set/stt/jck_promotions/6.0/beta/b13/binaries/JCK-runtime-60/  #put path to jck here
WORKDIR=/tmp  #put path to workdir

$JAVA/bin/java -Xfuture -classpath $JCK/classes -Djava.security.policy=$JCK/lib/jck.policy javasoft.sqe.tests.api.javax.imageio.stream.FileCacheImageInputStream.closeTests -TestWorkDirURL file:$WORKDIR/workDir/api/javax_imageio/stream/FileCacheImageInputStream/


Test output:
=============
java.lang.NullPointerException
	at javax.imageio.stream.FileCacheImageInputStream.readUntil(Unknown Source)
	at javax.imageio.stream.FileCacheImageInputStream.read(Unknown Source)
	at javasoft.sqe.tests.api.javax.imageio.stream.FileCacheImageInputStream.closeTests.close002(closeTests.java:109)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:399)
	at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
	at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:127)
	at javasoft.sqe.tests.api.javax.imageio.stream.FileCacheImageInputStream.closeTests.main(closeTests.java:73)

Comments
EVALUATION This was caused by my changes for: 6299405: ImageInputStreamImpl still uses a finalize() which causes java.lang.OutOfMemoryError As part of that fix I changed FileCacheImageInputStream.close() so that it nulls out its reference to the cache object. The JCK test was just lucky before that it got an IOException when trying to call read() after close(). It turns out that FCIIS.read() does not properly call checkClosed(), so it will continue on and try to access the cache, which is now nulled out by close(), and thus the NPE instead of IOE. The fix is to change FCIIS.read() to call checkClosed() as it is supposed to do. While looking into this bug, I've found that the various stream classes are a bit inconsistent in the way that they check parameters to read/write methods. We should probably clean this up. Also, it looks like the FileCacheImageOutputStream.read() methods do not call checkClosed() either!
15-12-2005