Throws an IllegalStateException when the given value is not true.
765119
public static Boolean assertTrue(Boolean value, String message) {
        if (!Boolean.valueOf(value))
            throw new IllegalStateException(message);

        return value;
    }
940642
static boolean asBoolean(Object value) throws ProvidenceConfigException {
        if (value instanceof Boolean) {
            return (Boolean) value;
        } else if (value instanceof Double || value instanceof Float) {
            throw new ProvidenceConfigException("Unable to convert real value to boolean");
        } else if (value instanceof Number) {
            long l = ((Number) value).longValue();
            if (l == 0L) return false;
            if (l == 1L) return true;
            throw new ProvidenceConfigException("Unable to convert number " + l + " to boolean");
        }
        throw new ProvidenceConfigException("Unable to convert " + value.getClass().getSimpleName() + " to a boolean");
    }
379000
public static <T> void notNull(final String name, final T value) {
    if (value == null) {
      throw new IllegalArgumentException(name + " can not be null");
    }
  }
1089718
void set_value() throws DevFailed
	{
		switch(data_type)
		{
		case Tango_DEV_BOOLEAN:
			super.set_value(bool_val);
			break;
		
		case Tango_DEV_SHORT:
			super.set_value(short_val);
			break;
		
		case Tango_DEV_LONG:
			super.set_value(long_val);
			break;
				
		case Tango_DEV_LONG64:
			super.set_value(long64_val);
			break;
				
		case Tango_DEV_DOUBLE:
			super.set_value(double_val);
			break;
		
		case Tango_DEV_STRING:
			super.set_value(str_val);
			break;
		}
	}
884047
protected void assertNotNullOrEmpty(String value, String message) throws IllegalArgumentException {
        if (value == null || value.length() == 0) {
            throw new IllegalArgumentException(message);
        }
    }
1096080
public static void illegalStateIf(boolean tester, String msg, Object... args) {
        if (tester) {
            throw new IllegalStateException(S.fmt(msg, args));
        }
    }
264472
private Object parseValue(String value) {

        // Try to parse value as number
        try {
            return Double.valueOf(value);
        } catch (NumberFormatException ignored){}

        if (value.equals("true") || value.equals("false"))
            return Boolean.valueOf(value);

        throw new IllegalArgumentException("Only number or boolean stats values allowed");

    }
773854
void setError(Exception error) {
    if (this.error != null) {
      throw new IllegalStateException(
          "Cannot reassign the error value of a response!");
    }
    this.error = error;
    this.complete = true;
    try {
      this.states.put(RESPONSE_COMPLETE);
    } catch (InterruptedException e) {
      log.error("Interrupted trying to indicate an error condition.", e);
    }
  }
115137
public static void assertTrue(String message, boolean value) {
        if (value) {
            pass(message);
        } else {
            fail(message, null);
        }
    }
1143466
public void writeBoolean(boolean value) throws UnsupportedEncodingException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "writeBoolean", Boolean.valueOf(value));
    getBodyList().add(Boolean.valueOf(value));
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "writeBoolean");
  }
623073
public static void insertFromBoolean(final Boolean booleanValue,
	    final DeviceAttribute deviceAttributeWritten) throws DevFailed {

	Integer integerValue = 0;
	if (booleanValue.booleanValue()) {
	    integerValue = 1;
	}

	switch (deviceAttributeWritten.getType()) {
	case TangoConst.Tango_DEV_SHORT:
	    deviceAttributeWritten.insert(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    deviceAttributeWritten.insert_us(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_CHAR not supported",
		    "AttributeHelper.insertFromBoolean(Boolean value,deviceAttributeWritten)");
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    deviceAttributeWritten.insert_uc(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_LONG:
	    deviceAttributeWritten.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    deviceAttributeWritten.insert_ul(integerValue.longValue());
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_LONG64 not supported",
		    "AttributeHelper.insertFromBoolean(Boolean value,deviceAttributeWritten)");
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    deviceAttributeWritten.insert_u64(integerValue.longValue());
	    break;
	case TangoConst.Tango_DEV_INT:
	    deviceAttributeWritten.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    deviceAttributeWritten.insert(integerValue.floatValue());
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    deviceAttributeWritten.insert(integerValue.doubleValue());
	    break;
	case TangoConst.Tango_DEV_STRING:
	    deviceAttributeWritten.insert(Boolean.toString(booleanValue.booleanValue()));
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    deviceAttributeWritten.insert(booleanValue.booleanValue());
	    break;
	case TangoConst.Tango_DEV_STATE:
	    deviceAttributeWritten.insert(DevState.from_int(integerValue.intValue()));
	    break;
	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceAttributeWritten.getType() + " not supported",
		    "AttributeHelper.insertFromBoolean(Boolean value,deviceAttributeWritten)");
	    break;
	}
    }
685556
public synchronized void checkState(State requiredState) throws IllegalStateException {
        if (requiredState != currentState) {
            throw new IllegalStateException(String.format(Locale.US,
                    "Expected state %s, but in state %s", requiredState, currentState));
        }
    }
1301217
private void tryToSetParsedValue(String value) throws Exception {

        JSONObject json = JSONParser.parseStrict(value).isObject();
        JSONValue val = json.get(JsonKey.START);
        setStart(readOptionalDate(val));
        val = json.get(JsonKey.END);
        setEnd(readOptionalDate(val));
        setWholeDay(readOptionalBoolean(json.get(JsonKey.WHOLE_DAY)));
        JSONObject patternJson = json.get(JsonKey.PATTERN).isObject();
        readPattern(patternJson);
        setExceptions(readDates(json.get(JsonKey.EXCEPTIONS)));
        setSeriesEndDate(readOptionalDate(json.get(JsonKey.SERIES_ENDDATE)));
        setOccurrences(readOptionalInt(json.get(JsonKey.SERIES_OCCURRENCES)));
        setDerivedEndType();
        setCurrentTillEnd(readOptionalBoolean(json.get(JsonKey.CURRENT_TILL_END)));
        setParentSeriesId(readOptionalUUID(json.get(JsonKey.PARENT_SERIES)));

    }
1355612
@Override
    protected void applyValueUpdate(final T value) throws NotAvailableException {

        if(value == null) {
            throw new NotAvailableException("Value");
        }

        synchronized (VALUE_LOCK) {
            this.value = value;
            this.valueFuture.complete(value);
            VALUE_LOCK.notifyAll();
        }
    }
9273
public void verifyContained(V value) throws ValueOutOfRangeException {

    if (!isContained(value)) {
      throw new ValueOutOfRangeException(null, value, this.min, this.max);
    }
  }
811336
public boolean isValid() {
        if (ints == null) {
            throw new IllegalStateException("ints is null");
        }
        if (length < 0) {
            throw new IllegalStateException("length is negative: " + length);
        }
        if (length > ints.length) {
            throw new IllegalStateException("length is out of bounds: " + length + ",ints.length=" + ints.length);
        }
        if (offset < 0) {
            throw new IllegalStateException("offset is negative: " + offset);
        }
        if (offset > ints.length) {
            throw new IllegalStateException("offset out of bounds: " + offset + ",ints.length=" + ints.length);
        }
        if (offset + length < 0) {
            throw new IllegalStateException("offset+length is negative: offset=" + offset + ",length=" + length);
        }
        if (offset + length > ints.length) {
            throw new IllegalStateException("offset+length out of bounds: offset=" + offset + ",length=" + length + ",ints.length=" + ints.length);
        }
        return true;
    }
709420
@Override
  @SuppressWarnings("checkstyle:illegalcatch")
  public void onNext(final T value) {
    beforeOnNext();
    try {
      executor.submit(new Runnable() {

        @Override
        public void run() {
          try {
            handler.onNext(value);
          } catch (final Throwable t) {
            if (errorHandler != null) {
              errorHandler.onNext(t);
            } else {
              LOG.log(Level.SEVERE, name + " Exception from event handler", t);
              throw t;
            }
          } finally {
            afterOnNext();
          }
        }

      });
    } catch (final Exception e) {
      LOG.log(Level.SEVERE, "Encountered error when submitting to executor in ThreadPoolStage.");
      afterOnNext();
      throw e;
    }

  }