File is a directory?
Hi,
I've the following function:
staticpublicvoid setFileContents(File aFile, String aContents)
throws FileNotFoundException, IOException{
if (!aFile.isFile()){
thrownew IllegalArgumentException("Should not be a directory: " + aFile);
}
[...]
and I call it in this way:
File fn =new File("foo.txt");
[...]
setContents(fn,"Hi there");
foo.txt does not exists. Why do I receive the IllegalArgumentException Should not be a directory?
Is it because, since file does not exist, it's not a file? I.e., should it enclose within a
if(aFile.exists(){
if (!aFile.isFile()){
thrownew IllegalArgumentException("Should not be a directory: " + aFile);
}
}
Thanks.

