HHH-5195 : FilterImpl.validate() throws NullPointerException on deserialization

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19730 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Gail Badner 2010-06-15 02:44:40 +00:00
parent 3c57a05313
commit 6d9c10deab
2 changed files with 4 additions and 5 deletions

View File

@ -51,6 +51,7 @@ public class FilterImpl implements Filter, Serializable {
void afterDeserialize(SessionFactoryImpl factory) { void afterDeserialize(SessionFactoryImpl factory) {
definition = factory.getFilterDefinition(filterName); definition = factory.getFilterDefinition(filterName);
validate();
} }
/** /**

View File

@ -2152,14 +2152,12 @@ public final class SessionImpl extends AbstractSessionImpl
// LoadQueryInfluencers.getEnabledFilters() tries to validate each enabled // LoadQueryInfluencers.getEnabledFilters() tries to validate each enabled
// filter, which will fail when called before FilterImpl.afterDeserialize( factory ); // filter, which will fail when called before FilterImpl.afterDeserialize( factory );
// Instead lookup the filter by name, call FilterImpl.afterDeserialize( factory ), // Instead lookup the filter by name and then call FilterImpl.afterDeserialize( factory ).
// and then validate.
Iterator iter = loadQueryInfluencers.getEnabledFilterNames().iterator(); Iterator iter = loadQueryInfluencers.getEnabledFilterNames().iterator();
while ( iter.hasNext() ) { while ( iter.hasNext() ) {
String filterName = ( String ) iter.next(); String filterName = ( String ) iter.next();
FilterImpl filter = ( FilterImpl ) loadQueryInfluencers.getEnabledFilter( filterName ); ( ( FilterImpl ) loadQueryInfluencers.getEnabledFilter( filterName ) )
filter.afterDeserialize( factory ); .afterDeserialize( factory );
filter.validate();
} }
if ( isRootSession && childSessionsByEntityMode != null ) { if ( isRootSession && childSessionsByEntityMode != null ) {