Eclipse调试“源找不到” [英] Eclipse debugging "source not found"

查看:434
本文介绍了Eclipse调试“源找不到”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用Eclipse,以方便我;)。但是当尝试调试一个JUnit测试用例时,我得到一个对话框,指出当我在测试方法中的代码中找到该行时,找不到源:

I just started using Eclipse so go easy on me ;). But when trying to debug a JUnit test case I get a dialog that states the the source is not found when I get to this line in the code in my test method:

Assert.assertEquals(1, contents.size());

我知道我应该去尝试从某个地方下载源码,但我真的不想要因为我没有兴趣进入JUnit代码。我有JUnit运行时jar,所以为什么Eclipse希望我有所有引用的工具源代码来调试我自己的代码(看起来有点傻)?

I know I should probably go and try and download the source from somewhere, but I really don't want to because I have no interest in stepping into the JUnit code. I have the JUnit runtime jar so Why does Eclipse expect me to have all the referenced tools source code in order to debug my own code (seems somewhat silly)?

我的主要问题是,如果源不可用,我怎么能告诉Eclipse跳过此对话框,并允许我继续调试我自己的代码?

My main question is though, how can I tell Eclipse to skip this dialog when the source is not available and allow me to continue to debug my own code?

我已经孤立了原因。似乎Eclipse似乎认为当内部JUnit代码抛出异常时它需要源。一般来说,有没有告诉它,它不是,只是它会抛出一个错误的对话框,而不是?

I've isolated the cause of this. It seems that Eclipse seems to think it needs the source when an exception is thrown by the internal JUnit code. In general is there anyway to tell it that it doesn't and just have it throw up an error dialog of some kind instead?

推荐答案

我有这么长时间的这个非常讨厌的问题,但终于可以解决了。在我的情况下,空指针异常被抛出在Java的 Transformer.IsRuntimeCode(ProtectionDomain )函数的某个地方。

I had this very annoying problem for a long time but was finally able to solve it. In my case, a null pointer exception was being thrown somewhere in Java's Transformer.IsRuntimeCode(ProtectionDomain) function.

我真的不需要要知道这一点,因为异常被捕获和处理,但是eclipse会在每次发生这种情况时暂停调试,并告诉我源不可用。因此,我经常不得不按按钮继续执行代码。

I didn't really need to know about this since the exception was being caught and handled, but eclipse would pause debugging every time this happened and tell me that the source wasn't available. As a result, I constantly had to keep pressing the button to continue code execution.

为了防止这种情况发生,我:

In order to prevent this from happening, I:


  1. 点击断点窗口
    在调试
    屏幕底部

  2. 右键单击 NullPointerException

  3. 未勾选抓取

这样可以防止调试器在抓到NullPointerException。

This prevented the debugger from pausing program flow during a caught NullPointerException.

alt text http://www.SharpDetail。 com / p / so_breakpoint.gif

这篇关于Eclipse调试“源找不到”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