Skip to content

Commit

Permalink
fix(core): plugins validation failed with micronaut update
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Jul 6, 2022
1 parent 34b34e5 commit 0d3de92
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions core/src/main/java/io/kestra/core/contexts/KestraValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
import io.kestra.core.plugins.PluginRegistry;
import io.kestra.core.plugins.RegisteredPlugin;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.*;

@Singleton
@Replaces(DefaultValidator.class)
Expand All @@ -31,8 +29,7 @@ protected KestraValidator(@NonNull ValidatorConfiguration configuration) {
super(configuration);
}

protected @Nullable
BeanIntrospection<Object> getBeanIntrospection(@NonNull Object object) {
protected @Nullable BeanIntrospection<Object> getBeanIntrospection(@NonNull Object object) {
//noinspection ConstantConditions
if (object == null) {
return null;
Expand Down Expand Up @@ -102,18 +99,13 @@ private Map<String, BeanIntrospectionReference<Object>> getIntrospections() {
if (pluginRegistry != null) {
for (RegisteredPlugin registeredPlugin : pluginRegistry.getPlugins()) {

SoftServiceLoader<BeanIntrospectionReference> services = SoftServiceLoader.load(BeanIntrospectionReference.class, registeredPlugin.getClassLoader());

for (ServiceDefinition<BeanIntrospectionReference> service : services) {
if (service.isPresent()) {
BeanIntrospectionReference ref = service.load();
((Map) introspectionMap).put(ref.getName(), ref);
} else if (log.isDebugEnabled()) {
log.debug(
"BeanIntrospection {} not loaded since associated bean is not present on the classpath",
service.getName()
);
}
SoftServiceLoader<BeanIntrospectionReference> loader = SoftServiceLoader.load(BeanIntrospectionReference.class, registeredPlugin.getClassLoader());

List<BeanIntrospectionReference> definitions = new ArrayList<>(100);
loader.collectAll(definitions);

for (BeanIntrospectionReference definition : definitions) {
((Map) introspectionMap).put(definition.getName(), definition);
}
}
}
Expand Down

0 comments on commit 0d3de92

Please sign in to comment.