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
Show all changes
79 commits
Select commit Hold shift + click to select a range
3d95d43
don't give up permanently after a 400 error
eli-darkly Jun 28, 2018
8e2af3a
Merge pull request #77 from launchdarkly/eb/ch19705/400-error
eli-darkly Jun 28, 2018
398202a
implement evaluation with explanation
eli-darkly Jun 29, 2018
8abe79c
use case-class-like type instead of enum + optional fields
eli-darkly Jun 29, 2018
1874e20
fix tests
eli-darkly Jun 29, 2018
e694ab4
misc refactoring & tests
eli-darkly Jun 30, 2018
d692bb3
don't need array index
eli-darkly Jun 30, 2018
9eb8b34
stop using deprecated TestFeatureStore in tests
eli-darkly Jun 30, 2018
afdb396
add brief Java compatibility note to readme
eli-darkly Jul 3, 2018
7520d9e
Merge pull request #79 from launchdarkly/eb/ch19355/readme-java-version
eli-darkly Jul 3, 2018
84efc77
Merge branch 'master' into eb/ch19787/explanation
eli-darkly Jul 3, 2018
d28a57f
Merge branch 'eb/ch19787/explanation' into eb/test-cleanup
eli-darkly Jul 3, 2018
827bb36
Merge pull request #78 from launchdarkly/eb/ch19787/explanation
eli-darkly Jul 9, 2018
935c514
Merge pull request #80 from launchdarkly/eb/test-cleanup
eli-darkly Jul 9, 2018
b9e0634
avoid unnecessary retry after Redis update
eli-darkly Jul 14, 2018
cca7d78
Merge pull request #81 from launchdarkly/eb/ch20410/extra-update
eli-darkly Jul 14, 2018
e4d155c
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Jul 17, 2018
992408f
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Jul 19, 2018
742514e
fix javadoc errors
eli-darkly Jul 20, 2018
b388b63
include explanations, if requested, in full feature request events
eli-darkly Jul 20, 2018
64fe12e
add unit test for reason property in full feature event
eli-darkly Jul 20, 2018
ebfb18a
add javadoc note about reasons in events
eli-darkly Jul 20, 2018
fd1b8d9
Merge pull request #82 from launchdarkly/eb/ch19787/explanations-in-e…
eli-darkly Jul 20, 2018
4810c14
add unit test to verify that the reason object can return a non-zero …
eli-darkly Aug 13, 2018
52951a8
always include ruleIndex in toString()
eli-darkly Aug 14, 2018
fa5df96
make sure kind property gets serialized to JSON
eli-darkly Aug 14, 2018
849f085
version 4.3.0-SNAPSHOT
eli-darkly Aug 14, 2018
2bae5ab
better error logging practices
eli-darkly Aug 16, 2018
361849c
add new version of allFlags() that captures more metadata
eli-darkly Aug 16, 2018
e3cfe15
Merge pull request #84 from launchdarkly/eb/ch22265/error-logging
eli-darkly Aug 16, 2018
1889fb5
clarify comment
eli-darkly Aug 16, 2018
1bcc8a3
Merge branch 'master' into eb/ch21386/all-flags-state-without-reasons
eli-darkly Aug 16, 2018
a4a5695
remove FOSSA upload step from CI
eli-darkly Aug 16, 2018
cc42ed6
Merge pull request #86 from launchdarkly/eb/disable-fossa
eli-darkly Aug 16, 2018
e4ae9cb
add evaluation reasons to allFlagsState()
eli-darkly Aug 16, 2018
de8b9e7
Merge branch 'master' into explanation
eli-darkly Aug 16, 2018
80f7197
Merge branch 'explanation' into eb/ch21386/all-flags-state-with-reasons
eli-darkly Aug 16, 2018
7e91572
rm duplicated test
eli-darkly Aug 16, 2018
a0dcfa7
add error explanation for malformed flags
eli-darkly Aug 16, 2018
712bed4
add tests for more error conditions
eli-darkly Aug 16, 2018
564db86
change options to be more enum-like
eli-darkly Aug 17, 2018
e29c2e0
version 4.2.2 (#88)
eli-darkly Aug 17, 2018
91f9cb2
add option to select only client-side flags in allFlagsState()
eli-darkly Aug 17, 2018
b0f034e
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Aug 17, 2018
a060bcc
fix comment
eli-darkly Aug 17, 2018
8939c8b
serialize FeatureFlagsState to a JsonElement, not a string
eli-darkly Aug 20, 2018
78611fb
rm unused import
eli-darkly Aug 20, 2018
8200e44
edit comment
eli-darkly Aug 20, 2018
bb20933
use custom Gson serializer
eli-darkly Aug 21, 2018
b82f58b
Merge branch 'eb/ch21386/all-flags-state-without-reasons' into eb/ch1…
eli-darkly Aug 21, 2018
20b2914
Merge pull request #85 from launchdarkly/eb/ch21386/all-flags-state-w…
eli-darkly Aug 22, 2018
190cdb9
add tests for JSON serialization of evaluation reasons
eli-darkly Aug 22, 2018
e90f90b
Merge pull request #87 from launchdarkly/eb/malformed-flag-error
eli-darkly Aug 22, 2018
bc5033a
Merge pull request #89 from launchdarkly/eb/ch12124/filter-client-sid…
eli-darkly Aug 22, 2018
b8b6a5b
Merge branch 'all-flags-state' into explanation
eli-darkly Aug 22, 2018
e35d149
Merge branch 'explanation' into eb/ch21386/all-flags-state-with-reasons
eli-darkly Aug 22, 2018
38f01cc
Merge branch 'explanation' into eb/reason-json-tests
eli-darkly Aug 22, 2018
8f90c71
misc cleanup
eli-darkly Aug 23, 2018
ccaddda
don't keep evaluating prerequisites if one fails
eli-darkly Aug 23, 2018
1d20039
Merge branch 'eb/single-prereq-failure' into eb/reason-json-tests
eli-darkly Aug 23, 2018
9a00c07
avoid some inappropriate uses of Guava's ImmutableMap
eli-darkly Aug 23, 2018
d026e18
make map & set in the User immutable
eli-darkly Aug 23, 2018
18ed2d6
fix default value logic
eli-darkly Aug 24, 2018
ab503e8
Merge pull request #94 from launchdarkly/eb/default-values
eli-darkly Aug 25, 2018
1de786b
Merge pull request #93 from launchdarkly/eb/immutable-maps
eli-darkly Aug 25, 2018
e9a31d0
Merge branch 'all-flags-state' into eb/ch21386/all-flags-state-with-r…
eli-darkly Aug 25, 2018
7de5305
Merge pull request #92 from launchdarkly/eb/single-prereq-failure
eli-darkly Aug 25, 2018
001f2e3
Merge pull request #91 from launchdarkly/eb/reason-json-tests
eli-darkly Aug 25, 2018
648a2e6
Merge pull request #90 from launchdarkly/eb/ch21386/all-flags-state-w…
eli-darkly Aug 25, 2018
4b98e50
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Aug 27, 2018
d21466c
javadoc fix
eli-darkly Aug 27, 2018
98cb3a6
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Aug 27, 2018
e0a41a5
make LDUser serialize correctly as JSON and add more test coverage
eli-darkly Aug 29, 2018
6abbb22
preserve prerequisite flag value in event even if flag was off
eli-darkly Aug 29, 2018
c18a1e1
more test coverage for requesting values of different types
eli-darkly Aug 29, 2018
aa38e77
Merge pull request #95 from launchdarkly/eb/ch22890/user-json
eli-darkly Sep 4, 2018
61effc7
Merge pull request #96 from launchdarkly/eb/ch22995/prereq-off
eli-darkly Sep 4, 2018
897aa62
Merge pull request #97 from launchdarkly/eb/ch23009/numeric-types
eli-darkly Sep 4, 2018
982572f
version 4.3.1
eli-darkly Sep 4, 2018
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

All notable changes to the LaunchDarkly Java SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).

