auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() throws ConfigError, IOException, UnhandledEvent { FlowVisor.setInstance(this); Runtime.getRuntime().addShutdownHook(new ShutdownHook()); FVLog.log(LogLevel.INFO, null, "initializing poll loop"); FVEventLoop pollLoop = new FVEventLoop(); sliceLimits = new SlicerLimits(); JettyServer.spawnJettyServer(FVConfig.getJettyPort()); if (port == 0) port = FVConfig.getListenPort(); if (TopologyController.isConfigured()) handlers.add(TopologyController.spawn(pollLoop)); <START> OFSwitchAcceptor acceptor = new OFSwitchAcceptor(pollLoop, port, 16,FVConfig.getClearFlowTableOnConnect()); <END> acceptor.setSlicerLimits(sliceLimits); handlers.add(acceptor); try { this.apiServer = APIServer.spawn(); } catch (Exception e) { FVLog.log(LogLevel.FATAL, null, "failed to spawn APIServer"); e.printStackTrace(); System.exit(-1); } boolean flowdb = false; try { if (FVConfig.getFlowTracking()) flowdb = true; } catch (ConfigError e) { FVConfig.setFlowTracking(false); this.checkPointConfig(); } if (!flowdb) FVLog.log(LogLevel.INFO, null, "flowdb: Disabled"); pollLoop.doEventLoop(); }</code><technical_language>I more sense if extra parameter read FVClassifier required OFSwitchAcceptor. feature more other config options classifier supports</technical_language>

Target:
public void run() throws ConfigError, IOException, UnhandledEvent { FlowVisor.setInstance(this); Runtime.getRuntime().addShutdownHook(new ShutdownHook()); FVLog.log(LogLevel.INFO, null, "initializing poll loop"); FVEventLoop pollLoop = new FVEventLoop(); sliceLimits = new SlicerLimits(); JettyServer.spawnJettyServer(FVConfig.getJettyPort()); if (port == 0) port = FVConfig.getListenPort(); if (TopologyController.isConfigured()) handlers.add(TopologyController.spawn(pollLoop)); OFSwitchAcceptor acceptor = new OFSwitchAcceptor(pollLoop, port, 16); acceptor.setSlicerLimits(sliceLimits); handlers.add(acceptor); try { this.apiServer = APIServer.spawn(); } catch (Exception e) { FVLog.log(LogLevel.FATAL, null, "failed to spawn APIServer"); e.printStackTrace(); System.exit(-1); } boolean flowdb = false; try { if (FVConfig.getFlowTracking()) flowdb = true; } catch (ConfigError e) { FVConfig.setFlowTracking(false); this.checkPointConfig(); } if (!flowdb) FVLog.log(LogLevel.INFO, null, "flowdb: Disabled"); pollLoop.doEventLoop(); }
Source:
<code>private static Geometry readPolygon(SliceInput input) { requireNonNull(input, "input is null"); skipEnvelope(input); int partCount = input.readInt(); if (partCount == 0) { return GEOMETRY_FACTORY.createPolygon(); } int pointCount = input.readInt(); int[] startIndexes = new int[partCount]; for (int i = 0; i < partCount; i++) { startIndexes[i] = input.readInt(); } int[] partLengths = new int[partCount]; if (partCount > 1) { <START> partLengths[0] = startIndexes[1]; <END> for (int i = 1; i < partCount - 1; i++) { partLengths[i] = startIndexes[i + 1] - startIndexes[i]; } } partLengths[partCount - 1] = pointCount - startIndexes[partCount - 1]; List<Polygon> polygons = new ArrayList<>(); LinearRing shell = null; List<LinearRing> holes = new ArrayList<>(); for (int i = 0; i < partCount; i++) { Coordinate[] coordinates = readCoordinates(input, partLengths[i]); if (isClockwise(coordinates)) { if (shell != null) { polygons.add(GEOMETRY_FACTORY.createPolygon(shell, holes.toArray(new LinearRing[0]))); } shell = GEOMETRY_FACTORY.createLinearRing(coordinates); holes.clear(); } else { holes.add(GEOMETRY_FACTORY.createLinearRing(coordinates)); } } polygons.add(GEOMETRY_FACTORY.createPolygon(shell, holes.toArray(new LinearRing[0]))); if (polygons.size() == 1) { return polygons.get(0); } else { return GEOMETRY_FACTORY.createMultiPolygon(polygons.toArray(new Polygon[0])); } }</code><technical_language>double check partCount==1 case is handled fine here</technical_language>

Target:
private static Geometry readPolygon(SliceInput input) { requireNonNull(input, "input is null"); skipEnvelope(input); int partCount = input.readInt(); if (partCount == 0) { return GEOMETRY_FACTORY.createPolygon(); } int pointCount = input.readInt(); int[] startIndexes = new int[partCount]; for (int i = 0; i < partCount; i++) { startIndexes[i] = input.readInt(); } int[] partLengths = new int[partCount]; if (partCount > 1) { partLengths[0] = startIndexes[1]; for (int i = 1; i < partCount - 1; i++) { partLengths[i] = startIndexes[i + 1] - startIndexes[i]; } } partLengths[partCount - 1] = pointCount - startIndexes[partCount - 1]; LinearRing shell = null; List<LinearRing> holes = new ArrayList<>(); List<Polygon> polygons = new ArrayList<>(); for (int i = 0; i < partCount; i++) { Coordinate[] coordinates = readCoordinates(input, partLengths[i]); if (!isClockwise(coordinates)) { holes.add(GEOMETRY_FACTORY.createLinearRing(coordinates)); continue; } if (shell != null) { polygons.add(GEOMETRY_FACTORY.createPolygon(shell, holes.toArray(new LinearRing[0]))); } shell = GEOMETRY_FACTORY.createLinearRing(coordinates); holes.clear(); } polygons.add(GEOMETRY_FACTORY.createPolygon(shell, holes.toArray(new LinearRing[0]))); if (polygons.size() == 1) { return polygons.get(0); } return GEOMETRY_FACTORY.createMultiPolygon(polygons.toArray(new Polygon[0])); }
Source:
<code>public final void destroy() throws IOException { <START> queryRunner.close(); <END> queryRunner = null; embeddedElasticsearch.close(); }</code><technical_language>Closer resources a chance closed</technical_language>

Target:
public final void destroy() throws IOException { try (Closer closer = Closer.create()) { closer.register(queryRunner); closer.register(embeddedElasticsearch); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>public void returnsNumberOfAllowedRequests(String account, String method, int expectedNumberOfAllowedRequests) { <START> when(rateLimiterKey.getMethod()).thenReturn(method); <END> assertThat(rateLimitManager.getAllowedNumberOfRequests(rateLimiterKey, account), is(expectedNumberOfAllowedRequests)); }</code><technical_language>Personally I prefer create a real RateLimiterKey a mock simple do, a big deal</technical_language>

Target:
public void returnsNumberOfAllowedRequests(String account, String method, int expectedNumberOfAllowedRequests) { var rateLimiterKey = new RateLimiterKey("path", "key-type", method); assertThat(rateLimitManager.getAllowedNumberOfRequests(rateLimiterKey, account), is(expectedNumberOfAllowedRequests)); }
Source:
<code>public <T extends OAuth2AuthorizedClient> T loadAuthorizedClient(String id, Authentication principal, HttpServletRequest request) { OAuth2AuthorizedClient result = delegate.loadAuthorizedClient(id, principal, request); if (result != null) { return (T) result; } <START> if (repo.isAuthzClient(id) && !repo.getAuthorizationProperties().get(id).getOnDemand()) { <END> OAuth2AuthorizedClient client = loadAuthorizedClient(defaultClientRegistrationId(), principal, request); return (T) createInitAuthzClient(client, id, principal); } return null; }</code><technical_language>update method isAuthzClient, add getOnDemand logic in method isAuthzClient</technical_language>

Target:
public <T extends OAuth2AuthorizedClient> T loadAuthorizedClient(String id, Authentication principal, HttpServletRequest request) { OAuth2AuthorizedClient result = delegate.loadAuthorizedClient(id, principal, request); if (result != null) { return (T) result; } if (repo.isAuthzClient(id)) { OAuth2AuthorizedClient client = loadAuthorizedClient(defaultClientRegistrationId(), principal, request); return (T) createInitAuthzClient(client, id, principal); } return null; }
Source:
<code>public void testTokenFetch() { long millis = System.currentTimeMillis(); final String username = "someusername" + millis; final String password = "somepassword" + millis; final String repeat = password; CompatCreateAccountResult createAccountResult; new AMLoginInfoTask() { @Override public void onCatch(Throwable caught) { <START> L.e("AMLoginInfoTask failed: " + caught.getMessage()); <END> } @Override public void onFinish(AMLoginInfoResult result) { if (result.getEnabled()) { L.i("Logging in with AuthManager"); AMSubject subject = new AMSubject(username, password, repeat, null); subject.execute(); handleCreateAccountResult(subject.await()); } else { L.i("Logging in with legacy login"); Subject subject = new Subject(username, password, null); subject.execute(); handleCreateAccountResult(subject.await()); } } }.execute(); }</code><technical_language>a nit: I this L.e(caught) L.e("foo", caught); this is a test fail</technical_language>

Target:
public void testTokenFetch() { long millis = System.currentTimeMillis(); final String username = "someusername" + millis; final String password = "somepassword" + millis; final String repeat = password; new AMLoginInfoTask() { @Override public void onCatch(Throwable caught) { L.e(caught); fail(); } @Override public void onFinish(AMLoginInfoResult result) { if (result.getEnabled()) { L.i("Logging in with AuthManager"); isAuthManagerEnabled = true; amSubject = new AMSubject(username, password, repeat, null); amSubject.execute(); } else { L.i("Logging in with legacy login"); legacySubject = new Subject(username, password, null); legacySubject.execute(); } } }.execute(); CompatCreateAccountResult result = isAuthManagerEnabled ? amSubject.await() : legacySubject.await(); handleCreateAccountResult(result); }
Source:
<code>public ObjectInformation( final long id, final String name, final String typeString, final Date savedDate, final int version, final WorkspaceUser savedBy, final ResolvedWorkspaceID workspaceID, final String chksum, final long size, final UncheckedUserMetadata meta) { if (id < 1) { throw new IllegalArgumentException("id must be > 0"); } if (version < 1) { throw new IllegalArgumentException("version must be > 0"); } if (size < 1) { throw new IllegalArgumentException("size must be > 0"); } if (name == null || name.isEmpty()) { throw new IllegalArgumentException("name is null or empty"); } if (typeString == null || typeString.isEmpty()) { throw new IllegalArgumentException("typeString is null or empty"); } if (chksum == null|| chksum.isEmpty()) { throw new IllegalArgumentException("chksum is null or empty"); } if (savedDate == null) { throw new NullPointerException("savedDate"); } if (savedBy == null) { throw new NullPointerException("savedBy"); } if (workspaceID == null) { throw new NullPointerException("workspaceID"); } this.id = id; this.name = name; this.type = typeString; <START> this.savedDate = savedDate; <END> this.version = version; this.savedBy = savedBy; this.workspaceID = workspaceID.getID(); this.workspaceName = workspaceID.getName(); this.chksum = chksum; this.size = size; this.meta = meta; final List<Reference> refs = new LinkedList<>(); refs.add(new Reference(workspaceID.getID(), id, version)); this.refpath = Collections.unmodifiableList(refs); }</code><technical_language>in case intended immutable class java.util.Data is mutable class. check here: <LINK_0></technical_language>

Target:
public ObjectInformation( final long id, final String name, final String typeString, final Date savedDate, final int version, final WorkspaceUser savedBy, final ResolvedWorkspaceID workspaceID, final String chksum, final long size, final UncheckedUserMetadata meta) { if (id < 1) { throw new IllegalArgumentException("id must be > 0"); } if (version < 1) { throw new IllegalArgumentException("version must be > 0"); } if (size < 1) { throw new IllegalArgumentException("size must be > 0"); } if (name == null || name.isEmpty()) { throw new IllegalArgumentException("name is null or empty"); } if (typeString == null || typeString.isEmpty()) { throw new IllegalArgumentException("typeString is null or empty"); } if (chksum == null|| chksum.isEmpty()) { throw new IllegalArgumentException("chksum is null or empty"); } if (savedDate == null) { throw new NullPointerException("savedDate"); } if (savedBy == null) { throw new NullPointerException("savedBy"); } if (workspaceID == null) { throw new NullPointerException("workspaceID"); } this.id = id; this.name = name; this.type = typeString; this.savedDate = savedDate.getTime(); this.version = version; this.savedBy = savedBy; this.workspaceID = workspaceID.getID(); this.workspaceName = workspaceID.getName(); this.chksum = chksum; this.size = size; this.meta = meta; final List<Reference> refs = new LinkedList<>(); refs.add(new Reference(workspaceID.getID(), id, version)); this.refpath = Collections.unmodifiableList(refs); }
Source:
<code>public String getDisplayName() { <START> return "Abort and restart the build"; <END> }</code><technical_language>Please prepare for internationalization Messages.properties. Example: - <LINK_0> - <LINK_1></technical_language>

Target:
public String getDisplayName() { return Messages.AbortAndRestartOperation_DisplayName(); }
Source:
<code>private boolean tooManyPacks() { int autopacklimit = repo.getConfig().getInt( ConfigConstants.CONFIG_GC_SECTION, ConfigConstants.CONFIG_KEY_AUTOPACKLIMIT, <START> 50); <END> if (autopacklimit <= 0) { return false; } return repo.getObjectDatabase().getPacks().size() > autopacklimit; }</code><technical_language>50 a constant</technical_language>

Target:
private boolean tooManyPacks() { int autopacklimit = repo.getConfig().getInt( ConfigConstants.CONFIG_GC_SECTION, ConfigConstants.CONFIG_KEY_AUTOPACKLIMIT, DEFAULT_AUTOPACKLIMIT); if (autopacklimit <= 0) { return false; } return repo.getObjectDatabase().getPacks().size() > (autopacklimit + 1); }
Source:
<code>public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config == null || config.isEmpty()) { logger.warn("Empty or null configuration. Ignoring."); return; } Set<String> names = getNames(config); for (String name : names) { String value = (String) config.get(name + ".serialPort"); String serialPort = value != null ? value : MeterDeviceConfig.DEFAULT_SERIAL_PORT; value = (String) config.get(name + ".baudRateChangeDelay"); int baudRateChangeDelay = value != null ? Integer.valueOf(value) : MeterDeviceConfig.DEFAULT_BAUD_RATE_CHANGE_DELAY; value = (String) config.get(name + ".echoHandling"); boolean echoHandling = value != null ? Boolean.valueOf(value) : MeterDeviceConfig.DEFAULT_ECHO_HANDLING; MeterReader reader = createIec6205621MeterReader(name, new MeterDeviceConfig(serialPort, baudRateChangeDelay, echoHandling)); if (meterDevices.put(reader.getName(), reader) != null) { logger.info("Recreated reader with {}!", reader.getName(), reader.getConfig()); } else { logger.info("Created reader with {}!", reader.getName(), reader.getConfig()); <START> } <END> } if (config != null) { if (StringUtils.isNotBlank((String) config.get("refresh"))) { refreshInterval = Long .parseLong((String) config.get("refresh")); } setProperlyConfigured(true); } }</code><technical_language>in general updated() method is meant for static system configuration ip addresses of gateways stuff. creation of concrete readers done items do refer a specific meter. dangling Reader instances reading content state item</technical_language>

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config == null || config.isEmpty()) { logger.warn("Empty or null configuration. Ignoring."); return; } Set<String> names = getNames(config); for (String name : names) { String value = (String) config.get(name + ".serialPort"); String serialPort = value != null ? value : MeterConfig.DEFAULT_SERIAL_PORT; value = (String) config.get(name + ".baudRateChangeDelay"); int baudRateChangeDelay = value != null ? Integer.valueOf(value) : MeterConfig.DEFAULT_BAUD_RATE_CHANGE_DELAY; value = (String) config.get(name + ".echoHandling"); boolean echoHandling = value != null ? Boolean.valueOf(value) : MeterConfig.DEFAULT_ECHO_HANDLING; Meter meterConfig = createIec6205621MeterConfig(name, new MeterConfig(serialPort, baudRateChangeDelay, echoHandling)); if (meterDeviceConfigurtions.put(meterConfig.getName(), meterConfig) != null) { logger.info("Recreated reader with {}!", meterConfig.getName(), meterConfig.getConfig()); } else { logger.info("Created reader with {}!", meterConfig.getName(), meterConfig.getConfig()); } } if (config != null) { if (StringUtils.isNotBlank((String) config.get("refresh"))) { refreshInterval = Long .parseLong((String) config.get("refresh")); } setProperlyConfigured(true); } }
Source:
<code>public List<Project> fillClearingStateSummaryIncludingSubprojects(List<Project> projects, User user) { <START> final Map<String, Project> allProjectsIdMap = ThriftUtils.getIdMap(repository.getAll()); <END> projects.stream().forEach(project -> { Set<String> releaseIdsOfProjectTree = getReleaseIdsOfProjectTree(project, Sets.newHashSet(), allProjectsIdMap, user, null); List<Release> releasesForClearingStateSummary = componentDatabaseHandler .getReleasesForClearingStateSummary(releaseIdsOfProjectTree); final ReleaseClearingStateSummary releaseClearingStateSummary = ReleaseClearingStateSummaryComputer .computeReleaseClearingStateSummary(releasesForClearingStateSummary, project.getClearingTeam()); project.setReleaseClearingStateSummary(releaseClearingStateSummary); }); return projects; }</code><technical_language>So, big problem I this approach. chopped request for clearing status requests for of requests, load complete projects repository. means, display projects page for user, send N/10+1 requests for of projects DB instead of two. number of project is increase, I this approach future. Remember limit number of components loaded for display main page improve performance? do this for projects, +1 part faster. N/10 calls for clearing status loading projects. applies sticky filtering Group, is used. afraid is acceptable of loading deep project tree structures fly. I compute this information in some background jobs load DB cache necessary. Case in point: dev system contains 1099 projects. 2:25 min for projects page completely load, including clearing statuses. discuss</technical_language>

Target:
public List<Project> fillClearingStateSummaryIncludingSubprojects(List<Project> projects, User user) { final Map<String, Project> allProjectsIdMap = getRefreshedAllProjectsIdMap(); projects.stream().forEach(project -> { Set<String> releaseIdsOfProjectTree = getReleaseIdsOfProjectTree(project, Sets.newHashSet(), allProjectsIdMap, user, null); List<Release> releasesForClearingStateSummary = componentDatabaseHandler .getReleasesForClearingStateSummary(releaseIdsOfProjectTree); final ReleaseClearingStateSummary releaseClearingStateSummary = ReleaseClearingStateSummaryComputer .computeReleaseClearingStateSummary(releasesForClearingStateSummary, project.getClearingTeam()); project.setReleaseClearingStateSummary(releaseClearingStateSummary); }); return projects; }
Source:
<code>public void deleteSupplementaryResources(IResource[] resources) { for (int i = 0; i < resources.length; i++) { try { resources[i].delete(true, new NullProgressMonitor()); } catch (CoreException e) { <START> Activator.getDefault().logError("Error deleting supplementary resource " + resources[i], e); END> } } }</code><technical_language>externalize</technical_language>

Target:
public void deleteSupplementaryResources(IResource[] resources) { for (int i = 0; i < resources.length; i++) { try { resources[i].delete(true, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError(Messages.TmfCommonProjectElement_ErrorDeletingSR + resources[i], e); } } }
Source:
<code><START> public Study getMockStudy() { <END> Study study = new Study(); study.setOrderId(getMockOrder().getOrderId()); study.setModality(Modality.CT); study.setPriority(RequestedProcedurePriority.LOW); study.setMwlStatus(MwlStatus.DEFAULT); study.setScheduledStatus(ScheduledProcedureStepStatus.SCHEDULED); return study; }</code><technical_language>Same, above... dataset.xml instead</technical_language>

Target:
public Study getMockStudy() { Study study = new Study(); study.setOrderId(orderService.getOrder(ORDER_ID_WITHOUT_STUDY).getOrderId()); study.setModality(Modality.CT); study.setPriority(RequestedProcedurePriority.LOW); study.setMwlStatus(MwlStatus.DEFAULT); study.setScheduledStatus(ScheduledProcedureStepStatus.SCHEDULED); return study; }
Source:
<code>public void setJobOverrideProperty(Project project, Props prop, String jobName, User modifier) throws ProjectManagerException { prop.setSource(jobName + ".jor"); Props oldProps = projectLoader.fetchProjectProperty(project, prop.getSource()); if (oldProps == null) { oldProps = new Props(); <START> projectLoader.uploadProjectProperty(project, prop); <END> } else { projectLoader.updateProjectProperty(project, prop); } String diffMessage = PropsUtils.getPropertyDiff(oldProps, prop); projectLoader.postEvent(project, EventType.PROPERTY_OVERRIDE, modifier.getUserId(), diffMessage); return; }</code><technical_language>@wangqiaoshi if else logic redundant. Is move projectLoader.uploadProjectProperty(project, prop) of if else logics</technical_language>

Target:
public void setJobOverrideProperty(Project project, Props prop, String jobName, User modifier) throws ProjectManagerException { prop.setSource(jobName + ".jor"); Props oldProps = projectLoader.fetchProjectProperty(project, prop.getSource()); projectLoader.updateProjectProperty(project, prop); String diffMessage = PropsUtils.getPropertyDiff(oldProps, prop); projectLoader.postEvent(project, EventType.PROPERTY_OVERRIDE, modifier.getUserId(), diffMessage); return; }
Source:
<code>static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) { ResourceTransformationDescriptionBuilder builder = ModClusterModel.VERSION_6_0_0.requiresTransformation(version) ? parent.addChildRedirection(PATH, LEGACY_PATH) : parent.addChildResource(PATH); if (ModClusterModel.VERSION_6_0_0.requiresTransformation(version)) { builder.getAttributeBuilder() .setValueConverter(new AttributeConverter.DefaultAttributeConverter() { @Override protected void convertAttribute(PathAddress address, String attributeName, ModelNode attributeValue, TransformationContext context) { if (attributeValue.isDefined() && attributeValue.getType() != EXPRESSION) { attributeValue.set((int) Math.ceil(attributeValue.asDouble())); } } }, Attribute.DECAY.getDefinition()) .end(); } if (ModClusterModel.VERSION_7_0_0.requiresTransformation(version)) { builder.getAttributeBuilder() <START> .setDiscard(DiscardAttributeChecker.UNDEFINED, Attribute.INITIAL_LOAD.getDefinition()) <END> .addRejectCheck(RejectAttributeChecker.DEFINED, Attribute.INITIAL_LOAD.getDefinition()) .end(); } LoadMetricResourceDefinition.buildTransformation(version, builder); CustomLoadMetricResourceDefinition.buildTransformation(version, builder); }</code><technical_language>mistaken, this strictly correct. equivalent behavior achieved legacy slaves if discarded initial-load is 100, rejected otherwise</technical_language>

Target:
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) { ResourceTransformationDescriptionBuilder builder = ModClusterModel.VERSION_6_0_0.requiresTransformation(version) ? parent.addChildRedirection(PATH, LEGACY_PATH) : parent.addChildResource(PATH); if (ModClusterModel.VERSION_6_0_0.requiresTransformation(version)) { builder.getAttributeBuilder() .setValueConverter(new AttributeConverter.DefaultAttributeConverter() { @Override protected void convertAttribute(PathAddress address, String attributeName, ModelNode attributeValue, TransformationContext context) { if (attributeValue.isDefined() && attributeValue.getType() != EXPRESSION) { attributeValue.set((int) Math.ceil(attributeValue.asDouble())); } } }, Attribute.DECAY.getDefinition()) .end(); } if (ModClusterModel.VERSION_7_0_0.requiresTransformation(version)) { ModelNode legacyInitialLoad = new ModelNode(-1); builder.getAttributeBuilder() .setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(legacyInitialLoad), Attribute.INITIAL_LOAD.getDefinition()) .addRejectCheck(new RejectAttributeChecker.SimpleAcceptAttributeChecker(legacyInitialLoad), Attribute.INITIAL_LOAD.getDefinition()) .end(); } LoadMetricResourceDefinition.buildTransformation(version, builder); CustomLoadMetricResourceDefinition.buildTransformation(version, builder); }
Source:
<code>public void setWorkingSet(IWorkingSet workingSet) { TreeViewer treeViewer = getTreeViewer(); Object[] expanded = treeViewer.getExpandedElements(); <START> ISelection selection <END> = treeViewer.getStructuredSelection(); boolean refreshNeeded = internalSetWorkingSet(workingSet); workingSetFilter.setWorkingSet(emptyWorkingSet ? null : workingSet); if (workingSet != null) { settings.put(STORE_WORKING_SET, workingSet.getName()); } else { settings.put(STORE_WORKING_SET, ""); } updateTitle(); if(refreshNeeded) { treeViewer.refresh(); } treeViewer.setExpandedElements(expanded); if (selection.isEmpty() == false && selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; treeViewer.reveal(structuredSelection.getFirstElement()); } }</code><technical_language>change IStructuredSelection</technical_language>

Target:
public void setWorkingSet(IWorkingSet workingSet) { TreeViewer treeViewer = getTreeViewer(); Object[] expanded = treeViewer.getExpandedElements(); IStructuredSelection structuredSelection = treeViewer.getStructuredSelection(); boolean refreshNeeded = internalSetWorkingSet(workingSet); workingSetFilter.setWorkingSet(emptyWorkingSet ? null : workingSet); if (workingSet != null) { settings.put(STORE_WORKING_SET, workingSet.getName()); } else { settings.put(STORE_WORKING_SET, ""); } updateTitle(); if(refreshNeeded) { treeViewer.refresh(); } treeViewer.setExpandedElements(expanded); if (structuredSelection.isEmpty() == false) { treeViewer.reveal(structuredSelection.getFirstElement()); } }
Source:
<code>public static int convertIp4Address(String ipAddress) throws KuraException { if (ipAddress == null) { throw new KuraException(KuraErrorCode.INVALID_PARAMETER); <START> } <END> String[] splitIpAddress = ipAddress.split("\\."); if (splitIpAddress.length != 4) { throw new KuraException(KuraErrorCode.INVALID_PARAMETER); } short[] addressBytes = new short[4]; for (int i = 0; i < 4; i++) { String octet = splitIpAddress[i]; addressBytes[i] = Short.parseShort(octet); } return NetworkUtil.packIp4AddressBytes(addressBytes); }</code><technical_language>Null Parameters is a runtime problem I KuraRuntimeException. Preconditions static factory methods container class for conditions</technical_language>

Target:
public static int convertIp4Address(String ipAddress) { if (ipAddress == null) { throw new IllegalArgumentException("ipAddress is null"); } String[] splitIpAddress = ipAddress.split("\\."); if (splitIpAddress.length != 4) { throw new IllegalArgumentException("ipAddress is invalid: " + ipAddress); } short[] addressBytes = new short[4]; for (int i = 0; i < 4; i++) { String octet = splitIpAddress[i]; addressBytes[i] = Short.parseShort(octet); } return NetworkUtil.packIp4AddressBytes(addressBytes); }
Source:
<code>protected Void run() throws Exception { FilePath workspace = getContext().get(FilePath.class); workspace.mkdirs(); Run<?,?> run = getContext().get(Run.class); TaskListener listener = getContext().get(TaskListener.class); Launcher launcher = getContext().get(Launcher.class); FlowNode node = getContext().get(FlowNode.class); String nodeId = node.getId(); TestResultAction testResultAction = JUnitResultArchiver.parseAndAttach(step, nodeId, run, workspace, launcher, listener); if (testResultAction != null) { if (testResultAction.getResult().getFailCount() > 0) { getContext().setResult(Result.UNSTABLE); } TagsAction tagsAction = node.getAction(TagsAction.class); if (tagsAction != null) { tagsAction.addTag(JUnitResultsStep.HAS_TEST_RESULTS_TAG_NAME, "true"); node.save(); } else { tagsAction = new TagsAction(); tagsAction.addTag(JUnitResultsStep.HAS_TEST_RESULTS_TAG_NAME, "true"); node.addAction(tagsAction); } } <START> return null; <END> }</code><technical_language>This omits critical functionality in #9: allowing scripts interpret results themselves</technical_language>

Target:
protected TestResultSummary run() throws Exception { FilePath workspace = getContext().get(FilePath.class); workspace.mkdirs(); Run<?,?> run = getContext().get(Run.class); TaskListener listener = getContext().get(TaskListener.class); Launcher launcher = getContext().get(Launcher.class); FlowNode node = getContext().get(FlowNode.class); String nodeId = node.getId(); TestResultAction testResultAction = JUnitResultArchiver.parseAndAttach(step, nodeId, getEnclosingStagesAndParallels(node), run, workspace, launcher, listener); if (testResultAction != null) { if (testResultAction.getResult().getFailCount() > 0) { getContext().setResult(Result.UNSTABLE); } return new TestResultSummary(testResultAction.getResult().getResultByRunAndNode(run.getExternalizableId(), nodeId)); } return new TestResultSummary(); }
Source:
<code>public void shouldThrowExceptionWhenKVStoreWithPartitionDoesntExists() { <START> storeProvider.getStore(StoreQueryParameters.fromNameAndType(keyValueStore, QueryableStoreTypes.keyValueStore()).withPartition(numStateStorePartitions + 1)); <END> }</code><technical_language>split this follows: final StoreQueryParameters parameters = (StoreQueryParameters.fromNameAndType(keyValueStore, QueryableStoreTypes.keyValueStore()).withPartition(numStateStorePartitions + 1); final InvalidStateStoreException exception = asserThrows( InvalidStateStoreException.class, () -> storeProvider.getStore(parameters) ); assertThat(exception.message(), equalTo("...")); remove (excpected = ...) annotation. (1) limit code throw exception (eg, if withPartition throw InvalidStateStoreException test fail, pass in current setup) (2) verify exception -- getStore() throw InvalidStateStoreException multiple reasons throwing for reason test. for windowed case</technical_language>

Target:
public void shouldThrowExceptionWhenKVStoreWithPartitionDoesntExists() { final int partition = numStateStorePartitions + 1; final InvalidStateStoreException thrown = assertThrows(InvalidStateStoreException.class, () -> storeProvider.getStore( StoreQueryParameters .fromNameAndType(keyValueStore, QueryableStoreTypes.keyValueStore()) .withPartition(partition)) ); assertThat(thrown.getMessage(), equalTo(String.format("The specified partition %d for store %s does not exist.", partition, keyValueStore))); }
Source:
<code>public Response getFieldTypes(@Context final HttpServletRequest req) { final InitDataObject initData = this.webResource.init(null, true, req, true, null); final User user = initData.getUser(); final ImmutableList<Map<String, Object>> fieldTypesMap = fieldTypeAPI.getFieldTypes(user).stream() <START> .map(fieldType -> fieldType.toMap()) <END> .collect(toImmutableList()); return Response.ok( new ResponseEntityView( fieldTypesMap ) ).build(); }</code><technical_language>filedType::toMap</technical_language>

Target:
public Response getFieldTypes(@Context final HttpServletRequest req) { final InitDataObject initData = this.webResource.init(null, true, req, true, null); final User user = initData.getUser(); final ImmutableList<Map<String, Object>> fieldTypesMap = fieldTypeAPI.getFieldTypes(user).stream() .map(FieldType::toMap) .collect(toImmutableList()); return Response.ok( new ResponseEntityView( fieldTypesMap ) ).build(); }
Source:
<code>public void getReplicasTest() throws Exception { List<? extends PartitionId> partitionIds = CLUSTER_MAP.getWritablePartitionIds(); for (PartitionId partitionId : partitionIds) { String originalReplicaStr = partitionId.getReplicaIds().toString().replace(", ", ","); <START> BlobId blobId = new BlobId(BlobId.DEFAULT_FLAG, ClusterMapUtils.LEGACY_DATACENTER_ID, Account.LEGACY_ACCOUNT_ID, <END> Container.LEGACY_CONTAINER_ID, partitionId); RestRequest restRequest = AdminTestUtils.createRestRequest(RestMethod.GET, blobId.getID() + "/" + RestUtils.SubResource.Replicas, null, null); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); doOperation(restRequest, restResponseChannel); JSONObject response = new JSONObject(new String(restResponseChannel.getResponseBody())); String returnedReplicasStr = response.getString(GetReplicasHandler.REPLICAS_KEY).replace("\"", ""); assertEquals("Replica IDs returned for the BlobId do no match with the replicas IDs of partition", originalReplicaStr, returnedReplicasStr); } }</code><technical_language>LEGACY_ACCOUNT_ID LEGACY_CONTAINER_ID defined in BlobProperties. Lets declaration in place others same</technical_language>

Target:
public void getReplicasTest() throws Exception { List<? extends PartitionId> partitionIds = CLUSTER_MAP.getWritablePartitionIds(); for (PartitionId partitionId : partitionIds) { String originalReplicaStr = partitionId.getReplicaIds().toString().replace(", ", ","); BlobId blobId = new BlobId(BlobId.DEFAULT_FLAG, ClusterMapUtils.UNKNOWN_DATACENTER_ID, Account.UNKNOWN_ACCOUNT_ID, Container.UNKNOWN_CONTAINER_ID, partitionId); RestRequest restRequest = AdminTestUtils.createRestRequest(RestMethod.GET, blobId.getID() + "/" + RestUtils.SubResource.Replicas, null, null); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); doOperation(restRequest, restResponseChannel); JSONObject response = new JSONObject(new String(restResponseChannel.getResponseBody())); String returnedReplicasStr = response.getString(GetReplicasHandler.REPLICAS_KEY).replace("\"", ""); assertEquals("Replica IDs returned for the BlobId do no match with the replicas IDs of partition", originalReplicaStr, returnedReplicasStr); } }
Source:
<code>private void configVpnNetwork() { final Network network = new Network(mNetwork); final Network[] networks = new Network[] <START> {network}; <END> doReturn(networks).when(sMockConnectivityManager).getAllNetworks(); final NetworkCapabilities vpnCapabilities = new NetworkCapabilities(); vpnCapabilities.addTransportType(NetworkCapabilities.TRANSPORT_VPN); doReturn(vpnCapabilities).when(sMockConnectivityManager).getNetworkCapabilities(network); }</code><technical_language>Suggest a network - TRANSPORT_WIFI - top of VPN have</technical_language>

Target:
private void configVpnNetwork() { final Network network1 = new Network(TEST_NETID + 1); final Network network2 = new Network(TEST_NETID + 2); final Network[] networks = new Network[] {network1, network2}; doReturn(networks).when(sMockConnectivityManager).getAllNetworks(); final NetworkCapabilities underlyingCapabilities = new NetworkCapabilities() .addTransportType(NetworkCapabilities.TRANSPORT_WIFI); final NetworkCapabilities vpnCapabilities = new NetworkCapabilities(underlyingCapabilities) .addTransportType(NetworkCapabilities.TRANSPORT_VPN); doReturn(underlyingCapabilities).when(sMockConnectivityManager).getNetworkCapabilities( network1); doReturn(vpnCapabilities).when(sMockConnectivityManager).getNetworkCapabilities(network2); }
Source:
<code>private Container newContainer( RuntimeIdentity runtimeId, List<EnvVar> envVars, String image, @Nullable String brokerVolumeName) { <START> Matcher matcher = IMAGE_PATTERN.matcher(image); String containerName; if (matcher.matches()) { containerName = String.format("%s/%s", matcher.group("org"), matcher.group("image")); } else { containerName = image; <END> } containerName = containerName.toLowerCase().replaceAll("[^\\d\\w-]", "-"); final ContainerBuilder cb = new ContainerBuilder() .withName(containerName) .withImage(image) .withArgs( "-push-endpoint", cheWebsocketEndpoint, "-runtime-id", String.format( "%s:%s:%s", runtimeId.getWorkspaceId(), MoreObjects.firstNonNull(runtimeId.getEnvName(), ""), runtimeId.getOwnerId()), "-cacert", certProvisioner.isConfigured() ? certProvisioner.getCertPath() : "", "--registry-address", Strings.nullToEmpty(pluginRegistryUrl)) .withImagePullPolicy(brokerPullPolicy) .withEnv(envVars); if (brokerVolumeName != null) { cb.withVolumeMounts(new VolumeMount(CONF_FOLDER + "/", null, brokerVolumeName, true, null)); cb.addToArgs("-metas", CONF_FOLDER + "/" + CONFIG_FILE); } Container container = cb.build(); Containers.addRamLimit(container, "250Mi"); Containers.addRamRequest(container, "250Mi"); return container; }</code><technical_language>extract this method cover unit test + doc (the logic is transparent IMO)</technical_language>

