@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"); } }
@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"); } }