Android Question jcifs-ng SMB-Client

Nokia

Active Member
Licensed User
Longtime User
I have a few exceptions that show but does not crash app..

for example: SmbException: jcifs.smb.SmbException: The system cannot find the path specified.

I want to catch these and show to user..

any body have an idea if there is a event that is called?

example:
B4X:
Sub SMBClient_Test_Exception(Exception As Exception)
    ToastMessageShow(LastException.Message, True)
End Sub
 

Nokia

Active Member
Licensed User
Longtime User
Here is one error that happens Release but does not happen during debug.

error: java.lang.Exception: Sub smbclient_copy_copy2result was not found.

here is the code I execute smbclient:

B4X:
                smbClient.Initialize("smbClient_Copy", smbDomain, smbUser,smbPassword, SMB_Dir)
                Wait For smbClient_Copy_Resource(success As Boolean, smbobjres As Object,smbobj As Object, info As String)
                If smbobjres <> Null And smbobj <> Null And info = "OK" Then
                    Dim smbResource As SMBResource = smbobjres
                    
                    For Each f As String In File.ListFiles(CurrentDir)
                        smbClient.Copy2(CurrentDir,f,smbResource, f)
                        Wait For smbClient_Copy_CopyResult(success As Boolean, path As String, filename As String)
                        If success = False Then
                            bB = False
                        End If
                        Sleep(0)
                    Next
                End If

So I'm intentionally trying to connect to a recourse that is not there and after I put it back into debug mode I get error above. Trying to figure out how to catch exceptions. IT looks like it's trying to fire a copy2Result event, but when I do copy successfully,, it uses the CopyReslt event.
 
Upvote 0

Nokia

Active Member
Licensed User
Longtime User
You should probably change the event signature in line 8. Change it to: smbclient_copy_copy2result

I tried that and no go..

If I successfully connect to //192.168.1.20/share/ the event that's called is: smbClient_Copy_CopyResult. If I change it to smbClient_Copy_Copy2Result, the code under event never fires.

Now lets say I want to cause an error on purpose, to try and catch the error. I change the url to //192.168.2.20/share/ but I am still on 192.168.1.x. the app crashes (release mode) and the event that is being called is: smbClient_Copy_Copy2Result. It seems that it only calls then event when an error happens.. other wise when no issues/no error the event is: smbClient_Copy_CopyResult...

However under bedbug mode.. no crashes but some exception do come up.. I:E: "SmbException: jcifs.smb.SmbException: The system cannot find the path specified ". I don't know if these are true exceptions or if they are just logged events from the library. Either way I can't catch them or I have not found a way yet..

Erel, any thoughts?
 
Upvote 0
Top