From 81d123d45e5adb045b213670ad48304f34009ccf Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Tue, 3 Oct 2023 13:58:39 +0000 Subject: [PATCH] [XMLBEANS-641] add check for empty local part when saving XML git-svn-id: https://svn.apache.org/repos/asf/xmlbeans/trunk@1912719 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/xmlbeans/impl/store/Saver.java | 6 ++++-- src/main/java9/module-info.class | Bin 1757 -> 1757 bytes 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/xmlbeans/impl/store/Saver.java b/src/main/java/org/apache/xmlbeans/impl/store/Saver.java index fac6a4400..a7500ed40 100755 --- a/src/main/java/org/apache/xmlbeans/impl/store/Saver.java +++ b/src/main/java/org/apache/xmlbeans/impl/store/Saver.java @@ -1067,6 +1067,10 @@ protected void emitEndDoc(SaveCur c) { private void emitName(QName name, boolean needsPrefix) { assert name != null; + if (name != null && (name.getLocalPart() == null || name.getLocalPart().isEmpty())) { + throw new IllegalArgumentException("emitName does not support names with empty local part"); + } + String uri = name.getNamespaceURI(); assert uri != null; @@ -1096,8 +1100,6 @@ private void emitName(QName name, boolean needsPrefix) { } } - assert name.getLocalPart().length() > 0; - emit(name.getLocalPart()); } diff --git a/src/main/java9/module-info.class b/src/main/java9/module-info.class index 0936481e99dea57969492d4ed78ff56590040503..77b5d1b7141113869e32eb922b98128125322c9f 100644 GIT binary patch delta 13 Ucmcc1dzW{D3zLz-Mz`r~03-(lp#T5? delta 13 Ucmcc1dzW{D3zMPwMz`r~03;*?rvLx|