Eclipse条件断点。 如何检查是否发生exception?

我有这个function:

public static FradId readFradId(DataInput pIn) throws IOException { Integer lMainId = Integer.valueOf(pIn.readInt()); Integer lReferenceId = Integer.valueOf(pIn.readInt()); String lShortname = pIn.readUTF(); return new FradId(lMainId,lReferenceId,lShortname); } 

我在这一行得到了一个断点:

 String lShortname = pIn.readUTF(); 

我的问题是在某些情况下函数readUTF抛出RuntimeException 。 应用程序执行该function超过100次,因此我很难找到问题。

我的问题:有没有办法用断点条件捕获该exception? 我已经在简单的布尔条件下使用了这些条件,但我不知道在抛出exception时如何在该行中停止。

Thx提前

斯特凡

是的,有一个名为“exception断点”的选项
打开断点视图,单击j! 选项并添加所需的exception

在此处输入图像描述

你尝试过类似的东西吗?

 public static FradId readFradId(DataInput pIn) throws IOException { Integer lMainId = Integer.valueOf(pIn.readInt()); Integer lReferenceId = Integer.valueOf(pIn.readInt()); try{ String lShortname = pIn.readUTF(); }catch(Exception e){ //need a breakpoint here. } return new FradId(lMainId,lReferenceId,lShortname); } 

我认为你需要Java Exception Break Point

在你的eclipse中,从Run Menu中打开’ Add Java Exception Breakpoint … ‘。 您可以选择需要断点的例外。

 Run -> Add Java Exception Breakpoint...