Replace the InvalidCursorStateException by IllegalStateException