United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6539601 jdk 6 plug-in fail to load facebook.com using proxy
JDK-6539601 : jdk 6 plug-in fail to load facebook.com using proxy

Details
Type:
Bug
Submit Date:
2007-03-28
Status:
Resolved
Updated Date:
2010-11-03
Project Name:
JDK
Resolved Date:
2007-06-30
Component:
deploy
OS:
windows
Sub-Component:
plugin
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
6u4 (b01)

Related Reports
Backport:

Sub Tasks

Description
go www.facebook.com

create an user account, and try to create a photo album.

try to upload a photo, it will load a java applet for the photo upload.

if you use jdk 6 and a proxy server, the applet will fail to load.

without a proxy server, applet loads fine.

also, when using jdk 6, during applet loading, it will pop up a dialog with exception:

sun.plugin.cache.JarCacheVersionException: Number of attributes specified in 'cache_archive' doesn't match those in 'cache_version'
	at sun.plugin.cache.JarCacheUtil.getJarsWithVersion(Unknown Source)
	at sun.plugin.AppletViewer.initJarVersionMap(Unknown Source)
	at sun.plugin.AppletViewer.createClassLoader(Unknown Source)
	at sun.plugin.AppletViewer.appletInit(Unknown Source)
	at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
	at sun.plugin.viewer.WNetscapePluginObject$Initer.run(Unknown Source)

the exception is indeed valid.  cache_archive only has one jar file; file cache_version contains 2 version string.

in JDK 5, the exception dialog did not pop up because of a bug in the code in JarCacheUtil.java, method getJarsWithVersion:

    if(versionCount != versionCount){
		throw new JarCacheVersionException( ResourceHandler.getMessage("cache.version_attrib_error") );
	    }

obviously the exception will never be thrown.  hence there is no error dialog when loading with JDK 5.

we should report the cache_archive and cache_version issue to the website itself.

                                    

Comments
EVALUATION

for the sun.plugin.cache.JarCacheVersionException, instead of throwing a error dialog, we should just print the error message to the console.

this error message is only helpful to the developer; it has no value to consumer, and does not prevent the applet from being loaded.
                                     
2007-05-15
SUGGESTED FIX

Problem:  two regression from Java 5:

1.  cache_version error dialog pop-up before applet can be loaded
2.  applet cannot be loaded with scaweb1.sfbay.sun.com.proxy

For 1, the error is indeed valid.  But we should just print out the error to the console, since the error only has meaning to the applet developer.  Also, we should map available jar filename to jar version, and just ignore the extra values.

For 2, we always try to download JAR with http compression, but if the http server does not return the correct gzip content, in java 6 it will just fail; however in java 5, we will re-try with no http compression.

Fix:

1.  Output error to console, and use available jar filename / jar version.
2.  Retry JAR download with no http compression if needed.

http://web-east.east/deployment/www/webrevs/ngthomas/6539601/webrev/
                                     
2007-05-19
EVALUATION

proxy problem is specific to scaweb1.sfbay.sun.com proxy.  if you use webcache.sfbay.sun.com proxy, there is no problem.

it's seems like the scaweb1.sfbay.sun.com problem is having some problems with gzip encoding content, it does not return the correct jar file.

i tried with firefox, using scaweb1.sfbay.sun.com as proxy, i cannot download http://upload.facebook.com/controls/FacebookPhotoUploader.jar, the jar is corrupted after download.

however, in Java 5, it still works even with scaweb1.sfbay.sun.com proxy, this is because after the failed download with gzip encoding, we re-try again with no encoding, and jar download works with no encoding.  see below trace from java 5 plugin

network: Connecting http://upload.facebook.com/controls/FacebookPhotoUploader.jar with proxy=HTTP @ scaweb1.sfbay.sun.com/129.145.155.90:8080
network: Connecting http://upload.facebook.com/controls/FacebookPhotoUploader.jar with cookie "__qca=10bfe2c24d75b3f9; login=thomas.v.ng%40sun.com; __qcb=1974923269; test_cookie=1; xs=2bf39767a8eef91aa9e24fcb8b5523f9; c_user=568681010"
basic: Downloading http://upload.facebook.com/controls/FacebookPhotoUploader.jar to cache
basic: encoding = gzip for http://upload.facebook.com/controls/FacebookPhotoUploader.jar
network: Connecting http://upload.facebook.com/controls/FacebookPhotoUploader.jar with proxy=HTTP @ scaweb1.sfbay.sun.com/129.145.155.90:8080
network: Connecting http://upload.facebook.com/controls/FacebookPhotoUploader.jar with cookie "__qca=10bfe2c24d75b3f9; login=thomas.v.ng%40sun.com; __qcb=1974923269; test_cookie=1; xs=2bf39767a8eef91aa9e24fcb8b5523f9; c_user=568681010"
basic: Downloading http://upload.facebook.com/controls/FacebookPhotoUploader.jar to cache
basic: encoding = null for http://upload.facebook.com/controls/FacebookPhotoUploader.jar
basic: Cached file name: FacebookPhotoUploader.jar-2cce3b73-6de645cf.zip

we should re-store such download re-try in java 6.

but in both java 5 and java 6, the upload applet fail to actually upload photos, because it uses socket for upload, and we failed to specify a valid proxy for socket:

network: Connecting socket://upload.facebook.com:80 with proxy=DIRECT
UnknownHostException occured
upload.facebook.com
-----
java.net.UnknownHostException: upload.facebook.com
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.<init>(Unknown Source)
	at java.net.Socket.<init>(Unknown Source)
	at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(Unknown Source)
	at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(Unknown Source)
	at org.apache.commons.httpclient.HttpConnection.open(Unknown Source)
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Unknown Source)
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(Unknown Source)
	at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source)
	at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source)
	at com.aurigma.imageuploader.upload.d.g(Unknown Source)
	at com.aurigma.imageuploader.upload.d.h(Unknown Source)
	at com.aurigma.imageuploader.upload.d.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
                                     
2007-05-15



Hardware and Software, Engineered to Work Together