Skip to content

Commit

Permalink
change: return empty build date and list instead of null for no last …
Browse files Browse the repository at this point in the history
…build date
  • Loading branch information
ShindouMihou committed Oct 10, 2023
1 parent 94cf7a1 commit 5a9aad7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/pw/mihou/amelia/io/rome/RssReader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.w3c.dom.NodeList
import pw.mihou.amelia.Amelia
import pw.mihou.amelia.io.xml.SimpleXmlClient
import pw.mihou.amelia.logger
import java.time.Instant
import java.util.Date
import java.util.concurrent.TimeUnit

Expand All @@ -31,7 +32,7 @@ object RssReader {
val lastBuildDate = document.getElementsByTagName("lastBuildDate").item(0)
if (lastBuildDate.textContent == "") {
logger.warn("$url has no last build date.")
return null
return Date.from(Instant.now()) to emptyList()
}
Amelia.formatter.parse(lastBuildDate.textContent) to nodeListToFeedItems(document.getElementsByTagName("item"))
} catch (exception: Exception) {
Expand Down

0 comments on commit 5a9aad7

Please # to comment.