Hi Madhuka,

While fixing BAM-1565 <https://wso2.org/jira/browse/BAM-1565> and
BAM-1566<https://wso2.org/jira/browse/BAM-1566>we figured out Jaggery
core was still using
CarbonContext.getCurrentContext().getTenantId(). Because of this, BAM
toolbox deployment for tenant always got a stackoverflow.

A fix for this is attached here with.  Please make a new Jaggery release
for the upcoming BAM 2.4.1 release.

Note that Jaggery version we used was 0.9.0.ALPHA4.wso2v4.

Regards,

Dunith Dhanushka,
Senior Software Engineer - BAM,
WSO2 Inc,

Mobile - +94 71 8615744
Blog - dunithd.wordpress.com <http://blog.dunith.com>
Twitter - @dunithd <http://twitter.com/dunithd>
diff --git 
a/components/jaggery-core/org.jaggeryjs.jaggery.core/src/main/java/org/jaggeryjs/jaggery/core/manager/CommonManager.java
 
b/components/jaggery-core/org.jaggeryjs.jaggery.core/src/main/java/org/jaggeryjs/jaggery/core/manager/CommonManager.java
index ccd449d..c103c20 100644
--- 
a/components/jaggery-core/org.jaggeryjs.jaggery.core/src/main/java/org/jaggeryjs/jaggery/core/manager/CommonManager.java
+++ 
b/components/jaggery-core/org.jaggeryjs.jaggery.core/src/main/java/org/jaggeryjs/jaggery/core/manager/CommonManager.java
@@ -15,7 +15,7 @@ import org.mozilla.javascript.Context;
 import org.mozilla.javascript.Function;
 import org.mozilla.javascript.Scriptable;
 import org.mozilla.javascript.ScriptableObject;
-import org.wso2.carbon.context.CarbonContext;
+import org.wso2.carbon.context.PrivilegedCarbonContext;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -73,7 +73,7 @@ public class CommonManager {
     public static void initContext(JaggeryContext context) throws 
ScriptException {
         context.setEngine(manager.engine);
         context.setScope(manager.engine.getRuntimeScope());
-        
context.setTenantId(Integer.toString(CarbonContext.getCurrentContext().getTenantId()));
+        
context.setTenantId(Integer.toString(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()));
 
         context.addProperty(Constants.JAGGERY_CORE_MANAGER, manager);
         context.addProperty(Constants.JAGGERY_INCLUDED_SCRIPTS, new 
HashMap<String, Boolean>());
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to