Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMB version of MainActivityHelper.checkFolder() #2229

Merged
merged 8 commits into from
Apr 25, 2021

Conversation

TranceLove
Copy link
Collaborator

@TranceLove TranceLove commented Jan 19, 2021

PR Info

Issue tracker

Fixes will automatically close the related issue

Fixes #2189

Release

Addresses release/3.6

Test cases

  • Covered

Manual testing

  • Done

If yes,

  • Device: Fairphone 3
  • OS: LineageOS 16.0 (9.0)

Build tasks success

Successfully running following tasks on local

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

Additional Info

When copying from local to SMB, SMB URL was seen passed into MainActivityHelper.checkFolder(), causing the exception. Created a SMB version of the method to fix this.

@TranceLove TranceLove added Issue-Bug Related unexpected behavior or something worth investigating. Area-FileOperations Related to file operations (e.g. moving, copying, renaming). Area-SMB Related to SMB connections. labels Jan 19, 2021
@TranceLove TranceLove added this to the v3.6 milestone Jan 19, 2021
EmmanuelMess
EmmanuelMess previously approved these changes Jan 19, 2021
@VishalNehra
Copy link
Member

I can't seem to figure out why the reported crash has path as java.io.FileNotFoundException: smb:/workgroup with a single forward slash 🤔

@TranceLove
Copy link
Collaborator Author

I can't seem to figure out why the reported crash has path as java.io.FileNotFoundException: smb:/workgroup with a single forward slash

PrepareCopyTask called this, that the SMB URI passed into the checkFolder method. Yeap, don't know why...

@VishalNehra
Copy link
Member

Issue explanation (write below this line)

Trying to copy file to smb with the above changeset

Exception

  • User Action: UI Error
  • Request: Application crash
  • Version: 3.6.0
  • OS: Linux Android 10 - 29
  • Device: OnePlus6T
  • Model: ONEPLUS A6010
  • Product: OnePlus6T
Crash log

android.os.NetworkOnMainThreadException
	at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1565)
	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116)
	at java.net.SocketOutputStream.write(SocketOutputStream.java:161)
	at jcifs.smb.SmbTransportImpl.doSend(SmbTransportImpl.java:910)
	at jcifs.util.transport.Transport.doSend(Transport.java:276)
	at jcifs.util.transport.Transport.sendrecv(Transport.java:215)
	at jcifs.smb.SmbTransportImpl.sendrecv(SmbTransportImpl.java:1021)
	at jcifs.smb.SmbTransportImpl.send(SmbTransportImpl.java:1539)
	at jcifs.smb.SmbSessionImpl.send(SmbSessionImpl.java:409)
	at jcifs.smb.SmbTreeImpl.send(SmbTreeImpl.java:472)
	at jcifs.smb.SmbTreeConnection.send0(SmbTreeConnection.java:404)
	at jcifs.smb.SmbTreeConnection.send(SmbTreeConnection.java:318)
	at jcifs.smb.SmbTreeConnection.send(SmbTreeConnection.java:298)
	at jcifs.smb.SmbTreeHandleImpl.send(SmbTreeHandleImpl.java:130)
	at jcifs.smb.SmbTreeHandleImpl.send(SmbTreeHandleImpl.java:117)
	at jcifs.smb.SmbFile.withOpen(SmbFile.java:1741)
	at jcifs.smb.SmbFile.withOpen(SmbFile.java:1710)
	at jcifs.smb.SmbFile.withOpen(SmbFile.java:1704)
	at jcifs.smb.SmbFile.queryPath(SmbFile.java:770)
	at jcifs.smb.SmbFile.exists(SmbFile.java:851)
	at com.amaze.filemanager.utils.SmbUtil.checkFolder(SmbUtil.java:122)
	at com.amaze.filemanager.utils.MainActivityHelper.checkFolder(MainActivityHelper.java:413)
	at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.finishCopying(PrepareCopyTask.java:329)
	at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onEndDialog(PrepareCopyTask.java:279)
	at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onEndDialog(PrepareCopyTask.java:272)
	at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onPostExecute(PrepareCopyTask.java:186)
	at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onPostExecute(PrepareCopyTask.java:64)
	at android.os.AsyncTask.finish(AsyncTask.java:755)
	at android.os.AsyncTask.access$900(AsyncTask.java:192)
	at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
	at android.os.Handler.dispatchMessage(Handler.java:107)
	at android.os.Looper.loop(Looper.java:214)
	at android.app.ActivityThread.main(ActivityThread.java:7643)
	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)


@TranceLove TranceLove force-pushed the bugfix/2189 branch 2 times, most recently from 70042e0 to 9279df6 Compare February 10, 2021 10:05
@VishalNehra
Copy link
Member

@TranceLove can you please fix the conflict here

@VishalNehra
Copy link
Member

VishalNehra commented Feb 13, 2021

Sadly I'm still getting the exception log, so doesn't fix the issue still.
Though I can notice there's a leading / before smb:// now, if that helps to find the issue here.

2021-02-14 02:16:19.112 31870-31870/com.amaze.filemanager.debug W/System.err: java.io.FileNotFoundException: /smb:/vishalnehra:Vishal%[email protected]/vishalnehra/Downloads/2020-07-02_14.07 (1)/DummyFile: open failed: ENOENT (No such file or directory)
2021-02-14 02:16:19.115 31870-31870/com.amaze.filemanager.debug W/System.err:     at libcore.io.IoBridge.open(IoBridge.java:496)
2021-02-14 02:16:19.115 31870-31870/com.amaze.filemanager.debug W/System.err:     at java.io.FileOutputStream.<init>(FileOutputStream.java:235)
2021-02-14 02:16:19.115 31870-31870/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.filesystem.FileUtil.isWritable(FileUtil.java:754)
2021-02-14 02:16:19.115 31870-31870/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.utils.MainActivityHelper.checkFolder(MainActivityHelper.java:435)
2021-02-14 02:16:19.115 31870-31870/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.utils.MainActivityHelper.checkFolder(MainActivityHelper.java:414)
2021-02-14 02:16:19.115 31870-31870/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.finishCopying(PrepareCopyTask.java:331)
2021-02-14 02:16:19.115 31870-31870/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onEndDialog(PrepareCopyTask.java:281)
2021-02-14 02:16:19.115 31870-31870/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onEndDialog(PrepareCopyTask.java:274)
2021-02-14 02:16:19.115 31870-31870/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onPostExecute(PrepareCopyTask.java:188)
2021-02-14 02:16:19.115 31870-31870/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onPostExecute(PrepareCopyTask.java:66)
2021-02-14 02:16:19.116 31870-31870/com.amaze.filemanager.debug W/System.err:     at android.os.AsyncTask.finish(AsyncTask.java:755)
2021-02-14 02:16:19.116 31870-31870/com.amaze.filemanager.debug W/System.err:     at android.os.AsyncTask.access$900(AsyncTask.java:192)
2021-02-14 02:16:19.116 31870-31870/com.amaze.filemanager.debug W/System.err:     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
2021-02-14 02:16:19.116 31870-31870/com.amaze.filemanager.debug W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
2021-02-14 02:16:19.116 31870-31870/com.amaze.filemanager.debug W/System.err:     at android.os.Looper.loop(Looper.java:214)
2021-02-14 02:16:19.116 31870-31870/com.amaze.filemanager.debug W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7643)
2021-02-14 02:16:19.116 31870-31870/com.amaze.filemanager.debug W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2021-02-14 02:16:19.116 31870-31870/com.amaze.filemanager.debug W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
2021-02-14 02:16:19.116 31870-31870/com.amaze.filemanager.debug W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
2021-02-14 02:16:19.119 31870-31870/com.amaze.filemanager.debug W/System.err: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
2021-02-14 02:16:19.119 31870-31870/com.amaze.filemanager.debug W/System.err:     at libcore.io.Linux.open(Native Method)
2021-02-14 02:16:19.121 31870-31870/com.amaze.filemanager.debug W/System.err:     at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
2021-02-14 02:16:19.121 31870-31870/com.amaze.filemanager.debug W/System.err:     at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
2021-02-14 02:16:19.121 31870-31870/com.amaze.filemanager.debug W/System.err:     at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
2021-02-14 02:16:19.121 31870-31870/com.amaze.filemanager.debug W/System.err:     at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7542)
2021-02-14 02:16:19.121 31870-31870/com.amaze.filemanager.debug W/System.err:     at libcore.io.IoBridge.open(IoBridge.java:482)
2021-02-14 02:16:19.121 31870-31870/com.amaze.filemanager.debug W/System.err: 	... 18 more

Also added SshClientUtils version of checkFolder()
@EmmanuelMess
Copy link
Member

@TranceLove this needs to be rebased

Copy link
Member

@EmmanuelMess EmmanuelMess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes issue and code seems ok

@VishalNehra VishalNehra removed this from the v3.6 milestone Apr 25, 2021
@VishalNehra VishalNehra merged commit 74e7bd9 into TeamAmaze:release/3.6 Apr 25, 2021
@EmmanuelMess EmmanuelMess deleted the bugfix/2189 branch April 26, 2021 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-FileOperations Related to file operations (e.g. moving, copying, renaming). Area-SMB Related to SMB connections. Issue-Bug Related unexpected behavior or something worth investigating.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash stacktrace at SMB file copy
3 participants