dain/leveldb — pull request #16 by seh (2012-05-17 15:37:30+00:00)
Title: Tolerate paths without a designated parent in FileUtils#isSymbolicLink()

These proposed changes correct for a danger present in `FileUtils#isSymbolicLink()` in cases where the provided `java.io.File` instance was constructed with no parent, such as the following constructor call:

final File f = new File("db");
assert null == f.getParentFile();
assert null == f.getParent();

The changes attempt to preserve the documented predicate in `FileUtils#isSymbolicLink()`, but with a twist: namely, if the provided `File` instance has no parent, then it's not safe to conclude that it's a link just because that absent parent is not the same as the canonical parent. The canonical parent is synthesized from the program's current working directory, as though the parent had been specified as ".", which leads one to wonder why `File#getParent()` couldn't have just returned "." rather than null.