| Summary: | Sometimes CurrentPhase#get() returns a wrong phase | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Ivan Furnadjiev <ivan> | ||||||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P1 | ||||||||||
| Version: | 1.4 | ||||||||||
| Target Milestone: | 1.5 M6 | ||||||||||
| Hardware: | All | ||||||||||
| OS: | All | ||||||||||
| Whiteboard: | |||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 369521 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Ivan Furnadjiev
Created attachment 211867 [details]
Proposed patch
The problem is that CurrentPhase is using a phase listener too. It sets the current phase in beforePhase. That's why the order of execution of registered phase listener is crucial - the phase listener for the CurrentPhase *must* be executed first to set the correct current phase. The CurrentPhase phase listener is *always* registered in the PhaseListenerManager first - ApplicationContextConfigurator#addInternalPhaseListeners, but the order of execution of phased listeners is not guarantee by the PhaseListenerManager as HashSet is used to keep the listeners. The proposed patch changes the HashSet to LinkHashSet to ensure that phase listeners are executed in the order of which they are added.
Created attachment 211881 [details]
Updated patch
In addition to the previous patch HashSet is replaced with LinkHashSet in PhaseListenerRegistry too. JUnit tests for both classes added too.
It seems that this patch is not enough as phase listeners form the extension point (WorkbenchApplicationConfigurator) are still registered before the CurrentPhase listener - see ApplicationContextConfigurator#configure. Just come to my mind another approach - CurrentPhase could not rely on a phase listener by set current phase explicitly in RWTLifeCycle or SimpleLifeCycle. Created attachment 211919 [details] Patch that implements the idea in comment#4 Applied last patch to CVS HEAD. CurrentPhase does not use phase listener anymore. |