Package org.apache.commons.configuration2.ex

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


            xmlReader.setContentHandler(new XMLPropertiesHandler());
            xmlReader.parse(new InputSource(in));
        }
        catch (Exception e)
        {
            throw new ConfigurationException("Unable to parse the configuration file", e);
        }

        // todo: support included properties ?
    }
View Full Code Here


     */
    public void load(Element element) throws ConfigurationException
    {
        if (!element.getNodeName().equals("properties"))
        {
            throw new ConfigurationException(MALFORMED_XML_EXCEPTION);
        }
        NodeList childNodes = element.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++)
        {
            Node item = childNodes.item(i);
            if (item instanceof Element)
            {
                if (item.getNodeName().equals("comment"))
                {
                    setHeader(item.getTextContent());
                }
                else if (item.getNodeName().equals("entry"))
                {
                    String key = ((Element) item).getAttribute("key");
                    addProperty(key, item.getTextContent());
                }
                else
                {
                    throw new ConfigurationException(MALFORMED_XML_EXCEPTION);
                }
            }
        }
    }
View Full Code Here

    public synchronized ConfigurationBuilder<? extends Configuration> getNamedBuilder(
            String name) throws ConfigurationException
    {
        if (sourceData == null)
        {
            throw new ConfigurationException("Information about child builders"
                    + " has not been setup yet! Call getConfiguration() first.");
        }
        ConfigurationBuilder<? extends Configuration> builder =
                sourceData.getNamedBuilder(name);
        if (builder == null)
        {
            throw new ConfigurationException("Builder cannot be resolved: "
                    + name);
        }
        return builder;
    }
View Full Code Here

        if (fileParams != null)
        {
            return createXMLDefinitionBuilder(fileParams);
        }

        throw new ConfigurationException(
                "No builder for configuration definition specified!");
    }
View Full Code Here

            {
                SystemConfiguration.setSystemProperties(basePath, fileName);
            }
            catch (Exception ex)
            {
                throw new ConfigurationException(
                        "Error setting system properties from " + fileName, ex);
            }
        }
    }
View Full Code Here

         */
        @Override
        protected void initResultInstance(PropertiesConfiguration obj)
                throws ConfigurationException
        {
            throw new ConfigurationException("Initialization test exception!");
        }
View Full Code Here

        {
            ConfigurationBuilderProvider provider =
                    providerForTag(src.getRootElementName());
            if (provider == null)
            {
                throw new ConfigurationException(
                        "Unsupported configuration source: "
                                + src.getRootElementName());
            }

            ConfigurationBuilder<? extends Configuration> builder =
View Full Code Here

            setFooterComment(extractComment(reader.getCommentLines(), 0, reader
                    .getCommentLines().size() - 1));
        }
        catch (IOException ioex)
        {
            throw new ConfigurationException(ioex);
        }
        finally
        {
            if (--loadCounter == 0)
            {
View Full Code Here

            writeComment(writer, getCanonicalFooterCooment(true));
            writer.flush();
        }
        catch (IOException ioex)
        {
            throw new ConfigurationException(ioex);
        }
    }
View Full Code Here

            initProperties(XMLDocumentHelper.forSourceDocument(newDocument),
                    oldDocument == null);
        }
        catch (SAXParseException spe)
        {
            throw new ConfigurationException("Error parsing " + source.getSystemId(), spe);
        }
        catch (Exception e)
        {
            this.getLogger().debug("Unable to load the configuration", e);
            throw new ConfigurationException("Unable to load the configuration", e);
        }
    }
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.