Verify that a valid WCSNAME has been provided, and if not, create a
        default WCSNAME based on current date.
963359
def create_WCSname(wcsname):
    
    if util.is_blank(wcsname):
        ptime = fileutil.getDate()
        wcsname = "User_"+ptime

    return wcsname
849264
private void validateBasicOcspResponse(
      Date currentTime, BasicOCSPResp basicOcspResp)
  throws CertificateEncodingException
  {
    for (SingleResp singleResps : basicOcspResp.getResponses())
    {
      Date thisUpdate = singleResps.getThisUpdate();
      Date nextUpdate = singleResps.getNextUpdate();
      LOGGER.debug("Current Time: {}, This Update: {}, Next Update: {}",
                   currentTime, thisUpdate, nextUpdate);
      CertificateStatus certStatus = singleResps.getCertStatus();
      if (certStatus != CertificateStatus.GOOD)
      {
        if (certStatus instanceof RevokedStatus)
        {
          RevokedStatus status = (RevokedStatus) certStatus;
          int reason;
          try
          {
            reason = status.getRevocationReason();
          }
          catch (IllegalStateException ex)
          {
            reason = -1;
          }
          Date revocationTime = status.getRevocationTime();
          throw new CertificateEncodingException(
              String.format(
                  "The certificate has been revoked. Reason: %d, Time: %s",
                  reason, DATE_FORMAT_UTC.format(revocationTime)));
        }
        else
        {
          // Unknown status
          throw new CertificateEncodingException(
              "Failed to validate the certificate for UNKNOWN reason.");
        }
      }
      if (!isValidityRange(currentTime, thisUpdate, nextUpdate))
      {
        throw new CertificateEncodingException(
            String.format(
                "The validity is out of range: " +
                "Current Time: %s, This Update: %s, Next Update: %s",
                DATE_FORMAT_UTC.format(currentTime),
                DATE_FORMAT_UTC.format(thisUpdate),
                DATE_FORMAT_UTC.format(nextUpdate)));
      }
    }
    LOGGER.debug("OK. Verified the certificate revocation status.");
  }
810906
function tryVerify (rawBytes) {
  const {
    tbsCertificate,
    tbsCertificate: {
      validity: {
        notBefore: { value: notBefore },
        notAfter: { value: notAfter }
      }
    },
    signatureAlgorithm: { algorithm },
    signature: { data: signature }
  } = Certificate.decode(rawBytes, 'der')

  // Require sha512WithRSAEncryption.
  if (algorithm.join('.') !== '1.2.840.113549.1.1.13') {
    return false
  }

  // Check if certificate is still valid.–
  const now = Date.now()
  if (now < notBefore || now > notAfter) {
    return false
  }
  // Make sure the certificate was signed by CloudFlare's origin pull
  // certificate authority.
  const verifier = createVerify('RSA-SHA512')
  verifier.update(TBSCertificate.encode(tbsCertificate, 'der'))
  return verifier.verify(originPullCa, signature)
}
696754
@Override
	public Date engineGetCreationDate(String s) {
		try {
			ResourceTrustAnchor trustAnchor = getCertificateEntry(s);
			if (trustAnchor != null) {
				return trustAnchor.getTrustAnchor().getTrustedCert()
						.getNotBefore();
			} else {
				CredentialWrapper credential = getKeyEntry(s);
				if (credential != null) {
					return credential.getCredential().getNotBefore();
				}
			}
		} catch (ResourceStoreException e) {
			return null;
		}
		return null;
	}
801892
async function isStaleDailyData (endpointInstance) {
  const account = await new AccountEndpoint(endpointInstance).schema('2019-03-26').get()
  return new Date(account.last_modified) < resetTime.getLastDailyReset()
}
672130
def buildDefaultRefWCS(self):
        
        self.default_refWCS = None
        if self.use_wcs:
            wcslist = []
            for scichip in self.chip_catalogs:
                wcslist.append(self.chip_catalogs[scichip]['wcs'])
            self.default_refWCS = utils.output_wcs(wcslist)
1367993
function( name, actual, expected ) {
		var self = this,
			passed = false,
			message = '';

		if ( munit.isDate( actual ) && munit.isDate( expected ) ) {
			passed = actual.getTime() === expected.getTime();
			message = "Date '" + actual + "' does not match '" + expected + "'";
		}
		else {
			message = munit.isDate( actual ) ?
				"Expected value is not a Date object '" + expected + "'" :
				"Actual value is not a Date object '" + actual + "'";
		}

		return self.ok( name, passed, self.dateEquals, message );
	}
366914
def assert_valid_name(name: str) -> str:
    """"""
    error = is_valid_name_error(name)
    if error:
        raise error
    return name
520249
function handleNameUpdate(newFilenameInputEl, fileId) {
        var newName = newFilenameInputEl.value,
            origExtension;

        if (newName !== undefined && qq.trimStr(newName).length > 0) {
            origExtension = getOriginalExtension(fileId);

            if (origExtension !== undefined) {
                newName = newName + "." + origExtension;
            }

            spec.onSetName(fileId, newName);
        }

        spec.onEditingStatusChange(fileId, false);
    }
