Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse debugging "source not found"

Tags:

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()); 

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)?

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?

[Edit]

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?

like image 747
James Avatar asked Dec 25 '09 00:12

James


People also ask

How do I get debug view in Eclipse?

If Eclipse does not automatically switch to the Debug perspective, you can locate it manually in the Window entry on the menu bar or by clicking the Choose Perspective button (a button with a plus on it) in the upper right corner of the Eclipse window under the menu bar line.


1 Answers

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.

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. Clicked on the "Breakpoints" window at the bottom of the debugging screen
  2. Right clicked "NullPointerException"
  3. Unchecked "Caught"

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

alt text
(source: SharpDetail.com)

like image 79
Chris Dutrow Avatar answered Sep 22 '22 06:09

Chris Dutrow