Skip to content

Commit 5273f9f

Browse files
committed
[refactor] Address SonarCloud static code analysis issues
1 parent 441feab commit 5273f9f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ public NamedNodeMap getAttributes() {
835835
for(int i = 0; i < childCount; i++) {
836836
final IStoredNode next = iterator.next();
837837
if (next == null) {
838-
LOG.warn("Miscounted getChildCount() index " + i + " was null of " + childCount);
838+
LOG.warn("Miscounted getChildCount() index: {} was null of: {}", i, childCount);
839839
continue;
840840
}
841841
if(next.getNodeType() != Node.ATTRIBUTE_NODE) {
@@ -1350,7 +1350,7 @@ public void setNamespaceMappings(final Map<String, String> map) {
13501350
public Iterator<String> getPrefixes() {
13511351

13521352
if (namespaceMappings == null) {
1353-
return Collections.EMPTY_SET.iterator();
1353+
return Collections.<String>emptySet().iterator();
13541354
}
13551355
return namespaceMappings.keySet().iterator();
13561356
}

exist-core/src/main/java/org/exist/xquery/update/Insert.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathExc
130130

131131
//start a transaction
132132
try (final Txn transaction = getTransaction()) {
133-
final StoredNode[] ql = selectAndLock(transaction, inSeq);
133+
final StoredNode<?>[] ql = selectAndLock(transaction, inSeq);
134134
final NotificationService notifier = context.getBroker().getBrokerPool().getNotificationService();
135135
final NodeList contentList = seq2nodeList(contentSeq);
136-
for (final StoredNode node : ql) {
136+
for (final StoredNode<?> node : ql) {
137137
final DocumentImpl doc = node.getOwnerDocument();
138138
if (!doc.getPermissions().validate(context.getSubject(), Permission.WRITE)) {
139139
throw new PermissionDeniedException("User '" + context.getSubject().getName() + "' does not have permission to write to the document '" + doc.getDocumentURI() + "'!");
@@ -144,7 +144,7 @@ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathExc
144144
validateNonDefaultNamespaces(contentList, node);
145145
node.appendChildren(transaction, contentList, -1);
146146
} else {
147-
final NodeImpl parent = (NodeImpl) getParent(node);
147+
final NodeImpl<?> parent = (NodeImpl<?>) getParent(node);
148148
validateNonDefaultNamespaces(contentList, parent);
149149
switch (mode) {
150150
case INSERT_BEFORE:
@@ -225,7 +225,7 @@ private void validateNonDefaultNamespaceNode(final ElementImpl parentElement, fi
225225
* @param parent the position into which the nodes are being inserted
226226
* @throws XPathException if a node has a namespace conflict
227227
*/
228-
private void validateNonDefaultNamespaces(final NodeList nodeList, final NodeImpl parent) throws XPathException {
228+
private <T extends NodeImpl<T>> void validateNonDefaultNamespaces(final NodeList nodeList, final NodeImpl<T> parent) throws XPathException {
229229
if (parent instanceof ElementImpl) {
230230
final ElementImpl parentAsElement = (ElementImpl) parent;
231231
for (int i = 0; i < nodeList.getLength(); i++) {

0 commit comments

Comments
 (0)