Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Regression in (Simple)ClientHttpRequestFactory concerning Nativehints #1636

Closed
goafabric opened this issue Jun 13, 2022 · 2 comments
Closed
Labels
type: regression A bug that is also a regression
Milestone

Comments

@goafabric
Copy link

goafabric commented Jun 13, 2022

Description
The Regression concerning Nativehints + (Simple)ClientHttpRequestFactory
that was fixed multiple times, is again existent in 0.12.
See #1370

Setting a ConnectionTimeout e.g. via RestTemplateBuilder:
new RestTemplateBuilder().setConnectTimeout(Duration.ofMillis(timeout))

Symptom
Crashes during Bootstrap:
java.lang.IllegalStateException: Request factory class org.springframework.http.client.SimpleClientHttpRequestFactory does not have a suitable setConnectTimeout method

Mitigation
As always we can mitigate this, by setting a manual Typehint:
@typehint(types = org.springframework.http.client.SimpleClientHttpRequestFactory.class, access = {TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.PUBLIC_METHODS})

But it would be nice if this thing get's fixed once and for all.
Really odd that is .. because #1370 seems to contain a merge request that sets the hints.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 13, 2022
@mhalbritter
Copy link
Contributor

mhalbritter commented Jun 13, 2022

Thanks for the report. I'll add a sample to that our CI will catch that in the future.

@mhalbritter mhalbritter added type: bug A general bug type: regression A bug that is also a regression and removed type: bug A general bug status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 13, 2022
@mhalbritter mhalbritter added this to the 0.12.1 milestone Jun 13, 2022
@mhalbritter
Copy link
Contributor

Huh, this is indeed very strange. The hints are there, but they are not generated into the reflect-config.json.

When i add

@MethodHint(name = "setProxy", parameterTypes = Proxy.class)

this will show up in the JSON. Maybe the primitive type handling is broken, because int and boolean don't show up. Have to debug the JSON file generation.

@mhalbritter
Copy link
Contributor

mhalbritter commented Jun 13, 2022

Running it with debug output reveals:

org.springframework.nativex.type.Type    : Unable to fully resolve method setConnectTimeout(int)
org.springframework.nativex.type.Type    : Unable to fully resolve method setReadTimeout(int)
org.springframework.nativex.type.Type    : Unable to fully resolve method setBufferRequestBody(boolean)

This is logged from org.springframework.nativex.type.Type#unpackMethodInfo, and it seems that it can't resolve primitive types.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: regression A bug that is also a regression
Development

No branches or pull requests

3 participants