auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void clearIndexCache() { if (executionBlockId.getId() > 1) { Bootstrap bootstrap = new Bootstrap() .group(NettyUtils.getSharedEventLoopGroup(NettyUtils.GROUP.FETCHER, 1)) .channel(NioSocketChannel.class) .option(ChannelOption.ALLOCATOR, NettyUtils.ALLOCATOR) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10 * 1000) .option(ChannelOption.TCP_NODELAY, true); ChannelInitializer<Channel> initializer = new ChannelInitializer<Channel>() { @Override protected void initChannel(Channel channel) throws Exception { ChannelPipeline pipeline = channel.pipeline(); pipeline.addLast("codec", new HttpClientCodec()); } }; bootstrap.handler(initializer); WorkerConnectionInfo connInfo = workerContext.getConnectionInfo(); ChannelFuture future = bootstrap.connect(new InetSocketAddress(connInfo.getHost(), connInfo.getPullServerPort())) .addListener(ChannelFutureListener.CLOSE_ON_FAILURE); try { Channel channel = future.await().channel(); if (!future.isSuccess()) { LOG.warn(future.cause()); return; } ExecutionBlockId clearEbId = new ExecutionBlockId(executionBlockId.getQueryId(), executionBlockId.getId() - 1); HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.DELETE, clearEbId.toString()); request.headers().set(Names.HOST, connInfo.getHost()); request.headers().set(Names.CONNECTION, Values.CLOSE); channel.writeAndFlush(request); } catch (InterruptedException e) { throw new RuntimeException(e); } finally { if (future != null && future.channel().isOpen()) { <START> future.channel().closeFuture(); <END> } } } }</code><technical_language>future.channel().close()</technical_language>

Target:
private void clearIndexCache() { if (executionBlockId.getId() > 1) { Bootstrap bootstrap = new Bootstrap() .group(NettyUtils.getSharedEventLoopGroup(NettyUtils.GROUP.FETCHER, 1)) .channel(NioSocketChannel.class) .option(ChannelOption.ALLOCATOR, NettyUtils.ALLOCATOR) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 30 * 1000) .option(ChannelOption.TCP_NODELAY, true); ChannelInitializer<Channel> initializer = new ChannelInitializer<Channel>() { @Override protected void initChannel(Channel channel) throws Exception { ChannelPipeline pipeline = channel.pipeline(); pipeline.addLast("codec", new HttpClientCodec()); } }; bootstrap.handler(initializer); WorkerConnectionInfo connInfo = workerContext.getConnectionInfo(); ChannelFuture future = bootstrap.connect(new InetSocketAddress(connInfo.getHost(), connInfo.getPullServerPort())) .addListener(ChannelFutureListener.CLOSE_ON_FAILURE); try { Channel channel = future.await().channel(); if (!future.isSuccess()) { LOG.warn(future.cause()); return; } ExecutionBlockId clearEbId = new ExecutionBlockId(executionBlockId.getQueryId(), executionBlockId.getId() - 1); HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.DELETE, "ebid=" + clearEbId.toString()); request.headers().set(Names.HOST, connInfo.getHost()); request.headers().set(Names.CONNECTION, Values.CLOSE); channel.writeAndFlush(request); } catch (InterruptedException e) { throw new RuntimeException(e); } finally { if (future != null && future.channel().isOpen()) { future.channel().close(); } } } }
Source:
<code>public void notify(Transcriber transcriber, TranscriptEvent event) { TranscriptionStatusExtension extension = new TranscriptionStatusExtension(); extension.setStatus( transcriber.isTranscribing() ? TranscriptionStatusExtension.Status.ON : TranscriptionStatusExtension.Status.OFF); <START> jvbConference.sendPresenceExtension(extension); <END> }</code><technical_language>this update presence new transcription result. I missing something? I expect update presence status changes (when starts stops)</technical_language>

Target:
public void notify(Transcriber transcriber, TranscriptEvent event) { if (event.getEvent() == Transcript.TranscriptEventType.START || event.getEvent() == Transcript.TranscriptEventType.WILL_END) { TranscriptionStatusExtension.Status status = event.getEvent() == Transcript.TranscriptEventType.WILL_END ? TranscriptionStatusExtension.Status.OFF : transcriber.isTranscribing() ? TranscriptionStatusExtension.Status.ON : TranscriptionStatusExtension.Status.OFF; TranscriptionStatusExtension extension = new TranscriptionStatusExtension(); extension.setStatus(status); jvbConference.sendPresenceExtension(extension); } }
Source:
<code>public ByteBuf order(ByteOrder endianness) { ObjectUtil.checkNotNull(endianness, "endianness"); <START> if (endianness == order) { <END> return this; } return buf; }</code><technical_language>nit: merge lines checkNotNull return argument</technical_language>

Target:
public ByteBuf order(ByteOrder endianness) { if (ObjectUtil.checkNotNull(endianness, "endianness") == order) { return this; } return buf; }
Source:
<code>private void processError(String endpointId, JsonRpcResponse response, String key) { LOGGER.debug("Response has error. Proceeding..."); if (!promises.containsKey(key)) { <START> LOGGER.debug("No action is associated for the key: " + key + ", skipping."); <END> return; } JsonRpcError error = response.getError(); JsonRpcPromise<?> promise = promises.remove(key); LOGGER.debug("Fetching promise:" + promise); BiConsumer<String, JsonRpcError> consumer = promise.getFailureConsumer(); if (consumer != null) { LOGGER.debug("Failure consumer is found, accepting..."); consumer.accept(endpointId, error); } else { LOGGER.debug("Reject function is not found, skipping"); } }</code><technical_language>AFAIK string concatenation in debug traces</technical_language>

Target:
private void processError(String endpointId, JsonRpcResponse response, String key) { LOGGER.debug("Response has error. Proceeding..."); if (!promises.containsKey(key)) { LOGGER.debug("No action is associated for the key: {}, skipping.", key); return; } JsonRpcError error = response.getError(); JsonRpcPromise<?> promise = promises.remove(key); LOGGER.debug("Fetching promise: {}", promise); BiConsumer<String, JsonRpcError> consumer = promise.getFailureConsumer(); if (consumer != null) { LOGGER.debug("Failure consumer is found, accepting..."); consumer.accept(endpointId, error); } else { LOGGER.debug("Reject function is not found, skipping"); } }
Source:
<code>private void consumeIt(BatchIterator<Row> iterator) { boolean allLoaded; try { while (iterator.moveNext()) { rowCount++; resultReceiver.setNextRow(iterator.currentElement()); if (maxRows > 0 && rowCount % maxRows == 0) { activeIt = iterator; resultReceiver.batchFinished(); return; } } allLoaded = iterator.allLoaded(); } catch (Throwable t) { iterator.close(); <START> completionFuture.complete(null); <END> resultReceiver.fail(t); return; } if (allLoaded) { completionFuture.complete(null); iterator.close(); resultReceiver.allFinished(false); } else { iterator.loadNextBatch().whenComplete((r, f) -> { if (f == null) { consumeIt(iterator); } else { Throwable t = SQLExceptions.unwrap(f); iterator.close(); completionFuture.completeExceptionally(t); resultReceiver.fail(t); } }); } }</code><technical_language>this completionFuture.completeExceptionally(t)</technical_language>

Target:
private void consumeIt(BatchIterator<Row> iterator) { boolean allLoaded; try { while (iterator.moveNext()) { rowCount++; resultReceiver.setNextRow(iterator.currentElement()); if (maxRows > 0 && rowCount % maxRows == 0) { activeIt = iterator; resultReceiver.batchFinished(); return; } } allLoaded = iterator.allLoaded(); } catch (Throwable t) { iterator.close(); completionFuture.completeExceptionally(t); resultReceiver.fail(t); return; } if (allLoaded) { completionFuture.complete(null); iterator.close(); resultReceiver.allFinished(false); } else { iterator.loadNextBatch().whenComplete((r, f) -> { if (f == null) { consumeIt(iterator); } else { Throwable t = SQLExceptions.unwrap(f); iterator.close(); completionFuture.completeExceptionally(t); resultReceiver.fail(t); } }); } }
Source:
<code>public ListenableFuture<Optional<LabelMeta>> getMeta(final LabelId uid, final LabelType type) { final String qualifier = type.toString().toLowerCase() + "_meta"; final LabelMeta meta = labelMetas.get(uid, qualifier); <START> return Futures.immediateFuture(Optional.of(meta)); <END> }</code><technical_language>Optional.of() fail throws exception meta is null. is a test checks this</technical_language>

Target:
public ListenableFuture<Optional<LabelMeta>> getMeta(final LabelId uid, final LabelType type) { final String qualifier = type.toString().toLowerCase() + "_meta"; final LabelMeta meta = labelMetas.get(uid, qualifier); return Futures.immediateFuture(Optional.fromNullable(meta)); }
Source:
<code>protected void createControls(Composite composite) { fAncestor = createMergeViewer(composite, MergeViewerSide.ANCESTOR); fAncestor.addSelectionChangedListener(this); fLeft = createMergeViewer(composite, MergeViewerSide.LEFT); fLeft.addSelectionChangedListener(this); fRight = createMergeViewer(composite, MergeViewerSide.RIGHT); fRight.addSelectionChangedListener(this); <START> final IThemeManager themeManager; if (PlatformUI.isWorkbenchRunning()) { themeManager = PlatformUI.getWorkbench().getThemeManager(); } else { themeManager = null; } final ITheme currentTheme; if (themeManager != null) { currentTheme = themeManager.getCurrentTheme(); } else { currentTheme = null; } <END> boolean leftIsLocal = getCompareConfiguration().getBooleanProperty("LEFT_IS_LOCAL", false); fColors = new EMFCompareColor(composite.getDisplay(), leftIsLocal, currentTheme, getCompareConfiguration().getEventBus()); composite.addControlListener(new ControlListener() { public void controlResized(ControlEvent e) { redrawCenterControl(); } public void controlMoved(ControlEvent e) { } }); }</code><technical_language>I this more readable merge if branches of ifs extract a private method</technical_language>

Target:
protected void createControls(Composite composite) { fAncestor = createMergeViewer(composite, MergeViewerSide.ANCESTOR); fAncestor.addSelectionChangedListener(this); fLeft = createMergeViewer(composite, MergeViewerSide.LEFT); fLeft.addSelectionChangedListener(this); fRight = createMergeViewer(composite, MergeViewerSide.RIGHT); fRight.addSelectionChangedListener(this); final ITheme currentTheme = getCurrentTheme(); boolean leftIsLocal = getCompareConfiguration().getBooleanProperty("LEFT_IS_LOCAL", false); fColors = new EMFCompareColor(composite.getDisplay(), leftIsLocal, currentTheme, getCompareConfiguration().getEventBus()); composite.addControlListener(new ControlListener() { public void controlResized(ControlEvent e) { redrawCenterControl(); } public void controlMoved(ControlEvent e) { } }); }
Source:
<code>private static void validatePseudoScopedInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager, Set<Object> dependencyPath, Set<Bean<?>> validatedBeans) { Set<Bean<?>> resolved = beanManager.getBeans(ij); try { Bean<?> bean = beanManager.resolve(resolved); if (bean != null) { if (!(bean instanceof AbstractBuiltInBean<?>)) { if (!ij.isDelegate()) { boolean normalScoped = beanManager.isNormalScope(bean.getScope()); if (!normalScoped && !(bean instanceof SessionBean)) { reallyValidatePseudoScopedBean(bean, beanManager, dependencyPath, validatedBeans); } } } } <START> } catch (AmbiguousResolutionException ex) { <END> throw ValidatorLogger.LOG.injectionPointHasAmbiguousDependencies(ij, Formats.formatAnnotations(ij.getQualifiers()), Formats.formatInjectionPointType(ij.getType()), Formats.formatAsStackTraceElement(ij), InjectionPoints.getUnsatisfiedDependenciesAdditionalInfo(ij, beanManager)); } }</code><technical_language>I try-catch block for beanManager.resolve() clearer</technical_language>

Target:
private static void validatePseudoScopedInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager, Set<Object> dependencyPath, Set<Bean<?>> validatedBeans) { Set<Bean<?>> resolved = beanManager.getBeans(ij); Bean<?> bean = null; try { bean = beanManager.resolve(resolved); } catch (AmbiguousResolutionException ex) { throw ValidatorLogger.LOG.injectionPointHasAmbiguousDependencies(ij, Formats.formatAnnotations(ij.getQualifiers()), Formats.formatInjectionPointType(ij.getType()), Formats.formatAsStackTraceElement(ij), WeldCollections.toMultiRowString(resolved)); } if (bean != null) { if (!(bean instanceof AbstractBuiltInBean<?>)) { if (!ij.isDelegate()) { boolean normalScoped = beanManager.isNormalScope(bean.getScope()); if (!normalScoped && !(bean instanceof SessionBean)) { reallyValidatePseudoScopedBean(bean, beanManager, dependencyPath, validatedBeans); } } } } }
Source:
<code>protected String getChannelNameFromMessage(JsonNode message) throws IOException { <START> return null; <END> }</code><technical_language>I this return channel this service represents (so pass in channel name a constructor argument). subscribeChannel work normally</technical_language>

Target:
protected String getChannelNameFromMessage(JsonNode message) throws IOException { return channelName; }
Source:
<code>private void resolvePoolables(Pool pool) throws IOException { PoolableElementViewService svc = serviceManager.getPoolableElementViewService(); <START> for (PoolElement pd : pool.getPoolContents()) { <END> PoolableElementView resolved = svc.getByPreMigrationId(pd.getPoolableElementView().getPreMigrationId()); if (resolved == null) { throw new IllegalArgumentException( "No PoolableElement found with preMigrationId " + pd.getPoolableElementView().getPreMigrationId()); } pd.setPoolableElementView(resolved); } }</code><technical_language>'pd' longer sense a variable name, other places</technical_language>

Target:
private void resolvePoolables(Pool pool) throws IOException { PoolableElementViewService svc = serviceManager.getPoolableElementViewService(); for (PoolElement element : pool.getPoolContents()) { PoolableElementView resolved = svc.getByPreMigrationId(element.getPoolableElementView().getPreMigrationId()); if (resolved == null) { throw new IllegalArgumentException( "No PoolableElement found with preMigrationId " + element.getPoolableElementView().getPreMigrationId()); } element.setPoolableElementView(resolved); } }
Source:
<code>public boolean canEditToNewPackType(Donation existingDonation, PackType newPackType) { if(existingDonation.getTestBatch() != null && existingDonation.getTestBatch().getStatus() != null && !existingDonation.getTestBatch().getStatus().equals(TestBatchStatus.OPEN)) { if (newPackType.getTestSampleProduced() && !existingDonation.getPackType().getTestSampleProduced()) { return false; } if (existingDonation.getPackType().getTestSampleProduced() && !newPackType.getTestSampleProduced()) { return false; <START> } <END> } return true; }</code><technical_language>I this logic a bit easier follow if combined checks !==. clear pack types changed other pack types for testSampleProduced</technical_language>

Target:
public boolean canEditToNewPackType(Donation existingDonation, PackType newPackType) { if(existingDonation.isReleased() || isTestBatchNotOpen(existingDonation)) { if (existingDonation.getPackType().getTestSampleProduced() != newPackType.getTestSampleProduced()) { return false; } } return true; }
Source:
<code>private void validateNetmaskInReply() throws InvalidSyntaxException { boolean hasIpv4Address = false; int numNetmask = 0; for (ConfigAttribute <START> att : <END> recognizedAttributeList) { if (att.hasEmptyValue()) { IkeManager.getIkeLog() .d( "IkeConfigPayload", "Found empty attribute in a Config Payload reply " + att.attributeType); } switch (att.attributeType) { case CONFIG_ATTR_INTERNAL_IP4_ADDRESS: if (!att.hasEmptyValue()) hasIpv4Address = true; break; case CONFIG_ATTR_INTERNAL_IP4_NETMASK: if (!att.hasEmptyValue()) numNetmask++; break; default: continue; } } if (!hasIpv4Address && numNetmask > 0) { throw new InvalidSyntaxException( "Found INTERNAL_IP4_NETMASK attribute but no INTERNAL_IP4_ADDRESS attribute"); } if (numNetmask > 1) { throw new InvalidSyntaxException("Found more than one INTERNAL_IP4_NETMASK"); } }</code><technical_language>standard is "attr"</technical_language>

Target:
private void validateNetmaskInReply() throws InvalidSyntaxException { boolean hasIpv4Address = false; int numNetmask = 0; for (ConfigAttribute attr : recognizedAttributeList) { if (attr.isEmptyValue()) { IkeManager.getIkeLog() .d( "IkeConfigPayload", "Found empty attribute in a Config Payload reply " + attr.attributeType); } switch (attr.attributeType) { case CONFIG_ATTR_INTERNAL_IP4_ADDRESS: if (!attr.isEmptyValue()) hasIpv4Address = true; break; case CONFIG_ATTR_INTERNAL_IP4_NETMASK: if (!attr.isEmptyValue()) numNetmask++; break; default: continue; } } if (!hasIpv4Address && numNetmask > 0) { throw new InvalidSyntaxException( "Found INTERNAL_IP4_NETMASK attribute but no INTERNAL_IP4_ADDRESS attribute"); } if (numNetmask > 1) { throw new InvalidSyntaxException("Found more than one INTERNAL_IP4_NETMASK"); } }
Source:
<code>public RunnerDetail registerRunner(String token, String description, Boolean active, List<String> tagList, Boolean runUntagged, Boolean locked, Integer maximumTimeout) throws GitLabApiException { Preconditions.checkNotNull(token, "token is necessary for registering a new runner"); <START> <END> GitLabApiForm formData = new GitLabApiForm() .withParam("token", token, true) .withParam("description", description, false) .withParam("active", active, false) .withParam("locked", locked, false) .withParam("run_untagged", runUntagged, false) .withParam("tag_list", tagList, false) .withParam("maximum_timeout", maximumTimeout, false); Response response = post(Response.Status.CREATED, formData.asMap(), "runners"); return (response.readEntity(RunnerDetail.class)); }</code><technical_language>need Preconditions.checkNotNull() here, .withParam("token", token, true) throw a exception if token is null empty</technical_language>

Target:
public RunnerDetail registerRunner(String token, String description, Boolean active, List<String> tagList, Boolean runUntagged, Boolean locked, Integer maximumTimeout) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("token", token, true) .withParam("description", description, false) .withParam("active", active, false) .withParam("locked", locked, false) .withParam("run_untagged", runUntagged, false) .withParam("tag_list", tagList, false) .withParam("maximum_timeout", maximumTimeout, false); Response response = post(Response.Status.CREATED, formData.asMap(), "runners"); return (response.readEntity(RunnerDetail.class)); }
Source:
<code>public ReplicationConfig(VerifiableProperties verifiableProperties) { replicationTokenFactory = verifiableProperties.getString("replication.token.factory", "com.github.ambry.store.StoreFindTokenFactory"); replicationNumOfIntraDCReplicaThreads = verifiableProperties.getInt("replication.no.of.intra.dc.replica.threads", 1); replicationNumOfInterDCReplicaThreads = verifiableProperties.getInt("replication.no.of.inter.dc.replica.threads", 1); replicationConnectionPoolCheckoutTimeoutMs = verifiableProperties.getIntInRange("replication.connection.pool.checkout.timeout.ms", 5000, 1000, 10000); replicationTokenFlushIntervalSeconds = verifiableProperties.getIntInRange("replication.token.flush.interval.seconds", 300, 5, Integer.MAX_VALUE); replicationTokenFlushDelaySeconds = verifiableProperties.getIntInRange("replication.token.flush.delay.seconds", 5, 1, Integer.MAX_VALUE); replicationFetchSizeInBytes = verifiableProperties.getLongInRange("replication.fetch.size.in.bytes", 1048576, 0, 2097152); replicaWaitTimeBetweenReplicasMs = verifiableProperties.getIntInRange("replication.wait.time.between.replicas.ms", 1000, 0, 1000000); replicationMaxLagForWaitTimeInBytes = verifiableProperties.getLongInRange("replication.max.lag.for.wait.time.in.bytes", 5242880, 0, 104857600); <START> validateMessageStream = verifiableProperties.getBoolean("replication.validate.message.stream", true); <END> }</code><technical_language>this false, selectively enable - initially</technical_language>

Target:
public ReplicationConfig(VerifiableProperties verifiableProperties) { replicationTokenFactory = verifiableProperties.getString("replication.token.factory", "com.github.ambry.store.StoreFindTokenFactory"); replicationNumOfIntraDCReplicaThreads = verifiableProperties.getInt("replication.no.of.intra.dc.replica.threads", 1); replicationNumOfInterDCReplicaThreads = verifiableProperties.getInt("replication.no.of.inter.dc.replica.threads", 1); replicationConnectionPoolCheckoutTimeoutMs = verifiableProperties.getIntInRange("replication.connection.pool.checkout.timeout.ms", 5000, 1000, 10000); replicationTokenFlushIntervalSeconds = verifiableProperties.getIntInRange("replication.token.flush.interval.seconds", 300, 5, Integer.MAX_VALUE); replicationTokenFlushDelaySeconds = verifiableProperties.getIntInRange("replication.token.flush.delay.seconds", 5, 1, Integer.MAX_VALUE); replicationFetchSizeInBytes = verifiableProperties.getLongInRange("replication.fetch.size.in.bytes", 1048576, 0, 2097152); replicaWaitTimeBetweenReplicasMs = verifiableProperties.getIntInRange("replication.wait.time.between.replicas.ms", 1000, 0, 1000000); replicationMaxLagForWaitTimeInBytes = verifiableProperties.getLongInRange("replication.max.lag.for.wait.time.in.bytes", 5242880, 0, 104857600); validateMessageStream = verifiableProperties.getBoolean("replication.validate.message.stream", false); }
Source:
<code>public byte[] toBytes(KafkaCheckpointLogKey key) { try { return mapper.writeValueAsBytes(ImmutableMap.of( SSP_GROUPER_FACTORY_FIELD, key.getGrouperFactoryClassName(), TASK_NAME_FIELD, key.getTaskName().toString(), TYPE_FIELD, key.getType() )); } catch (Exception e) { <START> throw new SamzaException(e); <END> } }</code><technical_language>Wrap a meaningful message bubble up</technical_language>

Target:
public byte[] toBytes(KafkaCheckpointLogKey key) { try { return mapper.writeValueAsBytes(ImmutableMap.of( SSP_GROUPER_FACTORY_FIELD, key.getGrouperFactoryClassName(), TASK_NAME_FIELD, key.getTaskName().toString(), TYPE_FIELD, key.getType() )); } catch (Exception e) { throw new SamzaException(String.format("Exception in serializing: %s", key), e); } }
Source:
<code>public boolean removeRoute(@NonNull RouteInfo route) { if <START> (Objects.equals(mIfaceName, <END> route.getInterface())) { return false; } int i = findRouteIndexByDestination(route); if (i == -1) { return false; } mRoutes.remove(i); return true; }</code><technical_language>!Objects.equals(</technical_language>

Target:
public boolean removeRoute(@NonNull RouteInfo route) { if (!Objects.equals(mIfaceName, route.getInterface())) { return false; } int i = findRouteIndexByDestination(route); if (i == -1) { return false; } mRoutes.remove(i); return true; }
Source:
<code>public void shouldNotEditAnAutoGenerationOptionProvidedWithAllNullParams() throws Exception { SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("location", null); <START> autoGenerationOption.add("source", null); <END> autoGenerationOption.add("manualEntryEnabled", null); autoGenerationOption.add("automaticGenerationEnabled", null); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI() + "/" + getUuid()); req.setContent(json.getBytes()); handle(req); }</code><technical_language>For null values, do supply properties in autoGenerationOption</technical_language>

Target:
public void shouldNotEditAnAutoGenerationOptionProvidedWithAllNullParams() throws Exception { SimpleObject autoGenerationOption = new SimpleObject(); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI() + "/" + getUuid()); req.setContent(json.getBytes()); handle(req); }
Source:
<code>protected static boolean isRingTimeFromNextSmartAlarm(final DateTime currentTimeAlignedToStartOfMinute, final RingTime nextRingTimeFromWorker){ <START> final boolean alarmNotYetRing = currentTimeAlignedToStartOfMinute.isAfter(nextRingTimeFromWorker.actualRingTimeUTC) == false; <END> final boolean isProcessedSmartAlarm = nextRingTimeFromWorker.processed(); return alarmNotYetRing && isProcessedSmartAlarm; }</code><technical_language>this variable english :wink:</technical_language>

