abhishekagarwal87 commented on code in PR #13079:
URL: https://github.com/apache/druid/pull/13079#discussion_r1027678714
##########
core/src/main/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapper.java:
##########
@@ -166,4 +167,52 @@ public void close()
throw new RuntimeException(thrown);
}
}
+
+ public static String escapeFilename(String fileName)
+ {
+ StringBuilder sb = new StringBuilder(fileName.length());
+ for (int i = 0; i < fileName.length(); i++) {
+ if ('\n' == fileName.charAt(i)) {
+ sb.append("\\n");
+ } else if (',' == fileName.charAt(i)) {
+ sb.append("\\u002c");
+ } else {
+ sb.append(fileName.charAt(i));
+ }
+ }
+ return sb.toString();
+ }
+
+ public static String unescapeFilename(String fileName)
+ {
+ StringBuilder sb = new StringBuilder(fileName.length());
+ boolean escaped = false;
+ for (int i = 0; i < fileName.length(); i++) {
+ if ('\\' == fileName.charAt(i)) {
+ escaped = true;
+ } else {
+ if (escaped) {
+ escaped = false;
+ if ('n' == fileName.charAt(i)) {
+ sb.append("\n");
+ } else if (
+ 'u' == fileName.charAt(i) &&
+ '0' == fileName.charAt(i + 1) &&
+ '0' == fileName.charAt(i + 2) &&
+ '2' == fileName.charAt(i + 3) &&
+ 'c' == fileName.charAt(i + 4)
Review Comment:
what if we are are exceeding the string length here?
##########
core/src/main/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapper.java:
##########
@@ -48,6 +48,7 @@
*/
public class SmooshedFileMapper implements Closeable
{
+ private static final String COMMA = "\u002c";
Review Comment:
is it used anywhere?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]