Skip corrupt archives when importing legacy caches

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

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

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

Loading…
Cancel
Save