Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -58,11 +58,15 @@ public SimpleUri(Name moduleName, Name objectName) {
}

/**
* Creates a SimpleUri from a string in the format "module:object". If the string does not match this format, it will be marked invalid
* Creates a SimpleUri from a string in the format "module:object". If the string does not match this format
* (including {@code null}), it will be marked invalid.
*
* @param simpleUri
*/
public SimpleUri(String simpleUri) {
if (simpleUri == null) {
return;
}
String[] split = simpleUri.split(MODULE_SEPARATOR, 2);
if (split.length > 1) {
moduleName = new Name(split[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ public PersistedData serializeNonNull(T value, PersistedDataSerializer serialize
@Override
public Optional<T> deserialize(PersistedData data) {
if (data.isString()) {
return Optional.ofNullable(getFromString(data.getAsString()));
String value = data.getAsString();
if (value == null) {
// A PersistedData can report isString() true while still holding no actual
// content (e.g. a stale/renamed reference in older save data) - treat that the
// same as "absent" instead of forwarding null into getFromString(), which for
// handlers like ComponentClassTypeHandler ends up constructing a SimpleUri(null).
return Optional.empty();
}
return Optional.ofNullable(getFromString(value));
}
return Optional.empty();
}
Expand Down
Loading