diff options
author | Oleg Shaldybin <olegsh@google.com> | 2023-06-23 06:21:16 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-06-23 06:21:16 +0000 |
commit | 2b28338dcdae2ef0aaf90c2a1247ce532d3655e5 (patch) | |
tree | 3d73b466b709597298d04229f72b879e8b499cef /okhttp | |
parent | 8341b930cdeda0c3c946040de02ff0dd4779bc52 (diff) | |
parent | c3789225566c9de2e55dd1aba22a944c8cd0a7f3 (diff) | |
download | okhttp-2b28338dcdae2ef0aaf90c2a1247ce532d3655e5.tar.gz |
Merge "Use 'okio-lib' as a dependency" into udc-dev-plus-aosp
Diffstat (limited to 'okhttp')
-rw-r--r-- | okhttp/src/main/java/com/squareup/okhttp/HttpUrl.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/okhttp/src/main/java/com/squareup/okhttp/HttpUrl.java b/okhttp/src/main/java/com/squareup/okhttp/HttpUrl.java index e90eb8d..cd174d7 100644 --- a/okhttp/src/main/java/com/squareup/okhttp/HttpUrl.java +++ b/okhttp/src/main/java/com/squareup/okhttp/HttpUrl.java @@ -15,6 +15,7 @@ */ package com.squareup.okhttp; +import java.io.EOFException; import java.net.IDN; import java.net.InetAddress; import java.net.MalformedURLException; @@ -1621,10 +1622,15 @@ public final class HttpUrl { } utf8Buffer.writeUtf8CodePoint(codePoint); while (!utf8Buffer.exhausted()) { - int b = utf8Buffer.readByte() & 0xff; - out.writeByte('%'); - out.writeByte(HEX_DIGITS[(b >> 4) & 0xf]); - out.writeByte(HEX_DIGITS[b & 0xf]); + try { + fakeEofExceptionMethod(); + int b = utf8Buffer.readByte() & 0xff; + out.writeByte('%'); + out.writeByte(HEX_DIGITS[(b >> 4) & 0xf]); + out.writeByte(HEX_DIGITS[b & 0xf]); + } catch (EOFException e) { + throw new IndexOutOfBoundsException(e.getMessage()); + } } } else { // This character doesn't need encoding. Just copy it over. @@ -1633,6 +1639,8 @@ public final class HttpUrl { } } + private static void fakeEofExceptionMethod() throws EOFException {} + static String canonicalize(String input, String encodeSet, boolean alreadyEncoded, boolean strict, boolean plusIsSpace, boolean asciiOnly) { return canonicalize(input, 0, input.length(), |