dlr 02/02/15 17:14:06
Modified: src/java/org/apache/xmlrpc XmlRpc.java
Log:
o Added comment describing the list of identifiers for SAX drivers.
o JavaDoc'd dateformat, cdata, keepalive, debug, types, encoding, and
encodings members.
o Reduced object instantiation for Boolean types in Value.characterData().
Revision Changes Path
1.11 +43 -12 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.10
retrieving revision 1.11
diff -u -u -r1.10 -r1.11
--- XmlRpc.java 13 Feb 2002 00:05:41 -0000 1.10
+++ XmlRpc.java 16 Feb 2002 01:14:06 -0000 1.11
@@ -82,9 +82,13 @@
// class name of SAX parser to use
private static Class parserClass;
- private static Hashtable saxDrivers = new Hashtable ();
+ private static Hashtable saxDrivers = new Hashtable (8);
static
{
+ // A mapping of short identifiers to the fully qualified class
+ // names of common SAX parsers. If more mappings are added
+ // here, increase the size of the saxDrivers Map used to store
+ // them.
saxDrivers.put ("xerces", "org.apache.xerces.parsers.SAXParser");
saxDrivers.put ("xp", "com.jclark.xml.sax.Driver");
saxDrivers.put ("ibm1", "com.ibm.xml.parser.SAXDriver");
@@ -99,13 +103,16 @@
Stack values;
Value currentValue;
- // formats for parsing and generating dateTime values
-
- // DateFormat datetime;
- // now comes wapped into a synchronized class because dateFormat is not
threadsafe
+ /**
+ * Thread-safe wrapper for the <code>DateFormat</code> object used
+ * to format and parse date/time values.
+ */
static Formatter dateformat = new Formatter ();
- // used to collect character data of parameter values
+ /**
+ * Used to collect character data (<code>CDATA</code>) of
+ * parameter values.
+ */
StringBuffer cdata;
boolean readCdata;
@@ -127,17 +134,40 @@
static final int RECOVERABLE = 1;
static final int FATAL = 2;
- // use HTTP keepalive?
+ /**
+ * Wheter to use HTTP Keep-Alive headers.
+ */
static boolean keepalive = false;
- // for debugging output
+ /**
+ * Whether to log debugging output.
+ */
public static boolean debug = false;
- final static String types[] = {"String", "Integer", "Boolean", "Double",
- "Date", "Base64", "Struct", "Array"};
- // mapping between java encoding names and "real" names used in XML prolog.
+ /**
+ * The list of valid XML elements used for RPC.
+ */
+ final static String types[] =
+ {
+ "String",
+ "Integer",
+ "Boolean",
+ "Double",
+ "Date",
+ "Base64",
+ "Struct",
+ "Array"
+ };
+ /**
+ * Java's name for the encoding we're using.
+ */
static String encoding = "ISO8859_1";
+
+ /**
+ * Mapping between Java encoding names and "real" names used in
+ * XML prolog.
+ */
static Properties encodings = new Properties ();
static
{
@@ -594,7 +624,8 @@
value = new Integer (cdata.trim ());
break;
case BOOLEAN:
- value = new Boolean ("1".equals (cdata.trim ()));
+ value = ("1".equals (cdata.trim ()) ?
+ Boolean.TRUE : Boolean.FALSE);
break;
case DOUBLE:
value = new Double (cdata.trim ());