Closed GoogleCodeExporter closed 9 years ago
Added patch for submission
Original comment by stephens...@googlemail.com
on 16 Aug 2011 at 4:38
Attachments:
Original comment by alex.she...@gmail.com
on 18 Aug 2011 at 1:16
Original comment by alex.she...@gmail.com
on 18 Aug 2011 at 2:14
Fixed so when writing entity to an outFile, parent directories are
automatically created.
Bulk of code was from a user submitted patch
http://code.google.com/p/missing-link/issues/detail?id=23#c1
Changed will be available in 1.1.3
Original comment by alex.she...@gmail.com
on 18 Aug 2011 at 2:26
Original comment by alex.she...@gmail.com
on 19 Aug 2011 at 12:51
We need to re-open this issue please, I've discovered a concurrency issue with
my original patch.
protected static void mkdirs(final File file) {
final File dir = file.getParentFile();
if (!dir.exists()) {
final boolean mkdirs = dir.mkdirs();
if (!mkdirs) {
throw new BuildException("Could not make directories for " + dir.getAbsolutePath());
}
}
}
If thread B enters this method after thread A has evaluated dir#exists as false
*but before* thread A has finished dir#mkdirs, thread B may call dir#mkdirs and
receive false - which results in a BuildException.
Original comment by stephens...@googlemail.com
on 13 Sep 2011 at 4:01
We could log an INFO or a WARNING that the parent directory could not be
created, but I'm wary of logging something that low level. It could be
misleading. I think we're better off with an explicit check for permissions
problems, and simply ignoring the return value from File#mkdirs.
Original comment by stephens...@googlemail.com
on 13 Sep 2011 at 4:18
Attachments:
[deleted comment]
A far simpler patch, where we simply call File#mkdirs regardless - if the
directory already exists, we simply move on
Original comment by stephens...@googlemail.com
on 14 Sep 2011 at 9:25
Attachments:
Original issue reported on code.google.com by
stephens...@googlemail.com
on 16 Aug 2011 at 2:46