I started working with improved loops because of his best practices and robes for working with ArrayLists
.
My code basically gets an ArrayList that contains links to songs and parses this list loading songs. One of the exceptions thrown is a TimeoutException, which usually occurs when the server is overloaded or there is instability with the Internet connection.
To clarify:
try { for(Track track : album.getTracks()) { songdown.downloadTrack(track, directorio, formataudio); } } catch (TimeoutException te) { System.out.println("Timeout!"); }
track is an ArrayList that is parsed one by one by the songdown.downloadTrack function. When the download fails, a TimeoutException is thrown, but I donโt know how to handle this exception to delete the file that I generated and restart the for statement from the same track so that the download can repeat.
user1282468
source share