Constructs proper error message with expected value and actual value.
@param baseMessage the base error message.
@param controlValue the expected value.
@param actualValue the actual value.
@return
163501
public static String buildValueMismatchErrorMessage(String baseMessage, Object controlValue, Object actualValue) {
        return baseMessage + ", expected '" + controlValue + "' but was '" + actualValue + "'";
    }
1340214
public ObjectBindingAssert<T> hasSameValue(ObservableObjectValue<T> expectedValue) {
        new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
        return this;
    }
36678
public void handleContextControlProtocol(
      final EvaluatorRuntimeProtocol.ContextControlProto controlMessage) {

    synchronized (this.heartBeatManager) {
      try {
        if (controlMessage.hasAddContext() && controlMessage.hasRemoveContext()) {
          throw new IllegalArgumentException(
              "Received a message with both add and remove context. This is unsupported.");
        }

        final byte[] message = controlMessage.hasTaskMessage() ?
            controlMessage.getTaskMessage().toByteArray() : null;

        if (controlMessage.hasAddContext()) {
          this.addContext(controlMessage.getAddContext());
          if (controlMessage.hasStartTask()) {
            // We support submitContextAndTask()
            this.startTask(controlMessage.getStartTask());
          } else {
            // We need to trigger a heartbeat here.
            // In other cases, the heartbeat will be triggered by the TaskRuntime
            // Therefore this call can not go into addContext.
            this.heartBeatManager.sendHeartbeat();
          }
        } else if (controlMessage.hasRemoveContext()) {
          this.removeContext(controlMessage.getRemoveContext().getContextId());
        } else if (controlMessage.hasStartTask()) {
          this.startTask(controlMessage.getStartTask());
        } else if (controlMessage.hasStopTask()) {
          this.contextStack.peek().closeTask(message);
        } else if (controlMessage.hasSuspendTask()) {
          this.contextStack.peek().suspendTask(message);
        } else if (controlMessage.hasTaskMessage()) {
          this.contextStack.peek().deliverTaskMessage(message);
        } else if (controlMessage.hasContextMessage()) {
          final EvaluatorRuntimeProtocol.ContextMessageProto contextMessageProto = controlMessage.getContextMessage();
          boolean deliveredMessage = false;
          for (final ContextRuntime context : this.contextStack) {
            if (context.getIdentifier().equals(contextMessageProto.getContextId())) {
              context.handleContextMessage(contextMessageProto.getMessage().toByteArray());
              deliveredMessage = true;
              break;
            }
          }
          if (!deliveredMessage) {
            throw new IllegalStateException(
                "Sent message to unknown context " + contextMessageProto.getContextId());
          }
        } else {
          throw new RuntimeException("Unknown task control message: " + controlMessage);
        }
      } catch (final TaskClientCodeException e) {
        this.handleTaskException(e);
      } catch (final ContextClientCodeException e) {
        this.handleContextException(e);
      }
    }

  }
765794
public void setValue(Object newValue) {
        Object checkedValue = checkValue(newValue);
        setDirty(isDifferent(baseValue, checkedValue));
        if (isDifferent(value, checkedValue)){ // firePropertyChange doesn't do this check sufficiently
            firePropertyChange(VALUE, value, value = checkedValue); // set inline to avoid recursion
        }
    }
280011
public String getControlProperty(String strKey, String strDefaultValue)
    {
        String strValue = ((PropertiesField)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.PROPERTIES)).getProperty(strKey);
        if (strValue == null)
        {
            if (strDefaultValue == null)
                strDefaultValue = this.getDefaultValue(strKey);
            strValue = strDefaultValue;
        }
        return strValue;
    }
182808
public ObjectPropertyAssert<T> hasSameValue(ObservableObjectValue<T> expectedValue) {
        new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
        return this;
    }
1027692
public void setPreventResponseFlush(String configValue) {

        OpenCms.getSystemInfo().getServletContainerSettings().setPreventResponseFlush(
            Boolean.valueOf(configValue).booleanValue());
    }
567229
public void rejectValue(final String field, final String errorCode, 
            final Map<String, Object> messageVariables, final String defaultMessage) {
        
        rejectValue(field, null, errorCode, Collections.emptyMap(), defaultMessage);
        
    }
1188395
public static FormValidation validateBase64(String value, boolean allowWhitespace, boolean allowEmpty, String errorMessage) {
        try {
            String v = value;
            if(!allowWhitespace) {
                if(v.indexOf(' ')>=0 || v.indexOf('\n')>=0)
                    return error(errorMessage);
            }
            v=v.trim();
            if(!allowEmpty && v.length()==0)
                return error(errorMessage);

            Base64.getDecoder().decode(v.getBytes(StandardCharsets.UTF_8));
            return ok();
        } catch (IllegalArgumentException e) {
            return error(errorMessage);
        }
    }
498250
@Override
    @GwtIncompatible("incompatible method")
    public String getFormattedExceptionMessage(final String baseMessage){
        final StringBuilder buffer = new StringBuilder(256);
        if (baseMessage != null) {
            buffer.append(baseMessage);
        }

        if (contextValues.size() > 0) {
            if (buffer.length() > 0) {
                buffer.append('\n');
            }
            buffer.append("Exception Context:\n");

            int i = 0;
            for (final Pair<String, Object> pair : contextValues) {
                buffer.append("\t[");
                buffer.append(++i);
                buffer.append(':');
                buffer.append(pair.getKey());
                buffer.append("=");
                final Object value = pair.getValue();
                if (value == null) {
                    buffer.append("null");
                } else {
                    String valueStr;
                    try {
                        valueStr = value.toString();
                    } catch (final Exception e) {
                        valueStr = "Exception thrown on toString(): " + ExceptionUtils.getStackTrace(e);
                    }
                    buffer.append(valueStr);
                }
                buffer.append("]\n");
            }
            buffer.append("---------------------------------");
        }
        return buffer.toString();
    }
719261
public void setControlValue(Object objValue)
    {
        if (objValue != null)
            this.setText(objValue.toString());
        else
            this.setText(null);
    }
812618
public static <T> T validateNotEmpty(T value, String errorMsg) throws ValidateException {
		if (isEmpty(value)) {
			throw new ValidateException(errorMsg);
		}
		return value;
	}
1012170
private ControlNack createControlNackMessage()
                    throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "createControlNackMessage");

        ControlNack nackMsg = null;

        // Create new NackMessage
        try
        {
            nackMsg = _cmf.createNewControlNack();
        } catch (MessageCreateFailedException e)
        {
            // FFDC
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.PtoPInputHandler.createControlNackMessage",
                                        "1:1604:1.323",
                                        this);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            {
                SibTr.exception(tc, e);
                SibTr.exit(tc, "createControlNackMessage", e);
            }

            SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                        new Object[] {
                                      "com.ibm.ws.sib.processor.impl.PtoPInputHandler",
                                      "1:1616:1.323",
                                      e });

            throw new SIResourceException(
                            nls.getFormattedMessage(
                                                    "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                                    new Object[] {
                                                                  "com.ibm.ws.sib.processor.impl.PtoPInputHandler",
                                                                  "1:1624:1.323",
                                                                  e },
                                                    null),
                            e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createControlNackMessage");

        return nackMsg;
    }
777327
public static BaseMessage processErrorMessage(RecordOwner recordOwner, BaseMessage messageOut, String strMessageError)
    {
        if (strMessageError != null)  // Add the error message to the message so the error processor has the right desc.
            ((TrxMessageHeader)messageOut.getMessageHeader()).put(TrxMessageHeader.MESSAGE_ERROR, strMessageError); // Error Description
        // Get the error message processor for this message/message type
        String strDefaultProcessorClass = null;
        MessageProcessInfoModel recMessageProcessInfo = (MessageProcessInfoModel)recordOwner.getRecord(MessageProcessInfoModel.MESSAGE_PROCESS_INFO_FILE);
        if (recMessageProcessInfo == null)
            recMessageProcessInfo = (MessageProcessInfoModel)Record.makeRecordFromClassName(MessageProcessInfo.THICK_CLASS, recordOwner);
        Object objResponseID = messageOut.getMessageHeader().get(TrxMessageHeader.MESSAGE_ERROR_PROCESSOR);

        if (objResponseID != null)
        {
            if (Utility.isNumeric(objResponseID.toString()))
            {
                recMessageProcessInfo = recMessageProcessInfo.getMessageProcessInfo(objResponseID.toString());
                if (recMessageProcessInfo != null)
                    strDefaultProcessorClass = recMessageProcessInfo.getField(MessageProcessInfo.PROCESSOR_CLASS).toString();
            }
            else
                strDefaultProcessorClass = objResponseID.toString();
        }
        if (strDefaultProcessorClass == null)
        {
            String strMessageProcessInfoID = (String)messageOut.getMessageHeader().get(TrxMessageHeader.MESSAGE_PROCESS_INFO_ID);
            recMessageProcessInfo = recMessageProcessInfo.getMessageProcessInfo(strMessageProcessInfoID);
            if (recMessageProcessInfo != null)
            {
                Record recMessageInfo = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfoModel.MESSAGE_INFO_ID)).getReference();
                if (recMessageInfo != null)
                    if ((recMessageInfo.getEditMode() == DBConstants.EDIT_CURRENT) || (recMessageInfo.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
                {
                    String strMessageInfoType = ((ReferenceField)recMessageInfo.getField(MessageInfoModel.MESSAGE_INFO_TYPE_ID)).getReference().getField(MessageInfoTypeModel.CODE).toString();
                    String strContactType = ((ReferenceField)recMessageInfo.getField(MessageInfoModel.CONTACT_TYPE_ID)).getReference().getField(ContactTypeModel.CODE).toString();
                    String strRequestType = RequestTypeModel.ERROR; 
                    String strMessageProcessType = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfoModel.MESSAGE_TYPE_ID)).getReference().getField(MessageTypeModel.CODE).toString();
                    String strProcessType = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfoModel.PROCESS_TYPE_ID)).getReference().getField(ProcessTypeModel.CODE).toString();
                    
                    recMessageProcessInfo = recMessageProcessInfo.getMessageProcessInfo(strMessageInfoType, strContactType, strRequestType, strMessageProcessType, strProcessType);
                    if (recMessageProcessInfo != null)
                        strDefaultProcessorClass = recMessageProcessInfo.getField(MessageProcessInfoModel.PROCESSOR_CLASS).toString();
                }
            }
        }
        if (strDefaultProcessorClass == null)
            strDefaultProcessorClass = BaseMessageErrorProcessor.class.getName();
        // Process this error
        BaseMessageProcessor messageInProcessor = (BaseMessageProcessor)BaseMessageProcessor.getMessageProcessor(recordOwner.getTask(), null, strDefaultProcessorClass);
        Utility.getLogger().info("processIncommingMessage - processor: " + messageInProcessor);
        BaseMessage errorMessage = null;
        if (messageInProcessor != null)
        {   // Always
            errorMessage = messageInProcessor.processMessage(messageOut);
            messageInProcessor.free();
        }
        return errorMessage;
    }
1318866
public static <T> T checkNotEmpty(T reference,  Object errorMessage) {
        checkNotNull(reference, "Expected not null object, got '%s'", reference);
        checkNotEmpty(reference, String.valueOf(errorMessage), Arrays2.EMPTY_ARRAY);
        return reference;
    }
556392
@Override
    public ValidationResult validate(PMContext ctx) {
        final ValidationResult res = new ValidationResult();
        final String fieldvalue = (String) ctx.getFieldValue();
        res.setSuccessful(true);
        if (!isName(fieldvalue)) {
            res.setSuccessful(false);
            res.getMessages().add(MessageFactory.error(ctx.getEntity(), ctx.getField(), get("msg", "")));
        }
        return res;
    }
1252404
public static <T extends CharSequence> T validateLetter(T value, String errorMsg) throws ValidateException {
		if (false == isLetter(value)) {
			throw new ValidateException(errorMsg);
		}
		return value;
	}