Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 21861 - [TM] The implementation of ITeamNode#getKind():int in DiffElement can return a value that does not match the spec
Summary: [TM] The implementation of ITeamNode#getKind():int in DiffElement can return ...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 2.0   Edit
Hardware: PC All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Kevin McGuire CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-24 12:10 EDT by Antonio D'souza CLA
Modified: 2002-08-23 16:13 EDT (History)
1 user (show)

See Also:


Attachments
potential patch for bug 18208 that exposes this problem (6.49 KB, patch)
2002-07-24 14:01 EDT, Antonio D'souza CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio D'souza CLA 2002-07-24 12:10:59 EDT
RemoteTargetSyncElement#getSyncKind(int,IProgressMonitor):int, which implements
ILocalSyncElement#getSyncKind(int,IProgressMonitor):int, returns the ORed value
of the appropriate public static final ints defined in ILocalSyncElement. 
However, it is used by SyncCompareInput#collectResourceChanges(...):IDiffElement
to indirectly set the value of the fkind instance variable in DiffElement. 
This means that DiffElement#getKind():int, which is used by
{Put,Get}SyncAction#run(...):SyncSet, returns values not defined in Differencer.
Comment 1 Antonio D'souza CLA 2002-07-24 14:01:29 EDT
Created attachment 1731 [details]
potential patch for bug 18208 that exposes this problem
Comment 2 Antonio D'souza CLA 2002-07-24 14:14:25 EDT
How to see the effects of this bug in action:
Apply the patch for 18208 included in this PR to the org.eclipse.team.ui project.
Run a self-hosted Eclipse instance in Debug mode.
Create a new folder in a fresh project.
Deploy & upload this project to a Target site.
Delete the folder locally.
Synchronize the project and observe (in the debugger) what changed[i].getKind()
returns for the newly deleted folder.

What you will see:
The value returned by changed[i].getKind() will be 6 (the result of the bitwise
OR of 4 & 2). 

The problem:
Since changed[i].getKind() is supposed to return a value defined in Differencer,
this value is used to determine whether the change is a deletion or not.
However, since a deletion is indicated by 2 (not 6), the function does not flag
the change as a deletion & bad things ™ happen consequently.
Comment 3 Michael Valenta CLA 2002-08-23 16:03:26 EDT
Tony, was this patch ever applied?
Comment 4 Antonio D'souza CLA 2002-08-23 16:12:19 EDT
I think James & I fixed this by consolidating the public static finals in the 2
different files to be the same by making one set redirect to the other & using
the mask defined in one of the classes to prevent this from being a problem. 
Comment 5 Antonio D'souza CLA 2002-08-23 16:13:36 EDT
This should no longer be a problem.