aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Neverov <dmitry.neverov@gmail.com>2010-05-19 11:39:17 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-05-19 11:40:33 -0700
commitb3247ba5244d95e0d2c850a3fa1f69668a5790f5 (patch)
tree0c39737b590f27e4594e736ec00b3600203fef2b
parentae972e774e2eb8c72585ad3d4e02687a5c2df66f (diff)
downloadjgit-b3247ba5244d95e0d2c850a3fa1f69668a5790f5.tar.gz
jgit-b3247ba5244d95e0d2c850a3fa1f69668a5790f5.zip
Fix race condition in StreamCopyThread
If we get an interrupt during an IO operation (src.read or dst.write) caused by the flush() method incrementing the flush counter, ensure we restart the proper section of code. Just ignore the interrupt and continue running. Bug: 313082 Change-Id: Ib2b37901af8141289bbac9807cacf42b4e2461bd Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java
index bf47d199af..c36835692d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java
@@ -100,10 +100,7 @@ public class StreamCopyThread extends Thread {
try {
n = src.read(buf);
} catch (InterruptedIOException wakey) {
- if (flushCounter.get() > 0)
- continue;
- else
- throw wakey;
+ continue;
}
if (n < 0)
break;
@@ -112,10 +109,7 @@ public class StreamCopyThread extends Thread {
try {
dst.write(buf, 0, n);
} catch (InterruptedIOException wakey) {
- if (flushCounter.get() > 0)
- continue;
- else
- throw wakey;
+ continue;
}
break;
}