Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 708d89b

Browse filesBrowse files
authored
Make Public Suffix Database failures permanent (#7828)
1 parent b147d28 commit 708d89b
Copy full SHA for 708d89b

File tree

1 file changed

+16
-14
lines changed
Filter options

1 file changed

+16
-14
lines changed

‎okhttp/src/main/kotlin/okhttp3/internal/publicsuffix/PublicSuffixDatabase.kt

Copy file name to clipboardExpand all lines: okhttp/src/main/kotlin/okhttp3/internal/publicsuffix/PublicSuffixDatabase.kt
+16-14Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,26 +203,28 @@ class PublicSuffixDatabase {
203203

204204
@Throws(IOException::class)
205205
private fun readTheList() {
206-
var publicSuffixListBytes: ByteArray?
207-
var publicSuffixExceptionListBytes: ByteArray?
206+
try {
207+
var publicSuffixListBytes: ByteArray?
208+
var publicSuffixExceptionListBytes: ByteArray?
208209

209-
val resource =
210+
val resource =
210211
PublicSuffixDatabase::class.java.getResourceAsStream(PUBLIC_SUFFIX_RESOURCE) ?: return
211212

212-
GzipSource(resource.source()).buffer().use { bufferedSource ->
213-
val totalBytes = bufferedSource.readInt()
214-
publicSuffixListBytes = bufferedSource.readByteArray(totalBytes.toLong())
213+
GzipSource(resource.source()).buffer().use { bufferedSource ->
214+
val totalBytes = bufferedSource.readInt()
215+
publicSuffixListBytes = bufferedSource.readByteArray(totalBytes.toLong())
215216

216-
val totalExceptionBytes = bufferedSource.readInt()
217-
publicSuffixExceptionListBytes = bufferedSource.readByteArray(totalExceptionBytes.toLong())
218-
}
217+
val totalExceptionBytes = bufferedSource.readInt()
218+
publicSuffixExceptionListBytes = bufferedSource.readByteArray(totalExceptionBytes.toLong())
219+
}
219220

220-
synchronized(this) {
221-
this.publicSuffixListBytes = publicSuffixListBytes!!
222-
this.publicSuffixExceptionListBytes = publicSuffixExceptionListBytes!!
221+
synchronized(this) {
222+
this.publicSuffixListBytes = publicSuffixListBytes!!
223+
this.publicSuffixExceptionListBytes = publicSuffixExceptionListBytes!!
224+
}
225+
} finally {
226+
readCompleteLatch.countDown()
223227
}
224-
225-
readCompleteLatch.countDown()
226228
}
227229

228230
/** Visible for testing. */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.