Bug 215358 - [CommonNavigator] duplicate items in a (Web) project
Summary: [CommonNavigator] duplicate items in a (Web) project
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Francis Upton IV CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-15 10:58 EST by Andrew Mak CLA
Modified: 2019-09-06 15:35 EDT (History)
0 users

See Also:


Attachments
duplicate deployment descriptor node (9.20 KB, image/gif)
2008-01-15 10:58 EST, Andrew Mak CLA
no flags Details
test plugin exposing this problem (3.05 KB, application/x-zip-compressed)
2008-01-15 11:02 EST, Andrew Mak CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.