[Dev] Bug in APPM ES branch GenricExecuter.java class

2014-12-04 Thread Chathura Dilan
Hi All,

There is a bug in APPM ES branch[1] which does not allow mobileapps to
attach permissions which is defined in the LifeCycle. This bug is inherited
from ES 1.0.0 and it is fixed in ES 2.0.0.
However webapps are working fine with a workaround in web app extension
while the mobile apps breaks. But the workaround is not the best way to
handle it.


In APPM ES branch GenricExecuter.java class[1] following code (Line
102 -110)


String
stringTenantId=Integer.toString(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());

try{

this.tenantId=RealmContext.getRealmService().getTenantManager().getTenantId(stringTenantId);
}
catch(Exception e){
log.debug(Failed to obtain Tenant id);
}



   Should be replace with following code as in ES 2.0[2]



   String
stringTenantId=Integer.toString(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());

try{

this.tenantId=RealmContext.getRealmService().getTenantManager().getTenantId(stringTenantId);
}
catch(Exception e){
log.debug(Failed to obtain Tenant id);
}


I tested the fix for both webapp and mobileapp and they worked.


[1] -
https://github.com/wso2/product-es/blob/es-1.0.1-apm-reg/modules/components/jaggery-scxml-executors/src/main/java/org/wso2/jaggery/scxml/generic/GenericExecutor.java
[2] -
https://github.com/wso2/product-es/blob/master/modules/components/jaggery-scxml-executors/src/main/java/org/wso2/jaggery/scxml/generic/GenericExecutor.java



-- 
Regards,

Chatura Dilan Perera
*(Senior Software Engineer** - WSO2 Inc.**)*
www.dilan.me
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Bug in APPM ES branch GenricExecuter.java class

2014-12-04 Thread Ruwan Yatawara
Hi Chathura,

The two code blocks you have listed seem to be exactly the same. But i
believe the fix you are referring to is passing the teantDomain instead of
the tenantId to the
RealmContext.getRealmService().getTenantManager().getTenantId
method, is it?


Thanks and Regards,

Ruwan


On 4 Dec 2014 15:01, Chathura Dilan chathu...@wso2.com wrote:

 Hi All,

 There is a bug in APPM ES branch[1] which does not allow mobileapps to
 attach permissions which is defined in the LifeCycle. This bug is inherited
 from ES 1.0.0 and it is fixed in ES 2.0.0.
 However webapps are working fine with a workaround in web app extension
 while the mobile apps breaks. But the workaround is not the best way to
 handle it.


 In APPM ES branch GenricExecuter.java class[1] following code
 (Line 102 -110)


 String
 stringTenantId=Integer.toString(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());

 try{

 this.tenantId=RealmContext.getRealmService().getTenantManager().getTenantId(stringTenantId);
 }
 catch(Exception e){
 log.debug(Failed to obtain Tenant id);
 }



Should be replace with following code as in ES 2.0[2]



String
 stringTenantId=Integer.toString(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());

 try{

 this.tenantId=RealmContext.getRealmService().getTenantManager().getTenantId(stringTenantId);
 }
 catch(Exception e){
 log.debug(Failed to obtain Tenant id);
 }


 I tested the fix for both webapp and mobileapp and they worked.


 [1] -
 https://github.com/wso2/product-es/blob/es-1.0.1-apm-reg/modules/components/jaggery-scxml-executors/src/main/java/org/wso2/jaggery/scxml/generic/GenericExecutor.java
 [2] -
 https://github.com/wso2/product-es/blob/master/modules/components/jaggery-scxml-executors/src/main/java/org/wso2/jaggery/scxml/generic/GenericExecutor.java



 --
 Regards,

 Chatura Dilan Perera
 *(Senior Software Engineer** - WSO2 Inc.**)*
 www.dilan.me

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Bug in APPM ES branch GenricExecuter.java class

2014-12-04 Thread Chathura Dilan
Hi Ruwan,

Yes, Tenant name should be passed instead of tenant ID. That is a bug in ES
1.0 which makes that java code to malfunction. It is confirmed by SameeraM.

On Fri, Dec 5, 2014 at 8:57 AM, Ruwan Yatawara ruw...@wso2.com wrote:

 Hi Chathura,

 The two code blocks you have listed seem to be exactly the same. But i
 believe the fix you are referring to is passing the teantDomain instead of
 the tenantId to the 
 RealmContext.getRealmService().getTenantManager().getTenantId
 method, is it?


 Thanks and Regards,

 Ruwan


 On 4 Dec 2014 15:01, Chathura Dilan chathu...@wso2.com wrote:

 Hi All,

 There is a bug in APPM ES branch[1] which does not allow mobileapps to
 attach permissions which is defined in the LifeCycle. This bug is inherited
 from ES 1.0.0 and it is fixed in ES 2.0.0.
 However webapps are working fine with a workaround in web app extension
 while the mobile apps breaks. But the workaround is not the best way to
 handle it.


 In APPM ES branch GenricExecuter.java class[1] following code
 (Line 102 -110)


 String
 stringTenantId=Integer.toString(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());

 try{

 this.tenantId=RealmContext.getRealmService().getTenantManager().getTenantId(stringTenantId);
 }
 catch(Exception e){
 log.debug(Failed to obtain Tenant id);
 }



Should be replace with following code as in ES 2.0[2]



String
 stringTenantId=Integer.toString(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());

 try{

 this.tenantId=RealmContext.getRealmService().getTenantManager().getTenantId(stringTenantId);
 }
 catch(Exception e){
 log.debug(Failed to obtain Tenant id);
 }


 I tested the fix for both webapp and mobileapp and they worked.


 [1] -
 https://github.com/wso2/product-es/blob/es-1.0.1-apm-reg/modules/components/jaggery-scxml-executors/src/main/java/org/wso2/jaggery/scxml/generic/GenericExecutor.java
 [2] -
 https://github.com/wso2/product-es/blob/master/modules/components/jaggery-scxml-executors/src/main/java/org/wso2/jaggery/scxml/generic/GenericExecutor.java



 --
 Regards,

 Chatura Dilan Perera
 *(Senior Software Engineer** - WSO2 Inc.**)*
 www.dilan.me




-- 
Regards,

Chatura Dilan Perera
*(Senior Software Engineer** - WSO2 Inc.**)*
www.dilan.me
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev