MozillaZine

IE and Opera work with my applet, Firefox bugs it up.

Discussion of bugs in Mozilla Firefox
Virum
 
Posts: 10
Joined: December 10th, 2003, 12:37 am

Post Posted September 22nd, 2005, 10:52 pm

Ok I programmed this applet for a client, and basically, they want the applet to modify a database if the user exits the browser or tab while it's running. Easy, right? Just put the code you want in the stop(){} method.

This works perfectly in IE and Opera (haven't tried Netscape yet), which makes me convinced my code is fine, and there is a problem with Firefox. I even "upgraded" to the beta version to make sure it hadn't been fixed yet. Also, the code works fine in Firefox if it's not in the stop(){} or destroy(){} methods of the applet.

In the console; I'm getting:

Cookie service is not available - use cache to determine "Cookie"

I'm pretty sure the above happens when I send a POST request to a PHP page on the server.

The below happens when I read what the server gives me from my the POST request:

Code: Select all
java.security.AccessControlException: access denied (java.util.PropertyPermission http.strictPostRedirect read)
   at java.security.AccessControlContext.checkPermission(Unknown Source)
   at java.security.AccessController.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
   at java.lang.System.getProperty(Unknown Source)
   at java.lang.Boolean.getBoolean(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection.followRedirect(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
   at com.dizzypets.util.DPUserStats.updateDB(DPUserStats.java:41)
   at com.dizzypets.chikkachikka.ChikkaChikka.stop(ChikkaChikka.java:133)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-22" java.lang.NullPointerException
   at java.awt.Component$BltBufferStrategy.show(Unknown Source)
   at com.dizzypets.chikkachikka.ChikkaChikka.render(ChikkaChikka.java:166)
   at engine.GameEngine.start(GameEngine.java:70)
   at com.dizzypets.chikkachikka.ChikkaChikka.run(ChikkaChikka.java:100)
   at java.lang.Thread.run(Unknown Source)


And in case you care, the code for the database work.

Code: Select all
   private static URLConnection urlConn;
   private static String userName;

   public static void init()
   {   
      try
      {
         URL url = new URL("http://www.dizzypets.com/javauserinfointerface.php");
         urlConn = url.openConnection();
         urlConn.setDoInput(true); //no input
         urlConn.setDoOutput(true);
         urlConn.setUseCaches(false);
         urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
      }
      catch(IOException ioe)
      {
         ioe.printStackTrace();
      }
   }

   public static void updateDB(int coins, String game) //update database
   {
      try
      {
         String content = "coins=" + URLEncoder.encode(Integer.toString(coins), "UTF-8")
                     + "&game=" + URLEncoder.encode(game, "UTF-8");
         System.out.println(content);

                // the cookie service thing happens somewhere from here and line 41*************************************

         DataOutputStream printout = new DataOutputStream(urlConn.getOutputStream());
         printout.writeBytes (content);
          printout.flush();
          printout.close();
          
          // Get response data.
          BufferedReader input = new BufferedReader(new InputStreamReader(urlConn.getInputStream())); //line 41 of DPUserStats.java
          String str;
          while (null != ((str = input.readLine())))
          {
             System.out.println(str);
          }
         
          input.close();
         
      }       
       catch(IOException ioe)
      {
         ioe.printStackTrace();
      }
   }


Like I said, this code works fine as long as these methods aren't called inside the stop() or destroy() methods, and Firefox is the only browser that messes this up.

I'm not sure how to file this as a bug, or if this is a "feature." Please advise?

jqp

User avatar
 
Posts: 5070
Joined: November 17th, 2004, 10:56 am
Location: In a box

Post Posted September 23rd, 2005, 6:44 am

If your Firefox upgraded to the latest version of the java plugin (1.5.0+)? Previous version of Java did bad things to Firefox on almost every applet.

Do you have a link to the page to see if it crashes for anyone else here?

Virum
 
Posts: 10
Joined: December 10th, 2003, 12:37 am

Post Posted September 23rd, 2005, 11:48 am

Yeah, I have the latest version of Java (1.5.0_04)

Unfortunately, no; I can't link to the page. I changed the the code since the client found that unnacceptable; so I've already recoded it to a more complicated solution that doesn't use the stop methods. :\

I tried it on both of the computers I have at home, though. They both did the same thing.

Return to Firefox Bugs


Who is online

Users browsing this forum: No registered users and 1 guest