auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static CompressedVSizeIndexedV3Writer create( final IOPeon ioPeon, final String filenameBase, final int maxValue, final CompressedObjectStrategy.CompressionStrategy compression ) { return new CompressedVSizeIndexedV3Writer( new CompressedIntsIndexedWriter( ioPeon, <START> StringUtils.safeFormat("%s.offsets", filenameBase), <END> CompressedIntsIndexedSupplier.MAX_INTS_IN_BUFFER, IndexIO.BYTE_ORDER, compression ), new CompressedVSizeIntsIndexedWriter( ioPeon, StringUtils.safeFormat("%s.values", filenameBase), maxValue, CompressedVSizeIntsIndexedSupplier.maxIntsInBufferForValue(maxValue), IndexIO.BYTE_ORDER, compression ) ); }</code><technical_language>crash if bad format string</technical_language>

Target:
public static CompressedVSizeIndexedV3Writer create( final IOPeon ioPeon, final String filenameBase, final int maxValue, final CompressedObjectStrategy.CompressionStrategy compression ) { return new CompressedVSizeIndexedV3Writer( new CompressedIntsIndexedWriter( ioPeon, StringUtils.format("%s.offsets", filenameBase), CompressedIntsIndexedSupplier.MAX_INTS_IN_BUFFER, IndexIO.BYTE_ORDER, compression ), new CompressedVSizeIntsIndexedWriter( ioPeon, StringUtils.format("%s.values", filenameBase), maxValue, CompressedVSizeIntsIndexedSupplier.maxIntsInBufferForValue(maxValue), IndexIO.BYTE_ORDER, compression ) ); }
Source:
<code>private Set<Guid> findNonResponsiveHosts(List<VDS> hosts) { final Set<Guid> nonResponsiveHosts = new HashSet<>(); for (VDS host : hosts) { if (host.getStatus() == VDSStatus.NonResponsive) { nonResponsiveHosts.add(host.getId()); } if ((host.getStatus() == VDSStatus.Down || host.getStatus() == VDSStatus.Reboot) && host.isInFenceFlow()) { host.setStatus(VDSStatus.NonResponsive); nonResponsiveHosts.add(host.getId()); <START> } <END> } return nonResponsiveHosts; }</code><technical_language>Hmm, reformat more readable: if (host.isInFenceFlow() && (host.getStatus() == VDSStatus.Down || host.getStatus() == VDSStatus.Reboot)) {</technical_language>

Target:
private Set<Guid> findNonResponsiveHosts(List<VDS> hosts) { final Set<Guid> nonResponsiveHosts = new HashSet<>(); for (VDS host : hosts) { if (host.getStatus() == VDSStatus.NonResponsive) { nonResponsiveHosts.add(host.getId()); } if (host.isInFenceFlow() && (host.getStatus() == VDSStatus.Down || host.getStatus() == VDSStatus.Reboot)) { host.setStatus(VDSStatus.NonResponsive); nonResponsiveHosts.add(host.getId()); } } return nonResponsiveHosts; }
Source:
<code>public Cache.Entry<K, ValueHolder<V>> next() throws CacheAccessException { if (next == null) { throw new NoSuchElementException(); } final Map.Entry<K, OffHeapValueHolder<V>> thisEntry = next; advance(); final K key = thisEntry.getKey(); <START> backingMap().computeIfPresent(key, new BiFunction<K, OffHeapValueHolder<V>, OffHeapValueHolder<V>>() { <END> @Override public OffHeapValueHolder<V> apply(final K k, final OffHeapValueHolder<V> currentMapping) { if (currentMapping.getId() == thisEntry.getValue().getId()) { setAccessTimeAndExpiry(key, currentMapping, timeSource.getTimeMillis()); } return currentMapping; } }); return new Cache.Entry<K, ValueHolder<V>>() { @Override public K getKey() { return thisEntry.getKey(); } @Override public ValueHolder<V> getValue() { return thisEntry.getValue(); } @Override public long getCreationTime(TimeUnit unit) { return thisEntry.getValue().creationTime(unit); } @Override public long getLastAccessTime(TimeUnit unit) { return thisEntry.getValue().lastAccessTime(unit); } @Override public float getHitRate(TimeUnit unit) { final long now = timeSource.getTimeMillis(); return thisEntry.getValue().hitRate(now, unit); } }; }</code><technical_language>This change update holder in store return hit older access time. computing anyway, update hold latest returned, return if actual store longer holds this mapping</technical_language>

Target:
public Cache.Entry<K, ValueHolder<V>> next() throws CacheAccessException { if (next == null) { throw new NoSuchElementException(); } final Map.Entry<K, OffHeapValueHolder<V>> thisEntry = next; advance(); final long now = timeSource.getTimeMillis(); backingMap().computeIfPresent(thisEntry.getKey(), new BiFunction<K, OffHeapValueHolder<V>, OffHeapValueHolder<V>>() { @Override public OffHeapValueHolder<V> apply(final K k, final OffHeapValueHolder<V> currentMapping) { if (currentMapping.getId() == thisEntry.getValue().getId()) { setAccessTimeAndExpiry(k, currentMapping, now); } return currentMapping; } }); thisEntry.getValue().accessed(now, expiry.getExpiryForAccess(thisEntry.getKey(), thisEntry.getValue().value())); return new Cache.Entry<K, ValueHolder<V>>() { @Override public K getKey() { return thisEntry.getKey(); } @Override public ValueHolder<V> getValue() { return thisEntry.getValue(); } @Override public long getCreationTime(TimeUnit unit) { return thisEntry.getValue().creationTime(unit); } @Override public long getLastAccessTime(TimeUnit unit) { return thisEntry.getValue().lastAccessTime(unit); } @Override public float getHitRate(TimeUnit unit) { final long now = timeSource.getTimeMillis(); return thisEntry.getValue().hitRate(now, unit); } }; }
Source:
<code>public Single<PageBlobGetPageRangesDiffResponse> getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions, Context context) { blobRange = blobRange == null ? new BlobRange() : blobRange; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; context = context == null ? Context.NONE : context; if (prevSnapshot == null) { <START> throw new IllegalArgumentException("prevSnapshot cannot be null."); <END> } return postProcessResponse(this.storageClient.generatedPageBlobs().getPageRangesDiffWithRestResponseAsync( context, null, null, prevSnapshot, blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions())); }</code><technical_language>Replace Objects.requireNotNull</technical_language>