## [4.3.1] - 2018-09-04
### Fixed:
- When evaluating a prerequisite feature flag, the analytics event for the evaluation did not include the result value if the prerequisite flag was off.
- The default Gson serialization for `LDUser` now includes all user properties. Previously, it omitted `privateAttributeNames`.

## [4.3.0] - 2018-08-27
### Added:
- The new `LDClient` method `allFlagsState()` should be used instead of `allFlags()` if you are passing flag data to the front end for use with the JavaScript SDK. It preserves some flag metadata that the front end requires in order to send analytics events correctly. Versions 2.5.0 and above of the JavaScript SDK are able to use this metadata, but the output of `allFlagsState()` will still work with older versions.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=4.3.0
version=4.3.1
ossrhUsername=
ossrhPassword=
26 changes: 11 additions & 15 deletions src/main/java/com/launchdarkly/client/FeatureFlag.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ EvalResult evaluate(LDUser user, FeatureStore featureStore, EventFactory eventFa
return new EvalResult(EvaluationDetail.<JsonElement>error(EvaluationReason.ErrorKind.USER_NOT_SPECIFIED, null), prereqEvents);
}

if (isOn()) {
EvaluationDetail<JsonElement> details = evaluate(user, featureStore, prereqEvents, eventFactory);
return new EvalResult(details, prereqEvents);
}

