auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldResolveHistoricTaskAuthorization_HistoricProcessInstance() { processEngineConfiguration.setEnableHistoricInstancePermissions(true); testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setUserId("myUserId"); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); String processInstanceId = processInstance.getProcessInstanceId(); authorization.setResourceId(processInstanceId); authorizationService.saveAuthorization(authorization); Date removalTime = addDays(START_DATE, 5); assertThat(authorization.getRootProcessInstanceId(), is(processInstance.getRootProcessInstanceId())); assertThat(authorization.getRemovalTime(), is(removalTime)); clearAuthorization(); }

Target:
public void shouldResolveHistoricTaskAuthorization_HistoricProcessInstance() { processEngineConfiguration.setEnableHistoricInstancePermissions(true); testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setUserId("myUserId"); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); String processInstanceId = processInstance.getProcessInstanceId(); authorization.setResourceId(processInstanceId); authorizationService.saveAuthorization(authorization); Date removalTime = addDays(START_DATE, 5); assertThat(authorization.getRootProcessInstanceId(), is(processInstance.getRootProcessInstanceId())); assertThat(authorization.getRemovalTime(), is(removalTime)); }
Source:
public void shutdownApp(EmbeddedAppHandleImpl app, ShutdownMode shutdownMode) { if (shutdownMode != ShutdownMode.KILL) { app.controller.shutdown(); } else { throw new UnsupportedOperationException("Kill not supported"); } }

Target:
public void shutdownApp(EmbeddedAppHandleImpl app, ShutdownMode shutdownMode) throws LauncherException { if (shutdownMode != ShutdownMode.KILL) { app.controller.shutdown(); } else { throw new UnsupportedOperationException("Kill not supported"); } }
Source:
public void notify(Member member, String message) { Member intramurals = (Member) new MemberDao().getMemberByUsername("Intramurals"); save(new Message(message, "", intramurals, member).setSent(true)); }

Target:
public boolean notify(Member member, String message) { if (message.length() > 100) return false; Member intramurals = (Member) new MemberDao().getMemberByUsername("Intramurals"); merge(new Message(message, "", intramurals, member).setSent(true)); return true; }
Source:
public void write(Object datum) throws IOException { if (!opened) { throw new IOException(MESSAGES.getMessage("error.writerNotOpened")); } result.totalCount++; if (datum == null) { return; } IndexedRecord record = getFactory(datum).convertToAvro(datum); if (dataSchema == null) { dataSchema = record.getSchema(); Field jsonField = dataSchema.getField("json"); if (jsonField == null) { throw new IOException(MESSAGES.getMessage("error.schemaNotContainJson")); } jsonPos = jsonField.pos(); } String json = (String) record.get(jsonPos); try { validateRequestBody(json); } catch (DataRejectException e) { throw createRejectException("error.invalidRecordCreate", json, (String) e.getRejectInfo().get("message")); } JiraResponse response = getConnection().post(resource, json); handleResponse(response, json, record); }

Target:
public void write(Object datum) throws IOException { if (!opened) { throw new IOException(MESSAGES.getMessage("error.writerNotOpened")); } result.totalCount++; if (datum == null) { return; } IndexedRecord record = getFactory(datum).convertToAvro(datum); if (dataSchema == null) { dataSchema = record.getSchema(); Field jsonField = dataSchema.getField("json"); if (jsonField == null) { throw new IOException(MESSAGES.getMessage("error.schemaNotContainJson")); } jsonPos = jsonField.pos(); } String json = (String) record.get(jsonPos); validateRequestBody(json); JiraResponse response = getConnection().post(resource, json); handleResponse(response, json, record); }
Source:
public void testFailsIfInjectingScopedDirectlyWhenItIsntBound() { try { Guice.createInjector(new AbstractModule() { @Override protected void configure() { binder().requireExplicitBindings(); bind(Foo.class).to(ScopedFooImpl.class); bind(WantsScopedFooImpl.class); } }); fail(); } catch(CreationException expected) { assertContains(expected.getMessage(), "\n1) " + jitFailed(ScopedFooImpl.class)); assertTrue(expected.getMessage(), !expected.getMessage().contains("\n2) ")); } }

Target:
public void testFailsIfInjectingScopedDirectlyWhenItIsntBound() { try { Guice.createInjector(new AbstractModule() { @Override protected void configure() { binder().requireExplicitBindings(); bind(Foo.class).to(ScopedFooImpl.class); bind(WantsScopedFooImpl.class); } }); fail(); } catch(CreationException expected) { assertContains(expected.getMessage(), jitFailed(ScopedFooImpl.class)); assertEquals(1, expected.getErrorMessages().size()); } }
Source:
protected void executeCommand() { StorageDomainDR storageDomainDR = storageDomainDRDao.get(getParameters().getStorageDomainId(), getParameters().getGeoRepSessionId()); if (storageDomainDR == null) { storageDomainDR = new StorageDomainDR(); storageDomainDR.setStorageDomainId(getParameters().getStorageDomainId()); storageDomainDR.setGeoRepSessionId(getParameters().getGeoRepSessionId()); } else { if (storageDomainDR.getJobId() != null) { schedulerUtil.deleteJob(storageDomainDR.getJobId()); } } if (getParameters().getSchedule().getFrequency() != StorageSyncSchedule.Frequency.NONE) { String jobId = schedulerUtil.scheduleACronJob(Injector.get(GlusterStorageDomainDRSyncJob.class), "syncData", new Class[] { String.class, String.class }, new Object[] { getParameters().getStorageDomainId().toString(), getParameters().getGeoRepSessionId().toString() }, getParameters().getSchedule().getCronExpression()); storageDomainDR.setScheduleCronExpression(getParameters().getSchedule().getCronExpression()); storageDomainDR.setJobId(jobId); storageDomainDRDao.saveOrUpdate(storageDomainDR); } else { storageDomainDRDao.remove(storageDomainDR.getStorageDomainId(), storageDomainDR.getGeoRepSessionId()); } setSucceeded(true); }

Target:
protected void executeCommand() { StorageDomainDR storageDomainDR = storageDomainDRDao.get(getParameters().getStorageDomainId(), getParameters().getGeoRepSessionId()); if (storageDomainDR == null) { storageDomainDR = new StorageDomainDR(); storageDomainDR.setStorageDomainId(getParameters().getStorageDomainId()); storageDomainDR.setGeoRepSessionId(getParameters().getGeoRepSessionId()); } else { if (storageDomainDR.getJobId() != null) { schedulerUtil.deleteJob(storageDomainDR.getJobId()); } } if (getParameters().getSchedule().getFrequency() != StorageSyncSchedule.Frequency.NONE) { String jobId = schedulerUtil.scheduleACronJob(GlusterStorageDomainDRSyncJob.class, "syncData", new Class[] { String.class, String.class }, new Object[] { getParameters().getStorageDomainId().toString(), getParameters().getGeoRepSessionId().toString() }, getParameters().getSchedule().getCronExpression()); storageDomainDR.setScheduleCronExpression(getParameters().getSchedule().getCronExpression()); storageDomainDR.setJobId(jobId); storageDomainDRDao.saveOrUpdate(storageDomainDR); } else { storageDomainDRDao.remove(storageDomainDR.getStorageDomainId(), storageDomainDR.getGeoRepSessionId()); } setSucceeded(true); }
Source:
public static final byte[] readFully(final File path, final int max) throws FileNotFoundException, IOException { final FileInputStream in = new FileInputStream(path); try { long sz = Math.max(path.length(), 1); if (sz > max) throw new IOException(MessageFormat.format( JGitText.get().fileIsTooLarge, path)); byte[] buf = new byte[(int) sz]; int valid = 0; for (;;) { if (buf.length == valid) { if (buf.length == max) { int next = in.read(); if (next < 0) break; throw new IOException(MessageFormat.format( JGitText.get().fileIsTooLarge, path)); } byte[] nb = new byte[buf.length * 2]; System.arraycopy(buf, 0, nb, 0, valid); buf = nb; } int n = in.read(buf, valid, buf.length - valid); if (n < 0) break; valid += n; } if (valid < buf.length) { byte[] nb = new byte[valid]; System.arraycopy(buf, 0, nb, 0, valid); buf = nb; } return buf; } finally { try { in.close(); } catch (IOException ignored) { } } }

Target:
public static final byte[] readFully(final File path, final int max) throws FileNotFoundException, IOException { final FileInputStream in = new FileInputStream(path); try { long sz = Math.max(path.length(), 1); if (sz > max) throw new IOException(MessageFormat.format( JGitText.get().fileIsTooLarge, path)); byte[] buf = new byte[(int) sz]; int valid = 0; for (;;) { if (buf.length == valid) { if (buf.length == max) { int next = in.read(); if (next < 0) break; throw new IOException(MessageFormat.format( JGitText.get().fileIsTooLarge, path)); } byte[] nb = new byte[Math.min(buf.length * 2, max)]; System.arraycopy(buf, 0, nb, 0, valid); buf = nb; } int n = in.read(buf, valid, buf.length - valid); if (n < 0) break; valid += n; } if (valid < buf.length) { byte[] nb = new byte[valid]; System.arraycopy(buf, 0, nb, 0, valid); buf = nb; } return buf; } finally { try { in.close(); } catch (IOException ignored) { } } }
Source:
public ArrayList<Order> findOrderInList(String symbol, ArrayList<Order> list) { ArrayList<Order> order = new ArrayList<Order>(); for (Order o: list) { if (o.getStockSymbol().equals(symbol)) { order.add(o); } } return order; }

Target:
public ArrayList<Order> findOrderInList(String symbol, ArrayList<Order> list) { ArrayList<Order> orderList = new ArrayList<Order>(); for (Order o: list) { if (o.getStockSymbol().equals(symbol)) { orderList.add(o); } } return orderList; }
Source:
public char getLegacyChar() { return '�'; }

Target:
public char getLegacyChar() { return '§'; }
Source:
public ZestStatement deepCopy() { ZestAssignFromElement zestAssignFromElement = new ZestAssignFromElement(this.getVariableName()); zestAssignFromElement.filterElementName = this.filterElementName; zestAssignFromElement.elementNameFilter = this.elementNameFilter; zestAssignFromElement.filterAttributeValue = this.filterAttributeValue; zestAssignFromElement.attributeNameFilter = this.attributeNameFilter; zestAssignFromElement.attributeValueFilter = this.attributeValueFilter; zestAssignFromElement.attributeValueFilterFlags = this.attributeValueFilterFlags; zestAssignFromElement.reverseFilteredElements = this.reverseFilteredElements; zestAssignFromElement.elementIndex = this.elementIndex; zestAssignFromElement.returnElement = this.returnElement; zestAssignFromElement.returnAttribute = this.returnAttribute; zestAssignFromElement.returnedAttributeName = this.returnedAttributeName; return zestAssignFromElement; }

Target:
public ZestStatement deepCopy() { ZestAssignFromElement zestAssignFromElement = new ZestAssignFromElement(this.getVariableName()); zestAssignFromElement.filterElementName = this.filterElementName; zestAssignFromElement.elementNameFilter = this.elementNameFilter; zestAssignFromElement.filterAttributeValue = this.filterAttributeValue; zestAssignFromElement.attributeNameFilter = this.attributeNameFilter; zestAssignFromElement.attributeValueFilter = this.attributeValueFilter; zestAssignFromElement.attributeValueFilterFlags = this.attributeValueFilterFlags; zestAssignFromElement.attributeValueFilterPattern = this.attributeValueFilterPattern; zestAssignFromElement.reverseFilteredElements = this.reverseFilteredElements; zestAssignFromElement.elementIndex = this.elementIndex; zestAssignFromElement.returnElement = this.returnElement; zestAssignFromElement.returnAttribute = this.returnAttribute; zestAssignFromElement.returnedAttributeName = this.returnedAttributeName; return zestAssignFromElement; }
Source:
public Map<String, String> getEmailToNameTableFromRoster() { Map<String, String> commentGiverEmailNameTable = new HashMap<>(); List<InstructorAttributes> instructorList = getInstructors(); for (InstructorAttributes instructor : instructorList) { commentGiverEmailNameTable.put(instructor.email, instructor.name); } List<StudentAttributes> studentList = getStudents(); for (StudentAttributes student : studentList) { commentGiverEmailNameTable.put(student.email, student.name); } return commentGiverEmailNameTable; }

