Pages

Tuesday, December 3, 2013

Debugging managed beans in xpages

I copied all design elements from the XPageDebugToolbar v3.0.1 to my database and followed the procedures to debug my code. Some irritating stuff kept throwing "Command Not Handled" exception.

The error page was set to the error page mentioned by the XPageDebugToolbar v3.0.1 as per the documentation and hence I changed it back to default settings. Now I was able to see some clear meaningless errors. rolf.
It displayed something like the dbar.warn or dbar.error pointed to undefined values and hence no such methods existed.

So I made an attempt to check the "eu/linqed/debugtoolbar/DebugToolbar" file. That is where I found a clear error which upon fixing fixed the issue. The class (java design element) did not open up and instead it spoke of some refresh error and asked me to hit F9. How wonderful.

Now I have a managed bean with following lines of codes in different parts of the class which enabled me debug and fix the issue.

private static final DebugToolbar dBar = DebugToolbar.get();

dBar.info(colDef.getName()+"==C1 is " + (colDef.getName().equals("C1")));

for (Map.Entry entry: svals.entrySet()) {
dBar.info("Key = " + entry.getKey().toString() + ", Value = " + entry.getValue().toString());
}

My code is now fixed and I am one happy me now. :)

Dont forget to download and use the XPageDebugToolbar. It is really a great work and made my life easier with XPages.

I used to use a custom built logger tool which I built a couple of years ago. I used the same to create log documents and dump all my debugging statements. This helped me watch my code all these years.Now that I had to use Dynamic View Control from Extension Library, I had to use managed beans to manipulate so me column values and hurray my xLog failed. It simply did not create any log documents. Some posts kept telling me to recycle objects after they are used. It did not help either.

Hope this helps some one. :)

No comments:

Post a Comment