diff --git a/pom.xml b/pom.xml index cd42f625b..ecd16528d 100644 --- a/pom.xml +++ b/pom.xml @@ -27,17 +27,17 @@ - - - - - - - - - - - + hooks/open-telemetry + tools/junit-openfeature + providers/flagd + providers/flagsmith + providers/go-feature-flag + providers/jsonlogic-eval-provider + providers/env-var + providers/unleash + providers/flipt + providers/configcat + providers/statsig providers/multiprovider @@ -54,7 +54,7 @@ UTF-8 UTF-8 ${groupId}.${artifactId} - false + true @@ -229,85 +229,85 @@ 3.13.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.5.0 + + checkstyle.xml + UTF-8 + true + true + false + + + + com.puppycrawl.tools + checkstyle + 8.45.1 + + + + + validate + verify + + check + + + + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.25.0 + + ${basedir}/target/generated-sources/ + + + + run-pmd + verify + + check + + + + + + + com.github.spotbugs + spotbugs-maven-plugin + 4.8.6.4 + + spotbugs-exclusions.xml + + + com.h3xstream.findsecbugs + findsecbugs-plugin + 1.13.0 + + + + + + + com.github.spotbugs + spotbugs + 4.8.6 + + + + + run-spotbugs + verify + + check + + + + @@ -357,28 +357,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + org.apache.maven.plugins + maven-javadoc-plugin + 3.10.0 + + ${javadoc.failOnWarnings} + + **/GoFeatureFlagProviderOptions.java + + dev.openfeature.flagd.grpc,dev.openfeature.contrib.providers.gofeatureflag.exception,dev.openfeature.contrib.providers.gofeatureflag.bean + all,-missing + + + + attach-javadocs + verify + + jar + + + + diff --git a/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/MultiProvider.java b/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/MultiProvider.java index e7c174672..25f3a78ed 100644 --- a/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/MultiProvider.java +++ b/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/MultiProvider.java @@ -23,7 +23,7 @@ public class MultiProvider extends EventProvider { @Getter private static final String NAME = "multiprovider"; private final Map providers; - private final Strategy strategy; + private Strategy strategy; private String metadataName; /** @@ -43,24 +43,16 @@ public MultiProvider(List providers) { */ public MultiProvider(List providers, Strategy strategy) { this.providers = new LinkedHashMap<>(providers.size()); - JSONObject json = new JSONObject(); - json.put("name", NAME); - JSONObject providersMetadata = new JSONObject(); - json.put("originalMetadata", providersMetadata); for (FeatureProvider provider: providers) { FeatureProvider prevProvider = this.providers.put(provider.getMetadata().getName(), provider); if (prevProvider != null) { log.warn("duplicated provider name: {}", provider.getMetadata().getName()); } - JSONObject providerMetadata = new JSONObject(); - providerMetadata.put("name", provider.getMetadata().getName()); - providersMetadata.put(provider.getMetadata().getName(), providerMetadata); } - metadataName = json.toString(); - if (strategy == null) { - this.strategy = new FirstMatchStrategy(this.providers); - } else { + if (strategy != null) { this.strategy = strategy; + } else { + this.strategy = new FirstMatchStrategy(this.providers); } } @@ -71,9 +63,17 @@ public MultiProvider(List providers, Strategy strategy) { */ @Override public void initialize(EvaluationContext evaluationContext) throws Exception { + JSONObject json = new JSONObject(); + json.put("name", NAME); + JSONObject providersMetadata = new JSONObject(); + json.put("originalMetadata", providersMetadata); for (FeatureProvider provider: providers.values()) { provider.initialize(evaluationContext); + JSONObject providerMetadata = new JSONObject(); + providerMetadata.put("name", provider.getMetadata().getName()); + providersMetadata.put(provider.getMetadata().getName(), providerMetadata); } + metadataName = json.toString(); } @Override