Answer the question
In order to leave comments, you need to log in
Why throws ArrayIndexOutOfBoundsException?
I connect to the server to select a fresh file, but when searching for a file, it throws an exception:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
public static FTPFile lastFileModified(FTPFile[] files)
{
Date lastMod = files[0].getTimestamp().getTime();
FTPFile choice = files[0];
for (FTPFile file : files)
{
if (file.getTimestamp().getTime().after(lastMod))
{
choice = file;
lastMod = file.getTimestamp().getTime();
}
}
return choice;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question