[ 
https://issues.apache.org/jira/browse/CXF-5008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13653008#comment-13653008
 ] 

Daniel Kulp commented on CXF-5008:
----------------------------------

Somewhat working as designed.   The PhaseInterceptorChain will not reorder 
items already in the chain to meet new requirements.  In step 3 above (adding 
0), that resulting order (2, 0, 4) is perfectly valid according to the 
restraints available at that time.  From that point on, nothing would make 0 
move from between the 2 and the 4.
                
> PhaseInterceptorChain insertInterceptor gives wrong ordering
> ------------------------------------------------------------
>
>                 Key: CXF-5008
>                 URL: https://issues.apache.org/jira/browse/CXF-5008
>             Project: CXF
>          Issue Type: Bug
>            Reporter: Vadim Kirilchuk
>            Priority: Minor
>         Attachments: PhaseInterceptorChainTest.patch
>
>
> Hi everyone, 
> I am playing along with PhaseInterceptorChain#insertInterceptor and confused 
> by ordering. As i understand this code have to order interceptors according 
> to their before/after dependencies. 
> I have 5 interceptors with names "0","1","2","3","4"
> "0" must be before "1" and "4"
> "1" must be before "2" but after "0"
> "2" must be before "4" but after "1"
> "3" must be after "1" and "2"
> "4" has no befors or afters
> as you can see the rule is very simple
> n-th element befors can be any from n + 1
> n-th element afters can be any from 0, n
> Now i try to add this interceptors in shuffled order: 4, 2, 0, 1, 3
> Here is what i get in the chain step by step
> 4
> 2, 4
> 2, 0, 4
> 1, 2, 0, 4
> 1, 2, 0, 4, 3
> as you can see constraint for "0" is broken, it must be at the head!
> Also i don't see any checks for case when you met firstBefore and then met 
> lastAfter which means that your interceptors have conflicting dependencies. 
> Is it OK? 
> Example: interceptor C must be before D but after B, and interceptor B must 
> be after D
> when you start adding them as D B C you first add D to chain
> D
> then B, and see that it have to be after D
> D B
> then you try to add C and see, that it must be before D but after B
> c D B c
> and no exceptions or something is thrown.
> I am attaching tests as well.
> Please check them and tell me if i just doing something wrong.
> Thanks in advance.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to