Example usage for java.io FileNotFoundException getMessage

List of usage examples for java.io FileNotFoundException getMessage

Introduction

In this page you can find the example usage for java.io FileNotFoundException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:fedora.server.storage.translation.AtomDODeserializer.java

/**
 * {@inheritDoc}/*from w w  w  .  j  a  v  a2 s .  c om*/
 */
public void deserialize(InputStream in, DigitalObject obj, String encoding, int transContext)
        throws ObjectIntegrityException, StreamIOException, UnsupportedEncodingException {
    if (m_format.equals(ATOM_ZIP1_1)) {
        try {
            m_tempDir = FileUtils.createTempDir("atomzip", null);
            m_zin = new ZipInputStream(new BufferedInputStream(in));
            ZipEntry entry;
            while ((entry = m_zin.getNextEntry()) != null) {
                FileUtils.copy(m_zin, new FileOutputStream(new File(m_tempDir, entry.getName())));
            }
            in = new FileInputStream(new File(m_tempDir, "atommanifest.xml"));
        } catch (FileNotFoundException e) {
            throw new StreamIOException(e.getMessage(), e);
        } catch (IOException e) {
            throw new StreamIOException(e.getMessage(), e);
        }
    }

    Parser parser = abdera.getParser();
    Document<Feed> feedDoc = parser.parse(in);
    m_feed = feedDoc.getRoot();
    m_xpath = abdera.getXPath();

    m_obj = obj;
    m_encoding = encoding;
    m_transContext = transContext;
    addObjectProperties();
    addDatastreams();

    DOTranslationUtility.normalizeDatastreams(m_obj, m_transContext, m_encoding);
    FileUtils.delete(m_tempDir);
}

From source file:com.ibuildapp.romanblack.MultiContactsPlugin.MultiContactsPlugin.java

/**
 * Updates the page background after background image was downloaded and
 * decoded./*from w w w  .  jav a2 s . co  m*/
 */
private void updateBackground() {
    try {
        root.setBackgroundDrawable(
                new BitmapDrawable(BitmapFactory.decodeStream(new FileInputStream(cacheBackgroundFile))));
        backgroundLoaded = true;
        handler.sendEmptyMessage(SHOW_DATA);
    } catch (FileNotFoundException fNFEx) {
        Log.e(TAG, fNFEx.getMessage());
        fNFEx.printStackTrace();
    }
}

From source file:biomine.bmvis2.Vis.java

public GraphTab openTab(String file) {
    try {//www .j a  v a  2  s . co  m
        Logging.info("graph_reading", "Reading graph from file " + file.toString() + "...");
        VisualGraph vg = getGraphFromFile(file);
        Logging.info("graph_reading", "Read graph.");
        GraphTab nt = openEmptyTab(file);
        nt.addFile(file);
        Vis.lastOpenedPath = file;
        updateMenuBars();
        return nt;

    } catch (FileNotFoundException e) {
        String m = e.getMessage();
        Logging.error("graph_reading", m);
        JOptionPane.showMessageDialog(this, m);
    } catch (GraphReadingException e) {
        String m = e.getMessage();
        Logging.error("graph_reading", m);
        JOptionPane.showMessageDialog(this, m);
    }
    return null;
}

From source file:com.gisgraphy.importer.GeonamesAdmExtracter.java

private void initFiles() {
    adm1file = new File(importerConfig.getGeonamesDir() + importerConfig.getAdm1FileName());
    adm2file = new File(importerConfig.getGeonamesDir() + importerConfig.getAdm2FileName());
    adm3file = new File(importerConfig.getGeonamesDir() + importerConfig.getAdm3FileName());
    adm4file = new File(importerConfig.getGeonamesDir() + importerConfig.getAdm4FileName());
    try {//  w w  w.  j av  a2 s. c o m
        adm1fileOutputStreamWriter = getWriter(adm1file, 1);
        adm2fileOutputStreamWriter = getWriter(adm2file, 2);
        adm3fileOutputStreamWriter = getWriter(adm3file, 3);
        adm4fileOutputStreamWriter = getWriter(adm4file, 4);
    } catch (FileNotFoundException e) {
        closeOutputStreams();
        throw new RuntimeException("An error has occurred during creation of outpuStream : " + e.getMessage(),
                e);
    }
}

From source file:com.bah.applefox.main.plugins.fulltextindex.FTLoader.java

/**
 * Gets the words that are supposed to be removed from the article file
 * (Words such as the, a, an, etc. that are unimportant to the search
 * engine)/*from w w  w  . j  a v  a2  s  .  c o m*/
 * 
 * 
 * @return articles - All the words that shouldn't be included in the data
 * @throws IOException
 */
private HashSet<String> getStopWords() {
    HashSet<String> articles = new HashSet<String>();
    System.out.println("getting stop words");
    try {
        // Read the file
        BufferedReader reader = new BufferedReader(new FileReader(new File(articleFile)));

        // String to temporarily store each word
        String temp;

        // Add each word to temp
        while ((temp = reader.readLine()) != null) {
            // Add temp to articles
            articles.add(temp);
        }
        reader.close();
    } catch (FileNotFoundException e) {
        if (e.getMessage() != null) {
            log.error(e.getMessage());
        } else {
            log.error(e.getStackTrace());
        }
    } catch (IOException e) {
        if (e.getMessage() != null) {
            log.error(e.getMessage());
        } else {
            log.error(e.getStackTrace());
        }
    }
    return articles;
}

From source file:com.bah.applefox.main.plugins.fulltextindex.FTLoader.java

/**
 * Gets the ids of the div tags that should be excluded from the data on the
 * page. This is useful for pages with repetitive generic headers and
 * footers, allowing for more accurate results
 * /* ww w . j av  a 2s .  c  o  m*/
 * @return - HashSet of ids
 */
private HashSet<String> getExDivs() {
    HashSet<String> divs = new HashSet<String>();
    System.out.println("Getting stop divs");
    try {
        // Read in the file
        BufferedReader reader = new BufferedReader(new FileReader(new File(divsFile)));

        // Temporary variable for the ids
        String temp;

        // Set temp to the ids
        while ((temp = reader.readLine()) != null) {
            // Add temp to divs
            divs.add(temp);
        }
        reader.close();
    } catch (FileNotFoundException e) {
        if (e.getMessage() != null) {
            log.error(e.getMessage());
        } else {
            log.error(e.getStackTrace());
        }
    } catch (IOException e) {
        if (e.getMessage() != null) {
            log.error(e.getMessage());
        } else {
            log.error(e.getStackTrace());
        }
    }
    return divs;
}

From source file:co.anarquianegra.rockolappServidor.mundo.ListaReproductor.java

/**
 * Agrega una cancion a la carpeta de canciones de la aplicacion
 * @param arch el archivo de la cancion//from  w  w  w.  ja v a  2  s  . co  m
 * @throws IOException
 * @throws SAXException
 * @throws TikaException
 */
public void agregarCancion(File arch) throws IOException, SAXException, TikaException {
    try {
        extraerCanciones(arch);
        rutasCanciones.setProperty(arch.getName(), arch.getCanonicalPath());
    } catch (FileNotFoundException e) {
        throw new FileNotFoundException("No se agreg la cancion: (FileNotFound) \n" + e.getMessage());
    } catch (IOException e) {
        throw new IOException("No se agreg la cancion: (IO) \n" + e.getMessage());
    } catch (SAXException e) {
        throw new SAXException("No se agreg la cancion: (SAX) \n" + e.getMessage());
    } catch (TikaException e) {
        throw new TikaException("No se agreg la cancion: (Tika) \n" + e.getMessage());
    }

}

From source file:com.ibuildapp.romanblack.MultiContactsPlugin.ContactDetailsActivity.java

