You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by Daniel Rall <dl...@collab.net> on 2004/05/01 03:21:32 UTC
Re: Patch for unsigned applet clients
Ken, this looks like a reasonable change which I am willing to commit. However,
your change description doesn't match the entirety of the actual diff. Please
submit a more thorough description, and I'll check this into the 2.x branch.
- 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 {@link
> + * 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);
> }
>
> /**