cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: Cocoon JSR 168 Portlet in Cocoon Portal
Date Wed, 07 Jul 2004 06:25:55 GMT
Vadim Gritsenko wrote:

> 
> Hi all,
> 
> I have successfully deployed Cocoon JSR-168 Portlet into 
> Cocoon Portal. 
> Now, you can deploy your portlets implemented using Cocoon 
> into Cocoon's own portal.

Cool!!

> 
> There is a very simple demo of the Cocoon JSR-168 portlet 
> included, just go to the "JSR168" tab in the portal block 
> demo. The only thing you need to do before running demo is to 
> comment out implementation of the
> checkEnvironment() method in the EnvironmentHelper:
> 
> Index: 
> src/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
> ===================================================================
> RCS file: 
> /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/in
> ternal/EnvironmentHelper.java,v
> retrieving revision 1.3
> diff -u -r1.3 EnvironmentHelper.java
> ---
> src/java/org/apache/cocoon/environment/internal/EnvironmentHel
> per.java 
>      29 May 2004 17:39:38 -0000      1.3
> +++ 
> src/java/org/apache/cocoon/environment/internal/EnvironmentHel
> per.java 
>      6 Jul 2004 20:42:33 -0000
> @@ -288,6 +288,7 @@
>       public static void checkEnvironment(Logger logger)
>       throws Exception {
>           // TODO (CZ): This is only for testing - remove it later on
> +        /*
>           final EnvironmentStack stack = 
> (EnvironmentStack)environmentStack.get();
>           if (stack != null && !stack.isEmpty() ) {
>               logger.error("ENVIRONMENT STACK HAS NOT BEEN 
> CLEANED PROPERLY"); @@ -295,6 +296,7 @@
>                                             +"Please report 
> this (if possible together with a test case) "
>                                             +"to the Cocoon 
> developers.");
>           }
> +        */
>       }
> 
>       /**
> 
> 
> Carsten, can you shed more light as to what will be the best 
> course for this?
> 
Argh, ok, perhaps we can finally find the bug with this!
The checkEnvironment is an integrated "test" to see if something went
wrong with the internal environment handling. So if this method
logs the exception, something went wrong :)

We have an internal stack, bound as a thread local variable, that keeps
track of the current environment and sitemap. So, if you enter
a sitemap, the current environment and sitemap processor are pushed
onto the stack and when the sitemap is left, the values are taken
from the stack.
The checkEnvironment() method checks at the end of the processing if the
stack is empty. If not, something has not been taken from stack.

Now, this gets more complicated, when internal pipeline calls are used.
As these run in the same thread, the environment of the internal pipeline
and of the external call are both on the same stack. An index for
each pipeline keeps track of which environment belongs to which pipeline.

It seems that the problem arises when this index somehow gets confused
or, when something is not taken from the stack. 

I checked the code several times, but push and pop always come in a pair,
so I'm a little bit clueless :)
Is the message reproducable with every coplet? What do I have to do,
to reproduce it?

Carsten



Mime
View raw message