コード例 #1
0
ファイル: VGet.java プロジェクト: Alakeel/vget
 /**
  * check if all parts has the same filenotfound exception. if so throw
  * DownloadError.FilenotFoundexcepiton
  *
  * @param e
  */
 void checkFileNotFound(DownloadMultipartError e) {
   FileNotFoundException f = null;
   for (Part ee : e.getInfo().getParts()) {
     // no error for this part? skip it
     if (ee.getException() == null) continue;
     // this exception has no cause? then it is not FileNotFound
     // excpetion. then do noting. this is checking function. do not
     // rethrow
     if (ee.getException().getCause() == null) return;
     if (ee.getException().getCause() instanceof FileNotFoundException) {
       // our first filenotfoundexception?
       if (f == null) {
         // save it for later checks
         f = (FileNotFoundException) ee.getException().getCause();
       } else {
         // check filenotfound error message is it the same?
         FileNotFoundException ff = (FileNotFoundException) ee.getException().getCause();
         if (!ff.getMessage().equals(f.getMessage())) {
           // if the filenotfound exception message is not the
           // same. then we cannot retrhow filenotfound exception.
           // return and continue checks
           return;
         }
       }
     } else {
       break;
     }
   }
   if (f != null) throw new DownloadError(f);
 }
コード例 #2
0
ファイル: VGet.java プロジェクト: Alakeel/vget
 void checkRetry(DownloadMultipartError e) {
   for (Part ee : e.getInfo().getParts()) {
     if (!retry(ee.getException())) {
       throw e;
     }
   }
 }