auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public double computeForOperation(MetricKey<O> key, O node, MetricOptions options) { Objects.requireNonNull(key, "The metric key must not be null"); if (!key.supports(node)) { return Double.NaN; } <START> MetricOptions safeOptions = options == null ? MetricOptions.emptyOptions() : options; <END> MetricMemoizer<O> memoizer = getLanguageSpecificProjectMemoizer().getOperationMemoizer(node.getQualifiedName()); return memoizer == null ? Double.NaN : getLanguageSpecificComputer().computeForOperation(key, node, false, safeOptions, memoizer); }</code><technical_language>Hm.. sense require options non-null? spare safeOptions. This slight API change - consistent, parameters of this method non-null...</technical_language>

Target:
public double computeForOperation(MetricKey<O> key, O node, MetricOptions options) { Objects.requireNonNull(key, NULL_KEY_MESSAGE); Objects.requireNonNull(options, NULL_OPTIONS_MESSAGE); Objects.requireNonNull(node, NULL_NODE_MESSAGE); if (!key.supports(node)) { return Double.NaN; } MetricMemoizer<O> memoizer = getLanguageSpecificProjectMemoizer().getOperationMemoizer(node.getQualifiedName()); return memoizer == null ? Double.NaN : getLanguageSpecificComputer().computeForOperation(key, node, false, options, memoizer); }
Source:
<code>public Result apply(SemiJoinNode semiJoinNode, Captures captures, Context context) { JoinDistributionType joinDistributionType = getJoinDistributionType(context.getSession()); if (joinDistributionType == AUTOMATIC) { return Result.ofPlanNode(getCostBasedDistributionType(semiJoinNode, context)); } <START> <END> else if (joinDistributionType.canPartition()) { return Result.ofPlanNode(semiJoinNode.withDistributionType(PARTITIONED)); } return Result.ofPlanNode(semiJoinNode.withDistributionType(REPLICATED)); }</code><technical_language>nit: remove empty line</technical_language>

Target:
public Result apply(SemiJoinNode semiJoinNode, Captures captures, Context context) { JoinDistributionType joinDistributionType = getJoinDistributionType(context.getSession()); switch (joinDistributionType) { case AUTOMATIC: return Result.ofPlanNode(getCostBasedDistributionType(semiJoinNode, context)); case PARTITIONED: return Result.ofPlanNode(semiJoinNode.withDistributionType(PARTITIONED)); case BROADCAST: return Result.ofPlanNode(semiJoinNode.withDistributionType(REPLICATED)); default: throw new IllegalArgumentException("Unknown join_distribution_type: " + joinDistributionType); } }
Source:
<code><START> public List getBuilds() { <END> Item item = Stapler.getCurrentRequest().findAncestorObject(Item.class); return getBuilds(item); }</code><technical_language>deprecate this? a useful method, no</technical_language>

Target:
public List getBuilds() { final StaplerRequest currentRequest = Stapler.getCurrentRequest(); final Item item = currentRequest != null ? currentRequest.findAncestorObject(Item.class) : null; return getRuns(item); }
Source:
<code>public Flux<FeedResponse<T>> byPage() { CosmosPagedFluxOptions cosmosPagedFluxOptions = new CosmosPagedFluxOptions(); <START> return FluxUtil.fluxContext(context -> byPage(cosmosPagedFluxOptions, context)).subscriberContext(TracerProvider.callDepthAttributeFunc); <END> }</code><technical_language>of if tracing is enabled passing Pageflux tracing stack, recreating some internal Map in FluxUtil::toAzureContext This sit a tracing enabled flag. suggestion if (tracing.enabled) { return FluxUtil.fluxContext(context -> byPage(cosmosPagedFluxOptions, context)).subscriberContext(TracerProvider.callDepthAttributeFunc); } else { return this.optionsFluxFunction.apply(cosmosPagedFluxOptions); } able factor out common if/else code a method call here, a short circurt for tracing is enabled</technical_language>

Target:
public Flux<FeedResponse<T>> byPage() { CosmosPagedFluxOptions cosmosPagedFluxOptions = new CosmosPagedFluxOptions(); if (!this.isTracerEnabled) { return this.optionsFluxFunction.apply(cosmosPagedFluxOptions); } return FluxUtil.fluxContext(context -> byPage(cosmosPagedFluxOptions, context)); }
Source:
<code>public void testGetCssIdentifier() { <START> for (int pass = 0; pass < 5; pass++) <END> { String input, expected, result; switch (pass) { case 0: input = "-_perfectlyfine"; expected = input; break; case 1: input = "--verybad"; expected = "_-verybad"; break; case 2: input = "-2badagain?"; expected = "_2badagain_"; break; case 3: input = "great342_-↲"; expected = input; break; case 4: input = "4abc_bad"; expected = "_abc_bad"; break; default: input = expected = ""; } result = StringUtil.getCssIdentifier(input); assertTrue(StringUtil.equals(expected, result)); } }</code><technical_language>Nit: I this frustrating update remember increase pass count add a pass below. putting input/expected values in arrays, looping arrays</technical_language>

Target:
public void testGetCssIdentifier() { List<Pair<String, String>> testList = new ArrayList<>(); testList.add(new Pair<>("4abc_bad", "_abc_bad")); testList.add(new Pair<>("--verybad", "_-verybad")); testList.add(new Pair<>("-2badagain?", "_2badagain_")); testList.add(new Pair<>("great342_-↲", "great342_-↲")); testList.add(new Pair<>("-_perfectlyfine", "-_perfectlyfine")); for (Pair<String, String> td : testList) { String result = StringUtil.getCssIdentifier(td.first); assertTrue(StringUtil.equals(td.second, result)); } }
Source:
<code>protected void postLoad(DAnalysis dAnalysis, Version loadedVersion) { if (loadedVersion.compareTo(MIGRATION_VERSION) < 0) { final Collection<BorderedStyle> allBorderedStylesToUpdate = Sets.newLinkedHashSet(); for (DView dView : dAnalysis.getOwnedViews()) { for (DDiagram dDiagram : Iterables.filter(dView.getOwnedRepresentations(), DDiagram.class)) { for (DDiagramElement diagramElement : dDiagram.getOwnedDiagramElements()) { if (diagramElement.getStyle() instanceof BorderedStyle) { allBorderedStylesToUpdate.add((BorderedStyle) diagramElement.getStyle()); } } } } Integer zero = new Integer(0); Integer one = new Integer(1); for (BorderedStyle borderedStyleToUpdate : allBorderedStylesToUpdate) { if (zero.equals(borderedStyleToUpdate.getBorderSize()) && "1".equals(borderedStyleToUpdate.getBorderSizeComputationExpression())) { borderedStyleToUpdate.setBorderSize(one); } <START> } <END> } }</code><technical_language>update BorderedStyle.bordersizeComputationExpression if equals 0. is evaluation updated in next style refresh causing session dirty if do migrate it</technical_language>

Target:
protected void postLoad(DAnalysis dAnalysis, Version loadedVersion) { if (loadedVersion.compareTo(MIGRATION_VERSION) < 0) { final Collection<BorderedStyle> allBorderedStylesToUpdate = Sets.newLinkedHashSet(); for (DView dView : dAnalysis.getOwnedViews()) { for (DDiagram dDiagram : Iterables.filter(dView.getOwnedRepresentations(), DDiagram.class)) { for (DDiagramElement diagramElement : new DDiagramInternalQuery(dDiagram).getDiagramElements()) { if (diagramElement.getStyle() instanceof BorderedStyle) { allBorderedStylesToUpdate.add((BorderedStyle) diagramElement.getStyle()); } } } } Integer zero = new Integer(0); Integer one = new Integer(1); for (BorderedStyle borderedStyleToUpdate : allBorderedStylesToUpdate) { if (zero.equals(borderedStyleToUpdate.getBorderSize()) && "1".equals(borderedStyleToUpdate.getBorderSizeComputationExpression())) { borderedStyleToUpdate.setBorderSize(one); } else { System.out.println("here"); } } } }
Source:
<code>public void addSampleToWorkspace(String sampleName) { waitAddOrImportFormOpened(); if (!isSampleCheckboxEnabled(sampleName)) ; <START> { <END> clickOnSampleCheckbox(sampleName); } waitSampleCheckboxEnabled(sampleName); clickOnAddButton(); waitProjectTabAppearance(sampleName); }</code><technical_language>; is redundant</technical_language>

Target:
public void addSampleToWorkspace(String sampleName) { waitAddOrImportFormOpened(); if (!isSampleCheckboxEnabled(sampleName)) { clickOnSampleCheckbox(sampleName); } waitSampleCheckboxEnabled(sampleName); clickOnAddButton(); waitProjectTabAppearance(sampleName); }
Source:
<code>public File getPidFile() { <START> return new File(temporaryFolder.getRoot(), "__tmp.pid.file.swarm__"); <END> }</code><technical_language>I suggest more consistent other code in this file? more equivalent have: java return File.createTempFile("swarm-client", ".pid", temporaryFolder.getRoot()); this a name time invoked, need pull out a local variable test, passed Swarm client create</technical_language>

Target:
private static File getPidFile() throws IOException { File pidFile = File.createTempFile("swarm-client", ".pid", temporaryFolder.getRoot()); pidFile.delete(); return pidFile; }
Source:
<code>public Response register() throws Exception { <START> ResteasyProviderFactory factory = ResteasyProviderFactory.newInstance(); <END> factory.registerProviderInstance(paramConvertrProvider); factory.registerProviderInstance(exceptionMapper); return Response.ok("ok").build(); }</code><technical_language>I some doubts change here. In this case, attempt is alter current ResteasyProviderFactory instance (yes, I agree, a practice all). creating a new instance setting in singleton reference ResteasyProviderFactory, altering test. I suspect this is spotted Travis CI test is running due exclusions for RESTEASY-1935</technical_language>

Target:
public Response register() throws Exception { ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); factory.registerProviderInstance(paramConvertrProvider); factory.registerProviderInstance(exceptionMapper); return Response.ok("ok").build(); }
Source:
<code>private Uri welcomeDeepLinkFromUser(User user) { return Uri.parse(deepLinkBaseUrl) .buildUpon() .appendPath("welcome") <START> .appendQueryParameter("sender", user.getName()) <END> .build(); }</code><technical_language>query parameter is retrieve name intent later. a constant somewhere</technical_language>

Target:
private Uri welcomeDeepLinkFromUser(User user) { return Uri.parse(deepLinkBaseUrl) .buildUpon() .appendPath("welcome") .appendQueryParameter(SENDER, user.getName()) .build(); }
Source:
<code>public void addSteps(MigrationStepRegistry registry) { registry .add(1800, "Add incremental column to snapshots table", AddIncrementalColumnToSnapshotsTable.class) .add(1801, "Create table CE task characteristics", CreateTableCeTaskCharacteristics.class) .add(1802, "Delete leak settings on views", DeleteLeakSettingsOnViews.class) .add(1803, "Fix empty USERS.EXTERNAL_IDENTITY and USERS.EXTERNAL_IDENTITY_PROVIDER", FixEmptyIdentityProviderInUsers.class) .add(1804, "Add rules.plugin_key", AddPluginKeyToRules.class) .add(1805, "Create table plugins", CreateTablePlugins.class) .add(1806, "Create table project_branches", CreateTableProjectBranches.class) .add(1807, "Add on project_branches key", AddIndexOnProjectBranchesKey.class) .add(1808, "Add branch column to projects table", AddBranchColumnToProjectsTable.class) .add(1809, "Populate project_branches with existing main branches", PopulateMainProjectBranches.class) .add(1810, "Add ANALYSIS_UUID in WEBHOOK_DELIVERIES", AddAnalysisUuidToWebhookDeliveries.class) .add(1811, "Make column CE_TASK_UUID nullable", UpdateCeTaskUuidColumnToNullableOnWebhookDeliveries.class) .add(1812, "Populate ANALYSIS_UUID of WEBHOOK_DELIVERIES", PopulateAnalysisUuidColumnOnWebhookDeliveries.class) <START> .add(1813, "Make ANALYSIS_UUID not null in WEBHOOK_DELIVERIES", UpdateCeTaskUuidColumnToNullableOnWebhookDeliveries.class) <END> ; }</code><technical_language>this migration useless analysis_uuid null</technical_language>