Target:
protected static boolean isRingTimeFromNextSmartAlarm(final DateTime currentTimeAlignedToStartOfMinute, final RingTime nextRingTimeFromWorker){ final boolean isNextSmartAlarm = currentTimeAlignedToStartOfMinute.isAfter(nextRingTimeFromWorker.actualRingTimeUTC) == false; final boolean isProcessedSmartAlarm = nextRingTimeFromWorker.processed(); return isNextSmartAlarm && isProcessedSmartAlarm; }
Source:
<code>public Class<?> lookupIncludeClass(Class<?> objClass) { <START> Annotation first = getFirstAnnotation(objClass, Arrays.asList(Exclude.class, Include.class)); <END> if (first instanceof Include) { Class<?> declaringClass = lookupAnnotationDeclarationClass(objClass, Include.class); if (declaringClass != null) { return declaringClass; } } return null; }</code><technical_language>I update getFirstAnnotation() well, for this scenario java @Exclude class Foo { } @Include class Bar extends Foo class Baz extends Bar I getFirstAnnotation(Baz.class, Exclude.class, Include.class) return Exclude.class</technical_language>

Target:
public Class<?> lookupIncludeClass(Class<?> objClass) { Annotation first = getFirstAnnotation(objClass, Arrays.asList(Exclude.class, Include.class)); if (first instanceof Include) { Class<?> declaringClass = lookupAnnotationDeclarationClass(objClass, Include.class); if (declaringClass != null) { return declaringClass; } return objClass; } return null; }
Source:
<code>private Node createImportedNode(final Node node) { <START> assert !(node instanceof Document); <END> final Document document; try { document = DFACTORY.newDocumentBuilder().newDocument(); } catch (final ParserConfigurationException ex) { throw new IllegalStateException(ex); } final Node imported = document.importNode(node, true); document.appendChild(imported); return imported; }</code><technical_language>@Suseika please remove assert,</technical_language>

Target:
private Node createImportedNode(final Node node) { final Document document; try { document = DFACTORY.newDocumentBuilder().newDocument(); } catch (final ParserConfigurationException ex) { throw new IllegalStateException(ex); } final Node imported = document.importNode(node, true); document.appendChild(imported); return imported; }
Source:
<code>public void start(BundleContext bundleContext) throws Exception { bundleContext.registerService(PetsStoreService.class.getName(), new PetsManagerImpl(), null); <START> LOGGER.debug("Pet-Store BE Bundle started."); <END> }</code><technical_language>need check isDebug enabled this marker</technical_language>

Target:
public void start(BundleContext bundleContext) throws Exception { bundleContext.registerService(PetsStoreService.class.getName(), new PetsManagerImpl(), null); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Pet-Store BE Bundle started."); } }
Source:
<code>public List<AbstractProject> getTiedJobs() { List<AbstractProject> r = new ArrayList<>(); <START> for (AbstractProject<?,?> p : Jenkins.get().allItems(AbstractProject.class, i -> i instanceof TopLevelItem && this.equals(i.getAssignedLabel()))) { <END> r.add(p); } r.sort(Items.BY_FULL_NAME); return r; }</code><technical_language>I improves performance much, stream result allItems() collect a list, avoiding for loop</technical_language>

Target:
public List<AbstractProject> getTiedJobs() { return StreamSupport.stream(Jenkins.get().allItems(AbstractProject.class, i -> i instanceof TopLevelItem && this.equals(i.getAssignedLabel())).spliterator(), true) .sorted(Items.BY_FULL_NAME).collect(Collectors.toList()); }
Source:
<code>public static boolean isNullOrBlank(String string) { if (string == null) { return true; } int length = string.length(); if (length > 0) { for (int i = 0; i < length; i++) { if (!Character.isWhitespace(string.charAt(i))) { return false; } } } <START> return true; <END> }</code><technical_language>move this a util class marked non-public api</technical_language>

Target:
private static boolean isNullOrBlank(String string) { if (string == null) { return true; } int length = string.length(); if (length > 0) { for (int i = 0; i < length; i++) { if (!Character.isWhitespace(string.charAt(i))) { return false; } } } return true; }
Source:
<code>private synchronized PackIndex idx() throws IOException { if (loadedIdx == null) { <START> if (invalid) <END> throw new PackInvalidException(packFile, invalidatingCause); try { final PackIndex idx = PackIndex.open(extFile(INDEX)); if (packChecksum == null) { packChecksum = idx.packChecksum; } else if (!Arrays.equals(packChecksum, idx.packChecksum)) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packChecksumMismatch, packFile.getPath())); } loadedIdx = idx; } catch (InterruptedIOException e) { throw e; } catch (IOException e) { invalid = true; invalidatingCause = e; throw e; } } return loadedIdx; }</code><technical_language>Add missing braces</technical_language>

Target:
private synchronized PackIndex idx() throws IOException { if (loadedIdx == null) { if (invalid) { throw new PackInvalidException(packFile, invalidatingCause); } try { final PackIndex idx = PackIndex.open(extFile(INDEX)); if (packChecksum == null) { packChecksum = idx.packChecksum; } else if (!Arrays.equals(packChecksum, idx.packChecksum)) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packChecksumMismatch, packFile.getPath())); } loadedIdx = idx; } catch (InterruptedIOException e) { throw e; } catch (IOException e) { invalid = true; invalidatingCause = e; throw e; } } return loadedIdx; }
Source:
<code>private static Optional<HostAndPort> meshProxy(Optional<ProxyConfiguration> proxy) { if (!proxy.isPresent() || proxy.get().type() != ProxyConfiguration.Type.MESH) { return Optional.empty(); } <START> return Optional.of(HostAndPort.fromString(proxy.get().hostAndPort().get())); <END> }</code><technical_language>invert this: if (A && B) { return positive; } else { return negative; }</technical_language>

Target:
private static Optional<HostAndPort> meshProxy(Optional<ProxyConfiguration> proxy) { if (proxy.isPresent() && proxy.get().type() == ProxyConfiguration.Type.MESH) { return Optional.of(HostAndPort.fromString(proxy.get().hostAndPort().get())); } else { return Optional.empty(); } }
Source:
<code><START> public Builder withSteps(List<? extends FunnelStep> steps) { <END> for (FunnelStep step : steps) { withStep(step); } return this; }</code><technical_language>Suggestion: a potentially surprising in behavior setSteps withSteps if call some steps in builder. replace existing steps, while append them. of replace. If a need for a method append a list of steps, withAdditionalSteps something? TBH I overkill; in practice people a series of withStep calls, a single withSteps call</technical_language>

