Where is the exception happening? Copy the full contents of the error message and paste it here.
Make sure the catch block calls the printStackTrace method to show the error's location.
Is there a variable with a null value? Backtrack in the code to see why the variable does not have a valid value.
Where is the exception happening? Copy the full contents of the error message and paste it here.
Make sure the catch block calls the printStackTrace method to show the error's location.
Is there a variable with a null value? Backtrack in the code to see why the variable does not have a valid value.
Sorry, I edited the main post now. It is giving exception for any code related to sourcePath. Path exists and have files, not sure why it is not reading the sourcePath
Exception in thread "main" 4:
at com.jcraft.jsch.ChannelSftp.cd(ChannelSftp.java:359)
at org.gradle.CopyTest.downloadDir(CopyTest.java:65)
Look at line at 359 in ChannelSftp and find the null value. Use a print statement to print out the values of all the variables used on line 359 to see which one has the null value.
Does the error message go with the posted code?
The error message refers to method cd
the posted coded has method lcd
Exception in thread "main" 4:
at com.jcraft.jsch.ChannelSftp.cd(ChannelSftp.java:359)
at org.gradle.CopyTest.downloadDir(CopyTest.java:65)
Look at line at 359 in ChannelSftp and find the null value. Use a print statement to print out the values of all the variables used on line 359 to see which one has the null value.
Does the error message go with the posted code?
The error message refers to method cd
the posted coded has method lcd
I tried this too..Neither sourcePath nor sftpChannel is null but the sftpChannel.ls(sourcePath) gives exception.
I could not progress much here but I think the problem is host is not excepting sftp connection. I checked through WinScp and saw that even it was falling back to Scp.
I've never won anything before. Not even a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss