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 ?
I noticed that RuntimeExceptions are thrown instead of MrzParseExceptions, in 3 different places in the library:
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); }
public final MrzRecord newRecord() { try { return recordClass.newInstance(); } catch (Exception ex) { throw new RuntimeException(ex); } }
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