Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
–1 vote
363 views
in Java FTP by (210 points)

java.lang.ArrayIndexOutOfBoundsException occured during SFTP put (Debug log level).

Version: 7.2.0
Stacktrace:

Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Vector.java:497) ~[?:?]
at com.enterprisedt.util.debug.Logger.b(Logger.java:561) ~[agent.jar:?]
at com.enterprisedt.util.debug.Logger.log(Logger.java:447) ~[agent.jar:?]
at com.enterprisedt.util.debug.Logger.debug(Logger.java:659) ~[agent.jar:?]
at com.enterprisedt.net.j2ssh.connection.ConnectionProtocol.sendChannelData(ConnectionProtocol.java:262) ~[agent.jar:?]
at com.enterprisedt.net.j2ssh.connection.Channel.sendChannelData(Channel.java:229) ~[agent.jar:?]
at com.enterprisedt.net.j2ssh.subsystem.SubsystemChannel.sendMessage(SubsystemChannel.java:75) ~[agent.jar:?]
at com.enterprisedt.net.j2ssh.sftp.SftpSubsystemClient.writeFileAsync(SftpSubsystemClient.java:908) ~[agent.jar:?]
at com.enterprisedt.net.j2ssh.sftp.SftpFileOutputStream.write(SftpFileOutputStream.java:133) ~[agent.jar:?]
at com.enterprisedt.net.j2ssh.SftpClient.a(SftpClient.java:789) ~[agent.jar:?]
at com.enterprisedt.net.j2ssh.SftpClient.put(SftpClient.java:1382) ~[agent.jar:?]
at com.enterprisedt.net.j2ssh.SftpClient.put(SftpClient.java:1280) ~[agent.jar:?]
at com.enterprisedt.net.ftp.ssh.SSHFTPClient.put(SSHFTPClient.java:1103) ~[agent.jar:?]

1 Answer

+1 vote
by (51.6k points)
selected by
 
Best answer

Looking at the code in Logger.b (shown below), the only way that this could happen is if Logger.clearAppenders() or Logger.removeAppender(Appender) is invoked on another thread.

for (int i = 0; i < appenders.size(); i++) {
    Appender a = (Appender)appenders.elementAt(i);

You can see that execution doesn't enter the for loop if size==0, so since it did size must have been greater than 0 when it was evaluated, but then when execution reached the second line there was no element at index 0, so something must have happened in between these two points. As far as I can see, it must have been another thread changing the appenders Vector.

by (210 points)
Yep - clearing loggers could be called in another thread. Thank you for help

Categories

...