Error handling for chapter date parsing (#8391)

This commit is contained in:
Arraiment 2021-08-04 19:16:08 +08:00 committed by GitHub
parent 7448de3f32
commit 90e11ca177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -14,6 +14,7 @@ import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import java.text.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -165,7 +166,12 @@ abstract class Zbulu(
return if (this.isNullOrEmpty()) { return if (this.isNullOrEmpty()) {
0 0
} else { } else {
dateFormat.parse(this)?.time ?: 0 // In the event site displays invalid date
try {
dateFormat.parse(this)?.time ?: 0
} catch (_: ParseException) {
0
}
} }
} }

View File

@ -9,7 +9,7 @@ class ZbuluGenerator : ThemeSourceGenerator {
override val themeClass = "Zbulu" override val themeClass = "Zbulu"
override val baseVersionCode: Int = 1 override val baseVersionCode: Int = 2
override val sources = listOf( override val sources = listOf(
SingleLang("HolyManga", "https://w15.holymanga.net", "en", overrideVersionCode = 1), SingleLang("HolyManga", "https://w15.holymanga.net", "en", overrideVersionCode = 1),