auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_dds_text_field_formatting); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull MapboxMap mapboxMap) { mapboxMap.setStyle(Style.DARK, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull final Style style) { Toast.makeText(TextFieldFormattingActivity.this, getString(R.string.instruction_toast), Toast.LENGTH_SHORT).show(); FloatingActionButton textFontFab = findViewById(R.id.fab_toggle_font); textFontFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(style, textFont(fontChanged ? new String[] {textFonts[1]} : new String[] {textFonts[0]})); fontChanged = !fontChanged; } }); FloatingActionButton textSizeFab = findViewById(R.id.fab_toggle_text_size); textSizeFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(style, textSize(sizeChanged ? textSizes[1] : textSizes[0])); sizeChanged = !sizeChanged; } }); FloatingActionButton textColorFab = findViewById(R.id.fab_toggle_text_color); textColorFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(style, textColor(colorChanged ? textColors[1] : textColors[0])); colorChanged = !colorChanged; } <START> }); <END> } }); } }); }</code><technical_language>refactor statements, similar functionality. Additionally assigning setting click listener done in line instead</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_dds_text_field_formatting); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.DARK, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull final Style style) { TextFieldFormattingActivity.this.mapboxMap = mapboxMap; Toast.makeText(TextFieldFormattingActivity.this, getString(R.string.instruction_toast), Toast.LENGTH_SHORT).show(); findViewById(R.id.fab_toggle_font).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(textFont(fontChanged ? new String[] {textFonts[1]} : new String[] {textFonts[0]})); fontChanged = !fontChanged; } }); findViewById(R.id.fab_toggle_text_size).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(textSize(sizeChanged ? textSizes[1] : textSizes[0])); sizeChanged = !sizeChanged; } }); findViewById(R.id.fab_toggle_text_color).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(textColor(colorChanged ? textColors[1] : textColors[0])); colorChanged = !colorChanged; } }); } }); } }); }
Source:
<code>public AggregationDataStoreTransaction(QueryEngine queryEngine, Cache cache, QueryLogger queryLogger) { this.queryEngine = queryEngine; this.cache = cache; this.queryEngineTransaction = queryEngine.beginTransaction(); this.queryLogger = queryLogger; <START> this.metaDataStore = queryEngine.metaDataStore; <END> }</code><technical_language>getter method for metaDataStore incase move classes in packages ? do require add metaDataStore private member</technical_language>

Target:
public AggregationDataStoreTransaction(QueryEngine queryEngine, Cache cache, QueryLogger queryLogger) { this.queryEngine = queryEngine; this.cache = cache; this.queryEngineTransaction = queryEngine.beginTransaction(); this.queryLogger = queryLogger; this.metaDataStore = queryEngine.getMetaDataStore(); }
Source:
<code>public ServerOAuth2AuthorizedClientExchangeFilterFunction(ReactiveOAuth2AuthorizedClientManager authorizedClientManager) { Assert.notNull(authorizedClientManager, "authorizedClientManager cannot be null"); this.authorizedClientManager = authorizedClientManager; <START> this.responseHandler = createDefaultResponseHandler(authorizedClientManager); <END> }</code><technical_language>@philsttr giving this some thought I agree easier for users leverage existing basic (default) implementation. provide 2 implementations: SaveAuthorizedClientReactiveOAuth2AuthorizationSuccessHandler RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler. public outer classes requiring component. For example, DefaultReactiveOAuth2AuthorizedClientManager AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager instantiate default handlers. A setter exposed for handler getter. apply changes ServerOAuth2AuthorizedClientExchangeFilterFunction well. For SaveAuthorizedClientReactiveOAuth2AuthorizationSuccessHandler, provide 2 constructors - accepts ServerOAuth2AuthorizedClientRepository other accepts ReactiveOAuth2AuthorizedClientService. thoughts</technical_language>

Target:
public ServerOAuth2AuthorizedClientExchangeFilterFunction(ReactiveOAuth2AuthorizedClientManager authorizedClientManager) { Assert.notNull(authorizedClientManager, "authorizedClientManager cannot be null"); this.authorizedClientManager = authorizedClientManager; this.clientResponseHandler = (request, responseMono) -> responseMono; }
Source:
<code>public void contextEstablished(final Exchange exchange) { Request currentRequest = exchange.getCurrentRequest(); Request request = exchange.getRequest(); <START> if (request == currentRequest && request != null && request.isObserve()) { <END> observationStore.setContext(request.getToken(), exchange.getCorrelationContext()); } KeyToken token = KeyToken.fromOutboundMessage(currentRequest); exchangeStore.setContext(token, exchange.getCorrelationContext()); }</code><technical_language>check request == currentRequest. This for blockwise transfer. For block2 ok this avoid set context for block2 request. For block1 this means correlation context set request completely sent. I this is a problem. I want set correlation soon possible. avoid call contextEstablished if correlation context is set changed ? I in Exchange : java public void setCorrelationContext(final CorrelationContext ctx) { if (correlationContext != ctx) { // correlationContext != null depending behavior want correlationContext = ctx; ExchangeObserver obs = this.observer; if (obs != null) { obs.contextEstablished(this); } } }</technical_language>

Target:
public void contextEstablished(final Exchange exchange) { Request request = exchange.getRequest(); if (request != null && request.isObserve()) { observationStore.setContext(request.getToken(), exchange.getCorrelationContext()); } }
Source:
<code>public void testCreateTableNotExistsFalse() throws Exception { CreateTable statement = new CreateTable(QualifiedName.of("test_table"), ImmutableList.of(new ColumnDefinition("a", "BIGINT", Optional.empty())), false, ImmutableMap.of(), Optional.empty()); <START> try { <END> getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList())); fail("CreateTableTask should throw when notExists is set to false"); } catch (RuntimeException e) { } assertEquals(metadata.getCreateTableCallCount(), 1); }</code><technical_language>this is correct exception</technical_language>

Target:
public void testCreateTableNotExistsFalse() throws Exception { CreateTable statement = new CreateTable(QualifiedName.of("test_table"), ImmutableList.of(new ColumnDefinition("a", "BIGINT", Optional.empty())), false, ImmutableMap.of(), Optional.empty()); try { getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList())); fail("expected exception"); } catch (RuntimeException e) { assertTrue(e instanceof PrestoException); PrestoException prestoException = (PrestoException) e; assertTrue(prestoException.getErrorCode().equals(ALREADY_EXISTS.toErrorCode())); } assertEquals(metadata.getCreateTableCallCount(), 1); }
Source:
<code>public void actionPerformed(ActionEvent e) { List<Context> contexts = getContexts(); if (contexts == null) { return; } String contextList = <START> contexts.stream().map(c -> c.getName()).collect(Collectors.joining(", ")); <END> if (View.getSingleton() .showConfirmDialog( contexts.size() > 1 ? Constant.messages.getString( "context.delete.warning.multiple", contextList) : Constant.messages.getString("context.delete.warning")) == JOptionPane.OK_OPTION) { for (Context context : contexts) { Model.getSingleton().getSession().deleteContext(context); } } }</code><technical_language>\n string is long contexts lengthier names. - method reference Context::getName</technical_language>

Target:
public void actionPerformed(ActionEvent e) { List<Context> contexts = getContexts(); if (contexts.isEmpty()) { return; } String contextList = contexts.stream().map(Context::getName).collect(Collectors.joining("\n")); if (View.getSingleton() .showConfirmDialog( contexts.size() > 1 ? Constant.messages.getString( "context.delete.warning.multiple", contextList) : Constant.messages.getString("context.delete.warning")) == JOptionPane.OK_OPTION) { for (Context context : contexts) { Model.getSingleton().getSession().deleteContext(context); } } }
Source:
<code>private JarCreator(File file) throws IOException { try { <START> aos = new ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.JAR, new FileOutputStream(file)); <END> } catch (ArchiveException e) { throw new IOException(e); } }</code><technical_language>consider java.nio.file.FileSystem instead</technical_language>

Target:
private JarCreator(File file) throws IOException { jos = new JarOutputStream(new FileOutputStream(file)); }
Source:
<code>public void onProfileServiceStateChanged(ProfileService profile, int state) { if (state != BluetoothAdapter.STATE_ON && state != BluetoothAdapter.STATE_OFF) { Log.e(TAG, "onProfileServiceStateChanged: Unhandled " + BluetoothAdapter.nameForState( state)); <START> return; <END> } Message m = mHandler.obtainMessage(MESSAGE_PROFILE_SERVICE_STATE_CHANGED); m.obj = profile; m.arg1 = state; mHandler.sendMessage(m); }</code><technical_language>I crash throwing IllegalArgumentException</technical_language>

Target:
public void onProfileServiceStateChanged(ProfileService profile, int state) { if (state != BluetoothAdapter.STATE_ON && state != BluetoothAdapter.STATE_OFF) { throw new IllegalArgumentException(BluetoothAdapter.nameForState(state)); } Message m = mHandler.obtainMessage(MESSAGE_PROFILE_SERVICE_STATE_CHANGED); m.obj = profile; m.arg1 = state; mHandler.sendMessage(m); }
Source:
<code>public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null || player.getHand().count(StaticFilters.FILTER_CARD_LAND, game) < 1) { return false; } TargetCardInHand toDiscard = new TargetCardInHand(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_LAND); <START> player.chooseTarget(Outcome.Discard, toDiscard, source, game); <END> int count = player.discard(new CardsImpl(toDiscard.getTargets()), source, game).size(); if (count < 1) { return false; } Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.addCounters(CounterType.P1P1.createInstance(count), source, game); } player.drawCards(count, source.getSourceId(), game); return true; }</code><technical_language>AIDontUseIt. effect Outcome.Discard (no cards selection AI), useful find AI unsupported cards in future</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null || player.getHand().count(StaticFilters.FILTER_CARD_LAND, game) < 1) { return false; } TargetCardInHand toDiscard = new TargetCardInHand(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_LAND); player.chooseTarget(Outcome.AIDontUseIt, toDiscard, source, game); int count = player.discard(new CardsImpl(toDiscard.getTargets()), source, game).size(); if (count < 1) { return false; } Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.addCounters(CounterType.P1P1.createInstance(count), source, game); } player.drawCards(count, source.getSourceId(), game); return true; }
Source:
<code><START> public CorfuTable(IndexRegistry<K, V> indices, Map<K, V> mapImpl) { <END> indices.forEach(index -> { secondaryIndexes.put(index.getName().get(), new HashMap<>()); indexSpec.add(index); }); log.info("CorfuTable: creating CorfuTable with the following indexes: {}", secondaryIndexes.keySet().toString()); mainMap = mapImpl; }</code><technical_language>cleaner pass a type instance. <LINK_0></technical_language>

Target:
public CorfuTable(IndexRegistry<K, V> indices, Map<K, V> mapImpl) { indices.forEach(index -> { secondaryIndexes.put(index.getName().get(), new HashMap<>()); indexSpec.add(index); }); log.info("CorfuTable: creating CorfuTable with the following indexes: {}", secondaryIndexes.keySet()); mainMap = mapImpl; }
Source:
<code>protected Context doPublish(ServiceTarget target, DeploymentUnit unit) throws Exception { final Deployment deployment = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY); final List<Endpoint> endpoints = deployment.getService().getEndpoints(); if (!runningInService) { final ServiceRegistry registry = unit.getServiceRegistry(); final UninterruptibleCountDownLatch latch = new UninterruptibleCountDownLatch(endpoints.size()); final LifecycleListener listener = new LifecycleListener() { @Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.UP) latch.countDown(); } }; ServiceName serviceName; for (Endpoint ep : endpoints) { serviceName = EndpointService.getServiceName(unit, ep.getShortName()); registry.getRequiredService(serviceName).addListener(listener); } latch.awaitUninterruptibly(); <START> } <END> deployment.addAttachment(WebDeploymentController.class, startWebApp(host, unit)); return new Context(unit.getAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY).getContextRoot(), endpoints); }</code><technical_language>this lifecycle listener removed in a finally block</technical_language>

