Package org.apache.commons.configuration.ex

Examples of org.apache.commons.configuration.ex.ConfigurationException


            out = FileLocatorUtils.obtainFileSystem(locator).getOutputStream(file);
            saveToStream(out, locator.getEncoding(), file.toURI().toURL());
        }
        catch (MalformedURLException muex)
        {
            throw new ConfigurationException(muex);
        }
        finally
        {
            closeSilent(out);
        }
View Full Code Here


                {
                    writer = new OutputStreamWriter(out, encoding);
                }
                catch (UnsupportedEncodingException e)
                {
                    throw new ConfigurationException(
                            "The requested encoding is not supported, try the default encoding.",
                            e);
                }
            }
View Full Code Here

        {
            getContent().write(out);
        }
        catch (IOException ioex)
        {
            throw new ConfigurationException(ioex);
        }
        finally
        {
            fireSavedEvent();
        }
View Full Code Here

     */
    private void checkContent() throws ConfigurationException
    {
        if (getContent() == null)
        {
            throw new ConfigurationException("No content available!");
        }
    }
View Full Code Here

            getModel().setRootNode(
                    config.getNodeModel().getNodeHandler().getRootNode());
        }
        catch (ParseException e)
        {
            throw new ConfigurationException(e);
        }
    }
View Full Code Here

            FileSystemOptions opts = getOptions(url.getProtocol());
            file = (opts == null) ? VFS.getManager().resolveFile(url.toString())
                    : VFS.getManager().resolveFile(url.toString(), opts);
            if (file.getType() != FileType.FILE)
            {
                throw new ConfigurationException("Cannot load a configuration from a directory");
            }
            FileContent content = file.getContent();
            if (content == null)
            {
                String msg = "Cannot access content of " + file.getName().getFriendlyURI();
                throw new ConfigurationException(msg);
            }
            return content.getInputStream();
        }
        catch (FileSystemException fse)
        {
            String msg = "Unable to access " + url.toString();
            throw new ConfigurationException(msg, fse);
        }
    }
View Full Code Here

            FileObject file = (opts == null) ? fsManager.resolveFile(url.toString())
                    : fsManager.resolveFile(url.toString(), opts);
            // throw an exception if the target URL is a directory
            if (file == null || file.getType() == FileType.FOLDER)
            {
                throw new ConfigurationException("Cannot save a configuration to a directory");
            }
            FileContent content = file.getContent();

            if (content == null)
            {
                throw new ConfigurationException("Cannot access content of " + url);
            }
            return content.getOutputStream();
        }
        catch (FileSystemException fse)
        {
            throw new ConfigurationException("Unable to access " + url, fse);
        }
    }
View Full Code Here

    {
        // throw an exception if the target URL is a directory
        File file = FileLocatorUtils.fileFromURL(url);
        if (file != null && file.isDirectory())
        {
            throw new ConfigurationException("Cannot load a configuration from a directory");
        }

        try
        {
            return url.openStream();
        }
        catch (Exception e)
        {
            throw new ConfigurationException("Unable to load the configuration from the URL " + url, e);
        }
    }
View Full Code Here

                }
                return out;
            }
            catch (IOException e)
            {
                throw new ConfigurationException("Could not save to URL " + url, e);
            }
        }
    }
View Full Code Here

            createPath(file);
            return new FileOutputStream(file);
        }
        catch (FileNotFoundException e)
        {
            throw new ConfigurationException("Unable to save to file " + file, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.ex.ConfigurationException

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.