Skip to content

Commit

Permalink
Fix Codacy comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jemacineiras committed Oct 13, 2024
1 parent 05d0543 commit ef22e5f
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,8 @@ private void fillTemplateCustom(
final Path filePathToSave, final String modelPackage, final String fileNameAnnotation, final String templateAnnotation,
final String fileNameValidator, final String templateValidator) throws IOException {
final Path pathToCustomValidatorPackage = filePathToSave.resolve("customvalidator");
if (!pathToCustomValidatorPackage.toFile().exists()) {
if (!pathToCustomValidatorPackage.toFile().mkdirs()) {
throw new IOException("Can't create custom validator directory");
}
if (!pathToCustomValidatorPackage.toFile().exists() && !pathToCustomValidatorPackage.toFile().mkdirs()) {
throw new IOException("Can't create custom validator directory");
}
root.put("packageModel", modelPackage);
writeTemplateToFile(templateAnnotation, pathToCustomValidatorPackage, fileNameAnnotation);
Expand Down Expand Up @@ -283,10 +281,8 @@ protected void writeTemplateToFile(final String templateName, final String apiPa
}

protected void writeTemplateToFile(final String templateName, final Path filePathToSave, final String partialPath) throws IOException {
if (!filePathToSave.toFile().exists()) {
if (!filePathToSave.toFile().mkdirs()) {
throw new IOException("Could not create directory: " + filePathToSave.toFile().getAbsolutePath());
}
if (!filePathToSave.toFile().exists() && !filePathToSave.toFile().mkdirs()) {
throw new IOException("Could not create directory: " + filePathToSave.toFile().getAbsolutePath());
}
final String path = filePathToSave.resolve(partialPath + FILE_TYPE_JAVA).toString();
final Template template = cfg.getTemplate(templateName);
Expand Down

0 comments on commit ef22e5f

Please sign in to comment.