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

Bug 311791

Summary: For infocenters running on Eclipse 3.5 and earlier, requests to /rtopic return the page not found input stream, instead of returning SC_NOCONTENT, causing remote help priority to display Topic not found pages even if the doc is not on the infocenter.
Product: [Eclipse Project] Platform Reporter: Jim Perry <perryja>
Component: User AssistanceAssignee: Chris Austin <ChrisAustin>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cgold, ChrisAustin
Version: 4.0Flags: cgold: review+
Target Milestone: 3.6 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch to fix remote request failures against pre-3.6 ICs
none
Patch V2
none
Patch V3 ChrisAustin: iplog+

Description Jim Perry CLA 2010-05-05 16:18:59 EDT
Build Identifier: eclipse-SDK-I20100426-0852-win32

This is fixed in Eclipse 3.6 , however for infocenters running on Eclipse releases prior to 3.6, the below defect will still occur.  We need a solution in the IDE to handle the backwards compatibility case.

With the addition of the Remote Help priority preference, which allows for
remote help to have priority if the same doc exists local and remote.  If the
same help document exists both remote and local, the remote topic will be
shown.  If remote priority is selected, the infocenter is first checked for a
given topic.  If the InputStream returned is null, then we check locally.   

The problem is that the topic request being made returns a topic not found page
instead of null if the topic does not exist.  Therefore, although the topic is
not on the IC, an InputStream is returned (not null), and the Topic Not Found
page is shown.

Reproducible: Always

Steps to Reproduce:
Steps to Reproduce:
1. Launch Eclipse 3.6 and connect to a 3.5 or lower Eclipse version infocenter.
2. Select Include Remote Help and give it priority
3. Browse Eclipse Documentation doc pages
Comment 1 Chris Goldthorpe CLA 2010-05-07 16:30:13 EDT
Do you have a proposed solution? We're getting towards the end of the Eclipse 3.6 cycle and if we could get a simple low risk solution by the end of Tuesday of next week the fix could get into RC1. 

As I see it we can detect infocenters which are returning a "page not found" instead of 404, and so if we detect that case and the user selects remote help and read remote help first we can tell when the user is about to get shot in the foot. The question is what to do when we encounter this situation - it seems that we need to inform the user that this will cause problems and change the settings to read local help first. That seems like more than a two or three line change and would need to be done carefully.
Comment 2 Chris Austin CLA 2010-05-10 12:58:22 EDT
Created attachment 167757 [details]
Patch to fix remote request failures against pre-3.6 ICs

This patch first checks to see if a remote request IC has an error page (by using an invalid topic).  If the remote request returns null, then we store the IC in a table, so that we know requests to this IC already return null as expected.  If the remote IC does return an error message page, we store that page, and all future requests to this IC are checked against the error page.  If it is a match, we return null.
Comment 3 Chris Austin CLA 2010-05-10 12:59:55 EDT
Chris G - can you do a review on this?
Comment 4 Chris Goldthorpe CLA 2010-05-10 14:31:32 EDT
There are a couple of things that I think need to change with the patch. The first problem with the patch is that it is using Java 1.5 constructs. 

Description	Resource	Path	Location	Type
The method contains(String) is undefined for the type String	HelpURLConnection.java	/org.eclipse.help.base/src/org/eclipse/help/internal/protocols	line 422	Java Problem
Description	Resource	Path	Location	Type
The method contains(String) is undefined for the type String	HelpURLConnection.java	/org.eclipse.help.base/src/org/eclipse/help/internal/protocols	line 423	Java Problem

Secondly it should match the extensions from EclipseConnector.requiresErrorPage(), which are "htm", "pdf", "xhtml", "shtml" and "html".

I notice that you are testing for a parameter in the URL which is a good idea, EclipseConnector is not doing that so I'm guessing that EclipseConnector would return a 404 instead of showing an error pages if there was a parameter but that is a minor change we may want to make to EclipseConnector. I don't think that the server sees anchors so there is no need to test for those.
Comment 5 Chris Austin CLA 2010-05-10 15:18:25 EDT
Created attachment 167788 [details]
Patch V2

I removed the check for extensions, which basically takes care of both the issues you mentioned.  It does not impact the outcome of the code.  Also, I added some missing stream close() calls.
Comment 6 Chris Austin CLA 2010-05-10 15:41:03 EDT
Created attachment 167796 [details]
Patch V3

Missed an additional close() case.
Comment 7 Chris Austin CLA 2010-05-10 16:56:47 EDT
Patch committed to HEAD.