Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311404 - Remote help priority checks for null InputStream to determine if Doc is on remote infocenter even though InputStream for Topic Not Found page is returned
Summary: Remote help priority checks for null InputStream to determine if Doc is on re...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 RC1   Edit
Assignee: Jim Perry CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-03 14:25 EDT by Jim Perry CLA
Modified: 2010-05-06 14:18 EDT (History)
3 users (show)

See Also:
ChrisAustin: review+


Attachments
Patch for this issue (1.82 KB, patch)
2010-05-03 15:29 EDT, Jim Perry CLA
no flags Details | Diff
Patch for Checking if rtopic path when page is not found (1.34 KB, patch)
2010-05-04 14:59 EDT, Jim Perry CLA
ChrisAustin: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Perry CLA 2010-05-03 14:25:47 EDT
Build Identifier: eclipse-SDK-I20100426-0852-win32

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.

Eclipse needs a way to determine if the input stream returned is a Topic Not Found stream, and if it is, return a null InputStream

Reproducible: Always

Steps to Reproduce:
1. Launch Eclipse 3.6
2. Select Include Remote Help and give it priority
3. Add the infocenter http://publib.boulder.ibm.com/infocenter/rsahelp/v8/index.jsp
4. Browse Eclipse Documentation doc pages
Comment 1 Jim Perry CLA 2010-05-03 15:29:56 EDT
Created attachment 166858 [details]
Patch for this issue

Implemented the method:

public boolean isTopicNotFoundStream(URL url)

Which takes a URL and returns true or false based on whether or not that URL will return a stream to the topic not found page.  To detect the topic not found page, I use this line:

if(streamContent.indexOf("The topic that you have requested is not available. The link may be wrong, or you may not have the corresponding product feature installed. This online help only includes documentation for features that are installed.")!=-1)//$NON-NLS-1$
{
	isTopicNotFoundStream=true;
}

This text is directly from the Topic Not found page.  Is there a better way to detect the Topic not found stream?  I was thinking maybe we could open a stream to the local topic not found page and compare against that, but those may not be exactly the same depending on the Eclipse release of the platform VS the Eclipse release on the Infocenter.

Also, the method I implemented takes a URL instead of the current InputStream since we do not want to read the current InputStream or else we risk reading the data that the Help System needs from that stream.
Comment 2 Chris Austin CLA 2010-05-03 15:43:30 EDT
Jim - the problem with searching for that String is users can customize the page that displays when a topic is not found - see http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/ua_help_setup_preferences.htm

That being said, I still don't have a better solution.
Comment 3 Chris Goldthorpe CLA 2010-05-04 13:11:09 EDT
I don't think that patch will work so well because the not found page could be in a different locale or could be overridden by the user.

I'm thinking a better approach would be for calls to /rtopic to return a 404 status rather than returning an error page and check for that status when reading remote help. I haven't thought through all the details, such as backward compatibility issues but it seems that this would be less fragile than searching for specific words in the body of the text.
Comment 4 Jim Perry CLA 2010-05-04 14:59:34 EDT
Created attachment 167026 [details]
Patch for Checking if rtopic path when page is not found

This Patch implements the method:

public static boolean isRTopicPath(String servletPath)

which will return true if the request is an rtopic request.

If true, then  resp.setStatus(HttpServletResponse.SC_NOT_FOUND); is returned.

If false, the page not found is shown.

Tested and verified that this code will return a null input stream as expected by the remote help code.
Comment 5 Chris Goldthorpe CLA 2010-05-04 15:43:49 EDT
Chris A, can you review this for RC1 and commit the patch if you approve it?
Comment 6 Chris Austin CLA 2010-05-04 15:45:32 EDT
Patch works for me, committed to HEAD.
Comment 7 Chris Goldthorpe CLA 2010-05-04 16:20:18 EDT
I have tagged the projects for the next I-build.
Comment 8 Chris Goldthorpe CLA 2010-05-04 17:40:16 EDT
Jim, do you want to go ahead and create a second bug for the backward compatibility case where the remote infocenter is running on Eclipse 3.5 or earlier?
Comment 9 Dani Megert CLA 2010-05-06 08:24:03 EDT
Why is this bug in the Security_Advisories group?

This bug is missing a review+.
Comment 10 Chris Goldthorpe CLA 2010-05-06 14:18:15 EDT
Dani, you are correct - this is not a security bug. I'm guessing that box got checked by accident.