Package it.unina.seclab.jafimon.exceptions

Examples of it.unina.seclab.jafimon.exceptions.CannotWriteFileException


   
    File f = new File(fullName);
   
    // Mi assicuro che il file non esista gia'
    if (f.exists())
      throw new CannotWriteFileException(cName, "File already exists");
   
    // Ora creo le cartelle intermedie (se necessario)
    if (!new File(fullName.substring(0, fullName.lastIndexOf(File.separator))).mkdirs())
      throw new CannotWriteFileException(cName, "Cannot create intermediate directories");
   
    // Mi assicuro di poter scrivere sul file
    try {
      if (!f.createNewFile() || !f.canWrite())
        throw new CannotWriteFileException(cName, "Unable to write to file (probably read-only)");
    } catch (IOException e) {
      throw new CannotWriteFileException(cName, e.getCause() + " - " + e.getLocalizedMessage());
    }
   
    ConfigurationParser.save(xmlDocument, fullName);
  }
View Full Code Here

TOP

Related Classes of it.unina.seclab.jafimon.exceptions.CannotWriteFileException

Copyright © 2018 www.massapicom. 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.