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.
Summary: | Adding a query criteria changes Table binding | ||
---|---|---|---|
Product: | obsolete | Reporter: | John Baker <jbaker> |
Component: | visualweb | Assignee: | Matthew Bohm <mbohm> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | alexpetrov, blaha, sandipchitale, wjprakash |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | PC | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
diff of proposed fix
diff of revised proposed fix diff of integrated fix |
Description
John Baker
2007-08-24 07:26:39 UTC
Since Matt added the Dataprovider listener, assigning this to him to take care of this bug. Created attachment 47373 [details]
diff of proposed fix
I've attached a proposed fix (see attachment diff-0824-1830.txt), which is currently under review. In this diff, before reconstructing the table columns, we try to determine whether the existing bindings will throw an ELException. We only reconstruct the table columns if an ELException is detected. This may prove a good algorithm for determining whether to reconstruct in response to a change in the dataprovider's wrapped data. Adding wjprakash, sandipchitale to the CC list so they can see the proposed fix. wjprakash wisely points out that we can remove columns that will throw an ELException rather than perform the more drastic maneuver of reconstructing the table. I will revise the proposed fix. Created attachment 47562 [details]
diff of revised proposed fix
The diff looks OK to me. Created attachment 47783 [details]
diff of integrated fix
Fixed. Checking in webui/src/designtime/com/sun/webui/jsf/component/TableRowGroupDesign Info.java; /cvs/woodstock/webui/src/designtime/com/sun/webui/jsf/component/TableRowGroupDes ignInfo.java,v <-- TableRowGroupDesignInfo.java new revision: 1.5; previous revision: 1.4 done One note of interest. CachedRowSetXImpl.setCommand calls release, which leads to an invocation of CachedRowSetDataProvider.fireProviderChanged. Following the call to release, setCommand calls propertyChangeSupport.firePropertyChange, which leads to (1) the field keys updating based on the new command and (2) an invocation of CachedRowSetDataProvider.fireProviderChanged. The net effect is that fireProviderChanged is called twice, first with the old field keys in place and subsequently with the new ones in place. In my opinion, this is not a flaw in CachedRowSetXImpl: release and firePropertyChange are firing two distinct events--it just so happens that they both trigger calls to fireProviderChanged. Unfortunately, the distinction in *how* the provider has changed is lost; there is no way to tell whether the number of rows have changed (due to the call to release) or whether the field keys have changed (due to the call to firePropertyChange). This is just a limitation in the dataprovider API. The two consecutive invocations of fireProviderChanged causes ProviderListener.providerChanged to be called twice, but the effect of the repetition is benign: the first invocation never catches an ELException, precisely because the old field keys are still in place. Thus the first invocation is effectively a no-op. The second invocation actually catches any ELException resulting from the update to the field keys. Unfortunately I was able to reproduce this bug on SunOS sparc: Product Version: NetBeans IDE Dev (Build 200708300000) Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05 System: SunOS version 5.10 running on sparc And 1 more note: a Table column, which was added to column set, but wasn't related to DB table, has been disappear after modification of CachedRowSet in Query Editor. Oh, I'm very sorry, just now I see that this bug was fixed on 08/30/2007. And the fix was not included into build 0708300000. But there is no newer build now. FIXED status is restored. Verified on: Product Version: NetBeans IDE Dev (Build 2007090300000) Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05 System: SunOS version 5.10 running on sparc |