Skip to content

Commit

Permalink
[XMLBEANS-641] add check for empty local part when saving XML
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/xmlbeans/trunk@1912719 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
pjfanning committed Oct 3, 2023
1 parent c5dfedd commit 81d123d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/org/apache/xmlbeans/impl/store/Saver.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1096,8 +1100,6 @@ private void emitName(QName name, boolean needsPrefix) {
}
}

assert name.getLocalPart().length() > 0;

emit(name.getLocalPart());
}

Expand Down
Binary file modified src/main/java9/module-info.class
Binary file not shown.

0 comments on commit 81d123d

Please sign in to comment.