-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBASE-25512 May throw StringIndexOutOfBoundsException when construct illegal tablename error #2884
HBASE-25512 May throw StringIndexOutOfBoundsException when construct illegal tablename error #2884
Conversation
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
Patch looks good but please file an accompanying JIRA over here https://issues.apache.org/jira/projects/HBASE/summary After filing JIRA, please change the subject on this PR and make it the JIRA ID followed by the JIRA summary: e.g. HBASE-XXXXX string out of bounds when construct illegal tablename error Thanks. |
OK, I will do this latter |
Done. Create JIRA and link to this. |
@@ -192,16 +192,16 @@ public static void isLegalTableQualifierName(final byte[] qualifierName, | |||
if(end - start < 1) { | |||
throw new IllegalArgumentException(isSnapshot ? "Snapshot" : "Table" + " qualifier must not be empty"); | |||
} | |||
// Treat the bytes as UTF-8 | |||
String qualifierString = new String( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Why do this 'new String' instead of doing Bytes.toString(qualifierName, start, end - start) ?
I fixed the summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!!
No special reason here. Just copy the origin code.
Now I changed code to use Bytes.toString(qualifierName, start, end - start) instead of new String.
Is this better?
c877135
to
e869f89
Compare
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
Thanks for the PR @zhengzhuobinzzb , do you think you can add a test case for this change? |
e869f89
to
15426af
Compare
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
I added it by assert this method must throw IllegalArgumentException when the table name is illegal. |
…message (#2884) Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: stack <stack@apache.org>
…message (apache#2884) Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: stack <stack@apache.org>
…e error message (apache#2884)" This reverts commit 098f7c0.
…illegal tablename error apache#2884 This revert of a revert reapplies the PR; the original application was missing the HBASE JIRA #; thats why it was reverted and then reapplied w/ the JIRA # added. This reverts commit 16fe1e9.
…message (apache#2884) Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: stack <stack@apache.org>
…e error message (apache#2884)" This reverts commit 098f7c0.
…illegal tablename error apache#2884 This revert of a revert reapplies the PR; the original application was missing the HBASE JIRA #; thats why it was reverted and then reapplied w/ the JIRA # added. This reverts commit 16fe1e9.
fix bug: string out of bounds when construct illegal tablename error