You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Thorsten Scherler <th...@juntadeandalucia.es> on 2008/08/20 14:40:07 UTC

[2.1] AbstractEnvironment - NPE in release(...)

Hi all,

I found a bug that just some time happens and I am not sure why.

In AbstractEnvironment the method release throw SOMETIMES a NPE:
/**
     * Releases a resolved resource
     */
    public void release(final org.apache.excalibur.source.Source source)
{
        if (null != source) {
            this.sourceResolver.release(source);
        }
    }

I have found that under certain circumstances this.sourceResolver is
already null. I do not understand ATM why and when this can happen.

Does somebody has an idea?

salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: [2.1] AbstractEnvironment - NPE in release(...)

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Wed, 2008-08-20 at 14:40 +0200, Thorsten Scherler wrote:
> Hi all,
> 
> I found a bug that just some time happens and I am not sure why.
> 
> In AbstractEnvironment the method release throw SOMETIMES a NPE:
> /**
>      * Releases a resolved resource
>      */
>     public void release(final org.apache.excalibur.source.Source source)
> {
>         if (null != source) {
>             this.sourceResolver.release(source);
>         }
>     }
> 
> I have found that under certain circumstances this.sourceResolver is
> already null. I do not understand ATM why and when this can happen.
> 
> Does somebody has an idea?

Here the stack:
java.lang.NullPointerException
	at
org.apache.cocoon.environment.AbstractEnvironment.release(AbstractEnvironment.java:563)
	at
org.apache.cocoon.environment.wrapper.MutableEnvironmentFacade.release(MutableEnvironmentFacade.java:314)
	at
org.apache.cocoon.transformation.TraxTransformer.recycle(TraxTransformer.java:549)
	at
org.apache.avalon.excalibur.pool.InstrumentedResourceLimitingPool.put(InstrumentedResourceLimitingPool.java:407)
	at
org.apache.avalon.excalibur.component.PoolableComponentHandler.doPut(PoolableComponentHandler.java:212)
	at
org.apache.avalon.excalibur.component.ComponentHandler.put(ComponentHandler.java:425)
	at
org.apache.avalon.excalibur.component.ExcaliburComponentSelector.release(ExcaliburComponentSelector.java:307)
	at
org.apache.cocoon.components.ExtendedComponentSelector.release(ExtendedComponentSelector.java:301)

salu2

> 
> salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: [2.1] AbstractEnvironment - NPE in release(...)

Posted by Thorsten Scherler <th...@apache.org>.
On Thu, 2008-08-21 at 09:23 +0200, Thorsten Scherler wrote:
> On Wed, 2008-08-20 at 22:00 +0200, Andreas Hartmann wrote:
> > Hi Thorsten,
> > 
> > Thorsten Scherler schrieb:
> > > I found a bug that just some time happens and I am not sure why.
> > > 
> > > In AbstractEnvironment the method release throw SOMETIMES a NPE:
> > > /**
> > >      * Releases a resolved resource
> > >      */
> > >     public void release(final org.apache.excalibur.source.Source source)
> > > {
> > >         if (null != source) {
> > >             this.sourceResolver.release(source);
> > >         }
> > >     }
> > > 
> > > I have found that under certain circumstances this.sourceResolver is
> > > already null. I do not understand ATM why and when this can happen.
> > 
> > this bug also occured in Lenya. The problem there was that a source was 
> > not properly released by its source factory. Maybe this helps to locate 
> > the issue …
> 
> Yeah, thanks Andreas, I thought I saw it before. ;)
> 
> Will investigate.
> 

Fix that.

Thanks again Andreas.

salu2

> salu2
> 
> > 
> > http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/SiteSourceFactory.java?r1=618208&r2=679424&diff_format=h
> > 
> > (line 164)
> > 
> > -- Andreas
> > 
> > 
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: [2.1] AbstractEnvironment - NPE in release(...)

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Wed, 2008-08-20 at 22:00 +0200, Andreas Hartmann wrote:
> Hi Thorsten,
> 
> Thorsten Scherler schrieb:
> > I found a bug that just some time happens and I am not sure why.
> > 
> > In AbstractEnvironment the method release throw SOMETIMES a NPE:
> > /**
> >      * Releases a resolved resource
> >      */
> >     public void release(final org.apache.excalibur.source.Source source)
> > {
> >         if (null != source) {
> >             this.sourceResolver.release(source);
> >         }
> >     }
> > 
> > I have found that under certain circumstances this.sourceResolver is
> > already null. I do not understand ATM why and when this can happen.
> 
> this bug also occured in Lenya. The problem there was that a source was 
> not properly released by its source factory. Maybe this helps to locate 
> the issue …

Yeah, thanks Andreas, I thought I saw it before. ;)

Will investigate.

salu2

> 
> http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/SiteSourceFactory.java?r1=618208&r2=679424&diff_format=h
> 
> (line 164)
> 
> -- Andreas
> 
> 
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: [2.1] AbstractEnvironment - NPE in release(...)

Posted by Andreas Hartmann <an...@apache.org>.
Hi Thorsten,

Thorsten Scherler schrieb:
> I found a bug that just some time happens and I am not sure why.
> 
> In AbstractEnvironment the method release throw SOMETIMES a NPE:
> /**
>      * Releases a resolved resource
>      */
>     public void release(final org.apache.excalibur.source.Source source)
> {
>         if (null != source) {
>             this.sourceResolver.release(source);
>         }
>     }
> 
> I have found that under certain circumstances this.sourceResolver is
> already null. I do not understand ATM why and when this can happen.

this bug also occured in Lenya. The problem there was that a source was 
not properly released by its source factory. Maybe this helps to locate 
the issue …

http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/SiteSourceFactory.java?r1=618208&r2=679424&diff_format=h

(line 164)

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01