auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void update() { openPageFromFloatingQueue = false; List<Tab> tabList = Prefs.getTabs(); boolean shouldShowFloatingQueue = tabList.size() > 0; if (tabList.size() > 0) { List<PageBackStackItem> backStackItems = tabList.get(tabList.size() - 1).getBackStack(); if (backStackItems.size() > 0) { PageTitle title = backStackItems.get(backStackItems.size() - 1).getTitle(); floatingQueueArticle.setText(title.getDisplayText()); boolean shouldShowImage = shouldShowImage(title); floatingQueueThumbnail.getImage().setLegacyVisibilityHandlingEnabled(true); String imageUrl = Prefs.getFloatingQueueImage() == null ? title.getThumbUrl() : Prefs.getFloatingQueueImage(); if ((floatingQueueThumbnail.getTag() == null || !floatingQueueThumbnail.getTag().equals(imageUrl))) { floatingQueueThumbnail.load(shouldShowImage ? imageUrl : null); floatingQueueThumbnail.setTag(imageUrl); } floatingQueueCounts.setText(String.valueOf(tabList.size())); floatingQueueCounts.setTextSize(TypedValue.COMPLEX_UNIT_SP, tabList.size() > 99 ? TAB_COUNT_TEXT_SIZE_SMALL : TAB_COUNT_TEXT_SIZE_DEFAULT); setOnClickListener((v) -> { openPageFromFloatingQueue = true; callback.onFloatingQueueClicked(title); }); animation(false); } else { shouldShowFloatingQueue = false; } } setVisibility(shouldShowFloatingQueue ? VISIBLE : INVISIBLE); }

Target:
public void update() { openPageFromFloatingQueue = false; List<Tab> tabList = WikipediaApp.getInstance().getTabList(); boolean shouldShowFloatingQueue = tabList.size() > 0; if (shouldShowFloatingQueue) { List<PageBackStackItem> backStackItems = tabList.get(tabList.size() - 1).getBackStack(); if (backStackItems.size() > 0) { PageTitle title = backStackItems.get(backStackItems.size() - 1).getTitle(); floatingQueueArticle.setText(title.getDisplayText()); boolean shouldShowImage = shouldShowImage(title); floatingQueueThumbnail.getImage().setLegacyVisibilityHandlingEnabled(true); String imageUrl = Prefs.getFloatingQueueImage() == null ? title.getThumbUrl() : Prefs.getFloatingQueueImage(); if ((floatingQueueThumbnail.getTag() == null || !floatingQueueThumbnail.getTag().equals(imageUrl))) { floatingQueueThumbnail.load(shouldShowImage ? imageUrl : null); floatingQueueThumbnail.setTag(imageUrl); } floatingQueueCounts.setText(String.valueOf(tabList.size())); floatingQueueCounts.setTextSize(TypedValue.COMPLEX_UNIT_SP, tabList.size() > 99 ? TAB_COUNT_TEXT_SIZE_SMALL : TAB_COUNT_TEXT_SIZE_DEFAULT); setOnClickListener((v) -> { openPageFromFloatingQueue = true; callback.onFloatingQueueClicked(title); }); animation(false); } else { shouldShowFloatingQueue = false; } } setVisibility(shouldShowFloatingQueue ? VISIBLE : INVISIBLE); }
Source:
public static void setUp() throws IOException { emulatorProcess = (new ProcessBuilder()).command("mvn", "function:run").start(); }

Target:
public static void setUp() throws IOException { String baseDir = System.getProperty("basedir"); emulatorProcess = new ProcessBuilder() .command("mvn", "function:run") .directory(new File(baseDir)) .start(); }
Source:
private void search() { if (disposable != null) { disposable.dispose(); } progressBar.setVisibility(View.VISIBLE); emptyViewHandler.hide(); disposable = Observable.fromCallable(this::performSearch) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(results -> { progressBar.setVisibility(View.GONE); this.results = results.first; adapter.updateItems(results.first); if(getArguments().getLong(ARG_FEED,0)==0) { adapterFeeds.updateData(results.second); } else { adapterFeeds.updateData(null); } String query = getArguments().getString(ARG_QUERY); emptyViewHandler.setMessage(getString(R.string.no_results_for_query, query)); }, error -> Log.e(TAG, Log.getStackTraceString(error))); }

Target:
private void search() { if (disposable != null) { disposable.dispose(); } progressBar.setVisibility(View.VISIBLE); emptyViewHandler.hide(); disposable = Observable.fromCallable(this::performSearch) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(results -> { progressBar.setVisibility(View.GONE); this.results = results.first; adapter.updateItems(results.first); if (getArguments().getLong(ARG_FEED, 0) == 0) { adapterFeeds.updateData(results.second); } else { adapterFeeds.updateData(Collections.emptyList()); } String query = getArguments().getString(ARG_QUERY); emptyViewHandler.setMessage(getString(R.string.no_results_for_query, query)); }, error -> Log.e(TAG, Log.getStackTraceString(error))); }
Source:
public void addListenerOnMainMenuButton(){ mainMenu = (Button) findViewById(R.id.main_menu_button_gps); mainMenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(v.getContext(), MainMenuActivity.class); startActivity(i); } }); }

Target:
private void addListenerOnMainMenuButton() { mainMenu = (Button) findViewById(R.id.main_menu_button_gps); mainMenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(v.getContext(), MainMenuActivity.class); startActivity(i); } }); }
Source:
public static Collection<ITmfTrace> getTraceSetWithExperiment(@Nullable ITmfTrace trace) { if (trace == null) { return ImmutableSet.of(); } List<@NonNull ITmfTrace> traces = trace.getChildren(ITmfTrace.class); if (traces.size() > 0) { Iterable<ITmfTrace> iterable = checkNotNull(Iterables.concat(Iterables.transform(traces, t -> getTraceSetWithExperiment(t)))); return ImmutableSet.<ITmfTrace>builder().add(trace).addAll(iterable).build(); } return Collections.singleton(trace); }

Target:
public static Collection<ITmfTrace> getTraceSetWithExperiment(@Nullable ITmfTrace trace) { if (trace == null) { return ImmutableSet.of(); } List<@NonNull ITmfTrace> traces = trace.getChildren(ITmfTrace.class); if (!traces.isEmpty()) { Iterable<ITmfTrace> iterable = checkNotNull(Iterables.concat(Iterables.transform(traces, t -> getTraceSetWithExperiment(t)))); return ImmutableSet.<ITmfTrace>builder().add(trace).addAll(iterable).build(); } return Collections.singleton(trace); }
Source:
protected DataSetReadyCallback createDataSetDomainSpecificCallback(final int startRange, final FilterSettings tableSettings, boolean lastPage) { return new AbstractDataSetReadyCallback(errorPopup, view, tableSettings.getUUID()) { @Override public void callback(DataSet dataSet) { Set<String> columns = new HashSet<String>(); for (int i = 0; i < dataSet.getRowCount(); i++) { Long processInstanceId = getColumnLongValue(dataSet, PROCESS_INSTANCE_ID, i); String variableName = getColumnStringValue(dataSet, VARIABLE_NAME, i); String variableValue = getColumnStringValue(dataSet, VARIABLE_VALUE, i); for (ProcessInstanceSummary pis : myProcessInstancesFromDataSet) { String initiator = pis.getInitiator(); if (pis.getProcessInstanceId().equals(processInstanceId) && !filterInitiator(variableName, variableValue, initiator)) { pis.addDomainData(variableName, variableValue); columns.add(variableName); } } } final String filterValue = isFilteredByProcessId(tableSettings.getDataSetLookup().getOperationList()); view.addDomainSpecifColumns(view.getListGrid(), columns, filterValue); updateDataOnCallback(myProcessInstancesFromDataSet, startRange, startRange + myProcessInstancesFromDataSet.size(), lastPage); } }; }

Target:
protected DataSetReadyCallback createDataSetDomainSpecificCallback(final int startRange, final FilterSettings tableSettings, boolean lastPage) { return errorHandlerBuilder.get().withUUID(tableSettings.getUUID()).withDataSetCallback( dataSet -> { Set<String> columns = new HashSet<String>(); for (int i = 0; i < dataSet.getRowCount(); i++) { Long processInstanceId = getColumnLongValue(dataSet, PROCESS_INSTANCE_ID, i); String variableName = getColumnStringValue(dataSet, VARIABLE_NAME, i); String variableValue = getColumnStringValue(dataSet, VARIABLE_VALUE, i); for (ProcessInstanceSummary pis : myProcessInstancesFromDataSet) { String initiator = pis.getInitiator(); if (pis.getProcessInstanceId().equals(processInstanceId) && !filterInitiator(variableName, variableValue, initiator)) { pis.addDomainData(variableName, variableValue); columns.add(variableName); } } } view.addDomainSpecifColumns(view.getListGrid(), columns); updateDataOnCallback(myProcessInstancesFromDataSet, startRange, startRange + myProcessInstancesFromDataSet.size(), lastPage); }) .withEmptyResultsCallback(() -> setEmptyResults()); }
Source:
public static void main(String[] args) throws IOException { Configuration configuration = getCfg(); ServiceRegistry serviceRegistry = new ServiceRegistryCreator(getCfg()).getInstance(); br.com.caelum.vraptor.hibernate.SessionFactoryCreator sessionFactoryCreator = new br.com.caelum.vraptor.hibernate.SessionFactoryCreator(configuration, serviceRegistry); SchemaUpdate su = new SchemaUpdate(serviceRegistry, configuration); su.execute(true, false); }

Target:
public static void main(String[] args) throws IOException { Configuration configuration = getCfg(); LOG.info("Executing SchemaUpdate. environment=" + environmentType); ServiceRegistry serviceRegistry = new ServiceRegistryCreator(getCfg()).getInstance(); SchemaUpdate su = new SchemaUpdate(serviceRegistry, configuration); su.execute(true, false); LOG.info("SchemaUpdate finished."); }
Source:
public void updateMission(Mission mission) { SQLiteDatabase database = getWritableDatabase(); ContentValues values = getValuesOfMission(Objects.requireNonNull(mission, "mission is null")); String ts = String.valueOf(mission.timestamp); int rowsAffected; if (mission instanceof FinishedMission) { if (mission.storage.isInvalid()) { rowsAffected = database.update(FINISHED_TABLE_NAME, values, KEY_TIMESTAMP + " = ?", new String[]{ts}); } else { rowsAffected = database.update(FINISHED_TABLE_NAME, values, KEY_PATH + " = ?", new String[]{ mission.storage.getUri().toString() }); } } else { throw new UnsupportedOperationException("DownloadMission"); } if (rowsAffected != 1) { Log.e("FinishedMissionStore", "Expected 1 row to be affected by update but got " + rowsAffected); } }

Target:
public void updateMission(Mission mission) { ContentValues values = getValuesOfMission(Objects.requireNonNull(mission)); SQLiteDatabase database = getWritableDatabase(); String ts = String.valueOf(mission.timestamp); int rowsAffected; if (mission instanceof FinishedMission) { if (mission.storage.isInvalid()) { rowsAffected = database.update(FINISHED_TABLE_NAME, values, KEY_TIMESTAMP + " = ?", new String[]{ts}); } else { rowsAffected = database.update(FINISHED_TABLE_NAME, values, KEY_PATH + " = ?", new String[]{ mission.storage.getUri().toString() }); } } else { throw new UnsupportedOperationException("DownloadMission"); } if (rowsAffected != 1) { Log.e("FinishedMissionStore", "Expected 1 row to be affected by update but got " + rowsAffected); } }
Source:
public void run() throws Exception { metrics.timeStart = System.currentTimeMillis(); super.run(); reportMetrics(); addOutliers(); }

Target:
public void run() throws Exception { metrics.setTimeStart(System.currentTimeMillis()); super.run(); reportMetrics(); addOutliers(); }
Source:
public void testTimestampFilter() { SWTBotView viewBot = fBot.viewById(FilterView.ID); viewBot.setFocus(); SWTBot filterBot = viewBot.bot(); SWTBotTree treeBot = filterBot.tree(); viewBot.toolbarButton("Add new filter").click(); treeBot.getTreeItem("FILTER <name>").select(); SWTBotText textBot = filterBot.text(); textBot.setFocus(); String filterName = "timestamp"; textBot.setText(filterName); SWTBotTreeItem filterNodeBot = treeBot.getTreeItem(FILTER_TEST + filterName); filterNodeBot.click(); filterNodeBot.contextMenu("TRACETYPE").click(); filterNodeBot.expand(); SWTBotCombo comboBot = filterBot.comboBox(); comboBot.setSelection(TRACETYPE); filterNodeBot.getNode(WITH_TRACETYPE).expand(); filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(AND).click(); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).contextMenu(CONTAINS).click(); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).expand(); comboBot = selectCombo(filterBot); comboBot.setSelection(comboBot.itemCount() - 3); textBot = filterBot.text(); textBot.setFocus(); textBot.setText("100"); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).getNode("Timestamp CONTAINS \"100\"").select(); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).select(); viewBot.toolbarButton("Save filters").click(); String ret = applyFilter(fBot, filterName); assertEquals("10/100", ret); }

Target:
public void testTimestampFilter() { SWTBotView viewBot = fBot.viewById(FilterView.ID); viewBot.setFocus(); SWTBot filterBot = viewBot.bot(); SWTBotTree treeBot = filterBot.tree(); viewBot.toolbarButton("Add new filter").click(); treeBot.getTreeItem("FILTER <name>").select(); SWTBotText textBot = filterBot.text(); textBot.setFocus(); String filterName = "timestamp"; textBot.setText(filterName); SWTBotTreeItem filterNodeBot = treeBot.getTreeItem(FILTER_TEST + filterName); filterNodeBot.click(); filterNodeBot.contextMenu("TRACETYPE").click(); filterNodeBot.expand(); SWTBotCombo comboBot = filterBot.comboBox(); comboBot.setSelection(TRACETYPE); filterNodeBot.getNode(WITH_TRACETYPE).expand(); filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(AND).click(); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).contextMenu(CONTAINS).click(); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).expand(); comboBot = filterBot.comboBox(); comboBot.setSelection(comboBot.itemCount() - 3); textBot = filterBot.text(); textBot.setFocus(); textBot.setText("100"); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).getNode("Timestamp CONTAINS \"100\"").select(); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).select(); viewBot.toolbarButton("Save filters").click(); String ret = applyFilter(fBot, filterName); assertEquals("10/100", ret); }
Source:
private static LogicalType fromSchemaImpl(Schema schema, boolean throwErrors) { String typeName = schema.getProp(LogicalType.LOGICAL_TYPE_PROP); LogicalType logicalType; try { if (TIMESTAMP_MILLIS.equals(typeName)) { logicalType = TIMESTAMP_MILLIS_TYPE; } else if (DECIMAL.equals(typeName)) { logicalType = new Decimal(schema); } else if (UUID.equals(typeName)) { logicalType = UUID_TYPE; } else if (DATE.equals(typeName)) { logicalType = DATE_TYPE; } else if (TIMESTAMP_MICROS.equals(typeName)) { logicalType = TIMESTAMP_MICROS_TYPE; } else if (TIME_MILLIS.equals(typeName)) { logicalType = TIME_MILLIS_TYPE; } else if (TIME_MICROS.equals(typeName)) { logicalType = TIME_MICROS_TYPE; } else if (REGISTERED_TYPES.containsKey(typeName)) { logicalType = REGISTERED_TYPES.get(typeName).fromSchema(schema); } else { logicalType = null; } if (logicalType != null) { logicalType.validate(schema); } } catch (RuntimeException e) { if (throwErrors) { throw e; } else { LOGGER.warn("Ignoring invalid logical type for name: {}", typeName); LOGGER.debug("Invalid logical type found", e); } logicalType = null; } return logicalType; }

Target:
private static LogicalType fromSchemaImpl(Schema schema, boolean throwErrors) { String typeName = schema.getProp(LogicalType.LOGICAL_TYPE_PROP); LogicalType logicalType; try { if (TIMESTAMP_MILLIS.equals(typeName)) { logicalType = TIMESTAMP_MILLIS_TYPE; } else if (DECIMAL.equals(typeName)) { logicalType = new Decimal(schema); } else if (UUID.equals(typeName)) { logicalType = UUID_TYPE; } else if (DATE.equals(typeName)) { logicalType = DATE_TYPE; } else if (TIMESTAMP_MICROS.equals(typeName)) { logicalType = TIMESTAMP_MICROS_TYPE; } else if (TIME_MILLIS.equals(typeName)) { logicalType = TIME_MILLIS_TYPE; } else if (TIME_MICROS.equals(typeName)) { logicalType = TIME_MICROS_TYPE; } else if (REGISTERED_TYPES.containsKey(typeName)) { logicalType = REGISTERED_TYPES.get(typeName).fromSchema(schema); } else { logicalType = null; } if (logicalType != null) { logicalType.validate(schema); } } catch (RuntimeException e) { LOG.debug("Invalid logical type found", e); if (throwErrors) { throw e; } LOG.warn("Ignoring invalid logical type for name: {}", typeName); logicalType = null; } return logicalType; }
Source:
private void updateInfo(Workflow oldWorkflow, Workflow newWorkflow) { if (Objects.equals(oldWorkflow.getMode(), WorkflowMode.STUB)) { oldWorkflow.setDescriptorType(newWorkflow.getDescriptorType()); } oldWorkflow.setDefaultWorkflowPath(newWorkflow.getDefaultWorkflowPath()); oldWorkflow.setDefaultTestParameterFilePath(newWorkflow.getDefaultTestParameterFilePath()); if (newWorkflow.getDefaultVersion() != null) { if (!oldWorkflow.checkAndSetDefaultVersion(newWorkflow.getDefaultVersion())) { throw new CustomWebApplicationException("Workflow version does not exist.", HttpStatus.SC_BAD_REQUEST); } } }

Target:
private void updateInfo(Workflow oldWorkflow, Workflow newWorkflow) { if (Objects.equals(oldWorkflow.getMode(), WorkflowMode.FULL) && !Objects.equals(oldWorkflow.getDescriptorType(), newWorkflow.getDescriptorType())) { throw new CustomWebApplicationException("You cannot change the descriptor type of a FULL workflow.", HttpStatus.SC_BAD_REQUEST); } if (Objects.equals(oldWorkflow.getMode(), WorkflowMode.STUB)) { oldWorkflow.setDescriptorType(newWorkflow.getDescriptorType()); } oldWorkflow.setDefaultWorkflowPath(newWorkflow.getDefaultWorkflowPath()); oldWorkflow.setDefaultTestParameterFilePath(newWorkflow.getDefaultTestParameterFilePath()); if (newWorkflow.getDefaultVersion() != null) { if (!oldWorkflow.checkAndSetDefaultVersion(newWorkflow.getDefaultVersion())) { throw new CustomWebApplicationException("Workflow version does not exist.", HttpStatus.SC_BAD_REQUEST); } } }
Source:
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { Object root = context.getDefaultVariable(); IContainer container = null; if (root instanceof IContainer) { container = (IContainer)root; } else if (root instanceof IAdaptable) { container = ((IAdaptable)root).getAdapter(IContainer.class); } if (container != null) { RecursiveSuffixFileFinder finder = new RecursiveSuffixFileFinder(); container.accept(finder); return EvaluationResult.valueOf(finder.foundFileWithSuffix()); } return EvaluationResult.FALSE; }

Target:
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { Object root = context.getDefaultVariable(); IContainer container = Adapters.adapt(root, IContainer.class); if (container != null) { RecursiveSuffixFileFinder finder = new RecursiveSuffixFileFinder(); container.accept(finder); return EvaluationResult.valueOf(finder.foundFileWithSuffix()); } return EvaluationResult.FALSE; }
Source:
public static boolean isSuccess(final ResponseCode code) { return code.codeClass == CodeClass.SUCCESS_RESPONSE.value; }

Target:
public static boolean isSuccess(final ResponseCode code) { if (null == code) { throw new NullPointerException("ResponseCode must not be null!"); } return code.codeClass == CodeClass.SUCCESS_RESPONSE.value; }
Source:
public Object clone() { BibEntry clone = new BibEntry(type.getValue()); if (StandardEntryType.Misc.equals(type.getValue())) { clone.changed = true; } clone.fields = FXCollections.observableMap(new ConcurrentHashMap<>(fields)); return clone; }

Target:
public Object clone() { BibEntry clone = new BibEntry(type.getValue()); clone.fields = FXCollections.observableMap(new ConcurrentHashMap<>(fields)); clone.commentsBeforeEntry = new String(commentsBeforeEntry); clone.parsedSerialization = new String(parsedSerialization); clone.changed = changed; return clone; }
Source:
public List queryByAuditOptions(Integer outcome, List<String> eventTypeList, String userId, List<String> remoteHcidList, Date startDate, Date endDate) { Session session = null; List<AuditRepositoryRecord> queryList = null; try { SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); session = sessionFactory.openSession(); LOG.info("Getting Record for Audit Query "); Criteria queryCriteria = session.createCriteria(AuditRepositoryRecord.class); if (outcome != null && outcome >= 0) { queryCriteria.add(Restrictions.eq("outcome", outcome)); } if (NullChecker.isNotNullish(eventTypeList)) { queryCriteria.add(Restrictions.in("eventType", eventTypeList)); } if (NullChecker.isNotNullish(userId)) { queryCriteria.add(Restrictions.eq("userId", userId)); } if (NullChecker.isNotNullish(remoteHcidList)) { queryCriteria.add(Restrictions.in("remoteHcid", remoteHcidList)); } if (startDate != null && endDate != null) { queryCriteria.add(Expression.between("eventTimestamp", new Date(startDate.getTime()), new Date(endDate.getTime()))); } else if (startDate != null && endDate == null) { queryCriteria.add(Restrictions.ge("eventTimestamp", new Date(startDate.getTime()))); } else if (startDate == null && endDate != null) { queryCriteria.add(Restrictions.le("eventTimestamp", new Date(endDate.getTime()))); } queryList = setProjectionFields(queryCriteria).list(); } catch (HibernateException e) { LOG.error("Exception in AuditLog.get() occurred due to :" + e.getLocalizedMessage(), e); } finally { closeSession(session, false); } return queryList; }

Target:
public List queryByAuditOptions(Integer outcome, List<String> eventTypeList, String userId, List<String> remoteHcidList, Date startDate, Date endDate) { Session session = null; List<AuditRepositoryRecord> queryList = null; try { SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); session = sessionFactory.openSession(); LOG.info("Getting Record for Audit Query "); Criteria queryCriteria = session.createCriteria(AuditRepositoryRecord.class); if (outcome != null && outcome >= 0) { queryCriteria.add(Restrictions.eq("outcome", outcome)); } if (NullChecker.isNotNullish(eventTypeList)) { queryCriteria.add(Restrictions.in("eventType", eventTypeList)); } if (NullChecker.isNotNullish(userId)) { queryCriteria.add(Restrictions.eq("userId", userId)); } if (NullChecker.isNotNullish(remoteHcidList)) { queryCriteria.add(Restrictions.in("remoteHcid", remoteHcidList)); } if (startDate != null && endDate != null) { queryCriteria.add(Expression.between("eventTimestamp", startDate, endDate)); } else if (startDate != null && endDate == null) { queryCriteria.add(Restrictions.ge("eventTimestamp", startDate)); } else if (startDate == null && endDate != null) { queryCriteria.add(Restrictions.le("eventTimestamp", endDate)); } queryList = setProjectionFields(queryCriteria).list(); } catch (HibernateException e) { LOG.error("Exception in AuditLog.get() occurred due to :" + e.getLocalizedMessage(), e); } finally { closeSession(session, false); } return queryList; }
Source:
public JoinProcessorSupplier( final String stateStoreName, final IterativeJoin join, final List<String> joinVars, final List<String> allVars, final ProcessorResultFactory resultFactory) throws IllegalArgumentException { super(resultFactory); this.stateStoreName = requireNonNull(stateStoreName); this.join = requireNonNull(join); this.joinVars = requireNonNull(joinVars); this.allVars = requireNonNull(allVars); if(!allVars.subList(0, joinVars.size()).equals(joinVars)) { throw new IllegalArgumentException("All vars must be lead by the join vars, but it did not. " + "Join Vars: " + joinVars + ", All Vars: " + allVars); } }

Target:
public JoinProcessorSupplier( final String stateStoreName, final IterativeJoin join, final List<String> joinVars, final List<String> allVars, final ProcessorResultFactory resultFactory) throws IllegalArgumentException { super(resultFactory); this.stateStoreName = requireNonNull(stateStoreName); this.join = requireNonNull(join); this.joinVars = requireNonNull(joinVars); this.allVars = requireNonNull(allVars); if(!allVars.subList(0, joinVars.size()).equals(joinVars)) { throw new IllegalArgumentException("The allVars list must start with the joinVars list, but it did not. " + "Join Vars: " + joinVars + ", All Vars: " + allVars); } }
Source:
public String setFormat() { return "Drei Worte: !set option_name value_to_set. Versuch !help falls dir drei-Wort-Sätze zu kompliziert sind."; }

Target:
public String setFormat() { return "Drei Worte: !set option_name value_to_set. Versuch !help, falls dir drei-Wort-Sätze zu kompliziert sind."; }
Source:
private void handleInternalLink(PageTitle title) { if (!isAdded()) { return; } if (referenceDialog != null && referenceDialog.isShowing()) { referenceDialog.dismiss(); } LinkPreviewFunnel linkPreviewFunnel = new LinkPreviewFunnel(app, title); if (linkPreviewFunnel.getVersion() == 0 || app.getReleaseType() == WikipediaApp.RELEASE_PROD) { HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_INTERNAL_LINK); ((PageActivity) getActivity()).displayNewPage(title, historyEntry); linkPreviewFunnel.logLinkClick(); } else { LinkPreviewDialog dialog = LinkPreviewDialog.newInstance(title, linkPreviewFunnel.getVersion()); dialog.show(getActivity().getSupportFragmentManager(), "link_preview_dialog"); } }

Target:
private void handleInternalLink(PageTitle title) { if (!isAdded()) { return; } if (referenceDialog != null && referenceDialog.isShowing()) { referenceDialog.dismiss(); } LinkPreviewFunnel linkPreviewFunnel = new LinkPreviewFunnel(app, title); if (app.getReleaseType() == WikipediaApp.RELEASE_PROD || LinkPreviewVersion.getVersion(app) == 0) { HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_INTERNAL_LINK); ((PageActivity) getActivity()).displayNewPage(title, historyEntry); linkPreviewFunnel.logNavigate(); } else { LinkPreviewDialog dialog = LinkPreviewDialog.newInstance(title, LinkPreviewVersion.getVersion(app)); dialog.show(getActivity().getSupportFragmentManager(), "link_preview_dialog"); } }
Source:
public void detachDelegate() throws IOException { wrapped.flush(); wrapped = null; }

Target:
public void detachDelegate() throws IOException { Preconditions.checkState(wrapped != null); wrapped.flush(); wrapped = null; }
Source:
boolean isMeasurementWithinLimits() { double measurement; try { measurement = (double) currentValue(); } catch (ClassCastException ex) { return true; } return Double.compare(lowerLimit(), measurement) <= 0 && Double.compare(upperLimit(), measurement) >= 0; }

Target:
boolean isMeasurementWithinLimits() { double measurement; try { measurement = Double.valueOf(currentValue().toString()); } catch (ClassCastException ex) { return true; } return lowerLimit() <= measurement && measurement <= upperLimit(); }
Source:
public BitreserveRestAdapter(final String token) { RequestInterceptor requestInterceptor = new RequestInterceptor() { @Override public void intercept(RequestFacade request) { HashMap<String, String> map = Header.getHeaders(); for (Map.Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); request.addHeader(key, value); } if (token != null && !TextUtils.isEmpty(token)) { request.addHeader("Authorization", Header.encodeCredentialsForBasicAuthorization(token, "X-OAuth-Basic")); } } }; this.adapter = new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL) .setRequestInterceptor(requestInterceptor) .setLogLevel(GlobalConfigurations.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE) .setErrorHandler(new BitreserveRetrofitErrorHandling()) .build(); }

Target:
public BitreserveRestAdapter(final String token) { RequestInterceptor requestInterceptor = new RequestInterceptor() { @Override public void intercept(RequestFacade request) { HashMap<String, String> map = Header.getHeaders(); for (Map.Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); request.addHeader(key, value); } if (token != null && !TextUtils.isEmpty(token)) { request.addHeader("Authorization", Header.encodeCredentialsForBasicAuthorization(token, "X-OAuth-Basic")); } } }; this.adapter = new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL) .setErrorHandler(new BitreserveRetrofitErrorHandling()) .setLogLevel(GlobalConfigurations.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE) .setRequestInterceptor(requestInterceptor) .build(); }
Source:
public void bindTo(MeterRegistry registry) { startedCounter = Counter.builder(workspaceMetric("starting_attempts.total")) .description("The count of workspaces start attempts") .register(registry); eventService.subscribe( event -> { if (event.getPrevStatus() == WorkspaceStatus.STOPPED && event.getStatus() == WorkspaceStatus.STARTING) { startedCounter.increment(); } }, WorkspaceStatusEvent.class); }

Target:
public void bindTo(MeterRegistry registry) { startingCounter = Counter.builder(workspaceMetric("starting_attempts.total")) .description("The count of workspaces start attempts") .register(registry); eventService.subscribe( event -> { if (event.getPrevStatus() == WorkspaceStatus.STOPPED && event.getStatus() == WorkspaceStatus.STARTING) { startingCounter.increment(); } }, WorkspaceStatusEvent.class); }
Source:
protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } boolean isVolumeDistributed = glusterVolume.getVolumeType().isDistributedType(); if (!isVolumeDistributed) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_NOT_DISTRIBUTED); } else if (isVolumeDistributed && glusterVolume.getBricks().size() == 1) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_DISTRIBUTED_AND_HAS_SINGLE_VOLUME); } return true; }

Target:
protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } boolean isVolumeDistributed = glusterVolume.getVolumeType().isDistributedType(); if (!isVolumeDistributed) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_NOT_DISTRIBUTED); } else if (glusterVolume.getBricks().size() == 1) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_DISTRIBUTED_AND_HAS_SINGLE_VOLUME); } return true; }
Source:
private AbstractProject validateAndGetJenkinsProject(final ReleaseWebHookResource resource) { if (StringUtils.isEmpty(resource.getProjectName())) { throw new InvalidParameterException("Project name is empty"); } for (final Item project : Jenkins.getActiveInstance().getAllItems()) { if (project instanceof AbstractProject && project.getName().equalsIgnoreCase(resource.getProjectName())) { return (AbstractProject) project; } } throw new InvalidParameterException("Cannot find Jenkins Job with the name " + resource.getProjectName()); }

Target:
private AbstractProject validateAndGetJenkinsProject(final ReleaseWebHookResource resource) { String projectName = resource.getProjectName(); if (StringUtils.isBlank(projectName)) { throw new InvalidParameterException("Project name is empty"); } for (final Item project : Jenkins.getActiveInstance().getAllItems()) { if (project instanceof AbstractProject && project.getName().equalsIgnoreCase(projectName)) { return (AbstractProject) project; } } throw new InvalidParameterException("Cannot find Jenkins Project with the name " + resource.getProjectName()); }
Source:
private void handleFilterRegex(SearchPredicateFactory theF, BooleanPredicateClausesStep<?> theB, ValueSet.ConceptSetFilterComponent theFilter) { if (theFilter.getOp() == ValueSet.FilterOperator.REGEX) { String value = theFilter.getValue(); if (value.endsWith("$")) { value = value.substring(0, value.length() - 1); } else if (!value.endsWith(".*")) { value = value + ".*"; } if (!value.startsWith("^") && !value.startsWith(".*")) { value = ".*" + value; } else if (value.startsWith("^")) { value = value.substring(1); } Term term = new Term(TermConceptPropertyBinder.CONCEPT_FIELD_PROPERTY_PREFIX + theFilter.getProperty(), value); RegexpQuery query = new RegexpQuery(term); theB.must(theF.extension(LuceneExtension.get()).fromLuceneQuery(query)); } else { String value = theFilter.getValue(); Term term = new Term(TermConceptPropertyBinder.CONCEPT_FIELD_PROPERTY_PREFIX + theFilter.getProperty(), value); theB.must(theF.match().field(term.field()).matching(term.text())); } }

Target:
private void handleFilterRegex(SearchPredicateFactory theF, BooleanPredicateClausesStep<?> theB, ValueSet.ConceptSetFilterComponent theFilter) { if (theFilter.getOp() == ValueSet.FilterOperator.REGEX) { String value = theFilter.getValue(); if (value.endsWith("$")) { value = value.substring(0, value.length() - 1); } else if (!value.endsWith(".*")) { value = value + ".*"; } if (!value.startsWith("^") && !value.startsWith(".*")) { value = ".*" + value; } else if (value.startsWith("^")) { value = value.substring(1); } Term term = new Term(TermConceptPropertyBinder.CONCEPT_FIELD_PROPERTY_PREFIX + theFilter.getProperty(), value); if (isFullTextSetToUseElastic()) { String regexpQuery = "{'regexp':{'" + term.field() + "':{'value':'" + term.text() + "'}}}"; ourLog.debug("Build Elasticsearch Regexp Query: {}", regexpQuery); theB.must(theF.extension(ElasticsearchExtension.get()).fromJson(regexpQuery)); } else { RegexpQuery query = new RegexpQuery(term); theB.must(theF.extension(LuceneExtension.get()).fromLuceneQuery(query)); } } else { String value = theFilter.getValue(); Term term = new Term(TermConceptPropertyBinder.CONCEPT_FIELD_PROPERTY_PREFIX + theFilter.getProperty(), value); theB.must(theF.match().field(term.field()).matching(term.text())); } }
Source:
public PlanWithProperties visitUnnest(UnnestNode node, PreferredProperties preferredProperties) { PreferredProperties translatedPreferred = preferredProperties.translate(variable -> { checkArgument(variable instanceof VariableReferenceExpression, "Expect VariableReferenceExpression"); return node.getReplicateVariables().contains(variable) ? Optional.of(variable) : Optional.empty(); }); return rebaseAndDeriveProperties(node, planChild(node, translatedPreferred)); }

Target:
public PlanWithProperties visitUnnest(UnnestNode node, PreferredProperties preferredProperties) { PreferredProperties translatedPreferred = preferredProperties.translate(variable -> node.getReplicateVariables().contains(variable) ? Optional.of(variable) : Optional.empty()); return rebaseAndDeriveProperties(node, planChild(node, translatedPreferred)); }
Source:
public long getRetainedSizeInBytes() { return pageBuilder.getRetainedSizeInBytes() + outputQueue.stream().mapToLong(Page::getRetainedSizeInBytes).sum(); }

Target:
public long getRetainedSizeInBytes() { long retainedSizeInBytes = INSTANCE_SIZE; retainedSizeInBytes += pageBuilder.getRetainedSizeInBytes(); if (currentInput != null) { retainedSizeInBytes += currentInput.getRetainedSizeInBytes(); } for (Page page : outputQueue) { retainedSizeInBytes += page.getRetainedSizeInBytes(); } return retainedSizeInBytes; }
Source:
public boolean tryCreateAsDirectory() { try { if (exists()) { return isDirectory(); } if (!canCreateAsDirectory()) { return false; } if (parent() != null) { parent().createAsDirectory(); } return createDirectoryHandler.apply(this); } catch (Exception e) { throw handleErrorInCallback(e, "createDirectoryHandler"); } }

Target:
public boolean tryCreateAsDirectory() { try { if (exists()) { return isDirectory(); } if (!canCreateAsDirectory()) { return false; } if (parent() != null && !parent().tryCreateAsDirectory()) { return false; } return createDirectoryHandler.apply(this); } catch (Exception e) { throw handleErrorInCallback(e, "createDirectoryHandler"); } }
Source:
private String delete(final Long userId) throws UserRetrievalException, UserManagementException, UserPermissionRetrievalException, JsonProcessingException, EntityCreationException, EntityRetrievalException { if (userId <= 0) { throw new UserRetrievalException("Cannot delete user with ID less than 0"); } UserDTO toDelete = userManager.getById(userId); if (toDelete == null) { throw new UserRetrievalException("Could not find user with id " + userId); } if (resourcePermissions.isUserRoleAdmin() || resourcePermissions.isUserRoleOnc()) { userManager.delete(toDelete); userPermissionsManager.deleteAllAcbPermissionsForUser(userId); userPermissionsManager.deleteAllAtlPermissionsForUser(userId); } else if (resourcePermissions.isUserRoleAcbAdmin()) { List<CertificationBodyDTO> targetUserAcbs = resourcePermissions.getAllAcbsForUser(userId); for (CertificationBodyDTO dto : resourcePermissions.getAllAcbsForCurrentUser()) { if (isAcbInList(dto, targetUserAcbs)) { userPermissionsManager.deleteAcbPermission(dto, userId); } } } else if (resourcePermissions.isUserRoleAtlAdmin()) { List<TestingLabDTO> targetUserAtls = resourcePermissions.getAllAtlsForUser(userId); for (TestingLabDTO dto : resourcePermissions.getAllAtlsForCurrentUser()) { if (isAtlInList(dto, targetUserAtls)) { userPermissionsManager.deleteAtlPermission(dto, userId); } } } String activityDescription = "User " + toDelete.getSubjectName() + " was deleted."; activityManager.addActivity(ActivityConcept.ACTIVITY_CONCEPT_USER, toDelete.getId(), activityDescription, toDelete, null); return "{\"deletedUser\" : true}"; }

Target:
private String delete(final Long userId) throws UserRetrievalException, UserManagementException, UserPermissionRetrievalException, JsonProcessingException, EntityCreationException, EntityRetrievalException { if (userId <= 0) { throw new UserRetrievalException("Cannot delete user with ID less than 0"); } UserDTO toDelete = userManager.getById(userId); if (toDelete == null) { throw new UserRetrievalException("Could not find user with id " + userId); } if (resourcePermissions.isUserRoleAdmin() || resourcePermissions.isUserRoleOnc()) { userManager.delete(toDelete); userPermissionsManager.deleteAllAcbPermissionsForUser(userId); userPermissionsManager.deleteAllAtlPermissionsForUser(userId); } else { if (resourcePermissions.isUserRoleAcbAdmin()) { List<CertificationBodyDTO> targetUserAcbs = resourcePermissions.getAllAcbsForUser(userId); for (CertificationBodyDTO dto : resourcePermissions.getAllAcbsForCurrentUser()) { if (isAcbInList(dto, targetUserAcbs)) { userPermissionsManager.deleteAcbPermission(dto, userId); } } } if (resourcePermissions.isUserRoleAtlAdmin()) { List<TestingLabDTO> targetUserAtls = resourcePermissions.getAllAtlsForUser(userId); for (TestingLabDTO dto : resourcePermissions.getAllAtlsForCurrentUser()) { if (isAtlInList(dto, targetUserAtls)) { userPermissionsManager.deleteAtlPermission(dto, userId); } } } } String activityDescription = "User " + toDelete.getSubjectName() + " was deleted."; activityManager.addActivity(ActivityConcept.ACTIVITY_CONCEPT_USER, toDelete.getId(), activityDescription, toDelete, null); return "{\"deletedUser\" : true}"; }
Source:
public NimbusJwtDecoder build() { ConfigurableJWTProcessor<SecurityContext> processor = processor(); jwtProcessorCustomizer.accept(processor); return new NimbusJwtDecoder(processor); }

Target:
public NimbusJwtDecoder build() { return new NimbusJwtDecoder(processor()); }
Source:
void write(List<DeepLinkAnnotatedElement> elements) { if (file == null) { messager.printMessage(Diagnostic.Kind.NOTE, "Output file is null, DeepLink doc not generated."); return; } if (elements == null || elements.isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "No deep link, DeepLink doc not generated."); return; } PrintWriter writer; try { writer = new PrintWriter(new FileWriter(file), true); for (DeepLinkAnnotatedElement element : elements) { writer.print(element.getUri() + PROPERTY_DELIMITER); String doc = formatJavaDoc( processingEnv.getElementUtils().getDocComment(element.getElement())); if (doc != null) { writer.print(doc); } writer.print(PROPERTY_DELIMITER); writer.print(element.getAnnotatedElement().getSimpleName()); if (element.getAnnotationType().equals(DeepLinkEntry.Type.METHOD)) { writer.print(CLASS_METHOD_NAME_DELIMITER); writer.print(element.getMethod()); } writer.print(ELEMENT_DELIMITER); } writer.flush(); writer.close(); } catch (IOException e) { e.printStackTrace(); messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc not generated, "); } messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc generated at: " + file.getPath()); }

Target:
void write(List<DeepLinkAnnotatedElement> elements) { if (file == null) { messager.printMessage(Diagnostic.Kind.NOTE, "Output file is null, DeepLink doc not generated."); return; } if (elements == null || elements.isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "No deep link, DeepLink doc not generated."); return; } try (PrintWriter writer = new PrintWriter(new FileWriter(file), true)) { for (DeepLinkAnnotatedElement element : elements) { writer.print(element.getUri() + PROPERTY_DELIMITER); String doc = formatJavaDoc( processingEnv.getElementUtils().getDocComment(element.getElement())); if (doc != null) { writer.print(doc); } writer.print(PROPERTY_DELIMITER); writer.print(element.getAnnotatedElement().getSimpleName()); if (element.getAnnotationType().equals(DeepLinkEntry.Type.METHOD)) { writer.print(CLASS_METHOD_NAME_DELIMITER); writer.print(element.getMethod()); } writer.print(ELEMENT_DELIMITER); } writer.flush(); } catch (IOException e) { messager.printMessage(Diagnostic.Kind.ERROR, "DeepLink doc not generated: " + e.getMessage()); } messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc generated at: " + file.getPath()); }
Source:
public void start() throws ServerException { for (String stackPath: stackPaths) { if (!Strings.isNullOrEmpty(stackPath)) { for (StackImpl stack: loadStacks(stackPath)) { try { try { stackDao.update(stack); } catch (NotFoundException e) { stackDao.create(stack); } } catch (ConflictException e) { throw new ServerException("Failed to store stack " + stack, e); } } } } }

Target:
public void start() throws ServerException { for (String stackPath: stackPaths) { if (!Strings.isNullOrEmpty(stackPath)) { for (DecoratedStackImpl stack: loadStacks(stackPath)) { try { try { stackDao.update(stack); } catch (NotFoundException e) { stackDao.create(stack); } } catch (ConflictException e) { throw new ServerException("Failed to store stack " + stack, e); } } } } }
Source:
public void startContainer(ContainerModel containerModel, Config config, int maxChangelogStreamPartitions) { LocalityManager localityManager = null; if (new ClusterManagerConfig(config).getHostAffinityEnabled()) { localityManager = SamzaContainer$.MODULE$.getLocalityManager(containerModel.getContainerId(), config); } log.info("About to create container: " + containerModel.getContainerId()); container = SamzaContainer$.MODULE$.apply( containerModel.getContainerId(), containerModel, config, maxChangelogStreamPartitions, localityManager, new JmxServer(), Util.<String, MetricsReporter>javaMapAsScalaMap(metricsReporterMap), taskFactory); log.info("About to start container: " + containerModel.getContainerId()); containerFuture = executorService.submit(() -> { try { container.run(); } catch (Throwable t) { if (errorHandler != null) { errorHandler.onProcessorError(t); } else { throw t; } } }); }

Target:
public void startContainer(ContainerModel containerModel, Config config, int maxChangelogStreamPartitions) { if (isContainerRunning()) { log.warn("Container is already running. Should call stopContainer before starting the container again!"); return; } LocalityManager localityManager = null; if (new ClusterManagerConfig(config).getHostAffinityEnabled()) { localityManager = SamzaContainerWrapper.getLocalityManager(containerModel.getContainerId(), config); } log.info("About to create container: " + containerModel.getContainerId()); container = SamzaContainerWrapper.createInstance( containerModel.getContainerId(), containerModel, config, maxChangelogStreamPartitions, localityManager, new JmxServer(), Util.<String, MetricsReporter>javaMapAsScalaMap(metricsReporterMap), taskFactory, null); log.info("About to start container: " + containerModel.getContainerId()); executorService = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder() .setNameFormat("processor-thread-%d").build()); containerFuture = executorService.submit(() -> { try { container.run(); } catch (Throwable t) { if (lifecycleCallback != null) { lifecycleCallback.onError(t); } } }); }
Source:
public static JobStatus getJobStatusWithRetries(final Ds3Client client, final UUID jobId, final JobStatus expectedStatus) throws IOException, InterruptedException { final GetJobSpectraS3Request getJobSpectraS3Request = new GetJobSpectraS3Request(jobId); for (int retry = 0; retry < MAX_RETRIES; retry++) { actualStatus = client.getJobSpectraS3(getJobSpectraS3Request).getMasterObjectListResult().getStatus(); if (actualStatus.equals(expectedStatus)) { LOG.info("Found expected JobStatus " + expectedStatus + " after " + retry*POLLING_PERIOD_MILLIS + " millis."); break; } LOG.info("Expected JobStatus " + expectedStatus + " but is actually " + actualStatus + " after " + retry*POLLING_PERIOD_MILLIS + " millis."); Thread.sleep(POLLING_PERIOD_MILLIS); } return actualStatus; }

Target:
public static JobStatus getJobStatusWithRetries(final Ds3Client client, final UUID jobId, final JobStatus expectedStatus) throws IOException, InterruptedException { final GetJobSpectraS3Request getJobSpectraS3Request = new GetJobSpectraS3Request(jobId); for (int retry = 0; retry < MAX_RETRIES; retry++) { actualStatus = client.getJobSpectraS3(getJobSpectraS3Request).getMasterObjectListResult().getStatus(); if (actualStatus == expectedStatus) { LOG.info("Found expected JobStatus " + expectedStatus + " after " + retry*POLLING_PERIOD_MILLIS + " millis."); break; } LOG.info("Expected JobStatus " + expectedStatus + " but is actually " + actualStatus + " after " + retry*POLLING_PERIOD_MILLIS + " millis."); Thread.sleep(POLLING_PERIOD_MILLIS); } return actualStatus; }
Source:
public boolean allowsEStructuralFeatureCustomization(EObject element) { boolean customizationAllowed = false; for (Dialect dialect : dialects.values()) { customizationAllowed = customizationAllowed || dialect.getServices().allowsEStructuralFeatureCustomization(element); } return customizationAllowed; }

Target:
public boolean allowsEStructuralFeatureCustomization(EObject element) { boolean customizationAllowed = false; Iterator<Dialect> dialectsValueIterator = dialects.values().iterator(); while (dialectsValueIterator.hasNext() && !customizationAllowed) { customizationAllowed = dialectsValueIterator.next().getServices().allowsEStructuralFeatureCustomization(element); } return customizationAllowed; }
Source:
public FirestorePagingAdapter(@NonNull FirestorePagingOptions<T> options) { super(new DiffCallback<>(options.getParser())); mParser = options.getParser(); mData = options.getData(); if (options.getOwner() != null) { options.getOwner().getLifecycle().addObserver(this); } }

Target:
public FirestorePagingAdapter(@NonNull FirestorePagingOptions<T> options) { super(options.getDiffCallback()); mSnapshots = options.getData(); mLoadingState = Transformations.switchMap(mSnapshots, new Function<PagedList<DocumentSnapshot>, LiveData<LoadingState>>() { @Override public LiveData<LoadingState> apply(PagedList<DocumentSnapshot> input) { FirestoreDataSource dataSource = (FirestoreDataSource) input.getDataSource(); return dataSource.getLoadingState(); } }); mDataSource = Transformations.map(mSnapshots, new Function<PagedList<DocumentSnapshot>, FirestoreDataSource>() { @Override public FirestoreDataSource apply(PagedList<DocumentSnapshot> input) { return (FirestoreDataSource) input.getDataSource(); } }); mParser = options.getParser(); if (options.getOwner() != null) { options.getOwner().getLifecycle().addObserver(this); } }