auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void thePlatformShouldBufferAnUpdateDeviceCdmaSettingsResponseMessage( final Map<String, String> responseParameters) { final String deviceIdentification = (String) ScenarioContext.current() .get(PlatformKeys.KEY_DEVICE_IDENTIFICATION); final String correlationUid = (String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID); final OsgpResultType expectedResult = Enum.valueOf(OsgpResultType.class, responseParameters.get(PlatformKeys.KEY_RESULT)); LOGGER.info("THEN: Buffer UpdateCdmaSettingsResponse [correlationUid={}, deviceIdentification={}, result={}]", correlationUid, deviceIdentification, expectedResult); final UpdateDeviceCdmaSettingsAsyncRequest request = new UpdateDeviceCdmaSettingsAsyncRequest(); request.setDeviceId(deviceIdentification); request.setCorrelationUid(correlationUid); Wait.until(() -> { UpdateDeviceCdmaSettingsResponse response = null; try { response = this.client.getUpdateDeviceCdmaSettingsResponse(request); } catch (final Exception e) { } assertNotNull(response); assertEquals(expectedResult, response.getResult()); }); }

Target:
public void thePlatformShouldBufferAnUpdateDeviceCdmaSettingsResponseMessage( final Map<String, String> responseParameters) { final String deviceIdentification = (String) ScenarioContext.current() .get(PlatformKeys.KEY_DEVICE_IDENTIFICATION); final String correlationUid = (String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID); final OsgpResultType expectedResult = Enum.valueOf(OsgpResultType.class, responseParameters.get(PlatformKeys.KEY_RESULT)); LOGGER.info("THEN: Buffer UpdateCdmaSettingsResponse [correlationUid={}, deviceIdentification={}, result={}]", correlationUid, deviceIdentification, expectedResult); final UpdateDeviceCdmaSettingsAsyncRequest request = new UpdateDeviceCdmaSettingsAsyncRequest(); request.setDeviceId(deviceIdentification); request.setCorrelationUid(correlationUid); Wait.until(() -> { UpdateDeviceCdmaSettingsResponse response = null; try { response = this.client.getUpdateDeviceCdmaSettingsResponse(request); } catch (WebServiceSecurityException | InterruptedException e) { } assertNotNull(response); assertEquals(expectedResult, response.getResult()); }); }
Source:
public H getSectionHeader() { if (isSectionHeader) return sectionHeader; return null; }

Target:
public final H getSectionHeader() { return headerData; }
Source:
private void cancelUpload(MediaModel oneUpload) { if (oneUpload != null) { SiteModel site = mSiteStore.getSiteByLocalId(oneUpload.getLocalSiteId()); if (site != null) { dispatchCancelAction(oneUpload, mSiteStore.getSiteByLocalId(oneUpload.getLocalSiteId())); } else { AppLog.i(AppLog.T.MEDIA, "Unexpected state, site is null. Skipping cancellation of " + "this request - MediaUploadService."); } } }

Target:
private void cancelUpload(MediaModel oneUpload) { if (oneUpload != null) { SiteModel site = mSiteStore.getSiteByLocalId(oneUpload.getLocalSiteId()); if (site != null) { dispatchCancelAction(oneUpload, site); } else { AppLog.i(AppLog.T.MEDIA, "Unexpected state, site is null. Skipping cancellation of " + "this request - MediaUploadService."); } } }
Source:
public TaskReviewsMappingsStore(TaskDataManager taskDataManager, TaskRepositoryManager repositoryManager) { this.repositoryManager = repositoryManager; this.taskDataManager = taskDataManager; taskReviewsMap = Multimaps.synchronizedListMultimap(ArrayListMultimap.<String, String> create()); }

Target:
public TaskReviewsMappingsStore(TaskDataManager taskDataManager, TaskRepositoryManager repositoryManager) { this.repositoryManager = repositoryManager; this.taskDataManager = taskDataManager; taskReviewsMap = Multimaps.synchronizedSetMultimap(LinkedHashMultimap.<String, String> create()); }
Source:
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")); 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")); }

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:
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()) { for (DownloadBatch downloadBatch : downloadBatchMap.values()) { downloadBatch.waitForNetwork(); } } else { submitAllStoredDownloads(() -> Log.v("Allowed connectionType updated to " + allowedConnectionType + ". All jobs submitted")); } }

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:
public Method getOnStringMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); if (methods == null) { return 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)) { return method; } } } return null; }

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:
public SELF isNotEqualTo(Object other) { if (actual == null && other == null) { throw objects.getFailures().failure(info, shouldNotBeEqual(actual, other)); } else if (other != null && actual != null) { List<ComparisonDifference> differences = determineDifferencesWith(other); if (differences.isEmpty()) throw objects.getFailures().failure(info, shouldNotBeEqual(actual, other)); } return myself; }

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:
private boolean isDiskValidForStorage(Disk disk, StorageDomain storage) { if (disk.isShareable() && storage.getStorageType().equals(StorageType.GLUSTERFS)) { return false; } return true; }

Target:
private boolean isDiskValidForStorage(Disk disk, StorageDomain storage) { if (disk.isShareable() && storage.getStorageType() == StorageType.GLUSTERFS) { return false; } return true; }
Source:
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); possibleNodes = (possibleNodes == null ? new ArrayList() : possibleNodes); 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); } } }

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:
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] )) {" + " body( succ = [innerCond] );" + " continue 2;" + " }" + " }" + "} while (outerCond( succ = [innerCond, END] ));"); }

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:
protected String getBarcodeLabel(final Map<Integer, String> labels, final List<Integer> barcodeFields, final Map<Integer, Field> keyFieldMap, final boolean includeLabel) { final StringBuffer barcode = new StringBuffer(); 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(); }

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:
public void startupShouldNotFailOnIOExceptionOnlineListener() { Assert.assertEquals(1, IOExceptionOnOnlineListener.onOnlineCount); }

Target:
public void startupShouldNotFailOnIOExceptionOnlineListener() { assertEquals(1, IOExceptionOnOnlineListener.onOnlineCount); }
Source:
public boolean isEnabled(Geopoint geopoint) { if (geopoint == null) { return true; } return false; }

Target:
public boolean isEnabled(Geopoint geopoint) { return geopoint == null; }
Source:
protected RemoteOperationResult run(OwnCloudClient client) { GetRemoteCapabilitiesOperation getCapabilities = new GetRemoteCapabilitiesOperation(); RemoteOperationResult result = getCapabilities.execute(client); if (result.isSuccess()){ OCCapability capability = (OCCapability) result.getData().get(0); getStorageManager().saveCapabilities(capability); } return result; }

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:
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 { parcelResourceApi.deactivateCommand(stackName, installedComp.getKey(), installedComp.getValue()); } 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)); } }

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:
public Optional<CommandMapping> resolveMapping(String alias, CommandSource source) { return Optional.fromNullable(commands.get(alias.toLowerCase())); }

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

Target:
public B setZkClientType(ZkBaseDataAccessor.ZkClientType zkClientType) { return setZkClientType(Enum.valueOf(ZkClientType.class, zkClientType.name())); }
Source:
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) { getSupportActionBar().setDisplayShowTitleEnabled(true); 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); } } }

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:
public void setup() { new AudioDetector(); if (!AudioDetector.isNoAudio()) { new MusicPlayer(); } }

Target:
public void setup() { assumeFalse("No audio devices are available. Skipping...", AudioDetector.getInstance().isNoAudio()); MusicPlayer.init(); }
Source:
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 ); try ( MandatoryProperties.Check<RECORD,REPORT> mandatory = mandatoryProperties.apply( record ) ) { checkChainItem( firstProp, engine, keys, mandatory ); while ( props.hasNext() ) { checkChainItem( props.next(), engine, keys, mandatory ); } } } }

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:
private void setEndpoint(String url, String baseUrl) { endpoint = url.substring((baseUrl + "api").length(), url.length()); int questionMarkPosition = url.indexOf("?"); if (questionMarkPosition != -1) { endpoint = endpoint.substring(0, questionMarkPosition); } }

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:
public static void delayUntilTraceOpened(final ITmfProjectModelElement projectElement) { if (projectElement instanceof TmfTraceElement) { TmfTraceElement traceElement = (TmfTraceElement) projectElement; ITmfTrace trace = traceElement.getTrace(); int cnt = 0; while ((trace == null) && (cnt++ < DELAY_COUNTER)) { delayThread(DEFAULT_DELAY); trace = traceElement.getTrace(); } } else { delayThread(DEFAULT_DELAY); } }

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:
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_PERIOS_S, -1, TimeUnit.SECONDS); if (hashinatorConfig != null) { send(StreamSnapshotMessageType.HASHINATOR, -1, hashinatorConfig, false); } }

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:
private String concatenatedValue(String valueToAppend, String currentValue, String delimiter) { String retValue = currentValue; if (!Arrays.asList(retValue.split(delimiter)).contains(valueToAppend)) { if (!retValue.endsWith(delimiter)) { retValue += delimiter; } retValue += valueToAppend; } return retValue; }

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

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:
private AppUpdateState getAppUpdateState() { if (mAppUpdateInfo != null && mAppUpdateInfo.availableVersionCode() == HiddenPreferences.getSkippedCommCareUpdateVersion()) { return AppUpdateState.UNAVAILABLE; } 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; } if (mInstallErrorCode != InstallErrorCode.NO_ERROR) { state = AppUpdateState.FAILED; } return state; }

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:
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.deleteDirectory(execDir); throw ex; } }

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:
public PduResponse firePduRequestReceived(PduRequest request) { PduResponse response = null; try { if (request instanceof DeliverSm) { 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; }

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:
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) { logger.error("", e); } try { digests.add(new String(modifiedScript.digest())); } catch (Exception e) { logger.error("", e); } } } this.job = job; }

Target:
public SchedulingTaskComparator(InternalTask task, InternalJob job) { this.task = task; if (task.getSelectionScripts() != null) { computeHashForSelectionScripts(task, job); } this.job = job; }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("["); sb.append(fStart); sb.append(", "); sb.append(fStart + fDuration); sb.append("]"); return sb.toString(); }

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:
public String loadResource(String path) throws IOException { Reader reader = this.resourceReader(path); 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(); }

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:
OnlineBackupRequiredArguments establishRequiredArguments( String... args ) throws IncorrectUsage { try { OptionalHostnamePort address = toOptionalHostnamePortFromRawAddress( arguments.parse( args ).get( "from" ) ); 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() ); } }

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:
public static boolean canMergeSegments(Layout layout) { if (layout.getSegments().size() == 1) { return false; } else { int firstSegmentIndex = 0; int secondSegmentIndex = 1; return Sets.difference( layout.getSegments().get(secondSegmentIndex).getAllLogServers(), layout.getSegments().get(firstSegmentIndex).getAllLogServers()).isEmpty(); } }

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:
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) return root.getFileForLocation(obj.getLocation()); if (obj instanceof GitModelTree) { IResource res = root.getContainerForLocation(obj.getLocation()); if (res == null) res = root.getFolder(obj.getLocation()); return res; } } return null; }

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:
private AllocateResponse sendContainerAskToRM(List<ContainerRequest> containerRequests, List<ContainerRequest> removedContainerRequests, List<ContainerId> releasedContainers) throws YarnException, IOException { if (removedContainerRequests.size() > 0) { LOG.info(" Removing container request: (size={}) {}", removedContainerRequests.size(), removedContainerRequests); 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); }

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:
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 && quoted) quotedArgs.insert(0, '"'); else if (i == 0) quotedArgs.append('"'); if (quoted) quotedArgs.append('"'); else quotedArgs.append(arg); windowsCommand.add(quotedArgs, mask.get(i)); } windowsCommand.add("&&").add("exit").add("%%ERRORLEVEL%%\""); return windowsCommand; }

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:
public RabbitQueueingConsumer(Channel channel) { super(channel); _queue = new LinkedBlockingQueue<Delivery>(); }

Target:
public RabbitQueueingConsumer(Channel channel) { super(channel); queue = new LinkedBlockingQueue<>(); }
Source:
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(TimeLockAgent::getAlgorithmConfigOrDefault)); this.timelockCreator = install.asyncLock().useAsyncLockService() ? new AsyncTimeLockServicesCreator(leadershipCreator, install.asyncLock()) : new LegacyTimeLockServicesCreator(leadershipCreator); }

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:
public StringType() { this.value = ""; }

Target:
public StringType() { this(""); }
Source:
public RecentWikiActivityPage open(){ editArticle("RWA" + DateTime.now().getMillis()); getUrl(String.format("%s%s", urlBuilder.getUrlForWiki(), URLsContent.RECENT_WIKI_ACTIVITY)); return this; }

Target:
public RecentWikiActivityPage open() { getUrl(String.format("%s%s", urlBuilder.getUrlForWiki(), URLsContent.RECENT_WIKI_ACTIVITY)); return this; }
Source:
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); } } return new ImmutableDruidDataSource(dataSourceName, Collections.emptyMap(), segmentMap); }

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); }
Source:
public void shouldTryToLockValidTaskDirsAtRebalanceStart() throws IOException { expectLockObtainedFor(taskId01); expectLockFailedFor(taskId10); makeTaskFolders( "0_1", "1_0", "dummy" ); replay(stateDirectory); taskManager.handleRebalanceStart(singleton("topic")); verify(stateDirectory); assertThat(taskManager.lockedTaskDirectories(), is(singleton(taskId01))); }

Target:
public void shouldTryToLockValidTaskDirsAtRebalanceStart() throws IOException { expectLockObtainedFor(taskId01); expectLockFailedFor(taskId10); makeTaskFolders( taskId01.toString(), taskId10.toString(), "dummy" ); replay(stateDirectory); taskManager.handleRebalanceStart(singleton("topic")); verify(stateDirectory); assertThat(taskManager.lockedTaskDirectories(), is(singleton(taskId01))); }
Source:
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Bundle b = getArguments(); if (b != null) { Product product = (Product) b.getSerializable("product"); if (product != null) { code = product.getCode(); } } else { Toast.makeText(activity, "Something went wrong", Toast.LENGTH_SHORT).show(); activity.finish(); } }

Target:
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Bundle b = getArguments(); if (b != null) { Product product = (Product) b.getSerializable("product"); mOfflineSavedProduct = (OfflineSavedProduct) b.getSerializable("edit_offline_product"); if (product != null) { code = product.getCode(); } if (mOfflineSavedProduct != null) { code = mOfflineSavedProduct.getBarcode(); preFillValues(); } } else { Toast.makeText(activity, R.string.error_adding_ingredients, Toast.LENGTH_SHORT).show(); activity.finish(); } if (ingredients.getText().toString().isEmpty() && productDetails.get("image_ingredients") != null && !productDetails.get("image_ingredients").isEmpty()) { extractIngredients.setVisibility(View.VISIBLE); imagePath = productDetails.get("image_ingredients"); } loadAutoSuggestions(); }