问题描述
这是使用jodatime我第一次和我有一个计算器错误我不知道如何解决。我创建一个Android应用程序,需要能够显示被创建,今天一个SQLite记录时的日子。至于我可以告诉一切正常,除了jodatime。建设项目时,我得到这个错误
This is my first time using jodatime and i've got a stackoverflow error that i have no idea how to fix. I'm creating an android app that needs to be able to display the days between when a sqlite record was created and today. As far as i can tell everything is working correctly except jodatime. I got this error when building the project
[2010-08-10 02:08:50 - Grow Journal Beta] processing org/joda/time/DateTimeUtils.class...
[2010-08-10 02:08:50 - Grow Journal Beta] processing org/joda/time/DateTimeZone$1.class...
[2010-08-10 02:08:50 - Grow Journal Beta] warning: Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute. (This class was probably produced by a broken compiler.)
[2010-08-10 02:08:50 - Grow Journal Beta] processing org/joda/time/DateTimeZone$Stub.class...
这是logcat的:
08-13 22:12:11.823: ERROR/AndroidRuntime(6537): Uncaught handler: thread main exiting due to uncaught exception
08-13 22:12:11.893: ERROR/AndroidRuntime(6537): java.lang.StackOverflowError
08-13 22:12:11.893: ERROR/AndroidRuntime(6537): at java.util.Hashtable.get(Hashtable.java:274)
08-13 22:12:11.893: ERROR/AndroidRuntime(6537): at java.util.Properties.getProperty(Properties.java:177)
08-13 22:12:11.893: ERROR/AndroidRuntime(6537): at java.lang.System.getProperty(System.java:440)
08-13 22:12:11.893: ERROR/AndroidRuntime(6537): at java.lang.System.getProperty(System.java:412)
08-13 22:12:11.893: ERROR/AndroidRuntime(6537): at org.joda.time.DateTimeZone.getDefault(DateTimeZone.java:132)
08-13 22:12:11.893: ERROR/AndroidRuntime(6537): at org.joda.time.DateTimeZone.forID(DateTimeZone.java:190)
08-13 22:12:11.893: ERROR/AndroidRuntime(6537): at org.joda.time.DateTimeZone.getDefault(DateTimeZone.java:132)
环视了一下后,我想我只需要重新编译的二进制jodatime我自己。
我一直在使用Eclipse,我创建了一个新的项目,并导入jodatime源。当我尝试编译我在控制台中得到这样的:
After looking around a bit i figure i just need to recompile the jodatime binary my self.I've been using eclipse, I created a new project, and imported the jodatime source. When I attempt to compile I get this in the console:
Usage: java org.joda.time.tz.ZoneInfoCompiler <options> <source files>
在可能的选项包括:
-src指定要读取源文件
-dst指定在哪里写入生成的文件
where possible options include: -src Specify where to read source files -dst Specify where to write generated files
不是真的知道从哪里何去何从。任何帮助将大大AP preciated。感谢您的时间。
Not really sure where to go from here. Any help would be greatly appreciated. Thanks for your time.
从溢出堆栈跟踪:
Thread [ main] (Suspended (exception StackOverflowError))
DateTimeZone.getDefault() line: 147
ISOChronology.getInstance() line: 86
DateTimeUtils.getChronology(Chronology) line: 231
DateConverter(AbstractConverter).getChronology(Object, Chronology) line: 82
DateTime(BaseDateTime).(Object, Chronology) line: 170
DateTime.(Object) line: 168
PlantsCursorAdapter.newView(Context, Cursor, ViewGroup) line: 71
PlantsCursorAdapter(CursorAdapter).getView(int, View, ViewGroup) line: 182
ListView(AbsListView).obtainView(int) line: 1274
ListView.measureHeightOfChildren(int, int, int, int, int) line: 1147
ListView.onMeasure(int, int) line: 1060
ListView(View).measure(int, int) line: 7966
TableLayout(ViewGroup).measureChildWithMargins(View, int, int, int, int) line: 3077
TableLayout(LinearLayout).measureChildBeforeLayout(View, int, int, int, int, int) line: 888
TableLayout.measureChildBeforeLayout(View, int, int, int, int, int) line: 453
TableLayout(LinearLayout).measureVertical(int, int) line: 350
TableLayout.measureVertical(int, int) line: 465
TableLayout.onMeasure(int, int) line: 428
TableLayout(View).measure(int, int) line: 7966
FrameLayout(ViewGroup).measureChildWithMargins(View, int, int, int, int) line: 3077
FrameLayout.onMeasure(int, int) line: 245
FrameLayout(View).measure(int, int) line: 7966
LinearLayout.measureVertical(int, int) line: 464
LinearLayout.onMeasure(int, int) line: 278
LinearLayout(View).measure(int, int) line: 7966
PhoneWindow$DecorView(ViewGroup).measureChildWithMargins(View, int, int, int, int) line: 3077
PhoneWindow$DecorView(FrameLayout).onMeasure(int, int) line: 245
PhoneWindow$DecorView(View).measure(int, int) line: 7966
ViewRoot.performTraversals() line: 767
ViewRoot.handleMessage(Message) line: 1650
ViewRoot(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4595
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 860
ZygoteInit.main(String[]) line: 618
NativeStart.main(String[]) line: not available [native method]
DateTimeZone.class源<一个href=\"http://google.com/$c$csearch/p?hl=en#6vTamNAQOVE/src/java/org/joda/time/DateTimeZone.java&q=jodatime%20DateTimeZone.class&sa=N&cd=2&ct=rc\"相对=nofollow>在这里
推荐答案
有问题的递归显然是 DateTimeZone.getDefault
和 DateTimeZone.forID
。但是堆栈行号似乎不与乔达源$ C $ C我看到此处。而在这code时, DateTimeZone.getDefault()
方法不看系统属性......这些东西发生在静态初始化。
The problematic recursion is apparently between DateTimeZone.getDefault
and DateTimeZone.forID
. However, the stack line numbers don't seem to line up with the Joda source code I see here. And in that code, the DateTimeZone.getDefault()
method doesn't look at the system properties ... that stuff happens in a static initializer.
这似乎是Android的codeBase的使用JodaTime的扭捏版本。
It seems like the Android codebase uses a tweaked version of JodaTime.
不管怎么说,它看起来像调用 JodaTime.setDefault(...)
可能是一个解决办法。此外,检查了user.timezone系统属性已设置。
Anyway, it looks like calling JodaTime.setDefault(...)
might be a workaround. Also, check that the "user.timezone" system property has been set.
(我不认为重新编译/使用标准JodaTime是正确的策略。而Android的调整......不管他们是......可能是有原因的。)
(I don't think recompiling / using the standard JodaTime is the right strategy. The Android tweaks ... whatever they are ... are probably there for a reason.)
修改
此重温,它蒸发,这是JodaTime 1.6.1中的错误在某些平台上(机器人,谷歌 - 应用程序)。的问题跟踪显示它作为固定在JodaTime 1.6.2。
Revisiting this, it transpires that this was a bug in JodaTime 1.6.1 on some platforms (Android, Google-Apps). The issue tracker shows it as fixed in the JodaTime 1.6.2.
这篇关于重新编译jodatime?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!