diff --git a/src/org/labkey/test/params/FieldKey.java b/src/org/labkey/test/params/FieldKey.java index 1469033737..eb3100a331 100644 --- a/src/org/labkey/test/params/FieldKey.java +++ b/src/org/labkey/test/params/FieldKey.java @@ -2,6 +2,7 @@ import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Arrays; @@ -65,7 +66,7 @@ public static FieldKey fromParts(String... parts) * @param fieldKey String or FieldKey * @return FieldKey representation of the String, or the identity if a FieldKey was provided */ - public static FieldKey fromFieldKey(CharSequence fieldKey) + public static @Nullable FieldKey fromFieldKey(CharSequence fieldKey) { if (fieldKey instanceof WrapsFieldKey fk) { @@ -73,7 +74,14 @@ public static FieldKey fromFieldKey(CharSequence fieldKey) } else { - return fromParts(Arrays.stream(fieldKey.toString().split(SEPARATOR)).map(FieldKey::decodePart).toList()); + try + { + return fromParts(Arrays.stream(fieldKey.toString().split(SEPARATOR)).map(FieldKey::decodePart).toList()); + } + catch (IllegalArgumentException iae) + { + return null; // FieldReferenceManager depends on this returning null. + } } }