I was using the (new File(fileLoc).isFile()) method to determine if a file I needed to read in actually existed. I tested on a file I knew was there and it returned invalid. I traced through the code to see if maybe I was entering the path wrong and I found this in the java.io.File class:
final boolean isInvalid() {
if (status == null) {
status = (this.path.indexOf('\u0000') < 0) ? PathStatus.CHECKED
: PathStatus.INVALID;
}
return status == PathStatus.INVALID;
}
Am I crazy or will this always return an INVALID? I haven't had the chance to check newer versions. If this isn't the right way to check file existence, what should I use?
Thanks,
Tracy