mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 09:05:21 +00:00
don't use NPE to indicate that a PostInitCallbackEntry is unready and needs to be re-queued
because: - to anyone stepping through the code it looks like a bug - nobody *reading* the code would have any way of guessing that this is behavior that can happen, much less that it's expected and correct
This commit is contained in:
parent
6fcbe5f0a0
commit
9a98976b41
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@ -595,22 +594,22 @@ public void visitFetchables(Consumer<Fetchable> fetchableConsumer, EntityMapping
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SelectableMapping getSelectable(int columnIndex) {
|
public SelectableMapping getSelectable(int columnIndex) {
|
||||||
return selectableMappings.getSelectable( columnIndex );
|
return getSelectableMappings().getSelectable( columnIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getJdbcTypeCount() {
|
public int getJdbcTypeCount() {
|
||||||
return selectableMappings.getJdbcTypeCount();
|
return getSelectableMappings().getJdbcTypeCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<JdbcMapping> getJdbcMappings() {
|
public List<JdbcMapping> getJdbcMappings() {
|
||||||
return selectableMappings.getJdbcMappings();
|
return getSelectableMappings().getJdbcMappings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action) {
|
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action) {
|
||||||
return selectableMappings.forEachSelectable(
|
return getSelectableMappings().forEachSelectable(
|
||||||
offset,
|
offset,
|
||||||
(index, selectable) -> action.accept( index, selectable.getJdbcMapping() )
|
(index, selectable) -> action.accept( index, selectable.getJdbcMapping() )
|
||||||
);
|
);
|
||||||
@ -690,12 +689,24 @@ public int forEachDisassembledJdbcValue(
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int forEachSelectable(SelectableConsumer consumer) {
|
public int forEachSelectable(SelectableConsumer consumer) {
|
||||||
return selectableMappings.forEachSelectable( 0, consumer );
|
return getSelectableMappings().forEachSelectable( 0, consumer );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int forEachSelectable(int offset, SelectableConsumer consumer) {
|
public int forEachSelectable(int offset, SelectableConsumer consumer) {
|
||||||
return selectableMappings.forEachSelectable( offset, consumer );
|
return getSelectableMappings().forEachSelectable( offset, consumer );
|
||||||
|
}
|
||||||
|
|
||||||
|
private SelectableMappings getSelectableMappings() {
|
||||||
|
if (selectableMappings == null) {
|
||||||
|
// This is expected to happen when processing a
|
||||||
|
// PostInitCallbackEntry because the callbacks
|
||||||
|
// are not ordered. The exception is caught in
|
||||||
|
// MappingModelCreationProcess.executePostInitCallbacks()
|
||||||
|
// and the callback is re-queued.
|
||||||
|
throw new IllegalStateException("not yet ready");
|
||||||
|
}
|
||||||
|
return selectableMappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user