Application hangs when calling DefaultCellEditor constructor
I have control over a small part of an application built in Eclipse and I am having a problem creating the DefaultCellEditor. The code does use a subclass of DefaultCellEditor, but I can recreate the problem with the DefaultCellEditor, so that's what I'm going to ask about, hoping it solves the problem with the actual class. I've tried this with both JDK 1.5 and 1.6 and get the same behavior in both.
The problem occurs when the constructor for the DefaultCellEditor is called:
log.debug("Trying construction.");
currentCellEditor = new DefaultCellEditor(new JTextField());
log.debug("Constructed OK.");
When this code works, maybe 20% of the time, the application freezes and the processor is bound to 100% - it looks like there is an infinite loop in there somewhere, but I don't know where. The first line of the log is printed, but the second is not.
I tried to make a copy of the DefaultCellEditor class and paste the System.out.println statements into it to see if I can figure out where the problem is; during code execution, all my debug statements are printed, but when it does not work properly, none of the statements are printed, almost like a hang occurs before the constructor is called. Any ideas what might be going on?
a source to share
Both comments on this point were helpful. I was able to use a thread dump and figure out what was causing the loop (I ended up using StackTrace ). My other problem is that while I was on EDT earlier, the moment this code actually works it doesn't work anymore on EDT, so now I need to track this, but some early tests show that including this in EDT can solve the problem. Thanks!
a source to share