HHH-14305 Avoid referring to an empty ArrayList for AbstractEntityPersister#lobProperties

This commit is contained in:
Sanne Grinovero 2020-10-28 21:05:11 +00:00
parent fb34b720bc
commit 0dedcd05db
1 changed files with 5 additions and 2 deletions

View File

@ -95,6 +95,7 @@ import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.FilterHelper; import org.hibernate.internal.FilterHelper;
import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.internal.util.collections.LockModeEnumMap; import org.hibernate.internal.util.collections.LockModeEnumMap;
import org.hibernate.jdbc.Expectation; import org.hibernate.jdbc.Expectation;
import org.hibernate.jdbc.Expectations; import org.hibernate.jdbc.Expectations;
@ -210,7 +211,7 @@ public abstract class AbstractEntityPersister
private final boolean[] propertyUniqueness; private final boolean[] propertyUniqueness;
private final boolean[] propertySelectable; private final boolean[] propertySelectable;
private final List<Integer> lobProperties = new ArrayList<>(); private final List<Integer> lobProperties;
//information about lazy properties of this class //information about lazy properties of this class
private final String[] lazyPropertyNames; private final String[] lazyPropertyNames;
@ -698,6 +699,7 @@ public abstract class AbstractEntityPersister
ArrayList lazyTypes = new ArrayList(); ArrayList lazyTypes = new ArrayList();
ArrayList lazyColAliases = new ArrayList(); ArrayList lazyColAliases = new ArrayList();
final ArrayList<Integer> lobPropertiesLocalCollector = new ArrayList<>();
iter = persistentClass.getPropertyClosureIterator(); iter = persistentClass.getPropertyClosureIterator();
i = 0; i = 0;
boolean foundFormula = false; boolean foundFormula = false;
@ -759,12 +761,13 @@ public abstract class AbstractEntityPersister
propertyUniqueness[i] = prop.getValue().isAlternateUniqueKey(); propertyUniqueness[i] = prop.getValue().isAlternateUniqueKey();
if ( prop.isLob() && dialect.forceLobAsLastValue() ) { if ( prop.isLob() && dialect.forceLobAsLastValue() ) {
lobProperties.add( i ); lobPropertiesLocalCollector.add( i );
} }
i++; i++;
} }
this.lobProperties = CollectionHelper.toSmallList( lobPropertiesLocalCollector );
hasFormulaProperties = foundFormula; hasFormulaProperties = foundFormula;
lazyPropertyColumnAliases = ArrayHelper.to2DStringArray( lazyColAliases ); lazyPropertyColumnAliases = ArrayHelper.to2DStringArray( lazyColAliases );
lazyPropertyNames = ArrayHelper.toStringArray( lazyNames ); lazyPropertyNames = ArrayHelper.toStringArray( lazyNames );