Commit 104b778b authored by Helen Li's avatar Helen Li Committed by Commit Bot

Improve error msg in CronetBufferedOutputStream

Bug: 874152
Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester
Change-Id: I45441e5fdd8eaa4b0e39144cd94d610d3f98f368
Reviewed-on: https://chromium-review.googlesource.com/1174935
Commit-Queue: Paul Jensen <pauljensen@chromium.org>
Reviewed-by: default avatarPaul Jensen <pauljensen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583240}
parent 396a9099
...@@ -94,7 +94,8 @@ final class CronetBufferedOutputStream extends CronetOutputStream { ...@@ -94,7 +94,8 @@ final class CronetBufferedOutputStream extends CronetOutputStream {
+ mInitialContentLength + " bytes"); + mInitialContentLength + " bytes");
} }
if (mConnected) { if (mConnected) {
throw new IllegalStateException("Cannot write after being connected."); throw new IllegalStateException("Use setFixedLengthStreamingMode() or "
+ "setChunkedStreamingMode() for writing after connect");
} }
if (mInitialContentLength != -1) { if (mInitialContentLength != -1) {
// If mInitialContentLength is known, the buffer should not grow. // If mInitialContentLength is known, the buffer should not grow.
......
...@@ -92,7 +92,9 @@ public class CronetBufferedOutputStreamTest { ...@@ -92,7 +92,9 @@ public class CronetBufferedOutputStreamTest {
out.write(TestUtil.UPLOAD_DATA); out.write(TestUtil.UPLOAD_DATA);
fail(); fail();
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
assertEquals("Cannot write after being connected.", e.getMessage()); assertEquals("Use setFixedLengthStreamingMode() or "
+ "setChunkedStreamingMode() for writing after connect",
e.getMessage());
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment