Closed Bug 80685 Opened 24 years ago Closed 24 years ago

Java applets won't start when using htaccess basic authentication

Categories

(Core Graveyard :: Java APIs to WebShell, defect)

x86
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: sami.makinen, Assigned: stanley.ho)

References

()

Details

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9+) Gecko/20010513 BuildID: 2001051308 The working applet is demonstrated at http://www.dreamone.com/ and it works just fine. After moving the same applet (and the pictures it loads, under /testes/resource/) to http://www.dreamone.com/testes/, which is .htaccess-protected, the applet no longer starts. The username is "testing", and the password "test". The status line says "Applet dreams notinited". When you go to the page the browser first asks for the username and password, and then the Java applet also asks for that information. It will ask again if you mistype it, so the authentication itself must be working, but once you type in the correct username and password the applet doesn't proceed to load. It would also be better if the browser would pass the username and password to the applet directly, without the user having to type them in twice. Reproducible: Always Steps to Reproduce: 1. Go to http://www.dreamone.com/ 2. Notice applet with peom quote works 3. Go to http://www.dreamone.com/testes/ 4. Input username "testing" password "test" to browser 5. input username "testing" password "test" to Java applet 6. Notice applet does not work. Actual Results: Applet doesn't work. Expected Results: Applet should work. I think this might be related to the applet loading the images, which are under the .htaccess-protected directory. It needs the access information to be able to load the protected images, but somehow fails to use the username and password even though it asks for them. The protected applet works in both IE 5.0 and Netscape 4.7X, so I believe this is a Mozilla-related bug rather than applet-related. Same bug also when using Mozilla 0.9, both in Windows NT and Windows 2000.
I get this error. Accepting. Opening http://www.dreamone.com/testes/dreams.class Connecting http://www.dreamone.com/testes/dreams.class with proxy=webcache- cup.eng.sun.com:8080 Firewall authentication: site=null:-1, protocol=http, prompt=The Secret Page, scheme=basic java.lang.NullPointerException at sun.plugin.PluginAuthenticator.getPasswordAuthentication(Unknown Source) at java.net.Authenticator.requestPasswordAuthentication(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.privilegedRequestPasswordAuthenticat ion(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getServerAuthentication (Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream (Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source) at sun.plugin.protocol.jdk12.http.HttpURLConnection.checkCookieHeader (Unknown Source) at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream (Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at sun.applet.AppletClassLoader.getBytes(Unknown Source) at sun.applet.AppletClassLoader.access$100(Unknown Source) at sun.applet.AppletClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.applet.AppletClassLoader.findClass(Unknown Source) at sun.plugin.security.PluginClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
I get this behavior using both JDK1.3.1 rc1 and JDK1.3.0_01
Here's a plugin stack trace with line numbers for the plugin classes. Opening http://www.dreamone.com/testes/dreams/class.class Connecting http://www.dreamone.com/testes/dreams/class.class with proxy=webcache-cup.eng.sun.com:8080 Firewall authentication: site=null:-1, protocol=http, prompt=The Secret Page, scheme=basic java.lang.NullPointerException at sun.plugin.PluginAuthenticator.getPasswordAuthentication (PluginAuthenticator.java:87) at java.net.Authenticator.requestPasswordAuthentication(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.privilegedRequestPasswordAuthenticat ion(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getServerAuthentication (Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream (HttpURLConnection.java:326) at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source) at sun.plugin.protocol.jdk12.http.HttpURLConnection.checkCookieHeader (HttpURLConnection.java:267) at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream (HttpURLConnection.java:324) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at sun.applet.AppletClassLoader.getBytes(Unknown Source) at sun.applet.AppletClassLoader.access$100(Unknown Source) at sun.applet.AppletClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.applet.AppletClassLoader.findClass(Unknown Source) at sun.plugin.security.PluginClassLoader.findClass (PluginClassLoader.java:240) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1178) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) load: class dreams.class not found. java.lang.ClassNotFoundException: java.io.FileNotFoundException: http://www.dreamone.com/testes/dreams/class.class at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream (HttpURLConnection.java:326) at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source) at sun.plugin.protocol.jdk12.http.HttpURLConnection.checkCookieHeader (HttpURLConnection.java:267) at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream (HttpURLConnection.java:324) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at sun.applet.AppletClassLoader.getBytes(Unknown Source) at sun.applet.AppletClassLoader.access$100(Unknown Source) at sun.applet.AppletClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.applet.AppletClassLoader.findClass(Unknown Source) at sun.plugin.security.PluginClassLoader.findClass (PluginClassLoader.java:240) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1178) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Thanks to the thoughtful debugging messages the null pointer exception is because the getRequestingSite returns null. Debugging this further in the java plugin.
I would wager that the reason the reporter is not seeing the NullPointerException in the sun.plugin.PluginAuthenticator is due to the fact that they are probably not behind a firewall. Reporter, are you behind a firewall?
Reporter, I have fixed the bug. The fix is in the java plugin code. I have filed sun internal bugtraq bug 4458457 and posted a fix for the bug in that system. We'll have to wait and see when the fix can be integrated into the java plugin and shipped out to you, the customer. Thanks for finding and reporting this bug. It's people like you who make open source software valuable, and better than proprietary software.
Reassigning to Stanley. Stanley, the fix is posted in bugtraq bug 4458457.
Assignee: edburns → stanley.ho
Status: ASSIGNED → NEW
This has been fixed as suggested. The fix will be available in J2SE v1.4 Beta Refresh.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
I am behind the Helsinki University firewall when accessing the applet. I gather the bug has been already fixed though. Thanks for your kind words and for fixing the bug!
*** Bug 80692 has been marked as a duplicate of this bug. ***
*** Bug 84177 has been marked as a duplicate of this bug. ***
for the record. This was bugtraq bug 4458457
It works. Verified on WinNT4 SP4.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.