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

Bug 253770

Summary: [web connector] "RSS Error" trying to connect to in house ticket system using Web Templates
Product: z_Archived Reporter: Jesse Rosalia <theJenix>
Component: MylynAssignee: Project Inbox <mylyn-triaged>
Status: CLOSED MOVED QA Contact:
Severity: normal    
Priority: P3 CC: steffen.pingel
Version: 3.0Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
A sanitized capture of the query results (originally pulled using the "Open" from inside the advanced config in the new query dialog.
none
A screen cap of the error message none

Description Jesse Rosalia CLA 2008-11-04 14:36:23 EST
Created attachment 116994 [details]
A sanitized capture of the query results (originally pulled using the "Open" from inside the advanced config in the new query dialog.

Build ID: M20080911-1700

Steps To Reproduce:
1. Create a task repository to system.  Use the following query pattern:
<a class="ticketLinks" href=".*">({Id}.+?)</a></td>
<td class="searchResults">
({Owner}.+?)</td>
<td class="searchResults">
({Status}.+?)</td>
<td class="searchResults">
.*</td>
<td class="searchResults">
({Type}.+?)</td>
<td class="searchResults">
({Description}.+?)</td>

2. Create a query that ensures the results back in that format.
2a. Preview (inside the new/modify query screen) returns correct results.

3. Save the query.  Eclipse will attempt to query the task repository and will respond with the following error:
"Failed to parse RSS feed: "Invalid XML: Error on line 30: The entity name must immediately follow the ", in the entity reference."


More information:

Ive attached a sanitized (removed company proprietary info) capture of the output, pulled by using the "Open" button next to the Query URL box on the new query dialog.  I think the problem may have to do with javascript in the web query results...line 30 of that file:

if(window.opener != null && strSavedQuery == "null"){

Ive also seen a similar error on the same line complaining about the &.
Comment 1 Jesse Rosalia CLA 2008-11-04 14:36:51 EST
Created attachment 116995 [details]
A screen cap of the error message
Comment 2 Jesse Rosalia CLA 2008-11-04 14:38:42 EST
Incidentally, I would love to help take a look at this further but I couldn't figure out where to get the source from.  The CVS link I did find (:pserver:anonymous@dev.eclipse.org:/cvsroot/tools/org.eclipse.mylyn) kept asking for a password and the web view didn't seem to have any relevant files in the org.eclipse.mylyn.web.* packages.
Comment 3 Steffen Pingel CLA 2008-11-04 15:50:52 EST
The web connector is in the org.eclipse.mylyn.web.tasks plug-in. Make sure you use :pserver:anonymous@dev.eclipse.org:/cvsroot/tools as your cvs root. Check out instructions are here:

 http://wiki.eclipse.org/Mylyn_Contributor_Reference#Checkout
Comment 4 Jesse Rosalia CLA 2008-11-04 16:15:46 EST
(In reply to comment #3)
> The web connector is in the org.eclipse.mylyn.web.tasks plug-in. Make sure you
> use :pserver:anonymous@dev.eclipse.org:/cvsroot/tools as your cvs root. Check
> out instructions are here:
> 
>  http://wiki.eclipse.org/Mylyn_Contributor_Reference#Checkout
> 

Steffen,

Thanks for the reply...I thought I tried CVSROOT that but apparently I didnt as its now working.  I did see that page earlier, and I couldn't get the .psf file import to work (same problem I was having earlier with the command line...kept asking me for a password).

Anyway, I have the source now...Ill refer to that link for how to test, etc...if anyone has any idea based on the description what the problem could be or where I should start looking, please let me know.

-Jesse
Comment 5 Jesse Rosalia CLA 2008-11-04 22:55:15 EST
An update...I found the cause of the problem I described and a workaround but I think its worth some time to examine the code that was tripping me up.  In a nutshell, the problem was in WebRepositoryConnector#performQuery, where the following code exists:

String taskPrefixAttribute = query.getAttribute(KEY_TASK_PREFIX);
if (!Util.isPresent(taskPrefixAttribute)) {
	return performRssQuery(content, monitor, resultCollector, repository);
} else {
	String taskPrefix = evaluateParams(taskPrefixAttribute, queryParameters, repository);
	String queryPattern = evaluateParams(query.getAttribute(KEY_QUERY_PATTERN), queryParameters, repository);
	return performQuery(content, queryPattern, taskPrefix, monitor, resultCollector, repository);
}

I had not set a task url for my task repository, so this code was treating it like an RSS feed.  While I was able to overcome this problem by providing a task url, it seems arbitrary to switch between a RSS and patterned query based on this attribute.  I noticed the following code in WebQueryWizardPage UpdatePreviewJob#run:

if (queryPattern != null && queryPattern.trim().length() > 0) {
	status = WebRepositoryConnector.performQuery(webPage, queryPattern, taskPrefix, monitor, collector, getTaskRepository());
} else {
	status = WebRepositoryConnector.performRssQuery(webPage, monitor, collector,getTaskRepository());
}

This makes a bit more sense to me, checking to see if a query pattern has been provided as a means of determining how to query the data source.

I'd like a bit of advice on how to proceed here...is it appropriate to turn this bug into an enhancement request for the purposes of evaluating this logic?  Should I make (and test) the chance and submit it as a patch for review?
Comment 6 Steffen Pingel CLA 2008-11-04 23:13:08 EST
Eugene, you wrote the original code. Can you recommend how to proceed here?
Comment 7 Eugene Kuleshov CLA 2008-11-04 23:35:35 EST
(In reply to comment #6)
Looking at CVS history it seem like regression introduced by your changes - 
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.mylyn/org.eclipse.mylyn.web.tasks/src/org/eclipse/mylyn/internal/web/tasks/WebRepositoryConnector.java?root=Tools_Project&view=diff&r1=1.51&r2=1.52

An empty "pattern" value been used as an indicator to use rss to parse results and I believe this is explained on the wiki. Also, when rss mode is enabled, web tasks need to be created differently (id, url and descriptions).
Comment 8 Jesse Rosalia CLA 2008-11-05 14:31:52 EST
An outsiders opinion here...I think having the query aware of what type of query it is makes sense (the isRss flag).  Or perhaps taken a step further, maybe the query object should have specific performQuery method, which would be implemented one way for a RssQuery type and another way for a PatternableQuery type (move the logic from the 2 static methods in WebRepositoryConnector).  That way the check to determine what type of query it is only needs to be performed in one spot...at the time of query definition/creation...the code that operates on that query later then doesnt need to worry about it.

For curiosity's sake, I tried using if (queryPattern != null ...) conditional in WebRepositoryConnector#performQuery, and then blanked out my task url.  It appears to work except for some reason the task item strings no longer contain the task id.  Any ideas where that name/string gets built?
Comment 9 Eclipse Webmaster CLA 2022-11-15 11:45:08 EST
Mylyn has been restructured, and our issue tracking has moved to GitHub [1].

We are closing ~14K Bugzilla issues to give the new team a fresh start. If you feel that this issue is still relevant, please create a new one on GitHub.

[1] https://github.com/orgs/eclipse-mylyn