check boolean value returned by createFile (#17359)

This commit is contained in:
William Cheng 2023-12-09 21:58:53 +08:00 committed by GitHub
parent a21e68182a
commit 5daa145d25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -783,7 +783,10 @@ public class DefaultGenerator implements Generator {
try { try {
LOGGER.info("Writing file " + ignoreFileNameTarget + " (which is always overwritten when the option `openapiGeneratorIgnoreFile` is enabled.)"); LOGGER.info("Writing file " + ignoreFileNameTarget + " (which is always overwritten when the option `openapiGeneratorIgnoreFile` is enabled.)");
new File(config.outputFolder()).mkdirs(); new File(config.outputFolder()).mkdirs();
ignoreFile.createNewFile(); if (!ignoreFile.createNewFile()) {
throw new RuntimeException("Failed to create the file .openapi-generator-ignore: " + ignoreFileNameTarget);
}
String header = String.join("\n", String header = String.join("\n",
"# IMPORTANT: this file is generated with the option `openapiGeneratorIgnoreList` enabled", "# IMPORTANT: this file is generated with the option `openapiGeneratorIgnoreList` enabled",
"# (--openapi-generator-ignore-list in CLI for example) so the entries below are pre-populated based", "# (--openapi-generator-ignore-list in CLI for example) so the entries below are pre-populated based",