auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testMultipleContentLengthHeaders() { EmbeddedChannel channel = new EmbeddedChannel(new HttpRequestDecoder()); String requestStr = "GET /some/path HTTP/1.1\r\n" + <START> "Content-Length: 1\r\n" + <END> "Content-Length: 0\r\n\r\n" + "b"; assertTrue(channel.writeInbound(Unpooled.copiedBuffer(requestStr, CharsetUtil.US_ASCII))); HttpRequest request = channel.readInbound(); assertTrue(request.decoderResult().isFailure()); assertTrue(request.decoderResult().cause() instanceof IllegalArgumentException); assertFalse(channel.finish()); }</code><technical_language>code, this is issue want test non-contiguous content-length headers: java String requestStr = "GET /some/path HTTP/1.1\r\n" + "Content-Length: 1\r\n" + "Connection: close\r\n" + "Content-Length: 0\r\n\r\n" + "b";</technical_language>

Target:
public void testMultipleContentLengthHeaders() { String requestStr = "GET /some/path HTTP/1.1\r\n" + "Content-Length: 1\r\n" + "Content-Length: 0\r\n\r\n" + "b"; testInvalidHeaders0(requestStr); }
Source:
<code>public Promise<Object> submit(CheckType checkType, Runnable runnable) { final Job job = new ValidationJob(checkType.getName(), runnable); String uniqueRuleId = UUID.randomUUID().toString(); final ISchedulingRule schedulingRule = new ValidationRuleSchedulingRule(checkType, maxValidationThreadCount, uniqueRuleId); final Promise<Object> isRuleDonePromise = new Promise<>(); job.setSystem(true); job.setRule(schedulingRule); job.addJobChangeListener(new JobChangeAdapter() { <START> public void done(IJobChangeEvent event) { <END> if (event.getResult().isOK()) { isRuleDonePromise.resolve(Boolean.TRUE); } else { isRuleDonePromise.reject(new ValidationException(String.format("Validation job failed with status %s.", event.getResult()))); } }; }); job.schedule(); return isRuleDonePromise; }</code><technical_language>Missing @Override annotation</technical_language>

Target:
public Promise<Object> submit(CheckType checkType, Runnable runnable) { final Job job = new ValidationJob(checkType.getName(), runnable); final String uniqueRuleId = UUID.randomUUID().toString(); final ISchedulingRule schedulingRule = new ValidationRuleSchedulingRule(checkType, maxValidationThreadCount, maxConcurrentExpensiveJobs, maxConcurrentNormalJobs, uniqueRuleId); final Promise<Object> promise = new Promise<>(); job.setSystem(true); job.setRule(schedulingRule); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if (event.getResult().isOK()) { promise.resolve(Boolean.TRUE); } else { promise.reject(new ValidationException(String.format("Validation job failed with status %s.", event.getResult()))); } } }); job.schedule(); return promise; }
Source:
<code>public void testExpressionPerformance() throws Exception { <START> System.out.println("===Expression performance tests==="); <END> System.out.println("---1 million---"); runExpressionPerformance(1000000); System.out.println("---10 million---"); runExpressionPerformance(10000000); System.out.println("---100 million---"); runExpressionPerformance(100000000); System.out.println("---1 billion---"); runExpressionPerformance(1000000000); }</code><technical_language>Log instead of System.out</technical_language>

Target:
public void testExpressionPerformance() throws Exception { logger.info("===Expression performance tests==="); logger.info("---1 million---"); runExpressionPerformance(1000000); logger.info("---10 million---"); runExpressionPerformance(10000000); logger.info("---100 million---"); runExpressionPerformance(100000000); logger.info("---1 billion---"); runExpressionPerformance(1000000000); }
Source:
<code>private DashboardResource parse(ProjectControl ctl, String ref, String path, ProjectControl myCtl) throws ResourceNotFoundException, IOException, ConfigInvalidException { String id = ref + ":" + path; if (!ref.startsWith(REFS_DASHBOARDS)) { ref = REFS_DASHBOARDS + ref; } if (!Repository.isValidRefName(ref) || !ctl.controlForRef(ref).canRead()) { throw new ResourceNotFoundException(id); } Repository git; try { git = gitManager.openRepository(ctl.getProject().getNameKey()); } catch (RepositoryNotFoundException e) { throw new ResourceNotFoundException(id); } try { ObjectId objId; try { <START> objId = git.resolve(id); <END> } catch (AmbiguousObjectException e) { throw new ResourceNotFoundException(id); } catch (IncorrectObjectTypeException e) { throw new ResourceNotFoundException(id); } if (objId == null) { throw new ResourceNotFoundException(id); } BlobBasedConfig cfg = new BlobBasedConfig(null, git, objId); return new DashboardResource(myCtl, ref, path, cfg, false); } finally { git.close(); } }</code><technical_language>This lost refs/dashboards prefix, fail resolve JGit for "foo:bar" in refs/dashboards/foo"</technical_language>

Target:
private DashboardResource parse(ProjectControl ctl, String ref, String path, ProjectControl myCtl) throws ResourceNotFoundException, IOException, AmbiguousObjectException, IncorrectObjectTypeException, ConfigInvalidException { String id = ref + ":" + path; if (!ref.startsWith(REFS_DASHBOARDS)) { ref = REFS_DASHBOARDS + ref; } if (!Repository.isValidRefName(ref) || !ctl.controlForRef(ref).canRead()) { throw new ResourceNotFoundException(id); } Repository git; try { git = gitManager.openRepository(ctl.getProject().getNameKey()); } catch (RepositoryNotFoundException e) { throw new ResourceNotFoundException(id); } try { ObjectId objId = git.resolve(ref + ":" + path); if (objId == null) { throw new ResourceNotFoundException(id); } BlobBasedConfig cfg = new BlobBasedConfig(null, git, objId); return new DashboardResource(myCtl, ref, path, cfg, false); } finally { git.close(); } }
Source:
<code>public static void setUpBeforeClass() throws CoreException, IOException { provider = new MockConnectionProvider(); <START> provider.start(); <END> project = TestUtils.createProject(EditorToOutlineAdapterFactoryTest.class.getName() + System.currentTimeMillis()); testFile = TestUtils.createUniqueTestFile(project, "Hello World !!"); IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .findView("org.eclipse.ui.views.ContentOutline"); if (viewPart instanceof ContentOutline) { outline = (ContentOutline) viewPart; } Assert.assertNotNull(outline); }</code><technical_language>need that. LS is bound file-type (see other tests)</technical_language>

Target:
public static void setUpBeforeClass() throws CoreException, IOException { project = TestUtils .createProject(EditorToOutlineAdapterFactoryTest.class.getName() + System.currentTimeMillis()); testFile = TestUtils.createUniqueTestFile(project, "Hello World !!"); IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .findView("org.eclipse.ui.views.ContentOutline"); if (viewPart instanceof ContentOutline) { outline = (ContentOutline) viewPart; } Assert.assertNotNull(outline); }
Source:
<code>Flux<ByteBuffer> getBody() { if (batchOperationQueue.isEmpty()) { throw logger.logExceptionAsError(new UnsupportedOperationException("Empty batch requests aren't allowed.")); } Disposable disposable = Flux.fromStream(batchOperationQueue.stream()) .flatMap(batchOperation -> batchOperation) .subscribe(); while (!disposable.isDisposed()) { <START> } <END> this.batchRequest.add(ByteBuffer .wrap(String.format("--%s--NEWLINE", batchBoundary).getBytes(StandardCharsets.UTF_8))); return Flux.fromIterable(batchRequest); }</code><technical_language>XD sneaky mom! --- In reply to: [333121225](<LINK_0> [](ancestors = 333121225)</technical_language>

Target:
Flux<ByteBuffer> getBody() { if (batchOperationQueue.isEmpty()) { throw logger.logExceptionAsError(new UnsupportedOperationException("Empty batch requests aren't allowed.")); } Disposable disposable = Flux.fromStream(batchOperationQueue.stream()) .flatMap(batchOperation -> batchOperation) .subscribe(); while (!disposable.isDisposed()) { } this.batchRequest.add(ByteBuffer.wrap( String.format("--%s--%s", batchBoundary, BlobBatchHelper.HTTP_NEWLINE).getBytes(StandardCharsets.UTF_8))); return Flux.fromIterable(batchRequest); }
Source:
<code>public static Map<String, GeneAnnotation> parseGeneAnnotations( final File file) throws IOException { Map<String, GeneAnnotation> genomeAnnotations = new HashMap<String, GeneAnnotation>(); <START> Stream<String> annotationFile = Files.lines(file.toPath()); <END> annotationFile.forEach(line -> { GeneAnnotation genome = parseGeneAnnotation(line); if (genome != null) { genomeAnnotations.put(genome.getName(), genome); } }); annotationFile.close(); return genomeAnnotations; }</code><technical_language>annotationLines name</technical_language>

Target:
public static Set<GeneAnnotation> parseGeneAnnotations(final File file) throws IOException { Set<GeneAnnotation> genomeAnnotations = new HashSet<>(); Stream<String> annotationLines = Files.lines(file.toPath()); annotationLines.map(GeneAnnotationParser::parseGeneAnnotation) .filter(genome -> genome != null) .forEach(genome -> genomeAnnotations.add(genome)); annotationLines.close(); return genomeAnnotations; }
Source:
<code>public static void trimMemory() { synchronized (sAppIconCache) { sAppIconCache.clear(); } <START> System.gc(); <END> }</code><technical_language>[Never](<LINK_0></technical_language>

Target:
public static void trimMemory() { synchronized (sAppIconCache) { sAppIconCache.clear(); } }
Source:
<code>protected void setUp() throws Exception { <START> source = "void foo(int x) {\n\tx += 1;\n}"; END> expectedSource = "void foo(int x) {\n\tx++;\n}"; super.setUp(); }</code><technical_language>Code embedded newlines is hard read. Please split literal newline</technical_language>

Target:
protected void setUp() throws Exception { source = "void foo(int x) {\n" + " x += 1;\n" + "}"; expectedSource = "void foo(int x) {\n" + " x++;\n" + "}"; super.setUp(); }
Source:
<code>public SimpleDeadlineManager(ScopeAwareProvider scopeAwareProvider) { <START> this(scopeAwareProvider, Executors.newSingleThreadScheduledExecutor(), NoTransactionManager.INSTANCE); <END> }</code><technical_language>Please construct default Executor AxonThreadFactory. This Axon managed threads recognizable. (mandatory) group name "deadlineManager"</technical_language>

Target:
public SimpleDeadlineManager(ScopeAwareProvider scopeAwareProvider) { this(scopeAwareProvider, NoTransactionManager.INSTANCE); }
Source:
<code>public AuthenticationEventExecutionPlanConfigurer ldapPasswordSynchronizationAuthenticationEventExecutionPlanConfigurer( @Qualifier("ldapPasswordSynchronizationAuthenticationPostProcessorListFactoryBean") final ListFactoryBean ldapPasswordSynchronizationAuthenticationPostProcessorListFactoryBean) { return plan -> { try { val postProcessorList = Objects.requireNonNull(ldapPasswordSynchronizationAuthenticationPostProcessorListFactoryBean.getObject()); val ldap = casProperties.getAuthn().getPasswordSync().getLdap(); ldap.stream() .filter(LdapPasswordSynchronizationProperties::isEnabled) .forEach(instance -> { val postProcessor = new LdapPasswordSynchronizationAuthenticationPostProcessor(instance); postProcessorList.add(postProcessor); plan.registerAuthenticationPostProcessor(postProcessor); }); } catch (final Exception e) { <START> throw new BeanCreationException("Error creating ldapPasswordSynchronizationAuthenticationPostProcessorListFactoryBean: {}", e.getMessage(), e); <END> } }; }</code><technical_language>Small note: exception messages do work parameterized messages</technical_language>

Target:
public AuthenticationEventExecutionPlanConfigurer ldapPasswordSynchronizationAuthenticationEventExecutionPlanConfigurer( @Qualifier("ldapPasswordSynchronizationAuthenticationPostProcessorListFactoryBean") final ListFactoryBean ldapPasswordSynchronizationAuthenticationPostProcessorListFactoryBean) { return plan -> { try { val postProcessorList = Objects.requireNonNull(ldapPasswordSynchronizationAuthenticationPostProcessorListFactoryBean.getObject()); val ldap = casProperties.getAuthn().getPasswordSync().getLdap(); ldap.stream() .filter(LdapPasswordSynchronizationProperties::isEnabled) .forEach(instance -> { val postProcessor = new LdapPasswordSynchronizationAuthenticationPostProcessor(instance); postProcessorList.add(postProcessor); plan.registerAuthenticationPostProcessor(postProcessor); }); } catch (final Exception e) { throw new BeanCreationException("Error creating ldapPasswordSynchronizationAuthenticationEventExecutionPlanConfigurer: " + e.getMessage(), e); } }; }
Source:
<code>public void testLinkToConvertedMarkupDocument_WithAnchor() throws URISyntaxException { final File file = new File("/base/2/with space/"); builder.setConvertMarkupPageLinks(true); builder.setBase(file.toURI()); parser.parse("\"An URL\":foo/bar#bar"); String html = out.toString(); TestUtil.println("HTML: \n" + html); Pattern pattern = Pattern.compile("<a href=\"file:(/[A-Z]{1}:)?/base/2/with%20space/foo/bar.html#bar\">An URL</a>"); assertTrue(pattern.matcher(html).find()); <START> } <END></code><technical_language>4 previous tests save structure. Consider create a helper method avoid code duplication</technical_language>

Target:
public void testLinkToConvertedMarkupDocument_WithAnchor() throws URISyntaxException { final File file = new File("/base/2/with space/"); builder.setHtmlFilenameFormat("$1.html"); builder.setBase(file.toURI()); parser.parse("\"An URL\":foo/bar#bar"); assertMatch("<a href=\"file:(/[A-Z]{1}:)?/base/2/with%20space/foo/bar.html#bar\">An URL</a>"); }
Source:
<code>public void addPrivateEndpointNetworkPolicies(CloudSubnet cloudSubnet, String state) { <START> cloudSubnet.putParameter(PRIVATE_ENDPOINT_NETWORK_POLICIES, "Disabled".equals(state) ? DISABLED : ENABLED); <END> }</code><technical_language>instead of "Disabled" DISABLED variable equalsIgnoreCase</technical_language>

Target:
public void addPrivateEndpointNetworkPolicies(CloudSubnet cloudSubnet, String state) { cloudSubnet.putParameter(PRIVATE_ENDPOINT_NETWORK_POLICIES, "Disabled".equalsIgnoreCase(state) ? DISABLED : ENABLED); }
Source:
<code>public boolean hasPermission(String sid, Permission p, boolean principal) { final SecurityRealm securityRealm = Jenkins.getInstance().getSecurityRealm(); final IdStrategy strategy = principal ? securityRealm.getUserIdStrategy() : securityRealm.getGroupIdStrategy(); for (; p != null; p = p.impliedBy) { if (!p.getEnabled()) { continue; } Set<String> set = grantedPermissions.get(p); <START> if (set != null && set.contains(sid)) <END> return true; if (set != null) { for (String s: set) { if (strategy.equals(s, sid)) { return true; } } } } return false; }</code><technical_language>TABs</technical_language>

Target:
public boolean hasPermission(String sid, Permission p, boolean principal) { final SecurityRealm securityRealm = Jenkins.getActiveInstance().getSecurityRealm(); final IdStrategy strategy = principal ? securityRealm.getUserIdStrategy() : securityRealm.getGroupIdStrategy(); for (; p != null; p = p.impliedBy) { if (!p.getEnabled()) { continue; } Set<String> set = grantedPermissions.get(p); if (set == null) { continue; } if (set.contains(sid)) { return true; } for (String s : set) { if (strategy.equals(s, sid)) { return true; } } } return false; }
Source:
<code>public void run() { while (true) { try { ErrorInfoItem currItem; currItem = m_errorInfo.take(); if (currItem.lineNumber == -1) { return; } if (currItem.errorInfo.length != 2) { System.out.println("internal error, information is not enough"); } out_invaliderowfile.write(currItem.errorInfo[0] + "\n"); String message = "Invalid input on line " + currItem.lineNumber + ". " + currItem.errorInfo[1]; out_logfile.write(message + "\n Content: " + currItem.errorInfo[0] + "\n"); m_errorCount++; } catch (Exception x) { try { out_logfile.write(x.getMessage()); } catch (IOException e) { <START> e.printStackTrace(); <END> } } } }</code><technical_language>want print original message std error, exception happened write log file</technical_language>

Target:
public void run() { while (true) { try { ErrorInfoItem currItem; currItem = m_errorInfo.take(); if (currItem.lineNumber == -1) { return; } if (currItem.errorInfo.length != 2) { System.out.println("internal error, information is not enough"); } out_invaliderowfile.write(currItem.errorInfo[0] + "\n"); String message = "Invalid input on line " + currItem.lineNumber + ". " + currItem.errorInfo[1]; out_logfile.write(message + "\n Content: " + currItem.errorInfo[0] + "\n"); m_errorCount++; } catch (Exception x) { System.err.println(x.getMessage()); } } }
Source:
<code>StatementClient startQuery(String sql, Map<String, String> sessionPropertiesOverride) { String source = firstNonNull(clientInfo.get("ApplicationName"), "presto-jdbc"); Map<String, String> allProperties = new HashMap<>(sessionProperties); allProperties.putAll(sessionPropertiesOverride); int millis = networkTimeoutMillis.get(); <START> Duration timeout = (millis > 0) ? new Duration(millis, MILLISECONDS) : new Duration(1, DAYS); <END> ClientSession session = new ClientSession( httpUri, user, source, ImmutableSet.of(), clientInfo.get("ClientInfo"), catalog.get(), schema.get(), timeZoneId.get(), locale.get(), ImmutableMap.copyOf(allProperties), ImmutableMap.copyOf(preparedStatements), transactionId.get(), false, timeout); return queryExecutor.startQuery(session, sql); }</code><technical_language>1 day? Also, consider conversion milliseconds == 0 1 day immediately in setNetworkTimeout? I this visible in getNetworkTimeout(), a good thing? I find in getNetworkTimeout()'s preventing this</technical_language>

Target:
StatementClient startQuery(String sql, Map<String, String> sessionPropertiesOverride) { String source = firstNonNull(clientInfo.get("ApplicationName"), "presto-jdbc"); Iterable<String> clientTags = Splitter.on(',').trimResults().omitEmptyStrings() .split(nullToEmpty(clientInfo.get("ClientTags"))); Map<String, String> allProperties = new HashMap<>(sessionProperties); allProperties.putAll(sessionPropertiesOverride); int millis = networkTimeoutMillis.get(); Duration timeout = (millis > 0) ? new Duration(millis, MILLISECONDS) : new Duration(999, DAYS); ClientSession session = new ClientSession( httpUri, user, source, ImmutableSet.copyOf(clientTags), clientInfo.get("ClientInfo"), catalog.get(), schema.get(), timeZoneId.get(), locale.get(), ImmutableMap.copyOf(allProperties), ImmutableMap.copyOf(preparedStatements), transactionId.get(), false, timeout); return queryExecutor.startQuery(session, sql); }
Source:
<code>public boolean isThisType(String name, boolean open) { Location location = new Location(name); if (!location.exists()) { return false; } if (checkSuffix(name, ND_SUFFIX)) return true; if (open) { location = location.getAbsoluteFile(); Location parent = location.getParentFile(); String baseName = location.getName(); while (baseName.indexOf('_') >= 0) { baseName = baseName.substring(0, baseName.lastIndexOf("_")); if (checkSuffix(name, suffixes)) { for (String ext : PARENT_INDEX_SUFFIX) { if ((new Location(parent, baseName + "." + ext)).exists() || (new Location(parent, baseName + "." + ext.toUpperCase())).exists()) { return true; } } } } <START> } <END> return super.isThisType(name, open); }</code><technical_language>Previously behaviour in isThisType return false for suffix htd, HTD added PARENT_INDEX_SUFFIX is returning true is allowing identify files claimed CellWorxReader</technical_language>

Target:
public boolean isThisType(String name, boolean open) { Location location = new Location(name); if (!location.exists()) { return false; } if (checkSuffix(name, ND_SUFFIX)) return true; if (open) { location = location.getAbsoluteFile(); Location parent = location.getParentFile(); String baseName = location.getName(); while (baseName.indexOf('_') >= 0) { baseName = baseName.substring(0, baseName.lastIndexOf("_")); if (checkSuffix(name, suffixes)) { for (String ext : ND_SUFFIX) { if (new Location(parent, baseName + "." + ext).exists() || new Location(parent, baseName + "." + ext.toUpperCase()).exists()) { return true; } } if (new Location(parent, baseName + ".htd").exists() || new Location(parent, baseName + ".HTD").exists()) { return false; } } } } return super.isThisType(name, open); }
Source:
<code>public Schema createSchema(DocumentType input) { Schema schema = Schema.createRecord(getName(input), null, input.getNamespace().prefix, false); List<Field> fields = new ArrayList<>(input.getSchemas().size()); for (org.nuxeo.ecm.core.schema.types.Schema s : context.sort(input.getSchemas())) { Schema fieldSchema = context.createSchema(s); if (fieldSchema != null) { fields.add(new Field(s.getName(), fieldSchema, null, (Object) null)); } else { <START> log.error("field schema is null for : " + s.getName()); <END> } } schema.setFields(fields); return schema; }</code><technical_language>Throw exception instead</technical_language>

Target:
public Schema createSchema(DocumentType input) { Schema schema = Schema.createRecord(getName(input), null, input.getNamespace().prefix, false); List<Field> fields = new ArrayList<>(input.getSchemas().size()); for (org.nuxeo.ecm.core.schema.types.Schema s : context.sort(input.getSchemas())) { fields.add(new Field(s.getName(), context.createSchema(s), null, (Object) null)); } schema.setFields(fields); return schema; }
Source:
<code>protected float getAssignmentScore(AssignableNode node, AssignableReplica replica, ClusterContext clusterContext) { Map<String, String> bestPossibleStateMap = getStateMap(replica, clusterContext.getBestPossibleAssignment()); if (!bestPossibleStateMap.isEmpty()) { return calculateAssignmentScale(node, replica, bestPossibleStateMap); } Map<String, String> baselineStateMap = getStateMap(replica, clusterContext.getBaselineAssignment()); <START> if (!baselineStateMap.isEmpty()) { return calculateAssignmentScale(node, replica, baselineStateMap); } return 0; } <END></code><technical_language>a "smoothing" function here</technical_language>

Target:
protected double getAssignmentScore(AssignableNode node, AssignableReplica replica, ClusterContext clusterContext) { Map<String, String> bestPossibleAssignment = getStateMap(replica, clusterContext.getBestPossibleAssignment()); if (!bestPossibleAssignment.isEmpty()) { return calculateAssignmentScale(node, replica, bestPossibleAssignment); } Map<String, String> baselineAssignment = getStateMap(replica, clusterContext.getBaselineAssignment()); if (!baselineAssignment.isEmpty()) { return calculateAssignmentScale(node, replica, baselineAssignment); } return 0; }
Source:
<code>public Tenant createTenant(final TenantData data, final CallContext context) throws TenantApiException { final Tenant tenant = new DefaultTenant(data); if (null != tenant.getExternalKey() && tenant.getExternalKey().length() > 255) { throw new TenantApiException(ErrorCode.EXTERNAL_KEY_LIMIT_EXCEEDED); } if (data.getApiKey() != null && getTenantByApiKey(data.getApiKey()) != null) { <START> throw new TenantApiException(ErrorCode.TENANT_ALREADY_EXISTS, data.getExternalKey()); <END> } try { tenantDao.create(new TenantModelDao(tenant), internalCallContextFactory.createInternalCallContextWithoutAccountRecordId(context)); } catch (final TenantApiException e) { throw new TenantApiException(e, ErrorCode.TENANT_CREATION_FAILED); } return tenant; }</code><technical_language>I sync'ed @pierre this is is fine -- this is model in place for other resources</technical_language>

Target:
public Tenant createTenant(final TenantData data, final CallContext context) throws TenantApiException { final Tenant tenant = new DefaultTenant(data); if (null != tenant.getExternalKey() && tenant.getExternalKey().length() > 255) { throw new TenantApiException(ErrorCode.EXTERNAL_KEY_LIMIT_EXCEEDED); } try { if (data.getApiKey() != null && getTenantByApiKey(data.getApiKey()) != null) { throw new TenantApiException(ErrorCode.TENANT_ALREADY_EXISTS, data.getExternalKey()); } } catch (final RuntimeException e) { if (e.getCause() instanceof IllegalStateException) { } else { throw e; } } try { tenantDao.create(new TenantModelDao(tenant), internalCallContextFactory.createInternalCallContextWithoutAccountRecordId(context)); } catch (final TenantApiException e) { throw new TenantApiException(e, ErrorCode.TENANT_CREATION_FAILED); } return tenant; }
Source:
<code>CosmosPagedFlux<CosmosDatabaseProperties> readAllDatabases(CosmosQueryRequestOptions options) { return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { <START> String spanName = "readAllDatabases"; pagedFluxOptions.setTracerInformation(this.tracerProvider, spanName, this.serviceEndpoint, null); <END> setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); return getDocClientWrapper().readDatabases(options) .map(response -> BridgeInternal.createFeedResponse( ModelBridgeInternal.getCosmosDatabasePropertiesFromV2Results(response.getResults()), response.getResponseHeaders())); }); }</code><technical_language>save a variable declaration set passing string method call</technical_language>

Target:
CosmosPagedFlux<CosmosDatabaseProperties> readAllDatabases(CosmosQueryRequestOptions options) { return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { pagedFluxOptions.setTracerInformation(this.tracerProvider, "readAllDatabases", this.serviceEndpoint, null); setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); return getDocClientWrapper().readDatabases(options) .map(response -> BridgeInternal.createFeedResponse( ModelBridgeInternal.getCosmosDatabasePropertiesFromV2Results(response.getResults()), response.getResponseHeaders())); }); }
Source:
<code>protected StorageProvider getStorageProvider() { if (duracloudConfigBean.getSwiftEndpoint() != null) { <START> Map<String, String> map = new HashMap<String, String>(); <END> map.put(OPTS.SWIFT_S3_ENDPOINT.name(), duracloudConfigBean.getSwiftEndpoint()); map.put(OPTS.SWIFT_S3_SIGNER_TYPE.name(), duracloudConfigBean.getSwiftSignerType()); return new SwiftStorageProvider( duracloudConfigBean.getSwiftAccessKey(), duracloudConfigBean.getSwiftSecretKey(), map ); } else { AWSCredentials creds = new DefaultAWSCredentialsProviderChain().getCredentials(); AmazonS3 s3client = AmazonS3ClientBuilder.standard().build(); return new S3StorageProvider(s3client, creds.getAWSAccessKeyId(), null); } }</code><technical_language>suggestion Map<String, String> map = new HashMap<>();</technical_language>

Target:
protected StorageProvider getStorageProvider() { if (duracloudConfigBean.getSwiftEndpoint() != null) { Map<String, String> map = new HashMap<>(); map.put(OPTS.SWIFT_S3_ENDPOINT.name(), duracloudConfigBean.getSwiftEndpoint()); map.put(OPTS.SWIFT_S3_SIGNER_TYPE.name(), duracloudConfigBean.getSwiftSignerType()); return new SwiftStorageProvider( duracloudConfigBean.getSwiftAccessKey(), duracloudConfigBean.getSwiftSecretKey(), map ); } else { AWSCredentials creds = new DefaultAWSCredentialsProviderChain().getCredentials(); AmazonS3 s3client = AmazonS3ClientBuilder.standard().build(); return new S3StorageProvider(s3client, creds.getAWSAccessKeyId(), null); } }
Source:
<code>public void getLogReturnsAnEmptyListWhenCalledWith0() throws Exception { Run r = new Run(new StubJob(), 0) {}; File f = r.getLogFile(); f.getParentFile().mkdirs(); PrintWriter w = new PrintWriter(f, "utf-8"); w.println("dummy"); w.close(); List<String> logLines = r.getLog(0); assertTrue(logLines.isEmpty()); <START> } <END></code><technical_language>file is deleted AFAICT litter temp directory</technical_language>

