Community
Participate
Working Groups
The problem with the DataModelSynchHelper#synchUIWithModel(String, int) method is that the currentWidget instance variable is set by looking up from the cache but when the widget value is set this triggers an event which causes this method to be called again. When the method completes from the notification (from setting the widget value) it will set the currentWidget value back to null. Then the initial call to the method will call setEnablement(...) and throw the NPE because the currentWidget was set to null from the triggered event (tricky...:)). The fix is actually quite simple. Create a temp variable for the currentWidget and use the temp variable when doing the enablement setting. This way the currentWidget instance variable can be set to null and not affect the temp variable which was the widget when the code block was entered. I've attached a patch to this problem as well.
Created attachment 38987 [details] Patch to DataModelSynchHelper
I would like to nominate this bug a Great Bug. Dan found and fixed an obscure thread race condition in core DataModel framework code. Looking at where the fix is, this is clearly a difficut bug to reproduce, and likely would have been returned as "works for me" if Dan had simply included the stack trace. Thanks Dan!
Verified WTP 1.5.1 RC driver.