Issue 32 in android-xmlrpc: dateTime Error

38 views
Skip to first unread message

android...@googlecode.com

unread,
Nov 22, 2011, 6:58:24 PM11/22/11
to android-x...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 32 by wusu...@gmail.com: dateTime Error
http://code.google.com/p/android-xmlrpc/issues/detail?id=32

What steps will reproduce the problem?
1. Attempt to connect to UPC database at
(http://www.upcdatabase.com/xmlrpc) with android-xmlrpc on Button Click

What is the expected output? What do you see instead?
Returns expected error as seen in the Serialize file
of: "java.io.IOException: Cannot deserialize dateTime". Is there any way to
bypass this error so that I can retrieve the rest of the data in the xml
file?

I am successfully contacting the UPC database, but am unable to read the
returned xml.

What version of the product are you using? On what operating system?
r15, Windows 7

Please provide any additional information below.

I'm totally new to coding, so forgive me if this is a noob mistake!
Code Sample:
try {
HashMap<String, String> params = new HashMap<String, String>();
params.put("rpc_key", rpc_key);
params.put("upc", "049000042566");
HashMap result = (HashMap)client.call("lookup", params);

resultSize = result.get("size").toString();
resultDesc = result.get("description").toString();

} catch (NullPointerException nl) {
nl.printStackTrace();
Log.d("It's returning null", "Lookup");
} catch (XMLRPCException e) {
e.printStackTrace();
Log.d("It's failed", "Lookup");
}
text.setText("result description: " + resultDesc + "result size: "
+ resultSize);


android...@googlecode.com

unread,
Dec 9, 2011, 1:10:12 PM12/9/11
to android-x...@googlegroups.com

Comment #1 on issue 32 by gunney.p...@gmail.com: dateTime Error
http://code.google.com/p/android-xmlrpc/issues/detail?id=32

The android-xmlrpc code cannot decode the date that is received from the
RPC call (at least in version r15). In order to correct this change the
TYPE_
DATE_TIME_ISO8601 handler within XMLRPCSerializer.deserialize to :

if (typeNodeName.equals(TYPE_DATE_TIME_ISO8601)) {
String value = parser.nextText();
try {
obj = dateFormat.parseObject(value);
} catch (ParseException e) {

try {
SimpleDateFormat ISO8601Fmt = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
obj = ISO8601Fmt.parse(value);
} catch (ParseException e2) {
throw new IOException("Cannot deserialize dateTime " +
value);
}
}

This firstly tries the original check, then tries a variation if it fails.

Not elegant but it works :-)

android...@googlecode.com

unread,
Feb 5, 2012, 1:46:35 AM2/5/12
to android-x...@googlegroups.com

Comment #2 on issue 32 by unimpecc...@gmail.com: dateTime Error
http://code.google.com/p/android-xmlrpc/issues/detail?id=32

Still not working for me ... same error...

02-05 17:10:02.284: W/System.err(1714): java.io.IOException: Cannot
deserialize dateTime 2012-02-05T06:40:02
02-05 17:10:02.284: W/System.err(1714): at
org.xmlrpc.android.XMLRPCSerializer.deserialize(XMLRPCSerializer.java:161)
02-05 17:10:02.284: W/System.err(1714): at
org.xmlrpc.android.XMLRPCSerializer.deserialize(XMLRPCSerializer.java:202)
02-05 17:10:02.284: W/System.err(1714): at
org.xmlrpc.android.XMLRPCSerializer.deserialize(XMLRPCSerializer.java:202)
02-05 17:10:02.284: W/System.err(1714): at
org.xmlrpc.android.XMLRPCClient.callEx(XMLRPCClient.java:338)
02-05 17:10:02.294: W/System.err(1714): at
org.xmlrpc.android.XMLRPCClient.call(XMLRPCClient.java:424)
02-05 17:10:02.294: W/System.err(1714): at
edu.sfarooq.cmu.UPCDatabaseCoderActivity.searchUPCdatabase(UPCDatabaseCoderActivity.java:36)
02-05 17:10:02.294: W/System.err(1714): at
edu.sfarooq.cmu.UPCDatabaseCoderActivity.onCreate(UPCDatabaseCoderActivity.java:21)
02-05 17:10:02.294: W/System.err(1714): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-05 17:10:02.294: W/System.err(1714): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-05 17:10:02.294: W/System.err(1714): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-05 17:10:02.304: W/System.err(1714): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-05 17:10:02.304: W/System.err(1714): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-05 17:10:02.304: W/System.err(1714): at
android.os.Handler.dispatchMessage(Handler.java:99)
02-05 17:10:02.304: W/System.err(1714): at
android.os.Looper.loop(Looper.java:123)
02-05 17:10:02.304: W/System.err(1714): at
android.app.ActivityThread.main(ActivityThread.java:4627)
02-05 17:10:02.304: W/System.err(1714): at
java.lang.reflect.Method.invokeNative(Native Method)
02-05 17:10:02.304: W/System.err(1714): at
java.lang.reflect.Method.invoke(Method.java:521)
02-05 17:10:02.314: W/System.err(1714): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-05 17:10:02.314: W/System.err(1714): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-05 17:10:02.314: W/System.err(1714): at
dalvik.system.NativeStart.main(Native Method)


Reply all
Reply to author
Forward
0 new messages