Target:
protected Context doPublish(ServiceTarget target, DeploymentUnit unit) throws Exception { final Deployment deployment = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY); final List<Endpoint> endpoints = deployment.getService().getEndpoints(); if (!runningInService) { final ServiceRegistry registry = unit.getServiceRegistry(); final CountDownLatch latch = new CountDownLatch(endpoints.size()); final LifecycleListener listener = new LifecycleListener() { @Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.UP) { latch.countDown(); controller.removeListener(this); } } }; ServiceName serviceName; for (Endpoint ep : endpoints) { serviceName = EndpointService.getServiceName(unit, ep.getShortName()); registry.getRequiredService(serviceName).addListener(listener); } latch.await(); } deployment.addAttachment(WebDeploymentController.class, startWebApp(host, unit)); return new Context(unit.getAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY).getContextRoot(), endpoints); }
Source:
<code>public double getfreeDiskPercent() { int usedDiskSize = getused_disk_size() == null ? 0 : getused_disk_size(); int availableDiskSize = getavailable_disk_size() == null ? 0 : getavailable_disk_size(); double totalSize = usedDiskSize + availableDiskSize; <START> return totalSize != 0 ? (availableDiskSize / totalSize) * 100 : 0; <END> }</code><technical_language>nickpicking - if 0.0 instead of 0, save promotion int double</technical_language>

Target:
public double getfreeDiskPercent() { int usedDiskSize = getused_disk_size() == null ? 0 : getused_disk_size(); int availableDiskSize = getavailable_disk_size() == null ? 0 : getavailable_disk_size(); double totalSize = usedDiskSize + availableDiskSize; return totalSize != 0 ? (availableDiskSize / totalSize) * 100 : 0.0; }
Source:
<code>private void handleMaxRetriesExceeded(ExecutionCompletedEvent<HermesResponse> event) { if (event.getResult().isSuccess()) { return; } HermesMessage message = event.getResult().getHermesMessage(); if (shouldPublishMetrics()) { String prefix = MetricsUtils.getMetricsPrefix(message.getTopic()); metrics.counter(prefix + ".failure.unsent").inc(); } <START> LOGGER.error(MessageFormat.format("Failed to send message to topic {0} after {1} attempts", <END> message.getTopic(), event.getAttemptCount())); }</code><technical_language>Do need MessageFormat? slf4j supports parametrized logging. (<LINK_0></technical_language>

Target:
private void handleMaxRetriesExceeded(ExecutionCompletedEvent<HermesResponse> event) { if (event.getResult().isSuccess()) { return; } HermesMessage message = event.getResult().getHermesMessage(); messageDeliveryListeners.forEach(l -> l.onMaxRetriesExceeded(message, event.getAttemptCount())); logger.error("Failed to send message to topic after attempts", message.getTopic(), event.getAttemptCount()); }
Source:
<code>private Map<ICompilationUnit, ArrayList<IType>> createAffectedTypesMap(final IProgressMonitor monitor) throws JavaModelException { if ((!fCreateMethodStubs || <START> (getAbstractMethods().length <= 0))) <END> return new HashMap<>(0); final Set<IType> affected= getAffectedSubTypes(getDestinationTypeHierarchy(monitor), getDestinationType()); final Map<ICompilationUnit, ArrayList<IType>> result= new HashMap<>(); for (IType type : affected) { final ICompilationUnit unit= type.getCompilationUnit(); if (!result.containsKey(unit)) result.put(unit, new ArrayList<IType>(1)); result.get(unit).add(type); } return result; }</code><technical_language>isEmpty()</technical_language>

Target:
private Map<ICompilationUnit, ArrayList<IType>> createAffectedTypesMap(final IProgressMonitor monitor) throws JavaModelException { if (!fCreateMethodStubs || (getAbstractMethods().length <= 0)) return new HashMap<>(0); final Set<IType> affected= getAffectedSubTypes(getDestinationTypeHierarchy(monitor), getDestinationType()); final Map<ICompilationUnit, ArrayList<IType>> result= new HashMap<>(); for (IType type : affected) { final ICompilationUnit unit= type.getCompilationUnit(); if (!result.containsKey(unit)) result.put(unit, new ArrayList<IType>(1)); result.get(unit).add(type); } return result; }
Source:
<code>private void checkCurrentTaskState() throws ExecutionException, InterruptedException, TimeoutException { List<ListenableFuture<?>> futures = Lists.newArrayList(); Iterator<Map.Entry<Integer, TaskGroup>> iTaskGroups = taskGroups.entrySet().iterator(); while (iTaskGroups.hasNext()) { Map.Entry<Integer, TaskGroup> taskGroupEntry = iTaskGroups.next(); Integer groupId = taskGroupEntry.getKey(); TaskGroup taskGroup = taskGroupEntry.getValue(); log.debug("Task group [%d] pre-pruning: %s", groupId, taskGroup.taskIds()); Iterator<Map.Entry<String, TaskData>> iTasks = taskGroup.tasks.entrySet().iterator(); while (iTasks.hasNext()) { Map.Entry<String, TaskData> task = iTasks.next(); String taskId = task.getKey(); TaskData taskData = task.getValue(); if (!isTaskCurrent(groupId, taskId)) { log.info("Stopping task [%s] which does not match the expected offset range and ingestion spec", taskId); futures.add(stopTask(taskId, false)); iTasks.remove(); continue; } <START> Preconditions.checkNotNull(taskData.status, "task[%s] has a null status", taskId); <END> if (taskData.status.isFailure()) { iTasks.remove(); continue; } if (taskData.status.isSuccess()) { futures.add(stopTasksInGroup(taskGroup)); iTaskGroups.remove(); break; } } log.debug("Task group [%d] post-pruning: %s", groupId, taskGroup.taskIds()); } Futures.successfulAsList(futures).get(futureTimeoutInSeconds, TimeUnit.SECONDS); }</code><technical_language>Similar question -- this get thrown happen thrown</technical_language>

Target:
private void checkCurrentTaskState() throws ExecutionException, InterruptedException, TimeoutException { List<ListenableFuture<?>> futures = Lists.newArrayList(); Iterator<Map.Entry<Integer, TaskGroup>> iTaskGroups = taskGroups.entrySet().iterator(); while (iTaskGroups.hasNext()) { Map.Entry<Integer, TaskGroup> taskGroupEntry = iTaskGroups.next(); Integer groupId = taskGroupEntry.getKey(); TaskGroup taskGroup = taskGroupEntry.getValue(); log.debug("Task group [%d] pre-pruning: %s", groupId, taskGroup.taskIds()); Iterator<Map.Entry<String, TaskData>> iTasks = taskGroup.tasks.entrySet().iterator(); while (iTasks.hasNext()) { Map.Entry<String, TaskData> task = iTasks.next(); String taskId = task.getKey(); TaskData taskData = task.getValue(); if (!isTaskCurrent(groupId, taskId)) { log.info("Stopping task [%s] which does not match the expected offset range and ingestion spec", taskId); futures.add(stopTask(taskId, false)); iTasks.remove(); continue; } Preconditions.checkNotNull(taskData.status, "WTH? task[%s] has a null status", taskId); if (taskData.status.isFailure()) { iTasks.remove(); continue; } if (taskData.status.isSuccess()) { futures.add(stopTasksInGroup(taskGroup)); iTaskGroups.remove(); break; } } log.debug("Task group [%d] post-pruning: %s", groupId, taskGroup.taskIds()); } Futures.successfulAsList(futures).get(futureTimeoutInSeconds, TimeUnit.SECONDS); }
Source:
<code>protected View getView() { EditPart host = getHost(); if (host == null) { return null; } Object hostView = host.getModel(); if (hostView instanceof View) { <START> if (((View) getHost().getModel()) instanceof View) { <END> return (View) ((View) getHost().getModel()); } return null; } return null; }</code><technical_language>Casting View checking instanceof is highly suspicious</technical_language>

Target:
protected View getView() { EditPart host = getHost(); if (host == null) { return null; } Object hostView = host.getModel(); if (hostView instanceof View) { return (View) hostView; } return null; }
Source:
<code><START> private String convertLegacySyntaxToBooleanFormula(String input) throws OptionsParsingException { <END> return input.replaceAll(" *, *", " or ").replace("-", " not ").trim(); }</code><technical_language>need a regular expression here, remove whitespace; parser do that. return input.replace(",", " ").replace("-", " ");</technical_language>

Target:
private String convertLegacySyntaxToBooleanFormula(String input) throws OptionsParsingException { return input.replaceAll(" *, *-", " and not ") .replaceAll(" *, *", " or ") .replace("-", " not ").trim(); }
Source:
<code>public void respondWithGetAllRefunds(String transactionId, RefundTransactionFromLedgerFixture... refunds) { JsonStringBuilder jsonStringBuilder = new JsonStringBuilder() .add("parent_transaction_id", transactionId) .add("transactions", refunds); <START> System.out.println(jsonStringBuilder.build()); <END> ledgerMock.stubFor(get(urlPathEqualTo(format("/v1/transaction/%s/transaction", transactionId))) .willReturn(aResponse() .withStatus(OK_200) .withHeader(CONTENT_TYPE, APPLICATION_JSON) .withBody(jsonStringBuilder.build()))); }</code><technical_language>Do want outputting ^^</technical_language>

Target:
public void respondWithGetAllRefunds(String transactionId, RefundTransactionFromLedgerFixture... refunds) { JsonStringBuilder jsonStringBuilder = new JsonStringBuilder() .add("parent_transaction_id", transactionId) .add("transactions", refunds); ledgerMock.stubFor(get(urlPathEqualTo(format("/v1/transaction/%s/transaction", transactionId))) .willReturn(aResponse() .withStatus(OK_200) .withHeader(CONTENT_TYPE, APPLICATION_JSON) .withBody(jsonStringBuilder.build()))); }
Source:
<code>public void testDateExpressions() throws Exception { Calendar cal = Calendar.getInstance(); cal.set(1974, Calendar.APRIL, 20); exchange.getIn().setHeader("birthday", cal.getTime()); assertExpression("date:header.birthday", cal.getTime()); assertExpression("date:header.birthday:yyyyMMdd", "19740420"); <START> assertExpression("date:header.birthday+24h:yyyyMMdd", "19740421"); <END> }</code><technical_language>Please existing unit tests</technical_language>

Target:
public void testDateExpressions() throws Exception { Calendar cal = Calendar.getInstance(); cal.set(1974, Calendar.APRIL, 20); exchange.getIn().setHeader("birthday", cal.getTime()); assertExpression("date:header.birthday", cal.getTime()); assertExpression("date:header.birthday:yyyyMMdd", "19740420"); assertExpression("date:header.birthday+24h:yyyyMMdd", "19740421"); try { assertExpression("date:yyyyMMdd", "19740420"); fail("Should thrown an exception"); } catch (IllegalArgumentException e) { assertEquals("Command not supported for dateExpression: yyyyMMdd", e.getMessage()); } }
Source:
<code>private void drop(ConglomerateDescriptor cd, TableDescriptor td, DataDictionary dd, LanguageConnectionContext lcc) throws StandardException { SpliceTransactionManager userTxnManager = (SpliceTransactionManager)lcc.getTransactionExecute(); dd.dropConglomerateDescriptor(cd,userTxnManager); td.removeConglomerateDescriptor(cd); <START> dd.deletePartitionStatistics(cd.getConglomerateNumber(), userTxnManager); <END> }</code><technical_language>need broadcast ALTER_STATS messages invalidate plans based stats remove entry dictionary cache. StatisticsAdmin.ddlNotification()</technical_language>

Target:
private void drop(ConglomerateDescriptor cd, TableDescriptor td, DataDictionary dd, LanguageConnectionContext lcc) throws StandardException { SpliceTransactionManager userTxnManager = (SpliceTransactionManager)lcc.getTransactionExecute(); dd.dropConglomerateDescriptor(cd,userTxnManager); td.removeConglomerateDescriptor(cd); dd.deletePartitionStatistics(cd.getConglomerateNumber(), userTxnManager); List<TableDescriptor> tds = Collections.singletonList(td); DDLMessage.DDLChange ddlChange = ProtoUtil.alterStats(userTxnManager.getActiveStateTxn().getTxnId(), tds); userTxnManager.prepareDataDictionaryChange(DDLUtils.notifyMetadataChange(ddlChange)); }
Source:
<code>public PushResponse push(PushRequest request) throws GitException, UnauthorizedException { String remoteName = request.getRemote(); String remoteUri = getRepository().getConfig().getString(ConfigConstants.CONFIG_REMOTE_SECTION, remoteName, ConfigConstants.CONFIG_KEY_URL); PushResult pushResult = null; String currentBranch = getCurrentBranch(); try { PushCommand pushCommand = getGit().push(); if (request.getRemote() != null) { pushCommand.setRemote(remoteName); } List<String> refSpec = request.getRefSpec(); if (refSpec != null && refSpec.size() > 0) { List<RefSpec> refSpecInst = new ArrayList<>(refSpec.size()); refSpecInst.addAll(refSpec.stream().map(RefSpec::new).collect(Collectors.toList())); pushCommand.setRefSpecs(refSpecInst); } pushCommand.setForce(request.isForce()); int timeout = request.getTimeout(); if (timeout > 0) { pushCommand.setTimeout(timeout); } Iterable<PushResult> list = (Iterable<PushResult>)executeRemoteCommand(remoteUri, pushCommand); pushResult = list.iterator().next(); } catch (GitAPIException exception) { PushResponse jGitPushResponse = new JGitPushResponse(true); return jGitPushResponse.withCommandOutput(exception.getMessage()); } <START> return new JGitPushResponse(request, pushResult, currentBranch); <END> }</code><technical_language>IMHO wrap PushResponse DTO create missing methods in DTO place logic method in JGitConnection</technical_language>

Target:
public PushResponse push(PushRequest request) throws GitException, UnauthorizedException { String remoteName = request.getRemote(); String remoteUri = getRepository().getConfig().getString(ConfigConstants.CONFIG_REMOTE_SECTION, remoteName, ConfigConstants.CONFIG_KEY_URL); PushResponse pushResponseDto = newDto(PushResponse.class); try { PushCommand pushCommand = getGit().push(); if (request.getRemote() != null) { pushCommand.setRemote(remoteName); } List<String> refSpec = request.getRefSpec(); if (!refSpec.isEmpty()) { List<RefSpec> refSpecInst = new ArrayList<>(refSpec.size()); refSpecInst.addAll(refSpec.stream().map(RefSpec::new).collect(Collectors.toList())); pushCommand.setRefSpecs(refSpecInst); } pushCommand.setForce(request.isForce()); int timeout = request.getTimeout(); if (timeout > 0) { pushCommand.setTimeout(timeout); } @SuppressWarnings("unchecked") Iterable<PushResult> pushResults = (Iterable<PushResult>)executeRemoteCommand(remoteUri, pushCommand); PushResult pushResult = pushResults.iterator().next(); return addCommandOutputUpdates(pushResponseDto, request, pushResult); } catch (GitAPIException exception) { if ("origin: not found.".equals(exception.getMessage())) { throw new GitException(ERROR_NO_REMOTE_REPOSITORY, exception); } else { throw new GitException(exception.getMessage(), exception); } } }
Source:
<code>public void MultiPlayerGameUIController() { <START> <END> }</code><technical_language>add a log message confirm creation of object</technical_language>

Target:
public void MultiPlayerGameUIController() { Logger.getInstance().log("Created MultiPlayerGameUI Objec", LogEvent.Type.DEBUG); }
Source:
<code><START> public int compareTo(Vector2d v) { <END> checkNotNull(v); return 0; }</code><technical_language>This implements Java's comparable. a flow/flow-math implementation (it in target generated source)</technical_language>

Target:
public int compareTo(Vector2d v) { checkNotNull(v); return (int) Math.signum(lengthSquared() - v.lengthSquared()); }
Source:
<code>public List<QuotaTariffVO> listAllTariffPlans(final Date effectiveDate) { final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); List<QuotaTariffVO> tariffs = new ArrayList<QuotaTariffVO>(); try (TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB)) { final Filter filter = new Filter(QuotaTariffVO.class, "effectiveOn", false, 0L, 1L); final SearchCriteria<QuotaTariffVO> sc = listAllIncludedUsageType.create(); sc.setParameters("onorbefore", effectiveDate); for (Integer quotaType : QuotaTypes.listQuotaTypes().keySet()) { sc.setParameters("quotatype", quotaType); List<QuotaTariffVO> result = search(sc, filter); if (result.size() > 0) { tariffs.add(result.get(0)); <START> s_logger.info("listAllTariffPlans onorbefore" + effectiveDate + "quota type " + result.get(0).getDescription() + " , effective Date=" + result.get(0).getEffectiveOn() + " val=" + result.get(0).getCurrencyValue()); <END> } } } catch (Exception e) { throw new CloudRuntimeException("Unable to list all tariff plans"); } finally { TransactionLegacy.open(opendb).close(); } return tariffs; }</code><technical_language>This log message lacks context actionable a sysadmin INFO message. add context necessary for actionability a sysadmin change DEBUG</technical_language>

Target:
public List<QuotaTariffVO> listAllTariffPlans(final Date effectiveDate) { return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaTariffVO>>() { @Override public List<QuotaTariffVO> doInTransaction(final TransactionStatus status) { List<QuotaTariffVO> tariffs = new ArrayList<QuotaTariffVO>(); final Filter filter = new Filter(QuotaTariffVO.class, "updatedOn", false, 0L, 1L); final SearchCriteria<QuotaTariffVO> sc = listAllIncludedUsageType.create(); sc.setParameters("onorbefore", effectiveDate); for (Integer quotaType : QuotaTypes.listQuotaTypes().keySet()) { sc.setParameters("quotatype", quotaType); List<QuotaTariffVO> result = search(sc, filter); if (result != null && !result.isEmpty()) { tariffs.add(result.get(0)); if (s_logger.isDebugEnabled()) { s_logger.debug("ListAllTariffPlans on or before " + effectiveDate + " quota type " + result.get(0).getDescription() + " , effective Date=" + result.get(0).getEffectiveOn() + " val=" + result.get(0).getCurrencyValue()); } } } return tariffs; } }); }
Source:
<code>public void testReplicateSkipCacheLoad(Method m) { final AdvancedCache<String, String> cache1 = advancedCache(0, cacheName); final AdvancedCache<String, String> cache2 = advancedCache(1, cacheName); assertLoadsAndReset(cache1, 0, cache2, 0); final String v = v(m, 1); final String k = k(m, 1); cache1.withFlags(Flag.SKIP_CACHE_LOAD).put(k, v); <START> Address primaryLocation = cache1.getDistributionManager().getPrimaryLocation(k); <END> AdvancedCache<String, String> primary, backup; if (primaryLocation.equals(cache1.getRpcManager().getAddress())) { primary = cache1; backup = cache2; } else { assertEquals(cache2.getRpcManager().getAddress(), primaryLocation); primary = cache2; backup = cache1; } assertLoadsAndReset(primary, isTxCache() ? 1 : 0, backup, 0); assertCacheValue(cache2, k, v); assertLoadsAndReset(cache1, 0, cache2, 0); }</code><technical_language>In general I prefer MagicKeys, primary owner is same</technical_language>

