Set cause of the exceptions in AtomicFile.startWrite()

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173388899
This commit is contained in:
eguven 2017-10-25 06:17:28 -07:00 committed by Oliver Woodman
parent 3c201a0491
commit 8b3ec4800c

View File

@ -104,12 +104,12 @@ public final class AtomicFile {
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
File parent = baseName.getParentFile(); File parent = baseName.getParentFile();
if (!parent.mkdirs()) { if (!parent.mkdirs()) {
throw new IOException("Couldn't create directory " + baseName); throw new IOException("Couldn't create directory " + baseName, e);
} }
try { try {
str = new AtomicFileOutputStream(baseName); str = new AtomicFileOutputStream(baseName);
} catch (FileNotFoundException e2) { } catch (FileNotFoundException e2) {
throw new IOException("Couldn't create " + baseName); throw new IOException("Couldn't create " + baseName, e2);
} }
} }
return str; return str;