dataset_index,text,true_label,predicted_label,correct,error_type,probability_input_validation,probability_unrelated 0,"RangerServiceDefValidator validator = validatorFactory.getServiceDefValidator(svcStore); validator.validate(serviceDef, Action.CREATE);",input_validation,input_validation,True,,0.9981499910354614,0.0018500614678487182 1,"@Override protected void verifyTrust( X509Certificate[] certs, boolean enableRevocation, Collection subjectCertConstraints ) throws WSSecurityException { if (certs.length == 1 && !enableRevocation) { String issuerString = certs[0].getIssuerX500Principal().getName(); BigInteger issuerSerial = certs[0].getSerialNumber(); CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ISSUER_SERIAL); cryptoType.setIssuerSerial(issuerString, issuerSerial); X509Certificate[] foundCerts = getX509Certificates(cryptoType); if (foundCerts != null && foundCerts.length > 0 && foundCerts[0] != null && foundCerts[0].equals(certs[0])) { try { certs[0].checkValidity(); } catch (CertificateExpiredException | CertificateNotYetValidException e) { throw new WSSecurityException( WSSecurityException.ErrorCode.FAILED_CHECK, e, ""invalidCert"" ); } LOG.debug( ""Direct trust for certificate with {}"", certs[0].getSubjectX500Principal().getName() ); return; } } X509Certificate[] x509certs = certs; String issuerString = certs[0].getIssuerX500Principal().getName(); try { if (certs.length == 1) { byte[] keyIdentifierBytes = BouncyCastleUtils.getAuthorityKeyIdentifierBytes(certs[0]); X509Certificate[] foundCerts = getX509CertificatesFromKeyIdentifier(keyIdentifierBytes); if (foundCerts == null || foundCerts.length < 1) { String subjectString = certs[0].getSubjectX500Principal().getName(); LOG.debug( ""No certs found in keystore for issuer {} of certificate for {}"", issuerString, subjectString ); throw new WSSecurityException( WSSecurityException.ErrorCode.FAILURE, ""certpath"", new Object[] {""No trusted certs found""} ); } x509certs = new X509Certificate[foundCerts.length + 1]; x509certs[0] = certs[0]; System.arraycopy(foundCerts, 0, x509certs, 1, foundCerts.length); } } catch (NoSuchAlgorithmException | CertificateException ex) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, ""certpath""); } LOG.debug( ""Preparing to validate certificate path for issuer {}"", issuerString ); try { List certList = Arrays.asList(x509certs); CertPath path = getCertificateFactory().generateCertPath(certList); Set set = new HashSet<>(); if (truststore != null) { addTrustAnchors(set, truststore); } if (keystore != null && (truststore == null || loadCACerts)) { addTrustAnchors(set, keystore); } String provider = getCryptoProvider(); CertPathValidator validator = null; if (provider == null || provider.length() == 0) { validator = CertPathValidator.getInstance(""PKIX""); } else { validator = CertPathValidator.getInstance(""PKIX"", provider); } PKIXParameters param = createPKIXParameters(set, enableRevocation); validator.validate(path, param); } catch (NoSuchProviderException | NoSuchAlgorithmException | CertificateException | InvalidAlgorithmParameterException | java.security.cert.CertPathValidatorException | KeyStoreException e) { throw new WSSecurityException( WSSecurityException.ErrorCode.FAILURE, e, ""certpath"" ); } if (!matchesSubjectDnPattern(certs[0], subjectCertConstraints)) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); } }",unrelated,unrelated,True,,0.0004829519602935761,0.9995170831680298 2,"public RangerRole createRole(@QueryParam(""serviceName"") String serviceName, RangerRole role, @DefaultValue(""false"") @QueryParam(""createNonExistUserGroup"") Boolean createNonExistUserGroup) { LOG.debug(""==> createRole({})"", role); RangerRole ret; try { RangerRoleValidator validator = validatorFactory.getRangerRoleValidator(roleStore); validator.validate(role, RangerValidator.Action.CREATE);",input_validation,input_validation,True,,0.9981729984283447,0.001827010652050376 3,"private static Converter createAssertionValidator(String errorCode, Converter validatorConverter, Converter contextConverter) { return (assertionToken) -> { Assertion assertion = assertionToken.assertion; SAML20AssertionValidator validator = validatorConverter.convert(assertionToken); ValidationContext context = contextConverter.convert(assertionToken); Response response = (Response) Objects.requireNonNull(assertion.getParent()); try { ValidationResult result = validator.validate(assertion, context); if (result == ValidationResult.VALID) { return Saml2ResponseValidatorResult.success(); } } catch (Exception ex) { String message = String.format(""Invalid assertion [%s] for SAML response [%s]: %s"", assertion.getID(), response.getID(), ex.getMessage()); return Saml2ResponseValidatorResult.failure(new Saml2Error(errorCode, message)); } String message = String.format(""Invalid assertion [%s] for SAML response [%s]: %s"", assertion.getID(), response.getID(), context.getValidationFailureMessages()); return Saml2ResponseValidatorResult.failure(new Saml2Error(errorCode, message)); }; }",unrelated,unrelated,True,,0.0005315858870744705,0.9994683861732483 4,"try { RangerSecurityZoneValidator validator = validatorFactory.getSecurityZoneValidator(svcStore, securityZoneStore); validator.validate(securityZone, RangerValidator.Action.UPDATE);",input_validation,input_validation,True,,0.998155415058136,0.0018445890164002776 5,"try { RangerRoleValidator validator = validatorFactory.getRangerRoleValidator(roleStore); validator.validate(roleId, RangerRoleValidator.Action.DELETE);",input_validation,input_validation,True,,0.9981595873832703,0.0018404638394713402 6,"SchemaIdValidator validator = schemaContext.getSchemaRegistryConfig().getSchemaIdValidator(); if (validator != null) { if (!validator.validate(id, rootSchema, schemaLocation, result, schemaContext)) { SchemaLocation idSchemaLocation = schemaLocation.append(schemaContext.getDialect().getIdKeyword()); Error error = Error.builder() .messageKey(KeywordType.ID.getValue()).keyword(KeywordType.ID.getValue()) .instanceLocation(idSchemaLocation.getFragment()) .arguments(id, schemaContext.getDialect().getIdKeyword(), idSchemaLocation) .schemaLocation(idSchemaLocation) .schemaNode(schemaNode) .messageFormatter(args -> schemaContext.getSchemaRegistryConfig().getMessageSource().getMessage( KeywordType.ID.getValue(), schemaContext.getSchemaRegistryConfig().getLocale(), args)) .build(); throw new InvalidSchemaException(error); } }",input_validation,input_validation,True,,0.9981677532196045,0.001832181471399963 7,"RangerServiceValidator validator = validatorFactory.getServiceValidator(svcStore); validator.validate(id, Action.DELETE);",input_validation,input_validation,True,,0.9981465339660645,0.0018534634727984667 8,"public List handleToken( Element elem, RequestData data ) throws WSSecurityException { SecurityContextToken sct = new SecurityContextToken(elem); Validator validator = data.getValidator(new QName(elem.getNamespaceURI(), elem.getLocalName())); WSSecurityEngineResult result = new WSSecurityEngineResult(WSConstants.SCT, sct); if (validator != null) { Credential credential = new Credential(); credential.setSecurityContextToken(sct); Credential returnedCredential = validator.validate(credential, data); result.put(WSSecurityEngineResult.TAG_VALIDATED_TOKEN, Boolean.TRUE); String tokenId = sct.getID(); if (tokenId.length() != 0) { result.put(WSSecurityEngineResult.TAG_ID, tokenId); } result.put(WSSecurityEngineResult.TAG_SECRET, returnedCredential.getSecretKey()); } else { String id = sct.getID(); id = XMLUtils.getIDFromReference(id); byte[] secret = null; try { secret = getSecret(data.getCallbackHandler(), sct.getIdentifier()); } catch (WSSecurityException ex) { secret = getSecret(data.getCallbackHandler(), id); } if (secret == null || secret.length == 0) { secret = getSecret(data.getCallbackHandler(), id); } result.put(WSSecurityEngineResult.TAG_ID, sct.getID()); result.put(WSSecurityEngineResult.TAG_SECRET, secret); } data.getWsDocInfo().addTokenElement(elem); data.getWsDocInfo().addResult(result); return java.util.Collections.singletonList(result); }",unrelated,unrelated,True,,0.0005050601903349161,0.9994949102401733 9,"@DELETE @Path(""/zones/{id}"") public void deleteSecurityZone(@PathParam(""id"") Long zoneId) { LOG.debug(""==> deleteSecurityZone(id={})"", zoneId); if (zoneId != null && zoneId.equals(RangerSecurityZone.RANGER_UNZONED_SECURITY_ZONE_ID)) { throw restErrorUtil.createRESTException(""Cannot delete unzoned zone""); }",input_validation,input_validation,True,,0.9980939030647278,0.0019061029888689518 10,"RangerServiceDefValidator validator = validatorFactory.getServiceDefValidator(svcStore); validator.validate(id, Action.DELETE);",input_validation,input_validation,True,,0.9981465339660645,0.001853507594205439 11,"@Override public OAuth2TokenValidatorResult validate(Jwt token) { Assert.notNull(token, ""token cannot be null""); return this.validator.validate(token); }",unrelated,unrelated,True,,0.46549755334854126,0.5345024466514587 12,"protected void verifyTrust( X509Certificate[] certs, boolean enableRevocation, Collection subjectCertConstraints ) throws WSSecurityException { if (certs.length == 1 && !enableRevocation) { String issuerString = certs[0].getIssuerX500Principal().getName(); BigInteger issuerSerial = certs[0].getSerialNumber(); CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ISSUER_SERIAL); cryptoType.setIssuerSerial(issuerString, issuerSerial); X509Certificate[] foundCerts = getX509Certificates(cryptoType); if (foundCerts != null && foundCerts.length > 0 && foundCerts[0] != null && foundCerts[0].equals(certs[0])) { LOG.debug( ""Direct trust for certificate with {}"", certs[0].getSubjectX500Principal().getName() ); return; } } String issuerString = certs[0].getIssuerX500Principal().getName(); X509Certificate[] foundCerts = new X509Certificate[0]; if (certs.length == 1) { CryptoType cryptoType = new CryptoType(CryptoType.TYPE.SUBJECT_DN); cryptoType.setSubjectDN(issuerString); foundCerts = getX509Certificates(cryptoType); if (foundCerts == null || foundCerts.length < 1) { String subjectString = certs[0].getSubjectX500Principal().getName(); LOG.debug( ""No certs found in keystore for issuer {} of certificate for {}"", issuerString, subjectString ); throw new WSSecurityException( WSSecurityException.ErrorCode.FAILURE, ""certpath"", new Object[] {""No trusted certs found""} ); } } LOG.debug( ""Preparing to validate certificate path for issuer {}"", issuerString ); try { Set set = new HashSet<>(); if (trustedCerts != null) { for (X509Certificate cert : trustedCerts) { TrustAnchor anchor = new TrustAnchor(cert, null); set.add(anchor); } } String provider = getCryptoProvider(); CertPathValidator validator = null; if (provider == null || provider.length() == 0) { validator = CertPathValidator.getInstance(""PKIX""); } else { validator = CertPathValidator.getInstance(""PKIX"", provider); } PKIXParameters param = new PKIXParameters(set); param.setRevocationEnabled(enableRevocation); if (foundCerts.length > 0) { X509Certificate[] x509certs = new X509Certificate[foundCerts.length + 1]; x509certs[0] = certs[0]; System.arraycopy(foundCerts, 0, x509certs, 1, foundCerts.length); List certList = Arrays.asList(x509certs); CertPath path = getCertificateFactory().generateCertPath(certList); validator.validate(path, param); } else { List certList = Arrays.asList(certs); CertPath path = getCertificateFactory().generateCertPath(certList); validator.validate(path, param); } } catch (java.security.NoSuchProviderException | NoSuchAlgorithmException | java.security.cert.CertificateException | java.security.InvalidAlgorithmParameterException | java.security.cert.CertPathValidatorException e) { throw new WSSecurityException( WSSecurityException.ErrorCode.FAILURE, e, ""certpath"", new Object[] {e.getMessage()} ); } if (!matchesSubjectDnPattern(certs[0], subjectCertConstraints)) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); } }",unrelated,unrelated,True,,0.0004822474147658795,0.9995177984237671 13,"public List handleToken( Element elem, RequestData data ) throws WSSecurityException { String id = elem.getAttributeNS(WSConstants.WSU_NS, ""Id""); if (id.length() != 0) { Element foundElement = data.getWsDocInfo().getTokenElement(id); if (elem.equals(foundElement)) { WSSecurityEngineResult result = data.getWsDocInfo().getResult(id); return java.util.Collections.singletonList(result); } else if (foundElement != null) { throw new WSSecurityException( WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, ""duplicateError"" ); } } BinarySecurity token = createSecurityToken(elem, data); X509Certificate[] certs = null; Validator validator = data.getValidator(new QName(elem.getNamespaceURI(), elem.getLocalName())); if (data.getSigVerCrypto() == null) { certs = getCertificatesTokenReference(token, data.getDecCrypto()); } else { certs = getCertificatesTokenReference(token, data.getSigVerCrypto()); } WSSecurityEngineResult result = new WSSecurityEngineResult(WSConstants.BST, token, certs); data.getWsDocInfo().addTokenElement(elem); if (id.length() != 0) { result.put(WSSecurityEngineResult.TAG_ID, id); } if (validator != null) { Credential credential = new Credential(); credential.setBinarySecurityToken(token); credential.setCertificates(certs); Credential returnedCredential = validator.validate(credential, data); result.put(WSSecurityEngineResult.TAG_VALIDATED_TOKEN, Boolean.TRUE); result.put(WSSecurityEngineResult.TAG_SECRET, returnedCredential.getSecretKey()); if (returnedCredential.getTransformedToken() != null) { result.put( WSSecurityEngineResult.TAG_TRANSFORMED_TOKEN, returnedCredential.getTransformedToken() ); if (credential.getPrincipal() != null) { result.put(WSSecurityEngineResult.TAG_PRINCIPAL, credential.getPrincipal()); } else { SAMLTokenPrincipalImpl samlPrincipal = new SAMLTokenPrincipalImpl(credential.getTransformedToken()); result.put(WSSecurityEngineResult.TAG_PRINCIPAL, samlPrincipal); } } else if (credential.getPrincipal() != null) { result.put(WSSecurityEngineResult.TAG_PRINCIPAL, credential.getPrincipal()); } else if (certs != null && certs.length > 0 && certs[0] != null) { result.put(WSSecurityEngineResult.TAG_PRINCIPAL, certs[0].getSubjectX500Principal()); } result.put(WSSecurityEngineResult.TAG_SUBJECT, credential.getSubject()); if (credential.getDelegationCredential() != null) { result.put(WSSecurityEngineResult.TAG_DELEGATION_CREDENTIAL, credential.getDelegationCredential()); } } data.getWsDocInfo().addResult(result); return java.util.Collections.singletonList(result); }",unrelated,unrelated,True,,0.0005093958461657166,0.9994906187057495 14,"private Credential handleUsernameToken( Element token, Validator validator, RequestData data ) throws WSSecurityException { boolean allowNamespaceQualifiedPasswordTypes = data.isAllowNamespaceQualifiedPasswordTypes(); int utTTL = data.getUtTTL(); int futureTimeToLive = data.getUtFutureTTL(); UsernameToken ut = new UsernameToken(token, allowNamespaceQualifiedPasswordTypes, data.getBSPEnforcer()); if (!ut.verifyCreated(utTTL, futureTimeToLive)) { throw new WSSecurityException(WSSecurityException.ErrorCode.MESSAGE_EXPIRED); } ReplayCache replayCache = data.getNonceReplayCache(); if (replayCache != null && ut.getNonce() != null) { if (replayCache.contains(ut.getNonce())) { throw new WSSecurityException( WSSecurityException.ErrorCode.INVALID_SECURITY, ""badUsernameToken"", new Object[] {""A replay attack has been detected""} ); } Instant created = ut.getCreatedDate(); if (created == null || utTTL <= 0) { replayCache.add(ut.getNonce()); } else { replayCache.add(ut.getNonce(), Instant.now().plusSeconds(utTTL)); } } Credential credential = new Credential(); credential.setUsernametoken(ut); if (validator != null) { return validator.validate(credential, data); } return credential; }",unrelated,unrelated,True,,0.0005942349671386182,0.9994057416915894 15,"public List handleToken( Element elem, RequestData data ) throws WSSecurityException { LOG.debug(""Found Timestamp list element""); Timestamp timestamp = new Timestamp(elem, data.getBSPEnforcer()); Credential credential = new Credential(); credential.setTimestamp(timestamp); WSSecurityEngineResult result = new WSSecurityEngineResult(WSConstants.TS, timestamp); String tokenId = timestamp.getID(); if (tokenId.length() != 0) { result.put(WSSecurityEngineResult.TAG_ID, tokenId); } Validator validator = data.getValidator(WSConstants.TIMESTAMP); if (validator != null) { validator.validate(credential, data); result.put(WSSecurityEngineResult.TAG_VALIDATED_TOKEN, Boolean.TRUE); } data.getWsDocInfo().addTokenElement(elem); data.getWsDocInfo().addResult(result); return java.util.Collections.singletonList(result); }",unrelated,unrelated,True,,0.0005989952478557825,0.9994009733200073 16,"RangerSecurityZoneValidator validator = validatorFactory.getSecurityZoneValidator(svcStore, securityZoneStore); validator.validate(zoneName, RangerValidator.Action.DELETE); securityZoneStore.deleteSecurityZoneByName(zoneName);",input_validation,input_validation,True,,0.9981600642204285,0.0018399347318336368 17,@Override public OAuth2TokenValidatorResult validate(T token) { Collection errors = new ArrayList<>(); for (OAuth2TokenValidator validator : this.tokenValidators) { errors.addAll(validator.validate(token).getErrors()); } return OAuth2TokenValidatorResult.failure(errors); },unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9981728792190552,0.0018270574510097504 18,"public Credential handleSAMLToken( SamlAssertionWrapper samlAssertion, RequestData data, Validator validator ) throws WSSecurityException { samlAssertion.parseSubject( new WSSSAMLKeyInfoProcessor(data), data.getSigVerCrypto() ); Credential credential = new Credential(); credential.setSamlAssertion(samlAssertion); if (validator != null) { return validator.validate(credential, data); } return credential; }",unrelated,unrelated,True,,0.007731608580797911,0.9922683835029602 19,"protected void verifyTrust( X509Certificate[] certs, boolean enableRevocation, Collection subjectCertConstraints ) throws WSSecurityException { if (certs.length == 1 && !enableRevocation) { String issuerString = certs[0].getIssuerX500Principal().getName(); BigInteger issuerSerial = certs[0].getSerialNumber(); CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ISSUER_SERIAL); cryptoType.setIssuerSerial(issuerString, issuerSerial); X509Certificate[] foundCerts = getX509Certificates(cryptoType); if (foundCerts != null && foundCerts.length > 0 && foundCerts[0] != null && foundCerts[0].equals(certs[0])) { try { certs[0].checkValidity(); } catch (CertificateExpiredException | CertificateNotYetValidException e) { throw new WSSecurityException( WSSecurityException.ErrorCode.FAILED_CHECK, e, ""invalidCert"" ); } LOG.debug( ""Direct trust for certificate with {}"", certs[0].getSubjectX500Principal().getName() ); return; } } List foundIssuingCertChains = null; String issuerString = certs[0].getIssuerX500Principal().getName(); if (certs.length == 1) { Object subject = convertSubjectToPrincipal(issuerString); if (keystore != null) { foundIssuingCertChains = getCertificates(subject, keystore, false); } if ((foundIssuingCertChains == null || foundIssuingCertChains.isEmpty()) && truststore != null) { foundIssuingCertChains = getCertificates(subject, truststore, true); } if (foundIssuingCertChains == null || foundIssuingCertChains.isEmpty() || foundIssuingCertChains.get(0).length < 1) { String subjectString = certs[0].getSubjectX500Principal().getName(); LOG.debug( ""No certs found in keystore for issuer {} of certificate for {}"", issuerString, subjectString ); throw new WSSecurityException( WSSecurityException.ErrorCode.FAILURE, ""certpath"", new Object[] {""No trusted certs found""} ); } } LOG.debug( ""Preparing to validate certificate path for issuer {}"", issuerString ); try { Set set = new HashSet<>(); if (truststore != null) { addTrustAnchors(set, truststore); } if (keystore != null && (truststore == null || loadCACerts)) { addTrustAnchors(set, keystore); } String provider = getCryptoProvider(); CertPathValidator validator = null; if (provider == null || provider.length() == 0) { validator = CertPathValidator.getInstance(""PKIX""); } else { validator = CertPathValidator.getInstance(""PKIX"", provider); } PKIXParameters param = createPKIXParameters(set, enableRevocation); if (foundIssuingCertChains != null && !foundIssuingCertChains.isEmpty()) { java.security.cert.CertPathValidatorException validatorException = null; for (Certificate[] foundCertChain : foundIssuingCertChains) { X509Certificate[] x509certs = new X509Certificate[foundCertChain.length + 1]; x509certs[0] = certs[0]; System.arraycopy(foundCertChain, 0, x509certs, 1, foundCertChain.length); List certList = Arrays.asList(x509certs); CertPath path = getCertificateFactory().generateCertPath(certList); try { validator.validate(path, param); validatorException = null; break; } catch (java.security.cert.CertPathValidatorException e) { validatorException = e; } } if (validatorException != null) { throw validatorException; } } else { List certList = Arrays.asList(certs); CertPath path = getCertificateFactory().generateCertPath(certList); validator.validate(path, param); } } catch (NoSuchProviderException | NoSuchAlgorithmException | CertificateException | InvalidAlgorithmParameterException | java.security.cert.CertPathValidatorException | KeyStoreException e) { throw new WSSecurityException( WSSecurityException.ErrorCode.FAILURE, e, ""certpath"" ); } if (!matchesSubjectDnPattern(certs[0], subjectCertConstraints)) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); } }",unrelated,unrelated,True,,0.00047715107211843133,0.9995228052139282 20,"public List handleToken( Element elem, RequestData data ) throws WSSecurityException { LOG.debug(""Found signature element""); Element keyInfoElement = XMLUtils.getDirectChildElement( elem, ""KeyInfo"", WSConstants.SIG_NS ); X509Certificate[] certs = null; Principal principal = null; PublicKey publicKey = null; byte[] secretKey = null; String signatureMethod = getSignatureMethod(elem); REFERENCE_TYPE referenceType = null; Credential credential = new Credential(); Validator validator = data.getValidator(WSConstants.SIGNATURE); if (keyInfoElement == null) { certs = getDefaultCerts(data.getSigVerCrypto()); principal = certs[0].getSubjectX500Principal(); } else { int result = 0; Node node = keyInfoElement.getFirstChild(); Element child = null; while (node != null) { if (Node.ELEMENT_NODE == node.getNodeType()) { result++; child = (Element)node; } node = node.getNextSibling(); } if (result != 1) { data.getBSPEnforcer().handleBSPRule(BSPRule.R5402); } if (!(SecurityTokenReference.SECURITY_TOKEN_REFERENCE.equals(child.getLocalName()) && WSConstants.WSSE_NS.equals(child.getNamespaceURI()))) { data.getBSPEnforcer().handleBSPRule(BSPRule.R5417); publicKey = X509Util.parseKeyValue(keyInfoElement, signatureFactory); if (validator != null) { credential.setPublicKey(publicKey); principal = new PublicKeyPrincipalImpl(publicKey); credential.setPrincipal(principal); credential = validator.validate(credential, data); } } else { STRParserParameters parameters = new STRParserParameters(); parameters.setData(data); parameters.setStrElement(child); if (signatureMethod != null) { parameters.setDerivationKeyLength(KeyUtils.getKeyLength(signatureMethod)); } STRParser strParser = new SignatureSTRParser(); STRParserResult parserResult = strParser.parseSecurityTokenReference(parameters); principal = parserResult.getPrincipal(); certs = parserResult.getCertificates(); publicKey = parserResult.getPublicKey(); secretKey = parserResult.getSecretKey(); referenceType = parserResult.getCertificatesReferenceType(); boolean trusted = parserResult.isTrustedCredential(); if (trusted) { LOG.debug(""Direct Trust for SAML/BST credential""); } if (!trusted && (publicKey != null || (certs != null && certs.length > 0)) && validator != null) { credential.setPublicKey(publicKey); credential.setCertificates(certs); credential.setPrincipal(principal); credential = validator.validate(credential, data); } } } if ((certs == null || certs.length == 0 || certs[0] == null) && secretKey == null && publicKey == null) { LOG.debug(""No certificates or keys were found with which to validate the signature""); throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK); } AlgorithmSuite algorithmSuite = data.getAlgorithmSuite(); if (algorithmSuite != null) { AlgorithmSuiteValidator algorithmSuiteValidator = new AlgorithmSuiteValidator(algorithmSuite); if (principal instanceof WSDerivedKeyTokenPrincipal) { algorithmSuiteValidator.checkDerivedKeyAlgorithm( ((WSDerivedKeyTokenPrincipal)principal).getAlgorithm() ); algorithmSuiteValidator.checkSignatureDerivedKeyLength( ((WSDerivedKeyTokenPrincipal)principal).getLength() ); } else { if (certs != null && certs.length > 0) { algorithmSuiteValidator.checkAsymmetricKeyLength(certs); } else if (publicKey != null) { algorithmSuiteValidator.checkAsymmetricKeyLength(publicKey); } else if (secretKey != null) { algorithmSuiteValidator.checkSymmetricKeyLength(secretKey.length); } } } XMLSignature xmlSignature = verifyXMLSignature(elem, certs, publicKey, secretKey, signatureMethod, data, data.getWsDocInfo()); byte[] signatureValue = xmlSignature.getSignatureValue().getValue(); String c14nMethod = xmlSignature.getSignedInfo().getCanonicalizationMethod().getAlgorithm(); List dataRefs = buildProtectedRefs( elem.getOwnerDocument(), xmlSignature.getSignedInfo(), data, data.getWsDocInfo() ); if (dataRefs.isEmpty()) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK); } int actionPerformed = WSConstants.SIGN; if (principal instanceof UsernameTokenPrincipal) { actionPerformed = WSConstants.UT_SIGN; } WSSecurityEngineResult result = new WSSecurityEngineResult( actionPerformed, principal, certs, dataRefs, signatureValue); result.put(WSSecurityEngineResult.TAG_SIGNATURE_METHOD, signatureMethod); result.put(WSSecurityEngineResult.TAG_CANONICALIZATION_METHOD, c14nMethod); String tokenId = elem.getAttributeNS(null, ""Id""); if (tokenId.length() != 0) { result.put(WSSecurityEngineResult.TAG_ID, tokenId); } result.put(WSSecurityEngineResult.TAG_SECRET, secretKey); result.put(WSSecurityEngineResult.TAG_PUBLIC_KEY, publicKey); result.put(WSSecurityEngineResult.TAG_X509_REFERENCE_TYPE, referenceType); result.put(WSSecurityEngineResult.TAG_TOKEN_ELEMENT, elem); if (validator != null) { result.put(WSSecurityEngineResult.TAG_VALIDATED_TOKEN, Boolean.TRUE); if (credential != null) { result.put(WSSecurityEngineResult.TAG_SUBJECT, credential.getSubject()); } } data.getWsDocInfo().addResult(result); data.getWsDocInfo().addTokenElement(elem); return java.util.Collections.singletonList(result); }",unrelated,unrelated,True,,0.0004893092554993927,0.999510645866394 21,"public void validateSignatureAgainstProfile() throws WSSecurityException { Signature sig = getSignature(); if (sig != null) { SAMLSignatureProfileValidator validator = new SAMLSignatureProfileValidator(); try { validator.validate(sig); } catch (SignatureException ex) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, ""empty"", new Object[] {""SAML signature validation failed""}); } } }",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9980600476264954,0.0019399269949644804 22,"@Override public @Nullable String resolveCsrfTokenValue(HttpServletRequest request, CsrfToken csrfToken) { String actualToken = super.resolveCsrfTokenValue(request, csrfToken); if (actualToken == null) { return null; } return getTokenValue(actualToken, csrfToken.getToken()); }",unrelated,unrelated,True,,0.0004771631502080709,0.9995228052139282 23,private static boolean isSnapshot(String version) { return version.endsWith(SNAPSHOT) || SNAPSHOT_TIMESTAMP.matcher(version).matches(); },input_validation,input_validation,True,,0.9981513619422913,0.0018486627377569675 24,"String keyId = getString(WSHandlerConstants.SIG_KEY_ID, mc); if (keyId != null) { Integer id = WSHandlerConstants.getKeyIdentifier(keyId); if (id == null) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ""empty"", new Object[] {""WSHandler: Signature: unknown key identification""} ); } int tmp = id; if (!(tmp == WSConstants.ISSUER_SERIAL || tmp == WSConstants.ISSUER_SERIAL_QUOTE_FORMAT || tmp == WSConstants.BST_DIRECT_REFERENCE || tmp == WSConstants.X509_KEY_IDENTIFIER || tmp == WSConstants.SKI_KEY_IDENTIFIER || tmp == WSConstants.THUMBPRINT_IDENTIFIER || tmp == WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER || tmp == WSConstants.KEY_VALUE)) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ""empty"", new Object[] {""WSHandler: Signature: illegal key identification""} ); }",input_validation,input_validation,True,,0.9979806542396545,0.0020193338859826326 25,"public static SmartExecutor newSmartExecutor(Integer tasks, int maxConcurrentTasks, String namePrefix) { if (maxConcurrentTasks < 1) { throw new IllegalArgumentException(""maxConcurrentTasks must be > 0""); } requireNonNull(namePrefix); int poolSize; if (tasks != null) { if (tasks < 1) { throw new IllegalArgumentException(""tasks must be > 0""); } if (tasks == 1 || maxConcurrentTasks == 1) { return DIRECT; } poolSize = Math.min(tasks, maxConcurrentTasks); } else { if (maxConcurrentTasks == 1) { return DIRECT; } poolSize = maxConcurrentTasks; } return new SmartExecutor.Pooled(Executors.newFixedThreadPool(poolSize, new WorkerThreadFactory(namePrefix))); }",unrelated,unrelated,True,,0.0004819169989787042,0.9995180368423462 26,"private Node linkFirst(E e) { final Node newNode = newNode(Objects.requireNonNull(e)); restartFromHead: for (;;) for (Node h = head, p = h, q;;) { if ((q = p.prev) != null && (q = (p = q).prev) != null) p = (h != (h = head)) ? h : q; else if (p.next == p) continue restartFromHead; else { NEXT.set(newNode, p); if (PREV.compareAndSet(p, null, newNode)) { if (p != h) HEAD.weakCompareAndSet(this, h, newNode); return newNode; } } } }",unrelated,unrelated,True,,0.0004826383083127439,0.9995173215866089 27,"public static String getNodeNameIgnorePrefix(Node node) { if (node == null) { return null; } String nodeName = node.getNodeName(); if (nodeName.contains("":"")) { nodeName = nodeName.split("":"")[1]; } return nodeName; }",unrelated,unrelated,True,,0.0051710521802306175,0.994828999042511 28,"private void store(int streamId, StreamHolder streamHolder) { if (streamHolder == null) { return; } streamHolders.put(streamId, streamHolder); entries.add(new StreamCacheEntry(streamId)); }",unrelated,unrelated,True,,0.0004909444833174348,0.9995090961456299 29,"@Override public InputStreamSource getResource(AbsoluteIri absoluteIri) { String iri = absoluteIri != null ? absoluteIri.toString() : """"; String name = null; if (iri.startsWith(""classpath:"")) { name = iri.substring(10); } else if (iri.startsWith(""resource:"")) { name = iri.substring(9); } if (name != null) { ClassLoader classLoader = this.classLoaderSource.get(); if (name.startsWith(""//"")) { name = name.substring(2); } String resource = name; return () -> { InputStream result = classLoader.getResourceAsStream(resource); if (result == null) { result = classLoader.getResourceAsStream(resource.substring(1)); } if (result == null && this.fallbackToOwnClassLoader) { ClassLoader ownClassLoader = ResourceLoader.class.getClassLoader(); if (ownClassLoader != null && ownClassLoader != classLoader) { result = ownClassLoader.getResourceAsStream(resource); if (result == null) { result = ownClassLoader.getResourceAsStream(resource.substring(1)); } } } if (result == null) { throw new FileNotFoundException(iri); } return result; }; } return null; }",unrelated,unrelated,True,,0.0004891148419119418,0.9995108842849731 30,"protected T addRule(final String peer, final boolean deny) { if (IP4_EXACT.matcher(peer).matches()) { addIpV4ExactMatch(peer, deny); } else if (IP4_WILDCARD.matcher(peer).matches()) { addIpV4WildcardMatch(peer, deny); } else if (IP4_SLASH.matcher(peer).matches()) { addIpV4SlashPrefix(peer, deny); } else if (IP6_EXACT.matcher(peer).matches()) { addIpV6ExactMatch(peer, deny); } else if (IP6_WILDCARD.matcher(peer).matches()) { addIpV6WildcardMatch(peer, deny); } else if (IP6_SLASH.matcher(peer).matches()) { addIpV6SlashPrefix(peer, deny); } else { throw UndertowMessages.MESSAGES.notAValidIpPattern(peer); }",input_validation,input_validation,True,,0.9981067180633545,0.0018932222155854106 31,"private final static Pattern MAX_AGE_PATTERN = Pattern.compile(""^\\-?[0-9]+$"");",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0008087989408522844,0.9991912245750427 32,public PathMatcher includePath(final String path) { ANNOUNCE_INCLUDE.announce(); validatePath(path); includedPaths.add(path); return this; },input_validation,input_validation,True,,0.9977841973304749,0.002215778222307563 33,"public static List findFiles(String fileExt, String basePath, String partialPath, String stringToFind) throws IOException { if (basePath == null) { basePath = System.getProperty(""ofbiz.home""); } Set stringsToFindInPath = new HashSet<>(); Set stringsToFindInFile = new HashSet<>(); if (partialPath != null) { stringsToFindInPath.add(partialPath); } if (stringToFind != null) { stringsToFindInFile.add(stringToFind); } List fileList = new LinkedList<>(); FileUtil.searchFiles(fileList, new File(basePath), new SearchTextFilesFilter(fileExt, stringsToFindInPath, stringsToFindInFile), true); return fileList; }",unrelated,unrelated,True,,0.0033776715863496065,0.9966223239898682 34,"public void lcd(String path) throws SftpException { path = localAbsolutePath(path); if ((new File(path)).isDirectory()) { try { path = (new File(path)).getCanonicalPath(); } catch (Exception e) { } lcwd = path; return; } throw new SftpException(SSH_FX_NO_SUCH_FILE, ""No such directory""); }",unrelated,unrelated,True,,0.0006625272217206657,0.9993374943733215 35,"boolean found = false; final boolean requireAllOrigins = this.requireAllOrigins; for (final String header : origin) { if (allowedOrigins.contains(header)) { found = true; if (!requireAllOrigins) { break; } } else if (requireAllOrigins) { if (UndertowLogger.REQUEST_LOGGER.isDebugEnabled()) { UndertowLogger.REQUEST_LOGGER.debugf(""Refusing request for %s due to Origin %s not being in the allowed origins list"", exchange.getRequestPath(), header); } originFailedHandler.handleRequest(exchange); return; }",input_validation,input_validation,True,,0.9981513619422913,0.0018486689077690244 36,"private static void validatePath(String path) { CommonHelper.assertNotBlank(""path"", path); if (!path.startsWith(""/"")) { throw new TechnicalException(""Excluded path must begin with a /""); } }",input_validation,input_validation,True,,0.9981241822242737,0.0018757757497951388 37,"public static File newFile(String destinationDirName, ZipEntry zipEntry) throws IOException { File destinationDir = new File(destinationDirName); File destFile = new File(destinationDir, zipEntry.getName()); String destDirPath = destinationDir.getCanonicalPath(); String destFilePath = destFile.getCanonicalPath(); if (!destFilePath.startsWith(destDirPath + File.separator)) { throw new IOException(""Entry is outside of the target dir: "" + zipEntry.getName()); } return destFile; }",input_validation,input_validation,True,,0.9725556969642639,0.027444347739219666 38,"public static void validateArtifactComponents(Artifact artifact) { validatePathComponent(artifact.getGroupId(), ""groupId""); validatePathComponent(artifact.getArtifactId(), ""artifactId""); validatePathComponent(artifact.getVersion(), ""version""); validatePathComponent(artifact.getBaseVersion(), ""baseVersion""); validatePathComponent(artifact.getClassifier(), ""classifier""); validatePathComponent(artifact.getExtension(), ""extension""); }",input_validation,input_validation,True,,0.9981330037117004,0.001867016777396202 39,"public static byte[] decodeFromFile(String filename) throws java.io.IOException { byte[] decodedData = null; Base64.InputStream bis = null; try { Path file = Paths.get(filename); byte[] buffer; int length = 0; int numBytes; if (Files.size(file) > Integer.MAX_VALUE) { throw new java.io.IOException(""File is too big for this convenience method ("" + Files.size(file) + "" bytes).""); } buffer = new byte[(int) Files.size(file)];",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0004972864990122616,0.9995026588439941 40,"public SimpleRedirectSessionInformationExpiredStrategy(String invalidSessionUrl, RedirectStrategy redirectStrategy) { Assert.isTrue(UrlUtils.isValidRedirectUrl(invalidSessionUrl), ""url must start with '/' or with 'http(s)'""); this.destinationUrl = invalidSessionUrl; this.redirectStrategy = redirectStrategy; }",input_validation,input_validation,True,,0.9978783130645752,0.0021216715686023235 41,"public PathMatcher excludeBranch(final String path) { ANNOUNCE_REGEXP.announce(); validatePath(path); excludedPatterns.add(Pattern.compile(""^"" + path + ""(/.*)?$"", Pattern.DOTALL)); return this; }",input_validation,input_validation,True,,0.9981127977371216,0.001887256046757102 42,private static Path canonicalPath(Path path) { try { return path.toRealPath(); } catch (IOException e) { return path.getParent() != null ? canonicalPath(path.getParent()).resolve(path.getFileName()) : path.toAbsolutePath(); } },unrelated,unrelated,True,,0.0005016075447201729,0.9994983673095703 43,public PathMatcher excludePath(final String path) { validatePath(path); excludedPaths.add(path); return this; },input_validation,input_validation,True,,0.9979427456855774,0.0020572757348418236 44,"protected PathResource getFileResource(final Path file, final String path, final Path symlinkBase, String normalizedFile) throws IOException { if (this.caseSensitive) { if (symlinkBase != null) { String relative = symlinkBase.relativize(file.normalize()).toString(); String fileResolved = file.toRealPath().toString(); String symlinkBaseResolved = symlinkBase.toRealPath().toString(); if (!fileResolved.startsWith(symlinkBaseResolved)) { log.tracef(""Rejected path resource %s from path resource manager with base %s, as the case did not match actual case of %s"", path, base, normalizedFile); return null; } String compare = fileResolved.substring(symlinkBaseResolved.length()); if(compare.startsWith(fileSystem.getSeparator())) { compare = compare.substring(fileSystem.getSeparator().length()); } if(relative.startsWith(fileSystem.getSeparator())) { relative = relative.substring(fileSystem.getSeparator().length()); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0004937829216942191,0.9995062351226807 45,"public CachingResourceManager(final int metadataCacheSize, final long maxFileSize, final DirectBufferCache dataCache, final ResourceManager underlyingResourceManager, final int maxAge) { this.maxFileSize = maxFileSize; this.underlyingResourceManager = underlyingResourceManager; this.dataCache = dataCache; if(maxAge > 0 || maxAge == MAX_AGE_NO_CACHING || maxAge == MAX_AGE_NO_EXPIRY) { this.maxAge = maxAge; } else { UndertowLogger.ROOT_LOGGER.wrongCacheTTLValue(maxAge, MAX_AGE_NO_CACHING); this.maxAge = MAX_AGE_NO_CACHING; }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0004814083513338119,0.999518632888794 46,"protected void createParentDirectories(File destination) throws TransferFailedException { File destinationDirectory = destination.getParentFile(); if (destinationDirectory == null) { return; } try { destinationDirectory = destinationDirectory.getCanonicalFile(); } catch (IOException e) { } destinationDirectory.mkdirs(); if (!destinationDirectory.exists()) { throw new TransferFailedException( ""Specified destination directory cannot be created: "" + destinationDirectory); } }",unrelated,unrelated,True,,0.0005749448318965733,0.9994250535964966 47,"public static final PolicyFactory BIRT_FLEXIBLE_REPORT_POLICY = new HtmlPolicyBuilder() .allowWithoutAttributes(""html"", ""body"") .allowElements(""form"", ""div"", ""span"", ""table"", ""tr"", ""td"", ""input"", ""textarea"", ""label"", ""select"", ""option"") .allowAttributes(""id"", ""class"", ""name"", ""value"", ""onclick"").globally() .allowAttributes(""width"", ""cellspacing"").onElements(""table"") .allowAttributes(""type"", ""size"", ""maxlength"").onElements(""input"") .allowAttributes(""cols"", ""rows"").onElements(""textarea"") .allowAttributes(""class"").onElements(""td"") .allowAttributes(""method"").onElements(""form"") .allowAttributes(""accept"", ""action"", ""accept-charset"", ""autocomplete"", ""enctype"", ""method"", ""name"", ""novalidate"", ""target"").onElements(""form"") .toFactory();",input_validation,input_validation,True,,0.9981526732444763,0.0018472509691491723 48,@Override public String canonicalize(String path) throws IOException { return super.canonicalize(cwdify(path)); },unrelated,unrelated,True,,0.0005563626764342189,0.9994435906410217 49,} else { if (UtilValidate.isNotEmpty(sanitizer)) { sanitizer = sanitizer.and(Sanitizers.FORMATTING.and(Sanitizers.BLOCKS).and(Sanitizers.IMAGES).and( Sanitizers.LINKS).and(Sanitizers.STYLES)); } else { sanitizer = Sanitizers.FORMATTING.and(Sanitizers.BLOCKS).and(Sanitizers.IMAGES).and( Sanitizers.LINKS).and(Sanitizers.STYLES); } } sanitizer = sanitizer.and(PERMISSIVE_POLICY); return sanitizer.sanitize(original); },input_validation,input_validation,True,,0.9981613755226135,0.001838647061958909 50,"protected GSSContext createGSSContext( final GSSManager manager, final Oid oid, final GSSName serverName, final GSSCredential gssCredential) throws GSSException { final GSSContext gssContext = manager.createContext(serverName.canonicalize(oid), oid, gssCredential, GSSContext.DEFAULT_LIFETIME); gssContext.requestMutualAuth(true); if (config.getRequestDelegCreds() != org.apache.hc.client5.http.auth.KerberosConfig.Option.DEFAULT) { gssContext.requestCredDeleg(config.getRequestDelegCreds() == org.apache.hc.client5.http.auth.KerberosConfig.Option.ENABLE); } return gssContext; }",unrelated,unrelated,True,,0.0004830170364584774,0.9995169639587402 51,String canonicalize(String path) throws IOException;,unrelated,unrelated,True,,0.009404946118593216,0.9905951023101807 52,PolicyFactory getSanitizerPolicy();,unrelated,unrelated,True,,0.0015255562029778957,0.9984744191169739 53,"Builder withValue(String key, String value) { this.values.put(key, HtmlUtils.htmlEscape(value)); return this; }",input_validation,input_validation,True,,0.9699428677558899,0.030057135969400406 54,"@Override public Mono sendRedirect(ServerWebExchange exchange, URI location) { final UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUri(location); final StringBuilder hiddenInputsHtmlBuilder = new StringBuilder(); for (final Map.Entry> entry : uriComponentsBuilder.build().getQueryParams().entrySet()) { final String name = entry.getKey(); for (final String value : entry.getValue()) { final String hiddenInput = HIDDEN_INPUT_TEMPLATE .replace(""{{name}}"", HtmlUtils.htmlEscape(name)) .replace(""{{value}}"", HtmlUtils.htmlEscape(value)); hiddenInputsHtmlBuilder.append(hiddenInput.trim()); }",input_validation,input_validation,True,,0.9980841875076294,0.0019158243667334318 55,"public static final PolicyFactory POLICY_DEFINITION = new HtmlPolicyBuilder() .allowStandardUrlProtocols() .allowStyling() .allowAttributes(""title"").globally() .allowAttributes(""href"").onElements(""a"") .requireRelNofollowOnLinks() .allowAttributes(""lang"").matching(Pattern.compile(""[a-zA-Z]{2,20}"")) .globally() .allowAttributes(""align"") .matching(true, ""center"", ""left"", ""right"", ""justify"", ""char"") .onElements(""p"") .allowElements(""a"", ""p"", ""div"", ""i"", ""b"", ""em"", ""blockquote"", ""hr"", ""strong"", ""br"", ""ul"", ""ol"", ""li"", ""img"") .allowAttributes(""src"", ""alt"").onElements(""img"") .toFactory();",input_validation,input_validation,True,,0.9981499910354614,0.0018500949954614043 56,public synchronized String pwd() throws IOException { return super.canonicalize(cwd); },unrelated,unrelated,True,,0.0005384396645240486,0.9994615912437439 57,"Resource resource = null; try { if (File.separatorChar == '/' || !exchange.getRelativePath().contains(File.separator)) { resource = resourceSupplier.getResource(exchange, canonicalize(exchange.getRelativePath())); }",input_validation,input_validation,True,,0.9977108240127563,0.002289139200001955 58,"@Override public HttpUriRequest getRedirect(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException { final URI uri = getLocationURI(request, response, context); if (request instanceof HttpEntityEnclosingRequest) { HttpEntityEnclosingRequest encRequest = (HttpEntityEnclosingRequest) request; if (encRequest.getEntity() instanceof AbstractHttpClientWagon.WagonHttpEntity) { AbstractHttpClientWagon.WagonHttpEntity whe = (WagonHttpEntity) encRequest.getEntity(); if (whe.getWagon() instanceof AbstractHttpClientWagon) { AbstractHttpClientWagon httpWagon = (AbstractHttpClientWagon) whe.getWagon(); TransferEvent transferEvent = new TransferEvent( httpWagon, whe.getResource(), TransferEvent.TRANSFER_STARTED, TransferEvent.REQUEST_PUT); transferEvent.setTimestamp(System.currentTimeMillis()); transferEvent.setLocalFile(whe.getSource()); httpWagon .getTransferEventSupport() .fireDebug(String.format( ""Following redirect from '%s' to '%s'"", request.getRequestLine().getUri(), uri.toASCIIString())); httpWagon.getTransferEventSupport().fireTransferStarted(transferEvent); } else { LOGGER.warn( ""Cannot properly handle redirect transfer event, wagon has unexpected class: {}"", whe.getWagon().getClass()); } } } return RequestBuilder.copy(request).setUri(uri).build(); }",unrelated,unrelated,True,,0.000504146097227931,0.9994958639144897 59,"final String requestURI = getPathWithinApplication(request); final String requestURINoTrailingSlash = removeTrailingSlash(requestURI); for (String pathPattern : filterChainManager.getChainNames()) { if (pathMatches(pathPattern, requestURI)) { if (LOGGER.isTraceEnabled()) { LOGGER.trace(""Matched path pattern [{}] for requestURI [{}]. "" + ""Utilizing corresponding filter chain..."", pathPattern, Encode.forHtml(requestURI)); }",input_validation,input_validation,True,,0.9981683492660522,0.0018315938068553805 60,"static String canonicalize(String value, boolean strict) throws IntrusionException { return canonicalize(value, strict, strict); }",input_validation,input_validation,True,,0.9157175421714783,0.0842825323343277 61,"val profile = new WeiboProfile(); val json = JsonHelper.getFirstNode(body); if (json != null) { profile.setId( ProfileHelper.sanitizeIdentifier(JsonHelper.getElement(json, ""id""))); for (val attribute : getPrimaryAttributes()) { convertAndAdd(profile, PROFILE_ATTRIBUTE, attribute, JsonHelper.getElement(json, attribute)); } } else { raiseProfileExtractionJsonError(body);",input_validation,input_validation,True,,0.9981536269187927,0.001846326282247901 62,"var userNode = array.get(0); if (userNode == null) { raiseProfileExtractionJsonError(body, ""response""); } profile.setId(ProfileHelper.sanitizeIdentifier(JsonHelper.getElement(userNode, ""uid""))); for (val attribute : getPrimaryAttributes()) { convertAndAdd(profile, PROFILE_ATTRIBUTE, attribute, JsonHelper.getElement(userNode, attribute)); }",input_validation,input_validation,True,,0.9981445074081421,0.001855484675616026 63,"val json = JsonHelper.getFirstNode(body); if (json != null) { if (getProfileId() != null) { profile.setId(ProfileHelper.sanitizeIdentifier(JsonHelper.getElement(json, getProfileId()))); } for (val attribute : getPrimaryAttributes()) { convertAndAdd(profile, PROFILE_ATTRIBUTE, attribute, JsonHelper.getElement(json, attribute)); } } else { raiseProfileExtractionJsonError(body);",input_validation,input_validation,True,,0.9981468915939331,0.0018531759269535542 64,"String sanitize(String outString, String contentTypeId);",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9980699419975281,0.0019300220301374793 65,"public static String canonicalize(final String path) { return canonicalize(path, false); }",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9938609600067139,0.006139026023447514 66,"private static long asLong(final String value) throws ResourceIOException { try { return Long.parseLong(value); } catch (final NumberFormatException ex) { throw new ResourceIOException(""Invalid cache header format""); } }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.000490382662974298,0.9995095729827881 67,"private static long getParameterValue(Map parameters, String parameterName, long defaultValue) { long parameterValue = defaultValue; Object obj = parameters.get(parameterName); if (obj != null) { if (obj.getClass() == Long.class) { parameterValue = (Long) obj; } else if (obj.getClass() == Integer.class) { parameterValue = (Integer) obj; } else { try { parameterValue = Long.parseLong(obj.toString()); } catch (NumberFormatException ignored) { } } } return parameterValue; }",unrelated,unrelated,True,,0.0005030540633015335,0.9994969367980957 68,"String keyId = getString(WSHandlerConstants.SIG_KEY_ID, mc); if (keyId != null) { Integer id = WSHandlerConstants.getKeyIdentifier(keyId); if (id == null) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ""empty"", new Object[] {""WSHandler: Signature: unknown key identification""} ); } int tmp = id; if (!(tmp == WSConstants.ISSUER_SERIAL || tmp == WSConstants.ISSUER_SERIAL_QUOTE_FORMAT || tmp == WSConstants.BST_DIRECT_REFERENCE || tmp == WSConstants.X509_KEY_IDENTIFIER || tmp == WSConstants.SKI_KEY_IDENTIFIER || tmp == WSConstants.THUMBPRINT_IDENTIFIER || tmp == WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER || tmp == WSConstants.KEY_VALUE)) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ""empty"", new Object[] {""WSHandler: Signature: illegal key identification""} ); } actionToken.setKeyIdentifierId(tmp);",input_validation,input_validation,True,,0.9967310428619385,0.0032689576037228107 69,"public static Document makeEmptyXmlDocument(String rootElementName) { Document document = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.newDocument(); } catch (Exception e) { Debug.logError(e, MODULE); } if (document == null) { return null; } if (rootElementName != null) { Element rootElement = document.createElement(rootElementName); document.appendChild(rootElement); } return document; }",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9981703758239746,0.0018295582849532366 70,"Schema refSchema = this.schema.getSchema(); if (refSchema == null) { Error error = error().keyword(KeywordType.REF.getValue()) .messageKey(""internal.unresolvedRef"").message(""Reference {0} cannot be resolved"") .instanceLocation(instanceLocation).evaluationPath(executionContext.getEvaluationPath()) .arguments(schemaNode.asString()).build(); throw new InvalidSchemaRefException(error); } if (node == null) { boolean circularDependency = false; SchemaLocation schemaLocation = refSchema.getSchemaLocation(); for (Iterator iter = executionContext.getEvaluationSchema().descendingIterator(); iter.hasNext();) { Schema check = iter.next(); if (check.getSchemaLocation().equals(schemaLocation)) { circularDependency = true; break; } } if (circularDependency) { return; } }",input_validation,input_validation,True,,0.9980263113975525,0.001973670907318592 71,"URL url = FlexibleLocation.resolveLocation(str); if (url != null) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); factory.setFeature(""http://xml.org/sax/features/external-general-entities"", false); factory.setFeature(""http://xml.org/sax/features/external-parameter-entities"", false); factory.setFeature(""http://apache.org/xml/features/nonvalidating/load-external-dtd"", false); factory.setXIncludeAware(false); factory.setExpandEntityReferences(false); DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.parse(url.openStream()); document.getDocumentElement().normalize();",input_validation,input_validation,True,,0.9981637597084045,0.0018362969858571887 72,"File entityEngineFile = new File(ENTITY_ENGINE_FILE); if (!entityEngineFile.exists()) { return null; } try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setFeature(""http://apache.org/xml/features/disallow-doctype-decl"", true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc; try (InputStream is = Files.newInputStream(entityEngineFile.toPath())) { doc = builder.parse(is); } doc.getDocumentElement().normalize();",input_validation,input_validation,True,,0.9981613755226135,0.00183867069426924 73,"private void addIpV6SlashPrefix(final String peer, final boolean deny) { String[] components = peer.split(""\\/""); String[] parts = components[0].split(""\\:""); int maskLen = Integer.parseInt(components[1]); assert parts.length == 8; byte[] pattern = new byte[16]; byte[] mask = new byte[16]; for (int i = 0; i < 8; ++i) { int val = Integer.parseInt(parts[i], 16); pattern[i * 2] = (byte) (val >> 8); pattern[i * 2 + 1] = (byte) (val & 0xFF); } for (int i = 0; i < 16; ++i) { if (maskLen > 8) { mask[i] = (byte) (0xFF); maskLen -= 8; } else if (maskLen != 0) { mask[i] = (byte) (Bits.intBitMask(8 - maskLen, 7) & 0xFF); maskLen = 0; } else { break; } } ipv6Matches.add(new PrefixIpV6PeerMatch(peer, mask, pattern, deny)); }",unrelated,unrelated,True,,0.0004740038712043315,0.9995260238647461 74,"public DocumentCreatorImpl() throws ParserConfigurationException { documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); documentBuilderFactory.setFeature(""http://apache.org/xml/features/disallow-doctype-decl"", true); }",input_validation,input_validation,True,,0.9981566071510315,0.0018433425575494766 75,"public static ByteRange parse(String rangeHeader) { if(rangeHeader == null || rangeHeader.length() < 7) { return null; } if(!rangeHeader.startsWith(""bytes="")) { return null; } List ranges = new ArrayList<>(); String[] parts = rangeHeader.substring(6).split("",""); for(String part : parts) { try { int index = part.indexOf('-'); if (index == 0) { long val = Long.parseLong(part.substring(1)); if(val <= 0) { UndertowLogger.REQUEST_LOGGER.debugf(""Invalid range spec %s"", rangeHeader); return null; } ranges.add(new Range(-1, val));",input_validation,input_validation,True,,0.9981365203857422,0.0018634061561897397 76,boolean isContentExpected() { if (HttpContinue.requiresContinueResponse(headerMap)) { return true; } String contentLengthString = headerMap.getFirst(Headers.CONTENT_LENGTH); try { return contentLengthString != null ? Long.parseLong(contentLengthString) > 0 : false; } catch (NumberFormatException e) { return false; } },input_validation,input_validation,True,,0.9981459379196167,0.0018540802411735058 77,"public static void elementToStream(Element element, OutputStream out) throws TransformerException { DOMSource source = new DOMSource(element); StreamResult result = new StreamResult(out); TransformerFactory transFactory = TransformerFactory.newInstance(); transFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); try { transFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, """"); transFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, """"); } catch (IllegalArgumentException ex) { } Transformer transformer = transFactory.newTransformer(); transformer.transform(source, result); }",input_validation,input_validation,True,,0.9981579184532166,0.0018420279957354069 78,"ByteArrayInputStream bis = new ByteArrayInputStream(sb.toString().getBytes(StandardCharsets.UTF_8)); TransformerFactory transformerFactory = TransformerFactory.newInstance(); transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, """"); transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, """"); try (ByteArrayOutputStream os = new ByteArrayOutputStream();) { UtilXml.transformDomDocument(transformerFactory.newTransformer(new StreamSource(bis)), node, os); return os.toString(); }",input_validation,input_validation,True,,0.9981703758239746,0.0018296560738235712 79,"public static Schema loadWSSecuritySchemas() throws SAXException { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); schemaFactory.setResourceResolver(new LSResourceResolver() { @Override public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { if (""http://www.w3.org/2001/XMLSchema.dtd"".equals(systemId)) { ConcreteLSInput concreteLSInput = new ConcreteLSInput(); concreteLSInput.setByteStream(ClassLoaderUtils.getResourceAsStream(""schemas/XMLSchema.dtd"", WSSec.class)); return concreteLSInput; } else if (""XMLSchema.dtd"".equals(systemId)) { ConcreteLSInput concreteLSInput = new ConcreteLSInput(); concreteLSInput.setByteStream(ClassLoaderUtils.getResourceAsStream(""schemas/XMLSchema.dtd"", WSSec.class)); return concreteLSInput;",input_validation,input_validation,True,,0.9981685876846313,0.0018314161570742726 80,"@SuppressWarnings(""removal"") public DefaultOAuth2UserService() { RestTemplate restTemplate = new RestTemplate(); restTemplate.setErrorHandler(new OAuth2ErrorResponseErrorHandler()); this.restOperations = restTemplate; }",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9980118274688721,0.0019881611224263906 81,"public static SetErrorHandler setErrorHandler(int responseCode, HttpHandler next) { return new SetErrorHandler(next, responseCode); }",unrelated,unrelated,True,,0.0005447592702694237,0.9994552731513977 82,"TransformerFactory tfactory = TransformerFactory.newInstance(); tfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, """"); tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, """"); if (tfactory.getFeature(SAXSource.FEATURE)) { SAXParserFactory pfactory = SAXParserFactory.newInstance(); pfactory.setNamespaceAware(true); pfactory.setValidating(false); pfactory.setXIncludeAware(true); XMLReader reader = null; try { pfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); pfactory.setFeature(""http://xml.org/sax/features/external-general-entities"", false); pfactory.setFeature(""http://xml.org/sax/features/external-parameter-entities"", false); pfactory.setFeature(""http://apache.org/xml/features/nonvalidating/load-external-dtd"", false); reader = pfactory.newSAXParser().getXMLReader(); } catch (Exception e) { throw new TransformerException(""Error creating SAX parser/reader"", e);",input_validation,input_validation,True,,0.9981682300567627,0.0018317376961931586 83,"ByteArrayInputStream bis = new ByteArrayInputStream(sb.toString().getBytes()); TransformerFactory transformerFactory = TransformerFactory.newInstance(); transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, """"); transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, """"); return transformerFactory.newTransformer(new StreamSource(bis));",input_validation,input_validation,True,,0.9981696605682373,0.0018303667893633246 84,"TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer; try { tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, """"); tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, """"); transformer = tf.newTransformer();",input_validation,input_validation,True,,0.9981630444526672,0.0018370280740782619 85,"private void addIpV4WildcardMatch(final String peer, final boolean deny) { String[] parts = peer.split(""\\.""); int mask = 0; int prefix = 0; for (int i = 0; i < 4; ++i) { mask <<= 8; prefix <<= 8; String part = parts[i]; if (!part.equals(""*"")) { int no = Integer.parseInt(part); mask |= 0xFF; prefix |= no; } } ipv4Matches.add(new PrefixIpV4PeerMatch(peer, mask, prefix, deny)); }",unrelated,unrelated,True,,0.002605925314128399,0.9973940849304199 86,"parser.setFeature(""http://xml.org/sax/features/namespaces"", true); parser.setFeature(""http://xml.org/sax/features/validation"", validate); parser.setFeature(""http://apache.org/xml/features/validation/schema"", validate); parser.setFeature(""http://apache.org/xml/features/dom/defer-node-expansion"", false); parser.setFeature(""http://xml.org/sax/features/external-general-entities"", false); parser.setFeature(""http://xml.org/sax/features/external-parameter-entities"", false); parser.setFeature(""http://apache.org/xml/features/nonvalidating/load-external-dtd"", false); if (validate) { LocalResolver lr = new LocalResolver(new DefaultHandler()); ErrorHandler eh = new LocalErrorHandler(docDescription, lr); parser.setEntityResolver(lr); parser.setErrorHandler(eh); }",input_validation,input_validation,True,,0.9981132745742798,0.0018866827012971044 87,"DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(validate); factory.setNamespaceAware(true); factory.setAttribute(""http://xml.org/sax/features/validation"", validate); factory.setAttribute(""http://apache.org/xml/features/validation/schema"", validate); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); factory.setFeature(""http://xml.org/sax/features/external-general-entities"", false); factory.setFeature(""http://xml.org/sax/features/external-parameter-entities"", false); factory.setFeature(""http://apache.org/xml/features/nonvalidating/load-external-dtd"", false); factory.setXIncludeAware(false); factory.setExpandEntityReferences(false);",input_validation,input_validation,True,,0.9981550574302673,0.0018449350027367473 88,"public void walk(ExecutionContext executionContext, JsonNode node, JsonNode rootNode, NodePath instanceLocation, boolean shouldValidateSchema) { Schema refSchema = getSchemaRef(executionContext).getSchema(); if (refSchema == null) { Error error = error().keyword(KeywordType.DYNAMIC_REF.getValue()) .messageKey(""internal.unresolvedRef"").message(""Reference {0} cannot be resolved"") .instanceLocation(instanceLocation).evaluationPath(executionContext.getEvaluationPath()) .arguments(schemaNode.asString()).build(); throw new InvalidSchemaRefException(error); }",input_validation,input_validation,True,,0.9981287121772766,0.0018712548771873116 89,"public void walk(ExecutionContext executionContext, JsonNode node, JsonNode rootNode, NodePath instanceLocation, boolean shouldValidateSchema) { Schema refSchema = getSchemaRef(executionContext).getSchema(); if (refSchema == null) { Error error = error().keyword(KeywordType.RECURSIVE_REF.getValue()) .messageKey(""internal.unresolvedRef"").message(""Reference {0} cannot be resolved"") .instanceLocation(instanceLocation).evaluationPath(executionContext.getEvaluationPath()) .arguments(schemaNode.toString()).build(); throw new InvalidSchemaRefException(error); }",input_validation,input_validation,True,,0.99811851978302,0.001881478470750153 90,"protected ResultSetType resolveResultSetType(String alias) { try { return alias == null ? null : ResultSetType.valueOf(alias); } catch (IllegalArgumentException e) { throw new BuilderException(""Error resolving ResultSetType. Cause: "" + e, e); } }",unrelated,unrelated,True,,0.0004929284332320094,0.9995070695877075 91,@Override public RandomProviderState saveState() { return new RandomProviderDefaultState(getStateInternal()); },unrelated,unrelated,True,,0.0004989498993381858,0.9995009899139404 92,"private GuideTableDiscreteSampler(UniformRandomProvider rng, double[] cumulativeProbabilities, int[] guideTable) { this.rng = rng; this.cumulativeProbabilities = cumulativeProbabilities; this.guideTable = guideTable; }",unrelated,unrelated,True,,0.0004977502976544201,0.9995021820068359 93,"private int skipWS(String expression, int p) { for (int i = p; i < expression.length(); i++) { if (expression.charAt(i) > 0x20) { return i; } } return expression.length(); }",unrelated,unrelated,True,,0.0005607451894320548,0.9994391798973083 94,"private BoxMullerGaussianSampler(double mean, double standardDeviation, UniformRandomProvider rng) { super(null); this.rng = rng; this.mean = mean; this.standardDeviation = standardDeviation; }",unrelated,unrelated,True,,0.00048695580335333943,0.9995130300521851 95,"private PoissonSamplerCache(int minN, int maxN, LargeMeanPoissonSamplerState[] states) { this.minN = minN; this.maxN = maxN; this.values = states; }",unrelated,unrelated,True,,0.0004786726785823703,0.9995213747024536 96,@Override public long next() { final int p = bufferPosition; if (bufferPosition < PHILOX_BUFFER_SIZE) { bufferPosition = p + 1; return buffer[p]; } incrementCounter(); rand10(); bufferPosition = 1; return buffer[0]; },unrelated,unrelated,True,,0.0004901700303889811,0.9995098114013672 97,public void setLogImpl(Class logImpl) { if (logImpl != null) { this.logImpl = logImpl; LogFactory.useCustomLogging(this.logImpl); } },unrelated,unrelated,True,,0.0005142991431057453,0.9994857311248779 98,@Override public UniformRandomProvider jump() { final UniformRandomProvider copy = new L32X64Mix(this); ls = M * ls + la; resetCachedState(); return copy; },unrelated,unrelated,True,,0.0004816864093299955,0.9995182752609253 99,"private static void putInt(int v, byte[] buffer, int index) { buffer[index ] = (byte) (v & INT_LOWEST_BYTE_MASK); buffer[index + 1] = (byte)((v >>> 8) & INT_LOWEST_BYTE_MASK); buffer[index + 2] = (byte)((v >>> 16) & INT_LOWEST_BYTE_MASK); buffer[index + 3] = (byte) (v >>> 24); }",unrelated,unrelated,True,,0.0004974118783138692,0.9995025396347046 100,"private List selectList() throws SQLException { Executor localExecutor = executor; if (Thread.currentThread().getId() != this.creatorThreadId || localExecutor.isClosed()) { localExecutor = newExecutor(); } try { return localExecutor.query(mappedStatement, parameterObject, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER, cacheKey, boundSql); } finally { if (localExecutor != executor) { localExecutor.close(false); } } }",unrelated,unrelated,True,,0.0004779909795615822,0.9995219707489014 101,public List resolveWithConstructor() { if (constructorResultMappings.isEmpty()) { return constructorResultMappings; } final List matchingConstructorCandidates = retrieveConstructorCandidates( constructorResultMappings.size()); if (matchingConstructorCandidates.isEmpty()) { return constructorResultMappings; } final Set constructorArgsByName = constructorResultMappings.stream().map(ResultMapping::getProperty) .filter(Objects::nonNull).collect(Collectors.toCollection(LinkedHashSet::new)); final boolean allMappingsHavePropertyNames = verifyPropertyNaming(constructorArgsByName);,unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9877303242683411,0.012269685976207256 102,@Override public Class getSetterType(String name) { PropertyTokenizer prop = new PropertyTokenizer(name); if (prop.hasNext()) { MetaObject metaValue = metaObject.metaObjectForProperty(prop.getIndexedName()); if (metaValue == SystemMetaObject.NULL_META_OBJECT) { return Object.class; } else { return metaValue.getSetterType(prop.getChildren()); } } if (map.get(name) != null) { return map.get(name).getClass(); } else { return Object.class; } },unrelated,unrelated,True,,0.0004923969972878695,0.9995075464248657 103,"private void applyConstructorArgs(Arg[] args, Class resultType, List resultMappings, String resultMapId) { final List mappings = new ArrayList<>(); for (Arg arg : args) { List flags = new ArrayList<>(); flags.add(ResultFlag.CONSTRUCTOR); if (arg.id()) { flags.add(ResultFlag.ID); } @SuppressWarnings(""unchecked"") Class> typeHandler = (Class>) (arg .typeHandler() == UnknownTypeHandler.class ? null : arg.typeHandler()); ResultMapping resultMapping = assistant.buildResultMapping(resultType, nullOrEmpty(arg.name()), nullOrEmpty(arg.column()), arg.javaType() == void.class ? null : arg.javaType(), arg.jdbcType() == JdbcType.UNDEFINED ? null : arg.jdbcType(), nullOrEmpty(arg.select()), nullOrEmpty(arg.resultMap()), null, nullOrEmpty(arg.columnPrefix()), typeHandler, flags, null, null, false); mappings.add(resultMapping); } final ResultMappingConstructorResolver resolver = new ResultMappingConstructorResolver(configuration, mappings,",unrelated,unrelated,True,,0.00048702338244765997,0.9995130300521851 104,private MetaObject getParamMetaObject() { if (paramMetaObject != null) { return paramMetaObject; } paramMetaObject = configuration.newMetaObject(parameterObject); return paramMetaObject; },unrelated,unrelated,True,,0.0004888016264885664,0.9995112419128418 105,public int getActiveConnectionCount() { lock.lock(); try { return activeConnections.size(); } finally { lock.unlock(); } },unrelated,unrelated,True,,0.0005012375768274069,0.999498724937439 106,"@Override public BigDecimal getNullableResult(ResultSet rs, String columnName) throws SQLException { return rs.getBigDecimal(columnName); }",unrelated,unrelated,True,,0.0005166884511709213,0.9994832277297974 107,"@Override public void error(String s, Throwable e) { logger.log(MARKER, FQCN, LocationAwareLogger.ERROR_INT, s, null, e); }",unrelated,unrelated,True,,0.0005717046442441642,0.9994282126426697 108,"public PreparedStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) { super(executor, mappedStatement, parameter, rowBounds, resultHandler, boundSql); }",unrelated,unrelated,True,,0.0004928717971779406,0.9995070695877075 109,"private void parseSelectKeyNodes(String parentId, List list, Class parameterTypeClass, LanguageDriver langDriver, String skRequiredDatabaseId) { for (XNode nodeToHandle : list) { String id = parentId + SelectKeyGenerator.SELECT_KEY_SUFFIX; String databaseId = nodeToHandle.getStringAttribute(""databaseId""); if (databaseIdMatchesCurrent(id, databaseId, skRequiredDatabaseId)) { parseSelectKeyNode(id, nodeToHandle, parameterTypeClass, langDriver, databaseId); } } }",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9980114698410034,0.0019884801004081964 110,private void setState(long[] state) { key0 = state[0]; key1 = state[1]; counter0 = state[2]; counter1 = state[3]; counter2 = state[4]; counter3 = state[5]; },unrelated,unrelated,True,,0.0005079155671410263,0.9994920492172241 111,"public Class getGetterType(String propertyName) { Class clazz = getTypes.getOrDefault(propertyName, nullEntry).getValue(); if (clazz == null) { throw new ReflectionException(""There is no getter for property named '"" + propertyName + ""' in '"" + clazz + ""'""); } return clazz; }",unrelated,unrelated,True,,0.0004861289053224027,0.9995138645172119 112,"@Override protected void setStateInternal(byte[] s) { final byte[][] c = splitStateInternal(s, (N + 1) * 4); final int[] tmp = NumberFactory.makeIntArray(c[0]); System.arraycopy(tmp, 0, mt, 0, N); mti = tmp[N]; super.setStateInternal(c[1]); }",unrelated,unrelated,True,,0.0004905067617073655,0.9995094537734985 113,"@Override public List query(MappedStatement ms, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler) throws SQLException { BoundSql boundSql = ms.getBoundSql(parameterObject); CacheKey key = createCacheKey(ms, parameterObject, rowBounds, boundSql); return query(ms, parameterObject, rowBounds, resultHandler, key, boundSql); }",unrelated,unrelated,True,,0.00048652617260813713,0.9995135068893433 114,private boolean isLazy(Result result) { boolean isLazy = configuration.isLazyLoadingEnabled(); if (!result.one().select().isEmpty() && FetchType.DEFAULT != result.one().fetchType()) { isLazy = result.one().fetchType() == FetchType.LAZY; } else if (!result.many().select().isEmpty() && FetchType.DEFAULT != result.many().fetchType()) { isLazy = result.many().fetchType() == FetchType.LAZY; } return isLazy; },unrelated,unrelated,True,,0.0005416129715740681,0.999458372592926 115,public CacheBuilder addDecorator(Class decorator) { if (decorator != null) { this.decorators.add(decorator); } return this; },unrelated,unrelated,True,,0.0005047860904596746,0.9994951486587524 116,@Override public void clear() { lastClear = System.currentTimeMillis(); delegate.clear(); },unrelated,unrelated,True,,0.0005165152251720428,0.9994834661483765 117,"@Override protected Statement instantiateStatement(Connection connection) throws SQLException { String sql = boundSql.getSql(); if (mappedStatement.getResultSetType() == ResultSetType.DEFAULT) { return connection.prepareCall(sql); } return connection.prepareCall(sql, mappedStatement.getResultSetType().getValue(), ResultSet.CONCUR_READ_ONLY); }",unrelated,unrelated,True,,0.0004896359168924391,0.9995104074478149 118,"private static SharedStateDiscreteSampler createSampler(UniformRandomProvider rng, List collection, double[] probabilities) { if (probabilities.length != collection.size()) { throw new IllegalArgumentException(""Size mismatch: "" + probabilities.length + "" != "" + collection.size()); } return GuideTableDiscreteSampler.of(rng, probabilities); }",unrelated,unrelated,True,,0.00048334590974263847,0.9995166063308716 119,"private ResultMapping buildResultMappingFromContext(XNode context, Class resultType, List flags) { String property; if (flags.contains(ResultFlag.CONSTRUCTOR)) { property = context.getStringAttribute(""name""); } else { property = context.getStringAttribute(""property""); } String column = context.getStringAttribute(""column""); String javaType = context.getStringAttribute(""javaType""); String jdbcType = context.getStringAttribute(""jdbcType""); String nestedSelect = context.getStringAttribute(""select""); String nestedResultMap = context.getStringAttribute(""resultMap"", () -> processNestedResultMappings(context, List.of(), resultType)); String notNullColumn = context.getStringAttribute(""notNullColumn""); String columnPrefix = context.getStringAttribute(""columnPrefix""); String typeHandler = context.getStringAttribute(""typeHandler""); String resultSet = context.getStringAttribute(""resultSet""); String foreignColumn = context.getStringAttribute(""foreignColumn""); boolean lazy = ""lazy"" .equals(context.getStringAttribute(""fetchType"", configuration.isLazyLoadingEnabled() ? ""lazy"" : ""eager""));",unrelated,unrelated,True,,0.0005052104243077338,0.9994947910308838 120,@Override public Cursor queryCursor(Statement statement) throws SQLException { return delegate.queryCursor(statement); },unrelated,unrelated,True,,0.0004958898643963039,0.9995040893554688 121,"private JdbcType safeGetJdbcTypeForColumn(ResultSetMetaData rsmd, Integer columnIndex) { try { return JdbcType.forCode(rsmd.getColumnType(columnIndex)); } catch (Exception e) { return null; } }",unrelated,unrelated,True,,0.00048754052841104567,0.9995124340057373 122,@Override public int next() { final int indexRm1 = TABLE.getIndexPred(index); final int v0 = v[index]; final int vM1 = v[TABLE.getIndexM1(index)]; final int vM2 = v[TABLE.getIndexM2(index)]; final int vM3 = v[TABLE.getIndexM3(index)]; final int z0 = v[indexRm1]; final int z1 = v0 ^ (vM1 ^ (vM1 >>> 8)); final int z2 = (vM2 ^ (vM2 << 19)) ^ (vM3 ^ (vM3 << 14)); final int z3 = z1 ^ z2; final int z4 = (z0 ^ (z0 << 11)) ^ (z1 ^ (z1 << 7)) ^ (z2 ^ (z2 << 13)); v[index] = z3; v[indexRm1] = z4; index = indexRm1; return z4;,unrelated,unrelated,True,,0.0004943181411363184,0.9995056390762329 123,"private void linkToParents(ResultSet rs, ResultMapping parentMapping, Object rowValue) throws SQLException { CacheKey parentKey = createKeyForMultipleResults(rs, parentMapping, parentMapping.getColumn(), parentMapping.getForeignColumn()); List parents = pendingRelations.get(parentKey); if (parents != null) { for (PendingRelation parent : parents) { if (parent != null && rowValue != null) { linkObjects(parent.metaObject, parent.propertyMapping, rowValue); } } } }",unrelated,unrelated,True,,0.0004992068279534578,0.9995007514953613 124,PendingCreationKey(ResultMapping constructorMapping) { this.resultMapId = constructorMapping.getNestedResultMapId(); this.constructorColumnPrefix = constructorMapping.getColumnPrefix(); },unrelated,unrelated,True,,0.0004931222065351903,0.9995068311691284 125,"private static long sum(long[] frequencies) { if (frequencies == null || frequencies.length == 0) { throw new IllegalArgumentException(""frequencies must contain at least 1 value""); } long m = 0; long signFlag = 0; for (final long o : frequencies) { m += o; signFlag |= o | m; } if (signFlag < 0) { for (final long o : frequencies) { if (o < 0) {",unrelated,unrelated,True,,0.00047295205877162516,0.999527096748352 126,@Override public String[] getSetterNames() { return map.keySet().toArray(new String[0]); },unrelated,unrelated,True,,0.0005421805544756353,0.9994577765464783 127,"private InverseTransformParetoSampler(double scale, double shape, UniformRandomProvider rng) { super(null); this.rng = rng; this.scale = scale; this.oneOverShape = 1 / shape; nextDouble = shape >= 1 ? InternalUtils::makeNonZeroDouble : InternalUtils::makeDouble; }",unrelated,unrelated,True,,0.0004846885276492685,0.9995152950286865 128,public long getClaimedOverdueConnectionCount() { lock.lock(); try { return claimedOverdueConnectionCount; } finally { lock.unlock(); } },unrelated,unrelated,True,,0.0004977863864041865,0.9995021820068359 129,"public static double[] shuffle(UniformRandomProvider rng, double[] array) { int i = array.length; for (; i > BATCH_2; --i) { swap(array, i - 1, rng.nextInt(i)); } final int[] productBound = {i * (i - 1)}; for (; i > 1; i -= 2) { final int[] indices = randomBounded2(i, i - 1, productBound, rng); final int index1 = indices[0]; final int index2 = indices[1]; swap(array, i - 1, index1); swap(array, i - 2, index2); } return array; }",unrelated,unrelated,True,,0.0004954356118105352,0.999504566192627 130,"@Override public Reader getNullableResult(ResultSet rs, String columnName) throws SQLException { return toReader(rs.getClob(columnName)); }",unrelated,unrelated,True,,0.000498104898724705,0.9995019435882568 131,"@Override public int next() { z = computeNew(36969, z); w = computeNew(18000, w); final int mwc = (z << 16) + w; jsr ^= jsr << 13; jsr ^= jsr >>> 17; jsr ^= jsr << 5; jcong = 69069 * jcong + 1234567; return (mwc ^ jcong) + jsr; }",unrelated,unrelated,True,,0.0004958428908139467,0.9995042085647583 132,"@SuppressWarnings({""rawtypes"", ""unchecked""}) public static void shuffle(UniformRandomProvider rng, List list) { if (list instanceof RandomAccess || list.size() < RANDOM_ACCESS_SIZE_THRESHOLD) { ArraySampler.shuffle(rng, list); } else { final Object[] array = list.toArray(); ArraySampler.shuffle(rng, array); final ListIterator it = list.listIterator(); for (final Object item : array) { it.next(); it.set(item); } } }",unrelated,unrelated,True,,0.00048344270908273757,0.9995166063308716 133,"private void cacheElement(XNode context) { if (context != null) { String type = context.getStringAttribute(""type"", ""PERPETUAL""); Class typeClass = typeAliasRegistry.resolveAlias(type); String eviction = context.getStringAttribute(""eviction"", ""LRU""); Class evictionClass = typeAliasRegistry.resolveAlias(eviction); Long flushInterval = context.getLongAttribute(""flushInterval""); Integer size = context.getIntAttribute(""size""); boolean readWrite = !context.getBooleanAttribute(""readOnly"", false); boolean blocking = context.getBooleanAttribute(""blocking"", false); Properties props = context.getChildrenAsProperties(); builderAssistant.useNewCache(typeClass, evictionClass, flushInterval, size, readWrite, blocking, props); } }",unrelated,unrelated,True,,0.000480808928841725,0.9995192289352417 134,"@Override protected void setStateInternal(byte[] s) { final byte[][] c = splitStateInternal(s, SEED_SIZE * 8); setState(NumberFactory.makeLongArray(c[0])); super.setStateInternal(c[1]); }",unrelated,unrelated,True,,0.0004869251570198685,0.9995130300521851 135,"public static Type resolveFieldType(Field field, Type srcType) { Type fieldType = field.getGenericType(); Class declaringClass = field.getDeclaringClass(); return resolveType(fieldType, srcType, declaringClass); }",unrelated,unrelated,True,,0.0005047295708209276,0.999495267868042 136,private void finishJump() { resetCachedState(); if (bufferPosition < PHILOX_BUFFER_SIZE) { rand10(); } },unrelated,unrelated,True,,0.0005054897628724575,0.9994944334030151