Example usage for org.apache.commons.configuration ConfigurationException printStackTrace

List of usage examples for org.apache.commons.configuration ConfigurationException printStackTrace

Introduction

In this page you can find the example usage for org.apache.commons.configuration ConfigurationException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Usage

From source file:tw.com.mt.TopicAPIDemo.java

/**
 * Default constructor.//from w w  w.ja  va 2  s  . c o m
 */
public TopicAPIDemo() {
    CompositeConfiguration config = new CompositeConfiguration();
    config.addConfiguration(new SystemConfiguration());
    try {
        config.addConfiguration(new PropertiesConfiguration(propertyFile));
        this.projObjKey = config.getInt("projObjKey");
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:utilities.Config.java

public void saveToFile() {
    try {/*  w  ww. j a v  a  2s. co m*/
        this.save();
    } catch (ConfigurationException e) {
        System.err.println("can't save configuration");
        e.printStackTrace();
    }
}

From source file:velo.uiComponents.XMLTagInputs.java

public void encodeBegin(FacesContext context) throws IOException {
    if (getChildren().size() == 0) {
        // Get the view root from the Context
        UIViewRoot view = FacesContext.getCurrentInstance().getViewRoot();
        // System.out.println("WAAAAAAAAAAAAAAAAAAA VIEW: " + view);
        //System.out.println("GET FOR: " + getFor());
        // Get the XMLManager component from the view
        UIComponent uiComponent = view.findComponent(getFor());

        // System.out.println("Loaded component that expected to be an
        // XMLManager of class \'" + uiComponent.getClass().getName() +
        // "\'");
        if (uiComponent instanceof XMLManager) {
            XMLManager xmlManager = (XMLManager) uiComponent;
            // System.out.println("xml conf: " + xmlManager.getConfig());
            try {
                HierarchicalConfiguration hc = xmlManager.getConfig().getConfig().configurationAt(getTagName());

                Iterator nodes = hc.getRootNode().getChildren().listIterator();

                HtmlPanelGrid hpg = (HtmlPanelGrid) this.getFacesContext().getApplication()
                        .createComponent(HtmlPanelGrid.COMPONENT_TYPE);
                hpg.setColumns(1);/*  ww  w .j a v a  2s .c  o m*/
                hpg.setStyleClass("xmlTagMainPanel");

                // System.out.println("Size of children(BEFORE): " +
                // getChildren().size());

                while (nodes.hasNext()) {
                    XMLConfiguration.Node currNode = (XMLConfiguration.Node) nodes.next();

                    // If node has childs, then iterate over childs and
                    // display them
                    if (currNode.getChildrenCount() > 0) {
                        if (renderSubNodes) {
                            Iterator subNodes = currNode.getChildren().listIterator();
                            while (subNodes.hasNext()) {
                                XMLConfiguration.Node currSubNode = (XMLConfiguration.Node) subNodes.next();
                                XMLTagInput xti = new XMLTagInput(XMLTagInput.getFullXmlTagPath(currSubNode),
                                        getFor());
                                // hpg.getChildren().add(getTag(currSubNode));
                                hpg.getChildren().add(xti);
                            }
                        } else {
                            // Specified not to render tags with childs,
                            // then continue to the next node
                            continue;
                        }
                        // Else render tag since this is not a parent
                    } else {
                        // hpg.getChildren().add(getTag(currNode));
                        XMLTagInput xti = new XMLTagInput(XMLTagInput.getFullXmlTagPath(currNode), getFor());
                        hpg.getChildren().add(xti);
                    }

                    this.getChildren().add(hpg);

                }

            } catch (ConfigurationException ce) {
                ce.printStackTrace();
            }

        } else {
            // TODO handle the exception correctly!
            //System.out.println("Expected UI Component is not an instance of XMLManager class!");
        }

        // System.out.println("Size of children(AFTER): " +
        // getChildren().size());
    } else {
        // this component already has childrens, probably from the restore
        // phase, then do nothing...
    }
}

From source file:ws.argo.responder.plugin.configfile.ConfigFileMonitorTask.java

/**
 * When the timer goes off, look for changes to the specified xml config file.
 * For comparison, we are only interested in the last time we read the file. A
 * null value for lastTimeRead means that we never read the file before.
 *///from   w w  w. j av a  2  s . co  m
public void run() {
    LOGGER.debug("begin scan for config file changes ...");
    try {
        Date lastModified = new Date(_xmlConfigFile.lastModified());

        if (_lastTimeRead == null || lastModified.after(_lastTimeRead)) {
            LOGGER.info("loading config file changes ...");
            this.loadServiceConfigFile();
            _lastTimeRead = new Date();
        }
    } catch (ConfigurationException e) {
        e.printStackTrace();
        LOGGER.error("Error loading configuation file: ", e);
    }
    LOGGER.debug("finish scan for config file changes");
}