1222058
private void verifyTimestamp(X509Certificate cert)
        throws CertPathValidatorException
    {
        String msg = "timestamp";
        if (debug != null)
            debug.println("---checking " + msg + ":" + date.toString() + "...");

        try {
            cert.checkValidity(date);
        } catch (CertificateExpiredException e) {
            throw new CertPathValidatorException
                (msg + " check failed", e, null, -1, BasicReason.EXPIRED);
        } catch (CertificateNotYetValidException e) {
            throw new CertPathValidatorException
                (msg + " check failed", e, null, -1, BasicReason.NOT_YET_VALID);
        }

        if (debug != null)
            debug.println(msg + " verified.");
    }
124946
void registerId(final WComponent component) {
		if (!WebUtilities.isActiveNamingContext(this)) {
			throw new SystemException("Can only register a component on an active NamingContext");
		}

		// Get registered id names
		ComponentModel model = getOrCreateComponentModel();
		Map<String, WComponent> ids = model.getContextIds();
		if (ids == null) {
			ids = new HashMap<>();
			model.setContextIds(ids);
		}

		// Get id name
		String idName = component.getIdName();

		// Check if already used
		WComponent mapped = ids.get(idName);

		// Not in map
		if (mapped == null) {
			// Save ID / Component
			ids.put(idName, component);
		} else if (mapped != component) { // Check is same component
			String contextName = getId();
			throw new SystemException("Duplicate ID. ID \"" + idName + "\" for " + component.
					getClass().getName()
					+ " is already in use by " + mapped.getClass().getName() + " in context \"" + contextName + "\".");
		}

	}
1033391
public final void verifyNameValidity(String name, boolean checkNs)
        throws XMLStreamException
    {
        /* No empty names... caller must have dealt with optional arguments
         * prior to calling this method
         */
        if (name == null || name.length() == 0) {
            reportNwfName(ErrorConsts.WERR_NAME_EMPTY);
        }
        int illegalIx = WstxInputData.findIllegalNameChar(name, checkNs, mXml11);
        if (illegalIx >= 0) {
            if (illegalIx == 0) {
                reportNwfName(ErrorConsts.WERR_NAME_ILLEGAL_FIRST_CHAR,
                              WstxInputData.getCharDesc(name.charAt(0)));
            }
            reportNwfName(ErrorConsts.WERR_NAME_ILLEGAL_CHAR,
                          WstxInputData.getCharDesc(name.charAt(illegalIx)));
        }
    }
9660
def name_valid?(profile_name, profile_base_path)
      unless valid_puppet_class_name?(profile_name)
        error _('wizard.profile.invalid_name')%{words: Bebox::RESERVED_WORDS.join(', ')}
        return false
      end
      return true if profile_base_path.empty?
      # Check if the path name is valid
      unless Bebox::Profile.valid_pathname?(profile_base_path)
        error _('wizard.profile.invalid_path')%{words: Bebox::RESERVED_WORDS.join(', ')}
        return false
      end
      true
    end
1004973
def is_name_registered( self, name ):
        
        name_rec = self.get_name( name )    # won't return the name if expired
        if name_rec is None:
            return False 

        if name_rec['revoked']:
            return False

        return True
1203098
function shouldShowWidget(settings = {}) {
  const nowDate = new Date();
  // Show widget if flag does not exist (old widgets)
  if (!settings.hasOwnProperty('published')) {
    return true;
  }

  if (settings.published === false) {
    return false;
  }

  // Defensive here since this data comes from the pipeline, it might be invalid for some reasons.
  if (settings.hasOwnProperty('plan') && settings.plan) {
    let startDate = null;
    let endDate = null;
    let notStartedYet = false;
    let finishedAlready = false;

    if (settings.planDate.valid_from) {
      startDate = new Date(settings.planDate.valid_from);
      notStartedYet = nowDate <= startDate;
    }

    if (settings.planDate.valid_to) {
      endDate = new Date(settings.planDate.valid_to);
      finishedAlready = nowDate >= endDate;
    }
    // Don't hide if no dates found
    if (!startDate && !endDate) {
      return true;
    }

    // Hide if some wrong dates are passed
    if (startDate && endDate && (startDate >= endDate)) {
      return false;
    }

    // Hide if start date is set but it is not there yet
    // Hide if end date is reached
    if ((startDate && notStartedYet) || (endDate && finishedAlready)) {
      return false;
    }
  }

  return true;
}
816996
def createWCSObject(output,default_wcs,imageObjectList):
    """"""
    from . import imageObject
    outwcs = imageObject.WCSObject(output)
    outwcs.default_wcs = default_wcs
    outwcs.wcs = default_wcs.copy()
    outwcs.final_wcs = default_wcs.copy()
    outwcs.single_wcs = default_wcs.copy()

    outwcs.updateContextImage(imageObjectList[0].createContext)

    #
    # Add exptime information for use with drizzle
    #
    outwcs._exptime,outwcs._expstart,outwcs._expend = util.compute_texptime(imageObjectList)

    outwcs.nimages = util.countImages(imageObjectList)

    return outwcs
412949
public void expectDomainName(String name, String message) {
        String value = Optional.ofNullable(get(name)).orElse("");

        if (!DomainValidator.getInstance().isValid(value)) {
            addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.DOMAIN_NAME_KEY.name(), name)));
        }
    }