andreasgal/j2me.js — pull request #88 by mykmelez (2014-08-11 09:48:27+00:00)
Title: ensure RecordStoreCache entry non-null; etc.

This pull does a few different things. They were all small changes that I noticed at the same time, so I rolled them up together. But I can split them up if you'd prefer.

1. ensure RecordStoreCache entries aren't null when accessing them (they can be null if they've been ejected from the cache, since we eject them by replacing them with null to maintain the array index <=> lookup ID mapping);
2. raise IllegalStateException and IllegalArgumentException in RecordStoreSharedDBHeader methods when their reference implementations in rms_shared_db_header_kni.c would do so;
3. replace java/lang/IOException references with java/io/IOException references, since CLDC provides the latter but not the former;
4. catch exceptions in asynchronous natives when calling ctx.raiseException, which throws VM.Yield, so the natives can reach ctx.resume() to resume the thread.

(Regarding that fourth change: catching those exceptions is a pain, and I think we'd be better off removing the `throw VM.Yield;` from raiseException and making its callers throw the exception instead. Then the callers can throw it or not depending on whether they're performing a synchronous or asynchronous operation. But I didn't make that change here.)