Skip to content

Commit

Permalink
VideoStoreImportService: catch CursorWindowAllocationException via Ru…
Browse files Browse the repository at this point in the history
…ntimeException when doing c.getCount() on vob_insert on paginated query

It should not crash because vob_insert table has two columns _id and name and rawQuery is paginated

See nova-video-player/aos-AVP#1015
  • Loading branch information
courville committed Feb 10, 2024
1 parent aed4398 commit 460cf5b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ private void processDeleteFileAndVobCallback() {
try {
c = db.rawQuery("SELECT * FROM vob_insert ORDER BY " + BaseColumns._ID + " ASC LIMIT " + WINDOW_SIZE, null);
log.debug("processDeleteFileAndVobCallback: delete_files new batch fetching window=" + WINDOW_SIZE + " -> cursor has size " + c.getCount());
// TOFIX crashes with CursorWindowAllocationException when doing getCount() though rawQuery is paginated catch it via RuntimeException
if (c.getCount() == 0) {
log.debug("processDeleteFileAndVobCallback: vob_insert no more data");
break; // break out if no more data
Expand All @@ -601,7 +602,8 @@ private void processDeleteFileAndVobCallback() {
log.error("processDeleteFileAndVobCallback: SQLException", sqlE);
}
}
} catch (SQLException | IllegalStateException e) {
} catch (RuntimeException e) {
ArchosUtils.addBreadcrumb(SentryLevel.INFO, "VideoStoreImportService.processDeleteFileAndVobCallback", "crash " + e.getMessage());
log.error("processDeleteFileAndVobCallback: SQLException or IllegalStateException",e);
if (CRASH_ON_ERROR) throw new RuntimeException(e);
break;
Expand Down

0 comments on commit 460cf5b

Please sign in to comment.