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

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

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:de.sub.goobi.forms.ProzesskopieForm.java

/**
 * Creates a DataCopier with the given configuration, lets it process the
 * given data and wraps any errors to display in the front end.
 *
 * @param data/*from w  w w .  ja  v  a  2 s. c  o  m*/
 *            data to process
 */
private void applyCopyingRules(CopierData data) {
    String rules = ConfigCore.getParameter("copyData.onCatalogueQuery");
    if (rules != null && !rules.equals("- keine Konfiguration gefunden -")) {
        try {
            new DataCopier(rules).process(data);
        } catch (ConfigurationException e) {
            Helper.setFehlerMeldung("dataCopier.syntaxError", e.getMessage());
        } catch (RuntimeException exception) {
            if (RuntimeException.class.equals(exception.getClass())) {
                Helper.setFehlerMeldung("dataCopier.runtimeException", exception.getMessage());
            } else {
                throw exception;
            }
        }
    }
}

From source file:jdbc.pool.JDBCPoolMySQLTest.java

public void testDestroy() {
    logger.debug("testDestroy Start.");
    try {// www .  j  ava  2  s  . c  o  m
        CConnectionPoolManager manager = null;
        manager = create();
        manager.destroy(true);
        //            testGetInstanceNull();
    } catch (ConfigurationException e) {
        e.printStackTrace();
        fail("Caught ConfigurationException");
    } catch (ParseException e) {
        e.printStackTrace();
        fail("Caught ParseException");
    } catch (IOException e) {
        e.printStackTrace();
        fail("Caught IOException");
    } catch (SQLException e) {
        e.printStackTrace();
        logger.debug(e.getMessage());
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
        fail("Caught ClassNotFoundException");
    }
    logger.debug("testDestroy end.");
}

From source file:de.sub.goobi.metadaten.Metadaten.java

/**
 * Toggles the form to show the subpage to add a new metadata group.
 *
 * @return "" to indicate JSF not to navigate anywhere or
 *         "SperrungAbgelaufen" to make JSF show the message that the lock
 *         time is up and the user must leave the editor and open it anew
 *//*from  w w w  .  j  a va 2 s. co  m*/
public String showAddNewMetadataGroup() {
    try {
        newMetadataGroup = new RenderableMetadataGroup(docStruct.getAddableMetadataGroupTypes(),
                process.getProject().getTitle());
    } catch (ConfigurationException e) {
        Helper.setFehlerMeldung("Form_configuration_mismatch", e.getMessage());
        logger.error(e.getMessage());
        return "";
    }
    modeAdd = false;
    modeAddPerson = false;
    addMetadataGroupMode = true;
    return !updateBlocked() ? "SperrungAbgelaufen" : "";
}

From source file:es.bsc.servicess.ide.editors.deployers.LicenseTokensTableComposite.java

/**
 * Create the deployment section/*w  w  w.  j  a  v  a  2s.  com*/
 * 
 * @param composite Parents composite
 */
private void createDeploymentSection(Composite composite) {
    DS_section = page.getToolkit().createSection(composite, Section.TWISTIE | Section.DESCRIPTION | SWT.BORDER);
    DS_section.setText("Deployment Service");
    DS_section.setDescription("Define location and parameters for the Deployment Service");
    GridData rd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    rd.grabExcessHorizontalSpace = true;
    DS_section.setLayoutData(rd);
    DS_section.setLayout(new GridLayout(1, true));
    options = page.getToolkit().createComposite(DS_section, SWT.BORDER);
    rd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
    rd.grabExcessHorizontalSpace = true;
    options.setLayout(new GridLayout(3, false));
    options.setLayoutData(rd);
    page.getToolkit().createLabel(options, "Optimization Objective", SWT.NONE);
    optim = new Combo(options, SWT.NONE);
    rd = new GridData();
    rd.grabExcessHorizontalSpace = true;
    rd.minimumWidth = 400;
    optim.setLayoutData(rd);
    optim.setItems(new String[] { "RISK", "COST" });
    allowFederated = page.getToolkit().createButton(options, "Allow Federation", SWT.CHECK);
    allowFederated.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetDefaultSelected(SelectionEvent arg0) {
            updateAllowFederated();
        }

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            updateAllowFederated();
        }
    });
    page.getToolkit().createLabel(options, "Deployment Service", SWT.NONE);
    serverText = page.getToolkit().createText(options, "", SWT.SINGLE | SWT.BORDER);
    rd = new GridData();
    rd.grabExcessHorizontalSpace = true;
    rd.minimumWidth = 400;
    serverText.setLayoutData(rd);
    serverText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent arg0) {
            op_prop.setDSLocation(serverText.getText().trim());
            try {
                op_prop.save();
            } catch (ConfigurationException e) {
                log.error("Exception svaing properties", e);
                ErrorDialog.openError(getShell(), "Saving optimis properties", e.getMessage(),
                        new Status(Status.ERROR, Activator.PLUGIN_ID, "Exception saving properties", e));
            }
        }

    });
    DS_section.setClient(options);
    DS_section.setExpanded(true);
    DS_section.setExpanded(false);
}

From source file:es.bsc.servicess.ide.editors.deployers.LicenseTokensTableComposite.java

/**Create the image section
 * @param composite Parent's composite/*from  w  w w  .ja  va  2 s. com*/
 */
private void createImageSection(Composite composite) {
    SPEndP_section = page.getToolkit().createSection(composite, Section.TWISTIE | Section.DESCRIPTION);
    SPEndP_section.setText("Image Creation");
    SPEndP_section.setDescription("Define the option for Image Creation in the OPTIMIS Service Provider");
    GridData rd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    rd.grabExcessHorizontalSpace = true;
    SPEndP_section.setLayoutData(rd);
    SPEndP_section.setLayout(new GridLayout(1, true));
    ics_location = page.getToolkit().createComposite(SPEndP_section, SWT.BORDER);
    rd = new GridData(GridData.FILL_HORIZONTAL);
    rd.grabExcessHorizontalSpace = true;
    ics_location.setLayoutData(rd);
    ics_location.setLayout(new GridLayout(3, false));
    page.getToolkit().createLabel(ics_location, "Image Creation Service", SWT.NONE);
    icsText = page.getToolkit().createText(ics_location, "", SWT.SINGLE | SWT.BORDER);
    icsText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent arg0) {
            op_prop.setICSLocation(icsText.getText().trim());
            try {
                op_prop.save();
            } catch (ConfigurationException e) {
                log.error("Error modifiying optimis properties", e);
                ErrorDialog.openError(getShell(), "Saving optimis properties", e.getMessage(),
                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
                ;
            }
        }
    });
    rd = new GridData();
    rd.grabExcessHorizontalSpace = true;
    rd.minimumWidth = 400;
    icsText.setLayoutData(rd);
    icsButton = page.getToolkit().createButton(ics_location, "Create Images", SWT.NORMAL);
    icsButton.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetDefaultSelected(SelectionEvent arg0) {
            createServiceImages();
        }

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            createServiceImages();
        }
    });
    page.getToolkit().createLabel(ics_location, "Image Creation Mode", SWT.NONE);
    icsMode = af_sec = new Combo(ics_location, SWT.NONE);
    rd = new GridData(GridData.FILL_HORIZONTAL);
    rd.grabExcessHorizontalSpace = true;
    rd.minimumWidth = 400;
    icsMode.setLayoutData(rd);
    icsMode.setItems(IMAGE_CREATION_MODES);
    SPEndP_section.setClient(ics_location);
    SPEndP_section.setExpanded(true);
    SPEndP_section.setExpanded(false);
}

From source file:es.bsc.servicess.ide.editors.deployers.LicenseTokensTableComposite.java

