* @author Santiago Moreno <ingcsmoreno@gmail.com>
*/
public class DownloadManager {
public static void downloadUpdate(int updateCode) throws ChecksumFailException, IOException {
Update update = UpdateManager.getUpdate(updateCode);;
try {
String updateChecksum = downloadFile(update.getUpdateFile());
Logger.getLogger(DownloadManager.class.getName()).debug("Checksum="
+updateChecksum);
if (updateChecksum.compareTo(update.getChecksum())!=0)
throw new ChecksumFailException("Downloaded file "
+ update.getUpdateFile() + " checksum fails.");
} catch (MalformedURLException ex) {
Logger.getLogger(DownloadManager.class.getName()).error(
"URL: "+update.getUpdateFile()+"\n"+ex.getStackTrace());
}
}