Skip to content

Receive Long collection in MessageMapping #11227

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

Closed
Jhovanni opened this issue Nov 30, 2017 · 7 comments
Closed

Receive Long collection in MessageMapping #11227

Jhovanni opened this issue Nov 30, 2017 · 7 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@Jhovanni
Copy link

Jhovanni commented Nov 30, 2017

When you try to receive a collection of Long values, as parameter of a MessageMapping method (from spring messaging), you can print the collection. But if you try to access its values, there is an exception throw about not being able to cast Integer to Long.

Replicate it is easy:

@MessageMapping("/channel")
    public void receiveLongs(List<Long> list) {
        for (Long value : list) {
            System.out.println("Line above throws java.lang.ClassCastException");
        }
}

Exception throw is java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

Spring boot version: 1.5.8.RELEASE

Probably the bug is not related to spring boot, but I wasn't able to find where to report it for spring framework project. Please if its required to move it just let me know and I will without any problem. I just need to know where to report it.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 30, 2017
@snicoll
Copy link
Member

snicoll commented Dec 1, 2017

Probably the bug is not related to spring boot

Indeed, please raise an issue in Spring Framework issue tracker. Rather than a code snippet, please attach a sample that we can run and how you reproduced the issue. Thank you.

@snicoll snicoll closed this as completed Dec 1, 2017
@snicoll snicoll added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 1, 2017
@wangnanyang
Copy link

I suffered the same problem. Can you attach a link to the solution? Thank you.

@wilkinsona
Copy link
Member

This is the Spring Framework issue that was opened: spring-projects/spring-framework#20799.

@wangnanyang
Copy link

I know why. thank you. I'm using Springboot 1.5.9 now. The cost of updating is very high. Besides the method in the link, how can I solve this problem?

@wilkinsona
Copy link
Member

In addition to being fixed in Spring Framework 5.0.x, the fix was back-ported to 4.3.14 which is included in Spring Boot 1.5.10. 1.5.10 should be a drop-in replacement for 1.5.9. I would strongly encourage you to upgrade to the latest 1.5.x release which, the time time of writing, is 1.5.19. You should also start preparing to upgrade to Spring Boot 2 as 1.5 will reach the end of its life in August this year.

@wangnanyang
Copy link

The problem hasn't been solved. I upgraded Springboot to 1.5.10 and the version that relies on spring-web packages to 4.3.14, but I still can't. Do you need any other configuration?

@wilkinsona
Copy link
Member

Please open a new Spring Framework issue with a minimal sample that reproduces the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

5 participants