public boolean handleErrors() throws PluginException {
   if (externalDownloadStop()) {
     return false;
   }
   if (getFileSize() > 0 && totalLinkBytesLoaded != getFileSize()) {
     if (totalLinkBytesLoaded > getFileSize()) {
       /*
        * workaround for old bug deep in this downloadsystem. more data got loaded (maybe just counting bug) than filesize. but in
        * most cases the file is okay! WONTFIX because new downloadsystem is on its way
        */
       logger.severe("Filesize: " + getFileSize() + " Loaded: " + totalLinkBytesLoaded);
       if (caughtPluginException == null) {
         downloadable.setLinkStatus(LinkStatus.FINISHED);
       }
       return true;
     }
     logger.severe("Filesize: " + getFileSize() + " Loaded: " + totalLinkBytesLoaded);
     logger.severe("DOWNLOAD INCOMPLETE DUE TO FILESIZECHECK");
     if (caughtPluginException != null) {
       throw caughtPluginException;
     }
     throw new PluginException(
         LinkStatus.ERROR_DOWNLOAD_INCOMPLETE, _JDT.T.download_error_message_incomplete());
   }
   if (caughtPluginException == null) {
     downloadable.setLinkStatus(LinkStatus.FINISHED);
     downloadable.setVerifiedFileSize(outputCompleteFile.length());
     return true;
   } else {
     throw caughtPluginException;
   }
 }
  @Override
  public boolean startDownload() throws Exception {
    try {
      downloadable.setConnectionHandler(this.getManagedConnetionHandler());
      final DiskSpaceReservation reservation = downloadable.createDiskSpaceReservation();
      DownloadPluginProgress downloadPluginProgress = null;
      try {
        if (!downloadable.checkIfWeCanWrite(
            new ExceptionRunnable() {

              @Override
              public void run() throws Exception {
                downloadable.checkAndReserve(reservation);
                createOutputFiles();
                try {
                  downloadable.lockFiles(
                      outputCompleteFile, outputFinalCompleteFile, outputPartFile);
                } catch (FileIsLockedException e) {
                  downloadable.unlockFiles(
                      outputCompleteFile, outputFinalCompleteFile, outputPartFile);
                  throw new PluginException(LinkStatus.ERROR_ALREADYEXISTS);
                }
              }
            },
            null)) {
          throw new SkipReasonException(SkipReason.INVALID_DESTINATION);
        }
        startTimeStamp = System.currentTimeMillis();
        downloadPluginProgress =
            new DownloadPluginProgress(downloadable, this, Color.GREEN.darker());
        downloadable.addPluginProgress(downloadPluginProgress);
        downloadable.setAvailable(AvailableStatus.TRUE);
        download(filePath, downloadable.isResumable());
      } finally {
        try {
          downloadable.free(reservation);
        } catch (final Throwable e) {
          LogSource.exception(logger, e);
        }
        try {
          downloadable.addDownloadTime(System.currentTimeMillis() - getStartTimeStamp());
        } catch (final Throwable e) {
        }
        downloadable.removePluginProgress(downloadPluginProgress);
      }
      if (isDownloadComplete()) {
        logger.info("Download is complete");
        final HashResult hashResult = getHashResult(downloadable, outputPartFile);
        if (hashResult != null) {
          logger.info(hashResult.toString());
          downloadable.setHashResult(hashResult);
        }
        if (hashResult == null || hashResult.match()) {
          downloadable.setVerifiedFileSize(outputPartFile.length());
        } else {
          if (hashResult.getHashInfo().isTrustworthy()) {
            throw new PluginException(
                LinkStatus.ERROR_DOWNLOAD_FAILED,
                _JDT.T.system_download_doCRC2_failed(hashResult.getHashInfo().getType()));
          }
        }
        finalizeDownload(outputPartFile, outputCompleteFile);
        downloadable.setLinkStatus(LinkStatus.FINISHED);
        return true;
      }
      if (externalDownloadStop() == false) {
        throw new PluginException(
            LinkStatus.ERROR_DOWNLOAD_INCOMPLETE, _JDT.T.download_error_message_incomplete());
      }
      return false;
    } finally {
      downloadable.unlockFiles(outputCompleteFile, outputFinalCompleteFile, outputPartFile);
      cleanupDownladInterface();
    }
  }