svn merge -c 1295061. Merge HADOOP-7940 into branch-0.23. (Csaba Miklos via harsh).

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1295064 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Harsh J 2012-02-29 11:04:45 +00:00
parent cf56c58fd9
commit b43b75887f
3 changed files with 13 additions and 0 deletions

View File

@ -88,6 +88,8 @@ Release 0.23.3 - UNRELEASED
HADOOP-8104. Inconsistent Jackson versions (tucu)
HADOOP-7940. The Text.clear() method does not clear the bytes as intended. (Csaba Miklos via harsh)
Release 0.23.2 - UNRELEASED
NEW FEATURES

View File

@ -239,6 +239,7 @@ public class Text extends BinaryComparable
*/
public void clear() {
length = 0;
bytes = EMPTY_BYTES;
}
/*

View File

@ -192,6 +192,16 @@ public class TestText extends TestCase {
assertTrue(text.find("\u20ac", 5)==11);
}
public void testClear() {
Text text = new Text();
assertEquals("", text.toString());
assertEquals(0, text.getBytes().length);
text = new Text("abcd\u20acbdcd\u20ac");
text.clear();
assertEquals("", text.toString());
assertEquals(0, text.getBytes().length);
}
public void testFindAfterUpdatingContents() throws Exception {
Text text = new Text("abcd");
text.set("a".getBytes());