/* (non-Javadoc)
@see com.ibm.ws.sib.processor.runtime.ControlAdapter#assertValidControllable()
187842
public void assertValidControllable() throws SIMPControllableNotFoundException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "assertValidControllable");

    if(_targetStream == null ||
       _streamSetID == null  ||
       _targetStreamReliability == null )
    {
      SIMPControllableNotFoundException finalE =
        new SIMPControllableNotFoundException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0002",
            new Object[] {"TargetStreamControl.assertValidControllable",
                          "1:228:1.32",
                          _streamSetID},
                          null));

      SibTr.exception(tc, finalE);
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "assertValidControllable", finalE);
      throw finalE;
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "assertValidControllable");
  }
447293
public void assertValid(String valueAsString) throws IllegalArgumentException {
		final T value = valueConverter.convert(valueAsString);
		for (Validator<T> validator : validators) {
			validator.assertValid(value);
		}
	}
599805
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    if (pvalue == null) {
      return true;
    }
    try {
      String countryCode =
          BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldCountryCode);
      final String postalCode =
          BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldPostalCode);
      if (StringUtils.isEmpty(postalCode)) {
        return true;
      }

      if (allowLowerCaseCountryCode) {
        countryCode = StringUtils.upperCase(countryCode);
      }

      final String regExCheck = POSTAL_CODE_MAP.postalCodes().get(countryCode);
      if (regExCheck == null) {
        return true;
      }
      if (postalCode.matches(regExCheck)) {
        return true;
      }
      switchContext(pcontext);
      return false;
    } catch (final Exception ignore) {
      switchContext(pcontext);
      return false;
    }
  }
831743
boolean validateSettings() throws IllegalArgumentException {
        // Validate values which do not require user input first to avoid unnecesary
        // work on the user part.

        // dates
        if (startDate != null && stopDate != null) {
            if (startDate.after(stopDate)) {
                // stop date is before the start date.
                throw new IllegalArgumentException(getLocalizedString("CWTRA0026E"));
            }
        }

        // Validate levels if specified.
        if (maxLevel != null && minLevel != null) {
            // We have both a max and min level. Check that the min level is
            // equal to or less than the max level
            if (minLevel.intValue() > maxLevel.intValue()) {
                // Min is greater than Max level. Report error
                throw new IllegalArgumentException(getLocalizedString("CWTRA0027E"));
            }
        }

        // Required options
        if (binaryRepositoryDir == null) {
            File[] servers = listRepositoryChoices();
            File repositoryDirFile = null;
            if (servers.length > 1) {
                System.out.println(getLocalizedString("LVM_SelectServerPrompt"));
                int i = 0;
                for (File s : servers) {
                    i++;
                    System.out.println(i + ") " + getLogDirName(s));
                }
                String serverNum = null;
                int serverNumInt = 0;
                BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
                while (repositoryDirFile == null) {
                    System.out.print("[1-" + i + "]: ");
                    try {
                        serverNum = input.readLine();
                        serverNumInt = Integer.parseInt(serverNum);
                        if ((serverNumInt >= 1) && (serverNumInt <= i)) {
                            repositoryDirFile = servers[serverNumInt - 1];
                        }
                    } catch (NumberFormatException e) {
                        // Line does not contain a number.
                    } catch (IOException e) {
                        // Assume user just want to exit.
                        return true;
                    }
                } // end while loop
            } else if (servers.length == 1) {
                repositoryDirFile = servers[0];
            }

            if (repositoryDirFile != null) {
                // appears we have a repositoryDir
                try {
                    setBinaryRepositoryDir(repositoryDirFile.getCanonicalPath());
                    System.out.println(getLocalizedParmString("CWTRA0030I", new Object[] { binaryRepositoryDir }));
                } catch (IOException e) {
                    // TODO We don't want to print stack traces so what should we be doing here?
                    //e.printStackTrace();
                }
            }

            if (binaryRepositoryDir == null) {
                throw new IllegalArgumentException(getLocalizedString("CWTRA0024E"));
            }
        }

        return false;

    }
128314
public void dereferenceControllable()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "dereferenceControllable");
    
    _outputHandler = null;
    _messageProcessor = null;
    _anycastInputHandler = null;
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "dereferenceControllable");
  }
506115
public static final void assertProcessActive(final String processInstanceId) {
        Validate.notNull(processInstanceId);

        apiCallback.debug(LogMessage.PROCESS_1, processInstanceId);
        try {
            getProcessInstanceAssertable().processIsActive(processInstanceId);
        } catch (final AssertionError ae) {
            apiCallback.fail(ae, LogMessage.ERROR_PROCESS_1, processInstanceId);
        }
    }
549651
private boolean validateAssertion(final HttpServletRequest request, final String serviceTicketId, final Assertion assertion, final Service service) {
        for (val spec : serviceValidateConfigurationContext.getValidationSpecifications()) {
            spec.reset();
            val binder = new ServletRequestDataBinder(spec, "validationSpecification");
            initBinder(request, binder);
            binder.bind(request);
            if (!spec.isSatisfiedBy(assertion, request)) {
                LOGGER.warn("Service ticket [{}] does not satisfy validation specification.", serviceTicketId);
                return false;
            }
        }
        enforceTicketValidationAuthorizationFor(request, service, assertion);
        return true;
    }
981153
public static void throwChecked(Throwable t) {
    if (t == null) {
      throw new AssertionError("null");
    }
    Exceptions.<RuntimeException>throwIt(t);
  }
974246
private void onValidateTable(KsDef ksDef, TableInfo tableInfo) throws Exception
    {
        boolean tablefound = false;
        for (CfDef cfDef : ksDef.getCf_defs())
        {
            if (cfDef.getName().equals(tableInfo.getTableName())/*
                                                                 * && (cfDef.
                                                                 * getColumn_type
                                                                 * ().equals(
                                                                 * ColumnFamilyType
                                                                 * .
                                                                 * getInstanceOf
                                                                 * (
                                                                 * tableInfo.getType
                                                                 * ()).name()))
                                                                 */)
            {
                if (cfDef.getColumn_type().equals(ColumnFamilyType.Standard.name()))
                {
                    for (ColumnInfo columnInfo : tableInfo.getColumnMetadatas())
                    {
                        onValidateColumn(tableInfo, cfDef, columnInfo);
                    }
                    tablefound = true;
                    break;
                }
                else if (cfDef.getColumn_type().equals(ColumnFamilyType.Super.name()))
                {
                    tablefound = true;
                }
            }
        }
        if (!tablefound)
        {
            throw new SchemaGenerationException("Column family " + tableInfo.getTableName()
                    + " does not exist in keyspace " + databaseName + "", "Cassandra", databaseName,
                    tableInfo.getTableName());
        }
    }
610257
private static void validateMessageText(String messageML) throws InvalidInputException {
    if (messageML == null) { throw new InvalidInputException("Message input is NULL"); }

    for (char ch : messageML.toCharArray()) {
      if (ch != '\n' && ch != '\r' && ch != '\t' && (ch < ' ')) {
        throw new InvalidInputException("Invalid control characters in message");
      }
    }
  }
507218
@Override
	protected void checkPrimitiveValidity() {
		BusPrimitiveInvalidity invalidityReason = null;
		if (this.busStops.isEmpty()) {
			invalidityReason = new BusPrimitiveInvalidity(
					BusPrimitiveInvalidityType.NO_STOP_IN_HUB,
					null);
		} else {
			final Iterator<BusStop> iterator = this.busStops.iterator();
			while (iterator.hasNext() && invalidityReason == null) {
				final BusStop stop = iterator.next();
				if (!stop.isValidPrimitive()) {
					invalidityReason = new BusPrimitiveInvalidity(
							BusPrimitiveInvalidityType.INVALID_LINKED_STOP,
							stop.getName());
				} else {
					final BusNetwork bn = stop.getBusNetwork();
					if (bn == null || bn != getBusNetwork()) {
						invalidityReason = new BusPrimitiveInvalidity(
								BusPrimitiveInvalidityType.NOT_IN_SAME_NETWORK,
								null);
					}
				}
			}
		}
		setPrimitiveValidity(invalidityReason);
	}
1022600
public static boolean cannotBeValidatable(Object value) { // called by e.g. ResponseBeanValidator
        return value instanceof String // yes-yes-yes 
                || value instanceof Number // e.g. Integer
                || DfTypeUtil.isAnyLocalDate(value) // e.g. LocalDate
                || value instanceof Boolean // of course
                || value instanceof Classification // e.g. CDef
                || value.getClass().isPrimitive() // probably no way, just in case
        ;
    }
756785
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    if (pvalue == null) {
      return true;
    }
    try {
      final Object field1Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field1Name);
      final Object field2Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field2Name);
      if ((field1Value == null
          || field1Value instanceof String && StringUtils.isEmpty((String) field1Value))
          && (field2Value == null
              || field2Value instanceof String && StringUtils.isEmpty((String) field2Value))) {
        return true;
      }
      if (Objects.equals(field1Value, field2Value)) {
        switchContext(pcontext);
        return false;
      }
      return true;
    } catch (final Exception ignore) {
      switchContext(pcontext);
      return false;
    }
  }
819923
@Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        List<String> emailAddresses = EmailAddressesParser.parse(value);
        List<String> badAddresses = null;
        for (String ea : emailAddresses) {
            if (!EMAIL_VALIDATOR.isValid(ea, null)) {
                if (badAddresses == null) {
                    badAddresses = new LinkedList<String>();
                }

                badAddresses.add(ea);
            }
        }

        if (badAddresses != null) {
            context.disableDefaultConstraintViolation();
            context.buildConstraintViolationWithTemplate(MessageFormat.format(constraintAnnotation.message(),
                                                                              StringUtils.join(badAddresses, ", ")))
                   .addConstraintViolation();
        }
        return (badAddresses == null);
    }
