Skip to content

Commit

Permalink
Fixing squid:S2583 Conditions should not unconditionally evaluate to …
Browse files Browse the repository at this point in the history
…"TRUE" or to "FALSE"
  • Loading branch information
devFozgul committed Jun 30, 2016
1 parent 468d10e commit 53a9ad4
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public boolean setChildAt(int index, N newChild) throws IndexOutOfBoundsExceptio
throw new IndexOutOfBoundsException();
}

final N oldChild = (index < count) ? this.children.get(index) : null;
final N oldChild = this.children.get(index);
if (oldChild == newChild) {
return false;
}
Expand All @@ -257,19 +257,11 @@ public boolean setChildAt(int index, N newChild) throws IndexOutOfBoundsExceptio
}
}

if (index < count) {
// set the element
if (newChild != null) {
this.children.set(index, newChild);
} else {
this.children.remove(index);
}
} else if (newChild != null) {
// Resize the array
if (this.children == null) {
this.children = newInternalList(index + 1);
}
this.children.add(newChild);
// set the element
if (newChild != null) {
this.children.set(index, newChild);
} else {
this.children.remove(index);
}

if (newChild != null) {
Expand Down

0 comments on commit 53a9ad4

Please sign in to comment.