Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URLOutputStream Should Check for Directory Existance #789

Closed
joshar1 opened this issue Oct 24, 2014 · 4 comments
Closed

URLOutputStream Should Check for Directory Existance #789

joshar1 opened this issue Oct 24, 2014 · 4 comments

Comments

@joshar1
Copy link

joshar1 commented Oct 24, 2014

The maven surefire plugin offers the ability to run tests in parallel with the parallel parameter.

While attempting to execute my Cucumber tests in parallel, I noticed that the URLOutputStream class was throwing exceptions because the ensureParentDirExists method was not checking that the directory already existed prior to attempting to create the directory.

I propose the following one line change.

From:

if (file.getParentFile() != null && !file.getParentFile().isDirectory()) {

To:

if (file.getParentFile() != null && !file.getParentFile().isDirectory() 
     && !file.getParentFile().exists()) {

If this change is acceptable to others, I'll fork and issue a pull request.

@aslakhellesoy
Copy link
Contributor

Can isDirectory() return true if the directory doesn't exist?

klausbayrhammer added a commit to klausbayrhammer/cucumber-jvm that referenced this issue Dec 17, 2014
* tests whether files are created when the parent directory does not exists
* removes duplicate test case
@klausbayrhammer
Copy link
Contributor

I couldn't create a test with the behaviour you did describe. Could you provide a small code-sample?

@mpkorstanje
Copy link
Contributor

Hey @joshar1 I'm cleaning up old tickets. Do you still experience this problem?

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants