auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public TaskReviewsMappingsStore(TaskDataManager taskDataManager, TaskRepositoryManager repositoryManager) { this.repositoryManager = repositoryManager; this.taskDataManager = taskDataManager; <START> taskReviewsMap = Multimaps.synchronizedListMultimap(ArrayListMultimap.<String, String> create()); <END> }</code><technical_language>I this is I before, I synchronizedSetMultimap(LinkedHashMultimap) prevent duplicates</technical_language>

Target:
public TaskReviewsMappingsStore(TaskDataManager taskDataManager, TaskRepositoryManager repositoryManager) { this.repositoryManager = repositoryManager; this.taskDataManager = taskDataManager; taskReviewsMap = Multimaps.synchronizedSetMultimap(LinkedHashMultimap.<String, String> create()); }
Source:
<code>public void testApply() { BucketExtractionFn extractionFn1 = new BucketExtractionFn(100.0, 0.5); Assert.assertEquals("1200.5", extractionFn1.apply("1234.99")); Assert.assertEquals("0.5", extractionFn1.apply("1")); Assert.assertEquals("0.5", extractionFn1.apply("100")); Assert.assertEquals("500.5", extractionFn1.apply(501)); <START> Assert.assertEquals("-399.5", extractionFn1.apply("-325")); <END> BucketExtractionFn extractionFn2 = new BucketExtractionFn(3.0, 2.0); Assert.assertEquals("2", extractionFn2.apply("2")); Assert.assertEquals("2", extractionFn2.apply("3")); Assert.assertEquals("2", extractionFn2.apply("4.22")); Assert.assertEquals("-10", extractionFn2.apply("-8")); }</code><technical_language>great a test for input is numeric, specifically "" "blah blah" "1e2" interesting test cases</technical_language>

Target:
public void testApply() { BucketExtractionFn extractionFn1 = new BucketExtractionFn(100.0, 0.5); Assert.assertEquals("1200.5", extractionFn1.apply("1234.99")); Assert.assertEquals("0.5", extractionFn1.apply("1")); Assert.assertEquals("0.5", extractionFn1.apply("100")); Assert.assertEquals("500.5", extractionFn1.apply(501)); Assert.assertEquals("-399.5", extractionFn1.apply("-325")); Assert.assertEquals("2400.5", extractionFn1.apply("2.42e3")); Assert.assertEquals("-99.5", extractionFn1.apply("1.2e-1")); Assert.assertEquals(null, extractionFn1.apply("should be null")); Assert.assertEquals(null, extractionFn1.apply("")); BucketExtractionFn extractionFn2 = new BucketExtractionFn(3.0, 2.0); Assert.assertEquals("2", extractionFn2.apply("2")); Assert.assertEquals("2", extractionFn2.apply("3")); Assert.assertEquals("2", extractionFn2.apply("4.22")); Assert.assertEquals("-10", extractionFn2.apply("-8")); Assert.assertEquals("71", extractionFn2.apply("7.1e1")); }
Source:
<code>public void updateAllowedConnectionType(ConnectionType allowedConnectionType) { if (allowedConnectionType == null) { throw new IllegalArgumentException("Allowed connection type cannot be null"); } connectionChecker.updateAllowedConnectionType(allowedConnectionType); DownloadsNetworkRecoveryCreator.getInstance().updateAllowedConnectionType(allowedConnectionType); <START> if (!connectionChecker.isAllowedToDownload()) { <END> for (DownloadBatch downloadBatch : downloadBatchMap.values()) { downloadBatch.waitForNetwork(); } } else { submitAllStoredDownloads(() -> Log.v("Allowed connectionType updated to " + allowedConnectionType + ". All jobs submitted")); } }</code><technical_language>a positive check, reverse if else. more clear</technical_language>

Target:
public void updateAllowedConnectionType(ConnectionType allowedConnectionType) { if (allowedConnectionType == null) { throw new IllegalArgumentException("Allowed connection type cannot be null"); } connectionChecker.updateAllowedConnectionType(allowedConnectionType); DownloadsNetworkRecoveryCreator.getInstance().updateAllowedConnectionType(allowedConnectionType); if (connectionChecker.isAllowedToDownload()) { submitAllStoredDownloads(() -> Log.v("Allowed connectionType updated to " + allowedConnectionType + ". All jobs submitted")); } else { for (DownloadBatch downloadBatch : downloadBatchMap.values()) { downloadBatch.waitForNetwork(); } } }
Source:
<code>public Method getOnStringMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); if (methods == null) { return null; } <START> for (Method method : methods) { <END> if (method.isAnnotationPresent(OnMessage.class)) { Class<?>[] paraTypes = method.getParameterTypes(); List<Class<?>> paraList = Arrays.asList(paraTypes); if (paraList.contains(String.class)) { return method; } } } return null; }</code><technical_language>Consider Java 8 streams</technical_language>

Target:
public Optional<Method> getOnStringMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); Method returnMethod = null; for (Method method : methods) { if (method.isAnnotationPresent(OnMessage.class)) { Class<?>[] paraTypes = method.getParameterTypes(); List<Class<?>> paraList = Arrays.asList(paraTypes); if (paraList.contains(String.class)) { returnMethod = method; } } } return Optional.ofNullable(returnMethod); }
Source:
<code>public SELF isNotEqualTo(Object other) { if (actual == null && other == null) { <START> throw objects.getFailures().failure(info, shouldNotBeEqual(actual, other)); <END> } else if (other != null && actual != null) { List<ComparisonDifference> differences = determineDifferencesWith(other); if (differences.isEmpty()) throw objects.getFailures().failure(info, shouldNotBeEqual(actual, other)); } return myself; }</code><technical_language>add @since 3.16.0</technical_language>

Target:
public SELF isNotEqualTo(Object other) { if (actual == other) { throw objects.getFailures().failure(info, shouldNotBeEqualComparingFieldByFieldRecursively(actual, other, recursiveComparisonConfiguration, info.representation())); } if (other != null && actual != null) { List<ComparisonDifference> differences = determineDifferencesWith(other); if (differences.isEmpty()) throw objects.getFailures().failure(info, shouldNotBeEqualComparingFieldByFieldRecursively(actual, other, recursiveComparisonConfiguration, info.representation())); } return myself; }
Source:
<code>private boolean isDiskValidForStorage(Disk disk, StorageDomain storage) { <START> if (disk.isShareable() && storage.getStorageType().equals(StorageType.GLUSTERFS)) { <END> return false; } return true; }</code><technical_language>StorageType is enum - compared ==</technical_language>

Target:
private boolean isDiskValidForStorage(Disk disk, StorageDomain storage) { if (disk.isShareable() && storage.getStorageType() == StorageType.GLUSTERFS) { return false; } return true; }
Source:
<code>protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition) { String parentElement = contentAssistRequest.getParent().getNodeName(); String thisNode = contentAssistRequest.getNode().getNodeName(); if( thisNode.equals("#text")) thisNode = ""; ArrayList possibleNodes = children.get(parentElement); <START> possibleNodes = (possibleNodes == null ? new ArrayList() : possibleNodes); <END> ChildOccurances occ; for( int i = 0; i < possibleNodes.size(); i++ ) { occ = (ChildOccurances)possibleNodes.get(i); if( occ.name.startsWith(thisNode)) { createAndAddTagCompletionProposals(contentAssistRequest.getNode(), occ, contentAssistRequest.getParent(), contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest, true); } } }</code><technical_language>Collections.emptySet() Denis - check for null</technical_language>

Target:
protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition) { String parentElement = contentAssistRequest.getParent().getNodeName(); String thisNode = contentAssistRequest.getNode().getNodeName(); if( thisNode.equals("#text")) thisNode = ""; List possibleNodes = children.get(parentElement); if( possibleNodes != null ) { ChildOccurances occ; for( int i = 0; i < possibleNodes.size(); i++ ) { occ = (ChildOccurances)possibleNodes.get(i); if( occ.name.startsWith(thisNode)) { createAndAddTagCompletionProposals(contentAssistRequest.getNode(), occ, contentAssistRequest.getParent(), contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest, true); } } } }
Source:
<code>public void continue_with_argument() { String continueInnerLoop = "" + "while (outerCond( succ = [innerCond, END] )) {" + " while (innerCond( succ = [ifCond, outerCond] )) {" + " if (ifCond( succ = [body, innerCond] )) {" + " body( succ = [innerCond] );" + " continue %s;" + " }" + " }" + "}"; verifyBlockCfg(String.format(continueInnerLoop, "0")); verifyBlockCfg(String.format(continueInnerLoop, "1")); verifyBlockCfg("" + "while (outerCond( succ = [innerCond, END] )) {" + " while (innerCond( succ = [ifCond, outerCond] )) {" + " if (ifCond( succ = [body, innerCond] )) {" + " body( succ = [outerCond] );" + " continue 2;" + " }" + " }" + "}"); verifyBlockCfg("" + "do {" + " while (innerCond( succ = [ifCond, outerCond] )) {" + " if (ifCond( succ = [body, innerCond] )) {" + <START> " body( succ = [innerCond] );" + <END> " continue 2;" + " }" + " }" + "} while (outerCond( succ = [innerCond, END] ));"); }</code><technical_language>this outerCond? debug, want update CfgPrinter.blockLabel() function this version: <LINK_0></technical_language>

Target:
public void continue_with_argument() { String continueInnerLoop = "" + "while (outerCond( succ = [innerCond, END] )) {" + " while (innerCond( succ = [ifCond, outerCond] )) {" + " if (ifCond( succ = [body, innerCond] )) {" + " body( succ = [innerCond] );" + " continue %s;" + " }" + " }" + "}"; verifyBlockCfg(String.format(continueInnerLoop, "0")); verifyBlockCfg(String.format(continueInnerLoop, "1")); verifyBlockCfg("" + "while (outerCond( succ = [innerCond, END] )) {" + " while (innerCond( succ = [ifCond, outerCond] )) {" + " if (ifCond( succ = [body, innerCond] )) {" + " body( succ = [outerCond] );" + " continue 2;" + " }" + " }" + "}"); verifyBlockCfg("" + "do {" + " doBody( succ = [innerCond]);" + " while (innerCond( succ = [ifCond, outerCond] )) {" + " if (ifCond( succ = [whileBody, innerCond] )) {" + " whileBody( succ = [outerCond] );" + " continue 2;" + " }" + " }" + "} while (outerCond( succ = [doBody, END] ));"); }
Source:
<code>protected String getBarcodeLabel(final Map<Integer, String> labels, final List<Integer> barcodeFields, final Map<Integer, Field> keyFieldMap, final boolean includeLabel) { <START> final StringBuffer barcode = new StringBuffer(); <END> for (final Integer barcodeField : barcodeFields) { if (StringUtils.isEmpty(barcode.toString())) { if(includeLabel) { barcode.append(keyFieldMap.get(barcodeField).getName() + " : "); } barcode.append(labels.get(barcodeField)); continue; } barcode.append(" | "); if(includeLabel) { barcode.append(keyFieldMap.get(barcodeField).getName() + " : "); } barcode.append(labels.get(barcodeField)); } return barcode.toString(); }</code><technical_language>StringBuilder instead</technical_language>

Target:
String getBarcodeLabel(final Map<Integer, String> labels, final List<Integer> barcodeFields, final Map<Integer, Field> keyFieldMap, final boolean includeLabel) { final StringBuilder barcode = new StringBuilder(); for (final Integer barcodeField : barcodeFields) { if (!StringUtils.isEmpty(barcode.toString())) { barcode.append(BARCODE_SEPARATOR); } if(includeLabel) { barcode.append(keyFieldMap.get(barcodeField).getName() + FIELDNAME_VALUE_SEPARATOR); } barcode.append(labels.get(barcodeField)); } return barcode.toString(); }
Source:
<code>public void startupShouldNotFailOnIOExceptionOnlineListener() { <START> Assert.assertEquals(1, IOExceptionOnOnlineListener.onOnlineCount); <END> }</code><technical_language>suggestion assertEquals(1, IOExceptionOnOnlineListener.onOnlineCount); I suggest existing pattern in this file calling assert() methods directly. new import needed</technical_language>

Target:
public void startupShouldNotFailOnIOExceptionOnlineListener() { assertEquals(1, IOExceptionOnOnlineListener.onOnlineCount); }
Source:
<code>public boolean isEnabled(Geopoint geopoint) { if (geopoint == null) { return true; } <START> return false; <END> }</code><technical_language>This java return geopoint == null; I wrote, semantics of this questionable</technical_language>

