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.
1. Connect to some DB. 2. Exapnd "Indexes" node, rightclick some index and choose "Add Column". 3. Choose some column and press Enter. Result: Error message appears, but column is added.
Created attachment 72708 [details] Screenshot of error message.
I've seen this too, but it's not reliably reproducible. The real pain is that there is no stack trace in the log file. My first step is to get the darn thing to print a stack trace and then we'll see what we shall see...
4a4a8c34ffd3 The problem was that the method call to add the column was happening on the event thread - actually a bad idea for a database operation, so it was good that this was detected. I moved the operation into the task thread, and I can't reproduce any more, anyway, but since it's random I'm not sure. Roman, please verify.
I fixed this for "Add Column" but not for "Add Column to Index", it appears.
299f2490cfa5
Verified with build 081030.
Integrated into 'main-golden', will be available in build *200810310201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/299f2490cfa5 User: David Van Couvering <davidvc@netbeans.org> Log: #151513: Error message appears by attempt to add column to an index
Why is calling addColumn() in the event thread a bad idea, when all it does (TableNodeInfo.addColumn()) is notifyChange(), which should schedule a refresh of the nodes in a background thread?
Which changeset are you talking about Andrei? There is no call to addColumn() in the changeset for this fix.
I was reacting to your comment in desc4. Adding the column in the event thread doesn't seem to matter here, because (according to TableNodeInfo.addColumn()) adding a column means refreshing the column nodes, which should happen in a background thread. So I wonder how exactly the problem reported by Roman occurred.
Oh, I see. Well, what the code actually does is call NodeInfo.refreshChildren(), and refreshChildren() calls initChildren(), and IndexNodeInfo.initChildren() calls testDatabaseConnection(), which calls getJDBCConnection(test), which can't be called on the event thread. Now, perhaps it shouldn't call refreshChildren() and instead call notifyChange(). But the action was doing a *ton* of work with the database on the event thread, so I moved it all to a RequestProcessor thread, including the call to refreshChildren(). I could probably have fixed the bug by either calling notifyChange() or putting the call to refreshChildren() on a background thread, but I thought it better to put the whole thing on a background thread while I was at it. Now that I'm thinking further about this, I suspect there are other places where we call refreshChildren() on the event thread, and they'll get the same exception. I'll talk to Rob about this, it would be good to should fix this in a more centralized place rather than having all the actions need to know they need to call refreshChildren() on a background thread.