dlr         02/02/19 18:30:38

  Modified:    src/java/org/apache/xmlrpc XmlRpc.java
  Log:
  Worked around problem pointed out by Stuart Roll <[EMAIL PROTECTED]>,
  where un-signed applets cannot access System properties:
  
  o Added DEFAULT_PARSER (currently the fast MinML).
  
  o JavaDoc'd parserClass member.
  
  o Added braces around cdata handling to increase readability.
  
  o Defaulting to DEFAULT_PARSER when a SecurityException is thrown in
  parse() (the work around suggested by Stuart).
  
  Revision  Changes    Path
  1.19      +23 -5     xml-rpc/src/java/org/apache/xmlrpc/XmlRpc.java
  
  Index: XmlRpc.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpc.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -u -r1.18 -r1.19
  --- XmlRpc.java       19 Feb 2002 02:25:01 -0000      1.18
  +++ XmlRpc.java       20 Feb 2002 02:30:38 -0000      1.19
  @@ -83,13 +83,20 @@
       public static final String version = "Apache XML-RPC 1.0";
   
       /**
  +     * The default parser to use (MinML).
  +     */
  +    private static final String DEFAULT_PARSER = "uk.co.wilson.xml.MinML";
  +
  +    /**
        * The maximum number of threads which can be used concurrently.
        */
       private static int maxThreads = 100;
   
       String methodName;
   
  -    // class name of SAX parser to use
  +    /**
  +     * The class name of SAX parser to use.
  +     */
       private static Class parserClass;
       private static Hashtable saxDrivers = new Hashtable (8);
       static
  @@ -292,9 +299,13 @@
           errorMsg = null;
           values = new Stack ();
           if (cdata == null)
  +        {
               cdata = new StringBuffer (128);
  +        }
           else
  +        {
               cdata.setLength (0);
  +        }
           readCdata = false;
           currentValue = null;
   
  @@ -302,10 +313,17 @@
           if (parserClass == null)
           {
               // try to get the name of the SAX driver from the System properties
  -            // setDriver (System.getProperty (
  -            //     "sax.driver", "org.apache.xerces.parsers.SAXParser"));
  -            setDriver (System.getProperty (
  -                "sax.driver", "uk.co.wilson.xml.MinML"));
  +            String driver;
  +            try
  +            {
  +                driver = System.getProperty("sax.driver", DEFAULT_PARSER);
  +            }
  +            catch (SecurityException e)
  +            {
  +                // An unsigned applet may not access system properties.
  +                driver = DEFAULT_PARSER;
  +            }
  +            setDriver(driver);
           }
   
           Parser parser = null;
  
  
  


Reply via email to