-
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-27201 Clean up error-prone findings in hbase-backup #4622
Conversation
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@@ -1639,7 +1642,7 @@ public String[] getListOfBackupIdsFromDeleteOperation() throws IOException { | |||
if (val.length == 0) { | |||
return null; | |||
} | |||
return new String(val).split(","); | |||
return new String(val, StandardCharsets.UTF_8).split(","); |
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.
I think this will introduce another error prone warning? Use guava's Splitter.on
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.
It does not.
@@ -1720,7 +1723,7 @@ public String[] getListOfBackupIdsFromMergeOperation() throws IOException { | |||
if (val.length == 0) { | |||
return null; | |||
} | |||
return new String(val).split(","); | |||
return new String(val, StandardCharsets.UTF_8).split(","); |
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.
Ditto.
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.
It does not produce a warning, because stringsplitter warnings are suppressed.
@@ -1736,11 +1739,13 @@ static Scan createScanForOrigBulkLoadedFiles(TableName table) { | |||
return scan; | |||
} | |||
|
|||
@SuppressWarnings("StringSplitter") |
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.
Since we have shaded guava, I think it is OK for use to make use of guava's Splitter.
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.
There's nothing wrong with string.split in these applications and when I used Splitter it caused more trouble than it was worth.
static String getTableNameFromOrigBulkLoadRow(String rowStr) { | ||
String[] parts = rowStr.split(BLK_LD_DELIM); | ||
return parts[1]; | ||
} | ||
|
||
@SuppressWarnings("StringSplitter") |
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.
Ditto.
@@ -275,12 +276,12 @@ public static List<String> getWALFilesOlderThan(final Configuration c, | |||
return logFiles; | |||
} | |||
|
|||
@SuppressWarnings("StringSplitter") |
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.
DItto.
@@ -593,6 +594,7 @@ public int compare(BackupInfo o1, BackupInfo o2) { | |||
return ts1 < ts2 ? 1 : -1; | |||
} | |||
|
|||
@SuppressWarnings("StringSplitter") |
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.
Ditto.
@@ -731,6 +733,7 @@ public static BulkLoadHFiles createLoader(Configuration config) { | |||
return BulkLoadHFiles.create(conf); | |||
} | |||
|
|||
@SuppressWarnings("StringSplitter") |
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.
Ditto.
@Apache9 It is fine to handle the string split warnings some other way, but I thought I would take this approach. I had a bit of trouble actually using Splitter. I'm sure I could figure it out but there are other things that seem more important. string#split works in these cases and is good enough IMHO. Is this ok? Or, we could just leave these in place and also not add the |
Lets apply the new spotless rule for the automated fix for many of the javadoc issues, and then come back to this PR. |
Usually there is no harm to use String.split, as long as it has been like this for a long time in our code base, so I'm OK with leaving it as is or adding a SuppressWarnings. Thanks. |
No description provided.