This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 271487 - If repository server and label is the same, the task list shows "[ <unknown host> ]" instead of the repository label in query name
Summary: If repository server and label is the same, the task list shows "[ <unknown h...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows Vista
: P3 minor (vote)
Target Milestone: 3.2   Edit
Assignee: Steffen Pingel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-07 12:32 EDT by Calman Steynberg CLA
Modified: 2009-05-14 20:44 EDT (History)
1 user (show)

See Also:


Attachments
Screenshot of bug (30.45 KB, image/png)
2009-04-07 12:32 EDT, Calman Steynberg CLA
no flags Details
Patch: Use repository label instead of "[<unknown host>]" when label and url are the same and MalformedURLException is caught (1.28 KB, patch)
2009-04-07 13:42 EDT, Calman Steynberg CLA
no flags Details | Diff
mylyn/context/zip (6.31 KB, application/octet-stream)
2009-04-07 13:42 EDT, Calman Steynberg CLA
no flags Details
mylyn/context/zip (3.52 KB, application/octet-stream)
2009-05-14 20:44 EDT, Steffen Pingel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Calman Steynberg CLA 2009-04-07 12:32:58 EDT
Created attachment 131145 [details]
Screenshot of bug

Build ID: M20080911-1700

Steps To Reproduce:
1.Obtain the org.eclipse.mylyn.xml3 samples (both core and ui) from CVS: org.eclipse.mylyn/sandbox/connector-tutorial/org.eclipse.mylyn.xml3.core and org.eclipse.mylyn/sandbox/connector-tutorial/org.eclipse.mylyn.xml3.ui
2. Run Eclipse with both, then add a new File-Based XML task repository. Give the server and the label the same value. 
3. Add a new Query to the repository.
4. In the task list, the new query will show up as "queryname [ <unknown host> ]"
5. If the server and label is not the same, then it will correctly display the repository label 


More information: This will happen with any repository, and is not specific to the XML sample.

I've attached a screen shot showing the problem. In the screenshot, I used "sameserverandlabel" as both the server name and label. You will also see a query calld differentserverandlabel that works correctly.
Comment 1 Calman Steynberg CLA 2009-04-07 13:42:38 EDT
Created attachment 131152 [details]
Patch: Use repository label instead of "[<unknown host>]" when label and url are the same and MalformedURLException is caught
Comment 2 Calman Steynberg CLA 2009-04-07 13:42:40 EDT
Created attachment 131153 [details]
mylyn/context/zip
Comment 3 Calman Steynberg CLA 2009-04-07 13:43:28 EDT
On further investigation it turns out that this is being caused by TaskLabelDecorator.decorate(). It compares the repository url and label, and if the two are the same it then tries to create a URL instance using the repository url, which then throws a MalformedURLException. This exception is then caught and "[ <unknown host> ]" is then added as the suffix. For web based repositories, this probably works ok, but in my case I'm using a thirdparty API to retrieve all the task data, so no url's are involved. 

What's not clear from the code is why it doesn't just work the same in all cases. 
1. Why does it try to create a URL if the repository label and url is the same?
2. Why does it not try to create a URL or check the validity of the URL if the comparison fails? 

I've attached a patch file that makes the behaviour the same if the MalformedURLException is thrown.

Comment 4 Steffen Pingel CLA 2009-04-08 19:33:11 EDT
Mik, do you remember the reason for this behavior?
Comment 5 Steffen Pingel CLA 2009-05-14 20:44:11 EDT
Appears that this was old code that is not needed anymore. I have removed the special case handling.
Comment 6 Steffen Pingel CLA 2009-05-14 20:44:13 EDT
Created attachment 135889 [details]
mylyn/context/zip