Target:
public boolean isEnabled(Geopoint geopoint) { return geopoint == null; }
Source:
<code>protected RemoteOperationResult run(OwnCloudClient client) { GetRemoteCapabilitiesOperation getCapabilities = new GetRemoteCapabilitiesOperation(); RemoteOperationResult result = getCapabilities.execute(client); <START> if (result.isSuccess()){ <END> OCCapability capability = (OCCapability) result.getData().get(0); getStorageManager().saveCapabilities(capability); } return result; }</code><technical_language>check mplementation this, sense null check result, result.getData() result.getDate().get(0) is this null safe design</technical_language>

Target:
protected RemoteOperationResult run(OwnCloudClient client) { GetRemoteCapabilitiesOperation getCapabilities = new GetRemoteCapabilitiesOperation(); RemoteOperationResult result = getCapabilities.execute(client); if (result.isSuccess()){ if( result.getData()!= null && result.getData().size() > 0) { OCCapability capability = (OCCapability) result.getData().get(0); getStorageManager().saveCapabilities(capability); } } return result; }
Source:
<code>public void deactivateUnusedParcels(ParcelsResourceApi parcelsResourceApi, ParcelResourceApi parcelResourceApi, String stackName, Map<String, ClouderaManagerProduct> cmProducts) { Map<String, String> installedComponents = getParcelsInStatus(parcelsResourceApi, stackName, ParcelStatus.ACTIVATED); Set<String> failedDeactivations = new HashSet<>(); for (Map.Entry<String, String> installedComp : installedComponents.entrySet()) { if (!cmProducts.containsKey(installedComp.getKey())) { try { <START> parcelResourceApi.deactivateCommand(stackName, installedComp.getKey(), installedComp.getValue()); <END> } catch (ApiException e) { String product = "[" + installedComp.getKey() + ":" + installedComp.getValue() + "]"; LOGGER.info(String.format("Unable to deactivate product: %s", product), e); failedDeactivations.add(product); } } } if (!failedDeactivations.isEmpty()) { throw new ClouderaManagerOperationFailedException(String.format("Deactivation failed on the following products: %s", failedDeactivations)); } }</code><technical_language>I log deactivating</technical_language>

Target:
public void deactivateUnusedParcels(ParcelsResourceApi parcelsResourceApi, ParcelResourceApi parcelResourceApi, String stackName, Map<String, ClouderaManagerProduct> cmProducts) { Map<String, String> installedComponents = getParcelsInStatus(parcelsResourceApi, stackName, ParcelStatus.ACTIVATED); Map<String, String> filteredParcels = installedComponents.entrySet().stream() .filter(entry -> !cmProducts.containsKey(entry.getKey())) .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); deactivateParcels(parcelResourceApi, stackName, filteredParcels); }
Source:
<code>public Optional<CommandMapping> resolveMapping(String alias, CommandSource source) { return Optional.fromNullable(commands.get(alias.toLowerCase())); <START> } <END></code><technical_language>Missing newline</technical_language>

Target:
public Optional<CommandMapping> resolveMapping(String alias, CommandSource source) { return Optional.fromNullable(this.commands.get(alias.toLowerCase())); }
Source:
<code>public B setZkClientType(ZkBaseDataAccessor.ZkClientType zkClientType) { <START> _zkClientType = Enum.valueOf(ZkClientType.class, zkClientType.name()); return self(); <END> }</code><technical_language>nit, return setZkClientType(Enum.valueOf(ZkClientType.class, zkClientType.name()));</technical_language>

Target:
public B setZkClientType(ZkBaseDataAccessor.ZkClientType zkClientType) { return setZkClientType(Enum.valueOf(ZkClientType.class, zkClientType.name())); }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.reader_activity_post_list); mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { <START> getSupportActionBar().setDisplayShowTitleEnabled(true); <END> getSupportActionBar().setDisplayHomeAsUpEnabled(true); } if (getIntent().hasExtra(ReaderConstants.ARG_POST_LIST_TYPE)) { mPostListType = (ReaderPostListType) getIntent().getSerializableExtra(ReaderConstants.ARG_POST_LIST_TYPE); } else { mPostListType = ReaderTypes.DEFAULT_POST_LIST_TYPE; } if (getPostListType() == ReaderPostListType.BLOG_PREVIEW) { setTitle(R.string.reader_title_blog_preview); if (savedInstanceState == null) { long blogId = getIntent().getLongExtra(ReaderConstants.ARG_BLOG_ID, 0); long feedId = getIntent().getLongExtra(ReaderConstants.ARG_FEED_ID, 0); if (feedId != 0) { showListFragmentForFeed(feedId); } else { showListFragmentForBlog(blogId); } } } else if (getPostListType() == ReaderPostListType.TAG_PREVIEW) { setTitle(R.string.reader_title_tag_preview); ReaderTag tag = (ReaderTag) getIntent().getSerializableExtra(ReaderConstants.ARG_TAG); if (tag != null && savedInstanceState == null) { showListFragmentForTag(tag, mPostListType); } } }</code><technical_language>nitpick; actionBar here</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.reader_activity_post_list); mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } if (getIntent().hasExtra(ReaderConstants.ARG_POST_LIST_TYPE)) { mPostListType = (ReaderPostListType) getIntent().getSerializableExtra(ReaderConstants.ARG_POST_LIST_TYPE); } else { mPostListType = ReaderTypes.DEFAULT_POST_LIST_TYPE; } if (getPostListType() == ReaderPostListType.BLOG_PREVIEW) { setTitle(R.string.reader_title_blog_preview); if (savedInstanceState == null) { long blogId = getIntent().getLongExtra(ReaderConstants.ARG_BLOG_ID, 0); long feedId = getIntent().getLongExtra(ReaderConstants.ARG_FEED_ID, 0); if (feedId != 0) { showListFragmentForFeed(feedId); } else { showListFragmentForBlog(blogId); } } } else if (getPostListType() == ReaderPostListType.TAG_PREVIEW) { setTitle(R.string.reader_title_tag_preview); ReaderTag tag = (ReaderTag) getIntent().getSerializableExtra(ReaderConstants.ARG_TAG); if (tag != null && savedInstanceState == null) { showListFragmentForTag(tag, mPostListType); } } }
Source:
<code>public void setup() { new AudioDetector(); if (!AudioDetector.isNoAudio()) { <START> new MusicPlayer(); <END> } }</code><technical_language>for this line, new MusicPlayer is stored. Singleton, do else in case need multiple (for FX for example)</technical_language>

