Example usage for javax.management AttributeNotFoundException getMessage

List of usage examples for javax.management AttributeNotFoundException getMessage

Introduction

In this page you can find the example usage for javax.management AttributeNotFoundException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.webcurator.core.profiles.HeritrixProfile.java

/**
 * Adds a simple element to a map. //from  ww w.ja  v  a2s. com
 * @param complexElementName The name of the map.
 * @param child             The child element to add.
 * @throws InvalidAttributeValueException if the map doesn't accept simple elements.
 * @throws DuplicateNameException if the key is a duplicate of an existing key.
 */
public void addMapElement(String complexElementName, SimpleType child)
        throws InvalidAttributeValueException, DuplicateNameException {
    try {
        ComplexProfileElement elem = (ComplexProfileElement) getElement(complexElementName);
        MapType map = (MapType) elem.getValue();
        map.addElement(crawlerSettings, child);
    } catch (AttributeNotFoundException ex) {
        throw new WCTRuntimeException("Element " + complexElementName + " not found in profile");
    } catch (IllegalArgumentException ex) {
        if (ex.getMessage().startsWith("Duplicate field:")) {
            log.warn(ex);
            throw new DuplicateNameException(ex, ex.getMessage().substring("Duplicate field: ".length()));
        } else {
            throw new WCTRuntimeException(ex);
        }
    }

}