@@ -203,26 +203,28 @@ class PublicSuffixDatabase {
203
203
204
204
@Throws(IOException ::class )
205
205
private fun readTheList () {
206
- var publicSuffixListBytes: ByteArray?
207
- var publicSuffixExceptionListBytes: ByteArray?
206
+ try {
207
+ var publicSuffixListBytes: ByteArray?
208
+ var publicSuffixExceptionListBytes: ByteArray?
208
209
209
- val resource =
210
+ val resource =
210
211
PublicSuffixDatabase ::class .java.getResourceAsStream(PUBLIC_SUFFIX_RESOURCE ) ? : return
211
212
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())
215
216
216
- val totalExceptionBytes = bufferedSource.readInt()
217
- publicSuffixExceptionListBytes = bufferedSource.readByteArray(totalExceptionBytes.toLong())
218
- }
217
+ val totalExceptionBytes = bufferedSource.readInt()
218
+ publicSuffixExceptionListBytes = bufferedSource.readByteArray(totalExceptionBytes.toLong())
219
+ }
219
220
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()
223
227
}
224
-
225
- readCompleteLatch.countDown()
226
228
}
227
229
228
230
/* * Visible for testing. */
0 commit comments