Hi,
I use the xmlrpcclient from applet context, and it bombs with a security
exception. I'm using xmlrpc-1.2-b1 on java 1.4.2_04. The following
is my code, the exception that gets raised and finally my cure to the
problem that was posted on xmlrpc-users.
I hope a patch like this gets incorporated into the xmlrpc core because
this is a great tool and many would want it working seamlessly with
applets also.
Thanks for the great work!
- Raja
===== my code
import org.apache.xmlrpc.secure.SecureXmlRpcClient;
...
try {
fetchMethod = new SecureXmlRpcClient(fetch);
fetchMethod.setBasicAuthentication(user, passwd);
} catch (MalformedURLException e) {
System.err.println("ERROR: Bad URL " + e);
}
...
// This bombs when called from applet context!
result = (Hashtable) fetchMethod.execute("fetchJob", new Vector());
=====
===== Exception raised
java.security.AccessControlException: access denied (java.util.PropertyPermission
org.apache.xmlrpc.TypeFactory read)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:26
+9)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1276)
at java.lang.System.getProperty(System.java:573)
at org.apache.xmlrpc.XmlRpc.<init>(XmlRpc.java:201)
at org.apache.xmlrpc.XmlRpcClient$Worker.<init>(XmlRpcClient.java:325)
at org.apache.xmlrpc.XmlRpcClient.getWorker(XmlRpcClient.java:234)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:160)
...
=====
===== the cure
--- XmlRpc.java.orig 2004-09-02 20:18:10.000000000 +0530
+++ XmlRpc.java 2004-09-02 20:18:29.000000000 +0530
@@ -197,7 +197,14 @@
*/
protected XmlRpc()
{
- this(System.getProperty(TypeFactory.class.getName()));
+ String s;
+ try {
+ s = System.getProperty(TypeFactory.class.getName());
+ } catch (SecurityException e) {
+ s = null;
+ }
+
+ this(s);
}
/**