From a85dac76fb12c88f989695b2be8d314b87d1ecff Mon Sep 17 00:00:00 2001 From: Michael Ng Date: Fri, 21 Sep 2018 15:54:29 -0700 Subject: [PATCH] chore: Prepare release branch for new release (#216) --- .travis.yml | 2 +- CHANGELOG.md | 7 +++++++ .../optimizely/ab/event/internal/EventFactory.java | 14 +++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 74d2f7d2d..3417e7f91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,6 @@ cache: branches: only: - master - - /^\d+\.\d+\.\d+(-SNAPSHOT|-alpha|-beta)?\d*$/ # trigger builds on tags which are semantically versioned to ship the SDK. + - /^\d+\.\d+\.(\d|[x])+(-SNAPSHOT|-alpha|-beta)?\d*$/ # trigger builds on tags which are semantically versioned to ship the SDK. after_success: - ./gradlew coveralls uploadArchives --console plain diff --git a/CHANGELOG.md b/CHANGELOG.md index 9953b3252..1df840831 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Optimizely Java X SDK Changelog +## 2.1.3 + +September 21st, 2018 + +### Bug Fixes +* fix(attributes): Filters out attributes with null values from the event payload ([#204](https://github.com/optimizely/java-sdk/pull/204)) + ## 2.1.2 August 1st, 2018 diff --git a/core-api/src/main/java/com/optimizely/ab/event/internal/EventFactory.java b/core-api/src/main/java/com/optimizely/ab/event/internal/EventFactory.java index a7aedda50..ad32a229a 100644 --- a/core-api/src/main/java/com/optimizely/ab/event/internal/EventFactory.java +++ b/core-api/src/main/java/com/optimizely/ab/event/internal/EventFactory.java @@ -167,7 +167,19 @@ public LogEvent createConversionEvent(@Nonnull ProjectConfig projectConfig, private List buildAttributeList(ProjectConfig projectConfig, Map attributes) { List attributesList = new ArrayList(); - for (Map.Entry entry : attributes.entrySet()) { + for (Map.Entry entry : attributes.entrySet()) { + // Filter down to the types of values we're allowed to track. + // Don't allow Longs, BigIntegers, or BigDecimals - they /can/ theoretically be serialized as JSON numbers + // but may take on values that can't be faithfully parsed by the backend. + // https://developers.optimizely.com/x/events/api/#Attribute + if (entry.getValue() == null || + !((entry.getValue() instanceof String) || + (entry.getValue() instanceof Integer) || + (entry.getValue() instanceof Double) || + (entry.getValue() instanceof Boolean))) { + continue; + } + String attributeId = projectConfig.getAttributeId(projectConfig, entry.getKey()); if(attributeId == null) { continue;