Package java.io

Examples of java.io.FileNotFoundException


     */
    public TarFileInputStream(File sourceFile, int compressionType,
                              int readBufferBlocks) throws IOException {

        if (!sourceFile.isFile()) {
            throw new FileNotFoundException(sourceFile.getAbsolutePath());
        }

        if (!sourceFile.canRead()) {
            throw new IOException(
                    RB.read_denied.getString(sourceFile.getAbsolutePath()));
View Full Code Here


            // Datei pruefen
            if (_fileName != null && !_fileName.equals("")) {
                File file = new File(_fileName);
                file.createNewFile();
                if (!file.canWrite()) { throw new FileNotFoundException(
                        "File not writeable: " + _fileName); }

                if (_log != null) _log.debug2("Starte Export in die Datei...");

                SimpleDateFormat dateFormat = new SimpleDateFormat(
View Full Code Here

            existList[i] = componentFiles[i].exists();

            if (i < 2 && !existList[i]) {

                // First 2 files are REQUIRED
                throw new FileNotFoundException(
                        RB.file_missing.getString(
                        componentFiles[i].getAbsolutePath()));
            }
        }

        if (abortUponModify) {
            Properties      p   = new Properties();
            FileInputStream fis = null;

            try {
                fis = new FileInputStream(propertiesFile);

                p.load(fis);
            } finally {
                try {
                    if (fis != null) {
                        fis.close();
                    }
                } finally {
                    fis = null; // Encourage buffer GC
                }
            }

            String modifiedString = p.getProperty("modified");

            if (modifiedString != null
                    && (modifiedString.equalsIgnoreCase("yes")
                        || modifiedString.equalsIgnoreCase("true"))) {
                throw new IllegalStateException(
                        RB.modified_property.getString(modifiedString));
            }
        }

        TarGenerator generator = new TarGenerator(archiveFile, overWrite,
            new Integer(DbBackup.generateBufferBlockValue(componentFiles)));

        for (File componentFile : componentFiles) {
            if (!componentFile.exists()) {
                continue;

                // We've already verified that required files exist, therefore
                // there is no error condition here.
            }

            generator.queueEntry(componentFile.getName(), componentFile);
        }

        generator.write();

        if (abortUponModify) {
            try {
                for (int i = 0; i < componentFiles.length; i++) {
                    if (componentFiles[i].exists()) {
                        if (!existList[i]) {
                            throw new FileNotFoundException(
                                    RB.file_disappeared.getString(
                                    componentFiles[i].getAbsolutePath()));
                        }

                        if (componentFiles[i].lastModified() > startTime) {
                            throw new FileNotFoundException(
                                    RB.file_changed.getString(
                                    componentFiles[i].getAbsolutePath()));
                        }
                    } else if (existList[i]) {
                        throw new FileNotFoundException(
                                RB.file_appeared.getString(
                                componentFiles[i].getAbsolutePath()));
                    }
                }
            } catch (IllegalStateException ise) {
View Full Code Here

   */
  public static Vector<File> getFilelist(String folder, String regexp, int flag) throws Exception {
   
    Vector<File> filelist = new Vector<File>();
   
      if(folder == null || folder.length() == 0) throw new FileNotFoundException("empty directory not allowed!!");
     
      File f = new File(folder);
      if(!f.exists()) throw new FileNotFoundException("directory does not exist: " + folder);
      filelist        = new Vector<File>();
      File[] files    = f.listFiles(new SOSFilelistFilter(regexp,flag));
      for(int i=0; i < files.length;i++) {
        if(files[i].isDirectory()) {
        } else if ( files[i].isFile()) {
View Full Code Here

   */
  public static Vector<File> getFolderlist(String folder, String regexp, int flag) throws Exception {
   
    Vector<File> filelist = new Vector<File>();
   
      if(folder == null || folder.length() == 0) throw new FileNotFoundException("empty directory not allowed!!");
     
      File f = new File(folder);
      if(!f.exists()) throw new FileNotFoundException("directory does not exist: " + folder);
      filelist        = new Vector<File>();
      File[] files    = f.listFiles(new SOSFilelistFilter(regexp,flag));
      for(int i=0; i < files.length;i++) {
        if (!files[i].getName().equals(".") && !files[i].getName().equals(".."))
          filelist.add(files[i]);
View Full Code Here

        if (!propertiesFileExists()) {
            return false;
        }

        if (fileName == null || fileName.length() == 0) {
            throw new FileNotFoundException(
                Error.getMessage(ErrorCode.M_HsqlProperties_load));
        }

        InputStream fis           = null;
        String      propsFilename = fileName + ".properties";
View Full Code Here

      SAXParser parser = new SAXParser();
      parser.setContentHandler(this);

      File file = new File(_fileName);
      if (!file.canRead()) {
        throw new FileNotFoundException("File not found: " + _fileName);
      }

      if (_log != null) _log.debug3("Using file: " + _fileName);

      //FileReader fr = new FileReader(_fileName);
View Full Code Here

        baseUrl = new File(this.basePath).toURI().toURL();
      } else {
        baseUrl = new File(file).toURI().toURL();
      }
    } catch (MalformedURLException ex) {
      throw new FileNotFoundException(file);
    }
    return load(new BufferedInputStream(new FileInputStream(file)), baseUrl);
  }
View Full Code Here

    }
    InputStream in;
    try {
      in = url.openStream();
    } catch (IOException ex) {
      throw new FileNotFoundException("Can't read " + url);
    }
    return load(new BufferedInputStream(in), baseUrl);
  }
View Full Code Here

   */
  public static File getFile() throws FileNotFoundException {
    File f;
    if (inAccessf = new File(new File(WebappHelper.getUserDataRoot(), SYSTEM_DIR), XML_FILE + ".old");
    else          f = new File(new File(WebappHelper.getUserDataRoot(), SYSTEM_DIR), XML_FILE);
    if (!f.exists() || !f.canRead()) throw new FileNotFoundException("Catalog export file not found!");
    return f;
  }
View Full Code Here

TOP

Related Classes of java.io.FileNotFoundException

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.