auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testEqualsIgnoreValueOrder_sameLengthSameValues() { MultivaluedHashMap map = new MultivaluedHashMap(); MultivaluedHashMap equalMap = new MultivaluedHashMap(); map.put(1, Arrays.asList(new Integer[]{1, 2, 3})); equalMap.put(1, Arrays.asList(new Integer[]{3, 2, 1})); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put(2, Arrays.asList(new Integer[]{4, 5, 6})); equalMap.put(2, Arrays.asList(new Integer[]{5, 6, 4})); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); <START> map.put("c", Arrays.asList(new String[]{"x", "y", "z"})); <END> equalMap.put("c", Arrays.asList(new String[]{"z", "x", "y"})); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.clear(); map.put(1, Arrays.asList(new Integer[]{1, 2, 3, 4, 5})); map.put(2, Arrays.asList(new Integer[]{4, 5, 6, 7, 8})); equalMap.clear(); equalMap.put(1, Arrays.asList(new Integer[]{4, 3, 2, 6, 1})); equalMap.put(2, Arrays.asList(new Integer[]{6, 7, 4, 8, 5})); equalsIgnoreValueOrder_shouldReturnFalseForDifferentMaps(map, equalMap); }</code><technical_language>This is false mitigated this test : map initialized if a MultivaluedHashMap<Integer, Integer>... is if a MultivaluedHashMap<String, String>. Mixing types is object created for is considered error... Ideally, MultivaluedHashMap mixed type content types provided declaration... here, is for test purpose</technical_language>

Target:
public void testEqualsIgnoreValueOrder_sameLengthSameValues() { MultivaluedHashMap<Integer, Integer> map = new MultivaluedHashMap<>(); MultivaluedHashMap<Integer, Integer> equalMap = new MultivaluedHashMap<>(); map.put(1, Arrays.asList(1, 2, 3)); equalMap.put(1, Arrays.asList(3, 2, 1)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put(2, Arrays.asList(4, 5, 6)); equalMap.put(2, Arrays.asList(5, 6, 4)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put(3, Arrays.asList(7, 8, 9)); equalMap.put(3, Arrays.asList(9, 7, 8)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.clear(); equalMap.clear(); map.put(1, Arrays.asList(1, 2, 3, 4, 5)); map.put(2, Arrays.asList(4, 5, 6, 7, 8)); equalMap.put(1, Arrays.asList(4, 3, 2, 5, 1)); equalMap.put(2, Arrays.asList(6, 7, 4, 8, 5)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); }
Source:
<code>public void addAll(List<T> entity) { LOG.debug("added search result"); this.getContainerDataSource().removeAllItems(); <START> entity.stream().forEach(item -> this.getContainerDataSource().addItem(item)); <END> }</code><technical_language>entities.forEach(getContainerdataSource()::addItem);</technical_language>

Target:
public void addAll(List<T> entity) { getContainerDataSource().removeAllItems(); entity.forEach(getContainerDataSource()::addItem); }
Source:
<code>private void formatDiff(@NonNull DiffEditorInput input) { IRepositoryCommit commit = input.getTip(); if (commit instanceof RepositoryCommit) { RepositoryCommit repoCommit = (RepositoryCommit) commit; if (!repoCommit.isStash() && repoCommit.getRevCommit().getParentCount() > 1) { input.setDocument(new Document()); setInput(input); return; } } IRepositoryCommit base = input.getBase(); <START> Job job = <END> new Job(UIText.DiffEditor_TaskGeneratingDiff) { @Override protected IStatus run(IProgressMonitor monitor) { FileDiff diffs[] = getDiffs(commit, base); DiffDocument document = new DiffDocument(); try (DiffRegionFormatter formatter = new DiffRegionFormatter( document)) { SubMonitor progress = SubMonitor.convert(monitor, diffs.length); for (FileDiff diff : diffs) { if (progress.isCanceled()) { break; } progress.subTask(diff.getPath()); try { formatter.write(diff); } catch (IOException ignore) { } progress.worked(1); } document.connect(formatter); } new UIJob(UIText.DiffEditor_TaskUpdatingViewer) { @Override public IStatus runInUIThread(IProgressMonitor uiMonitor) { if (UIUtils .isUsable(getSourceViewer().getTextWidget())) { input.setDocument(document); setInput(input); } return Status.OK_STATUS; } }.schedule(); return Status.OK_STATUS; } }; job.schedule(); }</code><technical_language>mind making job(s) belonging some of predefined families? I it, jobs show icon coming from</technical_language>

Target:
private void formatDiff(@NonNull DiffEditorInput input) { IRepositoryCommit commit = input.getTip(); if (commit instanceof RepositoryCommit) { RepositoryCommit repoCommit = (RepositoryCommit) commit; if (!repoCommit.isStash() && repoCommit.getRevCommit().getParentCount() > 1) { input.setDocument(new Document()); setInput(input); return; } } IRepositoryCommit base = input.getBase(); Job job = new Job(UIText.DiffEditor_TaskGeneratingDiff) { @Override protected IStatus run(IProgressMonitor monitor) { FileDiff diffs[] = getDiffs(commit, base); DiffDocument document = new DiffDocument(); try (DiffRegionFormatter formatter = new DiffRegionFormatter( document)) { SubMonitor progress = SubMonitor.convert(monitor, diffs.length); for (FileDiff diff : diffs) { if (progress.isCanceled()) { break; } progress.subTask(diff.getPath()); try { formatter.write(diff); } catch (IOException ignore) { } progress.worked(1); } document.connect(formatter); } new UIJob(UIText.DiffEditor_TaskUpdatingViewer) { @Override public IStatus runInUIThread(IProgressMonitor uiMonitor) { if (UIUtils .isUsable(getSourceViewer().getTextWidget())) { input.setDocument(document); setInput(input); } return Status.OK_STATUS; } }.schedule(); return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { return JobFamilies.DIFF == family || super.belongsTo(family); } }; job.schedule(); }
Source:
<code>private List<ExtensionProxy> getExtensions() { <START> return ExtensionsManager.getInstance().getProvidedExtensions(LOGGER_SERVICE); <END> }</code><technical_language>cache this</technical_language>

Target:
private List<ExtensionProxy> getExtensions() { if (extensions == null) { extensions = ExtensionsManager.getInstance().getProvidedExtensions(LOGGER_SERVICE); } return extensions; }
Source:
<code>public void error( String message, Object... params ) { <START> logger.error(new I18n(message), params); <END> }</code><technical_language>suggest wrapping of methods "if (logger.isErrorEnabled() )" blocks (or equivalently-named method for log level) create a new I18n instance logging is enabled</technical_language>

Target:
public void error( String message, Object... params ) { if (logger.isErrorEnabled()) { logger.error(new I18n(message), params); } }
Source:
<code>private void internalMerge(SegmentStoreStatistics other) { long min = fMin.getLength(); long max = fMax.getLength(); fMin = min <= other.getMin() ? fMin : other.getMinSegment(); fMax = max >= other.getMax() ? fMax : other.getMaxSegment(); long oldNbSeg = fNbSegments; double oldAverage = fAverage; long otherSegments = other.getNbSegments(); fNbSegments += otherSegments; fTotal += other.getTotal(); fAverage = ((oldNbSeg * oldAverage) + (other.getAverage() * otherSegments)) / fNbSegments; double avg1Sq = oldAverage * oldAverage; double avg2sq = other.getAverage() * other.getAverage(); double avgtSq = fAverage * fAverage; <START> double variance1 = fVariance / (oldNbSeg - 1); <END> double variance2 = other.fVariance / (otherSegments - 1); fVariance = ((variance1 + avg1Sq - avgtSq) * (oldNbSeg - 1) + (variance2 + avg2sq - avgtSq) * (otherSegments - 1)); }</code><technical_language>do -1 below</technical_language>

Target:
private void internalMerge(SegmentStoreStatistics other) { long min = fMin.getLength(); long max = fMax.getLength(); fMin = min <= other.getMin() ? fMin : other.getMinSegment(); fMax = max >= other.getMax() ? fMax : other.getMaxSegment(); long oldNbSeg = fNbSegments; double oldAverage = fAverage; long otherSegments = other.getNbSegments(); double otherAverage = other.getAverage(); fNbSegments += otherSegments; fTotal += other.getTotal(); fAverage = ((oldNbSeg * oldAverage) + (otherAverage * otherSegments)) / fNbSegments; double avg1Sq = oldAverage * oldAverage; double avg2sq = otherAverage * otherAverage; double avgtSq = fAverage * fAverage; double variance1 = fVariance / (oldNbSeg - 1); double variance2 = other.fVariance / (otherSegments - 1); fVariance = ((variance1 + avg1Sq - avgtSq) * (oldNbSeg - 1) + (variance2 + avg2sq - avgtSq) * (otherSegments - 1)); }
Source:
<code>public void nameMangling_2_folder_reload() throws Exception { r.addStep(new Statement() { @Override public void evaluate() throws Throwable { <START> OrganizationFolder foo = (OrganizationFolder) r.j.jenkins.getItem("foo"); <END> foo.doReload(); assertDataMigrated(foo); } }); r.addStep(new Statement() { @Override public void evaluate() throws Throwable { TopLevelItem foo = r.j.jenkins.getItem("foo"); assertDataMigrated(foo); } }); }</code><technical_language>getItemByFullName takes a type param</technical_language>

Target:
public void nameMangling_2_folder_reload() throws Exception { r.addStep(new Statement() { @Override public void evaluate() throws Throwable { OrganizationFolder foo = r.j.jenkins.getItemByFullName("foo", OrganizationFolder.class); foo.doReload(); assertDataMigrated(foo); } }); r.addStep(new Statement() { @Override public void evaluate() throws Throwable { TopLevelItem foo = r.j.jenkins.getItem("foo"); assertDataMigrated(foo); } }); }
Source:
<code>public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { if (HttpResponseCodes.SC_BAD_REQUEST == responseContext.getStatus()) { Object entity = responseContext.getEntity(); if (entity != null && entity instanceof String) { <START> String tmpEscapedMsg = StringEscapeUtils.escapeXml((String) entity); <END> String escapedMsg = tmpEscapedMsg.replaceAll("/", "&#x2F;"); responseContext.setEntity(escapedMsg); } } }</code><technical_language>a minor (performance) concern here. StringEscapeUtils code, in case of xml escape, ends done is a 5 chars replacement (double-quote, ampersand, less-than, greater-than, xml apostrophe). entity string is scanned linearly. String#replaceAll for slash replacement, builds a pattern, matches replaces. manually create Pattern, provide a regexp matching 6 chars perform replacement that? Alternatively, do linear string scan in code replace 6 chars in pass</technical_language>

Target:
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { if (HttpResponseCodes.SC_BAD_REQUEST == responseContext.getStatus()) { Object entity = responseContext.getEntity(); if (entity != null && entity instanceof String) { String escapedMsg = escapeXml((String) entity); responseContext.setEntity(escapedMsg); } } }
Source:
<code>private final void checkExpectedProviders(MultiFallbackProvider subject, Class<? extends LocationProvider>... expectedProviders) { Collection<LocationProvider> providers = subject.getProviders(); assertEquals(expectedProviders.length, providers.size()); int i = 0; <START> for (LocationProvider provider : providers) { <END> Class<? extends LocationProvider> expected = expectedProviders[i]; assertTrue("provider instance class " + provider.getClass().getName() + " does not " + "match expected value " + expected.getName(), provider.getClass() .isAssignableFrom(expected)); i++; } }</code><technical_language>a fori loop here, need index anyway</technical_language>

Target:
private final void checkExpectedProviders(MultiFallbackProvider subject, Class<? extends LocationProvider>... expectedProviders) { Collection<LocationProvider> providers = subject.getProviders(); assertEquals(expectedProviders.length, providers.size()); Iterator<LocationProvider> providerIt = providers.iterator(); for (int i = 0; i < expectedProviders.length; i++) { Class<? extends LocationProvider> expected = expectedProviders[i]; if (!providerIt.hasNext()) { fail("providers list did not have expected value " + expected.getName()); } LocationProvider actual = providerIt.next(); assertTrue("provider instance class " + actual.getClass().getName() + " does not " + "match expected value " + expected.getName(), actual.getClass() .isAssignableFrom(expected)); } }
Source:
<code>public <R, C extends ServiceConfiguration<?, R>> CacheConfigurationBuilder<K, V> updateServices(Class<C> clazz, UnaryOperator<R> update) { Collection<? extends ServiceConfiguration<?, R>> existing = getServices(clazz); if (existing.isEmpty()) { <START> throw new IllegalStateException("Cannot updates service configurations. No services exist"); <END> } else { CacheConfigurationBuilder<K, V> otherBuilder = withoutServices(clazz); for (ServiceConfiguration<?, R> configuration : existing) { otherBuilder = otherBuilder.withService(configuration.build(update.apply(configuration.derive()))); } return otherBuilder; } }</code><technical_language>"update__s__"</technical_language>

Target:
public <R, C extends ServiceConfiguration<?, R>> CacheConfigurationBuilder<K, V> updateServices(Class<C> clazz, UnaryOperator<R> update) { Collection<? extends ServiceConfiguration<?, R>> existing = getServices(clazz); if (existing.isEmpty()) { throw new IllegalStateException("Cannot update service configurations. No existing services of type: " + clazz); } else { CacheConfigurationBuilder<K, V> otherBuilder = withoutServices(clazz); for (ServiceConfiguration<?, R> configuration : existing) { ServiceConfiguration<?, ?> replacement = configuration.build(update.apply(configuration.derive())); if (replacement == null) { throw new NullPointerException(configuration.getClass().getSimpleName() + ".build(...) returned a null configuration instance"); } else { otherBuilder = otherBuilder.withService(replacement); } } return otherBuilder; } }
Source:
<code>protected void executeCommand() { getParameters().setEntityInfo(getEntityInfo()); setSucceeded(true); if (!images.isEmpty()) { List<DiskImage> imageToRemove = new ArrayList<>(); for (DiskImage image : images) { if (image.getStorageIds().get(0).equals(getParameters().getStorageDomainId())) { List<Guid> storageIds = new ArrayList<>(); storageIds.add(getParameters().getStorageDomainId()); image.setStorageIds(storageIds); image.setStoragePoolId(getParameters().getStoragePoolId()); imageToRemove.add(image); } } RemoveAllVmImagesParameters removeAllVmImagesParameters = new RemoveAllVmImagesParameters(getVmId(), imageToRemove); removeAllVmImagesParameters.setParentCommand(getActionType()); removeAllVmImagesParameters.setEntityInfo(getParameters().getEntityInfo()); removeAllVmImagesParameters.setForceDelete(true); removeAllVmImagesParameters.setParentParameters(getParameters()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.RemoveAllVmImages, removeAllVmImagesParameters); if (vdcRetValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } else { getReturnValue().setFault(vdcRetValue.getFault()); setSucceeded(false); } } List<Guid> guids = new ArrayList<>(); <START> guids.add(ovfEntityData.getEntityId()); <END> vmAndTemplatesGenerationsDao.deleteOvfGenerations(guids); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); }</code><technical_language>nan</technical_language>

Target:
protected void executeCommand() { getParameters().setEntityInfo(getEntityInfo()); setSucceeded(true); if (!images.isEmpty()) { List<DiskImage> imageToRemove = new ArrayList<>(); for (DiskImage image : images) { if (image.getStorageIds().get(0).equals(getParameters().getStorageDomainId())) { image.setStorageIds(Collections.singletonList(getParameters().getStorageDomainId())); image.setStoragePoolId(getParameters().getStoragePoolId()); imageToRemove.add(image); } } RemoveAllVmImagesParameters removeAllVmImagesParameters = new RemoveAllVmImagesParameters(getVmId(), imageToRemove); removeAllVmImagesParameters.setParentCommand(getActionType()); removeAllVmImagesParameters.setEntityInfo(getParameters().getEntityInfo()); removeAllVmImagesParameters.setForceDelete(true); removeAllVmImagesParameters.setParentParameters(getParameters()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.RemoveAllVmImages, removeAllVmImagesParameters); if (vdcRetValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } else { getReturnValue().setFault(vdcRetValue.getFault()); setSucceeded(false); } } vmAndTemplatesGenerationsDao.deleteOvfGenerations(Collections.singletonList(ovfEntityData.getEntityId())); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); }
Source:
<code>abstract void checkGlobalOutcome(ManagementClient managementClient, String operation, boolean mustBeUP, String probeName) throws IOException; @Deployment(name = EAR_ARCHIVE_NAME, managed = false) public static Archive<?> deployEar() { JavaArchive jarArchive = ShrinkWrap.create(JavaArchive.class, JAR_ARCHIVE_NAME) <START> .addClass(HealthConfigSource.class) <END> .addAsServiceProvider(ConfigSource.class, HealthConfigSource.class) .addAsResource(EmptyAsset.INSTANCE, "beans.xml"); WebArchive war = ShrinkWrap.create(WebArchive.class, WAR_ARCHIVE_NAME) .addClasses(TestApplication.class, TestApplication.Resource.class, MyProbe.class, MyLiveProbe.class, HealthSubDeploymentConfigSource.class) .addAsServiceProvider(ConfigSource.class, HealthSubDeploymentConfigSource.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); WebArchive testableArchive = Testable.archiveToTest(war); EnterpriseArchive ear = ShrinkWrap .create(EnterpriseArchive.class, EAR_ARCHIVE_NAME) .addAsModule(testableArchive) .addAsLibraries(jarArchive) .addAsResource(EmptyAsset.INSTANCE, "beans.xml") .addAsResource(MicroProfileHealthTestBase.class.getPackage(), "application.xml", "application.xml") .addManifest(); System.out.println(ear.toString(true)); return ear; }</code><technical_language>mentioned in <LINK_0>, config source of a subdeployment support reading another library in EAR deployment</technical_language>

Target:
abstract void checkGlobalOutcome(ManagementClient managementClient, String operation, boolean mustBeUP, String probeName) throws IOException; @Deployment(name = "MicroProfileHealthTestCase", managed = false) public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "MicroProfileHealthTestCase.war") .addClasses(TestApplication.class, TestApplication.Resource.class, MyProbe.class, MyLiveProbe.class, HealthConfigSource.class) .addAsServiceProvider(ConfigSource.class, HealthConfigSource.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); return war; }
Source:
<code>public void returnsItsUpdatedContent() throws Exception { final DyMemo memo = new DyMemo(this.emptyMkItemWithMemo()); memo.update( new Directives() .xpath("/memo") .add("uri").set("sample.uri") ); <START> final XML xml = memo.read(); <END> MatcherAssert.assertThat( XhtmlMatchers.xhtml(xml.toString()), XhtmlMatchers.hasXPaths( " ) ); }</code><technical_language>inline xml</technical_language>

Target:
public void returnsItsUpdatedContent() throws Exception { final DyMemo memo = new DyMemo(this.emptyMkItemWithMemo()); memo.update( new Directives() .xpath("/memo") .add("uri").set("sample.uri") ); MatcherAssert.assertThat( XhtmlMatchers.xhtml(memo.read().toString()), XhtmlMatchers.hasXPaths( " ) ); }
Source:
<code>private boolean isFolderExisting(IFolder folder) { for (IPath <START> fExistingFolder : <END> fExistingFolders) { if (folder.getFullPath().equals(fExistingFolder)) { return true; } } return false; }</code><technical_language>rename existingFolder</technical_language>

Target:
private boolean isFolderExisting(IFolder folder) { for (IPath existingFolder : fExistingFolders) { if (folder.getFullPath().equals(existingFolder)) { return true; } } return false; }
Source:
<code>public AlterTableDesc() { <START> this.properties = new KeyValueSet(); <END> }</code><technical_language>separate this code another method AlterTableDesc::init</technical_language>

Target:
public AlterTableDesc() { init(); }
Source:
<code><START> public void testDirtySaveModelOnModifyChildWithoutIndividualTracking() throws ECPProjectWithNameExistsException { <END> final ECPProperties ecpProperties = ECPUtil.createProperties(); ecpProperties.addProperty(WorkspaceProvider.PROP_ROOT_URI, WorkspaceProvider.VIRTUAL_ROOT_URI); ecpProperties.addProperty(WorkspaceProvider.TRACK_MODIFY_ON_RESOURCE, Boolean.toString(true)); ecpProperties.removeProperty(WorkspaceProvider.TRACK_MODIFY_ON_RESOURCE); final InternalProject project2 = (InternalProject) getProjectManager().createProject(getProvider(), "Projekt " + UUID.randomUUID(), ecpProperties); final EClass clazz = EcoreFactory.eINSTANCE.createEClass(); project.getContents().add(clazz); final EClass clazz2 = EcoreFactory.eINSTANCE.createEClass(); project2.getContents().add(clazz2); assertTrue(project.hasDirtyContents()); assertFalse(project2.hasDirtyContents()); project.saveContents(); assertFalse(project.hasDirtyContents()); }</code><technical_language>this test case "broken" commands project2 is marked dirty? i project 2 marked dirty changes marked cleaned if project is saved</technical_language>

Target:
public void testDirtySaveModelOnModifyChildWithoutIndividualTracking() throws ECPProjectWithNameExistsException { final ECPProperties ecpProperties = ECPUtil.createProperties(); ecpProperties.addProperty(WorkspaceProvider.PROP_ROOT_URI, WorkspaceProvider.VIRTUAL_ROOT_URI); final InternalProject project2 = (InternalProject) getProjectManager().createProject(getProvider(), "Projekt " + UUID.randomUUID(), ecpProperties); final EClass clazz = EcoreFactory.eINSTANCE.createEClass(); project.getContents().add(clazz); final EClass clazz2 = EcoreFactory.eINSTANCE.createEClass(); project2.getContents().add(clazz2); assertTrue(project.hasDirtyContents()); assertFalse(project2.hasDirtyContents()); project.saveContents(); assertFalse(project.hasDirtyContents()); }
Source:
<code>private static ReaderTagList parseTags(JSONObject jsonObject, String name, ReaderTagType topicType) { ReaderTagList topics = new ReaderTagList(); if (jsonObject == null) { return topics; } JSONObject jsonTopics = jsonObject.optJSONObject(name); if (jsonTopics == null) { return topics; } Iterator<String> it = jsonTopics.keys(); while (it.hasNext()) { String internalName = it.next(); JSONObject jsonTopic = jsonTopics.optJSONObject(internalName); if (jsonTopic != null) { String tagTitle = JSONUtils.getStringDecoded(jsonTopic, "title"); String tagName; <START> if (jsonTopic.has("display_name")) { <END> tagName = JSONUtils.getStringDecoded(jsonTopic, "display_name"); } else { tagName = tagTitle; } String endpoint = JSONUtils.getString(jsonTopic, "URL"); topics.add(new ReaderTag(tagName, tagTitle, endpoint, topicType)); } } return topics; }</code><technical_language>slug display_name? clarify distinction tags name tags title. display_name is unfortunate a dictionary key. a glance presented user screen. Edit: a closer API code slug canonical path element for tag</technical_language>

Target:
private static ReaderTagList parseTags(JSONObject jsonObject, String name, ReaderTagType topicType) { ReaderTagList topics = new ReaderTagList(); if (jsonObject == null) { return topics; } JSONObject jsonTopics = jsonObject.optJSONObject(name); if (jsonTopics == null) { return topics; } Iterator<String> it = jsonTopics.keys(); while (it.hasNext()) { String internalName = it.next(); JSONObject jsonTopic = jsonTopics.optJSONObject(internalName); if (jsonTopic != null) { String tagTitle = JSONUtils.getStringDecoded(jsonTopic, "title"); String tagSlug; if (jsonTopic.has("slug")) { tagSlug = JSONUtils.getStringDecoded(jsonTopic, "slug"); } else { tagSlug = tagTitle; } String endpoint = JSONUtils.getString(jsonTopic, "URL"); topics.add(new ReaderTag(tagSlug, tagTitle, endpoint, topicType)); } } return topics; }
Source:
<code>public Iterable<T> fetchAll(long projectId) throws IOException; public T fetch(long id) throws IOException; <START> public void store(T item, User user) throws IOException; <END> public String groupName(); public String idName(); } public static File getBarcodeFileLocation(HttpSession session) { return new File(session.getServletContext().getRealPath("/temp/")); }</code><technical_language>User parameter is for updating lastModifier? If so, remove. This done service/requestman level</technical_language>

Target:
public Iterable<T> fetchAll(long projectId) throws IOException; public T fetch(long id) throws IOException; public void store(T item) throws IOException; public String getGroupName(); public String getIdName(); } public static File getBarcodeFileLocation(HttpSession session) { return new File(session.getServletContext().getRealPath("/temp/")); }
Source:
<code>public void testReparentingToGrandparent() { <START> RulesetModel child = rm.addRuleset("child", rootId, id1); <END> RulesetModel grandchild = rm.addRuleset("grandchild", id1, id2); assertEquals(id1, grandchild.getParentRulesetId()); rm.removeRuleset(id1); assertEquals(rootId, grandchild.getParentRulesetId()); }</code><technical_language>suggestion rm.addRuleset("child", rootId, id1); child is unused</technical_language>

Target:
public void testReparentingToGrandparent() { rm.addRuleset("child", rootId, id1); RulesetModel grandchild = rm.addRuleset("grandchild", id1, id2); assertEquals(id1, grandchild.getParentRulesetId()); rm.removeRuleset(id1); assertEquals(rootId, grandchild.getParentRulesetId()); }
Source:
<code>public RichMember call(ApiCaller ac, Deserializer params) throws PerunException { ac.stateChangingCheck(); String guestName = params.readString("guestName"); String password = params.readString("password"); Vo vo = ac.getVoById(params.readInt("vo")); String namespace = params.readString("namespace"); User sponsor; try { sponsor = ac.getUserById(params.readInt("sponsor")); <START> } catch (RpcException exp) { <END> sponsor = null; } return ac.getMembersManager().createSponsoredMember(ac.getSession(), vo, namespace, guestName, password, sponsor); }</code><technical_language>params.contains("sponsor") check if parameter is available. that, deal exception anymore</technical_language>

Target:
public RichMember call(ApiCaller ac, Deserializer params) throws PerunException { ac.stateChangingCheck(); String guestName = params.readString("guestName"); String password = params.readString("password"); Vo vo = ac.getVoById(params.readInt("vo")); String namespace = params.readString("namespace"); User sponsor = null; if(params.contains("sponsor")) { sponsor = ac.getUserById(params.readInt("sponsor")); } return ac.getMembersManager().createSponsoredMember(ac.getSession(), vo, namespace, guestName, password, sponsor); }
Source:
<code>public void startSettingsFromHomeScreen() throws UiObjectNotFoundException { mDevice.pressHome(); final String launcherPackage = getLauncherPackageName(); assertThat(launcherPackage, notNullValue()); mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT); Context context = InstrumentationRegistry.getContext(); final Intent intent = context.getPackageManager() .getLaunchIntentForPackage(ANDROID_SETTINGS_PACKAGE); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent); <START> clickByText("Data usage"); <END> }</code><technical_language>Please, set a constant for this</technical_language>

Target:
public void startSettingsFromHomeScreen() throws UiObjectNotFoundException { mDevice.pressHome(); final String launcherPackage = getLauncherPackageName(); assertThat(launcherPackage, notNullValue()); mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT); Context context = InstrumentationRegistry.getContext(); final Intent intent = context.getPackageManager() .getLaunchIntentForPackage(ANDROID_SETTINGS_PACKAGE); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent); clickByText(SETTINGS_DATA_USAGE_OPTION); }
Source:
<code>public AssociationLnListTypeDto execute(final ClientConnection conn, final DlmsDevice device, final Void object) throws ProtocolAdapterException { final AttributeAddress attributeAddress = new AttributeAddress(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID); LOGGER.debug("Retrieving Association LN objects for class id: {}, obis code: {}, attribute id: {}", CLASS_ID, OBIS_CODE, ATTRIBUTE_ID); List<GetResult> getResultList; try { getResultList = conn.get(attributeAddress); <START> } catch (IOException | TimeoutException e) { <END> throw new ConnectionException(e); } if (getResultList.isEmpty()) { throw new ProtocolAdapterException("No GetResult received while retrieving Association LN objects."); } if (getResultList.size() > 1 || getResultList.get(0) == null) { throw new ProtocolAdapterException("Expected 1 GetResult while retrieving Association LN objects, got " + getResultList.size()); } final DataObject resultData = getResultList.get(0).resultData(); if (!resultData.isComplex()) { throw new ProtocolAdapterException("Unexpected type of element"); } @SuppressWarnings("unchecked") final List<AssociationLnListElementDto> elements = this .convertAssociationLnList((List<DataObject>) getResultList.get(0).resultData().value()); return new AssociationLnListTypeDto(elements); }</code><technical_language>if dlmsHelperService.getAndCheck reuse some validation logic covers checks in next llines</technical_language>

Target:
public AssociationLnListTypeDto execute(final ClientConnection conn, final DlmsDevice device, final Void object) throws ProtocolAdapterException { final AttributeAddress attributeAddress = new AttributeAddress(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID); LOGGER.debug("Retrieving Association LN objects for class id: {}, obis code: {}, attribute id: {}", CLASS_ID, OBIS_CODE, ATTRIBUTE_ID); final List<GetResult> getResultList = this.dlmsHelperService.getAndCheck(conn, device, "Association LN Objects", attributeAddress); final DataObject resultData = getResultList.get(0).resultData(); if (!resultData.isComplex()) { throw new ProtocolAdapterException("Unexpected type of element"); } @SuppressWarnings("unchecked") final List<AssociationLnListElementDto> elements = this .convertAssociationLnList((List<DataObject>) getResultList.get(0).resultData().value()); return new AssociationLnListTypeDto(elements); }
Source:
<code>private void sendEvent() { try { httpJsonRequestFactory.fromUrl(apiEndpoint + "/workspace/" + WorkspaceIdProvider.getWorkspaceId() + "/runtime") .useDeleteMethod() .request(); <START> LOG.info("Workspace " + WorkspaceIdProvider.getWorkspaceId() + " has been stopped."); <END> } catch (Exception e) { LOG.error("Cannot stop workspace " + WorkspaceIdProvider.getWorkspaceId(), e); } finally { stopped.set(true); } }</code><technical_language>Please a more explicit message here: "Idling workspace " + WorkspaceIdProvider.getWorkspaceId() + " " + timeout / 1000 + " seconds of inactivity."</technical_language>

Target:
private void sendEvent() { try { httpJsonRequestFactory.fromUrl(apiEndpoint + "/workspace/" + WorkspaceIdProvider.getWorkspaceId() + "/runtime") .useDeleteMethod() .request(); LOG.info("Stopping workspace " + WorkspaceIdProvider.getWorkspaceId() + " after " + timeout / 1000 + " seconds of inactivity."); } catch (Exception e) { LOG.error("Cannot stop workspace " + WorkspaceIdProvider.getWorkspaceId(), e); } finally { stopped.set(true); } }
Source:
<code>public FederatedZkClient(RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig, RealmAwareZkClient.RealmAwareZkClientConfig clientConfig) throws IOException, InvalidRoutingDataException { if (connectionConfig == null) { throw new IllegalArgumentException("RealmAwareZkConnectionConfig cannot be null!"); } if (clientConfig == null) { <START> throw new IllegalArgumentException("RealmAwareZkConnectionConfig cannot be null!"); <END> } String msdsEndpoint = connectionConfig.getMsdsEndpoint(); if (msdsEndpoint == null || msdsEndpoint.isEmpty()) { _metadataStoreRoutingData = HttpRoutingDataReader.getMetadataStoreRoutingData(); } else { _metadataStoreRoutingData = HttpRoutingDataReader.getMetadataStoreRoutingData(msdsEndpoint); } _isClosed = false; _clientConfig = clientConfig; _pathBasedZkSerializer = clientConfig.getZkSerializer(); _zkRealmToZkClientMap = new ConcurrentHashMap<>(); }</code><technical_language>Client config in message</technical_language>

Target:
public FederatedZkClient(RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig, RealmAwareZkClient.RealmAwareZkClientConfig clientConfig) throws IOException, InvalidRoutingDataException { if (connectionConfig == null) { throw new IllegalArgumentException("RealmAwareZkConnectionConfig cannot be null!"); } if (clientConfig == null) { throw new IllegalArgumentException("RealmAwareZkClientConfig cannot be null!"); } String msdsEndpoint = connectionConfig.getMsdsEndpoint(); if (msdsEndpoint == null || msdsEndpoint.isEmpty()) { _metadataStoreRoutingData = HttpRoutingDataReader.getMetadataStoreRoutingData(); } else { _metadataStoreRoutingData = HttpRoutingDataReader.getMetadataStoreRoutingData(msdsEndpoint); } _isClosed = false; _clientConfig = clientConfig; _pathBasedZkSerializer = clientConfig.getZkSerializer(); _zkRealmToZkClientMap = new ConcurrentHashMap<>(); }
Source:
<code>public List<ValidationProvider<?>> run() { ClassLoader classloader = Thread.currentThread().getContextClassLoader(); List<ValidationProvider<?>> cachedContextClassLoaderProviderList = getCachedValidationProviders( classloader ); if ( cachedContextClassLoaderProviderList != null ) { return cachedContextClassLoaderProviderList; } ServiceLoader<ValidationProvider> loader = ServiceLoader.load( ValidationProvider.class, classloader ); Iterator<ValidationProvider> providerIterator = loader.iterator(); if ( !providerIterator.hasNext() ) { classloader = DefaultValidationProviderResolver.class.getClassLoader(); List<ValidationProvider<?>> cachedCurrentClassLoaderProviderList = getCachedValidationProviders( classloader ); if ( cachedCurrentClassLoaderProviderList != null ) { return cachedCurrentClassLoaderProviderList; } loader = ServiceLoader.load( ValidationProvider.class, classloader ); providerIterator = loader.iterator(); } List<ValidationProvider<?>> validationProviderList = new ArrayList<ValidationProvider<?>>(); while ( providerIterator.hasNext() ) { try { validationProviderList.add( providerIterator.next() ); } catch ( ServiceConfigurationError e ) { throw new ValidationException( <START> "Unable to load Bean Validation provider non.existent.ValidationProvider", <END> e ); } } cacheValidationProviders( classloader, validationProviderList ); return validationProviderList; }</code><technical_language>out of curiosity, is _non.existent.ValidationProvider_ a placeholder key for something</technical_language>

Target:
public List<ValidationProvider<?>> run() { ClassLoader classloader = Thread.currentThread().getContextClassLoader(); List<ValidationProvider<?>> cachedContextClassLoaderProviderList = getCachedValidationProviders( classloader ); if ( cachedContextClassLoaderProviderList != null ) { return cachedContextClassLoaderProviderList; } ServiceLoader<ValidationProvider> loader = ServiceLoader.load( ValidationProvider.class, classloader ); Iterator<ValidationProvider> providerIterator = loader.iterator(); if ( !providerIterator.hasNext() ) { classloader = DefaultValidationProviderResolver.class.getClassLoader(); List<ValidationProvider<?>> cachedCurrentClassLoaderProviderList = getCachedValidationProviders( classloader ); if ( cachedCurrentClassLoaderProviderList != null ) { return cachedCurrentClassLoaderProviderList; } loader = ServiceLoader.load( ValidationProvider.class, classloader ); providerIterator = loader.iterator(); } List<ValidationProvider<?>> validationProviderList = new ArrayList<ValidationProvider<?>>(); while ( providerIterator.hasNext() ) { try { validationProviderList.add( providerIterator.next() ); } catch ( ServiceConfigurationError e ) { throw new ValidationException( "Unable to load Bean Validation provider", e ); } } cacheValidationProviders( classloader, validationProviderList ); return validationProviderList; }
Source:
<code>public void onStreamCreate(IMediaStream stream) { <START> WMSProperties properties = stream.getProperties(); <END> RTPStream rtpSession = stream.getRTPStream(); String streamName = (stream.getName() != null && stream.getName().length() > 0) ? stream.getName() : stream.getContextStr(); IClient client = stream.getClient(); PacketListener listener = new PacketListener(); WMSProperties props = stream.getProperties(); synchronized (props) { props.setProperty(Constants.STREAM_ACTION_LISTENER_PROPERTY, listener); } stream.addLivePacketListener(listener); }</code><technical_language>please remove unsed code</technical_language>

Target:
public void onStreamCreate(IMediaStream stream) { PacketListener listener = new PacketListener(); WMSProperties props = stream.getProperties(); synchronized (props) { props.setProperty(Constants.STREAM_ACTION_LISTENER_PROPERTY, listener); } stream.addLivePacketListener(listener); }
Source:
<code>public void verifyTemplateWasFound() { waitForElementVisibleByElement(templatesBox); waitForElementByElement(thumbCollection.get(0)); <START> System.out.println(thumbCollection.get(0)); <END> System.out.println(checkIfElementOnPage(thumbCollection.get(0))); Assertion.assertEquals(checkIfElementOnPage(thumbCollection.get(0)), true); }</code><technical_language>remove console printout system.out.println</technical_language>

Target:
public void verifyTemplateWasFound() { waitForElementVisibleByElement(templatesBox); waitForElementByElement(thumbCollection.get(0)); Assertion.assertEquals(checkIfElementOnPage(thumbCollection.get(0)), true); }
Source:
<code>private void bindView() { setContentView(R.layout.activity_home); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); View mainView = findViewById(R.id.home_layout); <START> mPager = (HomeViewPager)findViewById(R.id.view_pager); <END> mPager.setAdapter(new HomeSlidePagerAdapter(getSupportFragmentManager(), this)); mSlidingTabLayout= (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs); mSlidingTabLayout.setViewPager(mPager); ViewCompat.setElevation(toolbar, getResources().getDimension(R.dimen.toolbar_elevation)); ViewCompat.setElevation(mSlidingTabLayout, getResources().getDimension(R.dimen.toolbar_elevation)); mainView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent contactIntent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(contactIntent, REQUEST_CONTACTPICKER); } }); }</code><technical_language>(HomeViewPager) findViewById(R.id.view_pager);</technical_language>

Target:
private void bindView() { setContentView(R.layout.activity_home); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mPager = (HomeViewPager) findViewById(R.id.view_pager); mPager.setAdapter(new HomeSlidePagerAdapter(getSupportFragmentManager(), this)); mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs); mSlidingTabLayout.setViewPager(mPager); ViewCompat.setElevation(toolbar, getResources().getDimension(R.dimen.toolbar_elevation)); ViewCompat.setElevation(mSlidingTabLayout, getResources().getDimension(R.dimen.toolbar_elevation)); }
Source:
<code>CorsConfigurationAccessor(ResourceMappings mappings, Repositories repositories, StringValueResolver embeddedValueResolver) { <START> this.mappings = mappings; <END> this.repositories = repositories; this.embeddedValueResolver = embeddedValueResolver; }</code><technical_language>Non-null assertions missing</technical_language>

Target:
CorsConfigurationAccessor(ResourceMappings mappings, Repositories repositories, StringValueResolver embeddedValueResolver) { Assert.notNull(mappings, "ResourceMappings must not be null!"); Assert.notNull(repositories, "Repositories must not be null!"); this.mappings = mappings; this.repositories = repositories; this.embeddedValueResolver = embeddedValueResolver; }
Source:
<code>public static boolean canProcess(IArtifactDescriptor descriptor) { IExtensionRegistry registry = RegistryFactory.getRegistry(); IExtensionPoint point = registry.getExtensionPoint(PROCESSING_STEPS_EXTENSION_ID); if (point == null) return false; List<String> processorIds = stream(descriptor.getProcessingSteps()) .map(IProcessingStepDescriptor::getProcessorId) .collect(toList()); try { for (String processorId : processorIds) { IExtension extension = point.getExtension(processorId); if (extension == null) return false; List<IConfigurationElement> stepConfigs = stream(extension.getConfigurationElements()) .filter(config -> "step".equals(config.getName())) <START> .collect(toList()); <END> if (stepConfigs.size() != 1) return false; IConfigurationElement stepConfig = stepConfigs.get(0); ProcessingStep stepToCheck = (ProcessingStep) stepConfig.createExecutableExtension("class"); if (!stepToCheck.isEnabled()) return false; } } catch (InvalidRegistryObjectException e) { LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "", e)); return false; } catch (CoreException e) { return false; } return true; }</code><technical_language>Do need a List a collect point? Checking size single element done stream</technical_language>

Target:
public static boolean canProcess(IArtifactDescriptor descriptor) { IExtensionPoint point = ofNullable(RegistryFactory.getRegistry()) .map(r -> r.getExtensionPoint(PROCESSING_STEPS_EXTENSION_ID)) .orElse(null); if (point == null) return false; List<String> processorIds = stream(descriptor.getProcessingSteps()) .map(IProcessingStepDescriptor::getProcessorId) .collect(toList()); try { for (String processorId : processorIds) { IExtension extension = point.getExtension(processorId); if (extension == null) return false; List<IConfigurationElement> stepConfigs = stream(extension.getConfigurationElements()) .filter(config -> "step".equals(config.getName())) .collect(toList()); if (stepConfigs.size() != 1) return false; IConfigurationElement stepConfig = stepConfigs.get(0); ProcessingStep stepToCheck = (ProcessingStep) stepConfig.createExecutableExtension("class"); if (!stepToCheck.isEnabled()) return false; } } catch (InvalidRegistryObjectException e) { LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "", e)); return false; } catch (CoreException e) { return false; } return true; }
Source:
<code>private List<Map<String, Object>> parseHostDevices(XmlDocument document, List<VmDevice> devices, Guid hostId) { List<VmDevice> <START> dbDevices= filterDevices(devices, <END> VmDeviceGeneralType.HOSTDEV); if (dbDevices.isEmpty()) { Collections.emptyList(); } Map<Map<String, String>, HostDevice> addressToHostDevice = hostDeviceDao.getHostDevicesByHostId(hostId) .stream() .filter(dev -> !dev.getAddress().isEmpty()) .collect(Collectors.toMap(HostDevice::getAddress, device -> device)); List<Map<String, Object>> result = new ArrayList<>(); for (XmlNode node : document.selectNodes(" Map<String, String> hostAddress = parseHostAddress(node); if (hostAddress == null) { continue; } HostDevice hostDevice = addressToHostDevice.get(hostAddress); Map<String, Object> dev = new HashMap<>(); dev.put(VdsProperties.Type, VmDeviceGeneralType.HOSTDEV.getValue()); dev.put(VdsProperties.Address, parseAddress(node)); dev.put(VdsProperties.Alias, parseAlias(node)); dev.put(VdsProperties.Device, hostDevice.getDeviceName()); VmDevice dbDev = dbDevices.stream() .filter(d -> d.getDevice().equals(hostDevice.getDeviceName())) .findFirst() .orElse(null); if (dbDev == null) { log.warn("VM host device '{}' does not exist in the database, thus ignored", hostDevice.getDeviceName()); continue; } dev.put(VdsProperties.DeviceId, dbDev.getId().getDeviceId().toString()); dev.put(VdsProperties.SpecParams, dbDev.getSpecParams()); result.add(dev); } return result; }</code><technical_language>Spacing</technical_language>

Target:
private List<Map<String, Object>> parseHostDevices(XmlDocument document, List<VmDevice> devices, Guid hostId) { List<VmDevice> dbDevices = filterDevices(devices, VmDeviceGeneralType.HOSTDEV); if (dbDevices.isEmpty()) { return Collections.emptyList(); } Map<Map<String, String>, HostDevice> addressToHostDevice = hostDeviceDao.getHostDevicesByHostId(hostId) .stream() .filter(dev -> !dev.getAddress().isEmpty()) .collect(Collectors.toMap(HostDevice::getAddress, device -> device)); List<Map<String, Object>> result = new ArrayList<>(); for (XmlNode node : document.selectNodes(" Map<String, String> hostAddress = parseHostAddress(node); if (hostAddress == null) { continue; } HostDevice hostDevice = addressToHostDevice.get(hostAddress); Map<String, Object> dev = new HashMap<>(); dev.put(VdsProperties.Type, VmDeviceGeneralType.HOSTDEV.getValue()); dev.put(VdsProperties.Address, parseAddress(node)); dev.put(VdsProperties.Alias, parseAlias(node)); dev.put(VdsProperties.Device, hostDevice.getDeviceName()); VmDevice dbDev = dbDevices.stream() .filter(d -> d.getDevice().equals(hostDevice.getDeviceName())) .findFirst() .orElse(null); if (dbDev == null) { log.warn("VM host device '{}' does not exist in the database, thus ignored", hostDevice.getDeviceName()); continue; } dev.put(VdsProperties.DeviceId, dbDev.getId().getDeviceId().toString()); dev.put(VdsProperties.SpecParams, dbDev.getSpecParams()); result.add(dev); } return result; }
Source:
<code>private List<String> getList(String strProtocol, boolean mandatory) { List<String> rtnList = new ArrayList<String>(); loadProperties(); if (prop != null) { String strKey = strProtocol; if (mandatory) { strKey += ".mandatory"; } else { strKey += ".optional"; } String strLength = prop.getProperty(strKey); Integer iLength = null; if (strLength != null) { try { iLength = Integer.parseInt(strLength); } catch (Exception e) { iLength = null; } } if (iLength != null) { for (int i = 1; i <= iLength; i++) { String tmpString = strKey + "." + i; String strVal = prop.getProperty(tmpString); if (strVal != null) { <START> if (strProtocol.equals(InboundClientConstants.TYPE_KAFKA) && (mandatory && !strVal.contains("highlevel.") && !strVal.contains("simple.")) || !mandatory) { <END> rtnList.add(strVal); } else if(!strProtocol.equals(InboundClientConstants.TYPE_KAFKA)) { rtnList.add(strVal); } } } } } return rtnList; }</code><technical_language>issue formatting. Line length</technical_language>

Target:
private List<String> getList(String strProtocol, boolean mandatory) { List<String> rtnList = new ArrayList<String>(); loadProperties(); if (prop != null) { String strKey = strProtocol; if (mandatory) { strKey += ".mandatory"; } else { strKey += ".optional"; } String strLength = prop.getProperty(strKey); Integer iLength = null; if (strLength != null) { try { iLength = Integer.parseInt(strLength); } catch (Exception e) { iLength = null; } } if (iLength != null) { for (int i = 1; i <= iLength; i++) { String tmpString = strKey + "." + i; String strVal = prop.getProperty(tmpString); if (strVal != null) { if ((strProtocol.equals(InboundClientConstants.TYPE_KAFKA) && ((mandatory && !strVal.contains("highlevel.") && !strVal.contains("simple.")) || !mandatory)) || !strProtocol.equals(InboundClientConstants.TYPE_KAFKA)) { rtnList.add(strVal); } } } } } return rtnList; }
Source:
<code>private boolean checkReferer( final HttpServletRequest request, final MapPrinter mapPrinter) { final Configuration config = mapPrinter.getConfiguration(); final UriMatchers allowedReferers = config.getAllowedReferersImpl(); if (allowedReferers == null) { return true; } final String referer = request.getHeader("referer"); if (referer == null) { LOGGER.debug("Null referer"); <START> return false; <END> } try { return allowedReferers.matches(new URI(referer), HttpMethod.resolve(request.getMethod())); } catch (SocketException | UnknownHostException | URISyntaxException | MalformedURLException e) { LOGGER.error("Referer invalid", referer, e); return false; } }</code><technical_language>a good idea, debugging harder... change localhost permit config</technical_language>

Target:
private boolean checkReferer( final HttpServletRequest request, final MapPrinter mapPrinter) { final Configuration config = mapPrinter.getConfiguration(); final UriMatchers allowedReferers = config.getAllowedReferersImpl(); if (allowedReferers == null) { return true; } String referer = request.getHeader("referer"); if (referer == null) { referer = "http://localhost/"; } try { return allowedReferers.matches(new URI(referer), HttpMethod.resolve(request.getMethod())); } catch (SocketException | UnknownHostException | URISyntaxException | MalformedURLException e) { LOGGER.error("Referer invalid", referer, e); return false; } }