You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@distributedlog.apache.org by jiazhai <gi...@git.apache.org> on 2017/05/20 02:36:53 UTC

[GitHub] incubator-distributedlog pull request #130: DL-199: Be able to support files...

Github user jiazhai commented on a diff in the pull request:

    https://github.com/apache/incubator-distributedlog/pull/130#discussion_r117600036
  
    --- Diff: distributedlog-core/src/main/java/org/apache/distributedlog/util/DLUtils.java ---
    @@ -281,41 +281,89 @@ public static boolean isReservedStreamName(String name) {
         }
     
         /**
    -     * Validate the stream name.
    +     * Validate the log name.
          *
    -     * @param nameOfStream
    -     *          name of stream
    +     * @param logName
    +     *          name of log
          * @throws InvalidStreamNameException
          */
    -    public static void validateName(String nameOfStream)
    +    public static String validateAndNormalizeName(String logName)
                 throws InvalidStreamNameException {
    -        String reason = null;
    -        char chars[] = nameOfStream.toCharArray();
    -        char c;
    -        // validate the stream to see if meet zookeeper path's requirement
    -        for (int i = 0; i < chars.length; i++) {
    -            c = chars[i];
    -
    -            if (c == 0) {
    -                reason = "null character not allowed @" + i;
    -                break;
    -            } else if (c == '/') {
    -                reason = "'/' not allowed @" + i;
    -                break;
    -            } else if (c > '\u0000' && c < '\u001f'
    -                    || c > '\u007f' && c < '\u009F'
    -                    || c > '\ud800' && c < '\uf8ff'
    -                    || c > '\ufff0' && c < '\uffff') {
    -                reason = "invalid charater @" + i;
    -                break;
    -            }
    +        if (isReservedStreamName(logName)) {
    +            throw new InvalidStreamNameException(logName, "Log Name is reserved");
             }
    -        if (null != reason) {
    -            throw new InvalidStreamNameException(nameOfStream, reason);
    +
    +        if (logName.charAt(0) == 47) {
    --- End diff --
    
    Is 47 intentional?  How about replace 47 with '/'  in this file? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---