steveloughran commented on a change in pull request #2545:
URL: https://github.com/apache/hadoop/pull/2545#discussion_r545809363
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java
##########
@@ -226,6 +226,12 @@ public void set(String string) {
* Set to a utf8 byte array.
*/
public void set(byte[] utf8) {
+ if(utf8.length == 0){
+ bytes = EMPTY_BYTES;
+ length = 0;
+ textLength = -1;
+ return;
Review comment:
I think I'd prefer to cut the return here and just have an `else` clause
for the normal set() operation.
This isn't so long and complex a piece of code that an early return makes
sense; it can be easy to miss that it's there when reading the code.
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java
##########
@@ -226,6 +226,12 @@ public void set(String string) {
* Set to a utf8 byte array.
*/
public void set(byte[] utf8) {
+ if(utf8.length == 0){
Review comment:
nit: can you add spaces either side of the () ,e.g
```
if (utf8.length == 0) {
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]