auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testVariableBindings() throws Exception { SelectionScript script = new SelectionScript("variables.get(\"TOTO\")", "groovy", false); ManagerObjects managerObjects = new ManagerObjects(1).invoke(); SelectionManager selectionManager = managerObjects.getSelectionManager(); ArrayList<RMNode> freeNodes = managerObjects.getFreeNodes(); selectionManager.processScriptResult(script, Collections.singletonMap("TOTO", (Serializable) "value"), new ScriptResult<>(true), freeNodes.get(0)); Assert.assertTrue(selectionManager.isPassed(script, Collections.singletonMap("TOTO", (Serializable) "value"), freeNodes.get(0))); Assert.assertFalse(selectionManager.isPassed(script, Collections.singletonMap("TOTO", (Serializable) "differentValue"), freeNodes.get(0))); Assert.assertFalse(selectionManager.isPassed(script, Collections.<String, Serializable> emptyMap(), freeNodes.get(0))); selectionManager.processScriptResult(script, Collections.singletonMap("TOTO", (Serializable) "differentValue"), new ScriptResult<>(true), freeNodes.get(0)); Assert.assertTrue(selectionManager.isPassed(script, Collections.singletonMap("TOTO", (Serializable) "differentValue"), freeNodes.get(0))); Assert.assertTrue(selectionManager.isPassed(script, Collections.singletonMap("TOTO", (Serializable) "value"), freeNodes.get(0))); }

Target:
public void testVariableBindings() throws Exception { SelectionScript script = new SelectionScript("variables.get(\"TOTO\")", "groovy", false); ManagerObjects managerObjects = new ManagerObjects(1).invoke(); SelectionManager selectionManager = managerObjects.getSelectionManager(); ArrayList<RMNode> freeNodes = managerObjects.getFreeNodes(); selectionManager.processScriptResult(script, Collections.singletonMap("TOTO", "value"), new ScriptResult<>(true), freeNodes.get(0)); Assert.assertTrue(selectionManager.isPassed(script, Collections.singletonMap("TOTO", "value"), freeNodes.get(0))); Assert.assertFalse(selectionManager.isPassed(script, Collections.singletonMap("TOTO", "differentValue"), freeNodes.get(0))); Assert.assertFalse(selectionManager.isPassed(script, Collections.<String, Serializable> emptyMap(), freeNodes.get(0))); selectionManager.processScriptResult(script, Collections.singletonMap("TOTO", "differentValue"), new ScriptResult<>(true), freeNodes.get(0)); Assert.assertTrue(selectionManager.isPassed(script, Collections.singletonMap("TOTO", "differentValue"), freeNodes.get(0))); Assert.assertTrue(selectionManager.isPassed(script, Collections.singletonMap("TOTO", "value"), freeNodes.get(0))); }
Source:
public StoreFileWriter build() throws IOException { if ((dir == null ? 0 : 1) + (filePath == null ? 0 : 1) != 1) { throw new IllegalArgumentException("Either specify parent directory " + "or file path"); } if (dir == null) { dir = filePath.getParent(); } if (!fs.exists(dir)) { HRegionFileSystem.mkdirs(fs, conf, dir); } String policyName = this.conf.get(ColumnFamilyDescriptorBuilder.STORAGE_POLICY); if (null == policyName) { policyName = this.conf.get(HStore.BLOCK_STORAGE_POLICY_KEY); } CommonFSUtils.setStoragePolicy(this.fs, dir, policyName); if (filePath == null) { if (fileStoragePolicy != null && !fileStoragePolicy.isEmpty()) { dir = new Path(dir, HConstants.STORAGE_POLICY_PREFIX + fileStoragePolicy); if (!fs.exists(dir)) { HRegionFileSystem.mkdirs(fs, conf, dir); } CommonFSUtils.setStoragePolicy(this.fs, dir, fileStoragePolicy); if (LOG.isDebugEnabled()) { LOG.debug( "Create tmp dir " + dir.toString() + " with storage policy: " + fileStoragePolicy); } } filePath = getUniqueFile(fs, dir); if (!BloomFilterFactory.isGeneralBloomEnabled(conf)) { bloomType = BloomType.NONE; } } return new StoreFileWriter(fs, filePath, conf, cacheConf, bloomType, maxKeyCount, favoredNodes, fileContext, shouldDropCacheBehind, compactedFilesSupplier); }

Target:
public StoreFileWriter build() throws IOException { if ((dir == null ? 0 : 1) + (filePath == null ? 0 : 1) != 1) { throw new IllegalArgumentException("Either specify parent directory " + "or file path"); } if (dir == null) { dir = filePath.getParent(); } if (!fs.exists(dir)) { HRegionFileSystem.mkdirs(fs, conf, dir); } String policyName = this.conf.get(ColumnFamilyDescriptorBuilder.STORAGE_POLICY); if (null == policyName) { policyName = this.conf.get(HStore.BLOCK_STORAGE_POLICY_KEY); } CommonFSUtils.setStoragePolicy(this.fs, dir, policyName); if (filePath == null) { if (!Strings.isNullOrEmpty(fileStoragePolicy)) { dir = new Path(dir, HConstants.STORAGE_POLICY_PREFIX + fileStoragePolicy); if (!fs.exists(dir)) { HRegionFileSystem.mkdirs(fs, conf, dir); LOG.info( "Create tmp dir " + dir.toString() + " with storage policy: " + fileStoragePolicy); } CommonFSUtils.setStoragePolicy(this.fs, dir, fileStoragePolicy); } filePath = getUniqueFile(fs, dir); if (!BloomFilterFactory.isGeneralBloomEnabled(conf)) { bloomType = BloomType.NONE; } } return new StoreFileWriter(fs, filePath, conf, cacheConf, bloomType, maxKeyCount, favoredNodes, fileContext, shouldDropCacheBehind, compactedFilesSupplier); }
Source:
private short getLibraryId(final SAMRecord rec) { if (this.libraryIds.size() == 0) { populateLibraryIds(rec.getHeader()); } final String library = getLibraryName(rec); return updateLibraryId(library); }

Target:
private short getLibraryId(final SAMRecord rec) { if (this.libraryIds.size() == 0) { populateLibraryIds(Arrays.asList(rec.getHeader())); } final String library = getLibraryName(rec); return updateLibraryId(library); }
Source:
protected void executeQueryCommand() { Guid objectId = getParameters().getObjectId(); List<permissions> perms; if (getParameters().getDirectOnly()) { perms = getPermissionDAO() .getAllForEntity(objectId, getUserID(), getParameters().isFiltered()); } else { perms = getPermissionDAO() .getTreeForEntity(objectId, getParameters().getVdcObjectType(), getUserID(), getParameters().isFiltered()); } getQueryReturnValue().setReturnValue(perms); }

Target:
protected void executeQueryCommand() { Guid objectId = getParameters().getObjectId(); PermissionDAO dao = getDbFacade().getPermissionDAO(); List<permissions> perms; if (getParameters().getDirectOnly()) { perms = dao.getAllForEntity(objectId, getUserID(), getParameters().isFiltered()); } else { perms = dao.getTreeForEntity(objectId, getParameters().getVdcObjectType(), getUserID(), getParameters().isFiltered()); } getQueryReturnValue().setReturnValue(perms); }
Source:
public void testProtectFilename() throws Exception { PerforceRepository instance = new PerforceRepository(); ArrayList<SimpleImmutableEntry<String,String>> testmap = new ArrayList<SimpleImmutableEntry<String,String>>() { { 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); } }

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:
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); }

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:
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) == null) ? "" : TimestampedMessageParser.usingDatePrefix(config); }

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:
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) { cfg = tenantConfig.withFallback(cfg); } cfg = userAccountConfig.withFallback(cfg); return Tuple.create(new UserSettings(cfg, false), user.getTenant().getUniqueObjectName()); }).getFirst(); }

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:
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().toString(); strvalue = strvalue.replaceFirst("#.*", ""); return strvalue; } } } return super.getValue(object, feature, value, loadedVersion); }

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:
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); } }); }

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:
private void upgradeBuddy(Buddy buddy) { BuddyAnonymized buddyAnonymized = buddy.getBuddyAnonymized(); buddy.setLastStatusChangeTime(buddyAnonymized.getLastStatusChangeTime()); buddyAnonymized.clearLastStatusChangeTime(); }

Target:
private void upgradeBuddy(Buddy buddy) { BuddyAnonymized buddyAnonymized = buddy.getBuddyAnonymized(); buddy.setLastStatusChangeTime(buddyAnonymized.getLastStatusChangeTime()); buddyAnonymized.clearLastStatusChangeTime(); BuddyAnonymized.getRepository().save(buddyAnonymized); }
Source:
public void searchInputAcceptsValue() { SearchInput searchInput = new SearchInput().searchInputValue(); SearchInput searchInputSubmit = new SearchInput().searchInputSubmit(); String URL = driver.getCurrentUrl(); Assert.assertEquals(URL, "<LINK_2>"); SearchInput firstInstance = new SearchInput().firstPostInstance(); }

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:
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(Collectors.toCollection(LinkedHashSet::new)); LinkedHashSet<PlanNode> rightSources = sources.stream() .filter(source -> !leftSources.contains(source)) .collect(Collectors.toCollection(LinkedHashSet::new)); return createJoin(leftSources, rightSources, outputSymbols); }

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:
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; } }

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:
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(); Thread.sleep(1000); 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")); }

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:
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 public Class<?> getChildType() { 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; }

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:
public List<SMSAlert> getDailyAlerts(){ LocalDateTime today = DatabaseUtilities.getCurrentDateTime(); String sql = "SELECT * FROM sms_alerts"; 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; } }

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:
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.synchronizedMap(new HashMap<>(additionalAttributes)); }

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:
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"); check_changelog_sha1(w.git.changelog(),commitSha1, "master"); }

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:
protected boolean validate() { Guid nicId = getParameters().getNicId(); HostInterfaceValidator hostInterfaceValidator = new HostInterfaceValidator(getNic()); ValidationResult validationResult = hostInterfaceValidator.interfaceExists(nicId); if (!validationResult.isValid()) { return validate(validationResult); } return validate(hostInterfaceValidator.nicIsNotLabeledWithSpecifiedLabel(getLabel())); }

Target:
protected boolean validate() { Guid nicId = getParameters().getNicId(); HostInterfaceValidator hostInterfaceValidator = new HostInterfaceValidator(getNic()); return validate(hostInterfaceValidator.interfaceExists(nicId)) && validate(hostInterfaceValidator.nicIsNotLabeledWithSpecifiedLabel(getLabel())); }
Source:
protected Object computeParameterValue(JpaParameter parameter, Object value, Object[] values) { return value; }

Target:
private Object computeParameterValue(JpaParameter parameter, Object value, Object[] values) { return value; }
Source:
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.size() > 0); 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)); }

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:
private void init() { this.head = new Head(driver); this.navigate = new Navigate(driver); }

Target:
private void init() { this.head = new Head(); this.navigate = new Navigate(driver); }
Source:
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 { resultTimestamp = context().timestamp(); } if (sendOldValues && change.oldValue != null) { oldValue = joiner.apply(change.oldValue, valueRight); } context().forward(key, new Change<>(newValue, oldValue), To.all().withTimestamp(resultTimestamp)); }

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:
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); } }

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:
private NettyIoPool(String name, NettyIoPoolConfig config) { 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); }

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:
private PreparedStatement getPreparedStatement(Connection connection, TableMetaDataView tableMetaData, EntryColumnData entryColumnData, Operation operation) throws SQLException { String sqlStr = getSqlString(tableMetaData, entryColumnData, operation); if (logger.isDebugEnabled()) { logger.debug("SQL:{} key:{} value:{}", sqlStr, entryColumnData.getEntryKeyColumnData(), entryColumnData.getEntryValueColumnData()); } return connection.prepareStatement(sqlStr); }

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:
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.findMetricIndentifiersWithFilters(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)); } }); }

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:
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]); } else { bucket.addEvent(traceIndex, (int) series[i]); } buckets[i] = bucket; } }

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:
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(); this.partitionsWithUnresolvedSequences.clear(); return true; } } return error.exception() instanceof RetriableException; }

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:
public PropertyValue(MAPIProperty property, long flags, byte[] data) { this.property = property; this.flags = flags; this.data = data; this.actualType = property.usualType; }

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

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:
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()); for (Column hiveTypeName : columnCoercions.values()) { result += INTEGER_INSTANCE_SIZE + hiveTypeName.getEstimatedSizeInBytes(); } return result; }

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:
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); 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()); } }

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:
public Row next() throws IOException { Optional<Row> next = responseQueueReader.getNextMergedRow(); return next.isPresent() ? next.get() : null; }

Target:
public Row next() throws IOException { return responseQueueReader.getNextMergedRow(); }
Source:
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; } }; }

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:
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); Vm selectedVm = createdVms.stream() .filter(vm -> getExpectedNumberOfFreeVmPes(vm, true) >= cloudlet.getNumberOfPes()) .filter(vm -> getExpectedCloudletResponseTime(cloudlet) <= responseTimeSlaContract) .findFirst().orElse(mostFreePesVm); return selectedVm; }

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:
public ResourceLoader(AppResources resources, WidgetResources widgetResources) { resources.styles().ensureInjected(); widgetResources.header().ensureInjected(); }

Target:
ResourceLoader(AppResources resources, WidgetResources widgetResources) { resources.styles().ensureInjected(); widgetResources.header().ensureInjected(); }