Uploaded image for project: 'Red Hat build of Apache Camel for Spring Boot'
  1. Red Hat build of Apache Camel for Spring Boot
  2. CSB-1531

simple expression with regex causes java.lang.IllegalArgumentException: name must be specified and not empty

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Normal Normal
    • csb-3.20
    • csb-3.14
    • Camel
    • False
    • Hide

      None

      Show
      None
    • False
    • Very Likely
    • 0

      The following simple expression with replaceAll and a regex (to remove tags like <mytag>):

      .setProperty("testString", new SimpleExpression("${exchangeProperty.testString.replaceAll('<[^>]+>','')}"))
      

      Causes an IllegalArgumentException. It appears that the presence of the '<' character at position 0 causes the DefaultClassResolver to throw the IllegalArgumentException when testing the parameter type. This is the method that does the loadClass:

      https://github.com/apache/camel/blob/4c7ce615ab464056d1d8cc34503040542b91e896/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultClassResolver.java#L65

      called from:

      https://github.com/apache/camel/blob/4c7ce615ab464056d1d8cc34503040542b91e896/components/camel-bean/src/main/java/org/apache/camel/component/bean/MethodInfo.java#L646

      This same expression worked in Camel 2.x, but fails in Camel 3.14.x. Workarounds are available (do the regex/replace in a processor, for example).

            fmariani@redhat.com Federico Mariani
            rhn-support-shiggs Stephen Higgs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: