Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ LaunchDarkly SDK for Java
[![Javadocs](http://javadoc.io/badge/com.launchdarkly/launchdarkly-client.svg)](http://javadoc.io/doc/com.launchdarkly/launchdarkly-client)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Flaunchdarkly%2Fjava-client.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Flaunchdarkly%2Fjava-client?ref=badge_shield)

Supported Java versions
-----------------------

This version of the LaunchDarkly SDK works with Java 7 and above.

Quick setup
-----------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ private <T extends VersionedData> void updateItemWithVersioning(VersionedDataKin
if (cache != null) {
cache.invalidate(new CacheKey(kind, newItem.getKey()));
}
return;
} finally {
if (jedis != null) {
jedis.unwatch();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/launchdarkly/client/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static Request.Builder getRequestBuilder(String sdkKey) {
static boolean isHttpErrorRecoverable(int statusCode) {
if (statusCode >= 400 && statusCode < 500) {
switch (statusCode) {
case 400: // bad request
case 408: // request timeout
case 429: // too many requests
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@ public void sdkKeyIsSent() throws Exception {
assertThat(req.getHeader("Authorization"), equalTo(SDK_KEY));
}

@Test
public void http400ErrorIsRecoverable() throws Exception {
testRecoverableHttpError(400);
}

@Test
public void http401ErrorIsUnrecoverable() throws Exception {
testUnrecoverableHttpError(401);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public void testConnectionProblem() throws Exception {
pollingProcessor.close();
verifyAll();
}

@Test
public void http400ErrorIsRecoverable() throws Exception {
testRecoverableHttpError(400);
}

@Test
public void http401ErrorIsUnrecoverable() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ public void streamWillReconnectAfterGeneralIOException() throws Exception {
ConnectionErrorHandler.Action action = errorHandler.onConnectionError(new IOException());
assertEquals(ConnectionErrorHandler.Action.PROCEED, action);
}

@Test
public void http400ErrorIsRecoverable() throws Exception {
testRecoverableHttpError(400);
}

@Test
public void http401ErrorIsUnrecoverable() throws Exception {
Expand Down