This is preferable given that:

1) queryColumn in not designed to work with nulls, so the caller is not
missing out if we don't return nulls
2) if the null is in user data to be listed, there is in fact no data to
list, so skipping nothing isn't skipping anything at all
3) this is ~quite~ likely a non-issue that doesn't even need the error
report. The reason behind the report is that this may be the only place in
the code where we realize this is going on.


On Thu, May 8, 2014 at 9:57 PM, Charles J. Daniels <chajadan@gmail.com>wrote:

> Yes.
>
>
> On Thu, May 8, 2014 at 9:53 PM, Nicolas Raoul <notifications@github.com>wrote:
>
>> In src/com/ichi2/anki/AnkiDb.java:
>>
>> >              cursor = mDatabase.rawQuery(query, null);
>> >              String methodName = getCursorMethodName(type.getSimpleName());
>> >              while (cursor.moveToNext()) {
>> > -                // The magical line. Almost as illegible as python code ;)
>> > -                results.add(type.cast(Cursor.class.getMethod(methodName, int.class).invoke(cursor, column)));
>> > +                try {
>> > +                    // The magical line. Almost as illegible as python code ;)
>> > +                    results.add(type.cast(Cursor.class.getMethod(methodName, int.class).invoke(cursor, column)));
>> > +                } catch (InvocationTargetException e) {
>> > +                    if (cursor.isNull(column)) { // null value encountered
>> > +                        Log.w(AnkiDroidApp.TAG, "AnkiDb.queryColumn (column " + column + "): Located null during exception. Attempting to skip null result and continue. Query: " + query);
>> > +                        AnkiDroidApp.saveExceptionReportFile(e, "queryColumn_encounteredNull");
>> > +                        continue; // attempt to skip this null record
>>
>> So the behaviour has changed from "fail" to "prepare a report and
>> continue", right?
>>
>> —
>> Reply to this email directly or view it on GitHub<https://github.com/ankidroid/Anki-Android/pull/341/files#r12464260>
>> .
>>
>
>