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

    https://github.com/apache/twill/pull/3#discussion_r76174570
  
    --- Diff: 
twill-common/src/main/java/org/apache/twill/filesystem/LocalLocation.java ---
    @@ -255,4 +288,53 @@ public int hashCode() {
       public String toString() {
         return file.toString();
       }
    +
    +  /**
    +   * Ensures the given {@link File} is a directory. If it doesn't exist, 
it will be created.
    +   */
    +  private void ensureDirectory(File dir) throws IOException {
    +    // Check, create, check to resolve race conditions if there are 
concurrent creation of the directory.
    +    if (!dir.isDirectory() && !dir.mkdirs() && !dir.isDirectory()) {
    +      throw new IOException("Failed to create directory " + dir);
    +    }
    +  }
    +
    +  /**
    +   * Parses the given permission to a set of {@link PosixFilePermission}.
    +   *
    +   * @param permission the permission as passed to the {@link 
#createNew(String)} or {@link #getOutputStream(String)}
    +   *                   methods.
    +   * @return a new set of {@link PosixFilePermission}.
    +   */
    +  private Set<PosixFilePermission> parsePermissions(String permission) {
    +    Set<PosixFilePermission> permissions;
    +    if (permission.length() == 3) {
    +      permissions = parseNumericPermissions(permission);
    +    } else if (permission.length() == 9) {
    +      permissions = PosixFilePermissions.fromString(permission);
    +    } else {
    +      throw new IllegalArgumentException("Invalid permission " + 
permission +
    +                                           ". Permission should either be 
a three digits or nine characters string.");
    --- End diff --
    
    fixed


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to