This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
f.setWritable(true);
}
public void testFileObjectForBrokenLink () throws Exception {
clearWorkDir();
File original = new File(getWorkDir(), "original");
// original.createNewFile();
File lockFile = new File(getWorkDir(), "wlock");
ProcessBuilder pb = new ProcessBuilder().directory(lockFile.getParentFile()).command(new String[] { "ln", "-s", original.getName(), lockFile.getName() });
pb.start().waitFor();
// file exists, or at least dir.listFiles lists the file
assertTrue(Arrays.asList(lockFile.getParentFile().list()).contains(lockFile.getName()));
// java.io.File.exists returns false
assertFalse(lockFile.exists());
// and no FileObject is reated for suh a file
assertNotNull(FileUtil.toFileObject(lockFile));