arquillian / arquillian-spacelift

Arquillian process and package manager. Makes executing an external process or fetching platform depends dependencies an easier job
4 stars 7 forks source link

Replaced File.mkdirs with FileUtils.mkdir of Apache Commons IO #34

Open krichter722 opened 6 years ago

krichter722 commented 6 years ago

Replaced File.mkdirs with FileUtils.mkdir of Apache Commons IO in order to notice failure of directory creation which is easier with IOException than the boolean return value of File.mkdirs (which has been ignored so far anyway).

Short description of what this resolves:

Ignored failures of java.io.File.mkdirs which would require handling of the boolean return value which is already done in Apache Commons IO.

This requires throwing IOException in SpaceliftConfiguration.cache and cachePath(String), but that's necessary anyway since ignoring the failure of directory creation which would lead to bizarre behaviour (which has been the motivation for this PR, see e.g. https://stackoverflow.com/questions/47217087/why-does-my-arquillian-drone-functional-test-not-work-on-gitlab-ci) is not an option.

Since the if (!file.getParentFile().exists()) branch in UncompressTool.process isn't covered by a unit test, yet, I'd be happy for a suggestion how to acchieve that (in the linked SO question the failure is caused by a failure to create the directory at the statement wrapped with the mentioned if condition).

I have no idea why Travis CI fails (complains about erroneous JAVA_HOME, while the main repo passes.

Changes proposed in this pull request: