eftsousis / sshxcute

Automatically exported from code.google.com/p/sshxcute
0 stars 0 forks source link

uploadAllDataToServer is throwing error #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create obj for ConnBean
ConnBean cb = new ConnBean(hostname,username,password)
2. SSHExec.getInstance(cb);
   SSHExec ssh = SSHExec.getInstance(cb);
   ssh.connect();
3. ssh.uploadAllDataToServer(localdir,   destination);

What is the expected output? What do you see instead?
Expected output: it should be upload all file to destination location.
Instead of this it is throwing error with exception:
java.lang.ArrayIndexOutOfBoundsException: 1
    at net.neoremind.sshxcute.core.SSHExec.traverseDataDir(SSHExec.java:523)
    at net.neoremind.sshxcute.core.SSHExec.traverseDataDir(SSHExec.java:518)
    at net.neoremind.sshxcute.core.SSHExec.uploadAllDataToServer(SSHExec.java:265)

What version of the product are you using? On what operating system?
I am using sshxcute1.0 and os is win7 64 bit

Please provide any additional information below.

Original issue reported on code.google.com by i.ramandas on 29 Aug 2013 at 3:43

GoogleCodeExporter commented 9 years ago
I've found a fix for this.  SSHExec.java at the very bottom is a function 
called traverseDataDir().  The problem occurs when a file it's picked up is on 
the parent directory you passed into the uploadAllDataToServer.  There's a 
split function that returns an array of size 0 because the 2 parameters are 
equivalent.  
You can correct it by making an If else around it:
if(parentDir.getParent().toString().replace('\\', '/').equals(parentRootPath))
{               dataList.put(parentDir.getPath().toString().replace('\\', '/'),"");
}
else{
//Do original code
}
}

Original comment by kmal...@fenwayx.com on 20 Jan 2015 at 6:42