You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2022/09/30 20:39:13 UTC

[GitHub] [cxf] knut-estalea commented on a diff in pull request #1003: Fix SortedArraySet remove, containsAll

knut-estalea commented on code in PR #1003:
URL: https://github.com/apache/cxf/pull/1003#discussion_r984932840


##########
core/src/main/java/org/apache/cxf/common/util/SortedArraySet.java:
##########
@@ -71,25 +71,29 @@ private T[] newArray(int size) {
     }
 
     public boolean add(T o) {

Review Comment:
   The changes to `add` aren't fixing any bug. It just seemed like a waste to do a full sort every time.



##########
core/src/main/java/org/apache/cxf/common/util/SortedArraySet.java:
##########
@@ -138,20 +142,21 @@ public boolean remove(Object o) {
             return false;
         }
         int idx = Arrays.binarySearch(tmp, o);
-        if (idx != -1) {

Review Comment:
   The bug was here (idx == -1). Every negative value means "not found".



##########
core/src/main/java/org/apache/cxf/common/util/SortedArraySet.java:
##########
@@ -99,9 +103,9 @@ public boolean addAll(Collection<? extends T> c) {
         return val;
     }
     public boolean containsAll(Collection<?> c) {

Review Comment:
   This method is unused in the CXF code base as far as I can tell.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org