File result = null;
try {
result = new File(arg);
if (mustExist() && !result.exists()) {
throw (new ParseException(result + " does not exist."));
}
if (mustBeDirectory() && result.exists() && !result.isDirectory()) {
throw (new ParseException(result + " is not a directory."));
}
if (mustBeFile() && result.exists() && result.isDirectory()) {
throw (new ParseException(result + " is not a file."));
}
} catch (NullPointerException e) {
throw (
new ParseException(
"No File given to parse",
e));
}
return (result);
}