tags:

views:

31

answers:

1

I have control of a small piece of an application built on Eclipse, and I'm having a problem creating a DefaultCellEditor. The code actually uses a subclass of DefaultCellEditor, but I can recreate the problem using DefaultCellEditor, so that's what I'm going to ask about, hoping that it will solve 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 happens when the constructor for DefaultCellEditor is called:

log.debug("Trying construction.");
currentCellEditor = new DefaultCellEditor(new JTextField());
log.debug("Constructed OK.");

When this code runs, maybe 20% of the time, the app hangs, and the CPU is pegged at 100% - looks like there's an infinite loop in there somewhere, but I don't know where. The first log line is printed, but the second is not.

I've tried making a copy of the DefaultCellEditor class and inserting System.out.println statements in there to see if I can figure out where the problem occurs; during the times that the code runs correctly, all of my debug statements are printed out, but when it doesn't run correctly, none of the statements are printed out, almost like the hang occurs before the constructor is called. Any ideas what could be happening?

A: 

Both of the comments on the question were helpful. I was able to use the thread dump and figure out what was causing the loop (I ended up using StackTrace). My other problem is that while I was on the EDT earlier on, at the point this code actually runs, it's not on the EDT anymore - so now I have to track that down, but some early testing indicates that putting this on the EDT may fix the problem. Thanks!

Matt McMinn