Eclipse conditional interruption. How to check if an exception has occurred?

I have this 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); } 

I got a breakpoint on this line:

 String lShortname = pIn.readUTF(); 

My problem is that in some cases the readUTF function throws a RuntimeException . The application performs the function more than 100 times, so it is very difficult for me to find the problem.

my question is: is there a way to catch this exception with a breakpoint condition? I already use these conditions with light Boolean conditions, but I don’t know how to stop at this line when throwing an exception.

thanks in advance

Stephen

+4
source share
3 answers

Yes there is an option called "exception checkpoint"
Open a breakpoint, press j! and add the desired exception

enter image description here

+5
source

Have you tried something like this?

 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); } 
+1
source

I think you need a Java exception exception point

In eclipse, open "Runpoint Exception Breakpoint ..." from the Run menu. You can choose an exception for which you need a breakpoint.

 Run -> Add Java Exception Breakpoint... 
+1
source

All Articles