android-pdfview
android-pdfview copied to clipboard
PDF file is corrupted
Maybe this can be handle with error dialog!
java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.RuntimeException: PDF file is corrupted at org.vudroid.pdfdroid.codec.PdfDocument.open(Native Method) at org.vudroid.pdfdroid.codec.PdfDocument.openDocument(PdfDocument.java:28) at org.vudroid.pdfdroid.codec.PdfContext.openDocument(PdfContext.java:18) at org.vudroid.core.DecodeServiceBase.open(DecodeServiceBase.java:59) at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:52) at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:31) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)
I would love a proper fix to this. My hacky solution was to catch RuntimeException in DecodingAsyncTask.doInBackground, call an event listener and only call loadComplete if no exception was thrown. The event listener you provide also has to do Activity.runOnUiThread to display an error dialog so the whole thing is very messy. I'm sure someone can come up with a much better solution than that though.
Additionally, it would be nice if the library could throw more specific exceptions than just a RuntimeException for everything, though that's a more minor point.
I have the same issue but i would to resolve it :) Then is a good idea if the library handles this one...