Skip to content

Commit 8d39da6

Browse files
Merge pull request #47 from splitio/fme-10341
[FME-10341] fix vulns, update versions and add shutdown
2 parents a801da1 + a4a4c5c commit 8d39da6

File tree

7 files changed

+53
-32
lines changed

7 files changed

+53
-32
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
1.2.1 (October 6, 2025)
2+
- Updated dependencies to fix vulnerabilities.
3+
- Added support for the shutdown feature.
4+
15
1.2.0 (September 3, 2025)
26
- Updated `io.split.client` dependency to 4.16.1
37
- Updated `dev.openfeature` dependency to 1.17.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This SDK is compatible with Java 11 and higher.
1313
<dependency>
1414
<groupId>io.split.openfeature</groupId>
1515
<artifactId>split-openfeature-provider</artifactId>
16-
<version>1.2.0</version>
16+
<version>1.2.1</version>
1717
</dependency>
1818
```
1919
### Configure it

pom.xml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>io.split.openfeature</groupId>
88
<artifactId>split-openfeature-provider</artifactId>
9-
<version>1.2.0</version>
9+
<version>1.2.1</version>
1010
<name>split-openfeature-provider-java</name>
1111
<description>Split OpenFeature Java Provider</description>
1212
<url>www.split.io</url>
@@ -49,11 +49,6 @@
4949
<artifactId>java-client</artifactId>
5050
<version>4.18.1</version>
5151
</dependency>
52-
<dependency>
53-
<groupId>org.apache.httpcomponents</groupId>
54-
<artifactId>httpclient</artifactId>
55-
<version>4.5.14</version>
56-
</dependency>
5752
<dependency>
5853
<groupId>org.mockito</groupId>
5954
<artifactId>mockito-core</artifactId>
@@ -65,16 +60,6 @@
6560
<artifactId>sdk</artifactId>
6661
<version>1.18.1</version>
6762
</dependency>
68-
<dependency>
69-
<groupId>com.fasterxml.jackson.core</groupId>
70-
<artifactId>jackson-core</artifactId>
71-
<version>2.20.0</version>
72-
</dependency>
73-
<dependency>
74-
<groupId>com.fasterxml.jackson.core</groupId>
75-
<artifactId>jackson-databind</artifactId>
76-
<version>2.20.0</version>
77-
</dependency>
7863
</dependencies>
7964
<build>
8065
<pluginManagement>
@@ -85,6 +70,22 @@
8570
<artifactId>maven-clean-plugin</artifactId>
8671
<version>3.5.0</version>
8772
</plugin>
73+
<plugin>
74+
<groupId>org.owasp</groupId>
75+
<artifactId>dependency-check-maven</artifactId>
76+
<version>12.1.6</version>
77+
<configuration>
78+
<nvdApiKey>41aa3456-48f3-466a-a8ea-db1e84caba36</nvdApiKey>
79+
<failBuildOnCVSS>7</failBuildOnCVSS>
80+
</configuration>
81+
<executions>
82+
<execution>
83+
<goals>
84+
<goal>check</goal>
85+
</goals>
86+
</execution>
87+
</executions>
88+
</plugin>
8889
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
8990
<plugin>
9091
<artifactId>maven-resources-plugin</artifactId>

src/main/java/io/split/openfeature/SplitProvider.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ public Map<String, Object> transformContext(EvaluationContext context) {
158158
return context.asObjectMap();
159159
}
160160

161+
@Override
162+
public void shutdown() {
163+
client.destroy();
164+
}
165+
161166
private SplitResult evaluateTreatment(String key, EvaluationContext evaluationContext) {
162167
String id = evaluationContext.getTargetingKey();
163168
if (id == null || id.isEmpty()) {

src/main/java/io/split/openfeature/utils/Serialization.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package io.split.openfeature.utils;
22

3-
import com.fasterxml.jackson.core.JsonProcessingException;
4-
import com.fasterxml.jackson.databind.DeserializationFeature;
5-
import com.fasterxml.jackson.databind.ObjectMapper;
3+
import java.util.Map;
4+
65
import dev.openfeature.sdk.ErrorCode;
76
import dev.openfeature.sdk.exceptions.ParseError;
8-
9-
import java.util.Map;
7+
import io.split.client.utils.Json;
108

119
public class Serialization {
1210

@@ -15,10 +13,8 @@ private Serialization() {
1513

1614
public static Map<String, Object> stringToMap(final String obj) {
1715
try {
18-
return new ObjectMapper()
19-
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
20-
.readValue(obj, Map.class);
21-
} catch (JsonProcessingException e) {
16+
return Json.fromJson(obj, Map.class);
17+
} catch (Exception e) {
2218
throw new ParseError(ErrorCode.PARSE_ERROR.name());
2319
}
2420
}

src/test/java/io/split/openfeature/ClientTest.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@
3030
public class ClientTest {
3131
OpenFeatureAPI openFeatureAPI;
3232
Client client;
33+
SplitClient splitClient;
3334

3435
@BeforeEach
3536
public void init() {
3637
openFeatureAPI = OpenFeatureAPI.getInstance();
3738
try {
3839
SplitClientConfig config = SplitClientConfig.builder().splitFile("src/test/resources/split.yaml").build();
39-
SplitClient client = SplitFactoryBuilder.build("localhost", config).client();
40-
openFeatureAPI.setProviderAndWait(new SplitProvider(client));
40+
splitClient = SplitFactoryBuilder.build("localhost", config).client();
41+
openFeatureAPI.setProviderAndWait(new SplitProvider(splitClient));
4142
} catch (URISyntaxException | IOException e) {
4243
System.out.println("Unexpected Exception occurred initializing Split Provider.");
4344
}
@@ -267,6 +268,13 @@ public void getObjectFailTest() {
267268
assertNull(details.getVariant());
268269
}
269270

271+
@Test
272+
public void destroySplitClientTest() {
273+
assertEquals("32", splitClient.getTreatment("key","int_feature"));
274+
openFeatureAPI.shutdown();
275+
assertEquals("control", splitClient.getTreatment("key","int_feature"));
276+
}
277+
270278
private Value mapToValue(Map<String, Value> map) {
271279
return new Value(new MutableStructure(map));
272280
}

src/test/java/io/split/openfeature/SplitProviderTest.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,23 +420,23 @@ public void evalStructureComplexTest() {
420420
Instant instant = Instant.ofEpochMilli(1665698754828L);
421421
Value treatment = mapToValue(Map.of(
422422
"string", new Value("blah"),
423-
"int", new Value(10),
423+
"int", new Value(10D),
424424
"double", new Value(100D),
425425
"bool", new Value(true),
426426
"struct", mapToValue(Map.of(
427427
"foo", new Value("bar"),
428-
"baz", new Value(10),
428+
"baz", new Value(10D),
429429
"innerMap", mapToValue(Map.of(
430430
"aa", new Value("bb"))))),
431431
"list", new Value(
432432
List.of(
433-
new Value(1),
433+
new Value(1D),
434434
new Value(true),
435435
mapToValue(Map.of(
436436
"cc", new Value("dd")
437437
)),
438438
mapToValue(Map.of(
439-
"ee", new Value(1)
439+
"ee", new Value(1D)
440440
)))),
441441
"dateTime", new Value(instant)
442442
));
@@ -525,6 +525,13 @@ public void trackTrafficTypeErrorTest() {
525525
verifyNoInteractions(mockSplitClient);
526526
}
527527

528+
@Test
529+
public void destroySplitClientTest() {
530+
SplitProvider provider = new SplitProvider(mockSplitClient);
531+
provider.shutdown();
532+
verify(mockSplitClient).destroy();
533+
}
534+
528535
private Value mapToValue(Map<String, Value> map) {
529536
return new Value(new MutableStructure(map));
530537
}

0 commit comments

Comments
 (0)