This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 215255 - NullPointerException at org.netbeans.modules.db.dataview.util.DBReadWriteHelper.readResultSet
Summary: NullPointerException at org.netbeans.modules.db.dataview.util.DBReadWriteHelp...
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Show Data (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords: NETFIX
Depends on:
Blocks:
 
Reported: 2012-07-08 19:47 UTC by Exceptions Reporter
Modified: 2012-07-11 03:28 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 190525


Attachments
stacktrace (864 bytes, text/plain)
2012-07-08 19:47 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Exceptions Reporter 2012-07-08 19:47:35 UTC
This bug was originally marked as duplicate of bug 206233, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 7.1.2 (Build 201204101705)
VM: Java HotSpot(TM) Client VM, 1.6.0-b105, Java(TM) SE Runtime Environment, 1.6.0-b105
OS: Windows Vista

User Comments:
cloeffler: not all data in table is displayed

schkovich: Executing SQL statement returning empty result set most likely

GUEST: even using thin driver not able to view image data

schkovich: error in sql query




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.db.dataview.util.DBReadWriteHelper.readResultSet(DBReadWriteHelper.java:211)
   at org.netbeans.modules.db.dataview.output.SQLExecutionHelper.loadDataFrom(SQLExecutionHelper.java:515)
   at org.netbeans.modules.db.dataview.output.SQLExecutionHelper.initialDataLoad(SQLExecutionHelper.java:134)
   at org.netbeans.modules.db.dataview.output.DataView.create(DataView.java:105)
   at org.netbeans.modules.db.dataview.api.DataView.create(DataView.java:74)
   at org.netbeans.modules.db.sql.execute.SQLExecuteHelper.execute(SQLExecuteHelper.java:119)
Comment 1 Exceptions Reporter 2012-07-08 19:47:39 UTC
Created attachment 121808 [details]
stacktrace
Comment 2 matthias42 2012-07-08 20:18:42 UTC
Ah - you would think implementing the jdbc specification is not that complex. From the stacktrace the problem arises from:

byte[] bdata = rs.getBytes(index);

the stacktrace indicates, that bdata is null after this call. After this call the further process is guarded by a call to rs.wasNull() - which had to return false to reach the reported line.

This case is partly fixed in the upcoming 7.2 version, in which the whole blob/varbinary handling was reworked. The only missing part is a guard for the Types.BIT case.

For the committers:

Please add a guard in DBReadWriteHelper.java in line 192. There the call to rs.wasNull() is done, I would add a guard for a null result:

if (rs.wasNull() || bdata == null) {
Comment 3 Jaroslav Havlin 2012-07-09 08:58:28 UTC
(In reply to comment #2)
> For the committers:
> 
> Please add a guard in DBReadWriteHelper.java in line 192. There the call to
> rs.wasNull() is done, I would add a guard for a null result:
> 
> if (rs.wasNull() || bdata == null) {

Fixed in http://hg.netbeans.org/core-main/rev/271f799ec3db
Thank you, Matthias.
Comment 4 Quality Engineering 2012-07-11 03:28:27 UTC
Integrated into 'main-golden', will be available in build *201207110002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/271f799ec3db
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #215255: NPE at DBReadWriteHelper.readResultSet