Skip to content

Commit 74f7e83

Browse files
authored
Merge branch 'main' into chore/remove-unecessary-versions
2 parents cf3ad99 + 4dc988b commit 74f7e83

File tree

6 files changed

+39
-19
lines changed

6 files changed

+39
-19
lines changed

.github/workflows/lint-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
name: Validate PR title
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: amannn/action-semantic-pull-request@04501d43b574e4c1d23c629ffe4dcec27acfdeff
21+
- uses: amannn/action-semantic-pull-request@335288255954904a41ddda8947c8f2c844b8bfeb
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pullrequest.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ jobs:
1313
build:
1414
- java: 17
1515
profile: codequality
16-
- java: 8
17-
profile: java8
16+
- java: 11
17+
profile: java11
1818
name: with Java ${{ matrix.build.java }}
1919
runs-on: ${{ matrix.os}}
2020
steps:
2121
- name: Check out the code
2222
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2
2323

24-
- name: Set up JDK 8
24+
- name: Set up JDK 11
2525
uses: actions/setup-java@f4f1212c880fdec8162ea9a6493f4495191887b4
2626
with:
2727
java-version: ${{ matrix.build.java }}
2828
distribution: 'temurin'
2929
cache: maven
3030

3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@f843d94177a3bba7c0d0366e9bb9ff7de65547a9
32+
uses: github/codeql-action/init@5eb3ed6614230b1931d5c08df9e096e4ba524f21
3333
with:
3434
languages: java
3535

@@ -55,4 +55,4 @@ jobs:
5555
verbose: true # optional (default = false)
5656

5757
- name: Perform CodeQL Analysis
58-
uses: github/codeql-action/analyze@f843d94177a3bba7c0d0366e9bb9ff7de65547a9
58+
uses: github/codeql-action/analyze@5eb3ed6614230b1931d5c08df9e096e4ba524f21

.github/workflows/static-code-scanning.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ jobs:
3333

3434
# Initializes the CodeQL tools for scanning.
3535
- name: Initialize CodeQL
36-
uses: github/codeql-action/init@f843d94177a3bba7c0d0366e9bb9ff7de65547a9
36+
uses: github/codeql-action/init@5eb3ed6614230b1931d5c08df9e096e4ba524f21
3737
with:
3838
languages: java
3939

4040
- name: Autobuild
41-
uses: github/codeql-action/autobuild@f843d94177a3bba7c0d0366e9bb9ff7de65547a9
41+
uses: github/codeql-action/autobuild@5eb3ed6614230b1931d5c08df9e096e4ba524f21
4242

4343
- name: Perform CodeQL Analysis
44-
uses: github/codeql-action/analyze@f843d94177a3bba7c0d0366e9bb9ff7de65547a9
44+
uses: github/codeql-action/analyze@5eb3ed6614230b1931d5c08df9e096e4ba524f21

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
### Requirements
4848

49-
- Java 8+ (compiler target is 1.8)
49+
- Java 11+ (compiler target is 11)
5050

5151
Note that this library is intended to be used in server-side contexts and has not been evaluated for use on mobile devices.
5252

@@ -104,7 +104,12 @@ public void example(){
104104

105105
// configure a provider
106106
OpenFeatureAPI api = OpenFeatureAPI.getInstance();
107-
api.setProviderAndWait(new InMemoryProvider(myFlags));
107+
try {
108+
api.setProviderAndWait(new InMemoryProvider(myFlags));
109+
} catch (Exception e) {
110+
// handle initialization failure
111+
e.printStackTrace();
112+
}
108113

109114
// create a client
110115
Client client = api.getClient();
@@ -149,7 +154,12 @@ To register a provider in a blocking manner to ensure it is ready before further
149154

150155
```java
151156
OpenFeatureAPI api = OpenFeatureAPI.getInstance();
152-
api.setProviderAndWait(new MyProvider());
157+
try {
158+
api.setProviderAndWait(new MyProvider());
159+
} catch (Exception e) {
160+
// handle initialization failure
161+
e.printStackTrace();
162+
}
153163
```
154164

155165
#### Asynchronous

pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
<properties>
1111
<toolchain.jdk.version>[17,)</toolchain.jdk.version>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13-
<maven.compiler.source>1.8</maven.compiler.source>
13+
<maven.compiler.source>11</maven.compiler.source>
1414
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
1515
<org.mockito.version>5.17.0</org.mockito.version>
1616
<!-- exclusion expression for e2e tests -->
1717
<testExclusions>**/e2e/*.java</testExclusions>
1818
<module-name>${project.groupId}.${project.artifactId}</module-name>
1919
<skip.tests>false</skip.tests>
2020
<!-- this will throw an error if we use wrong apis -->
21-
<maven.compiler.release>8</maven.compiler.release>
21+
<maven.compiler.release>11</maven.compiler.release>
2222
</properties>
2323

2424
<name>OpenFeature Java SDK</name>
@@ -636,14 +636,14 @@
636636
</plugins>
637637
</build>
638638
</profile>
639-
<!-- profile for running tests under java 8 (used mostly in CI) -->
640-
<!-- selected automatically by JDK activeation (see https://maven.apache.org/guides/introduction/introduction-to-profiles.html#implicit-profile-activation) -->
639+
<!-- profile for running tests under java 11 (used mostly in CI) -->
640+
<!-- selected automatically by JDK activation (see https://maven.apache.org/guides/introduction/introduction-to-profiles.html#implicit-profile-activation) -->
641641
<profile>
642-
<id>java8</id>
642+
<id>java11</id>
643643
<!-- with the next block we can define a set of sdks which still support java 8, if any of the sdks is not supporting java 8 anymore -->
644644
<!--<modules><module></module></modules>-->
645645
<properties>
646-
<toolchain.jdk.version>(1.8,9)</toolchain.jdk.version>
646+
<toolchain.jdk.version>[11,)</toolchain.jdk.version>
647647
<skip.tests>true</skip.tests>
648648
</properties>
649649

src/main/java/dev/openfeature/sdk/OpenFeatureAPI.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,13 @@ public void setProvider(String domain, FeatureProvider provider) {
207207
}
208208

209209
/**
210-
* Set the default provider and wait for initialization to finish.
210+
* Sets the default provider and waits for its initialization to complete.
211+
*
212+
* <p>Note: If the provider fails during initialization, an {@link OpenFeatureError} will be thrown.
213+
* It is recommended to wrap this call in a try-catch block to handle potential initialization failures gracefully.
214+
*
215+
* @param provider the {@link FeatureProvider} to set as the default.
216+
* @throws OpenFeatureError if the provider fails during initialization.
211217
*/
212218
public void setProviderAndWait(FeatureProvider provider) throws OpenFeatureError {
213219
try (AutoCloseableLock __ = lock.writeLockAutoCloseable()) {
@@ -224,8 +230,12 @@ public void setProviderAndWait(FeatureProvider provider) throws OpenFeatureError
224230
/**
225231
* Add a provider for a domain and wait for initialization to finish.
226232
*
233+
* <p>Note: If the provider fails during initialization, an {@link OpenFeatureError} will be thrown.
234+
* It is recommended to wrap this call in a try-catch block to handle potential initialization failures gracefully.
235+
*
227236
* @param domain The domain to bind the provider to.
228237
* @param provider The provider to set.
238+
* @throws OpenFeatureError if the provider fails during initialization.
229239
*/
230240
public void setProviderAndWait(String domain, FeatureProvider provider) throws OpenFeatureError {
231241
try (AutoCloseableLock __ = lock.writeLockAutoCloseable()) {

0 commit comments

Comments
 (0)