Tuesday, September 26, 2006

The most strange bug in the Java Virtual Machine!

Rome, Italy. Yesterday night. My clock displays 1:23 AM.

Finally I found the bug that affects the CRUDSelect of RomaFramework project. Some users reported me a strange behaviour: the "select" button of CRUDSelect won't appear when the application is launched non in debug mode.

Initially I've leave out that report in favor of more concrete enhancements and problems. But some days ago I've catched the strange behaviour reported by the users.

How can the JVM hide my "select" button and show it when I launch the same application in debug mode? This is a case for the detective Luca. Since I cannot debug the application (in debug doesn't appears the bug), I've enabled the logging for the internal API of RomaFramework (just changing the log4j.xml file). It was not enought. So I've inserted much more logging and finally I saw the problem:

Java Reflection doesn't return the method public void select(). Much of Roma Framework working depends by Java Reflection. In a deeper analysis I've isolated the problem:

CRUDSelect class contains, between the others, these two methods:

public void select();
public void select(boolean iForceWindowClosing);

For a strange reason the first one is not returned when the JVM is in non-debug mode!!! Probably a bug in the HotSpot on method with the same name. I've renamed the second one method in:

public void selectAndForceClosing(boolean iForceWindowClosing);

And now anythings work!!! Now I submit the update in SVN repository, but tomorrow I'll open a bug report to Sun.com sending a test case that show the problem.

This time again, another case was resolved by detective Luca ;-)

1 comment:

Gennaro said...

Great!!! I was one of them!
Bye, Gennaro