android-pdfview icon indicating copy to clipboard operation
android-pdfview copied to clipboard

open a pdf file imcomplete then the app crash

Open liugt34 opened this issue 10 years ago • 2 comments

i want to open a remote pdf file ,so i download it first,but some times, the file did not download entirely, so
when it be opend ,the app crashed, i try to solve it by add try..catch ,but it did not worked,so how can i do?

if (oaFile.exists()) { try { pdfView.fromFile(oaFile).swipeVertical(true).load(); } catch (Exception e) { /////// this place did not work ,can not catch the exception // TODO: handle exception Toast.makeText(this, "the file is broke", Toast.LENGTH_SHORT).show(); oaFile.delete(); oaFile = new File(oafDir, currentFile.getName() + ".pdf"); openRemotePDF(url, oaFile); } }

liugt34 avatar Sep 24 '15 02:09 liugt34

09-24 10:59:20.996: E/AndroidRuntime(18213): FATAL EXCEPTION: AsyncTask #3 09-24 10:59:20.996: E/AndroidRuntime(18213): java.lang.RuntimeException: An error occured while executing doInBackground() 09-24 10:59:20.996: E/AndroidRuntime(18213): at android.os.AsyncTask$3.done(AsyncTask.java:299) 09-24 10:59:20.996: E/AndroidRuntime(18213): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 09-24 10:59:20.996: E/AndroidRuntime(18213): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 09-24 10:59:20.996: E/AndroidRuntime(18213): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 09-24 10:59:20.996: E/AndroidRuntime(18213): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 09-24 10:59:20.996: E/AndroidRuntime(18213): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 09-24 10:59:20.996: E/AndroidRuntime(18213): at java.lang.Thread.run(Thread.java:838) 09-24 10:59:20.996: E/AndroidRuntime(18213): Caused by: java.lang.RuntimeException: PDF file is corrupted 09-24 10:59:20.996: E/AndroidRuntime(18213): at org.vudroid.pdfdroid.codec.PdfDocument.open(Native Method) 09-24 10:59:20.996: E/AndroidRuntime(18213): at org.vudroid.pdfdroid.codec.PdfDocument.openDocument(PdfDocument.java:28) 09-24 10:59:20.996: E/AndroidRuntime(18213): at org.vudroid.pdfdroid.codec.PdfContext.openDocument(PdfContext.java:18) 09-24 10:59:20.996: E/AndroidRuntime(18213): at org.vudroid.core.DecodeServiceBase.open(DecodeServiceBase.java:59) 09-24 10:59:20.996: E/AndroidRuntime(18213): at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:51) 09-24 10:59:20.996: E/AndroidRuntime(18213): at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:1) 09-24 10:59:20.996: E/AndroidRuntime(18213): at android.os.AsyncTask$2.call(AsyncTask.java:287) 09-24 10:59:20.996: E/AndroidRuntime(18213): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 09-24 10:59:20.996: E/AndroidRuntime(18213): ... 3 more

liugt34 avatar Sep 24 '15 03:09 liugt34

how to solve this issue?

I am stuck with this crash. Anybody help me.

ragh2009 avatar Apr 06 '16 23:04 ragh2009