639706
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    if (pvalue == null) {
      return true;
    }
    try {
      String valueCountry =
          BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, this.fieldCountryCode);
      final String valueIban =
          BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, this.fieldIban);
      final String valueBic =
          BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, this.fieldBic);
      final String bicOfIban = IbanUtil.getBicOfIban(valueIban);

      if (StringUtils.isEmpty(valueIban) && StringUtils.isEmpty(valueBic)) {
        return true;
      } else if (StringUtils.isEmpty(valueIban)) {
        pcontext.disableDefaultConstraintViolation();
        pcontext.buildConstraintViolationWithTemplate(NOT_EMPTY_MESSAGE)
            .addPropertyNode(this.fieldIban).addConstraintViolation();
        return false;
      } else if (StringUtils.isEmpty(valueBic)) {
        pcontext.disableDefaultConstraintViolation();
        pcontext.buildConstraintViolationWithTemplate(NOT_EMPTY_MESSAGE)
            .addPropertyNode(this.fieldBic).addConstraintViolation();
        return false;
      } else if (StringUtils.length(valueIban) >= IbanValidator.IBAN_LENGTH_MIN
          && StringUtils.length(valueBic) >= BicValidator.BIC_LENGTH_MIN) {
        String countryIban = valueIban.replaceAll("\\s+", StringUtils.EMPTY).substring(0, 2);
        String countryBic = valueBic.replaceAll("\\s+", StringUtils.EMPTY).substring(4, 6);
        if (StringUtils.length(valueCountry) != 2) {
          // missing country selection, us country of iban
          valueCountry = countryIban;
        }

        if (this.allowLowerCaseCountryCode) {
          valueCountry = StringUtils.upperCase(valueCountry);
          countryIban = StringUtils.upperCase(countryIban);
          countryBic = StringUtils.upperCase(countryIban);
        }

        boolean ibanCodeMatches = false;
        boolean bicCodeMatches = false;
        final boolean bicIbanMatches = bicOfIban == null || StringUtils.equals(bicOfIban, valueBic);
        switch (valueCountry) {
          case "GF": // French Guyana
          case "GP": // Guadeloupe
          case "MQ": // Martinique
          case "RE": // Reunion
          case "PF": // French Polynesia
          case "TF": // French Southern Territories
          case "YT": // Mayotte
          case "NC": // New Caledonia
          case "BL": // Saint Barthelemy
          case "MF": // Saint Martin
          case "PM": // Saint Pierre et Miquelon
          case "WF": // Wallis and Futuna Islands
            // special solution for French oversea teritorials with french registry
            ibanCodeMatches = "FR".equals(countryIban);
            bicCodeMatches = "FR".equals(countryBic);
            break;
          case "JE": // Jersey
          case "GG": // Guernsey
            // they can use GB or FR registry, but iban and bic code must match
            ibanCodeMatches = ("GB".equals(countryIban) || "FR".equals(countryIban))
                && countryBic.equals(countryIban);
            bicCodeMatches = "GB".equals(countryBic) || "FR".equals(countryBic);
            break;
          default:
            ibanCodeMatches = valueCountry.equals(countryIban);
            bicCodeMatches = valueCountry.equals(countryBic);
            break;
        }
        if (ibanCodeMatches && bicCodeMatches && bicIbanMatches) {
          return true;
        }
        pcontext.disableDefaultConstraintViolation();
        if (!ibanCodeMatches) {
          pcontext.buildConstraintViolationWithTemplate(this.message)
              .addPropertyNode(this.fieldIban).addConstraintViolation();
        }
        if (!bicCodeMatches) {
          pcontext.buildConstraintViolationWithTemplate(this.message).addPropertyNode(this.fieldBic)
              .addConstraintViolation();
        }
        if (!bicIbanMatches) {
          pcontext.buildConstraintViolationWithTemplate(this.messageWrongBic)
              .addPropertyNode(this.fieldBic).addConstraintViolation();
        }
        return false;
      } else {
        // wrong format, should be handled by other validators
        return true;
      }
    } catch (final Exception ignore) {
      return false;
    }
  }
11211
void assertParent(Collection<Class<? extends Element>> permittedParents) throws InvalidInputException {
    if (!permittedParents.contains(this.getParent().getClass())) {
      throw new InvalidInputException("Element \"" + this.getMessageMLTag() + "\" is not allowed as a child of \""
          + this.getParent().getMessageMLTag() + "\"");
    }
  }
183050
@Override
    public boolean isAvailable(CommandContext commandContext) {
        // Available only in disconnected mode
        if (commandContext.isControllerConnected()) {
            commandContext.printLine("The command is not available in the current context. Please disconnnect first");
            return false;
        }

        return true;
    }