Bug 695132 - MuPDF Library throwing sporadic exception on Android
Summary: MuPDF Library throwing sporadic exception on Android
Status: NOTIFIED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: 1.3
Hardware: Android Phone Android
: P2 normal
Assignee: Paul Gardiner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-02 13:07 UTC by Marcos H. Woehrmann
Modified: 2014-10-19 19:03 UTC (History)
3 users (show)

See Also:
Customer: 832
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2014-04-02 13:07:32 UTC
The customer reports:

We are experiencing production crashes in our app while using the 1.3 version of the MuPDF library.  The exception stack trace is:

20140326 110428 PDT:HockeyExceptionHandler:uncaughtException:Received uncaught exception.
java.lang.UnsupportedOperationException: Not supported
	at com.artifex.mupdfdemo.ReaderView.getSelectedView(ReaderView.java:660)
	at android.widget.AdapterView.onInitializeAccessibilityEvent(AdapterView.java:951)
	at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:4946)
	at android.view.View.sendAccessibilityEventUnchecked(View.java:4933)
	at android.view.ViewRootImpl$SendWindowContentChangedAccessibilityEvent.run(ViewRootImpl.java:6675)
	at android.view.ViewRootImpl$SendWindowContentChangedAccessibilityEvent.runOrPost(ViewRootImpl.java:6701)

This does appear to happen quite frequently on a Nexus 5 we have in house, but for all other cases we've experienced the crash, we can't reproduce it.

The code from the stack trace for getSelectedView() is the following.  Do you know why Android seems to call this method, thus causing the UnsupportedOperationException?

ReaderView.java:
@Override
public View getSelectedView() {
  throw new UnsupportedOperationException(getContext().getString(R.string.not_supported));
}
Comment 1 cs 2014-04-03 07:20:31 UTC
Bug fixed:

just comment this line and return null

	@Override
	public View getSelectedView() {
		//throw new UnsupportedOperationException(getContext().getString(R.string.not_supported));
        	return null;
	}


newscope GmbH
Comment 2 Matt Holgate 2014-06-18 04:10:06 UTC
This is easy to reproduce if you enable 'Talkback' in the accessiblity settings. 

The fix should be pretty straightforward.
Comment 3 Matt Holgate 2014-06-18 04:11:50 UTC
Actually, cs@newscope.com has supplied the fix, thanks!
Comment 4 Matt Holgate 2014-06-18 05:44:07 UTC
commit 38402bcf8dfea7b08cb5b3e6948af078d0b3874b
Author: Matt Holgate <matt@emobix.co.uk>
Date:   Wed Jun 18 12:21:05 2014 +0100

    Fix bug #695132: MuPDF Library throwing sporadic exception on Android

    Android sometimes calls the 'getSelectedView()' method of an AdapterView.
    This can be made to happen more predicatably by enabling the Talkback
    accessibility feature.

    Remove the UnsupportedOperationException and just return null, as we the
    ReaderView does not have the concept of a selected page.