Target:
public void getLogReturnsAnEmptyListWhenCalledWith0() throws Exception { Job j = Mockito.mock(Job.class); File tempBuildDir = tmp.newFolder(); Mockito.when(j.getBuildDir()).thenReturn(tempBuildDir); Run r = new Run(j, 0) {}; File f = r.getLogFile(); f.getParentFile().mkdirs(); PrintWriter w = new PrintWriter(f, "utf-8"); w.println("dummy"); w.close(); List<String> logLines = r.getLog(0); assertTrue(logLines.isEmpty()); }
Source:
<code>public void testJsonOutput() { DumpProcessingAction action = new JsonSerializationAction(); action.open(); action.close(); assertEquals(action.getReport(), <START> "Finished serialization of 0 EntityDocuments in file {PROJECT}-{DATE}.json"); <END> }</code><technical_language>report a file-name pattern instead of a real file name</technical_language>

Target:
public void testJsonOutput() { String[] args = { "-a", "json", "-o", "output/wikidata.json" }; ClientConfiguration configuration = new ClientConfiguration(args); DumpProcessingAction action = configuration.actions.get(0); action.open(); action.close(); assertTrue(action .getReport() .matches( "Finished serialization of \\d+ EntityDocuments in file output/wikidata.json")); }
Source:
<code><START> public ArrayList<CapraOfficeObject> getSelection() { <END> return this.selection; }</code><technical_language>return interface (List), class</technical_language>

Target:
public List<CapraOfficeObject> getSelection() { return this.selection; }
Source:
<code>static MusicConfig load(String moduleName, JSONObject config) { List<String> menuMusicSet = new ArrayList<>(); List<String> gameMusicSet = new ArrayList<>(); JSONArray menuMusicArray = config.getJSONArray("menuMusic"); JSONArray gameMusicArray = config.getJSONArray("gameMusic"); <START> for (Object o : menuMusicArray) { <END> if (o instanceof String) { menuMusicSet.add(moduleName + ":" + o); } } for (Object o : gameMusicArray) { if (o instanceof String) { gameMusicSet.add(moduleName + ":" + o); } } Map<String, List<String>> musicMap = new HashMap<>(); musicMap.put(OggMusicManager.MENU_MUSIC_SET, menuMusicSet); musicMap.put(OggMusicManager.GAME_MUSIC_SET, gameMusicSet); return new MusicConfig(moduleName, musicMap); }</code><technical_language>Try avoid uninformative variable names o - minor, minimal index counters simply name o represents</technical_language>

Target:
static MusicConfig load(String moduleName, JSONObject config) { List<String> menuMusicSet = new ArrayList<>(); List<String> gameMusicSet = new ArrayList<>(); JSONArray menuMusicArray = config.getJSONArray("menuMusic"); JSONArray gameMusicArray = config.getJSONArray("gameMusic"); for (Object object : menuMusicArray) { if (object instanceof String) { menuMusicSet.add(moduleName + ":" + object); } } for (Object object : gameMusicArray) { if (object instanceof String) { gameMusicSet.add(moduleName + ":" + object); } } Map<String, List<String>> musicMap = new HashMap<>(); musicMap.put(OggMusicManager.MENU_MUSIC_SET, menuMusicSet); musicMap.put(OggMusicManager.GAME_MUSIC_SET, gameMusicSet); return new MusicConfig(moduleName, musicMap); }
Source:
<code>private void shutdown() throws IOException { try { Field executor = this.parent.getDeclaredField("_executor"); executor.setAccessible(true); ExecutorService _executor = (ExecutorService) executor.get(this); _executor.shutdown(); } catch (NoSuchFieldException | IllegalAccessException e) { <START> logger.severe("Error trying to abort JmDNS: " + e.getMessage()); <END> throw new IOException(e); } }</code><technical_language>add cause</technical_language>

Target:
private void shutdown() throws IOException { try { Field executor = this.parent.getDeclaredField("_executor"); executor.setAccessible(true); ExecutorService _executor = (ExecutorService) executor.get(this); _executor.shutdown(); } catch (NoSuchFieldException | IllegalAccessException e) { logger.log(Level.SEVERE, "Error trying to abort JmDNS", e); throw new IOException(e); } }
Source:
<code>private boolean isAppPresent() { try { <START> Thread.sleep(3000); <END> } catch (InterruptedException e) { PageObjectLogging.log("noEmailPerms", e.getMessage(), false); } boolean isPresent = false; for (WebElement element : pageElementList) { if (element.getText().toString().matches("^Wikia.*\n?.*")) { isPresent = true; } } return isPresent; }</code><technical_language>is reason for arbitrary sleep, is wait method aplicable</technical_language>

Target:
private boolean isAppPresent() { try { Thread.sleep(3000); } catch (InterruptedException e) { PageObjectLogging.log("isAppPresent", e.getMessage(), false); } boolean isPresent = false; for (WebElement element : pageElementList) { if (element.getText().toString().matches("^Wikia.*\n?.*")) { isPresent = true; } } return isPresent; }
Source:
<code>public Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> getMap(String filter) { HashMap<P2PDataStorage.ByteArray, PersistableNetworkPayload> result = new HashMap<>(); result.putAll(store.getMap()); if (filter.startsWith("since ")) { filter = filter.replace("since ", ""); if (!filter.equals(Version.VERSION)) { String finalFilter = filter; <START> history.entrySet().stream().filter(entry -> Integer.valueOf(entry.getKey().replace(".", "")) > Integer.valueOf(finalFilter.replace(".", ""))).forEach(entry -> result.putAll(entry.getValue().getMap())); <END> } } return result; }</code><technical_language>Try lines < 120 chars</technical_language>

Target:
public Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> getMap(String filter) { HashMap<P2PDataStorage.ByteArray, PersistableNetworkPayload> result = new HashMap<>(); result.putAll(store.getMap()); if (filter.startsWith("since ")) { String finalFilter = filter.replace("since ", ""); if (!finalFilter.equals(Version.VERSION)) { history.entrySet().stream() .filter(entry -> parseSpecialKey(entry.getKey()) > parseSpecialKey(finalFilter)) .forEach(entry -> result.putAll(entry.getValue().getMap())); } } return result; }
Source:
<code>public ParquetRecordWriter( ParquetFileWriter w, WriteSupport<T> writeSupport, MessageType schema, Map<String, String> extraMetaData, int blockSize, int pageSize, BytesCompressor compressor, int dictionaryPageSize, boolean enableDictionary, boolean validating, WriterVersion writerVersion) { this(w, writeSupport, schema, extraMetaData, blockSize, pageSize, compressor, dictionaryPageSize, enableDictionary, <START> validating, writerVersion, null); <END> }</code><technical_language>this throw exception (checkNotNull bellow). guess is for compatibility want register if null</technical_language>

Target:
public ParquetRecordWriter( ParquetFileWriter w, WriteSupport<T> writeSupport, MessageType schema, Map<String, String> extraMetaData, int blockSize, int pageSize, BytesCompressor compressor, int dictionaryPageSize, boolean enableDictionary, boolean validating, WriterVersion writerVersion) { internalWriter = new InternalParquetRecordWriter<T>(w, writeSupport, schema, extraMetaData, blockSize, pageSize, compressor, dictionaryPageSize, enableDictionary, validating, writerVersion); }
Source:
<code>protected void prepareOnAffectedNodes(TxInvocationContext<?> ctx, PrepareCommand command, Collection<Address> recipients, boolean ignored) { try { <START> Map<Address, Response> resps = rpcManager.invokeRemotely(recipients, command, rpcManager.getDefaultRpcOptions(true, DeliverOrder.NONE)); <END> checkTxCommandResponses(resps, command); CacheTransaction ct = ctx.getCacheTransaction(); for (Response r : resps.values()) readVersionsFromResponse(r, ct); } finally { transactionRemotelyPrepared(ctx); } }</code><technical_language>want SYNCHRONOUS_IGNORE_LEAVERS</technical_language>

Target:
protected void prepareOnAffectedNodes(TxInvocationContext<?> ctx, PrepareCommand command, Collection<Address> recipients, boolean ignored) { try { RpcOptions rpcOptions = rpcManager.getRpcOptionsBuilder(ResponseMode.SYNCHRONOUS_IGNORE_LEAVERS, DeliverOrder.NONE).build(); Map<Address, Response> resps = rpcManager.invokeRemotely(recipients, command, rpcOptions); checkTxCommandResponses(resps, command); CacheTransaction ct = ctx.getCacheTransaction(); for (Response r : resps.values()) readVersionsFromResponse(r, ct); } finally { transactionRemotelyPrepared(ctx); } }
Source:
<code>public void buildAtomicElement(Document doc, Element rootElement) { if (getAdds() != null) { Element atomic = doc.createElement(Constants.ATOMIC); rootElement.appendChild(atomic); if (getCommandId() != -1) { Element commandId = doc.createElement(Constants.COMMAND_ID); commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); atomic.appendChild(commandId); } for (int x = 0; x < getAdds().size(); x++) { if (getAdds().get(x) != null) { getAdds().get(x).buildAddElement(doc, atomic); } } <START> for (int x = 0; x < getReplaces().size(); x++) { <END> if (getReplaces().get(x) != null) { getReplaces().get(x).buildReplaceElement(doc, atomic); } } } }</code><technical_language>iterator based for loop, is more efficient</technical_language>

Target:
public void buildAtomicElement(Document doc, Element rootElement) { Element atomic = doc.createElement(Constants.ATOMIC); if (getAdds() != null) { rootElement.appendChild(atomic); if (getCommandId() != -1) { Element commandId = doc.createElement(Constants.COMMAND_ID); commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); atomic.appendChild(commandId); } for (Iterator<Add> addIterator = getAdds().iterator(); addIterator.hasNext(); ) { Add add = addIterator.next(); if (add != null) { add.buildAddElement(doc, atomic); } } } if (getReplaces() != null) { for (Iterator<Replace> replaceIterator = getReplaces().iterator(); replaceIterator.hasNext(); ) { Replace add = replaceIterator.next(); if (add != null) { add.buildReplaceElement(doc, atomic); } } } }
Source:
<code>public void configureSeries(Map<@NonNull ISeries, Object[]> mapper) { XYChartConsumer chartConsumer = getChartConsumer(); NumericalConsumerAggregator aggregator = (NumericalConsumerAggregator) checkNotNull(chartConsumer.getYAggregator()); fYRanges = clampExternalRange(checkNotNull(aggregator.getChartRanges())); for (XYSeriesConsumer seriesConsumer : chartConsumer.getSeries()) { BarStringConsumer xconsumer = (BarStringConsumer) seriesConsumer.getXConsumer(); NumericalConsumer yConsumer = (NumericalConsumer) seriesConsumer.getYConsumer(); Object[] object = seriesConsumer.getObject().toArray(); <START> fCategories = xconsumer.getList().stream().toArray(s -> new String[s]); <END> double[] yData = new double[yConsumer.getData().size()]; for (int i = 0; i < yData.length; i++) { Number number = checkNotNull(yConsumer.getData().get(i)); yData[i] = fYRanges.getInternalValue(number).doubleValue(); } ISeries series = checkNotNull(getSeriesMap().get(seriesConsumer.getSeries())); series.setYSeries(yData); mapper.put(series, checkNotNull(object)); } }</code><technical_language>Reading this fast, s intuitively refers a string, confusing, update for size in toArray method</technical_language>

Target:
public void configureSeries(Map<@NonNull ISeries, Object[]> mapper) { XYChartConsumer chartConsumer = getChartConsumer(); NumericalConsumerAggregator aggregator = (NumericalConsumerAggregator) checkNotNull(chartConsumer.getYAggregator()); fYRanges = clampExternalRange(checkNotNull(aggregator.getChartRanges())); for (XYSeriesConsumer seriesConsumer : chartConsumer.getSeries()) { BarStringConsumer xconsumer = (BarStringConsumer) seriesConsumer.getXConsumer(); NumericalConsumer yConsumer = (NumericalConsumer) seriesConsumer.getYConsumer(); Object[] object = seriesConsumer.getObject().toArray(); fCategories = xconsumer.getList().stream().toArray(size -> new String[size]); double[] yData = new double[yConsumer.getData().size()]; for (int i = 0; i < yData.length; i++) { Number number = checkNotNull(yConsumer.getData().get(i)); yData[i] = fYRanges.getInternalValue(number).doubleValue(); } ISeries series = checkNotNull(getSeriesMap().get(seriesConsumer.getSeries())); series.setYSeries(yData); mapper.put(series, checkNotNull(object)); } }
Source:
<code>public void beforeEach(final ExtensionContext context) { Set<Object> testInstances = new LinkedHashSet<>(); testInstances.add(context.getRequiredTestInstance()); <START> this.collectParentTestInstances(testInstances); <END> Strictness actualStrictness = this.retrieveAnnotationFromTestClasses(context) .map(MockitoSettings::strictness) .orElse(strictness); MockitoSession session = Mockito.mockitoSession() .initMocks(testInstances.toArray()) .strictness(actualStrictness) .logger(new MockitoSessionLoggerAdapter(Plugins.getMockitoLogger())) .startMocking(); context.getStore(MOCKITO).put(SESSION, session); }</code><technical_language>This is necessary anymore. 5.4.2, remove ThreadLocal simply call java List<Object> testInstances = context.getRequiredTestInstances().getAllInstances();</technical_language>

Target:
public void beforeEach(final ExtensionContext context) { List<Object> testInstances = context.getRequiredTestInstances().getAllInstances(); Strictness actualStrictness = this.retrieveAnnotationFromTestClasses(context) .map(MockitoSettings::strictness) .orElse(strictness); MockitoSession session = Mockito.mockitoSession() .initMocks(testInstances.toArray()) .strictness(actualStrictness) .logger(new MockitoSessionLoggerAdapter(Plugins.getMockitoLogger())) .startMocking(); context.getStore(MOCKITO).put(SESSION, session); }
Source:
<code>public void testCharacterWrapperWithParamOverloading() throws IOException { String translation = translateSourceFile( "class Test { " <START> + "void f(char i) void f(int i) void f(long l) void f(float f) void f(double d) " <END> + "void test1(Character toChar1) { f(toChar1); } " + "void test2(Character toChar2) { f((char) toChar2); } " + "void test3(Character toInt) { f((int) toInt); } " + "void test4(Character toLong) { f((long) toLong); } " + "void test5(Character toFlt) { f((float) toFlt); } " + "void test6(Character toDbl) { f((double) toDbl); } }", "Test", "Test.m"); assertTranslation(translation, "[self fWithChar:[((JavaLangCharacter *) nil_chk(toChar1)) charValue]]"); assertTranslation(translation, "[self fWithChar:[((JavaLangCharacter *) nil_chk(toChar2)) charValue]];"); assertTranslation(translation, "[self fWithInt:(jint) [((JavaLangCharacter *) nil_chk(toInt)) charValue]];"); assertTranslation(translation, "[self fWithLong:(jlong) [((JavaLangCharacter *) nil_chk(toLong)) charValue]];"); assertTranslation(translation, "[self fWithFloat:(jfloat) [((JavaLangCharacter *) nil_chk(toFlt)) charValue]];"); assertTranslation(translation, "[self fWithDouble:(jdouble) [((JavaLangCharacter *) nil_chk(toDbl)) charValue]];"); }</code><technical_language>consistent above</technical_language>

