auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testProtectFilename() throws Exception { PerforceRepository instance = new PerforceRepository(); <START> ArrayList<SimpleImmutableEntry<String,String>> testmap = new ArrayList<SimpleImmutableEntry<String,String>>() { <END> { add(new SimpleImmutableEntry<>("Testfile 34", "Testfile 34")); add(new SimpleImmutableEntry<>("Test%52", "Test%2552")); add(new SimpleImmutableEntry<>("Test*4+2", "Test%2A4+2")); add(new SimpleImmutableEntry<>("Test@", "Test%40")); add(new SimpleImmutableEntry<>("@seventeen", "%40seventeen")); add(new SimpleImmutableEntry<>("upNdown(", "upNdown(")); add(new SimpleImmutableEntry<>("tst#99", "tst%2399")); } }; for (SimpleImmutableEntry<String,String> ent : testmap) { String prot = instance.protectPerforceFilename(ent.getKey()); assertEquals("Improper protected filename, "+prot+" != "+ent.getValue(), ent.getValue(), prot); } }</code><technical_language>I pretty diamond operator fully sides</technical_language>

Target:
public void testProtectFilename() throws Exception { ArrayList<SimpleImmutableEntry<String,String>> testmap = new ArrayList<>(); testmap.add(new SimpleImmutableEntry<>("Testfile 34", "Testfile 34")); testmap.add(new SimpleImmutableEntry<>("Test%52", "Test%2552")); testmap.add(new SimpleImmutableEntry<>("Test*4+2", "Test%2A4+2")); testmap.add(new SimpleImmutableEntry<>("Test@", "Test%40")); testmap.add(new SimpleImmutableEntry<>("@seventeen", "%40seventeen")); testmap.add(new SimpleImmutableEntry<>("upNdown(", "upNdown(")); testmap.add(new SimpleImmutableEntry<>("tst#99", "tst%2399")); testmap.add(new SimpleImmutableEntry<>("#File*Three%trig", "%23File%2AThree%25trig")); testmap.add(new SimpleImmutableEntry<>("Two%and5#3#4", "Two%25and5%233%234")); for (SimpleImmutableEntry<String,String> ent : testmap) { String prot = protectPerforceFilename(ent.getKey()); assertEquals("Improper protected filename, "+prot+" != "+ent.getValue(), ent.getValue(), prot); } }
Source:
<code>public void showLabelPicker_typeQuery_displaysCorrectly() { triggerLabelPicker(getIssueCard(DEFAULT_ISSUECARD_ID).getIssue()); TextField labelPickerTextField = find(QUERY_FIELD_ID); click(labelPickerTextField); type("world"); assertEquals("world", labelPickerTextField.getText()); push(KeyCode.ESCAPE); waitUntilNodeDisappears(QUERY_FIELD_ID); <START> } <END></code><technical_language>@jinified start exploring UI tests. put in unstable tests. I a do UI tests secondary windows yet. @dariusf for advice</technical_language>

Target:
public void showLabelPicker_typeQuery_displaysCorrectly() { triggerLabelPicker(getIssueCard(DEFAULT_ISSUECARD_ID).getIssue()); TextField labelPickerTextField = find(QUERY_FIELD_ID); click(labelPickerTextField); type("world"); assertEquals("world", labelPickerTextField.getText()); exitCleanly(); }
Source:
<code>public DateMessageParser(SecorConfig config) { super(config); TimeZone timeZone = config.getTimeZone(); inputPattern = mConfig.getMessageTimestampInputPattern(); inputFormatter = new SimpleDateFormat(inputPattern.toString()); inputFormatter.setTimeZone(timeZone); outputFormatter.setTimeZone(timeZone); <START> mDtPrefix = (TimestampedMessageParser.usingDatePrefix(config) == null) ? "" : TimestampedMessageParser.usingDatePrefix(config); <END> }</code><technical_language>TimestampedMessageParser.usingDatePrefix() provides a default value, I simply do: mDtPrefix = TimestampedMessageParser.usingDatePrefix(config)</technical_language>

Target:
public DateMessageParser(SecorConfig config) { super(config); TimeZone timeZone = config.getTimeZone(); inputPattern = mConfig.getMessageTimestampInputPattern(); inputFormatter = new SimpleDateFormat(inputPattern.toString()); inputFormatter.setTimeZone(timeZone); outputFormatter.setTimeZone(timeZone); mDtPrefix = TimestampedMessageParser.usingDatePrefix(config); }
Source:
<code>protected UserSettings getUserSettings(UserSettings scopeSettings, UserInfo userInfo) { U user = userInfo.getUserObject(getUserClass()); Config userAccountConfig = user.getUserAccountData().getPermissions().getConfig(); Config tenantConfig = user.getTenant().fetchValue().getTenantData().getConfig(); if (userAccountConfig == null) { if (tenantConfig == null) { return scopeSettings; } return configCache.get(user.getTenant().getUniqueObjectName(), i -> { Config cfg = scopeSettings.getConfig(); cfg = tenantConfig.withFallback(cfg); return Tuple.create(new UserSettings(cfg, false), user.getTenant().getUniqueObjectName()); }).getFirst(); } return configCache.get(user.getUniqueName(), i -> { Config cfg = scopeSettings.getConfig(); if (tenantConfig != null) { <START> cfg = tenantConfig.withFallback(cfg); <END> } cfg = userAccountConfig.withFallback(cfg); return Tuple.create(new UserSettings(cfg, false), user.getTenant().getUniqueObjectName()); }).getFirst(); }</code><technical_language>i --></technical_language>

Target:
protected UserSettings getUserSettings(UserSettings scopeSettings, UserInfo userInfo) { U user = userInfo.getUserObject(getUserClass()); Config userAccountConfig = user.getUserAccountData().getPermissions().getConfig(); Config tenantConfig = user.getTenant().fetchValue().getTenantData().getConfig(); if (userAccountConfig == null) { if (tenantConfig == null) { return scopeSettings; } return configCache.get(user.getTenant().getUniqueObjectName(), ignored -> { Config config = scopeSettings.getConfig(); config = tenantConfig.withFallback(config); return Tuple.create(new UserSettings(config, false), user.getTenant().getUniqueObjectName()); }).getFirst(); } return configCache.get(user.getUniqueName(), ignored -> { Config config = scopeSettings.getConfig(); if (tenantConfig != null) { config = tenantConfig.withFallback(config); } config = userAccountConfig.withFallback(config); return Tuple.create(new UserSettings(config, false), user.getTenant().getUniqueObjectName()); }).getFirst(); }
Source:
<code>public Object getValue(EObject object, EStructuralFeature feature, Object value, String loadedVersion) { if (Version.parseVersion(loadedVersion).compareTo(ReplaceModelsBySemanticResources.MIGRATION_VERSION) < 0) { if (ViewpointPackage.eINSTANCE.getDAnalysis_Models().equals(feature)) { if (value instanceof InternalEObject) { <START> String strvalue = ((InternalEObject) value).eProxyURI().toString(); strvalue = strvalue.replaceFirst("#.*", ""); <END> return strvalue; } } } return super.getValue(object, feature, value, loadedVersion); }</code><technical_language>Prefer URI#trimFragment() URI#trimQuery() raw string manipulations</technical_language>

Target:
public Object getValue(EObject object, EStructuralFeature feature, Object value, String loadedVersion) { if (Version.parseVersion(loadedVersion).compareTo(ReplaceModelsBySemanticResources.MIGRATION_VERSION) < 0) { if (ViewpointPackage.eINSTANCE.getDAnalysis_Models().equals(feature)) { if (value instanceof InternalEObject) { String strvalue = ((InternalEObject) value).eProxyURI().trimFragment().toString(); return strvalue; } } } return super.getValue(object, feature, value, loadedVersion); }
Source:
<code>void connect(final Consumer<String> errorHandler) { Preconditions.checkState(!client.isOpen()); Preconditions.checkState(!closed); connectAsync() .whenComplete( (connected, throwable) -> { if (connected && throwable == null) { pingSender.start(); } else { errorHandler.accept("Failed to connect to: " + serverUri); } <START> }); <END> }</code><technical_language>technically get error here, errorHandler throws some exception, ping sender some issue. In cases silently fail. > expect ping sender start error handler throw exceptions. I exceptions expected time for a pythonic EAFP style: <LINK_0> This is perfectly fine example CompletableFutureUtils</technical_language>

Target:
CompletableFuture<Boolean> connect(final Consumer<String> errorHandler) { Preconditions.checkState(!client.isOpen()); Preconditions.checkState(!closed); return connectAsync() .whenComplete( (connected, throwable) -> { if (connected && throwable == null) { pingSender.start(); } else { errorHandler.accept("Failed to connect to: " + serverUri); } }); }
Source:
<code>private void upgradeBuddy(Buddy buddy) { BuddyAnonymized buddyAnonymized = buddy.getBuddyAnonymized(); buddy.setLastStatusChangeTime(buddyAnonymized.getLastStatusChangeTime()); <START> buddyAnonymized.clearLastStatusChangeTime(); <END> }</code><technical_language>explicitly save this</technical_language>

Target:
private void upgradeBuddy(Buddy buddy) { BuddyAnonymized buddyAnonymized = buddy.getBuddyAnonymized(); buddy.setLastStatusChangeTime(buddyAnonymized.getLastStatusChangeTime()); buddyAnonymized.clearLastStatusChangeTime(); BuddyAnonymized.getRepository().save(buddyAnonymized); }
Source:
<code>public void searchInputAcceptsValue() { <START> SearchInput searchInput = new SearchInput().searchInputValue(); <END> SearchInput searchInputSubmit = new SearchInput().searchInputSubmit(); String URL = driver.getCurrentUrl(); Assert.assertEquals(URL, "<LINK_2>"); SearchInput firstInstance = new SearchInput().firstPostInstance(); }</code><technical_language>![MAJOR](<LINK_0> Remove this unused "searchInput" local variable. [![rule](<LINK_1>](http://sonar-s1/coding_rules#rule_key=squid%3AS1481)</technical_language>

Target:
public void searchInputAcceptsValue() { SearchInput searchInput = new SearchInput().searchInputValue(); SearchInput searchInputSubmit = new SearchInput().searchInputSubmit(); String URL = driver.getCurrentUrl(); Assert.assertEquals(URL, "<LINK_2>"); SearchInput firstPostTitle = new SearchInput().getPostTitle(); SearchInput firstInstance = new SearchInput().firstPostInstance(); SearchInput postTitleFinal = new SearchInput().getPostTitleFinal(); Assert.assertEquals(firstPostTitle, postTitleFinal); }
Source:
<code>JoinEnumerationResult createJoinAccordingToPartitioning(LinkedHashSet<PlanNode> sources, List<Symbol> outputSymbols, Set<Integer> partitioning) { List<PlanNode> sourceList = ImmutableList.copyOf(sources); LinkedHashSet<PlanNode> leftSources = partitioning.stream() .map(sourceList::get) <START> .collect(Collectors.toCollection(LinkedHashSet::new)); <END> LinkedHashSet<PlanNode> rightSources = sources.stream() .filter(source -> !leftSources.contains(source)) .collect(Collectors.toCollection(LinkedHashSet::new)); return createJoin(leftSources, rightSources, outputSymbols); }</code><technical_language>static import</technical_language>

Target:
JoinEnumerationResult createJoinAccordingToPartitioning(LinkedHashSet<PlanNode> sources, List<Symbol> outputSymbols, Set<Integer> partitioning) { List<PlanNode> sourceList = ImmutableList.copyOf(sources); LinkedHashSet<PlanNode> leftSources = partitioning.stream() .map(sourceList::get) .collect(toCollection(LinkedHashSet::new)); LinkedHashSet<PlanNode> rightSources = sources.stream() .filter(source -> !leftSources.contains(source)) .collect(toCollection(LinkedHashSet::new)); return createJoin(leftSources, rightSources, outputSymbols); }
Source:
<code>protected void configureMergeAction(String mergeActionId, Action action) { if (mergeActionId==null) return; <START> <END> switch (mergeActionId) { case SynchronizationActionProvider.MERGE_ACTION_ID: Utils.initAction(action, "action.merge."); break; case SynchronizationActionProvider.OVERWRITE_ACTION_ID: if (isTwoWayMerge()) { Utils.initAction(action, "action.replace."); } else { Utils.initAction(action, "action.overwrite."); } break; case SynchronizationActionProvider.MARK_AS_MERGE_ACTION_ID: Utils.initAction(action, "action.markAsMerged."); break; case MERGE_ALL_ACTION_ID: if (isTwoWayMerge()) { Utils.initAction(action, "action.replaceAll."); } else { Utils.initAction(action, "action.mergeAll."); } break; default: break; } }</code><technical_language>Missing whitespace ==, missing {}, trailing whitespace. Generally unclear replacing identity comparisons a switch is improvement</technical_language>

Target:
protected void configureMergeAction(String mergeActionId, Action action) { if (mergeActionId == null) { return; } switch (mergeActionId) { case SynchronizationActionProvider.MERGE_ACTION_ID: Utils.initAction(action, "action.merge."); break; case SynchronizationActionProvider.OVERWRITE_ACTION_ID: if (isTwoWayMerge()) { Utils.initAction(action, "action.replace."); } else { Utils.initAction(action, "action.overwrite."); } break; case SynchronizationActionProvider.MARK_AS_MERGE_ACTION_ID: Utils.initAction(action, "action.markAsMerged."); break; case MERGE_ALL_ACTION_ID: if (isTwoWayMerge()) { Utils.initAction(action, "action.replaceAll."); } else { Utils.initAction(action, "action.mergeAll."); } break; default: break; } }
Source:
<code>public void testOffsetsCommit() throws Exception { final String etName = createEventType().getName(); final String topic = EVENT_TYPE_REPO.findByName(etName).getTopic(); final Subscription subscription = createSubscriptionForEventType(etName); final TestStreamingClient client = TestStreamingClient .create(URL, subscription.getId(), "") .start(); <START> Thread.sleep(1000); <END> String cursor = "[{\"partition\":\"0\",\"offset\":\"25\",\"event_type\":\"" + etName + "\",\"cursor_token\":\"abc\"}]"; commitCursors(subscription, cursor, client.getSessionId()) .then() .statusCode(HttpStatus.SC_NO_CONTENT); final CuratorFramework curator = ZookeeperTestUtils.createCurator(ZOOKEEPER_URL); String committedOffset = getCommittedOffsetFromZk(topic, subscription, "0", curator); assertThat(committedOffset, equalTo("25")); cursor = "[{\"partition\":\"0\",\"offset\":\"10\",\"event_type\":\"" + etName + "\",\"cursor_token\":\"abc\"}]"; commitCursors(subscription, cursor, client.getSessionId()) .then() .statusCode(HttpStatus.SC_OK); committedOffset = getCommittedOffsetFromZk(topic, subscription, "0", curator); assertThat(committedOffset, equalTo("25")); }</code><technical_language>decided this approach Thread.sleep if possible, unclean lead random behavior. Instead do like: TestUtils.waitFor(() -> assertThat(client.getSessionId(), not(equalTo("UNKNOWN")))); wait for need, abstract 1 second</technical_language>

Target:
public void testOffsetsCommit() throws Exception { final String etName = createEventType().getName(); final String topic = EVENT_TYPE_REPO.findByName(etName).getTopic(); final Subscription subscription = createSubscriptionForEventType(etName); final TestStreamingClient client = TestStreamingClient .create(URL, subscription.getId(), "") .start(); waitFor(() -> assertThat(client.getSessionId(), not(equalTo("UNKNOWN")))); String cursor = "[{\"partition\":\"0\",\"offset\":\"25\",\"event_type\":\"" + etName + "\",\"cursor_token\":\"abc\"}]"; commitCursors(subscription, cursor, client.getSessionId()) .then() .statusCode(HttpStatus.SC_NO_CONTENT); final CuratorFramework curator = ZookeeperTestUtils.createCurator(ZOOKEEPER_URL); String committedOffset = getCommittedOffsetFromZk(topic, subscription, "0", curator); assertThat(committedOffset, equalTo("25")); cursor = "[{\"partition\":\"0\",\"offset\":\"10\",\"event_type\":\"" + etName + "\",\"cursor_token\":\"abc\"}]"; commitCursors(subscription, cursor, client.getSessionId()) .then() .statusCode(HttpStatus.SC_OK); committedOffset = getCommittedOffsetFromZk(topic, subscription, "0", curator); assertThat(committedOffset, equalTo("25")); }
Source:
<code>public Object getRelation( DataStoreTransaction relationTx, Object entity, String relationName, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination, RequestScope scope) { EntityDictionary dictionary = scope.getDictionary(); Object val = com.yahoo.elide.core.PersistentResource.getValue(entity, relationName, scope); if (val instanceof Collection) { Collection filteredVal = (Collection) val; if (filteredVal instanceof AbstractPersistentCollection) { @SuppressWarnings("unchecked") Class<?> relationClass = dictionary.getParameterizedType(entity, relationName); AbstractHQLQueryBuilder.Relationship relationship = new AbstractHQLQueryBuilder.Relationship() { @Override public Class<?> getParentType() { return entity.getClass(); } @Override <START> public Class<?> getChildType() { <END> return relationClass; } @Override public String getRelationshipName() { return relationName; } @Override public Object getParent() { return entity; } @Override public Collection getChildren() { return filteredVal; } }; pagination.ifPresent(p -> { if (p.isGenerateTotals()) { p.setPageTotals(getTotalRecords(relationship, filterExpression, dictionary)); } }); final QueryWrapper query = (QueryWrapper) new SubCollectionFetchQueryBuilder(relationship, dictionary, sessionWrapper) .withPossibleFilterExpression(filterExpression) .withPossibleSorting(sorting) .withPossiblePagination(pagination) .build(); if (query != null) { return query.getQuery().list(); } } } return val; }</code><technical_language>Is a reason inline anonymous class here? cleaner a this trivial class generated Lombok (e.g. @Data)</technical_language>

Target:
public Object getRelation( DataStoreTransaction relationTx, Object entity, String relationName, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination, RequestScope scope) { EntityDictionary dictionary = scope.getDictionary(); Object val = com.yahoo.elide.core.PersistentResource.getValue(entity, relationName, scope); if (val instanceof Collection) { Collection filteredVal = (Collection) val; if (filteredVal instanceof AbstractPersistentCollection) { @SuppressWarnings("unchecked") Class<?> relationClass = dictionary.getParameterizedType(entity, relationName); RelationshipImpl relationship = new RelationshipImpl( entity.getClass(), relationClass, relationName, entity, filteredVal); pagination.ifPresent(p -> { if (p.isGenerateTotals()) { p.setPageTotals(getTotalRecords(relationship, filterExpression, dictionary)); } }); final QueryWrapper query = (QueryWrapper) new SubCollectionFetchQueryBuilder(relationship, dictionary, sessionWrapper) .withPossibleFilterExpression(filterExpression) .withPossibleSorting(sorting) .withPossiblePagination(pagination) .build(); if (query != null) { return query.getQuery().list(); } } } return val; }
Source:
<code>public List<SMSAlert> getDailyAlerts(){ LocalDateTime today = DatabaseUtilities.getCurrentDateTime(); <START> String sql = "SELECT * FROM sms_alerts"; <END> sql += " WHERE"; sql += " (court_date < '"+DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today.plusDays(15))+"'"; sql += " AND "; sql += "court_date > '"+DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today.plusDays(13))+"')"; sql += " OR "; sql += " (court_date < '"+DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today.plusDays(8))+"'"; sql += " AND "; sql += "court_date > '"+DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today.plusDays(6))+"')"; sql += " OR "; sql += " (court_date < '"+DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today.plusDays(2))+"'"; sql += " AND "; sql += "court_date > '"+DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today)+"')"; try { Map<String, Object> parameterMap = new HashMap<String, Object>(); List<SMSAlert> smsAlerts = jdbcTemplate.query(sql, parameterMap, new SMSAlertSQLMapper()); return smsAlerts; } catch (Exception e) { LogSystem.LogDBException(e); return null; } }</code><technical_language>Again, putting this in a separate sql file parameterMap a lot cleaner</technical_language>

