Exemple #1
1
  /**
   * Moves and archives old, non-executed transactions into an archive file.
   *
   * <p>Makes sure the file to archive to doesn't exist, and shows amount of archived transactions
   */
  private static void arkiveraGamlaTransaktioner() {
    File archive;

    System.out.print("Mata in ett nytt filnamn att arkivera till: ");
    archive = new File(tbScanner.nextLine());

    while (archive.exists()) {
      System.out.print("Filen existerar redan; var god mata in ett nytt filnamn: ");
      archive = new File(tbScanner.nextLine());
    }
    tbScanner.reset();
    System.out.println("Sparar till: " + archive);

    // Hämtar datum en vecka tillbaka
    Calendar c = Calendar.getInstance();
    c.add(Calendar.WEEK_OF_YEAR, -1);

    // Försöker arkivera till den nya filen
    try {
      int antalArkiveradeTransaktioner;
      antalArkiveradeTransaktioner = m.archiveTransactions(c.getTime(), archive);
      System.out.println("Arkiverade " + antalArkiveradeTransaktioner + " transaktioner");
    } catch (IOException e) {
      System.out.println("Kunde inte skriva till arkivfilen!");
    }
  } // s**t på arkiveraGamlaTransaktioner
Exemple #2
0
 public void renameDataSourceDir(String oldDataSourceId, String newDataSourceId)
     throws FileNotFoundException, IOException {
   File dataSourceDir = getDataSourceDir(oldDataSourceId);
   if (dataSourceDir.exists()) {
     dataSourceDir.renameTo(getDataSourceDir(newDataSourceId));
   }
 }
  public static void rename(@NotNull File source, @NotNull File target) throws IOException {
    if (source.renameTo(target)) return;
    if (!source.exists()) return;

    copy(source, target);
    delete(source);
  }
Exemple #4
0
 /**
  * The ActionListener implementation
  *
  * @param event the event.
  */
 public void actionPerformed(ActionEvent event) {
   String searchText = textField.getText().trim();
   if (searchText.equals("") && !saveAs.isSelected() && (fileLength > 10000000)) {
     textPane.setText("Blank search text is not allowed for large IdTables.");
   } else {
     File outputFile = null;
     if (saveAs.isSelected()) {
       outputFile = chooser.getSelectedFile();
       if (outputFile != null) {
         String name = outputFile.getName();
         int k = name.lastIndexOf(".");
         if (k != -1) name = name.substring(0, k);
         name += ".txt";
         File parent = outputFile.getAbsoluteFile().getParentFile();
         outputFile = new File(parent, name);
         chooser.setSelectedFile(outputFile);
       }
       if (chooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) System.exit(0);
       outputFile = chooser.getSelectedFile();
     }
     textPane.setText("");
     Searcher searcher = new Searcher(searchText, event.getSource().equals(searchPHI), outputFile);
     searcher.start();
   }
 }
Exemple #5
0
    protected void setData(String strChecksum) {
      String strValue = (String) m_cmbPath.getSelectedItem();
      if (strValue == null || strValue.equals("")) return;

      m_cmbChecksum.removeAllItems();

      String strPath = strValue.substring(strValue.lastIndexOf("/") + 1);
      strPath = UtilB.unixPathToWindows(FileUtil.SYS_VNMR + "/p11/checksums/" + strPath);
      strPath = FileUtil.openPath(strPath);
      if (strPath != null) {
        File file = new File(strPath);
        String[] files = file.list();
        int nSize = files.length;
        for (int i = 0; i < nSize; i++) {
          String strfile = files[i];
          m_cmbChecksum.addItem(strfile);
        }

        int nIndex = strChecksum.lastIndexOf("/");
        if (nIndex < 0) nIndex = strChecksum.lastIndexOf(File.separator);
        if (nIndex + 1 < strChecksum.length()) strChecksum = strChecksum.substring(nIndex + 1);

        m_cmbChecksum.setSelectedItem(strChecksum);
      }
    }
Exemple #6
0
 protected void eraseFiles() {
   File tmpdirF = new File(tmpdir);
   String[] files = tmpdirF.list();
   for (int i = 0; files != null && i < files.length; i++) {
     new File(tmpdir + "/" + files[i]).delete();
   }
 }
Exemple #7
0
 private void fixConfigSchema() {
   File configFile;
   File ctpDir = new File(directory, "CTP");
   if (ctpDir.exists()) configFile = new File(ctpDir, "config.xml");
   else configFile = new File(directory, "config.xml");
   if (configFile.exists()) {
     try {
       Document doc = getDocument(configFile);
       Element root = doc.getDocumentElement();
       Element server = getFirstNamedChild(root, "Server");
       moveAttributes(server, sslAttrs, "SSL");
       moveAttributes(server, proxyAttrs, "ProxyServer");
       moveAttributes(server, ldapAttrs, "LDAP");
       if (programName.equals("ISN")) fixRSNAROOT(server);
       if (isMIRC(root)) fixFileServiceAnonymizerID(root);
       setFileText(configFile, toString(doc));
     } catch (Exception ex) {
       cp.appendln(Color.red, "\nUnable to convert the config file schema.");
       cp.appendln(Color.black, "");
     }
   } else {
     cp.appendln(Color.red, "\nUnable to find the config file to check the schema.");
     cp.appendln(Color.black, "");
   }
 }
Exemple #8
0
  // Send File
  public void sendFile(String chunkName) throws IOException {
    OutputStream os = null;
    String currentDir = System.getProperty("user.dir");
    chunkName = currentDir + "/src/srcFile/" + chunkName;
    File myFile = new File(chunkName);

    byte[] arrby = new byte[(int) myFile.length()];

    try {
      FileInputStream fis = new FileInputStream(myFile);
      BufferedInputStream bis = new BufferedInputStream(fis);
      bis.read(arrby, 0, arrby.length);

      os = csocket.getOutputStream();
      System.out.println("Sending File.");
      os.write(arrby, 0, arrby.length);
      os.flush();
      System.out.println("File Sent.");
      //			os.close();
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      //			os.close();
    }
  }
  /**
   * Add fully-resolved directories (with filters) to the current class path.
   *
   * @param baseList is the list of library directories.
   * @param filterList is the corresponding list of filters.
   */
  protected void addDirsToClassPath(File[] baseList, FileFilter[] filterList)
      throws ManifoldCFException {
    int i = 0;
    while (i < baseList.length) {
      File base = baseList[i];
      FileFilter filter;
      if (filterList != null) filter = filterList[i];
      else filter = null;

      if (base.canRead() && base.isDirectory()) {
        File[] files = base.listFiles(filter);

        if (files != null && files.length > 0) {
          int j = 0;
          while (j < files.length) {
            File file = files[j++];
            currentClasspath.add(file);
            // Invalidate the current classloader
            classLoader = null;
          }
        }
      } else
        throw new ManifoldCFException(
            "Supposed directory '"
                + base.toString()
                + "' is either not a directory, or is unreadable.");
      i++;
    }
  }
Exemple #10
0
 /** Load all AIML Maps */
 int addAIMLMaps() {
   int cnt = 0;
   Timer timer = new Timer();
   timer.start();
   try {
     // Directory path here
     String file;
     File folder = new File(maps_path);
     if (folder.exists()) {
       File[] listOfFiles = IOUtils.listFiles(folder);
       if (MagicBooleans.trace_mode)
         System.out.println("Loading AIML Map files from " + maps_path);
       for (File listOfFile : listOfFiles) {
         if (listOfFile.isFile()) {
           file = listOfFile.getName();
           if (file.endsWith(".txt") || file.endsWith(".TXT")) {
             if (MagicBooleans.trace_mode) System.out.println(file);
             String mapName = file.substring(0, file.length() - ".txt".length());
             if (MagicBooleans.trace_mode) System.out.println("Read AIML Map " + mapName);
             AIMLMap aimlMap = new AIMLMap(mapName, this);
             cnt += aimlMap.readAIMLMap(this);
             mapMap.put(mapName, aimlMap);
           }
         }
       }
     } else System.out.println("addAIMLMaps: " + maps_path + " does not exist.");
   } catch (Exception ex) {
     ex.printStackTrace();
   }
   return cnt;
 }
