Skip to content

Bump version to 10.2.2 - #383

Merged
bobbrodie merged 5 commits into
bitpay:10.2.xfrom
bobbrodie:10.2.x
Jul 15, 2025
Merged

bobbrodie merged 5 commits into
bitpay:10.2.xfrom
bobbrodie:10.2.x

Conversation

@bobbrodie

@bobbrodie bobbrodie commented Jul 11, 2025 •

Copy link
Copy Markdown
Contributor

Overview

This PR performs two changes:

  1. Bumps the version to 10.2.2
  2. Updates the fromApacheHttpResponse method to fix an issue with duplicate headers

The Bug Fix

New builds were receiving the following error:

java.lang.IllegalStateException: Duplicate key Server-Timing (attempted merging values cfCacheStatus;desc="HIT" and cfEdge;dur=4,cfOrigin;dur=0)
	at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:135)
	at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:182)
	at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:727)
	at com.bitpay.sdk.client.HttpResponseProvider.fromApacheHttpResponse(HttpResponseProvider.java:29)
	at com.bitpay.sdk.functional.client.HttpResponseProviderTest.it_should_correct_transfer_apache_response_to_bitpay_response(HttpResponseProviderTest.java:25)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)

Running tests was throwing this due to the call that's made to https://jsonplaceholder.typicode.com/posts/1. They must have started using Cloudflare (or something changed) and multiple Server-Timing headers were being received.

Screenshot 2025-07-11 at 4 21 42 PM

This is a functional test, so I think it makes sense that we're calling JSON Placeholder, but we might consider replacing it in the future with a mocked call.

That said, it did uncover an issue where our client was not handling duplicate headers well, and if the BitPay API started to send duplicate headers, there could be a potential crash so I've implemented a change that will combine like headers into one.

I've confirmed that after the change, the Site-Timing header is changed to:

Server-Timing=cfCacheStatus;desc="HIT",cfEdge;dur=4,cfOrigin;dur=0

Closes #382

@bobbrodie bobbrodie added this to the v10.2.2 milestone Jul 11, 2025
@bobbrodie bobbrodie moved this to In Progress in SDKs & Plugins Jul 11, 2025
@bobbrodie bobbrodie moved this from In Progress to Under Review in SDKs & Plugins Jul 11, 2025
@bobbrodie
bobbrodie merged commit e9943de into bitpay:10.2.x Jul 15, 2025
@github-project-automation github-project-automation Bot moved this from Under Review to Done in SDKs & Plugins Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Release v10.2.2

2 participants