auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void handleStartupFailure(BackOffExecution backOffExecution) throws Exception { long recoveryInterval = backOffExecution.nextBackOff(); if (BackOffExecution.STOP == recoveryInterval) { <START> stop(); <END> return; } try { if (logger.isDebugEnabled()) { logger.debug("Recovering consumer in " + recoveryInterval + " ms."); } long timeout = System.currentTimeMillis() + recoveryInterval; while (isActive() && System.currentTimeMillis() < timeout) { Thread.sleep(200); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException("Unrecoverable interruption on consumer restart"); } }</code><technical_language>logger.warn("stopping container - restart recovery attempts exhausted")</technical_language>

Target:
protected void handleStartupFailure(BackOffExecution backOffExecution) throws Exception { long recoveryInterval = backOffExecution.nextBackOff(); if (BackOffExecution.STOP == recoveryInterval) { synchronized (this) { if (isActive()) { logger.warn("stopping container - restart recovery attempts exhausted"); stop(); } } return; } try { if (logger.isDebugEnabled() && isActive()) { logger.debug("Recovering consumer in " + recoveryInterval + " ms."); } long timeout = System.currentTimeMillis() + recoveryInterval; while (isActive() && System.currentTimeMillis() < timeout) { Thread.sleep(200); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException("Unrecoverable interruption on consumer restart"); } }
Source:
<code>public void testSaneClientAuthenticationWithMissingFileDoesNotFail() { String filepath = "NON_EXISTENT_PATH_" + UUID.randomUUID().toString(); SaneClientAuthentication sca = new SaneClientAuthentication(filepath); <START> sca.getCredentialForResource(null); <END> }</code><technical_language>If parameter non-null this test pass</technical_language>

Target:
public void testSaneClientAuthenticationWithMissingFileDoesNotFail() { String filepath = "NON_EXISTENT_PATH_" + UUID.randomUUID().toString(); SaneClientAuthentication sca = new SaneClientAuthentication(filepath); sca.getCredentialForResource(""); }
Source:
<code>private List<InitialStop> findIntermodalStops(Facility facility, Person person, double departureTime, Direction direction, RaptorParameters parameters, SwissRailRaptorData data) { SwissRailRaptorConfigGroup srrCfg = parameters.getConfig(); double x = facility.getCoord().getX(); double y = facility.getCoord().getY(); List<InitialStop> initialStops = new ArrayList<>(); switch (srrCfg.getIntermodalAccessEgressModeSelection()) { case CalcLeastCostModePerStop: for (IntermodalAccessEgressParameterSet parameterSet : srrCfg.getIntermodalAccessEgressParameterSets()) { addInitialStopsForParamSet(facility, person, departureTime, direction, parameters, data, x, y, initialStops, parameterSet); } break; case RandomSelectOneModePerRoutingRequestAndDirection: int counter = 0; do { <START> int rndSelector = (int) (MatsimRandom.getRandom().nextDouble() * srrCfg.getIntermodalAccessEgressParameterSets().size()); <END> addInitialStopsForParamSet(facility, person, departureTime, direction, parameters, data, x, y, initialStops, srrCfg.getIntermodalAccessEgressParameterSets().get(rndSelector)); counter++; } while (initialStops.isEmpty() && counter < 2 * srrCfg.getIntermodalAccessEgressParameterSets().size()); break; default: throw new RuntimeException(srrCfg.getIntermodalAccessEgressModeSelection() + " : not implemented!"); } return initialStops; }</code><technical_language>This non-deterministic, threads access random number generator</technical_language>

Target:
private List<InitialStop> findIntermodalStops(Facility facility, Person person, double departureTime, Direction direction, RaptorParameters parameters, SwissRailRaptorData data) { SwissRailRaptorConfigGroup srrCfg = parameters.getConfig(); double x = facility.getCoord().getX(); double y = facility.getCoord().getY(); List<InitialStop> initialStops = new ArrayList<>(); switch (srrCfg.getIntermodalAccessEgressModeSelection()) { case CalcLeastCostModePerStop: for (IntermodalAccessEgressParameterSet parameterSet : srrCfg.getIntermodalAccessEgressParameterSets()) { addInitialStopsForParamSet(facility, person, departureTime, direction, parameters, data, x, y, initialStops, parameterSet); } break; case RandomSelectOneModePerRoutingRequestAndDirection: int counter = 0; do { int rndSelector = random.nextInt(srrCfg.getIntermodalAccessEgressParameterSets().size()); addInitialStopsForParamSet(facility, person, departureTime, direction, parameters, data, x, y, initialStops, srrCfg.getIntermodalAccessEgressParameterSets().get(rndSelector)); counter++; } while (initialStops.isEmpty() && counter < 2 * srrCfg.getIntermodalAccessEgressParameterSets().size()); break; default: throw new RuntimeException(srrCfg.getIntermodalAccessEgressModeSelection() + " : not implemented!"); } return initialStops; }
Source:
<code>private Set<String> validateJobId(final Job job) { final Set<String> errors = Sets.newHashSet(); final JobId jobId = job.getId(); final JobId recomputedId = job.toBuilder().build().getId(); if (jobId == null) { errors.add(format("Job id was not specified.")); } else { <START> final String jobIdName = jobId.getName(); <END> if (jobIdName == null || jobIdName.isEmpty()) { errors.add(format("Job name was not specified.")); } else { if (!NAME_VERSION_PATTERN.matcher(jobIdName).matches()) { errors.add(format("Job name may only contain [0-9a-zA-Z-_.].")); } if (!recomputedId.getName().equals(jobIdName)) { errors.add(format("Id name mismatch: %s != %s", jobIdName, recomputedId.getName())); } } final String jobIdVersion = jobId.getVersion(); if (jobIdVersion == null || jobIdVersion.isEmpty()) { errors.add(format("Job version was not specified.")); } else { if (!NAME_VERSION_PATTERN.matcher(jobIdVersion).matches()) { errors.add(format("Job version may only contain [0-9a-zA-Z-_.].")); } if (!recomputedId.getVersion().equals(jobIdVersion)) { errors.add(format("Id version mismatch: %s != %s", jobIdVersion, recomputedId.getVersion())); } } final String jobIdHash = jobId.getHash(); if (jobIdHash == null || jobIdHash.isEmpty()) { errors.add(format("Job hash was not specified.")); } else { if (jobIdHash.indexOf(':') != -1) { errors.add(format("Job hash contains colon.")); } if (!recomputedId.getHash().equals(jobIdHash)) { errors.add(format("Id hash mismatch: %s != %s", jobIdHash, recomputedId.getHash())); } } } return errors; }</code><technical_language>consider extracting a validateJobName method for this</technical_language>

Target:
private Set<String> validateJobId(final Job job) { final Set<String> errors = Sets.newHashSet(); final JobId jobId = job.getId(); final String jobIdVersion = jobId.getVersion(); final String jobIdHash = jobId.getHash(); final JobId recomputedId = job.toBuilder().build().getId(); if (jobId == null) { errors.add(format("Job id was not specified.")); return errors; } errors.addAll(validateJobName(jobId, recomputedId)); errors.addAll(validateJobVersion(jobIdVersion, recomputedId)); errors.addAll(validateJobHash(jobIdHash, recomputedId)); return errors; }
Source:
<code><START> private LookupSourceFactory buildHash( <END> boolean parallelBuild, TaskContext taskContext, List<Integer> hashChannels, RowPagesBuilder buildPages, Optional<InternalJoinFilterFunction> filterFunction) { BuildSideSetup buildSideSetup = setupBuildSide(parallelBuild, taskContext, hashChannels, buildPages, filterFunction); buildLookupSource(buildSideSetup); return buildSideSetup.lookupSourceFactory; }</code><technical_language>easier read if methods in call order in file: buildHash, setupBuildSide buildLookupSource</technical_language>

Target:
private LookupSourceFactory buildHash( boolean parallelBuild, TaskContext taskContext, List<Integer> hashChannels, RowPagesBuilder buildPages, Optional<InternalJoinFilterFunction> filterFunction) { BuildSideSetup buildSideSetup = setupBuildSide(parallelBuild, taskContext, hashChannels, buildPages, filterFunction, false, SINGLE_STREAM_SPILLER_FACTORY); buildLookupSource(buildSideSetup); return buildSideSetup.getLookupSourceFactory(); }
Source:
<code>public static WebArchive createTestArchive() { return ShrinkWrap.create(WebArchive.class, "transactional-test.war") .addPackage(TransactionalChangedByExtensionTest.class.getPackage()) .addClass(Transactional.class) <START> .addAsWebInfResource( <END> new StringAsset("com.hp.mwtests.ts.jta.cdi.transactional.stereotype.extension.AddTransactionalAnnotationExtension"), "classes/META-INF/services/javax.enterprise.inject.spi.Extension") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); }</code><technical_language>a tip - ManifestContainer.addAsServiceProvider(Class<?>, Class<?>...) is type-safe a CDI extension</technical_language>

Target:
public static WebArchive createTestArchive() { return ShrinkWrap.create(WebArchive.class, "transactional-test.war") .addPackage(TransactionalChangedByExtensionTest.class.getPackage()) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsServiceProvider(javax.enterprise.inject.spi.Extension.class, AddTransactionalAnnotationExtension.class); }
Source:
<code>public Assignment apply(Task task, TaskContext taskContext, String excludedUser) { List<OrganizationalEntity> excluded = ((InternalPeopleAssignments)task.getPeopleAssignments()).getExcludedOwners(); UserInfo userInfo = (UserInfo) ((org.jbpm.services.task.commands.TaskContext)taskContext).get(EnvironmentName.TASK_USER_INFO); List<OrganizationalEntity> potentialOwners = task.getPeopleAssignments().getPotentialOwners().stream() .filter(oe -> oe instanceof User && !excluded.contains(oe)) .collect(Collectors.toList()); task.getPeopleAssignments().getPotentialOwners().stream().filter(oe -> oe instanceof Group) .forEach(oe -> { Iterator<OrganizationalEntity> groupUsers = userInfo.getMembersForGroup((Group)oe); if (groupUsers != null) { groupUsers.forEachRemaining(user -> { if (user != null && !excluded.contains(user) && !potentialOwners.contains(user)) { potentialOwners.add(user); } }); } <START> }); <END> logger.info("Asking the load calculator for task loads for the users {}",calculator.getIdentifier(),potentialOwners); List<User> users = potentialOwners.stream().map(entityToUser).collect(Collectors.toList()); Collection<UserTaskLoad> loads = calculator.getUserTaskLoads(users, taskContext); UserTaskLoad lightestLoad = loads.stream().min(UserTaskLoad::compareTo).orElse(null); return lightestLoad != null ? new Assignment(lightestLoad.getUser().getId()):null; }</code><technical_language>couple of lines (collecting users filtering excluded owners) repeated other strategies sense reuse abstract strategy some utility</technical_language>

Target:
public Assignment apply(Task task, TaskContext taskContext, String excludedUser) { List<OrganizationalEntity> excluded = ((InternalPeopleAssignments)task.getPeopleAssignments()).getExcludedOwners(); UserInfo userInfo = (UserInfo) ((org.jbpm.services.task.commands.TaskContext)taskContext).get(EnvironmentName.TASK_USER_INFO); List<OrganizationalEntity> potentialOwners = task.getPeopleAssignments().getPotentialOwners().stream() .filter(oe -> oe instanceof User && !excluded.contains(oe) && !oe.getId().equals(excludedUser)) .collect(Collectors.toList()); task.getPeopleAssignments().getPotentialOwners().stream().filter(oe -> oe instanceof Group) .forEach(oe -> { Iterator<OrganizationalEntity> groupUsers = userInfo.getMembersForGroup((Group)oe); if (groupUsers != null) { groupUsers.forEachRemaining(user -> { if (user != null && !excluded.contains(user) && !potentialOwners.contains(user) && !user.getId().equals(excludedUser)) { potentialOwners.add(user); } }); } }); logger.debug("Asking the load calculator for task loads for the users {}",calculator.getIdentifier(),potentialOwners); List<User> users = potentialOwners.stream().map(entityToUser).collect(Collectors.toList()); Collection<UserTaskLoad> loads = calculator.getUserTaskLoads(users, taskContext); UserTaskLoad lightestLoad = loads.stream().min(UserTaskLoad::compareTo).orElse(null); return lightestLoad != null ? new Assignment(lightestLoad.getUser().getId()):null; }
Source:
<code>public void endVist_shouldSetTheStopDateTimeOfVisit() { Visit visit = visitService.getVisit(1); <START> assertNull(visit.getStopDatetime()); <END> Date date = new Date(); visitService.endVisit(visit, date); }</code><technical_language>confirming stop date time of visit is set</technical_language>

Target:
public void endVist_shouldSetTheStopDateTimeOfVisit() throws ParseException { executeDataSet(VISITS_ATTRIBUTES_XML); Visit visit = visitService.getVisit(1); assertNull(visit.getStopDatetime()); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = dateFormat.parse("2019-09-16 00:00:00"); visit.setStopDatetime(date); visitService.endVisit(visit, visit.getStopDatetime()); }
Source:
<code>public void testGetBlogTags() { JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID); List jsonList = previewPage.getJsonList(); <START> Assert.assertFalse("GetPublicActivityStream returned no results", jsonList.isEmpty()); <END> }</code><technical_language>blog tags added</technical_language>

Target:
public void testGetBlogTags() { JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID); List jsonList = previewPage.getJsonList(); Assert.assertFalse("GetBlogTags returned no results", jsonList.isEmpty()); }
Source:
<code>public void triggerPoolMonitoringJob() { try { <START> poolMonitoringJob.cancel(true); <END> } catch (Throwable t) { log.debug("Exception cancelling existing job: {}", ExceptionUtils.getRootCauseMessage(t)); } poolMonitoringJob = schedulerService.scheduleWithFixedDelay( this::managePrestartedVmsInAllVmPools, 0, vmPoolMonitorIntervalInMinutes, TimeUnit.MINUTES); }</code><technical_language>(1) code function executed threads simultaneously; (2) commands (run stateless vm in this case) behaves properly thread is interrupted? I cancel running tasks trigger a new task if previous is canceled</technical_language>

Target:
public void triggerPoolMonitoringJob() { try { poolMonitoringJob.cancel(false); } catch (Throwable t) { log.debug("Exception cancelling existing job: {}", ExceptionUtils.getRootCauseMessage(t)); } poolMonitoringJob = schedulerService.scheduleWithFixedDelay( this::managePrestartedVmsInAllVmPools, 0, vmPoolMonitorIntervalInMinutes, TimeUnit.MINUTES); }
Source:
<code>public static boolean isKeepAlive(HttpMessage message) { boolean connectionClose = message.headers().containsValue(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE, true); if (connectionClose) { return false; } if (message.protocolVersion().isKeepAliveDefault()) { <START> return !connectionClose; <END> } else { return message.headers().containsValue(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE, true); } }</code><technical_language>connectionClose false</technical_language>

