OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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; | 5 package org.chromium.net; |
6 | 6 |
7 import android.util.Log; | 7 import android.util.Log; |
8 | 8 |
9 import org.apache.http.conn.ConnectTimeoutException; | |
10 import org.chromium.base.CalledByNative; | 9 import org.chromium.base.CalledByNative; |
11 import org.chromium.base.JNINamespace; | 10 import org.chromium.base.JNINamespace; |
12 import org.chromium.base.annotations.SuppressFBWarnings; | 11 import org.chromium.base.annotations.SuppressFBWarnings; |
13 | 12 |
14 import java.io.IOException; | 13 import java.io.IOException; |
15 import java.net.MalformedURLException; | 14 import java.net.MalformedURLException; |
15 import java.net.SocketTimeoutException; | |
16 import java.net.URL; | 16 import java.net.URL; |
17 import java.net.UnknownHostException; | 17 import java.net.UnknownHostException; |
18 import java.nio.ByteBuffer; | 18 import java.nio.ByteBuffer; |
19 import java.nio.channels.ReadableByteChannel; | 19 import java.nio.channels.ReadableByteChannel; |
20 import java.nio.channels.WritableByteChannel; | 20 import java.nio.channels.WritableByteChannel; |
21 import java.util.ArrayList; | 21 import java.util.ArrayList; |
22 import java.util.HashMap; | 22 import java.util.HashMap; |
23 import java.util.List; | 23 import java.util.List; |
24 import java.util.Map; | 24 import java.util.Map; |
25 import java.util.Map.Entry; | 25 import java.util.Map.Entry; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 case ChromiumUrlRequestError.SUCCESS: | 179 case ChromiumUrlRequestError.SUCCESS: |
180 if (mContentLengthOverLimit) { | 180 if (mContentLengthOverLimit) { |
181 return new ResponseTooLargeException(); | 181 return new ResponseTooLargeException(); |
182 } | 182 } |
183 return null; | 183 return null; |
184 case ChromiumUrlRequestError.UNKNOWN: | 184 case ChromiumUrlRequestError.UNKNOWN: |
185 return new IOException(mErrorString); | 185 return new IOException(mErrorString); |
186 case ChromiumUrlRequestError.MALFORMED_URL: | 186 case ChromiumUrlRequestError.MALFORMED_URL: |
187 return new MalformedURLException("Malformed URL: " + mUrl); | 187 return new MalformedURLException("Malformed URL: " + mUrl); |
188 case ChromiumUrlRequestError.CONNECTION_TIMED_OUT: | 188 case ChromiumUrlRequestError.CONNECTION_TIMED_OUT: |
189 return new ConnectTimeoutException("Connection timed out"); | 189 return new SocketTimeoutException("Connection timed out"); |
Yaron
2015/05/15 15:20:21
Not sure how we originally chose ConnectTimeoutExc
| |
190 case ChromiumUrlRequestError.UNKNOWN_HOST: | 190 case ChromiumUrlRequestError.UNKNOWN_HOST: |
191 String host; | 191 String host; |
192 try { | 192 try { |
193 host = new URL(mUrl).getHost(); | 193 host = new URL(mUrl).getHost(); |
194 } catch (MalformedURLException e) { | 194 } catch (MalformedURLException e) { |
195 host = mUrl; | 195 host = mUrl; |
196 } | 196 } |
197 return new UnknownHostException("Unknown host: " + host); | 197 return new UnknownHostException("Unknown host: " + host); |
198 case ChromiumUrlRequestError.TOO_MANY_REDIRECTS: | 198 case ChromiumUrlRequestError.TOO_MANY_REDIRECTS: |
199 return new IOException("Request failed because there were too " | 199 return new IOException("Request failed because there were too " |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 | 757 |
758 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); | 758 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); |
759 | 759 |
760 private native boolean nativeGetWasCached(long urlRequestAdapter); | 760 private native boolean nativeGetWasCached(long urlRequestAdapter); |
761 | 761 |
762 // Explicit class to work around JNI-generator generics confusion. | 762 // Explicit class to work around JNI-generator generics confusion. |
763 private static class ResponseHeadersMap extends | 763 private static class ResponseHeadersMap extends |
764 HashMap<String, List<String>> { | 764 HashMap<String, List<String>> { |
765 } | 765 } |
766 } | 766 } |
OLD | NEW |