You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by st...@apache.org on 2021/01/08 10:50:52 UTC
[hadoop] branch branch-3.3 updated: Revert "HADOOP-17430. Restore
ability to set Text to empty byte array (#2545)"
This is an automated email from the ASF dual-hosted git repository.
stevel pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.3 by this push:
new a2ae0d7 Revert "HADOOP-17430. Restore ability to set Text to empty byte array (#2545)"
a2ae0d7 is described below
commit a2ae0d707987e7a0abfad8d0da6f0d2837d44001
Author: Steve Loughran <st...@cloudera.com>
AuthorDate: Fri Jan 8 10:49:31 2021 +0000
Revert "HADOOP-17430. Restore ability to set Text to empty byte array (#2545)"
This reverts commit 9e85eb9a2ef1ba2e4e19f233e0cc114dfd07a6dc.
Change-Id: Id1ac803b29931b0f643cb37bbe58534726c36f1e
---
.../src/main/java/org/apache/hadoop/io/Text.java | 13 ++-----------
.../src/test/java/org/apache/hadoop/io/TestText.java | 18 ------------------
2 files changed, 2 insertions(+), 29 deletions(-)
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java
index 67d7c4f..3ab327f 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java
@@ -203,19 +203,10 @@ public class Text extends BinaryComparable
}
}
- /**
- * Set to a utf8 byte array. If the length of <code>utf8</code> is
- * <em>zero</em>, actually clear {@link #bytes} and any existing
- * data is lost.
+ /** Set to a utf8 byte array
*/
public void set(byte[] utf8) {
- if (utf8.length == 0) {
- bytes = EMPTY_BYTES;
- length = 0;
- textLength = -1;
- } else {
- set(utf8, 0, utf8.length);
- }
+ set(utf8, 0, utf8.length);
}
/** copy a text. */
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestText.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestText.java
index 715afaf..0fb20ac 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestText.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestText.java
@@ -449,22 +449,4 @@ public class TestText {
2, Text.utf8Length(new String(new char[]{(char)254})));
}
- @Test
- public void testSetBytes(){
- Text a = new Text(new byte[100]);
- assertEquals("testSetBytes100 getLength error !",
- 100, a.getLength());
- assertEquals("testSetBytes100 getBytes.length error !",
- 100, a.getBytes().length);
- assertEquals("testSetBytes100 getTextLength error !",
- 100, a.getTextLength());
-
- a.set(new byte[0]);
- assertEquals("testSetBytes0 getLength error !",
- 0, a.getLength());
- assertEquals("testSetBytes0 getBytes.length error !",
- 0, a.getBytes().length);
- assertEquals("testSetBytes0 getTextLength error !",
- 0, a.getTextLength());
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org