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

Should add null checker on table name in HTable constructor and RegionServerCallable

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 1.4.0, 2.0.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      If we run below codes:

      Table table = connection.getTable(null);
      

      we will see below exception:

      java.lang.NullPointerException
      	at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:221)
      	at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:182)
      	at org.apache.hadoop.hbase.client.ConnectionImplementation.getTable(ConnectionImplementation.java:298)
      	at org.apache.hadoop.hbase.client.ConnectionImplementation.getTable(ConnectionImplementation.java:293)
      

      And in this JIRA we will add a null checker and throw a more graceful IllegalArgumentException

      For RegionServerCallable, we're lacking of some null checker when using table name, such as in RegionServerCallable#prepare:

         public void prepare(final boolean reload) throws IOException {
           // check table state if this is a retry
          if (reload && !tableName.equals(TableName.META_TABLE_NAME) &&
              getConnection().isTableDisabled(tableName)) {
             throw new TableNotEnabledException(tableName.getNameAsString() + " is disabled.");
           }
      

      It will throw NPE if tableName is null and invoking tableName.equals. We'll add null checker in such places.

        Attachments

        1. HBASE-17212.addendum.patch
          2 kB
          Yu Li
        2. HBASE-17212.addendum.patch
          2 kB
          Yu Li
        3. HBASE-17212.patch
          0.7 kB
          Yu Li
        4. HBASE-17212.v2.patch
          1 kB
          Yu Li

          Issue Links

            Activity

              People

              • Assignee:
                liyu Yu Li
                Reporter:
                liyu Yu Li
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: