[
https://issues.apache.org/jira/browse/HDFS-4235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13584792#comment-13584792
]
Aaron T. Myers commented on HDFS-4235:
--------------------------------------
Patch looks pretty good to me. A few little comments:
# Recommend adding a few more comments to the new XMLUtils methods. In
particular, I suggest describing how you determined the ranges of code points
that need mangling in codePointMustBeMangled, and describe the characteristics
of the encoding a little bit in the doc for mangleXmlString.
# Instead of building up the value of escapedCp as an integer, I suggest you
build up the full hex string and then parse out the full value using
{{Integer.parseInt(String, int)}}. This will also let you get rid of the
hexCharToInt function.
# I find it strange that hexCharToInt takes the index in the string as a
parameter. What good is that going to be for debugging purposes if the string
isn't also in the error message? Seems like you should either output the string
or the character that was not a hex character, not the index in the string.
# This javadoc is wrong:
{code}
+ /**
+ * Demangle a string from an XML document.
+ *
+ * @param str The string to be demangled.
+ * @param bld (output) the string builder.
+ */
+ public static String unmangleXmlString(String str) {
{code}
In fact only one param is taken, and the result is returned, not built up using
a return param.
+1 once these are addressed.
> when outputting XML, OfflineEditsViewer can't handle some edits containing
> non-ASCII strings
> --------------------------------------------------------------------------------------------
>
> Key: HDFS-4235
> URL: https://issues.apache.org/jira/browse/HDFS-4235
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Colin Patrick McCabe
> Assignee: Colin Patrick McCabe
> Priority: Minor
> Attachments: HDFS-4235.001.patch
>
>
> It seems that when outputting XML, OfflineEditsViewer can't handle some edits
> containing non-ASCII strings.
> Example:
> {code}
> cmccabe@keter:/h> ./bin/hdfs oev -i ~/Downloads/current2/edits -o /tmp/u.xml
>
> 17:11:24,662 ERROR OfflineEditsBinaryLoader:82 - Got IOException at position
> 10593
> Encountered exception. Exiting: SAX error: The character '�' is an invalid
> XML character
> java.io.IOException: SAX error: The character '�' is an invalid XML character
> at
> org.apache.hadoop.hdfs.tools.offlineEditsViewer.XmlEditsVisitor.visitOp(XmlEditsVisitor.java:119)
> at
> org.apache.hadoop.hdfs.tools.offlineEditsViewer.OfflineEditsBinaryLoader.loadEdits(OfflineEditsBinaryLoader.java:78)
> at
> org.apache.hadoop.hdfs.tools.offlineEditsViewer.OfflineEditsViewer.go(OfflineEditsViewer.java:142)
> at
> org.apache.hadoop.hdfs.tools.offlineEditsViewer.OfflineEditsViewer.run(OfflineEditsViewer.java:228)
> at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
> at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
> at
> org.apache.hadoop.hdfs.tools.offlineEditsViewer.OfflineEditsViewer.main(OfflineEditsViewer.java:237)
> {code}
> Probably, we forgot to properly escape and/or re-encode a filename before
> putting it into the XML. The other processors (stats, binary) don't have
> this problem, so it is purely an XML encoding issue.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira