File size: 90,834 Bytes
6f80ef7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | dataset_index,text,true_label,predicted_label,correct,error_type,probability_audit_accountability,probability_unrelated
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
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
2,private static final Logger logger = LoggerFactory.getLogger(ParameterContextAuditor.class);,unrelated,unrelated,True,,0.000670079025439918,0.9993299245834351
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
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
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
6,"public SmsTwoFaProvider(CacheManager cacheManager, SmsService smsService, AuditLogService auditLogService) { super(cacheManager); this.smsService = smsService; this.auditLogService = auditLogService; }",unrelated,unrelated,True,,0.0008106429595500231,0.9991893172264099
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
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
9,private static final Logger LOG = LoggerFactory.getLogger(ProviderUtils.class);,unrelated,unrelated,True,,0.0006675135809928179,0.9993324875831604
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
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
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
13,"@Override protected JpaRepository<AuditLogEntity, UUID> getRepository() { return auditLogRepository; }",unrelated,unrelated,True,,0.0007192351040430367,0.9992807507514954
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
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
16,private static final Logger LOG = LoggerFactory.getLogger(CompositeService.class);,unrelated,unrelated,True,,0.0006661596125923097,0.9993337988853455
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
34,@Autowired public void setAuditService(AuditService auditService) { this.auditService = auditService; },unrelated,unrelated,True,,0.0008057396626099944,0.999194324016571
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
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
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
38,@Override protected Class<AuditLogEntity> getEntityClass() { return AuditLogEntity.class; },unrelated,unrelated,True,,0.0007710408535785973,0.9992289543151855
39,@Autowired private AuditLogLevelFilter auditLogLevelFilter;,unrelated,unrelated,True,,0.000750306760892272,0.9992496371269226
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
41,public static void setAuditSink(SecretAuditSink sink) { auditSink = sink; },unrelated,unrelated,True,,0.0007287966436706483,0.9992712140083313
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
43,"public DedicatedJpaAuditLogDao(AuditLogRepository auditLogRepository, DedicatedEventsSqlPartitioningRepository partitioningRepository) { super(auditLogRepository, partitioningRepository); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9897404909133911,0.010259446687996387
44,private @Nullable ObjectFactory<AuditingHandler> handler;,unrelated,unrelated,True,,0.0007314497488550842,0.9992685914039612
45,private final AuditLogRepository auditLogRepository;,unrelated,unrelated,True,,0.0007195823709480464,0.9992803931236267
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
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
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
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
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
51,"static final String AUDITING_ENTITY_LISTENER_CLASS_NAME = ""org.springframework.data.jpa.domain.support.AuditingEntityListener"";",unrelated,unrelated,True,,0.0007463603396899998,0.9992535710334778
52,"@Override protected String getAuditingHandlerBeanName() { return ""jpaAuditingHandler""; }",unrelated,unrelated,True,,0.0007518534548580647,0.9992480874061584
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
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
55,@Autowired private AuditLogDao auditLogDao;,unrelated,unrelated,True,,0.0007660716073587537,0.9992339611053467
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
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
58,public static SecretAuditSink getAuditSink() { return auditSink; },unrelated,unrelated,True,,0.0006894962280057371,0.9993104934692383
59,@Autowired private AuditLogSink auditLogSink;,unrelated,unrelated,True,,0.0007387421210296452,0.999261200428009
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
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
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
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
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
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
66,"public void lock() { this.locked = true; logger.info(Logger.SECURITY_SUCCESS, ""Account locked: "" + getAccountName() ); }",audit_accountability,audit_accountability,True,,0.996626615524292,0.003373452927917242
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
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
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
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
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
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
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
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
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
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
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
78,"public void disable() { enabled = false; logger.info( Logger.SECURITY_SUCCESS, ""Account disabled: "" + getAccountName() ); }",audit_accountability,audit_accountability,True,,0.9966199398040771,0.003380009438842535
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
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
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
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
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
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
85,"public void enable() { this.enabled = true; logger.info( Logger.SECURITY_SUCCESS, ""Account enabled: "" + getAccountName() ); }",audit_accountability,audit_accountability,True,,0.9966189861297607,0.0033809831365942955
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
106,public void setMillis(ReadableInstant instant) { long instantMillis = DateTimeUtils.getInstantMillis(instant); setMillis(instantMillis); },unrelated,unrelated,True,,0.0006816126988269389,0.9993183612823486
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
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
109,"@Override protected void subscribeActual(MaybeObserver<? super R> observer) { source.subscribe(new MapOptionalSingleObserver<>(observer, mapper)); }",unrelated,unrelated,True,,0.0007366078207269311,0.999263346195221
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
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
112,public void setZone(DateTimeZone zone) { iSavedState = null; iZone = zone; },unrelated,unrelated,True,,0.0007219785475172102,0.9992780089378357
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
114,public Seconds minus(Seconds seconds) { if (seconds == null) { return this; } return minus(seconds.getValue()); },unrelated,unrelated,True,,0.0006962090847082436,0.9993038177490234
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
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
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
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
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
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
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
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
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
124,"public void printTo(StringBuffer buf, long instant) { try { printTo((Appendable) buf, instant); } catch (IOException ex) { } }",unrelated,unrelated,True,,0.0006661554798483849,0.9993337988853455
125,public boolean isGreaterThan(Seconds other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.0006709005101583898,0.9993290901184082
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
127,final void removeSelf() { DisposableContainer c = composite.getAndSet(null); if (c != null) { c.delete(this); } },unrelated,unrelated,True,,0.000807380594778806,0.9991926550865173
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
129,"int getDayOfMonth(long millis, int year) { int month = getMonthOfYear(millis, year); return getDayOfMonth(millis, year, month); }",unrelated,unrelated,True,,0.0020391964353621006,0.9979608058929443
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
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
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
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
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
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
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
137,public boolean isGreaterThan(Minutes other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.0006792464409954846,0.9993207454681396
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
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
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
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
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
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
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
145,"@SuppressWarnings(""unchecked"") @NonNull public static <T> Predicate<T> alwaysFalse() { return (Predicate<T>)ALWAYS_FALSE; }",unrelated,unrelated,True,,0.0006871919613331556,0.9993127584457397
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
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
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
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
150,@Override public int getMinimumValue(ReadablePartial instant) { return getMinimumValue(); },unrelated,unrelated,True,,0.0007069453713484108,0.9992930889129639
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
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
153,"public void printTo(StringBuilder buf, ReadablePartial partial) { try { printTo((Appendable) buf, partial); } catch (IOException ex) { } }",unrelated,unrelated,True,,0.0006529599195346236,0.9993470311164856
154,"public MaybeToSingle(MaybeSource<T> source, T defaultValue) { this.source = source; this.defaultValue = defaultValue; }",unrelated,unrelated,True,,0.0006849748315289617,0.9993150234222412
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
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
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
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
159,@Override public Object clone() { try { return cloneReset(); } catch (final CloneNotSupportedException ex) { return null; } },unrelated,unrelated,True,,0.0007131232996471226,0.999286949634552
160,"BasicDayOfYearDateTimeField(BasicChronology chronology, DurationField days) { super(DateTimeFieldType.dayOfYear(), days); iChronology = chronology; }",unrelated,unrelated,True,,0.0007443579961545765,0.9992555975914001
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
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
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
164,public boolean isGreaterThan(Weeks other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.0006669602589681745,0.9993329644203186
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
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
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
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
169,@Override public long roundHalfFloor(long instant) { return getWrappedField().roundHalfFloor(instant); },unrelated,unrelated,True,,0.0006867199554108083,0.999313235282898
|