Target:
public void setup() { assumeFalse("No audio devices are available. Skipping...", AudioDetector.getInstance().isNoAudio()); MusicPlayer.init(); }
Source:
<code>public void checkConsistency( RECORD record, CheckerEngine<RECORD, REPORT> engine, RecordAccess records ) { if ( !Record.NO_NEXT_PROPERTY.is( record.getNextProp() ) ) { Iterator<PropertyRecord> props = records.rawPropertyChain( record.getNextProp() ); PropertyRecord firstProp = props.next(); if ( !Record.NO_PREVIOUS_PROPERTY.is( firstProp.getPrevProp() ) ) { engine.report().propertyNotFirstInChain( firstProp ); } final MutableIntSet keys = new IntHashSet( 0 ); <START> try ( <END> MandatoryProperties.Check<RECORD,REPORT> mandatory = mandatoryProperties.apply( record ) ) { checkChainItem( firstProp, engine, keys, mandatory ); while ( props.hasNext() ) { checkChainItem( props.next(), engine, keys, mandatory ); } } } }</code><technical_language>empty line, specific reason for initial capacity 0 here</technical_language>

Target:
public void checkConsistency( RECORD record, CheckerEngine<RECORD, REPORT> engine, RecordAccess records ) { if ( !Record.NO_NEXT_PROPERTY.is( record.getNextProp() ) ) { Iterator<PropertyRecord> props = records.rawPropertyChain( record.getNextProp() ); PropertyRecord firstProp = props.next(); if ( !Record.NO_PREVIOUS_PROPERTY.is( firstProp.getPrevProp() ) ) { engine.report().propertyNotFirstInChain( firstProp ); } final MutableIntSet keys = new IntHashSet(); try ( MandatoryProperties.Check<RECORD,REPORT> mandatory = mandatoryProperties.apply( record ) ) { checkChainItem( firstProp, engine, keys, mandatory ); while ( props.hasNext() ) { checkChainItem( props.next(), engine, keys, mandatory ); } } } }
Source:
<code>private void setEndpoint(String url, String baseUrl) { <START> endpoint = url.substring((baseUrl + "api").length(), url.length()); <END> int questionMarkPosition = url.indexOf("?"); if (questionMarkPosition != -1) { endpoint = endpoint.substring(0, questionMarkPosition); } }</code><technical_language>remove redundant parameter: endpoint = url.substring((baseUrl + "api").length());</technical_language>

Target:
private void setEndpoint(String url, String baseUrl) { endpoint = url.substring((baseUrl + "api").length()); int questionMarkPosition = url.indexOf("?"); if (questionMarkPosition != -1) { endpoint = endpoint.substring(0, questionMarkPosition); } }
Source:
<code>public static void delayUntilTraceOpened(final ITmfProjectModelElement projectElement) { if (projectElement instanceof TmfTraceElement) { TmfTraceElement traceElement = (TmfTraceElement) projectElement; ITmfTrace trace = traceElement.getTrace(); int cnt = 0; <START> while ((trace == null) && (cnt++ < DELAY_COUNTER)) { <END> delayThread(DEFAULT_DELAY); trace = traceElement.getTrace(); } } else { delayThread(DEFAULT_DELAY); } }</code><technical_language>this instead of traceEleement.getTrace() save a line</technical_language>

Target:
public static void delayUntilTraceOpened(final ITmfProjectModelElement projectElement) throws TimeoutException { if (projectElement instanceof TmfTraceElement) { TmfTraceElement traceElement = (TmfTraceElement) projectElement; int cnt = 0; while ((traceElement.getTrace() == null) && (cnt++ < DELAY_COUNTER)) { delayThread(DEFAULT_DELAY); } if (traceElement.getTrace() == null) { throw new TimeoutException(); } } else { delayThread(DEFAULT_DELAY); } }
Source:
<code>public StreamSnapshotDataTarget(long HSId, boolean lowestDestSite, Set<Long> allDestHostHSIds, byte[] hashinatorConfig, List<SnapshotTableInfo> tables, long writeTimeout, SnapshotSender sender, StreamSnapshotAckReceiver ackReceiver) { super(); assert(VoltDB.instanceOnServerThread() ? !m_rejoinDeathTestMode : true); m_targetId = m_totalSnapshotTargetCount.getAndIncrement(); m_schemas = tables.stream().collect( Collectors.toMap(SnapshotTableInfo::getTableId, t -> Pair.of(t.isReplicated(), t.getSchema()))); m_destHSId = HSId; m_replicatedTableTarget = lowestDestSite; m_otherDestHostHSIds = new HashSet<>(allDestHostHSIds); m_otherDestHostHSIds.remove(m_destHSId); m_sender = sender; m_sender.registerDataTarget(m_targetId); m_ackReceiver = ackReceiver; m_ackReceiver.setCallback(m_targetId, this, m_replicatedTableTarget ? allDestHostHSIds.size() : 1); rejoinLog.debug(String.format("Initializing snapshot stream processor " + "for source site id: %s, and with processorid: %d%s" , CoreUtils.hsIdToString(HSId), m_targetId, (lowestDestSite?" [Lowest Site]":""))); <START> VoltDB.instance().scheduleWork(new Watchdog(0, writeTimeout, System.currentTimeMillis()), WATCHDOG_PERIOS_S, -1, TimeUnit.SECONDS); <END> if (hashinatorConfig != null) { send(StreamSnapshotMessageType.HASHINATOR, -1, hashinatorConfig, false); } }</code><technical_language>want fix typo in WATCHDOG_PERIOS_S -> WATCHDOG_PERIOD_S</technical_language>

Target:
public StreamSnapshotDataTarget(long HSId, boolean lowestDestSite, Set<Long> allDestHostHSIds, byte[] hashinatorConfig, List<SnapshotTableInfo> tables, long writeTimeout, SnapshotSender sender, StreamSnapshotAckReceiver ackReceiver) { super(); assert(VoltDB.instanceOnServerThread() ? !m_rejoinDeathTestMode : true); m_targetId = m_totalSnapshotTargetCount.getAndIncrement(); m_schemas = tables.stream().collect( Collectors.toMap(SnapshotTableInfo::getTableId, t -> Pair.of(t.isReplicated(), t.getSchema()))); m_destHSId = HSId; m_replicatedTableTarget = lowestDestSite; m_otherDestHostHSIds = new HashSet<>(allDestHostHSIds); m_otherDestHostHSIds.remove(m_destHSId); m_sender = sender; m_sender.registerDataTarget(m_targetId); m_ackReceiver = ackReceiver; m_ackReceiver.setCallback(m_targetId, this, m_replicatedTableTarget ? allDestHostHSIds.size() : 1); rejoinLog.debug(String.format("Initializing snapshot stream processor " + "for source site id: %s, and with processorid: %d%s" , CoreUtils.hsIdToString(HSId), m_targetId, (lowestDestSite?" [Lowest Site]":""))); VoltDB.instance().scheduleWork(new Watchdog(0, writeTimeout, System.currentTimeMillis()), WATCHDOG_PERIOD_S, -1, TimeUnit.SECONDS); if (hashinatorConfig != null) { send(StreamSnapshotMessageType.HASHINATOR, -1, hashinatorConfig, false); } }
Source:
<code>private String concatenatedValue(String valueToAppend, String currentValue, String delimiter) { String retValue = currentValue; if (!Arrays.asList(retValue.split(delimiter)).contains(valueToAppend)) { <START> if (!retValue.endsWith(delimiter)) { <END> retValue += delimiter; } retValue += valueToAppend; } return retValue; }</code><technical_language>nested if omitted replace a simple && condition</technical_language>

Target:
private String concatenatedValue(String valueToAppend, String currentValue, String delimiter) { StringBuilder retValue = new StringBuilder(currentValue); if (!Arrays.asList(currentValue.split(delimiter)).contains(valueToAppend)) { if (!currentValue.endsWith(delimiter)) { retValue.append(delimiter); } retValue.append(valueToAppend); } return retValue.toString(); }
Source:
<code><START> protected Class<TBase> getThriftClass() <END> throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException { final Class<TBase> thrift; if(jarPath != null){ File jar = new File(jarPath); URLClassLoader child = new URLClassLoader( new URL[]{jar.toURI().toURL()}, this.getClass().getClassLoader() ); thrift = (Class<TBase>) Class.forName(thriftClassName, true, child); } else { thrift = (Class<TBase>) Class.forName(thriftClassName); } thrift.newInstance(); return thrift; }</code><technical_language>this need protected</technical_language>

Target:
public Class<TBase> getThriftClass() throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException { final Class<TBase> thrift; if (jarPath != null) { File jar = new File(jarPath); URLClassLoader child = new URLClassLoader( new URL[]{jar.toURI().toURL()}, this.getClass().getClassLoader() ); thrift = (Class<TBase>) Class.forName(thriftClassName, true, child); } else { thrift = (Class<TBase>) Class.forName(thriftClassName); } thrift.newInstance(); return thrift; }
Source:
<code>private AppUpdateState getAppUpdateState() { if (mAppUpdateInfo != null && mAppUpdateInfo.availableVersionCode() == HiddenPreferences.getSkippedCommCareUpdateVersion()) { return AppUpdateState.UNAVAILABLE; } AppUpdateState state = AppUpdateState.UNAVAILABLE; switch (mInstallStatus) { <START> case InstallStatus.PENDING: <END> case InstallStatus.DOWNLOADING: state = AppUpdateState.DOWNLOADING; break; case InstallStatus.DOWNLOADED: state = AppUpdateState.DOWNLOADED; break; case InstallStatus.FAILED: state = AppUpdateState.FAILED; break; } if (state == AppUpdateState.UNAVAILABLE && mUpdateAvailability == UpdateAvailability.UPDATE_AVAILABLE) { state = AppUpdateState.AVAILABLE; } if (mInstallErrorCode != InstallErrorCode.NO_ERROR) { state = AppUpdateState.FAILED; } return state; }</code><technical_language>Confirming Pending app update is downloading</technical_language>

Target:
private AppUpdateState getAppUpdateState() { AppUpdateState state = AppUpdateState.UNAVAILABLE; switch (mInstallStatus) { case InstallStatus.PENDING: case InstallStatus.DOWNLOADING: state = AppUpdateState.DOWNLOADING; break; case InstallStatus.DOWNLOADED: state = AppUpdateState.DOWNLOADED; break; case InstallStatus.FAILED: state = AppUpdateState.FAILED; break; } if (state == AppUpdateState.UNAVAILABLE && mUpdateAvailability == UpdateAvailability.UPDATE_AVAILABLE) { state = AppUpdateState.AVAILABLE; } return state; }
Source:
<code><START> private File setupExecutionDir(final File installedDir, final ExecutableFlow flow) <END> throws IOException { File execDir = null; try { execDir = createExecDir(flow); FileIOUtils.createDeepHardlink(installedDir, execDir); return execDir; } catch (final Exception ex) { FileIOUtils.deleteDirectory(execDir); throw ex; } }</code><technical_language>Recursively creating hard links expensive well. Do time takes average</technical_language>

Target:
private File setupExecutionDir(final File installedDir, final ExecutableFlow flow) throws IOException { File execDir = null; try { execDir = createExecDir(flow); FileIOUtils.createDeepHardlink(installedDir, execDir); return execDir; } catch (final Exception ex) { FileIOUtils.deleteDirectorySilently(execDir); throw ex; } }
Source:
<code>public PduResponse firePduRequestReceived(PduRequest request) { PduResponse response = null; try { if (request instanceof DeliverSm) { <START> Log.debug("Message Received: " <END> + CharsetUtil.decode(((DeliverSm) request).getShortMessage(), smppClient.mapDataCodingToCharset(((DeliverSm) request).getDataCoding())) + ", Source Address: " + ((DeliverSm) request).getSourceAddress().getAddress()); } response = request.createResponse(); } catch (Throwable error) { Log.warning(error); response = request.createResponse(); response.setResultMessage(error.getMessage()); response.setCommandStatus(SmppConstants.STATUS_UNKNOWNERR); } return response; }</code><technical_language>I simplify this log. I need of this information in log</technical_language>

Target:
public PduResponse firePduRequestReceived(PduRequest request) { PduResponse response = null; try { if (request instanceof DeliverSm) { if (request.getOptionalParameters() != null) { Log.debug("Message Delivered: " + request.getOptionalParameter(SmppConstants.TAG_RECEIPTED_MSG_ID).getValueAsString() + ", State: " + request.getOptionalParameter(SmppConstants.TAG_MSG_STATE).getValueAsByte()); } else { Log.debug("Message Received: " + CharsetUtil.decode(((DeliverSm) request).getShortMessage(), smppClient.mapDataCodingToCharset(((DeliverSm) request).getDataCoding())) + ", Source Address: " + ((DeliverSm) request).getSourceAddress().getAddress()); } } response = request.createResponse(); } catch (Throwable error) { Log.warning(error); response = request.createResponse(); response.setResultMessage(error.getMessage()); response.setCommandStatus(SmppConstants.STATUS_UNKNOWNERR); } return response; }
Source:
<code>public SchedulingTaskComparator(InternalTask task, InternalJob job) { this.task = task; if (task.getSelectionScripts() != null) { List<SelectionScript> scriptList = SchedulingMethodImpl.resolveScriptVariables(task.getSelectionScripts(), task.getRuntimeVariables()); for (SelectionScript script : scriptList) { SelectionScript modifiedScript = script; try { Map<String, Serializable> bindings = SchedulingMethodImpl.createBindingsForSelectionScripts(job, task); modifiedScript = SchedulingMethodImpl.replaceBindingsInsideScript(script, bindings); } catch (Exception e) { <START> logger.error("", e); <END> } try { digests.add(new String(modifiedScript.digest())); } catch (Exception e) { logger.error("", e); } } } this.job = job; }</code><technical_language>add more info in this error log</technical_language>

Target:
public SchedulingTaskComparator(InternalTask task, InternalJob job) { this.task = task; if (task.getSelectionScripts() != null) { computeHashForSelectionScripts(task, job); } this.job = job; }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); <START> sb.append("["); <END> sb.append(fStart); sb.append(", "); sb.append(fStart + fDuration); sb.append("]"); return sb.toString(); }</code><technical_language>single quote '[' avoid putting //$NON-NLS-1$ end</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append('['); sb.append(fStart); sb.append(", "); sb.append(fStart + fDuration); sb.append(']'); return sb.toString(); }
Source:
<code>public String loadResource(String path) throws IOException { <START> Reader reader = this.resourceReader(path); <END> StringBuffer sb = new StringBuffer(1024); char[] buffer = new char[1024]; int n; while ((n = reader.read(buffer)) >= 0) { if (n == 0) Thread.yield(); else { sb.append(buffer, 0, n); } } reader.close(); return sb.toString(); }</code><technical_language>try-with-resources for this</technical_language>

Target:
public String loadResource(String path) throws IOException { StringWriter writer = new StringWriter(1024); try (Reader reader = this.resourceReader(path)) { IOUtils.copy(reader, writer); } return writer.toString(); }
Source:
<code>OnlineBackupRequiredArguments establishRequiredArguments( String... args ) throws IncorrectUsage { try { <START> OptionalHostnamePort address = toOptionalHostnamePortFromRawAddress( arguments.parse( args ).get( "from" ) ); <END> Path folder = arguments.getMandatoryPath( ARG_NAME_BACKUP_DIRECTORY ); String name = arguments.get( ARG_NAME_BACKUP_NAME ); boolean fallbackToFull = arguments.getBoolean( ARG_NAME_FALLBACK_FULL ); boolean doConsistencyCheck = arguments.getBoolean( ARG_NAME_CHECK_CONSISTENCY ); long timeout = arguments.get( ARG_NAME_TIMEOUT, TimeUtil.parseTimeMillis ); Optional<Path> additionalConfig = arguments.getOptionalPath( ARG_NAME_ADDITIONAL_CONFIG_DIRECTORY ); Path reportDir = arguments.getOptionalPath( ARG_NAME_REPORT_DIRECTORY ) .orElseThrow( () -> new IllegalArgumentException( "cc-report-dir must be a path" ) ); return new OnlineBackupRequiredArguments( address , folder, name, fallbackToFull, doConsistencyCheck, timeout, additionalConfig, reportDir ); } catch ( IllegalArgumentException e ) { throw new IncorrectUsage( e.getMessage() ); } }</code><technical_language>constant for</technical_language>

Target:
OnlineBackupRequiredArguments establishRequiredArguments( String... args ) throws IncorrectUsage { try { arguments.parse( args ); OptionalHostnamePort address = toOptionalHostnamePortFromRawAddress( arguments.get( ARG_NAME_BACKUP_SOURCE) ); Path folder = arguments.getMandatoryPath( ARG_NAME_BACKUP_DIRECTORY ); String name = arguments.get( ARG_NAME_BACKUP_NAME ); boolean fallbackToFull = arguments.getBoolean( ARG_NAME_FALLBACK_FULL ); boolean doConsistencyCheck = arguments.getBoolean( ARG_NAME_CHECK_CONSISTENCY ); long timeout = arguments.get( ARG_NAME_TIMEOUT, TimeUtil.parseTimeMillis ); Optional<Path> additionalConfig = arguments.getOptionalPath( ARG_NAME_ADDITIONAL_CONFIG_DIRECTORY ); Path reportDir = arguments.getOptionalPath( ARG_NAME_REPORT_DIRECTORY ) .orElseThrow( () -> new IllegalArgumentException( format("%s must be a path", ARG_NAME_REPORT_DIRECTORY ) ) ); return new OnlineBackupRequiredArguments( address , folder, name, fallbackToFull, doConsistencyCheck, timeout, additionalConfig, reportDir ); } catch ( IllegalArgumentException e ) { throw new IncorrectUsage( e.getMessage() ); } }
Source:
<code>public static boolean canMergeSegments(Layout layout) { if (layout.getSegments().size() == 1) { return false; } else { <START> int firstSegmentIndex = 0; int secondSegmentIndex = 1; <END> return Sets.difference( layout.getSegments().get(secondSegmentIndex).getAllLogServers(), layout.getSegments().get(firstSegmentIndex).getAllLogServers()).isEmpty(); } }</code><technical_language>final int</technical_language>

Target:
public static boolean canMergeSegments(Layout layout) { if (layout.getSegments().size() == 1) { return false; } else { final int firstSegmentIndex = 0; final int secondSegmentIndex = 1; return Sets.difference( layout.getSegments().get(secondSegmentIndex).getAllLogServers(), layout.getSegments().get(firstSegmentIndex).getAllLogServers()).isEmpty(); } }
Source:
<code>public Object getAdapter(Object adaptableObject, Class adapterType) { if (adapterType.isAssignableFrom(IHistoryPageSource.class)) { return historyPageSource; } if (IWorkbenchAdapter.class == adapterType) { if (gitModelWorkbenchAdapter == null) gitModelWorkbenchAdapter = new GitModelWorkbenchAdapter(); return gitModelWorkbenchAdapter; } if (adaptableObject instanceof GitModelObject && adapterType == ResourceMapping.class) return GitObjectMapping.create((GitModelObject) adaptableObject); if (adaptableObject instanceof GitModelObject && adapterType == IResource.class) { GitModelObject obj = (GitModelObject) adaptableObject; if (obj instanceof GitModelBlob) <START> return root.getFileForLocation(obj.getLocation()); <END> if (obj instanceof GitModelTree) { IResource res = root.getContainerForLocation(obj.getLocation()); if (res == null) res = root.getFolder(obj.getLocation()); return res; } } return null; }</code><technical_language>If replace this line those: IFile res = root.getFileForLocation(obj.getLocation()); if (res == null) res = root.getFile(obj.getLocation()); return res; get default icon for non-workspace files ;)</technical_language>

Target:
public Object getAdapter(Object adaptableObject, Class adapterType) { if (adapterType.isAssignableFrom(IHistoryPageSource.class)) { return historyPageSource; } if (IWorkbenchAdapter.class == adapterType) { if (gitModelWorkbenchAdapter == null) gitModelWorkbenchAdapter = new GitModelWorkbenchAdapter(); return gitModelWorkbenchAdapter; } if (adaptableObject instanceof GitModelObject && adapterType == ResourceMapping.class) return GitObjectMapping.create((GitModelObject) adaptableObject); if (adaptableObject instanceof GitModelObject && adapterType == IResource.class) { GitModelObject obj = (GitModelObject) adaptableObject; if (obj instanceof GitModelBlob) { IResource res = root.getFileForLocation(obj.getLocation()); if (res == null) res = root.getFile(obj.getLocation()); return res; } if (obj instanceof GitModelTree) { IResource res = root.getContainerForLocation(obj.getLocation()); if (res == null) res = root.getFolder(obj.getLocation()); return res; } } return null; }
Source:
<code>private AllocateResponse sendContainerAskToRM(List<ContainerRequest> containerRequests, List<ContainerRequest> removedContainerRequests, List<ContainerId> releasedContainers) throws YarnException, IOException { if (removedContainerRequests.size() > 0) { <START> LOG.info(" Removing container request: (size={}) {}", removedContainerRequests.size(), removedContainerRequests); <END> for (ContainerRequest cr : removedContainerRequests) { LOG.info("Removed container: {}", cr.toString()); amRmClient.removeContainerRequest(cr); } } if (containerRequests.size() > 0) { LOG.info("Asking RM for containers: (size={}) {}", containerRequests.size(), containerRequests); for (ContainerRequest cr : containerRequests) { LOG.info("Requested container: {}", cr.toString()); amRmClient.addContainerRequest(cr); } } for (ContainerId containerId : releasedContainers) { LOG.info("Released container, id={}", containerId.getId()); amRmClient.releaseAssignedContainer(containerId); } for (String containerIdStr : dnmgr.containerStopRequests.values()) { AllocatedContainer allocatedContainer = this.allocatedContainers.get(containerIdStr); if (allocatedContainer != null && !allocatedContainer.stopRequested) { nmClient.stopContainerAsync(allocatedContainer.container.getId(), allocatedContainer.container.getNodeId()); LOG.info("Requested stop container {}", containerIdStr); allocatedContainer.stopRequested = true; } dnmgr.containerStopRequests.remove(containerIdStr); } return amRmClient.allocate(0); }</code><technical_language>is size necessary? INFO level entry for element in removedContainerRequests? remove this logging completely</technical_language>

Target:
private AllocateResponse sendContainerAskToRM(List<ContainerRequest> containerRequests, List<ContainerRequest> removedContainerRequests, List<ContainerId> releasedContainers) throws YarnException, IOException { if (removedContainerRequests.size() > 0) { LOG.debug("Removing container request: {}", removedContainerRequests); for (ContainerRequest cr : removedContainerRequests) { amRmClient.removeContainerRequest(cr); } } if (containerRequests.size() > 0) { LOG.debug("Asking RM for containers: {}", containerRequests); for (ContainerRequest cr : containerRequests) { amRmClient.addContainerRequest(cr); } } for (ContainerId containerId : releasedContainers) { LOG.info("Released container, id={}", containerId.getId()); amRmClient.releaseAssignedContainer(containerId); } for (String containerIdStr : dnmgr.containerStopRequests.values()) { AllocatedContainer allocatedContainer = this.allocatedContainers.get(containerIdStr); if (allocatedContainer != null && !allocatedContainer.stopRequested) { nmClient.stopContainerAsync(allocatedContainer.container.getId(), allocatedContainer.container.getNodeId()); LOG.info("Requested stop container {}", containerIdStr); allocatedContainer.stopRequested = true; } dnmgr.containerStopRequests.remove(containerIdStr); } return amRmClient.allocate(0); }
Source:
<code>public ArgumentListBuilder toWindowsCommand(boolean escapeVars) { ArgumentListBuilder windowsCommand = new ArgumentListBuilder().add("cmd.exe", "/C"); boolean quoted, percent; for (int i = 0; i < args.size(); i++) { StringBuilder quotedArgs = new StringBuilder(); String arg = args.get(i); quoted = percent = false; for (int j = 0; j < arg.length(); j++) { char c = arg.charAt(j); if (!quoted && (c == ' ' || c == '*' || c == '?' || c == ',' || c == ';')) { quoted = startQuoting(quotedArgs, arg, j); } else if (c == '^' || c == '&' || c == '<' || c == '>' || c == '|') { if (!quoted) quoted = startQuoting(quotedArgs, arg, j); } else if (c == '"') { if (!quoted) quoted = startQuoting(quotedArgs, arg, j); quotedArgs.append('"'); } else if (percent && escapeVars && ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))) { if (!quoted) quoted = startQuoting(quotedArgs, arg, j); quotedArgs.append('"').append(c); c = '"'; } percent = (c == '%'); if (quoted) quotedArgs.append(c); } <START> if(i == 0 && quoted) quotedArgs.insert(0, '"'); else if (i == 0) quotedArgs.append('"'); <END> if (quoted) quotedArgs.append('"'); else quotedArgs.append(arg); windowsCommand.add(quotedArgs, mask.get(i)); } windowsCommand.add("&&").add("exit").add("%%ERRORLEVEL%%\""); return windowsCommand; }</code><technical_language>for readability: suggestion if (i == 0) { if (quoted) { quotedArgs.insert(0, '"'); } else { quotedArgs.append('"'); } }</technical_language>

