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 102574 - ConcurrentModification exception can occur even when listening to JDBCDriverListener
Summary: ConcurrentModification exception can occur even when listening to JDBCDriverL...
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-26 08:12 UTC by John Baker
Modified: 2007-04-27 04:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
exception (1.82 KB, application/octet-stream)
2007-04-26 08:13 UTC, John Baker
Details
DerbyWaiter class (2.68 KB, application/octet-stream)
2007-04-26 08:14 UTC, John Baker
Details
Fixed DerbyWaiter.java (2.80 KB, text/plain)
2007-04-26 16:19 UTC, Andrei Badea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Baker 2007-04-26 08:12:04 UTC
This could be developer error but filing just in case.
Note, the ConcurrentModification exception doesn't occur consistently.

Running the attached program at IDE startup (start IDE without a userdir)
should add one Derby connection for a schema named TRAVEL

I see different results for each IDE restart

One of the following symptoms occur while testing IDE restart repeatedly,
deleting the userdir between restarts:

- connection to Travel is added correctly

- connection to Travel is added but the connection to the sample database
doesn't appear

- a ConcurrentModification exception occurs
(see attached stack trace)

A program will be attached.
Comment 1 John Baker 2007-04-26 08:13:13 UTC
Created attachment 41693 [details]
exception
Comment 2 John Baker 2007-04-26 08:14:54 UTC
Created attachment 41694 [details]
DerbyWaiter class
Comment 3 John Baker 2007-04-26 08:18:49 UTC
To use this class,  instantiate DerbyWaiter at IDE startup.

Starting IDE using JDK 1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105 on Windows XP
Comment 4 Andrei Badea 2007-04-26 16:05:38 UTC
Fixed, thanks for filing it. Next time please set the content type correctly. It
should have been text/plain for both the exception stack trace and the Java
class. application/octet-stream is not handled by Firefox, so it can't be
displayed just by clicking on it; it needs to be saved to the disk first.

Checking in JDBCDriverManager.java;
/cvs/db/src/org/netbeans/api/db/explorer/JDBCDriverManager.java,v  <-- 
JDBCDriverManager.java
new revision: 1.5; previous revision: 1.4
done
Comment 5 Andrei Badea 2007-04-26 16:18:39 UTC
By the way, you have some race conditions in DerbyWaiter:

1) If the Java DB drivers are registered before the listener is added, you won't
get any events. You need to first attach the listener and then try to register
the drivers (which may or may not succeed).

2) registerConnections() may be called multiple times (e.g. if another driver is
added immediately after the Java DB driver -- before you unregister the
listener). That could result in the connection being added multipe times (which
would throw an exception).

And of course, the fact that you got a driversChanged event doesn't mean it was
caused by the Java DB drivers -- it might have been caused by another driver, in
which case you would have got an AIOOBE trying to access drvsArray[0].

Attaching a DerbyWaiter.java which attempts to solve these problems. I haven't
actually run it, so let me know if it doesn't work.
Comment 6 Andrei Badea 2007-04-26 16:19:33 UTC
Created attachment 41744 [details]
Fixed DerbyWaiter.java
Comment 7 John Baker 2007-04-27 04:02:29 UTC
fix verified.

btw, the attachment was a test case, but thanks for evaluating it