Skip to content

Commit

Permalink
Try to fix privEval iterator
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Crawford <[email protected]>
  • Loading branch information
stephen-crawford committed Apr 24, 2023
1 parent 47f08b9 commit 2b6774b
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

package org.opensearch.security.privileges;

import com.carrotsearch.hppc.cursors.ObjectCursor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -649,7 +650,23 @@ private boolean checkFilteredAliases(Resolved requestedResolved, String action,
indexMetaDataCollection = new Iterable<IndexMetadata>() {
@Override
public Iterator<IndexMetadata> iterator() {
return (Iterator<IndexMetadata>) clusterService.state().getMetadata().getIndices().values();
final Iterator<ObjectCursor<IndexMetadata>> iterator = clusterService.state().getMetadata().getIndices().values().iterator();
return new Iterator<IndexMetadata>() {
@Override
public boolean hasNext() {
return iterator.hasNext();
}

@Override
public IndexMetadata next() {
return iterator.next().value;
}

@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
};
} else {
Expand Down

0 comments on commit 2b6774b

Please sign in to comment.