Skip to content

ognl 3.4.5 - Issue with using custom class loader in getValue #350

@davsclaus

Description

@davsclaus

At Apache Camel we have a camel-ognl module
https://github.com/apache/camel/tree/main/components/camel-ognl

When we upgrade from 3.4.4 to 3.4.5 we had an unit test error in one of our tests.
https://github.com/apache/camel/blob/main/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/OgnlTest.java#L48

At first sight I suspect its this change
#337

in the getValue method, that somehow the custom classloader that Camel will provide in the unit test is not being in use.

The custom class loader is part of the test
https://github.com/apache/camel/blob/main/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/MyClassResolver.java#L30

where the classloader will now correctly fix the classname and load the class (notice the Animal1 vs Animal) in the name.

The camel code that creates the ognl context and invokes ognl from camel in that test is executing this code
https://github.com/apache/camel/blob/main/components/camel-ognl/src/main/java/org/apache/camel/language/ognl/OgnlExpression.java#L53

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions