-
Notifications
You must be signed in to change notification settings - Fork 4
Conversation
base copyOnWrite*Attributes on respective objects nullability otherwise they will not be initialized causing NPE
@@ -380,8 +380,8 @@ ContextBuilder copyFrom(LDContext context) { | |||
anonymous = context.isAnonymous(); | |||
attributes = context.attributes; | |||
privateAttributes = context.privateAttributes; | |||
copyOnWriteAttributes = true; | |||
copyOnWritePrivateAttributes = true; | |||
copyOnWriteAttributes = context.attributes != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Objects.nonNull(context.attributes)
@pedroafonsodias, thank you for bringing this to our attention. Could you provide steps/pseudocode for reproducing the NPE. |
Using springboot to create a default context and when reusing it to customize a new context it will fail unless we specify a dummy attribute when creating the initial I have added a test in the mean time. |
@pedroafonsodias, approved but going to take a bit more time making sure there are no adverse consequences that others may have already been accounting for in production. Thank you for your contribution! |
Any ETA when this is going to be released? |
Working on releasing today. |
## [2.1.1] - 2023-11-13 ### Fixed: - Fixes NPE when interacting with Context created by use of `copyFrom`. (Thanks, [ pedroafonsodias](#15)) --------- Co-authored-by: Pedro Dias <pedroafonsodias@gmail.com> Co-authored-by: Todd Anderson <127344469+tanderson-ld@users.noreply.github.com>
@pedroafonsodias and @driverpt , what versions of the Java Server SDK are you using? |
5.10, very old versions. We detected this while upgrading to the latest version |
## [1.2.1] - 2023-11-13 ### Fixed: - Fixes NPE when interacting with Context created by use of `copyFrom`. (Thanks, [ pedroafonsodias](launchdarkly/java-sdk-common#15)) --------- Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Todd Anderson <tanderson@launchdarkly.com> Co-authored-by: tanderson-ld <127344469+tanderson-ld@users.noreply.github.com> Co-authored-by: ld-repository-standards[bot] <113625520+ld-repository-standards[bot]@users.noreply.github.com> Co-authored-by: Kane Parkinson <93555788+kparkinson-ld@users.noreply.github.com> Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
## [7.1.1] - 2023-11-14 ### Fixed: - Fixes NPE when interacting with Context created by copying. (Thanks, [ pedroafonsodias](launchdarkly/java-sdk-common#15)) --------- Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Alex Engelberg <aengelberg@launchdarkly.com> Co-authored-by: Anton Mostovoy <anton@mostovoy.net> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: LaunchDarklyCI <LaunchDarklyCI@users.noreply.github.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: ssrm <ssrm@users.noreply.github.com> Co-authored-by: Harpo Roeder <hroeder@launchdarkly.com> Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Elliot <35050275+Apache-HB@users.noreply.github.com> Co-authored-by: Robert J. Neal <rneal@launchdarkly.com> Co-authored-by: Robert J. Neal <robertjneal@users.noreply.github.com> Co-authored-by: Sam Stokes <sstokes@launchdarkly.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com> Co-authored-by: Alex Engelberg <alex.benjamin.engelberg@gmail.com> Co-authored-by: Louis Chan <lchan@launchdarkly.com> Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com> Co-authored-by: Todd Anderson <tanderson@launchdarkly.com> Co-authored-by: tanderson-ld <127344469+tanderson-ld@users.noreply.github.com> Co-authored-by: Matthew M. Keeler <mkeeler@launchdarkly.com> Co-authored-by: ld-repository-standards[bot] <113625520+ld-repository-standards[bot]@users.noreply.github.com> Co-authored-by: Kane Parkinson <93555788+kparkinson-ld@users.noreply.github.com> Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Should now be available in Java Server SDK 7.1.1. May still be propagating through package managers. |
**Related issues** This fix never propagated into the Android SDK and another customer reported it. launchdarkly/java-sdk-common#15
base
copyOnWrite*Attributes
on respective objects nullability otherwise they will not be initialized causingNPE