Skip to content

Commit 5685fdd

Browse files
committed
[refactor] allow null value in item separator again
This is just to safeguard against possible uses of FunSerialize.normalize we don't know of.
1 parent 96f4970 commit 5685fdd

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

exist-core/src/main/java/org/exist/xquery/functions/fn/FunSerialize.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ public static Sequence normalize(final Expression callingExpr, final XQueryConte
186186
try {
187187
final MemTreeBuilder builder = context.getDocumentBuilder();
188188
final DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(callingExpr, builder, true);
189+
final String safeItemSeparator = itemSeparator == null ? "" : itemSeparator;
189190
for (final SequenceIterator i = step2.iterate(); i.hasNext(); ) {
190191
final Item next = i.nextItem();
191192
if (Type.subTypeOf(next.getType(), Type.NODE)) {
@@ -196,7 +197,7 @@ public static Sequence normalize(final Expression callingExpr, final XQueryConte
196197
}
197198
// add itemSeparator if there is a next item
198199
if (i.hasNext()) {
199-
receiver.characters(itemSeparator);
200+
receiver.characters(safeItemSeparator);
200201
}
201202
}
202203
return (DocumentImpl)receiver.getDocument();

exist-core/src/main/java/org/exist/xquery/functions/util/Eval.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ private Sequence doEval(final XQueryContext evalContext, final Sequence contextS
404404

405405
final Sequence seq;
406406
if (xqSerializer.normalize()) {
407-
seq = FunSerialize.normalize(this, context, result, "");
407+
// TODO(JL): should this not be changed to DEFAULT_ITEM_SEPARATOR
408+
seq = FunSerialize.normalize(this, context, result, null);
408409
} else {
409410
seq = result;
410411
}

0 commit comments

Comments
 (0)