Target:
private Container newContainer( RuntimeIdentity runtimeId, List<EnvVar> envVars, String image, @Nullable String brokerVolumeName) { String containerName = generateContainerNameFromImageRef(image); final ContainerBuilder cb = new ContainerBuilder() .withName(containerName) .withImage(image) .withArgs( "-push-endpoint", cheWebsocketEndpoint, "-runtime-id", String.format( "%s:%s:%s", runtimeId.getWorkspaceId(), MoreObjects.firstNonNull(runtimeId.getEnvName(), ""), runtimeId.getOwnerId()), "-cacert", certProvisioner.isConfigured() ? certProvisioner.getCertPath() : "", "--registry-address", Strings.nullToEmpty(pluginRegistryUrl)) .withImagePullPolicy(brokerPullPolicy) .withEnv(envVars); if (brokerVolumeName != null) { cb.withVolumeMounts(new VolumeMount(CONF_FOLDER + "/", null, brokerVolumeName, true, null)); cb.addToArgs("-metas", CONF_FOLDER + "/" + CONFIG_FILE); } Container container = cb.build(); Containers.addRamLimit(container, "250Mi"); Containers.addRamRequest(container, "250Mi"); return container; }
Source:
<code>public StateModel createNewStateModel(String resourceName, String partitionName) { StateModel stateModelToReturn; switch (ambryStateModelDef) { case AmbryStateModelDefinition.AMBRY_LEADER_STANDBY_MODEL: stateModelToReturn = new AmbryPartitionStateModel(); break; <START> default: <END> stateModelToReturn = new AmbryDefaultStateModel(); } return stateModelToReturn; }</code><technical_language>explicitly check DEFAULT_STATE_MODEL_DEF here. For other cases, throw exception earlier better</technical_language>

Target:
public StateModel createNewStateModel(String resourceName, String partitionName) { StateModel stateModelToReturn; switch (ambryStateModelDef) { case AmbryStateModelDefinition.AMBRY_LEADER_STANDBY_MODEL: stateModelToReturn = new AmbryPartitionStateModel(resourceName, partitionName); break; case LeaderStandbySMD.name: stateModelToReturn = new DefaultLeaderStandbyStateModel(); break; default: throw new IllegalArgumentException("Unsupported state model definition: " + ambryStateModelDef); } return stateModelToReturn; }
Source:
<code>private RestRule getRuleInternal(String ruleId, User user) { Rule input = getRule(ruleId, user); RestRule restRule = ruleTransform.appToRest(input, user); <START> if(restRule == null) { <END> throw new NotFoundException("Rule not found: '%s'", ruleId); } return restRule; }</code><technical_language>transform return null. if changed need unchange it. #getRule(...) throw a NotFoundException if ruleId present in database. transform.appToRest throw errors prevent method returning a valid rule</technical_language>

Target:
private RestRule getRuleInternal(String ruleId, User user) { Rule input = getRule(ruleId, user); RestRule restRule = ruleTransform.appToRest(input, user); return restRule; }
Source:
<code>public void testClientIsInstrumentedWithTracer() throws InterruptedException { server.enqueue(new MockResponse().setBody("\"server\"")); OpenSpan parentTrace = Tracer.startSpan(""); AtomicInteger called = new AtomicInteger(); Tracer.subscribe(TracerTest.class.getName(), span -> { if (span.type().equals(SpanType.CLIENT_OUTGOING)) { assertThat(span.getOperation(), is("GET /{param}")); } else { assertThat(span.getOperation(), is("acquireLimiter")); } <START> called.getAndIncrement(); <END> }); String traceId = Tracer.getTraceId(); service.param("somevalue"); Tracer.unsubscribe(TracerTest.class.getName()); assertThat(called.intValue(), is(2)); RecordedRequest request = server.takeRequest(); assertThat(request.getHeader(TraceHttpHeaders.TRACE_ID), is(traceId)); assertThat(request.getHeader(TraceHttpHeaders.SPAN_ID), is(not(parentTrace.getSpanId()))); }</code><technical_language>nit: prefer push spans a collection verify after. written this pass if acquireLimiter span is created (also true of previous implementation)</technical_language>

Target:
public void testClientIsInstrumentedWithTracer() throws InterruptedException { server.enqueue(new MockResponse().setBody("\"server\"")); OpenSpan parentTrace = Tracer.startSpan(""); List<Map.Entry<SpanType, String>> observedSpans = Lists.newArrayList(); Tracer.subscribe(TracerTest.class.getName(), span -> observedSpans.add(Maps.immutableEntry(span.type(), span.getOperation()))); String traceId = Tracer.getTraceId(); service.param("somevalue"); Tracer.unsubscribe(TracerTest.class.getName()); assertThat(observedSpans, contains( Maps.immutableEntry(SpanType.LOCAL, "acquireLimiter"), Maps.immutableEntry(SpanType.CLIENT_OUTGOING, "GET /{param}"))); RecordedRequest request = server.takeRequest(); assertThat(request.getHeader(TraceHttpHeaders.TRACE_ID), is(traceId)); assertThat(request.getHeader(TraceHttpHeaders.SPAN_ID), is(not(parentTrace.getSpanId()))); }
Source:
<code>protected void handleNoOffsetForPartitionException(NoOffsetForPartitionException e, AbstractKafkaConsumer consumer) { AbstractBaseKafkaInputOperator.InitialOffset io = AbstractBaseKafkaInputOperator.InitialOffset.valueOf(ownerOperator.getInitialOffset()); <START> if (io == AbstractBaseKafkaInputOperator.InitialOffset.APPLICATION_OR_EARLIEST <END> || io == AbstractBaseKafkaInputOperator.InitialOffset.EARLIEST) { consumer.seekToBeginning(e.partitions().toArray(new TopicPartition[0])); } else { consumer.seekToEnd(e.partitions().toArray(new TopicPartition[0])); } }</code><technical_language>Retain original class name. I need change it</technical_language>

