don’t use “finally” in your Java code for XPages

since I have no started digging deeper into the XPages mysteries I want to share some of my learnings.

As most of you know: if you use Java in Lotus Notes/Domino you have to take care that you recycle the Notes objects you instantiated (session, database, document etc.)

Java has a nice feature called “finally”. If you use a try/catch block (which I do to log all errors happening, so that I can follow up and fix them) you can also add the “finally” block at the end..

It could serve pretty well for incinerating (I bought that term form some other blogger) the Notes objects…

But beware: I created a class which should be called upon the querySaveDocument event. As soon as I added the finally block the page would crash, most of the times so bad that my whole Notes/Designer went down too…

After hours (again hours!!! can you imagine what my week looks like???) putting log code moving it down one by one… until I reached the try block, nothing worked anymore…

but luck I figured: why not remove the finally block.. and miraculously the XPage could be displayed again

I don’t know what/why exactly it crashed and if you always should not use the finally block, try it.. if your system crashes, remove it and handle it in another way

Leave a Reply

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.