Closed GoogleCodeExporter closed 8 years ago
There's a possibility that android's reflection api returns the wrong field
ordering on android.
I've actually tested on android 2.3.3 and the field ordering was correct.
Can you test on yours? Print out the text output on android via new
String(YamlIOUtil.toByteArray(userAccount, schema, buffer));
Original comment by david.yu...@gmail.com
on 23 Jul 2011 at 2:30
Kindly see the output below. Thanks.
07-23 15:02:16.401: INFO/System.out(329): --- !UserAccount
07-23 15:02:16.401: INFO/System.out(329): password: username
07-23 15:02:16.410: INFO/System.out(329): username: password
Original comment by pohzysg
on 23 Jul 2011 at 3:03
Thanks. Will try to reproduce. I'm assuming that output is from the emulator.
Original comment by david.yu...@gmail.com
on 23 Jul 2011 at 3:19
Yes that’s right. Thanks for all the effort.
Original comment by pohzysg
on 23 Jul 2011 at 3:38
I tried this on 2.3.3 and it had no problems.
Can you try on 2.3.3 to see if protostuff is really the culprit here?
Original comment by david.yu...@gmail.com
on 31 Jul 2011 at 9:32
I tried it on 2.3.3 ,but I am facing the same issue.
But when I used a custom schema it is fine. Attached for your reference.
By the way, my server is running on JDK 1.6u26. Do let me know if you
require more information.
Original comment by pohzysg
on 31 Jul 2011 at 3:07
I tested mine on java1.6u26, windows xp. What os did you use for testing?
I dont' see the attached project. Can you attach the whole example project?
Original comment by david.yu...@gmail.com
on 1 Aug 2011 at 2:08
Related to issue 86.
Original comment by david.yu...@gmail.com
on 21 Oct 2011 at 5:39
I haven't seen the non-deterministic ordering actually happening on my Android
devices (not tested much either I must say), but from what I have read around,
it does happen on some devices running Dalvik and break frameworks relying on
consistent field order. To be on the safe side, I decided to implement, as
suggested in the comments for issue 86, an extension to the runtime schema
where the field mapping/tag can be enforced via an annotation.
I am attaching the patch in case anyone is interested, but I am just starting
to use it so use it at your own risk! If there is any interest to bring that
upstream, please review, and I will iterate.
From a documentation perspective, until this patch or something similar gets
into trunk, I think this known issue should be highlighted on the home page,
since Android is specifically mentioned as a fit for runtime-md but we do know
it won't work in all cases because of the weak reflection contract.
Original comment by bjag...@gmail.com
on 18 Mar 2012 at 9:49
Attachments:
Hi Brice,
Thanks for the patch. Will review it and include for the next release.
Cheers
Original comment by david.yu...@gmail.com
on 25 Mar 2012 at 11:45
patch added @ rev 1460. Thanks!
Original comment by david.yu...@gmail.com
on 29 Mar 2012 at 6:09
1.0.5 fixed this (forgot to close)
Original comment by david.yu...@gmail.com
on 30 Apr 2012 at 2:33
Original issue reported on code.google.com by
pohzysg
on 23 Jul 2011 at 2:20