Kuddi: Re: Bug in XmlRpcParser.java

Stefan Haustein <[email protected]> Fri, 21 May 2004 21:03:03 +0200
Newsgroups gmane.comp.java.enhydra.kxmlrpc
Organization University of Dortmund
Message-ID <[email protected]>
Hi,

I do not know if somebody maintains xml-rpc, my impression is the 
project is dead. Ask objectweb to take it over, or use

http://cvs.sourceforge.net/viewcvs.py/kobjects/kobjects/src/org/kobjects/xmlrpc/XmlRpcParser.java

instead.

Best regards,
Stefan Haustein



Mark Burke wrote:
> Hi,
> 
> I've also found another bug related to arrays. The <data> tag is not being
> used around
> the <value> tags.
> 
> Regards,
> Mark
> 
> XmlRpcWriter: (line 98)
> =======================
> 
> // java.util.Vector maps to an XML-RPC array
>     else if( value instanceof Vector ) {
>         writer.startTag( "array" );
>         writer.startTag( "data" );	// **** ADDED ****
>         Vector v = (Vector) value;
>         for( int i = 0; i < v.size(); i++ )
>         writeValue( v.elementAt(i) );// recursive call
>         writer.endTag();// </data>	// **** ADDED ****
>     }
> 
> XmlRpcReader: (line 227)
> ========================
> 
> Vector parseArray() throws IOException {
>     Vector v = new Vector();
>     parser.skip();
> 
>     // **** ADDED next 2 lines
>     parser.read( Xml.START_TAG, "", "data" );
>     parser.skip();
> 
>     while( parser.peek().getType() != Xml.END_TAG ) {
>         v.addElement( parseValue() ); // parse this element value
>         parser.skip();
>     }//end while( parser.peek().getType() != Xml.END_TAG )
> 
>     // **** ADDED next 2 lines
>     parser.read( Xml.END_TAG, "", "data" );
>     parser.skip();
>     return v;
>     }//end parseArray()
> 
> 
> 
> 
> -----Original Message-----
> From: Alan Slattery [mailto:[email protected]]
> Sent: 20 May 2004 14:38
> To: [email protected]
> Cc: Mark Burke
> Subject: Bug in XmlRpcParser.java
> 
> 
> Hi there,
>    We were working with the latest released version of kXML-RPC (version
> 0.6)
> and found a bug in XmlRpcParser.java.
> 
> In the method parseParams() there is the following:
> 
> 	while( parser.peek().getType() != Xml.END_TAG ) {
> 	    parser.read( Xml.START_TAG, "", "param" );
>              // Retrieve a Java representation of the XML-RPC parameter
> value
> 	    params.addElement( parseValue() );    // *** BUG ***
> 	    parser.skip();
> 
> There should be a call to parser.skip() before the line marked with BUG
> above.
> If any whitespace exists between the opening of the "param" start tag and
> the
> value, a parse exception is thrown, as the implementation of parseValue()
> expects the next read() to be a start tag for "value" but instead it gets
> the
> whitespace.
> 
> If you have been notified of this already then apologies, but a search of
> the
> mailing lists returned nothing relevant and the online view of the source is
> not
> working, so I can't verify if it has already been fixed.
> 
> Thanks,
>    Alan Slattery
>