Target:
public Single<PageBlobGetPageRangesDiffResponse> getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions, Context context) { blobRange = blobRange == null ? new BlobRange() : blobRange; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; context = context == null ? Context.NONE : context; if (prevSnapshot == null) { throw new IllegalArgumentException("prevSnapshot cannot be null"); } return postProcessResponse(this.storageClient.generatedPageBlobs().getPageRangesDiffWithRestResponseAsync( context, null, null, prevSnapshot, blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions())); }
Source:
<code>public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<String>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.subscription(friend.alias())) { continue; } <START> this.tryEmail(friend, text, failed); <END> } this.checkForFailures(failed); }</code><technical_language>@bdragan this method is simple enough inlined here</technical_language>

Target:
public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<String>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.subscription(friend.alias())) { continue; } try { this.courier.email(friend, text); } catch (final IOException exception) { failed.add(friend.alias()); } } if (!failed.isEmpty()) { final String message = String.format( "Sorry, we were not able to send the notification email to %s.", Joiner.on(", ").join(failed) ); throw new RsFailure(new EmailDeliveryException(message)); } }
Source:
<code>public void initialize() throws APIManagerIntegrationTestException, XPathExpressionException, MalformedURLException, ApiException { super.init(); apiEndPointUrl = backEndServerUrl.getWebAppURLHttp() + API_END_POINT_POSTFIX_URL; providerName = user.getUserName(); apiCreationRequestBean = new APICreationRequestBean(API_NAME, API_CONTEXT, API_VERSION_1_0_0, providerName, new URL(apiEndPointUrl)); apiCreationRequestBean.setTags(API_TAGS); apiCreationRequestBean.setDescription(API_DESCRIPTION); String publisherURLHttp = publisherUrls.getWebAppURLHttp(); String storeURLHttp = storeUrls.getWebAppURLHttp(); apiIdentifier = new APIIdentifier(providerName, API_NAME, API_VERSION_1_0_0); ApplicationDTO applicationDTO = restAPIStore.addApplication(APPLICATION_NAME, APIMIntegrationConstants.RESOURCE_TIER.UNLIMITED, "", ""); applicationId = applicationDTO.getApplicationId(); ArrayList grantTypes = new ArrayList(); <START> grantTypes.add("client_credentials"); <END> grantTypes.add("password"); ApplicationKeyDTO applicationKeyDTO = restAPIStore.generateKeys(applicationId, "3600", null, ApplicationKeyGenerateRequestDTO.KeyTypeEnum.PRODUCTION, null, grantTypes); consumerKey = applicationKeyDTO.getConsumerKey(); consumerSecret = applicationKeyDTO.getConsumerSecret(); }</code><technical_language>constants? APIMIntegrationConstants.GRANT_TYPE.CLIENT_CREDENTIAL</technical_language>

Target:
public void initialize() throws APIManagerIntegrationTestException, XPathExpressionException, MalformedURLException, ApiException { super.init(); apiEndPointUrl = backEndServerUrl.getWebAppURLHttp() + API_END_POINT_POSTFIX_URL; providerName = user.getUserName(); apiCreationRequestBean = new APICreationRequestBean(API_NAME, API_CONTEXT, API_VERSION_1_0_0, providerName, new URL(apiEndPointUrl)); apiCreationRequestBean.setTags(API_TAGS); apiCreationRequestBean.setDescription(API_DESCRIPTION); String publisherURLHttp = publisherUrls.getWebAppURLHttp(); String storeURLHttp = storeUrls.getWebAppURLHttp(); apiIdentifier = new APIIdentifier(providerName, API_NAME, API_VERSION_1_0_0); ApplicationDTO applicationDTO = restAPIStore.addApplication(APPLICATION_NAME, APIMIntegrationConstants.RESOURCE_TIER.UNLIMITED, "", ""); applicationId = applicationDTO.getApplicationId(); ArrayList grantTypes = new ArrayList(); grantTypes.add(APIMIntegrationConstants.GRANT_TYPE.CLIENT_CREDENTIAL); grantTypes.add(APIMIntegrationConstants.GRANT_TYPE.PASSWORD); ApplicationKeyDTO applicationKeyDTO = restAPIStore.generateKeys(applicationId, "3600", null, ApplicationKeyGenerateRequestDTO.KeyTypeEnum.PRODUCTION, null, grantTypes); consumerKey = applicationKeyDTO.getConsumerKey(); consumerSecret = applicationKeyDTO.getConsumerSecret(); }
Source:
<code>void record(String serviceName, String hostname, int port, int statusCode, long micros) { try { hostMetrics.getUnchecked( ImmutableServiceHostAndPort.of(serviceName, hostname, port)).record(statusCode, micros); } catch (Exception e) { log.warn("Unable to record metrics for host and url", UnsafeArg.of("hostname", hostname), <START> UnsafeArg.of("url", port)); <END> } }</code><technical_language>arg port</technical_language>

Target:
void record(String serviceName, String hostname, int port, int statusCode, long micros) { try { hostMetrics.getUnchecked( ImmutableServiceHostAndPort.of(serviceName, hostname, port)).record(statusCode, micros); } catch (Exception e) { log.warn("Unable to record metrics for host and port", UnsafeArg.of("hostname", hostname), SafeArg.of("port", port)); } }
Source:
<code>private void updateAudioDeviceState(boolean hasWiredHeadset) { <START> if (hasWiredHeadset) { <END> audioDevices.add(AudioDevice.WIRED_HEADSET); } else { audioDevices.add(AudioDevice.SPEAKER_PHONE); if (hasEarpiece()) { audioDevices.add(AudioDevice.EARPIECE); } } RCLogger.d(TAG, "audioDevices: " + audioDevices); if (hasWiredHeadset) { setAudioDevice(AudioDevice.WIRED_HEADSET); } else { setAudioDevice(defaultAudioDevice); } }</code><technical_language>This dangerous; if plugging unplugging headset end a lot of audioDevices, unknown results/behavior</technical_language>

Target:
private void updateAudioDeviceState(boolean hasWiredHeadset) { audioDevices.clear(); if (hasWiredHeadset) { audioDevices.add(AudioDevice.WIRED_HEADSET); } else { audioDevices.add(AudioDevice.SPEAKER_PHONE); if (hasEarpiece()) { audioDevices.add(AudioDevice.EARPIECE); } } RCLogger.d(TAG, "audioDevices: " + audioDevices); if (hasWiredHeadset) { setAudioDevice(AudioDevice.WIRED_HEADSET); } else { setAudioDevice(defaultAudioDevice); } }
Source:
<code>public void testCodeReview() { IGerritHudsonTriggerConfig config = Setup.createConfig(); ParameterExpander instance = new ParameterExpander(config); Integer result = instance.getMinimumCodeReviewValue(parameter.memoryImprint, true); if (parameter.expectedCodeReview == null) { <START> assertEquals(null, result); <END> } else { assertEquals(Integer.valueOf(parameter.expectedCodeReview), result); } }</code><technical_language>assertNull(result); more descriptive I guess</technical_language>

Target:
public void testCodeReview() { IGerritHudsonTriggerConfig config = Setup.createConfig(); ParameterExpander instance = new ParameterExpander(config); Integer result = instance.getMinimumCodeReviewValue(parameter.memoryImprint, true); if (parameter.expectedCodeReview == null) { assertNull(result); } else { assertEquals(Integer.valueOf(parameter.expectedCodeReview), result); } }
Source:
<code>public void testLoadFilters() { processDefinitionListBasicFiltersPresenter.loadFilters(); final InOrder inOrder = inOrder(getView()); <START> inOrder.verify(getView()).addTextFilter(eq(Constants.INSTANCE.Process_Definition_Name()), <END> eq(Constants.INSTANCE.Default_Process_Definition_Name()), eq(true), any()); }</code><technical_language>calling _verify_ once, need _InOrder_ then</technical_language>

Target:
public void testLoadFilters() { processDefinitionListBasicFiltersPresenter.loadFilters(); verify(getView()).addTextFilter(eq(Constants.INSTANCE.Name()), eq(Constants.INSTANCE.Default_Process_Definition_Name()), eq(true), any()); }
Source:
<code>public void validate_shouldPassIfTheDuplicateNameIsForATermFromSameConceptSourceButRetired() throws Exception { <START> ConceptReferenceTerm term = new ConceptReferenceTerm(); <END> term.setName("retired name"); term.setCode("retired code"); term.setConceptSource(Context.getConceptService().getConceptSource(1)); Errors errors = new BindException(term, "term"); new ConceptReferenceTermValidator().validate(term, errors); Assert.assertEquals(false, errors.hasErrors()); }</code><technical_language>nice load retired term name add assertion is retired</technical_language>

Target:
public void validate_shouldPassIfTheDuplicateNameIsForATermFromSameConceptSourceButRetired() throws Exception { ConceptService cs = Context.getConceptService(); ConceptSource source = Context.getConceptService().getConceptSource(1); ConceptReferenceTerm retiredTerm = cs.getConceptReferenceTermByName("retired name", source); Assert.assertTrue(retiredTerm.isRetired()); ConceptReferenceTerm term = new ConceptReferenceTerm(); term.setName("retired name"); term.setCode("retired code"); term.setConceptSource(source); Errors errors = new BindException(term, "term"); new ConceptReferenceTermValidator().validate(term, errors); Assert.assertEquals(false, errors.hasErrors()); }
Source:
<code>private static SecretKey generateEncryptionKey() throws NoSuchAlgorithmException { KeyGenerator keygen = KeyGenerator.getInstance("AES"); <START> keygen.init(128); END> SecretKey secretKey = keygen.generateKey(); return secretKey; }</code><technical_language>replace magic number 128 a constant</technical_language>

Target:
private static SecretKey generateEncryptionKey() throws NoSuchAlgorithmException { KeyGenerator keygen = KeyGenerator.getInstance(ENCRYPTION_ALGO); keygen.init(ENCRYPTION_KEY_SIZE_BITS); SecretKey secretKey = keygen.generateKey(); return secretKey; }
Source:
<code>public List<ArtifactEntry> findMatching(ArtifactEntrySearchCriteria searchCriteria, PagingCriteria pagingCriteria) { StringBuilder sb = new StringBuilder(); sb.append("SELECT FROM ").append(getEntityClass().getSimpleName()); Map<String, Object> parameterMap = Collections.emptyMap(); if (!searchCriteria.isEmpty()) { StringBuilder criteriaQueryClasuse = new StringBuilder(); sb.append(" WHERE "); parameterMap = new HashMap<>(); if (searchCriteria.getMinSizeInBytes() != null && searchCriteria.getMinSizeInBytes() > 0) { criteriaQueryClasuse.append(" sizeInBytes >= :minSizeInBytes "); parameterMap.put("minSizeInBytes", searchCriteria.getMinSizeInBytes()); } <START> if (searchCriteria.getUselessnessDays() != null && searchCriteria.getUselessnessDays() > 0) <END> { if (criteriaQueryClasuse.length() > 0) { criteriaQueryClasuse.append(" AND "); } Date lastUsed = DateUtils.addDays(new Date(), -searchCriteria.getUselessnessDays()); criteriaQueryClasuse.append(" lastUsed < :lastUsed "); parameterMap.put("lastUsed", lastUsed); } sb.append(criteriaQueryClasuse); } appendPagingCriteria(sb, pagingCriteria); logger.debug("Executing SQL query> " + sb.toString()); OSQLSynchQuery<ArtifactEntry> oQuery = new OSQLSynchQuery<>(sb.toString()); return getDelegate().command(oQuery).execute(parameterMap); }</code><technical_language>is getUselessnessDays? I a name getLastAccessedTime, lines...? Or... I missing something...</technical_language>

Target:
public List<ArtifactEntry> findMatching(ArtifactEntrySearchCriteria searchCriteria, PagingCriteria pagingCriteria) { StringBuilder sb = new StringBuilder(); sb.append("SELECT FROM ").append(getEntityClass().getSimpleName()); Map<String, Object> parameterMap = Collections.emptyMap(); if (!searchCriteria.isEmpty()) { StringBuilder criteriaQueryClasuse = new StringBuilder(); sb.append(" WHERE "); parameterMap = new HashMap<>(); if (searchCriteria.getMinSizeInBytes() != null && searchCriteria.getMinSizeInBytes() > 0) { criteriaQueryClasuse.append(" sizeInBytes >= :minSizeInBytes "); parameterMap.put("minSizeInBytes", searchCriteria.getMinSizeInBytes()); } if (searchCriteria.getLastAccessedTimeInDays() != null && searchCriteria.getLastAccessedTimeInDays() > 0) { if (criteriaQueryClasuse.length() > 0) { criteriaQueryClasuse.append(" AND "); } Date lastUsed = DateUtils.addDays(new Date(), -searchCriteria.getLastAccessedTimeInDays()); criteriaQueryClasuse.append(" lastUsed < :lastUsed "); parameterMap.put("lastUsed", lastUsed); } sb.append(criteriaQueryClasuse); } appendPagingCriteria(sb, pagingCriteria); logger.debug("Executing SQL query> " + sb.toString()); OSQLSynchQuery<ArtifactEntry> oQuery = new OSQLSynchQuery<>(sb.toString()); return getDelegate().command(oQuery).execute(parameterMap); }
Source:
<code>private void checkAutomaticProcessors(ILogEvent event) { for (IProcessorDescriptor descriptor : descriptors) { if (Processors.shouldProcess(descriptor, event) && <START> descriptor.isAutomaticActivation()) { <END> EList<IReportProcessor> enabledProcessors = event.getOptions().getEnabledProcessors(); IReportProcessor processor = descriptor.getProcessor(); if (!enabledProcessors.contains(processor)) { enabledProcessors.add(processor); } processor.analyze(event.getStatus(), event.getContext()); } } }</code><technical_language>faster check, move in front</technical_language>

Target:
private void checkAutomaticProcessors(ILogEvent event) { for (IProcessorDescriptor descriptor : descriptors) { if (descriptor.isAutomatic() && Processors.shouldProcess(descriptor, event)) { EList<IReportProcessor> enabledProcessors = event.getOptions().getEnabledProcessors(); IReportProcessor processor = descriptor.getProcessor(); if (!enabledProcessors.contains(processor)) { enabledProcessors.add(processor); } processor.analyze(event.getStatus(), event.getContext()); } } }
Source:
<code>public void testConvertToMimeType(String mimeType) throws IOException { String converterName = cs.getConverterName(mimeType, "text/html"); assertEquals("zip2html", converterName); checkConverterAvailability(converterName); BlobHolder htmlBH = getBlobFromPath("test-docs/hello.zip"); htmlBH.getBlob().setMimeType(mimeType); Map<String, Serializable> parameters = Collections.emptyMap(); BlobHolder result = cs.convert(converterName, htmlBH, parameters); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertNotNull(blobs); assertEquals(3, blobs.size()); String content = blobs.get(0).getString(); assertTrue(content.contains("<li><a href=\"hello.xml\">hello.xml</a></li>") && <START> content.contains("<li><a href=\"hello.txt\">hello.txt</a></li>")); <END> content = DocumentUTUtils.readContent(blobs.get(1).getFile()); assertTrue(content.contains("Hello from a xml <b>document</b>")); content = DocumentUTUtils.readContent(blobs.get(2).getFile()); assertTrue(content.contains("Hello from a text document")); }</code><technical_language>convert this assertTrue</technical_language>

Target:
public void testConvertToMimeType(String mimeType) throws IOException { String converterName = cs.getConverterName(mimeType, "text/html"); assertEquals("zip2html", converterName); checkConverterAvailability(converterName); BlobHolder htmlBH = getBlobFromPath("test-docs/hello.zip"); htmlBH.getBlob().setMimeType(mimeType); Map<String, Serializable> parameters = Collections.emptyMap(); BlobHolder result = cs.convert(converterName, htmlBH, parameters); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertNotNull(blobs); assertEquals(3, blobs.size()); String content = blobs.get(0).getString(); assertTrue(content, content.contains("<li><a href=\"hello.xml\">hello.xml</a></li>")); assertTrue(content, content.contains("<li><a href=\"hello.txt\">hello.txt</a></li>")); content = DocumentUTUtils.readContent(blobs.get(1).getFile()); assertTrue(content, content.contains("Hello from a xml <b>document</b>")); content = DocumentUTUtils.readContent(blobs.get(2).getFile()); assertTrue(content, content.contains("Hello from a text document")); }
Source:
<code>public Subscription getSubscription(final String owningApplication, final Set<String> eventTypes, final String consumerGroup) throws NoSuchSubscriptionException, InternalNakadiException, ServiceUnavailableException { final String sql = "SELECT s_subscription_object FROM zn_data.subscription " + "WHERE s_subscription_object->>'owning_application' = ? " + "AND replace(s_subscription_object->>'event_types', ' ', '') = ? " + "AND s_subscription_object->>'consumer_group' = ? "; try { final String eventTypesJson = jsonMapper.writer().writeValueAsString(newTreeSet(eventTypes)); return jdbcTemplate.queryForObject(sql, new Object[]{owningApplication, eventTypesJson, consumerGroup}, rowMapper); } catch (final JsonProcessingException e) { throw new InternalNakadiException("Serialization problem during getting event type", e); } catch (final EmptyResultDataAccessException e) { throw new NoSuchSubscriptionException("Subscription does not exist", e); } catch (final DataAccessException e) { <START> throw new ServiceUnavailableException("Error occurred when running database request", e); <END> } }</code><technical_language>expose users</technical_language>

