Skip to content

Commit df26867

Browse files
committed
#28: A null or white space DAU (height) element value should not be treated as an error. A value less than 3 characters in length should still be treated as an error.
1 parent 5b64ae3 commit df26867

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/IdParser.Core/Parsers/Id/HeightParser.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,19 @@ internal static class HeightParser
99
{
1010
ArgumentNullException.ThrowIfNull(elementId);
1111

12-
if (string.IsNullOrEmpty(rawValue) || rawValue.Length < 3)
12+
if (string.IsNullOrWhiteSpace(rawValue))
1313
{
14-
return FieldHelpers.UnparsedField<Height?>(elementId: elementId, rawValue: rawValue, $"Unable to parse Height from field '{SubfileElementIds.Height}': the field has no value, or has less than 3 characters: '{rawValue}'");
14+
// #28: For 2.0.0, I changed this to return an unparsed field error noting that the field had no value or
15+
// less than 3 characters. AAMVA says that DAU is required, and that when there is no data, it should be
16+
// encoded as NONE or unavl. MI does neither of those, and just leaves the field blank.
17+
// Split this into two separate checks: no value is not an error; return null.
18+
return FieldHelpers.ParsedField<Height?>(elementId: elementId, value: null, rawValue: rawValue);
19+
}
20+
21+
if (rawValue.Length < 3)
22+
{
23+
// #28: ... but we can't parse values that are less than 3 characters in length, so that's still an error.
24+
return FieldHelpers.UnparsedField<Height?>(elementId: elementId, rawValue: rawValue, $"Unable to parse Height from field '{SubfileElementIds.Height}': the field has less than 3 characters: '{rawValue}'");
1525
}
1626

1727
if (version == AAMVAVersion.AAMVA2000)

0 commit comments

Comments
 (0)