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 144211 - [65cat] IllegalStateException: This connection is not added to the ConnectionManager.
Summary: [65cat] IllegalStateException: This connection is not added to the Connection...
Status: RESOLVED DUPLICATE of bug 144819
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Rob Englander
URL: http://statistics.netbeans.org/except...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-17 20:38 UTC by sunbiz
Modified: 2008-09-17 17:36 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 93037


Attachments
stacktrace (2.71 KB, text/plain)
2008-08-17 20:38 UTC, sunbiz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sunbiz 2008-08-17 20:38:18 UTC
Build: NetBeans IDE Dev (Build 080817)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-rc-b28
OS: Windows Vista, 6.0, x86

User Comments: 
Run Query for Query Designer after the connection has been deleted

Stacktrace: 
java.lang.IllegalStateException: This connection is not added to the ConnectionManager.
        at org.netbeans.api.db.explorer.DatabaseConnection.getJDBCConnection(DatabaseConnection.java:223)
        at org.netbeans.modules.db.sql.visualeditor.querybuilder.QueryBuilder.getConnection(QueryBuilder.java:1052)
        at org.netbeans.modules.db.sql.visualeditor.querybuilder.QueryBuilder.executeQuery(QueryBuilder.java:1133)
        at org.netbeans.modules.db.sql.visualeditor.querybuilder.QueryBuilderSqlTextArea.actionPerformed(QueryBuilderSqlTextArea.java:614)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
Comment 1 sunbiz 2008-08-17 20:38:23 UTC
Created attachment 67650 [details]
stacktrace
Comment 2 Rob Englander 2008-08-21 17:28:46 UTC
There's a simple fix to deal with the case where the associated connection has since been deleted, at least with regard
to informing the user and not dumping an exception.

The problem is that the designer is not equipped to handle the fact that it's associated connection doesn't
exist anymore.  It would be a significant amount of work to modify the query designer to behave like the
sql command window, which maintains a list of connections and deals with this nicely.

There's a few choices:

1) After the connection has been deleted and the user attempts to run a query from the designer, inform the
user that the connection no longer exists and subsequently close the designer top component.

2) Same as above but just tell the user to close it.

3) Close the impacted query designer windows as soon as their associated connections are deleted.

Anything more than this, I think, would take much more time.  I prefer (3) myself.
Comment 3 John Baker 2008-08-21 20:23:14 UTC
+1 for
> 3) Close the impacted query designer windows as soon as their associated connections are deleted.

The Query Editor cannot function if a connection is disconnected or deleted.

A change I made awhile ago, doesn't allow the Query Editor to open if the user chose Cancel in the Connect dialog
Comment 4 John Baker 2008-08-21 20:25:14 UTC
Forgot to add that it would be a good idea to post a warning dialog to inform the user that the connection was lost/removed.
Comment 5 John Baker 2008-08-21 21:51:05 UTC
If the editor is closed then any changes must be saved.


On the other hand, if it's preferable to not close the visualsqleditor, I had implemented a way to detect deleted
connections and for users to restore the connection (for web projects):
In the j2ee.common module, see org.netbeans.modules.j2ee.common.ui.MissingDatabaseConnectionWarning
Comment 6 Rob Englander 2008-08-21 22:02:31 UTC
I agree, if we close the designer windows then the user will be informed.

I don't understand your comment about saving the changes when the window is closed.  It doesn't
look to me like the query designer serializes.  So what would we be saving, and for what purpose?
Comment 7 John Baker 2008-08-21 22:06:08 UTC
If the user changes the query then the SQL would need to be saved.  It is saved in the <scope>Bean class, typically in
the SessionBean class.

Comment 8 John Baker 2008-08-21 22:08:09 UTC
The SessionBean class is a client class that is generated by the Visual Web project
Comment 9 David Vancouvering 2008-09-17 17:36:25 UTC

*** This issue has been marked as a duplicate of 144819 ***