private void createLicenseSection(Composite composite) {
    license_section = page.getToolkit().createSection(composite, Section.TWISTIE | Section.DESCRIPTION);
    license_section.setText("License Tokens");
    license_section.setDescription("Define license tokens");
    GridData rd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    rd.grabExcessHorizontalSpace = true;
    license_section.setLayoutData(rd);/*w  w w  .  j av  a  2  s  . c o  m*/
    license_section.setLayout(new GridLayout(1, true));
    license_composite = page.getToolkit().createComposite(license_section, SWT.BORDER);
    rd = new GridData(GridData.FILL_HORIZONTAL);
    rd.grabExcessHorizontalSpace = true;
    license_composite.setLayoutData(rd);
    license_composite.setLayout(new GridLayout(1, false));
    Composite combo_comp = page.getToolkit().createComposite(license_composite, SWT.NONE);
    rd = new GridData(GridData.FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    rd.grabExcessHorizontalSpace = true;
    combo_comp.setLayoutData(rd);
    combo_comp.setLayout(new GridLayout(2, false));
    page.getToolkit().createLabel(combo_comp, " License Tokens");
    license_tks = new LicenseTokensTableComposite(getShell(), page.getToolkit(), this);
    license_tks.createComposite(combo_comp);
    page.getToolkit().createLabel(combo_comp, " License Server");
    license_server = page.getToolkit().createText(combo_comp, "", SWT.V_SCROLL | SWT.BORDER | SWT.FILL);
    rd = new GridData(GridData.FILL);
    rd.grabExcessHorizontalSpace = true;
    rd.minimumWidth = 300;
    rd.minimumHeight = 100;
    rd.widthHint = 500;
    license_server.setLayoutData(rd);
    license_server.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent arg0) {
            op_prop.setLSLocation(license_server.getText().trim());
            try {
                op_prop.save();
            } catch (ConfigurationException e) {
                log.error("Exception savin properties", e);
                ErrorDialog.openError(getShell(), "Saving optimis properties", e.getMessage(),
                        new Status(Status.ERROR, Activator.PLUGIN_ID, "Exception saving propertie", e));

            }
        }

    });
    page.getToolkit().createLabel(combo_comp, " Client Properties");
    Composite clientProp = page.getToolkit().createComposite(combo_comp, SWT.NONE);
    rd = new GridData(GridData.FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    rd.grabExcessHorizontalSpace = true;
    clientProp.setLayoutData(rd);
    clientProp.setLayout(new GridLayout(2, false));
    cliPropText = page.getToolkit().createText(clientProp, "", SWT.SINGLE | SWT.BORDER);
    cliPropText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent arg0) {
            op_prop.setLSClientProperties(cliPropText.getText().trim());
            try {
                op_prop.save();
            } catch (ConfigurationException e) {
                log.error("Exception saving properties", e);
                ErrorDialog.openError(getShell(), "Saving optimis properties", e.getMessage(),
                        new Status(Status.ERROR, Activator.PLUGIN_ID, "Exception saving properties", e));
            }
        }
    });
    rd = new GridData();
    rd.grabExcessHorizontalSpace = true;
    rd.minimumWidth = 400;
    cliPropText.setLayoutData(rd);
    cliPropButton = page.getToolkit().createButton(clientProp, "Select...", SWT.NORMAL);
    cliPropButton.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetDefaultSelected(SelectionEvent arg0) {
            selectClientPropertiesFile();
        }

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            selectClientPropertiesFile();
        }
    });

    // Buttons part
    license_but = new SaveResetButtonComposite(getShell(), page.getToolkit(), LICENSE, this);
    license_but.createComposite(license_composite);
    license_section.setClient(license_composite);
    license_section.setExpanded(true);
    license_section.setExpanded(false);
}

From source file:nl.knaw.huygens.timbuctoo.tools.other.SearchResultTool.java

public static void main(String[] args) {
    Options options = new Options();
    options.addOption("d", "delete", true, "delete search results");
    options.addOption("v", "verbose", false, "provide verbose output");

    try {/*from   w w w.j a v  a2s . c om*/
        CommandLineParser parser = new PosixParser();
        CommandLine cmd = parser.parse(options, args);
        boolean verbose = cmd.hasOption("verbose");
        boolean delete = cmd.hasOption("delete");
        Date threshold = delete ? getThreshold(cmd.getOptionValue("delete")) : null;

        SearchResultTool tool = new SearchResultTool();
        tool.execute(verbose, delete, threshold);
    } catch (ConfigurationException e) {
        System.out.printf("Configuration error. %s%n", e.getMessage());
    } catch (ParseException e) {
        System.out.printf("Parsing failed. %s.%n", e.getMessage());
        String syntax = "java " + SearchResultTool.class.getCanonicalName();
        new HelpFormatter().printHelp(100, syntax, null, options, null, true);
    }
}

From source file:org.accada.reader.rprm.core.ReaderDevice.java

/**
 * Resets all internal state variables of the reader to a default
 * configuration. The documentation of the reader shall provide a definition
 * what the default settings are/*from  w  w  w. j  a  va 2  s  .  co m*/
 * @param propFile
 *           The location of the property file
 * @throws ReaderProtocolException
 *            "Reader not found", "Failed to read properties file",
 *            "wrong valueTrigger in property file", "wrong edgeTrigger in
 *            property file"
 */
public final void resetToDefaultSettings(final String propFile, final String defaultPropFile)
        throws ReaderProtocolException {
    // operational status is DOWN before resetting
    setOperStatus(OperationalStatus.DOWN);

    //init lists
    sources = new Hashtable();
    dataSelectors = new Hashtable();
    notificationChannels = new Hashtable();
    triggers = new Hashtable();
    tagSelectors = new Hashtable();
    tagFields = new Hashtable();
    readPoints = new Hashtable();
    readers = new Hashtable<String, HardwareAbstraction>();
    valueTriggers = new Hashtable();
    edgeTriggers = new Hashtable();
    currentSource = null;
    alarmChannels = new Hashtable<String, AlarmChannel>();
    ioPorts = new Hashtable<String, IOPort>();

    // properties
    XMLConfiguration conf;
    URL fileurl = ResourceLocator.getURL(propFile, defaultPropFile, this.getClass());
    try {
        conf = new XMLConfiguration(fileurl);
    } catch (ConfigurationException e) {
        System.out.println(e.getMessage());
        throw new ReaderProtocolException("Failed to read properties file (" + propFile + ")",
                MessagingConstants.ERROR_UNKNOWN);
    }

    // get properties
    setEPC(conf.getString("epc"));
    setName(conf.getString("name"));
    setManufacturer(conf.getString("manufacturer"));
    setManufacturerDescription(conf.getString("manufacturerDescription"));
    setModel(conf.getString("model"));
    setHandle(conf.getInt("handle"));
    setRole(conf.getString("role"));

    setMaxSourceNumber(conf.getInt("maxSourceNumber"));
    setMaxTagSelectorNumber(conf.getInt("maxTagSelectorNumber"));
    setMaxTriggerNumber(conf.getInt("maxTriggerNumber"));

    // get readers
    SubnodeConfiguration readerConf = conf.configurationAt("readers");
    for (int i = 0; i <= readerConf.getMaxIndex("reader"); i++) {
        // key to current reader
        String key = "reader(" + i + ")";

        // reader's name
        String readerName = readerConf.getString(key + ".name");
        //System.out.println(readerName);

        // get reader
        if (!readers.containsKey(readerName)) {
            // reflection
            String rClass = readerConf.getString(key + ".class");
            String prop = readerConf.getString(key + ".properties");
            try {
                Class cls = Class.forName(rClass);
                Class[] partypes = new Class[] { String.class, String.class };
                Constructor ct = cls.getConstructor(partypes);
                Object[] arglist = new Object[] { readerName, prop };
                HardwareAbstraction ha = (HardwareAbstraction) ct.newInstance(arglist);
                readers.put(readerName, ha);

            } catch (Exception e) {
                log.error(e.getMessage() + "|" + e.getCause());
                throw new ReaderProtocolException("Reader not found", MessagingConstants.ERROR_UNKNOWN);
            }
        }
    }

    // configure readpoints
    SubnodeConfiguration rpConf = conf.configurationAt("readers");
    for (int i = 0; i <= rpConf.getMaxIndex("reader"); i++) {
        // key to current reader
        String key = "reader(" + i + ")";
        // name of the reader
        String readerName = rpConf.getString(key + ".name");
        // get reader
        HardwareAbstraction tempHardwareAbstraction = (HardwareAbstraction) readers.get(readerName);
        // get readpoints
        for (int j = 0; j <= rpConf.getMaxIndex(key + ".readpoint"); j++) {
            String rp = rpConf.getString(key + ".readpoint(" + j + ")");
            // System.out.println(" "+rps[j]);
            AntennaReadPoint.create(rp, this, tempHardwareAbstraction);
        }
    }

    // configure sources
    SubnodeConfiguration sourceConf = conf.configurationAt("sources");
    for (int i = 0; i <= sourceConf.getMaxIndex("source"); i++) {
        String key = "source(" + i + ")";
        // name of the source
        String sourceName = sourceConf.getString(key + ".name");
        // get source
        Source tempSource;
        if (!sources.containsKey(sourceName)) {
            tempSource = Source.create(sourceName, this);
        } else {
            tempSource = getSource(sourceName);
        }
        // fixed
        if (sourceConf.getString(key + ".fixed").equals("true")) {
            tempSource.setFixed(true);
        } else {
            tempSource.setFixed(false);
        }
        // reader's readpoints
        for (int j = 0; j <= sourceConf.getMaxIndex(key + ".readpoint"); j++) {
            String rp = sourceConf.getString(key + ".readpoint(" + j + ")");
            // System.out.println(" "+rp);
            tempSource.addReadPoints(new ReadPoint[] { getReadPoint(rp) });
        }
    }

    // set current Source
    setCurrentSource(getSource(conf.getString("currentSource")));

    // set defaults
    setDefaults();

    // get io triggers
    getIoTriggers(conf);

    // information used for the reader management implementation
    setDescription(conf.getString("description"));
    setLocationDescription(conf.getString("locationDescription"));
    setContact(conf.getString("contact"));
    serialNumber = conf.getString("serialNumber");
    dhcpServerFinder
            .setMacAddress(DHCPServerFinder.macAddressStringToByteArray(conf.getString("macAddress"), "-"));

    operStatusAlarmControl = new TTOperationalStatusAlarmControl("OperStatusAlarmControl", false,
            AlarmLevel.ERROR, 0, OperationalStatus.ANY, OperationalStatus.ANY);

    freeMemoryAlarmControl = new EdgeTriggeredAlarmControl("FreeMemoryAlarmControl", false, AlarmLevel.CRITICAL,
            0, 100, 1000, EdgeTriggeredAlarmDirection.FALLING);

    if ((alarmManager == null) && (mgmtAgent != null)) {
        AlarmProcessor alarmProcessor = null;
        switch (MessageLayer.mgmtAgentType) {
        case SNMP:
            alarmProcessor = new SnmpAlarmProcessor((SnmpAgent) mgmtAgent);
            break;
        // case ...:
        }
        alarmManager = new AlarmManager(alarmProcessor, this);
        alarmManager.start();
    }

    // configure alarm channels
    SubnodeConfiguration alarmChanConf = conf.configurationAt("alarmChannels");
    String host = "";
    int port = -1;
    for (int i = 0; i <= alarmChanConf.getMaxIndex("alarmChannel"); i++) {
        String key = "alarmChannel(" + i + ")";
        // name of the alarm channel
        String alarmChanName = alarmChanConf.getString(key + ".name");
        // get alarm channel
        try {
            host = alarmChanConf.getString(key + ".host");
            port = alarmChanConf.getInt(key + ".port");
            try {
                AlarmChannel.create(alarmChanName, new Address("udp://" + host + ":" + port), this);
            } catch (MalformedURLException mfue) {
                log.error(alarmChanName + ": invalid address");
            }
            host = "";
            port = -1;
        } catch (ReaderProtocolException rpe) {
            // next
        }
    }

    // operational status is UP after resetting
    setOperStatus(OperationalStatus.UP);

}

From source file:org.apache.distributedlog.service.DistributedLogServerApp.java

private void run() {
    try {/* w w w . j av a2  s. c  o  m*/
        logger.info("Running distributedlog server : args = {}", Arrays.toString(args));
        BasicParser parser = new BasicParser();
        CommandLine cmdline = parser.parse(options, args);
        runCmd(cmdline);
    } catch (ParseException pe) {
        logger.error("Argument error : {}", pe.getMessage());
        printUsage();
        Runtime.getRuntime().exit(-1);
    } catch (IllegalArgumentException iae) {
        logger.error("Argument error : {}", iae.getMessage());
        printUsage();
        Runtime.getRuntime().exit(-1);
    } catch (ConfigurationException ce) {
        logger.error("Configuration error : {}", ce.getMessage());
        printUsage();
        Runtime.getRuntime().exit(-1);
    } catch (IOException ie) {
        logger.error("Failed to start distributedlog server : ", ie);
        Runtime.getRuntime().exit(-1);
    } catch (ClassNotFoundException cnf) {
        logger.error("Failed to start distributedlog server : ", cnf);
        Runtime.getRuntime().exit(-1);
    }
}

From source file:org.apache.hadoop.metrics2.impl.MetricsConfig.java

/**
 * Load configuration from a list of files until the first successful load
 * @param conf  the configuration object
 * @param files the list of filenames to try
 * @return  the configuration object//from   w  w  w .  j  ava 2s. com
 */
static MetricsConfig loadFirst(String prefix, String... fileNames) {
    for (String fname : fileNames) {
        try {
            Configuration cf = new PropertiesConfiguration(fname).interpolatedConfiguration();
            LOG.info("loaded properties from " + fname);
            return new MetricsConfig(cf, prefix);
        } catch (ConfigurationException e) {
            if (e.getMessage().startsWith("Cannot locate configuration")) {
                continue;
            }
            throw new MetricsConfigException(e);
        }
    }
    throw new MetricsConfigException("Cannot locate configuration: tried " + StringUtils.join(", ", fileNames));
}