Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 275479

Summary: [ui] Site nickname entered by user is overwritten when repo is refreshed
Product: [Eclipse Project] Equinox Reporter: Henrik Lindberg <henrik.lindberg>
Component: p2Assignee: Susan McCourt <susan>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: irbull, john.arthorne, susan
Version: 3.5Flags: john.arthorne: review-
susan: review+
Target Milestone: 3.5 RC1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch
none
Repository manager fix none

Description Henrik Lindberg CLA 2009-05-08 11:58:19 EDT
When checking for updates is finished the nickname I entered was replaced by a name from the site.
Nice feature if I did not enter a name, but very confusing when I have different versions of "the same site" and doing testing. Also bad if the site has a bad name to begin with and user wants to override it.

I tested this with the http://testserver:8080/decelerate site and named it "slow 3.4" - after update it was called "Eclipse Project Updates"
Comment 1 Susan McCourt CLA 2009-05-08 18:27:24 EDT
Definitely not the intention.  The nickname is supposed to win, and the producer-name considered only when a nickname is not provided...
Will investigate.
Comment 2 Susan McCourt CLA 2009-05-11 16:03:39 EDT
Henrik, I can't reproduce this problem as described.  Could you provide some more information?

When I try to add http://testserver:8080/decelerate, I get this error for the site, so I'm unable to get any further.

Unknown Host: http://testserver:8080/decelerate/site.xml
  Unknown Host: http://testserver:8080/decelerate/site.xml
  testserver

I thought that maybe I have to have 3.4 site enabled for this site to work, but I still get this error after adding/enabling the 3.4 site.  

I tried other sites where there is a producer name.  For example, I added http://www.taubit.de/eclipse/twitterclipse and named it MyTwitter.  After checking for updates, it was still called "MyTwitter".  When I did the same thing and did not name the repo, the name would refresh to "twitterclipse" (the producer repo name).

I also double checked the code to ensure that we don't ever overwrite the nickname unless it's not been specified.

There may be some more subtle bug here, but I'll need to know:
- what sites you started with
- how/when/where you added the site (prefs, install new software, paste, drag?)
- where you looked to find out that the nickname had been replaced (prefs, install new software)


Comment 3 Henrik Lindberg CLA 2009-05-11 18:31:28 EDT
(In reply to comment #2)
> Henrik, I can't reproduce this problem as described.  Could you provide some
> more information?
> 
> When I try to add http://testserver:8080/decelerate, I get this error for the
> site, so I'm unable to get any further.
> 
> Unknown Host: http://testserver:8080/decelerate/site.xml
>   Unknown Host: http://testserver:8080/decelerate/site.xml
>   testserver
> 
Sorry, typo - I used http://testserver:8080/proxy/decelerate
(the "proxy" part was missing in my initial post).

> I tried other sites where there is a producer name.  For example, I added
> http://www.taubit.de/eclipse/twitterclipse and named it MyTwitter.  After
> checking for updates, it was still called "MyTwitter".  When I did the same
> thing and did not name the repo, the name would refresh to "twitterclipse" (the
> producer repo name).
> 
> I also double checked the code to ensure that we don't ever overwrite the
> nickname unless it's not been specified.
> 
> There may be some more subtle bug here, but I'll need to know:
> - what sites you started with
> - how/when/where you added the site (prefs, install new software, paste, drag?)
> - where you looked to find out that the nickname had been replaced (prefs,
> install new software)
> 
I think I did the following:
Removed all update sites under prefs.
Added site in "install new software" - then canceled out of the dialog as it took a long time to load.
Then ran "check for updates"
Then looked under prefs.

I wil try to reproduce and make notes about steps. I noticed the problem twice. Could perhaps have occurred when I again removed all repositories (using prefs) to try a second (and third time). I probably added and removed the "decelerate" site and used all involved dialogues back and forth - also using "test connection" to stress it.

Comment 4 Henrik Lindberg CLA 2009-05-11 18:32:31 EDT
Unless it happens every time, I don't think this needs to be fixed for 3.5
Comment 5 Susan McCourt CLA 2009-05-11 19:01:37 EDT
Thanks for the steps, Henrik.  I'll keep trying.

(In reply to comment #4)
> Unless it happens every time, I don't think this needs to be fixed for 3.5
> 
Agree this is not a showstopper, but I plan to investigate a little further.  I think this might be related to some name-related oddities Pascal saw in bug 274334.   
Comment 6 Ian Bull CLA 2009-05-11 19:16:26 EDT
I saw this too.  Sometimes is would happen after I hit "Test Connection".  
Comment 7 Susan McCourt CLA 2009-05-11 19:36:35 EDT
(In reply to comment #6)
> I saw this too.  Sometimes is would happen after I hit "Test Connection".  
> 
Uhhh....doh!
That's the problem.

When the repo is refreshed, it is removed and re-added and the old user nickname is lost.  The reason this isn't blatantly obvious is that in the preference page, if the user made any other changes to any repos, the repos are updated with what is visible in the pref page, so the old nickname gets reset again.

So the trick to reproduce the problem is
1 - add a repo and a name in the prefs
2 - OK
3 - open the prefs again
4 - "Test Connection" on the repo
5 - OK
6 - open the prefs again

name is gone.

If you do anything else between 4 and 5 (including accidentally clicking in the name field of a repo), you won't see the problem because the repo page has changed and it will update the manager with what is in the page.



Comment 8 Susan McCourt CLA 2009-05-12 12:43:06 EDT
Created attachment 135396 [details]
patch

This patch sets the nickname back into a repo that is refreshed.  Whatever name is showing in the UI (nickname or producer name) is set back as the nickname.
Comment 9 Susan McCourt CLA 2009-05-12 12:46:06 EDT
John, can you please review. 
Here is a slight clarification of the steps to reproduce.

1 - Prefs>Available Software Sites.  Add a repo that is not already in the list and specify a nickname.
2 - OK
3 - open the prefs again
4 - Select the newly added repo and push "Test Connection" 
5 - OK
6 - open the prefs again

The nickname is now gone.  If the producer specified a name it is there, otherwise it is blank.

If you do anything else between steps 3 and 5 (including accidentally clicking in the name field of a repo), the problem won't occur.
Comment 10 John Arthorne CLA 2009-05-13 14:41:33 EDT
I think this should be fixed in the repository manager. It seems unreasonable that all clients of the refresh API need to add back the property like this. I will come up with a patch.
Comment 11 John Arthorne CLA 2009-05-13 15:08:10 EDT
Created attachment 135664 [details]
Repository manager fix
Comment 12 Susan McCourt CLA 2009-05-13 15:50:44 EDT
fixed in HEAD >20090513.
I verified that the new test cases fail without the fix, pass with the fix, and that the fix also corrects the scenario in comment #9.

I agree fixing it in the manager is a better solution.