Skip to content

Commit

Permalink
Update after Luca's review
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrx committed Apr 28, 2015
1 parent fd4ec43 commit 46779d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Expand Up @@ -131,7 +131,7 @@ public void readFrom(StreamInput in) throws IOException {
final int len = in.readVInt();
ArrayList<ClusterBlockLevel> levels = new ArrayList<>();
for (int i = 0; i < len; i++) {
levels.addAll(ClusterBlockLevel.fromId(in.readVInt()));
levels.add(ClusterBlockLevel.fromId(in.readVInt()));
}
this.levels = EnumSet.copyOf(levels);
retryable = in.readBoolean();
Expand Down
Expand Up @@ -45,15 +45,15 @@ public int id() {
return this.id;
}

static EnumSet<ClusterBlockLevel> fromId(int id) {
static ClusterBlockLevel fromId(int id) {
if (id == 0) {
return EnumSet.of(READ);
return READ;
} else if (id == 1) {
return EnumSet.of(WRITE);
return WRITE;
} else if (id == 2) {
return EnumSet.of(METADATA_READ);
return METADATA_READ;
} else if (id == 3) {
return EnumSet.of(METADATA_WRITE);
return METADATA_WRITE;
}
throw new ElasticsearchIllegalArgumentException("No cluster block level matching [" + id + "]");
}
Expand Down

0 comments on commit 46779d2

Please sign in to comment.