Target:
public Subscription getSubscription(final String owningApplication, final Set<String> eventTypes, final String consumerGroup) throws NoSuchSubscriptionException, InternalNakadiException, ServiceUnavailableException { final String sql = "SELECT s_subscription_object FROM zn_data.subscription " + "WHERE s_subscription_object->>'owning_application' = ? " + "AND replace(s_subscription_object->>'event_types', ' ', '') = ? " + "AND s_subscription_object->>'consumer_group' = ? "; try { final String eventTypesJson = jsonMapper.writer().writeValueAsString(newTreeSet(eventTypes)); return jdbcTemplate.queryForObject(sql, new Object[]{owningApplication, eventTypesJson, consumerGroup}, rowMapper); } catch (final JsonProcessingException e) { throw new InternalNakadiException("Serialization problem during getting event type", e); } catch (final EmptyResultDataAccessException e) { throw new NoSuchSubscriptionException("Subscription does not exist", e); } catch (final DataAccessException e) { LOG.error("Database error when getting subscription by key properties", e); throw new ServiceUnavailableException("Error occurred when running database request"); } }
Source:
<code>private boolean shouldUpdateCache(Optional<ActivityDto> lastRegisteredActivity, Activity newOrUpdatedActivity) { if (!lastRegisteredActivity.isPresent()) { return true; } <START> return !newOrUpdatedActivity.getEndTime().atZone(newOrUpdatedActivity.getTimeZone()) <END> .isBefore(lastRegisteredActivity.get().getEndTime()); }</code><technical_language>getEndTimeAsZonedDateTime for simplicity</technical_language>

Target:
private boolean shouldUpdateCache(Optional<ActivityDto> lastRegisteredActivity, Activity newOrUpdatedActivity) { if (!lastRegisteredActivity.isPresent()) { return true; } return !newOrUpdatedActivity.getEndTimeAsZonedDateTime().isBefore(lastRegisteredActivity.get().getEndTime()); }
Source:
<code>private String buildCanonicalResourceIdentifier(URI uri, SpiderResourceFound resourceFound) throws URIException { StringBuilder identifierBuilder = new StringBuilder(50); <START> if (resourceFound != null) { <END> String visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation( uri, spider.getSpiderParam().getHandleParameters(), spider.getSpiderParam().isHandleODataParametersVisited()); identifierBuilder.append(resourceFound.getMethod()); identifierBuilder.append(" "); identifierBuilder.append(visitedURI); identifierBuilder.append("\n"); String canonicalHeaderRepresentation = getCanonicalHeadersString(resourceFound.getRequestHeaders()); identifierBuilder.append("\n"); identifierBuilder.append(resourceFound.getBody()); } return identifierBuilder.toString(); }</code><technical_language>Is this needed</technical_language>

Target:
private String buildCanonicalResourceIdentifier(URI uri, SpiderResourceFound resourceFound) throws URIException { StringBuilder identifierBuilder = new StringBuilder(50); String visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation( uri, spider.getSpiderParam().getHandleParameters(), spider.getSpiderParam().isHandleODataParametersVisited()); identifierBuilder.append(resourceFound.getMethod()); identifierBuilder.append(" "); identifierBuilder.append(visitedURI); identifierBuilder.append("\n"); String canonicalHeaderRepresentation = getCanonicalHeadersString(resourceFound.getRequestHeaders()); identifierBuilder.append("\n"); identifierBuilder.append(resourceFound.getBody()); return identifierBuilder.toString(); }
Source:
<code>public byte[] resultToBinary(Map<String, R> result) { Aggregation<P, R, T> agg = this.result.values().stream().findAny().orElse(null); if (agg == null) { return new byte[0]; } Map<String, byte[]> mapped = result.entrySet().stream().collect( Collectors.toMap(Map.Entry::getKey, e -> agg.resultToBinary(e.getValue()))); int totalDataSize = mapped.entrySet().stream().map(e -> 8 + e.getKey().length() + e.getValue().length).reduce( 0, <START> Integer::sum); <END> ByteBuffer bb = ByteBuffer.allocate(4 + totalDataSize); bb.putInt(mapped.size()); mapped.forEach( (k, v) -> bb.putInt(k.length()).put(StringUtils.stringToBinary(k)).putInt(v.length).put(v)); return bb.array(); }</code><technical_language>I this assumptions size. If binning strategy is updated provide this hint, sense</technical_language>

Target:
public byte[] resultToBinary(Map<String, R> result) { final Aggregation<P, R, T> agg = this.getHelperAggregation(); Map<String, byte[]> mapped = result.entrySet().stream().collect( Collectors.toMap(Map.Entry::getKey, e -> agg.resultToBinary(e.getValue()))); int totalDataSize = mapped.entrySet().stream().map(e -> 8 + e.getKey().length() + e.getValue().length).reduce( 0, Integer::sum); ByteBuffer bb = ByteBuffer.allocate(4 + totalDataSize); bb.putInt(mapped.size()); mapped.forEach( (k, v) -> bb.putInt(k.length()).put(StringUtils.stringToBinary(k)).putInt(v.length).put(v)); return bb.array(); }
Source:
<code>public void sendEvent(Event event) { if (log.isDebugEnabled()) { <START> log.debug("Sending event: " + event); <END> } try { ClientMessage message = getClientSession().createMessage(true); String eventString = mapper.writeValueAsString(event); message.getBodyBuffer().writeString(eventString); getClientProducer().send(message); } catch (Exception e) { log.error("Error while trying to send event: " + event, e); } }</code><technical_language>if block required either</technical_language>

Target:
public void sendEvent(Event event) { log.debug("Sending event: " + event); try { ClientMessage message = getClientSession().createMessage(true); String eventString = mapper.writeValueAsString(event); message.getBodyBuffer().writeString(eventString); getClientProducer().send(message); } catch (Exception e) { log.error("Error while trying to send event: " + event, e); } }
Source:
<code>public void testMethodNotFound() throws Exception { <START> Map<String, Object> req = request(7, "not-found", null); <END> assertError(onMessage(rpc, req), JsonRpc.METHOD_NOT_FOUND); }</code><technical_language>suing Gson sides tests works. This if broke</technical_language>

Target:
public void testMethodNotFound() throws Exception { String message = "{\"method\":\"not-found\",\"id\":0,\"jsonrpc\":\"2.0\",\"params\":null}"; assertError(onMessage(rpc, message), JsonRpc.METHOD_NOT_FOUND); }
Source:
<code>public void migrate(DiagnosisMetadata diagnosisMetadata) { EmrVisitService emrVisitService = Context.getService(EmrVisitService.class); DiagnosisService oldDiagnosisService = new DiagnosisServiceImpl(); ((DiagnosisServiceImpl)oldDiagnosisService).setEncounterService(Context.getEncounterService()); ((DiagnosisServiceImpl)oldDiagnosisService).setObsService(Context.getObsService()); ((DiagnosisServiceImpl)oldDiagnosisService).setEmrApiProperties(Context.getRegisteredComponent("emrApiProperties", EmrApiProperties.class)); org.openmrs.api.DiagnosisService newDiagnosisService = Context.getService(org.openmrs.api.DiagnosisService.class); List<Diagnosis> allEmrapiDiagnosis = new ArrayList<Diagnosis>(); List<Integer> patientsIds = emrVisitService.getAllPatientsWithDiagnosis(diagnosisMetadata); for (int id : patientsIds) { Patient patient = Context.getPatientService().getPatient(id); <START> allEmrapiDiagnosis.addAll(oldDiagnosisService.getDiagnoses(patient, null)); <END> } List<org.openmrs.Diagnosis> diagnoses = convert(allEmrapiDiagnosis); for (org.openmrs.Diagnosis diagnosis : diagnoses) { newDiagnosisService.save(diagnosis); } }</code><technical_language>save diagnosis separately for patient? thought of memory implications patients diagnoses</technical_language>

Target:
public Boolean migrate(DiagnosisMetadata diagnosisMetadata) { Boolean migratedAtleastOneEncounterDiagosis = false; EmrVisitService emrVisitService = Context.getService(EmrVisitService.class); DiagnosisService oldDiagnosisService = new DiagnosisServiceImpl(); ((DiagnosisServiceImpl)oldDiagnosisService).setEncounterService(Context.getEncounterService()); ((DiagnosisServiceImpl)oldDiagnosisService).setObsService(Context.getObsService()); ((DiagnosisServiceImpl)oldDiagnosisService).setEmrApiProperties(Context.getRegisteredComponent("emrApiProperties", EmrApiProperties.class)); org.openmrs.api.DiagnosisService newDiagnosisService = Context.getService(org.openmrs.api.DiagnosisService.class); List<Integer> patientsIds = emrVisitService.getAllPatientsWithDiagnosis(diagnosisMetadata); for (int id : patientsIds) { Patient patient = Context.getPatientService().getPatient(id); List<org.openmrs.Diagnosis> diagnoses = convert(oldDiagnosisService.getDiagnoses(patient, null)); for (org.openmrs.Diagnosis diagnosis : diagnoses) { newDiagnosisService.save(diagnosis); migratedAtleastOneEncounterDiagosis = true; } } return migratedAtleastOneEncounterDiagosis; }
Source:
<code>public String[] getPartitionsFor(final String eventTypeName) throws ServiceUnavailableException { try { String[] partitions = partitionsPerEventType.get(eventTypeName); if (partitions == null) { <START> partitions = kafkaFactory.createProducer().partitionsFor(eventTypeName) <END> .stream() .map(partitionInfo -> String.valueOf(partitionInfo.partition())) .toArray(n -> new String[n]); partitionsPerEventType.put(eventTypeName, partitions); } return partitions; } catch (final KafkaException e) { throw new ServiceUnavailableException("Could not get partition information about '" + eventTypeName + "'", e); } }</code><technical_language>This class is kafka-specific. I more correct abstract kafka TopicRepository layer</technical_language>

Target:
public String[] getPartitionsFor(final String eventTypeName) throws NakadiException { String[] partitions = partitionsPerEventType.get(eventTypeName); if (partitions == null) { partitions = topicRepository.listPartitionNames(eventTypeName); partitionsPerEventType.put(eventTypeName, partitions); } return partitions; }
Source:
<code>public GhprbGitHubAuth getGitHubApiAuth() { if (gitHubAuthId == null) { <START> GhprbGitHubAuth auth = getDescriptor().getGithubAuth().get(0); <END> gitHubAuthId = auth.getId(); getDescriptor().save(); return auth; } return getDescriptor().getGitHubAuth(gitHubAuthId); }</code><technical_language>This assumes entry, is be</technical_language>

Target:
public GhprbGitHubAuth getGitHubApiAuth() { GhprbGitHubAuth auth = getDescriptor().getGitHubAuth(gitHubAuthId); if (gitHubAuthId == null && auth != null) { gitHubAuthId = auth.getId(); getDescriptor().save(); } return auth; }
Source:
<code>private void connect(InetAddress anAddr, int aPort, int timeout) throws IOException { InetAddress normalAddr = anAddr.isAnyLocalAddress() ? InetAddress.getLocalHost() : anAddr; if (streaming && usingSocks()) { socksConnect(anAddr, aPort, 0); } else { IoBridge.connect(fd, normalAddr, aPort, timeout); } <START> super.address = normalAddr; <END> super.port = aPort; }</code><technical_language>(I discussed this earlier, I find discussion) do prefer existing implementation to: private void connect( ) { InetAddress normalAddr = ...; if (streaming && usingSocks()) { } else { } onConnect(normalAddr, aPort); } changing super.onConnect( ); set super.address super.port ? I cleaner if *all* connects / binds called onConnect & onBind update state instead of themselves. Also, PlainDatagramSocketImpl#connect #disconnect, call onConnect onDisconnect. separate question: ----- want call onBind( ) local socket address port this point</technical_language>

Target:
private void connect(InetAddress anAddr, int aPort, int timeout) throws IOException { InetAddress normalAddr = anAddr.isAnyLocalAddress() ? InetAddress.getLocalHost() : anAddr; if (streaming && usingSocks()) { socksConnect(anAddr, aPort, 0); } else { IoBridge.connect(fd, normalAddr, aPort, timeout); } address = normalAddr; port = aPort; }
Source:
<code>void calculate(int startLine, int lineCount) { int endLine = startLine + lineCount; if (startLine < 0 || endLine > lineSizes.length) { return; } int hTrim = styledText.leftMargin + styledText.rightMargin + styledText.getCaretWidth(); for (int i = startLine; i < endLine; i++) { LineSizeInfo line = getLineSize(i); <START> if (line.width == -1 || line.height == -1) { <END> TextLayout layout = getTextLayout(i); Rectangle rect = layout.getBounds(); line.width = rect.width + hTrim; line.height = rect.height; disposeTextLayout(layout); } if (line.width > maxWidth) { maxWidth = line.width; maxWidthLineIndex = i; } } }</code><technical_language>wrap this condition line.needsRecaculateSize());</technical_language>

Target:
void calculate(int startLine, int lineCount) { int endLine = startLine + lineCount; if (startLine < 0 || endLine > lineSizes.length) { return; } int hTrim = styledText.leftMargin + styledText.rightMargin + styledText.getCaretWidth(); for (int i = startLine; i < endLine; i++) { LineSizeInfo line = getLineSize(i); if (line.needsRecaculateSize()) { TextLayout layout = getTextLayout(i); Rectangle rect = layout.getBounds(); line.width = rect.width + hTrim; line.height = rect.height; disposeTextLayout(layout); } if (line.width > maxWidth) { maxWidth = line.width; maxWidthLineIndex = i; } } }
Source:
<code>public static void setOmHome(File home) { OM_HOME = home; final String dataDir = System.getProperty("DATA_DIR"); if (Strings.isEmpty(dataDir)) { DATA_HOME = new File(OM_HOME, DATA_DIR); } else { <START> log.info("Overwrite custom DATA_DIR: {}", dataDir); <END> DATA_HOME = new File(dataDir); } }</code><technical_language>I move this log.info out of if/else logged :))) is wrong ENV variable? currently set DATA_DIR in auto start script work In case of applicationContext.xml patched upgrade ...</technical_language>

Target:
public static void setOmHome(File home) { OM_HOME = home; final String dataDir = System.getProperty("DATA_DIR"); if (Strings.isEmpty(dataDir)) { DATA_HOME = new File(OM_HOME, DATA_DIR); } else { DATA_HOME = new File(dataDir); } log.info("Using file locations - OM_HOME: DATA_DIR: {}", OM_HOME, DATA_HOME); }
Source:
<code>private LockRequest toLegacyLockRequest(LockRequestV2 request) { SortedMap<LockDescriptor, LockMode> locks = buildLockMap(request.getLockDescriptors(), LockMode.WRITE); LockRequest.Builder builder = LockRequest.builder(locks); <START> if (request.getAcquireTimeoutMs() < Long.MAX_VALUE) { <END> builder.blockForAtMost(SimpleTimeDuration.of(request.getAcquireTimeoutMs(), TimeUnit.MILLISECONDS)); } return builder.build(); }</code><technical_language>I feel this is hacky. I a endpoint for block indefinitely requests, a flag set in LockRequestV2 itself</technical_language>

Target:
private LockRequest toLegacyLockRequest(LockRequestV2 request) { SortedMap<LockDescriptor, LockMode> locks = buildLockMap(request.getLockDescriptors(), LockMode.WRITE); return LockRequest.builder(locks) .blockForAtMost(SimpleTimeDuration.of(request.getAcquireTimeoutMs(), TimeUnit.MILLISECONDS)) .build(); }
Source:
<code>public static Builder overriding(ExecutableElement method) { checkNotNull(method, "method == null"); if (method.getEnclosingElement().getModifiers().contains(Modifier.FINAL)) { <START> throw new IllegalArgumentException("Cannot override method on final class."); <END> } Set<Modifier> modifiers = method.getModifiers(); if (modifiers.contains(Modifier.PRIVATE) || modifiers.contains(Modifier.FINAL) || modifiers.contains(Modifier.STATIC)) { throw new IllegalArgumentException("cannot override method with modifiers: " + modifiers); } String methodName = method.getSimpleName().toString(); MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(methodName); methodBuilder.addAnnotation(Override.class); modifiers = new LinkedHashSet<>(modifiers); modifiers.remove(Modifier.ABSTRACT); modifiers.remove(Util.DEFAULT); methodBuilder.addModifiers(modifiers); for (TypeParameterElement typeParameterElement : method.getTypeParameters()) { TypeVariable var = (TypeVariable) typeParameterElement.asType(); methodBuilder.addTypeVariable(TypeVariableName.get(var)); } methodBuilder.returns(TypeName.get(method.getReturnType())); methodBuilder.addParameters(ParameterSpec.parametersOf(method)); methodBuilder.varargs(method.isVarArgs()); for (TypeMirror thrownType : method.getThrownTypes()) { methodBuilder.addException(TypeName.get(thrownType)); } return methodBuilder; }</code><technical_language>Include class name</technical_language>

Target:
public static Builder overriding(ExecutableElement method) { checkNotNull(method, "method == null"); Element enclosingClass = method.getEnclosingElement(); if (enclosingClass.getModifiers().contains(Modifier.FINAL)) { throw new IllegalArgumentException("Cannot override method on final class " + enclosingClass); } Set<Modifier> modifiers = method.getModifiers(); if (modifiers.contains(Modifier.PRIVATE) || modifiers.contains(Modifier.FINAL) || modifiers.contains(Modifier.STATIC)) { throw new IllegalArgumentException("cannot override method with modifiers: " + modifiers); } String methodName = method.getSimpleName().toString(); MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(methodName); methodBuilder.addAnnotation(Override.class); modifiers = new LinkedHashSet<>(modifiers); modifiers.remove(Modifier.ABSTRACT); modifiers.remove(Util.DEFAULT); methodBuilder.addModifiers(modifiers); for (TypeParameterElement typeParameterElement : method.getTypeParameters()) { TypeVariable var = (TypeVariable) typeParameterElement.asType(); methodBuilder.addTypeVariable(TypeVariableName.get(var)); } methodBuilder.returns(TypeName.get(method.getReturnType())); methodBuilder.addParameters(ParameterSpec.parametersOf(method)); methodBuilder.varargs(method.isVarArgs()); for (TypeMirror thrownType : method.getThrownTypes()) { methodBuilder.addException(TypeName.get(thrownType)); } return methodBuilder; }
Source:
<code>public void testValidateCodeWithoutCodeOrCodingOrCodeableConcept() throws Exception { Parameters inParams = new Parameters(); inParams.addParameter().setName("url").setValue(new UriType(CS_ACMS_URL)); inParams.addParameter().setName("display").setValue(new StringType("Systolic blood pressure.inspiration - expiration")); try { <START> myClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute(); <END> } catch (InvalidRequestException e) { assertEquals("HTTP 400 Bad Request: No code, coding, or codeableConcept provided to validate.",e.getMessage()); } }</code><technical_language>Suggestion: include a JUnit fail() statement this statement, in case exception is thrown expected</technical_language>

Target:
public void testValidateCodeWithoutCodeOrCodingOrCodeableConcept() throws Exception { Parameters inParams = new Parameters(); inParams.addParameter().setName("url").setValue(new UriType(CS_ACMS_URL)); inParams.addParameter().setName("display").setValue(new StringType("Systolic blood pressure.inspiration - expiration")); try { myClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute(); fail(); } catch (InvalidRequestException e) { assertEquals("HTTP 400 Bad Request: No code, coding, or codeableConcept provided to validate.",e.getMessage()); } }
Source:
<code>public static Lens<IInventory, ItemStack> getLens(Fabric<IInventory> fabric, net.minecraft.inventory.Container container, SlotCollection slots) { System.out.print("### getLens for: " + container.getClass().getName() + " ###\n"); if (container instanceof InventoryAdapter) { Lens lens = ((InventoryAdapter) container).getRootLens(); if (lens != null) { System.out.print("Adapter found\n"); return lens; } } if (container instanceof LensProvider) { System.out.print("LensProvider found\n"); InventoryAdapter<IInventory, ItemStack> adapter; if (container instanceof InventoryAdapter) { adapter = ((InventoryAdapter) container); } else { adapter = new Adapter(MinecraftFabric.of(container)); } <START> return ((LensProvider) container).getRootLens(null, adapter); END> } if (container.getInventory().size() == 0) { return null; } return generateLens(container, slots); }</code><technical_language>inv parameter of getRootLens annotated @Nullable if this null is remain</technical_language>

Target:
public static Lens<IInventory, ItemStack> getLens(Fabric<IInventory> fabric, net.minecraft.inventory.Container container, SlotCollection slots) { if (container instanceof InventoryAdapter) { Lens lens = ((InventoryAdapter) container).getRootLens(); if (lens != null) { return lens; } } if (container instanceof LensProvider) { InventoryAdapter<IInventory, ItemStack> adapter; if (container instanceof InventoryAdapter) { adapter = ((InventoryAdapter) container); } else { adapter = new Adapter(MinecraftFabric.of(container)); } return ((LensProvider) container).getRootLens(fabric, adapter); } if (container.getInventory().size() == 0) { return null; } return generateLens(container, slots); }
Source:
<code>private String getLocalizedMessage(final Locale locale) { <START> final String pattern = this.getMessagePattern(locale, this.code); <END> if ((this.code == null) || KuraErrorCode.INTERNAL_ERROR.equals(this.code)) { if ((this.arguments != null) && (this.arguments.length > 1)) { final StringBuilder sbAllArgs = new StringBuilder(); for (final Object arg : this.arguments) { sbAllArgs.append(" - "); sbAllArgs.append(arg); } this.arguments = new Object[] { sbAllArgs.toString() }; } } return MessageFormat.format(pattern, this.arguments); }</code><technical_language>I require a this. for method calling. code style?</technical_language>

Target:
private String getLocalizedMessage(final Locale locale) { final String pattern = getMessagePattern(locale, this.code); if ((this.code == null) || KuraErrorCode.INTERNAL_ERROR.equals(this.code)) { if ((this.arguments != null) && (this.arguments.length > 1)) { final StringBuilder sbAllArgs = new StringBuilder(); for (final Object arg : this.arguments) { sbAllArgs.append(" - "); sbAllArgs.append(arg); } this.arguments = new Object[] { sbAllArgs.toString() }; } } return MessageFormat.format(pattern, this.arguments); }
Source:
<code>public void prepareTest() { <START> driver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS); <END> }</code><technical_language>extending timeout 3 times</technical_language>

Target:
public void prepareTest() { driver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS); wikiURL = urlBuilder.getUrlForWiki(MercuryWikis.MERCURY_CC); }
Source:
<code>public void setServerContent(Map<String, String> serverContent) { this.serverContent = <START> serverContent; <END> }</code><technical_language>consider fail-fast checkNotNull(serverContent)</technical_language>

Target:
public void setServerContent(Map<String, String> serverContent) { Preconditions.checkNotNull(serverContent); this.serverContent = serverContent; }
Source:
<code>public IborIndexRates iborIndexRates(IborIndex index) { Curve curve = marketData.getValue(IborIndexCurveKey.of(index)); <START> if (curve == null) { <END> throw new IllegalArgumentException("Unable to find forward curve: " + index); } return IborIndexRates.of(index, getValuationDate(), curve, timeSeries(index)); }</code><technical_language>MarketData.getValue returns null</technical_language>

Target:
public IborIndexRates iborIndexRates(IborIndex index) { Curve curve = marketData.getValue(IborIndexCurveKey.of(index)); return IborIndexRates.of(index, getValuationDate(), curve, timeSeries(index)); }
Source:
<code><START> public String getStat() { <END> ProducerStats stats = ProducerStatsRegistry.getProducerStats(clientId); ProducerTopicStats topicStats = ProducerTopicStatsRegistry.getProducerTopicStats(clientId); StringBuilder sb = new StringBuilder(); sb.append("resend rate: ").append(stats.resendRate().count()).append('\n'); sb.append("serialization error rate: " ).append(stats.serializationErrorRate().count()).append('\n'); sb.append("failed send rate: ").append(stats.failedSendRate().count()).append('\n'); sb.append("message rate: ").append(topicStats.getProducerAllTopicsStats().messageRate().count()).append('\n'); sb.append("byte rate: " ).append(topicStats.getProducerAllTopicsStats().byteRate().count()).append('\n'); sb.append("dropped message rate: " ).append(topicStats.getProducerAllTopicsStats().droppedMessageRate().count()).append('\n'); return sb.toString(); }</code><technical_language>This need checked carefully. producer is publishing metrics yammer-metric library I check new producer is publishing metrics metrics there</technical_language>

Target:
public String getStat() { Map<String,? extends Metric> metrics = producer.metrics(); StringBuilder sb = new StringBuilder(); for( Map.Entry<String,? extends Metric> e : metrics.entrySet() ){ sb.append("kafka.").append(e.getKey()).append(": ").append(e.getValue().value()).append('\n'); } sb.append("messages-in-queue4sink: ").append( this.queue4Sink.size() ).append('\n'); sb.append("failures: ").append( this.failureCount.get() ).append('\n'); return sb.toString(); }