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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.net.urlconnection; 5 package org.chromium.net.urlconnection;
6 6
7 import org.chromium.net.UploadDataProvider; 7 import org.chromium.net.UploadDataProvider;
8 8
9 import java.io.IOException; 9 import java.io.IOException;
10 import java.io.OutputStream; 10 import java.io.OutputStream;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void setRequestCompleted(IOException exception) { 47 void setRequestCompleted(IOException exception) {
48 mException = exception; 48 mException = exception;
49 mRequestCompleted = true; 49 mRequestCompleted = true;
50 } 50 }
51 51
52 /** 52 /**
53 * Throws an IOException if the stream is closed or the request is done. 53 * Throws an IOException if the stream is closed or the request is done.
54 */ 54 */
55 protected void checkNotClosed() throws IOException { 55 protected void checkNotClosed() throws IOException {
56 if (mRequestCompleted) { 56 if (mRequestCompleted) {
57 if (mException != null) { 57 checkNoException();
58 throw mException;
59 }
60 throw new IOException("Writing after request completed."); 58 throw new IOException("Writing after request completed.");
61 } 59 }
62 if (mClosed) { 60 if (mClosed) {
63 throw new IOException("Stream has been closed."); 61 throw new IOException("Stream has been closed.");
64 } 62 }
65 } 63 }
64
65 /**
66 * Throws the same IOException that the request is failed with. If there
67 * is no exception reported, this method is no-op.
68 */
69 protected void checkNoException() throws IOException {
70 if (mException != null) {
71 throw mException;
72 }
73 }
66 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698