Maintenance Notice

The bugs.java.com site will be undergoing maintenance on 15th Dec 2017 21:00 PST to 16th Dec 2017 1:00 AM PST.
JDK-6459029 : Attempt to close Query object after closing DataSet throws NPE
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.sql
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2006-08-10
  • Updated: 2011-02-16
  • Resolved: 2006-08-25
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 Availabitlity Release.

To download the current JDK release, click here.
JDK 6
6 b98Fixed
Description
After closing a DataSet, an attempt to close the associated Query object throws a NPE, even though the isClosed() method of the Query object returns false.

The attached test case produces the following output:

Dropping table...
Creating table...
Closing DataSet addressesDS.
Is addressesDS closed? true
Is Query object aq closed? false
Closing Query object aq.
Exception in thread "main" java.sql.SQLRuntimeException: java.lang.NullPointerException
        at com.sun.sql.QueryObjectGeneratorImpl.deregisterAllDataSets(Unknown Source)
        at com.sun.sql.QueryObjectGeneratorImpl.invoke(Unknown Source)
        at $Proxy0.close(Unknown Source)
        at CloseTest.main(CloseTest.java:67)
Caused by: java.lang.NullPointerException
        at com.sun.sql.DataSetImpl$DataSetItr.<init>(Unknown Source)
        at com.sun.sql.DataSetImpl.iterator(Unknown Source)
        at java.util.AbstractList.hashCode(AbstractList.java:524)
        at java.util.WeakHashMap.remove(WeakHashMap.java:543)
        at java.util.WeakHashMap$HashIterator.remove(WeakHashMap.java:779)
        ... 4 more

Comments
SUGGESTED FIX The closed datasets are not closed when QueryObject.close() is called. Also weakReferences is cleared when QueryObject.close() is called. checkin logs: Checking in DataSetImpl.java; /m/jws/jdbc4.0/src/com/sun/sql/DataSetImpl.java,v <-- DataSetImpl.java new revision: 1.56; previous revision: 1.55 done Checking in QueryObject.java; /m/jws/jdbc4.0/src/com/sun/sql/QueryObject.java,v <-- QueryObject.java new revision: 1.3; previous revision: 1.2 done
2006-08-25

EVALUATION After DataSet is closed, the hashCode for that DataSet results in NullPointerException. Need to ignore closed DataSet.
2006-08-24