aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2012-01-15 11:22:52 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2012-01-15 11:22:52 +0100
commite875c905d310153165c5bdb24ead55d98596923a (patch)
treeb247debd7c714838109a23a0f103dc1a17a54de4 /org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
parent02729810f9246b9f332945f730d65c68f118d489 (diff)
downloadjgit-e875c905d310153165c5bdb24ead55d98596923a.tar.gz
jgit-e875c905d310153165c5bdb24ead55d98596923a.zip
Make sure all bytes are written to files on close, or get an error.
Java's BufferedOutputStream swallows any errors that occur when flushing the buffer in close(). This class overrides close to make sure an error during the final flush is reported back to the caller. Change-Id: I74a82b31505fadf8378069c5f6554f1033c28f9b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
index 346b3b35f6..394c1a565f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
@@ -46,7 +46,6 @@
package org.eclipse.jgit.dircache;
import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
@@ -77,6 +76,7 @@ import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.MutableInteger;
import org.eclipse.jgit.util.NB;
import org.eclipse.jgit.util.TemporaryBuffer;
+import org.eclipse.jgit.util.io.SafeBufferedOutputStream;
/**
* Support for the Git dircache (aka index file).
@@ -536,7 +536,7 @@ public class DirCache {
final LockFile tmp = myLock;
requireLocked(tmp);
try {
- writeTo(new BufferedOutputStream(tmp.getOutputStream()));
+ writeTo(new SafeBufferedOutputStream(tmp.getOutputStream()));
} catch (IOException err) {
tmp.unlock();
throw err;