I think we need to check isEmpty as well.

On Tue, Jul 7, 2015 at 3:41 PM, Jagath Sisirakumara Ariyarathne <
[email protected]> wrote:

> Hi,
>
> I am working on [1] and found that the cause of the exception mentioned
> below is in the code segment in 
> org.wso2.carbon.context.internal.CarbonContextDataHolder
> in carbon.utils.
>
> public void endTenantFlow() {
>
>     Stack<CarbonContextDataHolder> carbonContextDataHolders = 
> parentContextHolderStack.get();
>     if (carbonContextDataHolders != null) {
>         currentContextHolder.set(carbonContextDataHolders.pop());
>     }
> }
>
> *Exception :*
>
> java.util.EmptyStackException
>       at java.util.Stack.peek(Stack.java:102)
>       at java.util.Stack.pop(Stack.java:84)
>       at 
> org.wso2.carbon.context.internal.CarbonContextDataHolder.endTenantFlow(CarbonContextDataHolder.java:1291)
>       at 
> org.wso2.carbon.context.PrivilegedCarbonContext.endTenantFlow(PrivilegedCarbonContext.java:75)
>       at 
> org.wso2.carbon.ntask.core.impl.TaskQuartzJobAdapter.execute(TaskQuartzJobAdapter.java:69)
>       at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>       at java.lang.Thread.run(Thread.java:745)
>
> Issue occurs when it tries to pop elements from carbonContextDataHolders 
> stack when it is empty.
>
> Is it a possible scenario that this stack being empty and shouldn't it be 
> handled at CarbonContextDataHolder (check isEmpty in stack)?
>
> [1] - https://wso2.org/jira/browse/ESBJAVA-3832
>
> Thanks
>
> --
> Jagath Ariyarathne
> Technical Lead
> WSO2 Inc.  http://wso2.com/
> Email: [email protected]
> Mob  : +94 77 386 7048
>
>


-- 

Best Regards,

Malaka Silva
Senior Tech Lead
M: +94 777 219 791
Tel : 94 11 214 5345
Fax :94 11 2145300
Skype : malaka.sampath.silva
LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
Blog : http://mrmalakasilva.blogspot.com/

WSO2, Inc.
lean . enterprise . middleware
http://www.wso2.com/
http://www.wso2.com/about/team/malaka-silva/
<http://wso2.com/about/team/malaka-silva/>

Save a tree -Conserve nature & Save the world for your future. Print this
email only if it is absolutely necessary.
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to