Compile.java closes out preventing java from reporting exceptions

Description

Problem: I was trying to compile a project that has some native dependencies (using clojure-maven-plugin version 1.3.13 with Maven 2.0). I forgot to set java.library.path properly so that the native library could be found, and only got an error of

Cause: Compile.java flushes and closes RT.out in the finally block. When out is closed it is unable to write out the stack trace for the UnsatisfiedLinkError that was being thrown. This made it very difficult to debug what was happening.

Solution: Flush, but do not close RT.out in Compile/main. Test is included, but may or may not be worth keeping.

Patch: CLJ-1154.patch

Environment

None

Attachments

1

Activity

Stuart Sierra 
August 2, 2013 at 2:34 PM

Screened. I confirmed with an independent test, by compiling code which spawned a future which would write to STDOUT:

With or without the patch, creating the future prevents the compile process from terminating, but after the patch the output is visible.

Alex Miller 
July 24, 2013 at 4:39 PM

Updated description a bit and added a patch. The code change is just to stop closing RT.out in Compile.main. The test to invoke Compile and check the stream has an annoying amount of setup and teardown so it's a bit messy. Would love to have more io facilities available (with managed cleanup)!

Stuart Halloway 
March 1, 2013 at 4:45 PM

I have encountered this problem as well. Did not verify the explanation, but sounds reasonable.

Completed

Details

Assignee

Reporter

Approval

Patch

Priority

Affects versions

Created January 31, 2013 at 7:04 PM
Updated August 15, 2013 at 12:13 AM
Resolved August 15, 2013 at 12:13 AM