auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Result apply(AggregationNode aggregation, Captures captures, Context context) { Assignments.Builder newAssignments = Assignments.builder(); ImmutableMap.Builder<Symbol, Aggregation> aggregations = ImmutableMap.builder(); for (Map.Entry<Symbol, Aggregation> entry : aggregation.getAggregations().entrySet()) { Symbol output = entry.getKey(); FunctionCall call = entry.getValue().getCall(); Optional<Symbol> mask = entry.getValue().getMask(); if (call.getFilter().isPresent()) { Expression filter = call.getFilter().get(); Symbol symbol = context.getSymbolAllocator().newSymbol(filter, BOOLEAN); <START> if (mask.isPresent()) { <END> filter = ExpressionUtils.and(filter, mask.get().toSymbolReference()); } newAssignments.put(symbol, filter); mask = Optional.of(symbol); } aggregations.put(output, new Aggregation( new FunctionCall(call.getName(), call.getWindow(), Optional.empty(), call.getOrderBy(), call.isDistinct(), call.getArguments()), entry.getValue().getSignature(), mask)); } newAssignments.putIdentities(aggregation.getSource().getOutputSymbols()); return Result.ofPlanNode( new AggregationNode( context.getIdAllocator().getNextId(), new ProjectNode( context.getIdAllocator().getNextId(), aggregation.getSource(), newAssignments.build()), aggregations.build(), aggregation.getGroupingSets(), aggregation.getStep(), aggregation.getHashSymbol(), aggregation.getGroupIdSymbol())); }</code><technical_language>remove, dead code</technical_language>

Target:
public Result apply(AggregationNode aggregation, Captures captures, Context context) { Assignments.Builder newAssignments = Assignments.builder(); ImmutableMap.Builder<Symbol, Aggregation> aggregations = ImmutableMap.builder(); for (Map.Entry<Symbol, Aggregation> entry : aggregation.getAggregations().entrySet()) { Symbol output = entry.getKey(); FunctionCall call = entry.getValue().getCall(); Optional<Symbol> mask = entry.getValue().getMask(); if (call.getFilter().isPresent()) { Expression filter = call.getFilter().get(); Symbol symbol = context.getSymbolAllocator().newSymbol(filter, BOOLEAN); verify(!mask.isPresent(), "Expected aggregation without mask symbols, see Rule pattern"); newAssignments.put(symbol, filter); mask = Optional.of(symbol); } aggregations.put(output, new Aggregation( new FunctionCall(call.getName(), call.getWindow(), Optional.empty(), call.getOrderBy(), call.isDistinct(), call.getArguments()), entry.getValue().getSignature(), mask)); } newAssignments.putIdentities(aggregation.getSource().getOutputSymbols()); return Result.ofPlanNode( new AggregationNode( context.getIdAllocator().getNextId(), new ProjectNode( context.getIdAllocator().getNextId(), aggregation.getSource(), newAssignments.build()), aggregations.build(), aggregation.getGroupingSets(), aggregation.getStep(), aggregation.getHashSymbol(), aggregation.getGroupIdSymbol())); }
Source:
<code>private boolean detectDuplicates(final Entity entity) throws EntityStorageException { boolean hasDuplicate = false; if (duplicateDataDetector.isDetectionEnabled()) { if (mongoTypeStorage == null) { mongoTypeStorage = new MongoTypeStorage(mongo, ryaInstanceName); } final Builder builder = new Builder(); builder.setSubject(entity.getSubject()); boolean abort = false; for (final RyaURI typeRyaUri : entity.getExplicitTypeIds()) { Optional<Type> type; try { type = mongoTypeStorage.get(typeRyaUri); } catch (final TypeStorageException e) { throw new EntityStorageException("Unable to get entity type: " + typeRyaUri, e); } if (type.isPresent()) { final ConvertingCursor<TypedEntity> cursor = search(Optional.empty(), type.get(), Collections.emptySet()); <START> while (cursor.hasNext()) { <END> final TypedEntity typedEntity = cursor.next(); builder.setExplicitType(typeRyaUri); for (final Property property : typedEntity.getProperties()) { builder.setProperty(typeRyaUri, property); } } } else { abort = true; break; } } if (!abort) { final Entity entity2 = builder.build(); try { hasDuplicate = duplicateDataDetector.compareEntities(entity, entity2); } catch (final SmartUriException e) { throw new EntityStorageException("Encountered an error while comparing entities.", e); } } } return hasDuplicate; }</code><technical_language>Entity Builder here. primarily convert TypedEntity returned in this loop Entity. If is case, creating a new Builder for TypedEntity duplicate comparison this loop. is currently written, overwriting properties iterate TypedEntities</technical_language>

Target:
private boolean detectDuplicates(final Entity entity) throws EntityStorageException { boolean hasDuplicate = false; if (duplicateDataDetector.isDetectionEnabled()) { final List<Entity> comparisonEntities = searchHasAllExplicitTypes(entity.getExplicitTypeIds()); for (final Entity compareEntity : comparisonEntities) { try { hasDuplicate = duplicateDataDetector.compareEntities(entity, compareEntity); } catch (final SmartUriException e) { throw new EntityStorageException("Encountered an error while comparing entities.", e); } if (hasDuplicate) { break; } } } return hasDuplicate; }
Source:
<code>synchronized public void scheduleAfterDebounceTime(String actionName, long debounceTimeMs, Runnable runnable) { ScheduledFuture sf = futureHandles.get(actionName); if (sf != null && !sf.isDone()) { LOGGER.info("cancel future for " + actionName); if (!sf.cancel(false)) { try { sf.get(TIMEOUT_MS, TimeUnit.MILLISECONDS); } catch (Exception e) { LOGGER.warn("cancel for action " + actionName + " failed with ", e); } } futureHandles.remove(actionName); } sf = scheduledExecutorService.schedule(() -> { try { runnable.run(); LOGGER.debug(actionName + " completed successfully."); <START> } catch (Exception e) { <END> LOGGER.error(actionName + " threw an exception.", e); if (callback != null) { callback.onException(e); } } }, debounceTimeMs, TimeUnit.MILLISECONDS); LOGGER.info("scheduled " + actionName + " in " + debounceTimeMs); futureHandles.put(actionName, sf); }</code><technical_language>I need catch throwble here. if's a RuntimeException SamzaException thread killed notifying listener</technical_language>

Target:
synchronized public void scheduleAfterDebounceTime(String actionName, long debounceTimeMs, Runnable runnable) { ScheduledFuture sf = futureHandles.get(actionName); if (sf != null && !sf.isDone()) { LOG.info("cancel future for " + actionName); if (!sf.cancel(false)) { try { sf.get(TIMEOUT_MS, TimeUnit.MILLISECONDS); } catch (Exception e) { LOG.warn("cancel for action " + actionName + " failed with ", e); } } futureHandles.remove(actionName); } sf = scheduledExecutorService.schedule(() -> { try { runnable.run(); LOG.debug(actionName + " completed successfully."); } catch (Throwable t) { LOG.error(actionName + " threw an exception.", t); if (scheduledTaskFailureCallback != null) { scheduledTaskFailureCallback.onError(t); } } }, debounceTimeMs, TimeUnit.MILLISECONDS); LOG.info("scheduled " + actionName + " in " + debounceTimeMs); futureHandles.put(actionName, sf); }
Source:
<code>public void updateSubscriptions() { if (!myMdmSettings.isEnabled()) { return; } myMdmProviderLoader.loadProvider(); ourLog.info("MDM provider registered"); myMdmSubscriptionLoader.daoUpdateMdmSubscriptions(); ourLog.info("MDM subscriptions updated"); <START> myMdmSearchParameterLoader.daoUpdateMdmSearchParameters(); <END> ourLog.info("MDM search parameters updated"); }</code><technical_language>removed</technical_language>

Target:
public void updateSubscriptions() { if (!myMdmSettings.isEnabled()) { return; } myMdmProviderLoader.loadProvider(); ourLog.info("MDM provider registered"); myMdmSubscriptionLoader.daoUpdateMdmSubscriptions(); ourLog.info("MDM subscriptions updated"); }
Source:
<code>static private List<BlackboardArtifact> createListFromMap(SortedMap<BlackboardAttribute, List<BlackboardArtifact>> sortedMap, int maxCount) { List<BlackboardArtifact> artifactList = new ArrayList<>(); for (List<BlackboardArtifact> mapArtifactList : sortedMap.values()) { <START> if (maxCount == artifactList.size()) { <END> break; } if (maxCount == 0 || (artifactList.size() + mapArtifactList.size()) <= maxCount) { artifactList.addAll(mapArtifactList); continue; } for (BlackboardArtifact artifact : mapArtifactList) { if (artifactList.size() < maxCount) { artifactList.add(artifact); } else { break; } } } return artifactList; }</code><technical_language>I intent is if maxCount is zero, return records. this line records returned in event</technical_language>

Target:
static private List<BlackboardArtifact> createListFromMap(SortedMap<BlackboardAttribute, List<BlackboardArtifact>> sortedMap, int maxCount) { List<BlackboardArtifact> artifactList = new ArrayList<>(); for (List<BlackboardArtifact> mapArtifactList : sortedMap.values()) { if (maxCount == 0 || (artifactList.size() + mapArtifactList.size()) <= maxCount) { artifactList.addAll(mapArtifactList); continue; } if (maxCount == artifactList.size()) { break; } for (BlackboardArtifact artifact : mapArtifactList) { if (artifactList.size() < maxCount) { artifactList.add(artifact); } else { break; } } } return artifactList; }
Source:
<code>public void close() { <START> zk.close(); <END> }</code><technical_language>rpcClient.close()</technical_language>

Target:
public void close() { rpcClient.close(); zk.close(); }
Source:
<code>public boolean delete(@NonNull Disposable disposable) { <START> ObjectHelper.requireNonNull(disposable, "Disposable item is null"); <END> if (disposed) { return false; } synchronized (this) { if (disposed) { return false; } OpenHashSet<Disposable> set = resources; if (set == null || !set.remove(disposable)) { return false; } } return true; }</code><technical_language>disposable is null</technical_language>

Target:
public boolean delete(@NonNull Disposable disposable) { ObjectHelper.requireNonNull(disposable, "disposables is null"); if (disposed) { return false; } synchronized (this) { if (disposed) { return false; } OpenHashSet<Disposable> set = resources; if (set == null || !set.remove(disposable)) { return false; } } return true; }
Source:
<code>public long getLength() throws IOException { try { URI uri = new URI(encodeUriParts(getSourcePath())); if (channel == null || channel.isClosed()) { channel = getSessionForHost(uri).openChannel("sftp"); channel.connect(); } ChannelSftp sftpChannel = (ChannelSftp) channel; SftpATTRS stats = sftpChannel.lstat(decodeUriParts(uri.getRawPath())); return stats.getSize(); } catch (URISyntaxException ex) { throw new IOException("Error parsing URL", ex); } catch (SftpException ex) { throw new IOException("Error getting file stats", ex); } catch (JSchException ex) { <START> throw new IOException("Error opening SFTP channel", ex); <END> } }</code><technical_language>log this properly too, I think. Errors in this class bubble inspected easily</technical_language>

Target:
public long getLength() throws IOException { try { URI uri = new URI(encodeUriParts(getSourcePath())); if (channel == null || channel.isClosed()) { channel = getSessionForHost(uri).openChannel("sftp"); channel.connect(); } ChannelSftp sftpChannel = (ChannelSftp) channel; SftpATTRS stats = sftpChannel.lstat(decodeUriParts(uri.getRawPath())); return stats.getSize(); } catch (URISyntaxException ex) { String msg = String.format("Bad URI format for %s", getSourcePath()); LOG.error(msg,ex); throw new IOException(msg,ex); } catch (SftpException ex) { LOG.error("Error with connection",ex); throw new IOException("Error with connection", ex); } catch (JSchException ex) { LOG.error("Error while retrieving file",ex); throw new IOException("Error retrieving file", ex); } }
Source:
<code>void updatePartitions(final Set<TopicPartition> newInputPartitions, final Function<TopicPartition, RecordQueue> recordQueueCreator) { <START> final Iterator<Map.Entry<TopicPartition, RecordQueue>> queuesIterator = partitionQueues.entrySet().iterator(); <END> final Set<TopicPartition> removedPartitions = new HashSet<>(); streamTime = RecordQueue.UNKNOWN; while (queuesIterator.hasNext()) { final Map.Entry<TopicPartition, RecordQueue> queueEntry = queuesIterator.next(); final TopicPartition topicPartition = queueEntry.getKey(); if (newInputPartitions.contains(topicPartition)) { newInputPartitions.remove(topicPartition); final long partitionTime = queueEntry.getValue().partitionTime(); if (streamTime < partitionTime) { streamTime = partitionTime; } } else { totalBuffered -= queueEntry.getValue().size(); queuesIterator.remove(); removedPartitions.add(topicPartition); } } for (final TopicPartition newInputPartition : newInputPartitions) { partitionQueues.put(newInputPartition, recordQueueCreator.apply(newInputPartition)); } nonEmptyQueuesByTime.removeIf(q -> removedPartitions.contains(q.partition())); allBuffered = allBuffered && newInputPartitions.isEmpty(); }</code><technical_language>nit: put iterator initialization closer start of while loop</technical_language>

Target:
void updatePartitions(final Set<TopicPartition> newInputPartitions, final Function<TopicPartition, RecordQueue> recordQueueCreator) { final Set<TopicPartition> removedPartitions = new HashSet<>(); final Iterator<Map.Entry<TopicPartition, RecordQueue>> queuesIterator = partitionQueues.entrySet().iterator(); while (queuesIterator.hasNext()) { final Map.Entry<TopicPartition, RecordQueue> queueEntry = queuesIterator.next(); final TopicPartition topicPartition = queueEntry.getKey(); if (!newInputPartitions.contains(topicPartition)) { totalBuffered -= queueEntry.getValue().size(); queuesIterator.remove(); removedPartitions.add(topicPartition); } newInputPartitions.remove(topicPartition); } for (final TopicPartition newInputPartition : newInputPartitions) { partitionQueues.put(newInputPartition, recordQueueCreator.apply(newInputPartition)); } nonEmptyQueuesByTime.removeIf(q -> removedPartitions.contains(q.partition())); allBuffered = allBuffered && newInputPartitions.isEmpty(); }
Source:
<code>public void tenant(WebContext ctx, String tenantId) { T tenant = find(getTenantClass(), tenantId); SaveHelper saveHelper = prepareSave(ctx).withAfterCreateURI("/tenant/${id}").withAfterSaveURI("/tenants"); saveHelper.withPreSaveHandler(isNew -> { <START> tenant.getTenantData().getPackageData().getUpgrades().clear(); <END> for (String upgrade : ctx.getParameters("upgrades")) { if (packages.getUpgrades("tenant").contains(upgrade)) { tenant.getTenantData().getPackageData().getUpgrades().add(upgrade); } } if (packages.getPackages("tenant").contains(ctx.get("package").asString())) { tenant.getTenantData().getPackageData().setPackage(ctx.get("package").asString()); } }); boolean requestHandled = saveHelper.saveEntity(tenant); if (!requestHandled) { validate(tenant); List<String> availableLanguages = ((TenantUserManager<?, ?, ?>) UserContext.get().getUserManager()).getAvailableLanguages(); List<BaseEntity<?>> possibleParentTenants = mixing.getDescriptor(getTenantClass()) .getMapper() .select(getTenantClass()) .orderAsc(Tenant.TENANT_DATA.inner(TenantData.NAME)) .queryList(); ctx.respondWith() .template("templates/biz/tenants/tenant-details.html.pasta", tenant, this, possibleParentTenants, availableLanguages, packages); } }</code><technical_language>add a loadFromContext PackageData - more place duplicating this code..</technical_language>

Target:
public void tenant(WebContext ctx, String tenantId) { T tenant = find(getTenantClass(), tenantId); SaveHelper saveHelper = prepareSave(ctx).withAfterCreateURI("/tenant/${id}").withAfterSaveURI("/tenants"); saveHelper.withPreSaveHandler(isNew -> { tenant.getTenantData().getPackageData().loadPackageAndUpgradesFromContext("tenant", ctx); }); boolean requestHandled = saveHelper.saveEntity(tenant); if (!requestHandled) { validate(tenant); List<String> availableLanguages = ((TenantUserManager<?, ?, ?>) UserContext.get().getUserManager()).getAvailableLanguages(); List<BaseEntity<?>> possibleParentTenants = mixing.getDescriptor(getTenantClass()) .getMapper() .select(getTenantClass()) .orderAsc(Tenant.TENANT_DATA.inner(TenantData.NAME)) .queryList(); ctx.respondWith() .template("templates/biz/tenants/tenant-details.html.pasta", tenant, this, possibleParentTenants, availableLanguages, packages); } }
Source:
<code>public void activate() { VDS vds = null; try { <START> if (log.isDebugEnabled()) { <END> log.debugFormat( "Trying to activate host {0} , meanwhile setting status to Unassigned meanwhile", getVdsId()); } vds = DbFacade.getInstance().getVdsDao().get(getVdsId()); VDSStatus newStatus = refreshCapabilities(new AtomicBoolean(), vds); if (log.isDebugEnabled()) { log.debugFormat( "Succeeded to refreshCapabilities for host {0} , new status will be {1} ", getVdsId(), newStatus); } } catch (java.lang.Exception e) { log.infoFormat("Failed to get VDS = {0} capabilities with error: {1}.", getVdsId(), e.getMessage()); log.infoFormat("Failed to activate VDS = {0}", getVdsId()); } finally { if (vds != null) { UpdateDynamicData(vds.getDynamicData()); monitoringStrategy.processHardwareCapabilities(vds); ResourceManager.getInstance().getEventListener().handleVdsVersion(vds.getId()); } } }</code><technical_language>^ remove this redundant check well</technical_language>

Target:
public void activate() { VDS vds = null; try { log.debugFormat( "Trying to activate host {0} , meanwhile setting status to Unassigned.", getVdsId()); vds = DbFacade.getInstance().getVdsDao().get(getVdsId()); VDSStatus newStatus = refreshCapabilities(new AtomicBoolean(), vds); if (log.isDebugEnabled()) { log.debugFormat( "Succeeded to refreshCapabilities for host {0} , new status will be {1} ", getVdsId(), newStatus); } } catch (java.lang.Exception e) { log.infoFormat("Failed to activate VDS = {0} with error: {1}.", getVdsId(), e.getMessage()); } finally { if (vds != null) { UpdateDynamicData(vds.getDynamicData()); monitoringStrategy.processHardwareCapabilities(vds); ResourceManager.getInstance().getEventListener().handleVdsVersion(vds.getId()); } } }
Source:
<code>public void file2url_shouldReturnNullIfFileIsNull() throws MalformedURLException { <START> Assert.assertNull(ModuleUtil.file2url(null)); <END> }</code><technical_language>please a static import for assertNull</technical_language>

Target:
public void file2url_shouldReturnNullIfFileIsNull() throws MalformedURLException { assertNull(ModuleUtil.file2url(null)); }
Source:
<code>public static void uploadEMX(String adminToken, String fileName) { URL resourceUrl = Resources.getResource(RestTestUtils.class, fileName); File file = null; try { file = new File(new URI(resourceUrl.toString()).getPath()); } catch (URISyntaxException e) { LOG.error(e.getMessage()); } <START> String importJobURLString = given().multiPart(file) <END> .param("file") .param("action", "ADD_UPDATE_EXISTING") .header(X_MOLGENIS_TOKEN, adminToken) .post("plugin/importwizard/importFile") .then() .extract() .asString(); String importJobURL = importJobURLString.substring(2, importJobURLString.length() - 1); LOG.info("############ " + importJobURL); Awaitility.await() .pollDelay(500, MILLISECONDS) .atMost(5, MINUTES) .until(() -> pollForStatus(adminToken, importJobURL), not(equalTo("RUNNING"))); LOG.info("Import completed"); }</code><technical_language>Rename stick convention: importJobUrlString --> importJobURLString</technical_language>

Target:
public static void uploadEMX(String adminToken, String fileName) { URL resourceUrl = Resources.getResource(RestTestUtils.class, fileName); File file = null; try { file = new File(new URI(resourceUrl.toString()).getPath()); } catch (URISyntaxException e) { LOG.error(e.getMessage()); } String importJobURLString = given().multiPart(file) .param("file") .param("action", "ADD_UPDATE_EXISTING") .header(X_MOLGENIS_TOKEN, adminToken) .post("plugin/importwizard/importFile") .then() .extract() .asString(); String importJobURL = importJobURLString.substring(2, importJobURLString.length() - 1); LOG.info("############ " + importJobURL); await().pollDelay(500, MILLISECONDS) .atMost(5, MINUTES) .until(() -> pollForStatus(adminToken, importJobURL), not(equalTo("RUNNING"))); LOG.info("Import completed"); }
Source:
<code>private Optional<Map<Integer, Integer>> fitNodes(int vmNumaNodeIndex, Map<Integer, Long> hostNodeFreeMem) { if (vmNumaNodeIndex >= vmNodes.size()) { return Optional.of(new HashMap<>(vmNodes.size())); } VmNumaNode vmNode = vmNodes.get(vmNumaNodeIndex); if (vmNode.getVdsNumaNodeList().isEmpty()) { return <START> fitNodes( <END> vmNumaNodeIndex + 1, hostNodeFreeMem); } for (Integer pinnedIndex: vmNode.getVdsNumaNodeList()) { long hostFreeMem = hostNodeFreeMem.get(pinnedIndex); List<Integer> hostNodeCpus = hostNodeCpuMap.get(pinnedIndex); if (!vmNodeFitsHostNode(vmNode, hostFreeMem, hostNodeCpus)) { continue; } hostNodeFreeMem.put(pinnedIndex, hostFreeMem - vmNode.getMemTotal()); Optional<Map<Integer, Integer>> othersFit = fitNodes(vmNumaNodeIndex + 1, hostNodeFreeMem); if (othersFit.isPresent()) { othersFit.get().put(vmNode.getIndex(), pinnedIndex); return othersFit; } hostNodeFreeMem.put(pinnedIndex, hostFreeMem); } return Optional.empty(); }</code><technical_language>remove space</technical_language>

Target:
private Optional<Map<Integer, Integer>> fitNodes(int vmNumaNodeIndex, Map<Integer, Long> hostNodeFreeMem) { if (vmNumaNodeIndex >= vmNodes.size()) { return Optional.of(new HashMap<>(vmNodes.size())); } VmNumaNode vmNode = vmNodes.get(vmNumaNodeIndex); if (vmNode.getVdsNumaNodeList().isEmpty()) { return fitNodes(vmNumaNodeIndex + 1, hostNodeFreeMem); } for (Integer pinnedIndex: vmNode.getVdsNumaNodeList()) { long hostFreeMem = hostNodeFreeMem.get(pinnedIndex); if (hostFreeMem < vmNode.getMemTotal()) { failedOnMemory = true; continue; } List<Integer> hostNodeCpus = hostNodeCpuMap.get(pinnedIndex); if (!vmNodeFitsHostNodeCpuPinning(vmNode, hostNodeCpus)) { failedOnCpuPinning = true; continue; } hostNodeFreeMem.put(pinnedIndex, hostFreeMem - vmNode.getMemTotal()); Optional<Map<Integer, Integer>> othersFit = fitNodes(vmNumaNodeIndex + 1, hostNodeFreeMem); if (othersFit.isPresent()) { othersFit.get().put(vmNode.getIndex(), pinnedIndex); return othersFit; } hostNodeFreeMem.put(pinnedIndex, hostFreeMem); } return Optional.empty(); }
Source:
<code>private void addDomainProvider(DomainProvider provider, DefaultMutableTreeNode node) { String providerName = provider.getName().getString(getSession().getLocale()); DefaultMutableTreeNode providerNode = new DefaultMutableTreeNode(providerName); node.add(providerNode); ServiceId domainProviderServiceId = new ServiceId(); <START> domainProviderServiceId.setServiceId(DOMAINSTRING + providerName + "]"); <END> availableDomains.put(provider.getDomainInterface().getName(), provider.getDomainInterface()); domainProviderServiceId.setServiceClass(provider.getDomainInterface().getName()); DefaultMutableTreeNode endPointReferenceNode = new DefaultMutableTreeNode(domainProviderServiceId, false); providerNode.add(endPointReferenceNode); for (ServiceReference serviceReference : services.serviceReferencesForDomain(provider.getDomainInterface())) { String id = (String) serviceReference.getProperty("id"); if (id != null) { ServiceId serviceId = new ServiceId(); serviceId.setServiceId(id); serviceId.setServiceClass(provider.getDomainInterface().getName()); DefaultMutableTreeNode referenceNode = new DefaultMutableTreeNode(serviceId, false); providerNode.add(referenceNode); } } }</code><technical_language>String.format extract constant (including closing ])</technical_language>

Target:
private void addDomainProvider(DomainProvider provider, DefaultMutableTreeNode node) { String providerName = provider.getName().getString(getSession().getLocale()); DefaultMutableTreeNode providerNode = new DefaultMutableTreeNode(providerName); node.add(providerNode); ServiceId domainProviderServiceId = new ServiceId(); String name = String.format(DOMAINSTRING, providerName); domainProviderServiceId.setServiceId(name); availableDomains.put(name, provider); domainProviderServiceId.setServiceClass(provider.getDomainInterface().getName()); DefaultMutableTreeNode endPointReferenceNode = new DefaultMutableTreeNode(domainProviderServiceId, false); providerNode.add(endPointReferenceNode); for (ServiceReference serviceReference : services.serviceReferencesForDomain(provider.getDomainInterface())) { String id = (String) serviceReference.getProperty("id"); if (id != null) { ServiceId serviceId = new ServiceId(); serviceId.setServiceId(id); serviceId.setServiceClass(provider.getDomainInterface().getName()); DefaultMutableTreeNode referenceNode = new DefaultMutableTreeNode(serviceId, false); providerNode.add(referenceNode); } } }
Source:
<code>CachedFileInfo getFileInfo(final Long ledger, final byte masterKey[]) throws IOException { try { CachedFileInfo fi; pendingGetFileInfoCounter.inc(); Callable<CachedFileInfo> loader = () -> { CachedFileInfo fileInfo = fileInfoBackingCache.loadFileInfo(ledger, masterKey); activeLedgers.put(ledger, true); return fileInfo; }; if (null != masterKey) { <START> fi = writeFileInfoCache.get(ledger, loader); <END> } else { fi = readFileInfoCache.get(ledger, loader); } fi.retain(); return fi; } catch (ExecutionException | UncheckedExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) ee.getCause(); } else { throw new IOException("Failed to load file info for ledger " + ledger, ee); } } finally { pendingGetFileInfoCounter.dec(); } }</code><technical_language>original goal of caching file info is read faster caching fileInfo for read created ledger, need put fileInfo write cache read cache. need increment refCount 2 put FileInfo read cache write cache</technical_language>

Target:
CachedFileInfo getFileInfo(final Long ledger, final byte masterKey[]) throws IOException { try { CachedFileInfo fi; pendingGetFileInfoCounter.inc(); Callable<CachedFileInfo> loader = () -> { CachedFileInfo fileInfo = fileInfoBackingCache.loadFileInfo(ledger, masterKey); activeLedgers.put(ledger, true); return fileInfo; }; do { if (null != masterKey) { fi = writeFileInfoCache.get(ledger, loader); } else { fi = readFileInfoCache.get(ledger, loader); } } while (!fi.tryRetain()); return fi; } catch (ExecutionException | UncheckedExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) ee.getCause(); } else { throw new IOException("Failed to load file info for ledger " + ledger, ee); } } finally { pendingGetFileInfoCounter.dec(); } }
Source:
<code>public static VariantContext makeMergedVariantContext(final List<VariantContext> vcs) { <START> final List<String> sources = vcs.stream().map(VariantContext::getSource).collect(Collectors.toList()); <END> return GATKVariantContextUtils.simpleMerge(vcs, sources, GATKVariantContextUtils.FilteredRecordMergeType.KEEP_IF_ANY_UNFILTERED, GATKVariantContextUtils.GenotypeMergeType.PRIORITIZE, false, false, null, false, false); }</code><technical_language>sources a more descriptive name. sourceHaplotypes</technical_language>

Target:
public static VariantContext makeMergedVariantContext(final List<VariantContext> vcs) { if (vcs.isEmpty()) { return null; } final List<String> haplotypeSources = vcs.stream().map(VariantContext::getSource).collect(Collectors.toList()); return GATKVariantContextUtils.simpleMerge(vcs, haplotypeSources, GATKVariantContextUtils.FilteredRecordMergeType.KEEP_IF_ANY_UNFILTERED, GATKVariantContextUtils.GenotypeMergeType.PRIORITIZE, false, false, null, false, false); }
Source:
<code>public void setGlusterNetwork(ClusterNetworkModel model, boolean value) { <START> if (!isMultiCluster()) { <END> if (value) { if (getGlusterNetwork() != null) { getGlusterNetwork().setGlusterNetwork(false); } } else { managementNetwork.setGlusterNetwork(true); } } model.setGlusterNetwork(value); }</code><technical_language>update pointer new gluster network..</technical_language>

Target:
public void setGlusterNetwork(ClusterNetworkModel model, boolean value) { if (!isMultiCluster()) { if (value) { if (getGlusterNetwork() != null) { getGlusterNetwork().setGlusterNetwork(false); } glusterNetwork = model; } else { getManagementNetwork().setGlusterNetwork(true); } } model.setGlusterNetwork(value); }
Source:
<code>protected void assertIsLegalCell(final int row, final int column) { int rowCount = rowCount(); int columnCount = columnCount(); <START> <END> Assert.isLegal(row < rowCount, "The row number (" + row + ") is more than the number of rows (" + rowCount + ") in the table."); Assert.isLegal((column < columnCount) || ((columnCount == 0) && (column == 0)), "The column number (" + column + ") is more than the number of columns (" + columnCount + ") in the table."); }</code><technical_language>assert row >=0 column >=0</technical_language>

Target:
protected void assertIsLegalCell(final int row, final int column) { int rowCount = rowCount(); int columnCount = columnCount(); Assert.isLegal(row >= 0); Assert.isLegal(column >= 0); Assert.isLegal(row < rowCount, "The row number (" + row + ") is more than the number of visible rows (" + rowCount + ") in the table."); Assert.isLegal((column < columnCount) || ((columnCount == 0) && (column == 0)), "The column number (" + column + ") is more than the number of visible columns (" + columnCount + ") in the table."); }
Source:
<code>private Map<StoreKey, StoreKey> batchConvertReplicaMetadataResponseKeys(ReplicaMetadataResponse response) throws IOException { try { List<StoreKey> storeKeysToConvert = new ArrayList<>(); <START> for (ReplicaMetadataResponseInfo replicaMetadataResponseInfo : response.getReplicaMetadataResponseInfoList()) { <END> if (replicaMetadataResponseInfo.getError() == ServerErrorCode.No_Error) { for (MessageInfo messageInfo : replicaMetadataResponseInfo.getMessageInfoList()) { storeKeysToConvert.add(messageInfo.getStoreKey()); } } } return storeKeyConverter.convert(storeKeysToConvert); } catch (Exception e) { throw new IOException("Problem with store key conversion", e); } }</code><technical_language>I discussed response.getReplicaMetadataResponseInfoList() null too? if response.getError() is ServerErrorCode.No_Error</technical_language>

Target:
private Map<StoreKey, StoreKey> batchConvertReplicaMetadataResponseKeys(ReplicaMetadataResponse response) throws IOException { try { List<StoreKey> storeKeysToConvert = new ArrayList<>(); for (ReplicaMetadataResponseInfo replicaMetadataResponseInfo : response.getReplicaMetadataResponseInfoList()) { if ((replicaMetadataResponseInfo.getError() == ServerErrorCode.No_Error) && ( replicaMetadataResponseInfo.getMessageInfoList() != null)) { for (MessageInfo messageInfo : replicaMetadataResponseInfo.getMessageInfoList()) { storeKeysToConvert.add(messageInfo.getStoreKey()); } } } return storeKeyConverter.convert(storeKeysToConvert); } catch (Exception e) { throw new IOException("Problem with store key conversion", e); } }
Source:
<code>public void handle(ContainerEvent event) { String podName = event.getPodName(); <START> if (isUnrecoverable(event) && workspacePods.containsKey(podName)) { <END> String reason = event.getReason(); String message = event.getMessage(); String workspaceId = getContext().getIdentity().getWorkspaceId(); LOG.error( "Unrecoverable event occurred during workspace '{}' startup: {}, {}, {}", workspaceId, reason, message, podName); try { internalStop(emptyMap()); } catch (InfrastructureException e) { LOG.error("Error occurred during runtime '{}' stopping. {}", workspaceId, e.getMessage()); } finally { eventPublisher.sendRuntimeStoppedEvent( format("Unrecoverable event occurred: '%s', '%s', '%s'", reason, message, podName), getContext().getIdentity()); } } }</code><technical_language>need keys of map, map</technical_language>

Target:
public void handle(ContainerEvent event) { if (isWorkspaceEvent(event) && happenedAfterHandlerInitialization(event) && isUnrecoverable(event)) { String reason = event.getReason(); String message = event.getMessage(); String workspaceId = getContext().getIdentity().getWorkspaceId(); LOG.error( "Unrecoverable event occurred during workspace '{}' startup: {}, {}, {}", workspaceId, reason, message, event.getPodName()); try { internalStop(emptyMap()); } catch (InfrastructureException e) { LOG.error("Error occurred during runtime '{}' stopping. {}", workspaceId, e.getMessage()); } finally { eventPublisher.sendRuntimeStoppedEvent( format( "Unrecoverable event occurred: '%s', '%s', '%s'", reason, message, event.getPodName()), getContext().getIdentity()); } } }
Source:
<code>public void setDefinedSize(boolean definedSize) { if (this.definedSize != definedSize) { this.definedSize = definedSize; this.countCallback = null; <START> this.skipCountIncreaseUntilReset = false; <END> if (definedSize) { requestFlush(); } else if (requestedRange.contains(assumedSize - 1)) { requestFlush(); } } }</code><technical_language>Unrelated unnecessary changes</technical_language>

Target:
public void setDefinedSize(boolean definedSize) { if (this.definedSize != definedSize) { this.definedSize = definedSize; countCallback = null; skipCountIncreaseUntilReset = false; if (definedSize) { requestFlush(); } else if (requestedRange.contains(assumedSize - 1)) { requestFlush(); } } }
Source:
<code>protected void executeQueryCommand() { <START> final Guid id = getParameters().getId(); <END> final MacPool macPool = getDbFacade().getMacPoolDao().get(id); getQueryReturnValue().setReturnValue(macPool); }</code><technical_language>This inlined</technical_language>

Target:
protected void executeQueryCommand() { final MacPool macPool = getDbFacade().getMacPoolDao().get(getParameters().getId()); getQueryReturnValue().setReturnValue(macPool); }
Source:
<code>public Comment getExternalComment(CoreSession session, String entityId) { DocumentModel commentModel = getExternalCommentModel(session, entityId); checkReadCommentPermissions(session, commentModel.getRef()); return Framework.doPrivileged( () -> COMMENT_DOC_TYPE.equals(commentModel.getType()) ? Comments.newComment(commentModel) <START> : Comments.newAnnotation(commentModel)); <END> }</code><technical_language>add some // end of line this code more readable</technical_language>

Target:
public Comment getExternalComment(CoreSession session, String entityId) { DocumentModel commentModel = getExternalCommentModel(session, entityId); checkReadCommentPermissions(session, commentModel.getRef()); return Framework.doPrivileged(() -> Comments.toComment(commentModel)); }
Source:
<code>public CacheServiceMBean getCacheServiceProxy() { <START> if (cacheService == null) <END> cacheService = newProxy(CacheService.MBEAN_NAME, CacheServiceMBean.class); return cacheService; }</code><technical_language>Missing { } if statement</technical_language>

Target:
public CacheServiceMBean getCacheServiceProxy() { if (cacheService == null) { cacheService = newProxy(CacheService.MBEAN_NAME, CacheServiceMBean.class); } return cacheService; }
Source:
<code>public void readsInboxPeriodically() throws Exception { final GreenMail mail = new GreenMail(ServerSetupTest.POP3); mail.start(); final ServerSetup setup = mail.getPop3().getServerSetup(); final String mailUser = "to"; final String from = "from@localhost.com"; final String to = "to@localhost.com"; final String password = "soooosecret"; final String subject = GreenMailUtil.random(); final String body = GreenMailUtil.random(); final GreenMailUser user = mail.setUser(mailUser, password); new EmCatch( new EmCatch.Action() { @Override public void run(final Message msg) { MatcherAssert.assertThat(msg, Matchers.notNullValue()); try { MatcherAssert.assertThat( msg.getSubject(), Matchers.equalTo(subject) ); MatcherAssert.assertThat( msg.getFrom()[0].toString(), Matchers.equalTo(from) ); MatcherAssert.assertThat( msg.getAllRecipients()[0].toString(), Matchers.equalTo(to) ); } catch (final MessagingException ex) { throw new IllegalStateException(ex); } } }, mailUser, password, setup.getBindAddress(), setup.getPort(), 500L ); final MimeMessage message = GreenMailUtil.createTextEmail( to, from, subject, body, setup ); user.deliver(message); MatcherAssert.assertThat( mail.getReceivedMessages().length, Matchers.equalTo(1) ); <START> Thread.sleep(1000); <END> mail.stop(); }</code><technical_language>@erimerturk this</technical_language>

Target:
public void readsInboxPeriodically() throws Exception { final Ports ports = new Ports(); final GreenMail mail = new GreenMail( new ServerSetup(ports.allocate(), null, "pop3") ); mail.start(); final ServerSetup setup = mail.getPop3().getServerSetup(); final String mailUser = "to"; final String from = "from@localhost.com"; final String to = "to@localhost.com"; final String password = "soooosecret"; final String subject = GreenMailUtil.random(); final String body = GreenMailUtil.random(); final GreenMailUser user = mail.setUser(mailUser, password); new EmCatch( new EmCatch.Action() { @Override public void run(final Message msg) { MatcherAssert.assertThat(msg, Matchers.notNullValue()); try { MatcherAssert.assertThat( msg.getSubject(), Matchers.equalTo(subject) ); MatcherAssert.assertThat( msg.getFrom()[0].toString(), Matchers.equalTo(from) ); MatcherAssert.assertThat( msg.getAllRecipients()[0].toString(), Matchers.equalTo(to) ); } catch (final MessagingException ex) { throw new IllegalStateException(ex); } } }, mailUser, password, setup.getBindAddress(), setup.getPort(), 500L ); final MimeMessage message = GreenMailUtil.createTextEmail( to, from, subject, body, setup ); user.deliver(message); MatcherAssert.assertThat( mail.getReceivedMessages().length, Matchers.equalTo(1) ); Thread.sleep(1000); ports.release(setup.getPort()); mail.stop(); }
Source:
<code>public String toString() { return new StringBuilder() <START> .append("EvaluatedGatewayRefundRequest[\n") <END> .append("transactionId: ") .append(transactionId) .append("\nrefundExternalId: ") .append(refundExternalId) .append("\nchargeExternalId:") .append("]") .toString(); }</code><technical_language>Name right</technical_language>

Target:
public String toString() { return new StringBuilder() .append("RefundGatewayRequest[\n") .append("transactionId: ") .append(transactionId) .append("\nrefundExternalId: ") .append(refundExternalId) .append("]") .toString(); }
Source:
<code>private EventTypeStatistics validateStatisticsUpdate( final EventTypeStatistics existing, final EventTypeStatistics newStatistics) throws InvalidEventTypeException { if (existing != null && newStatistics == null) { return existing; } <START> if (existing == null && newStatistics == null) { <END> return null; } final int newMaxPartitions = Math.max(newStatistics.getReadParallelism(), newStatistics.getWriteParallelism()); final int oldMaxPartitions = Math.max(existing.getReadParallelism(), existing.getWriteParallelism()); if (newMaxPartitions > nakadiSettings.getMaxTopicPartitionCount()) { throw new InvalidEventTypeException("Number of partitions should not be more than " + nakadiSettings.getMaxTopicPartitionCount()); } if (newMaxPartitions < oldMaxPartitions) { throw new InvalidEventTypeException("Read and write parallelism should be greater " + "than existing values."); } if (newMaxPartitions == oldMaxPartitions) { if ((existing.getReadParallelism() != newStatistics.getReadParallelism()) || (existing.getWriteParallelism() != newStatistics.getWriteParallelism())) { throw new InvalidEventTypeException("Read and write parallelism can be changed only to change" + "the number of partition (max of read and write parallelism)"); } } return newStatistics; }</code><technical_language>check if equal, if so, need validate validated before? So, if like: if ((existing == null && newStatistics == null) || existing.equals(newStatistics)) { return existing; }</technical_language>

Target:
private EventTypeStatistics validateStatisticsUpdate( final EventTypeStatistics existing, final EventTypeStatistics newStatistics) throws InvalidEventTypeException { if (existing != null && newStatistics == null) { return existing; } if ((existing == null && newStatistics == null) || (existing.equals(newStatistics))) { return existing; } final int newMaxPartitions = Math.max(newStatistics.getReadParallelism(), newStatistics.getWriteParallelism()); final int oldMaxPartitions = Math.max(existing.getReadParallelism(), existing.getWriteParallelism()); if (newMaxPartitions > nakadiSettings.getMaxTopicPartitionCount()) { throw new InvalidEventTypeException("Number of partitions should not be more than " + nakadiSettings.getMaxTopicPartitionCount()); } if (newMaxPartitions < oldMaxPartitions) { throw new InvalidEventTypeException("Read and write parallelism should be greater " + "than existing values."); } if (newMaxPartitions == oldMaxPartitions) { if ((existing.getReadParallelism() != newStatistics.getReadParallelism()) || (existing.getWriteParallelism() != newStatistics.getWriteParallelism())) { throw new InvalidEventTypeException("Read and write parallelism can be changed only to change" + "the number of partition (max of read and write parallelism)"); } } return newStatistics; }
Source:
<code>public Page<RelationshipRest> findByLabel(@Parameter(value = "label", required = true) String label, @Parameter(value = "dso", required = false) UUID dsoId, Pageable pageable) throws SQLException { Context context = obtainContext(); List<RelationshipType> relationshipTypeList = relationshipTypeService.findByLeftwardOrRightwardTypeName(context, label); List<Relationship> relationships = new LinkedList<>(); int total = 0; if (dsoId != null) { Item item = itemService.find(context, dsoId); if (item == null) { throw new ResourceNotFoundException("The request DSO with id: " + dsoId + " was not found"); } for (RelationshipType relationshipType : relationshipTypeList) { total = relationshipService.countByItemAndRelationshipType(context, relationshipType, item); relationships.addAll(relationshipService.findByItemAndRelationshipType(context, item, relationshipType, pageable.getPageSize(), pageable.getOffset())); } } else { for (RelationshipType relationshipType : relationshipTypeList) { total = relationshipService.countByRelationshipType(context, relationshipType); relationships.addAll(relationshipService.findByRelationshipType(context, relationshipType, pageable.getPageSize(), pageable.getOffset())); } } Page<RelationshipRest> page = new PageImpl<Relationship>(relationships, <START> pageable, total).map(relationshipConverter);; <END> return page; }</code><technical_language>a nitpick: Extra ; end of line</technical_language>

Target:
public Page<RelationshipRest> findByLabel(@Parameter(value = "label", required = true) String label, @Parameter(value = "dso", required = false) UUID dsoId, Pageable pageable) throws SQLException { Context context = obtainContext(); List<RelationshipType> relationshipTypeList = relationshipTypeService.findByLeftwardOrRightwardTypeName(context, label); List<Relationship> relationships = new LinkedList<>(); int total = 0; if (dsoId != null) { Item item = itemService.find(context, dsoId); if (item == null) { throw new ResourceNotFoundException("The request DSO with id: " + dsoId + " was not found"); } for (RelationshipType relationshipType : relationshipTypeList) { total = relationshipService.countByItemAndRelationshipType(context, item, relationshipType); relationships.addAll(relationshipService.findByItemAndRelationshipType(context, item, relationshipType, pageable.getPageSize(), pageable.getOffset())); } } else { for (RelationshipType relationshipType : relationshipTypeList) { total = relationshipService.countByRelationshipType(context, relationshipType); relationships.addAll(relationshipService.findByRelationshipType(context, relationshipType, pageable.getPageSize(), pageable.getOffset())); } } Page<RelationshipRest> page = new PageImpl<Relationship>(relationships, pageable, total).map(relationshipConverter); return page; }
Source:
<code>private String buildMetric(String metric) { final String sanitized = sanitize(metric); <START> if (Strings.isNullOrEmpty(namespacePrefix)) { <END> return sanitized; } else { return StringUtils.format("%s.%s", sanitize(namespacePrefix), sanitized); } }</code><technical_language>I this check namespacePrefix == null</technical_language>

Target:
private String buildMetric(String metric) { final String sanitized = sanitize(metric); if (namespacePrefix == null) { return sanitized; } else { return StringUtils.format("%s.%s", sanitize(namespacePrefix), sanitized); } }
Source:
<code>public RootPredicate<BooleanExpr> getRootPredicate(String entityType) { if (propertyHelper.getEntityNamesResolver().getClassFromName(entityType) == null) { <START> throw new IllegalStateException("Unknown entity name " + entityType); <END> } return new FilterRootPredicate(); }</code><technical_language>throw log.getNoIndexedEntityException(entityType)</technical_language>

Target:
public RootPredicate<BooleanExpr> getRootPredicate(String entityType) { if (propertyHelper.getEntityNamesResolver().getClassFromName(entityType) == null) { throw log.getUnknownEntity(entityType); } return new FilterRootPredicate(); }
Source:
<code><START> private static long getOperationId(int transactionId, long logId) { <END> DataUtils.checkArgument(transactionId >= 0 && transactionId < (1 << (64 - LOG_ID_BITS)), "Transaction id out of range: {0}", transactionId); DataUtils.checkArgument(logId >= 0 && logId <= LOG_ID_MASK, "Transaction log id out of range: {0}", logId); return ((long) transactionId << LOG_ID_BITS) | logId; }</code><technical_language>This method default visibility is accessed anonymous class</technical_language>

Target:
static long getOperationId(int transactionId, long logId) { DataUtils.checkArgument(transactionId >= 0 && transactionId < (1 << (64 - LOG_ID_BITS)), "Transaction id out of range: {0}", transactionId); DataUtils.checkArgument(logId >= 0 && logId <= LOG_ID_MASK, "Transaction log id out of range: {0}", logId); return ((long) transactionId << LOG_ID_BITS) | logId; }
Source:
<code>public void setup() { <START> when(review1.getUrl()).thenReturn(reviewUrl1); <END> when(review2.getUrl()).thenReturn(reviewUrl2); when(reviewNoTask.getUrl()).thenReturn(reviewUrlNoTask); when(task1.getUrl()).thenReturn(taskUrl1); when(task2.getUrl()).thenReturn(taskUrl2); when(task1.getTaskId()).thenReturn("1"); when(task1.getTaskId()).thenReturn("2"); when(review1.getTaskId()).thenReturn("3"); when(review2.getTaskId()).thenReturn("4"); when(reviewNoTask.getTaskId()).thenReturn("5"); }</code><technical_language>meaning ask if a class I instantiate, thank you</technical_language>

Target:
public void setup() { review1 = new TaskTask("reviewKind", reviewUrl1, "3"); review1.setUrl(reviewUrl1); review2 = new TaskTask("reviewKind", reviewUrl2, "4"); review2.setUrl(reviewUrl2); reviewNoTask = new TaskTask("reviewKind", reviewUrlNoTask, "5"); reviewNoTask.setUrl(reviewUrlNoTask); task1 = new TaskTask("reviewKind", taskUrl1, "1"); task1.setUrl(taskUrl1); task2 = new TaskTask("reviewKind", taskUrl2, "2"); task2.setUrl(taskUrl2); }