Example usage for org.apache.commons.vfs2 FileSystemException getCode

List of usage examples for org.apache.commons.vfs2 FileSystemException getCode

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 FileSystemException getCode.

Prototype

public String getCode() 

Source Link

Document

Retrieves error code of the exception.

Usage

From source file:org.mycore.backend.filesystem.MCRCStoreVFS.java

@Override
public void init(String storeId) {
    super.init(storeId);

    uri = MCRConfiguration.instance().getString(storeConfigPrefix + "URI");
    String check = MCRConfiguration.instance().getString(storeConfigPrefix + "StrictHostKeyChecking", "no");

    try {/* w w  w . j av  a  2s  .  com*/
        fsManager = VFS.getManager();

        opts = new FileSystemOptions();
        SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, check);

        FileObject baseDir = getBase();

        // Create a folder, if it does not exist or throw an
        // exception, if baseDir is not a folder
        baseDir.createFolder();

        if (!baseDir.isWriteable()) {
            String msg = "Content store base directory is not writeable: " + uri;
            throw new MCRConfigurationException(msg);
        }
    } catch (FileSystemException ex) {
        throw new MCRException(ex.getCode(), ex);
    }
}