auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testMultipartChunkedFilenames() throws InterruptedException, IOException { String containerName = getContainerName(); try { BlobStore blobStore = view.getBlobStore(); String objectName = "file.txt"; long countBefore = blobStore.countBlobs(containerName); File fileToUpload = createFileExactly(PART_SIZE * 11, objectName); addMultipartBlobToContainer(containerName, objectName, fileToUpload); long countAfter = blobStore.countBlobs(containerName); assertNotEquals(countBefore, countAfter, "No blob was created"); assertTrue(countAfter - countBefore > 1, "A multipart blob wasn't actually created - " + "there was only 1 extra blob but there should be one manifest blob and multiple chunk blobs"); assertEquals(countBefore + 12, countAfter, <START> "12 parts (11 objects + 1 manifest) were expected."); <END> Blob read = blobStore.getBlob(containerName, objectName); File outFile = new File("target", "file-read.txt"); ByteStreams.copy(read.getPayload(), Files.asByteSink(outFile)); HashCode expectedHashCode = Files.hash(fileToUpload, Hashing.md5()); HashCode actualHashCode = Files.hash(outFile, Hashing.md5()); assertEquals(actualHashCode, expectedHashCode); } finally { returnContainer(containerName); } }</code><technical_language>assertEquals(countAfter, countBefore + 12, ...) TestNG "actual, expected"</technical_language>

Target:
public void testMultipartChunkedFilenames() throws InterruptedException, IOException { String containerName = getContainerName(); try { BlobStore blobStore = view.getBlobStore(); String objectName = "object.txt"; long countBefore = blobStore.countBlobs(containerName); ByteSource inputSource = createByteSource(PART_SIZE * 11); addMultipartBlobToContainer(containerName, objectName, inputSource); long countAfter = blobStore.countBlobs(containerName); assertNotEquals(countAfter, countBefore, "No blob was created"); assertEquals(countAfter, countBefore + 12, "12 parts (11 objects + 1 manifest) were expected."); Blob read = blobStore.getBlob(containerName, objectName); Payload readPayload = read.getPayload(); assertTrue(inputSource.contentEquals(ByteSources.asByteSource(readPayload.openStream()))); } finally { returnContainer(containerName); } }
Source:
<code>public <T> T lockProjectSecret(int projectId, String scope, String key, SecretLockAction<T> action) { EncryptedSecret secret = dao.lockProjectSecret(siteId, projectId, scope, key); Optional<String> value; if (secret == null) { value = Optional.absent(); } else { if (!crypto.getName().equals(secret.engine)) { <START> throw new AssertionError("Crypto engine mismatch"); <END> } String decrypted = crypto.decryptSecret(secret.value); value = Optional.of(decrypted); } return action.call(this, value); }</code><technical_language>Adding values of crypt.getName() secret.engine message better</technical_language>

Target:
public <T> T lockProjectSecret(int projectId, String scope, String key, SecretLockAction<T> action) { EncryptedSecret secret = dao.lockProjectSecret(siteId, projectId, scope, key); Optional<String> value; if (secret == null) { value = Optional.absent(); } else { if (!crypto.getName().equals(secret.engine)) { throw new AssertionError(String.format(ENGLISH, "Crypto engine mismatch. Expected '%s' but got '%s'", secret.engine, crypto.getName())); } String decrypted = crypto.decryptSecret(secret.value); value = Optional.of(decrypted); } return action.call(this, value); }
Source:
<code><START> private OperationType getOperationType(byte opCode) { <END> switch (opCode) { case BookieProtocol.ADDENTRY: return OperationType.ADD_ENTRY; case BookieProtocol.READENTRY: return OperationType.READ_ENTRY; case BookieProtocol.AUTH: return OperationType.AUTH; case BookieProtocol.READ_LAC: return OperationType.READ_LAC; case BookieProtocol.WRITE_LAC: return OperationType.WRITE_LAC; case BookieProtocol.GET_BOOKIE_INFO: return OperationType.GET_BOOKIE_INFO; default: throw new IllegalArgumentException("Invalid operation type"); } }</code><technical_language>static ? change "getStatusCodeFromErrorCode" "static"</technical_language>

Target:
private static OperationType getOperationType(byte opCode) { switch (opCode) { case BookieProtocol.ADDENTRY: return OperationType.ADD_ENTRY; case BookieProtocol.READENTRY: return OperationType.READ_ENTRY; case BookieProtocol.AUTH: return OperationType.AUTH; case BookieProtocol.READ_LAC: return OperationType.READ_LAC; case BookieProtocol.WRITE_LAC: return OperationType.WRITE_LAC; case BookieProtocol.GET_BOOKIE_INFO: return OperationType.GET_BOOKIE_INFO; default: throw new IllegalArgumentException("Invalid operation type " + opCode); } }
Source:
<code>private boolean isDateValid(final DateTime issueInstant, final int interval) { final DateTime before = DateTime.now().plusSeconds(acceptedSkew); final DateTime after = DateTime.now().minusSeconds(acceptedSkew + interval); boolean isDateValid = issueInstant.isBefore(before) && issueInstant.isAfter(after); <START> if (logger.isTraceEnabled() && !isDateValid) { <END> logger.trace("interval=" + interval + ",before=" + before.toDateTime(issueInstant.getZone()) + ",after=" + after.toDateTime(issueInstant.getZone()) + ",issueInstant=" + issueInstant); } return isDateValid; }</code><technical_language>need a logger.isTraceEnabled here</technical_language>

Target:
private boolean isDateValid(final DateTime issueInstant, final int interval) { final DateTime before = DateTime.now().plusSeconds(acceptedSkew); final DateTime after = DateTime.now().minusSeconds(acceptedSkew + interval); boolean isDateValid = issueInstant.isBefore(before) && issueInstant.isAfter(after); if (!isDateValid) { logger.trace("interval={},before={},after={},issueInstant={}", interval, before.toDateTime(issueInstant.getZone()), after.toDateTime(issueInstant.getZone()), issueInstant); } return isDateValid; }
Source:
<code>public void ensureAtLeastNPeriods(int n) { <START> synchronized (this) { <END> while (periods.size() < n) { PeriodStatsModel psm = new DefaultPeriodStatsModel(periods.size() + 1); psm.addScoreBoardListener(this); periods.add(psm); } } }</code><technical_language>Is a reason synchronized (this) in this file instead of adding synchronized keyword method signature</technical_language>

Target:
public synchronized void ensureAtLeastNPeriods(int n) { while (periods.size() < n) { PeriodStatsModel psm = new DefaultPeriodStatsModel(periods.size() + 1); psm.addScoreBoardListener(this); periods.add(psm); } }
Source:
<code>public boolean canLogAtLevel(LogLevel logLevel) { <START> loadSystemLogLevel(); <END> return canLogAtLevel(logLevel, rootLogLevel); }</code><technical_language>Is this load operation necessary time this method is called</technical_language>

Target:
public boolean canLogAtLevel(LogLevel logLevel) { LogLevel rootLogLevel = loadSystemLogLevel(); return canLogAtLevel(logLevel, rootLogLevel); }
Source:
<code>private void validateQosNotPartiallyConfigured() { Set<String> someSubInterfacesHaveQos = new HashSet<>(); Set<String> notAllSubInterfacesHaveQos = new HashSet<>(); for (VdsNetworkInterface iface : params.getInterfaces()) { String networkName = iface.getNetworkName(); Network network = getExistingClusterNetworks().get(networkName); NetworkAttachment networkAttachment = getNetworkAttachment(iface, network); String baseIfaceName = NetworkUtils.stripVlan(iface); <START> if (network != null) { <END> if (NetworkUtils.qosConfiguredOnInterface(networkAttachment, network)) { someSubInterfacesHaveQos.add(baseIfaceName); } else { notAllSubInterfacesHaveQos.add(baseIfaceName); } } } for (String ifaceName : someSubInterfacesHaveQos) { if (notAllSubInterfacesHaveQos.contains(ifaceName)) { addViolation(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_QOS_INTERFACES_WITHOUT_QOS, ifaceName); } } }</code><technical_language>please move lines 330 332 condition. is need invoke if network is null</technical_language>

Target:
private void validateQosNotPartiallyConfigured() { Set<String> someSubInterfacesHaveQos = new HashSet<>(); Set<String> notAllSubInterfacesHaveQos = new HashSet<>(); for (VdsNetworkInterface iface : params.getInterfaces()) { String networkName = iface.getNetworkName(); Network network = getExistingClusterNetworks().get(networkName); if (network != null) { NetworkAttachment networkAttachment = getNetworkAttachment(iface, network); String baseIfaceName = NetworkUtils.stripVlan(iface); if (NetworkUtils.qosConfiguredOnInterface(networkAttachment, network)) { someSubInterfacesHaveQos.add(baseIfaceName); } else { notAllSubInterfacesHaveQos.add(baseIfaceName); } } } for (String ifaceName : someSubInterfacesHaveQos) { if (notAllSubInterfacesHaveQos.contains(ifaceName)) { addViolation(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_QOS_INTERFACES_WITHOUT_QOS, ifaceName); } } }
Source:
<code>static <T> Stream<T> of(T... elements) { Objects.requireNonNull(elements, "elements is null"); return Stream.ofAll(new Iterator<T>() { int i = 0; @Override public boolean hasNext() { return i < elements.length; } @Override public T next() { if (i >= elements.length) { throw new NoSuchElementException(); } <START> return elements[i++]; <END> } }); }</code><technical_language>In general of right. Here, this check is unnecessary Iterator is internally only. Stream.ofAll(Iterator) a for-loop iterate elements. Please remove check save cycles</technical_language>

Target:
static <T> Stream<T> of(T... elements) { Objects.requireNonNull(elements, "elements is null"); return Stream.ofAll(new Iterator<T>() { int i = 0; @Override public boolean hasNext() { return i < elements.length; } @Override public T next() { return elements[i++]; } }); }
Source:
<code>public void jobCompleted(JobInstance job) { AgentInstance agentInstance = agentService.findAgent(job.getAgentUuid()); if (!agentInstance.isElastic()) { LOGGER.debug("Agent is not elastic. Skipping further execution.", agentInstance.getUuid()); return; } if (job.isAssignedToAgent()) { jobCreationTimeMap.remove(job.getId()); } String pluginId = agentInstance.elasticAgentMetadata().elasticPluginId(); String elasticAgentId = agentInstance.elasticAgentMetadata().elasticAgentId(); ElasticProfile elasticProfile = job.getPlan().getElasticProfile(); ClusterProfile clusterProfile = job.getPlan().getClusterProfile(); secretParamResolver.resolve(elasticProfile); Map<String, String> elasticProfileConfiguration = elasticProfile.getConfigurationAsMap(true, true); Map<String, String> clusterProfileConfiguration = emptyMap(); if (clusterProfile != null) { <START> secretParamResolver.resolve(clusterProfile); <END> clusterProfileConfiguration = clusterProfile.getConfigurationAsMap(true, true); } elasticAgentPluginRegistry.reportJobCompletion(pluginId, elasticAgentId, job.getIdentifier(), elasticProfileConfiguration, clusterProfileConfiguration); }</code><technical_language>do handle secret resolution failures? removing job jobCreationTimeMap secrets resolved. repercussions of secret resolution failures removing map</technical_language>

Target:
public void jobCompleted(JobInstance job) { AgentInstance agentInstance = agentService.findAgent(job.getAgentUuid()); if (!agentInstance.isElastic()) { LOGGER.debug("Agent is not elastic. Skipping further execution.", agentInstance.getUuid()); return; } if (job.isAssignedToAgent()) { jobCreationTimeMap.remove(job.getId()); } String pluginId = agentInstance.elasticAgentMetadata().elasticPluginId(); String elasticAgentId = agentInstance.elasticAgentMetadata().elasticAgentId(); JobIdentifier jobIdentifier = job.getIdentifier(); ElasticProfile elasticProfile = job.getPlan().getElasticProfile(); ClusterProfile clusterProfile = job.getPlan().getClusterProfile(); try { secretParamResolver.resolve(elasticProfile); Map<String, String> elasticProfileConfiguration = elasticProfile.getConfigurationAsMap(true, true); Map<String, String> clusterProfileConfiguration = emptyMap(); if (clusterProfile != null) { secretParamResolver.resolve(clusterProfile); clusterProfileConfiguration = clusterProfile.getConfigurationAsMap(true, true); } elasticAgentPluginRegistry.reportJobCompletion(pluginId, elasticAgentId, jobIdentifier, elasticProfileConfiguration, clusterProfileConfiguration); } catch (RulesViolationException | SecretResolutionFailureException e) { String description = format("The job completion call to the plugin for the job identifier [%s] failed for secrets resolution: %s ", jobIdentifier.toString(), e.getMessage()); ServerHealthState healthState = error("Failed to notify plugin", description, general(scopeForJob(jobIdentifier))); healthState.setTimeout(Timeout.FIVE_MINUTES); serverHealthService.update(healthState); LOGGER.error(description); } }
Source:
<code>public static JdbcTableDefinitionBuilder like(JdbcTableDefinition tableDefinition) { JdbcTableDefinitionBuilder builder = new JdbcTableDefinitionBuilder(tableDefinition.getName()) .setCreateTableDDLTemplate(tableDefinition.createTableDDLTemplate) .setDataSource(tableDefinition.getDataSource()); if (tableDefinition.getSchema().isPresent()) { builder.withSchema(tableDefinition.getSchema().get()); } <START> if (tableDefinition.getTableHandle().getShouldCreateSchema()) { <END> builder.shouldNotCreateSchema(); } return builder; }</code><technical_language>missing !</technical_language>

Target:
public static JdbcTableDefinitionBuilder like(JdbcTableDefinition tableDefinition) { JdbcTableDefinitionBuilder builder = new JdbcTableDefinitionBuilder(tableDefinition.getName()) .setCreateTableDDLTemplate(tableDefinition.createTableDDLTemplate) .setDataSource(tableDefinition.getDataSource()); if (tableDefinition.getSchema().isPresent()) { builder.withSchema(tableDefinition.getSchema().get()); } return builder; }
Source:
<code>public boolean applyFWRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException { if (rules.size() == 1 && rules.iterator().next().getType().equals(FirewallRuleType.System)) { <START> s_logger.debug("Default ACL added by CS as system is ignored for network " + network.getName() + " with rule " + rules); <END> return true; } if (rules.isEmpty()) { return true; } s_logger.debug("Handling applyFWRules for network " + network.getName() + " with " + rules.size() + " FWRules"); return applyACLRules(network, rules, false, rules.iterator().next().getTrafficType().equals(FirewallRule.TrafficType.Ingress), false); }</code><technical_language>Wrap in a if (s_logger.isDebugEnabled()) { ... } block avoid unnecessary pressure string pool debug logging is enabled</technical_language>

Target:
public boolean applyFWRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { return true; } if (rules.size() == 1 && rules.iterator().next().getType().equals(FirewallRuleType.System)) { if (s_logger.isDebugEnabled()) { s_logger.debug("Default ACL added by CS as system is ignored for network " + network.getName() + " with rule " + rules); } return true; } s_logger.info("Applying " + rules.size() + " Firewall Rules for network " + network.getName()); return applyACLRules(network, rules, false, rules.iterator().next().getTrafficType().equals(FirewallRule.TrafficType.Ingress), false); }
Source:
<code>public <K, V> List<Map.Entry<Integer, Map.Entry<K, V>>> asAnchorList(SerializationService serializationService) { List<Map.Entry<Integer, Map.Entry<K, V>>> anchorObjectList = new ArrayList<>(anchorDataList.size()); Iterator<Map.Entry<Data, Data>> dataEntryIterator = anchorDataList.iterator(); <START> for (Iterator<Integer> pageNumberIt = anchorPageList.iterator(); pageNumberIt.hasNext(); ) { <END> Integer pageNumber = pageNumberIt.next(); Map.Entry<Data, Data> dataEntry = dataEntryIterator.next(); K key = serializationService.toObject(dataEntry.getKey()); V value = serializationService.toObject(dataEntry.getValue()); AbstractMap.SimpleImmutableEntry<K, V> entry = new AbstractMap.SimpleImmutableEntry<>(key, value); anchorObjectList.add(new AbstractMap.SimpleImmutableEntry<>(pageNumber, entry)); } return anchorObjectList; }</code><technical_language>replaced for (Integer pageNumber : anchorPageList) {</technical_language>

Target:
public <K, V> List<Map.Entry<Integer, Map.Entry<K, V>>> asAnchorList(SerializationService serializationService) { List<Map.Entry<Integer, Map.Entry<K, V>>> anchorObjectList = new ArrayList<>(anchorDataList.size()); Iterator<Map.Entry<Data, Data>> dataEntryIterator = anchorDataList.iterator(); for (Integer pageNumber : anchorPageList) { Map.Entry<Data, Data> dataEntry = dataEntryIterator.next(); K key = serializationService.toObject(dataEntry.getKey()); V value = serializationService.toObject(dataEntry.getValue()); AbstractMap.SimpleImmutableEntry<K, V> entry = new AbstractMap.SimpleImmutableEntry<>(key, value); anchorObjectList.add(new AbstractMap.SimpleImmutableEntry<>(pageNumber, entry)); } return anchorObjectList; }
Source:
<code>public static DatadogClient getInstance(String url, String logIntakeUrl, Secret apiKey){ if (lastInstance != null && (StringUtils.equals(lastInstance.getLogIntakeUrl(), logIntakeUrl)) && (StringUtils.equals(lastInstance.getUrl(), url) && ((lastInstance.getApiKey() == null && apiKey == null) || lastInstance.getApiKey().equals(apiKey)))){ return instance; <START> } else { <END> DatadogHttpClient.lastInstance = new DatadogHttpClient(url, logIntakeUrl, apiKey); if (enableValidations) { try { validateCongiguration(url, logIntakeUrl, apiKey); } catch(Exception e){ logger.severe(e.getMessage()); return null; } } instance = lastInstance; return instance; } }</code><technical_language>need for else block</technical_language>

Target:
public static DatadogClient getInstance(String url, String logIntakeUrl, Secret apiKey){ DatadogHttpClient newInstance = new DatadogHttpClient(url, logIntakeUrl, apiKey); if (instance != null && instance.equals(newInstance)) { if (DatadogHttpClient.failedLastValidation) { return null; } return instance; } if (enableValidations) { synchronized (DatadogHttpClient.class) { DatadogHttpClient.instance = newInstance; try { newInstance.validateConfiguration(); } catch(IllegalArgumentException e){ logger.severe(e.getMessage()); DatadogHttpClient.failedLastValidation = true; return null; } } } return newInstance; }
Source:
<code>public static RemoveAddress of(final Address address) { if (address.getId() == null) { throw new IllegalArgumentException(format("The address %s should have an id.", address)); } <START> return of(address.getId(), address.getKey()); <END> }</code><technical_language>for AddAddress</technical_language>

Target:
public static RemoveAddress of(final Address address) { if (address.getId() == null && address.getKey() == null) { throw new IllegalArgumentException(format("The address %s should have an id or a key.", address)); } if (address.getId() != null) { return of(address.getId()); } else { return ofKey(address.getKey()); } }
Source:
<code>public void createALC() { int numRetriesRemaining = 4; int retryDelayMsec = 100; while (true) { try { AL.create(); break; } catch (LWJGLException exception1) { if (numRetriesRemaining < 1) { throw new RuntimeException(exception1); } --numRetriesRemaining; <START> System.out.printf("Caught an LWJGLException from AL.create(). " <END> + "Will retry after %d msec, " + "with %d more retr%s remaining.%n", retryDelayMsec, numRetriesRemaining, (numRetriesRemaining == 1) ? "y" : "ies"); try { Thread.sleep(retryDelayMsec); } catch (InterruptedException exception2) { } retryDelayMsec *= 3; } } }</code><technical_language>this printed a warning logger</technical_language>

Target:
public void createALC() { int numRetriesRemaining = 4; int retryDelayMsec = 100; while (true) { try { AL.create(); break; } catch (LWJGLException exception1) { if (numRetriesRemaining < 1) { throw new RuntimeException(exception1); } --numRetriesRemaining; String message = String.format( "Caught an LWJGLException from AL.create(). " + "Will retry after %d msec, " + "with %d more retr%s remaining.%n", retryDelayMsec, numRetriesRemaining, (numRetriesRemaining == 1) ? "y" : "ies"); logger.log(Level.WARNING, message); try { Thread.sleep(retryDelayMsec); } catch (InterruptedException exception2) { } } } }
Source:
<code>public void onNext(final AvroElasticMemoryMessage msg) { <START> LOG.log(Level.INFO, "Received new Evaluators Deleted {0}.", msg); <END> if (executingPlan == null) { throw new RuntimeException("Evaluators deleted " + msg + " received, but no executingPlan available."); } executingPlan.onDeleted(); }</code><technical_language>EM delete is failed, hands FAILURE result avro message. I log message result</technical_language>

Target:
public void onNext(final AvroElasticMemoryMessage msg) { LOG.log(Level.INFO, "Received new Evaluators Deleted {0}", msg); if (msg.getResultMsg().getResult() == Result.FAILURE) { LOG.log(Level.WARNING, "Evaluator delete failed for evaluator {0}", msg.getSrcId()); } if (executingPlan == null) { throw new RuntimeException("Evaluators deleted " + msg + " received, but no executingPlan available."); } executingPlan.onDeleted(); }
Source:
<code>public void clearTaskChangeTimes(LocalDateTime untilLocalDateTime) { if (untilLocalDateTime != null) { final List<Long> removableChanges = taskChangeTimes.entrySet().stream() .filter(entry -> untilLocalDateTime.compareTo(entry.getValue()) > 0) .map(Map.Entry::getKey) .collect(Collectors.toList()); <START> removableChanges.forEach(removableChange -> taskChangeTimes.remove(removableChange)); <END> } }</code><technical_language>I forEach called stream, right map call</technical_language>

Target:
public void clearTaskChangeTimes(LocalDateTime untilLocalDateTime) { if (untilLocalDateTime != null) { taskChangeTimes.entrySet().stream() .filter(entry -> untilLocalDateTime.compareTo(entry.getValue()) > 0) .map(Map.Entry::getKey) .collect(Collectors.toList()) .forEach(removableChange -> taskChangeTimes.remove(removableChange)); } }
Source:
<code>public Collection<Referenceable> getEntities(String type, Map<String, Object> attributes) throws AtlasException { log.debug("Getting entity with type and attributes [{}]", type, attributes); checkAttributes(attributes); if (attributes.isEmpty()) { <START> return getEntities(type); <END> } List<Referenceable> referenceables = new ArrayList<>(); List<String> entityGuids = metadataService.getEntityList(type); Set<Map.Entry<String, Object>> attributesSet = attributes.entrySet(); for (String entityGuid : entityGuids) { Referenceable entity = getEntity(entityGuid); Set<Map.Entry<String, Object>> entityValuesSet = entity.getValuesMap().entrySet(); if (containsAll(attributesSet, entityValuesSet)) { referenceables.add(entity); } } return referenceables; }</code><technical_language>return</technical_language>

Target:
public Collection<Referenceable> getEntities(String type, Map<String, Object> attributes) throws AtlasException { LOG.debug("Getting entity with type and attributes [{}]", type, attributes); checkAttributes(attributes); Collection<Referenceable> referenceables = null; if (attributes.isEmpty()) { referenceables = getEntities(type); } else { referenceables = new ArrayList<>(); List<String> entityGuids = metadataService.getEntityList(type); Set<Map.Entry<String, Object>> attributesSet = attributes.entrySet(); for (String entityGuid : entityGuids) { Referenceable entity = getEntity(entityGuid); Set<Map.Entry<String, Object>> entityValuesSet = entity.getValuesMap().entrySet(); if (containsAll(attributesSet, entityValuesSet)) { referenceables.add(entity); } } } return referenceables; }
Source:
<code>public static InformationItem wbFromDMN(final org.kie.dmn.model.v1_1.InformationItem dmn) { <START> if (dmn == null) { <END> return null; } Id id = new Id(dmn.getId()); Description description = new Description(dmn.getDescription()); Name name = new Name(dmn.getName()); QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef()); InformationItem result = new InformationItem(id, description, name, typeRef); return result; }</code><technical_language>this bearing "nullable" properties? If defer merge of this meant them!</technical_language>

Target:
public static InformationItem wbFromDMN(final org.kie.dmn.model.v1_1.InformationItem dmn) { if (dmn == null) { return null; } Id id = new Id(dmn.getId()); Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); Name name = new Name(dmn.getName()); QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef()); InformationItem result = new InformationItem(id, description, name, typeRef); return result; }
Source:
<code>public int area() { <START> return Math.abs((maxY - minY) * (maxY - minY)); <END> }</code><technical_language>assume min is equal max, abs needed</technical_language>

Target:
public int area() { return (maxY - minY) * (maxY - minY); }
Source:
<code><START> private List<TypeElement> fetchSuperinterfaces(TypeElement baseInterface) { <END> List<TypeMirror> interfacesQueue = new ArrayList<>(baseInterface.getInterfaces()); Set<TypeMirror> interfacesSet = Sets.newHashSet(interfacesQueue); List<TypeElement> superInterfaceElements = new ArrayList<>(); for (int i = 0; i < interfacesQueue.size(); i++) { TypeMirror superInterfaceMirror = interfacesQueue.get(i); TypeElement superInterfaceType = ProcessorUtils.extractType(typeUtils, superInterfaceMirror); superInterfaceElements.add(superInterfaceType); List<TypeMirror> newInterfaces = superInterfaceType.getInterfaces() .stream() .filter((newInteface) -> !interfacesSet.contains(newInteface)) .collect(Collectors.toList()); interfacesSet.addAll(newInterfaces); interfacesQueue.addAll(newInterfaces); } return superInterfaceElements; }</code><technical_language>nitty nit: "Superinterfaces" is cased word, words in variables below</technical_language>

Target:
private List<TypeElement> fetchSuperinterfaces(TypeElement baseInterface) { List<TypeMirror> interfacesQueue = new ArrayList<>(baseInterface.getInterfaces()); Set<TypeMirror> interfacesSet = Sets.newHashSet(interfacesQueue); List<TypeElement> superinterfaceElements = new ArrayList<>(); for (int i = 0; i < interfacesQueue.size(); i++) { TypeMirror superinterfaceMirror = interfacesQueue.get(i); TypeElement superinterfaceType = ProcessorUtils.extractType(typeUtils, superinterfaceMirror); superinterfaceElements.add(superinterfaceType); List<TypeMirror> newInterfaces = superinterfaceType.getInterfaces() .stream() .filter((newInteface) -> !interfacesSet.contains(newInteface)) .collect(Collectors.toList()); interfacesSet.addAll(newInterfaces); interfacesQueue.addAll(newInterfaces); } return superinterfaceElements; }
Source:
<code>public boolean isFinished() { <START> return finishing && inputPage == null && unfinishedWork == null; <END> }</code><technical_language>add a hasUnfinishedInput method in RowNumber commit? I code easier read</technical_language>

Target:
public boolean isFinished() { return finishing && !hasUnfinishedInput(); }
Source:
<code>public void testSimpleOutput() throws IOException { final MarkupToXslfoTask task; <START> task = new MarkupToXslfoTask(); <END> task.setMarkupLanguage(languageName); File markup = createSimpleTextileMarkup(); task.setFile(markup); task.execute(); File targetFile = new File(markup.getParentFile(), "simple.fo"); assertTrue(targetFile.exists() && targetFile.isFile()); String content = getContent(targetFile); assertTrue(content.contains("<root xmlns=\"<LINK_0>\"")); assertTrue(content.contains("</root>")); assertTrue(content.contains(">simple</block>")); assertTrue(content.contains(" id=\"FirstHeading\">First Heading</block>")); assertTrue(content.contains(" id=\"SecondHeading\">Second Heading</block>")); }</code><technical_language>lines duplicated code - consider restoring setUp() method above</technical_language>

Target:
public void testSimpleOutput() throws IOException { File markup = createSimpleTextileMarkup(); task.setFile(markup); task.execute(); File targetFile = new File(markup.getParentFile(), "simple.fo"); assertTrue(targetFile.exists() && targetFile.isFile()); String content = getContent(targetFile); assertTrue(content.contains("<root xmlns=\"<LINK_0>\"")); assertTrue(content.contains("</root>")); assertTrue(content.contains(">simple</block>")); assertTrue(content.contains(" id=\"FirstHeading\">First Heading</block>")); assertTrue(content.contains(" id=\"SecondHeading\">Second Heading</block>")); }
Source:
<code>public void notifyTimeout(DCCppMessage msg) { <START> log.debug("Notified of timeout on message '{}'", msg.toString()); <END> }</code><technical_language>Is toString() required here? sure, I remove toString() call. toString() call is cheap if so, a problem. reason for check of log.isDebugEnabled() is call toString() if debug is disabled. If this line instead, this problem away: log.debug("Notified of timeout message '{}'", msg); I this work I log.debug call msg.toString(), I tested lately</technical_language>

Target:
public void notifyTimeout(DCCppMessage msg) { log.debug("Notified of timeout on message '{}'", msg); }
Source:
<code>private static boolean stopPreviousDevInstance() { if (!isDevelopmentModeSafe() || <START> ERXProperties.booleanForKeyWithDefault("er.extensions.ERXApplication.allowMultipleDevInstances", false)) { <END> return false; } String appUrl; if (!(application().wasMainInvoked())) { return false; } else if (application().isDirectConnectEnabled()) { appUrl = application().cgiAdaptorURL().replace("/cgi", ":" + application().port() + "/cgi"); appUrl += "/" + application().name() + ".woa"; } else { appUrl = application().cgiAdaptorURL() + "/" + application().name() + ".woa/-" + application().port(); } URL url; try { appUrl = appUrl + "/" + application().directActionRequestHandlerKey() + "/stop"; url = new URL(appUrl); log.debug("Stopping previously running instance of " + application().name()); URLConnection connection = url.openConnection(); connection.getContent(); Thread.sleep(2000); return true; } catch (Throwable e) { e.printStackTrace(); } return false; }</code><technical_language>current behavior is allow multiple instances long ports, default true, false</technical_language>

Target:
private static boolean stopPreviousDevInstance() { if (!isDevelopmentModeSafe() || ERXProperties.booleanForKeyWithDefault("er.extensions.ERXApplication.allowMultipleDevInstances", false)) { return false; } if (!(application().wasMainInvoked())) { return false; } String adapterUrl; if (application().host() != null) { adapterUrl = application().cgiAdaptorURL(); } else { adapterUrl = application().cgiAdaptorURL().replace("://null/", "://localhost/"); } String appUrl; if (application().isDirectConnectEnabled()) { appUrl = adapterUrl.replace("/cgi", ":" + application().port() + "/cgi"); appUrl += "/" + application().name() + ".woa"; } else { appUrl = adapterUrl + "/" + application().name() + ".woa/-" + application().port(); } URL url; try { appUrl = appUrl + "/" + application().directActionRequestHandlerKey() + "/stop"; url = new URL(appUrl); log.debug("Stopping previously running instance of " + application().name()); URLConnection connection = url.openConnection(); connection.getContent(); Thread.sleep(2000); return true; } catch (Throwable e) { e.printStackTrace(); } return false; }
Source:
<code>private void copyViaHttp(Folder f, JenkinsRule.WebClient wc, String fromName, String toName) throws Exception { r.jenkins.setCrumbIssuer(null); URL apiURL = new URL(MessageFormat.format( "{0}createItem?mode=copy&from={1}&name={2}", <START> r.jenkins.getRootUrl() + "/" + f.getUrl().toString(), fromName, toName)); <END> WebRequest request = new WebRequest(apiURL, HttpMethod.POST); request.setEncodingType(null); assertTrue("Copy Job request has failed", 200 == r.createWebClient() .getPage(request).getWebResponse().getStatusCode()); }</code><technical_language>"{0}/{1}create..."? weird formatting a String format of parameters too</technical_language>

Target:
private void copyViaHttp(Folder f, JenkinsRule.WebClient wc, String fromName, String toName) throws Exception { r.jenkins.setCrumbIssuer(null); URL apiURL = new URL( r.jenkins.getRootUrl().toString() + "/" + f.getUrl().toString() + "createItem?mode=copy&from=" + URLEncoder.encode(fromName, "UTF-8") + "&name=" + URLEncoder.encode(toName, "UTF-8")); WebRequest request = new WebRequest(apiURL, HttpMethod.POST); request.setEncodingType(null); assertTrue("Copy Job request has failed", 200 == r.createWebClient() .getPage(request).getWebResponse().getStatusCode()); }
Source:
<code>public void test() throws Exception { doInJPA( this::entityManagerFactory, entityManager -> { final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); final CriteriaQuery<Object[]> query = cb.createQuery( Object[].class ); final Root<Book> entity = query.from( Book.class ); query.multiselect( entity.get( "id" ).alias( "id" ), <START> entity.get( "name" ).alias( "name" ) <END> ); List<BookDto> dtos = entityManager.createQuery( query ) .unwrap( Query.class ) .setResultTransformer( Transformers.aliasToBean( BookDto.class ) ) .getResultList(); assertEquals( 1, dtos.size() ); BookDto dto = dtos.get( 0 ); assertEquals( 1, (int) dto.getId() ); assertEquals( bookName(), dto.getName() ); } ); }</code><technical_language>Wondering if aliases column names? test more natural</technical_language>

Target:
public void test() { doInJPA( this::entityManagerFactory, entityManager -> { final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); final CriteriaQuery<Object[]> query = cb.createQuery( Object[].class ); final Root<Book> entity = query.from( Book.class ); query.multiselect( entity.get( "id" ).alias( "id" ), entity.get( "name" ).alias( "title" ) ); List<BookDto> dtos = entityManager.createQuery( query ) .unwrap( Query.class ) .setResultTransformer( Transformers.aliasToBean( BookDto.class ) ) .getResultList(); assertEquals( 1, dtos.size() ); BookDto dto = dtos.get( 0 ); assertEquals( 1, (int) dto.getId() ); assertEquals( bookName(), dto.getTitle() ); } ); }
Source:
<code><START> private boolean checkRowNotExpired(List<Cell> cellList) throws IOException { <END> long cellListSize = cellList.size(); Cell cell = null; if (cellListSize == 0) { return true; } Iterator<Cell> cellIterator = cellList.iterator(); while (cellIterator.hasNext()) { cell = cellIterator.next(); if (isEmptyColumn(cell)) { LOG.debug(String.format("** PHOENIX-TTL: Row expired for [%s], expired = %s **", cell.toString(), isTTLExpired(cell))); if (cellListSize > 1) { cellIterator.remove(); } return !isTTLExpired(cell); } } byte[] rowKey = new byte[cell.getRowLength()]; System.arraycopy(cell.getRowArray(), cell.getRowOffset(), rowKey, 0, cell.getRowLength()); return checkEmptyColumnNotExpired(rowKey); }</code><technical_language>great if unit tests for new methods PhoenixTTLRegionObserverTest.java</technical_language>

Target:
private boolean checkRowNotExpired(List<Cell> cellList) throws IOException { long cellListSize = cellList.size(); Cell cell = null; if (cellListSize == 0) { return true; } Iterator<Cell> cellIterator = cellList.iterator(); while (cellIterator.hasNext()) { cell = cellIterator.next(); if (ScanUtil.isEmptyColumn(cell, this.emptyCF, this.emptyCQ)) { LOG.trace(String.format("** PHOENIX-TTL: Row expired for [%s], expired = %s **", cell.toString(), ScanUtil.isTTLExpired(cell, this.scan, this.now))); if (cellListSize > 1) { cellIterator.remove(); } return !ScanUtil.isTTLExpired(cell, this.scan, this.now); } } LOG.warn("The empty column does not exist in a row in " + region.getRegionInfo() .getTable().getNameAsString()); return true; }
Source:
<code>private void checkMissingQueues(String[] queueNames) { if (isMissingQueuesFatal()) { <START> RabbitAdmin checkAdmin = new RabbitAdmin(getConnectionFactory()); <END> for (String queue : queueNames) { Properties queueProperties = checkAdmin.getQueueProperties(queue); if (queueProperties == null && isMissingQueuesFatal()) { throw new IllegalStateException("At least one of the configured queues is missing"); } } } }</code><technical_language>newly introduced AbstractMessageListenerContainer.getRabbitAdmin()</technical_language>

Target:
private void checkMissingQueues(String[] queueNames) { if (isMissingQueuesFatal()) { RabbitAdmin checkAdmin = getRabbitAdmin(); if (checkAdmin == null) { checkAdmin = new RabbitAdmin(getConnectionFactory()); } for (String queue : queueNames) { Properties queueProperties = checkAdmin.getQueueProperties(queue); if (queueProperties == null && isMissingQueuesFatal()) { throw new IllegalStateException("At least one of the configured queues is missing"); } } } }
Source:
<code>public long getAllCount() { <START> return 1; <END> }</code><technical_language>I this zero</technical_language>

Target:
public long getAllCount() { return 0; }
Source:
<code>public void basics() throws JSONException { JSONObject jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); DataNode dataNode = new TestDataNode("datacenter", jsonObject, clusterMapConfig); assertEquals(dataNode.getHostname(), TestUtils.getLocalHost()); assertEquals(dataNode.getPort(), 6666); assertEquals(dataNode.getState(), HardwareState.AVAILABLE); assertEquals(dataNode.getDisks().size(), diskCount); assertEquals(dataNode.getRawCapacityInBytes(), diskCount * diskCapacityInBytes); assertNull(dataNode.getRackId()); assertEquals(Long.toString(TestUtils.DEFAULT_XID), dataNode.getXid()); assertEquals(dataNode.toJSONObject().toString(), jsonObject.toString()); assertEquals(dataNode, new TestDataNode("datacenter", dataNode.toJSONObject(), clusterMapConfig)); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, 42, 64, HardwareState.AVAILABLE, getDisks()); dataNode = new TestDataNode("datacenter", jsonObject, clusterMapConfig); assertEquals("42", dataNode.getRackId()); <START> assertEquals("64", dataNode.getXid()); <END> assertEquals(dataNode.toJSONObject().toString(), jsonObject.toString()); assertEquals(dataNode, new TestDataNode("datacenter", dataNode.toJSONObject(), clusterMapConfig)); }</code><technical_language>"64" in line 115 line 112 replaced TestUtils.DEFAULT_XID</technical_language>

Target:
public void basics() throws JSONException { JSONObject jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); DataNode dataNode = new TestDataNode("datacenter", jsonObject, clusterMapConfig); assertEquals(dataNode.getHostname(), TestUtils.getLocalHost()); assertEquals(dataNode.getPort(), 6666); assertEquals(dataNode.getState(), HardwareState.AVAILABLE); assertEquals(dataNode.getDisks().size(), diskCount); assertEquals(dataNode.getRawCapacityInBytes(), diskCount * diskCapacityInBytes); assertNull(dataNode.getRackId()); assertEquals(TestUtils.DEFAULT_XID, dataNode.getXid()); assertEquals(dataNode.toJSONObject().toString(), jsonObject.toString()); assertEquals(dataNode, new TestDataNode("datacenter", dataNode.toJSONObject(), clusterMapConfig)); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, 42, TestUtils.DEFAULT_XID, HardwareState.AVAILABLE, getDisks()); dataNode = new TestDataNode("datacenter", jsonObject, clusterMapConfig); assertEquals("42", dataNode.getRackId()); assertEquals(TestUtils.DEFAULT_XID, dataNode.getXid()); assertEquals(dataNode.toJSONObject().toString(), jsonObject.toString()); assertEquals(dataNode, new TestDataNode("datacenter", dataNode.toJSONObject(), clusterMapConfig)); }
Source:
<code>public void selectLoginMethod(String loginMethod) { <START> Assume.assumeTrue("This test is WiP, so it must be remade after adding a certain feature.",false); <END> new Select(authenticatorsSelect).selectByVisibleText(loginMethod); }</code><technical_language>I need this? I agree SelectAuthenticatorPage need rewritten KEYCLOAK-12469 is resolved, selecting authentication mechanism work in latest master - selecting mechanism in combobox, is some JS call triggered automatically redirect page selected authentication mechanism. If work, a regression of this PR some other cause... I fix tests this Assume is removed. In general, Assume is dangerous tests in-fact disabled, I places this..</technical_language>

Target:
public void selectLoginMethod(String loginMethod) { new Select(authenticatorsSelect).selectByVisibleText(loginMethod); }
Source:
<code>private static Druids.ScanQueryBuilder basicC(final BenchmarkSchemaInfo basicSchema) { final QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec(Collections.singletonList(basicSchema.getDataInterval())); <START> final List<String> dimUniformFilterVals = new ArrayList<>(); <END> final int resultNum = (int) (100000 * 0.1); final int step = 100000 / resultNum; for (int i = 1; i < 100001 && dimUniformFilterVals.size() < resultNum; i += step) { dimUniformFilterVals.add(String.valueOf(i)); } final String dimName = "dimUniform"; return Druids.newScanQueryBuilder() .filters(new SelectorDimFilter(dimName, "3", StrlenExtractionFn.instance())) .intervals(intervalSpec); }</code><technical_language>dimUniformFilterVals is unused</technical_language>

Target:
private static Druids.ScanQueryBuilder basicC(final BenchmarkSchemaInfo basicSchema) { final QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec(Collections.singletonList(basicSchema.getDataInterval())); final String dimName = "dimUniform"; return Druids.newScanQueryBuilder() .filters(new SelectorDimFilter(dimName, "3", StrlenExtractionFn.instance())) .intervals(intervalSpec); }
Source:
<code>public void listSettingRevisions() { ConfigurationClient configurationClient = createSyncConfigurationClient(); SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); PagedIterable<ConfigurationSetting> csStream = configurationClient.listSettingRevisions(settingSelector); csStream.streamByPage().forEach(setting -> { <START> System.out.printf("Key: %s, Value: %s", setting.value().get(0).key(), setting.value().get(0).value()); <END> }); END: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector }</code><technical_language>This a good example. Try grabbing page a variable more relevant it</technical_language>

Target:
public void listSettingRevisions() { ConfigurationClient client = createSyncConfigurationClient(); SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); client.listSettingRevisions(settingSelector).streamByPage().forEach(resp -> { System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), resp.request().url(), resp.statusCode()); resp.items().forEach(value -> { System.out.printf("Response value is %d %n", value); }); }); END: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector }
Source:
<code><START> public void createConnectors(List<String> listeners, List<String> adminListeners) { <END> List<Connector> connectors = new ArrayList<>(); for (String listener : listeners) { if (!listener.isEmpty()) { Connector connector = createConnector(listener); connectors.add(connector); log.info("Added connector for {}", listener); } } jettyServer.setConnectors(connectors.toArray(new Connector[connectors.size()])); if (adminListeners != null && !adminListeners.isEmpty()) { for (String adminListener : adminListeners) { Connector conn = createConnector(adminListener, ADMIN_SERVER_CONNECTOR_NAME); jettyServer.addConnector(conn); log.info("Added admin connector for {}", adminListener); } } }</code><technical_language>Do want a method signature for compatibility</technical_language>

Target:
public void createConnectors(List<String> listeners, List<String> adminListeners) { List<Connector> connectors = new ArrayList<>(); for (String listener : listeners) { if (!listener.isEmpty()) { Connector connector = createConnector(listener); connectors.add(connector); log.info("Added connector for {}", listener); } } jettyServer.setConnectors(connectors.toArray(new Connector[connectors.size()])); if (adminListeners != null && !adminListeners.isEmpty()) { for (String adminListener : adminListeners) { Connector conn = createConnector(adminListener, true); jettyServer.addConnector(conn); log.info("Added admin connector for {}", adminListener); } } }
Source:
<code>public GmmTrainer withInitialMeans(List<Vector> means) { A.notEmpty(means, "GMM should starts with non empty initial components list"); <START> this.initialMeans = means.stream().toArray(Vector[]::new); <END> this.countOfComponents = means.size(); return this; }</code><technical_language>stream()? wrong means.toArray(new Vector[0])</technical_language>

Target:
public GmmTrainer withInitialMeans(List<Vector> means) { A.notEmpty(means, "GMM should start with non empty initial components list"); this.initialMeans = means.toArray(new Vector[means.size()]); this.countOfComponents = means.size(); return this; }
Source:
<code>public BatchSecretDeliveryResource(@Readonly SecretController secretController, AclDAOFactory aclDAOFactory, ClientDAOFactory clientDAOFactory) { this.secretController = secretController; this.aclDAO = aclDAOFactory.readonly(); <START> this.clientDAO = clientDAOFactory.readwrite(); <END> }</code><technical_language>nit: this readonly()</technical_language>

Target:
public BatchSecretDeliveryResource(@Readonly SecretController secretController, AclDAOFactory aclDAOFactory, ClientDAOFactory clientDAOFactory) { this.secretController = secretController; this.aclDAO = aclDAOFactory.readonly(); this.clientDAO = clientDAOFactory.readonly(); }
Source:
<code>public Preferences() { chat = new ChatPrefs(); login = new LoginPrefs(); <START> lang= new LanguagePrefs(); <END> mainWindow = new WindowPrefs(); forgedAlliance = new ForgedAlliancePrefs(); themeName = new SimpleStringProperty(DEFAULT_THEME_NAME); lastGameType = new SimpleStringProperty(KnownFeaturedMod.DEFAULT.getString()); ignoredNotifications = new SimpleListProperty<>(observableArrayList()); notification = new NotificationsPrefs(); rememberLastTab = new SimpleBooleanProperty(true); lastGameTitle = new SimpleStringProperty(); lastMap = new SimpleStringProperty(); lastGameMinRating = new SimpleIntegerProperty(800); lastGameMaxRating = new SimpleIntegerProperty(1300); ranked1v1 = new Ranked1v1Prefs(); gamesViewMode = new SimpleStringProperty(); newsPrefs = new NewsPrefs(); developerPrefs = new DeveloperPrefs(); }</code><technical_language>language lang</technical_language>

Target:
public Preferences() { chat = new ChatPrefs(); login = new LoginPrefs(); localization = new LocalizationPrefs(); mainWindow = new WindowPrefs(); forgedAlliance = new ForgedAlliancePrefs(); themeName = new SimpleStringProperty(DEFAULT_THEME_NAME); lastGameType = new SimpleStringProperty(KnownFeaturedMod.DEFAULT.getString()); ignoredNotifications = new SimpleListProperty<>(observableArrayList()); notification = new NotificationsPrefs(); rememberLastTab = new SimpleBooleanProperty(true); lastGameTitle = new SimpleStringProperty(); lastMap = new SimpleStringProperty(); lastGameMinRating = new SimpleIntegerProperty(800); lastGameMaxRating = new SimpleIntegerProperty(1300); ranked1v1 = new Ranked1v1Prefs(); gamesViewMode = new SimpleStringProperty(); news = new NewsPrefs(); developer = new DeveloperPrefs(); }
Source:
<code>public void close() throws IOException { super.close(); transport.close(); <START> } <END></code><technical_language>Remember revert this file, transport class</technical_language>

Target:
public void close() throws IOException { super.close(); }