auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void sendMailSync(long userId, Event event, Position position) throws MessagingException { User user = Context.getPermissionsManager().getUser(userId); Properties properties = getProperties(new PropertiesProvider(user)); <START> if (Context.getConfig().getBoolean("mail.smtp.ignoreUserConfig") || !properties.containsKey("mail.smtp.host")) { <END> properties = getProperties(new PropertiesProvider(Context.getConfig())); if (!properties.containsKey("mail.smtp.host")) { Log.warning("No SMTP configuration found"); return; } } Session session = Session.getInstance(properties); MimeMessage message = new MimeMessage(session); String from = properties.getProperty("mail.smtp.from"); if (from != null) { message.setFrom(new InternetAddress(from)); } message.addRecipient(Message.RecipientType.TO, new InternetAddress(user.getEmail())); MailMessage mailMessage = NotificationFormatter.formatMailMessage(userId, event, position); message.setSubject(mailMessage.getSubject()); message.setSentDate(new Date()); message.setContent(mailMessage.getBody(), "text/html; charset=utf-8"); Transport transport = session.getTransport(); try { Context.getStatisticsManager().registerMail(); transport.connect( properties.getProperty("mail.smtp.host"), properties.getProperty("mail.smtp.username"), properties.getProperty("mail.smtp.password")); transport.sendMessage(message, message.getAllRecipients()); } finally { transport.close(); } }</code><technical_language>a bit inefficient initialise user properties if ignoreUserConfig is set true</technical_language>

Target:
public static void sendMailSync(long userId, Event event, Position position) throws MessagingException { User user = Context.getPermissionsManager().getUser(userId); Properties properties = null; if (!Context.getConfig().getBoolean("mail.smtp.ignoreUserConfig")) { properties = getProperties(new PropertiesProvider(user)); } if (properties == null || !properties.containsKey("mail.smtp.host")) { properties = getProperties(new PropertiesProvider(Context.getConfig())); } if (!properties.containsKey("mail.smtp.host")) { Log.warning("No SMTP configuration found"); return; } Session session = Session.getInstance(properties); MimeMessage message = new MimeMessage(session); String from = properties.getProperty("mail.smtp.from"); if (from != null) { message.setFrom(new InternetAddress(from)); } message.addRecipient(Message.RecipientType.TO, new InternetAddress(user.getEmail())); MailMessage mailMessage = NotificationFormatter.formatMailMessage(userId, event, position); message.setSubject(mailMessage.getSubject()); message.setSentDate(new Date()); message.setContent(mailMessage.getBody(), "text/html; charset=utf-8"); Transport transport = session.getTransport(); try { Context.getStatisticsManager().registerMail(); transport.connect( properties.getProperty("mail.smtp.host"), properties.getProperty("mail.smtp.username"), properties.getProperty("mail.smtp.password")); transport.sendMessage(message, message.getAllRecipients()); } finally { transport.close(); } }
Source:
<code>private void checkMethodDefinition(MethodTree tree) { BlockTree blockTree = tree.block(); <START> if (tree.symbol() != null && VERIFY_METHOD_MATCHER.matches(tree) && blockTree != null) { <END> checkBlock(blockTree); } }</code><technical_language>symbol null for a method tree</technical_language>

Target:
private void checkMethodDefinition(MethodTree tree) { BlockTree blockTree = tree.block(); if (VERIFY_METHOD_MATCHER.matches(tree) && blockTree != null) { checkBlock(blockTree); } }
Source:
<code>public void testQueryByDeploymentTimeAfter() { List<Deployment> deployments = repositoryService.createDeploymentQuery().list(); for (Deployment deployment : deployments) { List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(deployment.getDeploymentTime()).list(); for (ProcessDefinition processDefinition : processDefinitions) { Deployment singleDeployment = repositoryService.createDeploymentQuery().deploymentId(processDefinition.getDeploymentId()).singleResult(); assertThat(singleDeployment.getDeploymentTime()).isAfter(deployment.getDeploymentTime()); <START> } <END> } }</code><technical_language>This test is robust. assumes time elapses deployments, is enforced. Furthermore, test number of returned definitions is in correct, e.g. if process definition query returned results, test succeed</technical_language>

Target:
public void testQueryByDeploymentTimeAfter() { Date startTest = DateUtils.addSeconds(ClockUtil.now(), 5); ClockUtil.setCurrentTime(startTest); ClockUtil.setCurrentTime(DateUtils.addSeconds(startTest, 5)); Deployment tempDeploymentOne = repositoryService.createDeployment() .addClasspathResource(getResourceOnePath()).addClasspathResource(getResourceTwoPath()).deploy(); engineRule.manageDeployment(tempDeploymentOne); Date timeAfterDeploymentOne = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); ClockUtil.setCurrentTime(DateUtils.addSeconds(timeAfterDeploymentOne, 5)); Deployment tempDeploymentTwo = repositoryService.createDeployment() .addClasspathResource(getResourceOnePath()).deploy(); engineRule.manageDeployment(tempDeploymentTwo); Date timeAfterDeploymentTwo = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); ClockUtil.setCurrentTime(DateUtils.addSeconds(timeAfterDeploymentTwo, 5)); Deployment tempDeploymentThree = repositoryService.createDeployment() .addClasspathResource(getResourceThreePath()).deploy(); engineRule.manageDeployment(tempDeploymentThree); Date timeAfterDeploymentThree = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(startTest).list(); assertThat(processDefinitions).hasSize(4); processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(timeAfterDeploymentOne).list(); assertThat(processDefinitions).hasSize(2); assertThatProcessDefinitionsWereDeployedAfter(processDefinitions, timeAfterDeploymentOne); processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(timeAfterDeploymentTwo).list(); assertThat(processDefinitions).hasSize(1); assertThatProcessDefinitionsWereDeployedAfter(processDefinitions, timeAfterDeploymentTwo); processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(timeAfterDeploymentThree).list(); assertThat(processDefinitions).hasSize(0); }
Source:
<code>private boolean removeVmPool() { if (getVmPoolId() != null && canRemoveVmPool(getVmPoolId())) { getVmPoolDAO().remove(getVmPoolId()); return true; } else { <START> return false; <END> } }</code><technical_language>please add a log message</technical_language>

Target:
private boolean removeVmPool() { if (getVmPoolId() != null && canRemoveVmPool(getVmPoolId())) { getVmPoolDAO().remove(getVmPoolId()); return true; } else { if (getVmPoolId() == null) { log.error("Failed to remove VM Pool: VM Pool ID is null"); } else { log.error("Failed to remove VM Pool '{}': there are still VMs in the Pool", getVmPoolName()); } return false; } }
Source:
<code>public synchronized void testInjection() { Integer testInt = Integer.valueOf(123); String testString = new String("abc"); Double testDouble = Double.valueOf(1.23); Float testFloat = Float.valueOf(12.3f); Character testChar = Character.valueOf('v'); IEclipseContext context = EclipseContextFactory.create(); <START> context.set(Integer.class.getName(), testInt); <END> context.set(String.class, testString); context.set(Double.class.getName(), testDouble); context.set(Float.class.getName(), testFloat); context.set(Character.class, testChar); ObjectBasic userObject = new ObjectBasic(); ContextInjectionFactory.inject(userObject, context); assertEquals(testString, userObject.injectedString); assertEquals(testInt, userObject.getInt()); assertEquals(context, userObject.context); assertEquals(1, userObject.setMethodCalled); assertEquals(1, userObject.setMethodCalled2); assertEquals(testDouble, userObject.d); assertEquals(testFloat, userObject.f); assertEquals(testChar, userObject.c); assertTrue(userObject.finalized); }</code><technical_language>I remove .getName here</technical_language>

Target:
public synchronized void testInjection() { Integer testInt = Integer.valueOf(123); String testString = new String("abc"); Double testDouble = Double.valueOf(1.23); Float testFloat = Float.valueOf(12.3f); Character testChar = Character.valueOf('v'); IEclipseContext context = EclipseContextFactory.create(); context.set(Integer.class, testInt); context.set(String.class, testString); context.set(Double.class, testDouble); context.set(Float.class, testFloat); context.set(Character.class, testChar); ObjectBasic userObject = new ObjectBasic(); ContextInjectionFactory.inject(userObject, context); assertEquals(testString, userObject.injectedString); assertEquals(testInt, userObject.getInt()); assertEquals(context, userObject.context); assertEquals(1, userObject.setMethodCalled); assertEquals(1, userObject.setMethodCalled2); assertEquals(testDouble, userObject.d); assertEquals(testFloat, userObject.f); assertEquals(testChar, userObject.c); assertTrue(userObject.finalized); }
Source:
<code>static InternationalFixedDate ofEpochDay(final long epochDay) { InternationalFixedChronology.EPOCH_DAY_RANGE.checkValidValue(epochDay, ChronoField.EPOCH_DAY); long zeroDay = epochDay + InternationalFixedChronology.DAYS_0000_TO_1970; if (zeroDay < 0) { throw new DateTimeException("Invalid epoch: " + epochDay); } long year = (400 * zeroDay) / DAYS_PER_CYCLE; <START> long doy = zeroDay - (InternationalFixedChronology.DAYS_IN_YEAR * year + getLeapYearsBefore(year)); <END> return ofYearDay((int) year, (int) doy); }</code><technical_language>year is estimate, true afterwards. safe multiplication 400 is - do tests boundaries for non-leap centuries, right</technical_language>

Target:
static InternationalFixedDate ofEpochDay(final long epochDay) { EPOCH_DAY_RANGE.checkValidValue(epochDay, ChronoField.EPOCH_DAY); long zeroDay = epochDay + DAYS_0000_TO_1970; long year = (400 * zeroDay) / DAYS_PER_CYCLE; long doy = zeroDay - (DAYS_IN_YEAR * year + INSTANCE.getLeapYearsBefore(year)); boolean isLeapYear = INSTANCE.isLeapYear(year); if (doy == (DAYS_IN_YEAR + 1) && !isLeapYear) { year += 1; doy = 1; } if (doy == 0) { year -= 1; doy = DAYS_IN_YEAR + (isLeapYear ? 1 : 0); } return ofYearDay((int) year, (int) doy); }
Source:
<code>public void assignGroupsToResource(PerunSession perunSession, List<Group> groups, Resource resource) throws InternalErrorException, PrivilegeException, GroupNotExistsException, ResourceNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException, GroupAlreadyAssignedException { Utils.checkPerunSession(perunSession); Utils.notNull(groups, "groups"); getResourcesManagerBl().checkResourceExists(perunSession, resource); List<PerunBean> beans = new ArrayList<>(groups); <START> beans.add(resource); <END> if (!AuthzResolver.isAuthorized(perunSession, Role.VOADMIN, resource) && !AuthzResolver.isAuthorized(perunSession, Role.RESOURCEADMIN, resource)) { if (!AuthzResolver.isAuthorized(perunSession, Role.RESOURCESELFSERVICE, resource)) { throw new PrivilegeException(perunSession, "assignGroupsToResource"); } for (Group group : groups) { if (!AuthzResolver.isAuthorized(perunSession, Role.GROUPADMIN, group)) { throw new PrivilegeException(perunSession, "assignGroupsToResource"); } } } for(Group g: groups) { getPerunBl().getGroupsManagerBl().checkGroupExists(perunSession, g); } getResourcesManagerBl().assignGroupsToResource(perunSession, groups, resource); }</code><technical_language>beans is anywhere. part of change authorization, want part of this pull-request</technical_language>

Target:
public void assignGroupsToResource(PerunSession perunSession, List<Group> groups, Resource resource) throws InternalErrorException, PrivilegeException, GroupNotExistsException, ResourceNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException, GroupAlreadyAssignedException { Utils.checkPerunSession(perunSession); Utils.notNull(groups, "groups"); getResourcesManagerBl().checkResourceExists(perunSession, resource); if (!AuthzResolver.isAuthorized(perunSession, Role.VOADMIN, resource) && !AuthzResolver.isAuthorized(perunSession, Role.RESOURCEADMIN, resource)) { if (!AuthzResolver.isAuthorized(perunSession, Role.RESOURCESELFSERVICE, resource)) { throw new PrivilegeException(perunSession, "assignGroupsToResource"); } for (Group group : groups) { if (!AuthzResolver.isAuthorized(perunSession, Role.GROUPADMIN, group)) { throw new PrivilegeException(perunSession, "assignGroupsToResource"); } } } for(Group g: groups) { getPerunBl().getGroupsManagerBl().checkGroupExists(perunSession, g); } getResourcesManagerBl().assignGroupsToResource(perunSession, groups, resource); }
Source:
<code>static StringBuilder stringify(String cls, ConstructorOrMethod method) { StringBuilder result = new StringBuilder(cls).append(".").append(method.getName()).append("("); <START> return result.append(method.stringifyParameterTypes()); <END> }</code><technical_language>append(")") is missing</technical_language>

Target:
static StringBuilder stringify(String cls, ConstructorOrMethod method) { StringBuilder result = new StringBuilder(cls).append(".").append(method.getName()).append("("); return result.append(method.stringifyParameterTypes()).append(")"); }
Source:
<code>public RqWithHeaders(final Request req, final Iterable<? extends CharSequence> headers) { super( <START> new RqOf( <END> () -> { final List<String> head = new LinkedList<>(); for (final String hdr : req.head()) { head.add(hdr); } for (final CharSequence header : headers) { head.add(header.toString().trim()); } return head; }, req::body ) ); }</code><technical_language>@fanifieiev above</technical_language>

Target:
public RqWithHeaders(final Request req, final Iterable<? extends CharSequence> headers) { super( new RequestOf( () -> { final List<String> head = new LinkedList<>(); for (final String hdr : req.head()) { head.add(hdr); } for (final CharSequence header : headers) { head.add(header.toString().trim()); } return head; }, req::body ) ); }
Source:
<code>public File getTargetFile() { return new File(String.format(TARGET_FILE_PATTERN, exportPath, <START> destination.toString().toLowerCase(), <END> targetResolution.toString().toLowerCase(Locale.ENGLISH), exportName, format.toString().toLowerCase())); }</code><technical_language>fixed Locale argument for actual folder name in Destination constructor</technical_language>

Target:
public File getTargetFile() { return new File(String.format(TARGET_FILE_PATTERN, exportPath, destination.getFolderName(), targetResolution.toString().toLowerCase(Locale.ENGLISH), exportName, format.toString().toLowerCase())); }
Source:
<code>public String toString() { return toStringHelper(this) <START> .omitNullValues() <END> .add("filter", filter) .toString(); }</code><technical_language>null values omit</technical_language>

Target:
public String toString() { return toStringHelper(this) .add("filter", filter) .toString(); }
Source:
<code>public Builder preferIPv6(boolean preferIPv6) { <START> this.preferIPv6 = true; <END> return this; }</code><technical_language>true</technical_language>

Target:
public Builder preferIPv6(boolean preferIPv6) { this.preferIPv6 = preferIPv6; return this; }
Source:
<code>public boolean onCreateOptionsMenu(Menu menu) { boolean retval = mapBase.onCreateOptionsMenu(menu); Resources res = this.getResources(); SubMenu subMenuSelectSource = menu.addSubMenu(Menu.NONE, selectMapSourceMenuId, Menu.NONE, res.getString(R.string.map_file_select_title)); subMenuSelectSource.setHeaderTitle(res.getString(R.string.map_file_select_title)); try { ArrayList<String> mapDatabaseList = mapBase.getMapView().getMapDatabaseList(); if (mapDatabaseList.size() > 0) { for (int i = 0; i < mapDatabaseList.size(); i++) { MenuItem itm = subMenuSelectSource.add(AbstractMap.MENU_MAP_SPECIFIC_MIN , AbstractMap.MENU_MAP_SPECIFIC_MIN + i + 1 , Menu.NONE , mapDatabaseList.get(i)); itm.setCheckable(true); <START> itm.setChecked((new File(mapBase.getMapView().getCurrentMapDatabase())).getName().equals(mapDatabaseList.get(i))); <END> } subMenuSelectSource.setGroupCheckable(AbstractMap.MENU_MAP_SPECIFIC_MIN, true, true); } } catch (Exception e) { Log.e("MapforgeMapActivity.onCreateOptionsMenu: " + e); } return retval; }</code><technical_language>call methods in long chains instances here. Please a block local variable for loop element (mapDatabaseList.get(i)), if is more loop. extract setChecked(...) new method "isCurrentMapDatabase(mapDatabase)" like. If this line in some weeks, decode complete method chain understand it</technical_language>

Target:
public boolean onCreateOptionsMenu(Menu menu) { boolean retval = mapBase.onCreateOptionsMenu(menu); Resources res = this.getResources(); SubMenu subMenuSelectSource = menu.addSubMenu(Menu.NONE, selectMapSourceMenuId, Menu.NONE, res.getString(R.string.map_file_select_title)); subMenuSelectSource.setHeaderTitle(res.getString(R.string.map_file_select_title)); try { ArrayList<String> mapDatabaseList = mapBase.getMapView().getMapDatabaseList(); if (mapDatabaseList.size() > 0) { for (int i = 0; i < mapDatabaseList.size(); i++) { String mapDatabase = mapDatabaseList.get(i); MenuItem itm = subMenuSelectSource.add(AbstractMap.MENU_MAP_SPECIFIC_MIN , AbstractMap.MENU_MAP_SPECIFIC_MIN + i + 1 , Menu.NONE , mapDatabase); itm.setCheckable(true); itm.setChecked((new File(mapBase.getMapView().getCurrentMapDatabase())).getName().equals(mapDatabase)); } subMenuSelectSource.setGroupCheckable(AbstractMap.MENU_MAP_SPECIFIC_MIN, true, true); } } catch (Exception e) { Log.e("MapforgeMapActivity.onCreateOptionsMenu: " + e); } return retval; }
Source:
<code>JGitConnection(Repository repository, CredentialsLoader credentialsLoader, SshKeyProvider sshKeyProvider, GitUserResolver userResolver) { this.repository = repository; this.credentialsLoader = credentialsLoader; this.sshKeyProvider = sshKeyProvider; this.userResolver = userResolver; <START> this.proxyAuthenticator = new ProxyAuthenticator(); <END> }</code><technical_language>this instance is unused</technical_language>

Target:
JGitConnection(Repository repository, CredentialsLoader credentialsLoader, SshKeyProvider sshKeyProvider, GitUserResolver userResolver) { this.repository = repository; this.credentialsLoader = credentialsLoader; this.sshKeyProvider = sshKeyProvider; this.userResolver = userResolver; }
Source:
<code>public void testJpaMessageHandlerParser() throws Exception { setUp("JpaMessageHandlerParserTests.xml", getClass()); final AbstractMessageChannel inputChannel = TestUtils.getPropertyValue(this.consumer, "inputChannel", AbstractMessageChannel.class); assertEquals("target", inputChannel.getComponentName()); final JpaExecutor jpaExecutor = TestUtils.getPropertyValue(this.consumer, "handler.jpaExecutor", JpaExecutor.class); assertNotNull(jpaExecutor); final String query = TestUtils.getPropertyValue(jpaExecutor, "jpaQuery", String.class); assertEquals("from Student", query); final JpaOperations jpaOperations = TestUtils.getPropertyValue(jpaExecutor, "jpaOperations", JpaOperations.class); assertNotNull(jpaOperations); final PersistMode persistMode = TestUtils.getPropertyValue(jpaExecutor, "persistMode", PersistMode.class); assertEquals(PersistMode.PERSIST, persistMode); @SuppressWarnings("unchecked") List<JpaParameter> jpaParameters = TestUtils.getPropertyValue(jpaExecutor, "jpaParameters", List.class); assertNotNull(jpaParameters); assertTrue(jpaParameters.size() == 3); <START> assertEquals(new Integer(10), TestUtils.getPropertyValue(jpaExecutor, "flushSize", Integer.class)); <END> assertTrue(TestUtils.getPropertyValue(jpaExecutor, "cleanOnFlush", Boolean.class)); }</code><technical_language>Integer.valueOf(10) purely for consistency reasons</technical_language>

Target:
public void testJpaMessageHandlerParser() throws Exception { setUp("JpaMessageHandlerParserTests.xml", getClass()); final AbstractMessageChannel inputChannel = TestUtils.getPropertyValue(this.consumer, "inputChannel", AbstractMessageChannel.class); assertEquals("target", inputChannel.getComponentName()); final JpaExecutor jpaExecutor = TestUtils.getPropertyValue(this.consumer, "handler.jpaExecutor", JpaExecutor.class); assertNotNull(jpaExecutor); final String query = TestUtils.getPropertyValue(jpaExecutor, "jpaQuery", String.class); assertEquals("from Student", query); final JpaOperations jpaOperations = TestUtils.getPropertyValue(jpaExecutor, "jpaOperations", JpaOperations.class); assertNotNull(jpaOperations); final PersistMode persistMode = TestUtils.getPropertyValue(jpaExecutor, "persistMode", PersistMode.class); assertEquals(PersistMode.PERSIST, persistMode); @SuppressWarnings("unchecked") List<JpaParameter> jpaParameters = TestUtils.getPropertyValue(jpaExecutor, "jpaParameters", List.class); assertNotNull(jpaParameters); assertTrue(jpaParameters.size() == 3); assertEquals(Integer.valueOf(10), TestUtils.getPropertyValue(jpaExecutor, "flushSize", Integer.class)); assertTrue(TestUtils.getPropertyValue(jpaExecutor, "clearOnFlush", Boolean.class)); }
Source:
<code>public static ImageDescriptor getImage(String value, Bundle definingBundle) { URL url = getUrl(value, definingBundle); <START> return url == null ? null : ImageDescriptor.createFromURL(url); <END> }</code><technical_language>Optional</technical_language>

Target:
protected static Optional<ImageDescriptor> getImage(String value, Bundle definingBundle) { Optional<URL> url = getUrl(value, definingBundle); ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url.get()); return url.isPresent() ? Optional.of(imageDescriptor) : Optional.empty(); }
Source:
<code><START> public void search() { <END> WikiBasePageObject base = new WikiBasePageObject(driver); base.openMainPage(wikiURL); NavigationBar navbar = new NavigationBar(driver); navbar.executeScript(ClickTrackingScriptsProvider.REDIRECT_BLOCK); navbar.executeScript(ClickTrackingScriptsProvider.TRACKER_INSTALLATION); navbar.typeQuery(SearchContent.SEARCH_ARTICLE); navbar.clickEnterToSearch(); navbar.dismissPopupWindow(); navbar.typeQuery(SearchContent.SEARCH_ARTICLE); navbar.clickSearchButton(); navbar.dismissPopupWindow(); navbar.triggerSuggestions(SearchContent.SEARCH_SUGGESTION_PHRASE); navbar.verifySuggestions(SearchContent.SEARCH_ARTICLE); navbar.ArrowDownAndEnterSuggestion(SearchContent.SEARCH_ARTICLE); navbar.dismissPopupWindow(); navbar.clickSearchButton(); navbar.dismissPopupWindow(); navbar.triggerSuggestions(SearchContent.SEARCH_SUGGESTION_PHRASE); navbar.verifySuggestions(SearchContent.SEARCH_ARTICLE); navbar.clickSuggestion(SearchContent.SEARCH_ARTICLE); navbar.dismissPopupWindow(); navbar.clickEnterToSearch(); navbar.dismissPopupWindow(); List<JsonObject> expectedEvents = Arrays.asList( EventsGlobalNavigation.searchButtonClick, EventsGlobalNavigation.searchEnter, EventsGlobalNavigation.searchSuggestShow, EventsGlobalNavigation.searchSuggestionEnter, EventsGlobalNavigation.searchAfterSuggestionEnter, EventsGlobalNavigation.searchAfterSuggestionButtonClick ); navbar.compareTrackedEventsTo(expectedEvents); }</code><technical_language>Test is failing for me, works for you</technical_language>

Target:
public void search() { WikiBasePageObject base = new WikiBasePageObject(driver); base.openMainPage(wikiURL); NavigationBar navbar = new NavigationBar(driver); navbar.executeScript(ClickTrackingScriptsProvider.REDIRECT_BLOCK); navbar.executeScript(ClickTrackingScriptsProvider.TRACKER_INSTALLATION); navbar.triggerSuggestions(SearchContent.SEARCH_SUGGESTION_PHRASE); navbar.verifySuggestions(SearchContent.SEARCH_ARTICLE); navbar.ArrowDownAndEnterSuggestion(SearchContent.SEARCH_ARTICLE); AlertHandler.dismissPopupWindow(driver); navbar.clickSearchButton(); AlertHandler.dismissPopupWindow(driver); navbar.triggerSuggestions(SearchContent.SEARCH_SUGGESTION_PHRASE); navbar.verifySuggestions(SearchContent.SEARCH_ARTICLE); navbar.clickSuggestion(SearchContent.SEARCH_ARTICLE); AlertHandler.dismissPopupWindow(driver); navbar.clickEnterToSearch(); AlertHandler.dismissPopupWindow(driver); List<JsonObject> expectedEvents = Arrays.asList( EventsGlobalNavigation.searchSuggestShow, EventsGlobalNavigation.searchSuggestionEnter, EventsGlobalNavigation.searchAfterSuggestionEnter, EventsGlobalNavigation.searchAfterSuggestionButtonClick); navbar.compareTrackedEventsTo(expectedEvents); }
Source:
<code>public void update(INetwork network, IPartNetwork partNetwork, PartTarget target, S state) { super.update(network, partNetwork, target, state); IValue lastValue = state.getDisplayValue(); IValue newValue = null; if(state.hasVariable()) { try { IVariable variable = state.getVariable(partNetwork); if(variable != null) { newValue = variable.getValue(); } } catch (EvaluationException e) { state.addGlobalError(new L10NHelpers.UnlocalizedString(e.getLocalizedMessage())); } } if(!ValueHelpers.areValuesEqual(lastValue, newValue)) { onValueChanged(network, partNetwork, target, state, lastValue, newValue); state.onDirty(); if (network != null) { <START> network.getEventBus().post(new VariableContentsUpdatedEvent(network)); <END> } BlockHelpers.markForUpdate(target.getCenter().getPos().getWorld(), target.getCenter().getPos().getBlockPos()); } }</code><technical_language>Placing this call panels trigger VariableContentsUpdatedEvent time displayed changes. This means showing world time _very_ expensive</technical_language>

Target:
public void update(INetwork network, IPartNetwork partNetwork, PartTarget target, S state) { super.update(network, partNetwork, target, state); IValue lastValue = state.getDisplayValue(); IValue newValue = null; if(state.hasVariable()) { try { IVariable variable = state.getVariable(partNetwork); if(variable != null) { newValue = variable.getValue(); } } catch (EvaluationException e) { state.addGlobalError(new L10NHelpers.UnlocalizedString(e.getLocalizedMessage())); } } if(!ValueHelpers.areValuesEqual(lastValue, newValue)) { onValueChanged(network, partNetwork, target, state, lastValue, newValue); state.onDirty(); BlockHelpers.markForUpdate(target.getCenter().getPos().getWorld(), target.getCenter().getPos().getBlockPos()); } }
Source:
<code>public Map<Import, String> getImportXML(final Metadata metadata, final List<Import> imports) { final Map<Import, String> importXML = new HashMap<>(); if (imports.size() > 0) { for (final String xml : getOtherDMNDiagramsXML(metadata)) { <START> final Definitions definitions = marshaller.unmarshal(toStringReader(xml)); <END> findImportByDefinitions(definitions, imports).ifPresent(anImport -> { importXML.put(anImport, xml); }); } } return importXML; }</code><technical_language>I close StringReader unmarshaling</technical_language>

Target:
public Map<Import, String> getImportXML(final Metadata metadata, final List<Import> imports) { final Map<Import, String> importXML = new HashMap<>(); if (imports.size() > 0) { for (final String xml : getOtherDMNDiagramsXML(metadata)) { try (StringReader sr = toStringReader(xml)) { final Definitions definitions = marshaller.unmarshal(sr); findImportByDefinitions(definitions, imports).ifPresent(anImport -> { importXML.put(anImport, xml); }); } } } return importXML; }
Source:
<code>private float getPercenUsedGpus() { List<SchedulerNode> nodes = ((AbstractYarnScheduler) rmContext.getScheduler()).getAllNodes(); long totalGPUs = 0; long usedGPUs = 0; for(SchedulerNode node: nodes){ totalGPUs += node.getTotalResource().getResourceValue(ResourceInformation.GPU_URI); usedGPUs += node.getAllocatedResource().getResourceValue(ResourceInformation.GPU_URI); } <START> return (float) usedGPUs / totalGPUs; <END> }</code><technical_language>If GPUs in cluster, this result in dividing zero</technical_language>

Target:
private float getPercenUsedGpus() { List<SchedulerNode> nodes = ((AbstractYarnScheduler) rmContext.getScheduler()).getAllNodes(); long totalGPUs = 0; long usedGPUs = 0; for(SchedulerNode node: nodes){ totalGPUs += node.getTotalResource().getResourceValue(ResourceInformation.GPU_URI); usedGPUs += node.getAllocatedResource().getResourceValue(ResourceInformation.GPU_URI); } return totalGPUs == 0 ? 0 : (float) usedGPUs / totalGPUs; }
Source:
<code>private Mono<AmqpSendLink> createCoordinatorSendLink(Duration timeout, AmqpRetryPolicy retry) { if (isDisposed()) { return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format( "Cannot create coordinator send link '%s' from a closed session.", TRANSACTION_LINK_NAME)))); } final LinkSubscription<AmqpSendLink> existing = coordinatorLink.get(); if (existing != null) { logger.verbose("linkName[{}]: Returning existing coordinator send link.", TRANSACTION_LINK_NAME); return Mono.just(existing.getLink()); } return RetryUtil.withRetry( getEndpointStates().takeUntil(state -> state == AmqpEndpointState.ACTIVE), timeout, retry) .then(Mono.<AmqpSendLink>create(sink -> { try { provider.getReactorDispatcher().invoke(() -> { <START> LinkSubscription<AmqpSendLink> linkLinkSubscription = getCoordinator(TRANSACTION_LINK_NAME, <END> timeout, retry); if (coordinatorLink.compareAndSet(null, linkLinkSubscription)) { logger.info("linkName[{}]: coordinator send link created.", TRANSACTION_LINK_NAME); } else { logger.info("linkName[{}]: Another coordinator send link exists. Disposing of new one.", TRANSACTION_LINK_NAME); linkLinkSubscription.dispose(); } sink.success(coordinatorLink.get().getLink()); }); } catch (IOException e) { sink.error(e); } })); }</code><technical_language>linkLinkSubscription</technical_language>

Target:
private Mono<AmqpSendLink> createCoordinatorSendLink(Duration timeout, AmqpRetryPolicy retry) { if (isDisposed()) { return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format( "Cannot create coordinator send link '%s' from a closed session.", TRANSACTION_LINK_NAME)))); } final LinkSubscription<AmqpSendLink> existing = coordinatorLink.get(); if (existing != null) { logger.verbose("linkName[{}]: Returning existing coordinator send link.", TRANSACTION_LINK_NAME); return Mono.just(existing.getLink()); } return RetryUtil.withRetry( getEndpointStates().takeUntil(state -> state == AmqpEndpointState.ACTIVE), timeout, retry) .then(Mono.<AmqpSendLink>create(sink -> { try { provider.getReactorDispatcher().invoke(() -> { LinkSubscription<AmqpSendLink> linkSubscription = getCoordinator(TRANSACTION_LINK_NAME, timeout, retry); if (coordinatorLink.compareAndSet(null, linkSubscription)) { logger.info("linkName[{}]: coordinator send link created.", TRANSACTION_LINK_NAME); } else { logger.info("linkName[{}]: Another coordinator send link exists. Disposing of new one.", TRANSACTION_LINK_NAME); linkSubscription.dispose(); } sink.success(coordinatorLink.get().getLink()); }); } catch (IOException e) { sink.error(e); } })); }
Source:
<code>public @NotNull String getAsString(){ String entries = null; for(StateValue<?> value : this.values){ if(entries == null){ <START> entries = value.getGenerator().getId() + "=" + value.getValueAsString(); }else{ entries = entries + ", " + value.getGenerator().getId() + ": " + value.getValueAsString(); <END> } } if(entries == null) { return "minecraft:" + this.material.name().toLowerCase(); } return "minecraft:" + this.material.name().toLowerCase() + " [" + entries + "]"; }</code><technical_language>give top line a id-value separator bottom line</technical_language>

Target:
public @NotNull String getAsString(){ String entries = null; for(StateValue<?> value : this.values.values()){ if(entries == null){ entries = value.getGenerator().getId() + "=" + value.getValueAsString(); }else{ entries += "," + value.getGenerator().getId() + "=" + value.getValueAsString(); } } if(entries == null) { return "minecraft:" + this.material.name().toLowerCase(); } return "minecraft:" + this.material.name().toLowerCase() + "[" + entries + "]"; }
Source:
<code>public void watch(ListenableFuture<?> future, long timeoutInMillis) { if (future == null || future.isDone()) { return; } Watchdog dog = cachedDogs.get(timeoutInMillis); if (dog == null) { dog = new Watchdog(scheduler, timeoutInMillis, sendInterruptOnFutureCancel); Watchdog exisiting = cachedDogs.putIfAbsent(timeoutInMillis, dog); if (exisiting != null) { dog = exisiting; } } dog.watch(future); <START> if (! cleanerScheduled.get() && cleanerScheduled.compareAndSet(false, true)) { <END> scheduler.schedule(cacheCleaner, INSPECTION_INTERVAL_MILLIS); } }</code><technical_language>save some duplicated code putting this a method this scheduled runnable call if ! isEmpty</technical_language>

Target:
public void watch(ListenableFuture<?> future, long timeoutInMillis) { if (future == null || future.isDone()) { return; } Watchdog dog = cachedDogs.get(timeoutInMillis); if (dog == null) { dog = new Watchdog(scheduler, timeoutInMillis, sendInterruptOnFutureCancel); Watchdog exisiting = cachedDogs.putIfAbsent(timeoutInMillis, dog); if (exisiting != null) { dog = exisiting; } } dog.watch(future); maybeScheduleCleaner(); }
Source:
<code>public boolean clickContinue(final boolean key) { <START> final Component c = getContinue(); <END> if (c != null) { if (key) { ctx.input.send(" "); return true; } else { return c.click(); } } return false; }</code><technical_language>This simplified a ton. return c != null && ((key && ctx.input.send("{VK_SPACE}")) || c.click()) line note turn out have; I meant clickContinue(boolean key) method</technical_language>

Target:
public boolean clickContinue(final boolean key) { final Component c = getContinue(); return c != null && (key && ctx.input.send(" ") || c.click()); }
Source:
<code>private Long getSurveillanceAuthority() throws UserPermissionRetrievalException { if (Util.isUserRoleAdmin() || Util.isUserRoleOnc()) { <START> return userPermissionDao.getIdFromAuthority("ROLE_ONC"); <END> } else if (Util.isUserRoleAcbAdmin()) { return userPermissionDao.getIdFromAuthority("ROLE_ACB"); } else { return null; } }</code><technical_language>I hardcoded strings static final Strings somewhere... Authority class? reference instead</technical_language>

Target:
private Long getSurveillanceAuthority() throws UserPermissionRetrievalException { if (Util.isUserRoleAdmin() || Util.isUserRoleOnc()) { return userPermissionDao.getIdFromAuthority(Authority.ROLE_ONC); } else if (Util.isUserRoleAcbAdmin()) { return userPermissionDao.getIdFromAuthority(Authority.ROLE_ACB); } else { return null; } }
Source:
<code>public synchronized void onEvent(EventUserUpdate event) { User user = event.getUser(); if (user != null) { <START> this.addItem(user); <END> } }</code><technical_language>code style: omit this is ambiguity</technical_language>

Target:
public synchronized void onEvent(EventUserUpdate event) { User user = event.getUser(); if (user != null) { container.addItem(user); } }
Source:
<code>public void setAsPrimaryObject(AgentPrincipals agent, PID fileObjPid) { aclService.assertHasAccess("Insufficient privileges to set " + fileObjPid.getUUID() + " as primary object", fileObjPid, agent.getPrincipals(), editResourceType); RepositoryObject repoObj = repoObjLoader.getRepositoryObject(fileObjPid); if (!(repoObj instanceof FileObject)) { throw new InvalidOperationForObjectType("Cannot set " + fileObjPid.getUUID() + " as primary object, since objects of type " + repoObj.getClass().getName() + " are not eligible."); } RepositoryObject parent = repoObj.getParent(); if (!(parent instanceof WorkObject)) { throw new InvalidOperationForObjectType("Object of type " + parent.getClass().getName() + " cannot have a primary object."); } WorkObject work = (WorkObject) parent; work.setPrimaryObject(fileObjPid); <START> operationsMessageSender.sendSetAsPrimaryObjectOperation(agent.getUsername(), Arrays.asList(fileObjPid)); <END> }</code><technical_language>This message include parent file object (the parent is needs reindexed)</technical_language>

Target:
public void setAsPrimaryObject(AgentPrincipals agent, PID fileObjPid) { aclService.assertHasAccess("Insufficient privileges to set " + fileObjPid.getUUID() + " as primary object", fileObjPid, agent.getPrincipals(), editResourceType); RepositoryObject repoObj = repoObjLoader.getRepositoryObject(fileObjPid); if (!(repoObj instanceof FileObject)) { throw new InvalidOperationForObjectType("Cannot set " + fileObjPid.getUUID() + " as primary object, since objects of type " + repoObj.getClass().getName() + " are not eligible."); } RepositoryObject parent = repoObj.getParent(); if (!(parent instanceof WorkObject)) { throw new InvalidOperationForObjectType("Object of type " + parent.getClass().getName() + " cannot have a primary object."); } WorkObject work = (WorkObject) parent; work.setPrimaryObject(fileObjPid); operationsMessageSender.sendSetAsPrimaryObjectOperation(agent.getUsername(), Arrays.asList(parent.getPid(), fileObjPid)); }
Source:
<code>public RemoveMembersFromConsumerGroupOptions() { <START> this.members = new HashSet<>(); <END> }</code><technical_language>Collections.emptySet() more sense is immutable</technical_language>

Target:
public RemoveMembersFromConsumerGroupOptions() { this.members = Collections.emptySet(); }
Source:
<code>public void init() throws Exception { super.init(); setContextBaseUrl("/api/configuration/strongbox/storages"); <START> r0 = new RepositoryForm(); <END> r0.setId("repository0"); r0.setAllowsRedeployment(true); r0.setSecured(true); r0.setLayout(Maven2LayoutProvider.ALIAS); r0.setType("hosted"); r0.setPolicy("release"); r0.setImplementation("file-system"); r0.setStatus("In Service"); r1 = new RepositoryForm(); r1.setId("repository1"); r1.setAllowsForceDeletion(true); r1.setTrashEnabled(true); r1.setProxyConfiguration(createProxyConfiguration()); r1.setLayout(Maven2LayoutProvider.ALIAS); r1.setType("hosted"); r1.setPolicy("release"); r1.setImplementation("file-system"); r1.setStatus("In Service"); r1.setGroupRepositories(ImmutableSet.of("repository0")); }</code><technical_language>please repositoryForm0 naming convention? This is easier for refactoring later. mentioning this, I modify a classes I working test parallelization I cases a bit trickier re-work of inconsistencies in namings. (Thanks!) :)</technical_language>

Target:
public void init() throws Exception { super.init(); setContextBaseUrl("/api/configuration/strongbox/storages"); repositoryForm0 = new RepositoryForm(); repositoryForm0.setId("repository0"); repositoryForm0.setAllowsRedeployment(true); repositoryForm0.setSecured(true); repositoryForm0.setLayout(Maven2LayoutProvider.ALIAS); repositoryForm0.setType("hosted"); repositoryForm0.setPolicy("release"); repositoryForm0.setImplementation("file-system"); repositoryForm0.setStatus("In Service"); repositoryForm1 = new RepositoryForm(); repositoryForm1.setId("repository1"); repositoryForm1.setAllowsForceDeletion(true); repositoryForm1.setTrashEnabled(true); repositoryForm1.setProxyConfiguration(createProxyConfiguration()); repositoryForm1.setLayout(Maven2LayoutProvider.ALIAS); repositoryForm1.setType("hosted"); repositoryForm1.setPolicy("release"); repositoryForm1.setImplementation("file-system"); repositoryForm1.setStatus("In Service"); repositoryForm1.setGroupRepositories(ImmutableSet.of("repository0")); }
Source:
<code>private String pickCDN() { List<String> pushClusters = props.getList(VoldemortBuildAndPushJob.PUSH_CLUSTER); if (!props.containsKey(VoldemortBuildAndPushJob.PUSH_CDN_CLUSTER)) { <START> return ""; <END> } List<String> cdnClusters = props.getList(VoldemortBuildAndPushJob.PUSH_CDN_CLUSTER); if (pushClusters.size() != cdnClusters.size()) { warn("Cluster sizes are different! Will bypass CDN for push cluster " + destination); return ""; } int index = pushClusters.indexOf(destination); assert index != -1; String cdnCluster = cdnClusters.get(index); if (cdnCluster.equals("null")) { info("Will bypass CDN for push cluster " + destination); return ""; } if (!cdnCluster.matches(".*hdfs://.*:[0-9]{1,5}/?")) { warn("Invalid URL format! Will bypass CDN for push cluster " + destination); return ""; } return cdnCluster.replaceAll("(?<=:[0-9]{1,5})/", ""); }</code><technical_language>throw exception</technical_language>

Target:
private String pickCDN() throws Exception { String cdnCluster = buildCdnMap().get(removeTrailingSlash(destination)); if (cdnCluster == null) { warn("Cannot find corresponding CDN! Will bypass CDN for push cluster " + destination); return ""; } if (cdnCluster.equals("null")) { info("Will bypass CDN for push cluster " + destination); return ""; } if (!cdnCluster.matches(".*hdfs://.+:[0-9]{1,5}")) { warn("Invalid URL format! Will bypass CDN for push cluster " + destination); return ""; } return cdnCluster; }
Source:
<code>public void handleError(ClientHttpResponse response) throws IOException { HttpStatus status = response.getStatusCode(); AmazonS3Exception e = new AmazonS3Exception(IOUtils.toString(response.getBody())); switch (status) { case BAD_REQUEST: if (e.getErrorCode() == null || e.getErrorCode().equals("RequestTimeout")) { throw new RetryableException(new IOException(IOUtils.toString(response.getBody()))); } case NOT_FOUND: throw new NotRetryableException(new IOException(IOUtils.toString(response.getBody()))); case INTERNAL_SERVER_ERROR: log.warn("Server error. Stop processing: {}", response.getStatusText()); throw new NotResumableException(new IOException(IOUtils.toString(response.getBody()))); case FORBIDDEN: log.warn("FORBIDDEN response code received"); throw new NotRetryableException( <START> new IOException( <END> "Access refused by object store. Confirm client is part of repository cloud and that the download was initiated less than 1 day earlier (7 days for uploads)" + IOUtils.toString(response.getBody()))); default: log.warn("Retryable exception: {}", response.getStatusText()); throw new RetryableException(new IOException(IOUtils.toString(response.getBody()))); } }</code><technical_language>extract this repeating expression a helper</technical_language>

Target:
public void handleError(ClientHttpResponse response) throws IOException { HttpStatus status = response.getStatusCode(); AmazonS3Exception e = new AmazonS3Exception(IOUtils.toString(response.getBody())); switch (status) { case BAD_REQUEST: if (e.getErrorCode() == null || e.getErrorCode().equals("RequestTimeout")) { throw retryableException(response); } case NOT_FOUND: throw notRetryableException(response); case INTERNAL_SERVER_ERROR: log.warn("Server error. Stop processing: {}", response.getStatusText()); throw notResumableException(response); case FORBIDDEN: log.warn("FORBIDDEN response code received"); throw notRetryableException( "Access refused by object store. Confirm client is part of repository cloud and that the download was initiated less than 1 day earlier (7 days for uploads)", response); default: log.warn("Retryable exception: {}", response.getStatusText()); throw retryableException(response); } }
Source:
<code>public static void registerUserEmailConfirmed(SignUpUser user) { CloseableHttpClient httpClient = HttpClientBuilder.create().disableAutomaticRetries().build(); URL url = null; String env = Configuration.getEnvType().getKey(); String baseURL = XMLReader.getValue("services_internal." + env + ".base_url"); try { url = new URL(baseURL + "/users/emailconfirmed"); } catch (MalformedURLException e) { PageObjectLogging.logError("Wrong internal services URL",e); } try { HttpPost httpPost = new HttpPost(new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef())); <START> httpPost.setHeader("X-Client-Ip", "8.8.8.8"); <END> httpPost.setHeader("X-Wikia-Internal-Request", "1"); List<BasicNameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("username", user.getUsername())); params.add(new BasicNameValuePair("password", user.getPassword())); params.add(new BasicNameValuePair("email", user.getEmail())); params.add(new BasicNameValuePair("birthdate", user.getBirthday().toString())); params.add(new BasicNameValuePair("marketingAllowed", "on")); params.add(new BasicNameValuePair("registrationWikiaId", "80433")); httpPost.setEntity(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8)); httpClient.execute(httpPost); } catch (URISyntaxException | IOException e) { PageObjectLogging.logError("Error during registering user",e); } }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') this IP "8.8.8.8" address configurable. [![rule](<LINK_1>](http://sonar-s4/coding_rules#rule_key=squid%3AS1313)</technical_language>

Target:
public static void registerUserEmailConfirmed(SignUpUser user) { CloseableHttpClient httpClient = HttpClientBuilder.create().disableAutomaticRetries().build(); URL url = null; String env = Configuration.getEnvType().getKey(); String baseURL = XMLReader.getValue("services_internal." + env + ".base_url"); try { url = new URL(baseURL + "user-registration/users/emailconfirmed"); } catch (MalformedURLException e) { PageObjectLogging.logError("Wrong internal services URL", e); } try { HttpPost httpPost = new HttpPost(new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef())); httpPost.setHeader("X-Client-Ip", "8.8.8.8"); httpPost.setHeader("X-Wikia-Internal-Request", "1"); List<BasicNameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("username", user.getUsername())); params.add(new BasicNameValuePair("password", user.getPassword())); params.add(new BasicNameValuePair("email", user.getEmail())); params.add(new BasicNameValuePair("birthdate", user.getBirthday().toString())); params.add(new BasicNameValuePair("marketingAllowed", "on")); params.add(new BasicNameValuePair("registrationWikiaId", "80433")); httpPost.setEntity(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8)); httpClient.execute(httpPost); } catch (URISyntaxException | IOException e) { PageObjectLogging.logError("Error during registering user", e); } }
Source:
<code>public final boolean incrementToken() throws IOException { if (input.incrementToken()) { String converted = STEMMER.stemWord(termAtt.toString()); <START> if (converted != null) END> termAtt.setEmpty().append(converted); return true; } else { return false; } }</code><technical_language>nitpick: curly brackets additionally I return null</technical_language>

Target:
public final boolean incrementToken() throws IOException { if (input.incrementToken()) { String converted = STEMMER.stemWord(termAtt.toString()); if (converted != null) { termAtt.setEmpty().append(converted); } return true; } else { return false; } }
Source:
<code>private String getPostDataByDifferentOption(String postdata, String dataOptionName) { if (dataOptionName.equals("data-urlencode")) { postdata = encodePostdata(postdata); } else { if (postdata.contains("@") && !dataOptionName.equals("data-raw")) { <START> postdata = postdata.replace("@", ""); <END> postdata = readFromFile(postdata); if (!dataOptionName.equals("data-binary")) { postdata = deleteLineBreak(postdata); } } } return postdata; }</code><technical_language>Is this supposed replace @ in text? I thought @ space char</technical_language>

Target:
private String getPostDataByDifferentOption(String postdata, String dataOptionName) { if ("data-urlencode".equals(dataOptionName)) { postdata = encodePostdata(postdata); } else { if (postdata.charAt(0) == '@' && !"data-raw".equals(dataOptionName)) { postdata = postdata.substring(1, postdata.length()); postdata = readFromFile(postdata); if (!"data-binary".equals(dataOptionName)) { postdata = deleteLineBreak(postdata); } } } return postdata; }
Source:
<code><START> public static <T extends PlanNode> Rule<T> checkPlanDoNotMatch(Pattern<T> pattern, String message) <END> { return new Rule<T>() { @Override public Pattern<T> getPattern() { return pattern; } @Override public Result apply(T node, Captures captures, Context context) { throw new IllegalStateException(message); } }; }</code><technical_language>validate arguments returning new rule</technical_language>

Target:
public static <T extends PlanNode> Rule<T> checkPlanDoNotMatch(Pattern<T> pattern, String message) { requireNonNull(pattern, "pattern is null"); requireNonNull(message, "message is null"); return new Rule<T>() { @Override public Pattern<T> getPattern() { return pattern; } @Override public Result apply(T node, Captures captures, Context context) { throw new IllegalStateException(message); } }; }