From cb70fdb8e5c37cdd7e02cd2b16c6f6c8da7ca88f Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 13 Jun 2024 11:45:34 -0700 Subject: [PATCH] Improve error message in JDK 17+ when concurrent modifications to SDK client builders cause a null value to be read. --- .../main/java/software/amazon/awssdk/utils/AttributeMap.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/src/main/java/software/amazon/awssdk/utils/AttributeMap.java b/utils/src/main/java/software/amazon/awssdk/utils/AttributeMap.java index 5237f5da07b7..12eee34f0842 100644 --- a/utils/src/main/java/software/amazon/awssdk/utils/AttributeMap.java +++ b/utils/src/main/java/software/amazon/awssdk/utils/AttributeMap.java @@ -393,6 +393,10 @@ private T internalGet(Value requester, Key key) { * Resolve the provided value, making sure to record any of its dependencies in the dependency graph. */ private T resolveValue(Value value) { + Validate.notNull(value, + "Encountered a null value when resolving configuration attributes. This is commonly " + + "caused by concurrent modifications to non-thread-safe types. Ensure you're " + + "synchronizing access to all non-thread-safe types."); return value.get(new LazyValueSource() { @Override public U get(Key innerKey) {