1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 12:02:05 +01:00

Do a permission check before getting a Java system property.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1909 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-04-29 05:32:34 +00:00 committed by mtucker
parent 6b05d369de
commit dcf5d1ea72

View file

@ -59,6 +59,8 @@ import javax.swing.*;
import java.net.*;
import java.io.*;
import java.awt.*;
import java.security.*;
import java.util.PropertyPermission;
/**
* Creates a connection to a XMPP server. A simple use of this API might
@ -77,7 +79,7 @@ import java.awt.*;
*/
public class XMPPConnection {
private static final String NEWLINE = System.getProperty("line.separator");
private static final String NEWLINE = "\n";
/**
* Value that indicates whether debugging is enabled. When enabled, a debug
@ -92,7 +94,17 @@ public class XMPPConnection {
* property <tt>smack.debugEnabled</tt> to true. The system property can be set on the
* command line such as "java SomeApp -Dsmack.debugEnabled=true".
*/
public static boolean DEBUG_ENABLED = Boolean.getBoolean("smack.debugEnabled");
public static boolean DEBUG_ENABLED = false;
static {
try {
// See if we're allowed to access the debug flag system property. This will
// not be allowed on applets, so we need to do a special check.
AccessController.checkPermission(new PropertyPermission("smack.debugEnabled", "read"));
// Passed permission check, so must be allowed. Get the value of the flag.
DEBUG_ENABLED = Boolean.getBoolean("smack.debugEnabled");
}
catch (AccessControlException ace) { }
}
private JFrame debugFrame = null;
protected String host;