camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] git commit: CAMEL-6680: mvel compiles expression setting TCCL to classloader from mvel to improve OSGi compatability.
Date Thu, 29 Aug 2013 09:51:16 GMT
CAMEL-6680: mvel compiles expression setting TCCL to classloader from mvel to improve OSGi
compatability.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b8c85002
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b8c85002
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b8c85002

Branch: refs/heads/camel-2.11.x
Commit: b8c85002519981e383203cecc21a152046ddce5a
Parents: 1fd52ef
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Aug 29 11:48:50 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Aug 29 11:50:59 2013 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/language/mvel/MvelExpression.java  | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b8c85002/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MvelExpression.java
----------------------------------------------------------------------
diff --git a/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MvelExpression.java
b/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MvelExpression.java
index 802559e..d842493 100644
--- a/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MvelExpression.java
+++ b/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MvelExpression.java
@@ -32,10 +32,18 @@ public class MvelExpression extends ExpressionSupport {
     public MvelExpression(MvelLanguage language, String expressionString, Class<?>
type) {
         this.expressionString = expressionString;
         this.type = type;
+
+        // see http://jira.codehaus.org/browse/MVEL-250
+        final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
         try {
+            // set the TCCL to the MVEL
+            Thread.currentThread().setContextClassLoader(org.mvel2.MVEL.class.getClassLoader());
             this.compiled = org.mvel2.MVEL.compileExpression(expressionString);
         } catch (Exception e) {
             throw new ExpressionIllegalSyntaxException(expressionString, e);
+        } finally {
+            // restore
+            Thread.currentThread().setContextClassLoader(tccl);
         }
     }
 


Mime
View raw message