@Override protected Throwable doInBackground(final String... params) { LCTX.d("BookLoadTask.doInBackground(): start"); try { final File cached = scheme.loadToCache(intent.getData(), this); if (cached != null) { m_fileName = cached.getAbsolutePath(); setProgressDialogMessage(startProgressStringId); } getView().waitForInitialization(); documentModel.open(m_fileName, m_password); getDocumentController().init(this); return null; } catch (final MuPdfPasswordException pex) { LCTX.i(pex.getMessage()); return pex; } catch (final Exception e) { LCTX.e(e.getMessage(), e); return e; } catch (final Throwable th) { LCTX.e("BookLoadTask.doInBackground(): Unexpected error", th); return th; } finally { LCTX.d("BookLoadTask.doInBackground(): finish"); } }
public void close() { if (m_db != null) { try { m_db.close(); } catch (Exception ex) { LCTX.e("Unexpected DB close error: ", ex); } m_db = null; } }
public DBSettingsManager(final Context context) { super(context, context.getPackageName() + ".settings", null, DB_VERSION); adapter = createAdapter(DB_VERSION); try { m_db = getWritableDatabase(); } catch (final Exception ex) { LCTX.e("Unexpected DB error: ", ex); } BackupManager.addAgent(this); }
synchronized void closeDatabase(final SQLiteDatabase db) { if (db != upgragingInstance && db != m_db) { try { db.close(); } catch (final Exception ex) { LCTX.e("Unexpected DB close error: ", ex); } LCTX.d("DB connection closed: " + m_db); } }
protected IViewController switchDocumentController(final BookSettings bs) { if (bs != null) { try { final IViewController newDc = bs.viewMode.create(this); if (newDc != null) { final IViewController oldDc = ctrl.getAndSet(newDc); getZoomModel().removeListener(oldDc); getZoomModel().addListener(newDc); return ctrl.get(); } } catch (final Throwable e) { LCTX.e("Unexpected error: ", e); } } return null; }
@Override protected void onPostExecute(Throwable result) { LCTX.d("BookLoadTask.onPostExecute(): start"); try { if (result == null) { try { getDocumentController().show(); final DocumentModel dm = getDocumentModel(); currentPageChanged(PageIndex.NULL, dm.getCurrentIndex()); } catch (final Throwable th) { result = th; } } super.onPostExecute(result); if (result instanceof MuPdfPasswordException) { final MuPdfPasswordException pex = (MuPdfPasswordException) result; final int promptId = pex.isWrongPasswordEntered() ? R.string.msg_wrong_password : R.string.msg_password_required; askPassword(m_fileName, promptId); } else if (result != null) { final String msg = result.getMessage(); LogManager.onUnexpectedError(result); showErrorDlg(R.string.msg_unexpected_error, msg); } else { if (codecType != null && codecType.useCustomFonts) { EBookDroidApp.checkInstalledFonts(getManagedComponent()); } } } catch (final Throwable th) { LCTX.e("BookLoadTask.onPostExecute(): Unexpected error", th); LogManager.onUnexpectedError(result); } finally { LCTX.d("BookLoadTask.onPostExecute(): finish"); } }