Target:
public void testReplicateSkipCacheLoad(Method m) { final AdvancedCache<MagicKey, String> cache1 = advancedCache(0, cacheName); final AdvancedCache<MagicKey, String> cache2 = advancedCache(1, cacheName); assertLoadsAndReset(cache1, 0, cache2, 0); final String v = v(m, 1); final MagicKey k = new MagicKey(k(m, 1), cache1); cache1.withFlags(Flag.SKIP_CACHE_LOAD).put(k, v); assertLoadsAndReset(cache1, isTxCache() ? 1 : 0, cache2, 0); assertCacheValue(cache2, k, v); assertLoadsAndReset(cache1, 0, cache2, 0); }
Source:
<code>public void run( Parameters params, TopNResultBuilder resultBuilder, DimValSelector dimValSelector ) { boolean hasDimValSelector = (dimValSelector != null); final int cardinality = params.getCardinality(); int numProcessed = 0; while (numProcessed < cardinality) { <START> int numToProcess = Math.min(params.getNumValuesPerPass(), cardinality - numProcessed); <END> DimValSelector theDimValSelector; if (!hasDimValSelector) { theDimValSelector = makeDimValSelector(params, numProcessed, numToProcess); } else { numToProcess = computeNewLength(dimValSelector, numProcessed, numToProcess); theDimValSelector = updateDimValSelector(dimValSelector, numProcessed, numToProcess); } DimValAggregateStore aggregatesStore = makeDimValAggregateStore(params); scanAndAggregate(params, theDimValSelector, aggregatesStore, numProcessed); updateResults(params, theDimValSelector, aggregatesStore, resultBuilder); closeAggregators(aggregatesStore); numProcessed += numToProcess; params.getCursor().reset(); } }</code><technical_language>Suggest leaving final assigning values in cases of if statement</technical_language>

Target:
public void run( Parameters params, TopNResultBuilder resultBuilder, DimValSelector dimValSelector ) { boolean hasDimValSelector = (dimValSelector != null); final int cardinality = params.getCardinality(); int numProcessed = 0; while (numProcessed < cardinality) { final int numToProcess; int maxNumToProcess = Math.min(params.getNumValuesPerPass(), cardinality - numProcessed); DimValSelector theDimValSelector; if (!hasDimValSelector) { numToProcess = maxNumToProcess; theDimValSelector = makeDimValSelector(params, numProcessed, numToProcess); } else { numToProcess = computeNewLength(dimValSelector, numProcessed, maxNumToProcess); theDimValSelector = updateDimValSelector(dimValSelector, numProcessed, numToProcess); } DimValAggregateStore aggregatesStore = makeDimValAggregateStore(params); scanAndAggregate(params, theDimValSelector, aggregatesStore, numProcessed); updateResults(params, theDimValSelector, aggregatesStore, resultBuilder); closeAggregators(aggregatesStore); numProcessed += numToProcess; params.getCursor().reset(); } }
Source:
<code>public RestView<TopLevelResource> list() { <START> return null; <END> }</code><technical_language>return null. throw new ResourceNotFoundException() instead</technical_language>

Target:
public RestView<TopLevelResource> list() throws ResourceNotFoundException { throw new ResourceNotFoundException(); }
Source:
<code>public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); if (value.isDefined()) { try { Charset hashCharset = Charset.forName(value.asString()); } catch (IllegalCharsetNameException e) { throw ControllerLogger.ROOT_LOGGER.illegalCharsetName(value.asString()); } catch (UnsupportedCharsetException e) { <START> throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.unsupportedCharset(value.asString())); <END> } } }</code><technical_language>change suggested above, this simplified throw ControllerLogger.ROOT_LOGGER.unsupportedCharset..</technical_language>

Target:
public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); if (value.isDefined()) { try { Charset hashCharset = Charset.forName(value.asString()); } catch (IllegalCharsetNameException e) { throw ControllerLogger.ROOT_LOGGER.illegalCharsetName(value.asString()); } catch (UnsupportedCharsetException e) { throw ControllerLogger.ROOT_LOGGER.unsupportedCharset(value.asString()); } } }
Source:
<code>public void completion2() throws Exception { FreeStyleProject foo = j.createFreeStyleProject("foo"); MatrixProject bar = j.jenkins.createProject(MatrixProject.class, "bar"); bar.setAxes(new AxisList(new TextAxis("x","1","2","3"))); MatrixConfiguration x3 = bar.getItem("x=3"); AutoCompletionCandidates c; c = AutoCompletionCandidates.ofJobNames("", j.jenkins); assertContains(c, "foo", "bar", "bar/x=1", "bar/x=2", "bar/x=3"); c = AutoCompletionCandidates.ofJobNames("ba", j.jenkins); assertContains(c, "bar", "bar/x=1", "bar/x=2", "bar/x=3"); c = AutoCompletionCandidates.ofJobNames("bar/", j.jenkins); assertContains(c, "bar/x=1", "bar/x=2", "bar/x=3"); c = AutoCompletionCandidates.ofJobNames( "", x3.getParent()); assertContains(c, "../foo", "../bar", "x=1", "x=2", "x=3"); <START> c = AutoCompletionCandidates.ofJobNames(Item.class, "../", x3, x3.getParent()); <END> assertContains(c, "../bar", "../foo"); }</code><technical_language>This is testing new method for relative path confident new method is working properly for relative paths. please new method signature validate relative path? new is in doAutoComplete* method, a feature regression form</technical_language>

Target:
public void completion2() throws Exception { FreeStyleProject foo = j.createFreeStyleProject("foo"); MatrixProject bar = j.jenkins.createProject(MatrixProject.class, "bar"); bar.setAxes(new AxisList(new TextAxis("x","1","2","3"))); MatrixConfiguration x3 = bar.getItem("x=3"); AutoCompletionCandidates c; c = AutoCompletionCandidates.ofJobNames("", j.jenkins); assertContains(c, "foo", "bar", "bar/x=1", "bar/x=2", "bar/x=3"); c = AutoCompletionCandidates.ofJobNames("ba", j.jenkins); assertContains(c, "bar", "bar/x=1", "bar/x=2", "bar/x=3"); c = AutoCompletionCandidates.ofJobNames("bar/", j.jenkins); assertContains(c, "bar/x=1", "bar/x=2", "bar/x=3"); c = AutoCompletionCandidates.ofJobNames("", x3.getParent()); assertContains(c, "../foo", "../bar", "x=1", "x=2", "x=3"); c = AutoCompletionCandidates.ofJobNames("../", x3.getParent()); assertContains(c, "../bar", "../foo"); }
Source:
<code>public void updateCameraBearing(float bearing) { <START> return; END> }</code><technical_language>@droneboost rotate field MapStatus</technical_language>