Target:
public List<SMSAlert> getDailyAlerts(){ LocalDateTime today = DatabaseUtilities.getCurrentDateTime(); Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("twoWeekPlus", DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today.plusDays(15))); parameterMap.put("twoWeekMinus", DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today.plusDays(13))); parameterMap.put("oneWeekPlus", DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today.plusDays(8))); parameterMap.put("oneWeekMinus", DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today.plusDays(6))); parameterMap.put("todayPlus", DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today.plusDays(2))); parameterMap.put("today", DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(today)); try { List<SMSAlert> smsAlerts = jdbcTemplate.query(getSql("SMSAlert/get-daily-SMSAlerts.sql"), parameterMap, new SMSAlertSQLMapper()); return smsAlerts; } catch (Exception e) { LogSystem.LogDBException(e); return null; } }
Source:
<code>public RegistrationUpdate(String registrationId, Identity identity, Long lifeTimeInSec, String smsNumber, BindingMode bindingMode, Link[] objectLinks, Map<String, String> additionalAttributes) { Validate.notNull(registrationId); Validate.notNull(identity); this.registrationId = registrationId; this.identity = identity; this.lifeTimeInSec = lifeTimeInSec; this.smsNumber = smsNumber; this.bindingMode = bindingMode; this.objectLinks = objectLinks; if (additionalAttributes == null) this.additionalAttributes = Collections.emptyMap(); else <START> this.additionalAttributes = Collections.synchronizedMap(new HashMap<>(additionalAttributes)); <END> }</code><technical_language>RegistrationUpdate immutable</technical_language>

Target:
public RegistrationUpdate(String registrationId, Identity identity, Long lifeTimeInSec, String smsNumber, BindingMode bindingMode, Link[] objectLinks, Map<String, String> additionalAttributes) { Validate.notNull(registrationId); Validate.notNull(identity); this.registrationId = registrationId; this.identity = identity; this.lifeTimeInSec = lifeTimeInSec; this.smsNumber = smsNumber; this.bindingMode = bindingMode; this.objectLinks = objectLinks; if (additionalAttributes == null) this.additionalAttributes = Collections.emptyMap(); else this.additionalAttributes = Collections.unmodifiableMap(new HashMap<>(additionalAttributes)); }
Source:
<code>public void test_changelog_with_merge_commit() throws Exception { w.init(); w.commitEmpty("init"); w.git.branch("branch1"); w.git.checkout("branch1"); w.touch("file1", "content1"); w.git.add("file1"); w.git.commit("commit1"); String commitSha1 = w.git.revParse("HEAD").name(); w.git.checkout("master"); String mergeMessage = "Merge message to be tested."; w.git.merge().setMessage(mergeMessage).setGitPluginFastForwardMode(MergeCommand.GitPluginFastForwardMode.NO_FF).setRevisionToMerge(w.git.getHeadRev(w.repoPath(), "branch1")).execute(); String mergeSha1 = w.git.revParse("HEAD").name(); check_changelog_sha1(w.git.changelog().listMerges(true),mergeSha1, "master"); check_changelog_sha1(w.git.changelog().listMerges(false),commitSha1, "master"); <START> check_changelog_sha1(w.git.changelog(),commitSha1, "master"); <END> }</code><technical_language>Unfortunately, I shed more light difference. need investigate walker is behaving way</technical_language>

Target:
public void test_changelog_with_merge_commit() throws Exception { w.init(); w.commitEmpty("init"); w.git.branch("branch1"); w.git.checkout("branch1"); w.touch("file1", "content1"); w.git.add("file1"); w.git.commit("commit1"); String commitSha1 = w.git.revParse("HEAD").name(); w.git.checkout("master"); String mergeMessage = "Merge message to be tested."; w.git.merge().setMessage(mergeMessage).setGitPluginFastForwardMode(MergeCommand.GitPluginFastForwardMode.NO_FF).setRevisionToMerge(w.git.getHeadRev(w.repoPath(), "branch1")).execute(); String mergeSha1 = w.git.revParse("HEAD").name(); assertThat("Merge commit exists in output",get_changelog(w.git.changelog()),not(containsString(mergeSha1))); assertThat("Merge commit exists in output",get_changelog(w.git.changelog().listMerges(false)),not(containsString(mergeSha1))); assertThat("Merge commit is not the first commit",get_changelog(w.git.changelog().listMerges(true)),startsWith(("commit " + mergeSha1))); }
Source:
<code>protected boolean validate() { Guid nicId = getParameters().getNicId(); HostInterfaceValidator hostInterfaceValidator = new HostInterfaceValidator(getNic()); ValidationResult validationResult = hostInterfaceValidator.interfaceExists(nicId); if (!validationResult.isValid()) { return validate(validationResult); } <START> return validate(hostInterfaceValidator.nicIsNotLabeledWithSpecifiedLabel(getLabel())); <END> }</code><technical_language>Maybe- return validate(hostInterfaceValidator.interfaceExists(nicId)) && validate(hostInterfaceValidator.nicIsNotLabeledWithSpecifiedLabel(getLabel()));</technical_language>

Target:
protected boolean validate() { Guid nicId = getParameters().getNicId(); HostInterfaceValidator hostInterfaceValidator = new HostInterfaceValidator(getNic()); return validate(hostInterfaceValidator.interfaceExists(nicId)) && validate(hostInterfaceValidator.nicIsNotLabeledWithSpecifiedLabel(getLabel())); }
Source:
<code><START> protected Object computeParameterValue(JpaParameter parameter, Object value, Object[] values) { <END> return value; }</code><technical_language>I need if drop support for expression parameters repository method parameters, right</technical_language>

Target:
private Object computeParameterValue(JpaParameter parameter, Object value, Object[] values) { return value; }
Source:
<code>public ContainerCDNMetadata apply(final HttpResponse from) { String cdnEnabled = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_ENABLED), CloudFilesHeaders.CDN_ENABLED); String cdnLogRetention = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_LOG_RETENTION), CloudFilesHeaders.CDN_LOG_RETENTION); String cdnTTL = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_TTL), CloudFilesHeaders.CDN_TTL); String cdnUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_URI), CloudFilesHeaders.CDN_URI); String cdnSslUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_SSL_URI), CloudFilesHeaders.CDN_SSL_URI); String cdnStreamingUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_STREAMING_URI), CloudFilesHeaders.CDN_STREAMING_URI); String cdnIosUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_IOS_URI), CloudFilesHeaders.CDN_IOS_URI); List<String> parts = newArrayList(Splitter.on('/').split(request.getEndpoint().getPath())); <START> checkArgument(parts.size() > 0); <END> return new ContainerCDNMetadata( parts.get(parts.size() - 1), Boolean.parseBoolean(cdnEnabled), Boolean.parseBoolean(cdnLogRetention), Integer.parseInt(cdnTTL), URI.create(cdnUri), URI.create(cdnSslUri), URI.create(cdnStreamingUri), URI.create(cdnIosUri)); }</code><technical_language>[minor] !parts.isEmpty()</technical_language>

Target:
public ContainerCDNMetadata apply(final HttpResponse from) { String cdnEnabled = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_ENABLED), CloudFilesHeaders.CDN_ENABLED); String cdnLogRetention = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_LOG_RETENTION), CloudFilesHeaders.CDN_LOG_RETENTION); String cdnTTL = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_TTL), CloudFilesHeaders.CDN_TTL); String cdnUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_URI), CloudFilesHeaders.CDN_URI); String cdnSslUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_SSL_URI), CloudFilesHeaders.CDN_SSL_URI); String cdnStreamingUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_STREAMING_URI), CloudFilesHeaders.CDN_STREAMING_URI); String cdnIosUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_IOS_URI), CloudFilesHeaders.CDN_IOS_URI); List<String> parts = newArrayList(Splitter.on('/').split(request.getEndpoint().getPath())); checkArgument(!parts.isEmpty(), "incorrect path: " + request.getEndpoint().getPath()); return new ContainerCDNMetadata( Iterables.getLast(parts), Boolean.parseBoolean(cdnEnabled), Boolean.parseBoolean(cdnLogRetention), Long.parseLong(cdnTTL), URI.create(cdnUri), URI.create(cdnSslUri), URI.create(cdnStreamingUri), URI.create(cdnIosUri)); }
Source:
<code><START> private void init() { <END> this.head = new Head(driver); this.navigate = new Navigate(driver); }</code><technical_language>Please @BeforeMethod(alwaysRun = true) insted of init() of test body</technical_language>

Target:
private void init() { this.head = new Head(); this.navigate = new Navigate(driver); }
Source:
<code>public void process(final K key, final Change<V1> change) { if (key == null) { LOG.warn( "Skipping record due to null key. change=[{}] topic=[{}] partition=[{}] offset=[{}]", change, context().topic(), context().partition(), context().offset() ); metrics.skippedRecordsSensor().record(); return; } R newValue = null; final long resultTimestamp; R oldValue = null; final ValueAndTimestamp<V2> valueAndTimestampRight = valueGetter.get(key); final V2 valueRight = getValueOrNull(valueAndTimestampRight); if (valueRight == null) { return; } if (change.newValue != null) { newValue = joiner.apply(change.newValue, valueRight); resultTimestamp = Math.max(context().timestamp(), valueAndTimestampRight.timestamp()); } else { <START> resultTimestamp = context().timestamp(); <END> } if (sendOldValues && change.oldValue != null) { oldValue = joiner.apply(change.oldValue, valueRight); } context().forward(key, new Change<>(newValue, oldValue), To.all().withTimestamp(resultTimestamp)); }</code><technical_language>incorporate right side's timestamp here? Otherwise, get time-travel. observe RIGHT A:y (ts 2) observe LEFT A:x (ts 0) result A:(x,y) (ts 2) observe LEFT A:null (ts 1) result A:null (ts 2? 1?) Similar KTableAggregate, result timestamp non-decreasing, want 2, 1. some other part of join care of this</technical_language>

Target:
public void process(final K key, final Change<V1> change) { if (key == null) { LOG.warn( "Skipping record due to null key. change=[{}] topic=[{}] partition=[{}] offset=[{}]", change, context().topic(), context().partition(), context().offset() ); metrics.skippedRecordsSensor().record(); return; } R newValue = null; final long resultTimestamp; R oldValue = null; final ValueAndTimestamp<V2> valueAndTimestampRight = valueGetter.get(key); final V2 valueRight = getValueOrNull(valueAndTimestampRight); if (valueRight == null) { return; } resultTimestamp = Math.max(context().timestamp(), valueAndTimestampRight.timestamp()); if (change.newValue != null) { newValue = joiner.apply(change.newValue, valueRight); } if (sendOldValues && change.oldValue != null) { oldValue = joiner.apply(change.oldValue, valueRight); } context().forward(key, new Change<>(newValue, oldValue), To.all().withTimestamp(resultTimestamp)); }
Source:
<code>public void scan(HttpMessage msg, String paramName, String attack) { Stats.incCounter("domxss.scan.count"); ArrayList<WebDriverWrapper> drivers = new ArrayList<WebDriverWrapper>(); WebDriverWrapper fxDriver; try { fxDriver = this.getFirefoxDriver(); } catch (Exception e) { getLog().warn("Skipping scanner, failed to start Firefox: " + e.getMessage()); getParent().pluginSkipped(this, Constant.messages.getString("domxss.skipped.reason.browsererror")); return; } drivers.add(fxDriver); try { for (String attackVector : PARAM_ATTACK_STRINGS) { if (scan(drivers, paramName, attackVector)) { if (!Plugin.AlertThreshold.LOW.equals(this.getAlertThreshold())) { break; } } } } finally { this.returnFirefoxDriver(fxDriver); <START> } <END> }</code><technical_language>preferable change existing method (to pass currURL) avoid code duplication</technical_language>

Target:
public void scan(HttpMessage msg, String paramName, String attack) { Stats.incCounter("domxss.scan.count"); for (String attackVector : PARAM_ATTACK_STRINGS) { TreeSet<HtmlParameter> urlParams = msg.getUrlParams(); for (HtmlParameter param : urlParams) { if (param.getName().equals(paramName)) { param.setValue(attackVector); } } msg.setGetParams(urlParams); if (scan(attackVector, msg.getRequestHeader().getURI().toString())) { if (!Plugin.AlertThreshold.LOW.equals(this.getAlertThreshold())) { break; } } } }
Source:
<code><START> private NettyIoPool(String name, NettyIoPoolConfig config) <END> { checkNotNull(name, "name is null"); checkNotNull(config, "config is null"); String prefix = "netty-client-" + name + "-io-"; this.hashedWheelTimer = new HashedWheelTimer(new ThreadFactoryBuilder().setNameFormat(prefix + "timer-%s").setDaemon(true).build()); this.bossExecutor = newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat(prefix + "boss-%s").setDaemon(true).build()); this.workerExecutor = newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat(prefix + "worker-%s").setDaemon(true).build()); this.bossPool = new NioClientBossPool(bossExecutor, config.getIoBossThreads(), hashedWheelTimer, ThreadNameDeterminer.CURRENT); this.workerPool = new NioWorkerPool(workerExecutor, config.getIoWorkerThreads(), ThreadNameDeterminer.CURRENT); }</code><technical_language>Save name in a field debugging. add toString</technical_language>

Target:
private NettyIoPool(String name, NettyIoPoolConfig config) { this.name = checkNotNull(name, "name is null"); checkNotNull(config, "config is null"); String prefix = "netty-client-" + name + "-io-"; this.hashedWheelTimer = new HashedWheelTimer(new ThreadFactoryBuilder().setNameFormat(prefix + "timer-%s").setDaemon(true).build()); this.bossExecutor = newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat(prefix + "boss-%s").setDaemon(true).build()); this.workerExecutor = newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat(prefix + "worker-%s").setDaemon(true).build()); this.bossPool = new NioClientBossPool(bossExecutor, config.getIoBossThreads(), hashedWheelTimer, ThreadNameDeterminer.CURRENT); this.workerPool = new NioWorkerPool(workerExecutor, config.getIoWorkerThreads(), ThreadNameDeterminer.CURRENT); }
Source:
<code>private PreparedStatement getPreparedStatement(Connection connection, TableMetaDataView tableMetaData, EntryColumnData entryColumnData, Operation operation) throws SQLException { String sqlStr = getSqlString(tableMetaData, entryColumnData, operation); if (logger.isDebugEnabled()) { <START> logger.debug("SQL:{} key:{} value:{}", sqlStr, entryColumnData.getEntryKeyColumnData(), <END> entryColumnData.getEntryValueColumnData()); } return connection.prepareStatement(sqlStr); }</code><technical_language>This log output a more descriptive. Possibly "Got SQL string:{} key:{} value:{}"</technical_language>

Target:
private PreparedStatement getPreparedStatement(Connection connection, TableMetaDataView tableMetaData, EntryColumnData entryColumnData, Operation operation) throws SQLException { String sqlStr = getSqlString(tableMetaData, entryColumnData, operation); if (logger.isDebugEnabled()) { logger.debug("Got SQL string:{} with key:{} value:{}", sqlStr, entryColumnData.getEntryKeyColumnData(), entryColumnData.getEntryValueColumnData()); } return connection.prepareStatement(sqlStr); }
Source:
<code>public void getMetrics( @Suspended AsyncResponse asyncResponse, @ApiParam(value = "List of tags filters", required = false) @QueryParam("tags") Tags tags) { Observable<Metric<AvailabilityType>> metricObservable = (tags == null) ? metricsService.findMetrics(getTenant(), AVAILABILITY) <START> : metricsService.findMetricIndentifiersWithFilters(getTenant(), AVAILABILITY, tags.getTags()) <END> .flatMap(metricsService::findMetric); metricObservable .compose(new MinMaxTimestampTransformer<>(metricsService)) .toList() .map(ApiUtils::collectionToResponse) .subscribe(asyncResponse::resume, t -> { if (t instanceof PatternSyntaxException) { asyncResponse.resume(badRequest(t)); } else { asyncResponse.resume(serverError(t)); } }); }</code><technical_language>findMetricIdentifier, indentifier ;) (same everywhere)</technical_language>

Target:
public void getMetrics( @Suspended AsyncResponse asyncResponse, @ApiParam(value = "List of tags filters", required = false) @QueryParam("tags") Tags tags) { Observable<Metric<AvailabilityType>> metricObservable = (tags == null) ? metricsService.findMetrics(getTenant(), AVAILABILITY) : metricsService.findMetricIdentifiersWithFilters(getTenant(), AVAILABILITY, tags.getTags()) .flatMap(metricsService::findMetric); metricObservable .compose(new MinMaxTimestampTransformer<>(metricsService)) .toList() .map(ApiUtils::collectionToResponse) .subscribe(asyncResponse::resume, t -> { if (t instanceof PatternSyntaxException) { asyncResponse.resume(badRequest(t)); } else { asyncResponse.resume(serverError(t)); } }); }
Source:
<code>private static void handleEvents(HistogramBucket[] buckets, double[] series, int traceIndex, int nbTrace) { for (int i = 0; i < series.length; i++) { HistogramBucket bucket = buckets[i]; if (bucket == null) { bucket = new HistogramBucket(nbTrace); <START> bucket.addEvent(traceIndex, (int) series[i]); <END> } else { bucket.addEvent(traceIndex, (int) series[i]); } buckets[i] = bucket; } }</code><technical_language>move out of if/else for cases</technical_language>

Target:
private static void handleEvents(HistogramBucket[] buckets, double[] series, int traceIndex, int nbTrace) { for (int i = 0; i < series.length; i++) { HistogramBucket bucket = buckets[i]; if (bucket == null) { bucket = new HistogramBucket(nbTrace); } bucket.addEvent(traceIndex, (int) series[i]); buckets[i] = bucket; } }
Source:
<code>synchronized boolean canRetry(ProduceResponse.PartitionResponse response, ProducerBatch batch) { if (!hasProducerIdAndEpoch(batch)) return false; Errors error = response.error; if (error == Errors.UNKNOWN_PRODUCER_ID && !isTransactional()) { bumpEpoch(); return true; } else if (error == Errors.OUT_OF_ORDER_SEQUENCE_NUMBER) { if (!hasUnresolvedSequence(batch.topicPartition) && (batch.sequenceHasBeenReset() || !isNextSequence(batch.topicPartition, batch.baseSequence()))) { return true; } else if (!isTransactional() && hasUnresolvedSequence(batch.topicPartition) && isNextSequenceForUnresolvedPartition(batch.topicPartition, batch.baseSequence())) { bumpEpoch(); <START> this.partitionsWithUnresolvedSequences.clear(); <END> return true; } } return error.exception() instanceof RetriableException; }</code><technical_language>clearing unresolved partitions, include partitions other is retried. do error is UNKNOWN_PRODUCER_ID</technical_language>

Target:
synchronized boolean canRetry(ProduceResponse.PartitionResponse response, ProducerBatch batch) { Errors error = response.error; if (error == Errors.UNKNOWN_PRODUCER_ID) { if (response.logStartOffset == -1) { return true; } if (batch.sequenceHasBeenReset()) { return true; } else if (lastAckedOffset(batch.topicPartition).orElse(NO_LAST_ACKED_SEQUENCE_NUMBER) < response.logStartOffset) { if (isTransactional()) { topicPartitionBookkeeper.startSequencesAtBeginning(batch.topicPartition, this.producerIdAndEpoch); } else { requestEpochBumpForPartition(batch.topicPartition); } return true; } if (!isTransactional()) { requestEpochBumpForPartition(batch.topicPartition); return true; } } else if (error == Errors.OUT_OF_ORDER_SEQUENCE_NUMBER) { if (!hasUnresolvedSequence(batch.topicPartition) && (batch.sequenceHasBeenReset() || !isNextSequence(batch.topicPartition, batch.baseSequence()))) { return true; } else if (!isTransactional()) { if (!hasUnresolvedSequence(batch.topicPartition) || isNextSequenceForUnresolvedPartition(batch.topicPartition, batch.baseSequence())) { requestEpochBumpForPartition(batch.topicPartition); } return true; } } return error.exception() instanceof RetriableException; }
Source:
<code>public PropertyValue(MAPIProperty property, long flags, byte[] data) { <START> this.property = property; <END> this.flags = flags; this.data = data; this.actualType = property.usualType; }</code><technical_language>call this(property, flags, data, null)</technical_language>

Target:
public PropertyValue(MAPIProperty property, long flags, byte[] data) { this(property, flags, data, property.usualType); }
Source:
<code>private void notifyActivity() { <START> new Thread( <END> () -> { try { httpJsonRequestFactory .fromUrl(apiEndpoint + "/activity/" + wsId) .usePutMethod() .request(); } catch (Exception e) { LOG.error("Cannot notify master about workspace " + wsId + " activity", e); } }) .start(); }</code><technical_language>this thread daemon</technical_language>

Target:
private void notifyActivity() { try { httpJsonRequestFactory.fromUrl(apiEndpoint + "/activity/" + wsId).usePutMethod().request(); } catch (Exception e) { LOG.error("Cannot notify master about workspace " + wsId + " activity", e); } }
Source:
<code>public int getEstimatedSizeInBytes() { int result = INSTANCE_SIZE; result += sizeOfObjectArray(partitionKeys.size()); for (HivePartitionKey partitionKey : partitionKeys) { result += partitionKey.getEstimatedSizeInBytes(); } result += partitionName.length() * Character.BYTES; result += sizeOfObjectArray(columnCoercions.size()); <START> for (Column hiveTypeName : columnCoercions.values()) { <END> result += INTEGER_INSTANCE_SIZE + hiveTypeName.getEstimatedSizeInBytes(); } return result; }</code><technical_language>change name of variable column</technical_language>

Target:
public int getEstimatedSizeInBytes() { int result = INSTANCE_SIZE; result += sizeOfObjectArray(partitionKeys.size()); for (HivePartitionKey partitionKey : partitionKeys) { result += partitionKey.getEstimatedSizeInBytes(); } result += partitionName.length() * Character.BYTES; result += sizeOfObjectArray(partitionSchemaDifference.size()); for (Column column : partitionSchemaDifference.values()) { result += INTEGER_INSTANCE_SIZE + column.getEstimatedSizeInBytes(); } return result; }
Source:
<code>private void handleUpsert(GenericRow row, int docId) { PrimaryKey primaryKey = row.getPrimaryKey(_schema.getPrimaryKeyColumns()); Object timeValue = row.getValue(_timeColumnName); Preconditions.checkArgument(timeValue instanceof Comparable, "time column shall be comparable"); long timestamp = IngestionUtils.extractTimeValue((Comparable) timeValue); RecordLocation location = new RecordLocation(_segmentName, docId, timestamp); <START> if (_primaryKeyIndex.containsKey(primaryKey)) { RecordLocation prevLocation = _primaryKeyIndex.get(primaryKey); if (location.getTimestamp() >= prevLocation.getTimestamp()) { _primaryKeyIndex.put(primaryKey, location); _validDocIndex.remove(prevLocation.getDocId()); _validDocIndex.checkAndAdd(location.getDocId()); LOGGER.debug(String .format("upsert: replace old doc id %d with %d for key: %s, hash: %d", prevLocation.getDocId(), location.getDocId(), primaryKey, primaryKey.hashCode())); } else { LOGGER.debug( String.format("upsert: ignore a late-arrived record: %s, hash: %d", primaryKey, primaryKey.hashCode())); } } else if (_partitionUpsertMetadataManager.containsKey(primaryKey)) { RecordLocation prevLocation = _partitionUpsertMetadataManager.getRecordLocation(primaryKey); if (location.getTimestamp() >= prevLocation.getTimestamp()) { _partitionUpsertMetadataManager.removeRecordLocation(primaryKey); _primaryKeyIndex.put(primaryKey, location); _partitionUpsertMetadataManager.getValidDocIndex(prevLocation.getSegmentName()) .remove(prevLocation.getDocId()); _validDocIndex.checkAndAdd(location.getDocId()); } } else { _primaryKeyIndex.put(primaryKey, location); _validDocIndex.checkAndAdd(location.getDocId()); } <END> }</code><technical_language>Similarly, this part of logic moved PartitionUpsertMetadataManager concurrency control</technical_language>

Target:
private void handleUpsert(GenericRow row, int docId) { PrimaryKey primaryKey = row.getPrimaryKey(_schema.getPrimaryKeyColumns()); Object timeValue = row.getValue(_timeColumnName); Preconditions.checkArgument(timeValue instanceof Comparable, "time column shall be comparable"); long timestamp = IngestionUtils.extractTimeValue((Comparable) timeValue); RecordLocation recordLocation = new RecordLocation(_segmentName, docId, timestamp, true); _partitionUpsertMetadataManager.updateRecordLocation(primaryKey, recordLocation, _validDocIds); }
Source:
<code>public Row next() throws IOException { Optional<Row> next = responseQueueReader.getNextMergedRow(); <START> return next.isPresent() ? next.get() : null; <END> }</code><technical_language>If getNextMergedRow() return null a full row, need translate !isPresent null</technical_language>

Target:
public Row next() throws IOException { return responseQueueReader.getNextMergedRow(); }
Source:
<code>IMessage msg(int verb, String msg) { return new IMessage() { <START> public int verb() { return verb; } <END> public byte[] bytes() { return msg.getBytes(); } public int id() { return 0; } public int version() { return 0; } public InetSocketAddress from() { return null; } public int fromPort() { return 0; } }; }</code><technical_language>remove private static? visible slightly slower</technical_language>

Target:
private static IMessage msg(int verb, String msg) { return new IMessage() { public int verb() { return verb; } public byte[] bytes() { return msg.getBytes(); } public int id() { return 0; } public int version() { return 0; } public InetSocketAddress from() { return null; } public int fromPort() { return 0; } }; }
Source:
<code>private Vm selectVmForCloudlet(Cloudlet cloudlet) { List<Vm> createdVms = cloudlet.getBroker().getVmsCreatedList(); System.out.println("\t\tCreated VMs: " + createdVms); Comparator<Vm> sortByNumberOfFreePes = Comparator.comparingInt(vm -> getExpectedNumberOfFreeVmPes(vm, false)); Comparator<Vm> sortByExpectedCloudletResponseTime = Comparator.comparingDouble(vm -> getExpectedCloudletResponseTime(cloudlet)); createdVms.sort( sortByNumberOfFreePes .thenComparing(sortByExpectedCloudletResponseTime) .reversed()); Vm mostFreePesVm = createdVms.stream().findFirst().orElse(Vm.NULL); <START> Vm selectedVm = createdVms.stream() <END> .filter(vm -> getExpectedNumberOfFreeVmPes(vm, true) >= cloudlet.getNumberOfPes()) .filter(vm -> getExpectedCloudletResponseTime(cloudlet) <= responseTimeSlaContract) .findFirst().orElse(mostFreePesVm); return selectedVm; }</code><technical_language>method before, receives a Vm parameter MIPS it. real problem is: if change code VMs MIPS capacity, vmMips attribute simulation wrongly MIPS for VMs</technical_language>

Target:
private Vm selectVmForCloudlet(Cloudlet cloudlet) { List<Vm> createdVms = cloudlet.getBroker().getVmsCreatedList(); System.out.println("\t\tCreated VMs: " + createdVms); Comparator<Vm> sortByNumberOfFreePes = Comparator.comparingInt(vm -> getExpectedNumberOfFreeVmPes(vm, false)); Comparator<Vm> sortByExpectedCloudletResponseTime = Comparator.comparingDouble(vm -> getExpectedCloudletResponseTime(cloudlet, vm)); createdVms.sort( sortByNumberOfFreePes .thenComparing(sortByExpectedCloudletResponseTime) .reversed()); Vm mostFreePesVm = createdVms.stream().findFirst().orElse(Vm.NULL); Vm selectedVm = createdVms.stream() .filter(vm -> getExpectedNumberOfFreeVmPes(vm, true) >= cloudlet.getNumberOfPes()) .filter(vm -> getExpectedCloudletResponseTime(cloudlet, vm) <= responseTimeSlaContract) .findFirst().orElse(mostFreePesVm); return selectedVm; }
Source:
<code><START> public ResourceLoader(AppResources resources, WidgetResources widgetResources) { <END> resources.styles().ensureInjected(); widgetResources.header().ensureInjected(); }</code><technical_language>rm public</technical_language>

Target:
ResourceLoader(AppResources resources, WidgetResources widgetResources) { resources.styles().ensureInjected(); widgetResources.header().ensureInjected(); }
Source:
<code>protected boolean checkCanBeMoveInVm() { <START> List<VM> listVms = getVmDAO().getForImageGroup(getImage().getId()); <END> int indList = 0; boolean canMoveDisk = true; while (listVms.size() > indList && canMoveDisk) { VM vm = listVms.get(indList++); if (VMStatus.Down != vm.getstatus()) { VmDevice vmDevice = getVmDeviceDAO().get(new VmDeviceId(getImage().getId(), vm.getId())); if (vmDevice.getIsPlugged()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); canMoveDisk = false; } } } return canMoveDisk; }</code><technical_language>query is twice, reasons</technical_language>

Target:
protected boolean checkCanBeMoveInVm() { List<VM> listVms = getVmsForImageGroup(); int indList = 0; boolean canMoveDisk = true; while (listVms.size() > indList && canMoveDisk) { VM vm = listVms.get(indList++); if (VMStatus.Down != vm.getstatus()) { VmDevice vmDevice = getVmDeviceDAO().get(new VmDeviceId(getImage().getId(), vm.getId())); if (vmDevice.getIsPlugged()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); canMoveDisk = false; } } } return canMoveDisk; }