Package com.sshtools.j2ssh.transport

Examples of com.sshtools.j2ssh.transport.InvalidHostFileException


            }
        } catch (AccessControlException ace) {
            log.warn(
                "Not enough permission to load a hosts file, so just creating an empty list");
        } catch (IOException ioe) {
            throw new InvalidHostFileException("Could not open or read " +
                hostFileName);
        } catch (SAXException sax) {
            throw new InvalidHostFileException("Failed XML parsing: " +
                sax.getMessage());
        } catch (ParserConfigurationException pce) {
            throw new InvalidHostFileException(
                "Failed to initialize xml parser: " + pce.getMessage());
        } finally {
            if (in != null) {
                try {
                    in.close();
View Full Code Here


*
* @throws InvalidHostFileException
*/
    public void saveHostFile() throws InvalidHostFileException {
        if (!hostFileWriteable) {
            throw new InvalidHostFileException("Host file is not writeable.");
        }

        log.info("Saving " + defaultHostFile);

        try {
            File f = new File(hostFile);
            FileOutputStream out = new FileOutputStream(f);
            out.write(toString().getBytes());
            out.close();
        } catch (IOException e) {
            throw new InvalidHostFileException("Could not write to " +
                hostFile);
        }
    }
View Full Code Here

            }
        } catch (AccessControlException ace) {
            log.warn(
                "Not enough permission to load a hosts file, so just creating an empty list");
        } catch (IOException ioe) {
            throw new InvalidHostFileException("Could not open or read " +
                hostFileName);
        } catch (SAXException sax) {
            throw new InvalidHostFileException("Failed XML parsing: " +
                sax.getMessage());
        } catch (ParserConfigurationException pce) {
            throw new InvalidHostFileException(
                "Failed to initialize xml parser: " + pce.getMessage());
        } finally {
            if (in != null) {
                try {
                    in.close();
View Full Code Here

*
* @throws InvalidHostFileException
*/
    public void saveHostFile() throws InvalidHostFileException {
        if (!hostFileWriteable) {
            throw new InvalidHostFileException("Host file is not writeable.");
        }

        log.info("Saving " + defaultHostFile);

        try {
            File f = new File(hostFile);
            FileOutputStream out = new FileOutputStream(f);
            out.write(toString().getBytes());
            out.close();
        } catch (IOException e) {
            throw new InvalidHostFileException("Could not write to " +
                hostFile);
        }
    }
View Full Code Here

TOP

Related Classes of com.sshtools.j2ssh.transport.InvalidHostFileException

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.