I've just discovered this tiny bug in the JdeUtilities
class, which the JDE uses to fully qualify class names. I was going to
sort it out and send a patch. But then I thought about it for a little
bit and realised that I don't know how to sort it out. So I thought
that I would send a bug report instead.
The problem was this....
Despite having not changed my emacs set up in the last
few days all of the beanshell functions had died on my with a "No
Reply from Beanshell message".
I thought that maybe I had changed something in my .emacs,
so I slowly picked through the whole thing, and eventually isolated
the problem to the "custom-set-variables" form.
So after laboriously working my way through this commenting out
each form one, and constantly restarting emacs, I finally found that
if I set "jde-global-classpath" as normal the beanshell
hung. Otherwise it started fine.
Confusing eh?
The cause of the problem turned out to be some new build scripts
that I had written. Whilst doing this I had done my usual trick of
getting the "ln" command backwards and accidentally installed some
symlinks in a sub-directory in my classpath, to a directory further up
like so...
classpath-root
|
|
gnu<-----------|
| |
|--------| |
getopt gnu@--|
where the symlink is indicated by the arrow.
Now in JdeUtilities we have this....
public static void addClassesFromDir(Vector classList,
File rootDir,
File currentDir) {
// SNIP
// Check if it's a directory to recurse into
File currentFile = new File(currentDir, current);
if (currentFile.isDirectory()) {
addClassesFromDir(classList, rootDir, currentFile);
}
The recursive call here is the root cause of the problem.
With a circular directory structure such as I had, you get an infinite
loop.
Of course the problem here is that Java does not really have
much of a notion of symlinks, or they could just be ignored. It lead
me to the deeper realisation that I don't know how the various
utilities like find detect such circular directory structures. Do you
just have to store all the directories that you have looked at in the
current branch, or is there a neater way that I have overlooked?
Anyway there is the problem. I realise that creating such
directory structures is fairly daft, but as its taken me nearly an
hour of hacking through my .emacs to isolate the problem, I though I
would send it in, in the hope that it can save others this problem.
Phil