Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
202 views
in Technique[技术] by (71.8m points)

java - Breakpoint at exception in Eclipse - how to examine Exception object?

I feel like I'm missing something very simple here. I have Eclipse set up to break on all exceptions. So, let's say that it breaks on an AssertationFailedException. The Debug window will show that thread suspended and has the following data:

Thread [Thread-1] (Suspended (exception AssertionFailedException)) 
    ContactManager.addContact(String) line: 93  
    ContactManager$ContactDataCallback.dispatch(String, Element, ClientConnector) line: 118 
    PacketHandler.handle(FractusPacket) line: 173   
    ServerConnection.syncProcess(FractusMessage) line: 122  
    ServerConnection.run() line: 248    
    Thread.run() line: 636

However, the text that I'm looking for, such as: "Getter called outside realm of observable org.eclipse.core.databinding.observable.set.WritableSet@4b7361e2", is not available until I step through the exception (thus propagating it all the way up the stack) where it outputs the type of the exception, the text (which is the part that I want) and the stack trace.

How can I examine the "AssertationFailedException" (or any other exception) in order to get the message with which the exception was constructed? Of course I'm in the Debug perspective.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There is an option in the Eclipse Preferences that allows inspecting of the thrown exception:

Check Java -> Debug -> Open popup when suspended on exception

With this option there will be a popup allowing inspection of the exception.

Strange that this option is not checked by default as it is very useful !


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...