if (flags.isCreate()) {
if (theFile.exists() && flags.isExclusive()) {
throw new FileExistsException(path);
}
try {
fileCreated = theFile.createNewFile();
} catch (IOException ioe) {
// See JRUBY-4380.
// MRI behavior: raise Errno::ENOENT in case
// when the directory for the file doesn't exist.
// Java in such cases just throws IOException.