Target:
protected void handleNoOffsetForPartitionException(NoOffsetForPartitionException e, AbstractKafkaConsumer consumer) { AbstractKafkaInputOperator.InitialOffset io = AbstractKafkaInputOperator.InitialOffset.valueOf(ownerOperator.getInitialOffset()); if (io == AbstractKafkaInputOperator.InitialOffset.APPLICATION_OR_EARLIEST || io == AbstractKafkaInputOperator.InitialOffset.EARLIEST) { consumer.seekToBeginning(e.partitions().toArray(new TopicPartition[0])); } else { consumer.seekToEnd(e.partitions().toArray(new TopicPartition[0])); } }
Source:
<code>void submitSharingAccount() { <START> if (Network.isOnline(getContext())) { <END> SharingPayload sharingPayload = new SharingPayload(); sharingPayload.setExternalId(etClientExternalId.getEditableText().toString()); sharingPayload.setLocale("en"); sharingPayload.setSubmittedDate(submissionDate); sharingPayload.setDateFormat("dd MMMM yyyy"); sharingPayload.setClientId(clientId); sharingPayload.setProductId(productId); sharingPayload.setRequestedShares(Integer.parseInt(etRequestedShares. getEditableText().toString())); sharingPayload.setMinimumActivePeriod(etMinActivePeriod.getEditableText() .toString()); sharingPayload.setMinimumActivePeriodFrequencyType(minActivePeriodId); sharingPayload.setLockinPeriodFrequency(etLockinPeriod. getEditableText().toString()); sharingPayload.setLockinPeriodFrequencyType(lockinPeriodId); sharingPayload.setApplicationDate(applicationDate); sharingPayload.setAllowDividendCalculationForInactiveClients(isAllowDividend); sharingPayload.setSavingsAccountId(savingId); List<ChargeOptions> chargeOptionsList = shareChargesAdapter.getChargeOptionList(); List<ShareChargePayload> shareChargePayloadList = new ArrayList<ShareChargePayload>(); for (ChargeOptions chargeOptions : chargeOptionsList) { shareChargePayloadList.add(new ShareChargePayload(chargeOptions.getId(), chargeOptions.getAmount())); } sharingPayload.setChargePayload(shareChargePayloadList); mSharingAccountPresenter.createSharingAccount(sharingPayload); } else { Toaster.show(rootView, R.string.error_network_not_available); } }</code><technical_language>I getContext() getActivity(). do @droidchef</technical_language>

Target:
void submitSharingAccount() { if (Network.isOnline(getActivity())) { SharingPayload sharingPayload = new SharingPayload(); sharingPayload.setExternalId(etClientExternalId.getEditableText().toString()); sharingPayload.setLocale("en"); sharingPayload.setSubmittedDate(submissionDate); sharingPayload.setDateFormat("dd MMMM yyyy"); sharingPayload.setClientId(clientId); sharingPayload.setProductId(productId); sharingPayload.setRequestedShares(Integer.parseInt(etRequestedShares. getEditableText().toString())); sharingPayload.setMinimumActivePeriod(etMinActivePeriod.getEditableText() .toString()); sharingPayload.setMinimumActivePeriodFrequencyType(minActivePeriodId); sharingPayload.setLockinPeriodFrequency(etLockinPeriod. getEditableText().toString()); sharingPayload.setLockinPeriodFrequencyType(lockinPeriodId); sharingPayload.setApplicationDate(applicationDate); sharingPayload.setAllowDividendCalculationForInactiveClients(isAllowDividend); sharingPayload.setSavingsAccountId(savingId); List<ShareChargePayload> shareChargePayloadList = new ArrayList<ShareChargePayload>(); for (ChargeOptions chargeOptions : chargeOptionAdapterList) { shareChargePayloadList.add(new ShareChargePayload(chargeOptions.getId(), chargeOptions.getAmount())); } sharingPayload.setChargePayload(shareChargePayloadList); mSharingAccountPresenter.createSharingAccount(sharingPayload); } else { Toaster.show(rootView, R.string.error_network_not_available); } }
Source:
<code>protected <T extends Projectile> T launchProjectile(Class<? extends T> type, Location location, Vector originalVector, float pitchOffset, float velocity) { <START> double negDegreesPerRadian = Math.toRadians(-1); <END> double x = cos(negDegreesPerRadian * location.getPitch()) * sin(negDegreesPerRadian * location.getYaw()); double y = sin(negDegreesPerRadian * (location.getPitch() - pitchOffset)); double z = cos(location.getPitch() * negDegreesPerRadian) * cos(location.getYaw() * negDegreesPerRadian); T projectile = launchProjectile(type, location, x, y, z, velocity); projectile.getVelocity().add(originalVector); return projectile; }</code><technical_language>I calculations simplified this: java double pitchRadians = Math.toRadians(location.getPitch()); double yawRadians = Math.toRadians(location.getYaw()); double verticalMultiplier = cos(pitchRadians); double x = verticalMultiplier * sin(-yawRadians); double z = verticalMultiplier * cos(yawRadians); double y = sin(-(Math.toRadians(location.getPitch() - pitchOffset));</technical_language>

Target:
protected <T extends Projectile> T launchProjectile(Class<? extends T> type, Location location, Vector originalVector, float pitchOffset, float velocity) { double pitchRadians = Math.toRadians(location.getPitch()); double yawRadians = Math.toRadians(location.getYaw()); double verticalMultiplier = cos(pitchRadians); double x = verticalMultiplier * sin(-yawRadians); double z = verticalMultiplier * cos(yawRadians); double y = sin(-(Math.toRadians(location.getPitch() - pitchOffset))); T projectile = launchProjectile(type, location, x, y, z, velocity); projectile.getVelocity().add(originalVector); return projectile; }
Source:
<code>public void testDuplicatesInWindowOrderBy() throws Exception { ExpectedValueProvider<WindowNode.Specification> specification = specification( ImmutableList.of(), ImmutableList.of("A"), ImmutableMap.of("A", SortOrder.ASC_NULLS_LAST)); assertUnitPlan("WITH x as (SELECT a, a as b FROM (VALUES 1) t(a))" + "SELECT *, row_number() OVER(ORDER BY a ASC, b DESC)" + "FROM x", anyTree( window(windowMatcherBuilder -> windowMatcherBuilder .specification(specification) .addFunction(functionCall("row_number", Optional.empty(), ImmutableList.of())), <START> values(ImmutableMap.of("A", 0))) <END> )); }</code><technical_language>values("A")</technical_language>

Target:
public void testDuplicatesInWindowOrderBy() throws Exception { ExpectedValueProvider<WindowNode.Specification> specification = specification( ImmutableList.of(), ImmutableList.of("A"), ImmutableMap.of("A", SortOrder.ASC_NULLS_LAST)); assertUnitPlan("WITH x as (SELECT a, a as b FROM (VALUES 1) t(a))" + "SELECT *, row_number() OVER(ORDER BY a ASC, b DESC)" + "FROM x", anyTree( window(windowMatcherBuilder -> windowMatcherBuilder .specification(specification) .addFunction(functionCall("row_number", Optional.empty(), ImmutableList.of())), values("A")))); }
Source:
<code><START> public String toString() { <END> return getName(); }</code><technical_language>In fact, I return profiles. like: CommonHelper.toString(this.getClass(), "profiles", getPRofiles());</technical_language>

Target:
public String toString() { return CommonHelper.toString(this.getClass(), "profiles", getProfiles()); }