mirror of https://github.com/sbt/sbt.git
Fix detection of truncation (so messages exactly max length aren't flagged truncated)
This commit is contained in:
parent
1b21f200b5
commit
20ca549612
|
|
@ -209,13 +209,18 @@ class GigahorseUrlHandler(http: OkHttpClient) extends AbstractURLHandler {
|
|||
val os = new ByteArrayOutputStream(ErrorBodyTruncateLen)
|
||||
var count = 0
|
||||
var b = is.read()
|
||||
while (b >= 0 && count < ErrorBodyTruncateLen) {
|
||||
os.write(b)
|
||||
count += 1
|
||||
b = is.read()
|
||||
var truncated = false
|
||||
while (!truncated && b >= 0) {
|
||||
if (count >= ErrorBodyTruncateLen) {
|
||||
truncated = true
|
||||
} else {
|
||||
os.write(b)
|
||||
count += 1
|
||||
b = is.read()
|
||||
}
|
||||
}
|
||||
if (count > 0) {
|
||||
Some((os.toByteArray, count >= ErrorBodyTruncateLen))
|
||||
Some((os.toByteArray, truncated))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue