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

    https://github.com/apache/storm/pull/2739#discussion_r198900030
  
    --- Diff: 
storm-server/src/main/java/org/apache/storm/localizer/LocallyCachedBlob.java ---
    @@ -162,6 +152,31 @@ protected static long getSizeOnDisk(Path p) throws 
IOException {
          */
         public abstract long getSizeOnDisk();
     
    +    /**
    +     * Get the size of p in bytes.
    +     * @param p the path to read.
    +     * @return the size of p in bytes.
    +     */
    +    protected static long getSizeOnDisk(Path p) throws IOException {
    +        if (!Files.exists(p)) {
    +            return 0;
    +        } else if (Files.isRegularFile(p)) {
    +            return Files.size(p);
    +        } else {
    +            //We will not follow sym links
    +            return Files.walk(p)
    +                    .filter((subp) -> Files.isRegularFile(subp, 
LinkOption.NOFOLLOW_LINKS))
    +                    .mapToLong((subp) -> {
    +                        try {
    +                            return Files.size(subp);
    +                        } catch (IOException e) {
    +                            LOG.warn("Could not get the size of ");
    --- End diff --
    
    That may be, but if you could fix it that would be great.


---

Reply via email to