Skip to content

Commit 80a730c

Browse files
committed
handle null pkeys in explorer ui
Null primary keys are not supported, however when a null primary key is present, browsing a selected type in the Hollow Explorer UI will fail with an OOB exception. Handle null primary keys so that they are still displayed in the selected type page, with "NULL" substituted in-place of missing fields.
1 parent 1fd1a84 commit 80a730c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

hollow-explorer-ui/src/main/java/com/netflix/hollow/explorer/ui/pages/BrowseSelectedTypePage.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ private TypeKey getKey(int recordIdx, HollowTypeReadState typeState, int ordinal
167167
delimiterEscapedKeyBuilder.append(MULTI_FIELD_KEY_DELIMITER);
168168
}
169169

170+
if (curOrdinal == ORDINAL_NONE) {
171+
// Handle the case where the field is null, display "NULL"
172+
// as the key so the user can take action on it, while still
173+
// rendering the key's non-null fields.
174+
keyBuilder.append("NULL");
175+
delimiterEscapedKeyBuilder.append("NULL");
176+
continue;
177+
}
178+
170179
Object fieldValueObject = HollowReadFieldUtils.fieldValueObject(curState, curOrdinal, fieldPathIndexes[i][fieldPathIndexes[i].length - 1]);
171180
keyBuilder.append(fieldValueObject);
172181
if (fieldValueObject instanceof String) {

0 commit comments

Comments
 (0)