Package java.io

Examples of java.io.FileNotFoundException


      Statement s = conn.createStatement();
      //
      ResultSet rs = s.executeQuery("SELECT content FROM JoramDB WHERE name='" + fname + "'");

       if (!rs.next()) {
         throw new FileNotFoundException("Cannot find object in JoramDB " + ("serverCounter".equals(fname)?"[KNOWN PROBLEM] ":"") + fname);
       }

       byte[] content = rs.getBytes(1);

       rs.close();
       s.close();

       if (logger.isLoggable(BasicLevel.DEBUG))
           logger.log(BasicLevel.DEBUG, "load, after database call");

       nbloaded += 1;
       return content;
    } catch (SQLException sqle) {
      if (sqle instanceof com.mysql.jdbc.CommunicationsException && !reconnectLoop)
      {
          logger.log(BasicLevel.WARN, "Database reconnection problem at load, Reconnecting");
          reconnection();
          reconnectLoop = true;
          byte[] content = load(dirName, name);
          reconnectLoop = false;
          return content;
      }
     
      if (reconnectLoop)
          logger.log(BasicLevel.WARN, "Database reconnection problem at load");

      logger.log(BasicLevel.WARN, "load, problem load " + name);
      sqle.printStackTrace();
      throw new IOException(sqle.getMessage());
    } catch (Exception e) {
       String exceptionString = e.toString();
       if (exceptionString.indexOf("KNOWN PROBLEM") == -1)
       {
          logger.log(BasicLevel.WARN, "load, problem load " + name + " in e with " + e.getMessage());
          e.printStackTrace();
       }
       throw new FileNotFoundException(e.getMessage());
    }
  }
View Full Code Here


        if ((op.type == Operation.SAVE) || (op.type == Operation.CREATE)) {
          // reads the value from the log file
          return getFromLog(op);
        } else if (op.type == Operation.DELETE) {
          // The object was deleted.
          throw new FileNotFoundException();
        }
      }
     
      return null;
    }
View Full Code Here

    if (op != null) {
      if ((op.type == Operation.SAVE) || (op.type == Operation.CREATE)) {
        return op.value;
      } else if (op.type == Operation.DELETE) {
        // The object was deleted.
        throw new FileNotFoundException();
      }
    }
    return null;
  }
View Full Code Here

      logmon.log(BasicLevel.INFO, "Transaction, init():");

    dir = new File(path);
    if (!dir.exists()) dir.mkdirs();
    if (!dir.isDirectory())
      throw new FileNotFoundException(path + " is not a directory.");

    // Saves the transaction classname in order to prevent use of a
    // different one after restart (see AgentServer.init).
    DataOutputStream ldos = null;
    try {
View Full Code Here

    phase = INIT;

    dir = new File(path);
    if (!dir.exists()) dir.mkdir();
    if (!dir.isDirectory())
      throw new FileNotFoundException(path + " is not a directory.");

    // Saves the transaction classname in order to prevent use of a
    // different one after restart (see AgentServer.init).
    DataOutputStream dos = null;
    try {
View Full Code Here

            }
        }
       
        File fromFile = new File(fromFileName);
        if (!fromFile.exists()) {
            throw new FileNotFoundException(CorePlugin.Util.getString("FileUtils.File_does_not_exist._1", fromFileName)); //$NON-NLS-1$
        }
       
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(fromFile);
View Full Code Here

    private static void copyRecursively(File sourceDirectory,
                                        File targetDirectory,
                                        boolean includeSourceRoot) throws FileNotFoundException,
                                                             Exception {
        if (!sourceDirectory.exists()) {
            throw new FileNotFoundException(CorePlugin.Util.getString("FileUtils.File_does_not_exist._1",sourceDirectory)); //$NON-NLS-1$
        }
       
        if (!sourceDirectory.isDirectory()) {
            throw new FileNotFoundException(CorePlugin.Util.getString("FileUtils.Not_a_directory",sourceDirectory)); //$NON-NLS-1$
        }
       
        File targetDir = new File(targetDirectory.getAbsolutePath() + File.separatorChar + sourceDirectory.getName());
        if (includeSourceRoot) {
            // copy source directory
View Full Code Here

    }

    public FileObject openFileObject(String fileName, String mode) throws IOException {
        String entryName = getEntryName(fileName);
        if (entryName.length() == 0) {
            throw new FileNotFoundException(fileName);
        }
        ZipInputStream in = openZip(fileName);
        while (true) {
            ZipEntry entry = in.getNextEntry();
            if (entry == null) {
                break;
            }
            if (entry.getName().equals(entryName)) {
                return new FileObjectZip2(fileName, entryName, in, length(fileName));
            }
            in.closeEntry();
        }
        in.close();
        throw new FileNotFoundException(fileName);
    }
View Full Code Here

                   "Trying to find [" + path + "] using ClassLoader.getSystemResource().");
      is = ClassLoader.getSystemResourceAsStream(path);
    }
   
    if (is == null)
      throw new FileNotFoundException("XML Joram configuration file \"" + path + "\" not found.");

    executeAdmin(new InputStreamReader(is));
  }
View Full Code Here

    public FileObject openFileObject(String fileName, String mode) throws IOException {
        ZipFile file = openZipFile(translateFileName(fileName));
        ZipEntry entry = file.getEntry(getEntryName(fileName));
        if (entry == null) {
            throw new FileNotFoundException(fileName);
        }
        return new FileObjectZip(file, entry);
    }
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.