无法捕获且不会停止程序的错误

发布于 2024-12-12 06:11:19 字数 3563 浏览 0 评论 0原文

我正在运行一段代码,该代码在 Eclipse 中抛出错误。奇怪的是,logcat 显示抛出错误后程序继续运行,而且代码块正在正确执行其任务,但我无法捕获错误。这有可能是 eclipse 的 bug 吗?我在下面包含了我的 logcat。

10-26 22:38:13.300: INFO/System.out(844):  Proxy Main Triggered URL:     http://api.discogs.com/master/39614
10-26 22:38:13.300: INFO/System.out(844): 1Proxy Main Triggered
10-26 22:38:13.300: INFO/System.out(844): 2Proxy Main Triggered
10-26 22:38:13.310: INFO/System.out(844): 3Proxy Main Triggered
10-26 22:38:13.310: INFO/System.out(844): 4Proxy Main Triggered
10-26 22:38:13.310: INFO/System.out(844): 5Proxy Main Triggered
10-26 22:38:13.320: DEBUG/AndroidRuntime(844): Shutting down VM
10-26 22:38:13.320: WARN/dalvikvm(844): threadid=3: thread exiting with uncaught exception (group=0x4001da28)
10-26 22:38:13.320: ERROR/AndroidRuntime(844): Uncaught handler: thread main exiting due to uncaught exception
10-26 22:38:13.330: ERROR/AndroidRuntime(844): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.discog10/com.discog10.popUpActivity}:     java.lang.NullPointerException
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.os.Looper.loop(Looper.java:123)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.ActivityThread.main(ActivityThread.java:4203)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at java.lang.reflect.Method.invokeNative(Native Method)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at java.lang.reflect.Method.invoke(Method.java:521)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at dalvik.system.NativeStart.main(Native Method)
10-26 22:38:13.330: ERROR/AndroidRuntime(844): Caused by: java.lang.NullPointerException
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at com.discog10.popUpActivity.onCreate(popUpActivity.java:82)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     ... 11 more
10-26 22:38:13.340: INFO/Process(90): Sending signal. PID: 844 SIG: 3
10-26 22:38:13.350: INFO/dalvikvm(844): threadid=7: reacting to signal 3
10-26 22:38:13.350: ERROR/dalvikvm(844): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
10-26 22:38:13.640: INFO/System.out(844): 6Proxy Main Triggered
10-26 22:38:13.650: INFO/global(844): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
10-26 22:38:13.650: INFO/System.out(844): 7Proxy Main Triggered
10-26 22:38:13.650: INFO/System.out(844): Proxy Main Complete

I am running a piece of code that is throwing an error in eclipse. The strange thing is that the logcat shows that after the error is thrown the program keeps running, furthermore the block of code is performing it's task correctly, and I am unable to catch the error. Is it possible that this is an eclipse bug? I have included my logcat below.

10-26 22:38:13.300: INFO/System.out(844):  Proxy Main Triggered URL:     http://api.discogs.com/master/39614
10-26 22:38:13.300: INFO/System.out(844): 1Proxy Main Triggered
10-26 22:38:13.300: INFO/System.out(844): 2Proxy Main Triggered
10-26 22:38:13.310: INFO/System.out(844): 3Proxy Main Triggered
10-26 22:38:13.310: INFO/System.out(844): 4Proxy Main Triggered
10-26 22:38:13.310: INFO/System.out(844): 5Proxy Main Triggered
10-26 22:38:13.320: DEBUG/AndroidRuntime(844): Shutting down VM
10-26 22:38:13.320: WARN/dalvikvm(844): threadid=3: thread exiting with uncaught exception (group=0x4001da28)
10-26 22:38:13.320: ERROR/AndroidRuntime(844): Uncaught handler: thread main exiting due to uncaught exception
10-26 22:38:13.330: ERROR/AndroidRuntime(844): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.discog10/com.discog10.popUpActivity}:     java.lang.NullPointerException
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.os.Looper.loop(Looper.java:123)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.ActivityThread.main(ActivityThread.java:4203)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at java.lang.reflect.Method.invokeNative(Native Method)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at java.lang.reflect.Method.invoke(Method.java:521)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at dalvik.system.NativeStart.main(Native Method)
10-26 22:38:13.330: ERROR/AndroidRuntime(844): Caused by: java.lang.NullPointerException
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at com.discog10.popUpActivity.onCreate(popUpActivity.java:82)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
10-26 22:38:13.330: ERROR/AndroidRuntime(844):     ... 11 more
10-26 22:38:13.340: INFO/Process(90): Sending signal. PID: 844 SIG: 3
10-26 22:38:13.350: INFO/dalvikvm(844): threadid=7: reacting to signal 3
10-26 22:38:13.350: ERROR/dalvikvm(844): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
10-26 22:38:13.640: INFO/System.out(844): 6Proxy Main Triggered
10-26 22:38:13.650: INFO/global(844): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
10-26 22:38:13.650: INFO/System.out(844): 7Proxy Main Triggered
10-26 22:38:13.650: INFO/System.out(844): Proxy Main Complete

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瞳孔里扚悲伤 2024-12-19 06:11:19

尝试修复导致此行出现 NullPointerException 的代码(或将其作为问题的一部分发布):

com.discog10.popUpActivity.onCreate(popUpActivity.java:82)

您运行多个线程吗?恕我直言,这不太可能是 Eclipse 中的错误。

Try to fix the code which causes the NullPointerException at this line (or post it as part of your question):

com.discog10.popUpActivity.onCreate(popUpActivity.java:82)

Do you run several threads? IMHO It's highly unlikely that it is an bug in Eclipse.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文