Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -558,17 +558,35 @@ public void processOpts() {
additionalProperties.remove(ADDITIONAL_ENUM_TYPE_ANNOTATIONS);
}

// Need to remove invokerPackage prop, to disable warning in logs
String addInvokerPackage = null;
if (additionalProperties.containsKey(INVOKER_PACKAGE)) {
addInvokerPackage = (String) additionalProperties.get(INVOKER_PACKAGE);
additionalProperties.remove(INVOKER_PACKAGE);
}

super.processOpts();

// Get properties
if (additionalProperties.containsKey(OPT_TITLE)) {
title = (String) additionalProperties.get(OPT_TITLE);
}

if (additionalProperties.containsKey(INVOKER_PACKAGE)) {
packageName = (String) additionalProperties.get(INVOKER_PACKAGE);
if (addInvokerPackage != null) {
packageName = addInvokerPackage;
additionalProperties.put(INVOKER_PACKAGE, packageName);
additionalProperties.put(PACKAGE_NAME, packageName);
} else {
additionalProperties.put(INVOKER_PACKAGE, packageName);
additionalProperties.put(PACKAGE_NAME, packageName);
}

if (additionalProperties.containsKey(PACKAGE_NAME)) {
packageName = (String) additionalProperties.get(PACKAGE_NAME);
additionalProperties.put(INVOKER_PACKAGE, packageName);
} else {
additionalProperties.put(INVOKER_PACKAGE, packageName);
additionalProperties.put(PACKAGE_NAME, packageName);
}

if (additionalProperties.containsKey(API_PACKAGE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand All @@ -40,7 +39,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;

import static io.micronaut.core.util.StringUtils.EMPTY_STRING;
Expand Down Expand Up @@ -350,12 +348,9 @@ private String readTemplateFromCustomPath(String customPathStr, @Nullable Visito
} else if (customPathStr.startsWith(FILE_SCHEME)) {
customPathStr = customPathStr.substring(FILE_SCHEME.length());
} else if (customPathStr.startsWith(CLASSPATH_SCHEME)) {
final var customPathStrFinal = customPathStr;
var resourceLoader = new DefaultClassPathResourceLoader(getClass().getClassLoader());
Optional<InputStream> inOpt = resourceLoader.getResourceAsStream(customPathStr);
if (inOpt.isEmpty()) {
throw new IOException("Fail to load " + customPathStr);
}
try (InputStream in = inOpt.get();
try (var in = resourceLoader.getResourceAsStream(customPathStr).orElseThrow(() -> new IOException("Fail to load " + customPathStrFinal));
var reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))
) {
return readFile(reader);
Expand Down
Loading