It may be good to note that this section (or function if moved into one) is
entirely a no-op for the vast majority of users: known required for nooks,
and possibly others (HTC Magic?)


On Wed, Nov 20, 2013 at 4:19 PM, Flavio Lerda <notifications@github.com>wrote:

> In src/com/ichi2/anki/AnkiDb.java:
>
> > @@ -313,8 +313,12 @@ protected void setDeleteJournalMode() {
> >              if (db.inTransaction()) {
> >                  db.endTransaction();
> >              }
> > -            db.disableWriteAheadLogging(); // call necessary on some Nook devices
> > -        } catch (Exception e) {
> > +            //This call is required on some with custom Android versiones
> > +            //for example on Nook, where it was backported from Jelly Bean.
> > +            //So, we can't rely here on API version, to check for availability.
> > +            //That's why we just catching the error if method is not available.
> > +            db.disableWriteAheadLogging();
> > +        } catch (Throwable e) {
>
> Do we need to catch Throwable? That will also swallow NPEs for instance.
>
> How about add a method:
>
>   private void disableWriteAheadLogging(SQLiteDatabase db) {
>     // This call is required ...
>     try {
>       db.disableWriteAheadLogging();
>     } catch (NoSuchMethodError e) {
>       // Ignore since this is expected in older versions of Android.
>     }
>   }
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/ankidroid/Anki-Android/pull/128/files#r7811585>
> .
>