You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, using AbstractSitemapGenerator.toFile(file) with a file path where parent directory does not exists results in exception, so the user must manually create parent directory with file.getParentFile().mkdirs() before calling this method.
This check should be embedded inside the method to be user-friendly. For example, Apache IO commons uses:
public static FileOutputStream openOutputStream(final File file, final boolean append) throws IOException {
if (file.exists()) {
if (file.isDirectory()) {
throw new IOException("File '" + file + "' exists but is a directory");
}
if (file.canWrite() == false) {
throw new IOException("File '" + file + "' cannot be written to");
}
} else {
final File parent = file.getParentFile();
if (parent != null) {
if (!parent.mkdirs() && !parent.isDirectory()) {
throw new IOException("Directory '" + parent + "' could not be created");
}
}
}
return new FileOutputStream(file, append);
}
The text was updated successfully, but these errors were encountered:
Currently, using AbstractSitemapGenerator.toFile(file) with a file path where parent directory does not exists results in exception, so the user must manually create parent directory with
file.getParentFile().mkdirs()
before calling this method.This check should be embedded inside the method to be user-friendly. For example, Apache IO commons uses:
The text was updated successfully, but these errors were encountered: