auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void OnConnected(DelegationIOConnection connection) { boolean offsetNeedRecoveryBeforeWork = false; for (PartitionTopicInfo info : partitionTopicInfos) { if (info.getFetchedOffset() < 0) { offsetNeedRecoveryBeforeWork = true; partitionBlockMap.put(info, true); <START> senOffsetRequest(connection, info); <END> } } if (!offsetNeedRecoveryBeforeWork) { if (betterOrdered) { sendMultiFetchRequest(connection); } else { for (PartitionTopicInfo info : partitionTopicInfos) { sendFetchRequest(connection, info); } } } }</code><technical_language>senOffsetRequest</technical_language>

Target:
public void OnConnected(DelegationIOConnection connection) { boolean offsetNeedRecoveryBeforeWork = false; for (PartitionTopicInfo info : partitionBlockMap.keySet()) { if (info.getFetchedOffset() < 0) { offsetNeedRecoveryBeforeWork = true; partitionBlockMap.put(info, true); sendOffsetRequest(connection, info); } } if (!offsetNeedRecoveryBeforeWork) { if (betterOrdered) { sendMultiFetchRequest(connection); } else { for (PartitionTopicInfo info : partitionBlockMap.keySet()) { sendFetchRequest(connection, info); } } } }
Source:
<code>public void chooseAdvancedOption(int i) { waitForElementByElement(advancedField); advancedOptionInputs.get(i).click(); <START> intraSearchButton.click(); <END> }</code><technical_language>log()</technical_language>

Target:
public void chooseAdvancedOption(int i) { waitForElementByElement(advancedField); advancedOptionInputs.get(i).click(); intraSearchButton.click(); PageObjectLogging.log("chooseAdvancedOption", "chosen advance option is selected", true, driver); }
Source:
<code>public static boolean needFigureChange(final WorkspaceImage bundledImage, IWorkspaceImageFigure figure) { boolean result = false; String workspacePath = bundledImage.getWorkspacePath(); if (StringUtil.isEmpty(workspacePath)) { <START> if (!(figure instanceof WorkspaceImageFigure)) { result = true; } <END> } else if (WorkspaceImageFigure.isSvgImage(workspacePath)) { if (!(figure instanceof SVGWorkspaceImageFigure)) { result = true; } } else if (!(figure instanceof WorkspaceImageFigure)) { result = true; } return result; }</code><technical_language>simplify this replacing if(x){result = true;} result = x;</technical_language>

Target:
public static boolean needFigureChange(final WorkspaceImage bundledImage, IWorkspaceImageFigure figure) { boolean result = false; String workspacePath = bundledImage.getWorkspacePath(); if (!StringUtil.isEmpty(workspacePath) && WorkspaceImageFigure.isSvgImage(workspacePath)) { result = !(figure instanceof SVGWorkspaceImageFigure); } else { result = !(figure instanceof WorkspaceImageFigure); } return result; }
Source:
<code>public Void visitIndexSource(IndexSourceNode node, Context context) { TableHandle tableHandle = node.getTableHandle(); Set<Column> columns = new HashSet<>(); for (ColumnHandle columnHandle : node.getAssignments().values()) { columns.add(createColumn(metadata.getColumnMetadata(session, tableHandle, columnHandle))); } Set<ColumnHandle> desiredColumns = node.getAssignments().values().stream().collect(toImmutableSet()); Optional<TableStatistics> statistics = Optional.empty(); <START> if (context.extractStatistics) { <END> Constraint<ColumnHandle> constraint = new Constraint<>(node.getCurrentConstraint()); TableStatistics tableStatistics = metadata.getTableStatistics(session, tableHandle, constraint); statistics = Optional.of(pruneStatistics(tableStatistics, desiredColumns)); } inputs.add(createInput(metadata.getTableMetadata(session, tableHandle), tableHandle, columns, statistics)); return null; }</code><technical_language>context.isExtractStatistics()</technical_language>

Target:
public Void visitIndexSource(IndexSourceNode node, Context context) { TableHandle tableHandle = node.getTableHandle(); Set<Column> columns = new HashSet<>(); for (ColumnHandle columnHandle : node.getAssignments().values()) { columns.add(createColumn(metadata.getColumnMetadata(session, tableHandle, columnHandle))); } Set<ColumnHandle> desiredColumns = node.getAssignments().values().stream().collect(toImmutableSet()); Optional<TableStatistics> statistics = Optional.empty(); if (context.isExtractStatistics()) { Constraint<ColumnHandle> constraint = new Constraint<>(node.getCurrentConstraint()); TableStatistics tableStatistics = metadata.getTableStatistics(session, tableHandle, constraint); statistics = Optional.of(pruneStatistics(tableStatistics, desiredColumns)); } inputs.add(createInput(metadata.getTableMetadata(session, tableHandle), tableHandle, columns, statistics)); return null; }
Source:
<code>private void applyPrefixForLegacyConsumer(Message message) { <START> if (session.getRemotingConnection() instanceof CoreRemotingConnection) { <END> CoreRemotingConnection coreRemotingConnection = (CoreRemotingConnection) session.getRemotingConnection(); if (session.getMetaData(ClientSession.JMS_SESSION_IDENTIFIER_PROPERTY) != null && coreRemotingConnection.getClientVersion() < PacketImpl.ADDRESSING_CHANGE_VERSION) { if (getQueue().getRoutingType().equals(RoutingType.ANYCAST)) { if (!message.getAddress().startsWith(PacketImpl.OLD_QUEUE_PREFIX.toString())) { message.setAddress(PacketImpl.OLD_QUEUE_PREFIX + message.getAddress()); } } else if (getQueue().getRoutingType().equals(RoutingType.MULTICAST)) { if (!message.getAddress().startsWith(PacketImpl.OLD_TOPIC_PREFIX.toString())) { message.setAddress(PacketImpl.OLD_TOPIC_PREFIX + message.getAddress()); } } } } }</code><technical_language>please cache this construction, apply this if cached boolean is set? This is part of hot path for delivering messages.. gain counts</technical_language>

Target:
private void applyPrefixForLegacyConsumer(Message message) { if (requiresLegacyPrefix) { if (anycast) { if (!message.getAddress().startsWith(PacketImpl.OLD_QUEUE_PREFIX.toString())) { message.setAddress(PacketImpl.OLD_QUEUE_PREFIX + message.getAddress()); } } else { if (!message.getAddress().startsWith(PacketImpl.OLD_TOPIC_PREFIX.toString())) { message.setAddress(PacketImpl.OLD_TOPIC_PREFIX + message.getAddress()); } } } }
Source:
<code>private void deleteResources(final IResourceUIModel[] uiResources, boolean willDeleteSubResources) { final JobGroup group = new JobGroup("Delete Openshift resources", 1, uiResources.length) { @Override protected boolean shouldCancel(IStatus lastCompletedJobResult, int numberOfFailedJobs, int numberOfCanceledJobs) { return false; } <START> }; <END> try (Stream<IResourceUIModel> stream = Arrays.stream(uiResources)) { stream.forEach(uiResource -> { DeleteResourceJob job = OpenShiftJobs.createDeleteResourceJob(uiResource.getResource(), willDeleteSubResources); job.setJobGroup(group); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if(!event.getResult().isOK()) { uiResource.setDeleting(false); } } }); uiResource.setDeleting(true); job.schedule(); }); } }</code><technical_language>I suggest create schedule job for bunch of resources, if more 1 of them. job, for instance, iterate stream (1) check if monitor is cancelled, (2) report monitor of task, (3) set 'deleting' true, (4) explicitly call job.doRun(monitor) (let's public), (5) a job listener, check status set 'deleting' false if ok</technical_language>

Target:
private void deleteResources(final IResourceUIModel[] uiResources, boolean willDeleteSubResources) { final JobGroup group = new JobGroup("Delete Openshift resources", 1, uiResources.length) { @Override protected boolean shouldCancel(IStatus lastCompletedJobResult, int numberOfFailedJobs, int numberOfCanceledJobs) { return false; } }; DeleteResourceJob<IResourceUIModel> job = new DeleteResourceJob<>(Arrays.asList(uiResources), willDeleteSubResources, new DeleteResourceJob.Callback<IResourceUIModel>() { @Override public IResource getResource(IResourceUIModel wrapper) { return wrapper.getResource(); } @Override public void preProcess(IResourceUIModel wrapper) { wrapper.setDeleting(true); } @Override public void postProcess(IResourceUIModel wrapper) { wrapper.setDeleting(false); } }); job.schedule(); }
Source:
<code>public void testSaveBulkNullListItem() throws Exception { List<Document> documents = new Vector<Document>(); documents.add(null); documents.add(new Document(UUID.randomUUID().toString(), System.currentTimeMillis(), mapper.valueToTree(Collections.singletonMap("TEST_NAME", "SINGLE_SAVE_TEST")))); <START> queryStore.save(TestUtils.TEST_TABLE_NAME, documents); <END> }</code><technical_language>Check for equality of error code</technical_language>

Target:
public void testSaveBulkNullListItem() throws Exception { List<Document> documents = new Vector<Document>(); documents.add(null); documents.add(new Document(UUID.randomUUID().toString(), System.currentTimeMillis(), mapper.valueToTree(Collections.singletonMap("TEST_NAME", "SINGLE_SAVE_TEST")))); try { queryStore.save(TestUtils.TEST_TABLE_NAME, documents); } catch (QueryStoreException e) { assertEquals(QueryStoreException.ErrorCode.INVALID_REQUEST, e.getErrorCode()); throw e; } }
Source:
<code>protected final MessageValues deserializePayloadIfNecessary(Message<?> message) { return MessageSerializationUtils.deserializePayload(new MessageValues(message), this.contentTypeResolver, <START> this.payloadTypeCache, this.codec); <END> }</code><technical_language>This payloadTypeCache MessageSerializationUtils directly. I similar in JavaClassMimeTypeUtils for mimeTypesCache. So, consistent</technical_language>

Target:
protected final MessageValues deserializePayloadIfNecessary(Message<?> message) { return MessageSerializationUtils.deserializePayload(new MessageValues(message), this.contentTypeResolver, this.codec); }
Source:
<code>public RestOperations restOperations() { RestTemplate restOperations = (RestTemplate) super.restOperations(); <START> if (vaultProperties.getNamespace() != null) { <END> restOperations.getInterceptors().add(VaultClients .createNamespaceInterceptor(vaultProperties.getNamespace())); } return restOperations; }</code><technical_language>extract this a method replace <LINK_0></technical_language>

Target:
public RestOperations restOperations() { RestTemplate restOperations = (RestTemplate) super.restOperations(); applyNamespaceInterceptor(restOperations); return restOperations; }
Source:
<code><START> private ProgramState closeResource(ProgramState programState, final SymbolicValue target) { <END> if (target != null && isOpened(programState, target)) { return programState.addConstraint(target.wrappedValue(), NullConstraint.CLOSED); } return programState; }</code><technical_language>Please fix this issue</technical_language>

Target:
private static ProgramState closeResource(ProgramState programState, final SymbolicValue target) { if (target != null && isOpened(programState, target)) { return programState.addConstraint(target.wrappedValue(), NullConstraint.CLOSED); } return programState; }
Source:
<code>protected Reader reader(String path) throws IOException { <START> return new StringReader("key=testKey\npassword=ServerPassword\na=b\nlog=2"); <END> }</code><technical_language>Do need this? I kafka.server.MockFileConfigProvider in tests</technical_language>

Target:
protected Reader reader(String path) throws IOException { return new StringReader("key=testKey\npassword=randomPassword"); }
Source:
<code>private ICommandControlDMContext getCommandControlContext(Object obj) { IDMContext context = null; if (obj instanceof IDMVMContext) context = ((IDMVMContext)obj).getDMContext(); else if (obj instanceof GdbLaunch) { GdbLaunch l = (GdbLaunch)obj; final DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), l.getSession().getId()); Query<IDMContext> contextQuery = new Query<IDMContext>() { @Override protected void execute(DataRequestMonitor<IDMContext> rm) { <START> ICommandControlService commandControl = tracker.getService(ICommandControlService.class); <END> if (commandControl != null) { rm.setData(commandControl.getContext()); } rm.done(); } }; l.getSession().getExecutor().submit(contextQuery); try { context = contextQuery.get(); } catch (Exception e) { } } return DMContexts.getAncestorOfType(context, ICommandControlDMContext.class); }</code><technical_language>Please dispose of tracker here. tracker.dispose()</technical_language>

Target:
private ICommandControlDMContext getCommandControlContext(Object obj) { IDMContext context = null; if (obj instanceof IDMVMContext) context = ((IDMVMContext)obj).getDMContext(); else if (obj instanceof GdbLaunch) { GdbLaunch l = (GdbLaunch)obj; final DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), l.getSession().getId()); Query<IDMContext> contextQuery = new Query<IDMContext>() { @Override protected void execute(DataRequestMonitor<IDMContext> rm) { ICommandControlService commandControl = tracker.getService(ICommandControlService.class); tracker.dispose(); if (commandControl != null) { rm.setData(commandControl.getContext()); } rm.done(); } }; l.getSession().getExecutor().submit(contextQuery); try { context = contextQuery.get(); } catch (Exception e) { } } return DMContexts.getAncestorOfType(context, ICommandControlDMContext.class); }
Source:
<code>public SparkConf sparkConf() { Optional<SparkConfiguration> maybeSparkConfiguration = rhizomeConfiguration.getSparkConfiguration(); Optional<CassandraConfiguration> maybeCassandraConfiguration = rhizomeConfiguration.getCassandraConfiguration(); if ( maybeSparkConfiguration.isPresent() && maybeCassandraConfiguration.isPresent() ) { SparkConfiguration sparkConfiguration = maybeSparkConfiguration.get(); CassandraConfiguration cassandraConfiguration = maybeCassandraConfiguration.get(); StringBuilder sparkMasterUrlBuilder; if ( sparkConfiguration.isLocal() ) { sparkMasterUrlBuilder = new StringBuilder( sparkConfiguration.getSparkMasters().iterator().next() ); } else { sparkMasterUrlBuilder = new StringBuilder( "spark://" ); String sparkMastersAsString = sparkConfiguration.getSparkMasters().stream() .collect( Collectors.joining( "," ) ); <START> sparkMasterUrlBuilder.append( sparkMastersAsString ); <END> } return new SparkConf() .setMaster( sparkMasterUrlBuilder.toString() ) .setAppName( sparkConfiguration.getAppName() ) .set( "spark.cassandra.connection.host", cassandraConfiguration.getCassandraSeedNodes().stream() .map( host -> host.getHostAddress() ).collect( Collectors.joining( "," ) ) ) .set( "spark.cassandra.connection.port", Integer.toString( 9042 ) ) .setJars( sparkConfiguration.getJarLocations() ); } return null; }</code><technical_language>Gonna want port in well. Apparently full string is "spark://<url>:<port>"</technical_language>

Target:
public SparkConf sparkConf() { Optional<SparkConfiguration> maybeSparkConfiguration = rhizomeConfiguration.getSparkConfiguration(); Optional<CassandraConfiguration> maybeCassandraConfiguration = rhizomeConfiguration.getCassandraConfiguration(); if ( maybeSparkConfiguration.isPresent() && maybeCassandraConfiguration.isPresent() ) { SparkConfiguration sparkConfiguration = maybeSparkConfiguration.get(); CassandraConfiguration cassandraConfiguration = maybeCassandraConfiguration.get(); StringBuilder sparkMasterUrlBuilder; if ( sparkConfiguration.isLocal() ) { sparkMasterUrlBuilder = new StringBuilder( sparkConfiguration.getSparkMasters().iterator().next() ); } else { sparkMasterUrlBuilder = new StringBuilder( "spark://" ); String sparkMastersAsString = sparkConfiguration.getSparkMasters().stream() .map( master -> master + ":" + Integer.toString( sparkConfiguration.getSparkPort() ) ) .collect( Collectors.joining( "," ) ); sparkMasterUrlBuilder.append( sparkMastersAsString ); } return new SparkConf() .setMaster( sparkMasterUrlBuilder.toString() ) .setAppName( sparkConfiguration.getAppName() ) .set( "spark.cassandra.connection.host", cassandraConfiguration.getCassandraSeedNodes().stream() .map( host -> host.getHostAddress() ).collect( Collectors.joining( "," ) ) ) .set( "spark.cassandra.connection.port", Integer.toString( 9042 ) ) .setJars( sparkConfiguration.getJarLocations() ); } return null; }
Source:
<code>public static void checkPermission(Subject subject, int subjectMask, AuthorizationPermission perm) { if ((subjectMask & perm.getMask()) != perm.getMask()) { if (System.getSecurityManager() == null) { <START> throw log.unauthorizedAccess(subject == null ? "null" : subject.toString(), perm.toString()); <END> } else { System.getSecurityManager().checkPermission(perm.getSecurityPermission()); } } }</code><technical_language>String.valueOf() avoid checking for null code :P</technical_language>

Target:
public static void checkPermission(Subject subject, int subjectMask, AuthorizationPermission perm) { if ((subjectMask & perm.getMask()) != perm.getMask()) { if (System.getSecurityManager() == null) { throw log.unauthorizedAccess(String.valueOf(subject), perm.toString()); } else { System.getSecurityManager().checkPermission(perm.getSecurityPermission()); } } }
Source:
<code>private void checkForRegions() { Collection<Entry<ByteArrayWrapper, RedisData>> entrySet = keyRegistrar.keyInfos(); for (Entry<ByteArrayWrapper, RedisData> entry : entrySet) { ByteArrayWrapper key = entry.getKey(); RedisDataType type = entry.getValue().getType(); <START> if (!regionCache.typeUsesDynamicRegions(type)) { <END> continue; } if (cache.getRegion(key.toString()) != null) { continue; } try { regionCache.createRemoteRegionReferenceLocally(key, type); } catch (Exception e) { if (logger.errorEnabled()) { logger.error(e); } } } }</code><technical_language>"regionCache" renamed "regionProvider"? Line 506 talks a 'regionCache', 509 a 'cache'. I code wondering, "why caches"</technical_language>

Target:
private void checkForRegions() { Collection<Entry<ByteArrayWrapper, RedisData>> entrySet = keyRegistrar.keyInfos(); for (Entry<ByteArrayWrapper, RedisData> entry : entrySet) { ByteArrayWrapper key = entry.getKey(); RedisDataType type = entry.getValue().getType(); if (!regionProvider.typeUsesDynamicRegions(type)) { continue; } if (cache.getRegion(key.toString()) != null) { continue; } try { regionProvider.createRemoteRegionReferenceLocally(key, type); } catch (Exception e) { if (logger.errorEnabled()) { logger.error(e); } } } }
Source:
<code>private void generateVertxToJsonMethod(JDefinedClass jclass) { JMethod toJsonMethod = jclass.method(JMod.PUBLIC, jclass.owner().ref("io.vertx.core.json.JsonObject"), "toJson"); toJsonMethod.javadoc().add("Encode to JsonObject"); JBlock constructorBody = toJsonMethod.body(); <START> constructorBody.directStatement("JsonObject obj = new JsonObject()"); <END> constructorBody.add( jclass.owner() .ref(jclass.fullName() + "Converter") .staticInvoke("toJson") .arg(JExpr._this()) .arg(JExpr.ref("obj")) ); constructorBody._return(JExpr.ref("obj")); }</code><technical_language>missing a semicolon, no? I extrapolated AbstractAnnotator based work, thanks</technical_language>

Target:
private void generateVertxToJsonMethod(JDefinedClass jclass) { JMethod toJsonMethod = jclass.method(JMod.PUBLIC, jclass.owner().ref("io.vertx.core.json.JsonObject"), "toJson"); toJsonMethod.javadoc().add("Encode to JsonObject"); JBlock constructorBody = toJsonMethod.body(); constructorBody.directStatement("JsonObject obj = new JsonObject();"); constructorBody.add( jclass.owner() .ref(jclass.fullName() + "Converter") .staticInvoke("toJson") .arg(JExpr._this()) .arg(JExpr.ref("obj")) ); constructorBody._return(JExpr.ref("obj")); }
Source:
<code>public String toString() { <START> if (getNamespaceURI().equals(XMLConstants.NULL_NS_URI)) { <END> return getLocalPart(); } else { return "{" + getNamespaceURI() + "}" + getLocalPart(); } }</code><technical_language>please Objects.equals here</technical_language>

Target:
public String toString() { if (Objects.equals(getNamespaceURI(), XMLConstants.NULL_NS_URI)) { return getLocalPart(); } else { return "{" + getNamespaceURI() + "}" + getLocalPart(); } }
Source:
<code>public void requestWhenBearerTokenResolverAllowsQueryParameterThenEitherHeaderOrQueryParameterIsAccepted() throws Exception { this.spring.register(AllowBearerTokenAsQueryParameterConfig.class, JwtDecoderConfig.class, BasicController.class).autowire(); JwtDecoder decoder = this.spring.getContext().getBean(JwtDecoder.class); when(decoder.decode(anyString())).thenReturn(JWT); DefaultBearerTokenResolver resolver = this.spring.getContext().getBean(DefaultBearerTokenResolver.class); <START> resolver.setAllowUriQueryParameter(true); <END> this.mvc.perform(get("/authenticated") .with(bearerToken(JWT_TOKEN))) .andExpect(status().isOk()) .andExpect(content().string(JWT_SUBJECT)); this.mvc.perform(get("/authenticated?access_token=" + JWT_TOKEN)) .andExpect(status().isOk()) .andExpect(content().string(JWT_SUBJECT)); }</code><technical_language>This a needless change, AllowBearerTokenAsQueryParameterConfig that</technical_language>

Target:
public void requestWhenBearerTokenResolverAllowsQueryParameterThenEitherHeaderOrQueryParameterIsAccepted() throws Exception { this.spring.register(AllowBearerTokenAsQueryParameterConfig.class, JwtDecoderConfig.class, BasicController.class).autowire(); JwtDecoder decoder = this.spring.getContext().getBean(JwtDecoder.class); when(decoder.decode(anyString())).thenReturn(JWT); this.mvc.perform(get("/authenticated") .with(bearerToken(JWT_TOKEN))) .andExpect(status().isOk()) .andExpect(content().string(JWT_SUBJECT)); this.mvc.perform(get("/authenticated") .param("access_token", JWT_TOKEN)) .andExpect(status().isOk()) .andExpect(content().string(JWT_SUBJECT)); }
Source:
<code>private static Map<String, X509Certificate> getTrustedCertificates() { ImmutableMap.Builder<String, X509Certificate> certificateMap = ImmutableMap.builder(); try { <START> InputStream certificateResource = DefaultCas.class.getResourceAsStream(CA_CERTIFICATES_CRT); <END> ByteArrayOutputStream inMemoryCertificates = new ByteArrayOutputStream(); ByteStreams.copy(certificateResource, inMemoryCertificates); List<X509Certificate> caCertificates = KeyStores.readX509Certificates(new ByteArrayInputStream(inMemoryCertificates.toByteArray())) .stream() .map(cert -> (X509Certificate) cert) .collect(Collectors.toList()); int index = 0; for (X509Certificate cert : caCertificates) { String certificateCommonName = cert.getSubjectX500Principal().getName().toLowerCase(Locale.ENGLISH); certificateMap.put(certificateCommonName, cert); log.debug( "Adding CA certificate", SafeArg.of("certificateIndex", index), SafeArg.of("certificateCount", caCertificates.size()), SafeArg.of("certificateCommonName", certificateCommonName), SafeArg.of("expiry", cert.getNotAfter()), SafeArg.of( "sha256Fingerprint", Hashing.sha256().hashBytes(cert.getEncoded()).toString())); index++; } } catch (CertificateException | IOException e) { throw new SafeRuntimeException("Could not read file as an X.509 certificate", e); } return certificateMap.build(); }</code><technical_language>Resource streams closed, this added try</technical_language>

Target:
private static Map<String, X509Certificate> getTrustedCertificates() { ImmutableMap.Builder<String, X509Certificate> certificateMap = ImmutableMap.builder(); try { List<X509Certificate> caCertificates = KeyStores.readX509Certificates( new ByteArrayInputStream(Resources.toByteArray(Resources.getResource(CA_CERTIFICATES_CRT)))) .stream() .map(cert -> (X509Certificate) cert) .collect(Collectors.toList()); int index = 0; for (X509Certificate cert : caCertificates) { String certificateCommonName = cert.getSubjectX500Principal().getName().toLowerCase(Locale.ENGLISH); certificateMap.put(certificateCommonName, cert); log.debug( "Adding CA certificate", SafeArg.of("certificateIndex", index), SafeArg.of("certificateCount", caCertificates.size()), SafeArg.of("certificateCommonName", certificateCommonName), SafeArg.of("expiry", cert.getNotAfter()), SafeArg.of( "sha256Fingerprint", Hashing.sha256().hashBytes(cert.getEncoded()).toString())); index++; } } catch (CertificateException | IOException e) { throw new SafeRuntimeException("Could not read file as an X.509 certificate", e); } return certificateMap.build(); }
Source:
<code>private void sendError(HttpServletRequest request, HttpServletResponse response, String message) throws IOException { final Request baseRequest = Request.getBaseRequest(request); final Response baseResponse = Objects.requireNonNull(baseRequest).getResponse(); if (LOG.isDebugEnabled()) LOG.debug("OpenId authentication FAILED: {}", message); if (_errorPage == null) { if (LOG.isDebugEnabled()) LOG.debug("auth failed 403"); if (response != null) response.sendError(HttpServletResponse.SC_FORBIDDEN); } else { if (LOG.isDebugEnabled()) LOG.debug("auth failed {}", _errorPage); String redirectUri = URIUtil.addPaths(request.getContextPath(), _errorPage); if (message != null) { String query = URIUtil.combineQueryParams(ERROR_PARAMETER + "=" + UrlEncoded.encodeString(message), _errorQuery); <START> redirectUri = URIUtil.addPaths(request.getContextPath(), _errorPath) + "?" + query; <END> baseResponse.sendRedirect(getRedirectCode(baseRequest.getHttpVersion()), redirectUri); } baseResponse.sendRedirect(getRedirectCode(baseRequest.getHttpVersion()), redirectUri); } }</code><technical_language>In 10.0.x I added URIUtil: java /** Add a path a query string * @param path path a query * @param query query string null if query added * @return path null query added a '?' '&amp;' appropriate. */ public static String addPathQuery(String path, String query) { if (query == null) return path; if (path.indexOf('?') >= 0) return path + '&' + query; return path + '?' + query; } port here</technical_language>

Target:
private void sendError(HttpServletRequest request, HttpServletResponse response, String message) throws IOException { final Request baseRequest = Request.getBaseRequest(request); final Response baseResponse = Objects.requireNonNull(baseRequest).getResponse(); if (LOG.isDebugEnabled()) LOG.debug("OpenId authentication FAILED: {}", message); if (_errorPage == null) { if (LOG.isDebugEnabled()) LOG.debug("auth failed 403"); if (response != null) response.sendError(HttpServletResponse.SC_FORBIDDEN); } else { if (LOG.isDebugEnabled()) LOG.debug("auth failed {}", _errorPage); String redirectUri = URIUtil.addPaths(request.getContextPath(), _errorPage); if (message != null) { String query = URIUtil.addQueries(ERROR_PARAMETER + "=" + UrlEncoded.encodeString(message), _errorQuery); redirectUri = URIUtil.addPathQuery(URIUtil.addPaths(request.getContextPath(), _errorPath), query); baseResponse.sendRedirect(getRedirectCode(baseRequest.getHttpVersion()), redirectUri); } baseResponse.sendRedirect(getRedirectCode(baseRequest.getHttpVersion()), redirectUri); } }
Source:
<code>public CoreEvent process(CoreEvent event) throws MuleException { try { return processToApply(event, this); } catch (Exception error) { Throwable cause = error.getCause(); <START> if (cause instanceof RetryContextInitializationException && <END> cause.getCause() instanceof ExpressionRuntimeException) { throw ((ExpressionRuntimeException) cause.getCause()); } else { throw error; } } }</code><technical_language>check for != null</technical_language>

Target:
public CoreEvent process(CoreEvent event) throws MuleException { try { return processToApply(event, this); } catch (Exception error) { Throwable cause = error.getCause(); if (cause != null && cause instanceof RetryContextInitializationException && cause.getCause() instanceof ExpressionRuntimeException) { throw ((ExpressionRuntimeException) cause.getCause()); } else { throw error; } } }
Source:
<code>public void create(final String version, List<String> participants) { LOG.info(String.format("Creating barrier with version: %s, participants: %s.", version, participants)); String barrierRoot = keyBuilder.getBarrierRoot(); String barrierParticipantsPath = keyBuilder.getBarrierParticipantsPath(version); String barrierStatePath = keyBuilder.getBarrierStatePath(version); zkUtils.validatePaths(new String[]{ barrierRoot, keyBuilder.getBarrierPath(version), barrierParticipantsPath, barrierStatePath}); <START> LOG.info(String.format("Marking the barrier state: %s as %s.", barrierStatePath, State.NEW)); <END> zkUtils.writeData(barrierStatePath, State.NEW); LOG.info("Subscribing child changes for the path: {}.", barrierParticipantsPath); zkUtils.subscribeChildChanges(barrierParticipantsPath, new ZkBarrierChangeHandler(version, participants, zkUtils)); barrierListenerOptional.ifPresent(zkBarrierListener -> zkBarrierListener.onBarrierCreated(version)); }</code><technical_language>remove String.format boiler plate log4j formatters instead</technical_language>

Target:
public void create(final String version, List<String> participants) { LOG.info(String.format("Creating barrier with version: %s, participants: %s.", version, participants)); String barrierRoot = keyBuilder.getBarrierRoot(); String barrierParticipantsPath = keyBuilder.getBarrierParticipantsPath(version); String barrierStatePath = keyBuilder.getBarrierStatePath(version); zkUtils.validatePaths(new String[]{ barrierRoot, keyBuilder.getBarrierPath(version), barrierParticipantsPath, barrierStatePath}); LOG.info("Marking the barrier state: as {}.", barrierStatePath, State.NEW); zkUtils.writeData(barrierStatePath, State.NEW); LOG.info("Subscribing child changes on the path: for barrier version: {}.", barrierParticipantsPath, version); zkUtils.subscribeChildChanges(barrierParticipantsPath, new ZkBarrierChangeHandler(version, participants, zkUtils)); barrierListenerOptional.ifPresent(zkBarrierListener -> zkBarrierListener.onBarrierCreated(version)); }
Source:
<code>public int migrate(int currentVersion, MigrationDataProvider<ApplicationScope> migrationDataProvider, ProgressObserver observer) { final AdminClient adminClient = provider.getClient().admin(); final int latestVersion = dataVersion.getImplementationVersion(); observer.start(); migrationDataProvider.getData().flatMap(applicationScope -> { LegacyIndexIdentifier legacyIndexIdentifier = new LegacyIndexIdentifier(indexFig, applicationScope); String[] indexes = indexCache.getIndexes(legacyIndexIdentifier.getAlias(), AliasedEntityIndex.AliasType.Read); return Observable.from(indexes); }) .doOnNext(index -> { IndicesAliasesRequestBuilder aliasesRequestBuilder = adminClient.indices().prepareAliases(); aliasesRequestBuilder = adminClient.indices().prepareAliases(); aliasesRequestBuilder.addAlias(index, indexIdentifier.getAlias().getReadAlias()); observer.update(latestVersion,"EsIndexDataMigrationImpl: fixed index: " + index ); }) <START> .doOnError(error -> { <END> log.error("failed to migrate index", error); observer.failed(latestVersion,"EsIndexDataMigrationImpl: failed to migrate",error); }) .doOnCompleted(() -> observer.complete()) .toBlocking().lastOrDefault(null); return latestVersion; }</code><technical_language>Lets catch + swallow exceptions expect. this fail silently migration succeed</technical_language>

Target:
public int migrate(int currentVersion, MigrationDataProvider<ApplicationScope> migrationDataProvider, ProgressObserver observer) { final AdminClient adminClient = provider.getClient().admin(); final int latestVersion = dataVersion.getImplementationVersion(); entityIndex.initialize(); observer.start(); try { migrationDataProvider.getData().flatMap(applicationScope -> { LegacyIndexIdentifier legacyIndexIdentifier = new LegacyIndexIdentifier(indexFig, applicationScope); String[] indexes = indexCache.getIndexes(legacyIndexIdentifier.getAlias(), AliasedEntityIndex.AliasType.Read); return Observable.from(indexes); }) .doOnNext(index -> { IndicesAliasesRequestBuilder aliasesRequestBuilder = adminClient.indices().prepareAliases(); aliasesRequestBuilder = adminClient.indices().prepareAliases(); try { aliasesRequestBuilder.addAlias(index, indexIdentifier.getAlias().getReadAlias()).get(); } catch (InvalidAliasNameException e) { log.debug("Failed to add alias due to name conflict",e); } observer.update(latestVersion, "EsIndexDataMigrationImpl: fixed index: " + index); }) .doOnCompleted(() -> observer.complete()) .toBlocking().lastOrDefault(null); }catch (Exception e){ log.error("Failed to migrate index", e); throw e; } return latestVersion; }
Source:
<code>public void insert(final String id, final SupervisorSpec spec) { dbi.withHandle( new HandleCallback<Void>() { @Override public Void withHandle(Handle handle) throws Exception { final String version = new DateTime().toString(); handle.createStatement( String.format( "INSERT INTO %s (id, spec_id, version, payload) VALUES (:id, :spec_id, :version, :payload)", getSupervisorsTable() ) ) <START> .bind("id", String.format("%s_%s_%s", id, version, UUIDUtils.generateUuid())) <END> .bind("spec_id", id) .bind("version", version) .bind("payload", jsonMapper.writeValueAsBytes(spec)) .execute(); return null; } } ); }</code><technical_language>uuid part of version too, right? max(version) for supervisor work</technical_language>

Target:
public void insert(final String id, final SupervisorSpec spec) { dbi.withHandle( new HandleCallback<Void>() { @Override public Void withHandle(Handle handle) throws Exception { handle.createStatement( String.format( "INSERT INTO %s (spec_id, created_date, payload) VALUES (:spec_id, :created_date, :payload)", getSupervisorsTable() ) ) .bind("spec_id", id) .bind("created_date", new DateTime().toString()) .bind("payload", jsonMapper.writeValueAsBytes(spec)) .execute(); return null; } } ); }
Source:
<code>private void initLargeRequestThrottlingSettings() { <START> setLargeRequestMaxBytes(Integer.getInteger("zookeeper.largeRequestMaxBytes", 100 * 1024 * 1024)); <END> setLargeRequestThreshold(Integer.getInteger("zookeeper.largeRequestThreshold", -1)); }</code><technical_language>defined largeRequestMaxBytes int for default value</technical_language>

Target:
private void initLargeRequestThrottlingSettings() { setLargeRequestMaxBytes(Integer.getInteger("zookeeper.largeRequestMaxBytes", largeRequestMaxBytes)); setLargeRequestThreshold(Integer.getInteger("zookeeper.largeRequestThreshold", -1)); }
Source:
<code>public void testCache() { final AtomicBoolean criticalVariable = new AtomicBoolean(); SequencerServerCache cache = new SequencerServerCache(1, Address.NOT_FOUND); final long firstValue = 1L; final long secondValue = 2L; final int iterations = 10; final ConflictTxStream firstKey = new ConflictTxStream(UUID.randomUUID(), new byte[]{}, firstValue); final ConflictTxStream secondKey = new ConflictTxStream(UUID.randomUUID(), new byte[]{}, secondValue); for (int i = 0; i < iterations; i++) { <START> criticalVariable.set(false); <END> cache.put(firstKey); cache.put(secondKey); assertThat(cache.size()).isOne(); assertThat(cache.getIfPresent(firstKey)).isNull(); } }</code><technical_language>criticalVariable is now</technical_language>

Target:
public void testCache() { final AtomicBoolean criticalVariable = new AtomicBoolean(); SequencerServerCache cache = new SequencerServerCache(1, Address.NOT_FOUND); final long firstValue = 1L; final long secondValue = 2L; final int iterations = 10; final ConflictTxStream firstKey = new ConflictTxStream(UUID.randomUUID(), new byte[]{}, firstValue); final ConflictTxStream secondKey = new ConflictTxStream(UUID.randomUUID(), new byte[]{}, secondValue); for (int i = 0; i < iterations; i++) { cache.put(firstKey); cache.put(secondKey); assertThat(cache.size()).isOne(); assertThat(cache.get(firstKey)).isEqualTo(Address.NON_ADDRESS); } }
Source:
<code>protected void deployPartialComponent(RuntimeContext ctx, Set<TargetExtensions> extensionPoints, StreamRef component) throws IOException { RegistrationInfo ri = ((DefaultRuntimeContext) ctx).createRegistrationInfo(component); String alias = ri.getName().getName(); String name = alias.concat("-partial"); Set<Pair<String, String>> targets = extensionPoints.stream() .map(TargetExtensions::getTargetExtensions) .flatMap(Set::stream) .collect(Collectors.toSet()); String ext = Arrays.stream(ri.getExtensions()) .filter(e -> targets.contains( Pair.of(e.getTargetComponent().getName(), e.getExtensionPoint()))) .map(Extension::toXML) <START> .reduce((o, x) -> o + x) <END> .orElse(""); InlineURLFactory.install(); ctx.deploy(new InlineRef(name, String.format("<component name=\"%s\"><alias>%s</alias>%s</component>", name, alias, ext))); }</code><technical_language>collect(Collectors.joining()) avoid lambda expression orElse</technical_language>

Target:
protected void deployPartialComponent(RuntimeContext ctx, Set<TargetExtensions> extensionPoints, StreamRef component) throws IOException { RegistrationInfo ri = ((DefaultRuntimeContext) ctx).createRegistrationInfo(component); String name = ri.getName().getName() + "-partial"; Set<String> targets = extensionPoints.stream() .map(TargetExtensions::getTargetExtensions) .flatMap(Set::stream) .collect(Collectors.toSet()); String ext = Arrays.stream(ri.getExtensions()) .filter(e -> targets.contains(TargetExtensions.newTargetExtension( e.getTargetComponent().getName(), e.getExtensionPoint()))) .map(Extension::toXML) .collect(Collectors.joining()); InlineURLFactory.install(); ctx.deploy(new InlineRef(name, String.format("<component name=\"%s\">%s</component>", name, ext))); }
Source:
<code>public void testEmptyStruct() { CompatibilityReport report = getCompatibilityReport(NestedEmptyStruct.class, NestedEmptyStruct.class); <START> assertTrue(report.prettyMessages().contains("new struct is an empty struct: /required_empty/")); <END> assertTrue(report.prettyMessages().contains("new struct is an empty struct: /optional_empty/")); assertTrue(report.hasEmptyStruct()); }</code><technical_language>assertEquals() instead? assertTrue provide good error messages</technical_language>

Target:
public void testEmptyStruct() { CompatibilityReport report = getCompatibilityReport(NestedEmptyStruct.class, NestedEmptyStruct.class); assertEquals("encountered an empty struct: required_empty\nencountered an empty struct: optional_empty",report.prettyMessages()); assertTrue(report.hasEmptyStruct()); }
Source:
<code>public Mono<AccessToken> getToken(TokenRequestContext request) { AtomicReference<Throwable> cause = new AtomicReference<>(); List<CredentialUnavailableException> exceptions = new ArrayList<>(4); return Flux.fromIterable(credentials) .flatMap(p -> p.getToken(request).onErrorResume(CredentialUnavailableException.class, t -> { exceptions.add(t); return Mono.empty(); }), 1) .next() .switchIfEmpty(Mono.defer(() -> { StringBuilder message = new StringBuilder("Tried " + credentials.stream().map(c -> c.getClass().getSimpleName()) .collect(Collectors.joining(", ")) <START> + " but failed to acquire a token for any of them. Please verify the" + " environment for either of them" <END> + " and see more details in the causes below."); CredentialUnavailableException last = exceptions.get(exceptions.size() - 1); for (int z = exceptions.size() - 2; z >= 0; z--) { CredentialUnavailableException current = exceptions.get(z); last = new CredentialUnavailableException(current.getMessage(), last); } return Mono.error(new CredentialUnavailableException(message.toString(), last)); })); }</code><technical_language>remove "either of them" list of credentials try more 2</technical_language>

Target:
public Mono<AccessToken> getToken(TokenRequestContext request) { List<CredentialUnavailableException> exceptions = new ArrayList<>(4); return Flux.fromIterable(credentials) .flatMap(p -> p.getToken(request).onErrorResume(CredentialUnavailableException.class, t -> { exceptions.add(t); return Mono.empty(); }), 1) .next() .switchIfEmpty(Mono.defer(() -> { StringBuilder message = new StringBuilder("Tried " + credentials.stream().map(c -> c.getClass().getSimpleName()) .collect(Collectors.joining(", ")) + " but failed to acquire a token for any of them. Please verify the" + " environment for the credentials" + " and see more details in the causes below."); CredentialUnavailableException last = exceptions.get(exceptions.size() - 1); for (int z = exceptions.size() - 2; z >= 0; z--) { CredentialUnavailableException current = exceptions.get(z); last = new CredentialUnavailableException(current.getMessage(), last); } return Mono.error(new CredentialUnavailableException(message.toString(), last)); })); }
Source:
<code>public void testBasicOperation() throws Exception { assertNotNull(fExperiment); assertNotNull(fTraces); SelectTracesOperation selectTracesOperation = new <START> SelectTracesOperation(NonNullUtils.checkNotNull(fExperiment), <END> fTraces, new HashMap<String, TmfTraceElement>()); PlatformUI.getWorkbench().getProgressService().run(true, true, selectTracesOperation); validateTracesExperiment(false); }</code><technical_language>please, talk Matthew. I Objects.requireNotNull() instead of NonNulUtils.checkNotNUll()</technical_language>

Target:
public void testBasicOperation() throws Exception { assertNotNull(fExperiment); assertNotNull(fTraces); SelectTracesOperation selectTracesOperation = new SelectTracesOperation(Objects.requireNonNull(fExperiment), fTraces, new HashMap<String, TmfTraceElement>()); PlatformUI.getWorkbench().getProgressService().run(true, true, selectTracesOperation); validateTracesExperiment(false); }
Source:
<code><START> private List<PatchLineComment> <END> byCommentStatus( ResultSet<PatchLineComment> comments, final PatchLineComment.Status status) throws OrmException { return Lists.newArrayList( Iterables.filter(comments, new Predicate<PatchLineComment>() { @Override public boolean apply(PatchLineComment input) { return (input.getStatus() == status); } }) ); }</code><technical_language>private static Note static qualifier method order in class is wrong. Private methods expected public. Dave clarified order of methods in this change [1]. i place helper method methods help. line 146 in this ps. [1] <LINK_0></technical_language>

Target:
private static List<PatchLineComment> byCommentStatus( ResultSet<PatchLineComment> comments, final PatchLineComment.Status status) { return Lists.newArrayList( Iterables.filter(comments, new Predicate<PatchLineComment>() { @Override public boolean apply(PatchLineComment input) { return (input.getStatus() == status); } }) ); }
Source:
<code>public static String installJava6IfPossible() { <START> return installPackageOr(MutableMap.of("apt", "openjdk-6-jdk","yum", "java-1.6.0-openjdk-devel"), null, <END> chain("which zypper", sudo("zypper --non-interactive addrepo <LINK_1> java_sles_11"), sudo("zypper --non-interactive addrepo <LINK_2> java_suse_11"), sudo("zypper --non-interactive addrepo <LINK_0> java_suse_12"), alternatives(installPackageOrFail(MutableMap.of("zypper", "java-1_6_0-openjdk-devel"), null), installPackage(MutableMap.of("zypper", "java-1_6_0-ibm"), null)))); }</code><technical_language>this compare JavaSoftwareProcessSshDriver.installJava</technical_language>

Target:
public static String installJava6IfPossible() { return ok(installJava6()); }
Source:
<code><START> public static ResourceTable buildResourceTable(AndroidManifest appManifest) { <END> List<ResourcePath> allLibraryResourcePaths = new LinkedList<>(); addTransitiveResourcePaths(appManifest.getLibraryManifests(), allLibraryResourcePaths); return buildResourceTable(appManifest.getPackageName(), appManifest.getResourcePath(), allLibraryResourcePaths); }</code><technical_language>If this conceivably a strategy class (seems could?), non-static allow a ResourceMerger injected... cool if want put thinking though</technical_language>

Target:
public static ResourceTable buildResourceTable(AndroidManifest appManifest) { List<ResourcePath> allResourcePaths = appManifest.getIncludedResourcePaths(); PackageResourceIndex resourceIndex = new PackageResourceIndex(appManifest.getPackageName()); ResourceTable resourceTable = new ResourceTable(resourceIndex); ResourceRemapper resourceRemapper = null; for (ResourcePath resourcePath : allResourcePaths) { if (resourceRemapper == null) { resourceRemapper = new ResourceRemapper(resourcePath.getRClass()); } else { resourceRemapper.remapRClass(resourcePath.getRClass()); } if (resourcePath.getRClass() != null) { ResourceExtractor.populate(resourceIndex, resourcePath.getRClass()); } } for (ResourcePath resourcePath : allResourcePaths) { ResourceParser.load(appManifest.getPackageName(), resourcePath, resourceTable); } return resourceTable; }
Source:
<code>public void setUsePatternFly(final boolean usePatternFly) { setWrapperStyleName(""); <START> setContentWidgetContainerStyleName(""); END> setContentWidgetContainerStyleName(""); setLabelStyleName(""); if (usePatternFly) { addContentWidgetStyleName(PatternflyConstants.FORM_CONTROL); addWrapperStyleName(PatternflyConstants.FORM_GROUP); } else { addContentWidgetContainerStyleName(style.contentWidget()); addWrapperStyleName(style.wrapper()); } addContentWidgetContainerStyleName("avw_contentWidget_pfly_fix"); addWrapperStyleName("avw_wrapper_pfly_fix"); addLabelStyleName(style.label()); addLabelStyleName(style.labelEnabled()); }</code><technical_language>I want clear out existing styles. if defined some style classes in ui binder file this widget, this wipe out values</technical_language>

Target:
public void setUsePatternFly(final boolean usePatternFly) { removeLabelStyleName(style.label_legacy()); removeContentWidgetStyleName(style.contentWidget_legacy()); removeContentWidgetStyleName(Styles.FORM_CONTROL); removeContentWidgetContainerStyleName(style.contentWidgetContainer_legacy()); removeContentWidgetContainerStyleName("avw_contentWidgetContainer_pfly_fix"); removeWrapperStyleName(Styles.FORM_GROUP); removeWrapperStyleName(style.wrapper_legacy()); removeWrapperStyleName("avw_wrapper_pfly_fix"); if (usePatternFly) { addContentWidgetStyleName(Styles.FORM_CONTROL); addWrapperStyleName(Styles.FORM_GROUP); } else { addLabelStyleName(style.label_legacy()); addContentWidgetStyleName(style.contentWidget_legacy()); addContentWidgetContainerStyleName(style.contentWidgetContainer_legacy()); addContentWidgetContainerStyleName("avw_contentWidgetContainer_pfly_fix"); addWrapperStyleName(style.wrapper_legacy()); addWrapperStyleName("avw_wrapper_pfly_fix"); } }
Source:
<code>public CatchupFuture catchup(long sequence) { try (LockResource stateLock = new LockResource(mStateLock)) { Preconditions.checkState(mSuspended, "Not suspended"); Preconditions.checkState(!mResumeInProgress, "Resume in progress"); Preconditions.checkState(mCatchupThread == null || !mCatchupThread.isAlive(), "Catch-up task in progress."); <START> Preconditions.checkState(sequence >= 0, "Invalid sequence: %d", sequence); <END> Preconditions.checkState(mLastAppliedSequence <= sequence, "Can't catchup to past. Current: %d, Requested: %d", mLastAppliedSequence, sequence); LOG.info("Catching up state machine to sequence: {}", sequence); if (mLastAppliedSequence == sequence) { return CatchupFuture.completed(); } mCatchupThread = new RaftJournalCatchupThread(sequence); mCatchupThread.start(); return new CatchupFuture(mCatchupThread); } }</code><technical_language>Somewhere, add is invalid is 0? ways for invalid</technical_language>

Target:
public CatchupFuture catchup(long sequence) { try (LockResource stateLock = new LockResource(mStateLock)) { Preconditions.checkState(mSuspended, "Not suspended"); Preconditions.checkState(!mResumeInProgress, "Resume in progress"); Preconditions.checkState(mCatchupThread == null || !mCatchupThread.isAlive(), "Catch-up task in progress."); Preconditions.checkState(sequence >= 0, "Invalid negative sequence: %d", sequence); Preconditions.checkState(mLastAppliedSequence <= sequence, "Can't catchup to past. Current: %d, Requested: %d", mLastAppliedSequence, sequence); LOG.info("Catching up state machine to sequence: {}", sequence); if (mLastAppliedSequence == sequence) { return CatchupFuture.completed(); } mCatchupThread = new RaftJournalCatchupThread(sequence); mCatchupThread.start(); return new CatchupFuture(mCatchupThread); } }
Source:
<code>private static Iterable<? extends ZipkinCompatBinaryAnnotation> spanMetadataToZipkinBinaryAnnotations( Span span, ZipkinCompatEndpoint endpoint) { return span.getMetadata().entrySet().stream() .map(entry -> ZipkinCompatBinaryAnnotation.of(entry.getKey(), entry.getValue(), endpoint)) <START> .collect(Collectors.toList()); <END> }</code><technical_language>a worried streams this code path allocates a fair bit for typically a single element</technical_language>

Target:
private static Iterable<? extends ZipkinCompatBinaryAnnotation> spanMetadataToZipkinBinaryAnnotations( Span span, ZipkinCompatEndpoint endpoint) { List<ZipkinCompatBinaryAnnotation> binaryAnnotations = Lists.newArrayList(); for (Map.Entry<String, String> entry : span.getMetadata().entrySet()) { binaryAnnotations.add(ZipkinCompatBinaryAnnotation.of(entry.getKey(), entry.getValue(), endpoint)); } return binaryAnnotations; }