Merge "Fixed NP dereference error reported by ecj in UploadPack.stopBuffering()"
This commit is contained in:
commit
ace9e4305a
|
@ -72,7 +72,6 @@
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.jgit.annotations.Nullable;
|
|
||||||
import org.eclipse.jgit.errors.CorruptObjectException;
|
import org.eclipse.jgit.errors.CorruptObjectException;
|
||||||
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
||||||
import org.eclipse.jgit.errors.MissingObjectException;
|
import org.eclipse.jgit.errors.MissingObjectException;
|
||||||
|
@ -1588,12 +1587,10 @@ private static class ResponseBufferedOutputStream extends OutputStream {
|
||||||
private final OutputStream rawOut;
|
private final OutputStream rawOut;
|
||||||
|
|
||||||
private OutputStream out;
|
private OutputStream out;
|
||||||
@Nullable
|
|
||||||
private ByteArrayOutputStream buffer;
|
|
||||||
|
|
||||||
ResponseBufferedOutputStream(OutputStream rawOut) {
|
ResponseBufferedOutputStream(OutputStream rawOut) {
|
||||||
this.rawOut = rawOut;
|
this.rawOut = rawOut;
|
||||||
this.out = this.buffer = new ByteArrayOutputStream();
|
this.out = new ByteArrayOutputStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1622,9 +1619,8 @@ public void close() throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopBuffering() throws IOException {
|
void stopBuffering() throws IOException {
|
||||||
if (buffer != null) {
|
if (out != rawOut) {
|
||||||
buffer.writeTo(rawOut);
|
((ByteArrayOutputStream) out).writeTo(rawOut);
|
||||||
buffer = null;
|
|
||||||
out = rawOut;
|
out = rawOut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue