desertsyao's picture
Upload folder using huggingface_hub
ef4d042 verified
Raw
History Blame Contribute Delete
105 kB
dataset_index,text,true_label,predicted_label,correct,error_type,probability_input_validation,probability_unrelated
0,"@SuppressWarnings(""Immutable"") static JwtPublicKeyVerify createFullPrimitive( com.google.crypto.tink.jwt.JwtEcdsaPublicKey publicKey) throws GeneralSecurityException { EcdsaPublicKey ecdsaPublicKey = toEcdsaPublicKey(publicKey); final PublicKeyVerify verifier = EcdsaVerifyJce.create(ecdsaPublicKey); return new JwtPublicKeyVerify() { @Override public VerifiedJwt verifyAndDecode(String compact, JwtValidator validator) throws GeneralSecurityException { JwtFormat.Parts parts = JwtFormat.splitSignedCompact(compact); verifier.verify(parts.signatureOrMac, parts.unsignedCompact.getBytes(US_ASCII)); JsonObject parsedHeader = JsonUtil.parseJson(parts.header); JwtFormat.validateHeader( parsedHeader, publicKey.getParameters().getAlgorithm().getStandardName(), publicKey.getKid(), publicKey.getParameters().allowKidAbsent()); RawJwt token = RawJwt.fromJsonPayload(JwtFormat.getTypeHeader(parsedHeader), parts.payload); return validator.validate(token); } }; }",unrelated,unrelated,True,,0.0004913345910608768,0.9995086193084717
1,"@Override public boolean isValid(Float value, ConstraintValidatorContext context) { if ( value == null ) { return true; } return NumberSignHelper.signum( value, InfinityNumberComparatorHelper.GREATER_THAN ) < 0; }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0004934293101541698,0.9995065927505493
2,"ConstraintDefinitionContext<A> validatedBy(Class<? extends ConstraintValidator<A, ?>> validator);",unrelated,unrelated,True,,0.0006519967573694885,0.999347984790802
3,"@Override public boolean validateObject( PooledObject<LdapConnection> connection ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04152_VALIDATING, connection ) ); } return validator.validate( connection.getObject() ); }",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9981310963630676,0.00186887476593256
4,"Schema schema = SchemaFactory.loadFromUrl(schemaUrl); Validator validator = schema.newValidator(); if (JAXP_15_SUPPORTED) { validator.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, """"); validator.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, """"); } XMLErrorAccumulatorHandler errorAcumulator = new XMLErrorAccumulatorHandler(); validator.setErrorHandler(errorAcumulator); Source xmlSource = new DOMSource(xmlDocument); validator.validate(xmlSource); final boolean isValid = !errorAcumulator.hasError();",input_validation,input_validation,True,,0.9981671571731567,0.0018328269943594933
5,"@Override public VerifiedJwt verifyMacAndDecode(String compact, JwtValidator validator) throws GeneralSecurityException { JwtFormat.Parts parts = JwtFormat.splitSignedCompact(compact); mac.verifyMac(parts.signatureOrMac, parts.unsignedCompact.getBytes(US_ASCII)); JsonObject parsedHeader = JsonUtil.parseJson(parts.header); JwtFormat.validateHeader( parsedHeader, jwtHmacKey.getParameters().getAlgorithm().getStandardName(), jwtHmacKey.getKid(), jwtHmacKey.getParameters().allowKidAbsent()); RawJwt token = RawJwt.fromJsonPayload(JwtFormat.getTypeHeader(parsedHeader), parts.payload); return validator.validate(token); }",unrelated,unrelated,True,,0.0005056970403529704,0.9994943141937256
6,"@Override public boolean isValid(Float value, ConstraintValidatorContext context) { if ( value == null ) { return true; } return NumberSignHelper.signum( value, InfinityNumberComparatorHelper.LESS_THAN ) > 0; }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0004919250495731831,0.9995080232620239
7,"@Documented @Constraint(validatedBy = { }) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Repeatable(List.class) @ReportAsSingleViolation @Pattern(regexp = """") public @interface URL { String message() default ""{org.hibernate.validator.constraints.URL.message}""; Class<?>[] groups() default { }; Class<? extends Payload>[] payload() default { };",input_validation,input_validation,True,,0.9980059266090393,0.0019940235652029514
8,"@SuppressWarnings(""Immutable"") static JwtPublicKeyVerify createFullPrimitive( com.google.crypto.tink.jwt.JwtRsaSsaPkcs1PublicKey publicKey) throws GeneralSecurityException { RsaSsaPkcs1PublicKey rsaSsaPkcs1PublicKey = toRsaSsaPkcs1PublicKey(publicKey); final PublicKeyVerify verifier = RsaSsaPkcs1VerifyJce.create(rsaSsaPkcs1PublicKey); return new JwtPublicKeyVerify() { @Override public VerifiedJwt verifyAndDecode(String compact, JwtValidator validator) throws GeneralSecurityException { JwtFormat.Parts parts = JwtFormat.splitSignedCompact(compact); verifier.verify(parts.signatureOrMac, parts.unsignedCompact.getBytes(US_ASCII)); JsonObject parsedHeader = JsonUtil.parseJson(parts.header); JwtFormat.validateHeader( parsedHeader, publicKey.getParameters().getAlgorithm().getStandardName(), publicKey.getKid(), publicKey.getParameters().allowKidAbsent()); RawJwt token = RawJwt.fromJsonPayload(JwtFormat.getTypeHeader(parsedHeader), parts.payload); return validator.validate(token); } }; }",unrelated,unrelated,True,,0.0004909495473839343,0.9995090961456299
9,"public CertPathBuilderResult engineBuild( CertPathParameters params) throws CertPathBuilderException, InvalidAlgorithmParameterException { if (!(params instanceof PKIXBuilderParameters)) { throw new InvalidAlgorithmParameterException(""params must be a PKIXBuilderParameters instance""); } PKIXBuilderParameters pkixParams = (PKIXBuilderParameters)params; Collection targets; Iterator targetIter; List certPathList = new ArrayList(); X509Certificate cert; Collection certs; CertPath certPath = null; Exception certPathException = null; CertSelector certSelect = pkixParams.getTargetCertConstraints(); if (certSelect == null) { throw new CertPathBuilderException(""targetCertConstraints must be non-null for CertPath building""); } try { targets = findCertificates(certSelect, pkixParams.getCertStores()); } catch (CertStoreException e) { throw new CertPathBuilderException(e); } if (targets.isEmpty()) { throw new CertPathBuilderException(""no certificate found matching targetCertContraints""); } CertificateFactory cFact; CertPathValidator validator; try { cFact = CertificateFactory.getInstance(""X.509"", ""BC""); validator = CertPathValidator.getInstance(""PKIX"", ""BC""); } catch (Exception e) { throw new CertPathBuilderException(""exception creating support classes: "" + e); } targetIter = targets.iterator(); while (targetIter.hasNext()) { cert = (X509Certificate)targetIter.next(); certPathList.clear(); while (cert != null) { certPathList.add(cert); if (findTrustAnchor(cert, pkixParams.getTrustAnchors()) != null) { try { certPath = cFact.generateCertPath(certPathList); PKIXCertPathValidatorResult result = (PKIXCertPathValidatorResult)validator.validate(certPath, pkixParams); return new PKIXCertPathBuilderResult(certPath, result.getTrustAnchor(), result.getPolicyTree(), result.getPublicKey()); } catch (CertificateException ex) { certPathException = ex; } catch (CertPathValidatorException ex) { certPathException = ex; } cert = null; } else { try { X509Certificate issuer = findIssuer(cert, pkixParams.getCertStores()); if (issuer.equals(cert)) { cert = null; } else { cert = issuer; } } catch (CertPathValidatorException ex) { certPathException = ex; cert = null; } } } } if (certPath != null) { throw new CertPathBuilderException(""found certificate chain, but could not be validated"", certPathException); } throw new CertPathBuilderException(""unable to find certificate chain""); }",unrelated,unrelated,True,,0.18511027097702026,0.8148897290229797
10,"@Message(id = 29, value = ""Constraint factory returned null when trying to create instance of %s."") ValidationException getConstraintValidatorFactoryMustNotReturnNullException(@FormatWith(ClassObjectFormatter.class) Class<? extends ConstraintValidator<?, ?>> validatorClass);",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9981630444526672,0.0018370068864896894
11,"package org.hibernate.validator.constraints.time; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.time.Duration; import jakarta.validation.Constraint; import jakarta.validation.Payload; import jakarta.validation.ReportAsSingleViolation; import org.hibernate.validator.Incubating; import org.hibernate.validator.constraints.time.DurationMax.List; @Documented @Constraint(validatedBy = { }) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Repeatable(List.class) @ReportAsSingleViolation @Incubating public @interface DurationMax { String message() default ""{org.hibernate.validator.constraints.time.DurationMax.message}""; Class<?>[] groups() default { }; Class<? extends Payload>[] payload() default { }; long days() default 0; long hours() default 0; long minutes() default 0; long seconds() default 0; long millis() default 0; long nanos() default 0; boolean inclusive() default true; @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Documented @interface List { DurationMax[] value(); } }",unrelated,unrelated,True,,0.0005134711391292512,0.9994864463806152
12,"@Override public boolean isValid(short[] array, ConstraintValidatorContext constraintValidatorContext) { if ( array == null ) { return false; } return array.length > 0; }",input_validation,input_validation,True,,0.996573805809021,0.0034262582194060087
13,"@Pattern.List({ @Pattern(regexp = ""([0-9]{3}\\.[0-9]{3}\\.[0-9]{3}-[0-9]{2})|([0-9]{11})""), @Pattern(regexp = ""^(?:(?!000\\.?000\\.?000-?00).)*$""), @Pattern(regexp = ""^(?:(?!111\\.?111\\.?111-?11).)*$""), @Pattern(regexp = ""^(?:(?!222\\.?222\\.?222-?22).)*$""), @Pattern(regexp = ""^(?:(?!333\\.?333\\.?333-?33).)*$""), @Pattern(regexp = ""^(?:(?!444\\.?444\\.?444-?44).)*$""), @Pattern(regexp = ""^(?:(?!555\\.?555\\.?555-?55).)*$""), @Pattern(regexp = ""^(?:(?!666\\.?666\\.?666-?66).)*$""), @Pattern(regexp = ""^(?:(?!777\\.?777\\.?777-?77).)*$""), @Pattern(regexp = ""^(?:(?!888\\.?888\\.?888-?88).)*$""), @Pattern(regexp = ""^(?:(?!999\\.?999\\.?999-?99).)*$"") }) @ReportAsSingleViolation @Documented @Constraint(validatedBy = { }) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Repeatable(List.class) public @interface CPF {",input_validation,input_validation,True,,0.9559425115585327,0.04405751824378967
14,"@Documented @Constraint(validatedBy = { }) @SupportedValidationTarget(ValidationTarget.ANNOTATED_ELEMENT) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Repeatable(List.class) @Min(0) @Max(Long.MAX_VALUE) @ReportAsSingleViolation public @interface Range { @OverridesAttribute(constraint = Min.class, name = ""value"") long min() default 0; @OverridesAttribute(constraint = Max.class, name = ""value"") long max() default Long.MAX_VALUE;",input_validation,input_validation,True,,0.9980757236480713,0.0019242805428802967
15,"package org.hibernate.validator.constraints.kor; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import static org.hibernate.validator.constraints.kor.KorRRN.ValidateCheckDigit.NEVER; import java.lang.annotation.Documented; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.Target; import jakarta.validation.Constraint; import jakarta.validation.Payload; import jakarta.validation.ReportAsSingleViolation; import org.hibernate.validator.Incubating; @Incubating @Documented @Constraint(validatedBy = { }) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Repeatable(KorRRN.List.class) @ReportAsSingleViolation public @interface KorRRN { String message() default ""{org.hibernate.validator.constraints.kor.KorRRN.message}""; Class<?>[] groups() default { }; Class<? extends Payload>[] payload() default { }; ValidateCheckDigit validateCheckDigit() default NEVER; enum ValidateCheckDigit { NEVER, ALWAYS } @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Documented @interface List { KorRRN[] value(); } }",unrelated,unrelated,True,,0.000503516523167491,0.9994964599609375
16,"private X509Certificate[] doValidate(X509Certificate[] chain, PKIXBuilderParameters params) throws CertificateException { try { setDate(params); CertPathValidator validator = CertPathValidator.getInstance(""PKIX""); CertPath path = factory.generateCertPath(Arrays.asList(chain)); certPathLength = chain.length; PKIXCertPathValidatorResult result = (PKIXCertPathValidatorResult)validator.validate(path, params); return toArray(path, result.getTrustAnchor()); } catch (GeneralSecurityException e) { throw new ValidatorException (""PKIX path validation failed: "" + e.toString(), e); } }",unrelated,unrelated,True,,0.0004907898255623877,0.9995092153549194
17,"@Override public boolean isValid(byte[] array, ConstraintValidatorContext constraintValidatorContext) { if ( array == null ) { return true; } return array.length > 0; }",input_validation,input_validation,True,,0.9959249496459961,0.004075124394148588
18,"@Override public boolean isValid(Map map, ConstraintValidatorContext constraintValidatorContext) { if ( map == null ) { return true; } int size = map.size(); return size >= min && size <= max; }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005930535844527185,0.9994069337844849
19,"@LogMessage(level = WARN) @Message(id = 271, value = ""Using `@Valid` on a container (%1$s) is deprecated. You should apply the annotation on the type argument(s). Affected element: %2$s"") void deprecatedUseOfValidOnContainer(@FormatWith(ClassObjectFormatter.class) Class<?> valueType, Object context);",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9980403780937195,0.001959622837603092
20,"@LogMessage(level = WARN) @Message(id = 272, value = ""Using `@Valid` on a container is deprecated. You should apply the annotation on the type argument(s). (%1$s) can potentially be a container at runtime. Affected element: %2$s"") void potentiallyDeprecatedUseOfValidOnContainer(@FormatWith(ClassObjectFormatter.class) Class<?> valueType, Object context);",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9980251789093018,0.0019748774357140064
21,"protected static CertPathValidatorResult processAttrCert2A( CertPath certPath, PKIXExtendedParameters pkixParams) throws CertPathValidatorException { CertPathValidator validator = null; try { validator = CertPathValidator.getInstance(""PKIX"", BouncyCastleProvider.PROVIDER_NAME); } catch (NoSuchProviderException e) { throw SecurityExceptions.certPathValidatorException( ""Support class could not be created."", e); } catch (NoSuchAlgorithmException e) { throw SecurityExceptions.certPathValidatorException( ""Support class could not be created."", e); } try { return validator.validate(certPath, pkixParams); } catch (CertPathValidatorException e) { throw SecurityExceptions.certPathValidatorException( ""Certification path for issuer certificate of attribute certificate could not be validated."", e); } catch (InvalidAlgorithmParameterException e) { throw new RuntimeException(e.getMessage()); } }",unrelated,unrelated,True,,0.0004973592585884035,0.9995026588439941
22,"@Override public boolean isValid(CharSequence value, ConstraintValidatorContext constraintValidatorContext) { if ( value == null ) { return true; } int length = value.length(); return length >= min && length <= max; }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.013626660220324993,0.9863733053207397
23,"private CertPathBuilderResult build(X509AttributeCertificate attrCert, X509Certificate tbvCert, PKIXExtendedBuilderParameters pkixParams, List tbvPath) { if (tbvPath.contains(tbvCert)) { return null; } if (pkixParams.getExcludedCerts().contains(tbvCert)) { return null; } if (pkixParams.getMaxPathLength() != -1) { if (tbvPath.size() - 1 > pkixParams.getMaxPathLength()) { return null; } } tbvPath.add(tbvCert); CertificateFactory cFact; CertPathValidator validator; CertPathBuilderResult builderResult = null; try { cFact = CertificateFactory.getInstance(""X.509"", BouncyCastleProvider.PROVIDER_NAME); validator = CertPathValidator.getInstance(""RFC3281"", BouncyCastleProvider.PROVIDER_NAME); } catch (Exception e) { throw new RuntimeException( ""Exception creating support classes.""); } try { PKIXExtendedParameters baseParams = pkixParams.getBaseParameters(); if (CertPathValidatorUtilities.isIssuerTrustAnchor(tbvCert, baseParams.getTrustAnchors(), baseParams.getSigProvider())) { CertPath certPath; try { certPath = cFact.generateCertPath(tbvPath); } catch (Exception e) { throw new AnnotatedException(""Certification path could not be constructed from certificate list."", e); } PKIXCertPathValidatorResult result; try { result = (PKIXCertPathValidatorResult)validator.validate(certPath, pkixParams); } catch (Exception e) { throw new AnnotatedException(""Certification path could not be validated."", e); } return new PKIXCertPathBuilderResult(certPath, result.getTrustAnchor(), result.getPolicyTree(), result.getPublicKey()); } else { List stores = new ArrayList(); stores.addAll(baseParams.getCertificateStores()); try { stores.addAll(CertPathValidatorUtilities.getAdditionalStoresFromAltNames( tbvCert.getExtensionValue(Extension.issuerAlternativeName.getId()), baseParams.getNamedCertificateStoreMap())); } catch (CertificateParsingException e) { throw new AnnotatedException(""No additional X.509 stores can be added from certificate locations."", e); } Collection issuers = new HashSet(); try { issuers.addAll(CertPathValidatorUtilities.findIssuerCerts(tbvCert, baseParams.getCertStores(), stores)); } catch (AnnotatedException e) { throw new AnnotatedException( ""Cannot find issuer certificate for certificate in certification path."", e); } if (issuers.isEmpty()) { throw new AnnotatedException( ""No issuer certificate for certificate in certification path found.""); } Iterator it = issuers.iterator(); while (it.hasNext() && builderResult == null) { X509Certificate issuer = (X509Certificate) it.next(); if (issuer.getIssuerX500Principal().equals(issuer.getSubjectX500Principal())) { continue; } builderResult = build(attrCert, issuer, pkixParams, tbvPath); } } } catch (AnnotatedException e) { certPathException = new AnnotatedException(""No valid certification path could be build."", e); } if (builderResult == null) { tbvPath.remove(tbvCert); } return builderResult; }",unrelated,unrelated,True,,0.00048371832235716283,0.9995162487030029
24,"@Documented @Constraint(validatedBy = { }) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Repeatable(List.class) @ReportAsSingleViolation @LuhnCheck public @interface CreditCardNumber { String message() default ""{org.hibernate.validator.constraints.CreditCardNumber.message}""; Class<?>[] groups() default { }; Class<? extends Payload>[] payload() default { };",input_validation,input_validation,True,,0.9977018237113953,0.002298132749274373
25,"@Documented @Constraint(validatedBy = { }) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Repeatable(List.class) @ReportAsSingleViolation @Mod10Check public @interface EAN { String message() default ""{org.hibernate.validator.constraints.EAN.message}""; Class<?>[] groups() default { }; Class<? extends Payload>[] payload() default { }; Type type() default Type.EAN13;",input_validation,input_validation,True,,0.9967074394226074,0.0032925631385296583
26,"@Override public boolean isValid(boolean[] array, ConstraintValidatorContext constraintValidatorContext) { if ( array == null ) { return true; } return array.length > 0; }",input_validation,input_validation,True,,0.9977820515632629,0.0022179160732775927
27,"@Pattern(regexp = ""[0-9]{12}"") @Mod11Check.List({ @Mod11Check(threshold = 9, endIndex = 7, checkDigitIndex = 10, treatCheck10As = '0'), @Mod11Check(threshold = 9, startIndex = 8, endIndex = 10, checkDigitIndex = 11, treatCheck10As = '0') }) @ReportAsSingleViolation @Documented @Constraint(validatedBy = { }) @SupportedValidationTarget(ValidationTarget.ANNOTATED_ELEMENT) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Repeatable(List.class) public @interface TituloEleitoral {",input_validation,input_validation,True,,0.9981470108032227,0.0018529905937612057
28,"@SuppressWarnings(""Immutable"") static JwtPublicKeyVerify createFullPrimitive(JwtRsaSsaPssPublicKey publicKey) throws GeneralSecurityException { RsaSsaPssPublicKey rsaSsaPssPublicKey = toRsaSsaPssPublicKey(publicKey); final PublicKeyVerify verifier = RsaSsaPssVerifyJce.create(rsaSsaPssPublicKey); return new JwtPublicKeyVerify() { @Override public VerifiedJwt verifyAndDecode(String compact, JwtValidator validator) throws GeneralSecurityException { JwtFormat.Parts parts = JwtFormat.splitSignedCompact(compact); verifier.verify(parts.signatureOrMac, parts.unsignedCompact.getBytes(US_ASCII)); JsonObject parsedHeader = JsonUtil.parseJson(parts.header); JwtFormat.validateHeader( parsedHeader, publicKey.getParameters().getAlgorithm().getStandardName(), publicKey.getKid(), publicKey.getParameters().allowKidAbsent()); RawJwt token = RawJwt.fromJsonPayload(JwtFormat.getTypeHeader(parsedHeader), parts.payload); return validator.validate(token); } }; }",unrelated,unrelated,True,,0.0004904692759737372,0.9995095729827881
29,@Override public boolean equals(Object obj) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } AbstractConstraintMetaData other = (AbstractConstraintMetaData) obj; if ( name == null ) { if ( other.name != null ) { return false; } } else if ( !name.equals( other.name ) ) { return false; } return true; },unrelated,unrelated,True,,0.0004888267139904201,0.9995111227035522
30,"JDKDSAPublicKey( SubjectPublicKeyInfo info) { ASN1Integer derY; try { derY = (ASN1Integer)info.parsePublicKey(); } catch (IOException e) { throw new IllegalArgumentException(""invalid info structure in DSA public key""); } this.y = derY.getValue(); if (isNotNull(info.getAlgorithm().getParameters())) { DSAParameter params = DSAParameter.getInstance(info.getAlgorithm().getParameters()); this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG()); } }",unrelated,unrelated,True,,0.00047139229718595743,0.9995286464691162
31,"else if (oid.equals(C) || oid.equals(SERIALNUMBER) || oid.equals(DN_QUALIFIER) || oid.equals(TELEPHONE_NUMBER) || oid.equals(JURISDICTION_C)) { if ((oid.equals(C) || oid.equals(JURISDICTION_C)) && value.length() != 2) { throw new IllegalArgumentException(""country code attribute "" + oid.getId() + "" must be exactly 2 characters per ISO 3166-1 / X.520, got "" + value.length() + "": '"" + value + ""'""); } return new DERPrintableString(value); }",input_validation,input_validation,True,,0.9981619715690613,0.001838048454374075
32,"KEM.Encapsulated encapsulate(String algorithm, SecureRandom random) throws IOException { SecretKey sharedSecret = null; if (keyshare == null) { throw new IOException(""No keyshare available for KEM "" + ""encapsulation""); } try { KeyFactory kf = (provider != null) ? KeyFactory.getInstance(algorithmName, provider) : KeyFactory.getInstance(algorithmName); PublicKey pk; try { pk = (PublicKey) kf.translateKey( KeyUtil.newRawPublicKey(algorithmName, keyshare)); } catch (InvalidKeyException e) { try { pk = kf.generatePublic(new X509EncodedKeySpec( KeyUtil.rawToX509(algorithmName, keyshare))); } catch (GeneralSecurityException e2) { e2.addSuppressed(e); throw new InvalidKeyException(e2); } } KEM kem = (provider != null) ? KEM.getInstance(algorithmName, provider) : KEM.getInstance(algorithmName); KEM.Encapsulator e = kem.newEncapsulator(pk, random); KEM.Encapsulated enc = e.encapsulate(); sharedSecret = enc.key(); SecretKey derived = deriveHandshakeSecret(algorithm, sharedSecret); return new KEM.Encapsulated(derived, enc.encapsulation(), null); } catch (IllegalArgumentException | InvalidKeyException e) { throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER, e); } catch (GeneralSecurityException e) { throw context.conContext.fatal(Alert.INTERNAL_ERROR, e); } catch (RuntimeException e) { throw context.conContext.fatal(Alert.INTERNAL_ERROR, e); } finally { KeyUtil.destroySecretKeys(sharedSecret); } }",unrelated,unrelated,True,,0.0004953975440002978,0.999504566192627
33,"public void init(boolean forEncryption, CipherParameters params) throws IllegalArgumentException { this.initialised = true; if (params instanceof ParametersWithIV) { ParametersWithIV ivParam = (ParametersWithIV)params; byte[] iv = ivParam.getIV(); int diff = this.iv.length - iv.length; Arrays.fill(this.iv, (byte)0); System.arraycopy(iv, 0, this.iv, diff, iv.length); params = ivParam.getParameters(); } else { throw new IllegalArgumentException(""invalid parameter passed""); } if (params != null) { engine.init(true, params); } reset(); }",unrelated,unrelated,True,,0.00048497228999622166,0.9995150566101074
34,"@Override public void terminateRequest(final ClassicHttpRequest request) throws HttpException, IOException { Args.notNull(request, ""HTTP request""); final SocketHolder socketHolder = ensureOpen(); final HttpEntity entity = request.getEntity(); if (entity == null) { return; } final Iterator<String> it = MessageSupport.iterateTokens(request, HttpHeaders.CONNECTION); while (it.hasNext()) { final String token = it.next(); if (HeaderElements.CLOSE.equalsIgnoreCase(token)) { this.consistent = false; return; } } final long len = this.outgoingContentStrategy.determineLength(request); if (len == ContentLengthStrategy.CHUNKED) { try (final OutputStream outStream = createContentOutputStream(len, this.outbuffer, socketHolder.getOutputStream(), entity.getTrailers())) { } } else if (len >= 0 && len <= 1024) { try (final OutputStream outStream = createContentOutputStream(len, this.outbuffer, socketHolder.getOutputStream(), null)) { entity.writeTo(outStream); } } else { this.consistent = false; } }",unrelated,unrelated,True,,0.00048589889775030315,0.999514102935791
35,"if (!ASN1RelativeOID.isValidContents(contents, contentsLength)) { throw new IllegalArgumentException(""invalid OID contents""); }",input_validation,input_validation,True,,0.9981335997581482,0.0018664669478312135
36,@Override public void removeDataSourceListener(UIDataSourceListener l) { class_mon.enter(); try { if (listDSListeners == null) { return; } listDSListeners.remove(l); } finally { class_mon.exit(); } },unrelated,unrelated,True,,0.00048812085879035294,0.9995118379592896
37,"public PKMACBuilder setIterationCount(int iterationCount) { if (iterationCount < 100) { throw new IllegalArgumentException(""iteration count must be at least 100""); } checkIterationCountCeiling(iterationCount); this.iterationCount = iterationCount; return this; }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0004844584909733385,0.9995155334472656
38,"public static IESParameterSpec guessParameterSpec(BufferedBlockCipher iesBlockCipher, byte[] nonce) { if (iesBlockCipher == null) { return new IESParameterSpec(null, null, 128); } else { BlockCipher underlyingCipher = iesBlockCipher.getUnderlyingCipher(); if (underlyingCipher.getAlgorithmName().equals(""DES"") || underlyingCipher.getAlgorithmName().equals(""RC2"") || underlyingCipher.getAlgorithmName().equals(""RC5-32"") || underlyingCipher.getAlgorithmName().equals(""RC5-64"")) { return new IESParameterSpec(null, null, 64, 64, nonce); } else if (underlyingCipher.getAlgorithmName().equals(""SKIPJACK"")) { return new IESParameterSpec(null, null, 80, 80, nonce); } else if (underlyingCipher.getAlgorithmName().equals(""GOST28147"")) { return new IESParameterSpec(null, null, 256, 256, nonce); } return new IESParameterSpec(null, null, 128, 128, nonce); } }",unrelated,unrelated,True,,0.0004790181992575526,0.999521017074585
39,"public NetscapeCertRequest (ASN1Sequence spkac) { try { if (spkac.size() != 3) { throw new IllegalArgumentException(""invalid SPKAC (size):"" + spkac.size()); }",input_validation,input_validation,True,,0.9980296492576599,0.001970341196283698
40,"public static byte[] random(int numBytes) { if (numBytes <= 0) { throw new IllegalArgumentException(""numBytes argument must be >= 0""); } byte[] bytes = new byte[numBytes]; Randoms.secureRandom().nextBytes(bytes); return bytes; }",unrelated,unrelated,True,,0.0004978724755346775,0.9995020627975464
41,"while (label.startsWith(""/"") && label.length() > 0) { label = label.substring(1); } if (label.length() == 0) { throw new IllegalArgumentException(""Label set but after trimming '/' is not zero length string.""); } if (!pathInValid.matcher(label).matches()) { throw new IllegalArgumentException(""Server path "" + label + "" contains invalid characters""); }",input_validation,input_validation,True,,0.9981631636619568,0.0018368688179180026
42,public boolean supportsExtension( String extension_name ) { if (extension_map == null) {return false;} Number num = (Number)this.extension_map.get( extension_name ); return( num != null && num.intValue() != 0 ); },unrelated,unrelated,True,,0.016451720148324966,0.9835483431816101
43,public DHTPluginValue getLocalValue( byte[] key ) { final DHTTransportValue val = dht.getLocalValue( key ); if ( val == null ){ return( null ); } return( mapValue( val )); },unrelated,unrelated,True,,0.00048763814265839756,0.9995123147964478
44,"public OCSPReq build( ContentSigner signer, X509CertificateHolder[] chain) throws OCSPException, IllegalArgumentException { if (signer == null) { throw new IllegalArgumentException(""no signer specified""); } return generateRequest(signer, chain); }",unrelated,unrelated,True,,0.0004788193618878722,0.9995211362838745
45,"public MayoPrivateKeyParameters(MayoParameters params, byte[] seed_sk) { super(true, params); if (seed_sk.length != params.getCskBytes()) { throw new IllegalArgumentException(""'seed_sk' has invalid length""); } this.seed_sk = Arrays.clone(seed_sk); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0004936579498462379,0.9995063543319702
46,"public static ASN1BMPString getInstance(Object obj) { if (obj == null || obj instanceof ASN1BMPString) { return (ASN1BMPString)obj; } if (obj instanceof ASN1Encodable) { ASN1Primitive primitive = ((ASN1Encodable)obj).toASN1Primitive(); if (primitive instanceof ASN1BMPString) { return (ASN1BMPString)primitive; } } if (obj instanceof byte[]) { try { return (ASN1BMPString)TYPE.fromByteArray((byte[])obj); } catch (Exception e) { throw new IllegalArgumentException(""encoding error in getInstance: "" + e.toString()); } } throw new IllegalArgumentException(""illegal object in getInstance: "" + obj.getClass().getName()); }",unrelated,unrelated,True,,0.000488808611407876,0.9995112419128418
47,"public static boolean mkdirs( File f) { if (Constants.isOSX) { Pattern pat = Pattern.compile(""^(/Volumes/[^/]+)""); Matcher matcher = pat.matcher(f.getParent()); if (matcher.find()) { String sVolume = matcher.group(); File fVolume = newFile(sVolume); if (!fVolume.isDirectory()) { Logger.log(new LogEvent(LOGID, LogEvent.LT_WARNING, sVolume + "" is not mounted or not available."")); return false; } } } return f.mkdirs(); }",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9981462955474854,0.0018537157448008657
48,"static ASN1ObjectIdentifier getDigestOID(String alg) { ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)forMic.get(Strings.toLowerCase(alg)); if (oid == null) { throw new IllegalArgumentException(""unknown micalg passed: "" + alg); } return oid; }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005577669362537563,0.9994422793388367
49,"if (initial) { int num = buffer.getInt(); if ((num < 0) || (num > SshConstants.SSH_REQUIRED_PAYLOAD_PACKET_LENGTH_SUPPORT)) { log.error(""doAuth({}@{}) Illogical OID entries count: {}"", user, session, num); throw new IndexOutOfBoundsException(""Illogical OID entries count: "" + num); }",input_validation,input_validation,True,,0.9980463981628418,0.0019535329192876816
50,"public AttributeBuilder matching(final Pattern pattern) { return matching(new AttributePolicy() { public @Nullable String apply( String elementName, String attributeName, String value) { return pattern.matcher(value).matches() ? value : null; } }); }",input_validation,input_validation,True,,0.9981416463851929,0.001858384464867413
51,"public static Time getInstance( ASN1TaggedObject obj, boolean explicit) { if (!explicit) { throw new IllegalArgumentException(""choice item must be explicitly tagged""); } return getInstance(obj.getExplicitBaseObject()); }",unrelated,unrelated,True,,0.0004929681308567524,0.9995070695877075
52,"private void pickFile(String title, JTextField field) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(new FileNameExtensionFilter(Res.getString(""file.type.sound""), ""wav"")); if (Spark.isWindows()) { fc.setFileSystemView(new WindowsFileSystemView()); } fc.setDialogTitle(title); if (!field.getText().isEmpty()) { fc.setSelectedFile(new File(field.getText())); } if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); try { field.setText(file.getCanonicalPath()); } catch (IOException e) { Log.error(e); } } }",unrelated,unrelated,True,,0.0010315071558579803,0.9989684820175171
53,"public static JsonObject readJson(String path) throws Exception { String filePath = path; if (TestUtil.isAndroid()) { filePath = ""/sdcard/googletest/test_runfiles/google3/"" + path; } JsonObject result; try (FileInputStream fileInputStream = new FileInputStream(new File(filePath))) { result = JsonParser.parseString(new String(readAll(fileInputStream), UTF_8)).getAsJsonObject(); } String algorithm = result.get(""algorithm"").getAsString(); String generatorVersion = result.get(""generatorVersion"").getAsString(); int numTests = result.get(""numberOfTests"").getAsInt(); System.out.println( String.format( ""Read from %s total %d test cases for algorithm %s with generator version %s"", path, numTests, algorithm, generatorVersion)); return result; }",unrelated,unrelated,True,,0.000853022444061935,0.9991469383239746
54,"String[] parseArgs(String[] args) throws Exception { int i; boolean help = args.length == 0; String confFile = null; Set<String> optionsSet = new HashSet<>(); for (i=0; i < args.length; i++) { String flags = args[i]; if (flags.startsWith(""-"")) { String lowerFlags = flags.toLowerCase(Locale.ROOT); if (optionsSet.contains(lowerFlags)) { switch (lowerFlags) { case ""-ext"": case ""-id"": case ""-provider"": case ""-addprovider"": case ""-providerclass"": case ""-providerarg"": break; default: weakWarnings.add(String.format( rb.getString(""option.1.set.twice""), lowerFlags)); } } else { optionsSet.add(lowerFlags); } if (collator.compare(flags, ""-conf"") == 0) { if (i == args.length - 1) { errorNeedArgument(flags); } confFile = args[++i]; } else { Command c = Command.getCommand(flags); if (c != null) { if (command == null) { command = c; } else { throw new Exception(String.format( rb.getString(""multiple.commands.1.2""), command.name, c.name)); } } } } } if (confFile != null && command != null) { args = KeyStoreUtil.expandArgs(""keytool"", confFile, command.toString(), command.getAltName(), args); } debug = Arrays.stream(args).anyMatch( x -> collator.compare(x, ""-debug"") == 0); if (debug) { System.out.println(""Command line args: "" + Arrays.toString(args)); } for (i=0; (i < args.length) && args[i].startsWith(""-""); i++) { String flags = args[i]; if (i == args.length - 1) { for (Option option: Option.values()) { if (collator.compare(flags, option.toString()) == 0) { if (option.arg != null) errorNeedArgument(flags); break; } } } String modifier = null; int pos = flags.indexOf(':'); if (pos > 0) { modifier = flags.substring(pos+1); flags = flags.substring(0, pos); } Command c = Command.getCommand(flags); if (c != null) { command = c; } else if (collator.compare(flags, ""--help"") == 0 || collator.compare(flags, ""-h"") == 0 || collator.compare(flags, ""-?"") == 0 || collator.compare(flags, ""-help"") == 0) { help = true; } else if (collator.compare(flags, ""-conf"") == 0) { i++; } else if (collator.compare(flags, ""-nowarn"") == 0) { nowarn = true; } else if (collator.compare(flags, ""-keystore"") == 0) { ksfname = args[++i]; if (new File(ksfname).getCanonicalPath().equals( new File(KeyStoreUtil.getCacerts()).getCanonicalPath())) { System.err.println(rb.getString(""warning.cacerts.option"")); } } else if (collator.compare(flags, ""-destkeystore"") == 0) { ksfname = args[++i]; } else if (collator.compare(flags, ""-cacerts"") == 0) { cacerts = true; } else if (collator.compare(flags, ""-storepass"") == 0 || collator.compare(flags, ""-deststorepass"") == 0) { storePass = getPass(modifier, args[++i]); passwords.add(storePass); } else if (collator.compare(flags, ""-storetype"") == 0 || collator.compare(flags, ""-deststoretype"") == 0) { storetype = KeyStoreUtil.niceStoreTypeName(args[++i]); } else if (collator.compare(flags, ""-srcstorepass"") == 0) { srcstorePass = getPass(modifier, args[++i]); passwords.add(srcstorePass); } else if (collator.compare(flags, ""-srcstoretype"") == 0) { srcstoretype = KeyStoreUtil.niceStoreTypeName(args[++i]); } else if (collator.compare(flags, ""-srckeypass"") == 0) { srckeyPass = getPass(modifier, args[++i]); passwords.add(srckeyPass); } else if (collator.compare(flags, ""-srcprovidername"") == 0) { srcProviderName = args[++i]; } else if (collator.compare(flags, ""-providername"") == 0 || collator.compare(flags, ""-destprovidername"") == 0) { providerName = args[++i]; } else if (collator.compare(flags, ""-providerpath"") == 0) { pathlist = args[++i]; } else if (collator.compare(flags, ""-keypass"") == 0) { keyPass = getPass(modifier, args[++i]); passwords.add(keyPass); } else if (collator.compare(flags, ""-new"") == 0) { newPass = getPass(modifier, args[++i]); passwords.add(newPass); } else if (collator.compare(flags, ""-destkeypass"") == 0) { destKeyPass = getPass(modifier, args[++i]); passwords.add(destKeyPass); } else if (collator.compare(flags, ""-alias"") == 0 || collator.compare(flags, ""-srcalias"") == 0) { alias = args[++i]; } else if (collator.compare(flags, ""-dest"") == 0 || collator.compare(flags, ""-destalias"") == 0) { dest = args[++i]; } else if (collator.compare(flags, ""-dname"") == 0) { dname = args[++i]; } else if (collator.compare(flags, ""-keysize"") == 0) { keysize = Integer.parseInt(args[++i]); } else if (collator.compare(flags, ""-groupname"") == 0) { groupName = args[++i]; } else if (collator.compare(flags, ""-keyalg"") == 0) { keyAlgName = args[++i]; } else if (collator.compare(flags, ""-sigalg"") == 0) { sigAlgName = args[++i]; } else if (collator.compare(flags, ""-signer"") == 0) { signerAlias = args[++i]; } else if (collator.compare(flags, ""-signerkeypass"") == 0) { signerKeyPass = getPass(modifier, args[++i]); passwords.add(signerKeyPass); } else if (collator.compare(flags, ""-startdate"") == 0) { startDate = args[++i]; } else if (collator.compare(flags, ""-validity"") == 0) { validity = Long.parseLong(args[++i]); } else if (collator.compare(flags, ""-ext"") == 0) { v3ext.add(args[++i]); } else if (collator.compare(flags, ""-id"") == 0) { ids.add(args[++i]); } else if (collator.compare(flags, ""-file"") == 0) { filename = args[++i]; } else if (collator.compare(flags, ""-infile"") == 0) { infilename = args[++i]; } else if (collator.compare(flags, ""-outfile"") == 0) { outfilename = args[++i]; } else if (collator.compare(flags, ""-sslserver"") == 0) { sslserver = args[++i]; } else if (collator.compare(flags, ""-jarfile"") == 0) { jarfile = args[++i]; } else if (collator.compare(flags, ""-srckeystore"") == 0) { srcksfname = args[++i]; } else if (collator.compare(flags, ""-provider"") == 0 || collator.compare(flags, ""-providerclass"") == 0) { if (providerClasses == null) { providerClasses = new HashSet<>(3); } String providerClass = args[++i]; String providerArg = null; if (args.length > (i+1)) { flags = args[i+1]; if (collator.compare(flags, ""-providerarg"") == 0) { if (args.length == (i+2)) errorNeedArgument(flags); providerArg = args[i+2]; i += 2; } } providerClasses.add( Pair.of(providerClass, providerArg)); } else if (collator.compare(flags, ""-addprovider"") == 0) { if (providers == null) { providers = new HashSet<>(3); } String provider = args[++i]; String providerArg = null; if (args.length > (i+1)) { flags = args[i+1]; if (collator.compare(flags, ""-providerarg"") == 0) { if (args.length == (i+2)) errorNeedArgument(flags); providerArg = args[i+2]; i += 2; } } providers.add( Pair.of(provider, providerArg)); } else if (collator.compare(flags, ""-v"") == 0) { verbose = true; } else if (collator.compare(flags, ""-debug"") == 0) { } else if (collator.compare(flags, ""-rfc"") == 0) { rfc = true; } else if (collator.compare(flags, ""-noprompt"") == 0) { noprompt = true; } else if (collator.compare(flags, ""-trustcacerts"") == 0) { trustcacerts = true; } else if (collator.compare(flags, ""-protected"") == 0 || collator.compare(flags, ""-destprotected"") == 0) { protectedPath = true; } else if (collator.compare(flags, ""-srcprotected"") == 0) { srcprotectedPath = true; } else if (collator.compare(flags, ""-tls"") == 0) { tlsInfo = true; } else { System.err.println(rb.getString(""Illegal.option."") + flags); tinyHelp(); } } if (i<args.length) { System.err.println(rb.getString(""Illegal.option."") + args[i]); tinyHelp(); } if (command == null) { if (help) { usage(); } else { System.err.println(rb.getString(""Usage.error.no.command.provided"")); tinyHelp(); } } else if (help) { usage(); command = null; } return args; }",unrelated,unrelated,True,,0.0004897821927443147,0.9995101690292358
55,"for (int i = 0; i < headers.size(); i++) { final Header header = headers.get(i); final String name = header.getName(); final String value = header.getValue(); if (name.startsWith("":"")) { if (!FieldValidationSupport.isNameLowerCaseValid(name, 1, name.length())) { throw new ProtocolException(""Header name '%s' is invalid"", name); } if (!messageHeaders.isEmpty()) { throw new ProtocolException(""Invalid sequence of headers (pseudo-headers must precede message headers)""); }",input_validation,input_validation,True,,0.9981753826141357,0.0018246659310534596
56,"protected void doChecks() { if (!initialized) { throw new IllegalStateException(""Object not initialized. Call init() first.""); } if (notifications == null) { notifications = new List[n+1]; errors = new List[n+1]; for (int i = 0; i < notifications.length; i++) { notifications[i] = new ArrayList(); errors[i] = new ArrayList(); } checkSignatures(); checkNameConstraints(); checkPathLength(); checkPolicy(); checkCriticalExtensions(); } }",unrelated,unrelated,True,,0.0005000823875889182,0.9994999170303345
57,@Override public SftpPath toRealPath(LinkOption... options) throws IOException { SftpPath absolute = toAbsolutePath(); FileSystem fs = getFileSystem(); FileSystemProvider provider = fs.provider(); provider.checkAccess(absolute); return absolute; },unrelated,unrelated,True,,0.00048050720943138003,0.9995194673538208
58,"private void validatePathPseudoHeader(final String method, final String scheme, final String path) throws ProtocolException { if (URIScheme.HTTP.name().equalsIgnoreCase(scheme) || URIScheme.HTTPS.name().equalsIgnoreCase(scheme)) { if (TextUtils.isBlank(path)) { throw new ProtocolException(""':path' pseudo-header field must not be empty for 'http' or 'https' URIs""); } else { final boolean isRoot = path.startsWith(""/""); if (Method.OPTIONS.isSame(method)) { if (!""*"".equals(path) && !isRoot) { throw new ProtocolException(""OPTIONS request for an 'http' or 'https' URI must have a ':path' pseudo-header field with a value of '*' or '/'""); } } else { if (!isRoot) { throw new ProtocolException(""':path' pseudo-header field for 'http' or 'https' URIs must start with '/'""); } } } } }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.1332388073205948,0.8667611479759216
59,@Override public String getCanonicalPathSafe(File file) { try{ if (file instanceof FileHack) { return file.getCanonicalPath(); } }catch( Throwable e ){ return( file.getAbsolutePath()); } return super.getCanonicalPathSafe(file); },unrelated,unrelated,True,,0.0005166993360035121,0.9994832277297974
60,"if (dnsName.contains(""*"")) { int wildIndex = dnsName.indexOf('*'); if (wildIndex != dnsName.lastIndexOf('*') || wildIndex != 0 || dnsName.length() < 2 || dnsName.charAt(1) != '.' || dnsName.contains("".."")) { return false; }",input_validation,input_validation,True,,0.9981691837310791,0.0018307971768081188
61,"private int processDir( TOTorrentFileHasher hasher, File dir, List<TOTorrentFileImpl> encoded, String base_name, String root, long[] torrent_offset ) throws TOTorrentException { File[] dir_file_list = dir.listFiles(); if ( dir_file_list == null ){ throw( new TOTorrentException( ""Directory '"" + dir.getAbsolutePath() + ""' returned error when listing files in it"", TOTorrentException.RT_FILE_NOT_FOUND )); } List<File> file_list = new ArrayList<>(Arrays.asList(dir_file_list)); if ( add_v2 ){ Collections.sort( file_list, file_comparator_v2 ); }else if ( file_comparator == null ){ Collections.sort(file_list); }else{ Collections.sort( file_list,file_comparator); } int ignored = 0; for (int i=0;i<file_list.size();i++){ File file = (File)file_list.get(i); String file_name = file.getName(); if ( !(file_name.equals( ""."" ) || file_name.equals( "".."" ))){ if ( file.isDirectory()){ if ( root.length() > 0 ){ file_name = root + File.separator + file_name ; } ignored += processDir( hasher, file, encoded, base_name, file_name, torrent_offset ); }else{ if ( ignoreFile( file_name )){ ignored++; }else{ if ( add_pad_files ){ long offset = torrent_offset[0]; long l = offset%piece_length; if ( l > 0 ){ long pad_size = piece_length - l; hasher.addPad((int)pad_size); String pad_file = "".pad"" + File.separator + (++pad_file_num) + ""_"" + pad_size; pad_file_sizes += pad_size; TOTorrentFileImpl tf = new TOTorrentFileImpl( this, i, torrent_offset[0], pad_size, pad_file ); tf.setAdditionalProperty( TOTorrentImpl.TK_BEP47_ATTRS, ""p"".getBytes( Constants.UTF_8 )); torrent_offset[0] += pad_size; encoded.add( tf ); } } if ( root.length() > 0 ){ file_name = root + File.separator + file_name; } File link = linkage_map.get( base_name + File.separator + file_name ); if ( link != null ){ linked_tf_map.put( String.valueOf( encoded.size()), link.getAbsolutePath()); } long length = hasher.add( link==null?file:link ); TOTorrentFileImpl tf = new TOTorrentFileImpl( this, i, torrent_offset[0], length, file_name ); torrent_offset[0] += length; if ( add_other_hashes ){ byte[] ed2k_digest = hasher.getPerFileED2KDigest(); byte[] sha1_digest = hasher.getPerFileSHA1Digest(); tf.setAdditionalProperty( ""sha1"", sha1_digest ); tf.setAdditionalProperty( ""ed2k"", ed2k_digest ); } encoded.add( tf ); } } } } return( ignored ); }",unrelated,unrelated,True,,0.0004796453285962343,0.9995204210281372
62,"@Override public TranscodeProviderJob transcode( final TranscodeProviderAdapter _adapter, TranscodeProviderAnalysis analysis, boolean direct_input, DiskManagerFileInfo input, TranscodeProfile profile, URL output ) throws TranscodeException { try{ PluginInterface av_pi = plugin_interface.getPluginManager().getPluginInterfaceByID( ""azupnpav"" ); if ( av_pi == null ){ throw( new TranscodeException( ""Media Server plugin not found"" )); } final TranscodeProviderJob[] xcode_job = { null }; URL source_url = null; TranscodePipe pipe = null; if ( direct_input ){ if ( input instanceof DiskManagerFileInfoURL ){ ((DiskManagerFileInfoURL)input).download(); } if ( input.getDownloaded() == input.getLength()){ File file = input.getFile(); if ( file.exists() && file.length() == input.getLength()){ source_url = file.toURI().toURL(); } } if ( source_url == null ){ manager.log( ""Failed to use direct input as source file doesn't exist/incomplete"" ); } } if ( source_url == null ){ if ( input instanceof DiskManagerFileInfoURL ){ source_url = ((DiskManagerFileInfoURL)input).getURL(); }else{ IPCInterface av_ipc = av_pi.getIPC(); String url_str = (String)av_ipc.invoke( ""getContentURL"", new Object[]{ input }); if ( url_str == null || url_str.length() == 0 ){ File source_file = input.getFile(); if ( source_file.exists()){ pipe = new TranscodePipeFileSource( source_file, new TranscodePipe.errorListener() { @Override public void error( Throwable e ) { _adapter.failed( new TranscodeException( ""File access error"", e )); if ( xcode_job[0] != null ){ xcode_job[0].cancel(); } } }); source_url = new URL( ""http://127.0.0.1:"" + pipe.getPort() + ""/"" ); }else{ throw( new TranscodeException( ""Source file doesn't exist"" )); } }else{ source_url = new URL( url_str ); pipe = new TranscodePipeStreamSource( source_url.getHost(), source_url.getPort()); source_url = UrlUtils.setHost( source_url, ""127.0.0.1"" ); source_url = UrlUtils.setPort( source_url, pipe.getPort()); } } } final TranscodePipe f_pipe = pipe; try{ final IPCInterface ipc = plugin_interface.getIPC(); final Object context; final TranscodeProviderAdapter adapter; if ( output.getProtocol().equals( ""tcp"" )){ adapter = _adapter; context = ipc.invoke( ""transcodeToTCP"", new Object[]{ ((TranscodeProviderAnalysisImpl)analysis).getResult(), source_url, profile.getName(), output.getPort() }); }else{ final File file = new File( output.toURI()); File parent_dir = file.getParentFile(); if ( parent_dir.exists()){ if ( !parent_dir.canWrite()){ throw( new TranscodeException( ""Folder '"" + parent_dir.getAbsolutePath() + ""' isn't writable"" )); } }else{ if ( !parent_dir.mkdirs()){ throw( new TranscodeException( ""Failed to create folder '"" + parent_dir.getAbsolutePath() + ""'"" )); } } adapter = new TranscodeProviderAdapter() { @Override public void updateProgress( int percent, int eta_secs, int width, int height ) { _adapter.updateProgress( percent, eta_secs, width, height ); } @Override public void streamStats( long connect_rate, long write_speed ) { _adapter.streamStats(connect_rate, write_speed); } @Override public void failed( TranscodeException error ) { try{ file.delete(); }finally{ _adapter.failed( error ); } } @Override public void complete() { _adapter.complete(); } }; context = ipc.invoke( ""transcodeToFile"", new Object[]{ ((TranscodeProviderAnalysisImpl)analysis).getResult(), source_url, profile.getName(), file }); } new AEThread2( ""xcodeStatus"", true ) { @Override public void run() { try{ boolean in_progress = true; while( in_progress ){ in_progress = false; if ( f_pipe != null ){ adapter.streamStats( f_pipe.getConnectionRate(), f_pipe.getWriteSpeed()); } try{ Map status = (Map)ipc.invoke( ""getTranscodeStatus"", new Object[]{ context }); long state = (Long)status.get( ""state"" ); if ( state == 0 ){ int percent = (Integer)status.get( ""percent"" ); Integer i_eta = (Integer)status.get( ""eta_secs"" ); int eta = i_eta==null?-1:i_eta; Integer i_width = (Integer)status.get( ""new_width"" ); int width = i_width==null?0:i_width; Integer i_height = (Integer)status.get( ""new_height"" ); int height = i_height==null?0:i_height; adapter.updateProgress( percent, eta, width, height ); if ( percent == 100 ){ adapter.complete(); }else{ in_progress = true; Thread.sleep(1000); } }else if ( state == 1 ){ adapter.failed( new TranscodeException( ""Transcode cancelled"" )); }else{ Boolean perm_fail = (Boolean)status.get( ""error_is_perm"" ); TranscodeException error = new TranscodeException( ""Transcode failed"", (Throwable)status.get( ""error"" )); if ( perm_fail != null && perm_fail ){ error.setDisableRetry( true ); } adapter.failed( error ); } }catch( Throwable e ){ adapter.failed( new TranscodeException( ""Failed to get status"", e )); } } }finally{ if ( f_pipe != null ){ f_pipe.destroy(); } } } }.start(); xcode_job[0] = new TranscodeProviderJob() { @Override public void pause() { if ( f_pipe != null ){ f_pipe.pause(); } } @Override public void resume() { if ( f_pipe != null ){ f_pipe.resume(); } } @Override public void cancel() { try{ ipc.invoke( ""cancelTranscode"", new Object[]{ context }); }catch( Throwable e ){ Debug.printStackTrace( e ); } } @Override public void setMaxBytesPerSecond( int max ) { if ( f_pipe != null ){ f_pipe.setMaxBytesPerSecond( max ); } } }; return( xcode_job[0] ); }catch( Throwable e ){ if ( pipe != null ){ pipe.destroy(); } throw( e ); } }catch( TranscodeException e ){ throw( e ); }catch( Throwable e ){ throw( new TranscodeException( ""transcode failed"", e )); } }",unrelated,unrelated,True,,0.0005015955539420247,0.9994983673095703
63,"private void checkPathLength() { int maxPathLength = n; int totalPathLength = 0; X509Certificate cert = null; int i; for (int index = certs.size() - 1; index > 0; index--) { i = n - index; cert = (X509Certificate) certs.get(index); if (!isSelfIssued(cert)) { if (maxPathLength <= 0) { ErrorBundle msg = createErrorBundle(""CertPathReviewer.pathLengthExtended""); addError(msg); } maxPathLength--; totalPathLength++; } BasicConstraints bc; try { bc = BasicConstraints.getInstance(getExtensionValue(cert, BASIC_CONSTRAINTS)); } catch (AnnotatedException ae) { ErrorBundle msg = createErrorBundle(""CertPathReviewer.processLengthConstError""); addError(msg,index); bc = null; } if (bc != null && bc.isCA()) { ASN1Integer pathLenConstraint = bc.getPathLenConstraintInteger(); if (pathLenConstraint != null) { maxPathLength = Math.min(maxPathLength, pathLenConstraint.intPositiveValueExact()); } } } ErrorBundle msg = createErrorBundle(""CertPathReviewer.totalPathLength"", new Object[]{Integers.valueOf(totalPathLength)}); addNotification(msg); }",unrelated,unrelated,True,,0.0004731863155029714,0.999526858329773
64,"private String getClasspath() throws IOException { File libDir = getLibDirectory(); String libPath = null; String[] files = new String[0]; if (libDir != null) { libPath = libDir.getCanonicalPath(); files = libDir.list((dir, name) -> name.endsWith("".jar"")); } if (files == null) { return """"; } StringBuilder classpath = new StringBuilder(); for (String file : files) { classpath.append(libPath).append(File.separatorChar).append(file).append(File.pathSeparatorChar); } return classpath.toString(); }",unrelated,unrelated,True,,0.0005239939200691879,0.9994760155677795
65,"private void checkPathLength() { int maxPathLength = n; int totalPathLength = 0; X509Certificate cert = null; for (int index = certs.size() - 1; index > 0; index--) { cert = (X509Certificate) certs.get(index); if (!isSelfIssued(cert)) { if (maxPathLength <= 0) { ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,""CertPathReviewer.pathLengthExtended""); addError(msg); } maxPathLength--; totalPathLength++; } BasicConstraints bc; try { bc = BasicConstraints.getInstance(getExtensionValue(cert, BASIC_CONSTRAINTS)); } catch (AnnotatedException ae) { ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,""CertPathReviewer.processLengthConstError""); addError(msg,index); bc = null; } if (bc != null && bc.isCA()) { ASN1Integer pathLenConstraint = bc.getPathLenConstraintInteger(); if (pathLenConstraint != null) { maxPathLength = Math.min(maxPathLength, pathLenConstraint.intPositiveValueExact()); } } } ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,""CertPathReviewer.totalPathLength"", new Object[]{Integers.valueOf(totalPathLength)}); addNotification(msg); }",unrelated,unrelated,True,,0.00046547059901058674,0.9995346069335938
66,"@Override public int compareTo(Path paramPath) { T p1 = asT(); T p2 = checkPath(paramPath); int c = compare(p1.root, p2.root); if (c != 0) { return c; } for (int i = 0; i < Math.min(p1.names.size(), p2.names.size()); i++) { String n1 = p1.names.get(i); String n2 = p2.names.get(i); c = compare(n1, n2); if (c != 0) { return c; } } return p1.names.size() - p2.names.size(); }",unrelated,unrelated,True,,0.0004817057342734188,0.9995182752609253
67,"public static void deleteDataFiles( DownloadManager dm, TOTorrent torrent, String torrent_save_dir, String torrent_save_file, boolean force_no_recycle ) { if (torrent == null || torrent_save_file == null ){ return; } try{ if (torrent.isSimpleTorrent()){ DownloadManagerState dms = dm.getDownloadState(); File target = FileUtil.newFile( torrent_save_dir, torrent_save_file ); target = dms.getFileLink( 0, new StringInterner.FileKey( target.getCanonicalFile())).getFile(); FileUtil.deleteWithRecycle( target, force_no_recycle ); }else{ PlatformManager mgr = PlatformManagerFactory.getPlatformManager(); boolean deleted = false; if ( Constants.isOSX && torrent_save_file.length() > 0 && COConfigurationManager.getBooleanParameter(""Move Deleted Data To Recycle Bin"" ) && (! force_no_recycle ) && mgr.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete )){ String dir = torrent_save_dir + File.separatorChar + torrent_save_file + File.separatorChar; int numDataFiles = countDataFiles( dm, torrent, torrent_save_dir, torrent_save_file ); if ( countFiles( FileUtil.newFile(dir), numDataFiles) == numDataFiles){ if ( FileUtil.deleteWithRecycle( FileUtil.newFile( dir ), false )){ deleted = true; } } } if ( !deleted ){ deleteDataFileContents( dm, torrent, torrent_save_dir, torrent_save_file, force_no_recycle ); } } }catch( Throwable e ){ Debug.printStackTrace( e ); } }",unrelated,unrelated,True,,0.0004889884148724377,0.9995110034942627
68,"debug.println("" "" + ((key==null) ? """" : key + "": "") + header); i++; } debug.println(); } verifyMimeType(connection.getContentType()); int clen = connection.getContentLength(); replyBuffer = input.readAllBytes(); if (clen != -1 && replyBuffer.length != clen) throw new EOFException(""Expected:"" + clen + "", read:"" + replyBuffer.length);",input_validation,input_validation,True,,0.9295431971549988,0.07045675069093704
69,@Override public Path toRealPath(LinkOption... options) throws IOException { return this; },unrelated,unrelated,True,,0.0005396619671955705,0.9994603991508484
70,@javax.annotation.ParametersAreNonnullByDefault package org.owasp.html;,unrelated,unrelated,True,,0.0006588472169823945,0.9993411898612976
71,"@Override public void doTag() throws JspException, IOException { Encode.forUri(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005434787017293274,0.9994564652442932
72,"@SuppressWarnings(""synthetic-access"") public HtmlPolicyBuilder onElements(String... elementNames) { List<String> builder = new ArrayList<>(); for (String elementName : elementNames) { builder.add(HtmlLexer.canonicalElementName(elementName)); } return HtmlPolicyBuilder.this.allowAttributesOnElements( policy, attributeNames, Collections.unmodifiableList(builder)); }",input_validation,input_validation,True,,0.9981507658958435,0.0018491792725399137
73,"private HtmlPolicyBuilder allowAttributesOnElements( AttributePolicy policy, List<String> attributeNames, List<String> elementNames) { invalidateCompiledState(); for (String elementName : elementNames) { Map<String, AttributePolicy> policies = attrPolicies.get(elementName); if (policies == null) { policies = new LinkedHashMap<>(); attrPolicies.put(elementName, policies); } for (String attributeName : attributeNames) { AttributePolicy oldPolicy = policies.get(attributeName); policies.put( attributeName, AttributePolicy.Util.join(oldPolicy, policy)); } } return this; }",input_validation,input_validation,True,,0.9973064661026001,0.002693571150302887
74,"@Override public void doTag() throws JspException, IOException { Encode.forHtml(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005660169990733266,0.9994339346885681
75,"public HtmlPolicyBuilder requireRelsOnLinks(String... linkValues) { this.invalidateCompiledState(); if (this.extraRelsForLinks == null) { this.extraRelsForLinks = new LinkedHashSet<>(); } for (String linkValue : linkValues) { linkValue = HtmlLexer.canonicalKeywordAttributeValue(linkValue); if (Strings.containsHtmlSpace(linkValue)) { throw new IllegalArgumentException(""spaces in input. use f(\""foo\"", \""bar\"") not f(\""foo bar\"")""); } this.extraRelsForLinks.add(linkValue); } if (this.skipRelsForLinks != null) { this.skipRelsForLinks.removeAll(this.extraRelsForLinks); } return this; }",input_validation,input_validation,True,,0.9981416463851929,0.0018583694472908974
76,"private boolean equivalentStrings(String s1, String s2) { String value = canonicalize(s1); String oValue = canonicalize(s2); if (!value.equals(oValue)) { value = stripInternalSpaces(value); oValue = stripInternalSpaces(oValue); if (!value.equals(oValue)) { return false; } } return true; }",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.9981354475021362,0.0018644689116626978
77,"if (publicKey.length != PUBLIC_KEY_LEN) { throw new IllegalArgumentException( String.format(""Given public key's length is not %s."", PUBLIC_KEY_LEN)); } this.publicKey = Bytes.copyFrom(publicKey); this.outputPrefix = outputPrefix; this.messageSuffix = messageSuffix;",input_validation,input_validation,True,,0.7286946773529053,0.27130526304244995
78,"public HtmlPolicyBuilder allowElements( ElementPolicy policy, String... elementNames) { invalidateCompiledState(); for (String elementName : elementNames) { elementName = HtmlLexer.canonicalElementName(elementName); ElementPolicy newPolicy = ElementPolicy.Util.join( elPolicies.get(elementName), policy); elPolicies.put(elementName, newPolicy); if (!textContainers.containsKey(elementName)) {",input_validation,input_validation,True,,0.998170018196106,0.0018299783114343882
79,"@Override public void doTag() throws JspException, IOException { Encode.forXmlComment(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0006016989354975522,0.9993983507156372
80,"PolicyFactory( Map<String, ElementAndAttributePolicies> policies, Set<String> textContainers, Map<String, AttributePolicy> globalAttrPolicies, HtmlStreamEventProcessor preprocessor, HtmlStreamEventProcessor postprocessor) { this.policies = policies; this.textContainers = textContainers; this.globalAttrPolicies = globalAttrPolicies; this.preprocessor = preprocessor; this.postprocessor = postprocessor; }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0006560651818290353,0.9993439316749573
81,"@Override public void doTag() throws JspException, IOException { Encode.forUriComponent(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005336343892849982,0.9994663596153259
82,"@Override public void doTag() throws JspException, IOException { Encode.forXml(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005690690595656633,0.9994309544563293
83,"public HtmlPolicyBuilder allowStyling(CssSchema whitelist) { invalidateCompiledState(); this.stylingPolicySchema = this.stylingPolicySchema == null ? whitelist : CssSchema.union(stylingPolicySchema, whitelist); this.allowAttributesGlobally( AttributePolicy.IDENTITY_ATTRIBUTE_POLICY, j8().listOf(""style"")); return this; }",input_validation,input_validation,True,,0.9981517195701599,0.0018482888117432594
84,"private static void info(final String format, final Object... args) { System.out.println(String.format(format, args)); }",unrelated,unrelated,True,,0.000563876295927912,0.99943608045578
85,"public HtmlPolicyBuilder withPostprocessor(HtmlStreamEventProcessor pp) { this.postprocessor = HtmlStreamEventProcessor.Processors.compose( this.postprocessor, pp); return this; }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005119030829519033,0.999488115310669
86,"@Override public void doTag() throws JspException, IOException { Encode.forXmlAttribute(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0006018767016939819,0.9993981122970581
87,"@Override public void doTag() throws JspException, IOException { Encode.forXmlContent(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005860140081495047,0.9994139671325684
88,"@Override public void doTag() throws JspException, IOException { Encode.forCssString(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0006773995701223612,0.9993226528167725
89,"public HtmlPolicyBuilder disallowElements(String... elementNames) { return allowElements(ElementPolicy.REJECT_ALL_ELEMENT_POLICY, elementNames); }",input_validation,input_validation,True,,0.9980960488319397,0.0019040132174268365
90,"@Override public void doTag() throws JspException, IOException { Encode.forJavaScriptAttribute(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005539414123632014,0.9994460940361023
91,private String canonicalize(String s) { String value = Strings.toLowerCase(s.trim()); if (value.length() > 0 && value.charAt(0) == '#') { ASN1Primitive obj = decodeObject(value); if (obj instanceof ASN1String) { value = Strings.toLowerCase(((ASN1String)obj).getString().trim()); } } return value; },unrelated,unrelated,True,,0.032685015350580215,0.9673150181770325
92,"if (this.skipRelsForLinks == null) { this.skipRelsForLinks = new HashSet<>(); } for (String linkValue : linkValues) { linkValue = HtmlLexer.canonicalKeywordAttributeValue(linkValue); if (Strings.containsHtmlSpace(linkValue)) { throw new IllegalArgumentException(""spaces in input. use f(\""foo\"", \""bar\"") not f(\""foo bar\"")""); } this.skipRelsForLinks.add(linkValue);",input_validation,input_validation,True,,0.9981780052185059,0.0018219486810266972
93,public HtmlPolicyBuilder allowStyling() { allowStyling(CssSchema.DEFAULT); return this; },input_validation,input_validation,True,,0.9977743029594421,0.002225628588348627
94,public static String toXml(String text) { return StringEscapeUtils.escapeXml10(text); },input_validation,input_validation,True,,0.9980397820472717,0.001960204681381583
95,"public HtmlPolicyBuilder withPreprocessor(HtmlStreamEventProcessor pp) { this.preprocessor = HtmlStreamEventProcessor.Processors.compose( this.preprocessor, pp); return this; }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005130906356498599,0.9994869232177734
96,"final Method method = GetMethod.action( annotationType, VALIDATION_APPLIES_TO ); if ( hasGenericValidators && hasCrossParameterValidator ) { if ( method == null ) { throw LOG.getGenericAndCrossParameterConstraintDoesNotDefineValidationAppliesToParameterException( annotationType ); } if ( method.getReturnType() != ConstraintTarget.class ) { throw LOG.getValidationAppliesToParameterMustHaveReturnTypeConstraintTargetException( annotationType ); } ConstraintTarget defaultValue = (ConstraintTarget) method.getDefaultValue(); if ( defaultValue != ConstraintTarget.IMPLICIT ) { throw LOG.getValidationAppliesToParameterMustHaveDefaultValueImplicitException( annotationType ); } }",input_validation,input_validation,True,,0.9980140924453735,0.0019858444575220346
97,"public static final String CONFIG_NO_PW_WHITELIST = ""Password Disabled Whitelist"";",unrelated,input_validation,False,true_unrelated_predicted_input_validation,0.996841311454773,0.0031586799304932356
98,"private HtmlPolicyBuilder allowAttributesGlobally( AttributePolicy policy, List<String> attributeNames) { invalidateCompiledState(); for (String attributeName : attributeNames) { AttributePolicy oldPolicy = globalAttrPolicies.get(attributeName); globalAttrPolicies.put( attributeName, AttributePolicy.Util.join(oldPolicy, policy)); } return this; }",input_validation,input_validation,True,,0.9976650476455688,0.0023349695838987827
99,"@Override public byte[] encode(boolean withHash) { String cstring; String sstring; if (withHash) { cstring = """"; sstring = String.format(""%s:%s %d:%s %d:%s"", hashAlg, hash, client.length(), client, server.length(), server); } else { cstring = client; sstring = server; } return encode0(cstring, sstring); }",unrelated,unrelated,True,,0.0004933582968078554,0.9995065927505493
100,public HtmlPolicyBuilder allowUrlsInStyles( AttributePolicy newStyleUrlPolicy) { this.invalidateCompiledState(); this.styleUrlPolicy = newStyleUrlPolicy; return this; },input_validation,input_validation,True,,0.9978541731834412,0.002145820762962103
101,"@Override public void doTag() throws JspException, IOException { Encode.forHtmlContent(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0005838244105689228,0.9994162321090698
102,"@Override public void doTag() throws JspException, IOException { Encode.forCssUrl(getJspContext().getOut(), _value); }",input_validation,unrelated,False,true_input_validation_predicted_unrelated,0.0009083918994292617,0.999091625213623
103,"for (i=0; (i < args.length) && args[i].startsWith(""-""); i++) { String flags = args[i]; if (i == args.length - 1) { for (Option option: Option.values()) { if (collator.compare(flags, option.toString()) == 0) { if (option.arg != null) errorNeedArgument(flags); break; } } }",input_validation,input_validation,True,,0.9981409311294556,0.0018590327817946672
104,"if ( !Character.isDigit( last_char )){ val = val.substring( 0, val.length()-1 ); if ( last_char == 'k' ){ mult = 1024; }else if ( last_char == 'm' ){ mult = 1024*1024; }else if ( last_char == 'g' ){ mult = 1024*1024*1024; }else{ throw( new Exception( ""Invalid size unit '"" + last_char + ""'"" )); }",input_validation,input_validation,True,,0.9981435537338257,0.0018564031925052404
105,"in.reset(); Schema schema = getSchema( xmlParserHelper, schemaVersion ); Validator validator = schema.newValidator(); validator.validate( new StreamSource( new CloseIgnoringInputStream( in ) ) ); in.reset();",input_validation,input_validation,True,,0.9981524348258972,0.001847523613832891
106,"Schema schema = SchemaFactory.loadFromUrl(schemaUrl); Validator validator = schema.newValidator(); if (JAXP_15_SUPPORTED) { validator.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, """"); validator.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, """"); } XMLErrorAccumulatorHandler errorAcumulator = new XMLErrorAccumulatorHandler(); validator.setErrorHandler(errorAcumulator); Source xmlSource = new DOMSource(xmlDocument); validator.validate(xmlSource); final boolean isValid = !errorAcumulator.hasError(); if (!isValid) { LOGGER.warn(""Errors found when validating SAML response with schema: "" + errorAcumulator.getErrorXML());",input_validation,input_validation,True,,0.9981790781021118,0.0018208971014246345
107,@Override public void commit() { LocalPreferences pref = SettingsManager.getLocalPreferences(); pref.setFileTransferIbbOnly(ui.getIbbOnly()); pref.setAutoAcceptFileTransferFromContacts(ui.getAutoAccept()); String downloadDir = ui.getDownloadDirectory(); if (ModelUtil.hasLength(downloadDir)) { pref.setDownloadDir(downloadDir); } String timeout = ui.getTimeout(); if (ModelUtil.hasLength(timeout)) { int tout = 1; try { tout = Integer.parseInt(timeout); } catch (NumberFormatException e) { } pref.setFileTransferTimeout(tout); final int timeOutMs = tout * (60 * 1000); OutgoingFileTransfer.setResponseTimeout(timeOutMs); } },unrelated,unrelated,True,,0.000522913527674973,0.9994770884513855
108,String schemaResourceName = getSchemaResourceName( schemaVersion ); Schema schema = xmlParserHelper.getSchema( schemaResourceName ); if ( schema == null ) { throw LOG.unableToGetXmlSchema( schemaResourceName ); } Validator validator = schema.newValidator(); validator.validate( new StreamSource( new CloseIgnoringInputStream( in ) ) );,input_validation,input_validation,True,,0.9981784820556641,0.0018214804586023092
109,"protected PairManagerTunnel( PairingManagerTunnelHandler _tunnel_handler, String _tunnel_key, InetAddress _originator, String _sid, PairedServiceRequestHandler _request_handler, SecretKeySpec _key, String _tunnel_url, String _endpoint_url ) { tunnel_handler = _tunnel_handler; tunnel_key = _tunnel_key; originator = _originator; sid = _sid; request_handler = _request_handler; key = _key; tunnel_url = _tunnel_url; endpoint_url = _endpoint_url; new AEThread2( ""PairManagerTunnel:runner"" ) { @Override public void run() { try{ String current_reply_params = null; byte[] current_reply_data = null; while( !close_requested ){ if ( consec_fails > 1 ){ try{ Thread.sleep(( 1 << (consec_fails-1)) * 1000 ); }catch( Throwable e ){ } } long start_time = SystemTime.getMonotonousTime(); try{ String url_str = tunnel_url + ""?server=true"" + (current_reply_params==null?"""":current_reply_params ); if ( last_fail_duration_secs > 0 ){ url_str += ""&last_fail="" + last_fail_duration_secs; last_fail_duration_secs = 0; } byte[] bytes_to_send = current_reply_data==null?new byte[0]:current_reply_data; bytes_out += bytes_to_send.length; ResourceDownloader rd = rdf.create( new URL( url_str ), bytes_to_send ); rd.setProperty( ""URL_Connection"", ""Keep-Alive"" ); rd.setProperty( ""URL_Read_Timeout"", 5*60*1000 ); byte[] data = FileUtil.readInputStreamAsByteArray( rd.download()); if ( close_requested ){ break; } bytes_in += data.length; long now = SystemTime.getMonotonousTime(); last_active = now; current_reply_params = null; current_reply_data = null; List<String> cookies = (List<String>)rd.getProperty( ""URL_Set-Cookie"" ); boolean cookie_found = false; if ( cookies != null ){ for ( String cookie: cookies ){ final String name = ""vuze_pair_server_reqs=""; if ( cookie.startsWith( name )){ cookie_found = true; String value = cookie.substring( name.length()); int pos = value.indexOf( ';' ); value = value.substring( 0, pos ); String[] bits = value.split( ""&"" ); if ( bits.length > 0 ){ current_reply_params = """"; int data_pos = 0; List<byte[]> replies = new ArrayList<>(); int reply_length = 0; for ( String bit: bits ){ String[] temp = bit.split( ""="" ); if ( temp.length == 2 ){ String lhs = temp[0].toLowerCase(); if ( lhs.startsWith( ""seq"" )){ int seq = Integer.parseInt( lhs.substring( 3 )); int len = Integer.parseInt( temp[1]); last_request_time = now; request_count++; byte[] reply = processRequest( data, data_pos, len ); replies.add( reply ); reply_length += reply.length; data_pos += len; current_reply_params += ""&seq"" + seq + ""="" + reply.length; }else if ( lhs.equals( ""keepalive"" )){ }else if ( lhs.equals( ""close"" )){ close_requested = true; } } } current_reply_data = new byte[reply_length]; data_pos = 0; for ( byte[] reply: replies ){ System.arraycopy( reply, 0, current_reply_data, data_pos, reply.length ); data_pos += reply.length; } } } } } if ( !cookie_found ){ throw( new Exception( ""Cookie missing from reply"" )); } consec_fails = 0; }catch( Throwable e ){ long fail_time = SystemTime.getMonotonousTime(); last_fail_duration_secs = (fail_time - start_time)/1000; if ( isTimeout( e ) && last_fail_duration_secs >= 20 ){ consec_fails = 0; }else{ Debug.out( e ); consec_fails++; if ( consec_fails > 3 ){ break; } } } } }finally{ tunnel_handler.closeTunnel( PairManagerTunnel.this ); } } }.start(); }",unrelated,unrelated,True,,0.0005460047395899892,0.9994539618492126
110,"@Override public Engine[] search( Engine[] engines, final ResultListener original_listener, SearchParameter[] searchParameters, String headers, Map<String,String> context, final int max_results_per_engine ) { String batch_millis_str = context.get( Engine.SC_BATCH_PERIOD ); final long batch_millis = batch_millis_str==null?0:Long.parseLong( batch_millis_str ); String rem_dups_str = context.get( Engine.SC_REMOVE_DUP_HASH ); final boolean rem_dups = rem_dups_str==null?false:rem_dups_str.equalsIgnoreCase( ""true"" ); ResultListener listener = new ResultListener() { AsyncDispatcher dispatcher = new AsyncDispatcher( 5000 ); final Map<Engine,List<Result[]>> pending_results = new HashMap<>(); final private Map<Engine,Set<String>> result_hashes = new HashMap<>(); @Override public void contentReceived( final Engine engine, final String content ) { dispatcher.dispatch( new AERunnable() { @Override public void runSupport() { original_listener.contentReceived( engine, content ); } }); } @Override public void matchFound( final Engine engine, final String[] fields ) { dispatcher.dispatch( new AERunnable() { @Override public void runSupport() { original_listener.matchFound( engine, fields ); } }); } @Override public void resultsReceived( final Engine engine, final Result[] results ) { dispatcher.dispatch( new AERunnable() { @Override public void runSupport() { Result[] results_to_return = null; if ( batch_millis > 0 ){ List<Result[]> list = pending_results.get( engine ); if ( list == null ){ results_to_return = results; pending_results.put( engine, new ArrayList<Result[]>()); new DelayedEvent( ""SearchBatcher"", batch_millis, new AERunnable() { @Override public void runSupport() { dispatcher.dispatch( new AERunnable() { @Override public void runSupport() { batchResultsComplete( engine ); } }); } }); }else{ list.add( results ); } }else{ results_to_return = results; } if ( results_to_return != null ){ results_to_return = truncateResults( engine, results_to_return, max_results_per_engine ); original_listener.resultsReceived( engine, results_to_return ); } } }); } @Override public void resultsComplete( final Engine engine ) { dispatcher.dispatch( new AERunnable() { @Override public void runSupport() { if ( batch_millis > 0 ){ batchResultsComplete( engine ); } original_listener.resultsComplete( engine ); } }); } protected void batchResultsComplete( Engine engine ) { List<Result[]> list = pending_results.remove( engine ); if ( list != null ){ List<Result> x = new ArrayList<>(); for ( Result[] y: list ){ x.addAll( Arrays.asList( y )); } Result[] results = x.toArray( new Result[ x.size()]); results = truncateResults( engine, results, max_results_per_engine ); original_listener.resultsReceived( engine, results ); } } protected Result[] truncateResults( Engine engine, Result[] a_results, int max ) { Set<String> hash_set = result_hashes.get( engine ); if ( hash_set == null ){ hash_set = new HashSet<>(); result_hashes.put( engine, hash_set ); } List<Result> results = new ArrayList<>(a_results.length); for ( Result r: a_results ){ String name = r.getName(); if ( name == null || name.trim().length() == 0 ){ continue; } if ( rem_dups ){ String hash = r.getHash(); if ( hash == null || hash.length() == 0 ){ results.add( r ); }else{ if ( !hash_set.contains( hash )){ results.add( r ); hash_set.add( hash ); } } }else{ results.add( r ); } } if ( max < results.size() ){ log( ""Truncating search results for "" + engine.getName() + "" from "" + results.size() + "" to "" + max ); Collections.sort( results, new Comparator<Result>() { Map<Result,Float> ranks = new HashMap<>(); @Override public int compare( Result r1, Result r2) { Float rank1 = (Float)ranks.get(r1); if ( rank1 == null ){ rank1 = new Float(r1.getRank()); ranks.put( r1, rank1 ); } Float rank2 = (Float)ranks.get(r2); if ( rank2 == null ){ rank2 = new Float(r2.getRank()); ranks.put( r2, rank2 ); } return( rank2.compareTo( rank1 )); } }); Result[] x = new Result[max]; int pos = 0; while( pos < max ){ x[pos] = results.get( pos ); pos++; } return( x ); }else{ return( results.toArray( new Result[ results.size()] )); } } @Override public void engineFailed( final Engine engine, final Throwable e ) { dispatcher.dispatch( new AERunnable() { @Override public void runSupport() { original_listener.engineFailed( engine, e ); } }); } @Override public void engineRequiresLogin( final Engine engine, final Throwable e ) { dispatcher.dispatch( new AERunnable() { @Override public void runSupport() { original_listener.engineRequiresLogin( engine, e ); } }); } }; SearchExecuter se = new SearchExecuter( context, listener ); if ( engines == null ){ engines = getEngines( true, true ); } String engines_str = """"; for (int i=0;i<engines.length;i++){ engines_str += (i==0?"""":"","") + engines[i].getId(); } log( ""Search: engines="" + engines_str ); for (int i=0;i<engines.length;i++){ se.search( engines[i], searchParameters, headers, max_results_per_engine ); } return( engines ); }",unrelated,unrelated,True,,0.000496179738547653,0.9995038509368896
111,"db.setEntityResolver( new EntityResolver() { @Override public InputSource resolveEntity( String publicId, String systemId ) { try{ URL url = new URL( systemId ); String protocol = url.getProtocol(); if ( !protocol.toLowerCase().startsWith( ""http"" )){ return( new InputSource( new ByteArrayInputStream(""<?xml version='1.0' encoding='UTF-8'?>"".getBytes()))); }",input_validation,input_validation,True,,0.9981385469436646,0.0018614003201946616
112,"private Schema loadSchema(String schemaResource) { ClassLoader loader = GetClassLoader.fromClass( XmlParserHelper.class ); URL schemaUrl = GetResource.action( loader, schemaResource ); SchemaFactory sf = SchemaFactory.newInstance( javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI ); try { sf.setFeature( javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true ); } catch (SAXException e) { LOG.unableToEnableSecureFeatureProcessingSchemaXml( schemaResource, e.getMessage() ); }",input_validation,input_validation,True,,0.9981821775436401,0.001817908021621406
113,"InetAddress start = InetAddress.getByName( bgp_prefix.substring(0,pos)); int cidr_mask = Integer.parseInt( bgp_prefix.substring( pos+1 )); byte[] bytes = start.getAddress(); for ( int i=cidr_mask;i<bytes.length*8;i++){ bytes[i/8] |= 1<<(7-(i%8)); } return( InetAddress.getByAddress( bytes )); }catch( Throwable e ){ throw( new NetworkAdminException( ""Parse failure for '"" + bgp_prefix + ""'"", e ));",input_validation,input_validation,True,,0.9957408905029297,0.004259163048118353
114,"try { docfactory.setAttribute(""http://xml.org/sax/features/external-general-entities"", Boolean.FALSE); } catch (Throwable e) {} try { docfactory.setAttribute(""http://xml.org/sax/features/external-parameter-entities"", Boolean.FALSE); } catch (Throwable e) {} try { docfactory.setAttribute(""http://apache.org/xml/features/disallow-doctype-decl"", Boolean.TRUE); } catch (Throwable e) {}",input_validation,input_validation,True,,0.9981398582458496,0.0018600921612232924
115,"@Override public void onSubscribe(@NonNull Disposable d) { try { lastThread = Thread.currentThread(); if (d == null) { errors.add(new NullPointerException(""onSubscribe received a null Subscription"")); return; } if (!upstream.compareAndSet(null, d)) { d.dispose(); if (upstream.get() != DisposableHelper.DISPOSED) { errors.add(new IllegalStateException(""onSubscribe received multiple subscriptions: "" + d)); } return; } downstream.onSubscribe(d); } finally { onSubscribeReady.countDown();",unrelated,unrelated,True,,0.0004812637926079333,0.9995187520980835
116,public void setMillis(ReadableInstant instant) { long instantMillis = DateTimeUtils.getInstantMillis(instant); setMillis(instantMillis); },unrelated,unrelated,True,,0.0005087072495371103,0.9994912147521973
117,"public Interval gap(ReadableInterval interval) { interval = DateTimeUtils.getReadableInterval(interval); long otherStart = interval.getStartMillis(); long otherEnd = interval.getEndMillis(); long thisStart = getStartMillis(); long thisEnd = getEndMillis(); if (thisStart > otherEnd) { return new Interval(otherEnd, thisStart, getChronology()); } else if (otherStart > thisEnd) { return new Interval(thisEnd, otherStart, getChronology()); } else { return null; } }",unrelated,unrelated,True,,0.0004915822064504027,0.9995083808898926
118,"private int generateRandomNumber(final List<Character> characterList) { final int listSize = characterList.size(); if (random != null) { return String.valueOf(characterList.get(random.applyAsInt(listSize))).codePointAt(0); } return String.valueOf(characterList.get(ThreadLocalRandom.current().nextInt(0, listSize))).codePointAt(0); }",unrelated,unrelated,True,,0.00048463308485224843,0.9995154142379761
119,"@Override protected void subscribeActual(MaybeObserver<? super R> observer) { source.subscribe(new MapOptionalSingleObserver<>(observer, mapper)); }",unrelated,unrelated,True,,0.0004944446845911443,0.9995055198669434
120,"@Override protected void subscribeActual(Observer<? super R> observer) { source.subscribe(new ConcatMapEagerMainObserver<>(observer, mapper, maxConcurrency, prefetch, errorMode)); }",unrelated,unrelated,True,,0.0004966747364960611,0.9995033740997314
121,@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof GJCacheKey)) { return false; } GJCacheKey other = (GJCacheKey) obj; if (cutoverInstant == null) { if (other.cutoverInstant != null) { return false; } } else if (!cutoverInstant.equals(other.cutoverInstant)) { return false; } if (minDaysInFirstWeek != other.minDaysInFirstWeek) {,unrelated,unrelated,True,,0.0005842647515237331,0.9994157552719116
122,public void setZone(DateTimeZone zone) { iSavedState = null; iZone = zone; },unrelated,unrelated,True,,0.0005202824249863625,0.9994797110557556
123,"protected String resolveVariable(final String variableName, final TextStringBuilder buf, final int startPos, final int endPos) { final StringLookup resolver = getStringLookup(); if (resolver == null) { return null; } return resolver.apply(variableName); }",unrelated,unrelated,True,,0.0005049030878581107,0.9994950294494629
124,public Seconds minus(Seconds seconds) { if (seconds == null) { return this; } return minus(seconds.getValue()); },unrelated,unrelated,True,,0.0005071983905509114,0.9994927644729614
125,"@SuppressWarnings(""unchecked"") void remove(ReplaySubscription<T> rs) { for (;;) { ReplaySubscription<T>[] a = subscribers.get(); if (a == TERMINATED || a == EMPTY) { return; } int len = a.length; int j = -1; for (int i = 0; i < len; i++) { if (a[i] == rs) { j = i; break; } } if (j < 0) { return; } ReplaySubscription<T>[] b;",unrelated,unrelated,True,,0.0004808558733202517,0.9995191097259521
126,"public static String toCamelCase(String str, final boolean capitalizeFirstLetter, final char... delimiters) { if (StringUtils.isEmpty(str)) { return str; } str = str.toLowerCase(Locale.ROOT); final int strLen = str.length(); final int[] newCodePoints = new int[strLen]; int outOffset = 0; final Set<Integer> delimiterSet = toDelimiterSet(delimiters); boolean capitalizeNext = capitalizeFirstLetter; for (int index = 0; index < strLen;) { final int codePoint = str.codePointAt(index); if (delimiterSet.contains(codePoint)) { capitalizeNext = outOffset != 0; index += Character.charCount(codePoint); } else if (capitalizeNext || outOffset == 0 && capitalizeFirstLetter) { final int titleCaseCodePoint = Character.toTitleCase(codePoint); newCodePoints[outOffset++] = titleCaseCodePoint; index += Character.charCount(titleCaseCodePoint); capitalizeNext = false;",unrelated,unrelated,True,,0.00048165436601266265,0.9995183944702148
127,"public DateMidnight plusMonths(int months) { if (months == 0) { return this; } long instant = getChronology().months().add(getMillis(), months); return withMillis(instant); }",unrelated,unrelated,True,,0.0004954554606229067,0.999504566192627
128,"private String parseFormatDescription(final String pattern, final ParsePosition pos) { final int start = pos.getIndex(); seekNonWs(pattern, pos); final int text = pos.getIndex(); int depth = 1; while (pos.getIndex() < pattern.length()) { switch (pattern.charAt(pos.getIndex())) { case START_FE: depth++; next(pos); break; case END_FE: depth--; if (depth == 0) { return pattern.substring(text, pos.getIndex()); } next(pos); break; case QUOTE: getQuotedString(pattern, pos);",unrelated,unrelated,True,,0.0015990380197763443,0.9984009861946106
129,"@Override public int hashCode() { int total = 157; for (int i = 0, isize = size(); i < isize; i++) { total = 23 * total + getValue(i); total = 23 * total + getFieldType(i).hashCode(); } total += getChronology().hashCode(); return total; }",unrelated,unrelated,True,,0.00048492441419512033,0.9995150566101074
130,"@Override public @NonNull CompletionStage<Boolean> next(@NonNull T item) { try { return Objects.requireNonNull(onNext.apply(item), ""onNext returned a null CompletionStage""); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); return CompletableFuture.failedStage(ex); } }",unrelated,unrelated,True,,0.00048691517440602183,0.9995130300521851
131,"@CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull public final Observable<T> observeOn(@NonNull Scheduler scheduler) { return observeOn(scheduler, StandardBufferedConfig.DEFAULT); }",unrelated,unrelated,True,,0.00048731284914538264,0.9995126724243164
132,public MpscLinkedQueue() { producerNode = new AtomicReference<>(); consumerNode = new AtomicReference<>(); LinkedQueueNode<T> node = new LinkedQueueNode<>(); spConsumerNode(node); xchgProducerNode(node); },unrelated,unrelated,True,,0.0004885752568952739,0.9995114803314209
133,"private static int[] algorithmB(final CharSequence left, final CharSequence right) { final int m = left.length(); final int n = right.length(); final int[][] dpRows = new int[2][1 + n]; for (int i = 1; i <= m; i++) { final int[] temp = dpRows[0]; dpRows[0] = dpRows[1]; dpRows[1] = temp; for (int j = 1; j <= n; j++) { if (left.charAt(i - 1) == right.charAt(j - 1)) { dpRows[1][j] = dpRows[0][j - 1] + 1; } else { dpRows[1][j] = Math.max(dpRows[1][j - 1], dpRows[0][j]);",unrelated,unrelated,True,,0.00048701665946282446,0.9995130300521851
134,"public void printTo(StringBuffer buf, long instant) { try { printTo((Appendable) buf, instant); } catch (IOException ex) { } }",unrelated,unrelated,True,,0.0005023450939916074,0.999497652053833
135,public boolean isGreaterThan(Seconds other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.00048573146341368556,0.9995142221450806
136,"@Override public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, iMin, iMax); int remainder = getRemainder(getWrappedField().get(instant)); return getWrappedField().set(instant, value * iDivisor + remainder); }",unrelated,unrelated,True,,0.00048550881911069155,0.9995144605636597
137,final void removeSelf() { DisposableContainer c = composite.getAndSet(null); if (c != null) { c.delete(this); } },unrelated,unrelated,True,,0.0005081040435470641,0.9994919300079346
138,"@Override int getMonthOfYear(long millis, int year) { long monthZeroBased = (millis - getYearMillis(year)) / MILLIS_PER_MONTH; return ((int) monthZeroBased) + 1; }",unrelated,unrelated,True,,0.000495570944622159,0.9995044469833374
139,"int getDayOfMonth(long millis, int year) { int month = getMonthOfYear(millis, year); return getDayOfMonth(millis, year, month); }",unrelated,unrelated,True,,0.0005034279311075807,0.999496579170227
140,"private GJChronology(Chronology base, JulianChronology julian, GregorianChronology gregorian, Instant cutoverInstant) { super(base, new Object[] {julian, gregorian, cutoverInstant}); }",unrelated,unrelated,True,,0.00048449059249833226,0.9995155334472656
141,"public static void appendPaddedInteger(Appendable appendable, long value, int size) throws IOException { int intValue = (int)value; if (intValue == value) { appendPaddedInteger(appendable, intValue, size); } else if (size <= 19) { appendable.append(Long.toString(value)); } else { if (value < 0) { appendable.append('-'); if (value != Long.MIN_VALUE) { value = -value; } else { for (; size > 19; size--) { appendable.append('0'); } appendable.append(""9223372036854775808""); return; } } int digits = (int)(Math.log(value) / LOG_10) + 1;",unrelated,unrelated,True,,0.00047045547398738563,0.9995296001434326
142,"@Override public void onNext(T t) { if (fusionMode == QueueSubscription.NONE) { parent.innerNext(this, t); } else { parent.drain(); } }",unrelated,unrelated,True,,0.0004867158713750541,0.9995132684707642
143,"public static Years yearsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.years()); return Years.years(amount); }",unrelated,unrelated,True,,0.0004953298484906554,0.9995046854019165
144,private Chronology selectChronology(Chronology chrono) { chrono = DateTimeUtils.getChronology(chrono); if (iChrono != null) { chrono = iChrono; } if (iZone != null) { chrono = chrono.withZone(iZone); } return chrono; },unrelated,unrelated,True,,0.0004890295676887035,0.9995110034942627
145,"public StrBuilder replaceAll(final char search, final char replace) { if (search != replace) { for (int i = 0; i < size; i++) { if (buffer[i] == search) { buffer[i] = replace; } } } return this; }",unrelated,unrelated,True,,0.0004943166859447956,0.9995056390762329
146,"public static <V> String replace(final Object source, final Map<String, V> valueMap, final String prefix, final String suffix) { return new StrSubstitutor(valueMap, prefix, suffix).replace(source); }",unrelated,unrelated,True,,0.0004951872979290783,0.999504804611206
147,public boolean isGreaterThan(Minutes other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.0004880408523604274,0.9995119571685791
148,"protected int convertText(String text, Locale locale) { try { return Integer.parseInt(text); } catch (NumberFormatException ex) { throw new IllegalFieldValueException(getType(), text); } }",unrelated,unrelated,True,,0.0005144093884155154,0.9994856119155884
149,"@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull public static <@NonNull T> Observable<T> merge(@NonNull Iterable<@NonNull ? extends ObservableSource<? extends T>> sources, @NonNull StandardConcurrentBufferedConfig config) { Objects.requireNonNull(config, ""config is null""); return fromIterable(sources).flatMap(Functions.identity(), config); }",unrelated,unrelated,True,,0.0004959659418091178,0.9995039701461792
150,"public ObservableWithLatestFromMany(@NonNull ObservableSource<T> source, @NonNull Iterable<? extends ObservableSource<?>> otherIterable, @NonNull Function<? super Object[], R> combiner) { super(source); this.otherArray = null; this.otherIterable = otherIterable; this.combiner = combiner; }",unrelated,unrelated,True,,0.0005040091928094625,0.9994959831237793
151,"@Override public String toString() { String str = ""BuddhistChronology""; DateTimeZone zone = getZone(); if (zone != null) { str = str + '[' + zone.getID() + ']'; } return str; }",unrelated,unrelated,True,,0.000516953063197434,0.9994829893112183
152,"@Override public long set(long millis, int value) { FieldUtils.verifyValueBounds(this, value, iMinValue, getMaximumValue()); if (value <= iSkip) { value--; } return super.set(millis, value); }",unrelated,unrelated,True,,0.00048830610467121,0.99951171875
153,"public Interval withDurationAfterStart(ReadableDuration duration) { long durationMillis = DateTimeUtils.getDurationMillis(duration); if (durationMillis == toDurationMillis()) { return this; } Chronology chrono = getChronology(); long startMillis = getStartMillis(); long endMillis = chrono.add(startMillis, durationMillis, 1); return new Interval(startMillis, endMillis, chrono); }",unrelated,unrelated,True,,0.000489719386678189,0.9995102882385254
154,"@CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull public final <@NonNull R> Flowable<R> replay(@NonNull Function<? super Flowable<T>, @NonNull ? extends Publisher<R>> selector, long time, @NonNull TimeUnit unit) { return replay(selector, time, unit, Schedulers.computation()); }",unrelated,unrelated,True,,0.0004932073643431067,0.9995068311691284
155,"@SuppressWarnings(""unchecked"") @NonNull public static <T> Predicate<T> alwaysFalse() { return (Predicate<T>)ALWAYS_FALSE; }",unrelated,unrelated,True,,0.00049533077981323,0.9995046854019165
156,"@Override public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, getMinimumValue(), getMaximumValue()); return instant + (value - get(instant)) * iUnitMillis; }",unrelated,unrelated,True,,0.0004878111067228019,0.9995121955871582
157,"public DelegatedDateTimeField(DateTimeField field, DurationField rangeField, DateTimeFieldType type) { super(); if (field == null) { throw new IllegalArgumentException(""The field must not be null""); } iField = field; iRangeDurationField = rangeField; iType = (type == null ? field.getType() : type); }",unrelated,unrelated,True,,0.0004803123592864722,0.9995197057723999
158,"public Calendar toCalendar(Locale locale) { if (locale == null) { locale = Locale.getDefault(); } DateTimeZone zone = getZone(); Calendar cal = Calendar.getInstance(zone.toTimeZone(), locale); cal.setTime(toDate()); return cal; }",unrelated,unrelated,True,,0.0005095483502373099,0.9994903802871704
159,public StringMatcher stringMatcher(final char... chars) { final int length = ArrayUtils.getLength(chars); return length == 0 ? NONE_MATCHER : length == 1 ? new AbstractStringMatcher.CharMatcher(chars[0]) : new AbstractStringMatcher.CharArrayMatcher(chars); },unrelated,unrelated,True,,0.0007566181593574584,0.9992433786392212
160,@Override public int getMinimumValue(ReadablePartial instant) { return getMinimumValue(); },unrelated,unrelated,True,,0.0005082681309431791,0.9994916915893555
161,"@Override protected void subscribeActual(Observer<? super T> t) { CacheDisposable<T> consumer = new CacheDisposable<>(t, multicaster, head); t.onSubscribe(consumer); multicaster.add(consumer); if (consumer.isDisposed()) { multicaster.remove(consumer); } if (!once.get() && once.compareAndSet(false, true)) { source.subscribe(multicaster); } else { multicaster.replay(consumer); } }",unrelated,unrelated,True,,0.00048581924056634307,0.9995142221450806
162,"public LocalDateTime withTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) { Chronology chrono = getChronology(); long instant = getLocalMillis(); instant = chrono.hourOfDay().set(instant, hourOfDay); instant = chrono.minuteOfHour().set(instant, minuteOfHour); instant = chrono.secondOfMinute().set(instant, secondOfMinute); instant = chrono.millisOfSecond().set(instant, millisOfSecond); return withLocalMillis(instant); }",unrelated,unrelated,True,,0.00048738354234956205,0.9995126724243164
163,"public void printTo(StringBuilder buf, ReadablePartial partial) { try { printTo((Appendable) buf, partial); } catch (IOException ex) { } }",unrelated,unrelated,True,,0.0004932043375447392,0.9995068311691284
164,"public MaybeToSingle(MaybeSource<T> source, T defaultValue) { this.source = source; this.defaultValue = defaultValue; }",unrelated,unrelated,True,,0.0004891059943474829,0.9995108842849731
165,"public DeferredExecutorScheduler(@NonNull Supplier<? extends Executor> executorSupplier, boolean interruptibleWorker, boolean fair) { this.executorSupplier = executorSupplier; this.interruptibleWorker = interruptibleWorker; this.fair = fair; }",unrelated,unrelated,True,,0.0004957861383445561,0.9995042085647583
166,"@Override public long add(long instant, int years) { if (years == 0) { return instant; } return set(instant, get(instant) + years); }",unrelated,unrelated,True,,0.0004918723716400564,0.9995081424713135
167,@Override public boolean equals(Object period) { if (this == period) { return true; } if (period instanceof ReadablePeriod == false) { return false; } ReadablePeriod other = (ReadablePeriod) period; return (other.getPeriodType() == getPeriodType() && other.getValue(0) == getValue()); },unrelated,unrelated,True,,0.000486923789139837,0.9995130300521851
168,"public int indexOf(final char ch, int startIndex) { startIndex = Math.max(startIndex, 0); if (startIndex >= size) { return -1; } final char[] thisBuf = buffer; for (int i = startIndex; i < size; i++) { if (thisBuf[i] == ch) { return i; } } return -1; }",unrelated,unrelated,True,,0.0004932527081109583,0.9995067119598389
169,@Override public Object clone() { try { return cloneReset(); } catch (final CloneNotSupportedException ex) { return null; } },unrelated,unrelated,True,,0.0005083127762190998,0.9994916915893555
170,"BasicDayOfYearDateTimeField(BasicChronology chronology, DurationField days) { super(DateTimeFieldType.dayOfYear(), days); iChronology = chronology; }",unrelated,unrelated,True,,0.0004869641561526805,0.9995130300521851
171,"public LocalTime(Object instant, Chronology chronology) { PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); chronology = converter.getChronology(instant, chronology); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); int[] values = converter.getPartialValues(this, instant, chronology, ISODateTimeFormat.localTimeParser()); iLocalMillis = iChronology.getDateTimeMillis(0L, values[0], values[1], values[2], values[3]); }",unrelated,unrelated,True,,0.0004945907276123762,0.9995054006576538
172,"private static Predicate<Integer> generateIsDelimiterFunction(final char[] delimiters) { final Predicate<Integer> isDelimiter; if (delimiters == null || delimiters.length == 0) { isDelimiter = delimiters == null ? Character::isWhitespace : c -> false; } else { final Set<Integer> delimiterSet = new HashSet<>(); for (int index = 0; index < delimiters.length; index++) { delimiterSet.add(Character.codePointAt(delimiters, index)); } isDelimiter = delimiterSet::contains; } return isDelimiter; }",unrelated,unrelated,True,,0.0004766896599903703,0.9995232820510864
173,static long readMillis(DataInput in) throws IOException { int v = in.readUnsignedByte(); switch (v >> 6) { case 0: default: v = (v << (32 - 6)) >> (32 - 6); return v * (30 * 60000L); case 1: v = (v << (32 - 6)) >> (32 - 30); v |= (in.readUnsignedByte()) << 16; v |= (in.readUnsignedByte()) << 8; v |= (in.readUnsignedByte()); return v * 60000L; case 2: long w = (((long)v) << (64 - 6)) >> (64 - 38); w |= (in.readUnsignedByte()) << 24;,unrelated,unrelated,True,,0.0004874522564932704,0.9995125532150269
174,public boolean isGreaterThan(Weeks other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.000484117103042081,0.9995158910751343
175,"@SuppressWarnings(""unchecked"") public final U awaitOnSubscribe(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { if (!onSubscribeReady.await(timeout, unit)) { throw new TimeoutException(""TestSubscriber.awaitOnSubscribe timed out""); } return (U)this; }",unrelated,unrelated,True,,0.00048549839993938804,0.9995144605636597
176,"@Override public int getMaximumValue(ReadablePartial partial) { if (partial.isSupported(DateTimeFieldType.monthOfYear())) { int month = partial.get(DateTimeFieldType.monthOfYear()); if (partial.isSupported(DateTimeFieldType.year())) { int year = partial.get(DateTimeFieldType.year()); return iChronology.getDaysInYearMonth(year, month); } return iChronology.getDaysInMonthMax(month); } return getMaximumValue(); }",unrelated,unrelated,True,,0.00048510037595406175,0.9995149374008179
177,"public static Hours hoursBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.hours()); return Hours.hours(amount); }",unrelated,unrelated,True,,0.0004922784864902496,0.9995076656341553
178,"public int get(DateTimeField field) { if (field == null) { throw new IllegalArgumentException(""The DateTimeField must not be null""); } return field.get(getMillis()); }",unrelated,unrelated,True,,0.0004832098202314228,0.9995168447494507
179,@Override public long roundHalfFloor(long instant) { return getWrappedField().roundHalfFloor(instant); },unrelated,unrelated,True,,0.0005038785166107118,0.9994961023330688