ServiceMix
  1. ServiceMix
  2. SM-2314

Trying to get person with unknown end with error in camel-cxf-rest example

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.2, 5.1.0, 6.0.0
    • Fix Version/s: 5.0.2, 5.1.1, 6.0.0.M1, 6.0.0
    • Component/s: examples
    • Labels:
      None

      Description

      The example generally works (creating, deleting, getting existing person), but trying to get a person with non-existing id (e.g. 10) causes following entry in log (full stacktrace attached

      Caused by: java.lang.IndexOutOfBoundsException: Index: 10, Size: 1
      	at java.util.ArrayList.rangeCheck(ArrayList.java:635)[:1.7.0_55]
      	at java.util.ArrayList.get(ArrayList.java:411)[:1.7.0_55]
      	at org.apache.servicemix.examples.camel.rest.ServiceHandler.get(ServiceHandler.java:37)[158:camel-cxf-rest-route:5.1.0]
      	at org.apache.servicemix.examples.camel.rest.ServiceHandler.getPerson(ServiceHandler.java:45)[158:camel-cxf-rest-route:5.1.0]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_55]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_55]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_55]
      	at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_55]
      
      

      I haven't analyzed the code but the implementation of the service does not correctly handle the case when the request contains id which dos not exist.

      1. log.txt
        53 kB
        Krzysztof Sobkowiak

        Activity

        Hide
        Gregor Zurowski added a comment - - edited

        I have submitted the following pull request with a fix for this ticket: https://github.com/apache/servicemix/pull/13.

        A patch file is available at the following URL: https://github.com/apache/servicemix/pull/13.patch.

        Show
        Gregor Zurowski added a comment - - edited I have submitted the following pull request with a fix for this ticket: https://github.com/apache/servicemix/pull/13 . A patch file is available at the following URL: https://github.com/apache/servicemix/pull/13.patch .
        Show
        Krzysztof Sobkowiak added a comment - Pull request applied in servicemix-5.0.x – https://git-wip-us.apache.org/repos/asf/servicemix/?p=servicemix.git;a=commit;h=3a4e3099010d96299a686ae04d99a5f8bc733d28 servicemix-5.1.x – https://git-wip-us.apache.org/repos/asf/servicemix/?p=servicemix.git;a=commit;h=fd48f64e8e4e977c77d83ad98a31355425e40530 master – https://git-wip-us.apache.org/repos/asf/servicemix/?p=servicemix.git;a=commit;h=075ba7c056b4aad1da250910d5f0ad8cdf0186a7 Thanks to Gregor for the pull request!!

          People

          • Assignee:
            Krzysztof Sobkowiak
            Reporter:
            Krzysztof Sobkowiak
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development