Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311779 - [Help] Criteria Scopes are not restored properly
Summary: [Help] Criteria Scopes are not restored properly
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 RC1   Edit
Assignee: Chris Goldthorpe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-05 14:56 EDT by Chris Austin CLA
Modified: 2010-05-07 14:43 EDT (History)
1 user (show)

See Also:
ChrisAustin: review+


Attachments
Patch to fix scope cookie encoding (1.05 KB, patch)
2010-05-05 15:35 EDT, Chris Austin CLA
no flags Details | Diff
Patch which adds fix to UrlCoder and includes tests (8.77 KB, patch)
2010-05-06 17:36 EDT, Chris Goldthorpe CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Austin CLA 2010-05-05 14:56:14 EDT
Using the scope UI in the Help System, with criteria enabled, sometimes scopes are not restored properly.  A user can select scopes in the dialog and press ok.  These scopes are saved to a cookie so they can be retrieved later.  However, it seems that upon restore, the scope strings are truncated (usually at the first comma ',').  The truncated string does not restore properly, and any selected criteria is unchecked in the UI.  This happens in both Firefox and IE.

The only time the criteria scopes are restored properly is when a 'z' character appears in the value string, for example 'AzOS' or 'Uncategorized'.  If a z string value is selected, all other selected values work properly.

Looking at the cookie, the z string ends up being encoded as '%7a', so it obviously has something to do with this issue, just not sure how it all fits together yet...
Comment 1 Chris Austin CLA 2010-05-05 15:35:16 EDT
Created attachment 167211 [details]
Patch to fix scope cookie encoding

I have attached a patch which seems to resolve this issue, though I still don't quite understand the mechanics.  By also running URLCoder.compactEncode() on the commas used for criteria separation, I can ensure that part of the string to be saved to the cookie has some encoding (rather then just the sporadic 'z' here and there, commas always get encoded in compactEncode).  As long as one part of the string is encoded, the restore works as expected.
Comment 2 Chris Goldthorpe CLA 2010-05-05 19:04:09 EDT
I have seen this bug but I do not see it consistently. I have seen it show up in IE8 but I have only reproduced it a few times and I don't know why it only ocassionaly shows up.
Comment 3 Chris Goldthorpe CLA 2010-05-06 17:36:12 EDT
Created attachment 167406 [details]
Patch which adds fix to UrlCoder and includes tests

I have been able to reproduce the problem consistently and have reached the same conclusions. We discussed the bug and this is what we agreed.

The problem is rooted in the saving of prohibited characters in a cookie, in particular the ',' character. See http://www.w3.org/Protocols/rfc2068/rfc2068 for a list of these characters (search for tspecials ). This can cause the cookie value to be read incorrectly at the server side, whether the cookie is read correctly or not seems to depend on whether it contains any encoded characters.

The solution is to encode these special characters where possible. UrlCoder.compactEncode() was not encoding '/' so I have fixed that also. a '<' character also gets written to the cookie, this has been the case for some time but it is considered safer to not change that part of the logic. This patch also includes Chris A's original patch and some new tests which test for illegal characters being written to the cookie.
Comment 4 Chris Goldthorpe CLA 2010-05-06 17:39:40 EDT
Chris A please review the patches to UrlCoder and InfocenterWorkingSetManager - you don't need to review the new tests (unless you want to).
Comment 5 Chris Austin CLA 2010-05-07 09:23:22 EDT
Unfortunately, it looks like there is still a bug, even with my original patch or the new one.  The crieria seems to save / restore properly for the UI dialog.  However, if you try to select only criteria with z in the names, the actual filtering on the TOC does not take place.  For example, I select 'Uncategorized' and the book does not show up, even though there are uncategorized topics in it.  But if I select Linux and Uncategorized, both the Linux and uncategorized topics display properly.
Comment 6 Chris Austin CLA 2010-05-07 14:36:44 EDT
OK - ignore my last comments.  Chris G realized that some of my topics had criteria that was not applied to the parent topic.  I have opened Bug 312107 to address inheritance as a separate issue.

In the meantime, this patch works well - we should commit it and close out the bug.
Comment 7 Chris Goldthorpe CLA 2010-05-07 14:43:25 EDT
Patch committed to HEAD, Fixed