From b3555ec0c0aafcfc172658900108c33af7aee93c Mon Sep 17 00:00:00 2001 From: Mike Meessen Date: Mon, 24 Jun 2024 23:04:14 +0200 Subject: [PATCH] fix: Unmarshalling hexBinary with leading whitespaces yields `null` Fixes #312 --- .../jakarta/xml/bind/annotation/adapters/HexBinaryAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/jakarta/xml/bind/annotation/adapters/HexBinaryAdapter.java b/api/src/main/java/jakarta/xml/bind/annotation/adapters/HexBinaryAdapter.java index 5a74f80..90c54fe 100644 --- a/api/src/main/java/jakarta/xml/bind/annotation/adapters/HexBinaryAdapter.java +++ b/api/src/main/java/jakarta/xml/bind/annotation/adapters/HexBinaryAdapter.java @@ -28,7 +28,7 @@ public HexBinaryAdapter() {} @Override public byte[] unmarshal(String s) { if(s==null) return null; - return DatatypeConverter.parseHexBinary(s); + return DatatypeConverter.parseHexBinary(s.trim()); } @Override