Exemple #11
0
 /**
  * write categories to AIMLIF file
  *
  * @param cats array list of categories
  * @param filename AIMLIF filename
  */
 public void writeIFCategories(ArrayList<Category> cats, String filename) {
   // System.out.println("writeIFCategories "+filename);
   BufferedWriter bw = null;
   File existsPath = new File(aimlif_path);
   if (existsPath.exists())
     try {
       // Construct the bw object
       bw = new BufferedWriter(new FileWriter(aimlif_path + "/" + filename));
       for (Category category : cats) {
         bw.write(Category.categoryToIF(category));
         bw.newLine();
       }
     } catch (FileNotFoundException ex) {
       ex.printStackTrace();
     } catch (IOException ex) {
       ex.printStackTrace();
     } finally {
       // Close the bw
       try {
         if (bw != null) {
           bw.flush();
           bw.close();
         }
       } catch (IOException ex) {
         ex.printStackTrace();
       }
     }
 }
Exemple #12
0
  private void createOutputJar() {
    // Me make the .uninstaller directory
    String dest =
        IoHelper.translatePath(installdata.getInfo().getUninstallerPath(), variableSubstitutor);
    String jar = dest + File.separator + installdata.getInfo().getUninstallerName();
    File pathMaker = new File(dest);
    pathMaker.mkdirs();

    // We log the uninstaller deletion information
    udata.setUninstallerJarFilename(jar);
    udata.setUninstallerPath(dest);

    // We open our final jar file
    try {
      out = new FileOutputStream(jar);
    } catch (FileNotFoundException e) {
      throw new IzPackException("Problem writing uninstaller jar", e);
    }

    try {
      // Intersect a buffer else byte for byte will be written to the file.
      bos = new BufferedOutputStream(out);
      outJar = new JarOutputStream(bos);
    } catch (IOException e) {
      throw new IzPackException("Problem writing uninstaller jar", e);
    }

    outJar.setLevel(9);
    udata.addFile(jar, true);
  }
Exemple #13
0
  private BufferedWriter getExternLogFile(AutomatedInstallData installdata) {
    String logfile = installdata.getVariable(LOGFILE_PATH);
    BufferedWriter extLogWriter = null;
    if (logfile != null) {
      if (logfile.toLowerCase().startsWith("default")) {
        logfile = installdata.getInfo().getUninstallerPath() + "/install.log";
      }
      logfile = IoHelper.translatePath(logfile, variableSubstitutor);
      File outFile = new File(logfile);
      if (!outFile.getParentFile().exists()) {
        outFile.getParentFile().mkdirs();
      }
      FileOutputStream out = null;
      try {
        out = new FileOutputStream(outFile);
      } catch (FileNotFoundException e) {
        Debug.trace("Cannot create logfile!");
        Debug.error(e);
      }
      if (out != null) {
        extLogWriter = new BufferedWriter(new OutputStreamWriter(out));
      }
    }

    return extLogWriter;
  }
 public static List<String> toPaths(Collection<File> files) {
   List<String> paths = new ArrayList<String>();
   for (File file : files) {
     paths.add(file.getAbsolutePath());
   }
   return paths;
 }
Exemple #15
0
  /**
   * Empty repository directory, record count and specific Data Source temporary files and
   * directories.
   *
   * @throws Exception
   */
  public void cleanUp() throws IOException {
    // Delete records indexes
    for (AccessPoint accessPoint : getAccessPoints().values()) {
      try {
        RepoxContextUtil.getRepoxManager().getAccessPointsManager().emptyIndex(this, accessPoint);
        log.info("Emptied AccessPoint with id " + accessPoint.getId());
      } catch (Exception e) {
        log.error("Unable to empty Table from Database: " + accessPoint.getId(), e);
      }
    }

    File dataSourceDir = getDataSourceDir();

    boolean deletedDir = true;
    if (dataSourceDir.exists()) {
      deletedDir = FileUtil.deleteDir(dataSourceDir);
      dataSourceDir.mkdir();
    }

    if (!deletedDir) {
      log.error("Unable to delete Data Source dir from Data Source with id " + id);
    } else {
      log.info("Deleted Data Source dir with success from Data Source with id " + id);
    }

    RepoxContextUtil.getRepoxManager().getRecordCountManager().removeDataSourceCounts(id);
  }
  public static void recover() throws IOException {
    String directory = DatabaseDescriptor.getCommitLogLocation();
    File[] files =
        new File(directory)
            .listFiles(
                new FilenameFilter() {
                  public boolean accept(File dir, String name) {
                    return CommitLogSegment.possibleCommitLogFile(name);
                  }
                });
    if (files.length == 0) return;

    Arrays.sort(files, new FileUtils.FileComparator());
    logger.info("Replaying " + StringUtils.join(files, ", "));
    recover(files);
    for (File f : files) {
      FileUtils.delete(
          CommitLogHeader.getHeaderPathFromSegmentPath(
              f.getAbsolutePath())); // may not actually exist
      if (!f.delete())
        logger.error(
            "Unable to remove "
                + f
                + "; you should remove it manually or next restart will replay it again (harmless, but time-consuming)");
    }
    logger.info("Log replay complete");
  }
 public static void loadDescriptors(
     String pluginsPath,
     List<IdeaPluginDescriptorImpl> result,
     @Nullable StartupProgress progress,
     int pluginsCount) {
   final File pluginsHome = new File(pluginsPath);
   final File[] files = pluginsHome.listFiles();
   if (files != null) {
     int i = result.size();
     for (File file : files) {
       final IdeaPluginDescriptorImpl descriptor = loadDescriptor(file, PLUGIN_XML);
       if (descriptor == null) continue;
       if (progress != null) {
         progress.showProgress(
             descriptor.getName(), PLUGINS_PROGRESS_MAX_VALUE * ((float) ++i / pluginsCount));
       }
       int oldIndex = result.indexOf(descriptor);
       if (oldIndex >= 0) {
         final IdeaPluginDescriptorImpl oldDescriptor = result.get(oldIndex);
         if (StringUtil.compareVersionNumbers(oldDescriptor.getVersion(), descriptor.getVersion())
             < 0) {
           result.set(oldIndex, descriptor);
         }
       } else {
         result.add(descriptor);
       }
     }
   }
 }
Exemple #18
0
  public String readFromFile(String fileName) {
    StringBuilder sb = new StringBuilder();
    try {
      if (exists(fileName) == false) { // todo - исправь это плиз, а то выебу DONE
        throw new FileNotFoundException();
      } else {

        File file = new File(String.valueOf(fileName));
        String s;

        try {
          BufferedReader bufferedReaderIn =
              new BufferedReader(new FileReader(file.getAbsoluteFile()));
          try {
            while ((s = bufferedReaderIn.readLine()) != null) {
              sb.append(s).append(" ");
            }
          } finally {
            bufferedReaderIn.close();
          }
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
    } catch (FileNotFoundException e) {
      log.error("File not found");
    }

    return sb.toString();
  }
Exemple #19
0
  private static void index_h(String prefix, File file, IndexWriter indexWriter)
      throws IOException {
    Document doc = null;

    if (file.isDirectory()) {
      File files[] = file.listFiles();
      for (File file1 : files) {
        index_h(prefix + FILE_SEPARATOR + file.getName(), file1, indexWriter);
      }
    } else {
      String content = FileUtils.readFileToString(file, "utf-8");

      System.out.println("==============================================================");
      System.out.println("index_h " + content);
      System.out.println("==============================================================");

      String filename = prefix + FILE_SEPARATOR + file.getName();
      String path = file.getAbsolutePath();

      doc = new Document();
      doc.add(new Field("content", content, Field.Store.YES, Field.Index.ANALYZED));
      doc.add(new Field("relative_path", filename, Field.Store.YES, Field.Index.NOT_ANALYZED));
      indexWriter.addDocument(doc);
    }
  }
  /**
   * Load classes from given file. File could be either directory or JAR file.
   *
   * @param clsLdr Class loader to load files.
   * @param file Either directory or JAR file which contains classes or references to them.
   * @return Set of found and loaded classes or empty set if file does not exist.
   * @throws GridSpiException Thrown if given JAR file references to none existed class or
   *     IOException occurred during processing.
   */
  static Set<Class<? extends GridTask<?, ?>>> getClasses(ClassLoader clsLdr, File file)
      throws GridSpiException {
    Set<Class<? extends GridTask<?, ?>>> rsrcs = new HashSet<Class<? extends GridTask<?, ?>>>();

    if (file.exists() == false) {
      return rsrcs;
    }

    GridUriDeploymentFileResourceLoader fileRsrcLdr =
        new GridUriDeploymentFileResourceLoader(clsLdr, file);

    if (file.isDirectory()) {
      findResourcesInDirectory(fileRsrcLdr, file, rsrcs);
    } else {
      try {
        for (JarEntry entry : U.asIterable(new JarFile(file.getAbsolutePath()).entries())) {
          Class<? extends GridTask<?, ?>> rsrc = fileRsrcLdr.createResource(entry.getName(), false);

          if (rsrc != null) {
            rsrcs.add(rsrc);
          }
        }
      } catch (IOException e) {
        throw new GridSpiException(
            "Failed to discover classes in file: " + file.getAbsolutePath(), e);
      }
    }

    return rsrcs;
  }
Exemple #21
0
  // Saves the user info to a file
  public void saveUserInfo(String path) throws IOException {
    // Declare and initialize file object
    File file = new File(path + "\\Personal.txt");

    // Test if the file exists
    if (file.exists()) {
    } else file.createNewFile();

    // Declare and initialize a writer object
    PrintWriter write = new PrintWriter(new FileWriter(file, false));

    // Write information to file
    write.println(first);
    write.println(last);
    write.println(gender);
    write.println(birthDate);
    write.println(address);
    write.println(phoneNumber);
    write.println(province);
    write.println(city);
    write.println(postal);
    write.println(sin);

    write.close();
  } // End of saveUserInfo method
  /**
   * Recursively scans given directory and load all found files by loader.
   *
   * @param clsLdr Loader that could load class from given file.
   * @param dir Directory which should be scanned.
   * @param rsrcs Set which will be filled in.
   */
  @SuppressWarnings({"UnusedCatchParameter"})
  private static void findResourcesInDirectory(
      GridUriDeploymentFileResourceLoader clsLdr,
      File dir,
      Set<Class<? extends GridTask<?, ?>>> rsrcs) {
    assert dir.isDirectory() == true;

    for (File file : dir.listFiles()) {
      if (file.isDirectory()) {
        // Recurse down into directories.
        findResourcesInDirectory(clsLdr, file, rsrcs);
      } else {
        Class<? extends GridTask<?, ?>> rsrc = null;

        try {
          rsrc = clsLdr.createResource(file.getAbsolutePath(), true);
        } catch (GridSpiException e) {
          // Must never happen because we use 'ignoreUnknownRsrc=true'.
          assert false;
        }

        if (rsrc != null) {
          rsrcs.add(rsrc);
        }
      }
    }
  }
Exemple #23
0
 protected void eraseTempDir() {
   File tmpdirF = new File(tmpdir);
   if (tmpdirF.exists()) {
     eraseFiles();
     tmpdirF.delete();
   }
 }
Exemple #24
0
  private static void deleteDir(File dir) {
    if (!dir.exists()) {
      return;
    }
    try {
      Files.walkFileTree(
          dir.toPath(),
          new SimpleFileVisitor<Path>() {
            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
                throws IOException {
              Files.deleteIfExists(file);
              return FileVisitResult.CONTINUE;
            }

            @Override
            public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
              if (e == null) {
                Files.deleteIfExists(dir);
                return FileVisitResult.CONTINUE;
              } else {
                // directory iteration failed
                throw e;
              }
            }
          });
    } catch (IOException failed) {
      throw new RuntimeException(failed);
    }
  }
Exemple #25
0
 /**
  * Given the parameters for copying doc-files, check for errors.
  *
  * @param configuration The configuration of the current doclet.
  * @param path The relative path to the directory to be copied.
  * @param dirName The original directory name to copy from.
  */
 private static boolean checkCopyDocFilesErrors(
     Configuration configuration, String path, String dirName) {
   if ((configuration.sourcepath == null || configuration.sourcepath.length() == 0)
       && (configuration.destDirName == null || configuration.destDirName.length() == 0)) {
     // The destination path and source path are definitely equal.
     return true;
   }
   File sourcePath, destPath = new File(configuration.destDirName);
   StringTokenizer pathTokens =
       new StringTokenizer(
           configuration.sourcepath == null ? "" : configuration.sourcepath, File.pathSeparator);
   // Check if the destination path is equal to the source path.  If yes,
   // do not copy doc-file directories.
   while (pathTokens.hasMoreTokens()) {
     sourcePath = new File(pathTokens.nextToken());
     if (destPath.equals(sourcePath)) {
       return true;
     }
   }
   // Make sure the doc-file being copied exists.
   File srcdir = new File(path + dirName);
   if (!srcdir.exists()) {
     return true;
   }
   return false;
 }
Exemple #26
0
  /**
   * Take the name of a jar file and extract the plugin.xml file, if possible, to a temporary file.
   *
   * @param f The jar file to extract from.
   * @return a temporary file to which the plugin.xml file has been copied.
   */
  public static File unpackPluginXML(File f) {
    InputStream in = null;
    OutputStream out = null;

    try {
      JarFile jar = new JarFile(f);
      ZipEntry entry = jar.getEntry(PLUGIN_XML_FILE);
      if (entry == null) {
        return null;
      }
      File dest = File.createTempFile("jabref_plugin", ".xml");
      dest.deleteOnExit();

      in = new BufferedInputStream(jar.getInputStream(entry));
      out = new BufferedOutputStream(new FileOutputStream(dest));
      byte[] buffer = new byte[2048];
      for (; ; ) {
        int nBytes = in.read(buffer);
        if (nBytes <= 0) break;
        out.write(buffer, 0, nBytes);
      }
      out.flush();
      return dest;
    } catch (IOException ex) {
      ex.printStackTrace();
      return null;
    } finally {
      try {
        if (out != null) out.close();
        if (in != null) in.close();
      } catch (IOException ex) {
        ex.printStackTrace();
      }
    }
  }
 public static void setReadOnlyAttribute(@NotNull String path, boolean readOnlyFlag) {
   final boolean writableFlag = !readOnlyFlag;
   final File file = new File(path);
   if (!file.setWritable(writableFlag) && file.canWrite() != writableFlag) {
     LOG.warn("Can't set writable attribute of '" + path + "' to " + readOnlyFlag);
   }
 }
  /**
   * Resolve COLLADA references relative to the COLLADA document. If the reference is relative then
   * it will resolved relative to the .dae file, not the kml file. If the COLLADA document may be
   * contained in a KMZ archive the resources will be resolved relative to the .dae file within the
   * archive. Normally references in a KMZ are resolved relative to the root of the archive, but
   * Model references are an exception. See
   * https://developers.google.com/kml/documentation/kmzarchives and
   * https://developers.google.com/kml/documentation/kmlreference#model
   *
   * <p>{@inheritDoc}.
   */
  public String resolveFilePath(String path) throws IOException {
    KMLLink link = this.model.getLink();

    // Check the resource map to see if an alias is defined for this resource.
    String alias = this.resourceMap.get(path);
    if (alias != null) path = alias;

    // If the path is relative then resolve it relative to the COLLADA file.
    File f = new File(path);
    if (!f.isAbsolute() && link != null && link.getHref() != null) {
      try {
        URI base = new URI(null, link.getHref(), null);
        URI ref = new URI(null, path, null);

        path = base.resolve(ref).getPath();
      } catch (URISyntaxException ignored) {
        // Ignored
      }
    }

    Object o = this.parent.getRoot().resolveReference(path);
    if (o instanceof URL || o instanceof String) return o.toString();

    return null;
  }
Exemple #29
0
  /*
   * Return data as a byte array.
   */
  private static byte[] readByte(String filename) {
    byte[] data = null;
    AudioInputStream ais = null;
    try {

      // try to read from file
      File file = new File(filename);
      if (file.exists()) {
        ais = AudioSystem.getAudioInputStream(file);
        data = new byte[ais.available()];
        ais.read(data);
      }

      // try to read from URL
      else {
        URL url = StdAudio.class.getResource(filename);
        ais = AudioSystem.getAudioInputStream(url);
        data = new byte[ais.available()];
        ais.read(data);
      }
    } catch (Exception e) {
      System.out.println(e.getMessage());
      throw new RuntimeException("Could not read " + filename);
    }

    return data;
  }
  /** Return the modify-time of the underlying properties file. */
  public long lastModified() {
    if ((file == null) || !file.exists()) {
      return lastadd;
    }

    return Math.max(file.lastModified(), lastadd);
  }