android icon indicating copy to clipboard operation
android copied to clipboard

unable to share a doc

Open nikko-pfffff opened this issue 5 years ago • 5 comments

*********** CAUSE OF ERROR ************

java.lang.RuntimeException: Accessing result data after operation failed! at com.owncloud.android.lib.common.operations.RemoteOperationResult.getData(RemoteOperationResult.java:486) at com.owncloud.android.utils.ErrorMessageAdapter.getMessageForCreateShareOperations(ErrorMessageAdapter.java:254) at com.owncloud.android.utils.ErrorMessageAdapter.getMessageForResultAndOperation(ErrorMessageAdapter.java:143) at com.owncloud.android.utils.ErrorMessageAdapter.getErrorCauseMessage(ErrorMessageAdapter.java:79) at com.owncloud.android.ui.activity.FileActivity.onRemoteOperationFinish(FileActivity.java:381) at com.owncloud.android.ui.activity.FileDisplayActivity.onRemoteOperationFinish(FileDisplayActivity.java:1704) at com.owncloud.android.services.OperationsService.lambda$dispatchResultToOperationListeners$0(OperationsService.java:734) at com.owncloud.android.services.-$$Lambda$OperationsService$KsB1LbjHjlEBSp0h7XO24czs-OQ.run(Unknown Source:6) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7682) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

************ APP INFORMATION ************ ID: com.nextcloud.android.beta Version: 20201210 Build flavor: versionDev

************ DEVICE INFORMATION ************ Brand: OnePlus Device: OnePlus6T Model: ONEPLUS A6013 Id: QKQ1.190716.003 Product: OnePlus6T

************ FIRMWARE ************ SDK: 29 Release: 10 Incremental: 2011161919

nikko-pfffff avatar Dec 22 '20 20:12 nikko-pfffff

I have the same issue with Pixel 4

tobakk avatar Dec 22 '20 20:12 tobakk

@tobiasKaminsky This is caused by https://github.com/nextcloud/android-library/commit/fe20dd3d86f91aba15b42c99ed74969dbe30bebf PR.

The code assumes that the error description is in response data:

https://github.com/nextcloud/android/blob/b83bf828f2fe24bdf1dc25764c645ec481316f12/src/main/java/com/owncloud/android/utils/ErrorMessageAdapter.java#L203-L205

However, the library changed semantics recently and the API no longer allows accessing data when mSuccess is false.

This should be fixed either in the library or in the ErrorMessageAdapter and I'm not sure which. There might be more getData-after-error case and I can only assume that the library PR was made to catch them and get rid of them all.

ezaquarii avatar Jan 01 '21 22:01 ezaquarii

Indeed, I changed this so that data cannot be retrieved on error. Reason was that in one case even on failure the data was tried to read and thus created a NPE.

We could change this to something more graceful, like return an empty data set.

Meanwhile I changed behaviour so that we do not misuse data when in fact it is "only" a message. https://github.com/nextcloud/android-library/pull/571

This allows us, to have message and data in future. If you are fine with this, I will change it also on client side.

tobiasKaminsky avatar Jan 06 '21 11:01 tobiasKaminsky

@tobiasKaminsky Sounds like a good plan.

ezaquarii avatar Jan 06 '21 18:01 ezaquarii

Done via 3.15.1.

tobiasKaminsky avatar Feb 25 '21 08:02 tobiasKaminsky