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

Resources: closing outputstream bug, recursive delete #1176

Closed
wants to merge 1 commit into from

Conversation

NielsCharlier
Copy link
Contributor

According to the Closeable API (http://docs.oracle.com/javase/7/docs/api/java/io/Closeable.html#close%28%29 ) the close method should not throw (or cause, in this case) an exception when called on an already closed resource. The FileSystemResource and ResourceWrapper do do this.

Furthermore, I propose support for recursively deleting directories with their contents. This is already the case for the store.remove() function, but not resource.delete(). Note that the rule on whether to return true/false when the resource doesn't exist is different for remove and delete. Only for remove this appears to be documented.

}
finally {
lock.release();
//if already closed, there should be no exception (see spec Closeable)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is tricky logic, would love to know the file was written out at lest once :) Thinking about a resource against a directory with no write access. The tmp file would be created, the move would fail, and each successive close would produce the same error ...

You can decide if you care.

@jodygarnett
Copy link
Member

Output stream close looks fine.

The Resource.delete() change requires further discussion/work.

@jodygarnett
Copy link
Member

Revised and applied to master and 2.7.x / 2.6.x.

@NielsCharlier NielsCharlier deleted the filesystem branch September 23, 2015 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants