auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static boolean isPersonCurrentDepartmentPresident(Person person, Department department) { <START> return getCurrentDepartmentPresidents(department).contains(person); <END> }</code><technical_language>This implementation is slow... a method: public static Stream<Person> getCurrentDepartmentPresidents(Department department); instead of previous method? return match person collect entire stream necessary</technical_language>

Target:
public static boolean isPersonCurrentDepartmentPresident(Person person, Department department) { return getCurrentDepartmentPresidents(department).anyMatch(p -> p.equals(person)); }
Source:
<code>public void VEAndRTEDisabledEditorEntryAnonTests_002_MainEditEntry() { ArticlePageObject article = <START> base.openArticleByName(wikiURL, PageContent.articleNamePrefix + base.getTimeStamp()); <END> VisualEditorPageObject ve = article.openVEModeWithMainEditButton(); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); }</code><technical_language>please move creating articleName separate line in test</technical_language>

Target:
public void VEAndRTEDisabledEditorEntryAnonTests_002_MainEditEntry() { ArticlePageObject article = base.openArticleByName(wikiURL, base.getNameForArticle()); VisualEditorPageObject ve = article.openVEModeWithMainEditButton(); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); }
Source:
<code>public Image getImageFromPlugin(String bundleID, String path) { Optional<ImageDescriptor> desc = ResourceLocator.imageDescriptorFromBundle(bundleID, path); <START> return desc.isPresent() ? get(desc.get()) : getBlankImage(); <END> }</code><technical_language>desc.orElse / orElseGet more idiomatic</technical_language>

Target:
public Image getImageFromPlugin(String bundleID, String path) { return ResourceLocator.imageDescriptorFromBundle(bundleID, path).map(d-> get(d)).orElse(getBlankImage()); }
Source:
<code>public MessageType getConvertedMessageType() { final MessageType result; if (currentType == null) { result = new MessageType(currentName, new ArrayList<Type>()); } else { GroupType rootType = currentType.asGroupType(); result = new MessageType(currentName, rootType.getFields()); } <START> logger.info("projected fields"); <END> while (!projectedFields.empty()) { logger.info(projectedFields.pop()); } logger.info("\n\ndiscarded fields"); while (!discardedFields.empty()) { logger.info(discardedFields.pop()); } return result; }</code><technical_language>a static method builds string log, log a single call logger.info. write a unit test tests static method w/o test a mock logger funky that</technical_language>

Target:
public MessageType getConvertedMessageType() { logger.info("project fields"); for (String path : fieldProjectionFilter.getMatchedPaths()) { logger.info(path); } logger.info("\n\ndiscarded fields"); for (String path : fieldProjectionFilter.getUnmatchedPaths()) { logger.info(path); } if (currentType == null) return new MessageType(currentName, new ArrayList<Type>()); GroupType rootType = currentType.asGroupType(); return new MessageType(currentName, rootType.getFields()); }
Source:
<code>protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SSOConfig config = (SSOConfig) request.getServletContext().getAttribute(SSOUtils.SSO_CONFIG); Credentials credentials = null; if (config.isAcceptBasicAuthHeaders()) { credentials = SSOUtils.getUserCredentialsFromHeader(request); } if (credentials != null) { request.getSession(true).setAttribute(SSOUtils.USER_CREDENTIALS, credentials); response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE3_URI); <START> } if (doAuth(request, response)) { <END> response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE4_URI); } else { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE2_URI); } }</code><technical_language>please prefer nego basic</technical_language>

Target:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SSOConfig config = (SSOConfig) request.getServletContext().getAttribute(SSOUtils.SSO_CONFIG); Credentials credentials = null; if (config.isAcceptBasicAuthHeaders()) { credentials = SSOUtils.getUserCredentialsFromHeader(request); } if (doAuth(request, response)) { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE4_URI); } else if (credentials != null) { request.getSession(true).setAttribute(SSOUtils.USER_CREDENTIALS, credentials); response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE3_URI); } else { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE2_URI); } }
Source:
<code>public void shouldProcessFunctionInForEach() { Validation<String,String> v1 = Validation.valid("Eric Nelson"); Validation<String,String> v2 = Validation.invalid("error"); v1.forEach(System.out::println); v2.forEach(System.out::println); <START> assertThat(true).isTrue(); <END> }</code><technical_language>I suggest this: java final java.util.List<String> accumulator = new ArrayList<>(); accumulator.clear(); v1.forEach(accumulator::add); assertThat(accumulator.size()).isEqualTo(1); assertThat(accumulator.get(0)).isEqualTo("Eric Nelson"); accumulator.clear(); v2.forEach(accumulator::add); assertThat(accumulator.size()).isEqualTo(0);</technical_language>

Target:
public void shouldProcessFunctionInForEach() { final java.util.List<String> accumulator = new ArrayList<>(); Validation<String,String> v1 = Validation.valid("valid"); Validation<String,String> v2 = Validation.invalid("error"); accumulator.clear(); v1.forEach(accumulator::add); assertThat(accumulator.size()).isEqualTo(1); assertThat(accumulator.get(0)).isEqualTo("valid"); accumulator.clear(); v2.forEach(accumulator::add); assertThat(accumulator.size()).isEqualTo(0); }
Source:
<code>public static String decryptPassword(String password) { try { return EngineEncryptionUtils.decrypt(password); } catch (Exception e) { <START> log.debug("Failed to decrypt password, error message: {}", e.getMessage()); <END> return password; } }</code><technical_language>if is debug, drop feed e</technical_language>

Target:
public static String decryptPassword(String password) { try { return EngineEncryptionUtils.decrypt(password); } catch (Exception e) { log.debug("Failed to decrypt password", e); return password; } }
Source:
<code>public Guid persistAsyncTaskPlaceHolder(VdcActionType parentCommand) { Guid retValue = Guid.Empty; try { AsyncTasks task = createAsyncTask(new AsyncTaskCreationInfo(), parentCommand); retValue = task.getTaskId(); AsyncTaskUtils.addOrUpdateTaskInDB(task, null, EMPTY_GUID_ARRAY); } catch (RuntimeException ex) { <START> log.errorFormat("Error during persistAsyncTaskPlaceHolders for command: {0}. Exception {1}", this.getClass().getName(), ex); <END> } return retValue; }</code><technical_language>"this" is redundant</technical_language>

Target:
public Guid persistAsyncTaskPlaceHolder(VdcActionType parentCommand) { Guid retValue = Guid.Empty; try { AsyncTasks task = createAsyncTask(new AsyncTaskCreationInfo(), parentCommand); retValue = task.getTaskId(); AsyncTaskUtils.addOrUpdateTaskInDB(task, null, EMPTY_GUID_ARRAY); } catch (RuntimeException ex) { log.errorFormat("Error during persistAsyncTaskPlaceHolders for command: {0}. Exception {1}", getClass().getName(), ex); } return retValue; }
Source:
<code>public VdcQueryReturnValue RunPublicQuery(VdcQueryType queryType, VdcQueryParametersBase params) { <START> log.debug("Server: RunPublicQuery invoked! " + queryType); END> debugQuery(queryType, params); return getBackend().runPublicQuery(queryType, params); }</code><technical_language>please fix (though generally speaking mentioning method name in log is redundant log4j prints anyway, is relevant change)</technical_language>

Target:
public VdcQueryReturnValue RunPublicQuery(VdcQueryType queryType, VdcQueryParametersBase params) { log.debug("Server: runPublicQuery invoked! " + queryType); debugQuery(queryType, params); return getBackend().runPublicQuery(queryType, params); }
Source:
<code>public static void doSetup() throws Exception { Map<String, String> props = Maps.newHashMapWithExpectedSize(1); props.put(Indexer.INDEX_LAZY_POST_BATCH_WRITE, "true"); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); <START> } <END></code><technical_language>This test methods. Forgotten perhaps</technical_language>

Target:
public static void doSetup() throws Exception { Map<String, String> props = Maps.newHashMapWithExpectedSize(2); props.put(IndexRegionObserver.INDEX_LAZY_POST_BATCH_WRITE, "true"); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); }
Source:
<code>public void setEditable(boolean editableMessage) { isEditable = editableMessage; <START> fireDataChanged(); <END> }</code><technical_language>This needs done editable</technical_language>

Target:
public void setEditable(boolean editableMessage) { editable = editableMessage; if(editableMessage){ fireDataChanged(); } }
Source:
<code>private void removeEmptyStack(ArrayList<String> stackTypedPackages, Entry<String, Map<String, String>> entry) { if (!CollectionUtils.isEmpty(stackTypedPackages)) { Set<String> keySet = entry.getValue().keySet(); for (String stackTypedPackage : stackTypedPackages) { if (keySet.contains(stackTypedPackage)) { if (StringUtils.isEmpty(entry.getValue().get(stackTypedPackage))) { <START> entry.getValue().remove(stackTypedPackage); <END> } } } } }</code><technical_language>a log line nice</technical_language>

Target:
private void removeEmptyStack(ArrayList<String> stackTypedPackages, Entry<String, Map<String, String>> entry) { if (!CollectionUtils.isEmpty(stackTypedPackages)) { Set<String> keySet = entry.getValue().keySet(); for (String stackTypedPackage : stackTypedPackages) { if (keySet.contains(stackTypedPackage)) { if (StringUtils.isEmpty(entry.getValue().get(stackTypedPackage))) { entry.getValue().remove(stackTypedPackage); LOGGER.info("Remove empty stack type: {}", stackTypedPackage); } } } } }
Source:
<code>private void logPluginPathConfigProviderWarning(Map<String, String> rawOriginals) { String rawPluginPath = rawOriginals.get(PLUGIN_PATH_CONFIG); String transformedPluginPath = originalsStrings().get(PLUGIN_PATH_CONFIG); if (!Objects.equals(rawPluginPath, transformedPluginPath)) { <START> log.error( <END> "Config providers do not work with the plugin.path property. The raw value '{}' " + "will be used for plugin scanning, as opposed to the transformed value '{}'. " + "See <LINK_0> for more information.", rawPluginPath, transformedPluginPath ); } }</code><technical_language>suggestion log.warn(</technical_language>

Target:
private void logPluginPathConfigProviderWarning(Map<String, String> rawOriginals) { String rawPluginPath = rawOriginals.get(PLUGIN_PATH_CONFIG); String transformedPluginPath = Objects.toString(originals().get(PLUGIN_PATH_CONFIG)); if (!Objects.equals(rawPluginPath, transformedPluginPath)) { log.warn( "Variables cannot be used in the 'plugin.path' property, since the property is " + "used by plugin scanning before the config providers that replace the " + "variables are initialized. The raw value '{}' was used for plugin scanning, as " + "opposed to the transformed value '{}', and this may cause unexpected results.", rawPluginPath, transformedPluginPath ); } }
Source:
<code>private void uninstallPlugins(Set<String> pluginsToRemove) { <START> for (String pluginKey : pluginsToRemove) { <END> editionPluginUninstaller.uninstall(pluginKey); } }</code><technical_language>foreach here</technical_language>

Target:
private void uninstallPlugins(Set<String> pluginsToRemove) { pluginsToRemove.stream().forEach(editionPluginUninstaller::uninstall); }
Source:
<code>public void testExceptionOnInsertFunctional() { for (int i = 0; i < SIZE; ++i) { <START> cache(0).putIfAbsent(i * 4096, SIZE * 4096); <END> } try { cache(0).putIfAbsent(-1, SIZE); fail("Should have thrown an exception!"); } catch (Throwable t) { Exceptions.assertException(ContainerFullException.class, getMostNestedSuppressedThrowable(t)); } }</code><technical_language>putIfAbsent functional, method name implies</technical_language>

Target:
public void testExceptionOnInsertFunctional() { for (int i = 0; i < SIZE; ++i) { cache(0).computeIfAbsent(i, k -> SIZE); } try { cache(0).computeIfAbsent(-1, k -> SIZE); fail("Should have thrown an exception!"); } catch (Throwable t) { Exceptions.assertException(ContainerFullException.class, getMostNestedSuppressedThrowable(t)); } }
Source:
<code>public String deleteContentletsFromIdList(String List, String userId) throws PortalException, SystemException, DotDataException,DotSecurityException { List<String> conditionletWithErrors = new ArrayList<>(); validateUser(); ContentletAPI conAPI = APILocator.getContentletAPI(); String[] inodes = List.split(","); Integer contdeleted = 0; User user = UserLocalManagerUtil.getUserById(userId); for (int i = 0; i < inodes.length; i++) { inodes[i] = inodes[i].trim(); } List<Contentlet> contentlets = new ArrayList<Contentlet>(); for (String inode : inodes) { if (!inode.trim().equals("")) { contentlets.addAll(conAPI.getSiblings(inode)); } } if (!contentlets.isEmpty()) { for (Contentlet contentlet : contentlets) { <START> contentlet.getMap().put(Contentlet.DONT_VALIDATE_ME, true); <END> boolean delete = conAPI.delete(contentlet, user, true, true); if (!delete){ conditionletWithErrors.add(contentlet.getIdentifier()); }else{ contdeleted++; } } return getDeleteContentletMessage(user, conditionletWithErrors, contdeleted); }else{ return LanguageUtil.get(user, "message.contentlet.delete.error.dontExists"); } }</code><technical_language>do this in API ensure delete works everywhere</technical_language>

Target:
public String deleteContentletsFromIdList(String List, String userId) throws PortalException, SystemException, DotDataException,DotSecurityException { List<String> conditionletWithErrors = new ArrayList<>(); validateUser(); ContentletAPI conAPI = APILocator.getContentletAPI(); String[] inodes = List.split(","); Integer contdeleted = 0; User user = UserLocalManagerUtil.getUserById(userId); for (int i = 0; i < inodes.length; i++) { inodes[i] = inodes[i].trim(); } List<Contentlet> contentlets = new ArrayList<Contentlet>(); for (String inode : inodes) { if (!inode.trim().equals("")) { contentlets.addAll(conAPI.getSiblings(inode)); } } if (!contentlets.isEmpty()) { for (Contentlet contentlet : contentlets) { boolean delete = conAPI.destroy(contentlet, user, true); if (!delete){ conditionletWithErrors.add(contentlet.getIdentifier()); }else{ contdeleted++; } } return getDeleteContentletMessage(user, conditionletWithErrors, contdeleted); }else{ return LanguageUtil.get(user, "message.contentlet.delete.error.dontExists"); } }
Source:
<code>public void testZtestPostAggregator() throws Exception { ConstantPostAggregator successCount1, sample1Size, successCount2, sample2Size; successCount1 = new ConstantPostAggregator("successCountPopulation1", 39244); sample1Size = new ConstantPostAggregator("sampleSizePopulation1", 394298); successCount2 = new ConstantPostAggregator("successCountPopulation2", 8991275); sample2Size = new ConstantPostAggregator("sampleSizePopulation2", 9385573); List<PostAggregator> postAggregatorList; postAggregatorList = Lists.newArrayList( successCount1, sample1Size, successCount2, sample2Size ); Map<String, Object> metricValues = new HashMap<>(); for (PostAggregator pa : postAggregatorList) { metricValues.put(pa.getName(), ((ConstantPostAggregator) pa).getConstantValue()); } ztestPostAggregator = new ZtestPostAggregator( "zscore", successCount1, sample1Size, successCount2, sample2Size ); double zscore = ((Number) ztestPostAggregator.compute(metricValues)).doubleValue(); Assert.assertEquals(-1783.8762354220219, zscore, 0.0001 ); <START> System.out.print(ztestPostAggregator.toString()); <END> }</code><technical_language>Please remove debug code</technical_language>

Target:
public void testZtestPostAggregator() throws Exception { ConstantPostAggregator successCount1, sample1Size, successCount2, sample2Size; successCount1 = new ConstantPostAggregator("successCountPopulation1", 39244); sample1Size = new ConstantPostAggregator("sampleSizePopulation1", 394298); successCount2 = new ConstantPostAggregator("successCountPopulation2", 8991275); sample2Size = new ConstantPostAggregator("sampleSizePopulation2", 9385573); List<PostAggregator> postAggregatorList; postAggregatorList = Lists.newArrayList( successCount1, sample1Size, successCount2, sample2Size ); Map<String, Object> metricValues = new HashMap<>(); for (PostAggregator pa : postAggregatorList) { metricValues.put(pa.getName(), ((ConstantPostAggregator) pa).getConstantValue()); } ztestPostAggregator = new ZtestPostAggregator( "zscore", successCount1, sample1Size, successCount2, sample2Size ); double zscore = ((Number) ztestPostAggregator.compute(metricValues)).doubleValue(); Assert.assertEquals(-1783.8762354220219, zscore, 0.0001 ); }
Source:
<code>private void load(File directory) throws ConfigurationException { if (!directory.exists()) { log.warn("The directory \"" + directory.getAbsolutePath() + "\" containing the configuration files doesn't " + "exist."); } else { File[] files = directory.listFiles(); if (files != null) { sort(files); for (File file : files) { if (file.getName().endsWith(".properties")) { try { ExtensionEntry entry = new ExtensionEntry(file); ExtensionEntry alreadyLoded = loadedEntries.get(entry.getName()); if (alreadyLoded != null) { <START> throw new ConfigurationException("Could not load the configuration file \"" <END> + file.getAbsolutePath() + "\". The configuration file + \"" + alreadyLoded.file.getAbsolutePath() + "\" already has the name " + entry.getName()); } loadedEntries.put(entry.name, entry); } catch (IOException exception) { throw new ConfigurationException( "Can't load object configuration file \"" + file.getAbsolutePath() + "\".", exception); } } } } } }</code><technical_language>String.format...</technical_language>

Target:
private void load(File directory) throws ConfigurationException { if (!directory.exists()) { log.warn("The directory \"" + directory.getAbsolutePath() + "\" containing the configuration files doesn't " + "exist."); } else { File[] files = directory.listFiles(); if (files != null) { sort(files); for (File file : files) { if (file.getName().endsWith(".properties")) { try { ExtensionEntry entry = new ExtensionEntry(file); ExtensionEntry alreadyLoded = loadedEntries.get(entry.getName()); if (alreadyLoded != null) { throw new ConfigurationException(String.format("Could not load the configuration file \"%1$s\". The configuration file + \"%2$s\" already has the name %3$s", file.getAbsolutePath(), alreadyLoded.file.getAbsolutePath(), entry.getName())); } loadedEntries.put(entry.name, entry); } catch (IOException exception) { throw new ConfigurationException(String.format("Can't load object configuration file \"%1$s\"", file.getAbsolutePath())); } } } } } }
Source:
<code><START> public GithubBranchSource owner(final String owner) { <END> this.owner.set(owner); this.owner.sendKeys("" + Keys.TAB); return this; }</code><technical_language>is this method needed for? want create a fluent API</technical_language>

Target:
public GithubBranchSource owner(final String owner) { this.owner.set(owner); final String elementTag = this.owner.resolve().getTagName(); final String elementNameAttribute = this.owner.resolve().getAttribute("name"); executeScript("var event = new Event('change');document.getElementsBySelector(\"" + elementTag + "[name='" + elementNameAttribute + "']\")[0].dispatchEvent(event);"); return this; }
Source:
<code>public void testUpdate() throws IOException, VictimsException { <START> try { <END> VictimsDBInterface db = VictimsDB.db(); System.out.println(" DB records: " + db.getRecordCount()); System.out.println(" Syncing..."); db.synchronize(); System.out.println(" DB records: " + db.getRecordCount()); System.out.println("Database last updated on: " + db.lastUpdated().toString()); } catch (VictimsException ex){ if ("Failed to sync database".equals(ex.getMessage())) log.warning(ex.getMessage()); else throw ex; } }</code><technical_language>Formatting</technical_language>

Target:
public void testUpdate() throws IOException, VictimsException { final String victimsDBdir = "target/victimsDB"; System.setProperty(VictimsConfig.Key.HOME, victimsDBdir); FileUtils.deleteQuietly(new File(victimsDBdir)); try { VictimsDBInterface db = VictimsDB.db(); int recordCount = db.getRecordCount(); System.out.println(" DB records: " + recordCount); System.out.println(" Database last updated on: " + db.lastUpdated().toString()); Assert.assertEquals(0, recordCount); System.out.println(" Syncing..."); db.synchronize(); recordCount = db.getRecordCount(); System.out.println(" DB records: " + recordCount); Assert.assertTrue(recordCount > 200); System.out.println(" Database last updated on: " + db.lastUpdated().toString()); } catch (VictimsException ex) { if ("Failed to sync database".equals(ex.getMessage())) log.warning(ex.getMessage()); else throw ex; } }
Source:
<code><START> public CleanUpDomainCommand(VspDomainCleanUp domainCleanUp) { <END> super(); this._domainCleanUp = domainCleanUp; }</code><technical_language>Is acceptable for domainCleanup null? If not, please consider adding a Preconditions.checkArgument check verify domainCleanup is null. remove null checks equals hashCode methods if this precondition is added</technical_language>

Target:
public CleanUpDomainCommand(VspDomainCleanUp domainCleanUp) { super(); Preconditions.checkNotNull(domainCleanUp); this._domainCleanUp = domainCleanUp; }
Source:
<code>public long countRecordsByLookup(Long entityId, String lookupName, Map<String, Object> lookupMap) { EntityDto entity = getEntity(entityId); validateCredentialsForReading(entity); LookupDto lookup = getLookupByName(entityId, lookupName); Map<String, FieldDto> fieldMap = entityService.getLookupFieldsMapping(entityId, lookupName); MotechDataService service = getServiceForEntity(entity); try { LookupExecutor lookupExecutor = new LookupExecutor(service, lookup, fieldMap); return lookupExecutor.executeCount(lookupMap); } catch (RuntimeException e) { <START> throw new LookupExecutionException(e, "mds.error.lookupExecError"); <END> } }</code><technical_language>This a constant</technical_language>

Target:
public long countRecordsByLookup(Long entityId, String lookupName, Map<String, Object> lookupMap) { EntityDto entity = getEntity(entityId); validateCredentialsForReading(entity); LookupDto lookup = getLookupByName(entityId, lookupName); Map<String, FieldDto> fieldMap = entityService.getLookupFieldsMapping(entityId, lookupName); MotechDataService service = getServiceForEntity(entity); try { LookupExecutor lookupExecutor = new LookupExecutor(service, lookup, fieldMap); return lookupExecutor.executeCount(lookupMap); } catch (RuntimeException e) { throw new LookupExecutionException(e, LOOKUP_EXCEPTION_MESSAGE_KEY); } }
Source:
<code>public void testInitWithConfigDeleted() { ContentDirectoryMonitor monitor = new ContentDirectoryMonitor( camelContext, mock(AttributeRegistry.class), 1, 1, Runnable::run); monitor.systemSubjectBinder = exchange -> {}; monitor.setNumThreads(1); monitor.setReadLockIntervalMilliseconds(1000); monitor.setMonitoredDirectoryPath(monitoredDirectoryPath); <START> monitor.setConfigDeleted(true); <END> monitor.attemptAddRoutes(); assertThat( "The content directory monitor should have no route definitions", monitor.getRouteDefinitions(), hasSize(0)); }</code><technical_language>Is a set unit test config is deleted instead of needed a @VisibleForTesting method? configDeleted is internal detail of ContentDirectoryMonitor. If changed implementation, unit tests need re-written, right</technical_language>

Target:
public void testInitWithConfigDeleted() { monitor.destroy(0); monitor.init(); assertThat( "The content directory monitor should have no route definitions", camelContext.getRouteDefinitions(), hasSize(0)); }
Source:
<code>private Map<String, Object> getMap(AnnotationFieldCollection annotation) { Map<String, Object> metadataMap = new HashMap<>(); for (AnnotationField f : annotation.getFields()) { metadataMap.put(f.getName(), f.getValue()); } if (metadataMap.containsKey(REQUIRES_HTML_CONVERSION) && COMMENT_KEY.equals(metadataMap.get(REQUIRES_HTML_CONVERSION))) { <START> String syntax = (String) metadataMap.getOrDefault(String.format("%s_syntax", COMMENT_KEY), "xwiki/2.1"); <END> metadataMap .put(COMMENT_KEY, this.htmlConverter.fromHTML(String.valueOf(metadataMap.get(COMMENT_KEY)), syntax)); metadataMap.remove(REQUIRES_HTML_CONVERSION); } return metadataMap; }</code><technical_language>OK, check syntax is perform conversion if case</technical_language>

Target:
private Map<String, Object> getMap(AnnotationFieldCollection annotation) { Map<String, Object> metadataMap = new HashMap<>(); for (AnnotationField f : annotation.getFields()) { metadataMap.put(f.getName(), f.getValue()); } if (metadataMap.containsKey(REQUIRES_HTML_CONVERSION) && COMMENT_KEY.equals(metadataMap.get(REQUIRES_HTML_CONVERSION)) && metadataMap.containsKey(COMMENT_SYNTAX_KEY)) { String syntax = (String) metadataMap.get(COMMENT_SYNTAX_KEY); String convertedComment = this.htmlConverter.fromHTML(String.valueOf(metadataMap.get(COMMENT_KEY)), syntax); metadataMap.put(COMMENT_KEY, convertedComment); metadataMap.remove(REQUIRES_HTML_CONVERSION); } return metadataMap; }
Source:
<code>private static Identity applyRules(final Identity identity) { if (identity.urn().isEmpty()) { throw new DecodingException("urn is empty"); } <START> if (!identity.urn().matches("^(?i)^urn(?-i):[a-z]{1,31}(:([\\-a-zA-Z0-9/]|%[0-9a-fA-F]{2})*)+(\\?\\w+(=([\\-a-zA-Z0-9/]|%[0-9a-fA-F]{2})*)?(&\\w+(=([\\-a-zA-Z0-9/]|%[0-9a-fA-F]{2})*)?)*)?\\*?$")) { <END> throw new DecodingException("urn isn't valid"); } return identity; }</code><technical_language>@dmzaytsev add a dependency jcabi-urn project method boolean URN.isValid(String text)? @yegor256 do think</technical_language>

Target:
private static Identity applyRules(final Identity identity) { if (identity.urn().isEmpty()) { throw new DecodingException("urn is empty"); } if (!identity.urn().matches("^(?i)^urn(?-i):[a-zA-Z0-9]([\\-a-zA-Z0-9]{1,31})(:([\\-a-zA-Z0-9/]|%[0-9a-fA-F]{2})*)+(\\?\\w+(=([\\-a-zA-Z0-9/]|%[0-9a-fA-F]{2})*)?(&\\w+(=([\\-a-zA-Z0-9/]|%[0-9a-fA-F]{2})*)?)*)?\\*?$")) { throw new DecodingException("urn isn't valid"); } return identity; }
Source:
<code>public void addFullBody() throws Exception { <START> String mockBody = "{\"message\":{\"data\":\"dGVzdA==\"," + "\"attributes\":{},\"messageId\":\"91010751788941\"" + ",\"publishTime\":\"2017-09-25T23:16:42.302Z\"}}"; <END> mockMvc .perform(post("/").contentType(MediaType.APPLICATION_JSON).content(mockBody)) .andExpect(status().isOk()); }</code><technical_language>Ditto formatting</technical_language>

Target:
public void addFullBody() throws Exception { mockMvc .perform(post("/").contentType(MediaType.APPLICATION_JSON).content(mockBody)) .andExpect(status().isOk()); }
Source:
<code>protected void onFinishInflate() { super.onFinishInflate(); View.inflate(getContext(), R.layout.merge_create_channel_view, this); newChannelName = Views.findById(this, R.id.newChannelName); privateChannelSwitch = Views.findById(this, R.id.privateChannelSwitch); toolbar = Views.findById(this, R.id.toolbar); toolbar.setTitle(R.string.createChannel); toolbar.inflateMenu(R.menu.new_channel_menu); <START> toolbar.setNavigationIcon(R.drawable.ic_clear_white_24dp); <END> }</code><technical_language>move setUpToolbar()</technical_language>

Target:
protected void onFinishInflate() { super.onFinishInflate(); View.inflate(getContext(), R.layout.merge_create_channel_view, this); newChannelName = Views.findById(this, R.id.newChannelName); privateChannelSwitch = Views.findById(this, R.id.privateChannelSwitch); setupToolbar(); }
Source:
<code>public int getBatchSizeForMutations() { return 8_0000; <START> } <END></code><technical_language>underscore is in odd place, I want 80000 default</technical_language>

Target:
public int getBatchSizeForMutations() { return 8_000; }
Source:
<code><START> public static Collection<EClass> getSubClasses(EClass superClass) { <END> return getSubClasses(superClass, false); }</code><technical_language>Is this needed</technical_language>

Target:
public static Collection<EClass> getSubClasses(EClass superClass) { final Collection<EClass> classes = new HashSet<EClass>(); for (final EPackage ePackage : getAllRegisteredEPackages()) { for (final EClassifier eClassifier : ePackage.getEClassifiers()) { if (eClassifier instanceof EClass) { final EClass eClass = (EClass) eClassifier; if (superClass.isSuperTypeOf(eClass) && !eClass.isAbstract() && !eClass.isInterface()) { classes.add(eClass); } } } } return classes; }
Source:
<code>private boolean getJUnitTestCaseProposal(IInvocationContext context, ASTNode coveringNode, ArrayList<ICommandAccess> resultingCollections) { if (coveringNode instanceof SimpleName && coveringNode.getParent() instanceof <START> TypeDeclaration) { <END> SimpleName name= (SimpleName) coveringNode; String idName= name.getIdentifier() + JavaModelUtil.DEFAULT_CU_SUFFIX; String unitName= context.getCompilationUnit().getElementName(); if (unitName.equals(idName)) { if (resultingCollections != null) { Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_TEST_CASE); String label= Messages.format(CorrectionMessages.QuickAssistProcessor_create_new_junit_test_case, unitName); Change change= new NullChange(CorrectionMessages.QuickAssistProcessor_create_new_junit_test_case_desc); NewJUnitTestCaseProposal proposal= new NewJUnitTestCaseProposal(label, change, IProposalRelevance.CREATE_JUNIT_TEST_CASE, image, context.getASTRoot()); resultingCollections.add(proposal); } return true; } } return false; }</code><technical_language>AbstractTypeDeclaration used. Otherwise, work annotation enum types</technical_language>

Target:
private boolean getJUnitTestCaseProposal(IInvocationContext context, ASTNode coveringNode, ArrayList<ICommandAccess> resultingCollections) { if (coveringNode instanceof SimpleName && coveringNode.getParent() instanceof AbstractTypeDeclaration) { SimpleName name= (SimpleName) coveringNode; String idName= name.getIdentifier() + JavaModelUtil.DEFAULT_CU_SUFFIX; String unitName= context.getCompilationUnit().getElementName(); if (unitName.equals(idName)) { if (resultingCollections != null) { Image image= JavaPluginImages.DESC_OBJS_TEST_CASE.createImage(); String label= Messages.format(CorrectionMessages.QuickAssistProcessor_create_new_junit_test_case, unitName); Change change= new NullChange(CorrectionMessages.QuickAssistProcessor_create_new_junit_test_case_desc); NewJUnitTestCaseProposal proposal= new NewJUnitTestCaseProposal(label, change, IProposalRelevance.CREATE_JUNIT_TEST_CASE, image, context.getASTRoot()); resultingCollections.add(proposal); } return true; } } return false; }
Source:
<code>public void test2GhzQualifiedNo5GhzAvailable() { testStayOrSwitch(mThresholdQualifiedRssi2G <START> + 1, false, <END> mThresholdQualifiedRssi2G + 10, false, false); }</code><technical_language>Delete this, step closer edge</technical_language>

Target:
public void test2GhzQualifiedNo5GhzAvailable() { testStayOrSwitch(mThresholdQualifiedRssi2G, false, mThresholdQualifiedRssi2G + 10, false, false); }
Source:
<code>public static String getIDsOfPerunBeans(List<? extends PerunBean> listOfBeans) { if (listOfBeans == null || listOfBeans.isEmpty()) { return ""; } Boolean isFirstIteration = true; StringBuilder str = new StringBuilder(); for(PerunBean perunBean : listOfBeans) { if(isFirstIteration) { str.append(perunBean.getId()); isFirstIteration = false; } else { str.append(",").append(perunBean.getId()); } } <START> return new String(str); <END> }</code><technical_language>str.toString();</technical_language>

Target:
public static String getIDsOfPerunBeans(List<? extends PerunBean> listOfBeans) { if (listOfBeans == null || listOfBeans.isEmpty()) { return ""; } Boolean isFirstIteration = true; StringBuilder str = new StringBuilder(); for(PerunBean perunBean : listOfBeans) { if(isFirstIteration) { str.append(perunBean.getId()); isFirstIteration = false; } else { str.append(",").append(perunBean.getId()); } } return str.toString(); }
Source:
<code><START> public List<Storage> listStorages() { <END> return jdbcTemplate.query("select st_id, st_type, st_configuration from zn_data.storage order by st_id", storageRowMapper); }</code><technical_language>Do plan add some pagination support? (offset + limit)</technical_language>

Target:
public List<Storage> listStorages() { return jdbcTemplate.query("SELECT st_id, st_type, st_configuration FROM zn_data.storage ORDER BY st_id", storageRowMapper); }
Source:
<code>@Test public void insertCollectionWithCustomId() { final List<User> users = putUsers(1); final User user = users.get(0); assertNotNull(user.getId()); final Tweet tweet = TestFactory.newTweet(user.getId()); final PutResult putResult = storIOSQLiteDb .put() .object(tweet) .withMapFunc(Tweet.MAP_TO_CONTENT_VALUES) .withPutResolver(Tweet.PUT_RESOLVER) .prepare() .executeAsBlocking(); assertNotNull(putResult); <START> assertEquals(true, putResult.wasInserted()); <END> final Cursor cursor = db.query(Tweet.TABLE, null, null, null, null, null, null); assertEquals(1, cursor.getCount()); assertTrue(cursor.moveToNext()); assertEquals(tweet, Tweet.MAP_FROM_CURSOR.map(cursor)); cursor.close(); }</code><technical_language>assertTrue(putResult.wasInserted())</technical_language>

Target:
@Test public void insertCollectionWithCustomId() { final List<User> users = putUsers(1); final User user = users.get(0); assertNotNull(user.getId()); final Tweet tweet = TestFactory.newTweet(user.getId()); final PutResult putResult = storIOSQLiteDb .put() .object(tweet) .withMapFunc(Tweet.MAP_TO_CONTENT_VALUES) .withPutResolver(Tweet.PUT_RESOLVER) .prepare() .executeAsBlocking(); assertNotNull(putResult); assertTrue(putResult.wasInserted()); final Cursor cursor = db.query(Tweet.TABLE, null, null, null, null, null, null); assertEquals(1, cursor.getCount()); assertTrue(cursor.moveToNext()); assertEquals(tweet, Tweet.MAP_FROM_CURSOR.map(cursor)); cursor.close(); }
Source:
<code>public void testGetUserAgent_fromExternalVersionTestJar() throws IOException { <START> assertThat(UserAgents.getUserAgent(VersionTest.class), is(String.format("test-name (test-version)"))); <END> }</code><technical_language>String.format is superfluous</technical_language>

Target:
public void testGetUserAgent_fromExternalVersionTestJar() throws IOException { assertThat(UserAgents.fromClass(VersionTest.class), is("test-name (test-version)")); }
Source:
<code>private void alignmentBordersSanityCheck(final byte[] ref) { if (sequenceId == UNMAPPED_OR_NO_REFERENCE) return ; <START> if (alignmentStart > 0 && sequenceId >= 0 && ref == null) throw new NullPointerException("Mapped slice reference is null."); <END> if (alignmentStart > ref.length) { log.error(String.format("Slice mapped outside of reference: seqID=%d, start=%d, counter=%d.", sequenceId, alignmentStart, globalRecordCounter)); throw new RuntimeException("Slice mapped outside of the reference."); } if (alignmentStart - 1 + alignmentSpan > ref.length) { log.warn(String.format("Slice partially mapped outside of reference: seqID=%d, start=%d, span=%d, counter=%d.", sequenceId, alignmentStart, alignmentSpan, globalRecordCounter)); } }</code><technical_language>This IllegalArgumentException IllegalStateException</technical_language>

Target:
private void alignmentBordersSanityCheck(final byte[] ref) { if (sequenceId == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) return ; if (alignmentStart > 0 && sequenceId >= 0 && ref == null) throw new IllegalArgumentException ("Mapped slice reference is null."); if (alignmentStart > ref.length) { log.error(String.format("Slice mapped outside of reference: seqID=%d, start=%d, counter=%d.", sequenceId, alignmentStart, globalRecordCounter)); throw new RuntimeException("Slice mapped outside of the reference."); } if (alignmentStart - 1 + alignmentSpan > ref.length) { log.warn(String.format("Slice partially mapped outside of reference: seqID=%d, start=%d, span=%d, counter=%d.", sequenceId, alignmentStart, alignmentSpan, globalRecordCounter)); } }
Source:
<code><START> public void reset(MessageBufferOutput out) throws IOException { <END> MessageBufferOutput newOut = checkNotNull(out, "MessageBufferOutput is null"); this.out = newOut; this.position = 0; }</code><technical_language>returning MessageBufferOutput instance here</technical_language>

Target:
public MessageBufferOutput reset(MessageBufferOutput out) throws IOException { MessageBufferOutput newOut = checkNotNull(out, "MessageBufferOutput is null"); MessageBufferOutput old = this.out; this.out = newOut; this.position = 0; return old; }
Source:
<code>private void runFafReplayFile(Path path) throws IOException { byte[] rawReplayBytes = replayFileReader.readRawReplayData(path); Path tempSupComReplayFile = preferencesService.getCacheDirectory().resolve(TEMP_SCFA_REPLAY_FILE_NAME); createDirectories(tempSupComReplayFile.getParent()); Files.copy(new ByteArrayInputStream(rawReplayBytes), tempSupComReplayFile, StandardCopyOption.REPLACE_EXISTING); LocalReplayInfo replayInfo = replayFileReader.parseMetaData(path); String gameType = replayInfo.getFeaturedMod(); Integer replayId = replayInfo.getUid(); Map<String, Integer> modVersions = replayInfo.getFeaturedModVersions(); String mapName = replayInfo.getMapname(); if (StringUtils.isEmptyOrNull(mapName)) { mapName = parseMapFolderName(rawReplayBytes); } <START> if (StringUtils.equalsIgnoreCase(mapName, "None")) { <END> String maybeMapGen = parseMapFolderName(rawReplayBytes); if (mapGeneratorService.isGeneratedMap(maybeMapGen)) { mapName = maybeMapGen; } } Set<String> simMods = replayInfo.getSimMods() != null ? replayInfo.getSimMods().keySet() : emptySet(); Integer version = parseSupComVersion(rawReplayBytes); gameService.runWithReplay(tempSupComReplayFile, replayId, gameType, version, modVersions, simMods, mapName); }</code><technical_language>This is case for other featured mods coop. work out there</technical_language>

Target:
private void runFafReplayFile(Path path) throws IOException { byte[] rawReplayBytes = replayFileReader.readRawReplayData(path); Path tempSupComReplayFile = preferencesService.getCacheDirectory().resolve(TEMP_SCFA_REPLAY_FILE_NAME); createDirectories(tempSupComReplayFile.getParent()); Files.copy(new ByteArrayInputStream(rawReplayBytes), tempSupComReplayFile, StandardCopyOption.REPLACE_EXISTING); LocalReplayInfo replayInfo = replayFileReader.parseMetaData(path); String gameType = replayInfo.getFeaturedMod(); Integer replayId = replayInfo.getUid(); Map<String, Integer> modVersions = replayInfo.getFeaturedModVersions(); String mapName = replayInfo.getMapname(); if (StringUtils.isEmptyOrNull(mapName)) { mapName = parseMapFolderName(rawReplayBytes); } if (StringUtils.equalsIgnoreCase(mapName, "None")) { String maybeMapGen = parseMapName(rawReplayBytes).replaceAll(".scmap",""); if (mapGeneratorService.isGeneratedMap(maybeMapGen)) { mapName = maybeMapGen; } } Set<String> simMods = replayInfo.getSimMods() != null ? replayInfo.getSimMods().keySet() : emptySet(); Integer version = parseSupComVersion(rawReplayBytes); gameService.runWithReplay(tempSupComReplayFile, replayId, gameType, version, modVersions, simMods, mapName); }
Source:
<code>protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree firstArgument = mit.arguments().get(0); if (!firstArgument.is(Tree.Kind.METHOD_REFERENCE)) { return; } <START> MethodReferenceTree mrt = (MethodReferenceTree) firstArgument; <END> Tree expression = mrt.expression(); if (isAddMethod(mrt.method()) && expression.is(Tree.Kind.IDENTIFIER)) { context.reportIssue(this, mrt, String.format("Use \"collect(Collectors.toList())\" instead of \"forEach(%s::add)\".", ((IdentifierTree) expression).name())); } }</code><technical_language>I try cover simple cases add method is invoked well. list.forEach(s -> otherlist.add(s));</technical_language>

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree firstArgument = mit.arguments().get(0); if (firstArgument.is(Tree.Kind.METHOD_REFERENCE)) { handleMethodReference((MethodReferenceTree) firstArgument); } else if (firstArgument.is(Tree.Kind.LAMBDA_EXPRESSION)) { handleLambdaExpression((LambdaExpressionTree) firstArgument); } }
Source:
<code>public IRubyObject add(final ThreadContext threadContext, final IRubyObject[] args, Block block) { final IRubyObject rubyMessage; final String progname; if (args.length >= 2 && !args[1].isNil()) { rubyMessage = args[1]; <START> progname = args[2].asJavaString(); <END> } else if (block.isGiven()) { rubyMessage = block.yield(threadContext, getRuntime().getNil()); } else { rubyMessage = args[2]; } final Cursor cursor = getSourceLocation(rubyMessage); final String message = formatMessage(rubyMessage); final Severity severity = mapRubyLogLevel(args[0]); final LogRecord record = createLogRecord(threadContext, severity, cursor, message); rootLogHandler.log(record); return getRuntime().getNil(); }</code><technical_language>this is marked unused in IDE</technical_language>

Target:
public IRubyObject add(final ThreadContext threadContext, final IRubyObject[] args, Block block) { final IRubyObject rubyMessage; if (args.length >= 2 && !args[1].isNil()) { rubyMessage = args[1]; } else if (block.isGiven()) { rubyMessage = block.yield(threadContext, getRuntime().getNil()); } else { rubyMessage = args[2]; } final Cursor cursor = getSourceLocation(rubyMessage); final String message = formatMessage(rubyMessage); final Severity severity = mapRubyLogLevel(args[0]); final LogRecord record = createLogRecord(threadContext, severity, cursor, message); rootLogHandler.log(record); return getRuntime().getNil(); }
Source:
<code>public UnionType setElements(NodeList<ReferenceType<?>> elements) { <START> notifyPropertyChange("elements", this.elements, elements); <END> this.elements = assertNotNull(elements); setAsParentNodeOf(this.elements); return this; }</code><technical_language>Do enum for property names? get typo's</technical_language>

Target:
public UnionType setElements(NodeList<ReferenceType<?>> elements) { notifyPropertyChange(ObservableProperty.ELEMENTS, this.elements, elements); this.elements = assertNotNull(elements); setAsParentNodeOf(this.elements); return this; }
Source:
<code>public String toString() { <START> StringBuffer result = new StringBuffer(); <END> result.append("Concur Account info: "); result.append(KFSConstants.NEWLINE); result.append("Chart: " + this.chart); result.append(KFSConstants.NEWLINE); result.append("Account number: " + this.accountNumber); result.append(KFSConstants.NEWLINE); result.append("Sub Account number: " + this.subAccountNumber); result.append(KFSConstants.NEWLINE); result.append("Object code: " + this.objectCode); result.append(KFSConstants.NEWLINE); result.append("Sub object code: " + this.subObjectCode); result.append(KFSConstants.NEWLINE); result.append("Project code: " + this.projectCode); result.append(KFSConstants.NEWLINE); result.append("Org Ref Id: " + this.orgRefId); result.append(KFSConstants.NEWLINE); return result.toString(); }</code><technical_language>want StringBuilder instead of StringBuffer. StringBuilders thread safe, if this is single threaded, StringBuilder perform a bit better. Chad H suggested I start StringBuilder</technical_language>

Target:
public String toString() { StringBuilder result = new StringBuilder(); result.append("Concur Account info: "); result.append(KFSConstants.NEWLINE); result.append("Chart: " + this.chart); result.append(KFSConstants.NEWLINE); result.append("Account number: " + this.accountNumber); result.append(KFSConstants.NEWLINE); result.append("Sub Account number: " + this.subAccountNumber); result.append(KFSConstants.NEWLINE); result.append("Object code: " + this.objectCode); result.append(KFSConstants.NEWLINE); result.append("Sub object code: " + this.subObjectCode); result.append(KFSConstants.NEWLINE); result.append("Project code: " + this.projectCode); result.append(KFSConstants.NEWLINE); result.append("Org Ref Id: " + this.orgRefId); result.append(KFSConstants.NEWLINE); return result.toString(); }
Source:
<code>public void edit(final InstallModel model) { driver.edit(model); <START> if (model.getVds().getStatus() == VDSStatus.InstallFailed) { <END> rbPassword.setValue(true); model.setAuthenticationMethod(AuthenticationMethod.Password); displayPasswordField(true); } else { rbPublicKey.setValue(true); model.setAuthenticationMethod(AuthenticationMethod.PublicKey); displayPasswordField(false); } rbPassword.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { model.setAuthenticationMethod(AuthenticationMethod.Password); displayPasswordField(true); } }); rbPublicKey.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { model.setAuthenticationMethod(AuthenticationMethod.PublicKey); displayPasswordField(false); } }); userNameEditor.setEnabled(false); networkProviderWidget.edit(model.getNetworkProviderModel()); }</code><technical_language>Consider refactor: * boolean installedFailed = model.getVds().getStatus() == VDSStatus.InstallFailed; * model.setAuthenticationMethod(installedFailed ? AuthenticationMethod.Password : AuthenticationMethod.PublicKey); * displayPasswordField(installedFailed); * rbPassword.setValue(installedFailed); * rbPublicKey.setValue(!installedFailed);</technical_language>

Target:
public void edit(final InstallModel model) { driver.edit(model); boolean installedFailed = model.getVds().getStatus() == VDSStatus.InstallFailed; model.setAuthenticationMethod(installedFailed ? AuthenticationMethod.Password: AuthenticationMethod.PublicKey); displayPasswordField(installedFailed); rbPassword.setValue(installedFailed); rbPublicKey.setValue(!installedFailed); rbPassword.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { model.setAuthenticationMethod(AuthenticationMethod.Password); displayPasswordField(true); } }); rbPublicKey.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { model.setAuthenticationMethod(AuthenticationMethod.PublicKey); displayPasswordField(false); } }); userNameEditor.setEnabled(false); networkProviderWidget.edit(model.getNetworkProviderModel()); }
Source:
<code>protected SortedSet<String> getRequestedProjects(String paramName, String cookieName) { TreeSet<String> set = new TreeSet<>(); <START> HashSet<Project> projects = getEnv().getProjects(); <END> if (projects == null) { return set; } if (projects.size() == 1) { for (Project p : projects) { if (authFramework.isAllowed(req, p)) { set.add(p.getName()); } } return set; } List<String> vals = getParamVals(paramName); for (String s : vals) { Project x = Project.getByName(s); if (x != null && authFramework.isAllowed(req, x)) { set.add(s); } } if (set.isEmpty()) { List<String> cookies = getCookieVals(cookieName); for (String s : cookies) { Project x = Project.getByName(s); if (x != null && authFramework.isAllowed(req, x)) { set.add(s); } } } if (set.isEmpty()) { Set<Project> defaultProjects = env.getDefaultProjects(); if (defaultProjects != null) { for (Project project : defaultProjects) { if (authFramework.isAllowed(req, project)) { set.add(project.getName()); } } } } return set; }</code><technical_language>supertype Set</technical_language>

Target:
protected SortedSet<String> getRequestedProjects(String paramName, String cookieName) { TreeSet<String> set = new TreeSet<>(); List<Project> projects = getEnv().getProjectList(); if (projects == null) { return set; } if (getProject() != null) { set.add(getProject().getName()); return set; } if (projects.size() == 1) { Project p = projects.get(0); if (authFramework.isAllowed(req, p)) { set.add(p.getName()); } return set; } List<String> vals = getParamVals(paramName); for (String s : vals) { Project x = Project.getByName(s); if (x != null && authFramework.isAllowed(req, x)) { set.add(s); } } if (set.isEmpty()) { List<String> cookies = getCookieVals(cookieName); for (String s : cookies) { Project x = Project.getByName(s); if (x != null && authFramework.isAllowed(req, x)) { set.add(s); } } } if (set.isEmpty()) { Set<Project> defaultProjects = env.getDefaultProjects(); if (defaultProjects != null) { for (Project project : defaultProjects) { if (authFramework.isAllowed(req, project)) { set.add(project.getName()); } } } } return set; }