Target:
public static boolean isKeepAlive(HttpMessage message) { return !message.headers().containsValue(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE, true) && (message.protocolVersion().isKeepAliveDefault() || message.headers().containsValue(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE, true)); }
Source:
<code>private static URL toURL(File f) { try { return f.toURI().toURL(); } catch (MalformedURLException e) { <START> throw new IllegalStateException(e); <END> } }</code><technical_language>If a malformed URL, illegal argument method, illegal state</technical_language>

Target:
private static URL toURL(File f) { try { return f.toURI().toURL(); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } }
Source:
<code>CorfuRecord<V, M> update(@Nonnull final K key, @Nonnull final V value, @Nullable final M metadata) { <START> boolean beganNewTxn = false; <END> try { beganNewTxn = TxBegin(); return corfuTable.put(key, new CorfuRecord<>(value, metadata)); } finally { if (beganNewTxn) { TxEnd(); } } }</code><technical_language>Do support snapshot read? Is introduced in part 3 patch</technical_language>

Target:
CorfuRecord<V, M> update(@Nonnull final K key, @Nonnull final V value, @Nullable final M metadata) { boolean beganNewTxn = false; try { beganNewTxn = TxBegin(); M newMetadata = null; if (metadataOptions.isMetadataEnabled()) { if (metadata == null) { throw new RuntimeException("Table::update needs non-null metadata"); } CorfuRecord<V, M> previous = corfuTable.get(key); M previousMetadata = Optional.ofNullable(previous) .map(CorfuRecord::getMetadata) .orElse((M)metadataOptions.getDefaultMetadataInstance()); validateVersion(previousMetadata, metadata); newMetadata = getNewMetadata(previousMetadata, metadata); } return corfuTable.put(key, new CorfuRecord<>(value, newMetadata)); } finally { if (beganNewTxn) { TxEnd(); } } }
Source:
<code>public GridMetricManager(GridKernalContext ctx) { super(ctx, ctx.config().getMetricExporterSpi()); ctx.addNodeAttribute(ATTR_PHY_RAM, totalSysMemory()); heap = new MemoryUsageMetrics(SYS_METRICS, metricName("memory", "heap")); nonHeap = new MemoryUsageMetrics(SYS_METRICS, metricName("memory", "nonheap")); heap.update(mem.getHeapMemoryUsage()); nonHeap.update(mem.getNonHeapMemoryUsage()); MetricRegistry sysreg = registry(SYS_METRICS); gcCpuLoad = sysreg.doubleMetric(GC_CPU_LOAD, "GC CPU load."); cpuLoad = sysreg.doubleMetric(CPU_LOAD, "CPU load."); sysreg.register("SystemLoadAverage", os::getSystemLoadAverage, Double.class, null); sysreg.register(UP_TIME, rt::getUptime, null); sysreg.register(THREAD_CNT, threads::getThreadCount, null); sysreg.register(PEAK_THREAD_CNT, threads::getPeakThreadCount, null); sysreg.register(TOTAL_STARTED_THREAD_CNT, threads::getTotalStartedThreadCount, null); sysreg.register(DAEMON_THREAD_CNT, threads::getDaemonThreadCount, null); sysreg.register("CurrentThreadCpuTime", threads::getCurrentThreadCpuTime, null); sysreg.register("CurrentThreadUserTime", threads::getCurrentThreadUserTime, null); <START> HistogramMetric cacheOperationsBlockedDurationHistogram = <END> new HistogramMetric(CACHE_OPERATIONS_BLOCKED_DURATION_HISTOGRAM, "Histogram of cache operations blocked duration in milliseconds.", getDurationHistogramBounds()); sysreg.register(cacheOperationsBlockedDurationHistogram); }</code><technical_language>sysreg.histogram instead of explicit instance creation</technical_language>

