auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void createControl(Composite parent) { wizard = (SelectGraphWizard)getWizard(); Composite cmpGraphOpts = new Composite(parent, SWT.NONE); ColumnLayout colLayout = new ColumnLayout(); colLayout.maxNumColumns = 1; cmpGraphOpts.setLayout(colLayout); String[] graphIDs = GraphFactory.getAvailableGraphs(wizard.model.getDataSet()); btnGraphs = new Button[graphIDs.length]; for(int i=0; i<btnGraphs.length; i++) { btnGraphs[i] = new Button(cmpGraphOpts, SWT.TOGGLE); btnGraphs[i].setImage(GraphFactory.getGraphImage(graphIDs[i])); btnGraphs[i].addListener(SWT.Selection, this); btnGraphs[i].setData(graphIDs[i]); btnGraphs[i].setToolTipText(GraphFactory.getGraphName(btnGraphs[i].getData().toString()) + "\n\n" + GraphFactory.getGraphDescription(btnGraphs[i].getData().toString())); <START> if (wizard.edit && graphIDs[i].equals(wizard.model.getGraphID())) { <END> btnGraphs[i].setSelection(true); } } setControl(cmpGraphOpts); }</code><technical_language>is generally preferred member variables private accessed throw accessor. For example isEditing() {return this.edit} If code is ignore for introduce more of it</technical_language>

Target:
public void createControl(Composite parent) { wizard = (SelectGraphWizard)getWizard(); Composite cmpGraphOpts = new Composite(parent, SWT.NONE); ColumnLayout colLayout = new ColumnLayout(); colLayout.maxNumColumns = 1; cmpGraphOpts.setLayout(colLayout); String[] graphIDs = GraphFactory.getAvailableGraphs(wizard.model.getDataSet()); btnGraphs = new Button[graphIDs.length]; for(int i=0; i<btnGraphs.length; i++) { btnGraphs[i] = new Button(cmpGraphOpts, SWT.TOGGLE); btnGraphs[i].setImage(GraphFactory.getGraphImage(graphIDs[i])); btnGraphs[i].addListener(SWT.Selection, this); btnGraphs[i].setData(graphIDs[i]); btnGraphs[i].setToolTipText(GraphFactory.getGraphName(btnGraphs[i].getData().toString()) + "\n\n" + GraphFactory.getGraphDescription(btnGraphs[i].getData().toString())); if (wizard.isEditing() && graphIDs[i].equals(wizard.model.getGraphID())) { btnGraphs[i].setSelection(true); } } setControl(cmpGraphOpts); }
Source:
<code>public void exportQuarterlyReport(@PathVariable("quarterlyReportId") final Long quarterlyReportId, final HttpServletResponse response) throws EntityRetrievalException, IOException { if (!ff4j.check(FeatureList.SURVEILLANCE_REPORTING)) { throw new NotImplementedException(); } Workbook reportXlsx = reportManager.exportQuarterlyReport(quarterlyReportId); QuarterlyReportDTO report = reportManager.getQuarterlyReport(quarterlyReportId); String filename = report.getQuarter().getName() + "-" + report.getAnnualReport().getYear() + "-" + report.getAnnualReport().getAcb().getName() + "-quarterly-report.xlsx"; <START> File downloadFile = fileUtils.createDownloadFile(filename); <END> OutputStream outputStream = null; try { outputStream = new FileOutputStream(downloadFile); reportXlsx.write(outputStream); } catch (final Exception ex) { LOGGER.error("Error writing excel document to file output stream.", ex); } finally { outputStream.flush(); outputStream.close(); } fileUtils.streamFileAsResponse(downloadFile, XLSX_MIME_TYPE, response); }</code><technical_language>this download folder get new files in permanently request for a quarterly surveillance report? a good idea. create Excel file a temporary file stream instead? I remember created a temporary file for some other in CHPL, I idea is</technical_language>

Target:
public void exportQuarterlyReport(@PathVariable("quarterlyReportId") final Long quarterlyReportId, final HttpServletResponse response) throws EntityRetrievalException, IOException { if (!ff4j.check(FeatureList.SURVEILLANCE_REPORTING)) { throw new NotImplementedException(); } Workbook reportXlsx = reportManager.exportQuarterlyReport(quarterlyReportId); QuarterlyReportDTO report = reportManager.getQuarterlyReport(quarterlyReportId); String filename = report.getQuarter().getName() + "-" + report.getAnnualReport().getYear() + "-" + report.getAnnualReport().getAcb().getName() + "-quarterly-report"; File tempFileToStream = File.createTempFile(filename, ".xlsx"); OutputStream outputStream = null; try { outputStream = new FileOutputStream(tempFileToStream); reportXlsx.write(outputStream); } catch (final Exception ex) { LOGGER.error("Error writing excel document to file output stream.", ex); } finally { outputStream.flush(); outputStream.close(); } fileUtils.streamFileAsResponse(tempFileToStream, XLSX_MIME_TYPE, response); }
Source:
<code>public void testLongStatsToColumnStatistics() { LongColumnStatsData longColumnStatsData = new LongColumnStatsData(); longColumnStatsData.setLowValue(0); longColumnStatsData.setHighValue(100); longColumnStatsData.setNumNulls(0); longColumnStatsData.setNumDVs(20); ColumnStatisticsObj columnStatisticsObj = new ColumnStatisticsObj("my_col", BIGINT_TYPE_NAME, longStats(longColumnStatsData)); HiveColumnStatistics actual = fromMetastoreApiColumnStatistics(columnStatisticsObj); assertEquals(actual.getLowValue(), Optional.of(0L)); assertEquals(actual.getHighValue(), Optional.of(100L)); assertEquals(actual.getMaxColumnLength(), OptionalLong.empty()); <START> assertEquals(actual.getAverageColumnLength(), OptionalDouble.empty()); <END> assertEquals(actual.getTrueCount(), OptionalLong.empty()); assertEquals(actual.getFalseCount(), OptionalLong.empty()); assertEquals(actual.getNullsCount(), OptionalLong.of(0)); assertEquals(actual.getDistinctValuesCount(), OptionalLong.of(20)); LongColumnStatsData emptyLongColumnStatsData = new LongColumnStatsData(); columnStatisticsObj = new ColumnStatisticsObj("my_col", BIGINT_TYPE_NAME, longStats(emptyLongColumnStatsData)); actual = fromMetastoreApiColumnStatistics(columnStatisticsObj); assertEmptyColumnStats(actual); }</code><technical_language>please divide tests stats empty stats</technical_language>

Target:
public void testLongStatsToColumnStatistics() { LongColumnStatsData longColumnStatsData = new LongColumnStatsData(); longColumnStatsData.setLowValue(0); longColumnStatsData.setHighValue(100); longColumnStatsData.setNumNulls(0); longColumnStatsData.setNumDVs(20); ColumnStatisticsObj columnStatisticsObj = new ColumnStatisticsObj("my_col", BIGINT_TYPE_NAME, longStats(longColumnStatsData)); HiveColumnStatistics actual = fromMetastoreApiColumnStatistics(columnStatisticsObj); assertEquals(actual.getLowValue(), Optional.of(0L)); assertEquals(actual.getHighValue(), Optional.of(100L)); assertEquals(actual.getMaxColumnLength(), OptionalLong.empty()); assertEquals(actual.getAverageColumnLength(), OptionalDouble.empty()); assertEquals(actual.getTrueCount(), OptionalLong.empty()); assertEquals(actual.getFalseCount(), OptionalLong.empty()); assertEquals(actual.getNullsCount(), OptionalLong.of(0)); assertEquals(actual.getDistinctValuesCount(), OptionalLong.of(20)); }
Source:
<code>public void testAllocationDeallocationMemory() { fModule.schedule(); fModule.waitForCompletion(); ITmfStateSystem ss = fModule.getStateSystem(); assertNotNull(ss); assertEquals(1L, ss.getStartTime()); assertEquals(30L, ss.getCurrentEndTime()); long totalMemory = 0; threadEvent.put(1L, PAGE_SIZE); threadEvent.put(2L, -PAGE_SIZE); threadEvent.put(3L, -PAGE_SIZE); threadEvent.put(17L, PAGE_SIZE); threadEvent.put(22L, -PAGE_SIZE); threadEvent.put(28L, -PAGE_SIZE); threadEvent.put(29L, PAGE_SIZE); threadEvent.put(30L, PAGE_SIZE); for (Map.Entry<Long, Long> entry : threadEvent.entrySet()) { try { ITmfContext context = fTrace.seekEvent(entry.getKey()); ITmfEvent event = fTrace.getNext(context); if (event == null) { <START> assertNull(event); <END> }else{ Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { assertNull(tidField); tid = "other"; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsolute(tid); ITmfStateInterval kernelState = ss.querySingleState(entry.getKey(), tidQuark); long value = kernelState.getStateValue().unboxLong(); totalMemory += entry.getValue(); assertEquals(totalMemory, value); } } catch (StateSystemDisposedException | AttributeNotFoundException e) { fail(e.getMessage()); } } }</code><technical_language>do need tid aspect, do need event, simple</technical_language>

Target:
public void testAllocationDeallocationMemory() { fModule.schedule(); fModule.waitForCompletion(); ITmfStateSystem ss = fModule.getStateSystem(); assertNotNull(ss); assertEquals(1L, ss.getStartTime()); assertEquals(30L, ss.getCurrentEndTime()); long totalMemory = 0; threadEvent.put(1L, PAGE_SIZE); threadEvent.put(2L, -PAGE_SIZE); threadEvent.put(3L, -PAGE_SIZE); threadEvent.put(17L, PAGE_SIZE); threadEvent.put(22L, -PAGE_SIZE); threadEvent.put(28L, -PAGE_SIZE); threadEvent.put(29L, PAGE_SIZE); threadEvent.put(30L, PAGE_SIZE); for (Map.Entry<Long, Long> entry : threadEvent.entrySet()) { try { int tidQuark = ss.getQuarkAbsolute(KernelMemoryStateProvider.OTHER_TID); ITmfStateInterval kernelState = ss.querySingleState(entry.getKey(), tidQuark); long value = kernelState.getStateValue().unboxLong(); totalMemory += entry.getValue(); assertEquals(totalMemory, value); } catch (StateSystemDisposedException | AttributeNotFoundException e) { fail(e.getMessage()); } } }
Source:
<code>private boolean anyAnnotationsModifyType(List<DispoAnnotationData> annotations) { for (DispoAnnotationData annotation : annotations) { if (annotation.getResolutionMethodType() != null) { if <START> (annotation.getResolutionMethodType().startsWith("Modify_")) <END> { return true; } } } return false; }</code><technical_language>Nit: constant in DispoStrings</technical_language>

Target:
private boolean anyAnnotationsModifyType(List<DispoAnnotationData> annotations) { for (DispoAnnotationData annotation : annotations) { if (annotation.getResolutionMethodType() != null) { if (annotation.getResolutionMethodType().startsWith(DispoStrings.MODIFY)) { return true; } } } return false; }
Source:
<code>private static Optional<CoordinationUtils> getCoordinationUtils(Config config) { <START> if (new JobConfig(config).getConfigLoaderFactory().isPresent()) { config = ConfigUtil.loadConfig(config); } <END> if (!isAppModeBatch(config)) { return Optional.empty(); } JobCoordinatorConfig jcConfig = new JobCoordinatorConfig(config); CoordinationUtils coordinationUtils = jcConfig.getCoordinationUtilsFactory() .getCoordinationUtils(CoordinationConstants.APPLICATION_RUNNER_PATH_SUFFIX, PROCESSOR_ID, config); return Optional.ofNullable(coordinationUtils); }</code><technical_language>multiple calls loadConfig</technical_language>

Target:
private static Optional<CoordinationUtils> getCoordinationUtils(Config config) { if (!isAppModeBatch(config)) { return Optional.empty(); } JobCoordinatorConfig jcConfig = new JobCoordinatorConfig(config); CoordinationUtils coordinationUtils = jcConfig.getCoordinationUtilsFactory() .getCoordinationUtils(CoordinationConstants.APPLICATION_RUNNER_PATH_SUFFIX, PROCESSOR_ID, config); return Optional.ofNullable(coordinationUtils); }
Source:
<code>public void runBeforeEachTest() { executeDataSet(CREATE_PATIENT_PROGRAMS_XML); executeDataSet(PROGRAM_ATTRIBUTES_XML); if (pws == null) { pws = Context.getProgramWorkflowService(); adminService = Context.getAdministrationService(); encounterService = Context.getEncounterService(); cs = Context.getConceptService(); } if (dao == null) { <START> dao = (ProgramWorkflowDAO) applicationContext.getBean("programWorkflowDAO"); <END> } }</code><technical_language>mark dao field @Autowired</technical_language>

Target:
public void runBeforeEachTest() { executeDataSet(CREATE_PATIENT_PROGRAMS_XML); executeDataSet(PROGRAM_ATTRIBUTES_XML); executeDataSet(OTHER_PROGRAM_WORKFLOWS); if (pws == null) { pws = Context.getProgramWorkflowService(); adminService = Context.getAdministrationService(); encounterService = Context.getEncounterService(); cs = Context.getConceptService(); } }
Source:
<code>private void reloadProductList() { if (pd != null) { <START> pd.cancel(); <END> } pd = new ProgressDialog(this.getActivity()); pd.setMessage("Fetching products"); pd.show(); updateProductList(); }</code><technical_language>wondering if calling cancel() ProgressDialog null ? If not, want create a new instance of ProgressDialog null. A check for null creating instance for ProgressDialog sense in case</technical_language>

Target:
private void reloadProductList() { if (pd == null) { pd = new ProgressDialog(this.getActivity()); } pd.setMessage("Fetching products"); pd.show(); updateProductList(); }
Source:
<code><START> public int hashCode() { <END> int result = super.hashCode(); result = 31 * result + keySize; result = 31 * result + (hasKey ? 0 : 1); return result; }</code><technical_language>unit test this function</technical_language>

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + keySize; result = 31 * result + valueSize; return result; }
Source:
<code>private static boolean typeMatchesValue(DataType type, Object value) { if (value == null) { return true; } <START> if (type instanceof ArrayType) { <END> DataType innerType = ((ArrayType) type).innerType(); while (innerType instanceof ArrayType && value.getClass().isArray()) { type = innerType; innerType = ((ArrayType) innerType).innerType(); value = ((Object[]) value)[0]; } return Arrays.equals((Object[]) value, ((ArrayType) type).value(value)); } if (type.id() == ObjectType.ID) { Map<String, Object> mapValue = (Map<String, Object>) value; ObjectType objectType = ((ObjectType) type); for (String key : mapValue.keySet()) { DataType innerType = objectType.innerType(key); if (typeMatchesValue(innerType, mapValue.get(key)) == false) { return false; } } Map<String, Object> safeValue = objectType.value(value); return safeValue.size() == mapValue.size(); } return Objects.equals(type.value(value), value); }</code><technical_language>type.equals(DataTypes.STRING) && instanceof String shortcut sense</technical_language>

Target:
private static boolean typeMatchesValue(DataType type, Object value) { if (value == null) { return true; } if (type.id() == ObjectType.ID) { Map<String, Object> mapValue = (Map<String, Object>) value; ObjectType objectType = ((ObjectType) type); for (String key : mapValue.keySet()) { DataType innerType = objectType.innerType(key); if (typeMatchesValue(innerType, mapValue.get(key)) == false) { return false; } } Map<String, Object> safeValue = objectType.value(value); return safeValue.size() == mapValue.size(); } return Objects.equals(type.value(value), value); }
Source:
<code>public Color getBackground() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if <START> (alphaInfo_100.transparentPixel <END> == -1) return null; int red = (alphaInfo_100.transparentPixel >> 16) & 0xFF; int green = (alphaInfo_100.transparentPixel >> 8) & 0xFF; int blue = (alphaInfo_100.transparentPixel >> 0) & 0xFF; return Color.cocoa_new(device, new double []{red / 255f, green / 255f, blue / 255f, 1}); }</code><technical_language>Refer alpha field based currentDeviceZoom, this flow called 200% zoom level well</technical_language>

Target:
public Color getBackground() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); NSBitmapImageRep imageRep = getRepresentation(); AlphaInfo alphaInfo = _getAlphaInfoAtCurrentZoom(imageRep); if (alphaInfo.transparentPixel == -1) return null; int red = (alphaInfo.transparentPixel >> 16) & 0xFF; int green = (alphaInfo.transparentPixel >> 8) & 0xFF; int blue = (alphaInfo.transparentPixel >> 0) & 0xFF; return Color.cocoa_new(device, new double []{red / 255f, green / 255f, blue / 255f, 1}); }
Source:
<code>public void save() { Boolean value; if(persistenceType == PropertyPersistenceType.Persistent && (value = randomAccessStore.getBoolean(key)) != null) { <START> permanentStore.setBoolean(key, value.booleanValue()); <END> } }</code><technical_language>else warn logging</technical_language>

Target:
public void save() { if(persistenceType == PropertyPersistenceType.Persistent) { permanentStore.setBoolean(key, get()); } }
Source:
<code>protected boolean canDoAction() { boolean retValue=true; <START> job = DbFacade.getInstance().getJobDao().get(getParameters().getId()); <END> if (job != null) { if (!job.isExternal()) { retValue = false; } } else { parentStep = DbFacade.getInstance().getStepDao().get(getParameters().getId()); } if (job == null && parentStep == null) { retValue=false; } return retValue; }</code><technical_language>For potential mocking purposes, I suggest method snamed getJobDao() getStepDao() extract DbFacade.getInstance().getXXXDao</technical_language>

Target:
protected boolean canDoAction() { boolean retValue=true; job = getJobDao().get(getParameters().getId()); if (job != null) { if (!job.isExternal()) { retValue = false; } } else { parentStep = getStepDao().get(getParameters().getId()); } if (job == null && parentStep == null) { retValue=false; } return retValue; }
Source:
<code>public Response delete(@PathParam("tenant") String tenant, @PathParam("subject") String subject) { <START> LOGGER.debug("Removing all the policies for [" + tenant + "] and subject[" + subject + "]"); <END> dao.deleteFromSubject(tenant, subject); return Response.status(204).build(); }</code><technical_language><LINK_0></technical_language>

Target:
public Response delete(@PathParam("tenant") String tenant, @PathParam("subject") String subject) { LOGGER.debug("Removing all the policies for and subject[{}]", tenant, subject); dao.deleteFromSubject(tenant, subject); return Response.status(204).build(); }
Source:
<code>public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); String response = null; try { response = urlopen.open("<LINK_0>"); try { JSONObject object = (JSONObject) new JSONTokener(response).nextValue(); JSONArray data = object.getJSONArray("data"); int length = data.length(); for (int index = 0; index < length; index++) { JSONObject account = data.getJSONObject(index); Document d = Jsoup.parse(account.getString("namnUrl")); Element e = d.getElementsByTag("a").first(); if (e != null && e.attr("href") != null) { mAccountUrlMappings.put(account.getString("kontonummer"), e.attr("href").replace("/info.html", "/info/kontoutdrag.html")); } accounts.add(new Account(String.format("%s (%s)", account.getString("namn"), account.getString("kontonummer")), Helpers.parseBalance(account.getString("disponibeltBelopp")).subtract(Helpers.parseBalance(account.getString("limit"))), account.getString("kontonummer"))); } } catch (JSONException e) { throw new BankException(e.getMessage(), e); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } <START> } finally { <END> super.updateComplete(); } }</code><technical_language>remove finally {</technical_language>

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); String response = urlopen.open("<LINK_0>"); try { JSONObject object = (JSONObject) new JSONTokener(response).nextValue(); JSONArray data = object.getJSONArray("data"); int length = data.length(); for (int index = 0; index < length; index++) { JSONObject account = data.getJSONObject(index); Document d = Jsoup.parse(account.getString("namnUrl")); Element e = d.getElementsByTag("a").first(); if (e != null && e.attr("href") != null) { mAccountUrlMappings.put(account.getString("kontonummer"), e.attr("href").replace("/info.html", "/info/kontoutdrag.html")); } accounts.add(new Account(String.format("%s (%s)", account.getString("namn"), account.getString("kontonummer")), Helpers.parseBalance(account.getString("disponibeltBelopp")).subtract(Helpers.parseBalance(account.getString("limit"))), account.getString("kontonummer"))); } } catch (JSONException e) { throw new BankException(e.getMessage(), e); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }
Source:
<code>public EntityType(Type type, Set<Supertype> superTypes) { <START> this(type, superTypes, new DefaultVariableNameFunction()); <END> }</code><technical_language>a singleton instance of DefaultVariableNameFunction</technical_language>

Target:
public EntityType(Type type, Set<Supertype> superTypes) { this(type, superTypes, DefaultVariableNameFunction.INSTANCE); }
Source:
<code>public void testStringInputRowParserSerdeMultiCharset() throws Exception { Charset[] testCharsets = {Charsets.US_ASCII, Charsets.ISO_8859_1, Charsets.UTF_8, Charsets.UTF_16BE, Charsets.UTF_16LE, Charsets.UTF_16}; for (Charset testCharset : testCharsets) { InputRow parsed = testCharsetParseHelper(testCharset); Assert.assertEquals(ImmutableList.of("bar", "foo"), parsed.getDimensions()); Assert.assertEquals(ImmutableList.of("x"), parsed.getDimension("foo")); Assert.assertEquals(ImmutableList.of("y"), parsed.getDimension("bar")); Assert.assertEquals(new DateTime("3000").getMillis(), parsed.getTimestampFromEpoch()); } String badCharsetName = "BAD CHARSET NAME"; try { final StringInputRowParser badParser = new StringInputRowParser( new JSONParseSpec( new TimestampSpec("timestamp", "iso", null), new DimensionsSpec(ImmutableList.of("foo", "bar"), null, null) ), badCharsetName ); Assert.fail("StringInputRowParser should have failed with IllegalCharsetNameException"); } catch(IllegalCharsetNameException icne) { Assert.assertEquals(icne.getMessage(), badCharsetName); } <START> return; <END> }</code><technical_language>needed</technical_language>

Target:
public void testStringInputRowParserSerdeMultiCharset() throws Exception { Charset[] testCharsets = { Charsets.US_ASCII, Charsets.ISO_8859_1, Charsets.UTF_8, Charsets.UTF_16BE, Charsets.UTF_16LE, Charsets.UTF_16 }; for (Charset testCharset : testCharsets) { InputRow parsed = testCharsetParseHelper(testCharset); Assert.assertEquals(ImmutableList.of("bar", "foo"), parsed.getDimensions()); Assert.assertEquals(ImmutableList.of("x"), parsed.getDimension("foo")); Assert.assertEquals(ImmutableList.of("y"), parsed.getDimension("bar")); Assert.assertEquals(new DateTime("3000").getMillis(), parsed.getTimestampFromEpoch()); } }
Source:
<code>protected int printList(String prefix, Collection<String> list) { <START> if (list != null && !list.isEmpty()) { <END> for (String filename : list) out.println("#\t" + prefix + filename); return list.size(); } else return 0; }</code><technical_language>AFAIK, lists alway non-null. need a null check</technical_language>

Target:
protected int printList(String prefix, Collection<String> list) { if (!list.isEmpty()) { List<String> sortedList = new ArrayList<String>(list); java.util.Collections.sort(sortedList); for (String filename : sortedList) out.println(CLIText.formatLine(String.format( statusFileListFormat, prefix, filename))); return list.size(); } else return 0; }
Source:
<code>public PaginationResource getSessions( @PathParam("id") int projectId, @QueryParam("workflow") String workflowName, @QueryParam("last_id") Long lastId, @QueryParam("page_size") Integer pageSize, @QueryParam("page_number") Integer pageNumber) throws ResourceNotFoundException { int validPageSize = QueryParamValidator.validatePageSize(Optional.fromNullable(pageSize), MAX_SESSIONS_PAGE_SIZE, DEFAULT_SESSIONS_PAGE_SIZE); return tm.begin(() -> { ProjectStore ps = rm.getProjectStore(getSiteId()); SessionStore ss = ssm.getSessionStore(getSiteId()); StoredProject proj = ensureNotDeletedProject(ps.getProjectById(projectId)); List<StoredSessionWithLastAttempt> sessions; if (workflowName != null) { <START> sessions = ss.getSessionsOfWorkflowByName(proj.getId(), workflowName, Optional.fromNullable(lastId)); <END> } else { sessions = ss.getSessionsOfProject(proj.getId(), Optional.fromNullable(lastId)); } if (sessions.isEmpty()) return new PaginationResource(new ArrayList<>(), 1); int sessionsSize = sessions.size(); ArrayList<List<StoredSessionWithLastAttempt>> dividedSessions = new ArrayList<>(); for (int i =0; i < sessionsSize; i+= validPageSize) { dividedSessions.add(sessions.subList(i, Math.min(i + validPageSize, sessionsSize))); } Integer offset = Optional.fromNullable(pageNumber).or(1); List<StoredSessionWithLastAttempt> targetSessions = dividedSessions.get(offset - 1); List<RestSession> restSessions = RestModels.sessionCollection(ps, targetSessions).getSessions(); return new PaginationResource(restSessions, dividedSessions.size()); }, ResourceNotFoundException.class); }</code><technical_language>records returned, consume memory</technical_language>

Target:
public RestSessionCollection getSessions( @PathParam("id") int projectId, @QueryParam("workflow") String workflowName, @QueryParam("last_id") Long lastId, @QueryParam("page_size") Integer pageSize, @QueryParam("page_number") Integer pageNumber) throws ResourceNotFoundException { int validPageSize = QueryParamValidator.validatePageSize(Optional.fromNullable(pageSize), MAX_SESSIONS_PAGE_SIZE, DEFAULT_SESSIONS_PAGE_SIZE); int validPageNumber = QueryParamValidator.validatePageNumber(Optional.fromNullable(pageNumber), DEFAULT_PAGE_NUMBER); return tm.begin(() -> { ProjectStore ps = rm.getProjectStore(getSiteId()); SessionStore ss = ssm.getSessionStore(getSiteId()); StoredProject proj = ensureNotDeletedProject(ps.getProjectById(projectId)); Integer sessionRecordsNumber = ss.getSessionsCountOfProject(Optional.fromNullable(lastId), projectId); List<StoredSessionWithLastAttempt> sessions; if (workflowName != null) { sessions = ss.getSessionsOfWorkflowByName(proj.getId(), workflowName, validPageSize, validPageNumber, Optional.fromNullable(lastId)); } else { sessions = ss.getSessionsOfProject(proj.getId(), validPageSize, validPageNumber, Optional.fromNullable(lastId)); } return RestModels.sessionCollection(ps, sessions, sessionRecordsNumber); }, ResourceNotFoundException.class); }
Source:
<code>public void addGame(@NotNull Game game) { GamePanel panel = new GamePanel(getGlassPane(), game); <START> if(mTabbedPane.getTabCount() != 0) { <END> mTabbedPane.addTab(game.getGameType() + mTabbedPane.getTabCount(), panel); } else{ mTabbedPane.addTab(game.getGameType(), panel); } mTabbedPane.setSelectedComponent(panel); mCardLayout.show(mCardPanel, KEY_TABS); }</code><technical_language>need this change, if decide want it, needs in a separate commit</technical_language>

Target:
public void addGame(@NotNull Game game) { GamePanel panel = new GamePanel(getGlassPane(), game); mTabbedPane.addTab(game.getGameType() + mTabbedPane.getTabCount(), panel); mTabbedPane.setSelectedComponent(panel); mCardLayout.show(mCardPanel, KEY_TABS); }
Source:
<code>public PageReadStore readNextRowGroup() throws IOException { if (currentBlock == blocks.size()) { return null; } BlockMetaData block = blocks.get(currentBlock); if (block.getRowCount() == 0) { throw new RuntimeException("Illegal row group of 0 rows"); } this.currentRowGroup = new ColumnChunkPageReadStore(block.getRowCount()); <START> List<ConsecutivePartList> allChunks = new ArrayList<ConsecutivePartList>(); <END> ConsecutivePartList currentChunks = null; for (ColumnChunkMetaData mc : block.getColumns()) { ColumnPath pathKey = mc.getPath(); BenchmarkCounter.incrementTotalBytes(mc.getTotalSize()); ColumnDescriptor columnDescriptor = paths.get(pathKey); if (columnDescriptor != null) { long startingPos = mc.getStartingPos(); if (currentChunks == null || currentChunks.endPos() != startingPos) { currentChunks = new ConsecutivePartList(startingPos); allChunks.add(currentChunks); } currentChunks.addChunk(new ChunkDescriptor(columnDescriptor, mc, startingPos, (int)mc.getTotalSize())); } } ChunkListBuilder builder = new ChunkListBuilder(); for (ConsecutivePartList consecutiveChunks : allChunks) { consecutiveChunks.readAll(f, builder); } for (Chunk chunk : builder.build()) { currentRowGroup.addColumn(chunk.descriptor.col, chunk.readAllPages()); } if (nextDictionaryReader != null) { nextDictionaryReader.setRowGroup(currentRowGroup); } advanceToNextBlock(); return currentRowGroup; }</code><technical_language>(nit) rename variables reflect new type</technical_language>

Target:
public PageReadStore readNextRowGroup() throws IOException { if (currentBlock == blocks.size()) { return null; } BlockMetaData block = blocks.get(currentBlock); if (block.getRowCount() == 0) { throw new RuntimeException("Illegal row group of 0 rows"); } this.currentRowGroup = new ColumnChunkPageReadStore(block.getRowCount()); List<ConsecutivePartList> allParts = new ArrayList<ConsecutivePartList>(); ConsecutivePartList currentParts = null; for (ColumnChunkMetaData mc : block.getColumns()) { ColumnPath pathKey = mc.getPath(); BenchmarkCounter.incrementTotalBytes(mc.getTotalSize()); ColumnDescriptor columnDescriptor = paths.get(pathKey); if (columnDescriptor != null) { long startingPos = mc.getStartingPos(); if (currentParts == null || currentParts.endPos() != startingPos) { currentParts = new ConsecutivePartList(startingPos); allParts.add(currentParts); } currentParts.addChunk(new ChunkDescriptor(columnDescriptor, mc, startingPos, (int)mc.getTotalSize())); } } ChunkListBuilder builder = new ChunkListBuilder(); for (ConsecutivePartList consecutiveChunks : allParts) { consecutiveChunks.readAll(f, builder); } for (Chunk chunk : builder.build()) { currentRowGroup.addColumn(chunk.descriptor.col, chunk.readAllPages()); } if (nextDictionaryReader != null) { nextDictionaryReader.setRowGroup(currentRowGroup); } advanceToNextBlock(); return currentRowGroup; }
Source:
<code>private void waitOnAllRegionsToClose(final boolean abort) { int lastCount = -1; long previousLogTime = 0; Set<String> closedRegions = new HashSet<>(); boolean interrupted = false; try { while (!onlineRegions.isEmpty()) { int count = getNumberOfOnlineRegions(); if (count != lastCount) { if (System.currentTimeMillis() > (previousLogTime + 1000)) { previousLogTime = System.currentTimeMillis(); lastCount = count; LOG.info("Waiting on " + count + " regions to close"); if (count < 10 && LOG.isDebugEnabled()) { LOG.debug("Online Regions=" + this.onlineRegions); } } } for (Map.Entry<String, HRegion> e : this.onlineRegions.entrySet()) { RegionInfo hri = e.getValue().getRegionInfo(); if (!this.regionsInTransitionInRS.containsKey(hri.getEncodedNameAsBytes()) && !closedRegions.contains(hri.getEncodedName())) { closedRegions.add(hri.getEncodedName()); closeRegionIgnoreErrors(hri, abort); } } if (this.regionsInTransitionInRS.isEmpty()) { if (!onlineRegions.isEmpty()) { LOG.info("We were exiting though online regions are not empty," + " because some regions failed closing"); } break; } else { <START> LOG.trace("Waiting on {}", this.regionsInTransitionInRS.entrySet().stream(). <END> map(e -> Bytes.toString(e.getKey())).collect(Collectors.joining(", "))); } if (sleep(200)) { interrupted = true; } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }</code><technical_language>nit: "Waiting regions in transition: {}"</technical_language>

Target:
private void waitOnAllRegionsToClose(final boolean abort) { int lastCount = -1; long previousLogTime = 0; Set<String> closedRegions = new HashSet<>(); boolean interrupted = false; try { while (!onlineRegions.isEmpty()) { int count = getNumberOfOnlineRegions(); if (count != lastCount) { if (System.currentTimeMillis() > (previousLogTime + 1000)) { previousLogTime = System.currentTimeMillis(); lastCount = count; LOG.info("Waiting on " + count + " regions to close"); if (count < 10 && LOG.isDebugEnabled()) { LOG.debug("Online Regions=" + this.onlineRegions); } } } for (Map.Entry<String, HRegion> e : this.onlineRegions.entrySet()) { RegionInfo hri = e.getValue().getRegionInfo(); if (!this.regionsInTransitionInRS.containsKey(hri.getEncodedNameAsBytes()) && !closedRegions.contains(hri.getEncodedName())) { closedRegions.add(hri.getEncodedName()); closeRegionIgnoreErrors(hri, abort); } } if (this.regionsInTransitionInRS.isEmpty()) { if (!onlineRegions.isEmpty()) { LOG.info("We were exiting though online regions are not empty," + " because some regions failed closing"); } break; } if (sleep(200)) { interrupted = true; } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }
Source:
<code><START> public void report(String status, Class<?> execClass, MetricRegistry registry) { <END> String sn = execClass.getSimpleName(); String prefix = FluoConfiguration.FLUO_PREFIX + ".tx."; if (getLockWaitTime() > 0) registry.timer(prefix + "lockWait." + sn).update(getLockWaitTime(), TimeUnit.MILLISECONDS); registry.timer(prefix + "time." + sn).update(getTime(), TimeUnit.MILLISECONDS); if (getCollisions() > 0) registry.histogram(prefix + "collisions." + sn).update(getCollisions()); registry.histogram(prefix + "set." + sn).update(getEntriesSet()); registry.histogram(prefix + "read." + sn).update(getEntriesReturned()); if (getTimedOutLocks() > 0) registry.histogram(prefix + "locks.timedout." + sn).update(getTimedOutLocks()); if (getDeadLocks() > 0) registry.histogram(prefix + "locks.dead." + sn).update(getDeadLocks()); registry.counter(prefix + "status." + status.toLowerCase() + "." + sn).inc(); }</code><technical_language>I do of this reporting in method</technical_language>

Target:
public void report(String status, Class<?> execClass, MetricRegistry registry) { String sn = execClass.getSimpleName(); if (getLockWaitTime() > 0) registry.timer(MetricNames.TX_LOCKWAIT + sn).update(getLockWaitTime(), TimeUnit.MILLISECONDS); registry.timer(MetricNames.TX_TIME + sn).update(getTime(), TimeUnit.MILLISECONDS); if (getCollisions() > 0) registry.histogram(MetricNames.TX_COLLISIONS + sn).update(getCollisions()); registry.histogram(MetricNames.TX_SET + sn).update(getEntriesSet()); registry.histogram(MetricNames.TX_READ + sn).update(getEntriesReturned()); if (getTimedOutLocks() > 0) registry.histogram(MetricNames.TX_LOCKS_TIMEDOUT + sn).update(getTimedOutLocks()); if (getDeadLocks() > 0) registry.histogram(MetricNames.TX_LOCKS_DEAD + sn).update(getDeadLocks()); registry.counter(MetricNames.TX_STATUS + status.toLowerCase() + "." + sn).inc(); }
Source:
<code>CosmosStoredProcedureResponse mapStoredProcedureResponseAndBlock( Mono<CosmosAsyncStoredProcedureResponse> storedProcedureResponseMono) throws CosmosClientException { try { return storedProcedureResponseMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientException) throwable; } else { <START> throw (RuntimeException) ex; <END> } } }</code><technical_language>if exception is a checked exception ? cast RuntimeException checking. I thought reason throw Exceptions.propagate(ex) other places</technical_language>

Target:
CosmosStoredProcedureResponse mapStoredProcedureResponseAndBlock( Mono<CosmosAsyncStoredProcedureResponse> storedProcedureResponseMono) throws CosmosClientException { try { return storedProcedureResponseMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientException) throwable; } else { throw ex; } } }
Source:
<code>public void initialize() { <START> minMaxFunc = ops().function(MinMax.class, Pair.class, Iterable.class); <END> }</code><technical_language>this is wrong. do do this</technical_language>

Target:
public void initialize() { minMaxFunc = (FunctionOp) ops().function(MinMax.class, Pair.class, in() != null ? in() : Iterable.class); }
Source:
<code>public void addCluster(String clusterName, boolean overwritePrevious) { <START> _admin.addCluster(clusterName, overwritePrevious); <END> for (BuiltInStateModelDefinitions def : BuiltInStateModelDefinitions.values()) { addStateModelDef(clusterName, def.getStateModelDefinition().getId(), def.getStateModelDefinition(), overwritePrevious); } }</code><technical_language>In general, usually, do this in a reverse way. method parameters call method more parameters. I is awkward condition check in method above</technical_language>

Target:
public void addCluster(String clusterName, boolean overwritePrevious) { addCluster(clusterName, overwritePrevious, null); }
Source:
<code>public void any_class_should_be_actual_alias_to_isA() { mock.simpleMethod(new ArrayList()); verify(mock).simpleMethod(isA(List.class)); verify(mock).simpleMethod(any(List.class)); mock.simpleMethod((String) null); try { verify(mock).simpleMethod(isA(String.class)); <START> } catch (AssertionError ignored) { <END> try { verify(mock).simpleMethod(any(String.class)); } catch (AssertionError ignored2) { return; } } fail(); }</code><technical_language>resulting code is readable. I suggest AssertJ suppression</technical_language>

Target:
public void any_class_should_be_actual_alias_to_isA() { mock.simpleMethod(new ArrayList()); verify(mock).simpleMethod(isA(List.class)); verify(mock).simpleMethod(any(List.class)); mock.simpleMethod((String) null); assertThatThrownBy(new ThrowableAssert.ThrowingCallable() { @Override public void call() { verify(mock).simpleMethod(isA(String.class)); } }).isInstanceOf(ArgumentsAreDifferent.class); assertThatThrownBy(new ThrowableAssert.ThrowingCallable() { @Override public void call() { verify(mock).simpleMethod(any(String.class)); } }).isInstanceOf(ArgumentsAreDifferent.class); }
Source:
<code>private void adjustQuestionNumbers(int oldQuestionNumber, int newQuestionNumber, List<FeedbackQuestionAttributes> questions) { <START> try { <END> if (oldQuestionNumber > newQuestionNumber && oldQuestionNumber >= 1) { for (int i = oldQuestionNumber - 1; i >= newQuestionNumber; i--) { FeedbackQuestionAttributes question = questions.get(i - 1); question.questionNumber += 1; updateFeedbackQuestionWithoutResponseRateUpdate(question); } } else if (oldQuestionNumber < newQuestionNumber && oldQuestionNumber < questions.size()) { for (int i = oldQuestionNumber + 1; i <= newQuestionNumber; i++) { FeedbackQuestionAttributes question = questions.get(i - 1); question.questionNumber -= 1; updateFeedbackQuestionWithoutResponseRateUpdate(question); } } } catch (InvalidParametersException e) { Assumption.fail("Invalid question."); } catch (EntityDoesNotExistException e) { Assumption.fail("Question disappeared."); } }</code><technical_language>Try Minimizing amount of code in try block</technical_language>

Target:
private void adjustQuestionNumbers(int oldQuestionNumber, int newQuestionNumber, List<FeedbackQuestionAttributes> questions) { if (oldQuestionNumber > newQuestionNumber && oldQuestionNumber >= 1) { for (int i = oldQuestionNumber - 1; i >= newQuestionNumber; i--) { FeedbackQuestionAttributes question = questions.get(i - 1); question.questionNumber += 1; updateFeedbackQuestionWithoutResponseRateUpdate(question); } } else if (oldQuestionNumber < newQuestionNumber && oldQuestionNumber < questions.size()) { for (int i = oldQuestionNumber + 1; i <= newQuestionNumber; i++) { FeedbackQuestionAttributes question = questions.get(i - 1); question.questionNumber -= 1; updateFeedbackQuestionWithoutResponseRateUpdate(question); } } }
Source:
<code>public List<Trip> getTripsForDate (String stop_id, LocalDate date) { List<String> tripIds = stats.getTripsForDate(date).stream() .map(trip -> trip.trip_id) .collect(Collectors.toList()); return feed.getStopTimesForStop(stop_id).stream() .map(t -> feed.trips.get(t.b.a)) <START> .filter(t -> tripIds.contains(t.trip_id)) END> .collect(Collectors.toList()); }</code><technical_language>Possibility of duplicates due loop routes, recommend adding .distinct()</technical_language>

Target:
public List<Trip> getTripsForDate (String stop_id, LocalDate date) { List<String> tripIds = stats.getTripsForDate(date).stream() .map(trip -> trip.trip_id) .collect(Collectors.toList()); return feed.getDistinctTripsForStop(stop_id).stream() .filter(t -> tripIds.contains(t.trip_id)) .collect(Collectors.toList()); }
Source:
<code>public void run() { boolean performAction = MessageDialog.openConfirm(form.getShell(), UIText.DiscardChangesAction_confirmActionTitle, UIText.DiscardChangesAction_confirmActionMessage); if (!performAction) return ; String[] files = getSelectedFiles(selection); <START> replaceWith(files, headRevision); <END> Repository repository = currentRepository; if (repository != null) { IndexDiffCacheEntry indexDiffCacheForRepository = org.eclipse.egit.core.Activator .getDefault().getIndexDiffCache() .getIndexDiffCacheEntry(repository); if (indexDiffCacheForRepository != null) { indexDiffCacheForRepository .refreshFiles(Arrays.asList(files)); } } }</code><technical_language>replaceWith() currently report if all. "return boolean" do if returns OK. Better, entire code checkoutCommand.call();</technical_language>

Target:
public void run() { boolean performAction = MessageDialog.openConfirm(form.getShell(), UIText.DiscardChangesAction_confirmActionTitle, UIText.DiscardChangesAction_confirmActionMessage); if (!performAction) { return; } List<String> files = new ArrayList<>(); List<String> inaccessibleFiles = new ArrayList<>(); getSelectedFiles(files, inaccessibleFiles); replaceWith(files, inaccessibleFiles); }
Source:
<code>public Description getDescription() { Description description = Description.createSuiteDescription( <START> getTestClass().getJavaClass(), <END> getName(), getRunnerAnnotations() ); for (T child : getFilteredChildren()) { description.addChild(describeChild(child)); } return description; }</code><technical_language>getJavaClass() in theory return null. safe, I suggest check for here, if is null getName() before</technical_language>

Target:
public Description getDescription() { Class<?> clazz = getTestClass().getJavaClass(); Description description; if (clazz == null || !clazz.getName().equals(getName())) { description = Description.createSuiteDescription(getName(), getRunnerAnnotations()); } else { description = Description.createSuiteDescription(clazz, getRunnerAnnotations()); } for (T child : getFilteredChildren()) { description.addChild(describeChild(child)); } return description; }
Source:
<code>public BasicNettyOrigin(String name, String vip, Registry registry) { this.name = name; this.vip = vip; this.registry = registry; this.config = setupClientConfig(name); this.clientChannelManager = new DefaultClientChannelManager(name, vip, config, registry); this.clientChannelManager.init(); this.requestAttemptFactory = new NettyRequestAttemptFactory(); <START> this.concurrentRequests = new AtomicInteger(0); <END> this.concurrencyMax = new CachedDynamicIntProperty("zuul.origin." + name + ".concurrency.max.requests", 200); this.concurrencyProtectionEnabled = new CachedDynamicBooleanProperty("zuul.origin." + name + ".concurrency.protect.enabled", true); }</code><technical_language>add a Gauge metric for this</technical_language>

Target:
public BasicNettyOrigin(String name, String vip, Registry registry) { this.name = name; this.vip = vip; this.registry = registry; this.config = setupClientConfig(name); this.clientChannelManager = new DefaultClientChannelManager(name, vip, config, registry); this.clientChannelManager.init(); this.requestAttemptFactory = new NettyRequestAttemptFactory(); this.concurrentRequests = SpectatorUtils.newGauge("zuul.origin.concurrent.requests", name, new AtomicInteger(0)); this.rejectedRequests = SpectatorUtils.newCounter("zuul.origin.rejected.requests", name); this.concurrencyMax = new CachedDynamicIntProperty("zuul.origin." + name + ".concurrency.max.requests", 200); this.concurrencyProtectionEnabled = new CachedDynamicBooleanProperty("zuul.origin." + name + ".concurrency.protect.enabled", true); }
Source:
<code>public void loadModule(String name) throws IOException, ScriptException { Resource resource = null; if ("underscore".equals(name)) { <START> resource = this.assetSource.getClasspathAsset("/META-INF/assets/tapestry5/underscore-1.8.3.js").getResource(); <END> } else { resource = this.moduleManager.findResourceForModule(name); } if (resource == null) { throw new RuntimeException("Could not load module / resource not found for module: " + name); } StreamableResource streamableResource = this.srs.getStreamableResource(resource, StreamableResourceProcessing.COMPRESSION_DISABLED, this.tracker); try (InputStream is = streamableResource.openStream()) { log.debug("Evaluating in nashorn javascript engine", resource.getFile()); this.engine.eval(IOUtils.toString(is), this.bindings); log.debug("Finished evaluating in nashorn javascript engine", resource.getFile()); } }</code><technical_language>In of applications, I override underscore a newer version, trouble. I assume, need a special case Tapestry a shim for underscore? works checking for "underscore-library" "underscore" a fallback</technical_language>

Target:
public void loadModule(String name) throws IOException, ScriptException { Resource resource = this.moduleManager.findResourceForModule(name); if (resource == null) { throw new RuntimeException("Could not load module / resource not found for module: " + name); } StreamableResource streamableResource = this.srs.getStreamableResource(resource, StreamableResourceProcessing.COMPRESSION_DISABLED, this.tracker); try (InputStream is = streamableResource.openStream()) { log.debug("Evaluating in nashorn javascript engine", resource.getFile()); this.engine.eval(IOUtils.toString(is, Charset.forName("UTF-8"))); log.debug("Finished evaluating in nashorn javascript engine", resource.getFile()); } }
Source:
<code>public void execution2() throws Exception { withProduct(client(), product -> { final String slug = product.getMasterData().getStaged().getSlug().get(Locale.ENGLISH); final ProductProjectionQuery normalSphereRequest = ProductProjectionQuery.ofStaged() .withPredicates(m -> m.slug().locale(Locale.ENGLISH).is(slug)) .plusExpansionPaths(m -> m.productType()); final JsonNodeSphereRequest jsonNodeSphereRequest = JsonNodeSphereRequest.of(normalSphereRequest); assertThat(normalSphereRequest.httpRequestIntent()) <START> .as("a JsonNodeSphereRequest creates the same request to the platform, but differes in the response") <END> .isEqualTo(jsonNodeSphereRequest.httpRequestIntent()); final PagedQueryResult<ProductProjection> productProjectionPagedSearchResult = client().executeBlocking(normalSphereRequest); final JsonNode jsonNode = client().executeBlocking(jsonNodeSphereRequest); assertThat(jsonNode.get("results").get(0).get("productType").get("obj").get("description").asText()) .as("the expansion paths are honored") .isEqualTo("a 'T' shaped cloth"); }); }</code><technical_language>if lazy modify this wait for CI tests pass again, *differs :D</technical_language>

Target:
public void execution2() throws Exception { withProduct(client(), product -> { final String slug = product.getMasterData().getStaged().getSlug().get(Locale.ENGLISH); final ProductProjectionQuery normalSphereRequest = ProductProjectionQuery.ofStaged() .withPredicates(m -> m.slug().locale(Locale.ENGLISH).is(slug)) .plusExpansionPaths(m -> m.productType()); final JsonNodeSphereRequest jsonNodeSphereRequest = JsonNodeSphereRequest.of(normalSphereRequest); assertThat(normalSphereRequest.httpRequestIntent()) .as("a JsonNodeSphereRequest creates the same request to the platform, but differs in the response") .isEqualTo(jsonNodeSphereRequest.httpRequestIntent()); final PagedQueryResult<ProductProjection> productProjectionPagedSearchResult = client().executeBlocking(normalSphereRequest); final JsonNode jsonNode = client().executeBlocking(jsonNodeSphereRequest); assertThat(jsonNode.get("results").get(0).get("productType").get("obj").get("description").asText()) .as("the expansion paths are honored") .isEqualTo("a 'T' shaped cloth"); }); }
Source:
<code>public static Map<String, String> headersToMap(Map<String, List<String>> headers) { <START> List<String>a = new ArrayList<String>(); <END> Map<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); for (String name : headers.keySet()) { map.put(name, join(headers.get(name), ", ")); } return map; }</code><technical_language>of a variable</technical_language>

Target:
public static Map<String, String> headersToMap(Map<String, List<String>> headers) { Map<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); for (String name : headers.keySet()) { map.put(name, join(headers.get(name), ", ")); } return map; }