Skip to content

Commit

Permalink
add support for empty no block due date
Browse files Browse the repository at this point in the history
  • Loading branch information
brichardEbsco committed Jun 9, 2021
1 parent 57e37f8 commit 2c56ee1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/folio/edge/sip2/parser/MessageParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
public abstract class MessageParser {
private static final Logger log = LogManager.getLogger();
private static final String MISSING_NB_DUE_DATE = " ".repeat(18);

protected int position;
protected final Character delimiter;
Expand Down Expand Up @@ -64,12 +65,12 @@ protected String parseVariableLengthField(char [] messageChars, Field field) {

protected OffsetDateTime parseDateTimeNB(char [] messageChars) {
final String dateTimeString = new String(messageChars, position, 18);
position += 18;

if (" ".repeat(18).equals(dateTimeString)) { // return null for 18 space nb due date
position += 18;
if (MISSING_NB_DUE_DATE.equals(dateTimeString)) { // return null for 18 space nb due date
return null;
} else {
return parseDateTime(messageChars);
return convertFieldToDateTime(dateTimeString);
}
}

Expand Down

0 comments on commit 2c56ee1

Please sign in to comment.