Target:
public Builder withSteps(List<? extends FunnelStep> steps) { if (null != this.steps) { throw new KeenQueryClientException( "Incorrect Usage: withSteps() called, which would clear any existing steps already added. " + "Don't add steps prior to calling withSteps(), or append additional steps by calling withStep()." ); } setSteps(steps); return this; }
Source:
<code>public HibernateValidatorContext addValueExtractor(ValueExtractor<?> extractor) { <START> valueExtractors.add( extractor ); <END> return this; }</code><technical_language>change VED throw error early if a valid VE</technical_language>

Target:
public HibernateValidatorContext addValueExtractor(ValueExtractor<?> extractor) { ValueExtractorDescriptor descriptor = new ValueExtractorDescriptor( extractor ); ValueExtractorDescriptor previous = valueExtractorDescriptors.put( descriptor.getKey(), descriptor ); if ( previous != null ) { throw LOG.getValueExtractorForTypeAndTypeUseAlreadyPresentException( extractor, previous.getValueExtractor() ); } return this; }
Source:
<code>private static void compareJSONObject(JSONObject original, JSONObject marshalled) { checkKeys(original, marshalled); for (String originalKey : original.keySet()) { <START> if (!OTHER_ATTRIBUTES.equals(originalKey) && !H_$.equals(originalKey)) { <END> compareJSONObjectKey(original, marshalled, originalKey); } } }</code><technical_language>Objects.equals in class please</technical_language>

Target:
private static void compareJSONObject(JSONObject original, JSONObject marshalled) { checkKeys(original, marshalled); for (String originalKey : original.keySet()) { if (!Objects.equals(OTHER_ATTRIBUTES, originalKey) && !Objects.equals(H_$, originalKey)) { compareJSONObjectKey(original, marshalled, originalKey); } } }
Source:
<code>private FlowRefFactoryBean createDynamicFlowRefFactoryBean(Processor target, Object targetBuilder, ApplicationContext applicationContext) throws Exception { if (targetBuilder != null) { doReturn(targetBuilder).when(applicationContext).getBean(eq(PARSED_DYNAMIC_REFERENCED_FLOW)); } else { doReturn(target).when(applicationContext).getBean(eq(PARSED_DYNAMIC_REFERENCED_FLOW)); } <START> return createFlowRefFactoryBean(FlowRefFactoryBeanTestCase.DYNAMIC_REFERENCED_FLOW, "flow", applicationContext); <END> }</code><technical_language>static import</technical_language>

Target:
private FlowRefFactoryBean createDynamicFlowRefFactoryBean(Processor target, Object targetBuilder, ApplicationContext applicationContext) throws Exception { if (targetBuilder != null) { doReturn(targetBuilder).when(applicationContext).getBean(eq(PARSED_DYNAMIC_REFERENCED_FLOW)); } else { doReturn(target).when(applicationContext).getBean(eq(PARSED_DYNAMIC_REFERENCED_FLOW)); } return createFlowRefFactoryBean(DYNAMIC_REFERENCED_FLOW, "flow", applicationContext); }
Source:
<code>public Optional<ImmutableFlyingData> with(Key<? extends BaseValue<?>> key, Object value, ImmutableFlyingData immutable) { <START> return Optional.absent(); <END> }</code><technical_language>this. ImmutableDataCachingUtil please</technical_language>

Target:
public Optional<ImmutableFlyingData> with(Key<? extends BaseValue<?>> key, Object value, ImmutableFlyingData immutable) { if (key.equals(Keys.IS_FLYING)) { return Optional.<ImmutableFlyingData>of(ImmutableDataCachingUtil.getManipulator(ImmutableSpongeFlyingData.class, value)); } return Optional.absent(); }
Source:
<code>public void onPlansFetched(OnPlansFetched event) { cancelDomainCreditsCheckProgressDialog(); if (event.isError()) { AppLog.e(T.PLANS, PluginDetailActivity.class.getSimpleName() + ".onPlansFetched: " + event.error.type + " - " + event.error.message); } else { if (event.plans == null) { <START> AppLog.e(T.PLANS, "Fetched user plans are null."); <END> return; } PlanModel currentPlan = null; for (PlanModel plan : event.plans) { if (plan.isCurrentPlan()) { currentPlan = plan; break; } } boolean isDomainCreditAvailable = currentPlan != null && currentPlan.getHasDomainCredit(); if (isDomainCreditAvailable) { showDomainRegistrationDialog(); } else { dispatchInstallPluginAction(); } } }</code><technical_language>want consider crashing app in debug follow Fail Fast principle showing a snackbar users wrong, wdyt</technical_language>

Target:
public void onPlansFetched(OnPlansFetched event) { if (mCheckingDomainCreditsProgressDialog == null || !mCheckingDomainCreditsProgressDialog.isShowing()) { AppLog.w(T.PLANS, "User cancelled domain credit checking. Ignoring the result."); return; } cancelDomainCreditsCheckProgressDialog(); if (event.isError()) { AppLog.e(T.PLANS, PluginDetailActivity.class.getSimpleName() + ".onPlansFetched: " + event.error.type + " - " + event.error.message); Snackbar.make(mContainer, getString(R.string.plugin_check_domain_credit_error), AccessibilityUtils.getSnackbarDuration(this)).show(); } else { if (event.plans == null) { String errorMessage = "Failed to fetch user Plans. The result is null."; if (BuildConfig.DEBUG) { throw new IllegalStateException(errorMessage); } Snackbar.make(mContainer, getString(R.string.plugin_check_domain_credit_error), AccessibilityUtils.getSnackbarDuration(this)).show(); AppLog.e(T.PLANS, errorMessage); return; } PlanModel currentPlan = null; for (PlanModel plan : event.plans) { if (plan.isCurrentPlan()) { currentPlan = plan; break; } } boolean isDomainCreditAvailable = currentPlan != null && currentPlan.getHasDomainCredit(); if (isDomainCreditAvailable) { showDomainRegistrationDialog(); } else { dispatchInstallPluginAction(); } } }
Source:
<code>public void setup() throws Exception { PowerMockito.whenNew(KubernetesClient.class).withAnyArguments().thenReturn(client); <START> PowerMockito.spy(KubernetesConfig.class); <END> PowerMockito.doReturn("default") .when(KubernetesConfig.class, "readFileContents", "/var/run/secrets/kubernetes.io/serviceaccount/namespace"); }</code><technical_language>setting a KubernetesProperty NAMESPACE instead of PowerMockito here? for other test</technical_language>