Target:
public GridMetricManager(GridKernalContext ctx) { super(ctx, ctx.config().getMetricExporterSpi()); ctx.addNodeAttribute(ATTR_PHY_RAM, totalSysMemory()); heap = new MemoryUsageMetrics(SYS_METRICS, metricName("memory", "heap")); nonHeap = new MemoryUsageMetrics(SYS_METRICS, metricName("memory", "nonheap")); heap.update(mem.getHeapMemoryUsage()); nonHeap.update(mem.getNonHeapMemoryUsage()); MetricRegistry sysreg = registry(SYS_METRICS); gcCpuLoad = sysreg.doubleMetric(GC_CPU_LOAD, "GC CPU load."); cpuLoad = sysreg.doubleMetric(CPU_LOAD, "CPU load."); sysreg.register("SystemLoadAverage", os::getSystemLoadAverage, Double.class, null); sysreg.register(UP_TIME, rt::getUptime, null); sysreg.register(THREAD_CNT, threads::getThreadCount, null); sysreg.register(PEAK_THREAD_CNT, threads::getPeakThreadCount, null); sysreg.register(TOTAL_STARTED_THREAD_CNT, threads::getTotalStartedThreadCount, null); sysreg.register(DAEMON_THREAD_CNT, threads::getDaemonThreadCount, null); sysreg.register("CurrentThreadCpuTime", threads::getCurrentThreadCpuTime, null); sysreg.register("CurrentThreadUserTime", threads::getCurrentThreadUserTime, null); MetricRegistry pmeReg = registry(PME_METRICS); long[] pmeBounds = new long[] {500, 1000, 5000, 30000}; pmeReg.histogram(PME_DURATION_HISTOGRAM, pmeBounds, "Histogram of PME durations in milliseconds."); pmeReg.histogram(PME_OPS_BLOCKED_DURATION_HISTOGRAM, pmeBounds, "Histogram of cache operations blocked PME durations in milliseconds."); }
Source:
<code>protected boolean approveRequest(IEditCommandRequest request) { boolean result = super.approveRequest(request); if (!result) { if (request instanceof CreateElementRequest) { Object context = request.getEditHelperContext(); if (context instanceof EObject) { EObject owner = (EObject) context; EReference reference = getContainmentFeature((CreateElementRequest) request); if (reference != null && reference.getEContainingClass() == null) { return false; } if ((reference != null) <START> && <END> reference.getEContainingClass().isSuperTypeOf(owner.eClass()) && !reference.isContainment()) { for (EReference next : UmlUtils.getSupersets(reference)) { if (next.isContainment()) { result = true; break; } } } } } } return result; }</code><technical_language>adding && reference.getEContainingClass() != null</technical_language>

Target:
protected boolean approveRequest(IEditCommandRequest request) { boolean result = super.approveRequest(request); if (!result) { if (request instanceof CreateElementRequest) { Object context = request.getEditHelperContext(); if (context instanceof EObject) { EObject owner = (EObject) context; EReference reference = getContainmentFeature((CreateElementRequest) request); if (reference != null && reference.getEContainingClass() != null && reference.getEContainingClass().isSuperTypeOf(owner.eClass()) && !reference.isContainment()) { for (EReference next : UmlUtils.getSupersets(reference)) { if (next.isContainment()) { result = true; break; } } } } } } return result; }
Source:
<code>public int hashCode() { int result = (_networkAcl ? 1 : 0); result = 31 * result + (_networkUuid != null ? _networkUuid.hashCode() : 0); result = 31 * result + (_networkDomainUuid != null ? _networkDomainUuid.hashCode() : 0); result = 31 * result + (_vpcOrSubnetUuid != null ? _vpcOrSubnetUuid.hashCode() : 0); result = 31 * result + (_networkName != null ? _networkName.hashCode() : 0); result = 31 * result + (_isL2Network ? 1 : 0); result = 31 * result + (_aclRules != null ? _aclRules.hashCode() : 0); result = 31 * result + (int) (_networkId ^ (_networkId >>> 32)); result = 31 * result + (_egressDefaultPolicy ? 1 : 0); result = 31 * result + (_acsIngressAcl != null ? _acsIngressAcl.hashCode() : 0); result = 31 * result + (_networkReset ? 1 : 0); result = 31 * result + (_domainTemplateName != null ? _domainTemplateName.hashCode() : 0); return result; <START> } <END></code><technical_language>Please implement toString() provide debugging state information for debugging purposes</technical_language>

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + (_networkAcl ? 1 : 0); result = 31 * result + (_networkUuid != null ? _networkUuid.hashCode() : 0); result = 31 * result + (_networkDomainUuid != null ? _networkDomainUuid.hashCode() : 0); result = 31 * result + (_vpcOrSubnetUuid != null ? _vpcOrSubnetUuid.hashCode() : 0); result = 31 * result + (_networkName != null ? _networkName.hashCode() : 0); result = 31 * result + (_isL2Network ? 1 : 0); result = 31 * result + (_aclRules != null ? _aclRules.hashCode() : 0); result = 31 * result + (int) (_networkId ^ (_networkId >>> 32)); result = 31 * result + (_egressDefaultPolicy ? 1 : 0); result = 31 * result + (_acsIngressAcl != null ? _acsIngressAcl.hashCode() : 0); result = 31 * result + (_networkReset ? 1 : 0); result = 31 * result + (_domainTemplateName != null ? _domainTemplateName.hashCode() : 0); return result; }
Source:
<code>public void write( @Nonnull Writer writer, @Nonnull Server server, @Nonnull Query query, @Nonnull Iterable<Result> results) throws IOException { try ( JsonGenerator g = jsonFactory.createGenerator(writer); ) { g.useDefaultPrettyPrinter(); g.writeStartObject(); g.writeStringField("request", "sender data"); g.writeArrayFieldStart("data"); for (Result result : results) { log.debug("Query result: {}", result); <START> String zabbixHostName = server.getAlias() != null ? server.getAlias() : server.getHost(); <END> String key = "jmxtrans." + KeyUtils.getKeyString(query, result, typeNames); Object value = result.getValue(); g.writeStartObject(); g.writeStringField("host", zabbixHostName); g.writeStringField("key", key); g.writeStringField("value", value.toString()); g.writeNumberField("clock", result.getEpoch() / 1000); g.writeEndObject(); } g.writeEndArray(); g.writeNumberField("clock", System.currentTimeMillis() / 1000); g.writeEndObject(); g.flush(); } }</code><technical_language>This replaced Server.getLabel()</technical_language>

Target:
public void write( @Nonnull Writer writer, @Nonnull Server server, @Nonnull Query query, @Nonnull Iterable<Result> results) throws IOException { try ( JsonGenerator g = jsonFactory.createGenerator(writer); ) { g.useDefaultPrettyPrinter(); g.writeStartObject(); g.writeStringField("request", "sender data"); g.writeArrayFieldStart("data"); for (Result result : results) { log.debug("Query result: {}", result); String key = "jmxtrans." + KeyUtils.getKeyString(query, result, typeNames); Object value = result.getValue(); g.writeStartObject(); g.writeStringField("host", server.getLabel()); g.writeStringField("key", key); g.writeStringField("value", value.toString()); g.writeNumberField("clock", result.getEpoch() / 1000); g.writeEndObject(); } g.writeEndArray(); g.writeNumberField("clock", System.currentTimeMillis() / 1000); g.writeEndObject(); g.flush(); } }
Source:
<code>public MatchFilter[] getActiveMatchFilters() { MatchFilter[] result = super.getActiveMatchFilters(); if (result == null) { List<MatchFilter> filters = new ArrayList<>(); if (CUIPlugin.getDefault().getDialogSettings().getBoolean(KEY_SHOW_POLYMORPHIC_CALLS)) { filters.add(HidePolymorphicCalls.FILTER); } if (CUIPlugin.getDefault().getDialogSettings().getBoolean(KEY_HIDE_READ_ONLY_REFERENCES)) { filters.add(HideReadWriteReferences.READ_ONLY_FILTER); } if (CUIPlugin.getDefault().getDialogSettings().getBoolean(KEY_HIDE_WRITE_REFERENCES)) { filters.add(HideReadWriteReferences.WRITE_FILTER); } <START> return filters.toArray(new MatchFilter[0]); <END> } return result; }</code><technical_language>0 -> filters.size()</technical_language>

Target:
public MatchFilter[] getActiveMatchFilters() { MatchFilter[] result = super.getActiveMatchFilters(); if (result == null) { List<MatchFilter> filters = new ArrayList<>(); if (CUIPlugin.getDefault().getDialogSettings().getBoolean(KEY_SHOW_POLYMORPHIC_CALLS)) { filters.add(HidePolymorphicCalls.FILTER); } if (CUIPlugin.getDefault().getDialogSettings().getBoolean(KEY_HIDE_READ_ONLY_REFERENCES)) { filters.add(HideReadOnlyReferences.READ_ONLY_FILTER); } return filters.toArray(new MatchFilter[filters.size()]); } return result; }
Source:
<code>private NearbyPage constructNearbyPage(@NonNull String title, double lat, double lon) { Location location = new <START> Location(title); <END> location.setLatitude(lat); location.setLongitude(lon); return new NearbyPage(location); }</code><technical_language>typing is permissive, I this is supposed a location provider GPS network</technical_language>

Target:
private NearbyPage constructNearbyPage(@NonNull String title, double lat, double lon) { Location location = new Location(""); location.setLatitude(lat); location.setLongitude(lon); return new NearbyPage(title, location); }
Source:
<code>public void addInteraction(final IMockInteraction interaction) { interactions.add(new MockInteractionDecorator(interaction) { final int myRegistrationZone = currentRegistrationZone; @Override public Object accept(IMockInvocation invocation) { WrongInvocationOrderError wrongInvocationOrderError = null; if (currentExecutionZone > myRegistrationZone) { wrongInvocationOrderError = new WrongInvocationOrderError(decorated, invocation, previousInvocations); } currentExecutionZone = myRegistrationZone; if (previousInvocations.size() == MAX_PREVIOUS_INVOCATIONS) { <START> previousInvocations.remove(); <END> } previousInvocations.add(invocation); Object result = null; Throwable invocationException = null; try { result = super.accept(invocation); } catch (AssertionError | Exception e) { invocationException = e; } ExceptionUtil.throwWithSuppressed(invocationException, wrongInvocationOrderError); return result; } @Override public String describeMismatch(IMockInvocation invocation) { return interaction.describeMismatch(invocation); } }); }</code><technical_language>If addFirst removeLast instead get reverse order out of box, if change name previousInvocationsInReverseOrder for confusion</technical_language>

Target:
public void addInteraction(final IMockInteraction interaction) { interactions.add(new MockInteractionDecorator(interaction) { final int myRegistrationZone = currentRegistrationZone; @Override public Object accept(IMockInvocation invocation) { WrongInvocationOrderError wrongInvocationOrderError = null; if (currentExecutionZone > myRegistrationZone) { wrongInvocationOrderError = new WrongInvocationOrderError(decorated, invocation, previousInvocationsInReverseOrder); } currentExecutionZone = myRegistrationZone; if (previousInvocationsInReverseOrder.size() == MAX_PREVIOUS_INVOCATIONS) { previousInvocationsInReverseOrder.removeLast(); } previousInvocationsInReverseOrder.addFirst(invocation); Object result = null; Throwable invocationException = null; try { result = super.accept(invocation); } catch (AssertionError | Exception e) { invocationException = e; } ExceptionUtil.throwWithSuppressed(invocationException, wrongInvocationOrderError); return result; } @Override public String describeMismatch(IMockInvocation invocation) { return interaction.describeMismatch(invocation); } }); }
Source:
<code>private CoreEvent getRetryExhaustedEvent(CoreEvent exhaustionCauseEvent, Throwable retryExhaustedException) { ErrorBuilder errorBuilder = ErrorBuilder.builder(retryExhaustedException) <START> .errorType(errorTypeLocator.lookupErrorType(retryExhaustedException)); <END> exhaustionCauseEvent.getError().ifPresent(error -> errorBuilder.errors(Collections.singletonList(error))); return CoreEvent.builder(exhaustionCauseEvent).error(errorBuilder.build()).build(); }</code><technical_language>result of errorTypeLocator.lookupErrorType(retryExhaustedException) initialization , avoid lookup fir handled error</technical_language>

Target:
private CoreEvent getRetryExhaustedEvent(CoreEvent exhaustionCauseEvent, Throwable retryExhaustedException) { ErrorBuilder errorBuilder = ErrorBuilder.builder(retryExhaustedException) .errorType(retryExhaustedErrorType); return CoreEvent.builder(exhaustionCauseEvent).error(errorBuilder.build()).build(); }
Source:
<code>public ScriptExecutionException(String causeMessage) { <START> super(ERROR_CODE, new RuntimeException(causeMessage)); <END> }</code><technical_language>generate a stack trace for this line, confusing. Store causeMessage in field instead. (And store cause.getLocalizedMessage() in field in other constructor)</technical_language>

Target:
public ScriptExecutionException(String causeMessage) { super(ERROR_CODE); this.causeMessage = requireNonNull(causeMessage); }
Source:
<code>protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { ITmfTrace trace = checkNotNull(getTrace()); final @Nullable String dataFileName = getDataFileName(); if (dataFileName != null) { String dir = TmfTraceManager.getSupplementaryFileDir(trace); final Path file = Paths.get(dir, dataFileName); if (Files.exists(file)) { try (ObjectInputStream ois = new ObjectInputStream(Files.newInputStream(file))) { Object[] segmentArray = readObject(ois); final ISegmentStore<ISegment> store = new ArrayListStore<>(); for (Object element : segmentArray) { if (element instanceof ISegment) { ISegment segment = (ISegment) element; store.add(segment); } } fSegmentStore = store; sendUpdate(store); return true; } catch (IOException | ClassNotFoundException | ClassCastException e) { try { Files.delete(file); } catch (IOException e1) { } } } } ISegmentStore<ISegment> segmentStore = new <START> TreeMapStore<>(); <END> boolean completed = buildAnalysisSegments(segmentStore, monitor); if (!completed) { return false; } fSegmentStore = segmentStore; if (dataFileName != null) { String dir = TmfTraceManager.getSupplementaryFileDir(trace); final Path file = Paths.get(dir, dataFileName); try (ObjectOutputStream oos = new ObjectOutputStream(Files.newOutputStream(file))) { oos.writeObject(segmentStore.toArray()); } catch (IOException e) { } } sendUpdate(segmentStore); return true; }</code><technical_language>ArrayListStore</technical_language>

Target:
protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { ITmfTrace trace = checkNotNull(getTrace()); final @Nullable String dataFileName = getDataFileName(); if (dataFileName != null) { String dir = TmfTraceManager.getSupplementaryFileDir(trace); final Path file = Paths.get(dir, dataFileName); if (Files.exists(file)) { try (ObjectInputStream ois = new ObjectInputStream(Files.newInputStream(file))) { Object[] segmentArray = readObject(ois); final ISegmentStore<ISegment> store = new ArrayListStore<>(); for (Object element : segmentArray) { if (element instanceof ISegment) { ISegment segment = (ISegment) element; store.add(segment); } } fSegmentStore = store; sendUpdate(store); return true; } catch (IOException | ClassNotFoundException | ClassCastException e) { try { Files.delete(file); } catch (IOException e1) { } } } } ISegmentStore<ISegment> segmentStore = new ArrayListStore<>(); boolean completed = buildAnalysisSegments(segmentStore, monitor); if (!completed) { return false; } fSegmentStore = segmentStore; if (dataFileName != null) { String dir = TmfTraceManager.getSupplementaryFileDir(trace); final Path file = Paths.get(dir, dataFileName); try (ObjectOutputStream oos = new ObjectOutputStream(Files.newOutputStream(file))) { oos.writeObject(segmentStore.toArray()); } catch (IOException e) { } } sendUpdate(segmentStore); return true; }
Source:
<code>@Test public void testFilterAndProjectWithMultiJoin() throws Exception { final FilterMultiJoinMergeRule filterMultiJoinMergeRule = new FilterMultiJoinMergeRule(LogicalFilter.class, RelFactories.LOGICAL_BUILDER); final ProjectMultiJoinMergeRule projectMultiJoinMergeRule = <START> new ProjectMultiJoinMergeRule(LogicalProject.class, RelFactories.LOGICAL_BUILDER); <END> HepProgram program = new HepProgramBuilder() .addMatchOrder(HepMatchOrder.BOTTOM_UP) .addRuleInstance(JoinToMultiJoinRule.INSTANCE) .addRuleCollection(Arrays.asList(filterMultiJoinMergeRule, projectMultiJoinMergeRule)) .build(); checkPlanning(program, "select * from (select * from emp e1 left outer join dept d on e1.deptno = d.deptno " + "where d.deptno > 3) where ename LIKE 'bar'"); }</code><technical_language>Well, LogicalProject default class, this test validate new. duplicate existing tests</technical_language>

Target:
@Test public void testFilterAndProjectWithMultiJoin() throws Exception { final Tester tester = new TesterImpl(getDiffRepos(), false, false, true, false, null, null, SqlToRelConverter.Config.DEFAULT, SqlConformanceEnum.DEFAULT, Contexts.empty()); final HepProgram preProgram = new HepProgramBuilder() .addMatchOrder(HepMatchOrder.BOTTOM_UP) .addRuleCollection(Arrays.asList(MyFilterRule.INSTANCE, MyProjectRule.INSTANCE)) .build(); final FilterMultiJoinMergeRule filterMultiJoinMergeRule = new FilterMultiJoinMergeRule(MyFilter.class, RelFactories.LOGICAL_BUILDER); final ProjectMultiJoinMergeRule projectMultiJoinMergeRule = new ProjectMultiJoinMergeRule(MyProject.class, RelFactories.LOGICAL_BUILDER); HepProgram program = new HepProgramBuilder() .addMatchOrder(HepMatchOrder.BOTTOM_UP) .addRuleInstance(JoinToMultiJoinRule.INSTANCE) .addRuleCollection(Arrays.asList(filterMultiJoinMergeRule, projectMultiJoinMergeRule)) .build(); checkPlanning(tester, preProgram, new HepPlanner(program), "select * from (select * from emp e1 left outer join dept d on e1.deptno = d.deptno " + "where d.deptno > 3)", false); }
Source:
<code><START> @Override public List<List<String>> lemmatize(List<String> toks, <END> List<String> tags) { return null; }</code><technical_language>Style issue: @Override shuld line method declaration</technical_language>

Target:
public List<List<String>> lemmatize(List<String> toks, List<String> tags) { return null; }
Source:
<code>private VariantSourceEntity getVariantSourceEntity() throws Exception { VariantStudy.StudyType studyType = VariantStudy.StudyType.COLLECTION; <START> VariantSource.Aggregation aggregation = VariantSource.Aggregation.NONE; <END> VcfHeaderReader headerReader = new VcfHeaderReader(new File(input), FILE_ID, STUDY_ID, STUDY_NAME, studyType, aggregation); return headerReader.read(); }</code><technical_language>rest of fields class attributes</technical_language>

Target:
private VariantSourceEntity getVariantSourceEntity() throws Exception { VcfHeaderReader headerReader = new VcfHeaderReader(new File(input), FILE_ID, STUDY_ID, STUDY_NAME, STUDY_TYPE, AGGREGATION); return headerReader.read(); }
Source:
<code>public void generateRandomAlphanumeric(String key) { <START> if (!propertyStore.contains(key)) { <END> propertyStore.put(key, RandomGenerator.generateRandomAlphanumeric(16)); } }</code><technical_language>want do this? I run this if want change random string stored a property</technical_language>

Target:
public void generateRandomAlphanumeric(String key) { propertyStore.put(key, RandomGenerator.generateRandomAlphanumeric(16)); }
Source:
<code>public List<FailureInfo> getAllFailures(QueryGroup group) { return failures.get(group).stream() .map(exception -> new FailureInfo( exception.getQueryOrigin().getStage(), exception.getErrorCode(), <START> exception.getQueryStats().map(QueryStats::getQueryId))) <END> .collect(toImmutableList()); }</code><technical_language>QueryException is generated for Cluster connection issues: public static QueryException forClusterConnection(Throwable cause) { return new QueryException(cause, CLUSTER_CONNECTION, Optional.empty(), true, Optional.empty()); } error code is empty. in this situation, for cluster connection issues - essentially pass in empty error code information happened. serialize return QueryException object</technical_language>

Target:
public List<FailureInfo> getAllFailures(QueryGroup group) { return failures.get(group).stream() .map(exception -> new FailureInfo( exception.getQueryOrigin().getStage(), exception.getErrorCode(), exception.getQueryStats().map(QueryStats::getQueryId), getStackTraceAsString(exception))) .collect(toImmutableList()); }
Source:
<code>private Iterator<Map.Entry<byte[], RowColumnRangeIterator>> partitionByRow(RowColumnRangeIterator rawResults) { PeekingIterator<Map.Entry<Cell, Value>> peekableRawResults = Iterators.peekingIterator(rawResults); return new AbstractIterator<Map.Entry<byte[], RowColumnRangeIterator>>() { byte[] prevRowName; @Override protected Map.Entry<byte[], RowColumnRangeIterator> computeNext() { finishConsumingPreviousRow(peekableRawResults); if (!peekableRawResults.hasNext()) { return endOfData(); } byte[] nextRowName = peekableRawResults.peek().getKey().getRowName(); Iterator<Map.Entry<Cell, Value>> columnsIterator = new AbstractIterator<Map.Entry<Cell, Value>>() { @Override protected Map.Entry<Cell, Value> computeNext() { if (!peekableRawResults.hasNext() || !Arrays.equals(peekableRawResults.peek().getKey().getRowName(), nextRowName)) { return endOfData(); } return peekableRawResults.next(); } }; prevRowName = nextRowName; return Maps.immutableEntry(nextRowName, new LocalRowColumnRangeIterator(columnsIterator)); } private void finishConsumingPreviousRow(PeekingIterator<Map.Entry<Cell, Value>> iter) { int numConsumed = 0; while (iter.hasNext() && Arrays.equals(iter.peek().getKey().getRowName(), prevRowName)) { iter.next(); numConsumed++; } if (numConsumed > 0) { log.warn("Not all columns for row were read. columns were discarded.", UnsafeArg.of("row", Arrays.toString(prevRowName)), <START> SafeArg.of("numColumnDiscarded", numConsumed)); <END> } } }; }</code><technical_language>numColumnsDiscarded cleaner. "consumed" is a bit of a weird word for "discarded" in this method</technical_language>

Target:
private Iterator<Map.Entry<byte[], RowColumnRangeIterator>> partitionByRow(RowColumnRangeIterator rawResults) { PeekingIterator<Map.Entry<Cell, Value>> peekableRawResults = Iterators.peekingIterator(rawResults); return new AbstractIterator<Map.Entry<byte[], RowColumnRangeIterator>>() { byte[] prevRowName; @Override protected Map.Entry<byte[], RowColumnRangeIterator> computeNext() { finishConsumingPreviousRow(peekableRawResults); if (!peekableRawResults.hasNext()) { return endOfData(); } byte[] nextRowName = peekableRawResults.peek().getKey().getRowName(); Iterator<Map.Entry<Cell, Value>> columnsIterator = new AbstractIterator<Map.Entry<Cell, Value>>() { @Override protected Map.Entry<Cell, Value> computeNext() { if (!peekableRawResults.hasNext() || !Arrays.equals(peekableRawResults.peek().getKey().getRowName(), nextRowName)) { return endOfData(); } return peekableRawResults.next(); } }; prevRowName = nextRowName; return Maps.immutableEntry(nextRowName, new LocalRowColumnRangeIterator(columnsIterator)); } private void finishConsumingPreviousRow(PeekingIterator<Map.Entry<Cell, Value>> iter) { int numConsumed = 0; while (iter.hasNext() && Arrays.equals(iter.peek().getKey().getRowName(), prevRowName)) { iter.next(); numConsumed++; } if (numConsumed > 0) { log.warn("Not all columns for row were read. columns were discarded.", UnsafeArg.of("row", Arrays.toString(prevRowName)), SafeArg.of("numColumnsDiscarded", numConsumed)); } } }; }
Source:
<code>public void get(String url, boolean isForceRefresh) throws WebDriverException { if (isTestChromeDriver) { if (!url.equalsIgnoreCase(GitHubURL.LOGIN_PAGE)) { UI.events.triggerEvent(new NavigateToPageEvent(url)); } logger.info("Test loading page: " + url); testGet(); } else { <START> if (!isForceRefresh && (driver.getCurrentUrl().equalsIgnoreCase(url))) { <END> logger.info("Already on page: " + url + " will not load it again. "); } else { logger.info("Previous page was: " + driver.getCurrentUrl()); logger.info("Loading page: " + url); driver.get(url); } } }</code><technical_language>a test covers browser action. Changing this a lot of trouble, exhaustively test browser action. need change implementation this stay is</technical_language>

Target:
public void get(String url, boolean isForceRefresh) throws WebDriverException { if (isTestChromeDriver) { if (!url.equalsIgnoreCase(GitHubURL.LOGIN_PAGE)) { UI.events.triggerEvent(new NavigateToPageEvent(url)); } logger.info("Test loading page: " + url); testGet(); } else { if (!isForceRefresh && driver.getCurrentUrl().equalsIgnoreCase(url)) { logger.info("Already on page: " + url + " will not load it again. "); } else { logger.info("Previous page was: " + driver.getCurrentUrl()); logger.info("Loading page: " + url); driver.get(url); } } }
Source:
<code>protected boolean isContainerIsAFormOrAGroup(final EObject element) { if (element != null && element instanceof Group) { return isContainerIsAFormOrAGroup(element.eContainer()); } else { <START> return element != null && element instanceof Form; <END> } }</code><technical_language>element != null is useless</technical_language>

Target:
protected boolean isContainerIsAFormOrAGroup(final EObject element) { if (element instanceof Group) { return isContainerIsAFormOrAGroup(element.eContainer()); } else { return element instanceof Form; } }
Source:
<code>private LinkedHashSet<String> toLinkedHashSet(String... scope) { <START> final LinkedHashSet<String> result = new LinkedHashSet<>(); <END> Collections.addAll(result, scope); return result; }</code><technical_language>conform other Spring Security code, please remove final keyword in front of local variables</technical_language>

Target:
private LinkedHashSet<String> toLinkedHashSet(String... scope) { LinkedHashSet<String> result = new LinkedHashSet<>(); Collections.addAll(result, scope); return result; }
Source:
<code>public static Response call( String masterUrl, OkHttpClient httpClient, String httpMethod, URI relativeUri, @Nullable HttpHeaders headers, @Nullable InputStream body) throws InfrastructureException { if (relativeUri.isAbsolute() || relativeUri.isOpaque()) { throw new InfrastructureException( "The direct infrastructure URL must be relative and not opaque."); } try { URI fullUrl = new URI(masterUrl).resolve(relativeUri); javax.ws.rs.core.MediaType mediaTypeHeader = headers.getMediaType(); String mediaType = <START> mediaTypeHeader == null ? "application/json;charset=utf-8" : mediaTypeHeader.toString(); <END> RequestBody requestBody = body == null ? null : new InputStreamBasedRequestBody(body, mediaType); Call httpCall = httpClient.newCall( new Request.Builder() .url(fullUrl.toURL()) .method(httpMethod, requestBody) .headers(toOkHttpHeaders(headers)) .build()); okhttp3.Response response = httpCall.execute(); Response.ResponseBuilder bld = Response.status(response.code()); for (int i = 0; i < response.headers().size(); ++i) { String name = response.headers().name(i); String value = response.headers().value(i); bld.header(name, value); } ResponseBody responseBody = response.body(); if (responseBody != null) { bld.entity(responseBody.byteStream()); MediaType contentType = responseBody.contentType(); if (contentType != null) { bld.type(contentType.toString()); } } return bld.build(); } catch (URISyntaxException | MalformedURLException e) { throw new InfrastructureException("Could not compose the direct URI.", e); } catch (IOException e) { throw new InfrastructureException("Error sending the direct infrastructure request.", e); } }</code><technical_language>Do need convert headers string in constructor called next line</technical_language>

Target:
public static Response call( String masterUrl, OkHttpClient httpClient, String httpMethod, URI relativeUri, @Nullable HttpHeaders headers, @Nullable InputStream body) throws InfrastructureException { if (relativeUri.isAbsolute() || relativeUri.isOpaque()) { throw new InfrastructureException( "The direct infrastructure URL must be relative and not opaque."); } try { URL fullUrl = new URI(masterUrl).resolve(relativeUri).toURL(); okhttp3.Response response = callApi(httpClient, fullUrl, httpMethod, headers, body); return convertResponse(response); } catch (URISyntaxException | MalformedURLException e) { throw new InfrastructureException("Could not compose the direct URI.", e); } catch (IOException e) { throw new InfrastructureException("Error sending the direct infrastructure request.", e); } }