More info :
First, I was mistaken; nextRecordId doesn't throw InvalidRecordIdException, it just returns 0 for the
record id. InvalidRecordIdException was thrown later by me trying to use this record id.
Here is some code that I wrote to test this:
In the above,
RecordStore rs = null;
RecordEnumeration en = null;
int nNulls = 0;
rs = RecordStore.openRecordStore( recStoreName, false );
int nRecs = rs.getNumRecords();
int nRecsEnumerated = 0;
en = rs.enumerateRecords( null, null, false );
int nRecsEnum = en.numRecords();
while( en.hasNextElement() )
int ri = en.nextRecordId();
if( ri == 0 )
rs.getNumRecords returns 500 (number of records in the record store)
en.numRecords returns 500 (number of records in the enumeration)
At the end of the loop, nRecsEnumerated is 500.
This means that hasNextElement sees 500 records.
However, at the end of the loop nNulls is 475, meaning that nextRecordId is unable
to retrieve all the records that the record store claims to have.
Can't see what I did wrong; is there some major corruption going on here or what ?
My app is deployed on about 200 phones and so far I have seen only 2 with these symptoms.
My app is multithreaded, but I understand that the RecordStore API is thread safe.
Any thoughts ?