auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String changePagination() { int[] pageSelection = new int[allPagesSelection.length]; for (int i = 0; i < allPagesSelection.length; i++) { pageSelection[i] = Integer.parseInt(allPagesSelection[i].split(":")[0]) - 1; } try { paginator.setPageSelection(pageSelection); paginator.setPagesToPaginate(allPagesNew); paginator.setFictitious(fictitious); paginator.setPaginationSeparator(paginationSeparators.getObject().getSeparatorString()); paginator.setPaginationStartValue(paginationValue); paginator.run(); } catch (IllegalArgumentException e) { <START> logger.error(e.getMessage(), e); <END> Helper.setFehlerMeldung("fehlerBeimEinlesen", e.getMessage()); } allPagesSelection = null; retrieveAllImages(); if (!updateBlocked()) { return "SperrungAbgelaufen"; } return null; }</code><technical_language>setErrorMessage</technical_language>

Target:
public String changePagination() { int[] pageSelection = new int[allPagesSelection.length]; for (int i = 0; i < allPagesSelection.length; i++) { pageSelection[i] = Integer.parseInt(allPagesSelection[i].split(":")[0]) - 1; } try { paginator.setPageSelection(pageSelection); paginator.setPagesToPaginate(allPagesNew); paginator.setFictitious(fictitious); paginator.setPaginationSeparator(paginationSeparators.getObject().getSeparatorString()); paginator.setPaginationStartValue(paginationValue); paginator.run(); } catch (IllegalArgumentException e) { Helper.setErrorMessage("fehlerBeimEinlesen", logger, e); } allPagesSelection = null; retrieveAllImages(); if (!updateBlocked()) { return "SperrungAbgelaufen"; } return null; }
Source:
<code>private static List<InetSocketAddress> loadRouters(String hostsFilePath) throws IOException { List<String> hostPorts; try (Reader reader = new FileReader(hostsFilePath)) { hostPorts = new Gson().fromJson(reader, List.class); } <START> List<InetSocketAddress> routers = new LinkedList<>(); <END> for (String hostPort : hostPorts) { String[] hostPortPair = hostPort.split(Pattern.quote(":")); String host = hostPortPair[0]; int port = Integer.parseInt(hostPortPair[1]); InetSocketAddress router = new InetSocketAddress(host, port); routers.add(router); } return routers; }</code><technical_language>ArrayList</technical_language>

Target:
private static List<InetSocketAddress> loadRouters(String hostsFilePath) throws IOException { List<String> hostPorts; try (Reader reader = new FileReader(hostsFilePath)) { hostPorts = new Gson().fromJson(reader, List.class); } List<InetSocketAddress> routers = new ArrayList<>(); for (String hostPort : hostPorts) { String[] hostPortPair = hostPort.split(Pattern.quote(":")); String host = hostPortPair[0]; int port = Integer.parseInt(hostPortPair[1]); InetSocketAddress router = new InetSocketAddress(host, port); routers.add(router); } return routers; }
Source:
<code>public boolean checksEventType(GameEvent event, Game game) { if (event.getType() == EventType.TAPPED_FOR_MANA) { ManaEvent manaEvent = (ManaEvent) event; Mana mana = manaEvent.getMana(); return mana.count() > 1; <START> } <END> return false; }</code><technical_language>Is reason applies logic in check event type method</technical_language>

Target:
public boolean checksEventType(GameEvent event, Game game) { return event.getType() == EventType.TAPPED_FOR_MANA; }
Source:
<code>public void cachePeriodicUpdateTriggered() throws InterruptedException { final Cache cache = Mockito.mock(Cache.class); final ZookeeperNodeInvalidator invalidator = new ZookeeperNodeInvalidator(cache, CURATOR, "/xxx/yyy1", 100); invalidator.start(); try { <START> ThreadUtils.sleep(600); <END> Mockito.verify(cache, Mockito.atLeast(4)).refresh(); Mockito.verify(cache, Mockito.atMost(7)).refresh(); } finally { invalidator.stop(); } }</code><technical_language>leave this test this I easy verify is a refresher running, if fails due timing, I a problem in removing it</technical_language>

Target:
public void cachePeriodicUpdateTriggered() throws InterruptedException { final Cache cache = Mockito.mock(Cache.class); final long forceRefreshMs = 100; final ZookeeperNodeInvalidator invalidator = new ZookeeperNodeInvalidator(cache, CURATOR, "/xxx/yyy1", forceRefreshMs); invalidator.start(); try { final long startedAt = System.currentTimeMillis(); waitForNCachesRefreshes(6, false, Collections.singleton(cache)); final long allRefreshesFinished = System.currentTimeMillis(); Assert.assertTrue((allRefreshesFinished - startedAt) >= (4 * forceRefreshMs)); } finally { invalidator.stop(); } }
Source:
<code>private List<UserResponse> getCloudstackUsers() { if (cloudstackUsers == null) { ListResponse<UserResponse> cloudstackUsersresponse; switch (getUserFilter()) { <START> case ANY_DOMAIN: <END> cloudstackUsersresponse = _queryService.searchForUsers(CallContext.current().getCallingAccount().getDomainId(), true); break; case NO_FILTER: cloudstackUsersresponse = _queryService.searchForUsers(this.domainId,true); break; case POTENTIAL_IMPORT: case LOCAL_DOMAIN: cloudstackUsersresponse = _queryService.searchForUsers(this.domainId,false); break; default: throw new CloudRuntimeException("error in program login; we are not filtering but still querying users to filter???"); } cloudstackUsers = cloudstackUsersresponse.getResponses(); if(s_logger.isTraceEnabled()) { StringBuilder users = new StringBuilder(); for (UserResponse user : cloudstackUsers) { if (users.length()> 0) { users.append(", "); } users.append(user.getUsername()); } s_logger.trace(String.format("checking against %d cloudstackusers: %s.", this.cloudstackUsers.size(), users.toString())); } } return cloudstackUsers; }</code><technical_language>Minor - cases indented a tab</technical_language>

Target:
private List<UserResponse> getCloudstackUsers() { if (cloudstackUsers == null) { try { cloudstackUsers = getUserFilter().getCloudstackUserList(this).getResponses(); } catch (IllegalArgumentException e) { throw new CloudRuntimeException("error in program login; we are not filtering but still querying users to filter???", e); } traceUserList(); } return cloudstackUsers; }
Source:
<code>public String getContent(String guid, PageOrientation orientation) { checkInitialized(); String toReturn; DataRightAnchor anchor = guidToAnchor.get(guid); DataRightId key = anchor.getDataRightId(); boolean needsPageBreak = anchor.isNeedsPageBreak(); boolean isNextDifferent = anchor.isNextDifferent(); DataRight dataRight = dataRightIdToDataRight.get(key); String partialFooter = dataRight.getContent(); if (orientation.isLandscape()) { toReturn = partialFooter; } else if (isNextDifferent || needsPageBreak) { <START> if (!needsPageBreak) { <END> toReturn = String.format(SAME_PAGE_TEMPLATE, partialFooter); } else { toReturn = String.format(NEW_PAGE_TEMPLATE, partialFooter); } } else { toReturn = ""; } return toReturn; }</code><technical_language>minor helps for readability. if invert this if statement, reads: if(needsPageBreak) instead, more clear</technical_language>

Target:
public String getContent(String guid, PageOrientation orientation) { checkInitialized(); String toReturn; DataRightAnchor anchor = guidToAnchor.get(guid); DataRightId key = anchor.getDataRightId(); boolean needsPageBreak = anchor.isNeedsPageBreak(); boolean isNextDifferent = anchor.isNextDifferent(); DataRight dataRight = dataRightIdToDataRight.get(key); String partialFooter = dataRight.getContent(); if (orientation.isLandscape()) { toReturn = partialFooter; } else if (isNextDifferent || needsPageBreak) { if (needsPageBreak) { toReturn = String.format(NEW_PAGE_TEMPLATE, partialFooter); } else { toReturn = String.format(SAME_PAGE_TEMPLATE, partialFooter); } } else { toReturn = ""; } return toReturn; }
Source:
<code>private void addOperatorAddToSet(IVariant variant, BasicDBObject update) { BasicDBObject addToSet = new BasicDBObject(); if (!variant.getSourceEntries().isEmpty()) { IVariantSourceEntry variantSourceEntry = getVariantSourceEntry(variant); addToSet.put(VariantMongo.FILES_FIELD, convertSourceEntry(variantSourceEntry)); if (includeStats) { BasicDBList statistics = convertStatistics(variantSourceEntry); addToSet.put(VariantMongo.STATISTICS_FIELD, new BasicDBObject("$each", statistics)); } } if (variant.getIds() != null && !variant.getIds().isEmpty()) { addToSet.put(IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } <START> if (variant.getDbsnpIds() != null && !variant.getDbsnpIds().isEmpty()) { <END> addToSet.put(DBSNP_IDS_FIELD, new BasicDBObject("$each", variant.getDbsnpIds())); } if (!addToSet.isEmpty()) { update.put("$addToSet", addToSet); } }</code><technical_language>I guess this is more of a defensive code, right? getDbsnpIds return null in case</technical_language>

Target:
private void addOperatorAddToSet(IVariant variant, BasicDBObject update) { BasicDBObject addToSet = new BasicDBObject(); if (!variant.getSourceEntries().isEmpty()) { IVariantSourceEntry variantSourceEntry = getVariantSourceEntry(variant); addToSet.put(VariantMongo.FILES_FIELD, convertSourceEntry(variantSourceEntry)); if (includeStats) { BasicDBList statistics = convertStatistics(variantSourceEntry); addToSet.put(VariantMongo.STATISTICS_FIELD, new BasicDBObject("$each", statistics)); } } if (!variant.getIds().isEmpty()) { addToSet.put(IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } if (!variant.getDbsnpIds().isEmpty()) { addToSet.put(DBSNP_IDS_FIELD, new BasicDBObject("$each", variant.getDbsnpIds())); } if (!addToSet.isEmpty()) { update.put("$addToSet", addToSet); } }
Source:
<code>public synchronized void deleteRepository( String id ) throws NoSuchRepositoryException, IOException, ConfigurationException { Repository repository = repositoryRegistry.getRepository( id ); repository.setLocalStatus( LocalStatus.OUT_OF_SERVICE ); repository.setIndexable( false ); repository.setSearchable( false ); List<ShadowRepository> shadows = repositoryRegistry.getRepositoriesWithFacet( ShadowRepository.class ); for ( Iterator<ShadowRepository> i = shadows.iterator(); i.hasNext(); ) { ShadowRepository shadow = i.next(); if ( repository.getId().equals( shadow.getMasterRepository().getId() ) ) { throw new ConfigurationException( "The repository '" + repository.getName() + "' is not deletable cause '" + shadow.getName() + "' depends on it!" ); <START> } <END> } List<CPathMappingItem> pathMappings = getConfigurationModel().getRepositoryGrouping().getPathMappings(); for ( Iterator<CPathMappingItem> i = pathMappings.iterator(); i.hasNext(); ) { CPathMappingItem item = i.next(); item.removeRepository( id ); } repositoryRegistry.removeRepository( id ); List<CRepository> reposes = getConfigurationModel().getRepositories(); for ( Iterator<CRepository> i = reposes.iterator(); i.hasNext(); ) { CRepository repo = i.next(); if ( repo.getId().equals( id ) ) { i.remove(); saveConfiguration(); releaseRepository( repository, getConfigurationModel(), repo ); return; } } throw new NoSuchRepositoryException( id ); }</code><technical_language>this exception logged for administrators, I is important retain mention of repo ID value. name id hurt though. Suggest this read more like: "Repository [id= + id + ",name=" + repository.getName() + "] + "' deleted due dependencies: shadow repository[id=" + shadow.getId() + ",name=" +shadow.getName()+"]."</technical_language>

Target:
public synchronized void deleteRepository( String id ) throws NoSuchRepositoryException, IOException, ConfigurationException { Repository repository = repositoryRegistry.getRepository( id ); repository.setLocalStatus( LocalStatus.OUT_OF_SERVICE ); repository.setIndexable( false ); repository.setSearchable( false ); List<ShadowRepository> shadows = repositoryRegistry.getRepositoriesWithFacet( ShadowRepository.class ); for ( Iterator<ShadowRepository> i = shadows.iterator(); i.hasNext(); ) { ShadowRepository shadow = i.next(); if ( repository.getId().equals( shadow.getMasterRepository().getId() ) ) { throw new RepositoryDependentException( repository, shadow ); } } List<CPathMappingItem> pathMappings = getConfigurationModel().getRepositoryGrouping().getPathMappings(); for ( Iterator<CPathMappingItem> i = pathMappings.iterator(); i.hasNext(); ) { CPathMappingItem item = i.next(); item.removeRepository( id ); } repositoryRegistry.removeRepository( id ); List<CRepository> reposes = getConfigurationModel().getRepositories(); for ( Iterator<CRepository> i = reposes.iterator(); i.hasNext(); ) { CRepository repo = i.next(); if ( repo.getId().equals( id ) ) { i.remove(); saveConfiguration(); releaseRepository( repository, getConfigurationModel(), repo ); return; } } throw new NoSuchRepositoryException( id ); }
Source:
<code>MongoDBTracing(Builder builder) { tracing = builder.tracing; maxAbbreviatedCommandLength = builder.maxAbbreviatedCommandLength; <START> commandsWithCollectionName = Collections.unmodifiableSet(builder.commandsWithCollectionName); <END> }</code><technical_language>Copy a new set too, user able modify set builder</technical_language>

Target:
MongoDBTracing(Builder builder) { tracing = builder.tracing; }
Source:
<code>public static boolean writeFile(String fileName, String content, int issueCount) { boolean validPath = !(fileName == null || fileName.isEmpty()); if (validPath) { try { PrintWriter writer = new PrintWriter(fileName, "UTF-8"); writer.println(content); writer.close(); long sizeAfterWrite = 0; <START> if (issueCount > 0) { <END> sizeAfterWrite = Files.size(Paths.get(fileName)); } return processFileGrowth(sizeAfterWrite, issueCount, fileName); } catch (IOException e) { logger.error(e.getLocalizedMessage(), e); return true; } } return false; }</code><technical_language>Is this check necessary if carry out check in processFileGrowth issueCount is nonzero</technical_language>

Target:
public static boolean writeFile(String fileName, String content, int issueCount) { boolean validPath = !(fileName == null || fileName.isEmpty()); if (validPath) { try { PrintWriter writer = new PrintWriter(fileName, "UTF-8"); writer.println(content); writer.close(); long sizeAfterWrite = Files.size(Paths.get(fileName)); return processFileGrowth(sizeAfterWrite, issueCount, fileName); } catch (IOException e) { logger.error(e.getLocalizedMessage(), e); return true; } } return false; }
Source:
<code>public void testNonExistentArgument(@SysErr Capturable systemErr, @SysOut Capturable systemOut) throws Exception { systemErr.capture(); <START> systemOut.capture(); <END> JavadocPropertiesGenerator.main("--nonexistent-argument"); final String expected = String.format(Locale.ROOT, "Missing required options " + "[--destfile=<outputFile>, params[0]=<inputFile>]%n") + USAGE; assertEquals(expected, systemErr.getCapturedData(), "Unexpected error log"); assertEquals("", systemOut.getCapturedData(), "Unexpected output log"); }</code><technical_language>systemErr.capture(); systemOut.capture(); lines duplicated times. extract some method @BeforeEach annotation</technical_language>

Target:
public void testNonExistentArgument(@SysErr Capturable systemErr, @SysOut Capturable systemOut) throws Exception { JavadocPropertiesGenerator.main("--nonexistent-argument"); final String expected = String.format(Locale.ROOT, "Missing required options " + "[--destfile=<outputFile>, params[0]=<inputFile>]%n") + USAGE; assertEquals(expected, systemErr.getCapturedData(), "Unexpected error log"); assertEquals("", systemOut.getCapturedData(), "Unexpected output log"); }
Source:
<code>public void setAwsCredentials(AWSCredentials cred) { <START> this.credProvider = new AWSStaticCredentialsProvider(cred); <END> }</code><technical_language>I pass AWSCredentials AmazonS3Client object letting Amazon lib decide kind of provider use. clear Amazon presently AWSStaticCredentialsProvider default logic change in future Ignite needs robust possible</technical_language>

Target:
public void setAwsCredentials(AWSCredentials cred) { this.cred = cred; }
Source:
<code>public V get(K key) { getObserver.begin(); try { statusTransitioner.checkAvailable(); checkNonNull(key); try { Store.ValueHolder<V> valueHolder = doGet(key); if (valueHolder == null) { getObserver.end(GetOutcome.MISS); return null; } else { getObserver.end(GetOutcome.HIT); return valueHolder.get(); } } catch (StoreAccessException e) { V value = resilienceStrategy.getFailure(key, e); getObserver.end(GetOutcome.FAILURE); return value; } <START> } catch(Exception e) { <END> getObserver.end(GetOutcome.FAILURE); throw e; } }</code><technical_language>This } catch (Throwable) { right</technical_language>

Target:
public V get(K key) { getObserver.begin(); try { statusTransitioner.checkAvailable(); checkNonNull(key); try { Store.ValueHolder<V> valueHolder = doGet(key); if (valueHolder == null) { getObserver.end(GetOutcome.MISS); return null; } else { getObserver.end(GetOutcome.HIT); return valueHolder.get(); } } catch (StoreAccessException e) { V value = resilienceStrategy.getFailure(key, e); getObserver.end(GetOutcome.FAILURE); return value; } } catch (Throwable e) { getObserver.end(GetOutcome.FAILURE); throw e; } }
Source:
<code>public void setTabViews() { for (int i = 0; i < NavTab.size(); i++) { NavTab navTab = NavTab.of(i); <START> if (AccountUtil.isLoggedIn()) { <END> getMenu().add(Menu.NONE, i, i, navTab.text()).setIcon(navTab.icon()); } else { if (!(NavTab.SUGGESTED_EDITS == navTab)) { getMenu().add(Menu.NONE, i, i, navTab.text()).setIcon(navTab.icon()); } } } }</code><technical_language>simplify logic following: if (!AccountUtil.isLoggedIn() && NavTab.SUGGESTED_EDITS == navTab) { continue; }</technical_language>

Target:
public void setTabViews() { getMenu().clear(); for (int i = 0; i < NavTab.size(); i++) { NavTab navTab = NavTab.of(i); if (!AccountUtil.isLoggedIn() && NavTab.SUGGESTED_EDITS == navTab) { continue; } getMenu().add(Menu.NONE, i, i, navTab.text()).setIcon(navTab.icon()); } }
Source:
<code>public Map<String, Object> apply(@Nullable Image from) { if (from == null) return null; Map<String, Object> headers = Maps.newHashMap(); <START> addIfNotNull(headers, ID, from.getName()); <END> addIfNotNull(headers, NAME, from.getName()); addIfNotNull(headers, MIN_DISK, from.getMinDisk()); addIfNotNull(headers, MIN_RAM, from.getMinRam()); addIfNotNull(headers, OWNER, from.getOwner()); addIfNotNull(headers, IS_PUBLIC, from.isPublic()); addIfNotNull(headers, PROTECTED, from.isProtected()); addIfNotNull(headers, CHECKSUM, from.getChecksum()); addIfNotNull(headers, SIZE, from.getSize()); addIfNotNull(headers, STORE, from.getStoreType()); addIfNotNull(headers, COPY_FROM, from.getCopyFrom(), false); if (from.getContainerFormat() != ContainerFormat.UNRECOGNIZED) headers.put(CONTAINER_FORMAT.asHeader(), from.getContainerFormat().value()); if (from.getDiskFormat() != DiskFormat.UNRECOGNIZED) headers.put(DISK_FORMAT.asHeader(), from.getDiskFormat().value()); if (from.getProperties() != null) { for (String k : from.getProperties().keySet()) { headers.put(PROPERTY.asHeader()+"-"+k, from.getProperties().get(k)); } } return headers; }</code><technical_language>from.getId()</technical_language>

Target:
public Map<String, Object> apply(@Nullable Image from) { if (from == null) return null; Map<String, Object> headers = Maps.newHashMap(); addIfNotNull(headers, ID, from.getId()); addIfNotNull(headers, NAME, from.getName()); addIfNotNull(headers, MIN_DISK, from.getMinDisk()); addIfNotNull(headers, MIN_RAM, from.getMinRam()); addIfNotNull(headers, OWNER, from.getOwner()); addIfNotNull(headers, IS_PUBLIC, from.isPublic()); addIfNotNull(headers, PROTECTED, from.isProtected()); addIfNotNull(headers, CHECKSUM, from.getChecksum()); addIfNotNull(headers, SIZE, from.getSize()); addIfNotNull(headers, STORE, from.getStoreType()); addIfNotNull(headers, COPY_FROM, from.getCopyFrom(), false); if (from.getContainerFormat() != ContainerFormat.UNRECOGNIZED) headers.put(CONTAINER_FORMAT.asHeader(), from.getContainerFormat().value()); if (from.getDiskFormat() != DiskFormat.UNRECOGNIZED) headers.put(DISK_FORMAT.asHeader(), from.getDiskFormat().value()); if (from.getProperties() != null) { for (String k : from.getProperties().keySet()) { headers.put(PROPERTY.asHeader()+"-"+k, from.getProperties().get(k)); } } return headers; }
Source:
<code>public void testUserValues() { <START> MetricType.userTypes().stream().filter(metricType -> metricType == MetricType.COUNTER_RATE).forEach <END> (metricType -> fail("COUNTER_RATE is not user defined type")); assertEquals(3, MetricType.userTypes().size()); }</code><technical_language>here, I find assertFalse(MetricType.userTypes().contains(COUNTER_RATE)) more readable</technical_language>

Target:
public void testUserValues() { assertFalse("COUNTER_RATE is not user defined type", MetricType.userTypes().contains(MetricType.COUNTER_RATE)); assertEquals(3, MetricType.userTypes().size()); }
Source:
<code>public QueryResult<ChannelSchedule> execute(ScheduleQuery query) throws QueryExecutionException { if (!query.getEnd().isPresent()) { throw new UnsupportedOperationException( "'count' parameter not supported in non-equivalent schedule store. Please specify 'to' parameter in your request"); } Iterable<Channel> channels = resolveChannels(query); List<Channel> defaultChannels = Lists.newArrayList(channels); List<Channel> ebsChannels = new ArrayList<>(); if (query.getContext().getApplicationSources().getAccessRoles().contains( ApplicationAccessRole.PREFER_EBS_SCHEDULE)) { ebsChannels = defaultChannels.stream() .filter(channel -> channel.getAvailableFrom().contains(Publisher.BT_SPORT_EBS)) .collect(Collectors.toList()); defaultChannels.removeAll(ebsChannels); } List<ChannelSchedule> channelScheduleList = getChannelScheduleList(ebsChannels, defaultChannels, query); if (query.isMultiChannel()) { return QueryResult.listResult( <START> channelScheduleList, <END> query.getContext(), channelScheduleList.size() ); } return QueryResult.singleResult( Iterables.getOnlyElement(channelScheduleList), query.getContext() ); }</code><technical_language>name variable type type change in future. channelSchedules is enough for this</technical_language>

Target:
public QueryResult<ChannelSchedule> execute(ScheduleQuery query) throws QueryExecutionException { if (!query.getEnd().isPresent()) { throw new UnsupportedOperationException( "'count' parameter not supported in non-equivalent schedule store. Please specify 'to' parameter in your request"); } Iterable<Channel> channels = resolveChannels(query); Ordering<ChannelSchedule> ordering = Ordering.explicit( StreamSupport.stream(channels.spliterator(), false) .map(Channel::getId) .collect(MoreCollectors.toImmutableList()) ) .onResultOf(channelSchedule -> channelSchedule.getChannel().getId()); ImmutableList<ChannelSchedule> orderedChannelSchedules = ImmutableList.copyOf( ordering.sortedCopy( getChannelSchedules(channels, query) ) ); if (query.isMultiChannel()) { return QueryResult.listResult( orderedChannelSchedules, query.getContext(), orderedChannelSchedules.size() ); } return QueryResult.singleResult( Iterables.getOnlyElement(orderedChannelSchedules), query.getContext() ); }
Source:
<code>private int findStartPositionForFunction(JoinFilterFunction searchFunction, int[] links, int startOffset, int probePosition, Page allProbeChannelsPage) { if (applySearchFunction(searchFunction, links, startOffset, probePosition, allProbeChannelsPage)) { return startOffset; } int left = startOffset; <START> int right = links.length - 1; <END> int offset = lowerBound(searchFunction, links, left, right, probePosition, allProbeChannelsPage); if (offset < 0) { return -1; } if (!applySearchFunction(searchFunction, links, offset, probePosition, allProbeChannelsPage)) { return -1; } return offset; }</code><technical_language>safely inline left & right</technical_language>

Target:
private int findStartPositionForFunction(JoinFilterFunction searchFunction, int[] links, int startOffset, int probePosition, Page allProbeChannelsPage) { if (applySearchFunction(searchFunction, links, startOffset, probePosition, allProbeChannelsPage)) { return startOffset; } int offset = lowerBound(searchFunction, links, startOffset, links.length - 1, probePosition, allProbeChannelsPage); if (!applySearchFunction(searchFunction, links, offset, probePosition, allProbeChannelsPage)) { return -1; } return offset; }
Source:
<code>private void initVmTemplate() { List<OvfEntityData> ovfEntityList = unregisteredOVFDataDao.getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (!ovfEntityList.isEmpty()) { try { ovfEntityData = ovfEntityList.get(0); vmTemplateFromConfiguration = ovfHelper.readVmTemplateFromOvf(ovfEntityData.getOvfData()); vmTemplateFromConfiguration.setClusterId(getParameters().getClusterId()); VmHandler.updateMaxMemorySize(vmTemplateFromConfiguration, <START> getEffectiveCompatibilityVersion()); <END> setVmTemplate(vmTemplateFromConfiguration); getParameters().setVmTemplate(vmTemplateFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskTemplateMap() != null) { ArrayList imageList = new ArrayList<>(getParameters().getDiskTemplateMap().values()); vmTemplateFromConfiguration.setDiskList(imageList); ensureDomainMap(imageList, getParameters().getDestDomainId()); } } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: {}:\n{}", e.getMessage(), ovfEntityData.getOvfData()); log.debug("Exception", e); } } setClusterId(getParameters().getClusterId()); setStoragePoolId(getCluster().getStoragePoolId()); }</code><technical_language>recompute effective compatibility version initializing template? I mean, currently, this call simply return compatibility version of cluster, ignoring custom compatibility version is potentially defined for template</technical_language>

Target:
private void initVmTemplate() { List<OvfEntityData> ovfEntityList = unregisteredOVFDataDao.getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (!ovfEntityList.isEmpty()) { try { ovfEntityData = ovfEntityList.get(0); vmTemplateFromConfiguration = ovfHelper.readVmTemplateFromOvf(ovfEntityData.getOvfData()); vmTemplateFromConfiguration.setClusterId(getParameters().getClusterId()); setVmTemplate(vmTemplateFromConfiguration); setEffectiveCompatibilityVersion(CompatibilityVersionUtils.getEffective(getVmTemplate(), this::getCluster)); VmHandler.updateMaxMemorySize(getVmTemplate(), getEffectiveCompatibilityVersion()); getParameters().setVmTemplate(vmTemplateFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskTemplateMap() != null) { ArrayList imageList = new ArrayList<>(getParameters().getDiskTemplateMap().values()); vmTemplateFromConfiguration.setDiskList(imageList); ensureDomainMap(imageList, getParameters().getDestDomainId()); } } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: {}:\n{}", e.getMessage(), ovfEntityData.getOvfData()); log.debug("Exception", e); } } setClusterId(getParameters().getClusterId()); setStoragePoolId(getCluster().getStoragePoolId()); }
Source:
<code>public HttpConnection create(URL url) throws IOException { <START> return new HttpClientConnection(url.toString(), null, lookupHttpClientBuilder(url).build()); <END> }</code><technical_language>potentially call URL, Proxy overload save a bit of duplication</technical_language>

Target:
public HttpConnection create(URL url) throws IOException { return create(url, null); }
Source:
<code>public void testBufferRecycledOnFailure() throws IOException { FailingChannelStateSerializer serializer = new FailingChannelStateSerializer(); TestRecoveredChannelStateHandler handler = new TestRecoveredChannelStateHandler(); try (FSDataInputStream stream = geStream(serializer, 10)) { new ChannelStateChunkReader(serializer).readChunk(stream, serializer.getHeaderLength(), handler, "channelInfo"); <START> checkState(serializer.failed); <END> checkState(!handler.requestedBuffers.isEmpty()); } finally { assertTrue(handler.requestedBuffers.stream().allMatch(TestChannelStateByteBuffer::isRecycled)); } }</code><technical_language>I understood control flow here. Is this line executed? want put finally</technical_language>

Target:
public void testBufferRecycledOnFailure() throws IOException, InterruptedException { FailingChannelStateSerializer serializer = new FailingChannelStateSerializer(); TestRecoveredChannelStateHandler handler = new TestRecoveredChannelStateHandler(); try (FSDataInputStream stream = getStream(serializer, 10)) { new ChannelStateChunkReader(serializer).readChunk(stream, serializer.getHeaderLength(), handler, "channelInfo"); } finally { checkState(serializer.failed); checkState(!handler.requestedBuffers.isEmpty()); assertTrue(handler.requestedBuffers.stream().allMatch(TestChannelStateByteBuffer::isRecycled)); } }
Source:
<code>public void close() { try { compressorPool.close(); } catch (Exception e) { <START> LOG.error(e); <END> } try { decompressorPool.close(); } catch (Exception e) { LOG.error(e); } }</code><technical_language>error message good</technical_language>

Target:
public void close() { try { compressorPool.close(); } catch (Exception e) { LOG.error("Exception while closing compressor pool", e); } try { decompressorPool.close(); } catch (Exception e) { LOG.error("Exception while closing decompressor pool", e); } }
Source:
<code>TDigestBuildSketchAggregatorFactory( final String name, final String fieldName, @Nullable final Integer compression, final byte cacheTypeId ) { Objects.requireNonNull(name, "Must have a valid, non-null aggregator name"); this.name = name; Objects.requireNonNull(fieldName, "Parameter fieldName must be specified"); <START> this.fieldName = fieldName; <END> this.compression = compression == null ? DEFAULT_COMRESSION : compression; this.cacheTypeId = cacheTypeId; }</code><technical_language>nit: Objects.requireNonNull() returns parameter if null. So, simplify lines</technical_language>

Target:
TDigestBuildSketchAggregatorFactory( final String name, final String fieldName, @Nullable final Integer compression, final byte cacheTypeId ) { this.name = Objects.requireNonNull(name, "Must have a valid, non-null aggregator name"); this.fieldName = Objects.requireNonNull(fieldName, "Parameter fieldName must be specified"); this.compression = compression == null ? DEFAULT_COMPRESSION : compression; this.cacheTypeId = cacheTypeId; }
Source:
<code>public void handleEvent(Event event) { if (event.getType() == Event.Type.FLOW_FINISHED) { FlowRunner flowRunner = (FlowRunner) event.getRunner(); ExecutableFlow flow = flowRunner.getExecutableFlow(); recentlyFinishedFlows.put(flow.getExecutionId(), flow); logger.info("Flow " + flow.getExecutionId() + " is finished. Adding it to recently finished flows list."); runningFlows.remove(flow.getExecutionId()); <START> submittedFlows.remove(flow.getExecutionId()); <END> } }</code><technical_language>This is code removed. Key in submittedFlows is longer Integer a Future<?></technical_language>

Target:
public void handleEvent(Event event) { if (event.getType() == Event.Type.FLOW_FINISHED) { FlowRunner flowRunner = (FlowRunner) event.getRunner(); ExecutableFlow flow = flowRunner.getExecutableFlow(); recentlyFinishedFlows.put(flow.getExecutionId(), flow); logger.info("Flow " + flow.getExecutionId() + " is finished. Adding it to recently finished flows list."); runningFlows.remove(flow.getExecutionId()); } }
Source:
<code>public RowData deserialize( byte[] recordValue, String partitionKey, String seqNum, long approxArrivalTimestamp, String stream, String shardId) throws IOException { RowData physicalRow = physicalDeserializer.deserialize(recordValue); GenericRowData metadataRow = new GenericRowData(requestedMetadataFields.size()); for (int i = 0; i < metadataRow.getArity(); i++) { Metadata metadataField = requestedMetadataFields.get(i); if (metadataField == Metadata.ApproximateArrivalTimestamp) { metadataRow.setField(i, TimestampData.fromEpochMillis(approxArrivalTimestamp)); } else if (metadataField == Metadata.SequenceNumber) { metadataRow.setField(i, StringData.fromString(seqNum)); } else if (metadataField == Metadata.ShardId) { metadataRow.setField(i, StringData.fromString(shardId)); } else { String msg = String.format("Unsupported metadata key %s", metadataField); throw new RuntimeException(msg); } } JoinedRowData joinedRowData = new JoinedRowData(physicalRow, metadataRow); <START> joinedRowData.setRowKind(physicalRow.getRowKind()); <END> return joinedRowData; }</code><technical_language>call deserialize(byte[] message, Collector<T> out) instead</technical_language>

Target:
public RowData deserialize( byte[] recordValue, String partitionKey, String seqNum, long approxArrivalTimestamp, String stream, String shardId) throws IOException { RowData physicalRow = physicalDeserializer.deserialize(recordValue); GenericRowData metadataRow = new GenericRowData(requestedMetadataFields.size()); for (int i = 0; i < metadataRow.getArity(); i++) { Metadata metadataField = requestedMetadataFields.get(i); if (metadataField == Metadata.Timestamp) { metadataRow.setField(i, TimestampData.fromEpochMillis(approxArrivalTimestamp)); } else if (metadataField == Metadata.SequenceNumber) { metadataRow.setField(i, StringData.fromString(seqNum)); } else if (metadataField == Metadata.ShardId) { metadataRow.setField(i, StringData.fromString(shardId)); } else { String msg = String.format("Unsupported metadata key %s", metadataField); throw new RuntimeException(msg); } } JoinedRowData joinedRowData = new JoinedRowData(physicalRow, metadataRow); joinedRowData.setRowKind(physicalRow.getRowKind()); return joinedRowData; }
Source:
<code>public void visit(SystemStreamPartition systemStreamPartition, StartpointSpecific startpointSpecific) { TopicPartition topicPartition = toTopicPartition(systemStreamPartition); long offsetInStartpoint = Long.parseLong(startpointSpecific.getSpecificOffset()); LOG.info("Updating the consumer fetch offsets of topic partition: to {}.", topicPartition, offsetInStartpoint); synchronized (kafkaConsumer) { kafkaConsumer.seek(topicPartition, offsetInStartpoint); } <START> proxy.addTopicPartition(systemStreamPartition, kafkaConsumer.position(topicPartition)); <END> }</code><technical_language>kafkaConsumer.position need protected lock too? Also, please check for other usages of kafkaConsumer of lock</technical_language>

Target:
public void visit(SystemStreamPartition systemStreamPartition, StartpointSpecific startpointSpecific) { TopicPartition topicPartition = toTopicPartition(systemStreamPartition); long offsetInStartpoint = Long.parseLong(startpointSpecific.getSpecificOffset()); LOG.info("Updating the consumer fetch offsets of topic partition: to {}.", topicPartition, offsetInStartpoint); synchronized (kafkaConsumer) { kafkaConsumer.seek(topicPartition, offsetInStartpoint); proxy.addTopicPartition(systemStreamPartition, kafkaConsumer.position(topicPartition)); } }
Source:
<code>public AtomicFileWriter(@Nonnull Path destinationPath, @Nonnull Charset charset) throws IOException { if (charset == null) { throw new IllegalArgumentException("charset is null"); } this.destPath = destinationPath; Path dir = this.destPath.getParent(); try { Files.createDirectories(dir); <START> tmpPath = Files.createTempFile(dir, "atomic", "tmp"); <END> } catch (IOException e) { throw new IOException("Failed to create a temporary file in "+ dir,e); } core = Files.newBufferedWriter(tmpPath, charset, StandardOpenOption.SYNC); }</code><technical_language>@batmat lifecycle of this? weary Redhat distributions periodically destroy files in tmp directory [1]. [1] file /etc/cron.daily/tmpwatch defines tmpwatch is called. #! /bin/sh flags=-umc /usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \ -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \ -X '/tmp/hsperfdata_*' 10d /tmp</technical_language>

Target:
public AtomicFileWriter(@Nonnull Path destinationPath, @Nonnull Charset charset) throws IOException { if (charset == null) { throw new IllegalArgumentException("charset is null"); } this.destPath = destinationPath; Path dir = this.destPath.getParent(); if (Files.exists(dir) && !Files.isDirectory(dir)) { throw new IOException(dir + " exists and is neither a directory nor a symlink to a directory"); } else { if (Files.isSymbolicLink(dir)) { LOGGER.log(Level.CONFIG, "{0} is a symlink to a directory", dir); } else { Files.createDirectories(dir); } } try { tmpPath = Files.createTempFile(dir, "atomic", "tmp"); } catch (IOException e) { throw new IOException("Failed to create a temporary file in "+ dir,e); } core = Files.newBufferedWriter(tmpPath, charset); }
Source:
<code>private MethodHandle toMethodHandle(Method method) throws IllegalAccessException { MethodHandle target = null; if (makeAccessible || isValidPrivateStructAccess(method)) { method.setAccessible(true); } if(isMethodDecorated(method)) { target = getDecoratedMethodHandle(method, arity); <START> }else{ <END> if ((method.isVarArgs() && isLastArgumentAnArray(type.parameterCount(), args))) { target = lookup.unreflect(method).asFixedArity().asType(type); } else { target = lookup.unreflect(method).asType(type); } } return FunctionCallSupport.insertSAMFilter(target, lookup, method.getParameterTypes(), 1); }</code><technical_language>spaces..</technical_language>

Target:
private MethodHandle toMethodHandle(Method method) throws IllegalAccessException { MethodHandle target = null; if (makeAccessible || isValidPrivateStructAccess(method)) { method.setAccessible(true); } if (isMethodDecorated(method)) { target = getDecoratedMethodHandle(method, arity); } else { if ((method.isVarArgs() && isLastArgumentAnArray(type.parameterCount(), args))) { target = lookup.unreflect(method).asFixedArity().asType(type); } else { target = lookup.unreflect(method).asType(type); } } if(argumentNames.length > 1) { target = FunctionCallSupport.reorderArguments(method, target, argumentNames); } return FunctionCallSupport.insertSAMFilter(target, lookup, method.getParameterTypes(), 1); }
Source:
<code>private Path getDataPath(File location) { File[] files = location.listFiles(); Path path = null; if (files != null) { for (File file : files) { if (file.getName().startsWith("part-")) { <START> path = new Path(file.toString()); <END> break; } } } return path; }</code><technical_language>I return right away</technical_language>

Target:
private Path getDataPath(File location) { File[] files = location.listFiles(); Path path = null; if (files != null) { for (File file : files) { if (file.getName().startsWith("part-")) { path = new Path(file.toString()); return path; } } } return path; }
Source:
<code>protected Collection<String> getCandidates() { Set<String> candidates = new HashSet<String>(); for (String containerPath : zkDb.getDataTree().getContainers()) { DataNode node = zkDb.getDataTree().getNode(containerPath); if ((node != null) && node.getChildren().isEmpty()) { if (node.stat.getCversion() > 0) { candidates.add(containerPath); } else { if (getElapsed(node) > maxNeverUsedIntervalMs) { candidates.add(containerPath); <START> } <END> } } if ((node != null) && (node.stat.getCversion() > 0) && (node.getChildren().isEmpty())) { candidates.add(containerPath); } } for (String ttlPath : zkDb.getDataTree().getTtls()) { DataNode node = zkDb.getDataTree().getNode(ttlPath); if (node != null) { Set<String> children = node.getChildren(); if (children.isEmpty()) { if (EphemeralType.get(node.stat.getEphemeralOwner()) == EphemeralType.TTL) { long ttl = EphemeralType.TTL.getValue(node.stat.getEphemeralOwner()); if ((ttl != 0) && (getElapsed(node) > ttl)) { candidates.add(ttlPath); } } } } } return candidates; }</code><technical_language>This is a compatible change default for this is Long.MAX_VALUE - i.e. never. 9223372036854775807/1000/60/60/24/365=292471209 years 200 million years equal in context of love storys :)</technical_language>

Target:
protected Collection<String> getCandidates() { Set<String> candidates = new HashSet<String>(); for (String containerPath : zkDb.getDataTree().getContainers()) { DataNode node = zkDb.getDataTree().getNode(containerPath); if ((node != null) && node.getChildren().isEmpty()) { if (node.stat.getCversion() > 0) { candidates.add(containerPath); } else { if ((maxNeverUsedIntervalMs != 0) && (getElapsed(node) > maxNeverUsedIntervalMs)) { candidates.add(containerPath); } } } if ((node != null) && (node.stat.getCversion() > 0) && (node.getChildren().isEmpty())) { candidates.add(containerPath); } } for (String ttlPath : zkDb.getDataTree().getTtls()) { DataNode node = zkDb.getDataTree().getNode(ttlPath); if (node != null) { Set<String> children = node.getChildren(); if (children.isEmpty()) { if (EphemeralType.get(node.stat.getEphemeralOwner()) == EphemeralType.TTL) { long ttl = EphemeralType.TTL.getValue(node.stat.getEphemeralOwner()); if ((ttl != 0) && (getElapsed(node) > ttl)) { candidates.add(ttlPath); } } } } } return candidates; }
Source:
<code>public boolean hasNext() { <START> return nextSetsIterator.hasNext() || wrappedIterator.hasNext(); <END> }</code><technical_language>why, common practises processing (if needed) happen hasNext(), next() call haveNext() returning nextSetsIterator.next()</technical_language>

Target:
public boolean hasNext() { if(!isOpen) { return false; } else { if(nextSetsIterator.hasNext() || wrappedIterator.hasNext()) { return true; } else { isOpen = false; return false; } } }
Source:
<code>private void testGlusterNetworkInUseAndUnset(boolean glusterNetworkBefore, boolean glusterNetworkAfter, boolean glusterService, boolean hasBricks, Matcher<ValidationResult> expectedResult) { when(oldNetworkCluster.isGluster()).thenReturn(glusterNetworkBefore); when(networkCluster.isGluster()).thenReturn(glusterNetworkAfter); when(cluster.supportsGlusterService()).thenReturn(glusterService); doReturn(brickDao).when(validator).getGlusterBrickDao(); <START> ArrayList<GlusterBrickEntity> list = new ArrayList<>(); <END> if (hasBricks) { list.add(mock(GlusterBrickEntity.class)); } when(brickDao.getAllByClusterAndNetworkId(any(Guid.class), any(Guid.class))).thenReturn(list); assertThat(validator.glusterNetworkInUseAndUnset(cluster), expectedResult); }</code><technical_language>please replace 'list' a meaningful name, reduce type of list 'List'</technical_language>

Target:
private void testGlusterNetworkInUseAndUnset(boolean glusterNetworkBefore, boolean glusterNetworkAfter, boolean glusterService, boolean hasBricks, Matcher<ValidationResult> expectedResult) { when(oldNetworkCluster.isGluster()).thenReturn(glusterNetworkBefore); when(networkCluster.isGluster()).thenReturn(glusterNetworkAfter); when(cluster.supportsGlusterService()).thenReturn(glusterService); doReturn(brickDao).when(validator).getGlusterBrickDao(); when(brickDao.getAllByClusterAndNetworkId(any(Guid.class), any(Guid.class))).thenReturn(hasBricks ? Collections.<GlusterBrickEntity> singletonList(null) : Collections.<GlusterBrickEntity> emptyList()); assertThat(validator.glusterNetworkInUseAndUnset(cluster), expectedResult); }
Source:
<code>public OutputStream createFile(final Path path, final boolean overwrite, final FsPermission permission, final FsPermission umask) throws AzureBlobFileSystemException { try (AbfsPerfInfo perfInfo = startTracking("createFile", "createPath")) { boolean isNamespaceEnabled = getIsNamespaceEnabled(); LOG.debug("createFile filesystem: path: overwrite: permission: umask: isNamespaceEnabled: {}", client.getFileSystem(), path, overwrite, permission.toString(), umask.toString(), isNamespaceEnabled); boolean appendBlob = false; if (isAppendBlobKey(path.toString())) { appendBlob = true; } client.createPath(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path), true, overwrite, isNamespaceEnabled ? getOctalNotation(permission) : null, isNamespaceEnabled ? getOctalNotation(umask) : null, appendBlob); return new AbfsOutputStream( client, AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path), <START> Long.valueOf(0), <END> abfsConfiguration.getWriteBufferSize(), abfsConfiguration.isFlushEnabled(), abfsConfiguration.isOutputStreamFlushDisabled(), abfsConfiguration.isAppendWithFlushEnabled(), appendBlob); } }</code><technical_language>nit: 0</technical_language>

Target:
public OutputStream createFile(final Path path, final boolean overwrite, final FsPermission permission, final FsPermission umask) throws AzureBlobFileSystemException { try (AbfsPerfInfo perfInfo = startTracking("createFile", "createPath")) { boolean isNamespaceEnabled = getIsNamespaceEnabled(); LOG.debug("createFile filesystem: path: overwrite: permission: umask: isNamespaceEnabled: {}", client.getFileSystem(), path, overwrite, permission.toString(), umask.toString(), isNamespaceEnabled); boolean appendBlob = false; if (isAppendBlobKey(path.toString())) { appendBlob = true; } client.createPath(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path), true, overwrite, isNamespaceEnabled ? getOctalNotation(permission) : null, isNamespaceEnabled ? getOctalNotation(umask) : null, appendBlob); return new AbfsOutputStream( client, AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path), 0, abfsConfiguration.getWriteBufferSize(), abfsConfiguration.isFlushEnabled(), abfsConfiguration.isOutputStreamFlushDisabled(), abfsConfiguration.isAppendWithFlushEnabled(), appendBlob); } }
Source:
<code>public Class<?> loadClass(String name, final boolean resolve) throws ClassNotFoundException { int pos = name.lastIndexOf("."); String classPackageName; if (pos > 0) { classPackageName = name.substring(0, pos); } else { classPackageName = name; } ArrayList<ModuleClassLoader> moduleClassLoaders = new ArrayList<ModuleClassLoader>(ModuleFactory .getModuleClassLoaders()); Collections.sort(moduleClassLoaders, new Comparator<ModuleClassLoader>() { @Override public int compare(ModuleClassLoader o1, ModuleClassLoader o2) { return o2.getModule().getPackageName().length() - o1.getModule().getPackageName().length(); } }); for (ModuleClassLoader classLoader : moduleClassLoaders) { boolean tryToLoad = classPackageName.startsWith(classLoader.getModule().getPackageName()); if (!tryToLoad) { for (String providedPackage : classLoader.getAdditionalPackages()) { <START> if (classPackageName.equals(providedPackage)) { <END> tryToLoad = true; break; } } } if (tryToLoad) { try { Class<?> c = classLoader.loadClass(name); loadedClasses.add(c); return c; } catch (ClassNotFoundException e) { } } } ClassNotFoundException ex = null; try { Class<?> c = getParent().loadClass(name); loadedClasses.add(c); return c; } catch (ClassNotFoundException e) { ex = e; } try { Class<?> c = this.findClass(name); return c; } catch (ClassNotFoundException e) { ex = e; } throw ex; }</code><technical_language>changed startsWith equals? worried break things</technical_language>

Target:
public Class<?> loadClass(String name, final boolean resolve) throws ClassNotFoundException { ArrayList<ModuleClassLoader> moduleClassLoaders = new ArrayList<ModuleClassLoader>(ModuleFactory .getModuleClassLoaders()); Class<?> c = loadModuleClass(name, moduleClassLoaders); if (c != null) return c; ClassNotFoundException ex = null; try { c = getParent().loadClass(name); loadedClasses.add(c); return c; } catch (ClassNotFoundException e) { ex = e; } try { c = this.findClass(name); return c; } catch (ClassNotFoundException e) { ex = e; } throw ex; }
Source:
<code>@Test void testHashDistributionWithoutKeys() { final RelNode root = createSortPlan(RelDistributions.hash(new ArrayList<>())); final RelJsonWriter writer = new RelJsonWriter(); <START> root.explain(writer); <END> final String json = writer.asString(); assertThat(json, is(XX4)); final String s = deserializeAndDumpToTextFormat(getSchema(root), json); final String expected = "LogicalSortExchange(distribution=[hash], collation=[[0]])\n" + " LogicalTableScan(table=[[scott, EMP]])\n"; assertThat(s, isLinux(expected)); }</code><technical_language>Collections.emptyList() instead of new ArrayList<>()</technical_language>

Target:
@Test void testHashDistributionWithoutKeys() { final RelNode root = createSortPlan(RelDistributions.hash(Collections.emptyList())); final RelJsonWriter writer = new RelJsonWriter(); root.explain(writer); final String json = writer.asString(); assertThat(json, is(HASH_DIST_WITHOUT_KEYS)); final String s = deserializeAndDumpToTextFormat(getSchema(root), json); final String expected = "LogicalSortExchange(distribution=[hash], collation=[[0]])\n" + " LogicalTableScan(table=[[scott, EMP]])\n"; assertThat(s, isLinux(expected)); }