Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
-
Reviewed
Description
hbase-common/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfo.java
RSGroupInfo(String name, SortedSet<Address> servers, SortedSet<TableName> tables) { this.name = name; this.servers = servers == null? new TreeSet<>(): servers; this.servers.addAll(servers); this.tables = new TreeSet<>(tables); }
2 improvements could be made:
- When servers is not null, addAll(servers) tries to add all items in servers again. Seems not needed
- new TreeSet<>(tables) has no null check on tables. The constructor of TreeSet does not do the null check either. It leads to NullPointerException if tables is null