Target:
public void addSteps(MigrationStepRegistry registry) { registry .add(1800, "Add incremental column to snapshots table", AddIncrementalColumnToSnapshotsTable.class) .add(1801, "Create table CE task characteristics", CreateTableCeTaskCharacteristics.class) .add(1802, "Delete leak settings on views", DeleteLeakSettingsOnViews.class) .add(1803, "Fix empty USERS.EXTERNAL_IDENTITY and USERS.EXTERNAL_IDENTITY_PROVIDER", FixEmptyIdentityProviderInUsers.class) .add(1804, "Add rules.plugin_key", AddPluginKeyToRules.class) .add(1805, "Create table plugins", CreateTablePlugins.class) .add(1806, "Create table project_branches", CreateTableProjectBranches.class) .add(1807, "Add on project_branches key", AddIndexOnProjectBranchesKey.class) .add(1808, "Add branch column to projects table", AddBranchColumnToProjectsTable.class) .add(1809, "Populate project_branches with existing main branches", PopulateMainProjectBranches.class) .add(1810, "Add ANALYSIS_UUID in WEBHOOK_DELIVERIES", AddAnalysisUuidToWebhookDeliveries.class) .add(1811, "Make column CE_TASK_UUID nullable", UpdateCeTaskUuidColumnToNullableOnWebhookDeliveries.class) .add(1812, "Populate ANALYSIS_UUID of WEBHOOK_DELIVERIES", PopulateAnalysisUuidColumnOnWebhookDeliveries.class) ; }
Source:
<code>public Properties getStatistics() throws GitAPIException { try { GC gc = new GC((FileRepository) repo); <START> gc.setPackConfig(pconfig); <END> return toProperties(gc.getStatistics()); } catch (IOException e) { throw new JGitInternalException( JGitText.get().couldNotGetRepoStatistics, e); } }</code><technical_language>I this necessary getStatistics() need configuration</technical_language>

Target:
public Properties getStatistics() throws GitAPIException { try { GC gc = new GC((FileRepository) repo); return toProperties(gc.getStatistics()); } catch (IOException e) { throw new JGitInternalException( JGitText.get().couldNotGetRepoStatistics, e); } }
Source:
<code>public void testDoPipe() throws Exception { pipe.setLCharacters("abcd"); pipe.setNumbers("12342"); pipe.setUCharacters("ASDF"); pipe.setSigns("!@#@"); pipe.setNumOfDigits(3); pipe.setNumOfLCharacters(4); pipe.setNumOfUCharacters(2); pipe.setNumOfSigns(2); pipe.setUseSecureRandom(false); pipe.configure(); PipeRunResult res = doPipe(pipe, "pipey", session); <START> assertEquals(res.getResult().toString().length(), 19); <END> }</code><technical_language>Try asString instead</technical_language>

Target:
public void testDoPipe() throws Exception { pipe.setLCharacters("abcd"); pipe.setNumbers("12342"); pipe.setUCharacters("ASDF"); pipe.setSigns("!@#@"); pipe.setNumOfDigits(3); pipe.setNumOfLCharacters(4); pipe.setNumOfUCharacters(2); pipe.setNumOfSigns(2); pipe.setUseSecureRandom(false); pipe.configure(); PipeRunResult res = doPipe(pipe, "pipey", session); assertEquals(res.getResult().asString().length(), 11); }
Source:
<code>public VisitDomainWrapper createRetrospectiveVisit(Patient patient, Location location, Date startDatetime, Date stopDatetime) throws ExistingVisitDuringTimePeriodException { Date actualStopDate = stopDatetime; if (stopDatetime == null){ stopDatetime = new Date(); <START> } <END> if (startDatetime.after(new Date())) { throw new IllegalArgumentException("emrapi.retrospectiveVisit.startDateCannotBeInFuture"); } if (stopDatetime.after(new Date())) { throw new IllegalArgumentException("emrapi.retrospectiveVisit.stopDateCannotBeInFuture"); } if (startDatetime.after(stopDatetime)) { throw new IllegalArgumentException("emrapi.retrospectiveVisit.endDateBeforeStartDateMessage"); } if (hasVisitDuring(patient, location, startDatetime, stopDatetime)) { throw new ExistingVisitDuringTimePeriodException("emrapi.retrospectiveVisit.patientAlreadyHasVisit"); } Visit visit = buildVisit(patient, location, startDatetime); visit.setStopDatetime(actualStopDate); return wrap(visitService.saveVisit(visit)); }</code><technical_language>Is this avoid a null pointer exception line 792? If so, I add a null check there, is: if (if stopDatetime != null && stopDatetime.after(new Date())) {</technical_language>

Target:
public VisitDomainWrapper createRetrospectiveVisit(Patient patient, Location location, Date startDatetime, Date stopDatetime) throws ExistingVisitDuringTimePeriodException { if (startDatetime.after(new Date())) { throw new IllegalArgumentException("emrapi.retrospectiveVisit.startDateCannotBeInFuture"); } if (stopDatetime != null && stopDatetime.after(new Date())) { throw new IllegalArgumentException("emrapi.retrospectiveVisit.stopDateCannotBeInFuture"); } if (stopDatetime != null && startDatetime.after(stopDatetime)) { throw new IllegalArgumentException("emrapi.retrospectiveVisit.endDateBeforeStartDateMessage"); } if (hasVisitDuring(patient, location, startDatetime, stopDatetime)) { throw new ExistingVisitDuringTimePeriodException("emrapi.retrospectiveVisit.patientAlreadyHasVisit"); } Visit visit = buildVisit(patient, location, startDatetime); visit.setStopDatetime(stopDatetime); return wrap(visitService.saveVisit(visit)); }
Source:
<code>@Override public void end() { checkThread(); if (ended) return; ended = true; <START> sources.get(0).cancel(); <END> assert downstream != null; downstream.end(); }</code><technical_language>cancel upstream</technical_language>

Target:
@Override public void end() { checkThread(); if (ended) return; ended = true; assert downstream != null; downstream.end(); }
Source:
<code><START> protected String defaultErrorMessage(Description description, Representation representation) { <END> if (actualAndExpectedHaveSameStringRepresentation()) { return defaultDetailedErrorMessage(description, representation); } return comparisonStrategy.isStandard() ? messageFormatter.format(description, representation, EXPECTED_BUT_WAS_MESSAGE, actual, expected) : messageFormatter.format(description, representation, EXPECTED_BUT_WAS_MESSAGE_USING_COMPARATOR, actual, expected, comparisonStrategy); }</code><technical_language>this changed protected</technical_language>

Target:
private String defaultErrorMessage(Description description, Representation representation) { if (actualAndExpectedHaveSameStringRepresentation()) { return defaultDetailedErrorMessage(description, representation); } return comparisonStrategy.isStandard() ? messageFormatter.format(description, representation, EXPECTED_BUT_WAS_MESSAGE, actual, expected) : messageFormatter.format(description, representation, EXPECTED_BUT_WAS_MESSAGE_USING_COMPARATOR, actual, expected, comparisonStrategy); }
Source:
<code>public synchronized void clientAddProperty(PlatformConnectedClient platformClient, String key, String value) { LOGGER.trace("[0] client property added ({}, key:{}, value:{})", platformClient, key, value); stripe.getServerByName(currentActive.getServerName()) .ifPresent(server -> { ClientIdentifier clientIdentifier = toClientIdentifier(platformClient); cluster.getClient(clientIdentifier) .ifPresent(client -> { client.addProperty(key, value); <START> firingService.fireNotification(new ContextualNotification(client.getContext(), Notification.CLIENT_PROPERTY_ADDED.name())); <END> }); }); }</code><technical_language>@myronkscott : argument of constructor pass: Collections.emptyMap(key, value) => M&M context of this notification</technical_language>

Target:
public synchronized void clientAddProperty(PlatformConnectedClient platformClient, String key, String value) { LOGGER.trace("[0] client property added ({}, key:{}, value:{})", platformClient, key, value); stripe.getServerByName(currentActive.getServerName()) .ifPresent(server -> { ClientIdentifier clientIdentifier = toClientIdentifier(platformClient); cluster.getClient(clientIdentifier) .ifPresent(client -> { client.addProperty(key, value); firingService.fireNotification(new ContextualNotification(client.getContext(), Notification.CLIENT_PROPERTY_ADDED.name(), Collections.singletonMap(key, value))); }); }); }
Source:
<code>public boolean disablePearlDamage(boolean allow) { pearlDamage = allow; <START> return allow; <END> }</code><technical_language>real need for a return type :P</technical_language>

Target:
public void disablePearlDamage(boolean allow) { pearlDamage = allow; }
Source:
<code>private CatalogItem<?,?> addItemDto(CatalogItemDtoAbstract<?, ?> itemDto, boolean forceUpdate) { <START> CatalogItem<?, ?> existingDto = checkItemIsDuplicateOrDisallowed(itemDto, true, forceUpdate); <END> if (existingDto!=null) { log.trace("Using existing duplicate for catalog item {}", itemDto.getId()); return existingDto; } if (manualAdditionsCatalog==null) loadManualAdditionsCatalog(); manualAdditionsCatalog.addEntry(itemDto); getCatalog().addEntry(itemDto); if (log.isTraceEnabled()) { log.trace("Scheduling item for persistence addition: {}", itemDto.getId()); } if (itemDto.getCatalogItemType() == CatalogItemType.LOCATION) { @SuppressWarnings("unchecked") CatalogItem<Location,LocationSpec<?>> locationItem = (CatalogItem<Location, LocationSpec<?>>) itemDto; ((BasicLocationRegistry)mgmt.getLocationRegistry()).updateDefinedLocation(locationItem); } mgmt.getRebindManager().getChangeListener().onManaged(itemDto); return itemDto; }</code><technical_language>Name checkItemIsDuplicateOrDisallowed is confusing. check... prefix guava convention: throws exception if check fails (e.g. checkNotNull throws if condition "not null" fails). Reading this suggests throw if "is duplicate disallowed" fails. opposite: checking a duplicate is allowed</technical_language>

Target:
private CatalogItem<?,?> addItemDto(CatalogItemDtoAbstract<?, ?> itemDto, boolean forceUpdate) { CatalogItem<?, ?> existingDto = checkItemAllowedAndIfSoReturnAnyDuplicate(itemDto, true, forceUpdate); if (existingDto!=null) { log.trace("Using existing duplicate for catalog item {}", itemDto.getId()); return existingDto; } if (manualAdditionsCatalog==null) loadManualAdditionsCatalog(); manualAdditionsCatalog.addEntry(itemDto); getCatalog().addEntry(itemDto); if (log.isTraceEnabled()) { log.trace("Scheduling item for persistence addition: {}", itemDto.getId()); } if (itemDto.getCatalogItemType() == CatalogItemType.LOCATION) { @SuppressWarnings("unchecked") CatalogItem<Location,LocationSpec<?>> locationItem = (CatalogItem<Location, LocationSpec<?>>) itemDto; ((BasicLocationRegistry)mgmt.getLocationRegistry()).updateDefinedLocation(locationItem); } mgmt.getRebindManager().getChangeListener().onManaged(itemDto); return itemDto; }
Source:
<code>private void handleGenerationException(Throwable e) { Throwable cause = e.getCause(); if (cause instanceof IllegalArgumentException) { String msg = cause.getMessage(); if (msg.startsWith("New Version")) { notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooNewVersion"); <START> log.error("Map generation failed", cause); } else if (msg.startsWith("Old Version")) { notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooOldVersion"); log.error("Map generation failed", cause); } else { notificationService.addImmediateErrorNotification(e, "mapGenerator.generationFailed"); log.error("Map generation failed", e); } } else { notificationService.addImmediateErrorNotification(e, "mapGenerator.generationFailed"); log.error("Map generation failed", e); <END> } }</code><technical_language>warn</technical_language>

Target:
private void handleGenerationException(Throwable e) { Throwable cause = e.getCause(); if (cause instanceof InvalidParameterException) { notificationService.addImmediateErrorNotification(e, "mapGenerator.invalidName"); log.warn("Map generation failed", e); } else if (cause instanceof UnsupportedVersionException) { notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooNewVersion"); log.warn("Map generation failed", e); } else if (cause instanceof OutdatedVersionException) { notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooOldVersion"); log.warn("Map generation failed", e); } else { notificationService.addImmediateErrorNotification(e, "mapGenerator.generationFailed"); log.warn("Map generation failed", e); } }
Source:
<code>public void process(final LGraph graph, final IElkProgressMonitor progressMonitor) { int layerIndex = 0; for (Layer layer : graph) { for (LNode node : layer.getNodes()) { final int previousLayerIndex = layerIndex - 1; Collections.sort(node.getPorts(), (p1, p2) -> { if (p1.getOutgoingEdges().isEmpty() && p2.getOutgoingEdges().isEmpty()) { Layer previousLayer = graph.getLayers().get(previousLayerIndex); LNode p1Node = p1.getIncomingEdges().get(0).getSource().getNode(); LNode p2Node = p2.getIncomingEdges().get(0).getSource().getNode(); for (LNode previousNode : previousLayer) { if (previousNode.equals(p1Node)) { return 1; <START> } if (previousNode.equals(p2Node)) { return -1; } } } <END> if (p1.getIncomingEdges().isEmpty() && p2.getIncomingEdges().isEmpty()) { return Integer.compare( p1.getOutgoingEdges().get(0).getProperty(InternalProperties.MODEL_ORDER), p2.getOutgoingEdges().get(0).getProperty(InternalProperties.MODEL_ORDER)); } if (p1.getOutgoingEdges().isEmpty() && p2.getIncomingEdges().isEmpty()) { return 1; } else { return -1; } }); } Collections.sort(layer.getNodes(), (n1, n2) -> { if (!n1.hasProperty(InternalProperties.MODEL_ORDER) || !n2.hasProperty(InternalProperties.MODEL_ORDER)) { return Integer.compare( getModelOrderFromConnectedEdges(n1), getModelOrderFromConnectedEdges(n2)); } return Integer.compare( n1.getProperty(InternalProperties.MODEL_ORDER), n2.getProperty(InternalProperties.MODEL_ORDER)); }); layerIndex++; } }</code><technical_language>clear cases mutually exclusive: } else if (..</technical_language>

Target:
public void process(final LGraph graph, final IElkProgressMonitor progressMonitor) { int layerIndex = 0; for (Layer layer : graph) { final int previousLayerIndex = layerIndex == 0 ? 0 : layerIndex - 1; Layer previousLayer = graph.getLayers().get(previousLayerIndex); for (LNode node : layer.getNodes()) { if (node.getProperty(LayeredOptions.PORT_CONSTRAINTS) != PortConstraints.FIXED_ORDER || node.getProperty(LayeredOptions.PORT_CONSTRAINTS) != PortConstraints.FIXED_POS) { Map<LNode, Integer> targetNodeModelOrder = new HashMap<>(); node.getPorts().stream().filter(p -> !p.getOutgoingEdges().isEmpty()).forEach(p -> { LNode targetNode = getTargetNode(p); p.setProperty(InternalProperties.LONG_EDGE_TARGET_NODE, targetNode); if (targetNode != null) { int previousOrder = Integer.MAX_VALUE; if (targetNodeModelOrder.containsKey(targetNode)) { previousOrder = targetNodeModelOrder.get(targetNode); } targetNodeModelOrder.put(targetNode, Math.min(p.getOutgoingEdges().get(0).getProperty(InternalProperties.MODEL_ORDER), previousOrder)); } }); Collections.sort(node.getPorts(), new ModelOrderPortComparator(previousLayer, targetNodeModelOrder)); } } Collections.sort(layer.getNodes(), new ModelOrderNodeComparator(previousLayer, graph.getProperty(LayeredOptions.CONSIDER_MODEL_ORDER))); layerIndex++; } }
Source:
<code>protected int processStatusCode(StatusLine statusLine) throws CustomResponseException { int statusCode = statusLine.getStatusCode(); <START> if (statusCode >= 400 && statusCode < 452) { <END> throw new CustomResponseException("Client error: " + statusLine.toString()); } else if (statusCode >= 500 && statusCode < 512) { throw new CustomResponseException("Server error: " + statusLine.toString()); } return statusCode; }</code><technical_language>4xx range (400 499) is defined for client errors</technical_language>

Target:
protected int processStatusCode(StatusLine statusLine) throws CustomResponseException { int statusCode = statusLine.getStatusCode(); if (statusCode >= 400 && statusCode <= 499) { throw new CustomResponseException("Client error: " + statusLine.toString()); } else if (statusCode >= 500 && statusCode <= 599) { throw new CustomResponseException("Server error: " + statusLine.toString()); } return statusCode; }
Source:
<code>private void refresh(NodeStatus status) { Objects.requireNonNull(status); LOG.fine("Refreshing: " + status.getUri()); <START> if (!status.getRegistrationSecret().equals(registrationSecret)) { <END> LOG.severe(String.format("Node at %s failed to send correct registration secret.", status.getUri())); return; } Lock writeLock = lock.writeLock(); writeLock.lock(); try { Optional<Host> existing = hosts.stream() .filter(host -> host.getId().equals(status.getNodeId())) .findFirst(); if (existing.isPresent()) { LOG.fine("Modifying existing state"); existing.get().update(status); } else { LOG.info("Creating a new remote node for " + status.getUri()); Node node = new RemoteNode( tracer, clientFactory, status.getNodeId(), status.getUri(), status.getStereotypes().keySet()); add(node, status); } } finally { writeLock.unlock(); } }</code><technical_language>status.getRegistrationSecret() return null</technical_language>

Target:
private void refresh(NodeStatus status) { Objects.requireNonNull(status); LOG.fine("Refreshing: " + status.getUri()); if (! Objects.equals(status.getRegistrationSecret(), registrationSecret)) { LOG.severe(String.format("Node at %s failed to send correct registration secret. Node NOT registered.", status.getUri())); bus.fire(new NodeRejectedEvent(status.getUri())); return; } Lock writeLock = lock.writeLock(); writeLock.lock(); try { Optional<Host> existing = hosts.stream() .filter(host -> host.getId().equals(status.getNodeId())) .findFirst(); if (existing.isPresent()) { LOG.fine("Modifying existing state"); existing.get().update(status); } else { LOG.info("Creating a new remote node for " + status.getUri()); Node node = new RemoteNode( tracer, clientFactory, status.getNodeId(), status.getUri(), status.getStereotypes().keySet()); add(node, status); } } finally { writeLock.unlock(); } }
Source:
<code>public PartitionFilter(@JsonProperty("hiveTableName") HiveTableName hiveTableName, @JsonProperty("parts") List<String> parts) { <START> this.hiveTableName = hiveTableName; <END> this.parts = ImmutableList.copyOf(parts); }</code><technical_language>rnn (+ for parts)</technical_language>

Target:
public PartitionFilter(@JsonProperty("hiveTableName") HiveTableName hiveTableName, @JsonProperty("parts") List<String> parts) { this.hiveTableName = requireNonNull(hiveTableName, "hiveTableName is null"); this.parts = ImmutableList.copyOf(requireNonNull(parts, "parts is null")); }
Source:
<code>public List<ProjectDetail> call() { <START> List<ProjectDetail> result = new ArrayList<ProjectDetail>(); <END> for (Project.NameKey projectName : projectCache.all()) { try { result.add(projectDetailFactory.create(projectName).call()); } catch (NoSuchProjectException e) { continue; } } Collections.sort(result, new Comparator<ProjectDetail>() { public int compare(final ProjectDetail a, final ProjectDetail b) { return a.project.getName().compareTo(b.project.getName()); } }); return result; }</code><technical_language>worth seeding size (in case 10k projects)</technical_language>

Target:
public List<ProjectDetail> call() { List<ProjectDetail> result = new ArrayList<ProjectDetail>(); for (Project.NameKey projectName : projectCache.all()) { try { result.add(projectDetailFactory.create(projectName).call()); } catch (NoSuchProjectException e) { } } Collections.sort(result, new Comparator<ProjectDetail>() { public int compare(final ProjectDetail a, final ProjectDetail b) { return a.project.getName().compareTo(b.project.getName()); } }); return result; }
Source:
<code>public VdcUserConditionFieldAutoCompleter() { super(); mVerbs.add("NAME"); mVerbs.add("LASTNAME"); mVerbs.add("USRNAME"); mVerbs.add("DEPARTMENT"); mVerbs.add("GROUP"); mVerbs.add("TITLE"); mVerbs.add("ACTIVE"); mVerbs.add("ROLE"); mVerbs.add("TAG"); mVerbs.add("POOL"); mVerbs.add("TYPE"); buildCompletions(); getTypeDictionary().put("NAME", String.class); getTypeDictionary().put("LASTNAME", String.class); getTypeDictionary().put("USRNAME", String.class); getTypeDictionary().put("DEPARTMENT", String.class); getTypeDictionary().put("TITLE", String.class); getTypeDictionary().put("GROUP", String.class); getTypeDictionary().put("ACTIVE", Boolean.class); getTypeDictionary().put("ROLE", String.class); getTypeDictionary().put("TAG", String.class); getTypeDictionary().put("POOL", String.class); getTypeDictionary().put("TYPE", UserOrGroup.class); columnNameDict.put("NAME", "name"); columnNameDict.put("LASTNAME", "surname"); columnNameDict.put("USRNAME", "username"); columnNameDict.put("DEPARTMENT", "department"); columnNameDict.put("TITLE", "role"); columnNameDict.put("GROUP", "groups"); columnNameDict.put("ACTIVE", "active"); columnNameDict.put("ROLE", "mla_role"); <START> columnNameDict.put("TAG", SyntaxChecker.TAG_COLUMN_NAME_IN_CRITERIA); <END> columnNameDict.put("POOL", "vm_pool_name"); columnNameDict.put("TYPE", "user_group"); buildBasicValidationTable(); }</code><technical_language>I leave "tag_name" if want in future put constants , putting is clear..</technical_language>

Target:
public VdcUserConditionFieldAutoCompleter() { super(); mVerbs.add("NAME"); mVerbs.add("LASTNAME"); mVerbs.add("USRNAME"); mVerbs.add("DEPARTMENT"); mVerbs.add("GROUP"); mVerbs.add("TITLE"); mVerbs.add("ACTIVE"); mVerbs.add("ROLE"); mVerbs.add("TAG"); mVerbs.add("POOL"); mVerbs.add("TYPE"); buildCompletions(); getTypeDictionary().put("NAME", String.class); getTypeDictionary().put("LASTNAME", String.class); getTypeDictionary().put("USRNAME", String.class); getTypeDictionary().put("DEPARTMENT", String.class); getTypeDictionary().put("TITLE", String.class); getTypeDictionary().put("GROUP", String.class); getTypeDictionary().put("ACTIVE", Boolean.class); getTypeDictionary().put("ROLE", String.class); getTypeDictionary().put("TAG", String.class); getTypeDictionary().put("POOL", String.class); getTypeDictionary().put("TYPE", UserOrGroup.class); columnNameDict.put("NAME", "name"); columnNameDict.put("LASTNAME", "surname"); columnNameDict.put("USRNAME", "username"); columnNameDict.put("DEPARTMENT", "department"); columnNameDict.put("TITLE", "role"); columnNameDict.put("GROUP", "groups"); columnNameDict.put("ACTIVE", "active"); columnNameDict.put("ROLE", "mla_role"); columnNameDict.put("TAG", "tag_name"); columnNameDict.put("POOL", "vm_pool_name"); columnNameDict.put("TYPE", "user_group"); buildBasicValidationTable(); }
Source:
<code>private static String hashClasspathEntry(URL entry) throws IOException { InputStream is = entry.openStream(); try { DigestInputStream input = null; try { MessageDigest digest = MessageDigest.getInstance("SHA-1"); input = new DigestInputStream(new BufferedInputStream(is), digest); byte[] buffer = new byte[1024]; while (input.read(buffer) != -1) { } return Util.toHexString(digest.digest()); } catch (NoSuchAlgorithmException x) { throw new AssertionError(x); } finally { if (input != null) { <START> input.close();; <END> } } } finally { is.close(); } }</code><technical_language>Unnecessary, this is a wrapper stream, base stream is closed, FindBugs is dumb, suppress it</technical_language>

Target:
private static String hashClasspathEntry(URL entry) throws IOException { InputStream is = entry.openStream(); try { DigestInputStream input = null; try { MessageDigest digest = MessageDigest.getInstance("SHA-1"); input = new DigestInputStream(new BufferedInputStream(is), digest); byte[] buffer = new byte[1024]; while (input.read(buffer) != -1) { } return Util.toHexString(digest.digest()); } catch (NoSuchAlgorithmException x) { throw new AssertionError(x); } finally { if (input != null) { input.close(); } } } finally { is.close(); } }
Source:
<code><START> public void testExtractValue() { <END> SqlTester mySqlTester = tester(SqlLibrary.MYSQL); mySqlTester.checkNull("ExtractValue(NULL, ' mySqlTester.checkNull("ExtractValue('', NULL)"); mySqlTester.checkFails("ExtractValue('<a><b/></a>', '#/a/b')", "Illegal behavior '.*", true); mySqlTester.checkFails("ExtractValue('<a><b/></a></a>', '/b')", "Illegal behavior '.*", true); mySqlTester.checkString("ExtractValue('<a>c</a>', ' "c", "VARCHAR(2000)"); mySqlTester.checkString("ExtractValue('<a>ccc<b>ddd</b></a>', '/a')", "ccc", "VARCHAR(2000)"); mySqlTester.checkString("ExtractValue('<a>ccc<b>ddd</b></a>', '/a/b')", "ddd", "VARCHAR(2000)"); mySqlTester.checkString("ExtractValue('<a>ccc<b>ddd</b></a>', '/b')", "", "VARCHAR(2000)"); mySqlTester.checkString("ExtractValue('<a>ccc<b>ddd</b><b>eee</b></a>', ' "ddd eee", "VARCHAR(2000)"); mySqlTester.checkString("ExtractValue('<a><b/></a>', 'count(/a/b)')", "1", "VARCHAR(2000)"); }</code><technical_language>@Test line method name</technical_language>

Target:
@Test public void testExtractValue() { SqlTester mySqlTester = tester(SqlLibrary.MYSQL); mySqlTester.checkNull("ExtractValue(NULL, ' mySqlTester.checkNull("ExtractValue('', NULL)"); mySqlTester.checkFails("ExtractValue('<a><b/></a>', '#/a/b')", "Illegal behavior '.*", true); mySqlTester.checkFails("ExtractValue('<a><b/></a></a>', '/b')", "Illegal behavior '.*", true); mySqlTester.checkString("ExtractValue('<a>c</a>', ' "c", "VARCHAR(2000)"); mySqlTester.checkString("ExtractValue('<a>ccc<b>ddd</b></a>', '/a')", "ccc", "VARCHAR(2000)"); mySqlTester.checkString("ExtractValue('<a>ccc<b>ddd</b></a>', '/a/b')", "ddd", "VARCHAR(2000)"); mySqlTester.checkString("ExtractValue('<a>ccc<b>ddd</b></a>', '/b')", "", "VARCHAR(2000)"); mySqlTester.checkString("ExtractValue('<a>ccc<b>ddd</b><b>eee</b></a>', ' "ddd eee", "VARCHAR(2000)"); mySqlTester.checkString("ExtractValue('<a><b/></a>', 'count(/a/b)')", "1", "VARCHAR(2000)"); }
Source:
<code>public void start() { logger.fine("BundleManager.start"); installServices(); try { COMPONENT_COLLECTION_CACHE_FILE_URI=ResourceRegistry.getInstance().getResource("componentCollections/defaultComponentCollection.abd",RES_TYPE.WEB_DOCUMENT_ROOT); LOADER_COMPONENTLIST_CACHE_FILE_URI=ResourceRegistry.getInstance().getResource(LOADER_COMPONENTLIST_LOCATION,RES_TYPE.PROFILE); if(ResourceRegistry.getInstance().isOSGIMode()) { <START> String md5Sum=generateMD5Sum(); <END> if(bundleChangeDetected(md5Sum)||cacheFileMissing()) { generateCacheFiles(); } storeMD5Sum(md5Sum); } initComponentTypeIDToJarNameMap(); logger.fine("BundleManager initialization finished"); } catch (IOException | ParseException | URISyntaxException | NoSuchAlgorithmException e1) { AstericsErrorHandling.instance.reportError(null, "Could not create cache for Asterics components:\n" + e1.getMessage()); } }</code><technical_language>please format</technical_language>

Target:
public void start() { logger.fine("BundleManager.start"); AREProperties.instance.getProperty(ARE_GENERATE_CACHES_FROM_INSTALLABLE_BUNDLES_PROP_KEY, "false", "Enable/Disable if bundles should be tested for being installable on this platform via OSGI"); installServices(); try { COMPONENT_COLLECTION_CACHE_FILE_URI = ResourceRegistry.getInstance().getResource(DEFAULT_COMPONENT_COLLECTION_ABD, RES_TYPE.WEB_DOCUMENT_ROOT); LOADER_COMPONENTLIST_CACHE_FILE_URI = ResourceRegistry.getInstance().getResource(LOADER_COMPONENTLIST_LOCATION, RES_TYPE.TMP); if (ResourceRegistry.getInstance().isOSGIMode()) { String mdSum = generateMDSum(); if (cacheFileMissing() || bundleChangeDetected(mdSum)) { generateCacheFiles(); } storeMDSum(mdSum); } initComponentTypeIDToJarNameMap(); logger.fine("BundleManager initialization finished"); } catch (IOException | ParseException | URISyntaxException | NoSuchAlgorithmException e1) { AstericsErrorHandling.instance.reportError(null, "Could not create cache for Asterics components:\n" + e1.getMessage()); } }
Source:
<code>private Map<StatsReportType, StatsSnapshot> generateRandomSnapshot() { Map<String, StatsSnapshot> accountMap = new HashMap<>(); <START> Map<String, StatsSnapshot> account_container_Map = new HashMap<>(); <END> long totalSize = 0; for (int i = 0; i < random.nextInt(MAX_ACCOUNT_COUNT - MIN_ACCOUNT_COUNT + 1) + MIN_ACCOUNT_COUNT; i++) { String accountIdStr = "Account[".concat(String.valueOf(i)).concat("]"); Map<String, StatsSnapshot> containerMap = new HashMap<>(); long subTotalSize = 0; for (int j = 0; j < random.nextInt(MAX_CONTAINER_COUNT - MIN_CONTAINER_COUNT + 1) + MIN_CONTAINER_COUNT; j++) { String containerIdStr = "Container[".concat(String.valueOf(j)).concat("]"); long validSize = random.nextInt(2501) + 500; subTotalSize += validSize; containerMap.put(containerIdStr, new StatsSnapshot(validSize, null)); account_container_Map.put(accountIdStr + "_" + containerIdStr, new StatsSnapshot(validSize, null)); } totalSize += subTotalSize; accountMap.put(accountIdStr, new StatsSnapshot(subTotalSize, containerMap)); } Map<StatsReportType, StatsSnapshot> allSnapshots = new HashMap<>(); allSnapshots.put(StatsReportType.PARTITION_CLASS_REPORT, new StatsSnapshot(totalSize, account_container_Map)); allSnapshots.put(StatsReportType.ACCOUNT_REPORT, new StatsSnapshot(totalSize, accountMap)); return allSnapshots; }</code><technical_language>minor: naming camel case, underscore</technical_language>

Target:
private Map<StatsReportType, StatsSnapshot> generateRandomSnapshot() { Map<String, StatsSnapshot> accountMap = new HashMap<>(); Map<String, StatsSnapshot> accountContainerPairMap = new HashMap<>(); long totalSize = 0; for (int i = 0; i < random.nextInt(MAX_ACCOUNT_COUNT - MIN_ACCOUNT_COUNT + 1) + MIN_ACCOUNT_COUNT; i++) { String accountIdStr = "Account[".concat(String.valueOf(i)).concat("]"); Map<String, StatsSnapshot> containerMap = new HashMap<>(); long subTotalSize = 0; for (int j = 0; j < random.nextInt(MAX_CONTAINER_COUNT - MIN_CONTAINER_COUNT + 1) + MIN_CONTAINER_COUNT; j++) { String containerIdStr = "Container[".concat(String.valueOf(j)).concat("]"); long validSize = random.nextInt(2501) + 500; subTotalSize += validSize; containerMap.put(containerIdStr, new StatsSnapshot(validSize, null)); accountContainerPairMap.put(accountIdStr + Utils.ACCOUNT_CONTAINER_SEPARATOR + containerIdStr, new StatsSnapshot(validSize, null)); } totalSize += subTotalSize; accountMap.put(accountIdStr, new StatsSnapshot(subTotalSize, containerMap)); } Map<StatsReportType, StatsSnapshot> allSnapshots = new HashMap<>(); allSnapshots.put(StatsReportType.PARTITION_CLASS_REPORT, new StatsSnapshot(totalSize, accountContainerPairMap)); allSnapshots.put(StatsReportType.ACCOUNT_REPORT, new StatsSnapshot(totalSize, accountMap)); return allSnapshots; }
Source:
<code>public boolean onTouchEvent(@NonNull final TextView widget, @NonNull final Spannable buffer, @NonNull final MotionEvent event) { final int action = event.getAction(); if (action == MotionEvent.ACTION_UP) { final int x = (int) event.getX() - widget.getTotalPaddingLeft() + widget.getScrollX(); final int y = (int) event.getY() - widget.getTotalPaddingTop() + widget.getScrollY(); final Layout layout = widget.getLayout(); final int line = layout.getLineForVertical(y); final int off = layout.getOffsetForHorizontal(line, x); final URLSpan[] links = buffer.getSpans(off, off, URLSpan.class); if (links.length != 0) { String url = decodeURL(links[0].getURL()); handler.onUrlClick(url, <START> null); <END> return true; } } return super.onTouchEvent(widget, buffer, event); }</code><technical_language>This kind of dubious. onUrlClick() relies titleString non-null. This responsible for links longer working reference pop-ups</technical_language>

Target:
public boolean onTouchEvent(@NonNull final TextView widget, @NonNull final Spannable buffer, @NonNull final MotionEvent event) { final int action = event.getAction(); if (action == MotionEvent.ACTION_UP) { final int x = (int) event.getX() - widget.getTotalPaddingLeft() + widget.getScrollX(); final int y = (int) event.getY() - widget.getTotalPaddingTop() + widget.getScrollY(); final Layout layout = widget.getLayout(); final int line = layout.getLineForVertical(y); final int off = layout.getOffsetForHorizontal(line, x); final URLSpan[] links = buffer.getSpans(off, off, URLSpan.class); if (links.length != 0) { String url = decodeURL(links[0].getURL()); handler.onUrlClick(url, UriUtil.getTitleFromUrl(url)); return true; } } return super.onTouchEvent(widget, buffer, event); }
Source:
<code>protected void configure() { Multibinder<ServicePlugin> plugins = Multibinder.newSetBinder(binder(), ServicePlugin.class); plugins.addBinding().toInstance(Plugins.of(new HttpBackend(port))); install(new ServletModule() { @Override protected void configureServlets() { bind(TestServlet.class).in(Singleton.class); serve("/test").with(TestServlet.class); } }); install(new SitebricksModule() { @Override protected void configureSitebricks() { at("/testservice").serve(ExampleService.class); at("/r/controllers").serve(ApControllerService.class); at("/r/aps").serve(AccessPointService.class); at("/r/operators").serve(OperatorService.class); <START> at("/r/rgs").serve(RoamingGroupService.class); <END> } }); }</code><technical_language>/r/roaming-groups</technical_language>

Target:
protected void configure() { Multibinder<ServicePlugin> plugins = Multibinder.newSetBinder(binder(), ServicePlugin.class); plugins.addBinding().toInstance(Plugins.of(new HttpBackend(port))); install(new ServletModule() { @Override protected void configureServlets() { bind(TestServlet.class).in(Singleton.class); serve("/test").with(TestServlet.class); } }); install(new SitebricksModule() { @Override protected void configureSitebricks() { at("/testservice").serve(ExampleService.class); at("/r/controllers").serve(ApControllerService.class); at("/r/aps").serve(AccessPointService.class); at("/r/operators").serve(OperatorService.class); at("/r/roaming-groups").serve(RoamingGroupService.class); } }); }
Source:
<code>public void resetCookie(String name, String path) { <START> throw new IllegalStateException("Not supported yet"); <END> }</code><technical_language>UOE instead of ISE (x3)</technical_language>

Target:
public void resetCookie(String name, String path) { throw new UnsupportedOperationException("Not supported yet"); }
Source:
<code>@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { final double rowCount = mq.getRowCount(this.input).doubleValue(); <START> double toSort = this.fetch == null ? rowCount : RexLiteral.intValue(this.fetch); <END> if (this.offset != null) { toSort += RexLiteral.intValue(this.offset); } toSort = Math.min(rowCount, toSort); final double lookup = Math.max(1., Math.log(toSort)); final double bytesPerRow = this.getRowType().getFieldCount() * 4.; final double cpu = (rowCount * lookup) * bytesPerRow; RelOptCost cost = planner.getCostFactory().makeCost(rowCount, cpu, 0); return cost; }</code><technical_language>implement method allow this.fetch a dynamic parameter; (computeSelfCost) assume a RexLiteral (I impression arriving this point a RexDynamicParam throw exception). modify cost computation (but impossible give a precise cost in case of dynamic parameter); simplify decide EnumerableLimitSort supports fetch (and offset) in form of RexLiteral (and adapt EnumerableLimitSortRule accordingly)</technical_language>

Target:
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { final double rowCount = mq.getRowCount(this.input).doubleValue(); double toSort = getValue(this.fetch, rowCount); if (this.offset != null) { toSort += getValue(this.offset, rowCount); } toSort = Math.min(rowCount, toSort); final double lookup = Math.max(1., Math.log(toSort)); final double bytesPerRow = this.getRowType().getFieldCount() * 4.; final double cpu = (rowCount * lookup) * bytesPerRow; RelOptCost cost = planner.getCostFactory().makeCost(rowCount, cpu, 0); return cost; }
Source:
<code>public ValidationTopology(String defaultPropertyFile, String providedPropertyFile, String defaultValidationPropertiesFile, String providedValidationPropertiesFile) { topologyProperties = new Properties(); PropertyFileLoader.loadPropertyFile(defaultPropertyFile, providedPropertyFile, topologyProperties); <START> loadValidationProperties(defaultValidationPropertiesFile, providedValidationPropertiesFile); <END> brokerHosts = new ZkHosts(topologyProperties.getProperty(TopologyPropertyKeys.INPUT_ZOOKEEPER_ADDRESS)); }</code><technical_language>this method loadValidationProperties more generic for loading topologyProperties validationProperties</technical_language>

Target:
public ValidationTopology(String defaultPropertyFile, String providedPropertyFile, String defaultValidationPropertiesFile, String providedValidationPropertiesFile) { PropertyFileLoader.loadPropertyFile(defaultPropertyFile, providedPropertyFile, topologyProperties); PropertyFileLoader.loadPropertyFile(defaultValidationPropertiesFile, providedValidationPropertiesFile, validationProperties); brokerHosts = new ZkHosts(topologyProperties.getProperty(TopologyPropertyKeys.INPUT_ZOOKEEPER_ADDRESS)); }