HDFS-12828. OIV ReverseXML Processor fails with escaped characters

Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
Erik Krogen 2018-04-18 14:38:23 +09:00 committed by Akira Ajisaka
parent bcb57b1f89
commit 2d9e791a90
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50
2 changed files with 8 additions and 3 deletions

View File

@ -385,8 +385,8 @@ private void loadNodeChildrenHelper(Node parent, String expected,
break; break;
case XMLEvent.CHARACTERS: case XMLEvent.CHARACTERS:
String val = XMLUtils. String val = XMLUtils.
unmangleXmlString(ev.asCharacters().getData(), true); unmangleXmlString(ev.asCharacters().getData(), false);
parent.setVal(val); parent.setVal(parent.getVal() + val);
events.nextEvent(); events.nextEvent();
break; break;
case XMLEvent.ATTRIBUTE: case XMLEvent.ATTRIBUTE:

View File

@ -194,10 +194,15 @@ public static void createOriginalFSImage() throws IOException {
dirCount++; dirCount++;
writtenFiles.put(emptydir.toString(), hdfs.getFileStatus(emptydir)); writtenFiles.put(emptydir.toString(), hdfs.getFileStatus(emptydir));
//Create a directory whose name should be escaped in XML //Create directories whose name should be escaped in XML
Path invalidXMLDir = new Path("/dirContainingInvalidXMLChar\u0000here"); Path invalidXMLDir = new Path("/dirContainingInvalidXMLChar\u0000here");
hdfs.mkdirs(invalidXMLDir); hdfs.mkdirs(invalidXMLDir);
dirCount++; dirCount++;
Path entityRefXMLDir = new Path("/dirContainingEntityRef&here");
hdfs.mkdirs(entityRefXMLDir);
dirCount++;
writtenFiles.put(entityRefXMLDir.toString(),
hdfs.getFileStatus(entityRefXMLDir));
//Create a directory with sticky bits //Create a directory with sticky bits
Path stickyBitDir = new Path("/stickyBit"); Path stickyBitDir = new Path("/stickyBit");