Skip corrupt archives when importing legacy caches

Signed-off-by: Graham <gpe@openrs2.org>
master
Graham 2 years ago
parent 29716379c3
commit 35f54fd753
  1. 9
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt
  2. 9
      cache/src/main/kotlin/org/openrs2/cache/ChecksumTable.kt

@ -1043,8 +1043,13 @@ public class CacheImporter @Inject constructor(
// import archives and version list
for (id in store.list(0)) {
readArchive(store, id).use { archive ->
addArchive(connection, sourceId, archive)
try {
readArchive(store, id).use { archive ->
addArchive(connection, sourceId, archive)
}
} catch (ex: StoreCorruptException) {
// see the comment in ChecksumTable::create
logger.warn(ex) { "Skipping corrupt archive ($id)" }
}
}

@ -26,8 +26,13 @@ public class ChecksumTable(
var nextArchive = 0
for (archive in store.list(0)) {
val entry = store.read(0, archive).use { buf ->
buf.crc32()
val entry = try {
store.read(0, archive).use { buf ->
buf.crc32()
}
} catch (ex: StoreCorruptException) {
// see the equivalent comment in Js5MasterIndex::create
continue
}
for (i in nextArchive until archive) {

Loading…
Cancel
Save