Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9564

EndpointHelper.resolveReferenceListParameter should not return immutable lists

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.16.1
    • Fix Version/s: 2.16.3, 2.17.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      EndpointHelper.resolveReferenceListParameter can sometimes return immutable lists, which can cause issues when other components try to add items to those lists.

      The fact that other endpoints (like jetty-common JettyHttpComponent [enableCors line 279]) can add other components into the lists can cause hard to track down failures.

      Sorry don't have a patch file, but the lines i would fix in EndpointHelper.java would be:

      line 350: return Collections.emptyList();

      line 360: return Arrays.asList(elements.size())

      These should just return ArrayLists.

      I know these parameters should optionally be Lists already, and this is a slight performance hit when starting up, but i think it's better than trying to figure out what went wrong when it fails.

      My particular scenario was a Jetty endpoint with a filtersRef (with a single Filter - not a list) and then enableCORS=true. The filtersRef returned Arrays.asLIst and then enableCORS tried to add an element into that list and crashed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                jmandawg Jay mann
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: