aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2017-04-05 07:53:24 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2017-04-05 07:53:26 -0400
commitace9e4305af2ef5a26f3da86d45377e4b33982c4 (patch)
treece21b2fad3f1aecebbe7f06f342d733ba8676aeb
parentdb8b2c4288458769c71226b11479940b6723c72d (diff)
parent7476baebfc457e75c984de61dc8ae08a359b52e8 (diff)
downloadjgit-ace9e4305af2ef5a26f3da86d45377e4b33982c4.tar.gz
jgit-ace9e4305af2ef5a26f3da86d45377e4b33982c4.zip
Merge "Fixed NP dereference error reported by ecj in UploadPack.stopBuffering()"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java10
1 files changed, 3 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
index 6b16f550d9..ddb2fbf012 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -72,7 +72,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
@@ -1588,12 +1587,10 @@ public class UploadPack {
private final OutputStream rawOut;
private OutputStream out;
- @Nullable
- private ByteArrayOutputStream buffer;
ResponseBufferedOutputStream(OutputStream rawOut) {
this.rawOut = rawOut;
- this.out = this.buffer = new ByteArrayOutputStream();
+ this.out = new ByteArrayOutputStream();
}
@Override
@@ -1622,9 +1619,8 @@ public class UploadPack {
}
void stopBuffering() throws IOException {
- if (buffer != null) {
- buffer.writeTo(rawOut);
- buffer = null;
+ if (out != rawOut) {
+ ((ByteArrayOutputStream) out).writeTo(rawOut);
out = rawOut;
}
}