private static void checkFile(ZipEntry entry,String disthash,String newhash) throws IOException {
  String path=entry.getName();
  File dest=new File(path);
  if (dest.exists()) {
    if (!newhash.equals(disthash)) {
      String localhash="";
      try {
        localhash=Filesystem.getHash(new FileInputStream(dest));
      }
 catch (      NoSuchAlgorithmException e) {
        Log.info("ERROR: Cannot calculate local file hash: " + e.getMessage());
      }
      if (!localhash.equals(disthash)) {
        File backup=new File(dest.getAbsolutePath() + ".bak");
        Log.info("File " + path + " is modified! I will create a backup to "+ backup.getAbsolutePath()+ " and recreate the new file.");
        Filesystem.moveFile(dest,backup);
        createFile(dest,path,(int)entry.getSize());
      }
 else {
        Log.info("Upgrading file: " + path);
        createFile(dest,path,(int)entry.getSize());
      }
    }
  }
 else {
    Log.info("File " + path + " doesn't exist! Recreating...");
    createFile(dest,path,(int)entry.getSize());
  }
}

private static void checkFile ( ZipEntry entry , String disthash , String newhash ) throws IOException { String path = entry . getName ( ) ; File dest = new File ( path ) ; if ( dest . exists ( ) ) { if ( ! newhash . equals ( disthash ) ) { String localhash = "" ; try { localhash = Filesystem . getHash ( new FileInputStream ( dest ) ) ; } catch ( NoSuchAlgorithmException e ) { Log . info ( "ERROR: Cannot calculate local file hash: " + e . getMessage ( ) ) ; } if ( ! localhash . equals ( disthash ) ) { File backup = new File ( dest . getAbsolutePath ( ) + ".bak" ) ; Log . info ( "File " + path + " is modified! I will create a backup to " + backup . getAbsolutePath ( ) + " and recreate the new file." ) ; Filesystem . moveFile ( dest , backup ) ; createFile ( dest , path , ( int ) entry . getSize ( ) ) ; } else { Log . info ( "Upgrading file: " + path ) ; createFile ( dest , path , ( int ) entry . getSize ( ) ) ; } } } else { Log . info ( "File " + path + " doesn't exist! Recreating..." ) ; createFile ( dest , path , ( int ) entry . getSize ( ) ) ; } }
checks if file exists and copies it from the jar if it doesn ' t .
