HHH-5195 : FilterImpl.validate() throws NullPointerException on deserialization
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19728 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
182ee2f34e
commit
3c57a05313
|
@ -111,6 +111,14 @@ public class LoadQueryInfluencers implements Serializable {
|
|||
return enabledFilters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable Set of enabled filter names.
|
||||
* @return an unmodifiable Set of enabled filter names.
|
||||
*/
|
||||
public Set getEnabledFilterNames() {
|
||||
return java.util.Collections.unmodifiableSet( enabledFilters.keySet() );
|
||||
}
|
||||
|
||||
public Filter getEnabledFilter(String filterName) {
|
||||
return ( Filter ) enabledFilters.get( filterName );
|
||||
}
|
||||
|
|
|
@ -2150,9 +2150,16 @@ public final class SessionImpl extends AbstractSessionImpl
|
|||
|
||||
childSessionsByEntityMode = ( Map ) ois.readObject();
|
||||
|
||||
Iterator iter = loadQueryInfluencers.getEnabledFilters().values().iterator();
|
||||
// LoadQueryInfluencers.getEnabledFilters() tries to validate each enabled
|
||||
// filter, which will fail when called before FilterImpl.afterDeserialize( factory );
|
||||
// Instead lookup the filter by name, call FilterImpl.afterDeserialize( factory ),
|
||||
// and then validate.
|
||||
Iterator iter = loadQueryInfluencers.getEnabledFilterNames().iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
( ( FilterImpl ) iter.next() ).afterDeserialize( factory );
|
||||
String filterName = ( String ) iter.next();
|
||||
FilterImpl filter = ( FilterImpl ) loadQueryInfluencers.getEnabledFilter( filterName );
|
||||
filter.afterDeserialize( factory );
|
||||
filter.validate();
|
||||
}
|
||||
|
||||
if ( isRootSession && childSessionsByEntityMode != null ) {
|
||||
|
|
Loading…
Reference in New Issue