Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: components/cronet/android/java/src/org/chromium/net/urlconnection/CronetOutputStream.java

Issue 2173923002: [Cronet] Mark request as complete when OutputStream fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/java/src/org/chromium/net/urlconnection/CronetOutputStream.java
diff --git a/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetOutputStream.java b/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetOutputStream.java
index 03c4b4bae3378684f3183dca75011d1a23987d1e..c73426a6a94e07ce1f12cba93a6275cc402a9537 100644
--- a/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetOutputStream.java
+++ b/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetOutputStream.java
@@ -54,13 +54,21 @@ abstract class CronetOutputStream extends OutputStream {
*/
protected void checkNotClosed() throws IOException {
if (mRequestCompleted) {
- if (mException != null) {
- throw mException;
- }
+ checkNoException();
throw new IOException("Writing after request completed.");
}
if (mClosed) {
throw new IOException("Stream has been closed.");
}
}
+
+ /**
+ * Throws the same IOException that the request is failed with. If there
+ * is no exception reported, this method is no-op.
+ */
+ protected void checkNoException() throws IOException {
+ if (mException != null) {
+ throw mException;
+ }
+ }
}

Powered by Google App Engine
This is Rietveld 408576698