[
https://issues.apache.org/jira/browse/STORM-239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14059350#comment-14059350
]
ASF GitHub Bot commented on STORM-239:
--------------------------------------
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`.
> Supervisor fails in working directories whose paths have spaces in them
> -----------------------------------------------------------------------
>
> Key: STORM-239
> URL: https://issues.apache.org/jira/browse/STORM-239
> Project: Apache Storm (Incubating)
> Issue Type: Bug
> Environment: Linux
> Reporter: Adrian Petrescu
> Priority: Minor
> Labels: build
>
> This is incredibly minor, but when running the unit tests from a path that
> has a space somewhere, you get a failure of the form:
> {code}
> 7378 [Thread-5] INFO backtype.storm.daemon.supervisor - Copying resources at
> file:/var/lib/jenkins/jobs/Apache%20Storm/workspace/storm-core/target/test-classes/resources
> to
> /tmp/265ce1e8-8a68-475a-9d59-ccb599add284/supervisor/stormdist/test-1-0/resources
> 7383 [Thread-5] ERROR backtype.storm.event - Error when processing event
> java.io.FileNotFoundException: Source
> '/var/lib/jenkins/jobs/Apache%20Storm/workspace/storm-core/target/test-classes/resources'
> does not exist
> at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:866)
> ~[commons-io-1.4.jar:1.4]
> at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:770)
> ~[commons-io-1.4.jar:1.4]
> at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:745)
> ~[commons-io-1.4.jar:1.4]
> at backtype.storm.daemon.supervisor$fn__4995.invoke(supervisor.clj:493)
> ~[classes/:na]
> at clojure.lang.MultiFn.invoke(MultiFn.java:172) ~[clojure-1.4.0.jar:na]
> at
> backtype.storm.daemon.supervisor$mk_synchronize_supervisor$this__4902.invoke(supervisor.clj:325)
> ~[classes/:na]
> at backtype.storm.event$event_manager$fn__2530.invoke(event.clj:39)
> ~[classes/:na]
> at clojure.lang.AFn.run(AFn.java:24) ~[clojure-1.4.0.jar:na]
> at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
> 7405 [Thread-5] INFO backtype.storm.util - Halting process: ("Error when
> processing an event")
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Reactor Summary:
> [INFO]
> [INFO] Storm ............................................. SUCCESS [22.941s]
> [INFO] maven-shade-clojure-transformer ................... SUCCESS [23.513s]
> [INFO] Storm Core ........................................ FAILURE [2:54.488s]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 3:52.857s
> [INFO] Finished at: Mon Feb 10 16:16:28 EST 2014
> [INFO] Final Memory: 29M/262M
> [INFO]
> ------------------------------------------------------------------------
> {code}
> This can be kind of annoying when (as in my example) a continuous integration
> system is running tests, since you often don't have full control of the path
> it chooses to check the source tree out at.
--
This message was sent by Atlassian JIRA
(v6.2#6252)