Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JerseyClientBuilder modifies Map content during provider registration #4082

Closed
Verdent opened this issue Mar 21, 2019 · 3 comments
Closed

JerseyClientBuilder modifies Map content during provider registration #4082

Verdent opened this issue Mar 21, 2019 · 3 comments
Labels
Milestone

Comments

@Verdent
Copy link
Member

Verdent commented Mar 21, 2019

When you try to register new provider with Map of contracts, it will get modified when there is non supported provider class present in the map.

Example:
Map<Class<?>, Integer> contracts = new HashMap<>();
contract.put(ClientRequestFilter.class, 500);
contract.put(SomeCustomClass.class, 501);

contracts.size();// -> returns 2
jerseyClientBuilder.register(MyProvider.class, contracts);
contracts.size();// -> returns 1

@senivam
Copy link
Contributor

senivam commented Mar 21, 2019

That is documented behavior:

/**
* Create a contract provider for a given component class.
*
* @param componentClass component class to create contract provider model for.
* @param defaultPriority default component priority. If {@value ContractProvider#NO_PRIORITY},
* the value from the component class {@link javax.annotation.Priority} annotation will be used
* (if any).
* @param contractMap map of contracts and their binding priorities. If {@code null}, the contracts will
* gathered by introspecting the component class. Content of the contract map
* may be modified during the registration processing.
* @param modelEnhancer custom contract provider model enhancer.
* @return contract provider model for the class.
*/
private static ContractProvider modelFor(final Class componentClass, final int defaultPriority, final Map, Integer> contractMap,
final Inflector<ContractProvider.Builder, ContractProvider> modelEnhancer)

senivam added a commit to senivam/jersey that referenced this issue Mar 21, 2019
Signed-off-by: Maxim Nesen <[email protected]>
senivam added a commit to senivam/jersey that referenced this issue Mar 21, 2019
Signed-off-by: Maxim Nesen <[email protected]>
senivam added a commit to senivam/jersey that referenced this issue Mar 21, 2019
Signed-off-by: Maxim Nesen <[email protected]>
@senivam senivam mentioned this issue Mar 21, 2019
@senivam
Copy link
Contributor

senivam commented Mar 21, 2019

Even though the behavior is documented it does not seem to be correct. Thus fix for it is introduced.

senivam added a commit to senivam/jersey that referenced this issue Mar 21, 2019
Signed-off-by: Maxim Nesen <[email protected]>
senivam added a commit to senivam/jersey that referenced this issue Mar 25, 2019
Signed-off-by: Maxim Nesen <[email protected]>
senivam added a commit that referenced this issue Mar 26, 2019
Signed-off-by: Maxim Nesen <[email protected]>
@senivam
Copy link
Contributor

senivam commented Mar 26, 2019

merged, fixed

@senivam senivam closed this as completed Mar 26, 2019
@senivam senivam added the 2.29 label Mar 26, 2019
@senivam senivam added this to the 2.29 milestone Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants