United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6363748 api/javax_imageio/stream/FileCacheImageInputStream/index.html#close[close002] fails
JDK-6363748 : api/javax_imageio/stream/FileCacheImageInputStream/index.html#close[close002] fails

Details
Type:
Bug
Submit Date:
2005-12-15
Status:
Closed
Updated Date:
2012-03-23
Project Name:
JDK
Resolved Date:
2006-02-22
Component:
client-libs
OS:
generic
Sub-Component:
javax.imageio
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports

Sub Tasks

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!
                                     
2005-12-15



Hardware and Software, Engineered to Work Together