private boolean receiveResult(String submissionID){
  File zipfile=null;
  FileOutputStream output=null;
  try {
    File resultDir=new File(resultDirName);
    if (!resultDir.exists())     resultDir.mkdirs();
    zipfile=File.createTempFile("jplagtmpresult",".zip");
    output=new FileOutputStream(zipfile);
    StartResultDownloadData srdd=stub.startResultDownload(submissionID);
    int filesize=srdd.getFilesize();
    int loadedsize=srdd.getData().length;
    initProgressBar(srdd.getFilesize());
    output.write(srdd.getData());
    setProgressBarValue(loadedsize);
    while (loadedsize < filesize) {
      byte[] data=stub.continueResultDownload(0);
      output.write(data);
      loadedsize+=data.length;
      setProgressBarValue(loadedsize);
    }
    output.close();
    ZipUtil.unzip(zipfile,resultDir);
    zipfile.delete();
  }
 catch (  Exception e) {
    if (output != null) {
      try {
        output.close();
      }
 catch (      Exception ex) {
      }
    }
    if (zipfile != null)     zipfile.delete();
    checkException(e);
    return false;
  }
  return true;
}

private boolean receiveResult ( String submissionID ) { File zipfile = null ; FileOutputStream output = null ; try { File resultDir = new File ( resultDirName ) ; if ( ! resultDir . exists ( ) ) resultDir . mkdirs ( ) ; zipfile = File . createTempFile ( "jplagtmpresult" , ".zip" ) ; output = new FileOutputStream ( zipfile ) ; StartResultDownloadData srdd = stub . startResultDownload ( submissionID ) ; int filesize = srdd . getFilesize ( ) ; int loadedsize = srdd . getData ( ) . length ; initProgressBar ( srdd . getFilesize ( ) ) ; output . write ( srdd . getData ( ) ) ; setProgressBarValue ( loadedsize ) ; while ( loadedsize < filesize ) { byte [ ] data = stub . continueResultDownload ( 0 ) ; output . write ( data ) ; loadedsize += data . length ; setProgressBarValue ( loadedsize ) ; } output . close ( ) ; ZipUtil . unzip ( zipfile , resultDir ) ; zipfile . delete ( ) ; } catch ( Exception e ) { if ( output != null ) { try { output . close ( ) ; } catch ( Exception ex ) { } } if ( zipfile != null ) zipfile . delete ( ) ; checkException ( e ) ; return false ; } return true ; }
downloads and unzips the result
