瀏覽代碼

HADOOP-712. Fix record io's xml serialization to correctly handle control characters. Contributed by Milind.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@474946 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 年之前
父節點
當前提交
6c984cc361

+ 3 - 0
CHANGES.txt

@@ -67,6 +67,9 @@ Trunk (unreleased changes)
     Each task's log output is now available through the web ui.  (Arun
     C Murthy via cutting)
 
+21. HADOOP-712.  Fix record io's xml serialization to correctly handle
+    control-characters.  (Milind Bhandarkar via cutting)
+
 
 Release 0.8.0 - 2006-11-03
 

+ 1 - 1
src/java/org/apache/hadoop/record/Utils.java

@@ -62,7 +62,7 @@ public class Utils {
         return true;
     }
     
-    public static final byte[] hexchars = { '0', '1', '2', '3', '4', '5',
+    public static final char[] hexchars = { '0', '1', '2', '3', '4', '5',
                                             '6', '7', '8', '9', 'A', 'B',
                                             'C', 'D', 'E', 'F' };
     /**

+ 2 - 2
src/test/org/apache/hadoop/record/test/TestRecordIO.java

@@ -127,12 +127,12 @@ public class TestRecordIO extends TestCase {
             r1.setDoubleVal(1.5234);
             r1.setIntVal(4567);
             r1.setLongVal(0x5a5a5a5a5a5aL);
-            r1.setStringVal(new Text("random &lt; %text<&more"));
+            r1.setStringVal(new Text("ran\002dom &lt; %text<&more"));
             r1.setBufferVal(new ByteArrayOutputStream(20));
             r1.setVectorVal(new ArrayList());
             r1.setMapVal(new TreeMap());
             RecRecord0 r0 = new RecRecord0();
-            r0.setStringVal(new Text("other %random &amp; >&more text"));
+            r0.setStringVal(new Text("other %rando\007m &amp; >&more text"));
             r1.setRecordVal(r0);
             out.write(r1);
             ostream.close();