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 247699 - NullPointerException at org.netbeans.modules.db.dataview.output.DataView$6.run
Summary: NullPointerException at org.netbeans.modules.db.dataview.output.DataView$6.run
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Show Data (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: matthias42
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2014-10-05 17:23 UTC by IrianR
Modified: 2015-02-01 16:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 212471


Attachments
stacktrace (1.17 KB, text/plain)
2014-10-05 17:23 UTC, IrianR
Details
proposed patch v1 (8.43 KB, patch)
2014-11-26 20:54 UTC, matthias42
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description IrianR 2014-10-05 17:23:47 UTC
Build: NetBeans IDE 8.0.1 (Build 201408142300)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.55-b03, Java(TM) SE Runtime Environment, 1.7.0_55-b13
OS: Windows 7

User Comments:
IrianR: Inserting 2 rows with a BLOB column ina derby table.




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.db.dataview.output.DataView$6.run(DataView.java:335)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
   at java.awt.EventQueue.access$200(EventQueue.java:103)
   at java.awt.EventQueue$3.run(EventQueue.java:694)
   at java.awt.EventQueue$3.run(EventQueue.java:692)
Comment 1 IrianR 2014-10-05 17:23:48 UTC
Created attachment 149716 [details]
stacktrace
Comment 2 matthias42 2014-11-26 20:54:21 UTC
Created attachment 150737 [details]
proposed patch v1
Comment 3 matthias42 2014-11-26 21:00:40 UTC
The problem is easily reproducible by creating a simple derby table:

create table blobtest3 (id integer generated always as identity primary key, data blob);

Open "Insert" dialog, add a second row, use "open as text" on both rows, input text into each and press ok.

Problem: The insert routine schedules a reload immediately after _each_ insert. So when the second insert is invoked we have a race condition. One thread opens a resultset and in that the blob, the other commits the open transaction and in doing so invalidates the blob reference.

The "real solution" would be to use locking or seperate connections for the queries.

The attached patch fixes the problem different (in all fairness the base problem remains, but should not be visible anymore). This patch changes the insert to execute all inserts in one go and issues a refresh after wards. This is more efficient and works around the race condition, as it won't happen.
Comment 4 matthias42 2015-02-01 16:12:49 UTC
The fix was committed as:

http://hg.netbeans.org/core-main/rev/338df9dcc394

the fix works as described in comment 3. As said there the problem was reproducible and in my after tests the behavior is correct.

In the next few days a nightly build will be done, that contains this fix. Please check, if the problem is also fixed for you. If you find it fixed, please change the status of this bug to "VERIFIED". Thank you!