You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2021/02/08 22:39:20 UTC

[hbase] branch branch-2 updated (3c29eae -> 4c6f0f3)

This is an automated email from the ASF dual-hosted git repository.

stack pushed a change to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git.


    from 3c29eae  HBASE-25542 Add client detail to scan name so when lease expires, we … (#2930)
     new 1d281ef  Revert "fix bug: string out of bounds when construct illegal tablename error message (#2884)"
     new 4c6f0f3  HBASE-25512 May throw StringIndexOutOfBoundsException when construct illegal tablename error Revert of a revert -- i.e. a reapply -- that adds in the JIRA # missing from original commit.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[hbase] 02/02: HBASE-25512 May throw StringIndexOutOfBoundsException when construct illegal tablename error Revert of a revert -- i.e. a reapply -- that adds in the JIRA # missing from original commit.

Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit 4c6f0f35bfbe6250942d7aa0bcb8efca543baeff
Author: stack <st...@apache.org>
AuthorDate: Mon Feb 8 14:38:03 2021 -0800

    HBASE-25512 May throw StringIndexOutOfBoundsException when construct illegal tablename error
    Revert of a revert -- i.e. a reapply -- that adds in the JIRA # missing
    from original commit.
---
 hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java   | 6 ++----
 .../src/test/java/org/apache/hadoop/hbase/TestTableName.java        | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java
index b1205e0..903c42e 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java
@@ -185,16 +185,14 @@ public final class TableName implements Comparable<TableName> {
     if(end - start < 1) {
       throw new IllegalArgumentException(isSnapshot ? "Snapshot" : "Table" + " qualifier must not be empty");
     }
+    String qualifierString = Bytes.toString(qualifierName, start, end - start);
     if (qualifierName[start] == '.' || qualifierName[start] == '-') {
       throw new IllegalArgumentException("Illegal first character <" + qualifierName[start] +
                                          "> at 0. " + (isSnapshot ? "Snapshot" : "User-space table") +
                                          " qualifiers can only start with 'alphanumeric " +
                                          "characters' from any language: " +
-                                         Bytes.toString(qualifierName, start, end));
+                                         qualifierString);
     }
-    // Treat the bytes as UTF-8
-    String qualifierString = new String(
-        qualifierName, start, (end - start), StandardCharsets.UTF_8);
     if (qualifierString.equals(DISALLOWED_TABLE_NAME)) {
       // Per https://zookeeper.apache.org/doc/r3.4.10/zookeeperProgrammers.html#ch_zkDataModel
       // A znode named "zookeeper" is disallowed by zookeeper.
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java
index e1cd52a..a908a48 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java
@@ -137,7 +137,7 @@ public class TestTableName {
 
   @Test public void testIllegalHTableNames() {
     for (String tn : illegalTableNames) {
-      assertThrows(Exception.class,
+      assertThrows(IllegalArgumentException.class,
         () -> TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(tn)));
     }
   }


[hbase] 01/02: Revert "fix bug: string out of bounds when construct illegal tablename error message (#2884)"

Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit 1d281effe60eb304a09737b53264c426a67a50ba
Author: stack <st...@apache.org>
AuthorDate: Mon Feb 8 14:37:46 2021 -0800

    Revert "fix bug: string out of bounds when construct illegal tablename error message (#2884)"
    
    This reverts commit 9b6c135df6a385e017efecc044c366b7545e1f12.
---
 hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java   | 6 ++++--
 .../src/test/java/org/apache/hadoop/hbase/TestTableName.java        | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java
index 903c42e..b1205e0 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java
@@ -185,14 +185,16 @@ public final class TableName implements Comparable<TableName> {
     if(end - start < 1) {
       throw new IllegalArgumentException(isSnapshot ? "Snapshot" : "Table" + " qualifier must not be empty");
     }
-    String qualifierString = Bytes.toString(qualifierName, start, end - start);
     if (qualifierName[start] == '.' || qualifierName[start] == '-') {
       throw new IllegalArgumentException("Illegal first character <" + qualifierName[start] +
                                          "> at 0. " + (isSnapshot ? "Snapshot" : "User-space table") +
                                          " qualifiers can only start with 'alphanumeric " +
                                          "characters' from any language: " +
-                                         qualifierString);
+                                         Bytes.toString(qualifierName, start, end));
     }
+    // Treat the bytes as UTF-8
+    String qualifierString = new String(
+        qualifierName, start, (end - start), StandardCharsets.UTF_8);
     if (qualifierString.equals(DISALLOWED_TABLE_NAME)) {
       // Per https://zookeeper.apache.org/doc/r3.4.10/zookeeperProgrammers.html#ch_zkDataModel
       // A znode named "zookeeper" is disallowed by zookeeper.
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java
index a908a48..e1cd52a 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java
@@ -137,7 +137,7 @@ public class TestTableName {
 
   @Test public void testIllegalHTableNames() {
     for (String tn : illegalTableNames) {
-      assertThrows(IllegalArgumentException.class,
+      assertThrows(Exception.class,
         () -> TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(tn)));
     }
   }