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?