Joda time bug on certain Android devices?

家住魔仙堡 提交于 2019-12-12 08:58:15

问题


I'm using joda-time 1.6.2 in an Android app and I am getting some crash reports

java.lang.IllegalArgumentException: Invalid format: "8:00 AM" is malformed at "AM"

And the code that triggers is is the following:

DateTimeFormatter formatter = DateTimeFormat.forPattern("hh:mm a");
LocalTime lt = formatter.parseDateTime(value).toLocalTime();

I can't reproduce this crash on my phones so it happens only on certain Android devices and I have no clue why.


回答1:


I was faced with the same issue after the release of Android 5. Only devices running this version would crash.

This is probably a localization issue. It appears that your default local does not know the "AM"-string, but something else.

See my post for details and my solution



来源:https://stackoverflow.com/questions/13286127/joda-time-bug-on-certain-android-devices

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!