Throws an exception if any {@linkITenantOperationsListener} indicates that the specified
value isn't allowable for the specified attribute.

@throws Exception
@since 4.3
494160
public void validateAttribute(final String key, final String value) throws Exception {
        for (ITenantOperationsListener listener : tenantOperationsListeners) {
            // Will throw an exception if not valid
            listener.validateAttribute(key, value);
        }
    }
533697
protected void attributeImpl(String name, String value) {
        if (! (this.xmlNode instanceof Element)) {
            throw new RuntimeException(
                "Cannot add an attribute to non-Element underlying node: "
                + this.xmlNode);
        }
        ((Element) xmlNode).setAttribute(name, value);
    }
298223
@Override
	public void onAttributeChangeEvent(AttributeChangeEvent event) {
		super.onAttributeChangeEvent(event);
		fireLayerAttributeChangedEvent(new MapLayerAttributeChangeEvent(this, event));
		fireElementChanged();
		if (ATTR_VISIBLE.equals(event.getName())) {
			final AttributeValue nValue = event.getValue();
			boolean cvalue;
			try {
				cvalue = nValue.getBoolean();
			} catch (Exception exception) {
				cvalue = isVisible();
			}
			if (cvalue) {
				final GISLayerContainer<?> container = getContainer();
				if (container instanceof GISBrowsable) {
					((GISBrowsable) container).setVisible(cvalue, false);
				}
			}
		}
	}
263009
protected synchronized void fireAttributeRemovedEvent(String name, AttributeValue oldValue) {
		if (this.listenerList != null && isEventFirable()) {
			final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()];
			this.listenerList.toArray(list);
			final AttributeChangeEvent event = new AttributeChangeEvent(
					this,
					Type.REMOVAL,
					name,
					oldValue,
					name,
					oldValue);
			for (final AttributeChangeListener listener : list) {
				listener.onAttributeChangeEvent(event);
			}
		}
	}
210003
public boolean isListening() throws Exception {
        try {
            JSONObject resp = new JSONObject(Get.get(API_BASE_URL + ":" + API_PORT, Constants.REQUEST_HEARTBEAT, ""));

            return true;
        } catch (Exception e) {
            return false;
        }
    }
915201
private void setTorsion() throws Exception {
        List data = null;
        st.nextToken();
        String scode = st.nextToken(); // String scode
        String sid1 = st.nextToken();
        String sid2 = st.nextToken();
        String sid3 = st.nextToken();
        String sid4 = st.nextToken();
        String value1 = st.nextToken();
        String value2 = st.nextToken();
        String value3 = st.nextToken();
        String value4 = st.nextToken();
        String value5 = st.nextToken();

        try {
            double va1 = new Double(value1).doubleValue();
            double va2 = new Double(value2).doubleValue();
            double va3 = new Double(value3).doubleValue();
            double va4 = new Double(value4).doubleValue();
            double va5 = new Double(value5).doubleValue();

            key = "torsion" + scode + ";" + sid1 + ";" + sid2 + ";" + sid3 + ";" + sid4;
            LOG.debug("key = " + key);
            if (parameterSet.containsKey(key)) {
                data = (Vector) parameterSet.get(key);
                data.add(new Double(va1));
                data.add(new Double(va2));
                data.add(new Double(va3));
                data.add(new Double(va4));
                data.add(new Double(va5));
                LOG.debug("data = " + data);
            } else {
                data = new Vector();
                data.add(new Double(va1));
                data.add(new Double(va2));
                data.add(new Double(va3));
                data.add(new Double(va4));
                data.add(new Double(va5));
                LOG.debug("data = " + data);
            }

            parameterSet.put(key, data);

        } catch (NumberFormatException nfe) {
            throw new IOException("setTorsion: Malformed Number due to:" + nfe);
        }
    }
509150
protected void onTransformationSinkErrorOccurred(Exception exception) {

        for (TransformerSinkEventListener listener : transformerSinkEventListeners)
            fireErrorEvent(listener, new TransformerSinkErrorEvent(this, exception));
    }


    /**
     * (Re)-fires a preconstructed event.
     * @param event The event to fire
     */
    protected void onTransformationSinkErrorOccurred(TransformerSinkErrorEvent event) {

        for (TransformerSinkEventListener listener : transformerSinkEventListeners)
            fireErrorEvent(listener, event);
    }

    /**
     * Fires the given event on the given listener.
     * @param listener The listener to fire the event to.
     * @param event The event to fire.
     */
    private void fireErrorEvent(TransformerSinkEventListener listener, TransformerSinkErrorEvent event) {

        try {
            listener.ErrorOccurred(event);
        }
        catch (RuntimeException e) {
            // Log this somehow
            System.err.println("Exception thrown while trying to invoke event listener, removing bed behaved listener.");
            e.printStackTrace();
            removeTransformerSinkEventListener(listener);
        }
    }
}
244082
public static <T> void exceptionListener(CompletableFuture<T> completableFuture, Consumer<Throwable> exceptionListener) {
        completableFuture.whenComplete((r, ex) -> {
            if (ex != null) {
                Callbacks.invokeSafely(exceptionListener, ex, null);
            }
        });
    }
114754
private void doSet() throws PageException {
	if (entry == null) throw new ApplicationException("attribute entry is required for tag registry, when action is [set]");
	if (type == RegistryEntry.TYPE_ANY) type = RegistryEntry.TYPE_STRING;
	if (value == null) {
	    if (type == RegistryEntry.TYPE_DWORD) value = "0";
	    else value = "";
	}

	try {
	    RegistryQuery.setValue(branch, entry, type, value);
	}
	catch (Exception e) {
	    throw Caster.toPageException(e);
	}

    }
85719
protected static void checkNotCreate(String view, String attribute, boolean create) {
    if (create) {
      throw new UnsupportedOperationException(
          "cannot set attribute '" + view + ":" + attribute + "' during file creation");
    }
  }
1209787
public void set(String name, Object obj) throws IOException {
        if (name.equalsIgnoreCase(NUMBER)) {
            if (!(obj instanceof BigInteger)) {
                throw new IOException("Attribute must be of type BigInteger.");
            }
            crlNumber = (BigInteger)obj;
        } else {
          throw new IOException("Attribute name not recognized by"
                                + " CertAttrSet:" + extensionName + ".");
        }
        encodeThis();
    }
833473
protected synchronized void fireAttributeRenamedEvent(String oldName, String newName, AttributeValue attr) {
		if (this.listenerList != null && isEventFirable()) {
			final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()];
			this.listenerList.toArray(list);
			final AttributeChangeEvent event = new AttributeChangeEvent(
					this,
					Type.RENAME,
					oldName,
					attr,
					newName,
					attr);
			for (final AttributeChangeListener listener : list) {
				listener.onAttributeChangeEvent(event);
			}
		}
	}
531254
public void propagateIfCancelException(final Throwable t) {
    final RuntimeException cancelException = this.getPlatformOperationCanceledException(t);
    if ((cancelException != null)) {
      throw cancelException;
    }
  }
1366650
private Object itemValue(Object obj, Object item) throws Exception {
		// String value
		if (item instanceof String) {
			return item;
		}

		Element node = (Element) item;
		String tag = node.getTagName();
		// TODO: in case of jdk7 usage use swtich instead
		if ("Call".equals(tag)) {
			return call(obj, node);
		}
		if ("Get".equals(tag)) {
			return get(obj, node);
		}
		if ("New".equals(tag)) {
			return newObj(obj, node);
		}
		if ("Ref".equals(tag)) {
			return refObj(obj, node);
		}
		if ("Array".equals(tag)) {
			return newArray(obj, node);
		}
		if ("Map".equals(tag)) {
			return newMap(obj, node);
		}
		if ("Property".equals(tag)) {
			return propertyObj(obj, node);
		}

		if ("SystemProperty".equals(tag)) {
			String name = getAttribute(node, "name");
			String defaultValue = getAttribute(node, "default");
			return System.getProperty(name, defaultValue);
		}

		LOG.warn("Unknown value tag: {}", node);
		return null;
	}
1134567
public void set(String name, Object obj) throws IOException {
        if (!(obj instanceof Integer)) {
            throw new IOException("Attribute must be of type Integer.");
        }
        if (name.equalsIgnoreCase(REASON)) {
            reasonCode = ((Integer)obj).intValue();
        } else {
            throw new IOException
                ("Name not supported by CRLReasonCodeExtension");
        }
        encodeThis();
    }
1035625
static void extractAttributeValue(Elements elementUtils, Element item, String annotationName, AnnotationAttributeType attribute, OnAttributeFoundListener listener) {
		List<? extends AnnotationMirror> annotationList = elementUtils.getAllAnnotationMirrors(item);
		for (AnnotationMirror annotation : annotationList) {			
			if (annotationName.equals(annotation.getAnnotationType().asElement().toString())) {
				// found annotation
				for (Entry<? extends ExecutableElement, ? extends AnnotationValue> annotationItem : elementUtils.getElementValuesWithDefaults(annotation).entrySet()) {
					if (attribute.isEquals(annotationItem.getKey())) {
						listener.onFound(annotationItem.getValue().toString());
						return;
					}
				}
			}
		}
	}
332677
protected static IllegalArgumentException invalidType(
      String view, String attribute, Object value, Class<?>... expectedTypes) {
    Object expected =
        expectedTypes.length == 1 ? expectedTypes[0] : "one of " + Arrays.toString(expectedTypes);
    throw new IllegalArgumentException(
        "invalid type "
            + value.getClass()
            + " for attribute '"
            + view
            + ":"
            + attribute
            + "': expected "
            + expected);
  }