auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private MeetingSchedule getMeetingSchedule(int numberOfEntities) { MeetingSchedule solution = new MeetingSchedule(); <START> MeetingWeightPack parametrization = new MeetingWeightPack(); <END> parametrization.setId(0L); solution.setWeightPack(parametrization); List<Meeting> meetingList = new ArrayList<>(); List<Day> dayList = new ArrayList<>(); List<TimeGrain> timeGrainList = new ArrayList<>(); List<Room> roomList = new ArrayList<>(); List<Person> personList = new ArrayList<>(); List<MeetingAssignment> meetingAssignmentList = new ArrayList<>(); for (int i = 0; i < numberOfEntities; i++) { Meeting m = new Meeting(); m.setId((long) i); m.setTopic("meeting" + i); meetingList.add(m); Day d = new Day(); d.setId((long) i); d.setDayOfYear(i+1); dayList.add(d); TimeGrain t = new TimeGrain(); t.setId((long) i); t.setGrainIndex(i); t.setDay(dayList.get(0)); t.setStartingMinuteOfDay(i * TimeGrain.GRAIN_LENGTH_IN_MINUTES); timeGrainList.add(t); Room r = new Room(); r.setId((long) i); r.setName("room" + i); roomList.add(r); Person p = new Person(); p.setId((long) i); p.setFullName("person" + i); personList.add(p); MeetingAssignment ma = new MeetingAssignment(); ma.setId((long) i); meetingAssignmentList.add(ma); } solution.setRoomList(roomList); solution.setTimeGrainList(timeGrainList); solution.setDayList(dayList); solution.setPersonList(personList); solution.setMeetingList(meetingList); solution.setMeetingAssignmentList(meetingAssignmentList); return solution; }</code><technical_language>variable name "parametrization" renamed? (e.g. weightPack)</technical_language>

Target:
private MeetingSchedule getMeetingSchedule(int numberOfEntities) { MeetingSchedule solution = new MeetingSchedule(); MeetingConstraintConfiguration constraintConfiguration = new MeetingConstraintConfiguration(); constraintConfiguration.setId(0L); solution.setConstraintConfiguration(constraintConfiguration); List<Meeting> meetingList = new ArrayList<>(); List<Day> dayList = new ArrayList<>(); List<TimeGrain> timeGrainList = new ArrayList<>(); List<Room> roomList = new ArrayList<>(); List<Person> personList = new ArrayList<>(); List<MeetingAssignment> meetingAssignmentList = new ArrayList<>(); for (int i = 0; i < numberOfEntities; i++) { Meeting m = new Meeting(); m.setId((long) i); m.setTopic("meeting" + i); meetingList.add(m); Day d = new Day(); d.setId((long) i); d.setDayOfYear(i+1); dayList.add(d); TimeGrain t = new TimeGrain(); t.setId((long) i); t.setGrainIndex(i); t.setDay(dayList.get(0)); t.setStartingMinuteOfDay(i * TimeGrain.GRAIN_LENGTH_IN_MINUTES); timeGrainList.add(t); Room r = new Room(); r.setId((long) i); r.setName("room" + i); roomList.add(r); Person p = new Person(); p.setId((long) i); p.setFullName("person" + i); personList.add(p); MeetingAssignment ma = new MeetingAssignment(); ma.setId((long) i); meetingAssignmentList.add(ma); } solution.setRoomList(roomList); solution.setTimeGrainList(timeGrainList); solution.setDayList(dayList); solution.setPersonList(personList); solution.setMeetingList(meetingList); solution.setMeetingAssignmentList(meetingAssignmentList); return solution; }
Source:
<code>private void countRows(long[] rowCount, ShardResponse response) { <START> updateOrFail(rowCount, response, (a,b) -> a[0] += 1); <END> }</code><technical_language>improve var names in lambda signature? (a, b) -> (acc, response) smth</technical_language>

Target:
private void countRows(long[] rowCount, ShardResponse response) { updateOrFail(rowCount, response, (acc,b) -> acc[0] += 1); }
Source:
<code>public Response getIncompleteTasks() { final List<TaskResponseObject> incompleteTasks = Lists.transform( <START> taskStorageQueryAdapter.getActiveTasks(), <END> new Function<Task, TaskResponseObject>() { @Nullable @Override public TaskResponseObject apply(Task task) { return new TaskResponseObject( task.getId(), new DateTime(0), new DateTime(0), Optional.<TaskStatus>absent() ); } } ); return Response.ok(incompleteTasks).build(); }</code><technical_language>in call train stop exceptions. intending last-resort exception reporter handle exceptions</technical_language>

Target:
public Response getIncompleteTasks() { final List<TaskResponseObject> incompleteTasks = Lists.transform( taskStorageQueryAdapter.getActiveTasks(), new Function<Task, TaskResponseObject>() { @Nullable @Override public TaskResponseObject apply(Task task) { return new TaskResponseObject( task.getId(), new DateTime(0), new DateTime(0), Optional.<TaskStatus>absent(), TaskLocation.unknown() ); } } ); return Response.ok(incompleteTasks).build(); }
Source:
<code>private static Repository getRepositoryOfProjects(Collection<?> collection, boolean single) { Repository repo = null; for (Object element : collection) { IProject project = AdapterUtils.adapt(element, IProject.class); if (project != null) { Repository r = getRepositoryOfMapping(project); if (single && r != null && repo != null && r != repo) return null; else if (r != null) repo = r; } else { IContainer container = AdapterUtils.adapt(element, IContainer.class); RepositoryMapping mapping = null; if (container != null) { mapping = RepositoryMapping.getMapping(container); } if (container != null && mapping != null && container.equals(mapping.getContainer())) { Repository r = mapping.getRepository(); <START> if (single && r != null && repo != null && r != repo) <END> return null; else if (r != null) repo = r; } else { IWorkingSet workingSet = AdapterUtils.adapt(element, IWorkingSet.class); if (workingSet != null) { for (IAdaptable adaptable : workingSet.getElements()) { Repository r = getRepositoryOfProject(adaptable); if (single && r != null && repo != null && r != repo) return null; else if (r != null) repo = r; } } } } } return repo; }</code><technical_language>Please add missing braces, below</technical_language>

Target:
private static Repository getRepositoryOfProjects(Collection<?> collection, boolean single) { Repository repo = null; for (Object element : collection) { IProject project = AdapterUtils.adapt(element, IProject.class); if (project != null) { Repository r = getRepositoryOfMapping(project); if (single && r != null && repo != null && r != repo) { return null; } else if (r != null) { repo = r; } } else { IContainer container = AdapterUtils.adapt(element, IContainer.class); RepositoryMapping mapping = null; if (container != null) { mapping = RepositoryMapping.getMapping(container); } if (container != null && mapping != null && container.equals(mapping.getContainer())) { Repository r = mapping.getRepository(); if (single && r != null && repo != null && r != repo) { return null; } else if (r != null) { repo = r; } } else { IWorkingSet workingSet = AdapterUtils.adapt(element, IWorkingSet.class); if (workingSet != null) { for (IAdaptable adaptable : workingSet.getElements()) { Repository r = getRepositoryOfProject(adaptable); if (single && r != null && repo != null && r != repo) { return null; } else if (r != null) { repo = r; } } } } } } return repo; }
Source:
<code>public Vector2i getPreferredContentSize(Canvas canvas, Vector2i sizeHint) { <START> if (currentImage.get() != null) { <END> return currentImage.get().getPreferredContentSize(canvas, sizeHint); } return Vector2i.zero(); }</code><technical_language>replaced currentImage.isPresent()</technical_language>

Target:
public Vector2i getPreferredContentSize(Canvas canvas, Vector2i sizeHint) { if (images.get(index) != null) { return images.get(index).getPreferredContentSize(canvas, sizeHint); } return Vector2i.zero(); }
Source:
<code>private BlobStoreStats setupBlobStoreStats(int bucketCount, long logSegmentForecastOffsetMs) { return new BlobStoreStats("", state.index, bucketCount, BUCKET_SPAN_IN_MS, logSegmentForecastOffsetMs, QUEUE_PROCESSOR_PERIOD_IN_SECS, Time.SecsPerMin, state.time, indexScannerScheduler, queueProcessorScheduler, <START> diskIOScheduler, METRICS); <END> }</code><technical_language>uniform wrt storeId. In StoreMetrics pass in "temp" empty string</technical_language>

Target:
private BlobStoreStats setupBlobStoreStats(int bucketCount, long logSegmentForecastOffsetMs) { return new BlobStoreStats("", state.index, bucketCount, BUCKET_SPAN_IN_MS, logSegmentForecastOffsetMs, QUEUE_PROCESSOR_PERIOD_IN_Ms, DEFAULT_WAIT_TIMEOUT_SECS, state.time, indexScannerScheduler, queueProcessorScheduler, diskIOScheduler, METRICS); }
Source:
<code>private static Intent helper_baseHMSOpenIntent() { return new Intent() <START> .setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET | Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NEW_TASK) <END> .setAction("android.intent.action.VIEW"); }</code><technical_language>FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET is deprecated, is needed</technical_language>

Target:
private static Intent helper_baseHMSOpenIntent() { return new Intent() .setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK) .setAction("android.intent.action.VIEW"); }
Source:
<code>private void deleteFileOrLog(File file, Attachable object, FileAttachment attachment) { if (!file.delete()) { log.error(String.format("File no longer associated with an object, but failed to delete: %s%s from %s %d", file.getName(), <START> (attachment == null ? "" : " (" + attachment.getFilename() + ")"), attachment.getFilename(), object.getAttachmentsTarget(), <END> object.getId())); } }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') "java.nio.Files#delete" for messages error conditions. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private void deleteFileOrLog(File file, Attachable object, FileAttachment attachment) { if (!file.delete()) { log.error("File no longer associated with an object, but failed to delete: {}{} from {}", new Object[] { file.getName(), (attachment == null ? "" : " (" + attachment.getFilename() + ")"), object.getAttachmentsTarget(), Long.valueOf(object.getId()) }); } }
Source:
<code>public static String normalizeMethodSignature(String requestURL, String method) { if (requestURL.startsWith("/repo/v1") || requestURL.startsWith("/file/v1") || requestURL.startsWith("/auth/v1")) { requestURL = requestURL.substring(8); <START> } <END> Matcher matcher = NUMERIC_PARAM_PATTERN.matcher(requestURL); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(buffer, NUMBER_REPLACEMENT); } matcher.appendTail(buffer); return method + " " + buffer; }</code><technical_language>constants</technical_language>

Target:
public static String normalizeMethodSignature(String requestURL, String method) { requestURL = requestURL.toLowerCase(); if (requestURL.startsWith(REPO_V1) || requestURL.startsWith(FILE_V1) || requestURL.startsWith(AUTH_V1)) { requestURL = requestURL.substring(8); } Matcher matcher = NUMERIC_PARAM_PATTERN.matcher(requestURL); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(buffer, NUMBER_REPLACEMENT); } matcher.appendTail(buffer); return method + " " + buffer; }
Source:
<code>public JSONArray put(String index, JSONArray values) { if (values.length() == 2 && index != null) { <START> synchronized (mConcurrentLock) { <END> return mVars.put(index, values); } } Logy.d(LOGGER_TAG, "value length should be equal 2"); return null; }</code><technical_language>a style of coding, do it? (Assuming change ConcurrentHashMap) public JSONArray put(String index, JSONArray values) { if (values.length() != 2 || index == null) { Logy.d(LOGGER_TAG, "values.length() equal 2"); return null; } return mVars.put(index, values); }</technical_language>

Target:
public JSONArray put(String index, JSONArray values) { if (values.length() != 2 || index == null) { Logy.d(LOGGER_TAG, "values.length() should be equal 2"); return null; } return mVars.put(index, values); }
Source:
<code>private Object decodeNtcb(Channel channel, SocketAddress remoteAddress, ByteBuf buf) { prefix = buf.toString(buf.readerIndex(), 4, StandardCharsets.US_ASCII); buf.skipBytes(prefix.length()); serverId = buf.readUnsignedIntLE(); deviceUniqueId = buf.readUnsignedIntLE(); int length = buf.readUnsignedShortLE(); buf.skipBytes(2); if (length == 0) { return null; } String type = buf.toString(buf.readerIndex(), 3, StandardCharsets.US_ASCII); buf.skipBytes(type.length()); if (type.equals("*>S")) { return processHandshake(channel, remoteAddress, buf); } else { DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); if (deviceSession != null) { try { switch (type) { case "*>A": return processNtcbArray(deviceSession, channel, buf); case "*>T": return processNtcbSingle(deviceSession, channel, buf); case "*>F": buf.skipBytes(3); return processFlexNegotiation(channel, buf); default: break; } <START> } catch (IndexOutOfBoundsException error) { <END> LOGGER.warn("Navis NTCB message parsing error", error); } } } return null; }</code><technical_language>do need handle exception</technical_language>

Target:
private Object decodeNtcb(Channel channel, SocketAddress remoteAddress, ByteBuf buf) { prefix = buf.toString(buf.readerIndex(), 4, StandardCharsets.US_ASCII); buf.skipBytes(prefix.length()); serverId = buf.readUnsignedIntLE(); deviceUniqueId = buf.readUnsignedIntLE(); int length = buf.readUnsignedShortLE(); buf.skipBytes(2); if (length == 0) { return null; } String type = buf.toString(buf.readerIndex(), 3, StandardCharsets.US_ASCII); buf.skipBytes(type.length()); if (type.equals("*>S")) { return processHandshake(channel, remoteAddress, buf); } else { DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); if (deviceSession != null) { switch (type) { case "*>A": return processNtcbArray(deviceSession, channel, buf); case "*>T": return processNtcbSingle(deviceSession, channel, buf); case "*>F": buf.skipBytes(3); return processFlexNegotiation(channel, buf); default: break; } } } return null; }
Source:
<code>public void intercept(SimpleInterceptorStack stack) { addRedirectListener(); EntityTransaction transaction = null; try { transaction = entityManager.getTransaction(); transaction.begin(); stack.next(); if (!validator.hasErrors() && transaction.isActive()) { transaction.commit(); <START> } <END> } finally { if (transaction != null && transaction.isActive()) { transaction.rollback(); } } }</code><technical_language>Change commit();</technical_language>

Target:
public void intercept(SimpleInterceptorStack stack) { addRedirectListener(); EntityTransaction transaction = null; try { transaction = entityManager.getTransaction(); transaction.begin(); stack.next(); commit(transaction); } finally { if (transaction != null && transaction.isActive()) { transaction.rollback(); } } }
Source:
<code>public boolean isInteresting(String project, String branch, String topic, List<String> files) { if (compareType.matches(pattern, project)) { for (Branch b : branches) { boolean foundInterestingForbidden = false; boolean foundInterestingTopicOrFile = false; if (b.isInteresting(branch)) { if (forbiddenFilePaths != null) { for (FilePath ffp : forbiddenFilePaths) { if (ffp.isInteresting(files)) { foundInterestingForbidden = true; break; } } } if (isInterestingTopic(topic) && isInterestingFile(files)) { foundInterestingTopicOrFile = true; } if (disableStrictForbiddenFileVerification) { return foundInterestingTopicOrFile; } else { <START> if (foundInterestingForbidden && foundInterestingTopicOrFile) { <END> return false; } if (!foundInterestingForbidden && foundInterestingTopicOrFile) { return true; } } } } } return false; }</code><technical_language>IIUC java if (foundInterestingForbidden) { // a forbidden file a wanted file path. return false; } else if (foundInterestingTopicOrFile) { // DO a forbidden file a wanted file path. return true; } logic easier read</technical_language>

Target:
public boolean isInteresting(String project, String branch, String topic, List<String> files) { if (compareType.matches(pattern, project)) { for (Branch b : branches) { boolean foundInterestingForbidden = false; boolean foundInterestingTopicOrFile = false; if (b.isInteresting(branch)) { if (forbiddenFilePaths != null) { for (FilePath ffp : forbiddenFilePaths) { if (ffp.isInteresting(files)) { foundInterestingForbidden = true; break; } } } if (isInterestingTopic(topic) && isInterestingFile(files)) { foundInterestingTopicOrFile = true; } if (disableStrictForbiddenFileVerification) { return foundInterestingTopicOrFile; } else { if (foundInterestingForbidden) { return false; } else if (foundInterestingTopicOrFile) { return true; } } } } } return false; }
Source:
<code>private void discardEntity(HttpResponse httpResponse, Materializer materializer) { <START> final HttpMessage.DiscardedEntity discarded = httpResponse.discardEntityBytes(materializer); <END> discarded.completionStage() .whenComplete((done, ex) -> log.info("Entity discarded completely!")); }</code><technical_language>Do need discarded temp variable ? call fluently httpResponse.discardEntityBytes(...)</technical_language>

Target:
private void discardEntity(HttpResponse httpResponse, Materializer materializer) { httpResponse.discardEntityBytes(materializer) .completionStage() .whenComplete((done, ex) -> log.info("Entity discarded completely!")); }
Source:
<code>public List<AddOn> getMarketplaceAddOns() { AddOnCollection aoc = this.getLatestVersionInfo(); if (aoc != null) { return aoc.getAddOns(); } <START> return new ArrayList<AddOn>(); <END> }</code><technical_language>Collections.emptyList()</technical_language>

Target:
protected List<AddOn> getMarketplaceAddOns() { AddOnCollection aoc = this.getLatestVersionInfo(); if (aoc != null) { return aoc.getAddOns(); } return Collections.<AddOn>emptyList(); }
Source:
<code>static void pruneParentDirectories(final MantaClient client, final MantaHttpHeaders headers, final String path, final int limit) throws IOException { client.delete(path, headers, null); int actualLimit = limit; if (actualLimit == PRUNE_ALL_PARENTS) { <START> actualLimit = path.split(MantaClient.SEPARATOR).length - 1; <END> } LOG.debug("Actual Number : " + actualLimit + " of directories"); String parent = path; try { for (int i = 0; i < actualLimit; i++) { parent = parent.substring(0, parent.lastIndexOf("/")); client.delete(parent, headers, null); } } catch (MantaClientHttpResponseException responseException) { if (responseException.getServerCode() != MantaErrorCode.DIRECTORY_NOT_EMPTY_ERROR) { throw responseException; } } }</code><technical_language>recommend saving of path.split(MantaClient.SEPARATOR) this check reuse in for loop. Also: this end counting /USER /USER/stor directories well? MantaUtils#writeablePrefixPaths give paths user write (passed-in path)</technical_language>

Target:
static void pruneParentDirectories(final MantaClient client, final MantaHttpHeaders headers, final String path, final int limit) throws IOException { client.delete(path, headers, null); String[] directories = MantaUtils.writeablePrefixPaths(path); ArrayUtils.reverse(directories); directories = ArrayUtils.remove(directories, 0); int actualLimit = limit; if (actualLimit > directories.length || actualLimit == PRUNE_ALL_PARENTS) { actualLimit = directories.length; } for (int i = 0; i < actualLimit; i++) { try { LOG.debug("************ Deleting Index : " + i + " name " + directories[i]); client.delete(directories[i], headers, null); } catch (MantaClientHttpResponseException responseException) { if (responseException.getServerCode().equals(MantaErrorCode.RESOURCE_NOT_FOUND_ERROR)) { continue; } else if (responseException.getServerCode() != MantaErrorCode.DIRECTORY_NOT_EMPTY_ERROR) { throw responseException; } } } }
Source:
<code>public void onBindViewHolder(ProviderViewHolder holder, int position) { final Provider provider = mItems.get(position); if (provider.getPerson().getDisplay() != null) { holder.mName.setText(provider.getPerson().getDisplay()); } if (provider.getIdentifier() != null) { holder.mIdentifier.setText(provider.getIdentifier()); } holder.deleteIv.setOnClickListener(v -> { createDeleteDialogBox(provider); }); holder.editIv.setOnClickListener(v -> { Intent intent = new Intent(fragment.getContext(),AddProviderActivity.class); ArrayList<Provider> providerArrayList = new ArrayList<>(mItems); <START> intent.putExtra(ApplicationConstants.BundleKeys.EXISTING_PROVIDERS_BUNDLE,providerArrayList); <END> intent.putExtra(ApplicationConstants.BundleKeys.PROVIDER_ID_BUNDLE, provider); fragment.startActivityForResult(intent, EDIT_PROVIDER_REQ_CODE); }); }</code><technical_language>Format this file</technical_language>

Target:
public void onBindViewHolder(ProviderViewHolder holder, int position) { final Provider provider = mItems.get(position); if (provider.getPerson().getDisplay() != null) { holder.mName.setText(provider.getPerson().getDisplay()); } if (provider.getIdentifier() != null) { holder.mIdentifier.setText(provider.getIdentifier()); } holder.deleteIv.setOnClickListener(view -> { createDeleteDialogBox(provider); }); holder.editIv.setOnClickListener(view -> { Intent intent = new Intent(fragment.getContext(), AddProviderActivity.class); ArrayList<Provider> providerArrayList = new ArrayList<>(mItems); intent.putExtra(ApplicationConstants.BundleKeys.EXISTING_PROVIDERS_BUNDLE, providerArrayList); intent.putExtra(ApplicationConstants.BundleKeys.PROVIDER_ID_BUNDLE, provider); fragment.startActivityForResult(intent, EDIT_PROVIDER_REQ_CODE); }); }
Source:
<code>public <T> void addTask( ScheduledTask<T> task ) { if ( RunNowSchedule.class.isAssignableFrom( task.getSchedule().getClass() ) ) { return; } synchronized ( applicationConfiguration ) { List<CScheduledTask> tasks = getCurrentConfiguration( true ); CScheduledTask foundTask = findTask( task.getId(), tasks ); CScheduledTask storeableTask = translateFrom( task ); if ( storeableTask != null ) { if ( foundTask != null ) { tasks.remove( foundTask ); storeableTask.setLastRun( foundTask.getLastRun() ); } tasks.add( storeableTask ); <START> } <END> if ( NXCM4979DEBUG ) { logger.info( "Task with ID={} added, config modified.", task.getId(), storeableTask != null ? "IS" : "is NOT", new Exception( "This is an exception only to provide caller backtrace" ) ); } try { applicationConfiguration.saveConfiguration(); } catch ( IOException e ) { logger.warn( "Could not save task changes!", e ); } } }</code><technical_language>relevant non-logging code change ^^^</technical_language>

Target:
public <T> void addTask( ScheduledTask<T> task ) { if ( RunNowSchedule.class.isAssignableFrom( task.getSchedule().getClass() ) ) { return; } synchronized ( applicationConfiguration ) { List<CScheduledTask> tasks = getCurrentConfiguration( true ); CScheduledTask foundTask = findTask( task.getId(), tasks ); CScheduledTask storeableTask = translateFrom( task ); if ( storeableTask != null ) { if ( foundTask != null ) { tasks.remove( foundTask ); storeableTask.setLastRun( foundTask.getLastRun() ); } tasks.add( storeableTask ); } if ( logger.isTraceEnabled() ) { logger.trace( "Task with ID={} added, config modified.", task.getId(), storeableTask != null ? "IS" : "is NOT", new Exception( "This is an exception only to provide caller backtrace" ) ); } try { applicationConfiguration.saveConfiguration(); } catch ( IOException e ) { logger.warn( "Could not save task changes!", e ); } } }
Source:
<code>protected void setHeader() { String degreeRegistrationDiploma = BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.phd.registryDiploma.degreeRegistrationDiploma"); final LocalizedString graduationLevel = getDocumentRequest().getProgramConclusion().getGraduationLevel(); if (!graduationLevel.isEmpty()) { degreeRegistrationDiploma = Joiner.on(" ").join(degreeRegistrationDiploma, <START> BundleUtil.getLocalizedString(Bundle.ACADEMIC, "label.of.both").getContent(getLocale()), <END> graduationLevel.getContent(getLocale())); } addParameter("degreeRegistrationDiploma", degreeRegistrationDiploma); addParameter("portugueseRepublic_1", BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.phd.registryDiploma.portugueseRepublic.part1")); addParameter("portugueseRepublic_2", BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.phd.registryDiploma.portugueseRepublic.part2")); }</code><technical_language>invoke getString variant a specific locale? do need Localized String locale resolution</technical_language>

Target:
protected void setHeader() { String degreeRegistrationDiploma = BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.phd.registryDiploma.degreeRegistrationDiploma"); final LocalizedString graduationLevel = getDocumentRequest().getProgramConclusion().getGraduationLevel(); if (!graduationLevel.isEmpty()) { degreeRegistrationDiploma = Joiner.on(" ").join(degreeRegistrationDiploma, BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.of.both"), graduationLevel.getContent(getLocale())); } addParameter("degreeRegistrationDiploma", degreeRegistrationDiploma); addParameter("portugueseRepublic_1", BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.phd.registryDiploma.portugueseRepublic.part1")); addParameter("portugueseRepublic_2", BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.phd.registryDiploma.portugueseRepublic.part2")); }
Source:
<code>public void testGetUrlAsString() throws Exception { String md5 = IOUtils.getUrlAsString(file2url(getTestResource("test-jar-1.0.zip.md5"))); <START> assertNotNull(md5); <END> if (md5.length() == 34) assertEquals(md5, "beec1608cf997d3acb42f0ab772b143f\r\n"); else assertEquals(md5, "beec1608cf997d3acb42f0ab772b143f\n"); }</code><technical_language>String.trim() MD5 values compare instead</technical_language>

Target:
public void testGetUrlAsString() throws Exception { String md5 = IOUtils.getUrlAsString(file2url(getTestResource("test-jar-1.0.zip.md5"))); assertNotNull(md5); assertEquals(md5.trim(), "beec1608cf997d3acb42f0ab772b143f"); }
Source:
<code>public String toString() { <START> return new String(b, CHARSET); <END> }</code><technical_language>a concern this. cache string too</technical_language>

Target:
public String toString() { if (s == null) { s = new String(b, CHARSET); } return s; }
Source:
<code>public void testRefLocation() throws Exception { File repository = new File(verifier.getBasedir(), "target/repository"); assertThat(new File(repository, "content.xml.xz"), isFile()); assertThat(new File(repository, "artifacts.xml.xz"), isFile()); assertThat(new File(repository, "p2.index"), isFile()); <START> assertThat(new File(repository, "category.xml"), isFile()); <END> }</code><technical_language>able org.eclipse.tycho.p2.tools.impl.Activator.createProvisioningAgent(tmpDir).getService(IMetadataRepositoryManager.SERVICE_NAME).loadRepository(repository, new NullProgressMonitor()).getReferences() check repository references properly added</technical_language>

Target:
public void testRefLocation() throws Exception { File repository = new File(verifier.getBasedir(), "target/repository"); assertThat(new File(repository, "content.xml"), isFile()); File artifactXml = new File(repository, "artifacts.xml"); assertThat(artifactXml, isFile()); assertThat(new File(repository, "category.xml"), isFile()); Map<String, String> expected = new HashMap<>(3, 1.f); expected.put("p2.statsURI", "<LINK_0>"); expected.put("p2.mirrorsURL", "<LINK_0>.else"); expected.put("foo", "bar"); Document artifactsDocument = XMLParser.parse(artifactXml); artifactsDocument.getChild("repository").getChild("properties").getChildren("property").forEach(element -> { String propertyName = element.getAttributeValue("name"); if (expected.containsKey(propertyName) && expected.get(propertyName).equals(element.getAttributeValue("value"))) { expected.remove(propertyName); } }); assertEquals("Missing properties in artifact repository", Collections.emptyMap(), expected); }
Source:
<code>protected AbstractGraphDecorator(Graph g) { if (g == null) { <START> throw new NullPointerException("g may not be null."); <END> } this.inner = g; }</code><technical_language>Minor suggestion change this exception to: throw new IllegalArgumentException("g null.");</technical_language>

Target:
protected AbstractGraphDecorator(Graph g) { if (g == null) { throw new IllegalArgumentException("g may not be null."); } this.inner = g; }
Source:
<code>public void selectVideosOnly() { <START> filterVideos.click(); <END> }</code><technical_language>log()</technical_language>

Target:
public void selectVideosOnly() { filterVideos.click(); PageObjectLogging.log("selectVideosOnly", "Videos option is selected", true, driver); }
Source:
<code>public void buildListOfRowKeyColumnExpressionsSingleNodeComparisonTest() throws Exception { List<Expression> expressions = new ArrayList<>(); RowKeyColumnExpression rvc1 = new RowKeyColumnExpression(); <START> RowKeyColumnExpression rvc2 = new RowKeyColumnExpression(); <END> ComparisonExpression expression1 = mock(ComparisonExpression.class); Mockito.when(expression1.getChildren()).thenReturn(Lists.<Expression>newArrayList(rvc1)); List<RowKeyColumnExpression> result = offsetCompiler.buildListOfRowKeyColumnExpressions(expression1, false); assertEquals(1,result.size()); assertEquals(rvc1,result.get(0)); }</code><technical_language>nit: remove unused expression rvc2</technical_language>

Target:
public void buildListOfRowKeyColumnExpressionsSingleNodeComparisonTest() throws Exception { List<Expression> expressions = new ArrayList<>(); RowKeyColumnExpression rvc = new RowKeyColumnExpression(); ComparisonExpression expression = mock(ComparisonExpression.class); Mockito.when(expression.getChildren()).thenReturn(Lists.<Expression>newArrayList(rvc)); List<RowKeyColumnExpression> result = offsetCompiler.buildListOfRowKeyColumnExpressions(expression, false); assertEquals(1,result.size()); assertEquals(rvc,result.get(0)); }
Source:
<code>ExpressionOrColumn(int aIndexEntryNumber, StmtTableScan tableScan, AbstractExpression expr, SortDirectionType sortDir, ColumnRef colRef) { assert (expr == null) == (colRef != null); <START> assert colRef == null || tableScan != null; <END> m_expr = expr; m_colRef = colRef; m_indexKeyComponentPosition = aIndexEntryNumber; m_tableScan = tableScan; m_sortDirection = sortDir; }</code><technical_language>IllegalArgumentException assert argument checking asserts normal run time</technical_language>

Target:
ExpressionOrColumn(int aIndexEntryNumber, StmtTableScan tableScan, AbstractExpression expr, SortDirectionType sortDir, ColumnRef colRef) { Preconditions.checkArgument((expr == null) == (colRef != null), "Exactly one of argument expr or colRef must be null."); Preconditions.checkArgument(colRef == null || tableScan != null, "When argument colRef is null, tableScan cannot be null."); m_expr = expr; m_colRef = colRef; m_indexKeyComponentPosition = aIndexEntryNumber; m_tableScan = tableScan; m_sortDirection = sortDir; }
Source:
<code>public boolean createIndex(String indexName) { Assert.notNull(indexName, "No index defined for Query"); try { CreateIndexRequest indexRequest = createIndexRequest(indexName); <START> return client.indices().create(indexRequest, RequestOptions.DEFAULT).isAcknowledged(); <END> } catch (Exception e) { throw new ElasticsearchException("Failed to create index " + indexName, e); } }</code><technical_language>extraction a variable? I inlined: return client.indices().create(createIndexRequest(indexName), RequestOptions.DEFAULT).isAcknowledged();</technical_language>

Target:
public boolean createIndex(String indexName) { Assert.notNull(indexName, "No index defined for Query"); try { return client.indices().create(createIndexRequest(indexName), RequestOptions.DEFAULT).isAcknowledged(); } catch (Exception e) { throw new ElasticsearchException("Failed to create index " + indexName, e); } }
Source:
<code>public String[] collect(int relativeDocId) { sortedSetDocValues.setDocument( relativeDocId ); int valueCount = safeLongToInt( sortedSetDocValues.getValueCount() ); String[] values = new String[valueCount]; BytesRef bytesRef = new BytesRef(); for ( int i = 0; i < valueCount; i++ ) { long ordinal = sortedSetDocValues.nextOrd(); if ( ordinal == SortedSetDocValues.NO_MORE_ORDS ) { <START> break; <END> } sortedSetDocValues.lookupOrd( ordinal, bytesRef ); values[i] = bytesRef.utf8ToString(); } return values; }</code><technical_language>of this _break_ returned String[] array un-initialized values. reasonable return a trimmed copy? ArrayList instead</technical_language>

Target:
public String[] collect(int relativeDocId) { sortedSetDocValues.setDocument( relativeDocId ); int valueCount = safeLongToInt( sortedSetDocValues.getValueCount() ); String[] values = new String[valueCount]; BytesRef bytesRef = new BytesRef(); int i; for ( i = 0; i < valueCount; i++ ) { long ordinal = sortedSetDocValues.nextOrd(); if ( ordinal == SortedSetDocValues.NO_MORE_ORDS ) { break; } sortedSetDocValues.lookupOrd( ordinal, bytesRef ); values[i] = bytesRef.utf8ToString(); } return Arrays.copyOf( values, i ); }
Source:
<code><START> public WriteAttributesRequest(String path, ObserveSpec observeSpec) { <END> this(newPath(path), new AttributeSet(observeSpec.toQueryParams())); }</code><technical_language>I remove this. in another PR/commit. Do remove throws InvalidRequestException</technical_language>

Target:
public WriteAttributesRequest(String path, ObserveSpec observeSpec) throws InvalidRequestException { this(newPath(path), new AttributeSet(observeSpec.toQueryParams())); }
Source:
<code>public static String getCurveName(String curveOid) { switch (curveOid) { case "1.2.840.10045.3.1.7": return "nistp256"; case "1.3.132.0.34": return "nistp384"; case "1.3.132.0.35": return "nistp521"; ENDED curves case "1.3.132.0.1": return "1.3.132.0.1"; case "1.2.840.10045.3.1.1": return "1.2.840.10045.3.1.1"; case "1.3.132.0.33": return "1.3.132.0.33"; case "1.3.132.0.26": return "1.3.132.0.26"; case "1.3.132.0.27": return "1.3.132.0.27"; case "1.3.132.0.16": return "1.3.132.0.16"; case "1.3.132.0.36": return "1.3.132.0.36"; case "1.3.132.0.37": return "1.3.132.0.37"; case "1.3.132.0.38": return "1.3.132.0.38"; default: <START> return null; <END> } }</code><technical_language>this invariably lead a NullPointerException, it</technical_language>

Target:
public static String getCurveName(String curveOid) throws NoSuchAlgorithmException { switch (curveOid) { case "1.2.840.10045.3.1.7": return "nistp256"; case "1.3.132.0.34": return "nistp384"; case "1.3.132.0.35": return "nistp521"; ENDED curves case "1.3.132.0.1": return "1.3.132.0.1"; case "1.2.840.10045.3.1.1": return "1.2.840.10045.3.1.1"; case "1.3.132.0.33": return "1.3.132.0.33"; case "1.3.132.0.26": return "1.3.132.0.26"; case "1.3.132.0.27": return "1.3.132.0.27"; case "1.3.132.0.16": return "1.3.132.0.16"; case "1.3.132.0.36": return "1.3.132.0.36"; case "1.3.132.0.37": return "1.3.132.0.37"; case "1.3.132.0.38": return "1.3.132.0.38"; default: throw new NoSuchAlgorithmException("Can't translate curve OID to SSH curve identifier"); } }
Source:
<code>public void launch(List<ModuleLaunchRequest> moduleLaunchRequests, boolean aggregate) { <START> this.launch(moduleLaunchRequests, aggregate, null); <END> }</code><technical_language>empty map instead</technical_language>

Target:
public void launch(List<ModuleLaunchRequest> moduleLaunchRequests, boolean aggregate) { this.launch(moduleLaunchRequests, aggregate, Collections.EMPTY_MAP); }
Source:
<code>public Map<DatasetField,String> getDisplayValueMap() { Map<DatasetField, String> fieldMap = new LinkedHashMap<>(); boolean fixTrailingComma = false; for (DatasetField childDatasetField : childDatasetFields) { fixTrailingComma = false; if (!StringUtils.isBlank(childDatasetField.getValue()) && !DatasetField.NA_VALUE.equals(childDatasetField.getValue())) { String format = childDatasetField.getDatasetFieldType().getDisplayFormat(); if (StringUtils.isBlank(format)) { format = "#VALUE"; } String sanitizedValue = childDatasetField.getDatasetFieldType().isSanitizeHtml() ? MarkupChecker.sanitizeBasicHTML(childDatasetField.getValue()) : childDatasetField.getValue(); if (!childDatasetField.getDatasetFieldType().isSanitizeHtml() && childDatasetField.getDatasetFieldType().isEscapeOutputText()){ sanitizedValue = MarkupChecker.stripAllTags(sanitizedValue); } if (format.equals("#VALUE, ")) fixTrailingComma = true; String displayValue = format .replace("#NAME", childDatasetField.getDatasetFieldType().getTitle()) .replace("#EMAIL", BundleUtil.getStringFromBundle("dataset.email.hiddenMessage")) .replace("#VALUE", sanitizedValue ); if(childDatasetField.getDatasetFieldType().getName().equals("country")){ <START> System.out.print(displayValue); <END> } fieldMap.put(childDatasetField,displayValue); } } if (fixTrailingComma) { return (removeLastComma(fieldMap)); } return fieldMap; }</code><technical_language>remove this debug line</technical_language>

Target:
public Map<DatasetField,String> getDisplayValueMap() { Map<DatasetField, String> fieldMap = new LinkedHashMap<>(); boolean fixTrailingComma = false; for (DatasetField childDatasetField : childDatasetFields) { fixTrailingComma = false; if (!StringUtils.isBlank(childDatasetField.getValue()) && !DatasetField.NA_VALUE.equals(childDatasetField.getValue())) { String format = childDatasetField.getDatasetFieldType().getDisplayFormat(); if (StringUtils.isBlank(format)) { format = "#VALUE"; } String sanitizedValue = childDatasetField.getDatasetFieldType().isSanitizeHtml() ? MarkupChecker.sanitizeBasicHTML(childDatasetField.getValue()) : childDatasetField.getValue(); if (!childDatasetField.getDatasetFieldType().isSanitizeHtml() && childDatasetField.getDatasetFieldType().isEscapeOutputText()){ sanitizedValue = MarkupChecker.stripAllTags(sanitizedValue); } if (format.equals("#VALUE, ")) fixTrailingComma = true; String displayValue = format .replace("#NAME", childDatasetField.getDatasetFieldType().getTitle()) .replace("#EMAIL", BundleUtil.getStringFromBundle("dataset.email.hiddenMessage")) .replace("#VALUE", sanitizedValue ); fieldMap.put(childDatasetField,displayValue); } } if (fixTrailingComma) { return (removeLastComma(fieldMap)); } return fieldMap; }
Source:
<code>private Mono<AmqpSendLink> getSendLink() { return connectionProcessor .flatMap(connection -> { String linkName = entityName; if (!CoreUtils.isNullOrEmpty(viaEntityName)) { <START> linkName = String.format("VIA-%s", viaEntityName); <END> } return connection.createSendLink(linkName, entityName, viaEntityName, retryOptions); }) .doOnNext(next -> linkName.compareAndSet(null, next.getLinkName())); }</code><technical_language>Do need do a string format? append it</technical_language>

Target:
private Mono<AmqpSendLink> getSendLink() { return connectionProcessor .flatMap(connection -> { if (!CoreUtils.isNullOrEmpty(viaEntityName)) { return connection.createSendLink("VIA-".concat(viaEntityName), viaEntityName, retryOptions, entityName); } else { return connection.createSendLink(entityName, entityName, retryOptions, null); } }) .doOnNext(next -> linkName.compareAndSet(null, next.getLinkName())); }
Source:
<code>private CompositeJobParametersValidator compositeJobParametersValidator() { <START> List<JobParametersValidator> jobParametersValidators = new ArrayList<>(Arrays.asList( <END> new VepPathValidator(), new VepCacheVersionValidator(), new VepCachePathValidator(), new VepCacheSpeciesValidator(), new InputFastaValidator(), new VepNumForksValidator(), new OutputDirAnnotationValidator(), new InputVcfIdValidator() )); if (isStudyIdRequired) { jobParametersValidators.add(new InputStudyIdValidator()); } CompositeJobParametersValidator compositeJobParametersValidator = new CompositeJobParametersValidator(); compositeJobParametersValidator.setValidators(jobParametersValidators); return compositeJobParametersValidator; }</code><technical_language>Instead of 2 "wrapping collections" use: java Collections.addAll(new ArrayList<>(), new VepPathValidator(), new VepCacheVersionValidator(), ... )</technical_language>

Target:
private CompositeJobParametersValidator compositeJobParametersValidator() { List<JobParametersValidator> jobParametersValidators = new ArrayList<>(); Collections.addAll(jobParametersValidators, new VepPathValidator(), new VepCacheVersionValidator(), new VepCachePathValidator(), new VepCacheSpeciesValidator(), new InputFastaValidator(), new VepNumForksValidator(), new OutputDirAnnotationValidator() ); if (isStudyIdRequired) { jobParametersValidators.add(new InputStudyIdValidator()); jobParametersValidators.add(new InputVcfIdValidator()); } CompositeJobParametersValidator compositeJobParametersValidator = new CompositeJobParametersValidator(); compositeJobParametersValidator.setValidators(jobParametersValidators); return compositeJobParametersValidator; }
Source:
<code>public HostData() { try { this.hostName = java.net.InetAddress.getLocalHost().getHostName(); this.hostAddress = java.net.InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { setHostName("unknown-host"); <START> } <END> }</code><technical_language>is ok, a bit strange direct access is (this.hostName = ) in catch is set setter (setHostName("unknown-host"); )</technical_language>

Target:
public HostData() { try { setHostName(java.net.InetAddress.getLocalHost().getHostName()); setHostAddress(java.net.InetAddress.getLocalHost().getHostAddress()); } catch (UnknownHostException e) { setHostName("unknown-host"); } }
Source:
<code><START> public Optional<InsightCard.Category> selectMarketingInsightToGenerate(final Long accountId, final DateTime currentTime) { <END> final Optional<MarketingInsightsSeen> marketingInsightsSeenOptional = marketingInsightsSeenDAODynamoDB.getSeenCategories(accountId); if (marketingInsightsSeenOptional.isPresent()) { return selectMarketingInsightToGenerate(currentTime, marketingInsightsSeenOptional.get().seenCategories, random); } return selectMarketingInsightToGenerate(currentTime, new HashSet<InsightCard.Category>(), random); }</code><technical_language>methods name "selectMarketingInsightToGenerate" share name. do things. a function call this "oh, recursive"</technical_language>

Target:
private Optional<InsightCard.Category> selectMarketingInsightToGenerate(final Long accountId, final DateTime currentTime) { final Optional<MarketingInsightsSeen> marketingInsightsSeenOptional = marketingInsightsSeenDAODynamoDB.getSeenCategories(accountId); if (marketingInsightsSeenOptional.isPresent()) { return selectMarketingInsightToGenerate(currentTime, marketingInsightsSeenOptional.get().seenCategories, RANDOM); } return selectMarketingInsightToGenerate(currentTime, new HashSet<InsightCard.Category>(), RANDOM); }
Source:
<code>public boolean filter(List<?> filters) { if (filters == null) { <START> return true; <END> } fLock.lock(); try { cancelOngoingRequests(); List<FilterCriteria> list = (List<FilterCriteria>)filters; fFilterCriteria = new ArrayList<FilterCriteria>(list); fillCurrentPage(fEvents); } finally { fLock.unlock(); } return true; }</code><technical_language>page update if filters previously active</technical_language>

Target:
public boolean filter(List<?> filters) { fLock.lock(); try { cancelOngoingRequests(); if (filters == null) { fFilterCriteria = new ArrayList<FilterCriteria>(); } else { List<FilterCriteria> list = (List<FilterCriteria>)filters; fFilterCriteria = new ArrayList<FilterCriteria>(list); } fillCurrentPage(fEvents); } finally { fLock.unlock(); } return true; }
Source:
<code>public ResourceDescriptor addAttributes(Collection<AttributeDefinition> attributes) { for (AttributeDefinition attribute : attributes) { <START> this.addAttributes(new Attribute() { <END> @Override public AttributeDefinition getDefinition() { return attribute; } }); } return this; }</code><technical_language>reason wrap AttributeDefinition. Add this.attributes collection</technical_language>

Target:
public ResourceDescriptor addAttributes(Collection<AttributeDefinition> attributes) { this.attributes.addAll(attributes); return this; }
Source:
<code>public void shouldParseUUID() throws Exception { SurefireMasterProcessChannelProcessorFactory factory = new SurefireMasterProcessChannelProcessorFactory(); UUID uuid = UUID.randomUUID(); <START> URI uri = new URI( "tcp://127.0.0.1:12345?auth=" + uuid ); <END> UUID parsed = invokeMethod( factory, "parseAuth", uri ); assertThat( parsed ) .isEqualTo( uuid ); }</code><technical_language>IP address here</technical_language>

Target:
public void shouldParseUUID() throws Exception { UUID uuid = UUID.randomUUID(); URI uri = new URI( "tcp://localhost:12345?sessionId=" + uuid ); String parsed = invokeMethod( SurefireMasterProcessChannelProcessorFactory.class, "extractSessionId", uri ); assertThat( parsed ) .isEqualTo( uuid.toString() ); }
Source:
<code>public RegexMessageParser(SecorConfig config) { super(config); String patStr = config.getMessageTimestampInputPattern(); <START> LOG.info("timestamp pattern: " + patStr); <END> tsPattern = Pattern.compile(patStr); }</code><technical_language>on, lets standardize logging format avoids string concatenation overhead if logging is disabled: LOG.info("timestamp pattern: {}", patStr);</technical_language>

Target:
public RegexMessageParser(SecorConfig config) { super(config); String patStr = config.getMessageTimestampInputPattern(); LOG.info("timestamp pattern: {}", patStr); mTsPattern = Pattern.compile(patStr); }
Source:
<code>public boolean isOpen() { boolean result = true; try { service.getToken(); <START> } catch (Throwable t) { <END> result = false; } return result; }</code><technical_language>Minor: code conventions typically favor this style: try { ... } catch (Throwable t) { ... }</technical_language>

Target:
public boolean isOpen() { boolean result = true; try { service.getApplications(); } catch (Throwable t) { result = false; } return result; }
Source:
<code>public void testConflictsDetected() { waitForClusterToForm(CACHE_NAME); IntStream.range(0, NUMBER_OF_CACHE_ENTRIES).forEach(i -> getCache(0).put(i, "v" + i)); final int cacheIndex = numMembersInCluster - 1; assertEquals(0, getConflicts(cacheIndex).count()); introduceCacheConflicts(); List<Map<Address, InternalCacheEntry<Object, Object>>> conflicts = getConflicts(cacheIndex).collect(Collectors.toList()); assertEquals(INCONSISTENT_VALUE_INCREMENT, conflicts.size()); for (Map<Address, InternalCacheEntry<Object, Object>> map : conflicts) { assertEquals(NUMBER_OF_OWNERS, map.keySet().size()); Collection<InternalCacheEntry<Object, Object>> mapValues = map.values(); <START> int key = (Integer) mapValues.stream().findAny().orElse(new NullValueEntry(-1)).getKey(); <END> assertTrue(key > -1); if (key % NULL_VALUE_FREQUENCY == 0) { assertTrue(map.values().stream().anyMatch(entry -> entry instanceof NullValueEntry)); } else { List<Object> icvs = map.values().stream().map(InternalCacheEntry::getValue).distinct().collect(Collectors.toList()); assertEquals(NUMBER_OF_OWNERS, icvs.size()); assertTrue("Expected one of the conflicting string values to be 'INCONSISTENT'", icvs.contains("INCONSISTENT")); } } }</code><technical_language>mapValues.stream().mapToInt(Map.Entry::getKey).findAny().orElse(-1)</technical_language>

Target:
public void testConflictsDetected() { waitForClusterToForm(CACHE_NAME); IntStream.range(0, NUMBER_OF_CACHE_ENTRIES).forEach(i -> getCache(0).put(i, "v" + i)); final int cacheIndex = numMembersInCluster - 1; assertEquals(0, getConflicts(cacheIndex).count()); introduceCacheConflicts(); List<Map<Address, CacheEntry<Object, Object>>> conflicts = getConflicts(cacheIndex).collect(Collectors.toList()); assertEquals(INCONSISTENT_VALUE_INCREMENT, conflicts.size()); for (Map<Address, CacheEntry<Object, Object>> map : conflicts) { assertEquals(NUMBER_OF_OWNERS, map.keySet().size()); Collection<CacheEntry<Object, Object>> mapValues = map.values(); int key = mapValues.stream().filter(e -> !(e instanceof NullCacheEntry)).mapToInt(e -> (Integer) e.getKey()).findAny().orElse(-1); assertTrue(key > -1); if (key % NULL_VALUE_FREQUENCY == 0) { assertTrue(map.values().stream().anyMatch(NullCacheEntry.class::isInstance)); } else { List<Object> icvs = map.values().stream().map(CacheEntry::getValue).distinct().collect(Collectors.toList()); assertEquals(NUMBER_OF_OWNERS, icvs.size()); assertTrue("Expected one of the conflicting string values to be 'INCONSISTENT'", icvs.contains("INCONSISTENT")); } } }