I have a vector which contains a list of files to open and parse, and I was wondering what is the best choice to do in my case.
This what I started to do :
for (int i =0 ; i< files.size() ; i++)
{
System.out.println("n°" + i + " : " + files.elementAt(i));
try
{
// open the files
}
catch (Exception e) {
// TODO: handle exception
}
}
or what do you think about this one?
try
{
for (int i =0 ; i< files.size() ; i++)
{
System.out.println("n°" + i + " : " + files.elementAt(i));
// open the files
}
}
catch (Exception e) {
// TODO: handle exception
}
EDIT:
My purpose is that, when I try to open a file that doesn't exist I must throw something or maybe write the exception in a log file and continue opening the other files.
So I think the first solution is the best in my situation?