Update Jackson (JSON 3.x), and use of java.net.http#74
Conversation
|
Thanks for the contribution @smocken78 ! Some feedback to improve your PR:
Some open questions:
Comments: One of the reasons Jackson renamed the packages in version 3 is to allow for versions 2 and 3 to co-exist in the classpath. So I'm assuming this change isn't for compatibility for your usage - perhaps there is another driver? Based upon your implementation - it does looks like you are already aware of some of the issues with One option is when you hold a static reference to a closeable - is for the enclosing class could also implement This gets a bit more complicated if you add the Creating one in a static field works, but does then does build a thread pool even if no methods are called. This instance could be lazily instantiated instead. In theory there is nothing wrong with changing to Thanks! |
|
A few additional findings from reviewing the diff: module-info.java has bugsThe current PR has: requires tools.jackson.databind.annotation;
requires tools.jackson.core;
requires com.fasterxml.jackson.databind;This has two issues:
It should be: requires com.fasterxml.jackson.annotation; // annotations (unchanged in 3.x)
requires tools.jackson.core; // jackson-core 3.x
requires tools.jackson.databind; // jackson-databind 3.x(Verified against the actual Breaking API changesThe
Exception type changeThe JWKS retrieval methods (
Code quality
|
|
One more note on the breaking changes — this PR introduces several:
Collectively these force a major version bump (6.x → 7.0.0). Generally, major version bumps to a library should be avoided unless driven by a security fix or architectural necessity — they impose upgrade cost on every downstream consumer. If the primary goal is to modernize internals (HttpClient, Jackson 3.x), it may be worth keeping the public API surface stable and only changing the implementation behind the existing method signatures. That way consumers get the benefits without a forced migration. |
|
Adding on to the URLConnection versus HttpClient discussion. HttpClient is known to be significantly slower than URLConnection (https://bugs.openjdk.org/browse/JDK-8277519?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel). I don't think this is an issue because JWKS and other requests are sporadic. Plus, the round-trip latency should not cause this library or applications using it issues. However, we should just make sure that any performance issues are considered and documented as not a concern. |
|
Thanks for reviewing, i will look into the bugs. In case of HttpClient there is no functional benefit, the main reason why i changed HttpUrlConnection to HttpClient was that in my personal application tests HttpClient had a slightly better performance over URLConnection since i upgraded to Java 21. Regarding the "Test line-ending normalization", yes this was done due to a plattform specifc error on some Windows machine. I will have a look into this. :( |
AbstractHttpHelper
use an other IDE therefore)
Updated depencies from com.fasterxml.jackson to tools.jackson where possible and migrated from URLConnection to HttpClient.
From my own test and my usage of the package there were no problems, especially with the upgraded dependencies, but i had no usecase where needed to use HttpClient, so this should be tested.