Target:
public void setup() throws Exception { PowerMockito.whenNew(KubernetesClient.class).withAnyArguments().thenReturn(client); }
Source:
<code>public HttpResponse doSafeExit(StaplerRequest req) throws IOException { checkPermission(ADMINISTER); isQuietingDown = true; final String exitUser = getAuthentication().getName(); final String exitAddr = req!=null ? req.getRemoteAddr() : "unknown"; new Thread("safe-exit thread") { @Override public void run() { try { ACL.impersonate(ACL.SYSTEM); LOGGER.severe(String.format("Shutting down VM as requested by %s from %s", exitUser, exitAddr)); doQuietDown(true, 0); if (isQuietingDown) { cleanUp(); System.exit(0); } } catch (Exception e) { <START> LOGGER.log(Level.WARNING, "Failed to shutdown Hudson",e); <END> } } }.start(); return HttpResponses.plainText("Shutting down as soon as all jobs are complete"); }</code><technical_language>touching line I done s/Hudson/Jenkins/</technical_language>

Target:
public HttpResponse doSafeExit(StaplerRequest req) throws IOException { checkPermission(ADMINISTER); isQuietingDown = true; final String exitUser = getAuthentication().getName(); final String exitAddr = req!=null ? req.getRemoteAddr() : "unknown"; new Thread("safe-exit thread") { @Override public void run() { try { ACL.impersonate(ACL.SYSTEM); LOGGER.severe(String.format("Shutting down VM as requested by %s from %s", exitUser, exitAddr)); doQuietDown(true, 0); if (isQuietingDown) { cleanUp(); System.exit(0); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to shut down Jenkins", e); } } }.start(); return HttpResponses.plainText("Shutting down as soon as all jobs are complete"); }
Source:
<code>private ScheduledExecutorService startKerberosLoginThread() { scheduledExecutorService = Executors.newScheduledThreadPool(1); scheduledExecutorService.submit(new Callable() { public Object call() throws Exception { if (runKerberosLogin()) { logger.info("Ran runKerberosLogin command successfully."); kinitFailCount = 0; <START> logger.info("Scheduling Kerberos ticket refresh thread with interval " + <END> getKerberosRefreshInterval() + " ms"); scheduledExecutorService .schedule(this, getKerberosRefreshInterval(), TimeUnit.MILLISECONDS); } else { kinitFailCount++; logger.info("runKerberosLogin failed for " + kinitFailCount + " time(s)."); if (kinitFailCount >= kinitFailThreshold()) { logger.error("runKerberosLogin failed for max attempts, calling close interpreter."); close(); } else { scheduledExecutorService.submit(this); } } return null; } }); return scheduledExecutorService; }</code><technical_language>rename logger LOGGER ? is convention for naming static variables</technical_language>

Target:
private ScheduledExecutorService startKerberosLoginThread() { scheduledExecutorService = Executors.newScheduledThreadPool(1); scheduledExecutorService.submit(new Callable() { public Object call() throws Exception { if (runKerberosLogin()) { LOGGER.info("Ran runKerberosLogin command successfully."); kinitFailCount = 0; LOGGER.info("Scheduling Kerberos ticket refresh thread with interval " + getKerberosRefreshInterval() + " ms"); scheduledExecutorService .schedule(this, getKerberosRefreshInterval(), TimeUnit.MILLISECONDS); } else { kinitFailCount++; LOGGER.info("runKerberosLogin failed for " + kinitFailCount + " time(s)."); if (kinitFailCount >= kinitFailThreshold()) { LOGGER.error("runKerberosLogin failed for max attempts, calling close interpreter."); close(); } else { scheduledExecutorService.schedule(this, 1, TimeUnit.SECONDS); } } return null; } }); return scheduledExecutorService; }
Source:
<code>private void processWorkerMetrics(final String srcId, final MetricReportMsg metricReportMsg) { for (final ByteBuffer encodedBuffer : metricReportMsg.getCustomMetrics()) { final DolphinWorkerMetrics workerMetrics = metricMsgCodec.decode(encodedBuffer.array()); final Map<String, Integer> tableToNumBlocks = metricReportMsg.getTableToNumBlocks(); final String hostname = metricReportMsg.getHostname(); <START> int numWorkers = 0; <END> switch (workerMetrics.getType()) { case BatchMetrics: final BatchMetrics batchMetrics = workerMetrics.getBatchMetrics(); try { numWorkers = etMaster.getTable(inputTableId).getPartitionInfo().size(); } catch (TableNotExistException e) { throw new RuntimeException(e); } final WorkerMetrics convertedBatchMetrics = convertBatchMetrics(metricReportMsg, tableToNumBlocks, hostname, batchMetrics); metricManager.storeWorkerMetrics(srcId, convertedBatchMetrics); break; case EpochMetrics: final EpochMetrics epochMetrics = workerMetrics.getEpochMetrics(); final WorkerMetrics convertedEpochMetrics = convertEpochMetrics(metricReportMsg, hostname, epochMetrics); metricManager.storeWorkerMetrics(srcId, convertedEpochMetrics); break; default: throw new RuntimeException("Unknown message type"); } LOG.log(Level.INFO, "Received a worker metric from {0} (num running workers: {1}): {2}", new Object[] {srcId, numWorkers, workerMetrics}); } }</code><technical_language>is this variable mutable? Another is extract a separate method (e.g., getNumRunningWorkers()). WDYT</technical_language>

Target:
private void processWorkerMetrics(final String srcId, final MetricReportMsg metricReportMsg) { for (final ByteBuffer encodedBuffer : metricReportMsg.getCustomMetrics()) { final DolphinWorkerMetrics workerMetrics = metricMsgCodec.decode(encodedBuffer.array()); final Map<String, Integer> tableToNumBlocks = metricReportMsg.getTableToNumBlocks(); final String hostname = metricReportMsg.getHostname(); switch (workerMetrics.getType()) { case BatchMetrics: final BatchMetrics batchMetrics = workerMetrics.getBatchMetrics(); final WorkerMetrics convertedBatchMetrics = convertBatchMetrics(metricReportMsg, tableToNumBlocks, hostname, batchMetrics); metricManager.storeWorkerMetrics(srcId, convertedBatchMetrics); break; case EpochMetrics: final EpochMetrics epochMetrics = workerMetrics.getEpochMetrics(); final WorkerMetrics convertedEpochMetrics = convertEpochMetrics(metricReportMsg, hostname, epochMetrics); metricManager.storeWorkerMetrics(srcId, convertedEpochMetrics); break; default: throw new RuntimeException("Unknown message type"); } try { final int numWorkers = etMaster.getTable(inputTableId).getPartitionInfo().size(); LOG.log(Level.INFO, "Received a worker metric from {0} (num running workers: {1}): {2}", new Object[] {srcId, numWorkers, workerMetrics}); } catch (TableNotExistException e) { throw new RuntimeException(e); } } }
Source:
<code>public void rateLimit(JoinPoint jp, RateLimit limit) throws RateLimitException { <START> RateLimiter limiter = limiters.computeIfAbsent(createKey(jp), createLimiter(limit)); <END> boolean acquired = limiter.tryAcquire(RATE_LIMIT_ACQUIRE_TIMEOUT_IN_SECONDS, TimeUnit.SECONDS); if (acquired) { logger.debug("Acquired rate limit permission"); } else { logger.error("Could not acquire rate limit permission"); throw new RateLimitException(String.format("Rate limit exceeded. Please limit rate to %s requests/second.", limit.value())); } }</code><technical_language>I trouble understanding createKey createLimiter return a a function returns a value: suggestion String limiterKey = getIpAddress(jp); RateLimiter limiter = limiters.computeIfAbsent(limiterKey, getLimiterFactory(limit));</technical_language>

Target:
public void rateLimit(JoinPoint jp, RateLimit limit) throws RateLimitException { RateLimiter limiter = limiters.computeIfAbsent(getIPAddress(jp), createLimiter(limit)); boolean acquired = limiter.tryAcquire(RATE_LIMIT_ACQUIRE_TIMEOUT_IN_SECONDS, TimeUnit.SECONDS); if (!acquired) { logger.error("Could not acquire rate limit permission"); throw new RateLimitException(String.format("Rate limit exceeded. Please limit rate to %d requests/second.", limit.value())); } logger.debug("Acquired rate limit permission"); }
Source:
<code>public void defaultRemovalStrategyShutsDownNewestFirstWhenResizing() throws Exception { final List<Entity> creationOrder = Lists.newArrayList(); DynamicCluster cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class) .configure("initialSize", 0) .configure("factory", new EntityFactory<Entity>() { @Override public Entity newEntity(Map flags, Entity parent) { Entity result = new TestEntityImpl(flags); creationOrder.add(result); return result; }})); cluster.start(ImmutableList.of(loc)); cluster.resize(1); cluster.resize(2); assertEquals(cluster.getCurrentSize(), (Integer)2); assertEquals(ImmutableSet.copyOf(cluster.getMembers()), ImmutableSet.copyOf(creationOrder), "actual="+cluster.getMembers()); Collection<Entity> preStopMembers = ImmutableList.copyOf(cluster.getMembers()); cluster.resize(1); assertEquals(cluster.getCurrentSize(), (Integer)1); Entity remainingEntity = cluster.getMembers().iterator().next(); for(Entity entity : preStopMembers) { assertTrue(entity.getCreationTime() >= remainingEntity.getCreationTime()); <START> } <END> }</code><technical_language>creationOrder.subList(0,1) fail is if creation times identical (ie nearest millisecond). i issues "older" deleted in situation. _both_ checks (the new time one, original subList one) stick a Time.sleep(Duration.millis(1)) resize(2)</technical_language>

Target:
public void defaultRemovalStrategyShutsDownNewestFirstWhenResizing() throws Exception { final List<Entity> creationOrder = Lists.newArrayList(); DynamicCluster cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class) .configure("initialSize", 0) .configure("factory", new EntityFactory<Entity>() { @Override public Entity newEntity(Map flags, Entity parent) { Entity result = new TestEntityImpl(flags); creationOrder.add(result); return result; }})); cluster.start(ImmutableList.of(loc)); cluster.resize(1); Thread.sleep(1); cluster.resize(2); assertEquals(cluster.getCurrentSize(), (Integer)2); assertEquals(ImmutableSet.copyOf(cluster.getMembers()), ImmutableSet.copyOf(creationOrder), "actual="+cluster.getMembers()); cluster.resize(1); assertEquals(cluster.getCurrentSize(), (Integer)1); assertEquals(ImmutableList.copyOf(cluster.getMembers()), creationOrder.subList(0, 1)); }
Source:
<code>protected void verify_internal_effects() { <START> verify(iterables).assertHasOnlyOneElementSatisfying(info(), newArrayList(internalArray()), consumer); <END> }</code><technical_language>list in place of newArrayList, is a bit lighter read</technical_language>

Target:
protected void verify_internal_effects() { verify(iterables).assertHasOnlyOneElementSatisfying(info(), list(internalArray()), consumer); }
Source:
<code>public void addRecords(final TopicPartition partition, final Iterable<ConsumerRecord<byte[], byte[]>> records) { if (state() == State.CLOSED || state() == State.CLOSING) { <START> log.info("Stream task is already in state, skip adding records to it.", id(), state()); <END> } final int newQueueSize = partitionGroup.addRawRecords(partition, records); if (log.isTraceEnabled()) { log.trace("Added records into the buffered queue of partition {}, new queue size is {}", partition, newQueueSize); } if (newQueueSize > maxBufferedSize) { consumer.pause(singleton(partition)); } }</code><technical_language>Hm. I concerned if get -- TaskMigratedException sense either. add records a closed task imply closed task due shutting longer it, cases involves trimming topic(s) consumer's assignment, returned records for topic(s). Unless, consumer return already-fetched records partitions longer in assignment poll? I thought trim records out return actual assignment</technical_language>

Target:
public void addRecords(final TopicPartition partition, final Iterable<ConsumerRecord<byte[], byte[]>> records) { final int newQueueSize = partitionGroup.addRawRecords(partition, records); if (log.isTraceEnabled()) { log.trace("Added records into the buffered queue of partition {}, new queue size is {}", partition, newQueueSize); } if (newQueueSize > maxBufferedSize) { consumer.pause(singleton(partition)); } }