Apps-android-commons: Crashes in v2.6.7

Created on 11 Feb 2018  路  23Comments  路  Source: commons-app/apps-android-commons

New contributors welcome - please mention the specific issue you are fixing (e.g. 1130(a)) in your pull request.

  • 1130(a):
java.lang.SecurityException: 
  at android.os.Parcel.readException (Parcel.java:1599)
  at android.os.Parcel.readException (Parcel.java:1552)
  at android.app.ActivityManagerProxy.getContentProvider (ActivityManagerNative.java:3735)
  at android.app.ActivityThread.acquireProvider (ActivityThread.java:5062)
  at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider (ContextImpl.java:2023)
  at android.content.ContentResolver.acquireUnstableProvider (ContentResolver.java:1517)
  at android.content.ContentResolver.openTypedAssetFileDescriptor (ContentResolver.java:1121)
  at android.content.ContentResolver.openAssetFileDescriptor (ContentResolver.java:958)
  at android.content.ContentResolver.openInputStream (ContentResolver.java:678)
  at fr.free.nrw.commons.upload.UploadService.uploadContribution (UploadService.java:188)
  at fr.free.nrw.commons.upload.UploadService.handle (UploadService.java:131)
  at fr.free.nrw.commons.upload.UploadService.handle (UploadService.java:41)
  at fr.free.nrw.commons.HandlerService$ServiceHandler.handleMessage (HandlerService.java:26)
  at android.os.Handler.dispatchMessage (Handler.java:111)
  at android.os.Looper.loop (Looper.java:207)
  at android.os.HandlerThread.run (HandlerThread.java:61)
  • 1130(b):
java.lang.NullPointerException: 
  at android.net.Uri$StringUri.<init> (Uri.java:489)
  at android.net.Uri$StringUri.<init> (Uri.java)
  at android.net.Uri.parse (Uri.java:451)
  at fr.free.nrw.commons.media.MediaDetailFragment.openWebBrowser (MediaDetailFragment.java:379)
  at fr.free.nrw.commons.media.MediaDetailFragment.lambda$setOnClickListeners$0$MediaDetailFragment (MediaDetailFragment.java:275)
  at fr.free.nrw.commons.media.MediaDetailFragment$$Lambda$1.onClick (Unknown Source)
  at android.view.View.performClick (View.java:5612)
  at android.view.View$PerformClick.run (View.java:22288)
  at android.os.Handler.handleCallback (Handler.java:751)
  at android.os.Handler.dispatchMessage (Handler.java:95)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6123)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:867)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:757)
  • 1130(c):
java.lang.SecurityException: 
  at android.os.Parcel.readException (Parcel.java:1942)
  at android.os.Parcel.readException (Parcel.java:1888)
  at android.app.IActivityManager$Stub$Proxy.getContentProvider (IActivityManager.java:5023)
  at android.app.ActivityThread.acquireProvider (ActivityThread.java:6142)
  at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider (ContextImpl.java:2546)
  at android.content.ContentResolver.acquireUnstableProvider (ContentResolver.java:1909)
  at android.content.ContentResolver.openTypedAssetFileDescriptor (ContentResolver.java:1433)
  at android.content.ContentResolver.openAssetFileDescriptor (ContentResolver.java:1286)
  at android.content.ContentResolver.openInputStream (ContentResolver.java:1006)
  at fr.free.nrw.commons.upload.UploadService.uploadContribution (UploadService.java:188)
  at fr.free.nrw.commons.upload.UploadService.handle (UploadService.java:131)
  at fr.free.nrw.commons.upload.UploadService.handle (UploadService.java:41)
  at fr.free.nrw.commons.HandlerService$ServiceHandler.handleMessage (HandlerService.java:26)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.os.HandlerThread.run (HandlerThread.java:65)
  • 1130(d):
java.lang.NullPointerException: 
  at fr.free.nrw.commons.upload.SingleUploadFragment.titleInfo (SingleUploadFragment.java:212)
  at fr.free.nrw.commons.upload.SingleUploadFragment_ViewBinding$1.onTouch (SingleUploadFragment_ViewBinding.java:46)
  at android.view.View.dispatchTouchEvent (View.java:9987)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent (PhoneWindow.java:2831)
  at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1863)
  at android.app.Activity.dispatchTouchEvent (Activity.java:3046)
  at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:68)
  at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:68)
  at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent (PhoneWindow.java:2792)
  at android.view.View.dispatchPointerEvent (View.java:10228)
  at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:5344)
  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:5180)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4620)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4673)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4639)
  at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:4781)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4647)
  at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:4838)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4620)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4673)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4639)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4647)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4620)
  at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:7306)
  at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:7184)
  at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:7145)
  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:7416)
  at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:185)
  at android.os.MessageQueue.nativePollOnce (Native Method)
  at android.os.MessageQueue.next (MessageQueue.java:323)
  at android.os.Looper.loop (Looper.java:143)
  at android.app.ActivityThread.main (ActivityThread.java:7229)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
  • 1130(e):
java.lang.SecurityException: 
  at android.os.Parcel.readException (Parcel.java:1942)
  at android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java:183)
  at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel (DatabaseUtils.java:146)
  at android.content.ContentProviderProxy.openTypedAssetFile (ContentProviderNative.java:698)
  at android.content.ContentResolver.openTypedAssetFileDescriptor (ContentResolver.java:1449)
  at android.content.ContentResolver.openAssetFileDescriptor (ContentResolver.java:1286)
  at android.content.ContentResolver.openInputStream (ContentResolver.java:1006)
  at fr.free.nrw.commons.upload.UploadService.uploadContribution (UploadService.java:188)
  at fr.free.nrw.commons.upload.UploadService.handle (UploadService.java:131)
  at fr.free.nrw.commons.upload.UploadService.handle (UploadService.java:41)
  at fr.free.nrw.commons.HandlerService$ServiceHandler.handleMessage (HandlerService.java:26)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.os.HandlerThread.run (HandlerThread.java:65)
  • 1130(f):
java.lang.NullPointerException: 
  at fr.free.nrw.commons.upload.SingleUploadFragment.descriptionInfo (SingleUploadFragment.java:229)
  at fr.free.nrw.commons.upload.SingleUploadFragment_ViewBinding$2.onTouch (SingleUploadFragment_ViewBinding.java:55)
  at android.view.View.dispatchTouchEvent (View.java:9987)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2839)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2456)
  at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent (PhoneWindow.java:2831)
  at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1863)
  at android.app.Activity.dispatchTouchEvent (Activity.java:3046)
  at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:68)
  at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:68)
  at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent (PhoneWindow.java:2792)
  at android.view.View.dispatchPointerEvent (View.java:10228)
  at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:5344)
  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:5180)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4620)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4673)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4639)
  at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:4781)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4647)
  at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:4838)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4620)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4673)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4639)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4647)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4620)
  at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:7306)
  at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:7184)
  at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:7145)
  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:7416)
  at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:185)
  at android.os.MessageQueue.nativePollOnce (Native Method)
  at android.os.MessageQueue.next (MessageQueue.java:323)
  at android.os.Looper.loop (Looper.java:143)
  at android.app.ActivityThread.main (ActivityThread.java:7229)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
  • 1130(g):
java.lang.NumberFormatException: 
  at java.lang.Integer.parseInt (Integer.java:533)
  at java.lang.Integer.parseInt (Integer.java:556)
  at fr.free.nrw.commons.settings.SettingsFragment.lambda$onCreate$3$SettingsFragment (SettingsFragment.java:74)
  at fr.free.nrw.commons.settings.SettingsFragment$$Lambda$2.onPreferenceChange (Unknown Source)
  at android.preference.Preference.callChangeListener (Preference.java:949)
  at android.preference.EditTextPreference.onDialogClosed (EditTextPreference.java:152)
  at android.preference.DialogPreference.onDismiss (DialogPreference.java:414)
  at android.app.Dialog$ListenersHandler.handleMessage (Dialog.java:1399)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6351)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:896)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:786)
  • 1130(h):
java.lang.IllegalStateException: 
  at android.support.v4.view.ViewPager.populate (ViewPager.java:1135)
  at android.support.v4.view.ViewPager.populate (ViewPager.java:1084)
  at android.support.v4.view.ViewPager.onMeasure (ViewPager.java:1614)
  at android.view.View.measure (View.java:20236)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6427)
  at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1464)
  at android.widget.LinearLayout.measureVertical (LinearLayout.java:747)
  at android.widget.LinearLayout.onMeasure (LinearLayout.java:629)
  at android.view.View.measure (View.java:20236)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6427)
  at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
  at android.view.View.measure (View.java:20236)
  at android.widget.RelativeLayout.measureChildHorizontal (RelativeLayout.java:716)
  at android.widget.RelativeLayout.onMeasure (RelativeLayout.java:462)
  at android.view.View.measure (View.java:20236)
  at android.support.v4.widget.DrawerLayout.onMeasure (DrawerLayout.java:1060)
  at android.view.View.measure (View.java:20236)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6427)
  at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
  at android.support.v7.widget.ContentFrameLayout.onMeasure (ContentFrameLayout.java:139)
  at android.view.View.measure (View.java:20236)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6427)
  at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1464)
  at android.widget.LinearLayout.measureVertical (LinearLayout.java:747)
  at android.widget.LinearLayout.onMeasure (LinearLayout.java:629)
  at android.view.View.measure (View.java:20236)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6427)
  at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
  at android.view.View.measure (View.java:20236)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6427)
  at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1464)
  at android.widget.LinearLayout.measureVertical (LinearLayout.java:747)
  at android.widget.LinearLayout.onMeasure (LinearLayout.java:629)
  at android.view.View.measure (View.java:20236)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6427)
  at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
  at com.android.internal.policy.PhoneWindow$DecorView.onMeasure (PhoneWindow.java:3140)
  at android.view.View.measure (View.java:20236)
  at android.view.ViewRootImpl.performMeasure (ViewRootImpl.java:2712)
  at android.view.ViewRootImpl.measureHierarchy (ViewRootImpl.java:1656)
  at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:1948)
  at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1544)
  at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7616)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:911)
  at android.view.Choreographer.doCallbacks (Choreographer.java:686)
  at android.view.Choreographer.doFrame (Choreographer.java:622)
  at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:897)
  at android.os.Handler.handleCallback (Handler.java:739)
  at android.os.Handler.dispatchMessage (Handler.java:95)
  at android.os.Looper.loop (Looper.java:148)
  at android.app.ActivityThread.main (ActivityThread.java:7406)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
  • 1130(i):
java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2724)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2789)
  at android.app.ActivityThread.-wrap12 (ActivityThread.java)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1527)
  at android.os.Handler.dispatchMessage (Handler.java:110)
  at android.os.Looper.loop (Looper.java:203)
  at android.app.ActivityThread.main (ActivityThread.java:6251)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1075)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)
Caused by: android.os.BadParcelableException: 
  at android.os.Parcel.readParcelableCreator (Parcel.java:2535)
  at android.os.Parcel.readParcelable (Parcel.java:2461)
  at fr.free.nrw.commons.contributions.Contribution.<init> (Contribution.java:75)
  at fr.free.nrw.commons.contributions.Contribution$1.createFromParcel (Contribution.java:21)
  at fr.free.nrw.commons.contributions.Contribution$1.createFromParcel (Contribution.java:18)
  at android.os.Parcel.readParcelable (Parcel.java:2470)
  at android.os.Parcel.readValue (Parcel.java:2364)
  at android.os.Parcel.readArrayMapInternal (Parcel.java:2717)
  at android.os.BaseBundle.unparcel (BaseBundle.java:269)
  at android.os.BaseBundle.getBoolean (BaseBundle.java:731)
  at android.app.Activity.restoreHasCurrentPermissionRequest (Activity.java:6907)
  at android.app.Activity.performCreate (Activity.java:6665)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1118)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2677)
  • 1130(j):
android.view.WindowManager$BadTokenException: 
  at android.view.ViewRootImpl.setView (ViewRootImpl.java:690)
  at android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:342)
  at android.view.WindowManagerImpl.addView (WindowManagerImpl.java:93)
  at android.app.Dialog.show (Dialog.java:316)
  at fr.free.nrw.commons.upload.ExistingFileAsync.onPostExecute (ExistingFileAsync.java:84)
  at fr.free.nrw.commons.upload.ExistingFileAsync.onPostExecute (ExistingFileAsync.java:19)
  at android.os.AsyncTask.finish (AsyncTask.java:660)
  at android.os.AsyncTask.-wrap1 (AsyncTask.java)
  at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:677)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6123)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:867)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:757)
bug good first issue

All 23 comments

The security exception (from line 188 of Upload Service) relates back to a comment I dropped into issue #1092 - reproducing here for clarity - I had been doing some digging - I implemented most of an "Upload Queue" and had to test what a failed upload looked like, and if I could restart it. That's when I encountered this bug while running on an Emulator (but I expected real phones to act similarly - your crashes confirm the suspicion).

When photos are shared with our app, we pull them from the incoming Intent

@Override
protected void onAuthCookieAcquired(String authCookie) {
    mwApi.setAuthCookie(authCookie);
    Intent intent = getIntent();

    if (intent.getAction().equals(Intent.ACTION_SEND_MULTIPLE)) {
        if (photosList == null) {
            photosList = new ArrayList<>();
            ArrayList<Uri> urisList = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
            for (int i = 0; i < urisList.size(); i++) {
                Contribution up = new Contribution();
                Uri uri = urisList.get(i);
                up.setLocalUri(uri);
                ...
            }
        }
        ...
        uploadController.prepareService();
    }
}

The incoming Uri has a content:// prefix, and we store it in the database inside the UploadService without any processing

@Override
public void queue(int what, Contribution contribution) {
    switch (what) {
        case ACTION_UPLOAD_FILE:
            contribution.setState(Contribution.STATE_QUEUED);
            contribution.setTransferred(0);
            contributionDao.save(contribution);
            ... 
    }
}

The problem is that content:// Uris are inherently temporary - the picture was available for a while but I closed the app and restarted and now the record in our database is invalid because its Uri was pointing into space. If we intend to retry the upload at a later point, or support any kind of "limited connection mode" where uploads stay in a queue until Wifi is available, then we cannot have the local Uri expire like this. If the content:// Uri has "expired" then you get the java.lang.SecurityException from Upload Service.

I believe the fix is fairly simple - as soon as we receive the intent (in ShareActivity and MultipleShareActivity) we need to pull the available bytes and cache them, that is, cache the image as a file in our apps storage. The "local uri" in the database then needs to be the path to the file.

Even if we cache the image file we need to be aware that it could be deleted (say, stored on the external SD card, deleted by a user / card removed) and should cleanup the contributions database accordingly.

A band-aid solution would be to catch the java.lang.SecurityException and delete the offending row from the contributions database (and any modifications that are pending) as it will never be possible to upload that file.

The BadTokenException - Stack Overflow has a discussion that seems relevant -
https://stackoverflow.com/questions/18662239/android-view-windowmanagerbadtokenexception-unable-to-add-window-on-buider-s

Basically, we're trying to pop a dialog to say "This file already exists on Commons. Are you sure you want to proceed?" after the activity has finished.

The number format exception in Settings Fragment stems from

int value = Integer.parseInt(newValue.toString());

My guess is that we have an empty string as our "new value" and it's blowing up.

A couple of lines above we as for a value and default to 100 if no value was present in shared preferences. I believe a try/catch around the number parsing, and cleaning up line 88 which could use the local variable rather than parsing a second time, would address things.

Thanks for the advice, @psh ! I wonder if we should split this up into individual tasks (probably no need to create separate issues, we can just add headers e.g. 1130(a), 1130(b) etc) and make this beginner-friendly? Fixing these could be good microtasks for potential GSoC/Outreachy applicants.

I want to help but I am not sure which ones are already taken.

Great I can get going with one of these.
I analyzed 1130(b). I think just adding @Nullable to the url parameter will not do since uriParse() will get evoked anyhow.
Since We can create the intent for opening the web-browser without a Uri parameter, I suppose we check for null Uri; if so, create intent with just the action;

 private void openWebBrowser(String url) {
        Intent browser;
            if(url != null) {
                 browser = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            } else {
                browser = new Intent(Intent.ACTION_VIEW);
            }
            startActivity(browser);
    }

@hismaeel Is there any case where it makes sense that this value is null?
Sending people to an empty web browser does not sound like something we intend to do.

I agree @nicolas-raoul can't be null just checked for it. But on stacktrace posted above it's a Null Pointer Exception, and seems it comes from Uri.parse() that invokes StringUri()

private StringUri(String uriString) {
            if (uriString == null) {
                throw new NullPointerException("uriString");   //exception
            }
this.uriString = uriString;
        }

Plus, licenselink() can return null when we invoke it through onClick

license.setOnClickListener(v -> openWebBrowser(licenseLink(media)));

But, my debugging didn't lead me to a Null Pointer Exception. @misaochan details of reproducing crash would be helpful. From the stacktrace, seems bug arises when License field of image is clicked. But when I actually do so, gives an activityNotFound exception.

 android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://creativecommons.org/... }
                                                                               at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1798)
                                                                               at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
                                                                               at android.app.Activity.startActivityForResult(Activity.java:3930)
                                                                               at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
                                                                               at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:65)
                                                                               at android.support.v4.app.ActivityCompat.startActivityForResult(ActivityCompat.java:152)
                                                                               at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:784)
                                                                               at android.support.v4.app.FragmentActivity$HostCallbacks.onStartActivityFromFragment(FragmentActivity.java:898)
                                                                               at android.support.v4.app.Fragment.startActivity(Fragment.java:999)
                                                                               at android.support.v4.app.Fragment.startActivity(Fragment.java:988)
                                                                               at fr.free.nrw.commons.media.MediaDetailFragment.openWebBrowser(MediaDetailFragment.java:398)
                                                                               at fr.free.nrw.commons.media.MediaDetailFragment.lambda$setOnClickListeners$0$MediaDetailFragment(MediaDetailFragment.java:281)
                                                                               at fr.free.nrw.commons.media.MediaDetailFragment$$Lambda$1.onClick(Unknown Source)
                                                                               at android.view.View.performClick(View.java:5204)
                                                                               at android.view.View$PerformClick.run(View.java:21153)
                                                                               at android.os.Handler.handleCallback(Handler.java:739)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                               at android.os.Looper.loop(Looper.java:148)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