Target:
public ArgumentListBuilder toWindowsCommand(boolean escapeVars) { ArgumentListBuilder windowsCommand = new ArgumentListBuilder().add("cmd.exe", "/C"); boolean quoted, percent; for (int i = 0; i < args.size(); i++) { StringBuilder quotedArgs = new StringBuilder(); String arg = args.get(i); quoted = percent = false; for (int j = 0; j < arg.length(); j++) { char c = arg.charAt(j); if (!quoted && (c == ' ' || c == '*' || c == '?' || c == ',' || c == ';')) { quoted = startQuoting(quotedArgs, arg, j); } else if (c == '^' || c == '&' || c == '<' || c == '>' || c == '|') { if (!quoted) quoted = startQuoting(quotedArgs, arg, j); } else if (c == '"') { if (!quoted) quoted = startQuoting(quotedArgs, arg, j); quotedArgs.append('"'); } else if (percent && escapeVars && ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))) { if (!quoted) quoted = startQuoting(quotedArgs, arg, j); quotedArgs.append('"').append(c); c = '"'; } percent = (c == '%'); if (quoted) quotedArgs.append(c); } if (i == 0) { if (quoted) { quotedArgs.insert(0, '"'); } else { quotedArgs.append('"'); } } if (quoted) quotedArgs.append('"'); else quotedArgs.append(arg); windowsCommand.add(quotedArgs, mask.get(i)); } windowsCommand.add("&&").add("exit").add("%%ERRORLEVEL%%\""); return windowsCommand; }
Source:
<code>public RabbitQueueingConsumer(Channel channel) { super(channel); <START> _queue = new LinkedBlockingQueue<Delivery>(); <END> }</code><technical_language>diamond <></technical_language>

Target:
public RabbitQueueingConsumer(Channel channel) { super(channel); queue = new LinkedBlockingQueue<>(); }
Source:
<code>public TimeLockAgent(TimeLockInstallConfiguration install, Observable<TimeLockRuntimeConfiguration> runtime, TimeLockDeprecatedConfiguration deprecated, Consumer<Object> registrar) { this.install = install; this.runtime = runtime; this.registrar = registrar; this.paxosResource = PaxosResource.create(install.paxos().dataDirectory().toString()); this.leadershipCreator = new PaxosLeadershipCreator(install, runtime, registrar); this.lockCreator = new LockCreator(runtime, deprecated); this.timestampCreator = new PaxosTimestampCreator(paxosResource, PaxosRemotingUtils.getRemoteServerPaths(install), PaxosRemotingUtils.getSslConfigurationOptional(install).map(SslSocketFactories::createSslSocketFactory), <START> runtime.map(TimeLockAgent::getAlgorithmConfigOrDefault)); <END> this.timelockCreator = install.asyncLock().useAsyncLockService() ? new AsyncTimeLockServicesCreator(leadershipCreator, install.asyncLock()) : new LegacyTimeLockServicesCreator(leadershipCreator); }</code><technical_language>this method get renamed / removed</technical_language>

Target:
public TimeLockAgent(TimeLockInstallConfiguration install, Observable<TimeLockRuntimeConfiguration> runtime, TimeLockDeprecatedConfiguration deprecated, Consumer<Object> registrar) { this.install = install; this.runtime = runtime; this.registrar = registrar; this.paxosResource = PaxosResource.create(install.paxos().dataDirectory().toString()); this.leadershipCreator = new PaxosLeadershipCreator(install, runtime, registrar); this.lockCreator = new LockCreator(runtime, deprecated); this.timestampCreator = new PaxosTimestampCreator(paxosResource, PaxosRemotingUtils.getRemoteServerPaths(install), PaxosRemotingUtils.getSslConfigurationOptional(install).map(SslSocketFactories::createSslSocketFactory), runtime.map(TimeLockRuntimeConfiguration::paxos)); this.timelockCreator = install.asyncLock().useAsyncLockService() ? new AsyncTimeLockServicesCreator(leadershipCreator, install.asyncLock()) : new LegacyTimeLockServicesCreator(leadershipCreator); }
Source:
<code>public StringType() { <START> this.value = ""; <END> }</code><technical_language>For HSB Percent type call other constructor. this("");</technical_language>

Target:
public StringType() { this(""); }
Source:
<code>public RecentWikiActivityPage open(){ <START> editArticle("RWA" + DateTime.now().getMillis()); <END> getUrl(String.format("%s%s", urlBuilder.getUrlForWiki(), URLsContent.RECENT_WIKI_ACTIVITY)); return this; }</code><technical_language>push content opening wiki activity</technical_language>

Target:
public RecentWikiActivityPage open() { getUrl(String.format("%s%s", urlBuilder.getUrlForWiki(), URLsContent.RECENT_WIKI_ACTIVITY)); return this; }
Source:
<code>private ImmutableDruidDataSource getDataSource(final String dataSourceName) { List<ImmutableDruidDataSource> dataSources = serverInventoryView .getInventory() .stream() .map(server -> server.getDataSource(dataSourceName)) .filter(Objects::nonNull) .map(DruidDataSource::toImmutableDruidDataSource) .collect(Collectors.toList()); if (dataSources.isEmpty()) { return null; } SortedMap<String, DataSegment> segmentMap = new TreeMap<>(); for (ImmutableDruidDataSource dataSource : dataSources) { Iterable<DataSegment> segments = dataSource.getSegments(); for (DataSegment segment : segments) { segmentMap.put(segment.getIdentifier(), segment); } } <START> return new ImmutableDruidDataSource(dataSourceName, Collections.emptyMap(), segmentMap); <END> }</code><technical_language>Minor, I think: if building segmentMap scratch anyway, start ImmutableSortedMap. ImmutableSortedMap.copyOfSorted is a no-op avoid extra copy</technical_language>

Target:
private ImmutableDruidDataSource getDataSource(final String dataSourceName) { List<ImmutableDruidDataSource> dataSources = serverInventoryView .getInventory() .stream() .map(server -> server.getDataSource(dataSourceName)) .filter(Objects::nonNull) .map(DruidDataSource::toImmutableDruidDataSource) .collect(Collectors.toList()); if (dataSources.isEmpty()) { return null; } final SortedMap<String, DataSegment> segmentMap = new TreeMap<>(); for (ImmutableDruidDataSource dataSource : dataSources) { Iterable<DataSegment> segments = dataSource.getSegments(); for (DataSegment segment : segments) { segmentMap.put(segment.getIdentifier(), segment); } } return new ImmutableDruidDataSource(dataSourceName, Collections.emptyMap(), segmentMap); }