Target:
public void updateCameraBearing(float bearing) { final BaiduMap map = getBaiduMap(); if (map == null) return; final MapStatus.Builder camera = new MapStatus.Builder(map.getMapStatus()); camera.rotate(bearing); map.animateMapStatus(MapStatusUpdateFactory.newMapStatus(camera.build())); }
Source:
<code>public void compileTest() { CompilationRequest req = new DefaultCompilationRequest(mavenRepo.toAbsolutePath().toString(), info, new String[]{ MavenCLIArgs.INSTALL, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE); ClasspathDepsAfterDecorator decorator = new ClasspathDepsAfterDecorator(new BaseMavenCompiler()); CompilationResponse res = decorator.compile(req); SoftAssertions.assertSoftly(softly -> { softly.assertThat(res.isSuccessful()).isTrue(); <START> softly.assertThat(res.getDependencies().size()).isEqualTo(4); <END> }); }</code><technical_language>assertThat(someContainer).hasSize(4) is shorter error message. 15x in this PR: CTRL + f ".size()).isEqualTo("</technical_language>

Target:
public void compileTest() { CompilationRequest req = new DefaultCompilationRequest(mavenRepo.toAbsolutePath().toString(), info, new String[]{ MavenCLIArgs.INSTALL, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE); ClasspathDepsAfterDecorator decorator = new ClasspathDepsAfterDecorator(new BaseMavenCompiler()); CompilationResponse res = decorator.compile(req); SoftAssertions.assertSoftly(softly -> { softly.assertThat(res.isSuccessful()).isTrue(); softly.assertThat(res.getDependencies()).hasSize(4); }); }
Source:
<code>private boolean hostEmulationModeMatchesTheConfigValues(VDS vds) { String matchedEmulatedMachine = ListUtils.firstMatch( Config.<List<String>> getValue(ConfigValues.ClusterEmulatedMachines, vds.getVdsGroupCompatibilityVersion().getValue()), vds.getSupportedEmulatedMachines().split(",")); <START> if (matchedEmulatedMachine != null && !matchedEmulatedMachine.isEmpty() && vds.getStatus() != VDSStatus.NonOperational) { <END> setClusterEmulatedMachine(vds, matchedEmulatedMachine); return true; } return false; }</code><technical_language>do other way, enumerate "good" states. list of host states guess "Up" "Maintenance" only? Roy</technical_language>

Target:
private boolean hostEmulationModeMatchesTheConfigValues(VDS vds) { String matchedEmulatedMachine = ListUtils.firstMatch( Config.<List<String>> getValue(ConfigValues.ClusterEmulatedMachines, vds.getVdsGroupCompatibilityVersion().getValue()), vds.getSupportedEmulatedMachines().split(",")); boolean isValidStatus = (vds.getStatus() == VDSStatus.Up || vds.getStatus() == VDSStatus.Maintenance); if (matchedEmulatedMachine != null && !matchedEmulatedMachine.isEmpty() && isValidStatus) { setClusterEmulatedMachine(vds, matchedEmulatedMachine); return true; } return false; }
Source:
<code>private void refreshNotifications() { list.setVisibility(View.GONE); <START> getPageAndNext(1).subscribe(new Observer<Page<NotificationThread>>() { <END> List<NotificationThread> threads = new ArrayList<>(); @Override public void onSubscribe(Disposable d) { progressBar.setVisibility(View.VISIBLE); } @Override public void onNext(Page<NotificationThread> notificationThreadPage) { threads.addAll(notificationThreadPage.items()); } @Override public void onError(Throwable e) { ToastUtils.show(getActivity(), R.string.error_notifications_load); } @Override public void onComplete() { adapter.setItems(threads); progressBar.setVisibility(View.GONE); list.setVisibility(View.VISIBLE); emptyText.setVisibility(threads.size() == 0 ? View.VISIBLE : View.GONE); refreshLayout.setRefreshing(false); } }); }</code><technical_language>I this method a bit more readable concise if written follow: private void refreshNotifications() { list.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); getPageAndNext(1) .flatMap(page -> Observable.fromIterable(page.items())) .toList() .subscribe(threads -> { adapter.setItems(threads); progressBar.setVisibility(View.GONE); list.setVisibility(View.VISIBLE); emptyText.setVisibility(threads.size() == 0 ? View.VISIBLE : View.GONE); refreshLayout.setRefreshing(false); }, e -> ToastUtils.show(getActivity(), R.string.error_notifications_load)); }</technical_language>

Target:
private void refreshNotifications() { list.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); getPageAndNext(1) .flatMap(page -> Observable.fromIterable(page.items())) .toList() .subscribe(threads -> { adapter.setItems(threads); progressBar.setVisibility(View.GONE); list.setVisibility(View.VISIBLE); emptyText.setVisibility(threads.size() == 0 ? View.VISIBLE : View.GONE); refreshLayout.setRefreshing(false); }, e -> ToastUtils.show(getActivity(), R.string.error_notifications_load)); }
Source:
<code>public void testListSecurityGroups() { HttpRequest list = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_list.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(list, listResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); Set<SecurityGroup> groups = extension.listSecurityGroups(); <START> assertEquals(1, groups.size()); <END> }</code><technical_language>TestNG assertEquals(boolean actual, boolean expected), assertEquals(groups.size(), 1);</technical_language>

Target:
public void testListSecurityGroups() { HttpRequest list = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_list.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(list, listResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); Set<SecurityGroup> groups = extension.listSecurityGroups(); assertEquals(groups.size(), 1); }
Source:
<code>private int iterate() { if (cursor < attributePath.length()) { <START> while (attributePath.charAt(cursor) == '[' || attributePath.charAt(cursor) == '.') { <END> cursor++; } } else { current = null; return -1; } for (int i = cursor; i < attributePath.length(); i++) { switch (attributePath.charAt(i)) { case '.': case '[': return i; case ']': isArray = true; return i; default: } } return attributePath.length(); }</code><technical_language>get StringIndexOutOfBoundsException for some malformed JSON? Do need handle it</technical_language>

Target:
private int iterate() { if (cursor < attributePath.length()) { try { while (attributePath.charAt(cursor) == '[' || attributePath.charAt(cursor) == '.') { cursor++; } } catch (IndexOutOfBoundsException e) { throw createIllegalArgumentException(); } } else { current = null; return -1; } for (int i = cursor; i < attributePath.length(); i++) { switch (attributePath.charAt(i)) { case '.': case '[': return i; case ']': isArray = true; return i; default: } } return attributePath.length(); }
Source:
<code>public void start() { <START> statsAggregator = scheduler.scheduleAtFixedRate(new StatsAggregator(), 0, publishPeriodInSecs, TimeUnit.SECONDS); <END> }</code><technical_language>add some initial random delay. If not, node deployment try collect stats time</technical_language>

Target:
public void start() { scheduler = Utils.newScheduler(1, false); statsAggregator = new StatsAggregator(); scheduler.scheduleAtFixedRate(statsAggregator, ThreadLocalRandom.current().nextInt(540) + 60, publishPeriodInSecs, TimeUnit.SECONDS); }
Source:
<code>public void testClientDiscoveryNodesLeave() throws Exception { startGrids(MAX_CLUSTER_SIZE); awaitPartitionMapExchange(); initClient(getClientConfigurationWithDiscovery(), 0, 1, 2, 3); detectTopologyChange(); for (int i = MAX_CLUSTER_SIZE - 1; i != 0; i--) { int[] workChannels = IntStream.range(0, i).toArray(); channels[i] = null; stopGrid(i); awaitPartitionMapExchange(); detectTopologyChange(); <START> awaitChannelsInit(workChannels); <END> testPartitionAwareness(workChannels); } }</code><technical_language>channels inited initClient, else do wait here</technical_language>

Target:
public void testClientDiscoveryNodesLeave() throws Exception { startGrids(MAX_CLUSTER_SIZE); awaitPartitionMapExchange(); initClient(getClientConfigurationWithDiscovery(), 0, 1, 2, 3); detectTopologyChange(); for (int i = MAX_CLUSTER_SIZE - 1; i != 0; i--) { int[] workChannels = IntStream.range(0, i).toArray(); channels[i] = null; stopGrid(i); awaitPartitionMapExchange(); detectTopologyChange(); testPartitionAwareness(workChannels); } }