auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean IsPowerManagementLegal(VdsStatic vdsStatic, String clsuterCompatibilityVersion) { boolean result = true; if (vdsStatic.getpm_enabled()) { <START> if (vdsStatic.getpm_user() == null || vdsStatic.getpm_user().length() == 0 || <END> vdsStatic.getpm_password() == null || vdsStatic.getpm_password().length() == 0) if (StringHelper.isNullOrEmpty(vdsStatic.getpm_type())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_PM_ENABLED_WITHOUT_AGENT_CREDENTIALS); result = false; } else if (!Regex.IsMatch(Config.<String> GetValue(ConfigValues.VdsFenceType, clsuterCompatibilityVersion), String.format("(,|^)%1$s(,|$)", vdsStatic.getpm_type()))) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_AGENT_NOT_SUPPORTED); result = false; } } return result; }</code><technical_language>simplified by: if (StringUtils.isEmpty(vdsStatic.getpm_user()) || StringUtils.isEmpty(vdsStatic.getpm_password())) { ... }</technical_language>

Target:
protected boolean IsPowerManagementLegal(VdsStatic vdsStatic, String clsuterCompatibilityVersion) { boolean result = true; if (vdsStatic.getpm_enabled()) { if (StringHelper.isNullOrEmpty(vdsStatic.getpm_type()) || !Regex.IsMatch(Config.<String> GetValue(ConfigValues.VdsFenceType, clsuterCompatibilityVersion), String.format("(,|^)%1$s(,|$)", vdsStatic.getpm_type()))) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_AGENT_NOT_SUPPORTED); result = false; } else if (StringUtils.isEmpty(vdsStatic.getpm_user()) || StringUtils.isEmpty(vdsStatic.getpm_password())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_PM_ENABLED_WITHOUT_AGENT_CREDENTIALS); result = false; } } return result; }
Source:
<code>public String buildCollectorFile(ConcurStandardAccountingExtractFile saeFileContents, ConcurStandardAccountingExtractBatchReportData reportData) { if (saeFileContents == null) { throw new IllegalArgumentException("saeFileContents cannot be null"); } else if (reportData == null) { throw new IllegalArgumentException("reportData cannot be null"); } <START> <END> CollectorBatch collectorBatch = buildCollectorBatch(saeFileContents, reportData); if (collectorBatch == null) { LOG.error("There was a problem preparing the data for the Collector file; will not create a file. See earlier logs for details."); return StringUtils.EMPTY; } return writeToCollectorFile(saeFileContents.getOriginalFileName(), collectorBatch, reportData); }</code><technical_language>thrown exceptions a throws</technical_language>

Target:
public String buildCollectorFile(ConcurStandardAccountingExtractFile saeFileContents, ConcurStandardAccountingExtractBatchReportData reportData) { if (saeFileContents == null) { throw new IllegalArgumentException("saeFileContents cannot be null"); } else if (reportData == null) { throw new IllegalArgumentException("reportData cannot be null"); } CollectorBatch collectorBatch = buildCollectorBatch(saeFileContents, reportData); if (collectorBatch == null) { LOG.error("buildCollectorFile(): There was a problem preparing the data for the Collector file;" + " will not create a file. See earlier logs for details."); return StringUtils.EMPTY; } return writeToCollectorFile(saeFileContents.getOriginalFileName(), collectorBatch, reportData); }
Source:
<code>public void registerOperations(ManagementResourceRegistration resourceRegistration) { if (showResources) { resourceRegistration.registerOperationHandler(ShowJaxrsResourcesHandler.DEFINITION, new ShowJaxrsResourcesHandler()); } else { resourceRegistration.registerOperationHandler(ADD_DEFINITION, JaxrsSubsystemAdd.INSTANCE); <START> resourceRegistration.registerOperationHandler(REMOVE_DEFINITION, ReloadRequiredRemoveStepHandler.INSTANCE); <END> } }</code><technical_language>registered all? invokes them</technical_language>

Target:
public void registerOperations(ManagementResourceRegistration resourceRegistration) { super.registerOperations(resourceRegistration); resourceRegistration.registerOperationHandler(ShowJaxrsResourcesHandler.DEFINITION, new ShowJaxrsResourcesHandler()); }
Source:
<code>public void testFetchStdout() throws TimeoutException { WaitingConsumer consumer = new WaitingConsumer(); container.followOutput(consumer, STDOUT); consumer.waitUntil(frame -> frame.getType() == STDOUT && frame.getUtf8String().contains("home"), <START> 30, TimeUnit.SECONDS); <END> }</code><technical_language>I remove line break</technical_language>

Target:
public void testFetchStdout() throws TimeoutException { WaitingConsumer consumer = new WaitingConsumer(); container.followOutput(consumer, STDOUT); consumer.waitUntil(frame -> frame.getType() == STDOUT && frame.getUtf8String().contains("home"), 4, TimeUnit.SECONDS); }
Source:
<code>AppSourceFunction(int bufferSize, int maxParallelism, int numberOfChannels) { this.maxParallelism = maxParallelism; this.numberOfChannels = numberOfChannels; <START> String shortString = "I am a very long string to test partial records hohoho hahaha "; <END> StringBuilder builder = new StringBuilder(shortString); for (int i = 0; i <= 2 * bufferSize / shortString.length() + 1; i++) { builder.append(shortString); } this.longOrShortString = builder.toString(); }</code><technical_language>deduplicated</technical_language>

Target:
AppSourceFunction(int bufferSize, int maxParallelism, int numberOfChannels) { this.maxParallelism = maxParallelism; this.numberOfChannels = numberOfChannels; this.keys = initKeys(numberOfChannels); StringBuilder builder = new StringBuilder(shortString); for (int i = 0; i <= 2 * bufferSize / shortString.length() + 1; i++) { builder.append(shortString); } this.longOrShortString = builder.toString(); }
Source:
<code>public BigDecimal getExchangeRateLast(String cryptoCurrency, String fiatCurrency) { if (isExchangeRateExist(cryptoCurrency, fiatCurrency)) { log.warn("{}-{} pair not supported", cryptoCurrency, fiatCurrency); return null; } try { <START> log.info("{}-{} pair SET getExchangeRateLast", cryptoCurrency, fiatCurrency); <END> setTicker(cryptoCurrency, fiatCurrency); return rateInfo.getLast(); } catch (Exception e) { log.error("", e); } return null; }</code><technical_language>this trace level</technical_language>

Target:
public BigDecimal getExchangeRateLast(String cryptoCurrency, String fiatCurrency) { if (isExchangeRateExist(cryptoCurrency, fiatCurrency)) { log.warn("{}-{} pair not supported", cryptoCurrency, fiatCurrency); return null; } try { log.info("{}-{} pair SET getExchangeRateLast", cryptoCurrency, fiatCurrency); setTicker(cryptoCurrency, fiatCurrency); return bitKubRateInfo.getLast(); } catch (Exception e) { log.error("", e); } return null; }
Source:
<code>public synchronized void scheduleRequestIfNecessary() { if (isFinished() || isFailed()) { return; } if (noMoreLocations && completedClients.size() == allClients.size()) { if (pageBuffer.peekLast() != NO_MORE_PAGES) { checkState(pageBuffer.add(NO_MORE_PAGES), "Could not add no more pages marker"); } if (pageBuffer.peek() == NO_MORE_PAGES) { close(); } notifyBlockedCallers(); return; } long neededBytes = bufferCapacity - bufferRetainedSizeInBytes; if (neededBytes <= 0) { return; } <START> long averageResponseSize = Math.max(1, responseSizeExponentialMovingAverage.get()); <END> int clientCount = (int) ((1.0 * neededBytes / averageResponseSize) * concurrentRequestMultiplier); clientCount = Math.max(clientCount, 1); int pendingClients = allClients.size() - queuedClients.size() - completedClients.size(); clientCount -= pendingClients; for (int i = 0; i < clientCount; ) { HttpPageBufferClient client = queuedClients.poll(); if (client == null) { return; } if (removedClients.contains(client)) { continue; } DataSize max = new DataSize(Math.min(averageResponseSize * 2, maxResponseSize.toBytes()), BYTE); client.scheduleRequest(max); i++; } }</code><technical_language>nit: static import max</technical_language>

Target:
public synchronized void scheduleRequestIfNecessary() { if (isFinished() || isFailed()) { return; } if (noMoreLocations && completedClients.size() == allClients.size()) { if (pageBuffer.peekLast() != NO_MORE_PAGES) { checkState(pageBuffer.add(NO_MORE_PAGES), "Could not add no more pages marker"); } if (pageBuffer.peek() == NO_MORE_PAGES) { close(); } notifyBlockedCallers(); return; } long neededBytes = bufferCapacity - bufferRetainedSizeInBytes; if (neededBytes <= 0) { return; } long averageResponseSize = max(1, responseSizeExponentialMovingAverage.get()); int clientCount = (int) ((1.0 * neededBytes / averageResponseSize) * concurrentRequestMultiplier); clientCount = max(clientCount, 1); int pendingClients = allClients.size() - queuedClients.size() - completedClients.size(); clientCount -= pendingClients; for (int i = 0; i < clientCount; ) { HttpPageBufferClient client = queuedClients.poll(); if (client == null) { return; } if (removedClients.contains(client)) { continue; } DataSize max = new DataSize(min(averageResponseSize * 2, maxResponseSize.toBytes()), BYTE); client.scheduleRequest(max); i++; } }
Source:
<code>private synchronized void regenerateMdsDataBundle(boolean startBundle, String... moduleNames) { LOGGER.info("Regenerating the mds entities bundle"); clearModulesCache(moduleNames); cleanEntitiesBundleCachedClasses(); boolean constructed = mdsConstructor.constructEntities(); if (!constructed) { return; } LOGGER.info("Updating mds data provider"); mdsDataProvider.updateDataProvider(); File dest = new File(monitor.bundleLocation()); if (dest.exists()) { LOGGER.info("Waiting for entities context"); monitor.waitForEntitiesContext(); } File tmpBundleFile; try { LOGGER.info("Generating bundle jar"); tmpBundleFile = generate(); LOGGER.info("Generated bundle jar"); } catch (IOException e) { throw new MdsException("Unable to generate entities bundle", e); } FileUtils.deleteQuietly(dest); try { FileUtils.copyFile(tmpBundleFile, dest); } catch (IOException e) { <START> LOGGER.error("Unable to copy the mds-entities bundle to the bundle directory. Installing from jdo directory", e); <END> dest = tmpBundleFile; } monitor.stopEntitiesBundle(); stopModulesForCoreBundleRefresh(moduleNames); try { monitor.start(dest, false); } finally { FileUtils.deleteQuietly(tmpBundleFile); } refreshModules(moduleNames); if (startBundle) { monitor.start(); } startModulesForCoreBundleRefresh(moduleNames); ThreadSuspender.sleep(2000); }</code><technical_language>this stay "temp" I</technical_language>

Target:
private synchronized void regenerateMdsDataBundle(boolean startBundle, String... moduleNames) { LOGGER.info("Regenerating the mds entities bundle"); clearModulesCache(moduleNames); cleanEntitiesBundleCachedClasses(); boolean constructed = mdsConstructor.constructEntities(); if (!constructed) { return; } LOGGER.info("Updating mds data provider"); mdsDataProvider.updateDataProvider(); File dest = new File(monitor.bundleLocation()); if (dest.exists()) { LOGGER.info("Waiting for entities context"); monitor.waitForEntitiesContext(); } File tmpBundleFile; try { LOGGER.info("Generating bundle jar"); tmpBundleFile = generate(); LOGGER.info("Generated bundle jar"); } catch (IOException e) { throw new MdsException("Unable to generate entities bundle", e); } FileUtils.deleteQuietly(dest); try { FileUtils.copyFile(tmpBundleFile, dest); } catch (IOException e) { LOGGER.error("Unable to copy the mds-entities bundle to the bundle directory. Installing from temp directory", e); dest = tmpBundleFile; } monitor.stopEntitiesBundle(); stopModulesForCoreBundleRefresh(moduleNames); try { monitor.start(dest, false); } finally { FileUtils.deleteQuietly(tmpBundleFile); } refreshModules(moduleNames); if (startBundle) { monitor.start(); } startModulesForCoreBundleRefresh(moduleNames); ThreadSuspender.sleep(2000); }
Source:
<code>public void testGetAllSchemaPropertiesConnectorsForIOConnection() { Set<PropertyPathConnector> actualConnectors = testInputProperties.getAllSchemaPropertiesConnectors(true); assertThat(actualConnectors, Matchers.contains(testInputProperties.FLOW_CONNECTOR)); <START> assertTrue(actualConnectors.size() == 1); <END> assertEquals("outputSchema", new ArrayList<>(actualConnectors).get(0).getPropertyPath()); }</code><technical_language>please *assertEquals* for cases</technical_language>

Target:
public void testGetAllSchemaPropertiesConnectorsForIOConnection() { Set<PropertyPathConnector> actualConnectors = testInputProperties.getAllSchemaPropertiesConnectors(true); assertThat(actualConnectors, Matchers.contains(testInputProperties.OUTGOING_CONNECTOR)); assertEquals(1,actualConnectors.size()); assertEquals("outputSchema", new ArrayList<>(actualConnectors).get(0).getPropertyPath()); }
Source:
<code>private String getAnExistingDOIForWorkflow(Workflow workflow) { String latestWorkflowVersionDOIURL = null; <START> Optional<WorkflowVersion> potentialWorfklowVersion = workflow.getWorkflowVersions().stream() <END> .filter((WorkflowVersion v) -> v.getDoiURL() != null) .filter((WorkflowVersion v) -> !v.getDoiURL().isEmpty()) .findAny(); if (potentialWorfklowVersion.isPresent()) { latestWorkflowVersionDOIURL = potentialWorfklowVersion.get().getDoiURL(); } return latestWorkflowVersionDOIURL; }</code><technical_language>1. I suggest map, like: Optional<String> latestWorkflowVersionDOIURL = workflow.getWorkflowVersions().stream().map(v -> v.getDoiURL()).filter(doi -> StringUtils.isEmpty(doi)).findAny() 2. important, nice if this method returns Optional<String> instead of String, have: return workflow.getWorkflowVersions().stream().map(v -> v.getDoiURL()).filter(doi -> !StringUtils.isEmpty(doi)).findAny(). Optional, -- helps avoid NPEs. 3. name of variable latestWorkflowVersionDOIURL is slightly confusing, I proposing rid of entirely. sure, name implies latest workflow version, code findAny is potentially select a random version, latest. If matter version, do item 2, please rename variable, ensure latest version, if API needs</technical_language>

Target:
private Optional<String> getAnExistingDOIForWorkflow(Workflow workflow) { return workflow.getWorkflowVersions().stream() .map(v -> v.getDoiURL()) .filter(doi -> !StringUtils.isEmpty(doi)).findAny(); }
Source:
<code>private void registerPreDeleteResourceChangeListener() { if (preDeleteProjectListener == null) { preDeleteProjectListener = new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResource resource = event.getResource(); if (resource instanceof IProject) { IProject project = (IProject) resource; if (project.isAccessible()) { if (RepositoryProvider.getProvider(project) instanceof GitProvider) { IResource dotGit = project .findMember(Constants.DOT_GIT); if (dotGit != null && dotGit.getType() == IResource.FOLDER) GitProjectData.reconfigureWindowCache(); } } else { <START> File location = project.getLocation().toFile(); <END> File dotGit = new File(location, Constants.DOT_GIT); if (dotGit.exists() && dotGit.isDirectory()) { GitProjectData.reconfigureWindowCache(); } } } } }; ResourcesPlugin.getWorkspace().addResourceChangeListener(preDeleteProjectListener, IResourceChangeEvent.PRE_DELETE); } }</code><technical_language>getLocation() return null, please add a check</technical_language>

Target:
private void registerPreDeleteResourceChangeListener() { if (preDeleteProjectListener == null) { preDeleteProjectListener = new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResource resource = event.getResource(); if (resource instanceof IProject) { IProject project = (IProject) resource; if (project.isAccessible()) { if (RepositoryProvider.getProvider(project) instanceof GitProvider) { IResource dotGit = project .findMember(Constants.DOT_GIT); if (dotGit != null && dotGit.getType() == IResource.FOLDER) GitProjectData.reconfigureWindowCache(); } } else { IPath locationPath = project.getLocation(); if (locationPath != null) { File locationDir = locationPath.toFile(); File dotGit = new File(locationDir, Constants.DOT_GIT); if (dotGit.exists() && dotGit.isDirectory()) { GitProjectData.reconfigureWindowCache(); } } } } } }; ResourcesPlugin.getWorkspace().addResourceChangeListener(preDeleteProjectListener, IResourceChangeEvent.PRE_DELETE); } }
Source:
<code>public boolean containsTuple(IInputKey key, TupleMask seedMask, ITuple seed) { <START> return containsTuple(key, TupleMask.identity(seedMask.sourceWidth).revertFrom(seed)); <END> }</code><technical_language>this expression is containsTuple(key, seed) hey, wait a minute, do need a separate method interface if same</technical_language>

Target:
public boolean containsTuple(IInputKey key, TupleMask seedMask, ITuple seed) { return containsTuple(key, seed.toImmutable()); }
Source:
<code>private static boolean containsTableFinishNode(PlanFragment planFragment) { <START> return containsTableFinishNode(planFragment.getRoot()); <END> }</code><technical_language>offline discussion, do a "pattern matching" of "OutputNode - TableFinishNode"</technical_language>

Target:
private static boolean containsTableFinishNode(PlanFragment planFragment) { PlanNode root = planFragment.getRoot(); return root instanceof OutputNode && getOnlyElement(root.getSources()) instanceof TableFinishNode; }
Source:
<code>public void testInstanceDelete() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Tasks> taskTable = new TaskListScoped(taskList, new TasksTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(taskTable); OperationsQueue queue = new BasicOperationsQueue(mClient); <START> assertThat(new MultiBatch( <END> new Put<>(taskList, new NameData("list1")), new Put<>(task, new TitleData("task1")) ), resultsIn(queue, new Assert<>(taskList, new NameData("list1")), new Assert<>(task, new TitleData("task1")), new PostOperationRelatedAssert<>(new InstanceTable(mAuthority), task, Instances.TASK_ID) )); assertThat(new SingletonBatch( new Delete<>(task) ), resultsIn(queue, new AssertEmptyTable<>(new TasksTable(mAuthority)), new AssertEmptyTable<>(new InstanceTable(mAuthority)) )); }</code><technical_language>is need assert this if verified a previous test. insert rows</technical_language>

Target:
public void testInstanceDelete() throws Exception { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Tasks> taskTable = new TaskListScoped(taskList, new TasksTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(taskTable); OperationsQueue queue = new BasicOperationsQueue(mClient); queue.enqueue(new MultiBatch( new Put<>(taskList, new NameData("list1")), new Put<>(task, new TitleData("task1")) )); queue.flush(); assertThat(new SingletonBatch( new Delete<>(task) ), resultsIn(queue, new AssertEmptyTable<>(new TasksTable(mAuthority)), new AssertEmptyTable<>(new InstanceTable(mAuthority)) )); }
Source:
<code>public static boolean showRemoteSearch() { <START> if (isRemoteProject()) { <END> ArtifactRepositoryBean customNexusServer = TalendLibsServerManager.getInstance().getCustomNexusServer(); if (customNexusServer != null) { String repoType = customNexusServer.getType(); if (repoType.equals(ArtifactRepositoryBean.NexusType.NEXUS_2.name()) || repoType.equals(ArtifactRepositoryBean.NexusType.NEXUS_3.name()) || repoType.equals(ArtifactRepositoryBean.NexusType.ARTIFACTORY.name())) { return true; } } } return false; }</code><technical_language>system properties in local project setup user libraries artifact server. -Dnexus.user=admin -Dnexus.password=Talend123 -Dnexus.url=http://localhost:8081/ -Dnexus.lib.server.type=NEXUS_3 need check if remote project</technical_language>

Target:
public static boolean showRemoteSearch() { ArtifactRepositoryBean customNexusServer = TalendLibsServerManager.getInstance().getCustomNexusServer(); if (customNexusServer != null) { String repoType = customNexusServer.getType(); if (repoType.equals(ArtifactRepositoryBean.NexusType.NEXUS_2.name()) || repoType.equals(ArtifactRepositoryBean.NexusType.NEXUS_3.name()) || repoType.equals(ArtifactRepositoryBean.NexusType.ARTIFACTORY.name())) { return true; } } return false; }
Source:
<code>public void buildMissingContainerSetAndValidate( Map<Long, Long> container2BCSIDMap) throws IOException { for (Map.Entry<Long, Long> mapEntry : container2BCSIDMap.entrySet()) { long id = mapEntry.getKey(); if (!containerMap.containsKey(id)) { LOG.warn("Adding container to missing container set.", id); missingContainerSet.add(id); } else { Container container = containerMap.get(id); long containerBCSID = container.getBlockCommitSequenceId(); long snapshotBCSID = mapEntry.getValue(); if (containerBCSID < snapshotBCSID) { LOG.warn( <START> "Marking container unhealthy as reported BCSID is smaller" <END> + " than ratis snapshot recorded value {}", containerBCSID, snapshotBCSID); container.markContainerUnhealthy(); } } } }</code><technical_language>argument appears missing. container passed argument</technical_language>

Target:
public void buildMissingContainerSetAndValidate( Map<Long, Long> container2BCSIDMap) { container2BCSIDMap.entrySet().parallelStream().forEach((mapEntry) -> { long id = mapEntry.getKey(); if (!containerMap.containsKey(id)) { LOG.warn("Adding container to missing container set.", id); missingContainerSet.add(id); } else { Container container = containerMap.get(id); long containerBCSID = container.getBlockCommitSequenceId(); long snapshotBCSID = mapEntry.getValue(); if (containerBCSID < snapshotBCSID) { LOG.warn( "Marking container unhealthy as reported BCSID is smaller" + " than ratis snapshot recorded value {}", id, containerBCSID, snapshotBCSID); try { container.markContainerUnhealthy(); } catch (StorageContainerException sce) { LOG.error("Unable to persist unhealthy state for container {}", id); } } } }); }
Source:
<code>public void removeCapabilityRequirements(OperationContext context, Resource resource, String attributeName, String... values) { String dependentName = this.capability.resolve(context.getCurrentAddress()).getName(); for (String value : values) { <START> this.requirementResolver.apply(context, value).ifPresent(requirementName -> context.deregisterCapabilityRequirement(requirementName, dependentName)); <END> } }</code><technical_language>This lambda eliminated</technical_language>

Target:
public void removeCapabilityRequirements(OperationContext context, Resource resource, String attributeName, String... values) { String dependentName = this.capability.resolve(context.getCurrentAddress()).getName(); for (String value : values) { final String requirementName = this.requirementResolver.apply(context, value); if (requirementName != null) { context.deregisterCapabilityRequirement(requirementName, dependentName); } } }
Source:
<code>public String getReverseLookupDomain() { String reverse = getConfig(REVERSE_LOOKUP_NETWORK); if (Strings.isBlank(reverse)) reverse = getAttribute(ADDRESS); <START> reverseNetwork = new Cidr(reverse + "/24"); <END> return Joiner.on('.').join(Iterables.skip(Lists.reverse(Lists.newArrayList(Splitter.on('.').split(reverse))), 1)) + " .in-addr.arpa"; }</code><technical_language>get NPE in added() reverseNetwork initialized point. @andreaturli is fix now. Suggestion is: a method initReverseLookupDomain sets new attributes: REVERSE_LOOKUP_NETWORK, REVERSE_LOOKUP_CIDR REVERSE_LOOKUP_DOMAIN. Change REVERSE_LOOKUP_NETWORK a ConfigKey a BasicAttributeSensorAndConfigKey. Change getReverseLookupDomain do getAttribute(REVERSE_LOOKUP_DOMAIN). call initReverseLookupDomain() beginning of preStart()</technical_language>

Target:
public String getReverseLookupDomain() { return getAttribute(REVERSE_LOOKUP_DOMAIN); }
Source:
<code>private static boolean isBlacklistedVersionGreaterOrEqual(String blacklistedVersion, String pluginVersion) { <START> Semver blacklistedSemver = new Semver(blacklistedVersion); <END> Semver pluginSemver = new Semver(pluginVersion); if (blacklistedSemver.getMajor() < pluginSemver.getMajor()) { return false; } if (blacklistedSemver.getMajor() > pluginSemver.getMajor()) { return true; } if (blacklistedSemver.getMinor() < pluginSemver.getMinor()) { return false; } if (blacklistedSemver.getMinor() > pluginSemver.getMinor()) { return true; } if (blacklistedSemver.getPatch() < pluginSemver.getPatch()) { return false; } return true; }</code><technical_language>methods semver compare versions</technical_language>

Target:
private static boolean isBlacklistedVersionGreaterOrEqual(String blacklistedVersion, String pluginVersion) { Semver blacklistedSemver = new Semver(blacklistedVersion); Semver pluginSemver = new Semver(pluginVersion); return !blacklistedSemver.isLowerThan(pluginSemver); }
Source:
<code>public void shouldCapture() throws Exception { Map<String, Object> responsePayloadMap = new ObjectMapper().readValue(load(STRIPE_CAPTURE_SUCCESS_RESPONSE), HashMap.class); when(response.readEntity(Map.class)).thenReturn(responsePayloadMap); when(stripeGatewayClient.postRequest(any(URI.class), anyString(), any(Map.class), any(MediaType.class), anyString())).thenReturn(response); CaptureResponse response = stripeCaptureHandler.capture(captureGatewayRequest); assertTrue(response.isSuccessful()); assertThat(response.getTransactionId().isPresent(), is(true)); assertThat(response.getTransactionId().get(), is("ch_123456")); <START> } <END></code><technical_language>goes, assert state too</technical_language>

Target:
public void shouldCapture() throws Exception { Map<String, Object> responsePayloadMap = new ObjectMapper().readValue(load(STRIPE_CAPTURE_SUCCESS_RESPONSE), HashMap.class); when(response.readEntity(Map.class)).thenReturn(responsePayloadMap); when(stripeGatewayClient.postRequest(any(URI.class), anyString(), any(Map.class), any(MediaType.class), anyString())).thenReturn(response); CaptureResponse response = stripeCaptureHandler.capture(captureGatewayRequest); assertTrue(response.isSuccessful()); assertThat(response.state(), is(CaptureResponse.ChargeState.COMPLETE)); assertThat(response.getTransactionId().isPresent(), is(true)); assertThat(response.getTransactionId().get(), is("ch_123456")); }
Source:
<code>public void testCountHistorical() throws Exception { String expected = "SELECT count(xTable.art_id) FROM (\n" + <START> " SELECT max(txs1.transaction_id) as transaction_id, art1.art_id, txs1.branch_id\n" + END> " FROM \n" + "osee_artifact art1, osee_txs txs1\n" + " WHERE \n" + "art1.art_type_id = ? AND art1.gamma_id = txs1.gamma_id AND txs1.transaction_id <= ?\n" + " AND \n" + "txs1.mod_type != 3 AND txs1.branch_id = ?\n" + " GROUP BY art1.art_id, txs1.branch_id\n" + ") xTable"; OptionsUtil.setFromTransaction(queryData.getOptions(), EXPECTED_TX_ID); queryData.addCriteria(TYPES); QuerySqlContext context = queryEngine.createCountContext(session, queryData); Assert.assertEquals(expected, context.getSql()); List<Object> parameters = context.getParameters(); Assert.assertEquals(3, parameters.size()); List<AbstractJoinQuery> joins = context.getJoins(); Assert.assertEquals(0, joins.size()); Iterator<Object> iterator = parameters.iterator(); Assert.assertEquals(CoreArtifactTypes.CodeUnit.getGuid().intValue(), iterator.next()); Assert.assertEquals(EXPECTED_TX_ID, iterator.next()); Assert.assertEquals(EXPECTED_BRANCH_ID, iterator.next()); }</code><technical_language>suggest slightly simpler (non-nested) form of: SELECT count(1), max(txs1.transaction_id) transaction_id, art1.art_id, txs1.branch_id osee_artifact art1, osee_txs txs1 art1.art_type_id = ? art1.gamma_id = txs1.gamma_id txs1.transaction_id <= ? txs1.mod_type <> 3 txs1.branch_id = ? GROUP art1.art_id, txs1.branch_id</technical_language>

Target:
public void testCountHistorical() throws Exception { String expected = "SELECT count(xTable.art_id) FROM (\n" + " SELECT max(txs1.transaction_id) as transaction_id, art1.art_id, txs1.branch_id\n" + " FROM \n" + "osee_artifact art1, osee_txs txs1\n" + " WHERE \n" + "art1.art_type_id = ? AND art1.gamma_id = txs1.gamma_id AND txs1.transaction_id <= ?\n" + " AND \n" + "txs1.mod_type <> 3 AND txs1.branch_id = ?\n" + " GROUP BY art1.art_id, txs1.branch_id\n" + ") xTable"; OptionsUtil.setFromTransaction(queryData.getOptions(), EXPECTED_TX_ID); queryData.addCriteria(TYPES); QuerySqlContext context = queryEngine.createCountContext(session, queryData); Assert.assertEquals(expected, context.getSql()); List<Object> parameters = context.getParameters(); Assert.assertEquals(3, parameters.size()); List<AbstractJoinQuery> joins = context.getJoins(); Assert.assertEquals(0, joins.size()); Iterator<Object> iterator = parameters.iterator(); Assert.assertEquals(CoreArtifactTypes.CodeUnit.getGuid(), iterator.next()); Assert.assertEquals(EXPECTED_TX_ID, iterator.next()); Assert.assertEquals(EXPECTED_BRANCH_ID, iterator.next()); }
Source:
<code>private void initialize() { if (getBatchSize() <= 0) { withBatchSize(1); logger.warn("batchSize should be 1 or greater -- setting batchSize to 1"); } if (getThreadCount() <= 0) { int threadCount = clients.size(); withThreadCount(threadCount); logger.warn("threadCount should be 1 or greater -- setting threadCount to number of hosts: " + threadCount); } if (initialized.getAndSet(true)) return; <START> <END> if(inputType == Void.class) { for (int i=0;i<getThreadCount(); i++) { CallArgs newInput = callArgsGenerator.apply(null); if(newInput != null) { submitCall((CallArgsImpl) newInput); } } } threadPool = new CallingThreadPoolExecutor(this, getThreadCount()); jobStartTime = Calendar.getInstance(); started.set(true); }</code><technical_language>thread pool initialized for loop starts submitting tasks execute thread pool. In other words, consider moving test for loop setting started flag</technical_language>

Target:
private void initialize() { if (getBatchSize() <= 0) { withBatchSize(1); logger.warn("batchSize should be 1 or greater -- setting batchSize to 1"); } if (getThreadCount() <= 0) { int threadCount = clients.size(); withThreadCount(threadCount); logger.warn("threadCount should be 1 or greater -- setting threadCount to number of hosts: " + threadCount); } if (initialized.getAndSet(true)) return; threadPool = new CallingThreadPoolExecutor(this, getThreadCount()); jobStartTime = Calendar.getInstance(); started.set(true); if(callArgsGenerator != null) { for (int i=0;i<getThreadCount(); i++) { CallArgs newInput = callArgsGenerator.apply(null); if(newInput != null) { if(!(newInput instanceof CallArgsImpl)) throw new MarkLogicInternalException("Unsupported implementation of call arguments."); submitCall((CallArgsImpl) newInput); } } } }
Source:
<code>public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 1 && args.size() != 2) { throw new IAE("Function[%s] needs 1 or 2 arguments", name()); } ExprEval value = args.get(0).eval(bindings); if (value.type() != ExprType.STRING) { throw new IAE("first argument should be string type but got %s type", value.type()); } DateTimeFormatter formatter = ISODateTimeFormat.dateOptionalTimeParser(); if (args.size() > 1) { ExprEval format = args.get(1).eval(bindings); if (format.type() != ExprType.STRING) { throw new IAE("second argument should be string type but got %s type", format.type()); } formatter = DateTimeFormat.forPattern(format.asString()); <START> } <END> DateTime date; try { date = DateTimes.wrapFormatter(formatter).parse(value.asString()); } catch (IllegalArgumentException e) { throw new IAE(e, "invalid value %s", value.asString()); } return toValue(date); }</code><technical_language>Above, DateTimes.wrapFormatter(ISODateTimeFormat.dateOptionalTimeParser()) cached more globally</technical_language>

Target:
public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 1 && args.size() != 2) { throw new IAE("Function[%s] needs 1 or 2 arguments", name()); } ExprEval value = args.get(0).eval(bindings); if (value.type() != ExprType.STRING) { throw new IAE("first argument should be string type but got %s type", value.type()); } DateTimes.UtcFormatter formatter = DateTimes.ISO_DATE_OPTIONAL_TIME; if (args.size() > 1) { ExprEval format = args.get(1).eval(bindings); if (format.type() != ExprType.STRING) { throw new IAE("second argument should be string type but got %s type", format.type()); } formatter = DateTimes.wrapFormatter(DateTimeFormat.forPattern(format.asString())); } DateTime date; try { date = formatter.parse(value.asString()); } catch (IllegalArgumentException e) { throw new IAE(e, "invalid value %s", value.asString()); } return toValue(date); }
Source:
<code>private OrganizationalUnit getOU( String ouIdentifier, Collection<OrganizationalUnit> organizationalUnits ) { Optional<OrganizationalUnit> targetOU = organizationalUnits.stream() .filter( p -> p.getIdentifier().equalsIgnoreCase( ouIdentifier ) ).findFirst(); <START> if ( targetOU.isPresent() ) { <END> return targetOU.get(); } return null; }</code><technical_language>this of Optional returning null contradictory? Surely checking isPresent(..) in getDefaultOrganizationalUnit(..) better</technical_language>

Target:
private Optional<OrganizationalUnit> getOU( String ouIdentifier, Collection<OrganizationalUnit> organizationalUnits ) { Optional<OrganizationalUnit> targetOU = organizationalUnits.stream() .filter( p -> p.getIdentifier().equalsIgnoreCase( ouIdentifier ) ).findFirst(); return targetOU; }
Source:
<code>public String toMetadata() { StringBuilder sb = new StringBuilder(serviceName); sb.append(":tags:"); tags.entrySet().stream().forEach(kv -> { sb.append(kv.getKey()); sb.append("="); sb.append(kv.getValue()); <START> sb.append("|tag|"); <END> }); return sb.toString(); }</code><technical_language>I proposing put tags in separate metadata properties listed in single collisions in case if tag key "|tag|" "="</technical_language>

Target:
public String toMetadata() { StringBuilder sb = new StringBuilder(serviceName); sb.append(TAGS_SPERATOR); tags.entrySet().stream().forEach(kv -> { sb.append(kv.getKey().replaceAll(EQ, KEY_VALUE_SEPERATOR)); sb.append(EQ); sb.append(kv.getValue().replaceAll(EQ, KEY_VALUE_SEPERATOR)); sb.append(TAG_SEPERATOR); }); return sb.toString(); }
Source:
<code>public CraftTweakerRecipeMapper() { if (Loader.isModLoaded("crafttweaker")) { <START> for (ModContainer mod : Iterables.concat(Loader.instance().getActiveModList(), ModAPIManager.INSTANCE.getAPIList())) { <END> if (mod.getModId().equals("crafttweaker")) { ctCompat = VersionParser.parseVersionReference("crafttweaker@[4.1.5,)").containsVersion(mod.getProcessedVersion()); break; } } } }</code><technical_language>is this necessary? get modcontainer Loader</technical_language>

Target:
public CraftTweakerRecipeMapper() { ctCompat = Loader.isModLoaded("crafttweaker") && VersionParser.parseVersionReference("crafttweaker@[4.1.5,)").containsVersion(Loader.instance().getIndexedModList().get("crafttweaker").getProcessedVersion()); }
Source:
<code>public static CliCommand getCommandExecutor(final String commandName) throws CommandException { final String commandCamel = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, commandName.toString()); final Iterator<CliCommand> implementations = getAllCommands(); <START> while (implementations.hasNext()) { <END> final CliCommand implementation = implementations.next(); final String className = implementation.getClass().getSimpleName(); if (className.equalsIgnoreCase(commandCamel)) { return implementation; } } throw new CommandException("No command class: " + commandName); }</code><technical_language>for style for loop. java for (final CliCommand implementation : getAllCommands())</technical_language>

Target:
public static CliCommand getCommandExecutor(final String commandName) throws CommandException { final String commandCamel = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, commandName.toString()); final Iterable<CliCommand> implementations = getAllCommands(); for (final CliCommand implementation : implementations) { final String className = implementation.getClass().getSimpleName(); if (className.equalsIgnoreCase(commandCamel)) { return implementation; } } throw new CommandException("No command class: " + commandName); }
Source:
<code>private static void serializeHostThread(HostThread hostThread, ISafeByteBufferWriter buffer) { <START> String string = hostThread.getHost(); byte[] strArray = string.getBytes(CHARSET); buffer.putShort((short) strArray.length); buffer.put(strArray); buffer.put((byte) 0); <END> buffer.putInt(hostThread.getTid()); }</code><technical_language>putString</technical_language>

Target:
private static void serializeHostThread(HostThread hostThread, ISafeByteBufferWriter buffer) { buffer.putString(hostThread.getHost()); buffer.putInt(hostThread.getTid()); }
Source:
<code>public ExecRow makeRow(boolean latestVersion, TupleDescriptor td, TupleDescriptor parent) throws StandardException { ExecIndexRow row; int value = -1; if (td != null) { if (!(td instanceof NaturalNumberDescriptor)) throw new RuntimeException("Unexpected TupleDescriptor " + td.getClass().getName()); NaturalNumberDescriptor nnd = (NaturalNumberDescriptor)td; value = nnd.getValue(); } <START> row = getExecutionFactory().getIndexableRow(SYSNATURALNUMBERS_COLUMN_COUNT); <END> row.setColumn(SYSNATURALNUMBERS_N, new SQLInteger(value)); return row; }</code><technical_language>This is a base table row, index row, getValueRow() instead</technical_language>

Target:
public ExecRow makeRow(boolean latestVersion, TupleDescriptor td, TupleDescriptor parent) throws StandardException { ExecRow row; int value = -1; if (td != null) { if (!(td instanceof NaturalNumberDescriptor)) throw new RuntimeException("Unexpected TupleDescriptor " + td.getClass().getName()); NaturalNumberDescriptor nnd = (NaturalNumberDescriptor)td; value = nnd.getValue(); } row = getExecutionFactory().getValueRow(SYSNATURALNUMBERS_COLUMN_COUNT); row.setColumn(SYSNATURALNUMBERS_N, new SQLInteger(value)); return row; }
Source:
<code>private File getNextUnusedFilename(File destination, String name) { String nameWithoutSuffix = null; <START> if( name.indexOf('.') == -1 ) { <END> nameWithoutSuffix = name; } else if( name.endsWith(".tar.gz")) nameWithoutSuffix = name.substring(0, name.length() - ".tar.gz".length()); else nameWithoutSuffix = name.substring(0, name.lastIndexOf('.')); String suffix = name.substring(nameWithoutSuffix.length()); int i = 1; String tmpName = null; File file = new File (destination, name); while (file.exists()) { tmpName = nameWithoutSuffix + "(" + i++ + ")" + suffix; file = new File(destination, tmpName); } return file; }</code><technical_language>Parsing puked <LINK_0> this fix better. Is unit test check that</technical_language>

Target:
protected File getNextUnusedFilename(File destination, String name) { String nameWithoutSuffix = null; if( name.indexOf('.') == -1 ) { nameWithoutSuffix = name; } else if( name.endsWith(".tar.gz")) nameWithoutSuffix = name.substring(0, name.length() - ".tar.gz".length()); else nameWithoutSuffix = name.substring(0, name.lastIndexOf('.')); String suffix = name.substring(nameWithoutSuffix.length()); int i = 1; String tmpName = null; File file = new File (destination, name); while (file.exists()) { tmpName = nameWithoutSuffix + "(" + i++ + ")" + suffix; file = new File(destination, tmpName); } return file; }
Source:
<code>public StreetSplitter( Graph graph, HashGridSpatialIndex<Edge> hashGridSpatialIndex, SpatialIndex transitStopIndex ) { this.graph = graph; if (graphsWithSplitters.contains(graph)) { throw new UnsupportedOperationException("Only one street splitter should be active on a graph at any given time"); } LOG.info("New StreetSpiltter created successfully!"); graphsWithSplitters.add(graph); this.transitStopIndex = transitStopIndex; if (hashGridSpatialIndex == null) { <START> synchronized (this) { <END> idx = new HashGridSpatialIndex<>(); for (StreetEdge se : Iterables.filter(graph.getEdges(), StreetEdge.class)) { idx.insert(se.getGeometry(), se); } } } else { idx = hashGridSpatialIndex; } }</code><technical_language>more clear synchronize index instance StreetSplitter contains it. This synchronization resolve concern multiple updaters writing index once. safe read index while writing though</technical_language>

Target:
public StreetSplitter( Graph graph, HashGridSpatialIndex<Edge> hashGridSpatialIndex, SpatialIndex transitStopIndex ) { this.graph = graph; if (graphsWithSplitters.contains(graph)) { LOG.warn("Multiple StreetSplitters detected on the same graph! Make sure only the most recently created one is used going forward!"); } LOG.info("New StreetSpiltter created successfully!"); graphsWithSplitters.add(graph); this.transitStopIndex = transitStopIndex; if (hashGridSpatialIndex == null) { synchronized (this) { idx = new HashGridSpatialIndex<>(); for (StreetEdge se : Iterables.filter(graph.getEdges(), StreetEdge.class)) { idx.insert(se.getGeometry(), se); } } } else { idx = hashGridSpatialIndex; } }
Source:
<code>public PythonVisitorContext(AstNode rootAst, PyFileInputTree rootTree, PythonFile pythonFile) { this.rootAst = rootAst; <START> this.rootTree = (PyFileInputTreeImpl) rootTree; <END> this.pythonFile = pythonFile; this.parsingException = null; SymbolTableBuilderVisitor symbolTableBuilderVisitor = new SymbolTableBuilderVisitor(); symbolTableBuilderVisitor.scanFile(this); symbolTable = symbolTableBuilderVisitor.symbolTable(); }</code><technical_language>I get rootTree field is declared PyFileInputTreeImpl instead of PyFileInputTree</technical_language>

Target:
public PythonVisitorContext(AstNode rootAst, PyFileInputTree rootTree, PythonFile pythonFile) { this.rootAst = rootAst; this.rootTree = rootTree; this.pythonFile = pythonFile; this.parsingException = null; SymbolTableBuilderVisitor symbolTableBuilderVisitor = new SymbolTableBuilderVisitor(); symbolTableBuilderVisitor.scanFile(this); symbolTable = symbolTableBuilderVisitor.symbolTable(); }
Source:
<code>private boolean support( ValueGroup[] valueGroups ) { <START> return valueGroups.length == 1 && ValueGroup.NUMBER.equals( valueGroups[0] ); <END> }</code><technical_language>please == for enum comparisons done 2 lines</technical_language>

Target:
private boolean support( ValueGroup[] valueGroups ) { return valueGroups.length == 1 && valueGroups[0] == ValueGroup.NUMBER; }
Source:
<code>public org.codice.solr.client.solrj.SolrClient newClient(String coreName) { <START> Args.notEmpty(coreName, "Cannot create Solr client. Solr core name"); <END> String solrDir = getProperty(SOLR_DATA_DIR); Args.notEmpty(solrDir, "Cannot create Solr client. Solr data directory"); ConfigurationStore.getInstance().setDataDirectoryPath(solrDir); LOGGER.debug( "Solr({}): Creating an HTTP Solr client using url [{}]", coreName, getCoreUrl(coreName)); return new SolrClientAdapter(coreName, () -> createSolrHttpClient(coreName)); }</code><technical_language>org.apache.commons.lang.Validate</technical_language>

Target:
public org.codice.solr.client.solrj.SolrClient newClient(String coreName) { Validate.notEmpty(coreName, "Solr core name is missing. Cannot create Solr client."); LOGGER.debug( "Solr({}): Creating an HTTP Solr client using url [{}]", coreName, solrSettings.getCoreUrl(coreName)); return new SolrClientAdapter(coreName, () -> createSolrHttpClient(coreName)); }
Source:
<code>public RelBuilder projectExcept(Iterable<RexNode> expressions) { List<RexNode> allExpressions = new ArrayList<>(fields()); for (RexNode excludeExp : expressions) { if (!allExpressions.remove(excludeExp)) { <START> throw RESOURCE.expressionNotFound(excludeExp.toString()).ex(); <END> } } return this.project(allExpressions); }</code><technical_language>I check redundant digest inputs, for example, if projectExcept(['a', 'a']) a, b, c, throws expression Redundant expression 'a' remove (or similar) is more readable</technical_language>

Target:
public RelBuilder projectExcept(Iterable<RexNode> expressions) { List<RexNode> allExpressions = new ArrayList<>(fields()); Set<RexNode> excludeExpressions = new HashSet<>(); for (RexNode excludeExp : expressions) { if (!excludeExpressions.add(excludeExp)) { throw new IllegalArgumentException( "Input list contains duplicates. Expression " + excludeExp + " exists multiple times."); } if (!allExpressions.remove(excludeExp)) { throw new IllegalArgumentException("Expression " + excludeExp.toString() + " not found."); } } return this.project(allExpressions); }
Source:
<code><START> private void createUIComponents() { <END> Supplier<String> onAdd = () -> { String s = Messages.showInputDialog(panel, "Enter new exclusion pattern", "Add File Exclusion", null, null, validator); return StringUtils.stripToNull(s); }; Function<String, String> onEdit = (value) -> { String s = Messages.showInputDialog(panel, "Modify exclusion pattern", "Edit File Exclusion", null, value, validator); return StringUtils.stripToNull(s); }; list = new EditableList<>(EMPTY_LABEL, onAdd, onEdit); patternList = list.getComponent(); }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Remove this unused private "createUIComponents" method. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private void createUIComponents() { Supplier<String> onAdd = () -> { String s = Messages.showInputDialog(panel, "Enter new exclusion pattern", "Add File Exclusion", null, null, validator); return StringUtils.stripToNull(s); }; Function<String, String> onEdit = value -> { String s = Messages.showInputDialog(panel, "Modify exclusion pattern", "Edit File Exclusion", null, value, validator); return StringUtils.stripToNull(s); }; list = new EditableList<>(EMPTY_LABEL, onAdd, onEdit); patternList = list.getComponent(); }
Source:
<code><START> private Slave getDockerSlave(SshdContainer container){ <END> DumbSlave slave = jenkins.slaves.create(DumbSlave.class); slave.setExecutors(1); slave.remoteFS.set("/tmp/"); SshSlaveLauncher launcher = slave.setLauncher(SshSlaveLauncher.class); launcher.host.set(container.ipBound(22)); launcher.port(container.port(22)); launcher.setSshHostKeyVerificationStrategy(SshSlaveLauncher.NonVerifyingKeyVerificationStrategy.class); launcher.keyCredentials("test", container.getPrivateKeyString()); slave.save(); slave.waitUntilOnline(); assertTrue(slave.isOnline()); return slave; }</code><technical_language>return DumbSlave casts needed</technical_language>

Target:
private DumbSlave getDockerSlave(SshdContainer container){ DumbSlave slave = jenkins.slaves.create(DumbSlave.class); slave.setExecutors(1); slave.remoteFS.set("/tmp/"); SshSlaveLauncher launcher = slave.setLauncher(SshSlaveLauncher.class); launcher.host.set(container.ipBound(22)); launcher.port(container.port(22)); launcher.setSshHostKeyVerificationStrategy(SshSlaveLauncher.NonVerifyingKeyVerificationStrategy.class); launcher.keyCredentials("test", container.getPrivateKeyString()); slave.save(); slave.waitUntilOnline(); assertTrue(slave.isOnline()); return slave; }
Source:
<code>private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (nullVector.length < requiredVectorLength) { nullVector = new boolean[requiredVectorLength]; <START> systemMemoryContext.setBytes(requiredVectorLength * SIZE_OF_BYTE); <END> } }</code><technical_language>overflow concern applies well</technical_language>

Target:
private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (nullVector.length < requiredVectorLength) { nullVector = new boolean[requiredVectorLength]; systemMemoryContext.setBytes(getRetainedSizeInBytes()); } }
Source:
<code>public void testPaintHyperlinkDoesNotLeakDisabledImage() throws Exception <START> { <END> Image prevImage = createGradient(); imageHyperlink.setImage(prevImage); imageHyperlink.setEnabled(false); imageHyperlink.paintHyperlink(gc); Image prevDisabledImage = getDisabledImage(imageHyperlink); imageHyperlink.paintHyperlink(gc); assertTrue(prevDisabledImage == getDisabledImage(imageHyperlink)); }</code><technical_language>style nit: please place opening brace line method name</technical_language>

Target:
public void testPaintHyperlinkDoesNotLeakDisabledImage() throws Exception { Image prevImage = createGradient(); imageHyperlink.setImage(prevImage); imageHyperlink.setEnabled(false); imageHyperlink.paintHyperlink(gc); Image prevDisabledImage = getDisabledImage(imageHyperlink); imageHyperlink.paintHyperlink(gc); assertSame(prevDisabledImage, getDisabledImage(imageHyperlink)); }
Source:
<code>public int getAmountOfSpellsAllPlayersCastOnCurrentTurn() { <START> return amountOfSpellsCastOnCurrentTurn.values().stream().mapToInt(Integer::intValue).sum(); <END> }</code><technical_language>amountOfSpellsCastOnCurrentTurn.values().stream().reduce(0, Integer::sum); I do it</technical_language>

Target:
public int getAmountOfSpellsAllPlayersCastOnCurrentTurn() { return amountOfSpellsCastOnCurrentTurn.values().stream().reduce(0, Integer::sum); }