desertsyao commited on
Commit
6f80ef7
·
verified ·
1 Parent(s): 649a559

Upload folder using huggingface_hub

Browse files
audit_accountability_codebert_v1/best_metrics.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "loss": 1.0383340008793311,
3
+ "accuracy": 0.8015873015873016,
4
+ "macro_f1": 0.7662337662337662,
5
+ "labels": [
6
+ "audit_accountability",
7
+ "unrelated"
8
+ ],
9
+ "precision": [
10
+ 0.6666666666666666,
11
+ 0.8620689655172413
12
+ ],
13
+ "recall": [
14
+ 0.6842105263157895,
15
+ 0.8522727272727273
16
+ ],
17
+ "f1": [
18
+ 0.6753246753246753,
19
+ 0.8571428571428571
20
+ ],
21
+ "support": [
22
+ 38,
23
+ 88
24
+ ],
25
+ "confusion_matrix": [
26
+ [
27
+ 26,
28
+ 12
29
+ ],
30
+ [
31
+ 13,
32
+ 75
33
+ ]
34
+ ],
35
+ "classification_report": " precision recall f1-score support\n\naudit_accountability 0.67 0.68 0.68 38\n unrelated 0.86 0.85 0.86 88\n\n accuracy 0.80 126\n macro avg 0.76 0.77 0.77 126\n weighted avg 0.80 0.80 0.80 126\n"
36
+ }
audit_accountability_codebert_v1/best_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:82c231ab5c29d56f800fb3ab66e14477453669da8aa5bfd52b3410632178a0ab
3
+ size 498751708
audit_accountability_codebert_v1/best_validation_errors.csv ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_index,text,true_label,predicted_label,correct,error_type,probability_audit_accountability,probability_unrelated
2
+ 15,"Commit(CommitMetadata commitMetadata, List<CdoSnapshot> snapshots, Diff diff) { Validate.argumentsAreNotNull(commitMetadata, snapshots, diff); this.commitMetadata = commitMetadata; this.snapshots = snapshots; this.diff = diff; }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0008665707428008318,0.9991334080696106
3
+ 16,"public Mono<Object> markAudited(Object object) { Assert.notNull(object, ""Source object must not be null""); if (!isAuditable(object)) { return Mono.just(object); } PersistentEntity<?, ? extends PersistentProperty<?>> entity = entities .getRequiredPersistentEntity(object.getClass()); return entity.isNew(object) ? markCreated(object) : markModified(object); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.05436493828892708,0.9456350803375244
4
+ 17,JaversAuditableAspectAsync(JaversCommitAdvice javersCommitAdvice) { this.javersCommitAdvice = javersCommitAdvice; },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.8558459877967834,0.14415398240089417
5
+ 18,"public CommitMetadata(String author, Map<String, String> properties, LocalDateTime commitDate, Instant commitDateInstant, CommitId id) { Validate.argumentsAreNotNull(author, properties, commitDate, id); this.author = author; this.properties = new HashMap<>(properties); this.commitDate = commitDate; this.id = id; this.commitDateInstant = initCommitDateInstant(commitDate, commitDateInstant); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.015962179750204086,0.9840378761291504
6
+ 19,<T> Optional<AuditableBeanWrapper<T>> getBeanWrapperFor(T source);,audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007884991355240345,0.9992114305496216
7
+ 22,"public boolean isAuditable() { return Optionals.isAnyPresent(createdByField, createdDateField, lastModifiedByField, lastModifiedDateField); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0009130316320806742,0.9990869760513306
8
+ 24,"public static AuditingHandler from(MappingContext<?, ?> mappingContext) { return new AuditingHandler(PersistentEntities.of(mappingContext)); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007030780543573201,0.9992969036102295
9
+ 28,JaversAuditableAspect(JaversCommitAdvice javersCommitAdvice) { this.javersCommitAdvice = javersCommitAdvice; },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.5178748965263367,0.48212510347366333
10
+ 30,"protected final boolean isAuditable(Object source) { Assert.notNull(source, ""Source entity must not be null""); return factory.getBeanWrapperFor(source).isPresent(); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0010555449407547712,0.9989444613456726
11
+ 32,"private <T> T touch(Auditor<?> auditor, T target, boolean isNew) { Optional<AuditableBeanWrapper<T>> wrapper = factory.getBeanWrapperFor(target); return wrapper.map(it -> { touchAuditor(auditor, it, isNew); Optional<TemporalAccessor> now = dateTimeForNow ? touchDate(it, isNew) : Optional.empty();",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007417748565785587,0.9992582201957703
12
+ 33,"public <T> T markModified(T source) { Assert.notNull(source, ""Entity must not be null""); return markModified(getAuditor(), source); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0036575798876583576,0.9963423609733582
13
+ 40,"public Object markAudited(Object object) { Assert.notNull(object, ""Source object must not be null""); if (!isAuditable(object)) { return object; } PersistentEntity<?, ? extends PersistentProperty<?>> entity = entities .getRequiredPersistentEntity(object.getClass()); return entity.isNew(object) ? markCreated(object) : markModified(object); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.19444452226161957,0.805555522441864
14
+ 49,"@Override public void written(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen, Throwable thrown) { this.applicationEventPublisher.publishEvent(new FileWrittenEvent(session, remoteHandle, localHandle.getFile(), dataLen, thrown)); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9599892497062683,0.040010739117860794
15
+ 50,"@Override public void created(ServerSession session, Path path, Map<String, ?> attrs, Throwable thrown) { this.applicationEventPublisher.publishEvent(new DirectoryCreatedEvent(session, path, attrs)); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9818547964096069,0.018145255744457245
16
+ 51,"protected void publish(String message) { FileTailingEvent event = new FileTailingEvent(this, message, getFile()); this.eventPublisher.publishEvent(event); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9962246417999268,0.003775383345782757
17
+ 53,"@Override public void removed(ServerSession session, Path path, boolean isDirectory, Throwable thrown) { this.applicationEventPublisher.publishEvent(new PathRemovedEvent(session, path, isDirectory, thrown)); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9935405850410461,0.006459440104663372
18
+ 61,"private void simulateFailedLogin(AuthenticationToken token) { try { AuthenticationInfo simulated = ensureSimulatedAuthenticationInfo(); if (simulated != null && assertCredentialsMatchWithoutException(token, simulated)) { String msg = ""Submitted credentials for token ["" + token + ""] matched the simulated credentials. "" + ""This indicates a misconfiguration of the realm's "" + ""CredentialsMatcher or simulated credentials. Please review your configuration.""; throw new IncorrectCredentialsException(msg); } } catch (AuthenticationException authenticationException) { LOGGER.error( ""CredentialsMatcher [{}] threw exception on method 'doCredentialsMatch'"", getCredentialsMatcher(), authenticationException); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9965315461158752,0.003468502778559923
19
+ 62,protected void informCancelled( PeerReadRequest request ) { for (int i=0;i<listeners.size();i++){ try{ ((ExternalSeedReaderListener)listeners.get(i)).requestCancelled( request ); }catch( Throwable e ){ e.printStackTrace(); } } },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9961208701133728,0.0038790665566921234
20
+ 66,"protected List<String> getObservableRepos() { try { List<String> ids = userRepositories.getObservableRepositoryIds( getPrincipal() ); return ids == null ? Collections.<String>emptyList() : ids; } catch ( PrincipalNotFoundException e ) { log.warn( e.getMessage(), e ); } catch ( AccessDeniedException e ) { log.warn( e.getMessage(), e ); } catch ( ArchivaSecurityException e ) { log.warn( e.getMessage(), e ); } return Collections.emptyList(); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9957423806190491,0.004257640801370144
21
+ 67,"@Override public void beginScan( ManagedRepository repo, Date whenGathered ) throws ConsumerException { repoId = repo.getId(); this.repositoryDir = Paths.get( repo.getLocation() ); try { repositorySession = repositorySessionFactory.createSession(); } catch ( MetadataRepositoryException e ) { e.printStackTrace( ); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9896793365478516,0.010320649482309818
22
+ 68,"private Logger logger = LoggerFactory.getLogger( ""org.apache.archiva.AuditLog"" );",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.000660295132547617,0.9993396401405334
23
+ 72,"@Override public void anonymousBind() throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04109_ANONYMOUS_BIND ) ); } BindRequest bindRequest = createBindRequest( StringConstants.EMPTY, Strings.EMPTY_BYTES ); BindResponse bindResponse = bind( bindRequest ); processResponse( bindResponse ); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9961133003234863,0.0038866542745381594
24
+ 74,"public static final Logger logger = LoggerFactory.getLogger( ""org.apache.archiva.AuditLog"" );",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.000661465513985604,0.9993385672569275
25
+ 77,"private List<String> getObservableRepos( String principal ) { try { return userRepositories.getObservableRepositoryIds( principal ); } catch ( PrincipalNotFoundException e ) { log.warn( e.getMessage(), e ); } catch ( AccessDeniedException e ) { log.warn( e.getMessage(), e ); } catch ( ArchivaSecurityException e ) { log.warn( e.getMessage(), e ); } return Collections.emptyList(); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.996346652507782,0.0036533456295728683
26
+ 125,private void finishJump() { resetCachedState(); if (bufferPosition < PHILOX_BUFFER_SIZE) { rand10(); } },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9718952775001526,0.028104670345783234
audit_accountability_codebert_v1/best_validation_predictions.csv ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_index,text,true_label,predicted_label,correct,error_type,probability_audit_accountability,probability_unrelated
2
+ 0,@Override public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) { this.applicationEventPublisher = applicationEventPublisher; },unrelated,unrelated,True,,0.0007789436494931579,0.9992210865020752
3
+ 1,"fileType.addPattern( pattern ); saveConfiguration( configuration ); triggerAuditEvent( """", """", AuditEvent.ADD_PATTERN, auditInformation ); }",audit_accountability,audit_accountability,True,,0.9966797828674316,0.0033202306367456913
4
+ 2,private static SimpleDateFormat createNameFormat() { SimpleDateFormat fmt = new SimpleDateFormat( AuditEvent.TIMESTAMP_FORMAT ); fmt.setTimeZone( UTC_TIME_ZONE ); return fmt; },unrelated,unrelated,True,,0.0006577104213647544,0.9993422627449036
5
+ 3,"triggerAuditEvent( repository.getRepository( ).getId( ), reference.toKey(), AuditEvent.PURGE_ARTIFACT );",audit_accountability,audit_accountability,True,,0.9966200590133667,0.0033799808006733656
6
+ 4,"List<AuditEvent> events = new ArrayList<>(records.size()); for (AuditRecord record : records) { AuditEvent auditEvent = (AuditEvent) metadataRepository.getMetadataFacet(session, record.repositoryId, AuditEvent.FACET_ID, record.name); events.add(auditEvent); } return events;",audit_accountability,audit_accountability,True,,0.99665367603302,0.00334633095189929
7
+ 5,"protected void triggerAuditEvent( String repositoryId, String resource, String action, AuditInformation auditInformation ) { User user = auditInformation == null ? null : auditInformation.getUser(); AuditEvent event = new AuditEvent( repositoryId, user == null ? ""null"" : user.getUsername(), resource, action ); event.setRemoteIP( auditInformation == null ? ""null"" : auditInformation.getRemoteAddr() ); for ( AuditListener listener : getAuditListeners() ) { listener.auditEvent( event ); } }",audit_accountability,audit_accountability,True,,0.9966598749160767,0.0033401641994714737
8
+ 6,"fileType.removePattern( pattern ); saveConfiguration( configuration ); triggerAuditEvent( """", """", AuditEvent.REMOVE_PATTERN, auditInformation ); }",audit_accountability,audit_accountability,True,,0.9966797828674316,0.00332023692317307
9
+ 7,protected final Logger logger = LoggerFactory.getLogger( getClass() );,unrelated,unrelated,True,,0.00066304428037256,0.9993368983268738
10
+ 8,"@Override public AuditEvent createMetadataFacet( String repositoryId, String name ) { return new AuditEvent( name, repositoryId ); }",audit_accountability,audit_accountability,True,,0.9966243505477905,0.003375662723556161
11
+ 9,"triggerAuditEvent( repositoryGroupId, null, AuditEvent.DELETE_REPO_GROUP, auditInformation ); return Boolean.TRUE; }",audit_accountability,audit_accountability,True,,0.9966455101966858,0.003354499116539955
12
+ 10,"protected void triggerAuditEvent( String repositoryId, String filePath, String action ) { AuditEvent auditEvent = new AuditEvent( repositoryId, getPrincipal(), filePath, action ); AuditInformation auditInformation = getAuditInformation(); auditEvent.setUserId( auditInformation.getUser() == null ? """" : auditInformation.getUser().getUsername() ); auditEvent.setRemoteIP( auditInformation.getRemoteAddr() ); for ( AuditListener auditListener : getAuditListeners() ) { auditListener.auditEvent( auditEvent ); } }",audit_accountability,audit_accountability,True,,0.9966625571250916,0.003337371628731489
13
+ 11,"@Override public void auditEvent( AuditEvent event ) { StringBuilder msg = new StringBuilder(); msg.append( checkNull( event.getRepositoryId() ) ).append( DELIM ); msg.append( event.getUserId() ).append( DELIM ); msg.append( checkNull( event.getRemoteIP() ) ).append( DELIM ); msg.append( '\""' ).append( checkNull( event.getResource() ) ).append( '\""' ).append( DELIM ); msg.append( '\""' ).append( event.getAction() ).append( '\""' ); logger.info( msg.toString() ); }",audit_accountability,audit_accountability,True,,0.9963418841362,0.003658141242340207
14
+ 12,"public AuditEvent( String repoId, String user, String resource, String action ) { this.repositoryId = repoId; this.userId = user; this.resource = resource; this.action = action; this.timestamp = Calendar.getInstance().getTime(); }",audit_accountability,audit_accountability,True,,0.9958723187446594,0.004127639811486006
15
+ 13,"Configuration configuration = getArchivaConfiguration().getConfiguration(); NetworkProxyConfiguration networkProxyConfiguration = getNetworkProxyConfiguration( networkProxy ); configuration.removeNetworkProxy( networkProxyConfiguration ); configuration.addNetworkProxy( networkProxyConfiguration ); triggerAuditEvent( networkProxy.getId(), null, AuditEvent.MODIFY_NETWORK_PROXY, auditInformation ); saveConfiguration( configuration );",audit_accountability,audit_accountability,True,,0.9966685175895691,0.003331440268084407
16
+ 14,"configuration.getRepositoryScanning().addKnownContentConsumer( knownContentConsumer ); saveConfiguration( configuration ); triggerAuditEvent( """", """", AuditEvent.ENABLE_REPO_CONSUMER, auditInformation ); }",audit_accountability,audit_accountability,True,,0.9966576099395752,0.0033424273133277893
17
+ 15,"Commit(CommitMetadata commitMetadata, List<CdoSnapshot> snapshots, Diff diff) { Validate.argumentsAreNotNull(commitMetadata, snapshots, diff); this.commitMetadata = commitMetadata; this.snapshots = snapshots; this.diff = diff; }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0008665707428008318,0.9991334080696106
18
+ 16,"public Mono<Object> markAudited(Object object) { Assert.notNull(object, ""Source object must not be null""); if (!isAuditable(object)) { return Mono.just(object); } PersistentEntity<?, ? extends PersistentProperty<?>> entity = entities .getRequiredPersistentEntity(object.getClass()); return entity.isNew(object) ? markCreated(object) : markModified(object); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.05436493828892708,0.9456350803375244
19
+ 17,JaversAuditableAspectAsync(JaversCommitAdvice javersCommitAdvice) { this.javersCommitAdvice = javersCommitAdvice; },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.8558459877967834,0.14415398240089417
20
+ 18,"public CommitMetadata(String author, Map<String, String> properties, LocalDateTime commitDate, Instant commitDateInstant, CommitId id) { Validate.argumentsAreNotNull(author, properties, commitDate, id); this.author = author; this.properties = new HashMap<>(properties); this.commitDate = commitDate; this.id = id; this.commitDateInstant = initCommitDateInstant(commitDate, commitDateInstant); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.015962179750204086,0.9840378761291504
21
+ 19,<T> Optional<AuditableBeanWrapper<T>> getBeanWrapperFor(T source);,audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007884991355240345,0.9992114305496216
22
+ 20,"public JaversAuditableAspect(Javers javers, AuthorProvider authorProvider) { this(javers, authorProvider, new EmptyPropertiesProvider()); }",audit_accountability,audit_accountability,True,,0.9915635585784912,0.0084364153444767
23
+ 21,"<T> T markCreated(Auditor<?> auditor, T source) { Assert.notNull(source, ""Source entity must not be null""); return touch(auditor, source, true); }",audit_accountability,audit_accountability,True,,0.9863481521606445,0.013651832938194275
24
+ 22,"public boolean isAuditable() { return Optionals.isAnyPresent(createdByField, createdDateField, lastModifiedByField, lastModifiedDateField); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0009130316320806742,0.9990869760513306
25
+ 23,"public JaversAuditableAspectAsync(Javers javers, AuthorProvider authorProvider, CommitPropertiesProvider commitPropertiesProvider,Executor executor) { this(new JaversCommitAdvice(javers, authorProvider, commitPropertiesProvider, executor)); }",audit_accountability,audit_accountability,True,,0.9964648485183716,0.0035351859405636787
26
+ 24,"public static AuditingHandler from(MappingContext<?, ?> mappingContext) { return new AuditingHandler(PersistentEntities.of(mappingContext)); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007030780543573201,0.9992969036102295
27
+ 25,"public JaversAuditableAspect(Javers javers, AuthorProvider authorProvider, CommitPropertiesProvider commitPropertiesProvider) { this(new JaversCommitAdvice(javers, authorProvider, commitPropertiesProvider) ); }",audit_accountability,audit_accountability,True,,0.996487021446228,0.0035130290780216455
28
+ 26,CommitEntry(CommitMetadata commitMetadata) { this.commitMetadata = commitMetadata; },unrelated,unrelated,True,,0.0008890447206795216,0.999110996723175
29
+ 27,private static final Log logger = LogFactory.getLog(AuditingHandler.class);,unrelated,unrelated,True,,0.000662136182654649,0.9993378520011902
30
+ 28,JaversAuditableAspect(JaversCommitAdvice javersCommitAdvice) { this.javersCommitAdvice = javersCommitAdvice; },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.5178748965263367,0.48212510347366333
31
+ 29,"package org.javers.core.metamodel.annotation; import org.javers.repository.api.JaversRepository; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Target ({FIELD, METHOD}) @Retention (RUNTIME) public @interface PropertyName { String value(); }",unrelated,unrelated,True,,0.0007101108785718679,0.999289870262146
32
+ 30,"protected final boolean isAuditable(Object source) { Assert.notNull(source, ""Source entity must not be null""); return factory.getBeanWrapperFor(source).isPresent(); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0010555449407547712,0.9989444613456726
33
+ 31,final CommitMetadata context;,unrelated,unrelated,True,,0.0009308463195338845,0.9990691542625427
34
+ 32,"private <T> T touch(Auditor<?> auditor, T target, boolean isNew) { Optional<AuditableBeanWrapper<T>> wrapper = factory.getBeanWrapperFor(target); return wrapper.map(it -> { touchAuditor(auditor, it, isNew); Optional<TemporalAccessor> now = dateTimeForNow ? touchDate(it, isNew) : Optional.empty();",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007417748565785587,0.9992582201957703
35
+ 33,"public <T> T markModified(T source) { Assert.notNull(source, ""Entity must not be null""); return markModified(getAuditor(), source); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0036575798876583576,0.9963423609733582
36
+ 34,"public JaversExtendedRepository(JaversRepository delegate, SnapshotDiffer snapshotDiffer) { this.delegate = delegate; this.snapshotDiffer = snapshotDiffer; previousSnapshotsCalculator = new PreviousSnapshotsCalculator(input -> getSnapshots(input)); }",unrelated,unrelated,True,,0.0008415053016506135,0.999158501625061
37
+ 35,"private Commit createCommit(String author, Map<String, String> properties, LiveGraph currentGraph){ CommitMetadata commitMetadata = newCommitMetadata(author, properties); ObjectGraph<CdoSnapshot> latestSnapshotGraph = snapshotGraphFactory.loadLatestAndCreateGraph(currentGraph.globalIds()); List<CdoSnapshot> changedCdoSnapshots = changedCdoSnapshotsFactory.create(currentGraph, latestSnapshotGraph.cdos(), commitMetadata); Diff diff = diffFactory.create(latestSnapshotGraph, currentGraph, Optional.of(commitMetadata)); return new Commit(commitMetadata, changedCdoSnapshots, diff); }",audit_accountability,audit_accountability,True,,0.9930773973464966,0.006922603119164705
38
+ 36,"Class<?> entityClass = it.getClass(); return entities.mapOnContext(entityClass, (context, entity) -> { MappingAuditingMetadata metadata = getMetadata(context, entityClass); if (metadata.isAuditable()) { return Optional.<AuditableBeanWrapper<T>> of(new MappingMetadataAuditableBeanWrapper<>(getConversionService(), entity.getPropertyPathAccessor(it), metadata)); } return Optional.<AuditableBeanWrapper<T>> empty(); }).orElseGet(() -> super.getBeanWrapperFor(source));",audit_accountability,audit_accountability,True,,0.847515344619751,0.15248462557792664
39
+ 37,"public JaversCommitAdvice(Javers javers, AuthorProvider authorProvider, CommitPropertiesProvider commitPropertiesProvider, Executor executor) { this.javers = javers; this.authorProvider = authorProvider; this.commitPropertiesProvider = commitPropertiesProvider; this.executor = executor; }",unrelated,unrelated,True,,0.0007432321435771883,0.9992567896842957
40
+ 38,"public <T> T markCreated(T source) { Assert.notNull(source, ""Entity must not be null""); return markCreated(getAuditor(), source); }",audit_accountability,audit_accountability,True,,0.9891228079795837,0.010877253487706184
41
+ 39,public boolean isAuditable() { return isAuditable.get(); },unrelated,unrelated,True,,0.0007373530534096062,0.9992626309394836
42
+ 40,"public Object markAudited(Object object) { Assert.notNull(object, ""Source object must not be null""); if (!isAuditable(object)) { return object; } PersistentEntity<?, ? extends PersistentProperty<?>> entity = entities .getRequiredPersistentEntity(object.getClass()); return entity.isNew(object) ? markCreated(object) : markModified(object); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.19444452226161957,0.805555522441864
43
+ 41,"public AuditingHandler(PersistentEntities entities) { super(entities); Assert.notNull(entities, ""PersistentEntities must not be null""); this.auditorAware = Optional.empty(); }",audit_accountability,audit_accountability,True,,0.9963005781173706,0.0036993727553635836
44
+ 42,public void setAuditorAware(@Nullable AuditorAware<?> auditorAware) { this.auditorAware = Optional.ofNullable(auditorAware); },unrelated,unrelated,True,,0.0007099257200025022,0.9992899894714355
45
+ 43,public boolean isAuditableAspectEnabled() { return auditableAspectEnabled; },unrelated,unrelated,True,,0.0007424452342092991,0.999257504940033
46
+ 44,public void setAuditableAspectEnabled(boolean auditableAspectEnabled) { this.auditableAspectEnabled = auditableAspectEnabled; },unrelated,unrelated,True,,0.0008373292512260377,0.9991626739501953
47
+ 45,@Override protected Class<?> getBeanClass(Element element) { return AuditingHandler.class; },unrelated,unrelated,True,,0.0007634436478838325,0.9992365837097168
48
+ 46,public void setAuditorAware(@Nullable ReactiveAuditorAware<?> auditorAware) { this.auditorAware = auditorAware == null ? Mono::empty : auditorAware; },unrelated,unrelated,True,,0.0006986649823375046,0.9993013143539429
49
+ 47,package org.javers.spring.annotation; import org.javers.core.Javers; import org.javers.spring.auditable.aspect.JaversAuditableAspect; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) public @interface JaversAuditableConditionalDelete { },unrelated,unrelated,True,,0.0006820448325015604,0.99931800365448
50
+ 48,"protected void notifyFailure(AuthenticationToken token, AuthenticationException ae) { for (AuthenticationListener listener : this.listeners) { listener.onFailure(token, ae); } }",audit_accountability,audit_accountability,True,,0.9963380098342896,0.00366196152754128
51
+ 49,"@Override public void written(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen, Throwable thrown) { this.applicationEventPublisher.publishEvent(new FileWrittenEvent(session, remoteHandle, localHandle.getFile(), dataLen, thrown)); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9599892497062683,0.040010739117860794
52
+ 50,"@Override public void created(ServerSession session, Path path, Map<String, ?> attrs, Throwable thrown) { this.applicationEventPublisher.publishEvent(new DirectoryCreatedEvent(session, path, attrs)); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9818547964096069,0.018145255744457245
53
+ 51,"protected void publish(String message) { FileTailingEvent event = new FileTailingEvent(this, message, getFile()); this.eventPublisher.publishEvent(event); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9962246417999268,0.003775383345782757
54
+ 52,"try { notifyFailure(token, ae); } catch (Throwable t2) { if (LOGGER.isWarnEnabled()) { String msg = ""Unable to send notification for failed authentication attempt - listener error?. "" + ""Please check your AuthenticationListener implementation(s). Logging sending exception "" + ""and propagating original AuthenticationException instead...""; LOGGER.warn(msg, t2); } }",audit_accountability,audit_accountability,True,,0.9965822100639343,0.0034178541973233223
55
+ 53,"@Override public void removed(ServerSession session, Path path, boolean isDirectory, Throwable thrown) { this.applicationEventPublisher.publishEvent(new PathRemovedEvent(session, path, isDirectory, thrown)); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9935405850410461,0.006459440104663372
56
+ 54,"protected void notifySuccess(AuthenticationToken token, AuthenticationInfo info) { for (AuthenticationListener listener : this.listeners) { listener.onSuccess(token, info); } }",audit_accountability,audit_accountability,True,,0.9964622855186462,0.0035377820022404194
57
+ 55,"@SuppressWarnings({""UnusedDeclaration""}) public Collection<AuthenticationListener> getAuthenticationListeners() { return this.listeners; }",unrelated,unrelated,True,,0.0006963033229112625,0.9993036985397339
58
+ 56,private Collection<AuthenticationListener> listeners;,unrelated,unrelated,True,,0.0007809622911736369,0.9992190599441528
59
+ 57,"@SuppressWarnings(""NullAway.Init"") private ApplicationEventPublisher eventPublisher;",unrelated,unrelated,True,,0.0007344287005253136,0.9992656111717224
60
+ 58,public AbstractAuthenticator() { listeners = new ArrayList<AuthenticationListener>(); },unrelated,unrelated,True,,0.11549683660268784,0.884503185749054
61
+ 59,"@SuppressWarnings({""UnusedDeclaration""}) public void setAuthenticationListeners(Collection<AuthenticationListener> listeners) { if (listeners == null) { this.listeners = new ArrayList<AuthenticationListener>(); } else { this.listeners = listeners; } }",unrelated,unrelated,True,,0.0007135950727388263,0.9992864727973938
62
+ 60,protected void notifyLogout(PrincipalCollection principals) { for (AuthenticationListener listener : this.listeners) { listener.onLogout(principals); } },audit_accountability,audit_accountability,True,,0.9965522289276123,0.003447748487815261
63
+ 61,"private void simulateFailedLogin(AuthenticationToken token) { try { AuthenticationInfo simulated = ensureSimulatedAuthenticationInfo(); if (simulated != null && assertCredentialsMatchWithoutException(token, simulated)) { String msg = ""Submitted credentials for token ["" + token + ""] matched the simulated credentials. "" + ""This indicates a misconfiguration of the realm's "" + ""CredentialsMatcher or simulated credentials. Please review your configuration.""; throw new IncorrectCredentialsException(msg); } } catch (AuthenticationException authenticationException) { LOGGER.error( ""CredentialsMatcher [{}] threw exception on method 'doCredentialsMatch'"", getCredentialsMatcher(), authenticationException); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9965315461158752,0.003468502778559923
64
+ 62,protected void informCancelled( PeerReadRequest request ) { for (int i=0;i<listeners.size();i++){ try{ ((ExternalSeedReaderListener)listeners.get(i)).requestCancelled( request ); }catch( Throwable e ){ e.printStackTrace(); } } },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9961208701133728,0.0038790665566921234
65
+ 63,"private void checkAuthority(final String userName, final String srcRepositoryId, final String dstRepositoryId ) throws ArchivaRestServiceException { User user; try { user = securitySystem.getUserManager().findUser( userName ); } catch ( UserNotFoundException e ) { httpServletResponse.setHeader( ""WWW-Authenticate"", ""Bearer realm=\""archiva\"""" ); throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.USER_NOT_FOUND, userName ), 401 ); } catch ( UserManagerException e ) { throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.USER_MANAGER_ERROR, e.getMessage( ) ) ); } AuthenticationResult authn = new AuthenticationResult( true, userName, null ); SecuritySession securitySession = new DefaultSecuritySession( authn, user ); try { boolean authz = securitySystem.isAuthorized( securitySession, OPERATION_READ_REPOSITORY, srcRepositoryId ); if ( !authz ) { throw new ArchivaRestServiceException(ErrorMessage.of( ErrorKeys.PERMISSION_REPOSITORY_DENIED, srcRepositoryId, OPERATION_READ_REPOSITORY ), 403); } } catch ( AuthorizationException e ) { log.error( ""Error reading permission: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.AUTHORIZATION_ERROR, e.getMessage() ), 403); } try { boolean authz = securitySystem.isAuthorized( securitySession, ArchivaRoleConstants.OPERATION_ADD_ARTIFACT, dstRepositoryId ); if ( !authz ) { throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.PERMISSION_REPOSITORY_DENIED, dstRepositoryId, OPERATION_ADD_ARTIFACT ) ); } } catch ( AuthorizationException e ) { log.error( ""Error reading permission: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.AUTHORIZATION_ERROR, e.getMessage() ), 403); } }",unrelated,unrelated,True,,0.36689135432243347,0.6331086158752441
66
+ 64,"protected String sendRequestForData(final OAuthService service, final Token accessToken, final String dataUrl, Verb verb) { logger.debug(""accessToken: {} / dataUrl: {}"", accessToken, dataUrl); val t0 = System.currentTimeMillis(); val request = createOAuthRequest(dataUrl, verb); signRequest(service, accessToken, request); final String body; final int code; try { var response = service.execute(request); code = response.getCode(); body = response.getBody(); } catch (final IOException | InterruptedException | ExecutionException e) { throw new HttpCommunicationException(""Error getting body: "" + e.getMessage()); } val t1 = System.currentTimeMillis(); logger.debug(""Request took: "" + (t1 - t0) + "" ms for: "" + dataUrl); logger.debug(""response code: {} / response body: {}"", code, body); if (code != 200) { throw new HttpCommunicationException(code, body); } return body; }",unrelated,unrelated,True,,0.003056216984987259,0.9969437718391418
67
+ 65,"@Override public Optional<Credentials> extract(final CallContext ctx) { val webContext = ctx.webContext(); val logoutToken = webContext.getRequestParameter(""logout_token""); val sid = webContext.getRequestParameter(Pac4jConstants.OIDC_CLAIM_SESSIONID); if (logoutToken.isPresent()) { try { val jwt = JWTParser.parse(logoutToken.get()); if (jwt instanceof EncryptedJWT) { LOGGER.error(""Encrypted JWTs are not accepted for logout requests""); throw new BadRequestAction(); } String sessionId; if (configuration.isLogoutValidation()) { val claims = configuration.getOpMetadataResolver().getTokenValidator().validateLogoutToken(jwt); if (claims.getClaim(OidcConfiguration.NONCE) != null) { LOGGER.error(""The nonce claim should not exist for logout requests""); throw new BadRequestAction(); } val events = claims.getClaim(""events""); if (!(events instanceof Map mapEvents) || !mapEvents.containsKey(""http://schemas.openid.net/event/backchannel-logout"")) { LOGGER.error(""The events claim should contain the 'http://schemas.openid.net/event/backchannel-logout'"" + "" member name for logout requests""); throw new BadRequestAction(); } sessionId = (String) claims.getClaim(Pac4jConstants.OIDC_CLAIM_SESSIONID); if (StringUtils.isBlank(sessionId)) { LOGGER.error(""The sid claim is mandatory for logout requests""); throw new BadRequestAction(); } } else { ANNOUNCE_LOGOUT_VALIDATION_DISABLED.announce(); sessionId = (String) jwt.getJWTClaimsSet().getClaim(Pac4jConstants.OIDC_CLAIM_SESSIONID); } LOGGER.debug(""Handling back-channel logout for sessionId: {}"", sessionId); return Optional.of(new SessionKeyCredentials(LogoutType.BACK, sessionId)); } catch (final java.text.ParseException | BadJOSEException | JOSEException e) { LOGGER.error(""Cannot validate JWT logout token"", e); throw new BadRequestAction(); } } else if (sid.isPresent()) { val sessionId = sid.get(); LOGGER.debug(""Handling front-channel logout for sessionId: {}"", sessionId); return Optional.of(new SessionKeyCredentials(LogoutType.FRONT, sessionId)); } else { val computedCallbackUrl = client.computeFinalCallbackUrl(webContext); val parameters = retrieveParameters(webContext); AuthenticationResponse response; try { response = AuthenticationResponseParser.parse(new URI(computedCallbackUrl), parameters); } catch (final URISyntaxException | ParseException e) { throw new OidcException(e); } if (response instanceof AuthenticationErrorResponse) { LOGGER.error(""Bad authentication response, error={}"", ((AuthenticationErrorResponse) response).getErrorObject()); return Optional.empty(); } LOGGER.debug(""Authentication response successful""); var successResponse = (AuthenticationSuccessResponse) response; var metadata = configuration.getOpMetadataResolver().load(); if (metadata.supportsAuthorizationResponseIssuerParam() && !metadata.getIssuer().equals(successResponse.getIssuer())) { throw new OidcIssuerMismatchException(""Issuer mismatch, possible mix-up attack, received issuer: '"" + successResponse.getIssuer() + ""'""); } if (configuration.isWithState()) { val requestState = (State) configuration.getValueRetriever() .retrieve(ctx, client.getStateSessionAttributeName(), client) .orElseThrow(() -> new OidcMissingSessionStateException(""State cannot be determined"")); val responseState = successResponse.getState(); if (responseState == null) { throw new OidcMissingStateParameterException(""Missing state parameter""); } LOGGER.debug(""Request state: {}/response state: {}"", requestState, responseState); if (!requestState.equals(responseState)) { throw new OidcStateMismatchException( ""State parameter is different from the one sent in authentication request.""); } } else { OidcRedirectionActionBuilder.ANNOUNCE_WITH_STATE_DISABLED.announce(); } val credentials = new OidcCredentials(); val code = successResponse.getAuthorizationCode(); if (code != null) { credentials.setCode(code.getValue()); } val idToken = successResponse.getIDToken(); if (idToken != null) { credentials.setIdToken(idToken.serialize()); } val accessToken = successResponse.getAccessToken(); if (accessToken != null) { credentials.setAccessTokenObject(accessToken); } if (code == null && idToken == null && accessToken == null) { throw new TechnicalException(""Cannot accept empty OIDC credentials""); } return Optional.of(credentials); } }",unrelated,unrelated,True,,0.06009479984641075,0.9399052262306213
68
+ 66,"protected List<String> getObservableRepos() { try { List<String> ids = userRepositories.getObservableRepositoryIds( getPrincipal() ); return ids == null ? Collections.<String>emptyList() : ids; } catch ( PrincipalNotFoundException e ) { log.warn( e.getMessage(), e ); } catch ( AccessDeniedException e ) { log.warn( e.getMessage(), e ); } catch ( ArchivaSecurityException e ) { log.warn( e.getMessage(), e ); } return Collections.emptyList(); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9957423806190491,0.004257640801370144
69
+ 67,"@Override public void beginScan( ManagedRepository repo, Date whenGathered ) throws ConsumerException { repoId = repo.getId(); this.repositoryDir = Paths.get( repo.getLocation() ); try { repositorySession = repositorySessionFactory.createSession(); } catch ( MetadataRepositoryException e ) { e.printStackTrace( ); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9896793365478516,0.010320649482309818
70
+ 68,"private Logger logger = LoggerFactory.getLogger( ""org.apache.archiva.AuditLog"" );",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.000660295132547617,0.9993396401405334
71
+ 69,"private boolean isAllowed( HttpServletRequest req, String repositoryId, String groupId, String artifactId ) throws UserNotFoundException, AccountLockedException, AuthenticationException, MustChangePasswordException, UnauthorizedException { String auth = req.getHeader( ""Authorization"" ); List<String> repoIds = new ArrayList<>(); if ( repositoryId != null ) { repoIds.add( repositoryId ); } else if ( artifactId != null && groupId != null ) { if ( auth != null ) { if ( !auth.toUpperCase().startsWith( ""BASIC "" ) ) { return false; } Decoder dec = new Base64(); String usernamePassword = """"; try { usernamePassword = new String( (byte[]) dec.decode( auth.substring( 6 ).getBytes() ) ); } catch ( DecoderException ie ) { log.warn( ""Error decoding username and password: {}"", ie.getMessage() ); } if ( usernamePassword == null || usernamePassword.trim().equals( """" ) ) { repoIds = getObservableRepos( UserManager.GUEST_USERNAME ); } else { String[] userCredentials = usernamePassword.split( "":"" ); repoIds = getObservableRepos( userCredentials[0] ); } } else { repoIds = getObservableRepos( UserManager.GUEST_USERNAME ); } } else { return false; } for ( String repoId : repoIds ) { try { AuthenticationResult result = httpAuth.getAuthenticationResult( req, null ); SecuritySession securitySession = httpAuth.getSecuritySession( req.getSession( true ) ); if ( servletAuth.isAuthenticated( req, result ) && servletAuth.isAuthorized( req, securitySession, repoId, ArchivaRoleConstants.OPERATION_READ_REPOSITORY ) ) { return true; } } catch ( AuthorizationException e ) { log.debug( ""AuthorizationException for repoId: {}"", repoId ); } catch ( UnauthorizedException e ) { log.debug( ""UnauthorizedException for repoId: {}"", repoId ); } } throw new UnauthorizedException( ""Access denied."" ); }",unrelated,unrelated,True,,0.000946316693443805,0.9990536570549011
72
+ 70,"@Override public void update(final ArchivaIndexingContext context, final boolean fullUpdate) throws IndexUpdateFailedException { log.info( ""start download remote index for remote repository {}"", context.getRepository( ).getId( ) ); URI remoteUpdateUri; if ( !( context.getRepository( ) instanceof RemoteRepository ) || !(context.getRepository().supportsFeature(RemoteIndexFeature.class)) ) { throw new IndexUpdateFailedException( ""The context is not associated to a remote repository with remote index "" + context.getId( ) ); } else { RemoteIndexFeature rif = context.getRepository().getFeature( RemoteIndexFeature.class ); remoteUpdateUri = context.getRepository().getLocation().resolve(rif.getIndexUri()); } final RemoteRepository remoteRepository = (RemoteRepository) context.getRepository( ); executeUpdateFunction( context, indexingContext -> { try { Path tempIndexDirectory = Paths.get( indexingContext.getIndexDirectoryFile( ).getParent( ), "".tmpIndex"" ); Path indexCacheDirectory = Paths.get( indexingContext.getIndexDirectoryFile( ).getParent( ), "".indexCache"" ); Files.createDirectories( indexCacheDirectory ); if ( Files.exists( tempIndexDirectory ) ) { org.apache.archiva.common.utils.FileUtils.deleteDirectory( tempIndexDirectory ); } Files.createDirectories( tempIndexDirectory ); tempIndexDirectory.toFile( ).deleteOnExit( ); String baseIndexUrl = indexingContext.getIndexUpdateUrl( ); String wagonProtocol = remoteUpdateUri.toURL( ).getProtocol( ); NetworkProxy networkProxy = null; if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) ) { RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); if ( StringUtils.isNotBlank( rif.getProxyId( ) ) ) { networkProxy = proxyRegistry.getNetworkProxy( rif.getProxyId( ) ); if ( networkProxy == null ) { log.warn( ""your remote repository is configured to download remote index trought a proxy we cannot find id:{}"", rif.getProxyId( ) ); } } final StreamWagon wagon = (StreamWagon) wagonFactory.getWagon( new WagonFactoryRequest( wagonProtocol, remoteRepository.getExtraHeaders( ) ).networkProxy( networkProxy ) ); int readTimeout = (int) rif.getDownloadTimeout( ).toMillis( ) * 1000; wagon.setReadTimeout( readTimeout ); wagon.setTimeout( (int) remoteRepository.getTimeout( ).toMillis( ) * 1000 ); if ( wagon instanceof AbstractHttpClientWagon ) { HttpConfiguration httpConfiguration = new HttpConfiguration( ); HttpMethodConfiguration httpMethodConfiguration = new HttpMethodConfiguration( ); httpMethodConfiguration.setUsePreemptive( true ); httpMethodConfiguration.setReadTimeout( readTimeout ); httpConfiguration.setGet( httpMethodConfiguration ); AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration ); } wagon.addTransferListener( new DownloadListener( ) ); ProxyInfo proxyInfo = null; if ( networkProxy != null ) { proxyInfo = new ProxyInfo( ); proxyInfo.setType( networkProxy.getProtocol( ) ); proxyInfo.setHost( networkProxy.getHost( ) ); proxyInfo.setPort( networkProxy.getPort( ) ); proxyInfo.setUserName( networkProxy.getUsername( ) ); proxyInfo.setPassword( new String(networkProxy.getPassword( )) ); } AuthenticationInfo authenticationInfo = null; if ( remoteRepository.getLoginCredentials( ) != null && ( remoteRepository.getLoginCredentials( ) instanceof PasswordCredentials ) ) { PasswordCredentials creds = (PasswordCredentials) remoteRepository.getLoginCredentials( ); authenticationInfo = new AuthenticationInfo( ); authenticationInfo.setUserName( creds.getUsername( ) ); authenticationInfo.setPassword( new String( creds.getPassword( ) ) ); } wagon.connect( new org.apache.maven.wagon.repository.Repository( remoteRepository.getId( ), baseIndexUrl ), authenticationInfo, proxyInfo ); Path indexDirectory = indexingContext.getIndexDirectoryFile( ).toPath( ); if ( !Files.exists( indexDirectory ) ) { Files.createDirectories( indexDirectory ); } ResourceFetcher resourceFetcher = new WagonResourceFetcher( log, tempIndexDirectory, wagon, remoteRepository ); IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher ); request.setForceFullUpdate( fullUpdate ); request.setLocalIndexCacheDir( indexCacheDirectory.toFile( ) ); indexUpdater.fetchAndUpdateIndex( request ); indexingContext.updateTimestamp( true ); } } catch ( AuthenticationException e ) { log.error( ""Could not login to the remote proxy for updating index of {}"", remoteRepository.getId( ), e ); throw new IndexUpdateFailedException( ""Login in to proxy failed while updating remote repository "" + remoteRepository.getId( ), e ); } catch ( ConnectionException e ) { log.error( ""Connection error during index update for remote repository {}"", remoteRepository.getId( ), e ); throw new IndexUpdateFailedException( ""Connection error during index update for remote repository "" + remoteRepository.getId( ), e ); } catch ( MalformedURLException e ) { log.error( ""URL for remote index update of remote repository {} is not correct {}"", remoteRepository.getId( ), remoteUpdateUri, e ); throw new IndexUpdateFailedException( ""URL for remote index update of repository is not correct "" + remoteUpdateUri, e ); } catch ( IOException e ) { log.error( ""IOException during index update of remote repository {}: {}"", remoteRepository.getId( ), e.getMessage( ), e ); throw new IndexUpdateFailedException( ""IOException during index update of remote repository "" + remoteRepository.getId( ) + ( StringUtils.isNotEmpty( e.getMessage( ) ) ? "": "" + e.getMessage( ) : """" ), e ); } catch ( WagonFactoryException e ) { log.error( ""Wagon for remote index download of {} could not be created: {}"", remoteRepository.getId( ), e.getMessage( ), e ); throw new IndexUpdateFailedException( ""Error while updating the remote index of "" + remoteRepository.getId( ), e ); } } ); }",unrelated,unrelated,True,,0.0007737126434221864,0.9992263317108154
73
+ 71,"public static void closeResultSet(ResultSet rs) { if (rs != null) { try { rs.close(); } catch (SQLException ex) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(""Could not close JDBC ResultSet"", ex); } } catch (Throwable ex) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(""Unexpected exception on closing JDBC ResultSet"", ex); } } } }",unrelated,unrelated,True,,0.000774941872805357,0.9992250204086304
74
+ 72,"@Override public void anonymousBind() throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04109_ANONYMOUS_BIND ) ); } BindRequest bindRequest = createBindRequest( StringConstants.EMPTY, Strings.EMPTY_BYTES ); BindResponse bindResponse = bind( bindRequest ); processResponse( bindResponse ); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9961133003234863,0.0038866542745381594
75
+ 73,"val code = connection.getResponseCode(); if (code == 200) { LOGGER.debug(""Authentication success for username: {}"", username); return HttpUtils.readBody(connection); } else if (code == 401 || code == 403) { LOGGER.info(""Authentication failure for username: {} -> {}"", username, HttpUtils.buildHttpErrorMessage(connection)); return null; } else { LOGGER.warn(""Unexpected error for username: {} -> {}"", username, HttpUtils.buildHttpErrorMessage(connection)); return null; }",audit_accountability,audit_accountability,True,,0.996607780456543,0.0033922295551747084
76
+ 74,"public static final Logger logger = LoggerFactory.getLogger( ""org.apache.archiva.AuditLog"" );",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.000661465513985604,0.9993385672569275
77
+ 75,"@Override public ActionStatus copyArtifact( ArtifactTransferRequest artifactTransferRequest ) throws ArchivaRestServiceException { String userName = getAuditInformation().getUser().getUsername(); if ( StringUtils.isBlank( userName ) ) { throw new ArchivaRestServiceException( ""copyArtifact call: userName not found"", null ); } if ( StringUtils.isBlank( artifactTransferRequest.getRepositoryId() ) ) { throw new ArchivaRestServiceException( ""copyArtifact call: sourceRepositoryId cannot be null"", null ); } if ( StringUtils.isBlank( artifactTransferRequest.getTargetRepositoryId() ) ) { throw new ArchivaRestServiceException( ""copyArtifact call: targetRepositoryId cannot be null"", null ); } ManagedRepository source = null; source = repositoryRegistry.getManagedRepository( artifactTransferRequest.getRepositoryId() ); if ( source == null ) { throw new ArchivaRestServiceException( ""cannot find repository with id "" + artifactTransferRequest.getRepositoryId(), null ); } ManagedRepository target = null; target = repositoryRegistry.getManagedRepository( artifactTransferRequest.getTargetRepositoryId() ); if ( target == null ) { throw new ArchivaRestServiceException( ""cannot find repository with id "" + artifactTransferRequest.getTargetRepositoryId(), null ); } if ( StringUtils.isBlank( artifactTransferRequest.getGroupId() ) ) { throw new ArchivaRestServiceException( ""groupId is mandatory"", null ); } if ( StringUtils.isBlank( artifactTransferRequest.getArtifactId() ) ) { throw new ArchivaRestServiceException( ""artifactId is mandatory"", null ); } if ( StringUtils.isBlank( artifactTransferRequest.getVersion() ) ) { throw new ArchivaRestServiceException( ""version is mandatory"", null ); } if ( VersionUtil.isSnapshot( artifactTransferRequest.getVersion() ) ) { throw new ArchivaRestServiceException( ""copy of SNAPSHOT not supported"", null ); } User user = null; try { user = securitySystem.getUserManager().findUser( userName ); } catch ( UserNotFoundException e ) { throw new ArchivaRestServiceException( ""user "" + userName + "" not found"", e ); } catch ( UserManagerException e ) { throw new ArchivaRestServiceException( ""ArchivaRestServiceException:"" + e.getMessage(), e ); } AuthenticationResult authn = new AuthenticationResult( true, userName, null ); SecuritySession securitySession = new DefaultSecuritySession( authn, user ); try { boolean authz = securitySystem.isAuthorized( securitySession, ArchivaRoleConstants.OPERATION_READ_REPOSITORY, artifactTransferRequest.getRepositoryId() ); if ( !authz ) { throw new ArchivaRestServiceException( ""not authorized to access repo:"" + artifactTransferRequest.getRepositoryId(), null ); } } catch ( AuthorizationException e ) { log.error( ""error reading permission: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } try { boolean authz = securitySystem.isAuthorized( securitySession, ArchivaRoleConstants.OPERATION_ADD_ARTIFACT, artifactTransferRequest.getTargetRepositoryId() ); if ( !authz ) { throw new ArchivaRestServiceException( ""not authorized to write to repo:"" + artifactTransferRequest.getTargetRepositoryId(), null ); } } catch ( AuthorizationException e ) { log.error( ""error reading permission: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } String packaging = StringUtils.trim( artifactTransferRequest.getPackaging() ); ItemSelector selector = ArchivaItemSelector.builder( ) .withProjectId( artifactTransferRequest.getArtifactId( ) ) .withArtifactId( artifactTransferRequest.getArtifactId( ) ) .withNamespace( artifactTransferRequest.getGroupId( ) ) .withArtifactVersion( artifactTransferRequest.getVersion( ) ) .withClassifier( artifactTransferRequest.getClassifier( ) ) .withExtension( StringUtils.isEmpty( packaging ) ? ""jar"" : packaging ) .build( ); try { ManagedRepositoryContent sourceRepository = getManagedRepositoryContent( artifactTransferRequest.getRepositoryId() ); BaseRepositoryContentLayout layout = sourceRepository.getLayout( BaseRepositoryContentLayout.class ); org.apache.archiva.repository.content.Artifact sourceArtifact = layout.getArtifact( selector ); if ( !sourceArtifact.exists() ) { log.error( ""cannot find artifact {}"", artifactTransferRequest ); throw new ArchivaRestServiceException( ""cannot find artifact "" + artifactTransferRequest.toString(), null ); } StorageAsset artifactFile = sourceArtifact.getAsset( ); ManagedRepositoryContent targetRepository = getManagedRepositoryContent( artifactTransferRequest.getTargetRepositoryId() ); String artifactPath = artifactFile.getPath( ); int lastIndex = artifactPath.lastIndexOf( '/' ); String path = artifactPath.substring( 0, lastIndex ); StorageAsset targetDir = target.getAsset( path ); Date lastUpdatedTimestamp = Calendar.getInstance().getTime(); int newBuildNumber = 1; String timestamp = null; StorageAsset versionMetadataFile = target.getAsset(path + ""/"" + MetadataTools.MAVEN_METADATA ); getMetadata( targetRepository.getRepository().getType(), versionMetadataFile ); if ( !targetDir.exists() ) { targetDir = target.addAsset(targetDir.getPath(), true); targetDir.create(); } String filename = artifactPath.substring( lastIndex + 1 ); boolean fixChecksums = !( archivaAdministration.getKnownContentConsumers().contains( ""create-missing-checksums"" ) ); StorageAsset targetFile = target.getAsset(targetDir.getPath() + ""/"" + filename ); if ( targetFile.exists() && target.blocksRedeployments()) { throw new ArchivaRestServiceException( ""artifact already exists in target repo: "" + artifactTransferRequest.getTargetRepositoryId() + "" and redeployment blocked"", null ); } else { copyFile(artifactFile, targetFile, fixChecksums ); queueRepositoryTask( target.getId(), targetFile ); } String pomFilename = filename; if ( StringUtils.isNotBlank( artifactTransferRequest.getClassifier() ) ) { pomFilename = StringUtils.remove( pomFilename, ""-"" + artifactTransferRequest.getClassifier() ); } pomFilename = FilenameUtils.removeExtension( pomFilename ) + "".pom""; StorageAsset pomFile = source.getAsset( artifactPath.substring( 0, artifactPath.lastIndexOf( '/' ) )+""/""+ pomFilename ); if ( pomFile != null && pomFile.exists() ) { StorageAsset targetPomFile = target.getAsset( targetDir.getPath() + ""/"" + pomFilename ); copyFile(pomFile, targetPomFile, fixChecksums ); queueRepositoryTask( target.getId(), targetPomFile ); } if ( !archivaAdministration.getKnownContentConsumers().contains( ""metadata-updater"" ) ) { updateProjectMetadata( target.getType(), target, targetDir, lastUpdatedTimestamp, timestamp, newBuildNumber, fixChecksums, artifactTransferRequest ); } String msg = ""Artifact \'"" + artifactTransferRequest.getGroupId() + "":"" + artifactTransferRequest.getArtifactId() + "":"" + artifactTransferRequest.getVersion() + ""\' was successfully deployed to repository \'"" + artifactTransferRequest.getTargetRepositoryId() + ""\'""; log.debug(""copyArtifact {}"", msg); } catch ( RepositoryException | LayoutException e ) { log.error( ""RepositoryException: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } catch ( RepositoryAdminException e ) { log.error( ""RepositoryAdminException: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } catch ( IOException e ) { log.error( ""IOException: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } return ActionStatus.SUCCESS; }",unrelated,unrelated,True,,0.10309610515832901,0.896903932094574
78
+ 76,"if (sessionStore == null) { LOGGER.warn(""No session store. Cannot destroy session""); return; }",audit_accountability,audit_accountability,True,,0.9961209893226624,0.0038790078833699226
79
+ 77,"private List<String> getObservableRepos( String principal ) { try { return userRepositories.getObservableRepositoryIds( principal ); } catch ( PrincipalNotFoundException e ) { log.warn( e.getMessage(), e ); } catch ( AccessDeniedException e ) { log.warn( e.getMessage(), e ); } catch ( ArchivaSecurityException e ) { log.warn( e.getMessage(), e ); } return Collections.emptyList(); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.996346652507782,0.0036533456295728683
80
+ 78,"@Override public Object perform(final Config config, final SecurityGrantedAccessAdapter securityGrantedAccessAdapter, final String clients, final String authorizers, final String matchers, final FrameworkParameters parameters) { LOGGER.debug(""=== SECURITY ===""); val ctx = buildContext(config, parameters); val webContext = ctx.webContext(); val sessionStore = ctx.sessionStore(); val httpActionAdapter = config.getHttpActionAdapter(); assertNotNull(""httpActionAdapter"", httpActionAdapter); HttpAction action; try { assertNotNull(""clientFinder"", clientFinder); assertNotNull(""authorizationChecker"", authorizationChecker); assertNotNull(""matchingChecker"", matchingChecker); val configClients = config.getClients(); assertNotNull(""configClients"", configClients); LOGGER.debug(""url: {}"", webContext.getFullRequestURL()); LOGGER.debug(""clients: {} | matchers: {}"", clients, matchers); val currentClients = clientFinder.find(configClients, webContext, clients); LOGGER.debug(""currentClients: {}"", currentClients); if (matchingChecker.matches(ctx, matchers, config.getMatchers(), currentClients)) { val manager = ctx.profileManagerFactory().apply(webContext, sessionStore); manager.setConfig(config); var profiles = this.loadProfilesFromSession ? loadProfiles(ctx, manager, currentClients) : List.<UserProfile>of(); LOGGER.debug(""Loaded profiles (from session: {}): {} "", this.loadProfilesFromSession, profiles); if (isEmpty(profiles) && !isEmpty(currentClients)) { var updated = false; for (val currentClient : currentClients) { if (currentClient instanceof DirectClient directClient) { LOGGER.debug(""Performing authentication for direct client: {}"", currentClient); var credentials = currentClient.getCredentials(ctx).orElse(null); credentials = currentClient.validateCredentials(ctx, credentials).orElse(null); LOGGER.debug(""credentials: {}"", credentials); if (credentials != null && credentials.isForAuthentication()) { val optProfile = currentClient.getUserProfile(ctx, credentials); LOGGER.debug(""profile: {}"", optProfile); if (optProfile.isPresent()) { val profile = optProfile.get(); val saveProfileInSession = directClient.getSaveProfileInSession(webContext, profile); val multiProfile = directClient.isMultiProfile(webContext, profile); LOGGER.debug(""saveProfileInSession: {} / multiProfile: {}"", saveProfileInSession, multiProfile); manager.save(saveProfileInSession, profile, multiProfile); updated = true; if (!multiProfile) { break; } } } } } if (updated) { profiles = loadProfiles(ctx, manager, currentClients); LOGGER.debug(""Reloaded profiles: {}"", profiles); } } if (isNotEmpty(profiles)) { LOGGER.debug(""authorizers: {}"", authorizers); if (authorizationChecker.isAuthorized(webContext, sessionStore, profiles, authorizers, config.getAuthorizers(), currentClients)) { LOGGER.debug(""authenticated and authorized -> grant access""); return securityGrantedAccessAdapter.adapt(webContext, sessionStore, profiles); } else { LOGGER.debug(""forbidden""); action = forbidden(ctx, currentClients, profiles, authorizers); } } else { if (startAuthentication(ctx, currentClients)) { LOGGER.debug(""Starting authentication""); saveRequestedUrl(ctx, currentClients, config.getClients().getAjaxRequestResolver()); action = redirectToIdentityProvider(ctx, currentClients); } else { LOGGER.debug(""unauthorized""); action = unauthorized(ctx, currentClients); } } } else { LOGGER.debug(""no matching for this request -> grant access""); return securityGrantedAccessAdapter.adapt(webContext, sessionStore, Collections.emptyList()); } } catch (final Exception e) { return handleException(e, httpActionAdapter, webContext); } return httpActionAdapter.adapt(action, webContext); }",unrelated,unrelated,True,,0.2498241811990738,0.7501758337020874
81
+ 79,"protected ResultSetType resolveResultSetType(String alias) { try { return alias == null ? null : ResultSetType.valueOf(alias); } catch (IllegalArgumentException e) { throw new BuilderException(""Error resolving ResultSetType. Cause: "" + e, e); } }",unrelated,unrelated,True,,0.0006803821888752282,0.9993196725845337
82
+ 80,@Override public RandomProviderState saveState() { return new RandomProviderDefaultState(getStateInternal()); },unrelated,unrelated,True,,0.0006825877935625613,0.9993174076080322
83
+ 81,"private GuideTableDiscreteSampler(UniformRandomProvider rng, double[] cumulativeProbabilities, int[] guideTable) { this.rng = rng; this.cumulativeProbabilities = cumulativeProbabilities; this.guideTable = guideTable; }",unrelated,unrelated,True,,0.0007046511163935065,0.9992953538894653
84
+ 82,"private int skipWS(String expression, int p) { for (int i = p; i < expression.length(); i++) { if (expression.charAt(i) > 0x20) { return i; } } return expression.length(); }",unrelated,unrelated,True,,0.0006768794264644384,0.9993231296539307
85
+ 83,"private BoxMullerGaussianSampler(double mean, double standardDeviation, UniformRandomProvider rng) { super(null); this.rng = rng; this.mean = mean; this.standardDeviation = standardDeviation; }",unrelated,unrelated,True,,0.0006701882812194526,0.9993298053741455
86
+ 84,"private PoissonSamplerCache(int minN, int maxN, LargeMeanPoissonSamplerState[] states) { this.minN = minN; this.maxN = maxN; this.values = states; }",unrelated,unrelated,True,,0.0006777537637390196,0.9993222951889038
87
+ 85,@Override public long next() { final int p = bufferPosition; if (bufferPosition < PHILOX_BUFFER_SIZE) { bufferPosition = p + 1; return buffer[p]; } incrementCounter(); rand10(); bufferPosition = 1; return buffer[0]; },unrelated,unrelated,True,,0.0007186403963714838,0.9992813467979431
88
+ 86,public void setLogImpl(Class<? extends Log> logImpl) { if (logImpl != null) { this.logImpl = logImpl; LogFactory.useCustomLogging(this.logImpl); } },unrelated,unrelated,True,,0.0006986603839322925,0.9993013143539429
89
+ 87,@Override public UniformRandomProvider jump() { final UniformRandomProvider copy = new L32X64Mix(this); ls = M * ls + la; resetCachedState(); return copy; },unrelated,unrelated,True,,0.0006779349641874433,0.9993220567703247
90
+ 88,"private static void putInt(int v, byte[] buffer, int index) { buffer[index ] = (byte) (v & INT_LOWEST_BYTE_MASK); buffer[index + 1] = (byte)((v >>> 8) & INT_LOWEST_BYTE_MASK); buffer[index + 2] = (byte)((v >>> 16) & INT_LOWEST_BYTE_MASK); buffer[index + 3] = (byte) (v >>> 24); }",unrelated,unrelated,True,,0.0006946384091861546,0.9993053674697876
91
+ 89,"private <E> List<E> selectList() throws SQLException { Executor localExecutor = executor; if (Thread.currentThread().getId() != this.creatorThreadId || localExecutor.isClosed()) { localExecutor = newExecutor(); } try { return localExecutor.query(mappedStatement, parameterObject, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER, cacheKey, boundSql); } finally { if (localExecutor != executor) { localExecutor.close(false); } } }",unrelated,unrelated,True,,0.0006833600345999002,0.9993166923522949
92
+ 90,public List<ResultMapping> resolveWithConstructor() { if (constructorResultMappings.isEmpty()) { return constructorResultMappings; } final List<ConstructorMetaInfo> matchingConstructorCandidates = retrieveConstructorCandidates( constructorResultMappings.size()); if (matchingConstructorCandidates.isEmpty()) { return constructorResultMappings; } final Set<String> constructorArgsByName = constructorResultMappings.stream().map(ResultMapping::getProperty) .filter(Objects::nonNull).collect(Collectors.toCollection(LinkedHashSet::new)); final boolean allMappingsHavePropertyNames = verifyPropertyNaming(constructorArgsByName);,unrelated,unrelated,True,,0.0006708480650559068,0.9993292093276978
93
+ 91,@Override public Class<?> getSetterType(String name) { PropertyTokenizer prop = new PropertyTokenizer(name); if (prop.hasNext()) { MetaObject metaValue = metaObject.metaObjectForProperty(prop.getIndexedName()); if (metaValue == SystemMetaObject.NULL_META_OBJECT) { return Object.class; } else { return metaValue.getSetterType(prop.getChildren()); } } if (map.get(name) != null) { return map.get(name).getClass(); } else { return Object.class; } },unrelated,unrelated,True,,0.0007314911927096546,0.9992684721946716
94
+ 92,"private void applyConstructorArgs(Arg[] args, Class<?> resultType, List<ResultMapping> resultMappings, String resultMapId) { final List<ResultMapping> mappings = new ArrayList<>(); for (Arg arg : args) { List<ResultFlag> flags = new ArrayList<>(); flags.add(ResultFlag.CONSTRUCTOR); if (arg.id()) { flags.add(ResultFlag.ID); } @SuppressWarnings(""unchecked"") Class<? extends TypeHandler<?>> typeHandler = (Class<? extends TypeHandler<?>>) (arg .typeHandler() == UnknownTypeHandler.class ? null : arg.typeHandler()); ResultMapping resultMapping = assistant.buildResultMapping(resultType, nullOrEmpty(arg.name()), nullOrEmpty(arg.column()), arg.javaType() == void.class ? null : arg.javaType(), arg.jdbcType() == JdbcType.UNDEFINED ? null : arg.jdbcType(), nullOrEmpty(arg.select()), nullOrEmpty(arg.resultMap()), null, nullOrEmpty(arg.columnPrefix()), typeHandler, flags, null, null, false); mappings.add(resultMapping); } final ResultMappingConstructorResolver resolver = new ResultMappingConstructorResolver(configuration, mappings,",unrelated,unrelated,True,,0.0006675615441054106,0.9993323683738708
95
+ 93,private MetaObject getParamMetaObject() { if (paramMetaObject != null) { return paramMetaObject; } paramMetaObject = configuration.newMetaObject(parameterObject); return paramMetaObject; },unrelated,unrelated,True,,0.0006804775330238044,0.9993195533752441
96
+ 94,public int getActiveConnectionCount() { lock.lock(); try { return activeConnections.size(); } finally { lock.unlock(); } },unrelated,unrelated,True,,0.000741267460398376,0.9992586970329285
97
+ 95,"@Override public BigDecimal getNullableResult(ResultSet rs, String columnName) throws SQLException { return rs.getBigDecimal(columnName); }",unrelated,unrelated,True,,0.000700238801073283,0.9992997646331787
98
+ 96,"@Override public void error(String s, Throwable e) { logger.log(MARKER, FQCN, LocationAwareLogger.ERROR_INT, s, null, e); }",unrelated,unrelated,True,,0.0060335625894367695,0.9939664602279663
99
+ 97,"public PreparedStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) { super(executor, mappedStatement, parameter, rowBounds, resultHandler, boundSql); }",unrelated,unrelated,True,,0.0006782851414754987,0.999321699142456
100
+ 98,"private void parseSelectKeyNodes(String parentId, List<XNode> list, Class<?> parameterTypeClass, LanguageDriver langDriver, String skRequiredDatabaseId) { for (XNode nodeToHandle : list) { String id = parentId + SelectKeyGenerator.SELECT_KEY_SUFFIX; String databaseId = nodeToHandle.getStringAttribute(""databaseId""); if (databaseIdMatchesCurrent(id, databaseId, skRequiredDatabaseId)) { parseSelectKeyNode(id, nodeToHandle, parameterTypeClass, langDriver, databaseId); } } }",unrelated,unrelated,True,,0.000729173538275063,0.9992708563804626
101
+ 99,private void setState(long[] state) { key0 = state[0]; key1 = state[1]; counter0 = state[2]; counter1 = state[3]; counter2 = state[4]; counter3 = state[5]; },unrelated,unrelated,True,,0.0006951470277272165,0.9993048906326294
102
+ 100,"public Class<?> getGetterType(String propertyName) { Class<?> clazz = getTypes.getOrDefault(propertyName, nullEntry).getValue(); if (clazz == null) { throw new ReflectionException(""There is no getter for property named '"" + propertyName + ""' in '"" + clazz + ""'""); } return clazz; }",unrelated,unrelated,True,,0.0006888050120323896,0.9993112087249756
103
+ 101,"@Override protected void setStateInternal(byte[] s) { final byte[][] c = splitStateInternal(s, (N + 1) * 4); final int[] tmp = NumberFactory.makeIntArray(c[0]); System.arraycopy(tmp, 0, mt, 0, N); mti = tmp[N]; super.setStateInternal(c[1]); }",unrelated,unrelated,True,,0.0006806306191720068,0.9993194341659546
104
+ 102,"@Override public <E> List<E> query(MappedStatement ms, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler) throws SQLException { BoundSql boundSql = ms.getBoundSql(parameterObject); CacheKey key = createCacheKey(ms, parameterObject, rowBounds, boundSql); return query(ms, parameterObject, rowBounds, resultHandler, key, boundSql); }",unrelated,unrelated,True,,0.0006841123686172068,0.9993158578872681
105
+ 103,private boolean isLazy(Result result) { boolean isLazy = configuration.isLazyLoadingEnabled(); if (!result.one().select().isEmpty() && FetchType.DEFAULT != result.one().fetchType()) { isLazy = result.one().fetchType() == FetchType.LAZY; } else if (!result.many().select().isEmpty() && FetchType.DEFAULT != result.many().fetchType()) { isLazy = result.many().fetchType() == FetchType.LAZY; } return isLazy; },unrelated,unrelated,True,,0.0006897367420606315,0.9993102550506592
106
+ 104,public CacheBuilder addDecorator(Class<? extends Cache> decorator) { if (decorator != null) { this.decorators.add(decorator); } return this; },unrelated,unrelated,True,,0.0007420936599373817,0.9992578625679016
107
+ 105,@Override public void clear() { lastClear = System.currentTimeMillis(); delegate.clear(); },unrelated,unrelated,True,,0.0010851596016436815,0.9989148378372192
108
+ 106,"@Override protected Statement instantiateStatement(Connection connection) throws SQLException { String sql = boundSql.getSql(); if (mappedStatement.getResultSetType() == ResultSetType.DEFAULT) { return connection.prepareCall(sql); } return connection.prepareCall(sql, mappedStatement.getResultSetType().getValue(), ResultSet.CONCUR_READ_ONLY); }",unrelated,unrelated,True,,0.0006832529907114804,0.9993168115615845
109
+ 107,"private static <T> SharedStateDiscreteSampler createSampler(UniformRandomProvider rng, List<T> collection, double[] probabilities) { if (probabilities.length != collection.size()) { throw new IllegalArgumentException(""Size mismatch: "" + probabilities.length + "" != "" + collection.size()); } return GuideTableDiscreteSampler.of(rng, probabilities); }",unrelated,unrelated,True,,0.0006653426680713892,0.9993346333503723
110
+ 108,"private ResultMapping buildResultMappingFromContext(XNode context, Class<?> resultType, List<ResultFlag> flags) { String property; if (flags.contains(ResultFlag.CONSTRUCTOR)) { property = context.getStringAttribute(""name""); } else { property = context.getStringAttribute(""property""); } String column = context.getStringAttribute(""column""); String javaType = context.getStringAttribute(""javaType""); String jdbcType = context.getStringAttribute(""jdbcType""); String nestedSelect = context.getStringAttribute(""select""); String nestedResultMap = context.getStringAttribute(""resultMap"", () -> processNestedResultMappings(context, List.of(), resultType)); String notNullColumn = context.getStringAttribute(""notNullColumn""); String columnPrefix = context.getStringAttribute(""columnPrefix""); String typeHandler = context.getStringAttribute(""typeHandler""); String resultSet = context.getStringAttribute(""resultSet""); String foreignColumn = context.getStringAttribute(""foreignColumn""); boolean lazy = ""lazy"" .equals(context.getStringAttribute(""fetchType"", configuration.isLazyLoadingEnabled() ? ""lazy"" : ""eager""));",unrelated,unrelated,True,,0.0006966364453546703,0.9993033409118652
111
+ 109,@Override public <E> Cursor<E> queryCursor(Statement statement) throws SQLException { return delegate.queryCursor(statement); },unrelated,unrelated,True,,0.0006712008034810424,0.9993288516998291
112
+ 110,"private JdbcType safeGetJdbcTypeForColumn(ResultSetMetaData rsmd, Integer columnIndex) { try { return JdbcType.forCode(rsmd.getColumnType(columnIndex)); } catch (Exception e) { return null; } }",unrelated,unrelated,True,,0.0006513011758215725,0.9993487000465393
113
+ 111,@Override public int next() { final int indexRm1 = TABLE.getIndexPred(index); final int v0 = v[index]; final int vM1 = v[TABLE.getIndexM1(index)]; final int vM2 = v[TABLE.getIndexM2(index)]; final int vM3 = v[TABLE.getIndexM3(index)]; final int z0 = v[indexRm1]; final int z1 = v0 ^ (vM1 ^ (vM1 >>> 8)); final int z2 = (vM2 ^ (vM2 << 19)) ^ (vM3 ^ (vM3 << 14)); final int z3 = z1 ^ z2; final int z4 = (z0 ^ (z0 << 11)) ^ (z1 ^ (z1 << 7)) ^ (z2 ^ (z2 << 13)); v[index] = z3; v[indexRm1] = z4; index = indexRm1; return z4;,unrelated,unrelated,True,,0.0006763815763406456,0.9993236064910889
114
+ 112,"private void linkToParents(ResultSet rs, ResultMapping parentMapping, Object rowValue) throws SQLException { CacheKey parentKey = createKeyForMultipleResults(rs, parentMapping, parentMapping.getColumn(), parentMapping.getForeignColumn()); List<PendingRelation> parents = pendingRelations.get(parentKey); if (parents != null) { for (PendingRelation parent : parents) { if (parent != null && rowValue != null) { linkObjects(parent.metaObject, parent.propertyMapping, rowValue); } } } }",unrelated,unrelated,True,,0.002051735296845436,0.9979482293128967
115
+ 113,PendingCreationKey(ResultMapping constructorMapping) { this.resultMapId = constructorMapping.getNestedResultMapId(); this.constructorColumnPrefix = constructorMapping.getColumnPrefix(); },unrelated,unrelated,True,,0.002486500423401594,0.9975135326385498
116
+ 114,"private static long sum(long[] frequencies) { if (frequencies == null || frequencies.length == 0) { throw new IllegalArgumentException(""frequencies must contain at least 1 value""); } long m = 0; long signFlag = 0; for (final long o : frequencies) { m += o; signFlag |= o | m; } if (signFlag < 0) { for (final long o : frequencies) { if (o < 0) {",unrelated,unrelated,True,,0.0006528124795295298,0.9993471503257751
117
+ 115,@Override public String[] getSetterNames() { return map.keySet().toArray(new String[0]); },unrelated,unrelated,True,,0.0007119377260096371,0.9992881417274475
118
+ 116,"private InverseTransformParetoSampler(double scale, double shape, UniformRandomProvider rng) { super(null); this.rng = rng; this.scale = scale; this.oneOverShape = 1 / shape; nextDouble = shape >= 1 ? InternalUtils::makeNonZeroDouble : InternalUtils::makeDouble; }",unrelated,unrelated,True,,0.0006661770748905838,0.9993337988853455
119
+ 117,public long getClaimedOverdueConnectionCount() { lock.lock(); try { return claimedOverdueConnectionCount; } finally { lock.unlock(); } },unrelated,unrelated,True,,0.000723060336895287,0.9992769360542297
120
+ 118,"public static double[] shuffle(UniformRandomProvider rng, double[] array) { int i = array.length; for (; i > BATCH_2; --i) { swap(array, i - 1, rng.nextInt(i)); } final int[] productBound = {i * (i - 1)}; for (; i > 1; i -= 2) { final int[] indices = randomBounded2(i, i - 1, productBound, rng); final int index1 = indices[0]; final int index2 = indices[1]; swap(array, i - 1, index1); swap(array, i - 2, index2); } return array; }",unrelated,unrelated,True,,0.0006528684752993286,0.9993471503257751
121
+ 119,"@Override public Reader getNullableResult(ResultSet rs, String columnName) throws SQLException { return toReader(rs.getClob(columnName)); }",unrelated,unrelated,True,,0.0006784965516999364,0.999321460723877
122
+ 120,"@Override public int next() { z = computeNew(36969, z); w = computeNew(18000, w); final int mwc = (z << 16) + w; jsr ^= jsr << 13; jsr ^= jsr >>> 17; jsr ^= jsr << 5; jcong = 69069 * jcong + 1234567; return (mwc ^ jcong) + jsr; }",unrelated,unrelated,True,,0.0006837148102931678,0.9993163347244263
123
+ 121,"@SuppressWarnings({""rawtypes"", ""unchecked""}) public static <T> void shuffle(UniformRandomProvider rng, List<T> list) { if (list instanceof RandomAccess || list.size() < RANDOM_ACCESS_SIZE_THRESHOLD) { ArraySampler.shuffle(rng, list); } else { final Object[] array = list.toArray(); ArraySampler.shuffle(rng, array); final ListIterator it = list.listIterator(); for (final Object item : array) { it.next(); it.set(item); } } }",unrelated,unrelated,True,,0.0006661351071670651,0.9993337988853455
124
+ 122,"private void cacheElement(XNode context) { if (context != null) { String type = context.getStringAttribute(""type"", ""PERPETUAL""); Class<? extends Cache> typeClass = typeAliasRegistry.resolveAlias(type); String eviction = context.getStringAttribute(""eviction"", ""LRU""); Class<? extends Cache> evictionClass = typeAliasRegistry.resolveAlias(eviction); Long flushInterval = context.getLongAttribute(""flushInterval""); Integer size = context.getIntAttribute(""size""); boolean readWrite = !context.getBooleanAttribute(""readOnly"", false); boolean blocking = context.getBooleanAttribute(""blocking"", false); Properties props = context.getChildrenAsProperties(); builderAssistant.useNewCache(typeClass, evictionClass, flushInterval, size, readWrite, blocking, props); } }",unrelated,unrelated,True,,0.0007082839729264379,0.9992916584014893
125
+ 123,"@Override protected void setStateInternal(byte[] s) { final byte[][] c = splitStateInternal(s, SEED_SIZE * 8); setState(NumberFactory.makeLongArray(c[0])); super.setStateInternal(c[1]); }",unrelated,unrelated,True,,0.0006698473007418215,0.9993301630020142
126
+ 124,"public static Type resolveFieldType(Field field, Type srcType) { Type fieldType = field.getGenericType(); Class<?> declaringClass = field.getDeclaringClass(); return resolveType(fieldType, srcType, declaringClass); }",unrelated,unrelated,True,,0.0006558888126164675,0.9993440508842468
127
+ 125,private void finishJump() { resetCachedState(); if (bufferPosition < PHILOX_BUFFER_SIZE) { rand10(); } },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9718952775001526,0.028104670345783234
audit_accountability_codebert_v1/history.json ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "epoch": 1,
4
+ "train_loss": 0.48844219001948386,
5
+ "loss": 0.6259549068636261,
6
+ "accuracy": 0.7301587301587301,
7
+ "macro_f1": 0.6843501326259946,
8
+ "labels": [
9
+ "audit_accountability",
10
+ "unrelated"
11
+ ],
12
+ "precision": [
13
+ 0.55,
14
+ 0.813953488372093
15
+ ],
16
+ "recall": [
17
+ 0.5789473684210527,
18
+ 0.7954545454545454
19
+ ],
20
+ "f1": [
21
+ 0.5641025641025641,
22
+ 0.8045977011494253
23
+ ],
24
+ "support": [
25
+ 38,
26
+ 88
27
+ ],
28
+ "confusion_matrix": [
29
+ [
30
+ 22,
31
+ 16
32
+ ],
33
+ [
34
+ 18,
35
+ 70
36
+ ]
37
+ ]
38
+ },
39
+ {
40
+ "epoch": 2,
41
+ "train_loss": 0.19740684147875168,
42
+ "loss": 0.952715638326481,
43
+ "accuracy": 0.7698412698412699,
44
+ "macro_f1": 0.7156641506497549,
45
+ "labels": [
46
+ "audit_accountability",
47
+ "unrelated"
48
+ ],
49
+ "precision": [
50
+ 0.6363636363636364,
51
+ 0.8172043010752689
52
+ ],
53
+ "recall": [
54
+ 0.5526315789473685,
55
+ 0.8636363636363636
56
+ ],
57
+ "f1": [
58
+ 0.5915492957746479,
59
+ 0.8397790055248618
60
+ ],
61
+ "support": [
62
+ 38,
63
+ 88
64
+ ],
65
+ "confusion_matrix": [
66
+ [
67
+ 21,
68
+ 17
69
+ ],
70
+ [
71
+ 12,
72
+ 76
73
+ ]
74
+ ]
75
+ },
76
+ {
77
+ "epoch": 3,
78
+ "train_loss": 0.10120202826083939,
79
+ "loss": 1.0092392266997194,
80
+ "accuracy": 0.8095238095238095,
81
+ "macro_f1": 0.7432937181663837,
82
+ "labels": [
83
+ "audit_accountability",
84
+ "unrelated"
85
+ ],
86
+ "precision": [
87
+ 0.7916666666666666,
88
+ 0.8137254901960784
89
+ ],
90
+ "recall": [
91
+ 0.5,
92
+ 0.9431818181818182
93
+ ],
94
+ "f1": [
95
+ 0.6129032258064516,
96
+ 0.8736842105263158
97
+ ],
98
+ "support": [
99
+ 38,
100
+ 88
101
+ ],
102
+ "confusion_matrix": [
103
+ [
104
+ 19,
105
+ 19
106
+ ],
107
+ [
108
+ 5,
109
+ 83
110
+ ]
111
+ ]
112
+ },
113
+ {
114
+ "epoch": 4,
115
+ "train_loss": 0.07305791778437429,
116
+ "loss": 1.0353072912548669,
117
+ "accuracy": 0.8333333333333334,
118
+ "macro_f1": 0.7557914167051223,
119
+ "labels": [
120
+ "audit_accountability",
121
+ "unrelated"
122
+ ],
123
+ "precision": [
124
+ 1.0,
125
+ 0.8073394495412844
126
+ ],
127
+ "recall": [
128
+ 0.4473684210526316,
129
+ 1.0
130
+ ],
131
+ "f1": [
132
+ 0.6181818181818182,
133
+ 0.8934010152284264
134
+ ],
135
+ "support": [
136
+ 38,
137
+ 88
138
+ ],
139
+ "confusion_matrix": [
140
+ [
141
+ 17,
142
+ 21
143
+ ],
144
+ [
145
+ 0,
146
+ 88
147
+ ]
148
+ ]
149
+ },
150
+ {
151
+ "epoch": 5,
152
+ "train_loss": 0.03457720968102042,
153
+ "loss": 1.0383340008793311,
154
+ "accuracy": 0.8015873015873016,
155
+ "macro_f1": 0.7662337662337662,
156
+ "labels": [
157
+ "audit_accountability",
158
+ "unrelated"
159
+ ],
160
+ "precision": [
161
+ 0.6666666666666666,
162
+ 0.8620689655172413
163
+ ],
164
+ "recall": [
165
+ 0.6842105263157895,
166
+ 0.8522727272727273
167
+ ],
168
+ "f1": [
169
+ 0.6753246753246753,
170
+ 0.8571428571428571
171
+ ],
172
+ "support": [
173
+ 38,
174
+ 88
175
+ ],
176
+ "confusion_matrix": [
177
+ [
178
+ 26,
179
+ 12
180
+ ],
181
+ [
182
+ 13,
183
+ 75
184
+ ]
185
+ ]
186
+ },
187
+ {
188
+ "epoch": 6,
189
+ "train_loss": 0.04306560103813032,
190
+ "loss": 1.0969145638482587,
191
+ "accuracy": 0.8253968253968254,
192
+ "macro_f1": 0.764685908319185,
193
+ "labels": [
194
+ "audit_accountability",
195
+ "unrelated"
196
+ ],
197
+ "precision": [
198
+ 0.8333333333333334,
199
+ 0.8235294117647058
200
+ ],
201
+ "recall": [
202
+ 0.5263157894736842,
203
+ 0.9545454545454546
204
+ ],
205
+ "f1": [
206
+ 0.6451612903225806,
207
+ 0.8842105263157894
208
+ ],
209
+ "support": [
210
+ 38,
211
+ 88
212
+ ],
213
+ "confusion_matrix": [
214
+ [
215
+ 20,
216
+ 18
217
+ ],
218
+ [
219
+ 4,
220
+ 84
221
+ ]
222
+ ]
223
+ },
224
+ {
225
+ "epoch": 7,
226
+ "train_loss": 0.010353359792476058,
227
+ "loss": 1.2069438621147128,
228
+ "accuracy": 0.8095238095238095,
229
+ "macro_f1": 0.7486702127659575,
230
+ "labels": [
231
+ "audit_accountability",
232
+ "unrelated"
233
+ ],
234
+ "precision": [
235
+ 0.7692307692307693,
236
+ 0.82
237
+ ],
238
+ "recall": [
239
+ 0.5263157894736842,
240
+ 0.9318181818181818
241
+ ],
242
+ "f1": [
243
+ 0.625,
244
+ 0.8723404255319149
245
+ ],
246
+ "support": [
247
+ 38,
248
+ 88
249
+ ],
250
+ "confusion_matrix": [
251
+ [
252
+ 20,
253
+ 18
254
+ ],
255
+ [
256
+ 6,
257
+ 82
258
+ ]
259
+ ]
260
+ },
261
+ {
262
+ "epoch": 8,
263
+ "train_loss": 0.004777412290887949,
264
+ "loss": 1.2169369823768648,
265
+ "accuracy": 0.8095238095238095,
266
+ "macro_f1": 0.7583120204603581,
267
+ "labels": [
268
+ "audit_accountability",
269
+ "unrelated"
270
+ ],
271
+ "precision": [
272
+ 0.7333333333333333,
273
+ 0.8333333333333334
274
+ ],
275
+ "recall": [
276
+ 0.5789473684210527,
277
+ 0.9090909090909091
278
+ ],
279
+ "f1": [
280
+ 0.6470588235294118,
281
+ 0.8695652173913043
282
+ ],
283
+ "support": [
284
+ 38,
285
+ 88
286
+ ],
287
+ "confusion_matrix": [
288
+ [
289
+ 22,
290
+ 16
291
+ ],
292
+ [
293
+ 8,
294
+ 80
295
+ ]
296
+ ]
297
+ }
298
+ ]
audit_accountability_codebert_v1/test_errors.csv ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_index,text,true_label,predicted_label,correct,error_type,probability_audit_accountability,probability_unrelated
2
+ 8,"public CamelWebSocketHandler() { this.receiveListener = new UndertowReceiveListener(); this.callback = new UndertowWebSocketConnectionCallback(); this.closeListener = (WebSocketChannel channel) -> sendEventNotificationIfNeeded( (String) channel.getAttribute(UndertowConstants.CONNECTION_KEY), null, channel, EventType.ONCLOSE); this.delegate = Handlers.websocket(callback); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9726507663726807,0.027349282056093216
3
+ 17,"@Override public void onConnect(WebSocketHttpExchange exchange, WebSocketChannel channel) { LOG.trace(""onConnect {}"", exchange); OAuthTokenValidationResult oauthTokenValidationResult = exchange.getAttachment(OAUTH_TOKEN_VALIDATION_RESULT_ATTACHMENT); if (oauthTokenValidationResult == null && requiresOAuth()) { LOG.warn(""Closing WebSocket channel whose handshake was not OAuth validated""); WebSockets.sendClose(CloseMessage.MSG_VIOLATES_POLICY, ""Authentication required"", channel, null); return; } final String connectionKey = UUID.randomUUID().toString(); channel.setAttribute(UndertowConstants.CONNECTION_KEY, connectionKey); if (oauthTokenValidationResult != null) { channel.setAttribute(OAuthHttpSecuritySupport.OAUTH_TOKEN_VALIDATION_RESULT, oauthTokenValidationResult); } channel.getReceiveSetter().set(receiveListener); channel.addCloseTask(closeListener); sendEventNotificationIfNeeded(connectionKey, exchange, channel, EventType.ONOPEN); channel.resumeReceives(); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9900937676429749,0.009906197898089886
4
+ 22,"@Query(""SELECT a FROM AuditLogEntity a WHERE "" + ""a.tenantId = :tenantId "" + ""AND (:startTime IS NULL OR a.createdTime >= :startTime) "" + ""AND (:endTime IS NULL OR a.createdTime <= :endTime) "" + ""AND ((:actionTypes) IS NULL OR a.actionType IN (:actionTypes)) "" + ""AND (:textSearch IS NULL OR ilike(a.entityType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.entityName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.userName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionStatus, CONCAT('%', :textSearch, '%')) = true)"" ) Page<AuditLogEntity> findByTenantId( @Param(""tenantId"") UUID tenantId, @Param(""textSearch"") String textSearch, @Param(""startTime"") Long startTime, @Param(""endTime"") Long endTime, @Param(""actionTypes"") List<ActionType> actionTypes, Pageable pageable);",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.16915641725063324,0.8308435678482056
5
+ 24,final FlowChangeAction processorAction = createFlowChangeAction(); processorAction.setSourceId(processor.getIdentifier()); processorAction.setSourceName(processor.getName()); processorAction.setSourceType(Component.Processor); processorAction.setComponentDetails(processorDetails); processorAction.setOperation(ScheduledState.RUNNING.equals(processor.getScheduledState()) ? Operation.Start : Operation.Stop); actions.add(processorAction);,audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0008172939415089786,0.9991826415061951
6
+ 28,"@Query(""SELECT a FROM AuditLogEntity a WHERE "" + ""a.tenantId = :tenantId "" + ""AND a.userId = :userId "" + ""AND (:startTime IS NULL OR a.createdTime >= :startTime) "" + ""AND (:endTime IS NULL OR a.createdTime <= :endTime) "" + ""AND ((:actionTypes) IS NULL OR a.actionType IN (:actionTypes)) "" + ""AND (:textSearch IS NULL OR ilike(a.entityType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.entityName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionStatus, CONCAT('%', :textSearch, '%')) = true)"" ) Page<AuditLogEntity> findAuditLogsByTenantIdAndUserId(@Param(""tenantId"") UUID tenantId, @Param(""userId"") UUID userId, @Param(""textSearch"") String textSearch, @Param(""startTime"") Long startTime, @Param(""endTime"") Long endTime, @Param(""actionTypes"") List<ActionType> actionTypes, Pageable pageable);",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.3596550524234772,0.6403449177742004
7
+ 30,"public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { try { getBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME, beanFactory); } catch (NoSuchBeanDefinitionException o_O) { throw new IllegalStateException( ""Invalid auditing setup; Make sure you've used @EnableJpaAuditing or <jpa:auditing /> correctly"", o_O); } for (String beanName : getEntityManagerFactoryBeanNames(beanFactory)) { BeanDefinition definition = getBeanDefinition(beanName, beanFactory); definition.setDependsOn(addStringToArray(definition.getDependsOn(), BEAN_CONFIGURER_ASPECT_BEAN_NAME)); } }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007471139542758465,0.9992528557777405
8
+ 43,"public DedicatedJpaAuditLogDao(AuditLogRepository auditLogRepository, DedicatedEventsSqlPartitioningRepository partitioningRepository) { super(auditLogRepository, partitioningRepository); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9897404909133911,0.010259446687996387
9
+ 46,"@Query(""SELECT a FROM AuditLogEntity a WHERE "" + ""a.tenantId = :tenantId "" + ""AND a.customerId = :customerId "" + ""AND (:startTime IS NULL OR a.createdTime >= :startTime) "" + ""AND (:endTime IS NULL OR a.createdTime <= :endTime) "" + ""AND ((:actionTypes) IS NULL OR a.actionType IN (:actionTypes)) "" + ""AND (:textSearch IS NULL OR ilike(a.entityType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.entityName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.userName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionStatus, CONCAT('%', :textSearch, '%')) = true)"" ) Page<AuditLogEntity> findAuditLogsByTenantIdAndCustomerId(@Param(""tenantId"") UUID tenantId, @Param(""customerId"") UUID customerId, @Param(""textSearch"") String textSearch, @Param(""startTime"") Long startTime, @Param(""endTime"") Long endTime, @Param(""actionTypes"") List<ActionType> actionTypes, Pageable pageable);",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.13454431295394897,0.8654556274414062
10
+ 49,"@Query(""SELECT a FROM AuditLogEntity a WHERE "" + ""a.tenantId = :tenantId "" + ""AND a.entityType = :entityType AND a.entityId = :entityId "" + ""AND (:startTime IS NULL OR a.createdTime >= :startTime) "" + ""AND (:endTime IS NULL OR a.createdTime <= :endTime) "" + ""AND ((:actionTypes) IS NULL OR a.actionType IN (:actionTypes)) "" + ""AND (:textSearch IS NULL OR ilike(a.entityName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.userName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionStatus, CONCAT('%', :textSearch, '%')) = true)"" ) Page<AuditLogEntity> findAuditLogsByTenantIdAndEntityId(@Param(""tenantId"") UUID tenantId, @Param(""entityType"") EntityType entityType, @Param(""entityId"") UUID entityId, @Param(""textSearch"") String textSearch, @Param(""startTime"") Long startTime, @Param(""endTime"") Long endTime, @Param(""actionTypes"") List<ActionType> actionTypes, Pageable pageable);",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.037442974746227264,0.9625569581985474
11
+ 54,"@Override protected void registerAuditListenerBeanDefinition(BeanDefinition auditingHandlerDefinition, BeanDefinitionRegistry registry) { if (!registry.containsBeanDefinition(JPA_MAPPING_CONTEXT_BEAN_NAME)) { registry.registerBeanDefinition(JPA_MAPPING_CONTEXT_BEAN_NAME, new RootBeanDefinition(JpaMetamodelMappingContextFactoryBean.class)); } BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(AuditingEntityListener.class); builder.addPropertyValue(""auditingHandler"", ParsingUtils.getObjectFactoryBeanDefinition(getAuditingHandlerBeanName(), null)); registerInfrastructureBeanWithId(builder.getRawBeanDefinition(), AuditingEntityListener.class.getName(), registry); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.000740239629521966,0.9992597699165344
12
+ 60,"@EventListener(classes = UserAuthDataChangedEvent.class) public void onUserAuthDataChanged(UserAuthDataChangedEvent event) { if (StringUtils.hasText(event.getId())) { cache.put(event.getId(), event.getTs()); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9963765740394592,0.003623413620516658
13
+ 61,"@ApiOperation(value = ""Enable/Disable User credentials (setUserCredentialsEnabled)"", notes = ""Enables or Disables user credentials. Useful when you would like to block user account without deleting it. "" + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH) @PreAuthorize(""hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')"") @PostMapping(value = ""/user/{userId}/userCredentialsEnabled"") public void setUserCredentialsEnabled( @Parameter(description = USER_ID_PARAM_DESCRIPTION) @PathVariable(USER_ID) String strUserId, @Parameter(description = ""Enable (\""true\"") or disable (\""false\"") the credentials."", schema = @Schema(defaultValue = ""true"")) @RequestParam(required = false, defaultValue = ""true"") boolean userCredentialsEnabled) throws ThingsboardException { checkParameter(USER_ID, strUserId); UserId userId = new UserId(toUUID(strUserId)); checkUserId(userId, Operation.WRITE); TenantId tenantId = getCurrentUser().getTenantId(); userService.setUserCredentialsEnabled(tenantId, userId, userCredentialsEnabled); if (!userCredentialsEnabled) { eventPublisher.publishEvent(new UserCredentialsInvalidationEvent(userId)); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9842357635498047,0.01576417125761509
14
+ 67,"public static final Logger AUDITLOG = LoggerFactory.getLogger(""SecurityLogger.""+Server.class.getName());",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0006616939790546894,0.9993383288383484
15
+ 72,"@Override protected int incrementCurrentKeyId() { try { incrSharedCount(keyIdSeqCounter, 1); } catch (InterruptedException e) { LOG.debug(""Thread interrupted while performing keyId increment"", e); Thread.currentThread().interrupt(); } catch (Exception e) { throw new RuntimeException(""Could not increment shared keyId counter !!"", e); } return keyIdSeqCounter.getCount(); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9964644908905029,0.0035354746505618095
16
+ 84,"synchronized void processWatchEvent(ZooKeeper zk, WatchedEvent event) { Event.EventType eventType = event.getType(); if (isStaleClient(zk)) return; if (LOG.isDebugEnabled()) { LOG.debug(""Watcher event type: "" + eventType + "" with state:"" + event.getState() + "" for path:"" + event.getPath() + "" connectionState: "" + zkConnectionState + "" for "" + this); } if (eventType == Event.EventType.None) { switch (event.getState()) { case SyncConnected: LOG.info(""Session connected.""); ConnectionState prevConnectionState = zkConnectionState; zkConnectionState = ConnectionState.CONNECTED; if (prevConnectionState == ConnectionState.DISCONNECTED && wantToBeInElection) { monitorActiveStatus(); } break; case Disconnected: LOG.info(""Session disconnected. Entering neutral mode...""); zkConnectionState = ConnectionState.DISCONNECTED; enterNeutralMode(); break; case Expired: LOG.info(""Session expired. Entering neutral mode and rejoining...""); enterNeutralMode(); reJoinElection(0); break; case SaslAuthenticated: LOG.info(""Successfully authenticated to ZooKeeper using SASL.""); break; default: fatalError(""Unexpected Zookeeper watch event state: "" + event.getState()); break; } return; } String path = event.getPath(); if (path != null) { switch (eventType) { case NodeDeleted: if (state == State.ACTIVE) { enterNeutralMode(); } joinElectionInternal(); break; case NodeDataChanged: monitorActiveStatus(); break; default: if (LOG.isDebugEnabled()) { LOG.debug(""Unexpected node event: "" + eventType + "" for path: "" + path); } monitorActiveStatus(); } return; } fatalError(""Unexpected watch error from Zookeeper""); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9894054532051086,0.010594533756375313
17
+ 91,"private void disconnect(FTPClient client) throws IOException { if (client != null) { if (!client.isConnected()) { throw new FTPException(""Client not connected""); } boolean logoutSuccess = client.logout(); client.disconnect(); if (!logoutSuccess) { LOG.warn(""Logout failed while disconnecting, error code - "" + client.getReplyCode()); } } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9959501028060913,0.004049923270940781
18
+ 92,"private void readTagFromConfig(String attributeValue, String confName, String confValue, String[] confSource) { for (String tagStr : attributeValue.split("","")) { try { tagStr = tagStr.trim(); if (confValue == null) { confValue = """"; } if (propertyTagsMap.containsKey(tagStr)) { propertyTagsMap.get(tagStr).setProperty(confName, confValue); } else { Properties props = new Properties(); props.setProperty(confName, confValue); propertyTagsMap.put(tagStr, props); } } catch (Exception ex) { LOG.trace(""Tag '{}' for property:{} Source:{}"", tagStr, confName, confSource, ex); } } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.70677250623703,0.29322749376296997
19
+ 95,"@Override public boolean renameFile(String from, String to) throws GenericFileOperationFailedException { lock.lock(); try { LOG.debug(""Renaming file: {} to: {}"", from, to); reconnectIfNecessary(null); to = FileUtil.compactPath(to, '/'); channel.rename(from, to); return true; } catch (SftpException e) { LOG.debug(""Cannot rename file from: {} to: {}"", from, to, e); throw new GenericFileOperationFailedException(""Cannot rename file from: "" + from + "" to: "" + to, e); } finally { lock.unlock(); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9793726801872253,0.02062731422483921
20
+ 101,"private Set<String> fetchGroupSet(String user) throws IOException { long startMs = timer.monotonicNow(); Set<String> groups = impl.getGroupsSet(user); long endMs = timer.monotonicNow(); long deltaMs = endMs - startMs ; UserGroupInformation.metrics.addGetGroups(deltaMs); if (deltaMs > warningDeltaMs) { LOG.warn(""Potential performance problem: getGroups(user="" + user +"") "" + ""took "" + deltaMs + "" milliseconds.""); } return groups; }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9952043294906616,0.004795738961547613
audit_accountability_codebert_v1/test_metrics.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "loss": 0.5047465368745264,
3
+ "accuracy": 0.888235294117647,
4
+ "macro_f1": 0.8805959114265647,
5
+ "labels": [
6
+ "audit_accountability",
7
+ "unrelated"
8
+ ],
9
+ "precision": [
10
+ 0.8307692307692308,
11
+ 0.9238095238095239
12
+ ],
13
+ "recall": [
14
+ 0.8709677419354839,
15
+ 0.8981481481481481
16
+ ],
17
+ "f1": [
18
+ 0.8503937007874016,
19
+ 0.9107981220657277
20
+ ],
21
+ "support": [
22
+ 62,
23
+ 108
24
+ ],
25
+ "confusion_matrix": [
26
+ [
27
+ 54,
28
+ 8
29
+ ],
30
+ [
31
+ 11,
32
+ 97
33
+ ]
34
+ ],
35
+ "classification_report": " precision recall f1-score support\n\naudit_accountability 0.83 0.87 0.85 62\n unrelated 0.92 0.90 0.91 108\n\n accuracy 0.89 170\n macro avg 0.88 0.88 0.88 170\n weighted avg 0.89 0.89 0.89 170\n"
36
+ }
audit_accountability_codebert_v1/test_predictions.csv ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_index,text,true_label,predicted_label,correct,error_type,probability_audit_accountability,probability_unrelated
2
+ 0,"for (ActionDetails detail : details) { FlowChangeAction remoteProcessGroupAction = createFlowChangeAction(timestamp, remoteProcessGroup, remoteProcessGroupDetails); remoteProcessGroupAction.setOperation(Operation.Configure); remoteProcessGroupAction.setActionDetails(detail); actions.add(remoteProcessGroupAction); } if (!actions.isEmpty()) { saveActions(actions, logger); }",audit_accountability,audit_accountability,True,,0.9966552257537842,0.003344767726957798
3
+ 1,"public Action generateAuditRecord(Funnel funnel, Operation operation, ActionDetails actionDetails) { FlowChangeAction action = null; if (isAuditable()) { action = createFlowChangeAction(); action.setOperation(operation); action.setSourceId(funnel.getIdentifier()); action.setSourceName(funnel.getName()); action.setSourceType(Component.Funnel); if (actionDetails != null) { action.setActionDetails(actionDetails); } } return action; }",audit_accountability,audit_accountability,True,,0.9963028430938721,0.0036971152294427156
4
+ 2,private static final Logger logger = LoggerFactory.getLogger(ParameterContextAuditor.class);,unrelated,unrelated,True,,0.000670079025439918,0.9993299245834351
5
+ 3,"if (isAuditable()) { FlowChangeExtensionDetails controllerServiceDetails = new FlowChangeExtensionDetails(); controllerServiceDetails.setType(controllerService.getComponentType()); final FlowChangeAction configAction = createFlowChangeAction(); configAction.setOperation(Operation.ClearState); configAction.setSourceId(controllerService.getIdentifier()); configAction.setSourceName(controllerService.getName()); configAction.setSourceType(Component.ControllerService); configAction.setComponentDetails(controllerServiceDetails); saveAction(configAction, logger); }",audit_accountability,audit_accountability,True,,0.9966711401939392,0.00332890497520566
6
+ 4,"private void logAttributesDeleted(SecurityUser user, EntityId entityId, AttributeScope scope, List<String> keys, Throwable e) { logEntityActionService.logEntityAction(user.getTenantId(), (UUIDBased & EntityId) entityId, ActionType.ATTRIBUTES_DELETED, user, toException(e), scope, keys); }",audit_accountability,audit_accountability,True,,0.9966233968734741,0.0033766189590096474
7
+ 5,"private void logTelemetryUpdated(SecurityUser user, EntityId entityId, List<TsKvEntry> telemetry, Throwable e) { logEntityActionService.logEntityAction(user.getTenantId(), entityId, ActionType.TIMESERIES_UPDATED, user, toException(e), telemetry); }",audit_accountability,audit_accountability,True,,0.9965726137161255,0.003427420975640416
8
+ 6,"public SmsTwoFaProvider(CacheManager cacheManager, SmsService smsService, AuditLogService auditLogService) { super(cacheManager); this.smsService = smsService; this.auditLogService = auditLogService; }",unrelated,unrelated,True,,0.0008106429595500231,0.9991893172264099
9
+ 7,"@Override public void createPartition(AuditLogEntity entity) { partitioningRepository.createPartitionIfNotExists(AUDIT_LOG_TABLE_NAME, entity.getCreatedTime(), TimeUnit.HOURS.toMillis(partitionSizeInHours)); }",audit_accountability,audit_accountability,True,,0.9966607093811035,0.0033393469639122486
10
+ 8,"public CamelWebSocketHandler() { this.receiveListener = new UndertowReceiveListener(); this.callback = new UndertowWebSocketConnectionCallback(); this.closeListener = (WebSocketChannel channel) -> sendEventNotificationIfNeeded( (String) channel.getAttribute(UndertowConstants.CONNECTION_KEY), null, channel, EventType.ONCLOSE); this.delegate = Handlers.websocket(callback); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9726507663726807,0.027349282056093216
11
+ 9,private static final Logger LOG = LoggerFactory.getLogger(ProviderUtils.class);,unrelated,unrelated,True,,0.0006675135809928179,0.9993324875831604
12
+ 10,"final FlowChangeAction configurationAction = createFlowChangeAction(); configurationAction.setOperation(operation); configurationAction.setTimestamp(actionTimestamp); configurationAction.setSourceId(user.getIdentifier()); configurationAction.setSourceName(user.getName()); configurationAction.setSourceType(Component.UserGroup); configurationAction.setActionDetails(actionDetails); actions.add(configurationAction); } } if (!actions.isEmpty()) { saveActions(actions, logger); }",audit_accountability,audit_accountability,True,,0.996579110622406,0.003420925000682473
13
+ 11,"@ApiOperation(value = ""Change password for current User (changePassword)"", notes = ""Change the password for the User which credentials are used to perform this REST API call. Be aware that previously generated [JWT](https://jwt.io/) tokens will be still valid until they expire."") @PreAuthorize(""hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')"") @PostMapping(value = ""/auth/changePassword"") public JwtPair changePassword(@Parameter(description = ""Change Password Request"") @RequestBody ChangePasswordRequest changePasswordRequest) throws ThingsboardException { String currentPassword = changePasswordRequest.getCurrentPassword(); String newPassword = changePasswordRequest.getNewPassword(); SecurityUser securityUser = getCurrentUser(); UserCredentials userCredentials = userService.findUserCredentialsByUserId(TenantId.SYS_TENANT_ID, securityUser.getId()); if (!passwordEncoder.matches(currentPassword, userCredentials.getPassword())) { throw new ThingsboardException(""Current password doesn't match!"", ThingsboardErrorCode.BAD_REQUEST_PARAMS); } systemSecurityService.validatePassword(newPassword, userCredentials); if (passwordEncoder.matches(newPassword, userCredentials.getPassword())) { throw new ThingsboardException(""New password should be different from existing!"", ThingsboardErrorCode.BAD_REQUEST_PARAMS); } userCredentials.setPassword(passwordEncoder.encode(newPassword)); userService.replaceUserCredentials(securityUser.getTenantId(), userCredentials); eventPublisher.publishEvent(new UserCredentialsInvalidationEvent(securityUser.getId())); return tokenFactory.createTokenPair(securityUser); }",unrelated,unrelated,True,,0.004657413344830275,0.9953426122665405
14
+ 12,"final FlowChangeAction configurationAction = createFlowChangeAction(); configurationAction.setOperation(operation); configurationAction.setTimestamp(actionTimestamp); configurationAction.setSourceId(parameterProvider.getIdentifier()); configurationAction.setSourceName(parameterProvider.getName()); configurationAction.setSourceType(Component.ParameterProvider); configurationAction.setComponentDetails(providerDetails); configurationAction.setActionDetails(actionDetails); actions.add(configurationAction); } } if (!actions.isEmpty()) { saveActions(actions, logger); }",audit_accountability,audit_accountability,True,,0.9965510368347168,0.0034489643294364214
15
+ 13,"@Override protected JpaRepository<AuditLogEntity, UUID> getRepository() { return auditLogRepository; }",unrelated,unrelated,True,,0.0007192351040430367,0.9992807507514954
16
+ 14,"private void logAttributesUpdated(SecurityUser user, EntityId entityId, AttributeScope scope, List<AttributeKvEntry> attributes, Throwable e) { logEntityActionService.logEntityAction(user.getTenantId(), entityId, ActionType.ATTRIBUTES_UPDATED, user, toException(e), scope, attributes); }",audit_accountability,audit_accountability,True,,0.9966080188751221,0.0033919878769665956
17
+ 15,"<E extends HasName, I extends EntityId> ListenableFuture<Void> logEntityAction( TenantId tenantId, CustomerId customerId, UserId userId, String userName, @NotNull I entityId, E entity, ActionType actionType, Exception e, Object... additionalInfo);",audit_accountability,audit_accountability,True,,0.9964936375617981,0.003506411798298359
18
+ 16,private static final Logger LOG = LoggerFactory.getLogger(CompositeService.class);,unrelated,unrelated,True,,0.0006661596125923097,0.9993337988853455
19
+ 17,"@Override public void onConnect(WebSocketHttpExchange exchange, WebSocketChannel channel) { LOG.trace(""onConnect {}"", exchange); OAuthTokenValidationResult oauthTokenValidationResult = exchange.getAttachment(OAUTH_TOKEN_VALIDATION_RESULT_ATTACHMENT); if (oauthTokenValidationResult == null && requiresOAuth()) { LOG.warn(""Closing WebSocket channel whose handshake was not OAuth validated""); WebSockets.sendClose(CloseMessage.MSG_VIOLATES_POLICY, ""Authentication required"", channel, null); return; } final String connectionKey = UUID.randomUUID().toString(); channel.setAttribute(UndertowConstants.CONNECTION_KEY, connectionKey); if (oauthTokenValidationResult != null) { channel.setAttribute(OAuthHttpSecuritySupport.OAUTH_TOKEN_VALIDATION_RESULT, oauthTokenValidationResult); } channel.getReceiveSetter().set(receiveListener); channel.addCloseTask(closeListener); sendEventNotificationIfNeeded(connectionKey, exchange, channel, EventType.ONOPEN); channel.resumeReceives(); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9900937676429749,0.009906197898089886
20
+ 18,"private void logRuleEngineCall(SecurityUser user, EntityId entityId, String request, TbMsg response, Throwable e) { auditLogService.logEntityAction( user.getTenantId(), user.getCustomerId(), user.getId(), user.getName(), entityId, null, ActionType.REST_API_RULE_ENGINE_CALL, BaseController.toException(e), request, response != null ? response.getData() : """"); }",audit_accountability,audit_accountability,True,,0.996541440486908,0.003458545543253422
21
+ 19,action = createFlowChangeAction(); action.setOperation(operation); action.setSourceId(controllerService.getIdentifier()); action.setSourceName(controllerService.getName()); action.setSourceType(Component.ControllerService); action.setComponentDetails(serviceDetails); if (actionDetails != null) { action.setActionDetails(actionDetails); },audit_accountability,audit_accountability,True,,0.9965278506278992,0.003472094191238284
22
+ 20,"final FlowChangeAction configurationAction = createFlowChangeAction(); configurationAction.setOperation(operation); configurationAction.setTimestamp(actionTimestamp); configurationAction.setSourceId(user.getIdentifier()); configurationAction.setSourceName(user.getIdentity()); configurationAction.setSourceType(Component.User); configurationAction.setActionDetails(actionDetails); actions.add(configurationAction); } } if (!actions.isEmpty()) { saveActions(actions, logger); }",audit_accountability,audit_accountability,True,,0.9965722560882568,0.0034277073573321104
23
+ 21,"final FlowChangeConfigureDetails actionDetails = new FlowChangeConfigureDetails(); actionDetails.setName(""Applied Update""); actionDetails.setValue(""true""); actionDetails.setPreviousValue(null); final FlowChangeAction configurationAction = createFlowChangeAction(); configurationAction.setOperation(Operation.Configure); configurationAction.setTimestamp(new Date()); configurationAction.setSourceId(connector.getIdentifier()); configurationAction.setSourceName(connector.getName()); configurationAction.setSourceType(Component.Connector); configurationAction.setComponentDetails(connectorDetails); configurationAction.setActionDetails(actionDetails); saveAction(configurationAction, logger);",audit_accountability,audit_accountability,True,,0.9965574741363525,0.0034426080528646708
24
+ 22,"@Query(""SELECT a FROM AuditLogEntity a WHERE "" + ""a.tenantId = :tenantId "" + ""AND (:startTime IS NULL OR a.createdTime >= :startTime) "" + ""AND (:endTime IS NULL OR a.createdTime <= :endTime) "" + ""AND ((:actionTypes) IS NULL OR a.actionType IN (:actionTypes)) "" + ""AND (:textSearch IS NULL OR ilike(a.entityType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.entityName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.userName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionStatus, CONCAT('%', :textSearch, '%')) = true)"" ) Page<AuditLogEntity> findByTenantId( @Param(""tenantId"") UUID tenantId, @Param(""textSearch"") String textSearch, @Param(""startTime"") Long startTime, @Param(""endTime"") Long endTime, @Param(""actionTypes"") List<ActionType> actionTypes, Pageable pageable);",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.16915641725063324,0.8308435678482056
25
+ 23,action = createFlowChangeAction(); action.setOperation(operation); action.setSourceId(flowAnalysisRule.getIdentifier()); action.setSourceName(flowAnalysisRule.getName()); action.setSourceType(Component.FlowAnalysisRule); action.setComponentDetails(ruleDetails); if (actionDetails != null) { action.setActionDetails(actionDetails); },audit_accountability,audit_accountability,True,,0.9964738488197327,0.003526156535372138
26
+ 24,final FlowChangeAction processorAction = createFlowChangeAction(); processorAction.setSourceId(processor.getIdentifier()); processorAction.setSourceName(processor.getName()); processorAction.setSourceType(Component.Processor); processorAction.setComponentDetails(processorDetails); processorAction.setOperation(ScheduledState.RUNNING.equals(processor.getScheduledState()) ? Operation.Start : Operation.Stop); actions.add(processorAction);,audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0008172939415089786,0.9991826415061951
27
+ 25,final FlowChangeConfigureDetails actionDetails = new FlowChangeConfigureDetails(); actionDetails.setName(property); actionDetails.setValue(newValue); actionDetails.setPreviousValue(oldValue); final FlowChangeAction configurationAction = createFlowChangeAction(); configurationAction.setOperation(operation); configurationAction.setTimestamp(actionTimestamp); configurationAction.setSourceId(processor.getIdentifier()); configurationAction.setSourceName(processor.getName()); configurationAction.setSourceType(Component.Processor); configurationAction.setComponentDetails(processorDetails); configurationAction.setActionDetails(actionDetails); actions.add(configurationAction);,audit_accountability,audit_accountability,True,,0.9953617453575134,0.004638220649212599
28
+ 26,"package org.springframework.data.jpa.repository.config; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.context.annotation.Import; import org.springframework.data.auditing.DateTimeProvider; import org.springframework.data.domain.AuditorAware; @Documented @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Import(JpaAuditingRegistrar.class) public @interface EnableJpaAuditing { String auditorAwareRef() default """"; boolean setDates() default true; boolean modifyOnCreate() default true; String dateTimeProviderRef() default """"; }",unrelated,unrelated,True,,0.0007058642222546041,0.9992941617965698
29
+ 27,"return executor.submit(() -> { try { AuditLog auditLog = auditLogDao.save(tenantId, auditLogEntry); auditLogSink.logAction(auditLog); } catch (Throwable e) { log.error(""[{}] Failed to save audit log: {}"", tenantId, auditLogEntry, e); } return null; });",audit_accountability,audit_accountability,True,,0.9966694712638855,0.003330534789711237
30
+ 28,"@Query(""SELECT a FROM AuditLogEntity a WHERE "" + ""a.tenantId = :tenantId "" + ""AND a.userId = :userId "" + ""AND (:startTime IS NULL OR a.createdTime >= :startTime) "" + ""AND (:endTime IS NULL OR a.createdTime <= :endTime) "" + ""AND ((:actionTypes) IS NULL OR a.actionType IN (:actionTypes)) "" + ""AND (:textSearch IS NULL OR ilike(a.entityType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.entityName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionStatus, CONCAT('%', :textSearch, '%')) = true)"" ) Page<AuditLogEntity> findAuditLogsByTenantIdAndUserId(@Param(""tenantId"") UUID tenantId, @Param(""userId"") UUID userId, @Param(""textSearch"") String textSearch, @Param(""startTime"") Long startTime, @Param(""endTime"") Long endTime, @Param(""actionTypes"") List<ActionType> actionTypes, Pageable pageable);",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.3596550524234772,0.6403449177742004
31
+ 29,"@RequestParam(name = ""actionTypes"", required = false) String actionTypesStr) throws ThingsboardException { checkParameter(""CustomerId"", strCustomerId); TenantId tenantId = getCurrentUser().getTenantId(); TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, getStartTime(startTime), getEndTime(endTime)); List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr); return checkNotNull(auditLogService.findAuditLogsByTenantIdAndCustomerId(tenantId, new CustomerId(UUID.fromString(strCustomerId)), actionTypes, pageLink)); }",audit_accountability,audit_accountability,True,,0.9966500401496887,0.0033499393612146378
32
+ 30,"public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { try { getBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME, beanFactory); } catch (NoSuchBeanDefinitionException o_O) { throw new IllegalStateException( ""Invalid auditing setup; Make sure you've used @EnableJpaAuditing or <jpa:auditing /> correctly"", o_O); } for (String beanName : getEntityManagerFactoryBeanNames(beanFactory)) { BeanDefinition definition = getBeanDefinition(beanName, beanFactory); definition.setDependsOn(addStringToArray(definition.getDependsOn(), BEAN_CONFIGURER_ASPECT_BEAN_NAME)); } }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007471139542758465,0.9992528557777405
33
+ 31,"@PreUpdate public void touchForUpdate(Object target) { Assert.notNull(target, ""Entity must not be null""); if (handler != null) { AuditingHandler object = handler.getObject(); if (object != null) { object.markModified(target); } } }",audit_accountability,audit_accountability,True,,0.9964841604232788,0.003515881020575762
34
+ 32,"@Override public PageData<AuditLog> findAuditLogsByTenantIdAndCustomerId(TenantId tenantId, CustomerId customerId, List<ActionType> actionTypes, TimePageLink pageLink) { log.trace(""Executing findAuditLogsByTenantIdAndCustomerId [{}], [{}], [{}]"", tenantId, customerId, pageLink); validateId(tenantId, id -> INCORRECT_TENANT_ID + id); validateId(customerId, id -> ""Incorrect customerId "" + id); return auditLogDao.findAuditLogsByTenantIdAndCustomerId(tenantId.getId(), customerId, actionTypes, pageLink); }",audit_accountability,audit_accountability,True,,0.9964487552642822,0.0035511960741132498
35
+ 33,"@RequestParam(name = ""actionTypes"", required = false) String actionTypesStr) throws ThingsboardException { checkParameter(""UserId"", strUserId); TenantId tenantId = getCurrentUser().getTenantId(); TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, getStartTime(startTime), getEndTime(endTime)); List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr); return checkNotNull(auditLogService.findAuditLogsByTenantIdAndUserId(tenantId, new UserId(UUID.fromString(strUserId)), actionTypes, pageLink)); }",audit_accountability,audit_accountability,True,,0.996658205986023,0.0033417423255741596
36
+ 34,@Autowired public void setAuditService(AuditService auditService) { this.auditService = auditService; },unrelated,unrelated,True,,0.0008057396626099944,0.999194324016571
37
+ 35,"@PrePersist public void touchForCreate(Object target) { Assert.notNull(target, ""Entity must not be null""); if (handler != null) { AuditingHandler object = handler.getObject(); if (object != null) { object.markCreated(target); } } }",audit_accountability,audit_accountability,True,,0.9965136647224426,0.003486398607492447
38
+ 36,"@RequestParam(name = ""actionTypes"", required = false) String actionTypesStr) throws ThingsboardException { checkParameter(""EntityId"", strEntityId); checkParameter(""EntityType"", strEntityType); TenantId tenantId = getCurrentUser().getTenantId(); TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, getStartTime(startTime), getEndTime(endTime)); List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr); return checkNotNull(auditLogService.findAuditLogsByTenantIdAndEntityId(tenantId, EntityIdFactory.getByTypeAndId(strEntityType, strEntityId), actionTypes, pageLink)); }",audit_accountability,audit_accountability,True,,0.9966173768043518,0.0033826418220996857
39
+ 37,"@Override public PageData<AuditLog> findAuditLogsByTenantId(TenantId tenantId, List<ActionType> actionTypes, TimePageLink pageLink) { log.trace(""Executing findAuditLogs [{}]"", pageLink); validateId(tenantId, id -> INCORRECT_TENANT_ID + id); return auditLogDao.findAuditLogsByTenantId(tenantId.getId(), actionTypes, pageLink); }",audit_accountability,audit_accountability,True,,0.996599018573761,0.0034010461531579494
40
+ 38,@Override protected Class<AuditLogEntity> getEntityClass() { return AuditLogEntity.class; },unrelated,unrelated,True,,0.0007710408535785973,0.9992289543151855
41
+ 39,@Autowired private AuditLogLevelFilter auditLogLevelFilter;,unrelated,unrelated,True,,0.000750306760892272,0.9992496371269226
42
+ 40,"@Override public PageData<AuditLog> findAuditLogsByTenantIdAndUserId(TenantId tenantId, UserId userId, List<ActionType> actionTypes, TimePageLink pageLink) { log.trace(""Executing findAuditLogsByTenantIdAndUserId [{}], [{}], [{}]"", tenantId, userId, pageLink); validateId(tenantId, id -> INCORRECT_TENANT_ID + id); validateId(userId, id -> ""Incorrect userId"" + id); return auditLogDao.findAuditLogsByTenantIdAndUserId(tenantId.getId(), userId, actionTypes, pageLink); }",audit_accountability,audit_accountability,True,,0.9964260458946228,0.0035739580634981394
43
+ 41,public static void setAuditSink(SecretAuditSink sink) { auditSink = sink; },unrelated,unrelated,True,,0.0007287966436706483,0.9992712140083313
44
+ 42,"@Override public PageData<AuditLog> findAuditLogsByTenantId(UUID tenantId, List<ActionType> actionTypes, TimePageLink pageLink) { return DaoUtil.toPageData( auditLogRepository.findByTenantId( tenantId, pageLink.getTextSearch(), pageLink.getStartTime(), pageLink.getEndTime(), actionTypes, DaoUtil.toPageable(pageLink))); }",audit_accountability,audit_accountability,True,,0.9861173033714294,0.013882717117667198
45
+ 43,"public DedicatedJpaAuditLogDao(AuditLogRepository auditLogRepository, DedicatedEventsSqlPartitioningRepository partitioningRepository) { super(auditLogRepository, partitioningRepository); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9897404909133911,0.010259446687996387
46
+ 44,private @Nullable ObjectFactory<AuditingHandler> handler;,unrelated,unrelated,True,,0.0007314497488550842,0.9992685914039612
47
+ 45,private final AuditLogRepository auditLogRepository;,unrelated,unrelated,True,,0.0007195823709480464,0.9992803931236267
48
+ 46,"@Query(""SELECT a FROM AuditLogEntity a WHERE "" + ""a.tenantId = :tenantId "" + ""AND a.customerId = :customerId "" + ""AND (:startTime IS NULL OR a.createdTime >= :startTime) "" + ""AND (:endTime IS NULL OR a.createdTime <= :endTime) "" + ""AND ((:actionTypes) IS NULL OR a.actionType IN (:actionTypes)) "" + ""AND (:textSearch IS NULL OR ilike(a.entityType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.entityName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.userName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionStatus, CONCAT('%', :textSearch, '%')) = true)"" ) Page<AuditLogEntity> findAuditLogsByTenantIdAndCustomerId(@Param(""tenantId"") UUID tenantId, @Param(""customerId"") UUID customerId, @Param(""textSearch"") String textSearch, @Param(""startTime"") Long startTime, @Param(""endTime"") Long endTime, @Param(""actionTypes"") List<ActionType> actionTypes, Pageable pageable);",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.13454431295394897,0.8654556274414062
49
+ 47,"@Override public PageData<AuditLog> findAuditLogsByTenantIdAndEntityId(TenantId tenantId, EntityId entityId, List<ActionType> actionTypes, TimePageLink pageLink) { log.trace(""Executing findAuditLogsByTenantIdAndEntityId [{}], [{}], [{}]"", tenantId, entityId, pageLink); validateId(tenantId, id -> INCORRECT_TENANT_ID + id); validateEntityId(entityId, id -> ""Incorrect entityId"" + id); return auditLogDao.findAuditLogsByTenantIdAndEntityId(tenantId.getId(), entityId, actionTypes, pageLink); }",audit_accountability,audit_accountability,True,,0.9964095950126648,0.0035903495736420155
50
+ 48,"@Override public PageData<AuditLog> findAuditLogsByTenantIdAndUserId(UUID tenantId, UserId userId, List<ActionType> actionTypes, TimePageLink pageLink) { return DaoUtil.toPageData( auditLogRepository .findAuditLogsByTenantIdAndUserId( tenantId, userId.getId(), pageLink.getTextSearch(), pageLink.getStartTime(), pageLink.getEndTime(), actionTypes, DaoUtil.toPageable(pageLink))); }",audit_accountability,audit_accountability,True,,0.9942046999931335,0.005795370787382126
51
+ 49,"@Query(""SELECT a FROM AuditLogEntity a WHERE "" + ""a.tenantId = :tenantId "" + ""AND a.entityType = :entityType AND a.entityId = :entityId "" + ""AND (:startTime IS NULL OR a.createdTime >= :startTime) "" + ""AND (:endTime IS NULL OR a.createdTime <= :endTime) "" + ""AND ((:actionTypes) IS NULL OR a.actionType IN (:actionTypes)) "" + ""AND (:textSearch IS NULL OR ilike(a.entityName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.userName, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionType, CONCAT('%', :textSearch, '%')) = true "" + ""OR ilike(a.actionStatus, CONCAT('%', :textSearch, '%')) = true)"" ) Page<AuditLogEntity> findAuditLogsByTenantIdAndEntityId(@Param(""tenantId"") UUID tenantId, @Param(""entityType"") EntityType entityType, @Param(""entityId"") UUID entityId, @Param(""textSearch"") String textSearch, @Param(""startTime"") Long startTime, @Param(""endTime"") Long endTime, @Param(""actionTypes"") List<ActionType> actionTypes, Pageable pageable);",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.037442974746227264,0.9625569581985474
52
+ 50,"public void setAuditingHandler(ObjectFactory<AuditingHandler> auditingHandler) { Assert.notNull(auditingHandler, ""AuditingHandler must not be null""); this.handler = auditingHandler; }",unrelated,unrelated,True,,0.0007169446907937527,0.9992831349372864
53
+ 51,"static final String AUDITING_ENTITY_LISTENER_CLASS_NAME = ""org.springframework.data.jpa.domain.support.AuditingEntityListener"";",unrelated,unrelated,True,,0.0007463603396899998,0.9992535710334778
54
+ 52,"@Override protected String getAuditingHandlerBeanName() { return ""jpaAuditingHandler""; }",unrelated,unrelated,True,,0.0007518534548580647,0.9992480874061584
55
+ 53,"@Override public PageData<AuditLog> findAuditLogsByTenantIdAndCustomerId(UUID tenantId, CustomerId customerId, List<ActionType> actionTypes, TimePageLink pageLink) { return DaoUtil.toPageData( auditLogRepository .findAuditLogsByTenantIdAndCustomerId( tenantId, customerId.getId(), pageLink.getTextSearch(), pageLink.getStartTime(), pageLink.getEndTime(), actionTypes, DaoUtil.toPageable(pageLink))); }",audit_accountability,audit_accountability,True,,0.9941046833992004,0.005895309150218964
56
+ 54,"@Override protected void registerAuditListenerBeanDefinition(BeanDefinition auditingHandlerDefinition, BeanDefinitionRegistry registry) { if (!registry.containsBeanDefinition(JPA_MAPPING_CONTEXT_BEAN_NAME)) { registry.registerBeanDefinition(JPA_MAPPING_CONTEXT_BEAN_NAME, new RootBeanDefinition(JpaMetamodelMappingContextFactoryBean.class)); } BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(AuditingEntityListener.class); builder.addPropertyValue(""auditingHandler"", ParsingUtils.getObjectFactoryBeanDefinition(getAuditingHandlerBeanName(), null)); registerInfrastructureBeanWithId(builder.getRawBeanDefinition(), AuditingEntityListener.class.getName(), registry); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.000740239629521966,0.9992597699165344
57
+ 55,@Autowired private AuditLogDao auditLogDao;,unrelated,unrelated,True,,0.0007660716073587537,0.9992339611053467
58
+ 56,"@Override public PageData<AuditLog> findAuditLogsByTenantIdAndEntityId(UUID tenantId, EntityId entityId, List<ActionType> actionTypes, TimePageLink pageLink) { return DaoUtil.toPageData( auditLogRepository .findAuditLogsByTenantIdAndEntityId( tenantId, entityId.getEntityType(), entityId.getId(), pageLink.getTextSearch(), pageLink.getStartTime(), pageLink.getEndTime(), actionTypes, DaoUtil.toPageable(pageLink))); }",audit_accountability,audit_accountability,True,,0.9938143491744995,0.00618561077862978
59
+ 57,"@RequestParam(name = ""actionTypes"", required = false) String actionTypesStr) throws ThingsboardException { TenantId tenantId = getCurrentUser().getTenantId(); List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr); TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, getStartTime(startTime), getEndTime(endTime)); return checkNotNull(auditLogService.findAuditLogsByTenantId(tenantId, actionTypes, pageLink)); }",audit_accountability,audit_accountability,True,,0.996653139591217,0.0033469321206212044
60
+ 58,public static SecretAuditSink getAuditSink() { return auditSink; },unrelated,unrelated,True,,0.0006894962280057371,0.9993104934692383
61
+ 59,@Autowired private AuditLogSink auditLogSink;,unrelated,unrelated,True,,0.0007387421210296452,0.999261200428009
62
+ 60,"@EventListener(classes = UserAuthDataChangedEvent.class) public void onUserAuthDataChanged(UserAuthDataChangedEvent event) { if (StringUtils.hasText(event.getId())) { cache.put(event.getId(), event.getTs()); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9963765740394592,0.003623413620516658
63
+ 61,"@ApiOperation(value = ""Enable/Disable User credentials (setUserCredentialsEnabled)"", notes = ""Enables or Disables user credentials. Useful when you would like to block user account without deleting it. "" + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH) @PreAuthorize(""hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')"") @PostMapping(value = ""/user/{userId}/userCredentialsEnabled"") public void setUserCredentialsEnabled( @Parameter(description = USER_ID_PARAM_DESCRIPTION) @PathVariable(USER_ID) String strUserId, @Parameter(description = ""Enable (\""true\"") or disable (\""false\"") the credentials."", schema = @Schema(defaultValue = ""true"")) @RequestParam(required = false, defaultValue = ""true"") boolean userCredentialsEnabled) throws ThingsboardException { checkParameter(USER_ID, strUserId); UserId userId = new UserId(toUUID(strUserId)); checkUserId(userId, Operation.WRITE); TenantId tenantId = getCurrentUser().getTenantId(); userService.setUserCredentialsEnabled(tenantId, userId, userCredentialsEnabled); if (!userCredentialsEnabled) { eventPublisher.publishEvent(new UserCredentialsInvalidationEvent(userId)); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9842357635498047,0.01576417125761509
64
+ 62,"setLoginUser(u); LOG.info( ""Login successful for user {} using keytab file {}. Keytab auto"" + "" renewal enabled : {}"", user, new File(path).getName(), isKerberosKeyTabLoginRenewalEnabled()); }",audit_accountability,audit_accountability,True,,0.9966400861740112,0.0033599173184484243
65
+ 63,"} catch (AuthorizationException ae) { LOG.info(""Connection from "" + this + "" for protocol "" + connectionContext.getProtocol() + "" is unauthorized for user "" + user); rpcMetrics.incrAuthorizationFailures(); throw new FatalRpcServerException( RpcErrorCodeProto.FATAL_UNAUTHORIZED, ae); }",audit_accountability,audit_accountability,True,,0.9966244697570801,0.0033755311742424965
66
+ 64,public static String[] getDNSSubjectAlts(X509Certificate cert) { final List<String> subjectAltList = new LinkedList<String>(); Collection<List<?>> c = null; try { c = cert.getSubjectAlternativeNames(); } catch (CertificateParsingException cpe) { cpe.printStackTrace(); } if (c != null) { Iterator<List<?>> it = c.iterator(); while (it.hasNext()) { List<?> list = it.next(); int type = ((Integer) list.get(0)).intValue(); if (type == 2) { String s = (String) list.get(1); subjectAltList.add(s); } } } if (!subjectAltList.isEmpty()) { String[] subjectAlts = new String[subjectAltList.size()]; subjectAltList.toArray(subjectAlts); return subjectAlts; } else { return null; } },unrelated,unrelated,True,,0.0006960179889574647,0.999303936958313
67
+ 65,"if (authorizedPattern.matcher(foundSubject).matches()) { if (authorizedIssuerPattern.matcher(foundIssuer).matches()) { break; } else { logger.warn(""Access Forbidden [Issuer not authorized] Host [{}] Subject [{}] Issuer [{}]"", request.getRemoteHost(), foundSubject, foundIssuer); response.sendError(HttpServletResponse.SC_FORBIDDEN, ""not allowed based on issuer dn""); return; } } else { logger.warn(""Access Forbidden [Subject not authorized] Host [{}] Subject [{}] Issuer [{}]"", request.getRemoteHost(), foundSubject, foundIssuer); response.sendError(HttpServletResponse.SC_FORBIDDEN, ""not allowed based on subject dn""); return; }",audit_accountability,audit_accountability,True,,0.9966012239456177,0.0033987874630838633
68
+ 66,"public void lock() { this.locked = true; logger.info(Logger.SECURITY_SUCCESS, ""Account locked: "" + getAccountName() ); }",audit_accountability,audit_accountability,True,,0.996626615524292,0.003373452927917242
69
+ 67,"public static final Logger AUDITLOG = LoggerFactory.getLogger(""SecurityLogger.""+Server.class.getName());",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0006616939790546894,0.9993383288383484
70
+ 68,"public ExitUtil.ExitException launchService(Configuration conf, S instance, List<String> processedArgs, boolean addShutdownHook, boolean execute) { ExitUtil.ExitException exitException; try { int exitCode = coreServiceLaunch(conf, instance, processedArgs, addShutdownHook, execute); if (service != null) { Throwable failure = service.getFailureCause(); if (failure != null) { Service.STATE failureState = service.getFailureState(); if (failureState == Service.STATE.STOPPED) { LOG.debug(""Failure during shutdown: {} "", failure, failure); } else { throw failure; } } } String name = getServiceName(); if (exitCode == 0) { exitException = new ServiceLaunchException(exitCode, ""%s succeeded"", name); } else { exitException = new ServiceLaunchException(exitCode, ""%s failed "", name); } } catch (ExitUtil.ExitException ee) { exitException = ee; } catch (Throwable thrown) { LOG.error(""Exception raised {}"", service != null ? (service.toString() + "" in state "" + service.getServiceState()) : ""during service instantiation"", thrown); exitException = convertToExitException(thrown); } noteException(exitException); return exitException; }",unrelated,unrelated,True,,0.0006528330268338323,0.9993471503257751
71
+ 69,"public static void freeDB(ByteBuffer buffer) { if (CleanerUtil.UNMAP_SUPPORTED) { try { CleanerUtil.getCleaner().freeBuffer(buffer); } catch (IOException e) { LOG.info(""Failed to free the buffer"", e); } } else { LOG.trace(CleanerUtil.UNMAP_NOT_SUPPORTED_REASON); } }",unrelated,unrelated,True,,0.0006592721329070628,0.9993407130241394
72
+ 70,"if((clientPrincipal != null && !clientPrincipal.equals(user.getUserName())) || acls.length != 2 || !acls[0].isUserAllowed(user) || acls[1].isUserAllowed(user)) { String cause = clientPrincipal != null ? "": this service is only accessible by "" + clientPrincipal : "": denied by configured ACL""; AUDITLOG.warn(AUTHZ_FAILED_FOR + user + "" for protocol="" + protocol + cause); throw new AuthorizationException(""User "" + user + "" is not authorized for protocol "" + protocol + cause); }",audit_accountability,audit_accountability,True,,0.996659517288208,0.003340496215969324
73
+ 71,"public static void parseCrypto( Map<String, Object> config, WSSSecurityProperties properties ) { Object passwordEncryptorObj = config.get(ConfigurationConstants.PASSWORD_ENCRYPTOR_INSTANCE); PasswordEncryptor passwordEncryptor = null; if (passwordEncryptorObj instanceof PasswordEncryptor) { passwordEncryptor = (PasswordEncryptor)passwordEncryptorObj; } if (passwordEncryptor == null) { CallbackHandler callbackHandler = properties.getCallbackHandler(); if (callbackHandler != null) { passwordEncryptor = new JasyptPasswordEncryptor(callbackHandler); } } String sigPropRef = getString(ConfigurationConstants.SIG_PROP_REF_ID, config); boolean foundSigRef = false; if (sigPropRef != null) { Object sigRef = config.get(sigPropRef); if (sigRef instanceof Crypto) { foundSigRef = true; properties.setSignatureCrypto((Crypto)sigRef); } else if (sigRef instanceof Properties) { foundSigRef = true; properties.setSignatureCryptoProperties((Properties)sigRef, passwordEncryptor); } if (foundSigRef && properties.getSignatureUser() == null) { properties.setSignatureUser(getDefaultX509Identifier(properties, true)); } } if (!foundSigRef) { String sigPropFile = getString(ConfigurationConstants.SIG_PROP_FILE, config); if (sigPropFile != null) { try { Properties sigProperties = CryptoFactory.getProperties(sigPropFile, getClassLoader()); properties.setSignatureCryptoProperties(sigProperties, passwordEncryptor); if (properties.getSignatureUser() == null) { properties.setSignatureUser(getDefaultX509Identifier(properties, true)); } } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); } } } String sigVerPropRef = getString(ConfigurationConstants.SIG_VER_PROP_REF_ID, config); boolean foundSigVerRef = false; if (sigVerPropRef != null) { Object sigVerRef = config.get(sigVerPropRef); if (sigVerRef instanceof Crypto) { foundSigVerRef = true; properties.setSignatureVerificationCrypto((Crypto)sigVerRef); } else if (sigVerRef instanceof Properties) { foundSigVerRef = true; properties.setSignatureVerificationCryptoProperties((Properties)sigVerRef, passwordEncryptor); } } if (!foundSigVerRef) { String sigPropFile = getString(ConfigurationConstants.SIG_VER_PROP_FILE, config); if (sigPropFile != null) { try { Properties sigProperties = CryptoFactory.getProperties(sigPropFile, getClassLoader()); properties.setSignatureVerificationCryptoProperties(sigProperties, passwordEncryptor); } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); } } } String encPropRef = getString(ConfigurationConstants.ENC_PROP_REF_ID, config); boolean foundEncRef = false; if (encPropRef != null) { Object encRef = config.get(encPropRef); if (encRef instanceof Crypto) { foundEncRef = true; properties.setEncryptionCrypto((Crypto)encRef); } else if (encRef instanceof Properties) { foundEncRef = true; properties.setEncryptionCryptoProperties((Properties)encRef, passwordEncryptor); } } if (!foundEncRef) { String encPropFile = getString(ConfigurationConstants.ENC_PROP_FILE, config); if (encPropFile != null) { try { Properties encProperties = CryptoFactory.getProperties(encPropFile, getClassLoader()); properties.setEncryptionCryptoProperties(encProperties, passwordEncryptor); } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); } } } String decPropRef = getString(ConfigurationConstants.DEC_PROP_REF_ID, config); boolean foundDecRef = false; if (decPropRef != null) { Object decRef = config.get(decPropRef); if (decRef instanceof Crypto) { foundDecRef = true; properties.setDecryptionCrypto((Crypto)decRef); } else if (decRef instanceof Properties) { foundDecRef = true; properties.setDecryptionCryptoProperties((Properties)decRef, passwordEncryptor); } } if (!foundDecRef) { String encPropFile = getString(ConfigurationConstants.DEC_PROP_FILE, config); if (encPropFile != null) { try { Properties encProperties = CryptoFactory.getProperties(encPropFile, getClassLoader()); properties.setDecryptionCryptoProperties(encProperties, passwordEncryptor); } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); } } } }",unrelated,unrelated,True,,0.000743202748708427,0.9992567896842957
74
+ 72,"@Override protected int incrementCurrentKeyId() { try { incrSharedCount(keyIdSeqCounter, 1); } catch (InterruptedException e) { LOG.debug(""Thread interrupted while performing keyId increment"", e); Thread.currentThread().interrupt(); } catch (Exception e) { throw new RuntimeException(""Could not increment shared keyId counter !!"", e); } return keyIdSeqCounter.getCount(); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9964644908905029,0.0035354746505618095
75
+ 73,"if (servletContext.getAttribute(ADMINS_ACL) != null && !userHasAdministratorAccess(servletContext, remoteUser)) { response.sendError(HttpServletResponse.SC_FORBIDDEN, ""Unauthenticated users are not "" + ""authorized to access this page.""); LOG.warn(""User "" + remoteUser + "" is unauthorized to access the page "" + request.getRequestURI() + "".""); return false; }",audit_accountability,audit_accountability,True,,0.9965247511863708,0.0034752634819597006
76
+ 74,"@Override public int hashCode() { int result = 17; try { Reference reference = getReference(); if (reference != null) { result = 31 * result + reference.hashCode(); } } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); } String keyIdentifierEncodingType = getKeyIdentifierEncodingType(); if (keyIdentifierEncodingType != null) { result = 31 * result + keyIdentifierEncodingType.hashCode(); } String keyIdentifierValueType = getKeyIdentifierValueType(); if (keyIdentifierValueType != null) { result = 31 * result + keyIdentifierValueType.hashCode(); } String keyIdentifierValue = getKeyIdentifierValue(); if (keyIdentifierValue != null) { result = 31 * result + keyIdentifierValue.hashCode(); } String tokenType = getTokenType(); if (tokenType != null) { result = 31 * result + tokenType.hashCode(); } byte[] skiBytes = getSKIBytes(); if (skiBytes != null) { result = 31 * result + Arrays.hashCode(skiBytes); } String issuer = null; BigInteger serialNumber = null; try { issuer = getIssuerSerial().getIssuer(); serialNumber = getIssuerSerial().getSerialNumber(); } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); } if (issuer != null) { result = 31 * result + issuer.hashCode(); } if (serialNumber != null) { result = 31 * result + serialNumber.hashCode(); } return result; }",unrelated,unrelated,True,,0.0007079954957589507,0.9992920160293579
77
+ 75,"protected Node chooseRandom(final String scope, String excludedScope, final Collection<Node> excludedNodes) { if (excludedScope != null) { if (isChildScope(scope, excludedScope)) { return null; } if (!isChildScope(excludedScope, scope)) { excludedScope = null; } } Node node = getNode(scope); if (!(node instanceof InnerNode)) { return excludedNodes != null && excludedNodes.contains(node) ? null : node; } InnerNode innerNode = (InnerNode)node; int numOfDatanodes = innerNode.getNumOfLeaves(); if (excludedScope == null) { node = null; } else { node = getNode(excludedScope); if (!(node instanceof InnerNode)) { numOfDatanodes -= 1; } else { numOfDatanodes -= ((InnerNode)node).getNumOfLeaves(); } } if (numOfDatanodes <= 0) { LOG.debug(""Failed to find datanode (scope=\""{}\"" excludedScope=\""{}\""). numOfDatanodes={}"", scope, excludedScope, numOfDatanodes); return null; } final int availableNodes; if (excludedScope == null) { availableNodes = countNumOfAvailableNodes(scope, excludedNodes); } else { netlock.readLock().lock(); try { availableNodes = countNumOfAvailableNodes(scope, excludedNodes) - countNumOfAvailableNodes(excludedScope, excludedNodes); } finally { netlock.readLock().unlock(); } } if (LOG.isDebugEnabled()) { LOG.debug(""Choosing random from {} available nodes on node {}, scope={},"" + "" excludedScope={}, excludeNodes={}. numOfDatanodes={}."", availableNodes, innerNode, scope, excludedScope, excludedNodes, numOfDatanodes); } Node ret = null; if (availableNodes > 0) { ret = chooseRandom(innerNode, node, excludedNodes, numOfDatanodes, availableNodes); } LOG.debug(""chooseRandom returning {}"", ret); return ret; }",unrelated,unrelated,True,,0.0006612977595068514,0.999338686466217
78
+ 76,"logger.info(Logger.SECURITY_SUCCESS, ""Logging in user with remember token: "" + user.getAccountName()); user.loginWithPassword(password); return user; } catch (AuthenticationException ae) { logger.warning(Logger.SECURITY_FAILURE, ""Login via remember me cookie failed"", ae);",audit_accountability,audit_accountability,True,,0.9966051578521729,0.0033948516938835382
79
+ 77,"verifyPasswordStrength(currentPassword, newPassword, user); user.setLastPasswordChangeTime(new Date()); String newHash = hashPassword(newPassword, accountName); if (getOldPasswordHashes(user).contains(newHash)) { throw new AuthenticationCredentialsException(""Password change failed"", ""Password change matches a recent password for user: "" + accountName); } setHashedPassword(user, newHash); logger.info(Logger.SECURITY_SUCCESS, ""Password changed for user: "" + accountName);",audit_accountability,audit_accountability,True,,0.9966591596603394,0.0033408612944185734
80
+ 78,"public void disable() { enabled = false; logger.info( Logger.SECURITY_SUCCESS, ""Account disabled: "" + getAccountName() ); }",audit_accountability,audit_accountability,True,,0.9966199398040771,0.003380009438842535
81
+ 79,"@Override public boolean equals(Object object) { if (!(object instanceof SecurityTokenReference)) { return false; } SecurityTokenReference tokenReference = (SecurityTokenReference)object; try { if (!getReference().equals(tokenReference.getReference())) { return false; } } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); return false; } if (!compare(getKeyIdentifierEncodingType(), tokenReference.getKeyIdentifierEncodingType())) { return false; } if (!compare(getKeyIdentifierValueType(), tokenReference.getKeyIdentifierValueType())) { return false; } if (!compare(getKeyIdentifierValue(), tokenReference.getKeyIdentifierValue())) { return false; } if (!compare(getTokenType(), tokenReference.getTokenType())) { return false; } if (!Arrays.equals(getSKIBytes(), tokenReference.getSKIBytes())) { return false; } try { if (getIssuerSerial() != null && tokenReference.getIssuerSerial() != null) { if (!compare(getIssuerSerial().getIssuer(), tokenReference.getIssuerSerial().getIssuer())) { return false; } if (!compare(getIssuerSerial().getSerialNumber(), tokenReference.getIssuerSerial().getSerialNumber())) { return false; } } } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); return false; } return true; }",unrelated,unrelated,True,,0.0007361461175605655,0.9992638230323792
82
+ 80,"if (requiredPasswordType != null && !requiredPasswordType.equals(pwType)) { LOG.warn(""Authentication failed as the received password type does not "" + ""match the required password type of: {}"", requiredPasswordType); throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); }",audit_accountability,audit_accountability,True,,0.9965362548828125,0.0034637923818081617
83
+ 81,"protected void verifyUnknownPassword(UsernameToken usernameToken, RequestData data) throws WSSecurityException { boolean allowUsernameTokenDerivedKeys = data.isAllowUsernameTokenNoPassword(); if (!allowUsernameTokenDerivedKeys) { LOG.warn(""Authentication failed as the received UsernameToken does not "" + ""contain any password element""); throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); } }",audit_accountability,audit_accountability,True,,0.996334433555603,0.0036655855365097523
84
+ 82,"public void setLastFailedLoginTime(Date lastFailedLoginTime) { this.lastFailedLoginTime = lastFailedLoginTime; logger.info(Logger.SECURITY_SUCCESS, ""Set last failed login time to "" + lastFailedLoginTime + "" for "" + getAccountName() ); }",audit_accountability,audit_accountability,True,,0.9964534044265747,0.0035465892869979143
85
+ 83,"if (usernameToken.isHashed()) { LOG.warn(""Authentication failed as hashed username token not supported""); throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); }",audit_accountability,audit_accountability,True,,0.9965997338294983,0.0034003285691142082
86
+ 84,"synchronized void processWatchEvent(ZooKeeper zk, WatchedEvent event) { Event.EventType eventType = event.getType(); if (isStaleClient(zk)) return; if (LOG.isDebugEnabled()) { LOG.debug(""Watcher event type: "" + eventType + "" with state:"" + event.getState() + "" for path:"" + event.getPath() + "" connectionState: "" + zkConnectionState + "" for "" + this); } if (eventType == Event.EventType.None) { switch (event.getState()) { case SyncConnected: LOG.info(""Session connected.""); ConnectionState prevConnectionState = zkConnectionState; zkConnectionState = ConnectionState.CONNECTED; if (prevConnectionState == ConnectionState.DISCONNECTED && wantToBeInElection) { monitorActiveStatus(); } break; case Disconnected: LOG.info(""Session disconnected. Entering neutral mode...""); zkConnectionState = ConnectionState.DISCONNECTED; enterNeutralMode(); break; case Expired: LOG.info(""Session expired. Entering neutral mode and rejoining...""); enterNeutralMode(); reJoinElection(0); break; case SaslAuthenticated: LOG.info(""Successfully authenticated to ZooKeeper using SASL.""); break; default: fatalError(""Unexpected Zookeeper watch event state: "" + event.getState()); break; } return; } String path = event.getPath(); if (path != null) { switch (eventType) { case NodeDeleted: if (state == State.ACTIVE) { enterNeutralMode(); } joinElectionInternal(); break; case NodeDataChanged: monitorActiveStatus(); break; default: if (LOG.isDebugEnabled()) { LOG.debug(""Unexpected node event: "" + eventType + "" for path: "" + path); } monitorActiveStatus(); } return; } fatalError(""Unexpected watch error from Zookeeper""); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9894054532051086,0.010594533756375313
87
+ 85,"public void enable() { this.enabled = true; logger.info( Logger.SECURITY_SUCCESS, ""Account enabled: "" + getAccountName() ); }",audit_accountability,audit_accountability,True,,0.9966189861297607,0.0033809831365942955
88
+ 86,"@Override public boolean equals(Object object) { if (!(object instanceof DerivedKeyToken)) { return false; } DerivedKeyToken token = (DerivedKeyToken)object; if (!compare(getAlgorithm(), token.getAlgorithm())) { return false; } try { if (getSecurityTokenReference() != null && !getSecurityTokenReference().equals(token.getSecurityTokenReference()) || getSecurityTokenReference() == null && token.getSecurityTokenReference() != null) { return false; } } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); return false; } if (!compare(getProperties(), token.getProperties())) { return false; } if (getGeneration() != token.getGeneration()) { return false; } if (getOffset() != token.getOffset()) { return false; } if (getLength() != token.getLength()) { return false; } if (!compare(getLabel(), token.getLabel())) { return false; } return compare(getNonce(), token.getNonce()); }",unrelated,unrelated,True,,0.0007124175317585468,0.9992876648902893
89
+ 87,"if (requiredPasswordType != null) { if (passwordType == null || passwordType.getType() == null) { LOG.warn(""Authentication failed as the received password type does not "" + ""match the required password type of: {}"", requiredPasswordType); throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); } WSSConstants.UsernameTokenPasswordType usernameTokenPasswordType = WSSConstants.UsernameTokenPasswordType.getUsernameTokenPasswordType(passwordType.getType()); if (requiredPasswordType != usernameTokenPasswordType) { LOG.warn(""Authentication failed as the received password type does not "" + ""match the required password type of: {}"", requiredPasswordType); throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); } }",audit_accountability,audit_accountability,True,,0.9901577830314636,0.009842172265052795
90
+ 88,"if (usernameTokenPasswordType != WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT) { LOG.warn(""Password type is not supported""); throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); }",audit_accountability,audit_accountability,True,,0.9964287877082825,0.0035711792297661304
91
+ 89,"private String substituteVars(String expr) { if (expr == null) { return null; } String eval = expr; for(int s = 0; s < MAX_SUBST; s++) { final int[] varBounds = findSubVariable(eval); if (varBounds[SUB_START_IDX] == -1) { return eval; } final String var = eval.substring(varBounds[SUB_START_IDX], varBounds[SUB_END_IDX]); String val = null; try { if (var.startsWith(""env."") && 4 < var.length()) { String v = var.substring(4); int i = 0; for (; i < v.length(); i++) { char c = v.charAt(i); if (c == ':' && i < v.length() - 1 && v.charAt(i + 1) == '-') { val = getenv(v.substring(0, i)); if (val == null || val.length() == 0) { val = v.substring(i + 2); } break; } else if (c == '-') { val = getenv(v.substring(0, i)); if (val == null) { val = v.substring(i + 1); } break; } } if (i == v.length()) { val = getenv(v); } } else { val = getProperty(var); } } catch (SecurityException se) { LOG.warn(""Unexpected SecurityException in Configuration"", se); } if (val == null) { val = getRaw(var); } if (val == null) { return eval; } final int dollar = varBounds[SUB_START_IDX] - ""${"".length(); final int afterRightBrace = varBounds[SUB_END_IDX] + ""}"".length(); final String refVar = eval.substring(dollar, afterRightBrace); if (val.contains(refVar)) { return expr; } eval = eval.substring(0, dollar) + val + eval.substring(afterRightBrace); } throw new IllegalStateException(""Variable substitution depth too large: "" + MAX_SUBST + "" "" + expr); }",unrelated,unrelated,True,,0.0006630603456869721,0.9993368983268738
92
+ 90,"} catch (IOException e) { rpcMetrics.incrAuthenticationFailures(); if (LOG.isDebugEnabled()) { LOG.debug(StringUtils.stringifyException(e)); } IOException tce = (IOException) getTrueCause(e); AUDITLOG.warn(AUTH_FAILED_FOR + this.toString() + "":"" + attemptingUser + "" ("" + e.getLocalizedMessage() + "") with true cause: ("" + tce.getLocalizedMessage() + "")"");",audit_accountability,audit_accountability,True,,0.9966435432434082,0.0033564523328095675
93
+ 91,"private void disconnect(FTPClient client) throws IOException { if (client != null) { if (!client.isConnected()) { throw new FTPException(""Client not connected""); } boolean logoutSuccess = client.logout(); client.disconnect(); if (!logoutSuccess) { LOG.warn(""Logout failed while disconnecting, error code - "" + client.getReplyCode()); } } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9959501028060913,0.004049923270940781
94
+ 92,"private void readTagFromConfig(String attributeValue, String confName, String confValue, String[] confSource) { for (String tagStr : attributeValue.split("","")) { try { tagStr = tagStr.trim(); if (confValue == null) { confValue = """"; } if (propertyTagsMap.containsKey(tagStr)) { propertyTagsMap.get(tagStr).setProperty(confName, confValue); } else { Properties props = new Properties(); props.setProperty(confName, confValue); propertyTagsMap.put(tagStr, props); } } catch (Exception ex) { LOG.trace(""Tag '{}' for property:{} Source:{}"", tagStr, confName, confSource, ex); } } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.70677250623703,0.29322749376296997
95
+ 93,"try { setHashedPassword(user, hashPassword(password1, accountName)); } catch (EncryptionException ee) { throw new AuthenticationException(""Internal error"", ""Error hashing password for "" + accountName, ee); } userMap.put(user.getAccountId(), user); logger.info(Logger.SECURITY_SUCCESS, ""New user created: "" + accountName); saveUsers(); return user; }",audit_accountability,audit_accountability,True,,0.9966579675674438,0.0033419933170080185
96
+ 94,"final X509Certificate[] certs = (X509Certificate[]) request.getAttribute(""jakarta.servlet.request.X509Certificate""); String foundSubject = DEFAULT_FOUND_SUBJECT; if (certs != null) { for (final X509Certificate cert : certs) { foundSubject = StandardPrincipalFormatter.getInstance().getSubject(cert); if (authorizedPattern.matcher(foundSubject).matches()) { break; } else { logger.warn(""rejecting transfer attempt from [{}] because the DN is not authorized"", foundSubject); response.sendError(HttpServletResponse.SC_FORBIDDEN, ""not allowed based on dn""); return; } } }",audit_accountability,audit_accountability,True,,0.7171044945716858,0.282895565032959
97
+ 95,"@Override public boolean renameFile(String from, String to) throws GenericFileOperationFailedException { lock.lock(); try { LOG.debug(""Renaming file: {} to: {}"", from, to); reconnectIfNecessary(null); to = FileUtil.compactPath(to, '/'); channel.rename(from, to); return true; } catch (SftpException e) { LOG.debug(""Cannot rename file from: {} to: {}"", from, to, e); throw new GenericFileOperationFailedException(""Cannot rename file from: "" + from + "" to: "" + to, e); } finally { lock.unlock(); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9793726801872253,0.02062731422483921
98
+ 96,"public void logout() { ESAPI.httpUtilities().killCookie( ESAPI.currentRequest(), ESAPI.currentResponse(), HTTPUtilities.REMEMBER_TOKEN_COOKIE_NAME ); HttpSession session = ESAPI.currentRequest().getSession(false); if (session != null) { removeSession(session); session.invalidate(); } ESAPI.httpUtilities().killCookie(ESAPI.currentRequest(), ESAPI.currentResponse(), ESAPI.securityConfiguration().getHttpSessionIdName()); loggedIn = false; logger.info(Logger.SECURITY_SUCCESS, ""Logout successful"" ); ESAPI.authenticator().setCurrentUser(User.ANONYMOUS); }",audit_accountability,audit_accountability,True,,0.9966416358947754,0.003358317306265235
99
+ 97,"User user = getCurrentUser(); if (user != null && !user.isAnonymous()) { logger.warning(Logger.SECURITY_SUCCESS, ""User requested relogin. Performing logout then authentication""); user.logout(); }",audit_accountability,audit_accountability,True,,0.99660325050354,0.0033967040944844484
100
+ 98,"@Override public int hashCode() { int result = 17; String algorithm = getAlgorithm(); if (algorithm != null) { result = 31 * result + algorithm.hashCode(); } try { SecurityTokenReference tokenReference = getSecurityTokenReference(); if (tokenReference != null) { result = 31 * result + tokenReference.hashCode(); } } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); } Map<String, String> properties = getProperties(); if (!properties.isEmpty()) { result = 31 * result + properties.hashCode(); } int generation = getGeneration(); if (generation != -1) { result = 31 * result + generation; } int offset = getOffset(); if (offset != -1) { result = 31 * result + offset; } int length = getLength(); if (length != -1) { result = 31 * result + length; } String label = getLabel(); if (label != null) { result = 31 * result + label.hashCode(); } String nonce = getNonce(); if (nonce != null) { result = 31 * result + nonce.hashCode(); } return result; }",unrelated,unrelated,True,,0.0006998956087045372,0.9993001222610474
101
+ 99,"@Override public void run() { for(;;) { RenewAction<?> action = null; try { action = queue.take(); if (action.renew()) { queue.add(action); } } catch (InterruptedException ie) { return; } catch (Exception ie) { FileSystem.LOG.warn(""Failed to renew token, action="" + action, ie); } } }",audit_accountability,audit_accountability,True,,0.9964827299118042,0.003517217468470335
102
+ 100,"@Override public void onTrigger(ProcessContext context, final ProcessSession session) throws ProcessException { FlowFile inputFlowFile = session.get(); if (null == inputFlowFile) { return; } final List<String> args = new ArrayList<>(); final List<String> argumentAttributeValue = new ArrayList<>(); final boolean putToAttribute = context.getProperty(PUT_OUTPUT_IN_ATTRIBUTE).isSet(); final PropertyValue argumentsStrategyPropertyValue = context.getProperty(ARGUMENTS_STRATEGY); final boolean useDynamicPropertyArguments = argumentsStrategyPropertyValue.isSet() && argumentsStrategyPropertyValue.getValue().equals(DYNAMIC_PROPERTY_ARGUMENTS_STRATEGY.getValue()); final Integer attributeSize = context.getProperty(PUT_ATTRIBUTE_MAX_LENGTH).asInteger(); final String attributeName = context.getProperty(PUT_OUTPUT_IN_ATTRIBUTE).getValue(); final String executeCommand = context.getProperty(EXECUTION_COMMAND).evaluateAttributeExpressions(inputFlowFile).getValue(); args.add(executeCommand); final boolean ignoreStdin = Boolean.parseBoolean(context.getProperty(IGNORE_STDIN).getValue()); final String commandArguments; if (!useDynamicPropertyArguments) { commandArguments = context.getProperty(EXECUTION_ARGUMENTS).evaluateAttributeExpressions(inputFlowFile).getValue(); if (!StringUtils.isBlank(commandArguments)) { args.addAll(ArgumentUtils .splitArgs(commandArguments, context.getProperty(ARG_DELIMITER).getValue().charAt(0))); } } else { List<PropertyDescriptor> propertyDescriptors = new ArrayList<>(); for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) { Matcher matcher = COMMAND_ARGUMENT_PATTERN.matcher(entry.getKey().getName()); if (matcher.matches()) { propertyDescriptors.add(entry.getKey()); } } propertyDescriptors.sort((p1, p2) -> { Matcher matcher = COMMAND_ARGUMENT_PATTERN.matcher(p1.getName()); String indexString1 = null; while (matcher.find()) { indexString1 = matcher.group(""commandIndex""); } matcher = COMMAND_ARGUMENT_PATTERN.matcher(p2.getName()); String indexString2 = null; while (matcher.find()) { indexString2 = matcher.group(""commandIndex""); } final int index1 = Integer.parseInt(indexString1); final int index2 = Integer.parseInt(indexString2); if (index1 > index2) { return 1; } else if (index1 < index2) { return -1; } return 0; }); for (final PropertyDescriptor descriptor : propertyDescriptors) { String argValue = context.getProperty(descriptor.getName()).evaluateAttributeExpressions(inputFlowFile).getValue(); if (descriptor.isSensitive()) { argumentAttributeValue.add(MASKED_ARGUMENT); } else { argumentAttributeValue.add(argValue); } args.add(argValue); } if (!argumentAttributeValue.isEmpty()) { final StringBuilder builder = new StringBuilder(); for (String s : argumentAttributeValue) { builder.append(s).append(""\t""); } commandArguments = builder.toString().trim(); } else { commandArguments = """"; } } final String workingDir = context.getProperty(WORKING_DIR).evaluateAttributeExpressions(inputFlowFile).getValue(); final ProcessBuilder builder = new ProcessBuilder(); logger.debug(""Executing and waiting for command: {}"", executeCommand); File dir = null; if (!StringUtils.isBlank(workingDir)) { dir = new File(workingDir); if (!dir.exists() && !dir.mkdirs()) { logger.warn(""Failed to create working directory {}, using current working directory {}"", workingDir, System.getProperty(""user.dir"")); } } final Map<String, String> environment = new HashMap<>(); for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) { if (entry.getKey().isDynamic()) { environment.put(entry.getKey().getName(), entry.getValue()); } } builder.environment().putAll(environment); builder.command(args); builder.directory(dir); builder.redirectInput(Redirect.PIPE); builder.redirectOutput(Redirect.PIPE); final File errorOut; try { errorOut = File.createTempFile(""out"", null); builder.redirectError(errorOut); } catch (IOException e) { logger.error(""Could not create temporary file for error logging"", e); throw new ProcessException(e); } final Process process; try { process = builder.start(); } catch (IOException e) { try { if (!errorOut.delete()) { logger.warn(""Unable to delete file: {}"", errorOut.getAbsolutePath()); } } catch (SecurityException se) { logger.warn(""Unable to delete file: '{}'"", errorOut.getAbsolutePath(), se); } logger.error(""Could not create external process to run command"", e); throw new ProcessException(e); } try (final OutputStream pos = process.getOutputStream(); final InputStream pis = process.getInputStream(); final BufferedInputStream bis = new BufferedInputStream(pis)) { final BufferedOutputStream bos = new BufferedOutputStream(pos); FlowFile outputFlowFile = putToAttribute ? inputFlowFile : session.create(inputFlowFile); ProcessStreamWriterCallback callback = new ProcessStreamWriterCallback(ignoreStdin, bos, bis, logger, attributeName, session, outputFlowFile, process, putToAttribute, attributeSize); session.read(inputFlowFile, callback); outputFlowFile = callback.outputFlowFile; if (putToAttribute) { outputFlowFile = session.putAttribute(outputFlowFile, attributeName, new String(callback.outputBuffer, 0, callback.size)); } int exitCode = callback.exitCode; logger.debug(""Execution complete for command: {}. Exited with code: {}"", executeCommand, exitCode); Map<String, String> attributes = new HashMap<>(); String stdErr = """"; try (final InputStream in = new BufferedInputStream(new LimitingInputStream(new FileInputStream(errorOut), 4000))) { stdErr = IOUtils.toString(in, Charset.defaultCharset()); } catch (final Exception e) { stdErr = ""Unknown...could not read Process's Std Error due to "" + e.getClass().getName() + "": "" + e.getMessage(); } attributes.put(""execution.error"", stdErr); final Relationship outputFlowFileRelationship = putToAttribute ? ORIGINAL_RELATIONSHIP : (exitCode != 0) ? NONZERO_STATUS_RELATIONSHIP : OUTPUT_STREAM_RELATIONSHIP; if (exitCode == 0) { logger.info(""Transferring {} to {}"", outputFlowFile, outputFlowFileRelationship.getName()); } else { logger.error(""Transferring {} to {}. Executable command {} returned exitCode {} and error message: {}"", outputFlowFile, outputFlowFileRelationship.getName(), executeCommand, exitCode, stdErr); } attributes.put(""execution.status"", Integer.toString(exitCode)); attributes.put(""execution.command"", executeCommand); attributes.put(""execution.command.args"", commandArguments); if (context.getProperty(MIME_TYPE).isSet() && !putToAttribute) { attributes.put(CoreAttributes.MIME_TYPE.key(), context.getProperty(MIME_TYPE).getValue()); } outputFlowFile = session.putAllAttributes(outputFlowFile, attributes); if (NONZERO_STATUS_RELATIONSHIP.equals(outputFlowFileRelationship)) { outputFlowFile = session.penalize(outputFlowFile); } session.transfer(outputFlowFile, outputFlowFileRelationship); if (!putToAttribute) { logger.info(""Transferring {} to original"", inputFlowFile); inputFlowFile = session.putAllAttributes(inputFlowFile, attributes); session.transfer(inputFlowFile, ORIGINAL_RELATIONSHIP); } } catch (final IOException e) { logger.warn(""Problem terminating Process {}"", process, e); } finally { FileUtils.deleteQuietly(errorOut); process.destroy(); } }",unrelated,unrelated,True,,0.0006936705904081464,0.999306321144104
103
+ 101,"private Set<String> fetchGroupSet(String user) throws IOException { long startMs = timer.monotonicNow(); Set<String> groups = impl.getGroupsSet(user); long endMs = timer.monotonicNow(); long deltaMs = endMs - startMs ; UserGroupInformation.metrics.addGetGroups(deltaMs); if (deltaMs > warningDeltaMs) { LOG.warn(""Potential performance problem: getGroups(user="" + user +"") "" + ""took "" + deltaMs + "" milliseconds.""); } return groups; }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9952043294906616,0.004795738961547613
104
+ 102,"@Override public SftpRemoteFile[] listFiles(String path) throws GenericFileOperationFailedException { lock.lock(); try { LOG.trace(""Listing remote files from path {}"", path); if (ObjectHelper.isEmpty(path)) { path = "".""; } Vector<?> files = channel.ls(path); return files.stream() .map(f -> new SftpRemoteFileJCraft((ChannelSftp.LsEntry) f)) .toArray(SftpRemoteFileJCraft[]::new); } catch (SftpException e) { throw new GenericFileOperationFailedException(""Cannot list directory: "" + path, e); } finally { lock.unlock(); } }",unrelated,unrelated,True,,0.01273399218916893,0.9872660636901855
105
+ 103,"public void setLastPasswordChangeTime(Date lastPasswordChangeTime) { this.lastPasswordChangeTime = lastPasswordChangeTime; logger.info(Logger.SECURITY_SUCCESS, ""Set last password change time to "" + lastPasswordChangeTime + "" for "" + getAccountName() ); }",audit_accountability,audit_accountability,True,,0.9963535070419312,0.0036465313751250505
106
+ 104,"public static void parseCallback( Map<String, Object> config, WSSSecurityProperties properties ) { Object pwPropRef = config.get(ConfigurationConstants.PW_CALLBACK_REF); if (pwPropRef instanceof CallbackHandler) { properties.setCallbackHandler((CallbackHandler)pwPropRef); } else { String pwCallback = getString(ConfigurationConstants.PW_CALLBACK_CLASS, config); if (pwCallback != null) { try { CallbackHandler pwCallbackHandler = loadCallbackHandler(pwCallback); properties.setCallbackHandler(pwCallbackHandler); } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); } } } Object samlPropRef = config.get(ConfigurationConstants.SAML_CALLBACK_REF); if (samlPropRef instanceof CallbackHandler) { properties.setSamlCallbackHandler((CallbackHandler)samlPropRef); } else { String samlCallback = getString(ConfigurationConstants.SAML_CALLBACK_CLASS, config); if (samlCallback != null) { try { CallbackHandler samlCallbackHandler = loadCallbackHandler(samlCallback); properties.setSamlCallbackHandler(samlCallbackHandler); } catch (WSSecurityException e) { LOG.error(e.getMessage(), e); } } } }",unrelated,unrelated,True,,0.0007220226689241827,0.9992780089378357
107
+ 105,"@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.42212051153182983,0.5778794288635254
108
+ 106,public void setMillis(ReadableInstant instant) { long instantMillis = DateTimeUtils.getInstantMillis(instant); setMillis(instantMillis); },unrelated,unrelated,True,,0.0006816126988269389,0.9993183612823486
109
+ 107,"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.0006717626238241792,0.9993282556533813
110
+ 108,"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.0006752390181645751,0.9993247985839844
111
+ 109,"@Override protected void subscribeActual(MaybeObserver<? super R> observer) { source.subscribe(new MapOptionalSingleObserver<>(observer, mapper)); }",unrelated,unrelated,True,,0.0007366078207269311,0.999263346195221
112
+ 110,"@Override protected void subscribeActual(Observer<? super R> observer) { source.subscribe(new ConcatMapEagerMainObserver<>(observer, mapper, maxConcurrency, prefetch, errorMode)); }",unrelated,unrelated,True,,0.0012496714480221272,0.9987503290176392
113
+ 111,@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.0006962534971535206,0.9993036985397339
114
+ 112,public void setZone(DateTimeZone zone) { iSavedState = null; iZone = zone; },unrelated,unrelated,True,,0.0007219785475172102,0.9992780089378357
115
+ 113,"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.0006628041155636311,0.9993371367454529
116
+ 114,public Seconds minus(Seconds seconds) { if (seconds == null) { return this; } return minus(seconds.getValue()); },unrelated,unrelated,True,,0.0006962090847082436,0.9993038177490234
117
+ 115,"@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.0006677359342575073,0.9993322491645813
118
+ 116,"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.0006641963263973594,0.9993358254432678
119
+ 117,"public DateMidnight plusMonths(int months) { if (months == 0) { return this; } long instant = getChronology().months().add(getMillis(), months); return withMillis(instant); }",unrelated,unrelated,True,,0.0007214139914140105,0.9992786049842834
120
+ 118,"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.0006924648187123239,0.9993075132369995
121
+ 119,"@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.0007118874927982688,0.9992881417274475
122
+ 120,"@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.0006582640344277024,0.9993416666984558
123
+ 121,"@CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull public final Observable<T> observeOn(@NonNull Scheduler scheduler) { return observeOn(scheduler, StandardBufferedConfig.DEFAULT); }",unrelated,unrelated,True,,0.0006643807864747941,0.9993355870246887
124
+ 122,public MpscLinkedQueue() { producerNode = new AtomicReference<>(); consumerNode = new AtomicReference<>(); LinkedQueueNode<T> node = new LinkedQueueNode<>(); spConsumerNode(node); xchgProducerNode(node); },unrelated,unrelated,True,,0.0006587397656403482,0.9993411898612976
125
+ 123,"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.0006565048242919147,0.9993434548377991
126
+ 124,"public void printTo(StringBuffer buf, long instant) { try { printTo((Appendable) buf, instant); } catch (IOException ex) { } }",unrelated,unrelated,True,,0.0006661554798483849,0.9993337988853455
127
+ 125,public boolean isGreaterThan(Seconds other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.0006709005101583898,0.9993290901184082
128
+ 126,"@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.000652270158752799,0.9993477463722229
129
+ 127,final void removeSelf() { DisposableContainer c = composite.getAndSet(null); if (c != null) { c.delete(this); } },unrelated,unrelated,True,,0.000807380594778806,0.9991926550865173
130
+ 128,"@Override int getMonthOfYear(long millis, int year) { long monthZeroBased = (millis - getYearMillis(year)) / MILLIS_PER_MONTH; return ((int) monthZeroBased) + 1; }",unrelated,unrelated,True,,0.0006840390269644558,0.9993159770965576
131
+ 129,"int getDayOfMonth(long millis, int year) { int month = getMonthOfYear(millis, year); return getDayOfMonth(millis, year, month); }",unrelated,unrelated,True,,0.0020391964353621006,0.9979608058929443
132
+ 130,"private GJChronology(Chronology base, JulianChronology julian, GregorianChronology gregorian, Instant cutoverInstant) { super(base, new Object[] {julian, gregorian, cutoverInstant}); }",unrelated,unrelated,True,,0.000669678847771138,0.9993304014205933
133
+ 131,"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.0006489985971711576,0.9993509650230408
134
+ 132,"@Override public void onNext(T t) { if (fusionMode == QueueSubscription.NONE) { parent.innerNext(this, t); } else { parent.drain(); } }",unrelated,unrelated,True,,0.0006853718659840524,0.9993146657943726
135
+ 133,"public static Years yearsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.years()); return Years.years(amount); }",unrelated,unrelated,True,,0.0006771400803700089,0.9993228912353516
136
+ 134,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.0006663281819783151,0.9993336796760559
137
+ 135,"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.0007081112125888467,0.9992918968200684
138
+ 136,"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.0006758769741281867,0.9993240833282471
139
+ 137,public boolean isGreaterThan(Minutes other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.0006792464409954846,0.9993207454681396
140
+ 138,"protected int convertText(String text, Locale locale) { try { return Integer.parseInt(text); } catch (NumberFormatException ex) { throw new IllegalFieldValueException(getType(), text); } }",unrelated,unrelated,True,,0.0006868155905976892,0.999313235282898
141
+ 139,"@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.000684696133248508,0.9993152618408203
142
+ 140,"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.0006757816881872714,0.9993242025375366
143
+ 141,"@Override public String toString() { String str = ""BuddhistChronology""; DateTimeZone zone = getZone(); if (zone != null) { str = str + '[' + zone.getID() + ']'; } return str; }",unrelated,unrelated,True,,0.0007042267243377864,0.999295711517334
144
+ 142,"@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.0006844912422820926,0.9993155002593994
145
+ 143,"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.0006733600166626275,0.9993267059326172
146
+ 144,"@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.0006824109004810452,0.9993176460266113
147
+ 145,"@SuppressWarnings(""unchecked"") @NonNull public static <T> Predicate<T> alwaysFalse() { return (Predicate<T>)ALWAYS_FALSE; }",unrelated,unrelated,True,,0.0006871919613331556,0.9993127584457397
148
+ 146,"@Override public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, getMinimumValue(), getMaximumValue()); return instant + (value - get(instant)) * iUnitMillis; }",unrelated,unrelated,True,,0.0006629102281294763,0.9993370175361633
149
+ 147,"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.0006410396890714765,0.9993589520454407
150
+ 148,"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.0006788633181713521,0.9993211030960083
151
+ 149,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.0006565141957253218,0.9993434548377991
152
+ 150,@Override public int getMinimumValue(ReadablePartial instant) { return getMinimumValue(); },unrelated,unrelated,True,,0.0007069453713484108,0.9992930889129639
153
+ 151,"@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.0006750292959623039,0.9993250370025635
154
+ 152,"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.0006695836782455444,0.9993304014205933
155
+ 153,"public void printTo(StringBuilder buf, ReadablePartial partial) { try { printTo((Appendable) buf, partial); } catch (IOException ex) { } }",unrelated,unrelated,True,,0.0006529599195346236,0.9993470311164856
156
+ 154,"public MaybeToSingle(MaybeSource<T> source, T defaultValue) { this.source = source; this.defaultValue = defaultValue; }",unrelated,unrelated,True,,0.0006849748315289617,0.9993150234222412
157
+ 155,"public DeferredExecutorScheduler(@NonNull Supplier<? extends Executor> executorSupplier, boolean interruptibleWorker, boolean fair) { this.executorSupplier = executorSupplier; this.interruptibleWorker = interruptibleWorker; this.fair = fair; }",unrelated,unrelated,True,,0.0006704253028146923,0.9993295669555664
158
+ 156,"@Override public long add(long instant, int years) { if (years == 0) { return instant; } return set(instant, get(instant) + years); }",unrelated,unrelated,True,,0.0006814405787736177,0.9993185997009277
159
+ 157,@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.0006774336798116565,0.9993225336074829
160
+ 158,"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.0006896352278999984,0.9993103742599487
161
+ 159,@Override public Object clone() { try { return cloneReset(); } catch (final CloneNotSupportedException ex) { return null; } },unrelated,unrelated,True,,0.0007131232996471226,0.999286949634552
162
+ 160,"BasicDayOfYearDateTimeField(BasicChronology chronology, DurationField days) { super(DateTimeFieldType.dayOfYear(), days); iChronology = chronology; }",unrelated,unrelated,True,,0.0007443579961545765,0.9992555975914001
163
+ 161,"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.0006634013261646032,0.9993365406990051
164
+ 162,"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.0006518792943097651,0.9993481040000916
165
+ 163,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.000670118723064661,0.9993299245834351
166
+ 164,public boolean isGreaterThan(Weeks other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.0006669602589681745,0.9993329644203186
167
+ 165,"@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.0006623248918913305,0.9993376135826111
168
+ 166,"@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.0006723326514475048,0.9993276596069336
169
+ 167,"public static Hours hoursBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.hours()); return Hours.hours(amount); }",unrelated,unrelated,True,,0.000680596858728677,0.9993194341659546
170
+ 168,"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.000658047036267817,0.9993419051170349
171
+ 169,@Override public long roundHalfFloor(long instant) { return getWrappedField().roundHalfFloor(instant); },unrelated,unrelated,True,,0.0006867199554108083,0.999313235282898
audit_accountability_codebert_v1/tokenizer/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
audit_accountability_codebert_v1/tokenizer/special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": true,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": true,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": true,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
audit_accountability_codebert_v1/tokenizer/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
audit_accountability_codebert_v1/tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<s>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<pad>",
14
+ "lstrip": false,
15
+ "normalized": true,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "50264": {
37
+ "content": "<mask>",
38
+ "lstrip": true,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ }
44
+ },
45
+ "bos_token": "<s>",
46
+ "clean_up_tokenization_spaces": false,
47
+ "cls_token": "<s>",
48
+ "eos_token": "</s>",
49
+ "errors": "replace",
50
+ "extra_special_tokens": {},
51
+ "mask_token": "<mask>",
52
+ "model_max_length": 512,
53
+ "pad_token": "<pad>",
54
+ "sep_token": "</s>",
55
+ "tokenizer_class": "RobertaTokenizer",
56
+ "trim_offsets": true,
57
+ "unk_token": "<unk>"
58
+ }
audit_accountability_codebert_v1/tokenizer/vocab.json ADDED
The diff for this file is too large to render. See raw diff