auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onVisible(IObservableValue detailsViewModel, DataBindingContext dbc) { bindWidgetsToInternalModel(dbc); rememberTokenCheckbox.setText("&Save token (could trigger secure storage login)"); <START> setCheckboxVisible(true); <END> rememberTokenCheckbox.getParent().update(); rememberTokenCheckbox.getParent().layout(true); }</code><technical_language>UIUtils.setVisibleAndExclude(boolean visible, final Control control)</technical_language>

Target:
public void onVisible(IObservableValue detailsViewModel, DataBindingContext dbc) { bindWidgetsToInternalModel(dbc); this.rememberTokenBinding = ValueBindingBuilder .bind(WidgetProperties.selection().observe(rememberTokenCheckbox)) .to(rememberTokenObservable) .in(dbc); }
Source:
<code>public static <T extends org.eclipse.swt.widgets.Widget> org.hamcrest.Matcher<T> withId(java.lang.String key, java.lang.String value) { return org.eclipse.swtbot.swt.finder.matchers.WithId.withId(key, <START> value); <END> }</code><technical_language>Cast (Object) prevent a deprecation warning</technical_language>

Target:
public static <T extends org.eclipse.swt.widgets.Widget> org.hamcrest.Matcher<T> withId(java.lang.String key, java.lang.String value) { return org.eclipse.swtbot.swt.finder.matchers.WithId.withId(key, (Object)value); }
Source:
<code>public TaskActivityRecords getTaskActivities(@PathVariable Long taskId, GridSettings settings) { if (settings != null) { QueryParams params = settings.isLastExecution() ? new QueryParams(settings.getPage(), 1, new Order("date", Order.Direction.DESC)) : new QueryParams(settings.getPage(), settings.getRows(), new Order("date", Order.Direction.DESC)); Set<TaskActivityType> types = settings.getTypesFromString(); Range<DateTime> dateTimeRange = settings.convertToDateRange(settings.getDateTimeFrom(), settings.getDateTimeTo()); List<TaskActivityDto> activities; long count; if (dateTimeRange != null) { activities = taskWebService.getTaskActivities(taskId, types, dateTimeRange, params); <START> count = settings.isLastExecution() ? 1 : activityService.getTaskActivitiesCount(taskId, types, dateTimeRange); <END> } else { activities = taskWebService.getTaskActivities(taskId, types, params); count = settings.isLastExecution() ? 1 : activityService.getTaskActivitiesCount(taskId, types); } int totalPages = (int) Math.ceil((double) count / settings.getRows()); return new TaskActivityRecords(settings.getPage(), totalPages, count, activities); } else { return null; } }</code><technical_language>1 ? Is 1</technical_language>

Target:
public TaskActivityRecords getTaskActivities(@PathVariable Long taskId, GridSettings settings) { if (settings != null) { QueryParams params = getParams(settings); Set<TaskActivityType> types = settings.getTypesFromString(); Range<DateTime> dateTimeRange = settings.convertToDateRange(settings.getDateTimeFrom(), settings.getDateTimeTo()); List<TaskActivityDto> activities; long count; if (dateTimeRange != null) { activities = taskWebService.getTaskActivities(taskId, types, dateTimeRange, params, settings.isLastExecution()); count = activityService.getTaskActivitiesCount(taskId, types, dateTimeRange, settings.isLastExecution()); } else { activities = taskWebService.getTaskActivities(taskId, types, params, settings.isLastExecution()); count = activityService.getTaskActivitiesCount(taskId, types, settings.isLastExecution()); } int totalPages = (int) Math.ceil((double) count / settings.getRows()); return new TaskActivityRecords(settings.getPage(), totalPages, count, activities); } else { return null; } }
Source:
<code>public InstallModel() { setUserPassword(new EntityModel<String>()); setOVirtISO(new ListModel<RpmVersion>()); setHostVersion(new EntityModel<String>()); setOverrideIpTables(new EntityModel<Boolean>()); setActivateHostAfterInstall(new EntityModel<Boolean>()); setReconfigureGluster(new EntityModel<Boolean>()); getOverrideIpTables().setEntity(false); getActivateHostAfterInstall().setEntity(false); getReconfigureGluster().setEntity(true); <START> getReconfigureGluster().getEntityChangedEvent().addListener((ev, sender, args) -> { <END> if(getReconfigureGluster().getEntity()) { getReconfigureGluster().setEntity(false); } else { getReconfigureGluster().setEntity(true); } }); setUserName(new EntityModel<String>()); getUserName().setEntity(HostModel.RootUserName); getUserName().setIsChangeable(false); setPublicKey(new EntityModel<String>()); getPublicKey().setEntity(""); setValidationFailed(new EntityModel<Boolean>()); fetchEngineSshPublicKey(); setHostedEngineHostModel(new HostedEngineHostModel()); }</code><technical_language>is reason for this listener? negating here</technical_language>

Target:
public InstallModel() { setUserPassword(new EntityModel<String>()); setOVirtISO(new ListModel<RpmVersion>()); setHostVersion(new EntityModel<String>()); setOverrideIpTables(new EntityModel<Boolean>()); setActivateHostAfterInstall(new EntityModel<Boolean>()); setReconfigureGluster(new EntityModel<Boolean>()); getOverrideIpTables().setEntity(false); getActivateHostAfterInstall().setEntity(false); getReconfigureGluster().setEntity(true); setUserName(new EntityModel<String>()); getUserName().setEntity(HostModel.RootUserName); getUserName().setIsChangeable(false); setPublicKey(new EntityModel<String>()); getPublicKey().setEntity(""); setValidationFailed(new EntityModel<Boolean>()); fetchEngineSshPublicKey(); setHostedEngineHostModel(new HostedEngineHostModel()); }
Source:
<code>@Override public void addSelect(List<SqlNode> selectList, SqlNode node, RelDataType rowType) { String name = rowType.getFieldNames().get(selectList.size()); String alias = SqlValidatorUtil.getAlias(node, -1); final String lowerName = name.toLowerCase(Locale.ROOT); if (lowerName.startsWith("expr$")) { if (stack.size() != 1) { node = as(node, name); } else { ordinalMap.put(lowerName, node); <START> } <END> } else if (alias == null || !alias.equals(name)) { node = as(node, name); } selectList.add(node); }</code><technical_language>isordinalMap for</technical_language>

Target:
@Override public void addSelect(List<SqlNode> selectList, SqlNode node, RelDataType rowType) { String name = rowType.getFieldNames().get(selectList.size()); String alias = SqlValidatorUtil.getAlias(node, -1); final String lowerName = name.toLowerCase(Locale.ROOT); if (lowerName.startsWith("expr$")) { final RelNode current = stack.peek().r; if (stack.size() != 1 && current instanceof Aggregate) { node = as(node, name); } else { ordinalMap.put(lowerName, node); } } else if (alias == null || !alias.equals(name)) { node = as(node, name); } selectList.add(node); }
Source:
<code>@Override public Pair<RelTraitSet, List<RelTraitSet>> passThroughTraits( final RelTraitSet required) { if (!isSimple(this)) { return null; } RelTraitSet inputTraits = getInput().getTraitSet(); RelCollation collation = required.getTrait(RelCollationTraitDef.INSTANCE); ImmutableBitSet requiredKeys = ImmutableBitSet.of(RelCollations.ordinals(collation)); ImmutableBitSet groupKeys = ImmutableBitSet.range(groupSet.cardinality()); if (!groupKeys.contains(requiredKeys)) { return null; } Mappings.TargetMapping mapping = Mappings.source(groupSet.toList(), input.getRowType().getFieldCount()); if (requiredKeys.equals(groupKeys)) { RelCollation inputCollation = RexUtil.apply(mapping, collation); return Pair.of(required, ImmutableList.of(inputTraits.replace(inputCollation))); } else if (groupKeys.contains(requiredKeys)) { List<RelFieldCollation> list = new ArrayList<>(collation.getFieldCollations()); groupKeys.except(requiredKeys).forEach(k -> list.add(new RelFieldCollation(k))); RelCollation aggCollation = RelCollations.of(list); RelCollation inputCollation = RexUtil.apply(mapping, aggCollation); return Pair.of(traitSet.replace(aggCollation), ImmutableList.of(inputTraits.replace(inputCollation))); } return null; <START> } <END></code><technical_language>If reached, throw exception</technical_language>

Target:
@Override public Pair<RelTraitSet, List<RelTraitSet>> passThroughTraits( final RelTraitSet required) { if (!isSimple(this)) { return null; } RelTraitSet inputTraits = getInput().getTraitSet(); RelCollation collation = required.getTrait(RelCollationTraitDef.INSTANCE); ImmutableBitSet requiredKeys = ImmutableBitSet.of(RelCollations.ordinals(collation)); ImmutableBitSet groupKeys = ImmutableBitSet.range(groupSet.cardinality()); Mappings.TargetMapping mapping = Mappings.source(groupSet.toList(), input.getRowType().getFieldCount()); if (requiredKeys.equals(groupKeys)) { RelCollation inputCollation = RexUtil.apply(mapping, collation); return Pair.of(required, ImmutableList.of(inputTraits.replace(inputCollation))); } else if (groupKeys.contains(requiredKeys)) { List<RelFieldCollation> list = new ArrayList<>(collation.getFieldCollations()); groupKeys.except(requiredKeys).forEach(k -> list.add(new RelFieldCollation(k))); RelCollation aggCollation = RelCollations.of(list); RelCollation inputCollation = RexUtil.apply(mapping, aggCollation); return Pair.of(traitSet.replace(aggCollation), ImmutableList.of(inputTraits.replace(inputCollation))); } return null; }
Source:
<code>public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { if (command.hasFlag(Flag.PUT_FOR_EXTERNAL_READ)) { <START> return super.visitPutKeyValueCommand(ctx, command); <END> } SingleKeyRecipientGenerator skrg = new SingleKeyRecipientGenerator(command.getKey()); Object returnValue = handleWriteCommand(ctx, command, skrg, command.hasFlag(Flag.PUT_FOR_STATE_TRANSFER), false); if (ignorePreviousValueOnBackup(command, ctx)) { command.setPutIfAbsent(false); } if (isL1CacheEnabled && !ctx.isOriginLocal() && !skrg.generateRecipients().contains(ctx.getOrigin())) l1Manager.addRequestor(command.getKey(), ctx.getOrigin()); return returnValue; }</code><technical_language>super is a BaseDistributionInterceptor, I clearer if methods NonTx in name subclasses override visitXxx methods. WDYT</technical_language>

Target:
public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { if (command.hasFlag(Flag.PUT_FOR_EXTERNAL_READ)) { return handleNonTxWriteCommand(ctx, command); } SingleKeyRecipientGenerator skrg = new SingleKeyRecipientGenerator(command.getKey()); Object returnValue = handleTxWriteCommand(ctx, command, skrg, command.hasFlag(Flag.PUT_FOR_STATE_TRANSFER)); if (ignorePreviousValueOnBackup(command, ctx)) { command.setPutIfAbsent(false); } if (isL1CacheEnabled && !ctx.isOriginLocal() && !skrg.generateRecipients().contains(ctx.getOrigin())) l1Manager.addRequestor(command.getKey(), ctx.getOrigin()); return returnValue; }
Source:
<code>public ClassLoader getClassLoader() { <START> return this.getClassLoader(); <END> }</code><technical_language>This method recursively calls itself, result in stackoverflow. Is ok</technical_language>

Target:
public ClassLoader getClassLoader() { return this.getClass().getClassLoader(); }
Source:
<code>protected Set<Value.Immutable<?>> api$getVanillaValues() { Set<Value.Immutable<?>> vanillaValues = super.api$getVanillaValues(); <START> vanillaValues.add(this.angry().asImmutable()); <END> vanillaValues.add(this.collarColor().asImmutable()); return vanillaValues; }</code><technical_language>Do sitting key for wolves? IF a key, can: suggestion vanillaValues.add(this.angry().asImmutable()); this.getValue(Keys.WOLF_SITTING).map(Value::asImmutable).ifPresent(vanillaValues::add);</technical_language>

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = super.api$getVanillaValues(); values.add(this.sitting().asImmutable()); values.add(this.angry().asImmutable()); values.add(this.collarColor().asImmutable()); values.add(this.beggingForFood().asImmutable()); return values; }
Source:
<code>protected static void leech(Card card, Activity activity) { if (activity != null) { Resources res = activity.getResources(); final String leechMessage; if (card.getQueue() < 0) { leechMessage = res.getString(R.string.leech_suspend_notification); } else { leechMessage = res.getString(R.string.leech_notification); } activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(activity, leechMessage, Toast.LENGTH_SHORT).show(); } }); } else { <START> Timber.e("LeechHook :: could not show leech toast as activity was null"); <END> } }</code><technical_language>Ideally leave in a separate commit a functionality change - issue for some time. suggestion Timber.w("LeechHook :: show leech toast activity null");</technical_language>

Target:
protected static void leech(Card card, Activity activity) { if (activity != null) { Resources res = activity.getResources(); final String leechMessage; if (card.getQueue() < 0) { leechMessage = res.getString(R.string.leech_suspend_notification); } else { leechMessage = res.getString(R.string.leech_notification); } activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(activity, leechMessage, Toast.LENGTH_SHORT).show(); } }); } else { Timber.w("LeechHook :: could not show leech toast as activity was null"); } }
Source:
<code>public void apply(OnlineCommandContext ctx) throws Exception { if (assignGroups != null) { if (ctx.version.lessThan(ServerVersion.VERSION_3_0_0) <START> && !ctx.version.equalTo(ServerVersion.VERSION_1_7_0)) { <END> throw new AssertionError("Option assign-groups is available since WildFly 9 or in EAP 6.4.x."); } } Operations ops = new Operations(ctx.client); Address securityRealmJaasAuthnAddress = securityRealmAddress.and("authentication", "jaas"); if (replaceExisting) { ops.removeIfExists(securityRealmJaasAuthnAddress); new Administration(ctx.client).reloadIfRequired(); } ops.add(securityRealmJaasAuthnAddress, Values.empty() .andOptional("name", name) .andOptional("assign-groups", assignGroups)); }</code><technical_language>Sorry, I forgot thing! This longer enough, VERSION_1_8_0 now. I a condition be: ctx.version.lessThan(ServerVersion.VERSION_1_7_0) || ctx.version.inRange(ServerVersion.VERSION_2_0_0, ServerVersion.VERSION_2_2_0), feel free write condition own</technical_language>

Target:
public void apply(OnlineCommandContext ctx) throws Exception { if (assignGroups != null) { if (ctx.version.lessThan(ServerVersion.VERSION_1_7_0) || ctx.version.inRange(ServerVersion.VERSION_2_0_0, ServerVersion.VERSION_2_2_0)) { throw new AssertionError("Option assign-groups is available since WildFly 9 or in EAP 6.4.x."); } } Operations ops = new Operations(ctx.client); Address securityRealmJaasAuthnAddress = securityRealmAddress.and("authentication", "jaas"); if (replaceExisting) { ops.removeIfExists(securityRealmJaasAuthnAddress); new Administration(ctx.client).reloadIfRequired(); } ops.add(securityRealmJaasAuthnAddress, Values.empty() .andOptional("name", name) .andOptional("assign-groups", assignGroups)); }
Source:
<code>public List<InputStream> getStreamingPropertyValueInputStreams(List<StreamingPropertyValue> streamingPropertyValues) { List<InputStream> results = new ArrayList<>(); for (StreamingPropertyValue streamingPropertyValue : streamingPropertyValues) { results.add(streamingPropertyValue.getInputStream()); } return results; <START> } <END></code><technical_language>This a cleaner streams. return streamingPropertyValues .stream() .map(StreamingPropertyValue::getInputStream) .collect(Collectors.toList());</technical_language>

Target:
public List<InputStream> getStreamingPropertyValueInputStreams(List<StreamingPropertyValue> streamingPropertyValues) { return streamingPropertyValues.stream() .map(StreamingPropertyValue::getInputStream) .collect(Collectors.toList()); }
Source:
<code><START> public ResultIterator iterator(String query, int fetchSize, int readTimeoutOverride) throws DatabaseEngineException { <END> try { getConnection(); Statement stmt = createSelectStatement(readTimeoutOverride); stmt.setFetchSize(fetchSize); logger.trace(query); return createResultIterator(stmt, query); } catch (final DatabaseEngineTimeoutException e) { throw e; } catch (final Exception e) { throw new DatabaseEngineException("Error querying", e); } }</code><technical_language>iterator method in AbstractDatabaseEngine this signature: public synchronized ResultIterator iterator(String query) people added more iterator methods, some of synchronized, some of not. I methods connection synchronized; this means this need synchronized, other iterator methods call this need be</technical_language>

Target:
public synchronized ResultIterator iterator(String query, int fetchSize, int readTimeoutOverride) throws DatabaseEngineException { try { getConnection(); Statement stmt = createSelectStatement(readTimeoutOverride); stmt.setFetchSize(fetchSize); logger.trace(query); return createResultIterator(stmt, query); } catch (final DatabaseEngineTimeoutException e) { throw e; } catch (final Exception e) { throw new DatabaseEngineException("Error querying", e); } }
Source:
<code>private KafkaAdminClient(AdminClientConfig config, String clientId, Time time, AdminMetadataManager metadataManager, Metrics metrics, KafkaClient client, TimeoutProcessorFactory timeoutProcessorFactory, LogContext logContext) { this.defaultTimeoutMs = config.getInt(AdminClientConfig.DEFAULT_API_TIMEOUT_MS_CONFIG); <START> this.requestTimeoutMs = Math.min(defaultTimeoutMs, config.getInt(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG)); <END> this.clientId = clientId; this.log = logContext.logger(KafkaAdminClient.class); this.time = time; this.metadataManager = metadataManager; this.metrics = metrics; this.client = client; this.runnable = new AdminClientRunnable(); String threadName = NETWORK_THREAD_PREFIX + " | " + clientId; this.thread = new KafkaThread(threadName, runnable, true); this.timeoutProcessorFactory = (timeoutProcessorFactory == null) ? new TimeoutProcessorFactory() : timeoutProcessorFactory; this.maxRetries = config.getInt(AdminClientConfig.RETRIES_CONFIG); this.retryBackoffMs = config.getLong(AdminClientConfig.RETRY_BACKOFF_MS_CONFIG); config.logUnused(); AppInfoParser.registerAppInfo(JMX_PREFIX, clientId, metrics, time.milliseconds()); log.debug("Kafka admin client initialized"); thread.start(); }</code><technical_language>options raise error user adjust of configurations. default.api.timeout.ms is a new configuration, is a user explicitly provided a request.timeout.ms conflicts default default.api.timeout.ms. I logic following: 1. If a default.api.timeout.ms explicitly specified, raise error if conflicts request.timeout.ms. 2. If default.api.timeout.ms configured, set max of default request.timeout.ms. log a warning. 3. Otherwise, provided values for configurations</technical_language>

Target:
private KafkaAdminClient(AdminClientConfig config, String clientId, Time time, AdminMetadataManager metadataManager, Metrics metrics, KafkaClient client, TimeoutProcessorFactory timeoutProcessorFactory, LogContext logContext) { this.clientId = clientId; this.log = logContext.logger(KafkaAdminClient.class); configureDefaultApiTimeoutMsAndRequestTimeoutMs(config); this.time = time; this.metadataManager = metadataManager; this.metrics = metrics; this.client = client; this.runnable = new AdminClientRunnable(); String threadName = NETWORK_THREAD_PREFIX + " | " + clientId; this.thread = new KafkaThread(threadName, runnable, true); this.timeoutProcessorFactory = (timeoutProcessorFactory == null) ? new TimeoutProcessorFactory() : timeoutProcessorFactory; this.maxRetries = config.getInt(AdminClientConfig.RETRIES_CONFIG); this.retryBackoffMs = config.getLong(AdminClientConfig.RETRY_BACKOFF_MS_CONFIG); config.logUnused(); AppInfoParser.registerAppInfo(JMX_PREFIX, clientId, metrics, time.milliseconds()); log.debug("Kafka admin client initialized"); thread.start(); }
Source:
<code>public void setAttributes(PerunSession sess, Facility facility, List<Attribute> attributes) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { List<Attribute> attributesToRemove = new ArrayList<>(); List<Attribute> attributesToSet = new ArrayList<>(); convertEmptyAttrValueToNull(attributes); for (Attribute attribute : attributes) { if (attribute.getValue() == null) { attributesToRemove.add(attribute); } else { attributesToSet.add(attribute); } } removeAttributes(sess, facility, attributesToRemove); for (Attribute attribute : attributesToSet) { if (!isCoreAttribute(sess, attribute)) { if (isVirtAttribute(sess, attribute)) { throw new InternalErrorException("Virtual attribute can't be set this way yet. Please set physical attribute."); } else { setAttributeWithoutCheck(sess, facility, attribute); } } } <START> checkAttributesSyntax(sess, facility, attributesToSet); <END> checkAttributesSemantics(sess, facility, attributesToSet); log.debug("IMPORTANT: ENTERING CHECK ATTRIBUTES DEPENDENCIES"); checkAttributesDependencies(sess, facility, null, attributesToSet); log.debug("IMPORTANT: EXITING CHECK ATTRIBUTES DEPENDENCIES"); }</code><technical_language>@balcirakpeter noted, perform check syntax storing attributes DB (before call setAttributeWithoutCheck()). I this applies changed methods</technical_language>

Target:
public void setAttributes(PerunSession sess, Facility facility, List<Attribute> attributes) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { List<Attribute> attributesToRemove = new ArrayList<>(); List<Attribute> attributesToSet = new ArrayList<>(); convertEmptyAttrValueToNull(attributes); for (Attribute attribute : attributes) { if (attribute.getValue() == null) { attributesToRemove.add(attribute); } else { attributesToSet.add(attribute); } } removeAttributes(sess, facility, attributesToRemove); checkAttributesSyntax(sess, facility, attributesToSet); for (Attribute attribute : attributesToSet) { if (!isCoreAttribute(sess, attribute)) { if (isVirtAttribute(sess, attribute)) { throw new InternalErrorException("Virtual attribute can't be set this way yet. Please set physical attribute."); } else { setAttributeWithoutCheck(sess, facility, attribute); } } } checkAttributesSemantics(sess, facility, attributesToSet); checkAttributesDependencies(sess, facility, null, attributesToSet); }
Source:
<code>public void queue( TileCanvasViewGroup viewGroup, LinkedList<Tile> tiles ) { if( tiles != null && tiles.size() > 0) { mViewGroup = new WeakReference<>( viewGroup ); viewGroup.onRenderTaskPreExecute(); int size = tiles.size(); <START> for( int i = 0 ; i < size ; i++ ) { <END> mFutureList.add( mExecutor.submit( new TileRenderRunnable( viewGroup, tiles.get( i ) ) ) ); } } }</code><technical_language>reason for( Title tile : tiles ) { here? I a LinkedList a more efficient iteration (since LinkedList.get(index) is O(n))</technical_language>

Target:
public void queue( TileCanvasViewGroup viewGroup, LinkedList<Tile> tiles ) { if( tiles != null && tiles.size() > 0) { mViewGroup = new WeakReference<>( viewGroup ); viewGroup.onRenderTaskPreExecute(); for ( Tile tile : tiles ){ mFutureList.add( mExecutor.submit( new TileRenderRunnable( viewGroup, tile ) ) ); } } }
Source:
<code>public void setManagementNetwork(String managementNetwork) { <START> this._managementNetwork = managementNetwork; <END> }</code><technical_language>do need "this."</technical_language>

Target:
public void setManagementNetwork(String managementNetwork) { _managementNetwork = managementNetwork; }
Source:
<code>public void testGeneralMeasurementEventsBroadcast() throws Exception { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_0>")); i.putExtra("foo", "bar"); ArrayList<String> arr = new ArrayList<String>(); arr.add("foo2"); arr.add("bar2"); i.putExtra("foobar", arr); Map<String, String> other = new HashMap<String, String>(); other.put("yetAnotherFoo", "yetAnotherBar"); final String[] receivedStrings = new String[5]; LocalBroadcastManager manager = LocalBroadcastManager.getInstance(getInstrumentation().getTargetContext()); manager.registerReceiver( new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String eventName = intent.getStringExtra("event_name"); Bundle eventArgs = intent.getBundleExtra("event_args"); receivedStrings[0] = eventName; receivedStrings[1] = eventArgs.getString("foo"); receivedStrings[2] = eventArgs.getString("foobar"); receivedStrings[3] = eventArgs.getString("yetAnotherFoo"); receivedStrings[4] = eventArgs.getString("intentData"); <START> } <END> }, new IntentFilter("com.parse.bolts.measurement_event") ); MeasurementEvent.sendEventBroadcast(getInstrumentation().getTargetContext(), "myEventName", i, other); CountDownLatch lock = new CountDownLatch(1); lock.await(2000, TimeUnit.MILLISECONDS); assertEquals("myEventName", receivedStrings[0]); assertEquals("bar", receivedStrings[1]); assertEquals((new JSONArray(arr)).toString(), receivedStrings[2]); assertEquals("yetAnotherBar", receivedStrings[3]); assertEquals("<LINK_0>", receivedStrings[4]); }</code><technical_language>Is a reason lock.countDown() in here</technical_language>

Target:
public void testGeneralMeasurementEventsBroadcast() throws Exception { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_0>")); i.putExtra("foo", "bar"); ArrayList<String> arr = new ArrayList<String>(); arr.add("foo2"); arr.add("bar2"); i.putExtra("foobar", arr); Map<String, String> other = new HashMap<String, String>(); other.put("yetAnotherFoo", "yetAnotherBar"); final CountDownLatch lock = new CountDownLatch(1); final String[] receivedStrings = new String[5]; LocalBroadcastManager manager = LocalBroadcastManager.getInstance(getInstrumentation().getTargetContext()); manager.registerReceiver( new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String eventName = intent.getStringExtra("event_name"); Bundle eventArgs = intent.getBundleExtra("event_args"); receivedStrings[0] = eventName; receivedStrings[1] = eventArgs.getString("foo"); receivedStrings[2] = eventArgs.getString("foobar"); receivedStrings[3] = eventArgs.getString("yetAnotherFoo"); receivedStrings[4] = eventArgs.getString("intentData"); lock.countDown(); } }, new IntentFilter("com.parse.bolts.measurement_event") ); MeasurementEvent.sendBroadcastEvent(getInstrumentation().getTargetContext(), "myEventName", i, other); lock.await(2000, TimeUnit.MILLISECONDS); assertEquals("myEventName", receivedStrings[0]); assertEquals("bar", receivedStrings[1]); assertEquals((new JSONArray(arr)).toString(), receivedStrings[2]); assertEquals("yetAnotherBar", receivedStrings[3]); assertEquals("<LINK_0>", receivedStrings[4]); }
Source:
<code>public void delete_Map() { InteractiveMapPageObject iMap = base.openInteractiveMapById(wikiURL, Integer.parseInt(mapID)); DeleteAMapComponentObject deleteMapModal = iMap.deleteMap(); <START> deleteMapModal.deleteMap(); <END> }</code><technical_language>please consider verifying if map is deleted is important, I is a test, hard detect in future if this method is broken</technical_language>

Target:
public void delete_Map() { createdMap = base.openInteractiveMapById(wikiURL, Integer.parseInt(mapID)); DeleteAMapComponentObject deleteMapModal = createdMap.deleteMap(); InteractiveMapsPageObject specialMaps = deleteMapModal.deleteMap(); specialMaps.verifyEmptyState(); }
Source:
<code>private void addAsset() { Asset a = new Asset(); EditAssetDialog ead = new EditAssetDialog(frame, a); ead.setTitle(resourceMap.getString("addAssetDialogTitle.text")); ead.setVisible(true); if(!ead.wasCancelled()) { <START> ead.dispose(); <END> campaign.getFinances().getAllAssets().add(a); MekHQ.triggerEvent(new AssetNewEvent(a)); refreshTable(); } }</code><technical_language>if this is cancelled disposed</technical_language>

Target:
private void addAsset() { Asset a = new Asset(); EditAssetDialog ead = new EditAssetDialog(frame, a); ead.setTitle(resourceMap.getString("addAssetDialogTitle.text")); ead.setVisible(true); if(!ead.wasCancelled()) { campaign.getFinances().getAllAssets().add(a); MekHQ.triggerEvent(new AssetNewEvent(a)); refreshTable(); } ead.dispose(); }
Source:
<code>private static void writePcm32bitFloat(int val, ByteBuffer buffer) { float convVal = (float) (PCM_INT32_FLOAT * val); int bits = Float.floatToIntBits(convVal); if (bits == 0x7fc00000) bits = Float.floatToIntBits((float) 0.0); buffer.put((byte) (bits & 0xff)); buffer.put((byte) ((bits >> 8) & 0xff)); buffer.put((byte) ((bits >> 16) & 0xff)); <START> buffer.put((byte) ((bits >> 24) & 0xff)); <END> }</code><technical_language>buffer.putLong(bits) work here</technical_language>

Target:
private static void writePcm32bitFloat(int val, ByteBuffer buffer) { float convVal = (float) (PCM_INT32_FLOAT * val); int bits = Float.floatToIntBits(convVal); if (bits == 0x7fc00000) bits = Float.floatToIntBits((float) 0.0); buffer.putInt(bits); }
Source:
<code>public String getStringOfMaxLength(int maxlen) { LinkedHashMap<String, String> words = new LinkedHashMap<String,String>(); words.putAll(wordsByIdInOrder); int length = 0; for (String w: words.values()) { <START> if (w!=null && w.length()>0) { <END> length += w.length(); if (separator!=null) length += separator.length(); } } if (separator!=null && length>0) length -= separator.length(); List<ShorteningRule> rulesLeft = new ArrayList<ShorteningRule>(); rulesLeft.addAll(rules); while (length > maxlen && !rulesLeft.isEmpty()) { ShorteningRule r = rulesLeft.remove(0); length = r.apply(words, maxlen, length); } StringBuilder sb = new StringBuilder(); for (String w: words.values()) { if (w!=null && w.length()>0) { if (separator!=null && sb.length()>0) sb.append(separator); sb.append(w); } } String result = sb.toString(); if (result.length() > maxlen) result = result.substring(0, maxlen); return result; }</code><technical_language>!Strings.isBlank()</technical_language>

Target:
public String getStringOfMaxLength(int maxlen) { LinkedHashMap<String, String> words = new LinkedHashMap<String,String>(); words.putAll(wordsByIdInOrder); int length = 0; for (String w: words.values()) { if (!Strings.isBlank(w)) { length += w.length(); if (separator!=null) length += separator.length(); } } if (separator!=null && length>0) length -= separator.length(); List<ShorteningRule> rulesLeft = new ArrayList<ShorteningRule>(); rulesLeft.addAll(rules); while (length > maxlen && !rulesLeft.isEmpty()) { ShorteningRule r = rulesLeft.remove(0); length = r.apply(words, maxlen, length); } StringBuilder sb = new StringBuilder(); for (String w: words.values()) { if (!Strings.isBlank(w)) { if (separator!=null && sb.length()>0) sb.append(separator); sb.append(w); } } String result = sb.toString(); if (result.length() > maxlen) result = result.substring(0, maxlen); return result; }
Source:
<code>private String performLogin(ICluster cluster, IAccount account) { if (null != provider) { LoginResponse response = provider.login(cluster, account); if (null != response) { if (null == account) { <START> String id = OSIOUtils.decodeEmailFromToken(response.getAccessToken()); <END> IAccount newAccount = cluster.createAccount(id); updateAccount(response, newAccount); cluster.addAccount(newAccount); return newAccount.getAccessToken(); } else { updateAccount(response, account); } return account.getAccessToken(); } else { throw new OpenshiftIOLoginException(cluster, account); } } else { throw new OpenshiftIOConfigurationException("No login provider found"); } }</code><technical_language>extract l109-112 private IAccount createAccount(response, cluster)</technical_language>

Target:
private String performLogin(ICluster cluster, IAccount account) { if (null != provider) { LoginResponse response = provider.login(cluster, account); if (null != response) { if (null == account) { IAccount newAccount = createAccount(cluster, response); return newAccount.getAccessToken(); } else { updateAccount(response, account); } return account.getAccessToken(); } else { throw new OpenshiftIOLoginException(cluster, account); } } else { throw new OpenshiftIOConfigurationException("No login provider found"); } }
Source:
<code>public Factory(List<Supplier<LookupSource>> partitions) { this.lookupSources = partitions.stream() .map(Supplier::get) .toArray(LookupSource[]::new); visitedPositions = Arrays.stream(this.lookupSources) <START> .map(s -> toIntExact(s.getJoinPositionCount())) <END> .map(boolean[]::new) .toArray(boolean[][]::new); }</code><technical_language>nit: add .map(Math::toIntExact) instead :)</technical_language>

Target:
public Factory(List<Supplier<LookupSource>> partitions) { this.lookupSources = partitions.stream() .map(Supplier::get) .toArray(LookupSource[]::new); visitedPositions = Arrays.stream(this.lookupSources) .map(LookupSource::getJoinPositionCount) .map(Math::toIntExact) .map(boolean[]::new) .toArray(boolean[][]::new); }
Source:
<code>public List<AffinityGroup> mapAffinityGroups(Map<String, String> affinityGroupMap, List<AffinityGroup> affinityGroupsFromParam, Guid vmId) { if (affinityGroupsFromParam == null) { return Collections.emptyList(); } List<AffinityGroup> affinityGroups = new ArrayList<>(); affinityGroupsFromParam.forEach(affinityGroup -> { <START> log.info("Mapping affinity group '{}/{} for vm '{}'.", affinityGroup.getId(), affinityGroup.getName(), <END> vmId); AffinityGroup affGroup = getRelatedEntity(affinityGroupMap, affinityGroup.getName(), val -> affinityGroupDao.getByName((String) val)); if (affGroup != null) { Set<Guid> vmIds = new HashSet<>(affGroup.getVmIds()); vmIds.add(vmId); affGroup.setVmIds(new ArrayList<>(vmIds)); affinityGroups.add(affGroup); } }); return affinityGroups; }</code><technical_language>Lets add mapping for destination map</technical_language>

Target:
public List<AffinityGroup> mapAffinityGroups(Map<String, String> affinityGroupMap, List<AffinityGroup> affinityGroupsFromParam, Guid vmId) { if (affinityGroupsFromParam == null) { return Collections.emptyList(); } List<AffinityGroup> affinityGroups = new ArrayList<>(); affinityGroupsFromParam.forEach(affinityGroup -> { AffinityGroup affGroup = getRelatedEntity(affinityGroupMap, affinityGroup.getName(), val -> affinityGroupDao.getByName((String) val)); if (affGroup != null) { log.info("Mapping affinity group '{}'/'{}', to '{}' for vm '{}'.", affinityGroup.getId(), affinityGroup.getName(), affGroup.getName(), vmId); Set<Guid> vmIds = new HashSet<>(affGroup.getVmIds()); vmIds.add(vmId); affGroup.setVmIds(new ArrayList<>(vmIds)); affinityGroups.add(affGroup); } }); return affinityGroups; }
Source:
<code>public Boolean ternaryEquals( AnyValue other ) { if ( other == null || other == NO_VALUE ) { return null; } <START> if ( other instanceof SequenceValue && this.isSequenceValue() ) <END> { return ((SequenceValue) this).ternaryEquality( (SequenceValue) other ); } if ( other instanceof Value && ((Value) other).valueGroup() == valueGroup() ) { Value otherValue = (Value) other; if ( this.isNaN() || otherValue.isNaN() ) { return null; } return equals( otherValue ); } return false; }</code><technical_language>Inconsistent check for this other</technical_language>

Target:
public Boolean ternaryEquals( AnyValue other ) { if ( other == null || other == NO_VALUE ) { return null; } if ( other.isSequenceValue() && this.isSequenceValue() ) { return ((SequenceValue) this).ternaryEquality( (SequenceValue) other ); } if ( other instanceof Value && ((Value) other).valueGroup() == valueGroup() ) { Value otherValue = (Value) other; if ( this.isNaN() || otherValue.isNaN() ) { return null; } return equals( otherValue ); } return false; }
Source:
<code>public void testQuotedColumnName() { MessageType schema = MessageTypeParser.parseMessageType( "message Document {\n" + " required group foo {\n" + " required int64 `bar?@`;\n" + " }\n" + "}\n"); GroupFactory gf = new SimpleGroupFactory(schema); Group g1 = gf.newGroup(); g1.addGroup("foo").append("bar?@", 2l); <START> testSchema(schema, Arrays.asList(g1)); <END> }</code><technical_language>fail quotes</technical_language>

Target:
public void testQuotedColumnName() { MessageType schema = MessageTypeParser.parseMessageType( "message Document {\n" + " required group foo {\n" + " required int64 bar?@;\n" + " required int64 `foo bar`;\n" + " }\n" + "}\n"); GroupFactory gf = new SimpleGroupFactory(schema); Group g1 = gf.newGroup(); g1.addGroup("foo").append("bar?@", 2l).append("foo bar", 3l); testSchema(schema, Arrays.asList(g1)); }
Source:
<code>List<ICommitMessageProvider> getCommitMessageProviders() { List<ICommitMessageProvider> foundProviders = new ArrayList<>(); <START> IExtensionRegistry registry = Platform.getExtensionRegistry(); <END> IConfigurationElement[] configs = registry .getConfigurationElementsFor(COMMIT_MESSAGE_PROVIDER_ID); for (IConfigurationElement config : configs) { Object provider; String contributorName = "<unknown>"; String extensionId = "<unknown>"; try { extensionId = config.getDeclaringExtension() .getUniqueIdentifier(); contributorName = config.getContributor().getName(); provider = config.createExecutableExtension("class"); if (provider instanceof ICommitMessageProvider) { foundProviders.add((ICommitMessageProvider) provider); } else { Activator.logError( MessageFormat.format( UIText.CommitDialog_WrongTypeOfCommitMessageProvider, extensionId, contributorName), null); } } catch (CoreException | RuntimeException e) { Activator .logError( MessageFormat.format( UIText.CommitDialog_ErrorCreatingCommitMessageProvider, extensionId, contributorName), e); } } return foundProviders; }</code><technical_language>this inlined registry is</technical_language>

Target:
List<ICommitMessageProvider> getCommitMessageProviders() { List<ICommitMessageProvider> providers = new ArrayList<>(); IConfigurationElement[] configs = Platform.getExtensionRegistry() .getConfigurationElementsFor(COMMIT_MESSAGE_PROVIDER_ID); for (IConfigurationElement config : configs) { Object provider; String contributorName = "<unknown>"; String extensionId = "<unknown>"; try { extensionId = config.getDeclaringExtension() .getUniqueIdentifier(); contributorName = config.getContributor().getName(); provider = config.createExecutableExtension("class"); if (provider instanceof ICommitMessageProvider) { providers.add((ICommitMessageProvider) provider); } else { Activator.logError( MessageFormat.format( UIText.CommitDialog_WrongTypeOfCommitMessageProvider, extensionId, contributorName), null); } } catch (CoreException | RuntimeException e) { Activator .logError( MessageFormat.format( UIText.CommitDialog_ErrorCreatingCommitMessageProvider, extensionId, contributorName), e); } } return providers; }
Source:
<code>private boolean removeLeaseIfNeeded() { Guid leaseDomainIdToRemove = null; if (isRemoveLeaseNeeded(activeBeforeSnapshotLeaseDomainId, previewedSnapshotLeaseDomainId)) { leaseDomainIdToRemove = getParameters().getSnapshotAction() == SnapshotActionEnum.UNDO ? previewedSnapshotLeaseDomainId : activeBeforeSnapshotLeaseDomainId; } else if (getParameters().getSnapshotAction() == SnapshotActionEnum.RESTORE_STATELESS && previewedSnapshotLeaseDomainId != null) { <START> leaseDomainIdToRemove = previewedSnapshotLeaseDomainId; <END> } return leaseDomainIdToRemove == null || removeVmLease(leaseDomainIdToRemove, getVmId()); }</code><technical_language>need check !activeBeforeSnapshotLeaseDomainId.equals(previewedSnapshotLeaseDomainId) ? adding case isRemoveLeaseNeeded method</technical_language>

Target:
private boolean removeLeaseIfNeeded() { if (isRemoveLeaseNeeded(activeBeforeSnapshotLeaseDomainId, previewedSnapshotLeaseDomainId)) { Guid leaseDomainIdToRemove = getParameters().getSnapshotAction() == SnapshotActionEnum.COMMIT ? activeBeforeSnapshotLeaseDomainId : previewedSnapshotLeaseDomainId; if (!removeVmLease(leaseDomainIdToRemove, getVmId())) { return false; } } return true; }
Source:
<code>public String toString() { return <START> String.format("vmId <END> = %s, status = %s", getVmId(), getStatus()); }</code><technical_language>want put exit status well??</technical_language>

Target:
public String toString() { return String.format("vmId = %s, status = %s, exit status = %s", getVmId(), getStatus(), getExitStatus()); }
Source:
<code>public T decode(byte[] data) { ByteArrayInputStream bis = new ByteArrayInputStream(data); ObjectInput in = null; try { in = new ObjectInputStream(bis); return (T) in.readObject(); } catch (IOException | ClassNotFoundException e) { throw new IllegalArgumentException(e); <START> } finally { <END> try { if (in != null) { in.close(); } } catch (IOException ex) { } } }</code><technical_language>I guess this (and finally/close) simplified try-with-resources</technical_language>

Target:
public T decode(byte[] data) { ByteArrayInputStream bis = new ByteArrayInputStream(data); ObjectInput in = null; try { in = new ObjectInputStream(bis); return (T) in.readObject(); } catch (IOException | ClassNotFoundException e) { throw new IllegalArgumentException(e); } finally { try { if (in != null) { in.close(); } bis.close(); } catch (IOException ex) { } } }
Source:
<code>public Set<String> getJWTExcludedClaims() { <START> return jwtAdditionalClaims; <END> }</code><technical_language>rename this too</technical_language>

Target:
public Set<String> getJWTExcludedClaims() { return jwtExcludedClaims; }
Source:
<code>protected boolean isOrUnionReplacementEnabled() { String orUnionReplacement = System.getProperty("app-schema.orUnionReplace"); <START> return (!"false".equalsIgnoreCase(orUnionReplacement)); <END> }</code><technical_language>This property shoudl handled other App-Schema (configuration) properties handled: [here](<LINK_0> [here](<LINK_1></technical_language>

Target:
protected boolean isOrUnionReplacementEnabled() { return AppSchemaDataAccessConfigurator.isOrUnionReplacementEnabled(); }
Source:
<code><START> protected <Z extends ScesimDataWithIndex> List<Z> toScesimDataWithIndex(BiFunction<Integer, T, Z> producer) { <END> List<Z> toReturn = new ArrayList<>(); List<T> data = getUnmodifiableData(); for (int index = 0; index < data.size(); index += 1) { toReturn.add(producer.apply(index + 1, data.get(index))); } return toReturn; }</code><technical_language>@danielezonca I <Z extends ScesimDataWithIndex<T>></technical_language>

Target:
protected <Z extends ScesimDataWithIndex<T>> List<Z> toScesimDataWithIndex(BiFunction<Integer, T, Z> producer) { List<Z> toReturn = new ArrayList<>(); List<T> data = getUnmodifiableData(); for (int index = 0; index < data.size(); index += 1) { toReturn.add(producer.apply(index + 1, data.get(index))); } return toReturn; }
Source:
<code>public static <T> T buildInterface(Class<T> clazz, Context context, boolean perPageQueryParam) { RestAdapter restAdapter = CanvasRestAdapter.buildAdapter(context, perPageQueryParam); <START> restAdapter.setLogLevel(RestAdapter.LogLevel.FULL); <END> return restAdapter.create(clazz); }</code><technical_language>in prod, way</technical_language>

Target:
public static <T> T buildInterface(Class<T> clazz, Context context, boolean perPageQueryParam) { RestAdapter restAdapter = CanvasRestAdapter.buildAdapter(context, perPageQueryParam); restAdapter.setLogLevel(LOG_LEVEL); return restAdapter.create(clazz); }
Source:
<code>public InstanceProperties setWaitDuration(Duration waitDuration) { Objects.requireNonNull(waitDuration); if (waitDuration.toMillis() < 0) { throw new IllegalArgumentException( <START> "waitDurationInOpenStateMillis must be a positive value"); <END> } this.waitDuration = waitDuration; return this; }</code><technical_language>please change waitDurationInOpenStateMillis waitDuration</technical_language>

Target:
public InstanceProperties setWaitDuration(Duration waitDuration) { Objects.requireNonNull(waitDuration); if (waitDuration.toMillis() < 0) { throw new IllegalArgumentException( "waitDuration must be a positive value"); } this.waitDuration = waitDuration; return this; }
Source:
<code>public int parseArguments(final Parameters params) throws CmdLineException { final String name = params.getParameter(0); if (new File(name).isDirectory()) { setter.addValue(new FileTreeIterator(new File(name))); return 1; } if (new File(name).isFile()) { final DirCache dirc; try { dirc = DirCache.read(new File(name)); } catch (IOException e) { throw new CmdLineException(MessageFormat.format(CLIText.get().notAnIndexFile, name), e); } setter.addValue(new DirCacheIterator(dirc)); return 1; } final ObjectId id; try { id = clp.getRepository().resolve(name); } catch (IOException e) { throw new CmdLineException(e.getMessage()); } if (id == null) throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); final CanonicalTreeParser p = new CanonicalTreeParser(); final WindowCursor curs = new WindowCursor(); try { p.reset(clp.getRepository(), clp.getRevWalk().parseTree(id), curs); } catch (MissingObjectException e) { throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); } catch (IncorrectObjectTypeException e) { throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); } catch (IOException e) { throw new CmdLineException(MessageFormat.format(CLIText.get().cannotRead, name) <START> + ": " + e.getMessage()); <END> } finally { curs.release(); } setter.addValue(p); return 1; }</code><technical_language>move ":" + e.getMessage() translation to. (e.getMessage() a parameter)</technical_language>

Target:
public int parseArguments(final Parameters params) throws CmdLineException { final String name = params.getParameter(0); if (new File(name).isDirectory()) { setter.addValue(new FileTreeIterator(new File(name))); return 1; } if (new File(name).isFile()) { final DirCache dirc; try { dirc = DirCache.read(new File(name)); } catch (IOException e) { throw new CmdLineException(MessageFormat.format(CLIText.get().notAnIndexFile, name), e); } setter.addValue(new DirCacheIterator(dirc)); return 1; } final ObjectId id; try { id = clp.getRepository().resolve(name); } catch (IOException e) { throw new CmdLineException(e.getMessage()); } if (id == null) throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); final CanonicalTreeParser p = new CanonicalTreeParser(); final WindowCursor curs = new WindowCursor(); try { p.reset(clp.getRepository(), clp.getRevWalk().parseTree(id), curs); } catch (MissingObjectException e) { throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); } catch (IncorrectObjectTypeException e) { throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); } catch (IOException e) { throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage())); } finally { curs.release(); } setter.addValue(p); return 1; }
Source:
<code>static <K, V> AssertsNearCache<K, V> create(Cache<byte[], ?> server, ConfigurationBuilder builder) { final BlockingQueue<MockEvent> events = new ArrayBlockingQueue<>(128); AtomicReference<NearCacheService<K, V>> nearCacheServiceAtomicReference = new AtomicReference<>(); RemoteCacheManager manager = new RemoteCacheManager(builder.build()) { @Override protected <KK, VV> NearCacheService<KK, VV> createNearCacheService(String cacheName, NearCacheConfiguration cfg) { MockNearCacheService nearCacheService = new MockNearCacheService<>(cfg, events, listenerNotifier); <START> nearCacheServiceAtomicReference.set(nearCacheService); <END> return nearCacheService; } }; return new AssertsNearCache<K, V>(manager, server, events, nearCacheServiceAtomicReference); }</code><technical_language>MockNearCacheService name is a bit confusing: if cache is a mock test size/contents all</technical_language>

Target:
static <K, V> AssertsNearCache<K, V> create(Cache<byte[], ?> server, ConfigurationBuilder builder) { final BlockingQueue<MockEvent> events = new ArrayBlockingQueue<>(128); AtomicReference<NearCacheService<K, V>> nearCacheServiceRef = new AtomicReference<>(); RemoteCacheManager manager = new RemoteCacheManager(builder.build()) { @Override protected <KK, VV> NearCacheService<KK, VV> createNearCacheService(String cacheName, NearCacheConfiguration cfg) { MockNearCacheService nearCacheService = new MockNearCacheService<>(cfg, events, listenerNotifier); nearCacheServiceRef.set(nearCacheService); return nearCacheService; } }; return new AssertsNearCache<K, V>(manager, server, events, nearCacheServiceRef); }