Target:
public void testCharacterWrapperWithParamOverloading() throws IOException { String translation = translateSourceFile( "class Test { " + "void f(char i) void f(int i) void f(long l) " + "void f(float f) void f(double d) " + "void test1(Character toChar1) { f(toChar1); } " + "void test2(Character toChar2) { f((char) toChar2); } " + "void test3(Character toInt) { f((int) toInt); } " + "void test4(Character toLong) { f((long) toLong); } " + "void test5(Character toFlt) { f((float) toFlt); } " + "void test6(Character toDbl) { f((double) toDbl); } }", "Test", "Test.m"); assertTranslation( translation, "[self fWithChar:[((JavaLangCharacter *) nil_chk(toChar1)) charValue]]"); assertTranslation( translation, "[self fWithChar:[((JavaLangCharacter *) nil_chk(toChar2)) charValue]];"); assertTranslation( translation, "[self fWithInt:(jint) [((JavaLangCharacter *) nil_chk(toInt)) charValue]];"); assertTranslation( translation, "[self fWithLong:(jlong) [((JavaLangCharacter *) nil_chk(toLong)) charValue]];"); assertTranslation( translation, "[self fWithFloat:(jfloat) [((JavaLangCharacter *) nil_chk(toFlt)) charValue]];"); assertTranslation( translation, "[self fWithDouble:(jdouble) [((JavaLangCharacter *) nil_chk(toDbl)) charValue]];"); }
Source:
<code>public synchronized String toString() { List<String> stanzas = Lists.newArrayListWithCapacity(3); if (isNotBlank(appName) && appVersion != null) { stanzas.add(String.format("%s/%s", appName, appVersion)); } else if (isNotBlank(appName)) { stanzas.add(appName); } else if (appVersion != null) { stanzas.add(Integer.toString(appVersion)); } if (isNotBlank(device) && isNotBlank(osName)) { stanzas.add(String.format("(%s; %s; %s)", device, osName, osVersion)); } else if (isNotBlank(device)) { stanzas.add(String.format("(%s)", device)); } else if (isNotBlank(osName)){ <START> stanzas.add(String.format("(%s; %s)", osName, osVersion)); <END> } if (isNotBlank(sdkVersion)) { stanzas.add(String.format("BridgeJavaSDK/%s", sdkVersion)); } else { stanzas.add("BridgeJavaSDK"); } return Joiner.on(" ").join(stanzas); }</code><technical_language>Do need update unit tests match</technical_language>

Target:
public synchronized String toString() { List<String> stanzas = Lists.newArrayListWithCapacity(3); if (isNotBlank(appName) && appVersion != null) { stanzas.add(String.format("%s/%s", appName, appVersion)); } else if (isNotBlank(appName)) { stanzas.add(appName); } else if (appVersion != null) { stanzas.add(Integer.toString(appVersion)); } if (isNotBlank(device) && isNotBlank(osName)) { stanzas.add(String.format("(%s; %s %s)", device, osName, osVersion)); } else if (isNotBlank(device)) { stanzas.add(String.format("(%s)", device)); } else if (isNotBlank(osName)){ stanzas.add(String.format("(%s; %s)", osName, osVersion)); } if (isNotBlank(sdkVersion)) { stanzas.add(String.format("BridgeJavaSDK/%s", sdkVersion)); } else { stanzas.add("BridgeJavaSDK"); } return Joiner.on(" ").join(stanzas); }
Source:
<code>public void widgetSelected(@Nullable SelectionEvent e) { int selectedCell = getColumnIndex(); ISegment selectedSegment = ((ISegment) NonNullUtils.checkNotNull(e).item.getData()); if (selectedSegment == null){ return; } ITmfTimestamp start = new <START> TmfTimestamp(selectedSegment.getStart(), <END> ITmfTimestamp.NANOSECOND_SCALE); ITmfTimestamp end = new TmfTimestamp(selectedSegment.getEnd(), ITmfTimestamp.NANOSECOND_SCALE); TmfSelectionRangeUpdatedSignal signal; switch (selectedCell) { case 0: signal = new TmfSelectionRangeUpdatedSignal(this, start, start); break; case 1: signal = new TmfSelectionRangeUpdatedSignal(this, end, end); break; case 2: signal = new TmfSelectionRangeUpdatedSignal(this, start, end); break; default: return; } TmfSignalManager.dispatchSignal(signal); }</code><technical_language>TmfNanoTimestamp</technical_language>

Target:
public void widgetSelected(@Nullable SelectionEvent e) { int selectedCell = getColumnIndex(); ISegment selectedSegment = ((ISegment) NonNullUtils.checkNotNull(e).item.getData()); if (selectedSegment == null) { return; } ITmfTimestamp start = new TmfNanoTimestamp(selectedSegment.getStart()); ITmfTimestamp end = new TmfNanoTimestamp(selectedSegment.getEnd()); TmfSelectionRangeUpdatedSignal signal; switch (selectedCell) { case 0: signal = new TmfSelectionRangeUpdatedSignal(this, start); break; case 1: signal = new TmfSelectionRangeUpdatedSignal(this, end, end); break; case 2: signal = new TmfSelectionRangeUpdatedSignal(this, start, end); break; default: return; } TmfSignalManager.dispatchSignal(signal); }
Source:
<code>private Collection<PendingTransaction> getTransactionWithAnyLockedKey(int transactionTopologyId, Collection<Object> keys, GlobalTransaction globalTransaction) { Function<CacheTransaction, PendingTransaction> filter = transaction -> { if (transaction.getTopologyId() < transactionTopologyId && !transaction.getGlobalTransaction().equals(globalTransaction)) { <START> Object key = transaction.findAnyLockedOrBackupLocked(keys.stream()); <END> return key == null ? null : new PendingTransaction(transaction, key); } return null; }; return filterAndCollectTransactions(filter); }</code><technical_language>Create stream filter? better, collection ;)</technical_language>

Target:
private Collection<PendingTransaction> getTransactionWithAnyLockedKey(int transactionTopologyId, Collection<Object> keys, GlobalTransaction globalTransaction) { final Collection<PendingTransaction> pendingTransactions = new ArrayList<>(); forEachTransaction(transaction -> { if (transaction.getTopologyId() < transactionTopologyId && !transaction.getGlobalTransaction().equals(globalTransaction)) { Object key = transaction.findAnyLockedOrBackupLocked(keys); if (key != null) { pendingTransactions.add(new PendingTransaction(transaction, key)); } } }); return pendingTransactions.isEmpty() ? Collections.emptyList() : pendingTransactions; }