@@ -17,7 +17,7 @@ public class OpenFeatureClient implements Client {
17
17
@ Getter private final String name ;
18
18
@ Getter private final String version ;
19
19
@ 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 );
21
21
22
22
public OpenFeatureClient (OpenFeatureAPI openFeatureAPI , String name , String version ) {
23
23
this .openfeatureApi = openFeatureAPI ;
@@ -33,6 +33,9 @@ public void registerHooks(Hook... hooks) {
33
33
34
34
private <T > FlagEvaluationDetails <T > evaluateFlag (FlagValueType type , String key , T defaultValue , EvaluationContext ctx , FlagEvaluationOptions options ) {
35
35
FeatureProvider provider = this .openfeatureApi .getProvider ();
36
+ if (ctx == null ) {
37
+ ctx = new EvaluationContext ();
38
+ }
36
39
// TODO: Context transformation?
37
40
HookContext hookCtx = HookContext .from (key , type , this , ctx , defaultValue );
38
41
@@ -67,7 +70,7 @@ private <T> FlagEvaluationDetails<T> evaluateFlag(FlagValueType type, String key
67
70
}
68
71
details .value = defaultValue ;
69
72
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.
71
74
details .errorCode = ((OpenFeatureError ) e ).getErrorCode ();
72
75
} else {
73
76
details .errorCode = ErrorCode .GENERAL ;
@@ -116,7 +119,7 @@ public Boolean getBooleanValue(String key, Boolean defaultValue, EvaluationConte
116
119
117
120
@ Override
118
121
public FlagEvaluationDetails <Boolean > getBooleanDetails (String key , Boolean defaultValue ) {
119
- return getBooleanDetails (key , defaultValue , null , null );
122
+ return getBooleanDetails (key , defaultValue , new EvaluationContext () );
120
123
}
121
124
122
125
@ Override
@@ -146,12 +149,12 @@ public String getStringValue(String key, String defaultValue, EvaluationContext
146
149
147
150
@ Override
148
151
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 () );
150
153
}
151
154
152
155
@ Override
153
156
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 );
155
158
}
156
159
157
160
@ Override
@@ -176,12 +179,12 @@ public Integer getIntegerValue(String key, Integer defaultValue, EvaluationConte
176
179
177
180
@ Override
178
181
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 () );
180
183
}
181
184
182
185
@ Override
183
186
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 );
185
188
}
186
189
187
190
@ Override
0 commit comments