Merge "Fix TransportException when reading bundle"
This commit is contained in:
commit
08aac5904e
|
@ -161,16 +161,23 @@ private PackProtocolException duplicateAdvertisement(final String name) {
|
|||
}
|
||||
|
||||
private String readLine(final byte[] hdrbuf) throws IOException {
|
||||
bin.mark(hdrbuf.length);
|
||||
final int cnt = bin.read(hdrbuf);
|
||||
int lf = 0;
|
||||
while (lf < cnt && hdrbuf[lf] != '\n')
|
||||
lf++;
|
||||
bin.reset();
|
||||
IO.skipFully(bin, lf);
|
||||
if (lf < cnt && hdrbuf[lf] == '\n')
|
||||
IO.skipFully(bin, 1);
|
||||
return RawParseUtils.decode(Constants.CHARSET, hdrbuf, 0, lf);
|
||||
StringBuilder line = new StringBuilder();
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
bin.mark(hdrbuf.length);
|
||||
final int cnt = bin.read(hdrbuf);
|
||||
int lf = 0;
|
||||
while (lf < cnt && hdrbuf[lf] != '\n')
|
||||
lf++;
|
||||
bin.reset();
|
||||
IO.skipFully(bin, lf);
|
||||
if (lf < cnt && hdrbuf[lf] == '\n') {
|
||||
IO.skipFully(bin, 1);
|
||||
done = true;
|
||||
}
|
||||
line.append(RawParseUtils.decode(Constants.CHARSET, hdrbuf, 0, lf));
|
||||
}
|
||||
return line.toString();
|
||||
}
|
||||
|
||||
public boolean didFetchTestConnectivity() {
|
||||
|
|
Loading…
Reference in New Issue