You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Karl Øie <ka...@gan.no> on 2005/01/04 13:41:12 UTC

NullPointerException in IndexTrigger

Hi there, just got around a NPE in both slide-2.1 and slide-2.2pre that  
is thrown in IndexTrigger upon drop/delete index.

i changed line 115 in IndexTrigger.java:

from :

indexers[j].dropIndex(
	new Uri(delete[i].getNamespace(),
	delete[i].getUri()),
	delete[i].getRevisionDescriptor().getRevisionNumber()
);

to :

indexers[j].dropIndex(
	new Uri(delete[i].getNamespace(),
	delete[i].getUri()),
	delete[i].getRevisionDescriptor()==null?null: 
delete[i].getRevisionDescriptor().getRevisionNumber()
);

as you can see getRevisionDescriptor() returns NULL and throws a NPE  
when we try to do getRevisionNumber() on it.

The thing is that im a complete newbie to Slide so i wonder if this is  
just a problem with IndexTrigger or if this is supposed to be right  
because the getRevisionDescriptor() shouldnt return NULL. My index only  
needs the getUri() result but i just wanted to ask?

Mvh Karl Øie

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: NullPointerException in IndexTrigger

Posted by Stefan Lützkendorf <lu...@apache.org>.
I applied your fix. In the ctor of ContentEvent nulls are used for the 
revision descriptor so we have to expect it.
thanks, Stefan

Karl Øie wrote:
> Hi there, just got around a NPE in both slide-2.1 and slide-2.2pre that  
> is thrown in IndexTrigger upon drop/delete index.
> 
> i changed line 115 in IndexTrigger.java:
> 
> from :
> 
> indexers[j].dropIndex(
>     new Uri(delete[i].getNamespace(),
>     delete[i].getUri()),
>     delete[i].getRevisionDescriptor().getRevisionNumber()
> );
> 
> to :
> 
> indexers[j].dropIndex(
>     new Uri(delete[i].getNamespace(),
>     delete[i].getUri()),
>     delete[i].getRevisionDescriptor()==null?null: 
> delete[i].getRevisionDescriptor().getRevisionNumber()
> );
> 
> as you can see getRevisionDescriptor() returns NULL and throws a NPE  
> when we try to do getRevisionNumber() on it.
> 
> The thing is that im a complete newbie to Slide so i wonder if this is  
> just a problem with IndexTrigger or if this is supposed to be right  
> because the getRevisionDescriptor() shouldnt return NULL. My index only  
> needs the getUri() result but i just wanted to ask?
> 
> Mvh Karl Øie
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
> 
> 

-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org