fixed problem with zim importer which crashed when non-valid urls appeared

pull/621/head
Michael Peter Christen 1 year ago
parent 656b3e3e77
commit ceb07a5218

@ -108,6 +108,7 @@ public class ZimImporter extends Thread implements Importer {
// read all documents // read all documents
for (int i = 0; i < this.file.header_entryCount; i++) { for (int i = 0; i < this.file.header_entryCount; i++) {
try {
if (this.abort) break; if (this.abort) break;
DirectoryEntry de = this.reader.getDirectoryInfo(i); DirectoryEntry de = this.reader.getDirectoryInfo(i);
if (!(de instanceof ZIMReader.ArticleEntry)) continue; if (!(de instanceof ZIMReader.ArticleEntry)) continue;
@ -160,6 +161,10 @@ public class ZimImporter extends Thread implements Importer {
String error = sb.toIndexer(response); String error = sb.toIndexer(response);
if (error != null) ConcurrentLog.info("ZimImporter", "error parsing: " + error); if (error != null) ConcurrentLog.info("ZimImporter", "error parsing: " + error);
this.recordCnt++; this.recordCnt++;
} catch (Exception e) {
// catch any error that could stop the importer
ConcurrentLog.info("ZimImporter", "error loading: " + e.getMessage());
}
} }
} catch (IOException e) { } catch (IOException e) {
ConcurrentLog.info("ZimImporter", "error reading: " + e.getMessage()); ConcurrentLog.info("ZimImporter", "error reading: " + e.getMessage());

Loading…
Cancel
Save