Package org.apache.commons.configuration2.ex

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


    {
        // 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

        {
            url = FileLocatorUtils.toURL(file);
        }
        catch (MalformedURLException e1)
        {
            throw new ConfigurationException("Cannot create URL from file "
                    + file);
        }

        load(url);
    }
View Full Code Here

        {
            throw e;
        }
        catch (Exception e)
        {
            throw new ConfigurationException(
                    "Unable to load the configuration from the URL " + url, e);
        }
        finally
        {
            closeSilent(in);
View Full Code Here

        {
            ((InputStreamSupport) getContent()).read(in);
        }
        catch (IOException e)
        {
            throw new ConfigurationException(e);
        }
    }
View Full Code Here

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

        {
            getContent().read(in);
        }
        catch (IOException ioex)
        {
            throw new ConfigurationException(ioex);
        }
        finally
        {
            fireLoadedEvent();
        }
View Full Code Here

     */
    private void save(FileLocator locator) throws ConfigurationException
    {
        if (!FileLocatorUtils.isLocationDefined(locator))
        {
            throw new ConfigurationException("No file location has been set!");
        }

        if (locator.getSourceURL() != null)
        {
            save(locator.getSourceURL(), locator);
View Full Code Here

            url = FileLocatorUtils.obtainFileSystem(locator).getURL(
                    locator.getBasePath(), fileName);
        }
        catch (MalformedURLException e)
        {
            throw new ConfigurationException(e);
        }

        if (url == null)
        {
            throw new ConfigurationException(
                    "Cannot locate configuration source " + fileName);
        }
        save(url, locator);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.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.