@@ -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