Target:
public Map<String, String> getEmailToNameTableFromRoster() { Map<String, String> emailToNameTable = new HashMap<>(); List<InstructorAttributes> instructorList = getInstructors(); for (InstructorAttributes instructor : instructorList) { emailToNameTable.put(instructor.email, instructor.name); } List<StudentAttributes> studentList = getStudents(); for (StudentAttributes student : studentList) { emailToNameTable.put(student.email, student.name); } return emailToNameTable; }
Source:
public synchronized void modified(Map<String, Object> config) { String defaultInterfaceConfig = (String) config.get(PRIMARY_ADDRESS); if (defaultInterfaceConfig == null || defaultInterfaceConfig.equals("")) { primaryAddress = NetUtil.getLocalIpv4HostAddress(); } else { String primaryAddressConf = (String) config.get(PRIMARY_ADDRESS); String[] addrString = primaryAddressConf.split("/"); if (addrString.length > 1) { String ip = getIPv4inSubnet(primaryAddressConf); if (ip == null) { LOGGER.warn("Error in IP configuration, will continue to use first interface"); NetUtil.getLocalIpv4HostAddress(); } else { primaryAddress = ip; } } else { primaryAddress = addrString[0]; } } }

Target:
public synchronized void modified(Map<String, Object> config) { String primaryAddressConf = (String) config.get(PRIMARY_ADDRESS); if (primaryAddressConf == null || primaryAddressConf.isEmpty() || !isValidIPConfig(primaryAddressConf)) { primaryAddress = getFirstLocalIPv4Address(); } else { primaryAddress = primaryAddressConf; } }
Source:
private void updateLanguageEntriesSupported(List<PageTitle> languageEntries) { boolean haveChineseEntry = false; for (ListIterator<PageTitle> it = languageEntries.listIterator(); it.hasNext();) { PageTitle link = it.next(); String languageCode = link.getWikiSite().languageCode(); if (link.isMainPage()) { link = new PageTitle(MainPageNameData.valueFor(languageCode), app.getWikiSite()); } if (GOTHIC_LANGUAGE_CODE.equals(languageCode)) { it.remove(); } else if ("be-x-old".equals(languageCode)) { it.remove(); it.add(new PageTitle(link.getText(), WikiSite.forLanguageCode("be-tarask"))); } else if (AppLanguageLookUpTable.CHINESE_LANGUAGE_CODE.equals(languageCode)) { haveChineseEntry = true; it.remove(); for (String dialect : Arrays.asList(AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE, AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE)) { it.add(new PageTitle((title.isMainPage()) ? MainPageNameData.valueFor(dialect) : link.getText(), WikiSite.forLanguageCode(dialect))); } } } if (!haveChineseEntry) { addChineseEntriesIfNeeded(title, languageEntries); } }

Target:
private void updateLanguageEntriesSupported(List<PageTitle> languageEntries) { boolean haveChineseEntry = false; for (ListIterator<PageTitle> it = languageEntries.listIterator(); it.hasNext();) { PageTitle link = it.next(); String languageCode = link.getWikiSite().languageCode(); if (GOTHIC_LANGUAGE_CODE.equals(languageCode)) { it.remove(); } else if ("be-x-old".equals(languageCode)) { it.remove(); it.add(new PageTitle(link.getText(), WikiSite.forLanguageCode("be-tarask"))); } else if (AppLanguageLookUpTable.CHINESE_LANGUAGE_CODE.equals(languageCode)) { haveChineseEntry = true; it.remove(); for (String dialect : Arrays.asList(AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE, AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE)) { it.add(new PageTitle((title.isMainPage()) ? MainPageNameData.valueFor(dialect) : link.getText(), WikiSite.forLanguageCode(dialect))); } } } if (!haveChineseEntry) { addChineseEntriesIfNeeded(title, languageEntries); } }
Source:
protected List<Person> getOptions(CharSequence constraint) { PatientController patientController = getMuzimaApplicationContext().getPatientController(); PersonController personController = getMuzimaApplicationContext().getPersonController(); List<Person> personList = new ArrayList<>(); try { List<Patient> patientList; if (searchRemote) { patientList = patientController.searchPatientOnServer(constraint.toString()); } else { personList = personController.searchPersonLocally(constraint.toString()); patientList = patientController.searchPatientLocally(constraint.toString(), null); } for (Patient patient : patientList) { if (personController.getPersonByUuid(patient.getUuid()) == null) personList.add(patient); } } catch (PersonController.PersonLoadException | PatientController.PatientLoadException e) { Log.e(getClass().getSimpleName(), "Unable to search persons!", e); } return personList; }

Target:
protected List<Person> getOptions(CharSequence constraint) { PatientController patientController = getMuzimaApplicationContext().getPatientController(); PersonController personController = getMuzimaApplicationContext().getPersonController(); List<Person> personList = new ArrayList<>(); try { List<Patient> patientList = new ArrayList<>(); if (searchRemote) { Credentials credentials = new Credentials(getContext()); Constants.SERVER_CONNECTIVITY_STATUS serverStatus = NetworkUtils.getServerStatus(getMuzimaApplicationContext(), credentials.getServerUrl()); if(serverStatus == Constants.SERVER_CONNECTIVITY_STATUS.SERVER_ONLINE) patientList = patientController.searchPatientOnServer(constraint.toString()); else connectivityFailed = true; } else { personList = personController.searchPersonLocally(constraint.toString()); patientList = patientController.searchPatientLocally(constraint.toString(), null); } for (Patient patient : patientList) { if (personController.getPersonByUuid(patient.getUuid()) == null) personList.add(patient); } } catch (PersonController.PersonLoadException | PatientController.PatientLoadException e) { Log.e(getClass().getSimpleName(), "Unable to search persons!", e); } return personList; }
Source:
protected void endWithFailure() { setVmTemplateId(getParameters().getVmTemplateId()); setVmId(getVmIdFromImageParameters()); for (VdcActionParametersBase p : getParameters().getImagesParameters()) { p.setTaskGroupSuccess(false); Backend.getInstance().endAction(VdcActionType.CreateImageTemplate, p, cloneContextAndDetachFromParent()); } if (TaskManagerUtil.getCommandExecutionStatus(getParameters().getCommandId()) == CommandExecutionStatus.EXECUTED) { if (getVmTemplate() != null) { DbFacade.getInstance().getVmTemplateDao().remove(getVmTemplateId()); removeNetwork(); } } if (!getVmId().equals(Guid.Empty) && getVm() != null) { VmHandler.unLockVm(getVm()); } setSucceeded(true); }

Target:
protected void endWithFailure() { setVmTemplateId(getParameters().getVmTemplateId()); setVmId(getVmIdFromImageParameters()); for (VdcActionParametersBase p : getParameters().getImagesParameters()) { p.setTaskGroupSuccess(false); Backend.getInstance().endAction(VdcActionType.CreateImageTemplate, p, cloneContextAndDetachFromParent()); } if (CommandCoordinatorUtil.getCommandExecutionStatus(getParameters().getCommandId()) == CommandExecutionStatus.EXECUTED) { if (getVmTemplate() != null) { DbFacade.getInstance().getVmTemplateDao().remove(getVmTemplateId()); removeNetwork(); } } if (!getVmId().equals(Guid.Empty) && getVm() != null) { VmHandler.unLockVm(getVm()); } setSucceeded(true); }
Source:
public Dog fromJson(JsonValue jsonObject, Type targetType, MappingParser parser) { String javaType = ((JsonObject) jsonObject).getString(" Class targetClass = javaType != null ? getSubClass(targetType, javaType) : (Class) targetType; return parser.readObject(jsonObject, targetClass); }

Target:
public Dog fromJson(JsonValue jsonObject, Type targetType, MappingParser parser) { String javaType = jsonObject.asJsonObject().getString(" Class targetClass = javaType != null ? getSubClass(targetType, javaType) : (Class) targetType; return parser.readObject(jsonObject, targetClass); }
Source:
private void handOverVM(VM vmToRemove) { vmToRemove.setRunOnVds(vmToRemove.getmigrating_to_vds()); log.infoFormat("Handing over VM {0} {1} to Host {2}. Setting VM to status {3}", vmToRemove.getName(), vmToRemove.getId(), vmToRemove.getmigrating_to_vds(), VMStatus.MigratingTo); ResourceManager.getInstance().InternalSetVmStatus(vmToRemove, VMStatus.MigratingTo); addVmDynamicToList(vmToRemove.getDynamicData()); addVmStatisticsToList(vmToRemove.getStatisticsData()); addVmInterfaceStatisticsToList(vmToRemove.getInterfaces()); }

Target:
private void handOverVM(VM vmToRemove) { NGuid destinationHostId = vmToRemove.getmigrating_to_vds(); VMStatus newVmStatus = (VDSStatus.NonResponsive == getDbFacade().getVdsDao().get(destinationHostId).getStatus()) ? VMStatus.Unknown : VMStatus.MigratingTo; vmToRemove.setRunOnVds(destinationHostId); log.infoFormat("Handing over VM {0} {1} to Host {2}. Setting VM to status {3}", vmToRemove.getName(), vmToRemove.getId(), destinationHostId, newVmStatus); ResourceManager.getInstance().InternalSetVmStatus(vmToRemove, newVmStatus); addVmDynamicToList(vmToRemove.getDynamicData()); addVmStatisticsToList(vmToRemove.getStatisticsData()); addVmInterfaceStatisticsToList(vmToRemove.getInterfaces()); }
Source:
private List<Entity> searchHasAllExplicitTypes(final ImmutableList<RyaURI> explicitTypeIds) throws EntityStorageException { RyaURI firstType = null; if (!explicitTypeIds.isEmpty()) { firstType = explicitTypeIds.get(0); } final List<RyaURI> subjects = new ArrayList<>(); Optional<Type> type; try { type = mongoTypeStorage.get(firstType); } catch (final TypeStorageException e) { throw new EntityStorageException("Unable to get entity type: " + firstType, e); } if (type.isPresent()) { final ConvertingCursor<TypedEntity> cursor = search(Optional.empty(), type.get(), Collections.emptySet()); while (cursor.hasNext()) { final TypedEntity typedEntity = cursor.next(); final RyaURI subject = typedEntity.getSubject(); subjects.add(subject); } } final List<Entity> hasAllExplicitTypesEntities = new ArrayList<>(); for (final RyaURI subject : subjects) { final Optional<Entity> entityFromSubject = get(subject); if (entityFromSubject.isPresent()) { final Entity candidateEntity = entityFromSubject.get(); if (explicitTypeIds.containsAll(explicitTypeIds)) { hasAllExplicitTypesEntities.add(candidateEntity); } } } return hasAllExplicitTypesEntities; }

Target:
private List<Entity> searchHasAllExplicitTypes(final ImmutableList<RyaURI> explicitTypeIds) throws EntityStorageException { final List<Entity> hasAllExplicitTypesEntities = new ArrayList<>(); if (!explicitTypeIds.isEmpty()) { final RyaURI firstType = explicitTypeIds.get(0); final List<RyaURI> subjects = new ArrayList<>(); Optional<Type> type; try { if (mongoTypeStorage == null) { mongoTypeStorage = new MongoTypeStorage(mongo, ryaInstanceName); } type = mongoTypeStorage.get(firstType); } catch (final TypeStorageException e) { throw new EntityStorageException("Unable to get entity type: " + firstType, e); } if (type.isPresent()) { final ConvertingCursor<TypedEntity> cursor = search(Optional.empty(), type.get(), Collections.emptySet()); while (cursor.hasNext()) { final TypedEntity typedEntity = cursor.next(); final RyaURI subject = typedEntity.getSubject(); subjects.add(subject); } } for (final RyaURI subject : subjects) { final Optional<Entity> entityFromSubject = get(subject); if (entityFromSubject.isPresent()) { final Entity candidateEntity = entityFromSubject.get(); if (candidateEntity.getExplicitTypeIds().containsAll(explicitTypeIds)) { hasAllExplicitTypesEntities.add(candidateEntity); } } } } return hasAllExplicitTypesEntities; }
Source:
DefaultPerChannelBookieClientPool(ClientConfiguration conf, PerChannelBookieClientFactory factory, BookieSocketAddress address, int coreSize) throws SecurityException { checkArgument(coreSize > 0); this.factory = factory; this.address = address; this.conf = conf; this.shFactory = SecurityProviderFactoryFactory.getSecurityProviderFactory(conf.getTLSProviderFactoryClass()); this.clients = new PerChannelBookieClient[coreSize]; for (int i = 0; i < coreSize; i++) { this.clients[i] = factory.create(address, this, shFactory, VERSION_TWO); } this.clientsV3 = new PerChannelBookieClient[coreSize]; for (int i = 0; i < coreSize; i++) { this.clientsV3[i] = factory.create(address, this, shFactory, VERSION_THREE); } }

Target:
DefaultPerChannelBookieClientPool(ClientConfiguration conf, PerChannelBookieClientFactory factory, BookieSocketAddress address, int coreSize) throws SecurityException { checkArgument(coreSize > 0); this.factory = factory; this.address = address; this.conf = conf; this.shFactory = SecurityProviderFactoryFactory.getSecurityProviderFactory(conf.getTLSProviderFactoryClass()); this.clients = new PerChannelBookieClient[coreSize]; for (int i = 0; i < coreSize; i++) { this.clients[i] = factory.create(address, this, shFactory, false); } if (conf.getUseV2WireProtocol()) { this.clientsV3Enforced = new PerChannelBookieClient[coreSize]; for (int i = 0; i < coreSize; i++) { this.clientsV3Enforced[i] = factory.create(address, this, shFactory, true); } } else { this.clientsV3Enforced = this.clients; } }
Source:
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { try { fConfigDir = null; SubMonitor subMonitor = SubMonitor.convert(monitor, 4); try { preLaunchCheck(configuration, launch, subMonitor.newChild(2)); } catch (CoreException e) { if (e.getStatus().getSeverity() == IStatus.CANCEL) { monitor.setCanceled(true); return; } throw e; } VMRunnerConfiguration runnerConfig = new VMRunnerConfiguration(getMainClass(), getClasspath(configuration)); runnerConfig.setVMArguments(getVMArguments(configuration)); runnerConfig.setProgramArguments(getProgramArguments(configuration)); runnerConfig.setWorkingDirectory(getWorkingDirectory(configuration).getAbsolutePath()); runnerConfig.setEnvironment(getEnvironment(configuration)); runnerConfig.setVMSpecificAttributesMap(getVMSpecificAttributesMap(configuration)); subMonitor.worked(1); setDefaultSourceLocator(configuration); manageLaunch(launch); IVMRunner runner = getVMRunner(configuration, mode); if (runner != null) runner.run(runnerConfig, launch, subMonitor); else subMonitor.setCanceled(true); } catch (final CoreException e) { throw e; } }

Target:
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { try { fConfigDir = null; SubMonitor subMonitor = SubMonitor.convert(monitor, 4); try { preLaunchCheck(configuration, launch, subMonitor.newChild(2)); } catch (CoreException e) { if (e.getStatus().getSeverity() == IStatus.CANCEL) { monitor.setCanceled(true); return; } throw e; } VMRunnerConfiguration runnerConfig = new VMRunnerConfiguration(getMainClass(), getClasspath(configuration)); runnerConfig.setVMArguments(getVMArguments(configuration)); runnerConfig.setProgramArguments(getProgramArguments(configuration)); runnerConfig.setWorkingDirectory(getWorkingDirectory(configuration).getAbsolutePath()); runnerConfig.setEnvironment(getEnvironment(configuration)); runnerConfig.setVMSpecificAttributesMap(getVMSpecificAttributesMap(configuration)); subMonitor.worked(1); setDefaultSourceLocator(configuration); manageLaunch(launch); IVMRunner runner = getVMRunner(configuration, mode); if (runner != null) runner.run(runnerConfig, launch, subMonitor.newChild(1)); else subMonitor.setCanceled(true); } catch (final CoreException e) { throw e; } }
Source:
public Object getTarget() { if (!SKIP_PERMISSION_CHECK) { Jenkins.get().checkPermission(Jenkins.CONFIGURE); } return this; }

Target:
public Object getTarget() { if (!SKIP_PERMISSION_CHECK) { Jenkins.get().checkPermission(Jenkins.ADMINISTER); } return this; }
Source:
public MockSCMSource build() { MockSCMSource source = controller == null ? new MockSCMSource(controllerId, repository, traits()) : new MockSCMSource(controller, repository, traits()); source.setId(id); return source; }

Target:
public MockSCMSource build() { MockSCMSource source = controller == null ? new MockSCMSource(controllerId, repository, traits()) : new MockSCMSource(controller, repository, traits()); source.setId(id()); return source; }
Source:
public boolean accept(String dimVal) { if (dimVal == null) { return false; } final String input = caseSensitive ? dimVal : dimVal.toLowerCase(); for (String value : target) { if (!input.contains(value)) { return false; } } return true; }

Target:
public boolean accept(String dimVal) { if (dimVal == null || values == null) { return false; } if (caseSensitive) { return containsAny(target, dimVal); } for (String search : target) { if (!org.apache.commons.lang.StringUtils.containsIgnoreCase(dimVal, search)) { return false; } } return true; }
Source:
protected Points.Point createPoint( Long timestamp, Object value ) { if( value instanceof Rollup || value instanceof String) return new Points.Point( timestamp, value); else return new Points.Point( timestamp, new SimpleNumber( value ) ); }

Target:
protected Points.Point createPoint( Long timestamp, Object value ) { if( value instanceof Rollup ) return new Points.Point( timestamp, value); else return new Points.Point( timestamp, new SimpleNumber( value ) ); }
Source:
public SftpSession getSession() { Assert.hasText(this.host, "host must not be empty"); Assert.hasText(this.user, "user must not be empty"); Assert.isTrue(StringUtils.hasText(this.userInfoWrapper.getPassword()) || this.privateKey != null, "either a password or a private key is required"); try { JSchSessionWrapper jschSession; if (this.isSharedSession) { this.sharedSessionLock.readLock().lock(); try { if (this.sharedJschSession == null || !this.sharedJschSession.isConnected()) { this.sharedSessionLock.readLock().unlock(); this.sharedSessionLock.writeLock().lock(); try { if (this.sharedJschSession == null || !this.sharedJschSession.isConnected()) { this.sharedJschSession = new JSchSessionWrapper(initJschSession()); } } finally { this.sharedSessionLock.readLock().lock(); this.sharedSessionLock.writeLock().unlock(); } } } finally { this.sharedSessionLock.readLock().unlock(); } jschSession = this.sharedJschSession; } else { jschSession = new JSchSessionWrapper(initJschSession()); } SftpSession sftpSession = new SftpSession(jschSession); if (this.isSharedSession) { this.sharedSessionLock.readLock().lock(); } try { sftpSession.connect(); } finally { if (this.isSharedSession) { this.sharedSessionLock.readLock().unlock(); } } jschSession.addChannel(); return sftpSession; } catch (Exception e) { throw new IllegalStateException("failed to create SFTP Session", e); } }

Target:
public SftpSession getSession() { Assert.hasText(this.host, "host must not be empty"); Assert.hasText(this.user, "user must not be empty"); Assert.isTrue(StringUtils.hasText(this.userInfoWrapper.getPassword()) || this.privateKey != null, "either a password or a private key is required"); try { JSchSessionWrapper jschSession; if (this.isSharedSession) { this.sharedSessionLock.readLock().lock(); try { if (this.sharedJschSession == null || !this.sharedJschSession.isConnected()) { this.sharedSessionLock.readLock().unlock(); this.sharedSessionLock.writeLock().lock(); try { if (this.sharedJschSession == null || !this.sharedJschSession.isConnected()) { this.sharedJschSession = new JSchSessionWrapper(initJschSession()); try { this.sharedJschSession.getSession().connect(); } catch (JSchException e) { throw new IllegalStateException("failed to connect", e); } } } finally { this.sharedSessionLock.readLock().lock(); this.sharedSessionLock.writeLock().unlock(); } } } finally { this.sharedSessionLock.readLock().unlock(); } jschSession = this.sharedJschSession; } else { jschSession = new JSchSessionWrapper(initJschSession()); } SftpSession sftpSession = new SftpSession(jschSession); sftpSession.connect(); jschSession.addChannel(); return sftpSession; } catch (Exception e) { throw new IllegalStateException("failed to create SFTP Session", e); } }
Source:
<R> R executeOnEndPoint(ServiceEndPoint endPoint, ServiceCallback<S, R> callback) throws Exception { ServiceHandle<S> handle = null; try { handle = _serviceCache.checkOut(endPoint); Timer.Context timer = _callbackExecutionTime.time(); try { return callback.call(handle.getService()); } finally { timer.stop(); } } catch (NoCachedInstancesAvailableException e) { LOG.debug("Service cache exhausted. End point: {}", endPoint, e); throw e; } catch (Exception e) { if (_serviceFactory.isRetriableException(e)) { markEndPointAsBad(endPoint); LOG.debug("Bad end point discovered. End point: {}", endPoint, e); } throw e; } finally { if (handle != null) { try { _serviceCache.checkIn(handle); } catch (Exception e) { LOG.warn("Error returning end point to cache. End point: {}, {}", endPoint, e.toString()); LOG.debug("Exception", e); } } } }

Target:
<R> R executeOnEndPoint(ServiceEndPoint endPoint, ServiceCallback<S, R> callback) throws Exception { ServiceHandle<S> handle = null; try { handle = _serviceCache.checkOut(endPoint); Timer.Context timer = _callbackExecutionTime.time(); try { return callback.call(handle.getService()); } finally { timer.stop(); } } catch (NoCachedInstancesAvailableException e) { LOG.info("Service cache exhausted. End point: {}", endPoint, e); throw e; } catch (Exception e) { if (_serviceFactory.isRetriableException(e)) { markEndPointAsBad(endPoint); LOG.info("Bad end point discovered. End point: {}", endPoint, e); } throw e; } finally { if (handle != null) { try { _serviceCache.checkIn(handle); } catch (Exception e) { LOG.warn("Error returning end point to cache. End point: {}, {}", endPoint, e.toString()); LOG.debug("Exception", e); } } } }
Source:
public void startup(ICluster cluster) { sync(() -> { try { mkdirs(); assert config.networkTopology().contains(config.broadcastAddressAndPort()); DistributedTestSnitch.assign(config.networkTopology()); DatabaseDescriptor.setDaemonInitialized(); DatabaseDescriptor.createAllDirectories(); SystemKeyspace.persistLocalMetadata(); try { Schema.instance.loadFromDisk(); } catch (Exception e) { throw e; } Keyspace.setInitialized(); try { CommitLog.instance.recover(); } catch (IOException e) { throw new RuntimeException(e); } if (config.has(NETWORK)) { registerFilter(cluster); MessagingService.instance().listen(); } else { registerMockMessaging(cluster); } if (config.has(GOSSIP)) { StorageService.instance.initServer(); StorageService.instance.removeShutdownHook(); } else { initializeRing(cluster); } if (config.has(NATIVE_PROTOCOL)) { CassandraDaemon.getInstanceForTesting().initializeNativeTransport(); CassandraDaemon.getInstanceForTesting().startNativeTransport(); } StorageService.instance.ensureTraceKeyspace(); SystemKeyspace.finishStartup(); if (!FBUtilities.getBroadcastAddress().equals(broadcastAddressAndPort().address)) throw new IllegalStateException(); if (DatabaseDescriptor.getStoragePort() != broadcastAddressAndPort().port) throw new IllegalStateException(); } catch (Throwable t) { if (t instanceof RuntimeException) throw (RuntimeException) t; throw new RuntimeException(t); } }).run(); }

Target:
public void startup(ICluster cluster) { sync(() -> { try { mkdirs(); assert config.networkTopology().contains(config.broadcastAddressAndPort()); DistributedTestSnitch.assign(config.networkTopology()); DatabaseDescriptor.setDaemonInitialized(); DatabaseDescriptor.createAllDirectories(); SystemKeyspace.persistLocalMetadata(); try { Schema.instance.loadFromDisk(); } catch (Exception e) { throw e; } Keyspace.setInitialized(); try { CommitLog.instance.recover(); } catch (IOException e) { throw new RuntimeException(e); } if (config.has(NETWORK)) { registerFilter(cluster); MessagingService.instance().listen(); } else { registerMockMessaging(cluster); } if (config.has(GOSSIP)) { StorageService.instance.initServer(); StorageService.instance.removeShutdownHook(); } else { initializeRing(cluster); } StorageService.instance.ensureTraceKeyspace(); SystemKeyspace.finishStartup(); if (config.has(NATIVE_PROTOCOL)) { CassandraDaemon.getInstanceForTesting().initializeNativeTransport(); CassandraDaemon.getInstanceForTesting().startNativeTransport(); } if (!FBUtilities.getBroadcastAddress().equals(broadcastAddressAndPort().address)) throw new IllegalStateException(); if (DatabaseDescriptor.getStoragePort() != broadcastAddressAndPort().port) throw new IllegalStateException(); } catch (Throwable t) { if (t instanceof RuntimeException) throw (RuntimeException) t; throw new RuntimeException(t); } }).run(); }
Source:
public Iterator<SpreadsheetRecord> iterator() { final Iterator<Row> iterator = myBook.getSheetAt(0).iterator(); return new Iterator<SpreadsheetRecord>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public SpreadsheetRecord next() { return new XlsRecordImpl(getCellValues(iterator.next()), myHeaders); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }

Target:
public Iterator<SpreadsheetRecord> iterator() { return Iterators.transform(myBook.getSheetAt(0).iterator(), (input) -> new XlsRecordImpl(getCellValues(input), myHeaders)); }
Source:
public HueLightHandler(Thing hueLight) { super(hueLight); lightId = null; lastSentColorTemp = null; lastSentBrightness = null; isOsramPar16 = false; propertiesInitializedSuccessfully = false; bridgeHandler = null; scheduledFuture = null; }

Target:
public HueLightHandler(Thing hueLight) { super(hueLight); }
Source:
protected void bindWidgetToSetting(UIWidget widget) { UISlider slider = widget.find("slider", UISlider.class); assert slider != null; updateSliderIfInteger(slider); setSliderRange(slider); slider.bindValue(new Binding<Float>() { @Override public Float get() { return getSetting().getValue().floatValue(); } @Override public void set(Float value) { setSettingValue(value); } }); }

Target:
protected void bindWidgetToSetting(UIWidget widget) { UISlider slider = widget.find("slider", UISlider.class); assert slider != null; updateSliderIfInteger(slider); setSliderRange(slider); slider.bindValue(new Binding<Float>() { @Override public Float get() { return getSetting().get().floatValue(); } @Override public void set(Float value) { setSettingValue(value); } }); }
Source:
Sequence<ScanResultValue> nWayMergeAndLimit( List<List<QueryRunner<ScanResultValue>>> groupedRunners, QueryPlus<ScanResultValue> queryPlus, Map<String, Object> responseContext ) { return Sequences.concat( Sequences.map( Sequences.simple(groupedRunners), runnerGroup -> Sequences.map( Sequences.simple(runnerGroup), (input) -> Sequences.concat( Sequences.map( input.run(queryPlus, responseContext), srv -> Sequences.simple(srv.toSingleEventScanResultValues()) ) ) ).flatMerge( seq -> seq, Ordering.from(new ScanResultValueTimestampComparator( (ScanQuery) queryPlus.getQuery() )).reverse() ) ) ).limit( Math.toIntExact(((ScanQuery) (queryPlus.getQuery())).getLimit()) ); }

Target:
Sequence<ScanResultValue> nWayMergeAndLimit( List<List<QueryRunner<ScanResultValue>>> groupedRunners, QueryPlus<ScanResultValue> queryPlus, Map<String, Object> responseContext ) { Sequence<ScanResultValue> resultSequence = Sequences.concat( Sequences.map( Sequences.simple(groupedRunners), runnerGroup -> Sequences.map( Sequences.simple(runnerGroup), (input) -> Sequences.concat( Sequences.map( input.run(queryPlus, responseContext), srv -> Sequences.simple(srv.toSingleEventScanResultValues()) ) ) ).flatMerge( seq -> seq, Ordering.from(new ScanResultValueTimestampComparator( (ScanQuery) queryPlus.getQuery() )).reverse() ) ) ); long limit = ((ScanQuery) (queryPlus.getQuery())).getLimit(); if (limit == Long.MAX_VALUE) { return resultSequence; } return resultSequence.limit(limit); }
Source:
public void remove() { if (getConfirmWindow() != null) { return; } ConfirmationModel model = getRemoveQosModel(); setConfirmWindow(model); }

Target:
public void remove() { if (getConfirmWindow() != null) { return; } setConfirmWindow(getRemoveQosModel()); }
Source:
public Resource getConfigFile(String profile, String label, String path) { Assert.isTrue( configClientProperties.getName() != null && !configClientProperties.getName().isEmpty(), "Spring application name is undefined."); Assert.isTrue( configClientProperties.getUri() != null && !configClientProperties.getUri().isEmpty(), "Config server URI is undefined."); if (profile == null) { profile = configClientProperties.getProfile(); if (profile == null || profile.isEmpty()) { profile = "default"; } } if (label == null) { label = configClientProperties.getLabel(); } String url = configClientProperties.getUri() + "/" + configClientProperties.getName() + "/" + profile + "/" + (label == null ? path + "?useDefaultLabel" : label + "/" + path); System.out.println(url); ResponseEntity<Resource> forEntity = restTemplate.getForEntity(url, Resource.class); return forEntity.getBody(); }

Target:
public Resource getConfigFile(String profile, String label, String path) { Assert.isTrue( configClientProperties.getName() != null && !configClientProperties.getName().isEmpty(), "Spring application name is undefined."); Assert.isTrue( configClientProperties.getUri() != null && !configClientProperties.getUri().isEmpty(), "Config server URI is undefined."); if (profile == null) { profile = configClientProperties.getProfile(); if (profile == null || profile.isEmpty()) { profile = "default"; } } if (label == null) { label = configClientProperties.getLabel(); } String url = configClientProperties.getUri() + "/" + configClientProperties.getName() + "/" + profile + "/" + (label == null ? path + "?useDefaultLabel" : label + "/" + path); ResponseEntity<Resource> forEntity = restTemplate.getForEntity(url, Resource.class); return forEntity.getBody(); }
Source:
public EventListWriter(AnnotationRegistry<Event> annotationRegistry) { this.annotationRegistry = annotationRegistry; }

Target:
public EventListWriter(AnnotationRegistry<Event> annotationRegistry) { this.annotationRegistry = checkNotNull(annotationRegistry); }
Source:
public ReadModifyWriteRowRequest.Builder adapt(Append operation) { ReadModifyWriteRowRequest.Builder result = ReadModifyWriteRowRequest.newBuilder(); result.setRowKey(ByteString.copyFrom(operation.getRow())); for (Map.Entry<byte[], List<Cell>> entry : operation.getFamilyCellMap().entrySet()){ String familyName = Bytes.toString(entry.getKey()); for (Cell cell : entry.getValue()) { ReadModifyWriteRule.Builder rule = result.addRulesBuilder(); rule.setFamilyName(familyName); rule.setColumnQualifier( ByteString.copyFrom( cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength())); rule.setAppendValue( ByteString.copyFrom( cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); } } return result; }

Target:
public ReadModifyWriteRowRequest.Builder adapt(Append operation) { ReadModifyWriteRowRequest.Builder result = ReadModifyWriteRowRequest.newBuilder(); result.setRowKey(ByteString.copyFrom(operation.getRow())); for (Map.Entry<byte[], List<Cell>> entry : operation.getFamilyCellMap().entrySet()){ String familyName = Bytes.toString(entry.getKey()); List<Cell> cells = CellDeduplicationHelper.deduplicateFamily(operation, entry.getKey()); for (Cell cell : cells) { ReadModifyWriteRule.Builder rule = result.addRulesBuilder(); rule.setFamilyName(familyName); rule.setColumnQualifier( ByteString.copyFrom( cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength())); rule.setAppendValue( ByteString.copyFrom( cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); } } return result; }
Source:
public void visitTryStatement(TryStatementTree tree) { boolean hasAutoCloseableSoftAssertion = tree.resources().stream() .map(VariableTree::symbol) .map(Symbol::type) .filter(type -> type != null) .filter(type -> type.isSubtypeOf("org.assertj.core.api.AutoCloseableSoftAssertions")) .findFirst() .isPresent(); super.visitTryStatement(tree); if (hasAutoCloseableSoftAssertion) { checkAssertJAssertAll(tree.block().closeBraceToken()); } }

Target:
public void visitTryStatement(TryStatementTree tree) { boolean hasAutoCloseableSoftAssertion = tree.resources().stream() .map(VariableTree::symbol) .map(Symbol::type) .filter(type -> type != null) .filter(type -> type.isSubtypeOf("org.assertj.core.api.AutoCloseableSoftAssertions")) .findFirst() .isPresent(); super.visitTryStatement(tree); if (hasAutoCloseableSoftAssertion) { checkAssertJAssertAll(tree.block().closeBraceToken(), "Add one or more 'assertThat' before the end of this try block."); } }
Source:
public void updateUserShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserService userService = adapter.create(UserService.class); userService.updateUser(new HashMap<String, Object>(), new RetrofitPromise<User>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me", MOCK_URL)); Assert.assertEquals(bodyRef.get().getMethod(), "PATCH"); }

Target:
public void updateUserShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserService userService = adapter.create(UserService.class); userService.updateUser(new HashMap<String, Object>(), new RetrofitPromise<User>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "PATCH"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me", MOCK_URL)); }
Source:
public static void renameTempIndexFile(File workDir) throws IgniteCheckedException { File defragmentedIdxTmpFile = defragmentedIndexTmpFile(workDir); File defragmentedIdxFile = defragmentedIndexFile(workDir); try { Files.move(defragmentedIdxTmpFile.toPath(), defragmentedIdxFile.toPath(), ATOMIC_MOVE); } catch (IOException e) { throw new IgniteCheckedException(e); } }

Target:
public static void renameTempIndexFile(File workDir) throws IgniteException { File defragmentedIdxTmpFile = defragmentedIndexTmpFile(workDir); File defragmentedIdxFile = defragmentedIndexFile(workDir); try { Files.move(defragmentedIdxTmpFile.toPath(), defragmentedIdxFile.toPath(), ATOMIC_MOVE); } catch (IOException e) { throw new IgniteException(e); } }
Source:
public void start() { long interval = randomTimeInterval(); logger.info("Scheduling CardCaptureProcess to run every seconds (will start in seconds)", interval, initialDelayInSeconds); scheduledExecutorService.scheduleAtFixedRate(() -> { for (int threadNumber = 1; threadNumber <= schedulerThreads; threadNumber++) { final int finalThreadNumber = threadNumber; cardCaptureProcess.loadCaptureQueue(); scheduleCaptureThreads(finalThreadNumber); } }, initialDelayInSeconds, interval, TimeUnit.SECONDS); }

Target:
public void start() { long interval = randomTimeInterval(); logger.info("Scheduling CardCaptureProcess to run every seconds (will start in seconds)", interval, initialDelayInSeconds); scheduledExecutorService.scheduleAtFixedRate(() -> { cardCaptureProcess.loadCaptureQueue(); scheduleCaptureThreads(); }, initialDelayInSeconds, interval, TimeUnit.SECONDS); }