Skip to content

Commit 6121daa

Browse files
committed
Build working
1 parent 5b396ce commit 6121daa

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

lib/src/main/java/javasdk/OpenFeatureClient.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class OpenFeatureClient implements Client {
1717
@Getter private final String name;
1818
@Getter private final String version;
1919
@Getter private final List<Hook> clientHooks;
20-
private final Logger log = LoggerFactory.getLogger(OpenFeatureClient.class);
20+
private static final Logger log = LoggerFactory.getLogger(OpenFeatureClient.class);
2121

2222
public OpenFeatureClient(OpenFeatureAPI openFeatureAPI, String name, String version) {
2323
this.openfeatureApi = openFeatureAPI;
@@ -33,6 +33,9 @@ public void registerHooks(Hook... hooks) {
3333

3434
private <T> FlagEvaluationDetails<T> evaluateFlag(FlagValueType type, String key, T defaultValue, EvaluationContext ctx, FlagEvaluationOptions options) {
3535
FeatureProvider provider = this.openfeatureApi.getProvider();
36+
if (ctx == null) {
37+
ctx = new EvaluationContext();
38+
}
3639
// TODO: Context transformation?
3740
HookContext hookCtx = HookContext.from(key, type, this, ctx, defaultValue);
3841

@@ -67,7 +70,7 @@ private <T> FlagEvaluationDetails<T> evaluateFlag(FlagValueType type, String key
6770
}
6871
details.value = defaultValue;
6972
details.reason = Reason.ERROR;
70-
if (e instanceof OpenFeatureError) {
73+
if (e instanceof OpenFeatureError) { //NOPMD - suppressed AvoidInstanceofChecksInCatchClause - Don't want to duplicate detail creation logic.
7174
details.errorCode = ((OpenFeatureError) e).getErrorCode();
7275
} else {
7376
details.errorCode = ErrorCode.GENERAL;
@@ -116,7 +119,7 @@ public Boolean getBooleanValue(String key, Boolean defaultValue, EvaluationConte
116119

117120
@Override
118121
public FlagEvaluationDetails<Boolean> getBooleanDetails(String key, Boolean defaultValue) {
119-
return getBooleanDetails(key, defaultValue, null, null);
122+
return getBooleanDetails(key, defaultValue, new EvaluationContext());
120123
}
121124

122125
@Override
@@ -146,12 +149,12 @@ public String getStringValue(String key, String defaultValue, EvaluationContext
146149

147150
@Override
148151
public FlagEvaluationDetails<String> getStringDetails(String key, String defaultValue) {
149-
return this.evaluateFlag(FlagValueType.STRING, key, defaultValue, null, null);
152+
return getStringDetails(key, defaultValue, new EvaluationContext());
150153
}
151154

152155
@Override
153156
public FlagEvaluationDetails<String> getStringDetails(String key, String defaultValue, EvaluationContext ctx) {
154-
return this.evaluateFlag(FlagValueType.STRING, key, defaultValue, ctx, null);
157+
return getStringDetails(key, defaultValue, new EvaluationContext(), null);
155158
}
156159

157160
@Override
@@ -176,12 +179,12 @@ public Integer getIntegerValue(String key, Integer defaultValue, EvaluationConte
176179

177180
@Override
178181
public FlagEvaluationDetails<Integer> getIntegerDetails(String key, Integer defaultValue) {
179-
return this.evaluateFlag(FlagValueType.INTEGER, key, defaultValue, null, null);
182+
return getIntegerDetails(key, defaultValue, new EvaluationContext());
180183
}
181184

182185
@Override
183186
public FlagEvaluationDetails<Integer> getIntegerDetails(String key, Integer defaultValue, EvaluationContext ctx) {
184-
return this.evaluateFlag(FlagValueType.INTEGER, key, defaultValue, ctx, null);
187+
return getIntegerDetails(key, defaultValue, new EvaluationContext(), null);
185188
}
186189

187190
@Override

lib/src/test/java/javasdk/AlwaysBrokenProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package javasdk;
22

3-
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
43

54
public class AlwaysBrokenProvider implements FeatureProvider {
65
@Override

lib/src/test/java/javasdk/FlagEvaluationSpecTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import org.junit.jupiter.api.Disabled;
44
import org.junit.jupiter.api.Test;
5-
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
65

76
import java.util.List;
87

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package javasdk;
2+
3+
public class NotImplementedException extends RuntimeException {
4+
5+
private static final long serialVersionUID = 1L;
6+
7+
public NotImplementedException(){}
8+
}

0 commit comments

Comments
 (0)