Skip to content

Commit 8b08052

Browse files
committed
[optimize] Optimise wrapping of persistent DOM Nodes in a Node Proxy
1 parent 5ad35c8 commit 8b08052

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

exist-core/src/main/java/org/exist/dom/persistent/NodeProxy.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,16 @@ public static NodeProxy wrap(@Nullable Expression expression, final NodeImpl nod
290290
final DocumentImpl doc = node instanceof DocumentImpl ? (DocumentImpl) node : (DocumentImpl) node.getOwnerDocument();
291291
expression = expression != null ? expression : doc.getExpression();
292292

293-
final NodeProxy wrapper = new NodeProxy(expression, doc, node.getNodeId(), node.getNodeType());
293+
final long address;
294+
if (node instanceof StoredNode<?>) {
295+
address = ((StoredNode<?>) node).getInternalAddress();
296+
} else {
297+
address = StoredNode.UNKNOWN_NODE_IMPL_ADDRESS;
298+
}
299+
300+
final NodeProxy wrapper = new NodeProxy(expression, doc, node.getNodeId(), node.getNodeType(), address);
294301
wrapper.cachedNode = new WeakReference<>(node);
302+
wrapper.qname = node.getQName();
295303

296304
return wrapper;
297305
}

0 commit comments

Comments
 (0)