Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ protected Page<E> getOrCreateEntryPage(int index) {

public void clear() {
for ( Page<E> entryPage : elementPages ) {
entryPage.clear();
if ( entryPage != null ) {
entryPage.clear();
}
}
elementPages.clear();
elementPages.trimToSize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.hibernate.engine.spi.InstanceIdentity;
import org.hibernate.internal.util.collections.InstanceIdentityMap;
import org.hibernate.testing.orm.junit.Jira;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -99,4 +100,15 @@ public void testSets() {
assertThat( testMap.values() ).hasSize( 100 ).containsAll( map.values() );
assertThat( testMap.entrySet() ).hasSize( 100 ).containsAll( map.entrySet() );
}

@Test
@Jira(value = "https://hibernate.atlassian.net/browse/HHH-19582")
public void testNullPage() {
final TestInstance i1 = new TestInstance( 9999 );
testMap.put( i1, "instance_X" );

testMap.clear();
assertThat( testMap ).isEmpty();
}

}