Author: [EMAIL PROTECTED]
Date: Tue Sep 30 14:38:30 2008
New Revision: 2738
Modified:
trunk/src/ca/sqlpower/architect/swingui/query/SQLQueryEntryPanel.java
trunk/src/ca/sqlpower/architect/swingui/query/messages.properties
Log:
Fixed a NPE that was caused by continuing execution after a dialog box.
Also enhanced the exception message.
Modified:
trunk/src/ca/sqlpower/architect/swingui/query/SQLQueryEntryPanel.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/query/SQLQueryEntryPanel.java
(original)
+++ trunk/src/ca/sqlpower/architect/swingui/query/SQLQueryEntryPanel.java
Tue Sep 30 14:38:30 2008
@@ -188,13 +188,17 @@
}
public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() != ItemEvent.SELECTED) {
+ return;
+ }
if (!conMap.containsKey(e.getItem())) {
SPDataSource ds = (SPDataSource)e.getItem();
try {
Connection con = ds.createConnection();
conMap.put(ds, con);
} catch (SQLException e1) {
- SPSUtils.showExceptionDialogNoReport(parent,
Messages.getString("SQLQuery.failedConnectingToDB"), e1);
+ SPSUtils.showExceptionDialogNoReport(parent,
Messages.getString("SQLQuery.failedConnectingToDBWithName", ds.getName()),
e1);
+ return;
}
}
try {
Modified: trunk/src/ca/sqlpower/architect/swingui/query/messages.properties
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/query/messages.properties
(original)
+++ trunk/src/ca/sqlpower/architect/swingui/query/messages.properties Tue
Sep 30 14:38:30 2008
@@ -9,6 +9,7 @@
SQLQuery.failedAutoCommit=Auto commit could not be toggled on the database.
SQlQuery.failedCommit=Commit failed executing on the database.
SQLQuery.failedConnectingToDB=Could not create a connection to the
selected database.
+SQLQuery.failedConnectingToDBWithName=Could not create a connection to {0}.
SQLQuery.failedRollback=Rollback failed executing on the database.
SQLQuery.mangeConnections=Manage Connections...
SQLQuery.rollback=Rollback