For this we can start activity after checking for nullness

if (browser.resolveActivity(getActivity().getPackageManager()) != null) {
            startActivity(browser);
                     }

But still doesn't quite solve it. The same crash is produced when a category of image is clicked.

Device: Nexus 5 android 6.0.1

@hismaeel I guess it is a difficult-to-reproduce crash with a should-never-happen condition.
How about gathering the stack trace and a few relevant variables' value and then calling ACRA to report the bug? (even though it is not a crash ACRA can be used). That's better than crashing or opening a blank page, and that might give us more information to fix the root problem in the future.

@hismaeel Ah, maybe the user is viewing an image whose license is not offered by our app?
For instance a very arcane license (such as the license used by https://commons.wikimedia.org/wiki/File:Official_gnu.svg) or a now-retired license such as CC-BY-SA version 1 (for new uploads we now only allow version 3 or 4).
Such licenses can be chosen by using the desktop upload wizard, or by editing the description page of any image after uploading it with the app.

@hismaeel Sorry, all these crashes are taken from logs sent to the Google Play Developer Console - only the stack trace and some information about the device and Android version are sent. So usually we don't know for sure how the user ran into the crash or how to reproduce them.

I agree with @nicolas-raoul on the likely best way to handle it.

Also, it would be really good if we could fix the new crash that you found! :)

@misaochan @nicolas-raoul This is somewhat funny; I had disabled my web browser because I was using it a lot at bedtime. That's why I was getting a "No Activity Found" exception because there was no browser to open the URL. The documentation for Intent actually reads this

> Caution: If there are no apps on the device that can receive the implicit intent, your app will crash when it calls startActivity()

Handling this is standard and good practice; check for null activity using the code in my previous reply. Throw a toast message that reads, "no app found to open URL". Also, I toured the app and this crash is now in the links in Tutorial page, clicking Categories, clicking "view in browser", some clicks in notification settings, etc. I've created a separate issue and have started working on it :-)

@nicolas-raoul
As for the issue above 1130(b), for some mysterious reason that user did get a null URL. Also, can't know where that click originates from, as trace says "unknown source". Now that we know it's not the issue I had, the only choice left is to check for a null URL as well in openWebBrowser(url). I think it'll be good practice. If null, we can throw a toast, "error, no URL found".

1166

@misaochan Can I start working on another crash too? :-)

@hismaeel If you are done with your current tasks (PR pending), feel free to take another one :-)

I made a commit into a PR for another issue, #1166 . Should I make a separate PR for this?

Yes, better make a different PR for each issue.
That way, a problem with one fix does not block all of your other fixes :-)

makes sense! Thanks

The fix for issue #1163, PR #1172 should fix #1130(f) and (d).

Can anyone tell me when does bug 1130 (a) occur?

I got a fix for getting mime type from camera. @nicolas-raoul is it correct and is it related to 1130 (a)

ContentResolver contentResolver = fragment.getContext().getContentResolver();
                MimeTypeMap mime = MimeTypeMap.getSingleton();
                String type = mime.getExtensionFromMimeType(contentResolver.getType(lastGeneratedCaptureUri));

I just realized that 1130 (a) has not been solved. It is our most prevalent crash on production by far, with 39 reports affecting 21 users over the last 30 days. It may be worth trying to solve this ASAP.

@hjoshi123 Sorry we didn't get back to you! Unfortunately those crash reports come from the Play Store dev console and we can't see when or how it happened. Has it happened for you before?

@psh currently I am working on the SecurityException, and your comments were really helpful. But I have a question: Since we upload from our app, means we already have that file, why do we have to cache it again?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

misaochan picture misaochan  路  3Comments

jidanni picture jidanni  路  3Comments

maskaravivek picture maskaravivek  路  3Comments

Saral-code picture Saral-code  路  3Comments

nicolas-raoul picture nicolas-raoul  路  4Comments