Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-16252

Exception when receiving Long collection in MessageMapping

    XMLWordPrintable

    Details

      Description

      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.
      Code found in github repository is ready to be used and replicate the bug.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rstoya05-aop Rossen Stoyanchev
              Reporter:
              Jhovanni Jhovanni
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 37 weeks, 1 day ago