auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void processStateEvent(NodeStateEvent event) { assert adminExecutor.inEventLoop(); DefaultNode node = event.node; NodeState oldState = event.oldState; NodeState newState = event.newState; if (pending.containsKey(node)) { pendingStateEvents.put(node, event); } else if (newState == null || newState == NodeState.FORCED_DOWN) { ChannelPool pool = pools.remove(node); if (pool != null) { LOG.debug( "[{}] was {}, destroying pool", logPrefix, node, <START> newState == null ? "removed" : "forced down"); <END> pool.closeAsync() .exceptionally( error -> { Loggers.warnWithException(LOG, "[{}] Error closing pool", logPrefix, error); return null; }); } } else if (oldState == NodeState.FORCED_DOWN && newState == NodeState.UP && node.getDistance() != NodeDistance.IGNORED) { LOG.debug("[{}] was forced back UP, initializing pool", logPrefix, node); createOrReconnectPool(node); } }</code><technical_language>total here: matter debug log changes FORCED_DOWN forced in cases? I realize a log, a Debug log that. Again, total nitpick</technical_language>

Target:
private void processStateEvent(NodeStateEvent event) { assert adminExecutor.inEventLoop(); DefaultNode node = event.node; NodeState oldState = event.oldState; NodeState newState = event.newState; if (pending.containsKey(node)) { pendingStateEvents.put(node, event); } else if (newState == null || newState == NodeState.FORCED_DOWN) { ChannelPool pool = pools.remove(node); if (pool != null) { LOG.debug( "[{}] was {}, destroying pool", logPrefix, node, newState == null ? "removed" : newState.name()); pool.closeAsync() .exceptionally( error -> { Loggers.warnWithException(LOG, "[{}] Error closing pool", logPrefix, error); return null; }); } } else if (oldState == NodeState.FORCED_DOWN && newState == NodeState.UP && node.getDistance() != NodeDistance.IGNORED) { LOG.debug("[{}] was forced back UP, initializing pool", logPrefix, node); createOrReconnectPool(node); } }
Source:
<code>static double getSamplingValue(SamplingConfig.Identifier identifier) { <START> return new BigDecimal(Long.valueOf(getSamplingId(identifier).substring(0, 8), 16)) <END> .divide(new BigDecimal(0xFFFFFFFFL), 4, RoundingMode.FLOOR) .doubleValue(); }</code><technical_language>BigInteger BigDecimal calculate Pi a billion decimal places, overkill for calculating sampling group for event? a plain double</technical_language>

Target:
static double getSamplingValue(SamplingConfig.Identifier identifier) { String token = getSamplingId(identifier).substring(0, 8); return (double) Long.parseLong(token, 16) / (double) 0xFFFFFFFFL; }
Source:
<code>private List<File> getHadoopConfigurationFileItems(String localHadoopConfigurationDirectory) { final File file = new File(localHadoopConfigurationDirectory); if (file.exists() && file.isDirectory()) { <START> return Arrays.stream(file.listFiles()).filter(File::isFile).collect(Collectors.toList()); <END> } else { return Collections.emptyList(); } }</code><technical_language>Do need add files in HADOOP_CONF_DIR? map-reduce, yarn related config file, log4j properties in this directory. I core-site.xml hdfs-site.xml is enough</technical_language>

Target:
private List<File> getHadoopConfigurationFileItems(String localHadoopConfigurationDirectory) { final List<String> expectedFileNames = new ArrayList<>(); expectedFileNames.add("core-site.xml"); expectedFileNames.add("hdfs-site.xml"); final File directory = new File(localHadoopConfigurationDirectory); if (directory.exists() && directory.isDirectory()) { return Arrays.stream(directory.listFiles()) .filter(file -> file.isFile() && expectedFileNames.stream().anyMatch(name -> file.getName().equals(name))) .collect(Collectors.toList()); } else { return Collections.emptyList(); } }
Source:
<code>public Pool createAndEnrichPools(Pool pool, List<Pool> existingPools) { List<Pool> pools = poolRules.createAndEnrichPools(pool, existingPools); log.debug("Creating pools: ", pools.size()); boolean isPoolLocked = pool.isLocked(); for (Pool p : pools) { createPool(p); } for (Pool tempPool : pools) { <START> if (isPoolLocked) { <END> tempPool.setLocked(true); } } return pool; }</code><technical_language>skip declaration query here. locked flag is a simple boolean is returned Pool object, call optimized basically needing write out yourself. cases want explicitly cache stuff locally, dealing unboxing a simple accessor is more a data store, this is a case</technical_language>

Target:
public Pool createAndEnrichPools(Pool pool, List<Pool> existingPools) { List<Pool> pools = poolRules.createAndEnrichPools(pool, existingPools); log.debug("Creating pools: ", pools.size()); for (Pool p : pools) { createPool(p); } return pool; }
Source:
<code>protected Map<String, String> getCurrentExtras(Configuration configuration, Cluster cluster) { Map<String, String> extras = new HashMap<String, String>(); extras.put(Properties.PROPERTY_CONFIG_NAME, configuration.name); extras.put(Properties.PROPERTY_PLUGIN_NAME, state.getPlugin()); extras.put(Properties.PROPERTY_CLUSTER_SIZE, String.valueOf(cluster.getSize())); extras.put(Properties.PROPERTY_CLUSTER_MAX_SIZE, String.valueOf(state.getMaxClusterSize())); extras.put(Properties.PROPERTY_SLAVE_INDEX, String.valueOf(state.getSlaveIndex())); Cluster.Group group = cluster.getGroup(state.getSlaveIndex()); extras.put(Properties.PROPERTY_GROUP_NAME, group.name); extras.put(Properties.PROPERTY_GROUP_SIZE, String.valueOf(group.size)); for (Cluster.Group g : cluster.getGroups()) { for(int i = 0; i != g.size; i++){ <START> extras.put(Properties.PROPERTY_GROUP_PREFIX + g.name + "." + i, state.getSlaveAddress(cluster, g.name, i).getAddress().toString().substring(1)); END> } } for (Cluster.Group g : cluster.getGroups()) { extras.put(Properties.PROPERTY_GROUP_PREFIX + g.name + Properties.PROPERTY_SIZE_SUFFIX, String.valueOf(group.size)); } extras.put(Properties.PROPERTY_PROCESS_ID, String.valueOf(Utils.getProcessID())); return extras; }</code><technical_language>getHostAddress() instead of toString()</technical_language>

Target:
protected Map<String, String> getCurrentExtras(Configuration configuration, Cluster cluster) { Map<String, String> extras = new HashMap<String, String>(); extras.put(Properties.PROPERTY_CONFIG_NAME, configuration.name); extras.put(Properties.PROPERTY_PLUGIN_NAME, state.getPlugin()); extras.put(Properties.PROPERTY_CLUSTER_SIZE, String.valueOf(cluster.getSize())); extras.put(Properties.PROPERTY_CLUSTER_MAX_SIZE, String.valueOf(state.getMaxClusterSize())); extras.put(Properties.PROPERTY_SLAVE_INDEX, String.valueOf(state.getSlaveIndex())); Cluster.Group group = cluster.getGroup(state.getSlaveIndex()); extras.put(Properties.PROPERTY_GROUP_NAME, group.name); extras.put(Properties.PROPERTY_GROUP_SIZE, String.valueOf(group.size)); for (Cluster.Group g : cluster.getGroups()) { for(int i = 0; i != g.size; i++){ SlaveConnectionInfo ifaces = state.getSlaveAddresses(cluster, g.name, i); for (String s: ifaces.getInterfaceNames()) { extras.put(Properties.PROPERTY_GROUP_PREFIX + g.name + "." + i + "." + s, ifaces.getAddressesAsString(s, ",")); } } } for (Cluster.Group g : cluster.getGroups()) { extras.put(Properties.PROPERTY_GROUP_PREFIX + g.name + Properties.PROPERTY_SIZE_SUFFIX, String.valueOf(group.size)); } extras.put(Properties.PROPERTY_PROCESS_ID, String.valueOf(Utils.getProcessID())); return extras; }
Source:
<code>protected Protos.Resource rangeResource(String name, long begin, long end) { List<Protos.Resource> reservedResources = new LinkedList<>(); for (Protos.Resource resource : offer.getResourcesList()) { if (resource.hasRole() && !resource.getRole().equals("*")) { reservedResources.add(resource); } } String role = "*"; for (Protos.Resource resource : reservedResources) { <START> if (resource.getName().equalsIgnoreCase(name)) { <END> Protos.Value.Ranges ranges = resource.getRanges(); for (Protos.Value.Range range : ranges.getRangeList()) { if (range.getBegin() <= begin && range.getEnd() >= end) { role = resource.getRole(); break; } } } } return Protos.Resource.newBuilder() .setType(Protos.Value.Type.RANGES) .setName(name) .setRanges(Protos.Value.Ranges.newBuilder() .addRange(Protos.Value.Range.newBuilder() .setBegin(begin) .setEnd(end) ).build() ) .setRole(role) .build(); }</code><technical_language>equalsIgnoreCase instead of equals? This change original behavior</technical_language>

Target:
protected Protos.Resource rangeResource(String name, long begin, long end) { List<Protos.Resource> reservedResources = new LinkedList<>(); for (Protos.Resource resource : offer.getResourcesList()) { if (resource.hasRole() && !resource.getRole().equals("*")) { reservedResources.add(resource); } } String role = "*"; for (Protos.Resource resource : reservedResources) { if (resource.getName().equals(name)) { Protos.Value.Ranges ranges = resource.getRanges(); for (Protos.Value.Range range : ranges.getRangeList()) { if (range.getBegin() <= begin && range.getEnd() >= end) { role = resource.getRole(); break; } } } } return Protos.Resource.newBuilder() .setType(Protos.Value.Type.RANGES) .setName(name) .setRanges(Protos.Value.Ranges.newBuilder() .addRange(Protos.Value.Range.newBuilder() .setBegin(begin) .setEnd(end) ).build() ) .setRole(role) .build(); }
Source:
<code>public Iterator<DataFactory<ENTITY>> iterator() { <START> return Iterators.iterator( new DataFactory<ENTITY>() <END> { @Override public Data<ENTITY> create( Configuration config ) { return new Data<ENTITY>() { @Override public CharReadable stream() { return last = factory.apply( config ); } @Override public Decorator<ENTITY> decorator() { return decorator; } }; } } ); }</code><technical_language>Great place for a lambda ;) java return Iterators.iterator( config -> new Data<ENTITY>() { @Override public CharReadable stream() { return = factory.apply( config ); } @Override public Decorator<ENTITY> decorator() { return decorator; } } );</technical_language>

Target:
public Iterator<DataFactory<ENTITY>> iterator() { return Iterators.iterator( config -> new Data<ENTITY>() { @Override public CharReadable stream() { return last = factory.apply( config ); } @Override public Decorator<ENTITY> decorator() { return decorator; } } ); }
Source:
<code>public void onResearchFireworkDamage(final EntityDamageByEntityEvent e) { if (e.getEntityType() == EntityType.PLAYER && e.getDamager() instanceof Firework) <START> if (((Firework) e.getDamager()).getFireworkMeta().getPersistentDataContainer() <END> .get(new NamespacedKey(SlimefunPlugin.instance, "slime"), PersistentDataType.INTEGER) != null && ((Firework) e.getDamager()).getFireworkMeta().getPersistentDataContainer() .get(new NamespacedKey(SlimefunPlugin.instance, "slime"), PersistentDataType.INTEGER) == 1) e.setCancelled(true); }</code><technical_language>Create a Firework variable clean this a bit</technical_language>

Target:
public void onResearchFireworkDamage(final EntityDamageByEntityEvent e) { Firework fw = null; if (e.getDamager() instanceof Firework) { fw = (Firework) e.getDamager(); if (!fw.getMetadata("slime").isEmpty() && fw.getMetadata("slime").get(0).asBoolean()) e.setCancelled(true); } }
Source:
<code>public static <K, A> PriorityQueue<K, A> empty(Monoid<K> m, Equal<K> e) { <START> return priorityQueue(e, FingerTree.empty(m, (P2<K, A> p) -> p._1())); <END> }</code><technical_language>priorityQueue(e, FingerTree.empty(m, P2.__1()))</technical_language>

Target:
public static <K, A> PriorityQueue<K, A> empty(Monoid<K> m, Equal<K> e) { return priorityQueue(e, FingerTree.empty(m, P2.__1())); }
Source:
<code>private RexNode simplifyCoalesce(RexCall call) { final Set<String> digests = new HashSet<>(); final List<RexNode> operands = new ArrayList<>(); for (RexNode operand : call.getOperands()) { <START> operand = withUnknownAsFalse(false).simplify_(operand); <END> if (digests.add(operand.digest) && (!RexUtil.isNull(operand) || !unknownAsFalse)) { operands.add(operand); } if (!operand.getType().isNullable()) { break; } } switch (operands.size()) { case 0: return rexBuilder.makeNullLiteral(call.type); case 1: return operands.get(0); default: if (operands.equals(call.operands)) { return call; } return call.clone(call.type, operands); } }</code><technical_language>Please move withUnknownAsFalse(false) out of loop</technical_language>

Target:
private RexNode simplifyCoalesce(RexCall call) { final Set<String> digests = new HashSet<>(); final List<RexNode> operands = new ArrayList<>(); final RexSimplify simplify = withUnknownAsFalse(false); for (RexNode operand : call.getOperands()) { operand = simplify.simplify_(operand); if (digests.add(operand.digest)) { operands.add(operand); } if (!operand.getType().isNullable()) { break; } } switch (operands.size()) { case 0: return rexBuilder.makeNullLiteral(call.type); case 1: return operands.get(0); default: if (operands.equals(call.operands)) { return call; } return call.clone(call.type, operands); } }
Source:
<code>public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FILE_INPUT, ctx -> this.importedNames.clear()); context.registerSyntaxNodeConsumer(Tree.Kind.IMPORT_FROM, ctx -> { <START> PyImportFromTree importFrom = (PyImportFromTree) ctx.syntaxNode(); <END> for (PyAliasedNameTree aliasedName : importFrom.importedNames()) { addImportedName(aliasedName); } }); context.registerSyntaxNodeConsumer(Tree.Kind.IMPORT_NAME, ctx -> { PyImportNameTree importName = (PyImportNameTree) ctx.syntaxNode(); for (PyAliasedNameTree aliasedName : importName.modules()) { addImportedName(aliasedName); } }); context.registerSyntaxNodeConsumer(Tree.Kind.ASSIGNMENT_STMT, ctx -> { PyAssignmentStatementTree assignment = (PyAssignmentStatementTree) ctx.syntaxNode(); PyExpressionTree assignedValue = assignment.assignedValue(); for (int i = 0; i < assignment.lhsExpressions().size(); i++) { List<PyExpressionTree> expressions = assignment.lhsExpressions().get(i).expressions(); if (expressions.size() == 1 && CheckUtils.areEquivalent(assignedValue, expressions.get(0)) && !isException(assignment, assignedValue)) { ctx.addIssue(assignment.equalTokens().get(i), MESSAGE); } } }); context.registerSyntaxNodeConsumer(Tree.Kind.ANNOTATED_ASSIGNMENT, ctx -> { PyAnnotatedAssignmentTree assignment = (PyAnnotatedAssignmentTree) ctx.syntaxNode(); PyExpressionTree assignedValue = assignment.assignedValue(); PyExpressionTree variable = assignment.variable(); if (CheckUtils.areEquivalent(assignedValue, variable) && !isException(assignment, assignedValue)) { ctx.addIssue(assignment.equalToken(), MESSAGE); } }); }</code><technical_language>Nitpick : in order in lambda expression I a liner clearer here. ( (PyImportFromTree) ctx.syntaxNode()).importedNames().stream().forEach(this::addImportedName)</technical_language>

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FILE_INPUT, ctx -> this.importedNames.clear()); context.registerSyntaxNodeConsumer(Tree.Kind.IMPORT_FROM, ctx -> ((PyImportFromTree) ctx.syntaxNode()).importedNames().forEach(this::addImportedName)); context.registerSyntaxNodeConsumer(Tree.Kind.IMPORT_NAME, ctx -> ((PyImportNameTree) ctx.syntaxNode()).modules().forEach(this::addImportedName)); context.registerSyntaxNodeConsumer(Tree.Kind.ASSIGNMENT_STMT, this::checkAssignement); context.registerSyntaxNodeConsumer(Tree.Kind.ANNOTATED_ASSIGNMENT, this::checkAnnotatedAssignment); }
Source:
<code>public void testPerformFailureSuccessIssueClosedWithComponents() throws Exception { JiraCreateIssueNotifier notifier = spy(new JiraCreateIssueNotifier(JIRA_PROJECT, "", "", "")); doReturn(site).when(notifier).getSiteForProject((AbstractProject) Mockito.any()); Issue issue = mock(Issue.class); Status status = new Status(null, null, "Closed", null, null); when(session.createIssue(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyList(), Mockito.anyString())).thenReturn(issue); when(issue.getStatus()).thenReturn(status); when(session.getIssueByKey(Mockito.anyString())).thenReturn(issue); Assert.assertEquals(0, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.SUCCESS); when(currentBuild.getResult()).thenReturn(Result.FAILURE); Assert.assertTrue(notifier.perform(currentBuild, launcher, buildListener)); Assert.assertEquals(1, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.FAILURE); when(currentBuild.getResult()).thenReturn(Result.SUCCESS); Assert.assertTrue(notifier.perform(currentBuild, launcher, buildListener)); <START> Assert.assertEquals(0, temporaryDirectory.list().length); <END> }</code><technical_language>static imports shorten statements</technical_language>

Target:
public void testPerformFailureSuccessIssueClosedWithComponents() throws Exception { JiraCreateIssueNotifier notifier = spy(new JiraCreateIssueNotifier(JIRA_PROJECT, "", "", "")); doReturn(site).when(notifier).getSiteForProject((AbstractProject) Mockito.any()); Issue issue = mock(Issue.class); Status status = new Status(null, null, JiraCreateIssueNotifier.finishedStatuses.Closed.toString() , null, null); when(session.createIssue(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyList(), Mockito.anyString())).thenReturn(issue); when(issue.getStatus()).thenReturn(status); when(session.getIssueByKey(Mockito.anyString())).thenReturn(issue); assertEquals(0, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.SUCCESS); when(currentBuild.getResult()).thenReturn(Result.FAILURE); assertTrue(notifier.perform(currentBuild, launcher, buildListener)); assertEquals(1, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.FAILURE); when(currentBuild.getResult()).thenReturn(Result.SUCCESS); assertTrue(notifier.perform(currentBuild, launcher, buildListener)); assertEquals(0, temporaryDirectory.list().length); }
Source:
<code>public void shouldKeepStreamOpen() throws IOException, DoneException { DefaultLogCallback callback2 = new DefaultLogCallback(spec); callback.log(1, ts, "line 1"); callback2.log(1, ts, "line 2"); callback.log(1, ts, "line 3"); callback.close(); callback2.log(1, ts, "line 4"); callback2.close(); <START> List<String> lines = Files.readAllLines(path); <END> assertThat(lines, contains("callback-test> line 1", "callback-test> line 2", "callback-test> line 3", "callback-test> line 4")); }</code><technical_language>Java 8 stuck Java 7 for (this change in future). need some other read lines here</technical_language>

Target:
public void shouldKeepStreamOpen() throws IOException, DoneException { DefaultLogCallback callback2 = new DefaultLogCallback(spec); callback2.open(); callback.log(1, ts, "line 1"); callback2.log(1, ts, "line 2"); callback.log(1, ts, "line 3"); callback.close(); callback2.log(1, ts, "line 4"); callback2.close(); List<String> lines = Arrays.asList(FileUtils.fileReadArray(file)); assertThat(lines, contains("callback-test> line 1", "callback-test> line 2", "callback-test> line 3", "callback-test> line 4")); }
Source:
<code><START> private boolean isReviewFragmentActive() { <END> Fragment currentFragment = this.getFragmentManager ().findFragmentById(R.id.dashboard_details_container); if (currentFragment instanceof ReviewFragment) { return true; } return false; }</code><technical_language>@idelcano merge isReviewFragmentActive isSurveyFragmentActive a single function pass a parameter? simplify lines method return (currentFragment instanceof [Class])</technical_language>

Target:
private boolean isReviewFragmentActive() { return isFragmentActive(reviewFragment, R.id.dashboard_details_container); }
Source:
<code>protected AnchorListItem getBulkRelease(final ExtendedPagedTable<TaskSummary> extendedPagedTable) { final AnchorListItem bulkAbortNavLink = GWT.create(AnchorListItem.class); bulkAbortNavLink.setText(constants.Bulk_Release()); bulkAbortNavLink.setIcon(IconType.UNLOCK); bulkAbortNavLink.setIconFixedWidth(true); <START> bulkAbortNavLink.addClickHandler(event -> confirmPopup.show(constants.Release_Confirmation(), <END> constants.Release(), constants.Release_tasks(), getReleaseCommand(extendedPagedTable)) ); return bulkAbortNavLink; }</code><technical_language>@nmirasch I popup title question inverted in confirmpopup. Question is showing title, double check that</technical_language>

Target:
protected AnchorListItem getBulkRelease(final ExtendedPagedTable<TaskSummary> extendedPagedTable) { final AnchorListItem bulkReleaseNavLink = GWT.create(AnchorListItem.class); bulkReleaseNavLink.setText(constants.Bulk_Release()); bulkReleaseNavLink.setIcon(IconType.UNLOCK); bulkReleaseNavLink.setIconFixedWidth(true); bulkReleaseNavLink.addClickHandler(event -> confirmPopup.show(constants.Release_tasks(), constants.Release(), constants.Release_Confirmation(), getReleaseCommand(extendedPagedTable)) ); return bulkReleaseNavLink; }
Source:
<code>public void setup(TestContext context) throws Exception { this.context = context; if (writePercentage < 0) { throw new IllegalArgumentException("Write percentage can't be smaller than 0"); } if (writePercentage > 100) { throw new IllegalArgumentException("Write percentage can't be larger than 100"); } targetInstance = context.getTargetInstance(); warmupPartitions(log, targetInstance); values = new Object[valueCount]; Random random = new Random(); for (int k = 0; k < valueCount; k++) { if (useStringValue) { values[k] = makeString(valueLength); } else { values[k] = randomByteArray(random, valueLength); } } counters = new IAtomicReference[countersLength]; for (int k = 0; k < counters.length; k++) { <START> String key; <END> if(preventLocalCalls){ key = StringUtils.generateNotKeyOwnedBy(8, targetInstance); }else{ key = StringUtils.makeString(8); } IAtomicReference atomicReference = targetInstance.getAtomicReference(key); atomicReference.set(values[random.nextInt(values.length)]); counters[k] = atomicReference; } }</code><technical_language>need for this; generateKey takes care of preventing local calls</technical_language>

Target:
public void setup(TestContext context) throws Exception { this.context = context; if (writePercentage < 0) { throw new IllegalArgumentException("Write percentage can't be smaller than 0"); } if (writePercentage > 100) { throw new IllegalArgumentException("Write percentage can't be larger than 100"); } targetInstance = context.getTargetInstance(); warmupPartitions(log, targetInstance); values = new Object[valueCount]; Random random = new Random(); for (int k = 0; k < valueCount; k++) { if (useStringValue) { values[k] = makeString(valueLength); } else { values[k] = randomByteArray(random, valueLength); } } counters = new IAtomicReference[countersLength]; for (int k = 0; k < counters.length; k++) { String key = StringUtils.generateKey(8, preventLocalCalls, targetInstance); IAtomicReference atomicReference = targetInstance.getAtomicReference(key); atomicReference.set(values[random.nextInt(values.length)]); counters[k] = atomicReference; } }
Source:
<code>public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException { validateOzoneObj(obj); String prefixPath = obj.getPath(); metadataManager.getLock().acquirePrefixLock(prefixPath); try { OmPrefixInfo prefixInfo = metadataManager.getPrefixTable().get(prefixPath); List<OzoneAcl> list = null; if (prefixInfo != null) { list = prefixInfo.getAcls(); if (list != null && list.contains(acl)) { LOG.debug("acl exist for prefix path {}", acl, prefixPath); return false; } } if (list == null) { list = new ArrayList<>(); } <START> list.add(acl); <END> OmPrefixInfo.Builder upiBuilder = OmPrefixInfo.newBuilder(); upiBuilder.setName(prefixPath).setAcls(list); if (prefixInfo != null && prefixInfo.getMetadata() != null) { upiBuilder.addAllMetadata(prefixInfo.getMetadata()); } prefixInfo = upiBuilder.build(); metadataManager.getPrefixTable().put(prefixPath, prefixInfo); prefixTree.insert(prefixPath, prefixInfo); } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Add acl operation failed for prefix path:{} acl:{}", prefixPath, acl, ex); } throw ex; } finally { metadataManager.getLock().releasePrefixLock(prefixPath); } return true; }</code><technical_language>this point check if acl of type name exist. If exist set bit for new acls in existing acl instance</technical_language>

Target:
public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException { validateOzoneObj(obj); String prefixPath = obj.getPath(); metadataManager.getLock().acquirePrefixLock(prefixPath); try { OmPrefixInfo prefixInfo = metadataManager.getPrefixTable().get(prefixPath); List<OzoneAcl> list = null; if (prefixInfo != null) { list = prefixInfo.getAcls(); } if (list == null) { list = new ArrayList<>(); list.add(acl); } else { boolean found = false; for (OzoneAcl a: list) { if (a.getName().equals(acl.getName()) && a.getType() == acl.getType()) { found = true; a.getAclBitSet().or(acl.getAclBitSet()); break; } } if (!found) { list.add(acl); } } OmPrefixInfo.Builder upiBuilder = OmPrefixInfo.newBuilder(); upiBuilder.setName(prefixPath).setAcls(list); if (prefixInfo != null && prefixInfo.getMetadata() != null) { upiBuilder.addAllMetadata(prefixInfo.getMetadata()); } prefixInfo = upiBuilder.build(); metadataManager.getPrefixTable().put(prefixPath, prefixInfo); prefixTree.insert(prefixPath, prefixInfo); } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Add acl operation failed for prefix path:{} acl:{}", prefixPath, acl, ex); } throw ex; } finally { metadataManager.getLock().releasePrefixLock(prefixPath); } return true; }
Source:
<code>protected boolean markRef(String refName) { if (refName == null) return false; RepositoryTreeNode node; try { if (refName.startsWith(Constants.R_HEADS)) { Ref ref = <START> repo.findRef(refName); <END> if (ref == null) return false; node = new RefNode(localBranches, repo, ref); } else if (refName.startsWith(Constants.R_REMOTES)) { Ref ref = repo.findRef(refName); if (ref == null) return false; node = new RefNode(remoteBranches, repo, ref); } else if (Constants.HEAD.equals(refName)) { Ref ref = repo.findRef(refName); if (ref == null) return false; node = new AdditionalRefNode(references, repo, ref); } else { String mappedRef = Activator.getDefault().getRepositoryUtil() .mapCommitToRef(repo, refName, false); if (mappedRef != null && mappedRef.startsWith(Constants.R_REMOTES)) { Ref ref = repo.findRef(mappedRef); if (ref == null) return false; node = new RefNode(remoteBranches, repo, ref); } else if (mappedRef != null && mappedRef.startsWith(Constants.R_TAGS)) { Ref ref = repo.findRef(mappedRef); if (ref == null) return false; node = new TagNode(tags, repo, ref); } else return false; } } catch (IOException e) { return false; } branchTree.setSelection(new StructuredSelection(node), true); return true; }</code><technical_language>exactRef</technical_language>

Target:
protected boolean markRef(String refName) { if (refName == null) return false; RepositoryTreeNode node; try { if (refName.startsWith(Constants.R_HEADS)) { Ref ref = repo.exactRef(refName); if (ref == null) return false; node = new RefNode(localBranches, repo, ref); } else if (refName.startsWith(Constants.R_REMOTES)) { Ref ref = repo.exactRef(refName); if (ref == null) return false; node = new RefNode(remoteBranches, repo, ref); } else if (Constants.HEAD.equals(refName)) { Ref ref = repo.exactRef(refName); if (ref == null) return false; node = new AdditionalRefNode(references, repo, ref); } else { String mappedRef = Activator.getDefault().getRepositoryUtil() .mapCommitToRef(repo, refName, false); if (mappedRef != null && mappedRef.startsWith(Constants.R_REMOTES)) { Ref ref = repo.exactRef(mappedRef); if (ref == null) return false; node = new RefNode(remoteBranches, repo, ref); } else if (mappedRef != null && mappedRef.startsWith(Constants.R_TAGS)) { Ref ref = repo.exactRef(mappedRef); if (ref == null) return false; node = new TagNode(tags, repo, ref); } else return false; } } catch (IOException e) { return false; } branchTree.setSelection(new StructuredSelection(node), true); return true; }
Source:
<code>public synchronized void stop(final StopContext context) { NamingStore namingStore = namingStoreInjector.getOptionalValue(); if(namingStore!= null) { Queue managementQueue = ActiveMQJMSClient.createQueue("activemq.management"); final NamingContext storeBaseContext = new NamingContext(namingStore, null); try { QueueConnectionFactory cf = (QueueConnectionFactory) storeBaseContext.lookup(pcfInjector.getValue().getBindInfo().getAbsoluteJndiName()); <START> try (QueueConnection connection = cf.createQueueConnection()) { <END> QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); connection.start(); QueueRequestor requestor = new QueueRequestor(session, managementQueue); Message m = session.createMessage(); org.apache.activemq.artemis.api.jms.management.JMSManagementHelper.putOperationInvocation(m, ResourceNames.BROKER, "destroyQueue", JMS_QUEUE_PREFIX + queueName, true, true); Message reply = requestor.request(m); ROOT_LOGGER.debugf("Deleting queue %s returned %s", JMS_QUEUE_PREFIX + queueName, reply); boolean success = reply.getBooleanProperty("_AMQ_OperationSucceeded"); if(success) { ROOT_LOGGER.infof("Queue %s has been deleted", JMS_QUEUE_PREFIX + queueName); } else { ROOT_LOGGER.errorf("Deleting queue %s failed with error %s", queue, reply.getBody(String.class)); } } } catch (NamingException | JMSException ex) { throw new RuntimeException(ex); } finally { try { storeBaseContext.close(); } catch (NamingException ex) { throw new RuntimeException(ex); } } } queue = null; }</code><technical_language>if remote Artemis enabled authentication management address</technical_language>

Target:
public synchronized void stop(final StopContext context) { if(sessionFactory != null) { sessionFactory.close(); } }
Source:
<code>public void finish() { if (state == State.NEEDS_INPUT) { state = State.HAS_OUTPUT; <START> mergedPages = unspill(); <END> } }</code><technical_language>this suggest spill happened. call unspill(): getSortedPages()</technical_language>

Target:
public void finish() { if (state == State.NEEDS_INPUT) { state = State.HAS_OUTPUT; WorkProcessor<Page> resultPages = getSortedPages( new SimplePageWithPositionComparator(sourceTypes, sortChannels, sortOrder)); sortedPages = resultPages.iterator(); } }
Source:
<code><START> public static IIrsServer createIrsServer(VdsProtocol vdsProtocol, Version version, String hostname, int port, int clientTimeOut, <END> int connectionTimeOut, int clientRetries, int heartbeat) { IIrsServer irsServer = null; if (VdsProtocol.STOMP == vdsProtocol) { String eventQueue = null; if (FeatureSupported.events(version)) { eventQueue = Config.<String> getValue(ConfigValues.EventQueueName); } irsServer = new JsonRpcIIrsServer(JsonRpcUtils.createStompClient(hostname, port, connectionTimeOut, clientTimeOut, clientRetries, heartbeat, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication), Config.<String> getValue(ConfigValues.VdsmSSLProtocol), Config.<Integer> getValue(ConfigValues.EventProcessingPoolSize), Config.<String> getValue(ConfigValues.IrsRequestQueueName), Config.<String> getValue(ConfigValues.IrsResponseQueueName), eventQueue)); } else if (VdsProtocol.XML == vdsProtocol){ Pair<IrsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(hostname, port, clientTimeOut, connectionTimeOut, clientRetries, Config.<Integer> getValue(ConfigValues.IrsMaxConnectionsPerHost), Config.<Integer> getValue(ConfigValues.MaxTotalConnections), IrsServerConnector.class, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)); irsServer = new IrsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); } return irsServer; }</code><technical_language>please format signature - long</technical_language>

Target:
public static IIrsServer createIrsServer(VdsProtocol vdsProtocol, Version version, String hostname, int port, int clientTimeOut, int connectionTimeOut, int clientRetries, int heartbeat) { IIrsServer irsServer = null; if (VdsProtocol.STOMP == vdsProtocol) { String eventQueue = getEventsQueue(version); irsServer = new JsonRpcIIrsServer(JsonRpcUtils.createStompClient(hostname, port, connectionTimeOut, clientTimeOut, clientRetries, heartbeat, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication), Config.<String> getValue(ConfigValues.VdsmSSLProtocol), Config.<Integer> getValue(ConfigValues.EventProcessingPoolSize), Config.<String> getValue(ConfigValues.IrsRequestQueueName), Config.<String> getValue(ConfigValues.IrsResponseQueueName), eventQueue)); } else if (VdsProtocol.XML == vdsProtocol){ Pair<IrsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(hostname, port, clientTimeOut, connectionTimeOut, clientRetries, Config.<Integer> getValue(ConfigValues.IrsMaxConnectionsPerHost), Config.<Integer> getValue(ConfigValues.MaxTotalConnections), IrsServerConnector.class, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)); irsServer = new IrsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); } return irsServer; }
Source:
<code>public BodyParser bodyHandler(final Consumer<String> bodyHandler) { return new BodyParser(tagName, bodyHandler); <START> } <END></code><technical_language>This</technical_language>

Target:
public void bodyHandler(final Consumer<String> bodyHandler) { this.bodyHandler = bodyHandler; }
Source:
<code>public void write(RawMessage rawMessage) { if (gateway.getAuthorizedUser() != null && gateway.getAuthorizedUser().length() > 0) { <START> _logger.info("Send data: {}, {}", this.gateway, rawMessage); <END> @SuppressWarnings("unchecked") List<String> data = (List<String>) rawMessage.getData(); MESSAGE_TYPE type = MESSAGE_TYPE.fromString(data.get(2)); if (data.size() == 4) { if (type == MESSAGE_TYPE.C_SET) { MESSAGE_TYPE_SET_REQ subType = MESSAGE_TYPE_SET_REQ.fromString(data.get(3)); State state = getHueUpdateState(subType, data); if (state != null) philipsHueClient.lights().updateState(data.get(0), state); } else if (type == MESSAGE_TYPE.C_INTERNAL) { switch (MESSAGE_TYPE_INTERNAL.fromString(data.get(3))) { case I_PRESENTATION: if (!isOnRequestUpdate()) { setOnRequestUpdate(true); } break; default: break; } } } else { _logger.error("data array size should be exactly 4, data:{}", data); } } else { _logger.warn("Private key not set for this {}", gateway); } }</code><technical_language>@Fraid change this log debug</technical_language>

Target:
public void write(RawMessage rawMessage) { if (gateway.getAuthorizedUser() != null && gateway.getAuthorizedUser().length() > 0) { _logger.debug("Send data: {}, {}", this.gateway, rawMessage); @SuppressWarnings("unchecked") List<String> data = (List<String>) rawMessage.getData(); if (data.size() == 4) { MESSAGE_TYPE type = MESSAGE_TYPE.fromString(data.get(0)); String subTypeString = data.get(1); String sensorId = data.get(2); String payload = data.get(3); if (type == MESSAGE_TYPE.C_SET) { MESSAGE_TYPE_SET_REQ subType = MESSAGE_TYPE_SET_REQ.fromString(subTypeString); try { State state = getHueUpdateState(subType, sensorId, payload); if (state != null) { ClientResponse<String> updateState = philipsHueClient.lights().updateState( sensorId, state); if (updateState != null && !updateState.isSuccess()) { _logger.debug("Error while updating hue lights: {}, ", updateState, rawMessage); } } else _logger.warn(" Unable to update ", rawMessage); } catch (Exception ex) { _logger.error("Exception, ", ex); } } else if (type == MESSAGE_TYPE.C_INTERNAL) { MESSAGE_TYPE_INTERNAL subType = MESSAGE_TYPE_INTERNAL.fromString(subTypeString); switch (subType) { case I_PRESENTATION: setOnRequestUpdate(true); break; default: _logger.error(" Not supported internal message: ", subType); break; } } } else { _logger.error("data array size should be exactly 4, data:{}", data); } } else { _logger.warn("Private key not set for this {}", gateway); } }
Source:
<code>public ReferencedEnvelope getLatLonBounds(ReferencedEnvelope nativeBounds, CoordinateReferenceSystem declaredCRS) throws IOException { if (nativeBounds != null && declaredCRS != null) { if (nativeBounds.isEmpty()) { <START> return new ReferencedEnvelope(nativeBounds, DefaultGeographicCRS.WGS84); <END> } if (!CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, declaredCRS)) { try { ReferencedEnvelope bounds = new ReferencedEnvelope(nativeBounds, declaredCRS); return bounds.transform(DefaultGeographicCRS.WGS84, true); } catch (Exception e) { throw (IOException) new IOException("transform error").initCause(e); } } else { return new ReferencedEnvelope(nativeBounds, DefaultGeographicCRS.WGS84); } } return null; }</code><technical_language>Stefano, wondering, is this way, bounds published in WFS valid schema wise? for geometryless data I a valid bbox, e.g., maxx > minx, maxy > miny</technical_language>

Target:
public ReferencedEnvelope getLatLonBounds(ReferencedEnvelope nativeBounds, CoordinateReferenceSystem declaredCRS) throws IOException { if (nativeBounds != null && declaredCRS != null) { if (!CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, declaredCRS)) { try { ReferencedEnvelope bounds = new ReferencedEnvelope(nativeBounds, declaredCRS); return bounds.transform(DefaultGeographicCRS.WGS84, true); } catch (Exception e) { throw (IOException) new IOException("transform error").initCause(e); } } else { return new ReferencedEnvelope(nativeBounds, DefaultGeographicCRS.WGS84); } } return null; }
Source:
<code>public static Range minimizeEndKeyTimeStamp(Range range) { Range seekRange = range; if (range.getEndKey() != null) { <START> Key seekKey = new Key(seekRange.getEndKey()); <END> if (range.getEndKey().getTimestamp() != Long.MIN_VALUE) { seekKey = new Key(seekRange.getEndKey()); seekKey.setTimestamp(Long.MIN_VALUE); seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true); } else if (!range.isEndKeyInclusive()) { seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true); } } return seekRange; }</code><technical_language>This creates a new Key, used. Also, in if stmt block recreates key created here</technical_language>

Target:
public static Range minimizeEndKeyTimeStamp(Range range) { Range seekRange = range; if (range.getEndKey() != null) { Key seekKey = seekRange.getEndKey(); if (range.getEndKey().getTimestamp() != Long.MIN_VALUE) { seekKey = new Key(seekRange.getEndKey()); seekKey.setTimestamp(Long.MIN_VALUE); seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true); } else if (!range.isEndKeyInclusive()) { seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true); } } return seekRange; }
Source:
<code>HttpServer.Method convertMethod(HttpServerRequest request) { switch (request.method()) { case GET: return HttpServer.Method.GET; case POST: return HttpServer.Method.POST; case DELETE: return HttpServer.Method.DELETE; case PUT: return HttpServer.Method.PUT; <START> default: <END> return HttpServer.Method.GET; } }</code><technical_language>omit case GET default</technical_language>

Target:
HttpServer.Method convertMethod(HttpServerRequest request) { switch (request.method()) { case POST: return HttpServer.Method.POST; case DELETE: return HttpServer.Method.DELETE; case PUT: return HttpServer.Method.PUT; default: return HttpServer.Method.GET; } }
Source:
<code>public void optimizeStatement() throws StandardException { if (sparkExplainKind != SparkExplainKind.NONE) { getCompilerContext().setDataSetProcessorType(DataSetProcessorType.FORCED_SPARK); } node.optimizeStatement(); <START> if (!showNoStatsObjects) return; <END> HashSet<String> noStatsColumnSet = new HashSet<>(); CollectNodesVisitor cnv = new CollectNodesVisitor(FromBaseTable.class); node.accept(cnv); List<FromBaseTable> baseTableNodes = cnv.getList(); for (FromBaseTable t : baseTableNodes) { String tableName = t.getExposedName(); if (!t.useRealTableStats()) { noStatsTables.add(new SQLVarchar(tableName)); } else if (!t.getNoStatsColumnIds().isEmpty()) { TableDescriptor td = t.getTableDescriptor(); for (int columnId : t.getNoStatsColumnIds()) { noStatsColumnSet.add(tableName + "." + td.getColumnDescriptor(columnId).getColumnName()); } } } cnv = new CollectNodesVisitor(BinaryRelationalOperatorNode.class); node.accept(cnv); List<BinaryRelationalOperatorNode> binaryOpNodes = cnv.getList(); for (BinaryRelationalOperatorNode bop : binaryOpNodes) { noStatsColumnSet.addAll(bop.getNoStatsColumns()); } cnv = new CollectNodesVisitor(GroupByNode.class); node.accept(cnv); List<GroupByNode> groupByNodes = cnv.getList(); for (GroupByNode gbn : groupByNodes) { noStatsColumnSet.addAll(gbn.getNoStatsColumns()); } for (String columnName : noStatsColumnSet) { noStatsColumns.add(new SQLVarchar(columnName)); } }</code><technical_language>this "early out" dangerous me. miss add end of function, of this function is executed if showNoStatsObjects. do if( showNoStatsObjects ) { // code } - extract a function if( showNoStatsObjects ) noStatsColumns = getNoStatsColumns();</technical_language>

Target:
public void optimizeStatement() throws StandardException { if (sparkExplainKind != SparkExplainKind.NONE) { getCompilerContext().setDataSetProcessorType(DataSetProcessorType.FORCED_SPARK); } node.optimizeStatement(); if (showNoStatsObjects) { collectNoStatsTablesAndColumns(); } }
Source:
<code>public void setPattern(String pattern){ if( pattern == null){ patternTextField.setText(""); }else{ patternTextField.setText(pattern); <START> } <END> }</code><technical_language>simplify patternTextField.setText(pattern == null ? "" : pattern);</technical_language>

Target:
public void setPattern(String pattern){ patternTextField.setText(pattern); }
Source:
<code>public ScrollResult scroll(String scrollId, Function<O, String> idExtractor) { CursorResult<C, O> cursorResult = cursorResults.get(scrollId); if (cursorResult == null) { throw new NuxeoException("Unknown or timed out scrollId"); } else if (isScrollTimedOut(scrollId, cursorResult)) { throw new NuxeoException("Timed out scrollId"); } cursorResult.touch(); List<String> ids = new ArrayList<>(cursorResult.getBatchSize()); List<O> results = new ArrayList<>(cursorResult.getBatchSize()); synchronized (cursorResult) { if (!cursorResult.hasNext()) { unregisterCursor(scrollId); return emptyResult(); } while (ids.size() < cursorResult.getBatchSize()) { if (!cursorResult.hasNext()) { cursorResult.close(); break; } else { O obj = cursorResult.next(); <START> results.add(obj); <END> String id = idExtractor.apply(obj); if (id == null) { log.error("Got a document without id: " + obj); } else { ids.add(id); } } } } return new ScrollResultImpl<>(scrollId, ids, results); }</code><technical_language>I record objects time other scroll users (that call getResultIds(), for example for repository doc id scrolling) need it. Instead please add a boolean method signature switch this recording (and original method signature call this recording)</technical_language>

Target:
public ScrollResult scroll(String scrollId, Function<O, String> idExtractor) { return scroll(scrollId, false, idExtractor); }
Source:
<code>public MultipartUpload initiateMultipartUpload(String container, BlobMetadata blobMetadata) { <START> Long contentLength = blobMetadata.getContentMetadata().getContentLength(); <END> String uploadId = String.format("%s/slo/%.6f/%s", blobMetadata.getName(), System.currentTimeMillis() / 1000.0, contentLength == null ? 0 : contentLength); return MultipartUpload.create(container, blobMetadata.getName(), uploadId, blobMetadata); }</code><technical_language>Call initiateMultipartUpload(container, blobMetadata, 0)</technical_language>

Target:
public MultipartUpload initiateMultipartUpload(String container, BlobMetadata blobMetadata) { return initiateMultipartUpload(container, blobMetadata, 0); }
Source:
<code>private CompletableFuture<Void> removeJob(JobID jobId, boolean cleanupHA) { DispatcherJob job = runningJobs.remove(jobId); <START> final CompletableFuture<Void> jobManagerRunnerTerminationFuture; <END> if (job != null) { jobManagerRunnerTerminationFuture = job.closeAsync(); } else { jobManagerRunnerTerminationFuture = CompletableFuture.completedFuture(null); } return jobManagerRunnerTerminationFuture.thenRunAsync( () -> cleanUpJobData(jobId, cleanupHA), getRpcService().getExecutor()); }</code><technical_language>Please update field names reflect new abstraction. I jobTerminationFuture dispatcherJobTerminationFuture now</technical_language>

Target:
private CompletableFuture<Void> removeJob(JobID jobId, boolean cleanupHA) { DispatcherJob job = runningJobs.remove(jobId); final CompletableFuture<Void> dispatcherJobTerminationFuture; if (job != null) { dispatcherJobTerminationFuture = job.closeAsync(); } else { dispatcherJobTerminationFuture = CompletableFuture.completedFuture(null); } return dispatcherJobTerminationFuture.thenRunAsync( () -> cleanUpJobData(jobId, cleanupHA), getRpcService().getExecutor()); }
Source:
<code>FetchV0Request(@NonNull Set<ObjectId> wantIds, int depth, @NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit, @NonNull Set<String> clientCapabilities) { super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities, 0, <START> new ArrayList<String>()); <END> }</code><technical_language>Collections.emptyList()</technical_language>

Target:
FetchV0Request(@NonNull Set<ObjectId> wantIds, int depth, @NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit, @NonNull Set<String> clientCapabilities) { super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities, 0, Collections.emptyList()); }
Source:
<code>private List<PropertyLink> createLinks(String identifier, BioentityPropertyName propertyName, Collection<String> propertyValues, Species species) { List<PropertyLink> links = bioEntityPropertyService.mapToLinkText(propertyName, propertyValues).entrySet().stream() .map( linkWithText -> createLink( linkWithText.getValue(), identifier, propertyName, linkWithText.getKey(), species, bioEntityPropertyService.assessRelevance(propertyName, linkWithText.getKey()) ) ).collect(Collectors.toList()); links.sort((PropertyLink p1, PropertyLink p2) -> p2.getRelevance() - p1.getRelevance()); <START> return links; <END> }</code><technical_language>Java streams a [.sorted](<LINK_0> method chain, this be: return bioEntityPropertyService.mapToLinkText(propertyName, propertyValues).entrySet().stream() ... .sorted((p1, p2) -> p2.getRelevance() - p1.getRelevance()) .collect(toList()) comparator simplified .sorted(comparing(PropertyLink::getRelevance)) check docs first</technical_language>

Target:
private List<PropertyLink> createLinks(String identifier, BioentityPropertyName propertyName, Collection<String> propertyValues, Species species) { List<PropertyLink> links = bioEntityPropertyService.mapToLinkText(propertyName, propertyValues).entrySet().stream() .map( linkWithText -> createLink( linkWithText.getValue(), identifier, propertyName, linkWithText.getKey(), species, bioEntityPropertyService.assessRelevance(propertyName, linkWithText.getKey()) ) ) .sorted(Comparator.comparing(PropertyLink::getRelevance).reversed()) .collect(Collectors.toList()); return links; }