From d86d66e0ac0c296d813e985217299a4a900a5e49 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Fri, 10 Feb 2023 14:22:57 +0100 Subject: new exception for wrong identifiers in U_HEAD --- src/main/java/org/uic/barcode/staticFrame/UHEADDataRecord.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/org/uic/barcode/staticFrame/UHEADDataRecord.java b/src/main/java/org/uic/barcode/staticFrame/UHEADDataRecord.java index 22ba8ce..fdef178 100644 --- a/src/main/java/org/uic/barcode/staticFrame/UHEADDataRecord.java +++ b/src/main/java/org/uic/barcode/staticFrame/UHEADDataRecord.java @@ -224,6 +224,16 @@ public class UHEADDataRecord extends DataRecord{ ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); String issuerElement = String.format("%4s", this.issuer); + + if (this.identifier == null || this.identifier.length() < 1) { + throw new EncodingFormatException("Identifier in U_HEAD missing"); + } + + if (this.identifier.length() > 20) { + throw new EncodingFormatException("Identifier in U_HEAD too long (max. 20 byte)"); + } + + String idElement = String.format("%20s", this.identifier); -- cgit v1.2.3