auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void readEntriesAndValidateDataArray(LedgerHandle lh, List<byte[]> entries) throws InterruptedException, BKException { ls = lh.readEntries(0, entries.size() - 1); int index = 0; while (ls.hasMoreElements()) { byte[] originalData = entries.get(index++); byte[] receivedData = ls.nextElement().getEntry(); LOG.debug("Length of originalData: " + originalData.length); LOG.debug("Length of receivedData: " + receivedData.length); assertTrue( String.format("LedgerID: %d EntryID: %d OriginalDataLength: %d ReceivedDataLength: %d", lh.getId(), (index - 1), originalData.length, receivedData.length), originalData.length == receivedData.length); assertTrue(String.format("Checking LedgerID: %d EntryID: %d for equality", lh.getId(), (index - 1)), Arrays.equals(originalData, receivedData)); } }

Target:
private void readEntriesAndValidateDataArray(LedgerHandle lh, List<byte[]> entries) throws InterruptedException, BKException { ls = lh.readEntries(0, entries.size() - 1); int index = 0; while (ls.hasMoreElements()) { byte[] originalData = entries.get(index++); byte[] receivedData = ls.nextElement().getEntry(); LOG.debug("Length of originalData: {}", originalData.length); LOG.debug("Length of receivedData: {}", receivedData.length); assertEquals( String.format("LedgerID: %d EntryID: %d OriginalDataLength: %d ReceivedDataLength: %d", lh.getId(), (index - 1), originalData.length, receivedData.length), originalData.length, receivedData.length); Assert.assertArrayEquals( String.format("Checking LedgerID: %d EntryID: %d for equality", lh.getId(), (index - 1)), originalData, receivedData); } }
Source:
public void setUp() throws Exception { super.setUp(); iProject = project.project; if (!gitDir.exists()) new FileRepository(gitDir).create(); new ConnectProviderOperation(iProject, gitDir).execute(null); testRepo = new TestRepository(gitDir); testRepo.connect(iProject); repo = RepositoryMapping.getMapping(iProject).getRepository(); }

Target:
public void setUp() throws Exception { super.setUp(); iProject = project.project; testRepo = new TestRepository(gitDir); testRepo.connect(iProject); repo = RepositoryMapping.getMapping(iProject).getRepository(); }
Source:
private void recordValues() { currentFateOps.set(metricSnapshot.getCurrentFateOps()); zkChildFateOpsTotal.set(metricSnapshot.getZkFateChildOpsTotal()); zkConnectionErrorsTotal.set(metricSnapshot.getZkConnectionErrors()); Map<String,Long> states = metricSnapshot.getTxStateCounters(); states.forEach((key, value) -> { MutableGaugeLong v = fateTypeCounts.get(key); if (v != null) { v.set(value); } else { v = registry.newGauge(metricNameHelper(FATE_TX_STATE_METRIC_PREFIX, key), "By transaction state count for " + key, value); fateTypeCounts.put(key, v); } }); fateOpCounts.forEach((key, value) -> value.set(0)); Map<String,Long> opTypes = metricSnapshot.getOpTypeCounters(); log.trace("OP Counts Before: prev {}, updates {}", fateOpCounts, opTypes); opTypes.forEach((key, value) -> { MutableGaugeLong g = fateOpCounts.get(key); if (g != null) { g.set(value); } else { g = registry.newGauge(metricNameHelper(FATE_OP_TYPE_METRIC_PREFIX, key), "By transaction op type count for " + key, value); fateOpCounts.put(key, g); } }); log.trace("OP Counts After: prev {}, updates {}", fateOpCounts, opTypes); }

Target:
private void recordValues() { currentFateOps.set(metricSnapshot.getCurrentFateOps()); zkChildFateOpsTotal.set(metricSnapshot.getZkFateChildOpsTotal()); zkConnectionErrorsTotal.set(metricSnapshot.getZkConnectionErrors()); Map<String,Long> states = metricSnapshot.getTxStateCounters(); states.forEach((key, value) -> { fateTypeCounts.computeIfAbsent(key, v -> registry.newGauge(metricNameHelper(FATE_TX_STATE_METRIC_PREFIX, key), "By transaction state count for " + key, value)) .set(value); }); fateOpCounts.forEach((key, value) -> value.set(0)); Map<String,Long> opTypes = metricSnapshot.getOpTypeCounters(); log.trace("OP Counts Before: prev {}, updates {}", fateOpCounts, opTypes); opTypes.forEach((key, value) -> { fateOpCounts.computeIfAbsent(key, guage -> registry.newGauge(metricNameHelper(FATE_OP_TYPE_METRIC_PREFIX, key), "By transaction op type count for " + key, value)) .set(value); }); log.trace("OP Counts After: prev {}, updates {}", fateOpCounts, opTypes); }
Source:
private String generateDigest(boolean passwordAlreadyEncoded, String username, String realm, String password, String httpMethod, String uri, String qop, String nonce, String nc, String cnonce) throws IllegalArgumentException { String ha1; String a2 = httpMethod + ":" + uri; String ha2 = CredentialUtil.H(a2); if (passwordAlreadyEncoded) { ha1 = password; } else { ha1 = CredentialUtil.H(username + ":" + realm + ":" +password); } String digest; if (qop == null) { digest = CredentialUtil.KD(ha1, nonce + ":" + ha2); } else if ("auth".equals(qop)) { digest = CredentialUtil.KD(ha1, nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2); } else { throw new IllegalArgumentException("Invalid qop: '" + qop + "'"); } return digest; }

Target:
private String generateDigest(boolean passwordAlreadyEncoded, String username, String realm, String password, String httpMethod, String uri, String qop, String nonce, String nc, String cnonce) throws IllegalArgumentException { String ha1; String a2 = httpMethod + ":" + uri; String ha2 = CredentialUtil.encryptMD5(a2); if (passwordAlreadyEncoded) { ha1 = password; } else { ha1 = CredentialUtil.encryptMD5(username + ":" + realm + ":" +password); } String digest; if (qop == null) { digest = CredentialUtil.encryptMD5(ha1, nonce + ":" + ha2); } else if ("auth".equals(qop)) { digest = CredentialUtil.encryptMD5(ha1, nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2); } else { throw new IllegalArgumentException("Invalid qop: '" + qop + "'"); } return digest; }
Source:
@Override public IgniteFuture<?> onDiscovery( int type, long topVer, ClusterNode node, Collection<ClusterNode> topSnapshot, @Nullable Map<Long, Collection<ClusterNode>> topHist, @Nullable DiscoverySpiCustomMessage spiCustomMsg ) { for (DiscoveryHook hook : hooks) hook.beforeDiscovery(spiCustomMsg); IgniteFuture<?> fut = delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg); for (DiscoveryHook hook : hooks) hook.afterDiscovery(spiCustomMsg); return fut; }

Target:
@Override public IgniteFuture<?> onDiscovery( int type, long topVer, ClusterNode node, Collection<ClusterNode> topSnapshot, @Nullable Map<Long, Collection<ClusterNode>> topHist, @Nullable DiscoverySpiCustomMessage spiCustomMsg ) { hook.beforeDiscovery(spiCustomMsg); IgniteFuture<?> fut = delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg); fut.listen(f -> hook.afterDiscovery(spiCustomMsg)); return fut; }
Source:
public void testCloseCq() throws Exception { gfsh.executeAndAssertThat("create region --name=region --type=PARTITION") .statusIsSuccess(); qs.newCq("Select * from /region r where r.ID = 1", cqa).execute(); server1.invoke(() -> populateRegion(0, 100)); locator.invoke(() -> { Cache cache = getCache(); ManagementService service = ManagementService.getManagementService(cache); DistributedSystemMXBean dsmbean = service.getDistributedSystemMXBean(); await().untilAsserted(() -> assertThat(dsmbean.getActiveCQCount()).isEqualTo(2)); }); qs.closeCqs(); locator.invoke(() -> { Cache cache = getCache(); ManagementService service = ManagementService.getManagementService(cache); DistributedSystemMXBean dsmbean = service.getDistributedSystemMXBean(); await().untilAsserted(() -> assertThat(dsmbean.getActiveCQCount()).isEqualTo(0)); }); }

Target:
public void testCloseCq() throws Exception { gfsh.executeAndAssertThat("create region --name=region --type=PARTITION") .statusIsSuccess(); queryService.newCq("Select * from /region r where r.ID = 1", cqAttributes).execute(); server1.invoke(() -> populateRegion(0, 100)); locator.invoke(() -> { Cache cache = getCache(); ManagementService service = ManagementService.getManagementService(cache); DistributedSystemMXBean dsmbean = service.getDistributedSystemMXBean(); await().atMost(30, TimeUnit.SECONDS) .untilAsserted(() -> assertThat(dsmbean.getActiveCQCount()).isEqualTo(2)); }); queryService.closeCqs(); locator.invoke(() -> { Cache cache = getCache(); ManagementService service = ManagementService.getManagementService(cache); DistributedSystemMXBean dsmbean = service.getDistributedSystemMXBean(); await().atMost(30, TimeUnit.SECONDS) .untilAsserted(() -> assertThat(dsmbean.getActiveCQCount()).isEqualTo(0)); }); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdsStatistics other = (VdsStatistics) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.objectsEqual(cpu_idle, other.cpu_idle) && ObjectUtils.objectsEqual(cpu_load, other.cpu_load) && ObjectUtils.objectsEqual(cpu_sys, other.cpu_sys) && ObjectUtils.objectsEqual(cpu_user, other.cpu_user) && ObjectUtils.objectsEqual(mem_available, other.mem_available) && ObjectUtils.objectsEqual(mem_shared, other.mem_shared) && ObjectUtils.objectsEqual(usage_cpu_percent, other.usage_cpu_percent) && ObjectUtils.objectsEqual(usage_network_percent, other.usage_network_percent) && ObjectUtils.objectsEqual(ksm_state, other.ksm_state) && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) && ObjectUtils.objectsEqual(swap_free, other.swap_free)); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdsStatistics other = (VdsStatistics) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.bigDecimalEqual(cpu_idle, other.cpu_idle) && ObjectUtils.bigDecimalEqual(cpu_load, other.cpu_load) && ObjectUtils.bigDecimalEqual(cpu_sys, other.cpu_sys) && ObjectUtils.bigDecimalEqual(cpu_user, other.cpu_user) && ObjectUtils.objectsEqual(mem_available, other.mem_available) && ObjectUtils.objectsEqual(mem_shared, other.mem_shared) && ObjectUtils.objectsEqual(usage_cpu_percent, other.usage_cpu_percent) && ObjectUtils.objectsEqual(usage_network_percent, other.usage_network_percent) && ObjectUtils.objectsEqual(ksm_state, other.ksm_state) && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) && ObjectUtils.objectsEqual(swap_free, other.swap_free)); }
Source:
public void testExceedingSpecifiedOperationTimeout() { final Long operationTimeoutInSeconds = 10l; WinRmTool winRmTool = WinRmTool.Builder.builder(VM_HOST + ":" + VM_PORT, VM_USER, VM_PASSWORD).build(); winRmTool.setOperationTimeout(operationTimeoutInSeconds * 1000l); try { winRmTool.executePs(String.format("Start-Sleep -s %d\r\nWrite-Host Test Completed", operationTimeoutInSeconds + 5)); fail("Command should fail to complete on time."); } catch (WebServiceException e) { assertTrue(e.getMessage().contains("The WS-Management service cannot complete the operation within the time specified in OperationTimeout")); } }

Target:
public void testExceedingSpecifiedOperationTimeout() throws Exception { final Long operationTimeoutInSeconds = 10l; WinRmTool winRmTool = WINRM_TOOL.call(); winRmTool.setOperationTimeout(operationTimeoutInSeconds * 1000l); try { winRmTool.executePs(String.format("Start-Sleep -s %d\r\nWrite-Host Test Completed", operationTimeoutInSeconds + 5)); fail("Command should fail to complete on time."); } catch (WebServiceException e) { assertTrue(e.getMessage().contains("The WS-Management service cannot complete the operation within the time specified in OperationTimeout")); } }
Source:
public ConsumerDTO clone() { ConsumerDTO copy = super.clone(); OwnerDTO owner = this.getOwner(); copy.setOwner(owner != null ? owner.clone() : null); EnvironmentDTO environment = this.getEnvironment(); copy.setEnvironment(environment != null ? environment.clone() : null); HypervisorIdDTO hid = this.getHypervisorId(); copy.setHypervisorId(hid != null ? hid.clone() : null); ConsumerTypeDTO ctype = this.getType(); copy.setType(ctype != null ? ctype.clone() : null); CertificateDTO idCert = this.getIdCertificate(); copy.setIdCertificate(idCert != null ? idCert.clone() : null); copy.setFacts(this.getFacts()); copy.setInstalledProducts(this.getInstalledProducts()); copy.setCapabilities(this.getCapabilities()); copy.setContentTags(this.getContentTags()); copy.setServiceLevel(this.getServiceLevel()); copy.setRole(this.getRole()); copy.setUsage(this.getUsage()); copy.setAddOns(this.getAddOns()); copy.setSystemPurposeStatus(this.getSystemPurposeStatus()); return copy; }

Target:
public ConsumerDTO clone() { ConsumerDTO copy = super.clone(); OwnerDTO owner = this.getOwner(); copy.setOwner(owner != null ? owner.clone() : null); EnvironmentDTO environment = this.getEnvironment(); copy.setEnvironment(environment != null ? environment.clone() : null); HypervisorIdDTO hid = this.getHypervisorId(); copy.setHypervisorId(hid != null ? hid.clone() : null); ConsumerTypeDTO ctype = this.getType(); copy.setType(ctype != null ? ctype.clone() : null); CertificateDTO idCert = this.getIdCertificate(); copy.setIdCertificate(idCert != null ? idCert.clone() : null); copy.setFacts(this.getFacts()); copy.setInstalledProducts(this.getInstalledProducts()); copy.setCapabilities(this.getCapabilities()); copy.setContentTags(this.getContentTags()); copy.setAddOns(this.getAddOns()); return copy; }
Source:
Map<String, String> getErrorApiHeaders() { Map<String, String> map = new HashMap<String, String>(); map.put(HEADER_API_PAYLOAD_VERSION, "4.0"); map.put(HEADER_API_KEY, apiKey); map.put(HEADER_BUGSNAG_SENT_AT, DateUtils.toIso8601(new Date())); return map; }

Target:
Map<String, String> getErrorApiHeaders() { Map<String, String> map = new HashMap<String, String>(); map.put(HEADER_API_PAYLOAD_VERSION, Report.PAYLOAD_VERSION); map.put(HEADER_API_KEY, apiKey); map.put(HEADER_BUGSNAG_SENT_AT, DateUtils.toIso8601(new Date())); return map; }
Source:
public void populateDocumentForRouting() { CuDisbursementVoucherPayeeDetail payeeDetail = getDvPayeeDetail(); if (payeeDetail.isVendor()) { payeeDetail.setDisbVchrPayeeEmployeeCode( getVendorService().isVendorInstitutionEmployee(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger())); payeeDetail.setDvPayeeSubjectPaymentCode( getVendorService().isSubjectPaymentVendor(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger())); } else if (payeeDetail.isEmployee()) { ParameterEvaluator researchPaymentReasonCodeEvaluator = SpringContext .getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_PAYMENT_REASONS_PARM_NM, payeeDetail.getDisbVchrPaymentReasonCode()); if (researchPaymentReasonCodeEvaluator.evaluationSucceeds() && getParameterService().parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM)) { String researchPayLimit = getParameterService() .getParameterValueAsString(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM); if (StringUtils.isNotBlank(researchPayLimit)) { KualiDecimal payLimit = new KualiDecimal(researchPayLimit); if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) { payeeDetail.setDvPayeeSubjectPaymentCode(true); } } } } super.populateDocumentForRouting(); }

Target:
public void populateDocumentForRouting() { CuDisbursementVoucherPayeeDetail payeeDetail = getDvPayeeDetail(); if (payeeDetail.isVendor()) { payeeDetail.setDisbVchrPayeeEmployeeCode( getVendorService().isVendorInstitutionEmployee(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger())); payeeDetail.setDvPayeeSubjectPaymentCode( getVendorService().isSubjectPaymentVendor(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger())); } else if (payeeDetail.isEmployee() || payeeDetail.isStudent() || payeeDetail.isAlumni()) { ParameterEvaluator researchPaymentReasonCodeEvaluator = SpringContext .getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_PAYMENT_REASONS_PARM_NM, payeeDetail.getDisbVchrPaymentReasonCode()); if (researchPaymentReasonCodeEvaluator.evaluationSucceeds() && getParameterService().parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM)) { String researchPayLimit = getParameterService() .getParameterValueAsString(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM); if (StringUtils.isNotBlank(researchPayLimit)) { KualiDecimal payLimit = new KualiDecimal(researchPayLimit); if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) { payeeDetail.setDvPayeeSubjectPaymentCode(true); } } } } super.populateDocumentForRouting(); }
Source:
private Disposable testDistinct() { Flowable<Person> personFlowable = realm.asFlowable().map(new Function<Realm, Person>() { @Override public Person apply(Realm realm) throws Exception { return realm.where(Person.class).findAllSorted("name").get(0); } }); new Function<Realm, Person>() { @Override public Person apply(Realm realm) throws Exception { return realm.where(Person.class).findAllSorted("name").get(0); } }; Disposable distinctItemTest = personFlowable .distinct() .subscribe(new Consumer<Person>() { @Override public void accept(Person person) throws Exception { showStatus("distinct(): " + person.getName() + ":" + person.getAge()); } }); Disposable distinctKeySelectorItemTest = personFlowable .distinct(new Function<Person, Object>() { @Override public Object apply(Person person) throws Exception { return person.getAge(); } }) .subscribe(new Consumer<Person>() { @Override public void accept(Person person) throws Exception { showStatus("distinct(keySelector): " + person.getName() + ":" + person.getAge()); } }); return new CompositeDisposable(distinctItemTest, distinctKeySelectorItemTest); }

Target:
private void testDistinct() { Flowable<Person> personFlowable = realm.asFlowable().map(realm -> realm.where(Person.class).findAllSorted("name").get(0)); Disposable distinctDisposable = personFlowable .distinct() .subscribe(person -> showStatus("distinct(): " + person.getName() + ":" + person.getAge())); compositeDisposable.add(distinctDisposable); Disposable distinctKeySelectorDisposable = personFlowable .distinct(person -> person.getAge()) .subscribe(person -> showStatus("distinct(keySelector): " + person.getName() + ":" + person.getAge())); compositeDisposable.add(distinctKeySelectorDisposable); }
Source:
private CheckedLocking sameFieldAlreadyOnStack(CheckedLocking nestedIf) { Iterator<CheckedLocking> stackIterator = ifConditionSymbolStack.descendingIterator(); return Iterators.tryFind(stackIterator, parentIf -> parentIf.field == nestedIf.field) .or(nestedIf); }

Target:
private CheckedLocking sameFieldAlreadyOnStack(CheckedLocking nestedIf) { return ifConditionSymbolStack.stream() .skip(1) .filter(parentIf -> parentIf.field == nestedIf.field) .findFirst() .orElse(nestedIf); }
Source:
public View getView(final ViewType viewType) { if (viewType == ViewType.JSON) { return this.jsonView; } return this.cliView; }

Target:
public View<T> getView(final ViewType viewType) { if (viewType == ViewType.JSON) { return (View<T>) new com.spectralogic.ds3cli.views.json.DefaultView(); } return (View<T>) new DefaultView(); }
Source:
private List<String> detectSourceFolders(HasProjectConfig projectNode) { List<String> sourceFolders = new ArrayList<>(); String projectBuilder = getProjectBuilder(projectNode); Map<String, List<String>> attributes = projectNode.getProjectConfig().getAttributes(); sourceFolders.addAll(attributes.containsKey("java.source.folder") ? attributes.get("java.source.folder") : Collections.<String>emptyList()); sourceFolders.addAll(attributes.containsKey(projectBuilder + ".test.source.folder") ? attributes.get(projectBuilder + ".test.source.folder") : Collections.<String>emptyList()); return sourceFolders; }

Target:
private List<String> detectSourceFolders(HasProjectConfig projectNode) { List<String> sourceFolders = new ArrayList<>(); String projectBuilder = getProjectBuilder(projectNode); Map<String, List<String>> attributes = projectNode.getProjectConfig().getAttributes(); sourceFolders.addAll(attributes.containsKey(SOURCE_FOLDER) ? attributes.get(SOURCE_FOLDER) : Collections.<String>emptyList()); sourceFolders.addAll(attributes.containsKey(projectBuilder + ".test.source.folder") ? attributes.get(projectBuilder + ".test.source.folder") : Collections.<String>emptyList()); return sourceFolders; }
Source:
private String typeAheadNameDescriptionTemplateNullSafe(String name, String description) { return applicationTemplates.typeAheadNameDescription( name != null ? name : "", description != null ? description : "") .asString(); }

Target:
private String typeAheadNameDescriptionTemplateNullSafe(String name, String description) { return applicationTemplates.typeAheadNameDescription( name != null ? name : constants.empty(), description != null ? description : constants.empty()) .asString(); }
Source:
public BeanDeploymentArchive getBeanDeploymentArchive(final Class<?> beanClass) { ClassLoader moduleClassLoader = WildFlySecurityManager.getClassLoaderPrivileged(beanClass); if (moduleClassLoader != null) { for (BeanDeploymentArchiveImpl bda : beanDeploymentArchives) { if (bda.getBeanClasses().contains(beanClass.getName()) && moduleClassLoader.equals(bda.getClassLoader())) { return bda; } } } if (additionalBeanDeploymentArchivesByClassloader.containsKey(moduleClassLoader)) { return additionalBeanDeploymentArchivesByClassloader.get(moduleClassLoader); } return null; }

Target:
public BeanDeploymentArchive getBeanDeploymentArchive(final Class<?> beanClass) { ClassLoader moduleClassLoader = WildFlySecurityManager.getClassLoaderPrivileged(beanClass); if (moduleClassLoader != null) { for (BeanDeploymentArchiveImpl bda : beanDeploymentArchives) { if (bda.getBeanClasses().contains(beanClass.getName()) && moduleClassLoader.equals(bda.getClassLoader())) { return bda; } } } if (moduleClassLoader != null && additionalBeanDeploymentArchivesByClassloader.containsKey(moduleClassLoader)) { return additionalBeanDeploymentArchivesByClassloader.get(moduleClassLoader); } return null; }
Source:
public static final AbstractFullDateTimeColumn<Disk> getDateCreatedColumn(String sortBy) { AbstractFullDateTimeColumn<Disk> column = new AbstractFullDateTimeColumn<Disk>() { @Override protected Date getRawValue(Disk object) { return object.getDiskStorageType() == DiskStorageType.IMAGE || object.getDiskStorageType() == DiskStorageType.CINDER || object.getDiskStorageType() == DiskStorageType.MANAGED_BLOCK_STORAGE ? ((DiskImage) object).getCreationDate() : null; } }; if (sortBy != null) { column.makeSortable(sortBy); } else { column.makeSortable(); } return column; }

Target:
public static final AbstractFullDateTimeColumn<Disk> getDateCreatedColumn(String sortBy) { AbstractFullDateTimeColumn<Disk> column = new AbstractFullDateTimeColumn<Disk>() { @Override protected Date getRawValue(Disk object) { return object.getDiskStorageType() == DiskStorageType.IMAGE || object.getDiskStorageType() == DiskStorageType.CINDER || object.getDiskStorageType() == DiskStorageType.MANAGED_BLOCK_STORAGE ? ((DiskImage) object).getCreationDate() : null; } }; return makeSortable(column, sortBy); }
Source:
public void applyUpdates(TInfo tinfo, long updateID, TKeyExtent tkeyExtent, List<TMutation> tmutations) throws TException { UpdateSession us = (UpdateSession) server.sessionManager.reserveSession(updateID); if (us == null) { return; } Semaphore semaphoreCopy = null; boolean reserved = true; try { KeyExtent keyExtent = new KeyExtent(tkeyExtent); if (TabletType.type(keyExtent) == TabletType.USER) { semaphoreCopy = server.getSemaphore(); if (!semaphoreCopy.tryAcquire()) { throw new TException("Mutation failed. No threads available."); } else { log.info("Available permits: {}", semaphoreCopy.availablePermits()); } } setUpdateTablet(us, keyExtent); if (us.currentTablet != null) { long additionalMutationSize = 0; List<Mutation> mutations = us.queuedMutations.get(us.currentTablet); for (TMutation tmutation : tmutations) { Mutation mutation = new ServerMutation(tmutation); mutations.add(mutation); additionalMutationSize += mutation.numBytes(); } us.queuedMutationSize += additionalMutationSize; long totalQueued = server.updateTotalQueuedMutationSize(additionalMutationSize); long total = server.getConfiguration().getAsBytes(Property.TSERV_TOTAL_MUTATION_QUEUE_MAX); if (totalQueued > total) { try { flush(us); } catch (HoldTimeoutException hte) { log.debug("HoldTimeoutException during applyUpdates, removing session"); server.sessionManager.removeSession(updateID, true); reserved = false; } } } } finally { if (semaphoreCopy != null) semaphoreCopy.release(); if (reserved) { server.sessionManager.unreserveSession(us); } } }

Target:
public void applyUpdates(TInfo tinfo, long updateID, TKeyExtent tkeyExtent, List<TMutation> tmutations) throws TException { UpdateSession us = (UpdateSession) server.sessionManager.reserveSession(updateID); if (us == null) { return; } Semaphore semaphoreCopy = null; boolean reserved = true; try { KeyExtent keyExtent = new KeyExtent(tkeyExtent); if (TabletType.type(keyExtent) == TabletType.USER) { semaphoreCopy = server.getSemaphore(); if (!semaphoreCopy.tryAcquire()) { throw new TException("Mutation failed. No threads available."); } else { log.trace("Available permits: {}", semaphoreCopy.availablePermits()); } } setUpdateTablet(us, keyExtent); if (us.currentTablet != null) { long additionalMutationSize = 0; List<Mutation> mutations = us.queuedMutations.get(us.currentTablet); for (TMutation tmutation : tmutations) { Mutation mutation = new ServerMutation(tmutation); mutations.add(mutation); additionalMutationSize += mutation.numBytes(); } us.queuedMutationSize += additionalMutationSize; long totalQueued = server.updateTotalQueuedMutationSize(additionalMutationSize); long total = server.getConfiguration().getAsBytes(Property.TSERV_TOTAL_MUTATION_QUEUE_MAX); if (totalQueued > total) { try { flush(us); } catch (HoldTimeoutException hte) { log.debug("HoldTimeoutException during applyUpdates, removing session"); server.sessionManager.removeSession(updateID, true); reserved = false; } } } } finally { if (semaphoreCopy != null) semaphoreCopy.release(); if (reserved) { server.sessionManager.unreserveSession(us); } } }
Source:
private static Integer getPlaceholders(@Nullable GoExpression argument) { if (argument == null) { return 0; } Matcher m = placeholderPattern.matcher(argument.getText()); Matcher cm; Integer indexCount = 0; Integer maxIndexCount = 0; while (m.find()) { indexCount++; cm = indexedPlaceholderPattern.matcher(m.group()); while (cm.find()) { Integer index = Integer.parseInt(cm.group().replaceAll("\\[|\\]", "")); if (index > 0 && !index.equals(indexCount)) { indexCount = index; } if (maxIndexCount < indexCount) { maxIndexCount = indexCount; } } if (maxIndexCount < indexCount) { maxIndexCount = indexCount; } } return maxIndexCount; }

Target:
private static int getPlaceholders(@Nullable GoExpression argument) { if (argument == null) return -1; String placeholderText = resolve(argument); if (placeholderText == null) return -1; Matcher placeholders = PLACEHOLDER_PATTERN.matcher(placeholderText); Matcher countPlaceholders; int indexCount = 0; int maxIndexCount = 0; while (placeholders.find()) { indexCount++; countPlaceholders = INDEXED_PLACEHOLDER_PATTERN.matcher(placeholders.group()); while (countPlaceholders.find()) { int index = StringUtil.parseInt(countPlaceholders.group().replaceAll("\\[|\\]", ""), -1); if (index > 0 && index != indexCount) { indexCount = index; } if (maxIndexCount < indexCount) { maxIndexCount = indexCount; } } if (maxIndexCount < indexCount) { maxIndexCount = indexCount; } } return maxIndexCount; }
Source:
public void setTransform(Transform transform) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (transform != null && transform.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (data.cairo == 0 && transform == null) return; initCairo(); long cairo = data.cairo; double[] identity = identity(); if (transform != null) { Cairo.cairo_matrix_multiply(identity, transform.handle, identity); } if (hasTransform) { Cairo.cairo_restore(cairo); } hasTransform = true; Cairo.cairo_save(cairo); Cairo.cairo_transform(cairo, identity); data.state &= ~DRAW_OFFSET; }

Target:
public void setTransform(Transform transform) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (transform != null && transform.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (data.cairo == 0 && transform == null) return; initCairo(); long cairo = data.cairo; double[] identity = identity(); identity[4] += ctm_dx; identity[5] += ctm_dy; if (transform != null) { Cairo.cairo_matrix_multiply(identity, transform.handle, identity); } Cairo.cairo_set_matrix(cairo, identity); data.state &= ~DRAW_OFFSET; }
Source:
private static String maxPlausibleSuffix(String suffix, int initialSuffixLength, int localMinStemLength) { int skipOver = 0; int maxSuffix = initialSuffixLength - maxSuffixLength; int lastDash = suffix.lastIndexOf('-'); if (lastDash != -1 && lastDash > maxSuffix) { skipOver = lastDash; } else { skipOver = Math.max(maxSuffix, localMinStemLength); } if (initialSuffixLength >= skipOver) { suffix = suffix.substring(skipOver); } return suffix; }

Target:
private static String maxPlausibleSuffix(String suffix, int initialSuffixLength, int localMinStemLength) { int skipOver = 0; int maxSuffixStart = initialSuffixLength - MAX_SUFFIX_LENGTH; int lastDash = suffix.lastIndexOf('-'); if (lastDash != -1 && lastDash > maxSuffixStart) { skipOver = lastDash; } else { skipOver = Math.max(maxSuffixStart, localMinStemLength); } if (initialSuffixLength >= skipOver) { suffix = suffix.substring(skipOver); } return suffix; }
Source:
private CostBenefitInfo getBestCandidateToCompact(NavigableMap<String, Long> validDataPerLogSegments, long segmentCapacity, long segmentHeaderSize, long maxBlobSize) { Map.Entry<String, Long> firstEntry = validDataPerLogSegments.firstEntry(); Map.Entry<String, Long> lastEntry = validDataPerLogSegments.lastEntry(); CostBenefitInfo bestCandidateToCompact = null; while (firstEntry != null && firstEntry.getKey().compareTo(lastEntry.getKey()) <= 0) { Map.Entry<String, Long> endEntry = lastEntry; while (endEntry != null && firstEntry.getKey().compareTo(endEntry.getKey()) <= 0) { CostBenefitInfo costBenefitInfo = getCostBenefitInfo(firstEntry.getKey(), endEntry.getKey(), validDataPerLogSegments, segmentCapacity, segmentHeaderSize, maxBlobSize); if (costBenefitInfo.getBenefit() > 0 && (bestCandidateToCompact == null || costBenefitInfo.getCostBenefitRatio().compareTo(bestCandidateToCompact.getCostBenefitRatio()) < 0)) { bestCandidateToCompact = costBenefitInfo; logger.trace("Updating best candidate to compact to ", bestCandidateToCompact); } endEntry = validDataPerLogSegments.lowerEntry(endEntry.getKey()); } firstEntry = validDataPerLogSegments.higherEntry(firstEntry.getKey()); } return bestCandidateToCompact; }

Target:
private CostBenefitInfo getBestCandidateToCompact(NavigableMap<String, Long> validDataPerLogSegments, long segmentCapacity, long segmentHeaderSize, long maxBlobSize) { Map.Entry<String, Long> firstEntry = validDataPerLogSegments.firstEntry(); Map.Entry<String, Long> lastEntry = validDataPerLogSegments.lastEntry(); CostBenefitInfo bestCandidateToCompact = null; while (firstEntry != null) { Map.Entry<String, Long> endEntry = lastEntry; while (endEntry != null && firstEntry.getKey().compareTo(endEntry.getKey()) <= 0) { CostBenefitInfo costBenefitInfo = getCostBenefitInfo(firstEntry.getKey(), endEntry.getKey(), validDataPerLogSegments, segmentCapacity, segmentHeaderSize, maxBlobSize); if (costBenefitInfo.getBenefit() >= storeConfig.storeMinLogSegmentCountToReclaimToTriggerCompaction && ( bestCandidateToCompact == null || costBenefitInfo.getCostBenefitRatio().compareTo(bestCandidateToCompact.getCostBenefitRatio()) < 0)) { bestCandidateToCompact = costBenefitInfo; logger.trace("Updating best candidate to compact to ", bestCandidateToCompact); } endEntry = validDataPerLogSegments.lowerEntry(endEntry.getKey()); } firstEntry = validDataPerLogSegments.higherEntry(firstEntry.getKey()); } return bestCandidateToCompact; }
Source:
public ValidationTaskResult validateImpl(Map<String, String> optionMap) throws InterruptedException { String hadoopVersion; try { hadoopVersion = getHadoopVersion(); } catch (IOException e) { return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), String.format("Failed to get hadoop version:%n%s.", ValidationUtils.getErrorInfo(e)), "Please check if hadoop is on your PATH."); } String version = mConf.get(PropertyKey.UNDERFS_VERSION); for (String prefix : new String[] {CDH_PREFIX, HADOOP_PREFIX}) { if (version.startsWith(prefix)) { version = version.substring(prefix.length()); } } if (hadoopVersion.contains(version)) { return new ValidationTaskResult(ValidationUtils.State.OK, getName(), String.format("Hadoop version %s contains UFS version defined in alluxio %s=%s.", hadoopVersion, PropertyKey.UNDERFS_VERSION.toString(), version), ""); } return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), String.format("Hadoop version %s does not match %s=%s.", hadoopVersion, PropertyKey.UNDERFS_VERSION.toString(), version), String.format("Please configure %s to match the HDFS version.", PropertyKey.UNDERFS_VERSION.toString())); }

Target:
public ValidationTaskResult validateImpl(Map<String, String> optionMap) throws InterruptedException { String hadoopVersion; try { hadoopVersion = getHadoopVersion(); } catch (IOException e) { return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), String.format("Failed to get hadoop version:%n%s.", ValidationUtils.getErrorInfo(e)), "Please check if hadoop is on your PATH."); } String version = mConf.get(PropertyKey.UNDERFS_VERSION); for (String prefix : new String[] {CDH_PREFIX, HADOOP_PREFIX}) { if (version.startsWith(prefix)) { version = version.substring(prefix.length()); break; } } if (hadoopVersion.contains(version)) { return new ValidationTaskResult(ValidationUtils.State.OK, getName(), String.format("Hadoop version %s contains UFS version defined in alluxio %s=%s.", hadoopVersion, PropertyKey.UNDERFS_VERSION.toString(), version), ""); } return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), String.format("Hadoop version %s does not match %s=%s.", hadoopVersion, PropertyKey.UNDERFS_VERSION.toString(), version), String.format("Please configure %s to match the HDFS version.", PropertyKey.UNDERFS_VERSION.toString())); }
Source:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_SUBSCRIPTION_KEY")) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildClient(); String text = "hello world"; final DetectLanguageResult detectLanguageResult = client.detectLanguage(text, "US"); final DetectedLanguage detectedDocumentLanguage = detectLanguageResult.getPrimaryLanguage(); System.out.printf("Detected Primary Language: %s, ISO 6391 Name: %s, Score: %s%n", detectedDocumentLanguage.getName(), detectedDocumentLanguage.getIso6391Name(), detectedDocumentLanguage.getScore()); final List<DetectedLanguage> detectedLanguages = detectLanguageResult.getDetectedLanguages(); detectedLanguages.forEach(detectedLanguage -> System.out.printf("Other detected languages: %s, ISO 6391 Name: %s, Score: %s%n", detectedLanguage.getName(), detectedLanguage.getIso6391Name(), detectedLanguage.getScore())); }

Target:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("subscription-key") .endpoint("<LINK_0>") .buildClient(); String text = "hello world"; final DetectLanguageResult detectLanguageResult = client.detectLanguage(text, "US"); final DetectedLanguage detectedDocumentLanguage = detectLanguageResult.getPrimaryLanguage(); System.out.printf("Detected Primary Language: %s, ISO 6391 Name: %s, Score: %s.%n", detectedDocumentLanguage.getName(), detectedDocumentLanguage.getIso6391Name(), detectedDocumentLanguage.getScore()); final List<DetectedLanguage> detectedLanguages = detectLanguageResult.getDetectedLanguages(); for (DetectedLanguage detectedLanguage : detectedLanguages) { System.out.printf("Other detected languages: %s, ISO 6391 Name: %s, Score: %s.%n", detectedLanguage.getName(), detectedLanguage.getIso6391Name(), detectedLanguage.getScore()); } }
Source:
private void pumpFileContent(File file, PrintStream out) throws IOException { BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader(file)); String line = PROLOG_PATTERN.matcher(bufferedReader.readLine()).replaceFirst(""); if (!line.isEmpty()) { out.println(line); } while ((line = bufferedReader.readLine()) != null) { out.println(line); } } finally { IOUtils.closeQuietly(bufferedReader); } }

Target:
private void pumpFileContent(File file, PrintStream out) throws IOException { BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader(file)); String line = XmlUtils.stripProlog(bufferedReader.readLine()); if (!line.isEmpty()) { out.println(line); } while ((line = bufferedReader.readLine()) != null) { out.println(line); } } finally { IOUtils.closeQuietly(bufferedReader); } }
Source:
final void cleanLocks() throws RepositoryException { lockManager.cleanLocks(session); for (String token : new ArrayList<String>(lockTokens.keySet())) { removeLockToken(token); } }

Target:
final void cleanLocks() throws RepositoryException { lockManager.cleanLocks(session); for (String token : lockTokens.keySet()) { removeLockToken(token); } }
Source:
JobPlan findMatchingJob(AgentInstance agent) { List<JobPlan> filteredJobPlans = environmentConfigService.filterJobsByAgent(jobPlans, agent.getUuid()); JobPlan match = null; if (!agent.isElastic()) { match = agent.firstMatching(filteredJobPlans); } else { for (JobPlan jobPlan : filteredJobPlans) { try { if (jobPlan.requiresElasticAgent() && elasticAgentPluginService.shouldAssignWork(agent.elasticAgentMetadata(), environmentConfigService.envForPipeline(jobPlan.getPipelineName()), jobPlan.getElasticProfile(), jobPlan.getClusterProfile(), jobPlan.getIdentifier())) { match = jobPlan; break; } } catch (RulesViolationException | SecretResolutionFailureException e) { JobInstance instance = jobInstanceService.buildById(jobPlan.getJobId()); JobIdentifier jobIdentifier = jobPlan.getIdentifier(); String failureMessage = format("\nThis job was failed by GoCD. This job is configured to run on an elastic agent, but the associated elastic configurations failed for secrets resolution: %s", e.getMessage()); logToJobConsole(jobIdentifier, failureMessage); scheduleService.failJob(instance); jobStatusTopic.post(new JobStatusMessage(jobIdentifier, instance.getState(), agent.getUuid())); } } } if (match != null) { jobPlans.remove(match); } return match; }

Target:
JobPlan findMatchingJob(AgentInstance agent) { List<JobPlan> filteredJobPlans = environmentConfigService.filterJobsByAgent(jobPlans, agent.getUuid()); JobPlan match = null; if (!agent.isElastic()) { match = agent.firstMatching(filteredJobPlans); } else { for (JobPlan jobPlan : filteredJobPlans) { try { if (jobPlan.requiresElasticAgent() && elasticAgentPluginService.shouldAssignWork(agent.elasticAgentMetadata(), environmentConfigService.envForPipeline(jobPlan.getPipelineName()), jobPlan.getElasticProfile(), jobPlan.getClusterProfile(), jobPlan.getIdentifier())) { match = jobPlan; break; } } catch (RulesViolationException | SecretResolutionFailureException e) { JobInstance instance = jobInstanceService.buildById(jobPlan.getJobId()); JobIdentifier jobIdentifier = jobPlan.getIdentifier(); String failureMessage = format("\nThis job was failed by GoCD. This job is configured to run on an elastic agent, there were errors while resolving secrets for the the associated elastic configurations.\nReasons: %s", e.getMessage()); logToJobConsole(jobIdentifier, failureMessage); scheduleService.failJob(instance); jobStatusTopic.post(new JobStatusMessage(jobIdentifier, instance.getState(), agent.getUuid())); } } } if (match != null) { jobPlans.remove(match); } return match; }
Source:
public DerbyConnector(Supplier<MetadataStorageConnectorConfig> config, Supplier<MetadataStorageTablesConfig> dbTables) { super(config, dbTables); final BasicDataSource datasource = getDatasource(); datasource.setDriverClassLoader(getClass().getClassLoader()); datasource.setDriverClassName("org.apache.derby.jdbc.ClientDriver"); this.dbi = new DBI(datasource); log.info("Configured Derby as the metadata storage"); }

Target:
public DerbyConnector(Supplier<MetadataStorageConnectorConfig> config, Supplier<MetadataStorageTablesConfig> dbTables) { super(config, dbTables); final BasicDataSource datasource = getDatasource(); datasource.setDriverClassLoader(getClass().getClassLoader()); datasource.setDriverClassName("org.apache.derby.jdbc.ClientDriver"); this.dbi = new DBI(datasource); log.info("Configured Derby as metadata storage"); }
Source:
protected static String formatNumber(long value, int base) { String s = ""; switch (base) { case 2: s = "0b" + Long.toBinaryString(value); break; case 8: s= "0" + Long.toOctalString(value); break; case 10: s = Long.toString(value); break; case 16: s = "0x" + Long.toHexString(value); break; default: s = Long.toString(value); break; } return s; }

Target:
protected final static String formatNumber(long value, int base) { String s; switch (base) { case 2: s = "0b" + Long.toBinaryString(value); break; case 8: s = "0" + Long.toOctalString(value); break; case 10: s = Long.toString(value); break; case 16: s = "0x" + Long.toHexString(value); break; default: s = Long.toString(value); break; } return s; }
Source:
public void configure(final MapperFactory mapperFactory) { mapperFactory.getConverterFactory().registerConverter(new ActualMeterReadsConverter()); mapperFactory.getConverterFactory().registerConverter(new ActualMeterReadsGasConverter()); mapperFactory.getConverterFactory().registerConverter(new AlarmRegisterConverter()); mapperFactory.getConverterFactory().registerConverter(new PeriodicMeterReadsRequestConverter()); mapperFactory.getConverterFactory().registerConverter(new PeriodicMeterReadsResponseConverter()); mapperFactory.getConverterFactory().registerConverter(new PeriodicMeterReadsResponseGasConverter()); mapperFactory.getConverterFactory().registerConverter(new AmrProfileStatusCodeConverter()); mapperFactory.getConverterFactory().registerConverter(new PushNotificationsAlarmConverter()); }

Target:
public void configure(final MapperFactory mapperFactory) { mapperFactory.getConverterFactory().registerConverter(new ActualMeterReadsConverter()); mapperFactory.getConverterFactory().registerConverter(new ActualMeterReadsGasConverter()); mapperFactory.getConverterFactory().registerConverter(new AlarmRegisterConverter()); mapperFactory.getConverterFactory().registerConverter(new PeriodicMeterReadsRequestConverter()); mapperFactory.getConverterFactory().registerConverter(new PeriodicMeterReadsResponseConverter()); mapperFactory.getConverterFactory().registerConverter(new PeriodicMeterReadsResponseGasConverter()); mapperFactory.getConverterFactory().registerConverter(new AmrProfileStatusCodeConverter()); mapperFactory.getConverterFactory().registerConverter(new PushNotificationsAlarmConverter()); mapperFactory.getConverterFactory().registerConverter(new MeterValueConverter()); }
Source:
public int hashCode() { int result = _domainUuid != null ? _domainUuid.hashCode() : 0; result = 31 * result + (_vpcUuid != null ? _vpcUuid.hashCode() : 0); result = 31 * result + (_domainTemplateName != null ? _domainTemplateName.hashCode() : 0); return result; }

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + (_domainUuid != null ? _domainUuid.hashCode() : 0); result = 31 * result + (_vpcUuid != null ? _vpcUuid.hashCode() : 0); result = 31 * result + (_domainTemplateName != null ? _domainTemplateName.hashCode() : 0); return result; }
Source:
public JobsRecords retrieveJobInfo(JobsSearchSettings jobsSearchSettings) throws SchedulerException, SQLException { int defaultRowsNumber = 10; int defaultPage = 1; List<JobBasicInfo> jobs = motechSchedulerDatabaseService.getScheduledJobsBasicInfo(jobsSearchSettings); int rowCount = jobs.size() == 0 ? 0 : motechSchedulerDatabaseService.countJobs(jobsSearchSettings); if (jobsSearchSettings.getRows() == null) { jobsSearchSettings.setRows(defaultRowsNumber); } if (jobsSearchSettings.getPage() == null) { jobsSearchSettings.setPage(defaultPage); } previousJobsRecords = new JobsRecords( jobsSearchSettings.getPage(), jobsSearchSettings.getRows(), rowCount, jobs ); return previousJobsRecords; }

Target:
public JobsRecords retrieveJobInfo(JobsSearchSettings jobsSearchSettings) throws SchedulerException, SQLException { List<JobBasicInfo> jobs = motechSchedulerDatabaseService.getScheduledJobsBasicInfo(jobsSearchSettings); int rowCount = jobs.size() == 0 ? 0 : motechSchedulerDatabaseService.countJobs(jobsSearchSettings); if (jobsSearchSettings.getRows() == null) { int defaultRowsNumber = 10; jobsSearchSettings.setRows(defaultRowsNumber); } if (jobsSearchSettings.getPage() == null) { int defaultPage = 1; jobsSearchSettings.setPage(defaultPage); } previousJobsRecords = new JobsRecords( jobsSearchSettings.getPage(), jobsSearchSettings.getRows(), rowCount, jobs ); return previousJobsRecords; }
Source:
public static void showMessage(Activity activity, int resId) { showMessage(findBestView(activity), activity.getString(resId), Snackbar.LENGTH_LONG); }

Target:
public static void showMessage(Activity activity, int resId) { showMessage(activity, activity.getString(resId), Snackbar.LENGTH_LONG); }
Source:
public void shouldDebugWebPhpScriptFromNonDefaultPortAndNotFromFirstLine() throws IOException { menu.runCommand( TestMenuCommandsConstants.Run.RUN_MENU, TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); debugConfig.createConfig(PROJECT, false, NON_DEFAULT_DEBUG_PORT); menu.runCommandByXpath( TestMenuCommandsConstants.Run.RUN_MENU, TestMenuCommandsConstants.Run.DEBUG, getXpathForDebugConfigurationMenuItem()); notificationPopup.waitExpectedMessageOnProgressPanelAndClosed( String.format( "Remote debugger connected\nConnected to: Zend Debugger, port: %s.", NON_DEFAULT_DEBUG_PORT)); projectExplorer.openItemByPath(PATH_TO_LIB_PHP); editor.setBreakpoint(14); editor.closeAllTabs(); projectExplorer.openItemByPath(PATH_TO_INDEX_PHP); projectExplorer.invokeCommandWithContextMenu( ProjectExplorer.CommandsGoal.COMMON, PROJECT, START_APACHE_COMMAND_NAME); startWebPhpScriptInDebugMode(); debugPanel.openDebugPanel(); editor.waitTabFileWithSavedStatus("lib.php"); debugPanel.waitDebugHighlightedText("return \"Hello, $name\""); debugPanel.waitTextInVariablesPanel("$name=\"man\""); debugPanel.clickOnButton(DebugPanel.DebuggerButtonsPanel.STEP_OUT); editor.waitTabFileWithSavedStatus("index.php"); debugPanel.waitDebugHighlightedText("echo sayHello(\"man\");"); debugPanel.waitTextInVariablesPanel("$_GET=array [3]"); }

Target:
public void shouldDebugWebPhpScriptFromNonDefaultPortAndNotFromFirstLine() throws IOException { menu.runCommand( TestMenuCommandsConstants.Run.RUN_MENU, TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); debugConfig.createConfig(PROJECT, false, NON_DEFAULT_DEBUG_PORT); menu.runCommandByXpath( TestMenuCommandsConstants.Run.RUN_MENU, TestMenuCommandsConstants.Run.DEBUG, getXpathForDebugConfigurationMenuItem()); notificationPopup.waitExpectedMessageOnProgressPanelAndClosed( String.format( "Remote debugger connected\nConnected to: Zend Debugger, port: %s.", NON_DEFAULT_DEBUG_PORT)); projectExplorer.openItemByPath(PATH_TO_LIB_PHP); editor.setBreakpoint(14); editor.closeAllTabs(); projectExplorer.openItemByPath(PATH_TO_INDEX_PHP); projectExplorer.invokeCommandWithContextMenu( ProjectExplorer.CommandsGoal.COMMON, PROJECT, START_APACHE_COMMAND_NAME); startWebPhpScriptInDebugMode(); debugPanel.openDebugPanel(); editor.waitTabFileWithSavedStatus("lib.php"); editor.waitAcitveBreakpoint(14); debugPanel.waitDebugHighlightedText("return \"Hello, $name\""); debugPanel.waitTextInVariablesPanel("$name=\"man\""); debugPanel.clickOnButton(DebugPanel.DebuggerButtonsPanel.STEP_OUT); editor.waitTabFileWithSavedStatus("index.php"); debugPanel.waitDebugHighlightedText("echo sayHello(\"man\");"); debugPanel.waitTextInVariablesPanel("$_GET=array [3]"); }