/**
 * Updates activity background./*from   w w  w  .  j av  a2s  . co m*/
 */
private void updateBackground() {
    try {
        root.setBackgroundDrawable(
                new BitmapDrawable(BitmapFactory.decodeStream(new FileInputStream(cacheBackgroundFile))));
    } catch (FileNotFoundException fNFEx) {
        Log.e(TAG, fNFEx.getMessage());
        fNFEx.printStackTrace();
    }
}

From source file:se.bitcraze.crazyflielib.bootloader.Bootloader.java

public void unzip(File zipFile) {
    mLogger.debug("Trying to unzip " + zipFile + "...");
    InputStream fis = null;//w w  w . j a v  a  2  s. co  m
    ZipInputStream zis = null;
    FileOutputStream fos = null;
    String parent = zipFile.getAbsoluteFile().getParent();

    try {
        fis = new FileInputStream(zipFile);
        zis = new ZipInputStream(new BufferedInputStream(fis));
        ZipEntry ze;
        while ((ze = zis.getNextEntry()) != null) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            byte[] buffer = new byte[1024];
            int count;
            while ((count = zis.read(buffer)) != -1) {
                baos.write(buffer, 0, count);
            }
            String filename = ze.getName();
            byte[] bytes = baos.toByteArray();
            // write files
            File filePath = new File(parent + "/" + getFileNameWithoutExtension(zipFile) + "/" + filename);
            // create subdir
            filePath.getParentFile().mkdirs();
            fos = new FileOutputStream(filePath);
            fos.write(bytes);
            //check
            if (filePath.exists() && filePath.length() > 0) {
                mLogger.debug(filename + " successfully extracted to " + filePath.getAbsolutePath());
            } else {
                mLogger.error(filename + " was not extracted.");
            }
        }
    } catch (FileNotFoundException ffe) {
        mLogger.error(ffe.getMessage());
    } catch (IOException ioe) {
        mLogger.error(ioe.getMessage());
    } finally {
        if (zis != null) {
            try {
                zis.close();
            } catch (IOException e) {
                mLogger.error(e.getMessage());
            }
        }
        if (fos != null) {
            try {
                fos.close();
            } catch (IOException e) {
                mLogger.error(e.getMessage());
            }
        }

    }
}

From source file:co.anarquianegra.rockolappServidor.mundo.ListaReproductor.java

/**
 * Carga todas las canciones desde la carpeta ./data/canciones
 * @throws IOException/*from   w w w  .  jav  a  2  s  . c  om*/
 * @throws SAXException
 * @throws TikaException
 */
public void cargar() throws IOException, SAXException, TikaException {
    try {
        rutasCanciones.load(Main.class.getResourceAsStream("res/canciones.properties"));
        capacidad = (int) (rutasCanciones.size() * .8);
        capacidad = (capacidad > 5) ? capacidad : 5;
        cancionesXartista = new TablaHashing<String, Cancion>((int) (capacidad * .5));
        cancionesXnombre = new TablaHashing<String, Cancion>(capacidad);
        cancionesXid = new TablaHashing<String, Cancion>(capacidad);

        Iterator iter = rutasCanciones.keySet().iterator();
        while (iter.hasNext()) {
            String key = (String) iter.next();

            File archivo = new File(rutasCanciones.getProperty(key));

            extraerCanciones(archivo);
        }
    } catch (FileNotFoundException e) {
        throw new FileNotFoundException("No se cargaron correctamente las canciones: \n" + e.getMessage());
    } catch (IOException e) {
        throw new IOException("No se cargaron correctamente las canciones: \n" + e.getMessage());
    } catch (SAXException e) {
        throw new SAXException("No se cargaron correctamente las canciones: \n" + e.getMessage());
    } catch (TikaException e) {
        throw new TikaException("No se cargaron correctamente las canciones: \n" + e.getMessage());
    }
}