Package java.io

Examples of java.io.File.renameTo()


    if(crop) {
      pdfFile = new File(tmpDir.getAbsolutePath() + LResources.FILE_SEP + name + PDFFilter.PDF_EXTENSION);
      log   = LSystem.INSTANCE.execute(new String[] {os.getPdfcropBinPath(), pdfFile.getAbsolutePath(), pdfFile.getAbsolutePath()}, tmpDir);
      // JAVA7: test pdfFile.toPath().move(pathExportPdf)
      // the renameto method is weak and fails sometimes.
      if(!pdfFile.renameTo(new File(pathExportPdf)) && !LFileUtils.INSTANCE.copy(pdfFile, new File(pathExportPdf)))
        log += " The final pdf document cannot be moved to its final destination. If you use Windows, you must have a Perl interpretor installed, such as strawberryPerl (http://strawberryperl.com/)"; //$NON-NLS-1$
      pdfFile.delete();
    }

    pdfFile = new File(pathExportPdf);
View Full Code Here


            if (!inputFile.delete()) {
                Logger.logError("Failed to delete Minecraft.jar.");
                return;
            }
            outputTmpFile.renameTo(inputFile);
        } catch (FileNotFoundException e) {
            Logger.logError("Error while killing META-INF", e);
        } catch (IOException e) {
            Logger.logError("Error while killing META-INF", e);
        }
View Full Code Here

          // Ignore
        }
      }
    }
    completedIdentifiersListNew.delete();
    temp.renameTo(completedIdentifiersListNew);
    if(!completedIdentifiersListNew.renameTo(completedIdentifiersList)) {
      completedIdentifiersList.delete();
      if(!completedIdentifiersListNew.renameTo(completedIdentifiersList)) {
        Logger.error(this, "Unable to store completed identifiers list because unable to rename "+completedIdentifiersListNew+" to "+completedIdentifiersList);
      }
View Full Code Here

      if(!dbFileBackup.renameTo(dbFile)) {
        throw new IOException("Database backup file "+dbFileBackup+" exists but cannot be renamed to "+dbFile+". Not loading database, please fix permissions problems!");
      }
    }
    if(dbFileCryptBackup.exists() && !dbFileCrypt.exists()) {
      if(!dbFileCryptBackup.renameTo(dbFileCrypt)) {
        throw new IOException("Database backup file "+dbFileCryptBackup+" exists but cannot be renamed to "+dbFileCrypt+". Not loading database, please fix permissions problems!");
      }
    }

    try {
View Full Code Here

        // file was moved to edits. We complete that checkpoint by
        // moving fsimage.new to fsimage. There is no need to
        // update the fstime file here. renameTo fails on Windows
        // if the destination file already exists.
        //
        if (!ckptFile.renameTo(curFile)) {
          if (!curFile.delete())
            LOG.warn("Unable to delete dir " + curFile + " before rename");
          if (!ckptFile.renameTo(curFile)) {
            throw new IOException("Unable to rename " + ckptFile +
                                  " to " + curFile);
View Full Code Here

        // if the destination file already exists.
        //
        if (!ckptFile.renameTo(curFile)) {
          if (!curFile.delete())
            LOG.warn("Unable to delete dir " + curFile + " before rename");
          if (!ckptFile.renameTo(curFile)) {
            throw new IOException("Unable to rename " + ckptFile +
                                  " to " + curFile);
          }
        }
      }
View Full Code Here

        }
      }
      // ////// End of closing the file streams ////////////

      // ////// Commit the changes from tmp file to the logFile ////////////
      if (!tmpFile.renameTo(logFile)) {
        // If the tmpFile cannot be renamed revert back
        // updatedTaskLogFileDetails to maintain the consistency of the
        // original log file
        copyOriginalIndexFileInfo(lInfo, taskLogFileDetails,
            updatedTaskLogFileDetails, logName);
View Full Code Here

        File main = getPluginStoreFile(storeIdentifier, isEncrypted, false);
        if(backup.exists() && main.exists()) {
            FileUtil.secureDelete(backup);
        }
        if(main.exists()) {
            if(!main.renameTo(backup))
                System.err.println("Unable to rename "+main+" to "+backup+" when writing pluginstore for "+storeIdentifier);
        }
        writePluginStoreInner(storeIdentifier, store, isEncrypted, false);
        File f = getPluginStoreFile(storeIdentifier, !isEncrypted, true);
        if(f.exists()) {
View Full Code Here

    } finally {
      Closer.close(fis);
      Closer.close(fos);
    }
   
    if(!newConfig.renameTo(oldConfig)) {
      File oldOldConfig = new File("wrapper.conf.old");
      if(oldOldConfig.exists() && !oldOldConfig.delete())
        try {
          oldOldConfig = File.createTempFile("wrapper.conf", ".old.tmp", new File("."));
        } catch (IOException e) {
View Full Code Here

      }
      if(!newConfig.renameTo(oldConfig)) {
        String error = "Unable to rename "+newConfig+" to "+oldConfig+" even after moving the old config file out of the way! Trying to restore previous config file so the node will start up...";
        Logger.error(WrapperConfig.class, error);
        System.err.println(error);
        if(!oldOldConfig.renameTo(oldConfig)) {
          System.err.println("CATASTROPHIC UPDATE ERROR: Unable to rename backup copy of config file over the current config file, after failing to update config file! The node will not boot until you get a new wrapper.conf!\n"+
              "The old config file is saved in "+oldOldConfig+" and it should be renamed to wrapper.conf");
          System.exit(NodeInitException.EXIT_BROKE_WRAPPER_CONF);
        }
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.