Skip to content

RuntimeException thrown instead of MrzParseException #22

@GoUpNorth

Description

@GoUpNorth

I noticed that RuntimeExceptions are thrown instead of MrzParseExceptions, in 3 different places in the library:

  • MrzParser line 249
    private static int getCharacterValue(char c) { if (c == FILLER) { return 0; } if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'Z') { return c - 'A' + 10; } throw new RuntimeException("Invalid character in MRZ record: " + c); }
  • MrzFormat line 144
    public final MrzRecord newRecord() { try { return recordClass.newInstance(); } catch (Exception ex) { throw new RuntimeException(ex); } }
  • MrzSex line 50
    public static MrzSex fromMrz(char sex) { switch (sex) { case 'M': return Male; case 'F': return Female; case '<': case 'X': return Unspecified; default: throw new RuntimeException("Invalid MRZ sex character: " + sex); } }

It looks like a bug to me. Shouldn't a MrzParseException be thrown in those cases ?

Regards,
P-A

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions