Today I was debugging a problem where I wanted to set an exception breakpoint for oracle.jbo.JboException to see what was the first ADFBC-related exception that was occurring. The only problem was that I did not want to stop for the oracle.jbo.NoXMLFileException (subtype of JboException) which the framework will throw when it can't find an optional file like the package XML file in the runtime classpath. Not knowing which subtype of JboException would be thrown, I didn't want to create a ton of different breakpoints for every possible subtype except for NoXMLFileException, so I tried to find a better way. Here's the solution I finally figured out.
I created an exception breakpoint for oracle.jbo.JboException, with a conditional breakpoint expression of:
!( _throw instanceof oracle.jbo.NoXMLFileException )
I got the idea about using the special _throw field because I noticed in the debugger "Data" window that an entry named _throw showed which exception had been thrown. Then I remembered something that a developer on the JDev IDE team told me once, which was "if you can see it in the Data window, you can reference it in a watch expression." So I tried it out, hoping that that maxim also held for the debugger's conditional breakpoint expressions. And it did!
In this way, the debugger avoids stopping if the exception happens to be of the NoXMLFileException subtype, but otherwise will stop for all other subtypes of JboException. I thought it was an interesting trick to share.
1:14:51 PM
|