Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-19702

Improve RSGroupInfo constructors

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.0.0-beta-1, 2.0.0
    • 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

      Attachments

        1. HBASE-19702.master.000.patch
          1 kB
          Xiang Li
        2. HBASE-19702.master.001.patch
          1 kB
          Xiang Li

        Activity

          People

            xiangli Xiang Li
            xiangli Xiang Li
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: