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

ExchangeStrategies custom codec's reader and writer are not registered #25146

Closed
dlsrb6342 opened this issue May 28, 2020 · 5 comments
Closed
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug

Comments

@dlsrb6342
Copy link
Contributor

dlsrb6342 commented May 28, 2020

Affects: 5.2.6.RELEASE


I added my custom encoder and decoder like following.

ExchangeStrategies
    .empty()
    .codecs(configurer -> {
        configurer.defaultCodecs().maxInMemorySize(properties.getMaxInMemorySize());
        configurer.customCodecs().registerWithDefaultConfig(encoder);
        configurer.customCodecs().registerWithDefaultConfig(decoder);
    })
    .build();

But there is no messageWriters when writing body with BodyInserts.fromValue().
It seems that encoder and decoder that I added above are not registered at ExchangeStrategies.

I think following code block has bug. Why put all readers and writers from this to other? It seems that this and other are swapped.

DefaultCustomCodecs(DefaultCustomCodecs other) {
other.typedReaders.putAll(this.typedReaders);
other.typedWriters.putAll(this.typedWriters);
other.objectReaders.putAll(this.objectReaders);
other.objectWriters.putAll(this.objectWriters);
}

If it is a bug, I would like to create a PR. :)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 28, 2020
@sbrannen
Copy link
Member

Yes, that looks like a bug.

Feel free to submit a PR with the fix, and please make sure to include a test that fails before the fix and passes afterwards.

@sbrannen sbrannen added in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels May 28, 2020
@sbrannen sbrannen added this to the 5.2.7 milestone May 28, 2020
@sbrannen
Copy link
Member

This should be backported to 5.1.x as well, but I'm holding off on creating the backport issue with the assumption that a PR from @dlsrb6342 will supersede this issue.

@sbrannen
Copy link
Member

@dlsrb6342 Do you think you'll find time to submit the PR in the coming week?

It would be good to have it in place in time for 5.2.7.

@dlsrb6342
Copy link
Contributor Author

@sbrannen
Please have a look #25149

@sbrannen
Copy link
Member

Superseded by #25149.

@sbrannen sbrannen removed this from the 5.2.7 milestone May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants