auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CohortDefinition getPatientsWithEnrollment(){ ProgramEnrollmentCohortDefinition cd = new ProgramEnrollmentCohortDefinition(); cd.addParameter(new Parameter("programs", "reporting.parameter.programs", Program.class, List.class, null)); cd.addParameter(new Parameter("enrolledOnOrAfter", "reporting.parameter.enrolledOnOrAfter", Date.class)); cd.addParameter(new Parameter("enrolledOnOrBefore", "reporting.parameter.enrolledOnOrBefore", Date.class)); cd.addParameter(new Parameter("completedOnOrAfter", "reporting.parameter.completedOnOrAfter", Date.class)); cd.addParameter(new Parameter("completedOnOrBefore", "reporting.parameter.completedOnOrBefore", Date.class)); <START> cd.addParameter(new Parameter("locationList", "reporting.parameter.locationList", Location.class, List.class, null)); <END> return cd; }</code><technical_language>This location parameter renamed in other methods I</technical_language>

Target:
public CohortDefinition getPatientsWithEnrollment(){ ProgramEnrollmentCohortDefinition cd = new ProgramEnrollmentCohortDefinition(); cd.addParameter(new Parameter("programs", "reporting.parameter.programs", Program.class, List.class, null)); cd.addParameter(new Parameter("enrolledOnOrAfter", "reporting.parameter.enrolledOnOrAfter", Date.class)); cd.addParameter(new Parameter("enrolledOnOrBefore", "reporting.parameter.enrolledOnOrBefore", Date.class)); cd.addParameter(new Parameter("completedOnOrAfter", "reporting.parameter.completedOnOrAfter", Date.class)); cd.addParameter(new Parameter("completedOnOrBefore", "reporting.parameter.completedOnOrBefore", Date.class)); cd.addParameter(new Parameter("locationList", "reporting.parameter.locationList", Location.class, List.class, null)); return new MappedParametersCohortDefinition(cd, "programs", "programs", "enrolledOnOrAfter", "enrolledOnOrAfter", "enrolledOnOrBefore", "enrolledOnOrBefore", "completedOnOrAfter", "completedOnOrAfter", "completedOnOrBefore", "completedOnOrBefore", "locationList", "locations" ); }
Source:
<code>public void nextRecordByCursor( RECORD record, RecordLoad mode, PageCursor cursor ) throws UnderlyingStorageException { try { int offset = cursor.getOffset() + recordSize; long id = record.getId() + 1; record.setId( id ); long pageId = cursor.getCurrentPageId(); if ( offset >= storeFile.pageSize() || pageId < 0 ) { offset = 0; if ( !cursor.next( pageId + 1 ) ) { verifyAfterNotRead( record, mode ); return; } } readRecordFromPage( id, record, mode, cursor, offset ); <START> } <END> catch ( IOException e ) { throw new UnderlyingStorageException( e ); } }</code><technical_language>pageId + 1 0, right</technical_language>

Target:
public void nextRecordByCursor( RECORD record, RecordLoad mode, PageCursor cursor ) throws UnderlyingStorageException { if ( cursor.getCurrentPageId() < -1 ) { throw new IllegalArgumentException( "Pages are assumed to be positive or -1 if not initialized" ); } try { int offset = cursor.getOffset(); long id = record.getId() + 1; record.setId( id ); long pageId = cursor.getCurrentPageId(); if ( offset >= storeFile.pageSize() || pageId < 0 ) { if ( !cursor.next() ) { verifyAfterNotRead( record, mode ); return; } cursor.setOffset( 0 ); } readRecordFromPage( id, record, mode, cursor ); } catch ( IOException e ) { throw new UnderlyingStorageException( e ); } }
Source:
<code>public OpenShiftDebugMode execute(IProgressMonitor monitor) throws CoreException { Connection connection = OpenShiftServerUtils.getConnection(context.getServer()); IResource resource = OpenShiftServerUtils.getResource(context.getServer(), monitor); <START> IDeploymentConfig dc = getDeploymentConfig(resource, connection, monitor); <END> if (dc == null) { throw new CoreException(OpenShiftCoreActivator.statusFactory().errorStatus( NLS.bind("Could not find deployment config for resource {0}. " + "Your build might be still running and pods not created yet or " + "there might be no labels on your pods pointing to the wanted deployment config.", resource != null? resource.getName() : ""))); } boolean dcUpdated = updateDc(dc, connection, monitor); IPod pod = getPod(dcUpdated, dc, connection, monitor); context.setPod(pod); toggleTimeout(resource, connection, context, monitor); toggleDebugger(context, monitor); return this; }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Change this condition evaluate "true" [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public OpenShiftDebugMode execute(IProgressMonitor monitor) throws CoreException { Connection connection = OpenShiftServerUtils.getConnection(context.getServer()); IResource resource = OpenShiftServerUtils.getResource(context.getServer(), monitor); IDeploymentConfig dc = getDeploymentConfig(resource, connection, monitor); if (dc == null) { throw new CoreException(OpenShiftCoreActivator.statusFactory().errorStatus( NLS.bind("Could not find deployment config for resource {0}. " + "Your build might be still running and pods not created yet or " + "there might be no labels on your pods pointing to the wanted deployment config.", resource != null? resource.getName() : ""))); } boolean dcUpdated = updateDc(dc, connection, monitor); IPod pod = getPod(dcUpdated, dc, connection, monitor); context.setPod(pod); toggleRouteTimeout(resource, connection, context, monitor); toggleDebugger(context, monitor); return this; }
Source:
<code>public Index(List<FieldSort> fieldNames, String indexName, IndexType indexType, Tokenizer tokenizer) { Misc.checkNotNull(fieldNames, "fieldNames"); Misc.checkArgument(!fieldNames.isEmpty(), "fieldNames isEmpty()"); Misc.checkArgument((indexName == null || !indexName.isEmpty()), "indexName"); this.fieldNames = new ArrayList<FieldSort>(fieldNames); this.indexName = indexName; this.indexType = indexType; if (indexType == IndexType.TEXT) { if (tokenizer == null) { this.tokenizer = Tokenizer.DEFAULT; } else { this.tokenizer = tokenizer; } } else { <START> Misc.checkArgument(tokenizer == null, "tokenizer must not be null if indexType is JSON"); <END> this.tokenizer = null; } }</code><technical_language>this message wrong? be: > tokenizer null if indexType is JSON</technical_language>

Target:
public Index(List<FieldSort> fieldNames, String indexName, IndexType indexType, Tokenizer tokenizer) { Misc.checkNotNull(fieldNames, "fieldNames"); Misc.checkArgument(!fieldNames.isEmpty(), "fieldNames isEmpty()"); Misc.checkArgument((indexName == null || !indexName.isEmpty()), "indexName"); this.fieldNames = new ArrayList<FieldSort>(fieldNames); this.indexName = indexName; this.indexType = indexType; if (indexType == IndexType.TEXT) { if (tokenizer == null) { this.tokenizer = Tokenizer.DEFAULT; } else { this.tokenizer = tokenizer; } } else { Misc.checkArgument(tokenizer == null, "tokenizer must be null if indexType is JSON"); this.tokenizer = null; } }
Source:
<code>public void setProjects(Map<String,Project> projects) { if (projects != null) { <START> populateGroups(getGroups(), new TreeSet<>(projects.values())); <END> } setConfigurationValue("projects", projects); }</code><technical_language>This need locking? populating groups (which synchronized in anyway) is a direct reference configuration object now. If other thread is looping groups, exception</technical_language>

Target:
public void setProjects(Map<String,Project> projects) { try { configLock.writeLock().lock(); if (projects != null) { populateGroups(getGroups(), new TreeSet<>(projects.values())); } setConfigurationValue("projects", projects); } finally { configLock.writeLock().unlock(); } }
Source:
<code>private long loadFiles(Table.ID tableId, Path bulkDir, LoadMappingIterator loadMapIter, Master master, long tid) throws Exception { PeekingIterator<Map.Entry<KeyExtent,Bulk.Files>> lmi = new PeekingIterator(loadMapIter); Map.Entry<KeyExtent,Bulk.Files> loadMapEntry = lmi.peek(); Text startRow = loadMapEntry.getKey().getPrevEndRow(); Iterator<TabletMetadata> tabletIter = TabletsMetadata.builder().forTable(tableId) .overlapping(startRow, null).checkConsistency().fetchPrev().fetchLocation().fetchLoaded() .build(master.getContext()).iterator(); List<TabletMetadata> tablets = new ArrayList<>(); TabletMetadata currentTablet = tabletIter.next(); Loader loader; if (bulkInfo.tableState == TableState.ONLINE) { loader = new OnlineLoader(); } else { loader = new OfflineLoader(); } loader.start(bulkDir, master, tid, bulkInfo.setTime); long t1 = System.currentTimeMillis(); while (lmi.hasNext()) { loadMapEntry = lmi.next(); <START> KeyExtent fileTablet = loadMapEntry.getKey(); <END> tablets.clear(); currentTablet = getFirstTablet(tabletIter, currentTablet, fileTablet.getPrevEndRow()); tablets.add(currentTablet); tablets.addAll(getTabletsInRange(tabletIter, currentTablet, fileTablet.getEndRow())); loader.load(tablets, loadMapEntry.getValue()); } return loader.finish(Math.min(System.currentTimeMillis() - t1, 30000)); }</code><technical_language>I this called loadRange</technical_language>

Target:
private long loadFiles(Table.ID tableId, Path bulkDir, LoadMappingIterator loadMapIter, Master master, long tid) throws Exception { PeekingIterator<Map.Entry<KeyExtent,Bulk.Files>> lmi = new PeekingIterator<>(loadMapIter); Map.Entry<KeyExtent,Bulk.Files> loadMapEntry = lmi.peek(); Text startRow = loadMapEntry.getKey().getPrevEndRow(); Iterator<TabletMetadata> tabletIter = TabletsMetadata.builder().forTable(tableId) .overlapping(startRow, null).checkConsistency().fetchPrev().fetchLocation().fetchLoaded() .build(master.getContext()).iterator(); Loader loader; if (bulkInfo.tableState == TableState.ONLINE) { loader = new OnlineLoader(); } else { loader = new OfflineLoader(); } loader.start(bulkDir, master, tid, bulkInfo.setTime); long t1 = System.currentTimeMillis(); while (lmi.hasNext()) { loadMapEntry = lmi.next(); List<TabletMetadata> tablets = findOverlappingTablets(loadMapEntry.getKey(), tabletIter); loader.load(tablets, loadMapEntry.getValue()); } long sleepTime = loader.finish(); if (sleepTime > 0) { long scanTime = Math.min(System.currentTimeMillis() - t1, 30000); sleepTime = Math.max(sleepTime, scanTime * 2); } return sleepTime; }
Source:
<code>private Optional<String> updateGerritAuthWhenRequired(HttpContext httpContext, HttpClientBuilder client) throws IOException, HttpStatusException { if (!loginCache.getHostSupportsGerritAuth()) { cookieStore.clear(); return Optional.absent(); } <START> if (authData.isHttpPassword() || githubOAuthDetected) { <END> return Optional.absent(); } Optional<Cookie> gerritAccountCookie = findGerritAccountCookie(); if (!gerritAccountCookie.isPresent() || gerritAccountCookie.get().isExpired(new Date()) || !isSessionValid(client, httpContext)) { return updateGerritAuth(httpContext, client); } return loginCache.getGerritAuthOptional(); }</code><technical_language>wondering if move this flag LoginCache, getHostSupportsGerritAuth? thought this? looked details yet</technical_language>

Target:
private Optional<String> updateGerritAuthWhenRequired(HttpContext httpContext, HttpClientBuilder client) throws IOException, HttpStatusException { if (!loginCache.getHostSupportsGerritAuth()) { cookieStore.clear(); return Optional.absent(); } if (authData.isHttpPassword()) { return Optional.absent(); } if (loginCache.isGithubOAuthDetected()) { return Optional.absent(); } Optional<Cookie> gerritAccountCookie = findGerritAccountCookie(); if (!gerritAccountCookie.isPresent() || gerritAccountCookie.get().isExpired(new Date()) || !isSessionValid(client, httpContext)) { return updateGerritAuth(httpContext, client); } return loginCache.getGerritAuthOptional(); }
Source:
<code>void parseTemplateNode(Map<String, Template> templates, Node templateNode) { if (templateNode.getNodeType() == Node.ELEMENT_NODE) { Template template = new Template(); Element element = (Element) templateNode; template.setTestPlan("true".equals(element.getAttribute("isTestPlan"))); <START> template.setName(element.getElementsByTagName("name").item(0).getTextContent()); <END> template.setDescription(element.getElementsByTagName("description").item(0).getTextContent()); template.setFileName(element.getElementsByTagName("fileName").item(0).getTextContent()); NodeList nl = element.getElementsByTagName("parameters"); if(nl.getLength()>0) { NodeList parameterNodes = ((Element) nl.item(0)).getElementsByTagName("parameter"); Map<String, String> parameters = parseParameterNodes(parameterNodes); template.setParameters(parameters); } templates.put(template.getName(), template); } }</code><technical_language>introduce a helper method, extracts text content for element found: template.setName(textOfFirstTag(element, "name")) This repeated times</technical_language>

Target:
void parseTemplateNode(Map<String, Template> templates, Node templateNode) { if (templateNode.getNodeType() == Node.ELEMENT_NODE) { Template template = new Template(); Element element = (Element) templateNode; template.setTestPlan("true".equals(element.getAttribute("isTestPlan"))); template.setName(textOfFirstTag(element, "name")); template.setDescription(textOfFirstTag(element, "description")); template.setFileName(textOfFirstTag(element, "fileName")); NodeList nl = element.getElementsByTagName("parameters"); if(nl.getLength()>0) { NodeList parameterNodes = ((Element) nl.item(0)).getElementsByTagName("parameter"); Map<String, String> parameters = parseParameterNodes(parameterNodes); template.setParameters(parameters); } templates.put(template.getName(), template); } }
Source:
<code>private static ResourceMethod getResourceMethod(Widget toCall, String methodName, Class<?> resourceType) throws NoSuchMethodException { Object oldData = toCall.getData(DISPOSE_LIST); if (oldData instanceof List) { for (Object <START> name : <END> ((List<?>) oldData)) { ResourceMethod method = (ResourceMethod) name; if (method.id == methodName) { return method; } } } if (oldData instanceof ResourceMethod) { if (((ResourceMethod) oldData).id == methodName) { return ((ResourceMethod) oldData); } List<ResourceMethod> newList = new ArrayList<>(); newList.add((ResourceMethod) oldData); oldData = newList; toCall.setData(DISPOSE_LIST, oldData); } Class<?> clazz = toCall.getClass(); Method method; try { method = clazz.getMethod(methodName, resourceType); } catch (SecurityException e) { throw e; } ResourceMethod result = new ResourceMethod(method, methodName); if (oldData == null) { toCall.setData(DISPOSE_LIST, result); toCall.addDisposeListener(disposeListener); } else { ((List<ResourceMethod>) oldData).add(result); } return result; }</code><technical_language>rename element</technical_language>

Target:
private static ResourceMethod getResourceMethod(Widget toCall, String methodName, Class<?> resourceType) throws NoSuchMethodException { Object oldData = toCall.getData(DISPOSE_LIST); if (oldData instanceof List) { for (Object element : ((List<?>) oldData)) { ResourceMethod method = (ResourceMethod) element; if (method.id == methodName) { return method; } } } if (oldData instanceof ResourceMethod) { if (((ResourceMethod) oldData).id == methodName) { return ((ResourceMethod) oldData); } List<ResourceMethod> newList = new ArrayList<>(); newList.add((ResourceMethod) oldData); oldData = newList; toCall.setData(DISPOSE_LIST, oldData); } Class<?> clazz = toCall.getClass(); Method method; try { method = clazz.getMethod(methodName, resourceType); } catch (SecurityException e) { throw e; } ResourceMethod result = new ResourceMethod(method, methodName); if (oldData == null) { toCall.setData(DISPOSE_LIST, result); toCall.addDisposeListener(disposeListener); } else { ((List<ResourceMethod>) oldData).add(result); } return result; }
Source:
<code>public void testCommit() { System.out.println("testCommit"); <START> jdbc.execute("insert into example values (1, 'test1')"); <END> System.out.println("testCommit OK"); }</code><technical_language>need a resource here, I a dummy is fine</technical_language>

Target:
public void testCommit() throws Exception { try { System.out.println("testCommit"); Transaction transaction = tm.getTransaction(); transaction.enlistResource(xaResource); jdbc.execute("insert into example values (1, 'test1')"); System.out.println("testCommit OK"); } catch (Exception e) { System.out.println("testCommit FAIL with " + e); throw e; } }
Source:
<code>public void enrollInCourse() { EnrollForCourseTask enrollForCourseTask = new EnrollForCourseTask(getActivity(), courseDetail.course_id, emailOptIn) { @Override public void onSuccess(Boolean result) { if (result != null && result) { mEnrolled = true; logger.debug("Enrollment successful:" + courseDetail.course_id); mEnrollButton.setText(R.string.view_course_button_text); Toast.makeText(getContext(), R.string.you_are_now_enrolled, Toast.LENGTH_SHORT).show(); <START> signalMyCourseListToRefresh(); <END> GetEnrolledCourseTask getEnrolledCourseTask = new GetEnrolledCourseTask(getActivity(), courseDetail.course_id) { @Override public void onSuccess(EnrolledCoursesResponse course) { if (course != null) { environment.getRouter().showCourseDashboardTabs(getActivity(), environment.getConfig(), course, false); } else { Toast.makeText(getContext(), R.string.cannot_show_dashboard, Toast.LENGTH_SHORT).show(); } } @Override public void onException(Exception ex) { logger.error(ex); Toast.makeText(getContext(), R.string.enrollment_failure, Toast.LENGTH_SHORT).show(); } }; getEnrolledCourseTask.execute(); } else { logger.debug("Enrollment failure:" + courseDetail.course_id); Toast.makeText(getContext(), R.string.enrollment_failure, Toast.LENGTH_SHORT).show(); } } @Override public void onException(Exception ex) { logger.error(ex); Toast.makeText(getContext(), R.string.enrollment_failure, Toast.LENGTH_SHORT).show(); } }; enrollForCourseTask.execute(); }</code><technical_language>I swap order here; UI needs GetEnrolledCourseTask call finish, initiate request first, show dashboard ASAP</technical_language>

Target:
public void enrollInCourse() { EnrollForCourseTask enrollForCourseTask = new EnrollForCourseTask(getActivity(), courseDetail.course_id, emailOptIn) { @Override public void onSuccess(Void result) { mEnrolled = true; logger.debug("Enrollment successful:" + courseDetail.course_id); mEnrollButton.setText(R.string.view_course_button_text); Toast.makeText(getContext(), R.string.you_are_now_enrolled, Toast.LENGTH_SHORT).show(); GetEnrolledCourseTask getEnrolledCourseTask = new GetEnrolledCourseTask(getActivity(), courseDetail.course_id) { @Override public void onSuccess(EnrolledCoursesResponse course) { environment.getRouter().showCourseDashboardTabs(getActivity(), environment.getConfig(), course, false); } @Override public void onException(Exception ex) { logger.error(ex); Toast.makeText(getContext(), R.string.cannot_show_dashboard, Toast.LENGTH_SHORT).show(); } }; getEnrolledCourseTask.execute(); } @Override public void onException(Exception ex) { logger.error(ex); Toast.makeText(getContext(), R.string.enrollment_failure, Toast.LENGTH_SHORT).show(); } }; enrollForCourseTask.execute(); }
Source:
<code>public void endWindow() { byte[] currentWindowIDBytes = GPOUtils.serializeLong(currentWindowID); for(Long bucket: buckets) { Long committedWindowID = futureBuckets.get(bucket); if(committedWindowID == null || committedWindowID <= currentWindowID) { futureBuckets.remove(bucket); try { put(bucket, WINDOW_ID_KEY, currentWindowIDBytes); } catch(IOException ex) { throw new RuntimeException(ex); } } } cacheWindowCount++; for(Map.Entry<EventKey, Aggregate> entry: cache.entrySet()) { putGAE(entry.getValue()); } <START> if (updates.isConnected()) { <END> for(Map.Entry<EventKey, Aggregate> entry: cache.entrySet()) { updates.emit(entry.getValue()); } } if(cacheWindowCount == cacheWindowDuration) { cache.clear(); cacheWindowCount = 0; } super.endWindow(); }</code><technical_language>move this a separate method a derived class control aggregates emitted</technical_language>

Target:
public void endWindow() { byte[] currentWindowIDBytes = GPOUtils.serializeLong(currentWindowID); for(Long bucket: buckets) { Long committedWindowID = futureBuckets.get(bucket); if(committedWindowID == null || committedWindowID <= currentWindowID) { futureBuckets.remove(bucket); try { put(bucket, WINDOW_ID_KEY, currentWindowIDBytes); } catch(IOException ex) { throw new RuntimeException(ex); } } } cacheWindowCount++; for(Map.Entry<EventKey, Aggregate> entry: cache.entrySet()) { putGAE(entry.getValue()); } emitUpdates(); if(cacheWindowCount == cacheWindowDuration) { cache.clear(); cacheWindowCount = 0; } super.endWindow(); }
Source:
<code>public E peek(long timeout, TimeUnit unit) throws InterruptedException { lock.lock(); try { long timeoutNanos = unit.toNanos(timeout); while (queue.isEmpty() && timeoutNanos > 0) { timeoutNanos = nonEmpty.awaitNanos(timeoutNanos); } E peek = queue.peek(); if (peek == null) { <START> throw new NoSuchElementException(); <END> } return peek; } catch (IOException e) { QueueFile.<Error>getSneakyThrowable(e); return null; } finally { lock.unlock(); } }</code><technical_language>unsure if a ConcurrentModifificationException</technical_language>

Target:
public E peek(long timeout, TimeUnit unit) throws InterruptedException { lock.lock(); try { long timeoutNanos = unit.toNanos(timeout); while (queue.isEmpty() && timeoutNanos > 0) { timeoutNanos = nonEmpty.awaitNanos(timeoutNanos); } E peek = queue.peek(); if (peek == null) { throw new NoSuchElementException(); } return peek; } catch (IOException e) { throw QueueFile.<Error>getSneakyThrowable(e); } finally { lock.unlock(); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { Timber.d("onCreate()"); mExtensions = new ReviewerExtRegistry(getBaseContext()); <START> super.onCreate(savedInstanceState); <END> setContentView(getContentViewAttr(mPrefFullscreenReview)); getDelegate().setHandleNativeActionModesEnabled(true); View mainView = findViewById(android.R.id.content); initNavigationDrawer(mainView); }</code><technical_language>mPrefFullscreenReview is loaded</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { Timber.d("onCreate()"); mExtensions = new ReviewerExtRegistry(getBaseContext()); restorePreferences(); super.onCreate(savedInstanceState); setContentView(getContentViewAttr(mPrefFullscreenReview)); getDelegate().setHandleNativeActionModesEnabled(true); View mainView = findViewById(android.R.id.content); initNavigationDrawer(mainView); }
Source:
<code><START> public Config syncConfig(@RequestBody Config config) { <END> return configService.syncConfig(config); }</code><technical_language>need refresh schema is config name</technical_language>

Target:
public void syncConfig(@RequestBody Config config) { if (configService.verifyConfig(config)) { configService.syncConfig(config.getName()); } else { throw new CommcareAuthenticationException(); } }
Source:
<code>public TierConfig(@JsonProperty(value = "name", required = true) String name, @JsonProperty(value = "segmentSelectorType", required = true) String segmentSelectorType, @JsonProperty("segmentAge") @Nullable String segmentAge, @JsonProperty(value = "storageType", required = true) String storageType, @JsonProperty("serverTag") @Nullable String serverTag) { _name = name; _segmentSelectorType = segmentSelectorType; _segmentAge = segmentAge; _storageType = storageType; _serverTag = serverTag; <START> } <END></code><technical_language>Preconditions.checkArgument() non-null arguments prevent bad config</technical_language>

Target:
public TierConfig(@JsonProperty(value = "name", required = true) String name, @JsonProperty(value = "segmentSelectorType", required = true) String segmentSelectorType, @JsonProperty("segmentAge") @Nullable String segmentAge, @JsonProperty(value = "storageType", required = true) String storageType, @JsonProperty("serverTag") @Nullable String serverTag) { Preconditions.checkArgument(name != null, "Must provide non-null 'name' in tierConfig"); Preconditions .checkArgument(segmentSelectorType != null, "Must provide non-null 'segmentSelectorType' in tierConfig"); Preconditions.checkArgument(storageType != null, "Must provide non-null 'storageType' in tierConfig"); _name = name; _segmentSelectorType = segmentSelectorType; _segmentAge = segmentAge; _storageType = storageType; _serverTag = serverTag; }
Source:
<code>private void updateProfileConfigIni() { File profileConfigIni = FileManagementUtil.getProfileConfigIniFile(destination, resourceBundle.getProfile()); <START> FileManagementUtil.changeConfigIniProperty(profileConfigIni, "eclipse.p2.data.area", "@config.dir/../lib/p2/", <END> resourceBundle.getLog()); }</code><technical_language>path moved constants is in GenerateProfileMojo.java</technical_language>

Target:
private void updateProfileConfigIni() { File profileConfigIni = FileManagementUtil.getProfileConfigIniFile(destination, resourceBundle.getProfile()); FileManagementUtil.changeConfigIniProperty(profileConfigIni, "eclipse.p2.data.area", P2Constants.P2_DIRECTORY, resourceBundle.getLog()); }
Source:
<code>public void cache(String key, E entry, int ttl) { <START> cache.get(key, k -> new Entries<>(ttl)).add(entry, shouldReplaceAll(entry)); <END> }</code><technical_language>If shouldReplaceAll(...) returns true, this simplified a cache.put(...)</technical_language>

Target:
public void cache(String key, E entry, int ttl) { Entries<E> entries = cache.getIfPresent(key); if (entries == null) { entries = new Entries<>(ttl); } entries.add(entry, ttl, shouldReplaceAll(entry)); cache.put(key, entries); }
Source:
<code>public AuthenticationToken getToken() { if (null != tokenClassName) { final Properties props = new Properties(); if (!loginProps.isEmpty()) { for (Entry<String,String> loginOption : loginProps.entrySet()) props.put(loginOption.getKey(), loginOption.getValue()); } try { AuthenticationToken token = Class.forName(tokenClassName).asSubclass(AuthenticationToken.class).newInstance(); token.init(props); return token; } catch (Exception e) { throw new RuntimeException(e); } } Password pass = null; if (securePassword != null) { pass = securePassword; } else if (password != null) { pass = password; } else { try { pass = Password.promptUser(); } catch (IOException e) { throw new RuntimeException(e); } } <START> if (pass != null) { <END> return new PasswordToken(pass.value); } return null; }</code><technical_language>This simpler too. throw RTE attempt get a password, create a PasswordToken results. This method return a non-null (woo!)</technical_language>

Target:
public AuthenticationToken getToken() { if (null != tokenClassName) { final Properties props = new Properties(); if (!loginProps.isEmpty()) { for (Entry<String,String> loginOption : loginProps.entrySet()) props.put(loginOption.getKey(), loginOption.getValue()); } try { AuthenticationToken token = Class.forName(tokenClassName).asSubclass(AuthenticationToken.class).newInstance(); token.init(props); return token; } catch (Exception e) { throw new RuntimeException(e); } } Password pass = null; if (securePassword != null) { pass = securePassword; } else if (password != null) { pass = password; } else { try { pass = Password.promptUser(); } catch (IOException e) { throw new RuntimeException(e); } } return new PasswordToken(pass.value); }
Source:
<code>public MetadataDiff compareMetadata(DirCacheEntry entry) { if (entry.isAssumeValid()) return MetadataDiff.EQUAL; if (entry.isUpdateNeeded()) return MetadataDiff.DIFFER_BY_METADATA; if (!entry.isSmudged() && entry.getLength() != (int) getEntryLength()) return MetadataDiff.DIFFER_BY_METADATA; if (isModeDifferent(entry.getRawMode())) return MetadataDiff.DIFFER_BY_METADATA; long cacheLastModified = entry.getLastModified(); long fileLastModified = getEntryLastModified(); if (cacheLastModified % 1000 == 0 <START> || getOptions().getCheckStat() == CheckStat.MINIMAL) <END> fileLastModified = fileLastModified - fileLastModified % 1000; else if (fileLastModified % 1000 == 0 || getOptions().getCheckStat() == CheckStat.MINIMAL) cacheLastModified = cacheLastModified - cacheLastModified % 1000; if (fileLastModified != cacheLastModified) return MetadataDiff.DIFFER_BY_TIMESTAMP; else if (!entry.isSmudged()) return MetadataDiff.EQUAL; else return MetadataDiff.SMUDGED; }</code><technical_language>oops, Robin, I lost some changes int patch-set. Please compare patchSet 2 4 2 5</technical_language>

Target:
public MetadataDiff compareMetadata(DirCacheEntry entry) { if (entry.isAssumeValid()) return MetadataDiff.EQUAL; if (entry.isUpdateNeeded()) return MetadataDiff.DIFFER_BY_METADATA; if (!entry.isSmudged() && entry.getLength() != (int) getEntryLength()) return MetadataDiff.DIFFER_BY_METADATA; if (isModeDifferent(entry.getRawMode())) return MetadataDiff.DIFFER_BY_METADATA; long cacheLastModified = entry.getLastModified(); long fileLastModified = getEntryLastModified(); long lastModifiedMillis = fileLastModified % 1000; long cacheMillis = cacheLastModified % 1000; if (getOptions().getCheckStat() == CheckStat.MINIMAL) { fileLastModified = fileLastModified - lastModifiedMillis; cacheLastModified = cacheLastModified - cacheMillis; } else if (cacheMillis == 0) fileLastModified = fileLastModified - lastModifiedMillis; else if (lastModifiedMillis == 0) cacheLastModified = cacheLastModified - cacheMillis; if (fileLastModified != cacheLastModified) return MetadataDiff.DIFFER_BY_TIMESTAMP; else if (!entry.isSmudged()) return MetadataDiff.EQUAL; else return MetadataDiff.SMUDGED; }
Source:
<code><START> public String toString() { <END> return "EmployeeInterface{" + "id=" + id + ", name='" + name + '\'' + '}'; }</code><technical_language>repeated ..</technical_language>

Target:
public String toString() { return "Employee{" + "id=" + id + ", name='" + name + '\'' + '}'; }
Source:
<code>public void mergeStreams(DAG dag, Configuration conf) { if (streamsToMerge.size() < 2) { throw new IllegalArgumentException("Not enough streams to merge, at least two streams must be selected for " + "merging with `.merge()`."); } ArrayList<Stream> streamsToAddToDag = new ArrayList<>(); ArrayList<NamedMerger> operatorsToAdd = new ArrayList<>(); constructMergeTree(streamsToAddToDag, operatorsToAdd); for (NamedMerger m : operatorsToAdd) { dag.addOperator(m.name, m.merger); } for (Stream s : streamsToAddToDag) { <START> dag.addStream(s.name, s.sourcePort, s.destPort).setLocality(DAG.Locality.CONTAINER_LOCAL); <END> } }</code><technical_language>Making streams container local force operators upstream merger stream merger in container. streams merger (the tiers of mergers ) CONTAINER_LOCAL. THREAD_LOCAL work here</technical_language>

Target:
public DefaultOutputPort<K> mergeStreams(DAG dag, Configuration conf) { if (streamsToMerge.size() < 2) { throw new IllegalArgumentException("Not enough streams to merge, at least two streams must be selected for " + "merging with `.merge()`."); } ArrayList<Stream> streamsToAddToDag = new ArrayList<>(); ArrayList<NamedMerger> operatorsToAdd = new ArrayList<>(); constructMergeTree(streamsToAddToDag, operatorsToAdd); for (NamedMerger m : operatorsToAdd) { dag.addOperator(m.name, m.merger); } for (Stream s : streamsToAddToDag) { DAG.StreamMeta stream = dag.addStream(s.name, s.sourcePort.port, s.destPort); if (s.sourcePort.internal) { stream.setLocality(DAG.Locality.CONTAINER_LOCAL); } } return streamOutput; }
Source:
<code>private void evictInactiveEntries(long bytesNeeded) { CacheEntry[] entries = getPersistentServerCaches().asMap().values().toArray(new CacheEntry[]{}); Arrays.sort(entries); long available = this.getMemoryManager().getAvailableMemory(); <START> for (int i = 0; i < entries.length && available < bytesNeeded; i++) { <END> CacheEntry entry = entries[i]; if (!entry.isLive()) { getServerCaches().invalidate(entry.getCacheId()); getPersistentServerCaches().invalidate(entry.getCacheId()); available = this.getMemoryManager().getAvailableMemory(); } } }</code><technical_language>Is iteration of values() threadsafe in face of another thread updating persistentServerCaches</technical_language>

Target:
synchronized private void evictInactiveEntries(long bytesNeeded) { logger.debug("Trying to evict inactive cache entries to free up " + bytesNeeded + " bytes"); CacheEntry[] entries = getPersistentServerCaches().asMap().values().toArray(new CacheEntry[]{}); Arrays.sort(entries); long available = this.getMemoryManager().getAvailableMemory(); for (int i = 0; i < entries.length && available < bytesNeeded; i++) { CacheEntry entry = entries[i]; ImmutableBytesPtr cacheId = entry.getCacheId(); getPersistentServerCaches().invalidate(cacheId); available = this.getMemoryManager().getAvailableMemory(); logger.debug("Evicted cache ID " + Bytes.toLong(cacheId.get()) + ", we now have " + available + " bytes available"); } }
Source:
<code>public synchronized void onOptimizationFinished(final Set<String> addedWorkers, final Set<String> deletedWorkers) { stateMachine.checkState(State.OPTIMIZE); LOG.log(Level.INFO, "NumAddedWorkers: {0}, NumDeletedWorkers: {1}", new Object[]{addedWorkers.size(), deletedWorkers.size()}); <START> LOG.log(Level.FINE, "AddedWorkers: {0}, DeletedWorkers: {1}", new Object[]{addedWorkers, deletedWorkers}); <END> if (!runningWorkerIds.containsAll(deletedWorkers) || !Collections.disjoint(addedWorkers, deletedWorkers) || !Collections.disjoint(addedWorkers, runningWorkerIds)) { throw new IllegalStateException("The change by optimization is invalid"); } final int numRunningWorkersBefore = runningWorkerIds.size(); runningWorkerIds.addAll(addedWorkers); runningWorkerIds.removeAll(deletedWorkers); blockedWorkerIds.removeAll(deletedWorkers); LOG.log(Level.INFO, "The number of running workers changes by optimization. {0} -> {1}", new Object[]{numRunningWorkersBefore, runningWorkerIds.size()}); stateMachine.setState(State.RUN); if (!blockedWorkerIds.isEmpty()) { stateMachine.setState(State.RUN_FINISHING); } tryReleasingWorkers(); }</code><technical_language>noticed messages different, I leaving messages is fine. suggestion is follows: LOG.log(Level.INFO, "Added {0} Workers: {1}", new Object[] {addedWorkers.size(), addedWorkers}); LOG.log(Level.INFO, "Deleted {0} Workers: {1}", new Object[] {deletedWorkers.size(), deletedWorkers});</technical_language>

Target:
public synchronized void onOptimizationFinished(final Set<String> addedWorkers, final Set<String> deletedWorkers) { stateMachine.checkState(State.OPTIMIZE); LOG.log(Level.INFO, "Added {0} Workers: {1}", new Object[] {addedWorkers.size(), addedWorkers}); LOG.log(Level.INFO, "Deleted {0} Workers: {1}", new Object[] {deletedWorkers.size(), deletedWorkers}); if (!runningWorkerIds.containsAll(deletedWorkers) || !Collections.disjoint(addedWorkers, deletedWorkers) || !Collections.disjoint(addedWorkers, runningWorkerIds)) { throw new IllegalStateException("The change by optimization is invalid"); } final int numRunningWorkersBefore = runningWorkerIds.size(); runningWorkerIds.addAll(addedWorkers); runningWorkerIds.removeAll(deletedWorkers); blockedWorkerIds.removeAll(deletedWorkers); LOG.log(Level.INFO, "The number of running workers changes by optimization. {0} -> {1}", new Object[]{numRunningWorkersBefore, runningWorkerIds.size()}); stateMachine.setState(State.RUN); if (!blockedWorkerIds.isEmpty()) { stateMachine.setState(State.RUN_FINISHING); } tryReleasingWorkers(); }
Source:
<code>private void deleteDependency() { editor.waitActive(); Actions action = actionsFactory.createAction(seleniumWebDriver); editor.setCursorToLine(36); action .keyDown(SHIFT) <START> .sendKeys(DOWN) <END> .sendKeys(DOWN) .sendKeys(DOWN) .sendKeys(DOWN) .sendKeys(DOWN) .keyUp(SHIFT) .sendKeys(DELETE) .perform(); }</code><technical_language>replacing multiple sendKeys(DOWN) invocations command sendKeys(DOWN, DOWN, DOWN, DOWN, DOWN)</technical_language>

Target:
private void deleteDependency() { editor.waitActive(); editor.setCursorToLine(36); seleniumWebDriverHelper .getAction() .keyDown(SHIFT) .sendKeys(DOWN, DOWN, DOWN, DOWN, DOWN) .keyUp(SHIFT) .sendKeys(DELETE) .perform(); }
Source:
<code>public static <T> Response<T> error(int code, ResponseBody body) { if (code < 400) throw new IllegalArgumentException("code < 400: " + code); return error(body, new okhttp3.Response.Builder() <START> .body(body) <END> .code(code) .message("Response.error()") .protocol(Protocol.HTTP_1_1) .request(new Request.Builder().url("http://localhost/").build()) .build()); }</code><technical_language>This needs changed mimic: <LINK_0></technical_language>

Target:
public static <T> Response<T> error(int code, ResponseBody body) { if (code < 400) throw new IllegalArgumentException("code < 400: " + code); return error(body, new okhttp3.Response.Builder() .body(new OkHttpCall.NoContentResponseBody(body.contentType(), body.contentLength())) .code(code) .message("Response.error()") .protocol(Protocol.HTTP_1_1) .request(new Request.Builder().url("http://localhost/").build()) .build()); }
Source:
<code>public Map<String, Object> toHeaders(StompHeaders source) { Map<String, Object> target = new HashMap<String, Object>(); for (String name : source.keySet()) { if (shouldMapHeader(name, this.inboundHeaderNames)) { if (StompHeaders.CONTENT_TYPE.equals(name)) { target.put(MessageHeaders.CONTENT_TYPE, source.getContentType()); } else { <START> target.put(name, source.getFirst(name)); <END> } } } return target; }</code><technical_language>value? Also, prefixing headers stomp_ ?</technical_language>

Target:
public Map<String, Object> toHeaders(StompHeaders source) { Map<String, Object> target = new HashMap<String, Object>(); for (String name : source.keySet()) { if (shouldMapHeader(name, this.inboundHeaderNames)) { if (StompHeaders.CONTENT_TYPE.equals(name)) { target.put(MessageHeaders.CONTENT_TYPE, source.getContentType()); } else { String key = name; if (IntegrationStompHeaders.HEADERS.contains(name)) { key = IntegrationStompHeaders.PREFIX + name; } target.put(key, source.getFirst(name)); } } } return target; }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Vcs)) { return false; } Vcs that = (Vcs) o; <START> if (!Objects.equals(revision, that.revision)) { <END> return false; } return Objects.equals(url, that.url); }</code><technical_language>simplified to: return (Objects.equals(revision, that.revision) && Objects.equals(url, that.url));</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Vcs)) { return false; } Vcs that = (Vcs) o; return Objects.equals(revision, that.revision) && Objects.equals(url, that.url); }
Source:
<code>public static BlueprintClusterBinding fromHostGroupHostMap(Map<String, Set<String>> hostGroupHosts) { Set<BindingHostGroup> hostGroups = hostGroupHosts.entrySet().stream() .map(entry -> { <START> BindingHostGroup hostGroup = new BindingHostGroup(); <END> hostGroup.setName(entry.getKey()); Set<Map<String, String>> hosts = entry.getValue().stream().map(hostName -> ImmutableMap.of("fqdn", hostName)).collect(toSet()); hostGroup.setHosts(hosts); return hostGroup; }) .collect(toSet()); BlueprintClusterBinding binding = new BlueprintClusterBinding(); binding.setHostGroups(hostGroups); return binding; }</code><technical_language>please extract this block a create method, similar in HostGroup</technical_language>

Target:
public static BlueprintClusterBinding fromHostGroupHostMap(Map<String, Set<String>> hostGroupHosts) { Set<BindingHostGroup> hostGroups = hostGroupHosts.entrySet().stream() .map(entry -> BindingHostGroup.create(entry.getKey(), entry.getValue())) .collect(toSet()); BlueprintClusterBinding binding = new BlueprintClusterBinding(); binding.setHostGroups(hostGroups); return binding; }
Source:
<code>public boolean equals(Object obj) { if(!(obj instanceof NfsProfileDetails)) { return false; } NfsProfileDetails nfsDetails = (NfsProfileDetails) obj; <START> if(!ObjectUtils.objectsEqual(getNfsServerIp(), nfsDetails.getNfsServerIp())) { <END> return false; } return true; }</code><technical_language>question list</technical_language>

Target:
public boolean equals(Object obj) { if(!(obj instanceof NfsProfileDetails)) { return false; } NfsProfileDetails nfsDetails = (NfsProfileDetails) obj; if(!ObjectUtils.objectsEqual(getNfsServerIp(), nfsDetails.getNfsServerIp())) { return false; } if(!ObjectUtils.objectsEqual(getStatsInfo(), nfsDetails.getStatsInfo())) { return false; } return true; }
Source:
<code>public String getDefaultQuotaName(storage_pool storagePool) { List<Quota> quotaList = getQuotaDAO().getQuotaByStoragePoolGuid(storagePool.getId()); String quotaDefaultName = "Quota_Def_" + storagePool.getname(); String regexToolPattern = quotaDefaultName + "_[0-9]{1,}$"; <START> Integer suffixQuotaName = 0; <END> for (Quota quota : quotaList) { String quotaName = quota.getQuotaName(); if (quotaName.contains(quotaDefaultName) && (quotaName.length() == quotaDefaultName.length() && suffixQuotaName == 0)) { suffixQuotaName = 1; } else if (quotaName.matches(regexToolPattern)) { String defaultQuotaString = quotaName.substring(quotaName.lastIndexOf("_") + 1); Integer defaultQuotaNumber = new Integer(defaultQuotaString); if (suffixQuotaName < defaultQuotaNumber.intValue()) { suffixQuotaName = defaultQuotaNumber.intValue() + 1; } } } return (suffixQuotaName > 0) ? String.format("%1$s_%2$s", quotaDefaultName, suffixQuotaName.toString()) : quotaDefaultName; }</code><technical_language>i int</technical_language>

Target:
public String getDefaultQuotaName(storage_pool storagePool) { List<Quota> quotaList = getQuotaDAO().getQuotaByStoragePoolGuid(storagePool.getId()); String quotaDefaultName = "Quota_Def_" + storagePool.getname(); String regexToolPattern = quotaDefaultName + "_[0-9]{1,}$"; int suffixQuotaName = 0; for (Quota quota : quotaList) { String quotaName = quota.getQuotaName(); if (quotaName.contains(quotaDefaultName) && (quotaName.length() == quotaDefaultName.length() && suffixQuotaName == 0)) { suffixQuotaName = 1; } else if (quotaName.matches(regexToolPattern)) { String defaultQuotaString = quotaName.substring(quotaName.lastIndexOf("_") + 1); Integer defaultQuotaNumber = new Integer(defaultQuotaString); if (suffixQuotaName <= defaultQuotaNumber.intValue()) { suffixQuotaName = defaultQuotaNumber.intValue() + 1; } } } return (suffixQuotaName > 0) ? String.format("%1$s_%2$s", quotaDefaultName, suffixQuotaName) : quotaDefaultName; }
Source:
<code>public Void visit(Boolean inTailPosition, New newExpr) { for (Declaration decl : newExpr.getDecls()) { <START> decl.acceptVisitor(this, inTailPosition); <END> } return null; }</code><technical_language>This matter Val- Var-Declaration pass "false" for inTailPosition, conceptually pass "false" here</technical_language>

Target:
public Void visit(Boolean inTailPosition, New newExpr) { for (Declaration decl : newExpr.getDecls()) { decl.acceptVisitor(this, false); } return null; }
Source:
<code>private String createPluginDirectory(GenEditorGenerator editorGen, String suffix) { StringBuilder pluginDirectory = new StringBuilder(editorGen.getPluginDirectory()); if (pluginDirectory.charAt(0) == '/') { <START> pluginDirectory.delete(0, 1); <END> } String[] pluginDirectoryParts = pluginDirectory.toString().split("/"); StringBuilder result = new StringBuilder("/").append(pluginDirectoryParts[0]); result.append(".").append(suffix).append("/"); for (int i = 1; i < pluginDirectoryParts.length; i++) { result.append(pluginDirectoryParts[i]).append("/"); } return result.toString(); }</code><technical_language>bad do pluginDirectory = pluginDirectory.substring(1);</technical_language>

Target:
private String createPluginDirectory(GenEditorGenerator editorGen, String suffix) { String pluginDirectory = editorGen.getPluginDirectory(); if (pluginDirectory.startsWith("/")) { pluginDirectory = pluginDirectory.substring(1); } String[] pluginDirectoryParts = pluginDirectory.split("/"); StringBuilder result = new StringBuilder("/").append(pluginDirectoryParts[0]); result.append(".").append(suffix).append("/"); for (int i = 1; i < pluginDirectoryParts.length; i++) { result.append(pluginDirectoryParts[i]).append("/"); } return result.toString(); }
Source:
<code>public Map<String, Ref> getRefs(String prefix) throws IOException { if (!prefix.isEmpty() && prefix.charAt(prefix.length() - 1) != '/') { return new HashMap<>(0); } Ref src = bootstrap.exactRef(txnCommitted); Scanner.Result c = refs; if (c == null || !c.refTreeId.equals(idOf(src))) { c = Scanner.scanRefTree(repo, src, prefix, true); if (prefix.isEmpty()) { refs = c; } } RefList<Ref> empty = RefList.emptyList(); return new RefMap(prefix, <START> empty, c.all, <END> c.sym); }</code><technical_language>Inline variable</technical_language>

Target:
public Map<String, Ref> getRefs(String prefix) throws IOException { if (!prefix.isEmpty() && prefix.charAt(prefix.length() - 1) != '/') { return new HashMap<>(0); } Ref src = bootstrap.exactRef(txnCommitted); Scanner.Result c = refs; if (c == null || !c.refTreeId.equals(idOf(src))) { c = Scanner.scanRefTree(repo, src, prefix, true); if (prefix.isEmpty()) { refs = c; } } return new RefMap(prefix, RefList.<Ref> emptyList(), c.all, c.sym); }
Source:
<code><START> public HttpServletRequest getRequest() { <END> return request; }</code><technical_language>getters private this instance members</technical_language>

Target:
private HttpServletRequest getRequest() { return this.request; }
Source:
<code>private String getWlpOutputDir() throws IOException { Properties envvars = new Properties(); File serverEnvFile = new File(installDirectory, "etc/server.env"); if (serverEnvFile.exists()) { envvars.load(new FileInputStream(serverEnvFile)); } <START> if (serverEnv.exists()) { <END> envvars.load(new FileInputStream(serverEnv)); } serverEnvFile = new File(configDirectory, "server.env"); if (configDirectory != null && serverEnvFile.exists()) { envvars.load(new FileInputStream(serverEnvFile)); } return (String) envvars.get("WLP_OUTPUT_DIR"); }</code><technical_language>this if else if configDirectory takes priority merge properties in configDirectory serverEnv in case? get other. I merged etc/server.env variables above. serverEnvFile = new File(configDirectory, "server.env"); if (configDirectory != null && serverEnvFile.exists()) { envvars.load(new FileInputStream(serverEnvFile)); } else if (serverEnv.exists()) { envvars.load(new FileInputStream(serverEnv)); }</technical_language>

Target:
private String getWlpOutputDir() throws IOException { Properties envvars = new Properties(); File serverEnvFile = new File(installDirectory, "etc/server.env"); if (serverEnvFile.exists()) { envvars.load(new FileInputStream(serverEnvFile)); } serverEnvFile = new File(configDirectory, "server.env"); if (configDirectory != null && serverEnvFile.exists()) { envvars.load(new FileInputStream(serverEnvFile)); } else if (serverEnv.exists()) { envvars.load(new FileInputStream(serverEnv)); } return (String) envvars.get("WLP_OUTPUT_DIR"); }