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

Bug 329280

Summary: [Help] Remote Help HTTPS support is setting java.protocol.handler.pkgs=javax.net.ssl
Product: [Eclipse Project] Platform Reporter: Chris Goldthorpe <cgold>
Component: User AssistanceAssignee: Jim Perry <perryja>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: cgold, ChrisAustin, rwatts, tjwatson
Version: 3.6.1Flags: cgold: review+
ChrisAustin: review+
Target Milestone: 3.7 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 330515    
Attachments:
Description Flags
Patch with the System.setProperty() line removed cgold: iplog+

Description Chris Goldthorpe CLA 2010-11-02 13:35:17 EDT
+++ This bug was initially created as a clone of Bug #227252 +++

The fix for Bug #227252 introduced a serious regression - org.eclipse.help.internal.base.remote.HttpsUtility.getHttpsInputStream(String, String, String, String, String) contains the line 

System.setProperty( "java.protocol.handler.pkgs" , "javax.net.ssl" ); //$NON-NLS-1$ //$NON-NLS-2$
	         
This has the side effect of changing the protocol handler throughout the entire application, not just Eclipse, which can cause this kind of an exception ( this was on Solaris ) when running any code that causes the java protocol handler to be invoked.

java.lang.RuntimeException: java.net.MalformedURLException: unknown protocol: https
Comment 1 Chris Goldthorpe CLA 2010-11-02 18:35:49 EDT
Comments copied from Bug #227252 

Thomas Watson 2010-11-02 10:00:50 EDT

Can someone explain why you need to set the system property:

System.setProperty( "java.protocol.handler.pkgs" , "javax.net.ssl" );

At a minimum I think you need to check for an existing
"java.protocol.handler.pkgs" property and append "|javax.net.ssl" if it already
exists.

Thomas Watson 2010-11-02 10:29:27 EDT

Setting java.protocol.handler.pkgs=javax.net.ssl implies that we expect the
class javax.net.ssl.https.Handler to exist for handling https protocols.  What
version of java does this exist?

Jim Perry 2010-11-02 16:41:40 EDT

Removing the line:

System.setProperty( "java.protocol.handler.pkgs" , "javax.net.ssl" );

Causes remote help to still work (on Windows).  So at minimum, the line may not
be required.  I will investigate Linux and Solaris to verify that the handler
package is supported there as well.
Comment 2 Chris Goldthorpe CLA 2010-11-02 19:05:56 EDT
The Javadoc for URL contains some information about when java.protocol.handler.pkgs is used.

http://download.oracle.com/javase/1.5.0/docs/api/java/net/URL.html#URL%28java.lang.String,%20java.lang.String,%20int,%20java.lang.String%29

Looking at the sequence for resolving protocols it appears that even if you specify a nonexistent package name for java.protocol.handler.pkgs some JREs may still be able to resolve the https protocol. On the other hand it's possible that on some JREs changing the value of java.protocol.handler.pkgs could cause https and other protocols to fail. That is what appears to be happening on Solaris.

We need to test this on all of the major Platform/JRE combinations

Win32 ( Both Oracle JRE and IBM JRE )
Linux ( Both Oracle JRE and IBM JRE )
Solaris
Mac OS

Not setting java.protocol.handler.pkgs is going to be much safer since it will not impact any other code which uses the URL class. We next need to test the remote help code to see if all of those JREs will handle https out of the box. If not using a URLStreamHandler in the constructor of URL would be preferable to setting a system property.
Comment 3 Jim Perry CLA 2010-11-17 14:01:50 EST
Created attachment 183329 [details]
Patch with the System.setProperty() line removed

HTTPS remote help still works without the System.setProperty() line.  The property already has the HTTPS support we need.

The Patch has all occurrences of this line removed from HttpsUtility.
Comment 4 Chris Goldthorpe CLA 2010-11-17 14:58:59 EST
Patch committed to HEAD, Fixed
Comment 5 Jim Perry CLA 2010-11-17 16:04:50 EST
Just FYI, Remote help works on Solaris with the System.setProperty() line in the code.