Issue 31 in android-xmlrpc: Problem with fault reporting code in XMLRPCClient

6 views
Skip to first unread message

android...@googlecode.com

unread,
Sep 5, 2011, 12:24:06 PM9/5/11
to android-x...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 31 by MrC...@gmail.com: Problem with fault reporting code in
XMLRPCClient
http://code.google.com/p/android-xmlrpc/issues/detail?id=31

What steps will reproduce the problem?
1. Set up a new app using the libs
2. Try to connect to a working server (some kind of error occurs)
3. class cast (String) exceptions occur

What is the expected output? What do you see instead?
I would expect an exception to be raised but instead it crashes.


What version of the product are you using? On what operating system?
Ubuntu / android 2.2

Please provide any additional information below.

The code in XMLRPCClient includes this section:
else if (tag.equals(Tag.FAULT))
{
Log.d(TAG,CLASS+"Fault found :"+tag+" "+Tag.FAULT);
// fault response
pullParser.nextTag(); // Tag.VALUE (<value>)
// no parser.require() here since its called in
// XMLRPCSerializer.deserialize() below

// deserialize fault result
Map<String, Object> map = (Map<String, Object>) iXMLRPCSerializer
.deserialize(pullParser);
String faultString = (String) map.get(Tag.FAULT_STRING);
int faultCode = (Integer) map.get(Tag.FAULT_CODE);
entity.consumeContent();
throw new XMLRPCFault(faultString, faultCode);

However the faultString and faultCode are not being populated correctly and
are causing cast exceptions.

I inserted some debugging code:
//hacks:)
Object os = map.get(Tag.FAULT_STRING);
Object oi = map.get(Tag.FAULT_CODE);
String faultString = (String)os;
String ois = (String)oi;
Log.d(TAG,CLASS+" String is :"+os+" Int is :"+ois);

The contents was quite interesting:
XMLRPCClient String is :Traceback (most recent call last):
File "/usr/share/pyshared/openerp-server/netsvc.py", line 489, in
dispatch
result = ExportService.getService(service_name).dispatch(method, auth,
params)
File "/usr/share/pyshared/openerp-server/service/web_services.py", line
590, in dispatch
(db, uid, passwd ) = params[0:3]
ValueError: need more than 2 values to unpack

Int is :need more than 2 values to unpack


Hence the class cast exception, the "need more than 2 values to unpack" is
not easily represented by an integer error code. It appears that whatever
fault is being found is not properly populating the fault codes, and is
simply passing the exception up the error reporting chain. Ask Ariane 5 if
that is a good idea :P


Reply all
Reply to author
Forward
0 new messages