-
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 <[email protected]> Co-authored-by: Todd Anderson <[email protected]>
@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 <[email protected]> Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Todd Anderson <[email protected]> Co-authored-by: tanderson-ld <[email protected]> Co-authored-by: ld-repository-standards[bot] <113625520+ld-repository-standards[bot]@users.noreply.github.com> Co-authored-by: Kane Parkinson <[email protected]> Co-authored-by: Ryan Lamb <[email protected]>
## [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 <[email protected]> Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Alex Engelberg <[email protected]> Co-authored-by: Anton Mostovoy <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: Gavin Whelan <[email protected]> Co-authored-by: ssrm <[email protected]> Co-authored-by: Harpo Roeder <[email protected]> Co-authored-by: Ben Woskow <[email protected]> Co-authored-by: Elliot <[email protected]> Co-authored-by: Robert J. Neal <[email protected]> Co-authored-by: Robert J. Neal <[email protected]> Co-authored-by: Sam Stokes <[email protected]> Co-authored-by: Ember Stevens <[email protected]> Co-authored-by: ember-stevens <[email protected]> Co-authored-by: Alex Engelberg <[email protected]> Co-authored-by: Louis Chan <[email protected]> Co-authored-by: Louis Chan <[email protected]> Co-authored-by: Todd Anderson <[email protected]> Co-authored-by: tanderson-ld <[email protected]> Co-authored-by: Matthew M. Keeler <[email protected]> Co-authored-by: ld-repository-standards[bot] <113625520+ld-repository-standards[bot]@users.noreply.github.com> Co-authored-by: Kane Parkinson <[email protected]> Co-authored-by: Ryan Lamb <[email protected]>
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