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

Can't access to length of Array (java) from simple language

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.11.0
    • 2.11.1, 2.12.0
    • camel-core
    • None
    • Unknown

    Description

      Cannot evaluate length on java.lang.String[] in simple
      I suspect this is because this is part of the language itself. But still, why not?

      repro step

      run this:

      ?xml version="1.0" encoding="UTF-8"?>
      <routes xmlns="http://camel.apache.org/schema/spring" >
          <route>
              <from uri="timer:test?repeatCount=1"/>
              <setBody>
                  <groovy>[[2, "Chaine_avec_des_underscores", 12, "c"], ["d4", "e5", "f6"]]</groovy>
              </setBody>
              <split>
                  <simple>${body}</simple>
                  <setHeader headerName="splittedColumn1">
                      <simple>${body[1].split("_")}</simple>
                  </setHeader>
                  <log message="${header.splittedColumn1.length}"/>
              </split>
          </route>
      </routes>
      

      errors with:

      org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: .length on null due to: org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: length on null due to: org.apache.camel.component.bean.MethodNotFoundException: Method with name: length not found on bean: [Ljava.lang.String;@33318365 of type: [Ljava.lang.String;. Exchange[Message: [d4, e5, f6]]

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            jeromeinsf Jérôme Decq
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: