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

    https://github.com/apache/incubator-storm/pull/188#discussion_r14843674
  
    --- Diff: storm-core/src/clj/backtype/storm/daemon/supervisor.clj ---
    @@ -522,17 +523,18 @@
           (FileUtils/copyDirectory (File. master-code-dir) (File. stormroot))
           (let [classloader (.getContextClassLoader (Thread/currentThread))
                 resources-jar (resources-jar)
    -            url (.getResource classloader RESOURCES-SUBDIR)
    +            ;; Work-around for JDK-4466485
    +            uri (URI. (str (.getResource classloader RESOURCES-SUBDIR)))
    --- End diff --
    
    I wanted to avoid trying to copy when no resource was found.  Now that we 
are making a string out of what is returned by .getResource, `uri` won't be 
`nil` when no resource is found—it will be a URI with an empty path.  And we 
do not want to try and do a dir copy from a File with an empty path, since it 
will likely bring down the supervisor with an exception.
    
    We really want something like:
    ```Clojure
    uri (if-let [url (.getResource classloader RESOURCES-DIR)]
          (URI. (str url)))
    ```
    
    This is slightly corrected from my earlier comment, and with this change:
    
      * If `.getResource` returns `nil`, then `uri` becomes `nil` (no else is 
needed within `if-let`), and the `cond` does not evaluate the `do` expression 
paired to `uri` with the `copyDirectory` below.
    
      * If `.getResource` returns a URL, then `uri` becomes a URI of the string 
of `url`, and `cond` evaluates the `do` expression with the `copyDirectory`.



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to