- Dan
Huffman, Ken wrote:
This is a patch to XmlRpc.java to allow unsigned code to use the class. The System.getProperty()function cannot be called by unsigned code and while there was a try/catch block around a call to that function in the parse() code, there wasn't one around the call in the constructor.
--- xmlrpc-1.2-b1/src/java/org/apache/xmlrpc/XmlRpc.java 2003-02-19
16:37:12.000000000 -0500
+++ xmlrpc-1.2-ai/src/java/org/apache/xmlrpc/XmlRpc.java 2004-03-02
09:55:22.000000000 -0500
@@ -197,7 +197,16 @@
*/
protected XmlRpc()
{
- this(System.getProperty(TypeFactory.class.getName()));
+ String typeFactory = null;
+ try
+ {
+ typeFactory = System.getProperty(TypeFactory.class.getName());
+ }
+ catch (SecurityException e)
+ {
+ // An unsigned applet may not access system properties, use
null
+ }
+ this.typeFactory = createTypeFactoryByName(typeFactory);
}
/**
@@ -208,6 +217,18 @@
*/
protected XmlRpc(String typeFactory)
{
+ this.typeFactory = createTypeFactoryByName(typeFactory);
+ }
+
+ /**
+ * Creates a new instance of the specified [EMAIL PROTECTED]
+ * org.apache.xmlrpc.TypeFactory}.
+ *
+ * @param typeFactory The name of the implementation class to use.
+ * @return The new type mapping.
+ */
+ private TypeFactory createTypeFactoryByName(String typeFactory)
+ {
Class c = null;
if (typeFactory != null && typeFactory.length() > 0)
{
@@ -223,7 +244,7 @@
e.getMessage());
}
}
- this.typeFactory = createTypeFactory(c);
+ return createTypeFactory(c);
}
/**