Bug 215358

Summary: [CommonNavigator] duplicate items in a (Web) project
Product: [Eclipse Project] Platform Reporter: Andrew Mak <makandre>
Component: UIAssignee: Francis Upton IV <francisu>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
duplicate deployment descriptor node
none
test plugin exposing this problem none

Description Andrew Mak CLA 2008-01-15 10:58:13 EST
Created attachment 86944 [details]
duplicate deployment descriptor node

Hi, I'm working on an extension to CNF to contribute some content to Dynamic Web Projects.  I am noticing that the deployment descriptor node is being rendered twice in the project (see screenshot); may need to close/re-open project to see this.  I'll attach a test plugin which exposes this problem.

I traced through the code and came across this block of code which seems to be causing some problems:

// NavigatorPipelineService.java: ~lines 99-112
for (int i = 0; i < contributions.length; i++) {
  // returns an array sorted by reverse priority
  possibleMatches = contentService.findDescriptorsWithPossibleChild  
    (contributions[i]); 
  NavigatorContentDescriptor[] descriptors = (NavigatorContentDescriptor[]) 
    possibleMatches.toArray(new NavigatorContentDescriptor[possibleMatches.size 
    ()]);
  for (int indx = possibleMatches.size()-1; indx > -1; indx--) {	
    // terminates once the highest priority match is found for this child
    if(possibleContributors.contains(descriptors[indx])) {
      contentService.rememberContribution(descriptors[indx], contributions[i]);
      break;
    }			
  }
}

According to the comment, the descriptors array is an array of content providers in reverse priority, highest to lowest (the content provider in my test plugin has lowest priority and I can see it at the end of the array via breakpointing).  The for indx loop that comes after looks for the highest priority match but the loop is in reverve direction starting at the end of the array, so I think the code here is picking the lowest priority provider to associate with the contribution (whereas elsewhere in the code the highest priorty provider is picked resulting in a different association).
Comment 1 Andrew Mak CLA 2008-01-15 11:02:58 EST
Created attachment 86945 [details]
test plugin exposing this problem
Comment 2 Francis Upton IV CLA 2008-11-30 04:16:57 EST
(In reply to comment #0)
> Created an attachment (id=86944) [details]
> duplicate deployment descriptor node
> 
> Hi, I'm working on an extension to CNF to contribute some content to Dynamic
> Web Projects.  I am noticing that the deployment descriptor node is being
> rendered twice in the project (see screenshot); may need to close/re-open
> project to see this.  I'll attach a test plugin which exposes this problem.
> 
> I traced through the code and came across this block of code which seems to be
> causing some problems:
> 
> // NavigatorPipelineService.java: ~lines 99-112
> for (int i = 0; i < contributions.length; i++) {
>   // returns an array sorted by reverse priority
>   possibleMatches = contentService.findDescriptorsWithPossibleChild  
>     (contributions[i]); 
>   NavigatorContentDescriptor[] descriptors = (NavigatorContentDescriptor[]) 
>     possibleMatches.toArray(new NavigatorContentDescriptor[possibleMatches.size 
>     ()]);
>   for (int indx = possibleMatches.size()-1; indx > -1; indx--) {        
>     // terminates once the highest priority match is found for this child
>     if(possibleContributors.contains(descriptors[indx])) {
>       contentService.rememberContribution(descriptors[indx], contributions[i]);
>       break;
>     }                   
>   }
> }
> 
> According to the comment, the descriptors array is an array of content
> providers in reverse priority, highest to lowest (the content provider in my
> test plugin has lowest priority and I can see it at the end of the array via
> breakpointing).  The for indx loop that comes after looks for the highest
> priority match but the loop is in reverve direction starting at the end of the
> array, so I think the code here is picking the lowest priority provider to
> associate with the contribution (whereas elsewhere in the code the highest
> priorty provider is picked resulting in a different association).
> 
No sure how accurate these comments are, it would seem findDescriptorsByTriggerPoint and findDescriptorsWithPossibleChild should return things in the same order.  Need to investigate this further.

Can you send the source of your test plugin?  I want to see how it might be integrated into the CNF tests.
Comment 3 Andrew Mak CLA 2008-12-01 09:26:34 EST
Hi, sorry it's been a while since I opened this bug, and I don't have the source to the test plugin anymore.  However, you can probably decompile the classes to take a look.
Comment 4 Eclipse Webmaster CLA 2019-09-06 15:35:00 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.