return new EvalResult(getOffValue(EvaluationReason.off()), prereqEvents);
EvaluationDetail<JsonElement> details = evaluate(user, featureStore, prereqEvents, eventFactory);
return new EvalResult(details, prereqEvents);
}

private EvaluationDetail<JsonElement> evaluate(LDUser user, FeatureStore featureStore, List<Event.FeatureRequest> events,
EventFactory eventFactory) {
if (!isOn()) {
return getOffValue(EvaluationReason.off());
}

EvaluationReason prereqFailureReason = checkPrerequisites(user, featureStore, events, eventFactory);
if (prereqFailureReason != null) {
return getOffValue(prereqFailureReason);
Expand Down Expand Up @@ -123,20 +123,16 @@ private EvaluationReason checkPrerequisites(LDUser user, FeatureStore featureSto
boolean prereqOk = true;
Prerequisite prereq = prerequisites.get(i);
FeatureFlag prereqFeatureFlag = featureStore.get(FEATURES, prereq.getKey());
EvaluationDetail<JsonElement> prereqEvalResult = null;
if (prereqFeatureFlag == null) {
logger.error("Could not retrieve prerequisite flag \"{}\" when evaluating \"{}\"", prereq.getKey(), key);
prereqOk = false;
} else if (prereqFeatureFlag.isOn()) {
prereqEvalResult = prereqFeatureFlag.evaluate(user, featureStore, events, eventFactory);
if (prereqEvalResult == null || prereqEvalResult.getVariationIndex() != prereq.getVariation()) {
} else {
EvaluationDetail<JsonElement> prereqEvalResult = prereqFeatureFlag.evaluate(user, featureStore, events, eventFactory);
// Note that if the prerequisite flag is off, we don't consider it a match no matter what its
// off variation was. But we still need to evaluate it in order to generate an event.
if (!prereqFeatureFlag.isOn() || prereqEvalResult == null || prereqEvalResult.getVariationIndex() != prereq.getVariation()) {
prereqOk = false;
}
} else {
prereqOk = false;
}
// We continue to evaluate all prerequisites even if one failed.
if (prereqFeatureFlag != null) {
events.add(eventFactory.newPrerequisiteFeatureRequestEvent(prereqFeatureFlag, user, prereqEvalResult, this));
}
if (!prereqOk) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/launchdarkly/client/LDConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
public final class LDConfig {
private static final Logger logger = LoggerFactory.getLogger(LDConfig.class);
final Gson gson = new GsonBuilder().registerTypeAdapter(LDUser.class, new LDUser.UserAdapter(this)).create();
final Gson gson = new GsonBuilder().registerTypeAdapter(LDUser.class, new LDUser.UserAdapterWithPrivateAttributeBehavior(this)).create();

private static final URI DEFAULT_BASE_URI = URI.create("https://app.launchdarkly.com");
private static final URI DEFAULT_EVENTS_URI = URI.create("https://events.launchdarkly.com");
Expand Down
Loading