Source:
public Changes changes(long since, final int limit) { Preconditions.checkState(this.isOpen(), "Database is closed"); Preconditions.checkArgument(limit > 0, "Limit must be positive number"); final long verifiedSince = since >= 0 ? since : 0; try { return queue.submit(new SQLQueueCallable<Changes>() { @Override public Changes call(SQLDatabase db) throws Exception { String[] args = {Long.toString(verifiedSince), Long.toString(verifiedSince + limit)}; Cursor cursor = null; try { Long lastSequence = verifiedSince; List<Long> ids = new ArrayList<Long>(); cursor = db.rawQuery(SQL_CHANGE_IDS_SINCE_LIMIT, args); while (cursor.moveToNext()) { ids.add(cursor.getLong(0)); lastSequence = Math.max(lastSequence, cursor.getLong(1)); } List<DocumentRevision> results = getDocumentsWithInternalIdsInQueue(db, ids); if(results.size() != ids.size()) { throw new IllegalStateException(String.format(Locale.ENGLISH, "The number of document does not match number of ids, " + "something must be wrong here. Number of IDs: %s, number of documents: %s", ids.size(), results.size() )); } return new Changes(lastSequence, results); } catch (SQLException e) { throw new IllegalStateException("Error querying all changes since: " + verifiedSince + ", limit: " + limit, e); } finally { DatabaseUtils.closeCursorQuietly(cursor); } } }).get(); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Failed to get changes",e); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Failed to get changes",e); if(e.getCause()!= null){ if(e.getCause() instanceof IllegalStateException) { throw new IllegalStateException("Failed to get changes, SQLite version: "+queue.getSQLiteVersion(),e); } } } return null; }

Target:
public Changes changes(long since, final int limit) { Preconditions.checkState(this.isOpen(), "Database is closed"); Preconditions.checkArgument(limit > 0, "Limit must be positive number"); final long verifiedSince = since >= 0 ? since : 0; try { return queue.submit(new SQLQueueCallable<Changes>() { @Override public Changes call(SQLDatabase db) throws Exception { String[] args = {Long.toString(verifiedSince), Long.toString(verifiedSince + limit)}; Cursor cursor = null; try { Long lastSequence = verifiedSince; List<Long> ids = new ArrayList<Long>(); cursor = db.rawQuery(SQL_CHANGE_IDS_SINCE_LIMIT, args); while (cursor.moveToNext()) { ids.add(cursor.getLong(0)); lastSequence = Math.max(lastSequence, cursor.getLong(1)); } List<DocumentRevision> results = getDocumentsWithInternalIdsInQueue(db, ids); if(results.size() != ids.size()) { throw new IllegalStateException(String.format(Locale.ENGLISH, "The number of documents does not match number of ids, " + "something must be wrong here. Number of IDs: %s, number of documents: %s", ids.size(), results.size() )); } return new Changes(lastSequence, results); } catch (SQLException e) { throw new IllegalStateException("Error querying all changes since: " + verifiedSince + ", limit: " + limit, e); } finally { DatabaseUtils.closeCursorQuietly(cursor); } } }).get(); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Failed to get changes",e); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Failed to get changes",e); if(e.getCause() instanceof IllegalStateException) { throw new IllegalStateException("Failed to get changes, SQLite version: "+queue.getSQLiteVersion(),e); } } return null; }