auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void iterateOrganizations() throws Exception { final Github github = RtOrganizationsITCase.github(); final Organizations orgs = github.users().self().organizations(); MatcherAssert.assertThat(orgs.iterate(), Matchers.notNullValue()); }

Target:
public void iterateOrganizations() throws Exception { final Organizations orgs = github().users().self().organizations(); MatcherAssert.assertThat( orgs.iterate("yegor256").iterator().next(), Matchers.notNullValue() ); }
Source:
final boolean execute() { for (Map.Entry<ServiceName, Dependent[]> dependentEntry : dependents.entrySet()) { ServiceName serviceName = dependentEntry.getKey(); for (Dependent dependent : dependentEntry.getValue()) { if (dependent != null) inform(dependent, serviceName); } } final ServiceName primaryRegistrationName = primaryRegistration.getName(); for (Dependent child : children) { if (child != null) inform(child, primaryRegistrationName); } return true; }

Target:
final boolean execute() { for (Dependent dependent : primaryRegistration.getDependents()) { inform(dependent, primaryRegistration.getName()); } for (ServiceRegistrationImpl aliasRegistration : aliasRegistrations) { for (Dependent dependent : aliasRegistration.getDependents()) { inform(dependent, aliasRegistration.getName()); } } synchronized (ServiceControllerImpl.this) { for (Dependent child : children) { inform(child, primaryRegistration.getName()); } execFlags |= execFlag; } return true; }
Source:
public void setConfiguration(String domain, List<OpenHABConfigurationRecord> records) { if (domain == null) return; if (domain.isEmpty()) { return; } if (domain.startsWith("node/") == false) return; ZWaveNode node = zController.getNode(5); if (node == null) return; int parameter = 1; int value = 1; int size = 1; node.configParameterSet(parameter, value, size); }

Target:
public void setConfiguration(String domain, List<OpenHABConfigurationRecord> records) { }
Source:
private RawPacket recover() { if (!canRecover()) { return null; } byte[] buf = new byte[1500]; RawPacket recoveredPacket = new RawPacket(buf, 0, 1500); if (!startPacketRecovery(this.fecPacket, recoveredPacket)) { return null; } for (Integer protectedSeqNum : fecPacket.getProtectedSequenceNumbers()) { if (protectedSeqNum != missingSequenceNumber) { RawPacket mediaPacket = mediaPackets.get(protectedSeqNum); xorHeaders(mediaPacket, recoveredPacket); xorPayloads( mediaPacket, RawPacket.FIXED_HEADER_SIZE, recoveredPacket, RawPacket.FIXED_HEADER_SIZE, mediaPacket.getLength() - RawPacket.FIXED_HEADER_SIZE); } } if (!finishPacketRecovery(fecPacket, recoveredPacket)) { return null; } return recoveredPacket; }

Target:
private RawPacket recover() { if (!canRecover()) { return null; } byte[] buf = new byte[1500]; RawPacket recoveredPacket = new RawPacket(buf, 0, 1500); if (!startPacketRecovery(this.fecPacket, recoveredPacket)) { return null; } for (Integer protectedSeqNum : fecPacket.getProtectedSequenceNumbers()) { if (protectedSeqNum != missingSequenceNumber) { RawPacket mediaPacket = mediaPackets.get(protectedSeqNum); xorHeaders(mediaPacket, recoveredPacket); xorPayloads( mediaPacket.getBuffer(), mediaPacket.getOffset() + RawPacket.FIXED_HEADER_SIZE, recoveredPacket.getBuffer(), RawPacket.FIXED_HEADER_SIZE, mediaPacket.getLength() - RawPacket.FIXED_HEADER_SIZE); } } if (!finishPacketRecovery(fecPacket, recoveredPacket)) { return null; } return recoveredPacket; }
Source:
public void testRedeclareXExpiresQueue() throws Exception { RabbitTemplate template = context.getBean(RabbitTemplate.class); template.convertAndSend("xExpires", "foo"); assertNotNull(queue.poll(10, TimeUnit.SECONDS)); SimpleMessageListenerContainer listenerContainer = context.getBean("container3", SimpleMessageListenerContainer.class); listenerContainer.stop(); RabbitAdmin admin = spy(TestUtils.getPropertyValue(this.listenerContainer1, "rabbitAdmin", RabbitAdmin.class)); new DirectFieldAccessor(listenerContainer).setPropertyValue("rabbitAdmin", admin); int n = 0; while (admin.getQueueProperties("xExpires") != null && n < 10) { Thread.sleep(100); n++; } assertTrue(n < 10); listenerContainer.start(); template.convertAndSend("xExpires", "foo"); assertNotNull(queue.poll(10, TimeUnit.SECONDS)); verify(admin, times(1)).initialize(); listenerContainer.stop(); }

Target:
public void testRedeclareXExpiresQueue() throws Exception { RabbitTemplate template = context.getBean(RabbitTemplate.class); template.convertAndSend("xExpires", "foo"); assertNotNull(queue.poll(10, TimeUnit.SECONDS)); SimpleMessageListenerContainer listenerContainer = context.getBean("container3", SimpleMessageListenerContainer.class); listenerContainer.stop(); RabbitAdmin admin = spy(TestUtils.getPropertyValue(listenerContainer, "rabbitAdmin", RabbitAdmin.class)); new DirectFieldAccessor(listenerContainer).setPropertyValue("rabbitAdmin", admin); int n = 0; while (admin.getQueueProperties("xExpires") != null && n < 100) { Thread.sleep(100); n++; } assertTrue(n < 100); listenerContainer.start(); template.convertAndSend("xExpires", "foo"); assertNotNull(queue.poll(10, TimeUnit.SECONDS)); verify(admin, times(1)).initialize(); }
Source:
private void UpdateNumOfMonitors() { boolean isVnc = false; if (getOSType().getSelectedItem() != null) { VmOsType osType = (VmOsType) getOSType().getSelectedItem(); } if (getDisplayProtocol().getSelectedItem() != null) { DisplayType displayType = (DisplayType) ((EntityModel) getDisplayProtocol().getSelectedItem()).getEntity(); isVnc = displayType == DisplayType.vnc; } if (isVnc) { getNumOfMonitors().setSelectedItem(1); getNumOfMonitors().setIsChangable(false); } else { getNumOfMonitors().setIsChangable(true); } }

Target:
private void UpdateNumOfMonitors() { boolean isVnc = false; if (getDisplayProtocol().getSelectedItem() != null) { DisplayType displayType = (DisplayType) ((EntityModel) getDisplayProtocol().getSelectedItem()).getEntity(); isVnc = displayType == DisplayType.vnc; } if (isVnc) { getNumOfMonitors().setSelectedItem(1); getNumOfMonitors().setIsChangable(false); } else { getNumOfMonitors().setIsChangable(true); } }
Source:
public InternalHiveBlock currentBlock() { checkState(!isDone(), "All blocks have been consumed"); List<HostAddress> addresses = blockAddresses.isEmpty() ? ImmutableList.of() : blockAddresses.get(currentBlockIndex); return new InternalHiveBlock(blockEnds[currentBlockIndex], addresses); }

Target:
public InternalHiveBlock currentBlock() { checkState(!isDone(), "All blocks have been consumed"); List<HostAddress> addresses = blockAddresses.isEmpty() ? ImmutableList.of() : blockAddresses.get(currentBlockIndex); return new InternalHiveBlock(blockEndOffsets[currentBlockIndex], addresses); }
Source:
public OpenShiftProject(OpenShiftClientFactory clientFactory, String name, String workspaceId) throws InfrastructureException { super(clientFactory, name, workspaceId, false); this.routes = new OpenShiftRoutes(name, workspaceId, clientFactory); doPrepare(name, clientFactory.create(), clientFactory.createOC()); }

Target:
public OpenShiftProject(OpenShiftClientFactory clientFactory, String name, String workspaceId) throws InfrastructureException { super(clientFactory, name, workspaceId, false); this.routes = new OpenShiftRoutes(name, workspaceId, clientFactory); doPrepare(name, clientFactory.create(workspaceId), clientFactory.createOC(workspaceId)); }
Source:
WebClient getWebClient(String uri, Map<String, Serializable> properties) { SecureCxfClientFactory<WebClient> factory; if (properties.get(USERNAME) != null && properties.get(PASSWORD) != null) { factory = clientFactoryFactory.getSecureCxfClientFactory( uri, WebClient.class, null, null, false, getFollowRedirects(), null, null, (String) properties.get(USERNAME), (String) properties.get(PASSWORD)); } else if (properties.get(ID_PROPERTY) != null && properties.get(OAUTH_DISCOVERY_URL) != null && properties.get(OAUTH_CLIENT_ID) != null && properties.get(OAUTH_CLIENT_SECRET) != null && properties.get(OAUTH_FLOW) != null) { factory = clientFactoryFactory.getSecureCxfClientFactory( uri, WebClient.class, null, null, false, getFollowRedirects(), null, null, (String) properties.get(ID_PROPERTY), (String) properties.get(OAUTH_DISCOVERY_URL), (String) properties.get(OAUTH_CLIENT_ID), (String) properties.get(OAUTH_CLIENT_SECRET), (String) properties.get(OAUTH_FLOW)); } else { factory = clientFactoryFactory.getSecureCxfClientFactory( uri, WebClient.class, null, null, false, getFollowRedirects()); } Serializable subject = properties.get(SecurityConstants.SECURITY_SUBJECT); if (subject instanceof org.apache.shiro.subject.Subject) { return factory.getClientForSubject((org.apache.shiro.subject.Subject) subject); } return factory.getWebClient(); }

Target:
protected WebClient getWebClient(String uri, Map<String, Serializable> properties) { SecureCxfClientFactory<WebClient> factory; if (properties.get(USERNAME) != null && properties.get(PASSWORD) != null) { factory = clientFactoryFactory.getSecureCxfClientFactory( uri, WebClient.class, null, null, false, getFollowRedirects(), null, null, (String) properties.get(USERNAME), (String) properties.get(PASSWORD)); } else if (properties.get(ID_PROPERTY) != null && properties.get(OAUTH_DISCOVERY_URL) != null && properties.get(OAUTH_CLIENT_ID) != null && properties.get(OAUTH_CLIENT_SECRET) != null && properties.get(OAUTH_FLOW) != null) { factory = clientFactoryFactory.getSecureCxfClientFactory( uri, WebClient.class, null, null, false, getFollowRedirects(), null, null, (String) properties.get(ID_PROPERTY), (String) properties.get(OAUTH_DISCOVERY_URL), (String) properties.get(OAUTH_CLIENT_ID), (String) properties.get(OAUTH_CLIENT_SECRET), (String) properties.get(OAUTH_FLOW)); } else { factory = clientFactoryFactory.getSecureCxfClientFactory( uri, WebClient.class, null, null, false, getFollowRedirects()); } Serializable subject = properties.get(SecurityConstants.SECURITY_SUBJECT); if (subject instanceof org.apache.shiro.subject.Subject) { return factory.getClientForSubject((org.apache.shiro.subject.Subject) subject); } return factory.getWebClient(); }
Source:
public MessagePackParser(SecorConfig config) { super(config); mTimestampField = ValueFactory.createRawValue(mConfig.getMessageTimestampName()); }

Target:
public MessagePackParser(SecorConfig config) { super(config); String timestampName = mConfig.getMessageTimestampName(); mTimestampField = ValueFactory.createRawValue(timestampName); }
Source:
public FileBasedSystemAccessControlRules( @JsonProperty("catalogs") Optional<List<CatalogAccessControlRule>> catalogRules, @JsonProperty("principals") Optional<List<PrincipalUserMatchRule>> principalUserMatchRules) { this.catalogRules = catalogRules.map(ImmutableList::copyOf).orElse(ImmutableList.of()); this.principalUserMatchRules = principalUserMatchRules.map(ImmutableList::copyOf).orElse(ImmutableList.of()); }

Target:
public FileBasedSystemAccessControlRules( @JsonProperty("catalogs") Optional<List<CatalogAccessControlRule>> catalogRules, @JsonProperty("principals") Optional<List<PrincipalUserMatchRule>> principalUserMatchRules) { this.catalogRules = catalogRules.map(ImmutableList::copyOf).orElse(ImmutableList.of()); this.principalUserMatchRules = principalUserMatchRules.map(ImmutableList::copyOf); }
Source:
public boolean isValueSetPreExpandedForCodeValidation(ValueSet theValueSet) { ResourceTable resourceTable = (ResourceTable) myValueSetResourceDao.readEntity(theValueSet.getIdElement(), null); Long valueSetResourcePid = resourceTable.getId(); Optional<TermValueSet> optionalTermValueSet = myValueSetDao.findByResourcePid(valueSetResourcePid); if (!optionalTermValueSet.isPresent()) { ourLog.warn("ValueSet is not present in terminology tables. Will perform in-memory code validation. Will schedule this ValueSet for pre-expansion. {}", getValueSetInfo(theValueSet)); myDeferredValueSets.add(theValueSet); return false; } TermValueSet termValueSet = optionalTermValueSet.get(); if (termValueSet.getExpansionStatus() != TermValueSetPreExpansionStatusEnum.EXPANDED) { ourLog.warn("{} is present in terminology tables but not ready for persistence-backed invocation of operation $validation-code. Will perform in-memory code validation. Current status: | {}", getValueSetInfo(theValueSet), termValueSet.getExpansionStatus().name(), termValueSet.getExpansionStatus().getDescription()); return false; } return true; }

Target:
public boolean isValueSetPreExpandedForCodeValidation(ValueSet theValueSet) { Long valueSetResourcePid = getValueSetResourcePid(theValueSet.getIdElement()); Optional<TermValueSet> optionalTermValueSet = myValueSetDao.findByResourcePid(valueSetResourcePid); if (!optionalTermValueSet.isPresent()) { ourLog.warn("ValueSet is not present in terminology tables. Will perform in-memory code validation. Will schedule this ValueSet for pre-expansion. {}", getValueSetInfo(theValueSet)); myDeferredValueSets.add(theValueSet); return false; } TermValueSet termValueSet = optionalTermValueSet.get(); if (termValueSet.getExpansionStatus() != TermValueSetPreExpansionStatusEnum.EXPANDED) { ourLog.warn("{} is present in terminology tables but not ready for persistence-backed invocation of operation $validation-code. Will perform in-memory code validation. Current status: | {}", getValueSetInfo(theValueSet), termValueSet.getExpansionStatus().name(), termValueSet.getExpansionStatus().getDescription()); return false; } return true; }
Source:
public boolean test() { ProjectExplorer pe = new ProjectExplorer(); pe.open(); if (!pe.getProject(this.projectName).isSelected()) { return false; } return true; }

Target:
public boolean test() { if (!pe.getProject(this.projectName).isSelected()) { return false; } return true; }
Source:
public void scopeHandlesExceptions() throws WordsRuntimeException { AST statementList = new INodeStatementList(createObjectFred); AST iterativeLoop = new INodeRepeat(fiveLeaf, statementList); loop.enqueueAST(createObjectFred); loop.fastForwardEnvironment(1); loop.enqueueAST(iterativeLoop); assertEquals("Outside of loop, ends in global scope", environment.getNumberOfScopes(), 1); }

Target:
public void scopeHandlesExceptions() throws WordsRuntimeException { AST statementList = new INodeStatementList(createObjectFred); AST iterativeLoop = new INodeRepeat(fiveLeaf, statementList); loop.enqueueAST(createObjectFred); loop.fastForwardEnvironment(1); loop.enqueueAST(iterativeLoop); loop.fastForwardEnvironment(2); assertEquals("Outside of loop, ends in global scope", environment.getNumberOfScopes(), 1); }
Source:
public void logMTUDifferences(Map<String, network> clusterNetworkByName, List<VdsNetworkInterface> interfaces) { for (VdsNetworkInterface iface: interfaces) { if (iface.getNetworkName() != null && clusterNetworkByName.containsKey(iface.getNetworkName())) { if (iface.getMtu() != clusterNetworkByName.get(iface.getNetworkName()).getMtu()) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("NetworkName", iface.getNetworkName()); logable.AddCustomValue("VDS_MTU", String.valueOf(iface.getMtu())); logable.AddCustomValue("CLUSTER_MTU", String.valueOf(clusterNetworkByName.get(iface.getNetworkName()).getMtu())); AuditLogDirector.log(logable, AuditLogType.VDS_SET_NONOPERATIONAL_NETWORK_MTU_DIFFER); } } } }

Target:
public void logMTUDifferences(Map<String, network> clusterNetworkByName, List<VdsNetworkInterface> interfaces) { for (VdsNetworkInterface iface : interfaces) { if (iface.getNetworkName() != null && clusterNetworkByName.containsKey(iface.getNetworkName()) && iface.getMtu() != clusterNetworkByName.get(iface.getNetworkName()).getMtu()) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue(NetworkName, iface.getNetworkName()); logable.AddCustomValue(HostNetworkMTU, String.valueOf(iface.getMtu())); logable.AddCustomValue(LogicalNetworkMTU, String.valueOf(clusterNetworkByName.get(iface.getNetworkName()).getMtu())); AuditLogDirector.log(logable, AuditLogType.VDS_NETWORK_MTU_DIFFER_FROM_LOGICAL_NETWORK); } } }
Source:
public static long calculateContentLength(final long plaintextSize, final int blockBytes, final int tagOrHmacBytes, final boolean hasIV) { if (plaintextSize <= 0) { return blockBytes + tagOrHmacBytes; } long calculatedContentLength = plaintextSize; long padding = 0L; if (plaintextSize > blockBytes) { padding = plaintextSize % blockBytes; } else { calculatedContentLength = blockBytes; } if (padding > 0) { calculatedContentLength = (plaintextSize - padding) + blockBytes; } if (!hasIV && plaintextSize >= blockBytes) { final double blocks = Math.floor(plaintextSize / ((long) blockBytes)); calculatedContentLength = (((long)blocks + 1) * blockBytes); } calculatedContentLength += tagOrHmacBytes; return calculatedContentLength; }

Target:
static long calculateContentLength(final long plaintextSize, final int blockBytes, final int tagOrHmacBytes, final boolean hasIV) { if (plaintextSize <= 0) { return blockBytes + tagOrHmacBytes; } long calculatedContentLength = plaintextSize; long padding = 0L; if (plaintextSize > blockBytes) { padding = plaintextSize % blockBytes; } else { calculatedContentLength = blockBytes; } if (padding > 0) { calculatedContentLength = (plaintextSize - padding) + blockBytes; } if (!hasIV && plaintextSize >= blockBytes) { final double blocks = Math.floor(plaintextSize / ((long) blockBytes)); calculatedContentLength = (((long)blocks + 1) * blockBytes); } calculatedContentLength += tagOrHmacBytes; return calculatedContentLength; }
Source:
private boolean equalsIgnoreNull(Object o1, Object o2) { return o1 != null ? o1.equals(o2) : o2 != null; }

Target:
private boolean equalsIgnoreNull(Object o1, Object o2) { return o1 != null ? o1.equals(o2) : o2 == null; }
Source:
public IUser getUser(String userName) throws QuadrigaStorageException { IUser user = null; QuadrigaUserDTO userDTO = dbConnect.getUserDTO(userName); if (userDTO != null) { user = mapUser(userDTO); } if (user != null) { List<IQuadrigaRole> userRole = user.getQuadrigaRoles(); IQuadrigaRole quadrigaRole = null; List<IQuadrigaRole> rolesList = new ArrayList<IQuadrigaRole>(); for (int i = 0; i < userRole.size(); i++) { quadrigaRole = roleManager.getQuadrigaRoleByDbId(IQuadrigaRoleManager.MAIN_ROLES, userRole.get(i) .getDBid()); if (quadrigaRole.getId().equals( RoleNames.ROLE_QUADRIGA_DEACTIVATED)) { rolesList.clear(); rolesList.add(quadrigaRole); break; } rolesList.add(quadrigaRole); } user.setQuadrigaRoles(rolesList); } else { user = userFactory.createUserObject(); IQuadrigaRole quadrigaRole = roleManager .getQuadrigaRoleByDbId(IQuadrigaRoleManager.MAIN_ROLES, RoleNames.DB_ROLE_QUADRIGA_NOACCOUNT); List<IQuadrigaRole> rolesList = new ArrayList<IQuadrigaRole>(); rolesList.add(quadrigaRole); user.setQuadrigaRoles(rolesList); } return user; }

Target:
public IUser getUser(String userName) throws QuadrigaStorageException { QuadrigaUserDTO userDTO = dbConnect.getUserDTO(userName); IUser user = constructUserWithRoles(userDTO); if (user == null) { user = userFactory.createUserObject(); IQuadrigaRole quadrigaRole = roleManager.getQuadrigaRoleByDbId(IQuadrigaRoleManager.MAIN_ROLES, RoleNames.DB_ROLE_QUADRIGA_NOACCOUNT); List<IQuadrigaRole> rolesList = new ArrayList<IQuadrigaRole>(); rolesList.add(quadrigaRole); user.setQuadrigaRoles(rolesList); } return user; }
Source:
public static void compactTransient(FluoConfiguration fluoConfig) throws Exception { Connector conn = getConnector(fluoConfig); try (FluoClient client = FluoFactory.newClient(fluoConfig)) { Configuration appConfig = client.getAppConfiguration(); TransientRegistry transientRegistry = new TransientRegistry(appConfig); List<RowRange> ranges = transientRegistry.getTransientRanges(); Logger logger = LoggerFactory.getLogger(TableOperations.class); for (RowRange r : ranges) { logger.debug("Compacting {}", r.getStart(), r.getEnd()); conn.tableOperations().compact(fluoConfig.getAccumuloTable(), new Text(r.getStart().toArray()), new Text(r.getEnd().toArray()), true, true); } } }

Target:
public static void compactTransient(FluoConfiguration fluoConfig) throws Exception { Connector conn = getConnector(fluoConfig); try (FluoClient client = FluoFactory.newClient(fluoConfig)) { Configuration appConfig = client.getAppConfiguration(); TransientRegistry transientRegistry = new TransientRegistry(appConfig); List<RowRange> ranges = transientRegistry.getTransientRanges(); for (RowRange r : ranges) { logger.debug("Compacting {}", r.getStart(), r.getEnd()); conn.tableOperations().compact(fluoConfig.getAccumuloTable(), new Text(r.getStart().toArray()), new Text(r.getEnd().toArray()), true, true); } } }
Source:
public boolean isChecked(String title) throws RemoteException { Selector nodeSelector = new Selector("span[title=\"" + title + "\"]"); Object checked = browser.syncRun("return " + nodeSelector.getStatement() + ".prev().hasClass('rc-tree-checkbox-checked')"); return checked != null ? (Boolean) checked : null; }

Target:
public boolean isChecked(String title) throws RemoteException { Selector nodeSelector = new Selector("span[title=\"" + title + "\"]"); Object checked = browser.syncRun(String.format( "return %s.prev().hasClass('rc-tree-checkbox-checked')", nodeSelector.getStatement())); return checked != null ? (Boolean) checked : null; }
Source:
final Snapshot toSnapshot() { S state; Version version; LifecycleFlags lifecycle; if (isTransactionInProgress()) { AggregateTransaction tx = (AggregateTransaction) tx(); state = builder().buildPartial(); version = tx.currentVersion(); lifecycle = tx.lifecycleFlags(); } else { state = state(); version = version(); lifecycle = lifecycleFlags(); } Any packedState = AnyPacker.pack(state); Snapshot.Builder builder = Snapshot .newBuilder() .setState(packedState) .setVersion(version) .setTimestamp(currentTime()) .setLifecycle(lifecycle); return builder.build(); }

Target:
final Snapshot toSnapshot() { S state; Version version; LifecycleFlags lifecycle; if (isTransactionInProgress()) { AggregateTransaction<?, ?, ?> tx = (AggregateTransaction<?, ?, ?>) tx(); state = builder().buildPartial(); version = tx.currentVersion(); lifecycle = tx.lifecycleFlags(); } else { state = state(); version = version(); lifecycle = lifecycleFlags(); } Any packedState = AnyPacker.pack(state); Snapshot.Builder builder = Snapshot .newBuilder() .setState(packedState) .setVersion(version) .setTimestamp(currentTime()) .setLifecycle(lifecycle); return builder.build(); }
Source:
private void initProgramURLField() { programURLContainer = loginActivity.findViewById(R.id.text_layout_program_server_url); ((TextInputLayout) loginActivity.findViewById(R.id.text_layout_program_server_url)).setHint( Utils.getInternationalizedString(R.string.program_url, loginActivity)); }

Target:
private void initProgramURLField() { programURLContainer = initTextInputLayout(R.id.text_layout_program_server_url, R.string.program_url); }
Source:
public Response listTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId) { Collection<TopologyTestRunCaseSink> sources = catalogService.listTopologyTestRunCaseSink(testCaseId); if (sources == null) { throw EntityNotFoundException.byFilter("topologyId: " + topologyId + " / testCaseId: " + testCaseId); } return WSUtils.respondEntities(sources, OK); }

Target:
public Response listTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId) { Collection<TopologyTestRunCaseSink> sinks = catalogService.listTopologyTestRunCaseSink(testCaseId); if (sinks == null) { throw EntityNotFoundException.byFilter("topologyId: " + topologyId + " / testCaseId: " + testCaseId); } return WSUtils.respondEntities(sinks, OK); }
Source:
public static LocalDateTimeValue truncate( TemporalUnit unit, TemporalValue input, MapValue fields, Supplier<ZoneId> defaultZone ) { if ( unit.isTimeBased() && !(input instanceof DateTimeValue || input instanceof LocalDateTimeValue) ) { throw new IllegalArgumentException( "Cannot truncate " + input + " to local date time with a time based unit." ); } LocalTime localTime = input.hasTime() ? input.getLocalTimePart() : LocalTimeValue.DEFAULT_LOCAL_TIME; LocalDate localDate = input.getDatePart(); LocalTime truncatedTime; LocalDate truncatedDate; if ( unit.isDateBased() ) { truncatedDate = DateValue.truncateTo( localDate, unit ); truncatedTime = LocalTimeValue.DEFAULT_LOCAL_TIME; } else { truncatedDate = localDate; truncatedTime = localTime.truncatedTo( unit ); } LocalDateTime truncatedLDT = LocalDateTime.of( truncatedDate, truncatedTime ); if ( fields.size() == 0 ) { return localDateTime( truncatedLDT ); } else { Map<String,AnyValue> updatedFields = fields.getMapCopy(); truncatedLDT = updateFieldMapWithConflictingSubseconds( updatedFields, unit, truncatedLDT ); if ( updatedFields.size() == 0 ) { return localDateTime( truncatedLDT ); } updatedFields.put( "datetime", localDateTime( truncatedLDT ) ); return build( VirtualValues.map( updatedFields ), defaultZone ); } }

Target:
public static LocalDateTimeValue truncate( TemporalUnit unit, TemporalValue input, MapValue fields, Supplier<ZoneId> defaultZone ) { Pair<LocalDate,LocalTime> pair = getTruncatedDateAndTime( unit, input, "local date time" ); LocalDate truncatedDate = pair.first(); LocalTime truncatedTime = pair.other(); LocalDateTime truncatedLDT = LocalDateTime.of( truncatedDate, truncatedTime ); if ( fields.size() == 0 ) { return localDateTime( truncatedLDT ); } else { Map<String,AnyValue> updatedFields = fields.getMapCopy(); truncatedLDT = updateFieldMapWithConflictingSubseconds( updatedFields, unit, truncatedLDT ); if ( updatedFields.size() == 0 ) { return localDateTime( truncatedLDT ); } updatedFields.put( "datetime", localDateTime( truncatedLDT ) ); return build( VirtualValues.map( updatedFields ), defaultZone ); } }
Source:
public void copyChildren(Folder destinationFolder, Folder toCopyFolder) { ItemIterable<CmisObject> immediateChildren = toCopyFolder.getChildren(); for (CmisObject child : immediateChildren) { if (child instanceof Document) { ((Document) child).copy(destinationFolder); } else if (child instanceof Folder) { copyFolderRecursive(destinationFolder, (Folder) child); } } }

Target:
private void copyChildren(Folder destinationFolder, Folder toCopyFolder) { ItemIterable<CmisObject> immediateChildren = toCopyFolder.getChildren(); for (CmisObject child : immediateChildren) { if (child instanceof Document) { ((Document) child).copy(destinationFolder); } else if (child instanceof Folder) { copyFolderRecursive(destinationFolder, (Folder) child); } } }
Source:
public boolean isDevPortalAnonymousEnabled(String tenantDomain) { try { org.json.simple.JSONObject tenantConfig = APIUtil.getTenantConfig(tenantDomain); Object value = tenantConfig.get(APIConstants.API_TENANT_CONF_ENABLE_ANONYMOUS_MODE); if (value != null) { return Boolean.parseBoolean(value.toString()); } else { return APIUtil.isDevPortalAnonymous(); } } catch (APIManagementException e) { log.debug("Error while retrieving Recommendation config from registry", e); } return true; }

Target:
public boolean isDevPortalAnonymousEnabled(String tenantDomain) { try { org.json.simple.JSONObject tenantConfig = APIUtil.getTenantConfig(tenantDomain); Object value = tenantConfig.get(APIConstants.API_TENANT_CONF_ENABLE_ANONYMOUS_MODE); if (value != null) { return Boolean.parseBoolean(value.toString()); } else { return APIUtil.isDevPortalAnonymous(); } } catch (APIManagementException e) { log.error("Error while retrieving Anonymous config from registry", e); } return true; }
Source:
private void trackResult() { if (!TextUtils.isEmpty(mReason)) { AppLog.e(AppLog.T.API, "Could not connect to Jetpack, reason: " + mReason); ToastUtils.showToast(this, mReason); } else { trackWithSource(Stat.SIGNED_INTO_JETPACK, mSource); } }

Target:
private void trackResult() { if (!TextUtils.isEmpty(mReason)) { if (mReason.equals(ALREADY_CONNECTED)) { AppLog.d(AppLog.T.API, "Already connected to Jetpack."); ToastUtils.showToast(this, getString(R.string.jetpack_already_connected_toast)); } else { AppLog.e(AppLog.T.API, "Could not connect to Jetpack, reason: " + mReason); JetpackConnectionUtils.trackFailureWithSource(mSource, mReason); ToastUtils.showToast(this, getString(R.string.jetpack_connection_failed_with_reason, mReason)); } } else { JetpackConnectionUtils.trackWithSource(Stat.SIGNED_INTO_JETPACK, mSource); } }
Source:
private void checkIfUnused(MethodTree methodTree) { Symbol symbol = methodTree.symbol(); if (methodTree.modifiers().annotations().isEmpty() && symbol.isPrivate() && symbol.usages().isEmpty()) { if (methodTree.is(Tree.Kind.CONSTRUCTOR)) { if (!methodTree.parameters().isEmpty()) { unusedPrivateMethods.add(methodTree); } } else if (!SerializableContract.SERIALIZABLE_CONTRACT_METHODS.contains(symbol.name())) { unusedPrivateMethods.add(methodTree); } } }

Target:
private void checkIfUnused(MethodTree methodTree) { Symbol symbol = methodTree.symbol(); if (isUnusedPrivate(symbol) && hasNoAnnotation(methodTree) && (isConstructorWithParameters(methodTree) || isNotMethodFromSerializable(methodTree, symbol))) { unusedPrivateMethods.add(methodTree); } }
Source:
public Type getColumnType(int col) { try { return getMetadata().getFieldType(col); } catch (DriverException e) { return null; } }

Target:
public Type getColumnType(int col) { try { return getMetadata().getFieldType(col); } catch (DriverException e) { throw new IllegalStateException(e); } }
Source:
public Map<ServerName, List<RegionInfo>> retainAssignment(Map<RegionInfo, ServerName> regions, List<ServerName> servers) throws HBaseIOException { try { Map<ServerName, List<RegionInfo>> assignments = new TreeMap<>(); List<Pair<List<RegionInfo>, List<ServerName>>> pairs = generateGroupAssignments(Lists.newArrayList(regions.keySet()), servers); for (Pair<List<RegionInfo>, List<ServerName>> pair : pairs) { List<RegionInfo> regionList = pair.getFirst(); Map<RegionInfo, ServerName> currentAssignmentMap = Maps.newTreeMap(); regionList.forEach(r -> currentAssignmentMap.put(r, regions.get(r))); Map<ServerName, List<RegionInfo>> pairResult = this.internalBalancer.retainAssignment(currentAssignmentMap, pair.getSecond()); if (pairResult == null || pairResult.isEmpty()) { continue; } pairResult.forEach((server, rs) -> assignments .computeIfAbsent(server, s -> Lists.newArrayList()).addAll(rs)); } return assignments; } catch (IOException e) { throw new HBaseIOException("Failed to do online retain assignment", e); } }

Target:
public Map<ServerName, List<RegionInfo>> retainAssignment(Map<RegionInfo, ServerName> regions, List<ServerName> servers) throws HBaseIOException { try { Map<ServerName, List<RegionInfo>> assignments = new TreeMap<>(); List<Pair<List<RegionInfo>, List<ServerName>>> pairs = generateGroupAssignments(Lists.newArrayList(regions.keySet()), servers); for (Pair<List<RegionInfo>, List<ServerName>> pair : pairs) { List<RegionInfo> regionList = pair.getFirst(); Map<RegionInfo, ServerName> currentAssignmentMap = Maps.newTreeMap(); regionList.forEach(r -> currentAssignmentMap.put(r, regions.get(r))); Map<ServerName, List<RegionInfo>> pairResult = this.internalBalancer.retainAssignment(currentAssignmentMap, pair.getSecond()); pairResult.forEach((server, rs) -> assignments .computeIfAbsent(server, s -> Lists.newArrayList()).addAll(rs)); } return assignments; } catch (IOException e) { throw new HBaseIOException("Failed to do online retain assignment", e); } }
Source:
public List<E> list(String field, String contains) { try { for (PropertyDescriptor pd : Introspector.getBeanInfo(entityClass).getPropertyDescriptors()) { if (pd.getReadMethod() != null && pd.getName().toLowerCase().equals(field.toLowerCase())) { final Method readMethod = pd.getReadMethod(); Predicate<E> builtPredicate = e -> { try { return readMethod.invoke(e).toString().toLowerCase().replaceAll("\\s+", "") .contains(contains.toLowerCase().replaceAll("\\s+", "")); } catch (IllegalAccessException e1) { return true; } catch (InvocationTargetException e1) { return true; } }; return list(builtPredicate); } } } catch (IntrospectionException e) { return list(); } return list(); }

Target:
public List<E> list(String field, String contains) { try { for (PropertyDescriptor pd : Introspector.getBeanInfo(entityClass).getPropertyDescriptors()) { if (pd.getReadMethod() != null && pd.getName().toLowerCase().equals(field.toLowerCase())) { final Method readMethod = pd.getReadMethod(); Predicate<E> builtPredicate = e -> { try { return containsIgnoreCaseIgnoreSpaces(readMethod.invoke(e).toString(), contains); } catch (IllegalAccessException | InvocationTargetException ex) { return true; } }; return list(builtPredicate); } } } catch (IntrospectionException e) { return list(); } return list(); }
Source:
public void executeTransactionAsync_asyncQuery() { final Realm realm = looperThread.realm; RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync(); looperThread.keepStrongReference.add(results); realm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { realm.createObject(AllTypes.class); } }, new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { assertEquals(realm.where(AllTypes.class).count(), 1); looperThread.testComplete(); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { fail(); } }); }

Target:
public void executeTransactionAsync_asyncQuery() { final Realm realm = looperThread.realm; final RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync(); assertEquals(0, results.size()); realm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { realm.createObject(AllTypes.class); } }, new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { assertEquals(1, realm.where(AllTypes.class).count()); assertEquals(1, results.size()); looperThread.testComplete(); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { fail(); } }); }
Source:
public Object getPayload(CorfuRuntime runtime) { Object value = payload.get(); if (value == null) { synchronized (this.payload) { value = this.payload.get(); if (value == null) { if (data == null) { this.payload.set(null); } else { ByteBuf copyBuf = Unpooled.wrappedBuffer(data); final Object actualValue; try { actualValue = Serializers.CORFU.deserialize(copyBuf, runtime); } catch (Throwable throwable) { log.error("Exception caught at address {}, {}, {}", getGlobalAddress(), getStreams(), getType()); log.error("Raw data buffer {}", copyBuf.toString(Charset.defaultCharset())); copyBuf.release(); data = null; throw throwable; } if (actualValue instanceof LogEntry) { ((LogEntry) actualValue).setGlobalAddress(getGlobalAddress()); ((LogEntry) actualValue).setRuntime(runtime); } value = actualValue == null ? this.payload : actualValue; this.payload.set(value); copyBuf.release(); lastKnownSize = data.length; data = null; } } } } return value; }

Target:
public Object getPayload(CorfuRuntime runtime) { Object value = payload.get(); if (value == null) { synchronized (this.payload) { value = this.payload.get(); if (value == null) { if (data == null) { this.payload.set(null); } else { ByteBuf copyBuf = Unpooled.wrappedBuffer(data); final Object actualValue; try { actualValue = Serializers.CORFU.deserialize(copyBuf, runtime); } catch (Throwable throwable) { log.error("Exception caught at address {}, {}, {}", getGlobalAddress(), getStreams(), getType()); log.error("Raw data buffer {}", copyBuf.resetReaderIndex().toString(Charset.defaultCharset())); copyBuf.release(); data = null; throw throwable; } if (actualValue instanceof LogEntry) { ((LogEntry) actualValue).setGlobalAddress(getGlobalAddress()); ((LogEntry) actualValue).setRuntime(runtime); } value = actualValue == null ? this.payload : actualValue; this.payload.set(value); copyBuf.release(); lastKnownSize = data.length; data = null; } } } } return value; }
Source:
public void testOneSuccessfull() throws IOException { final List<Pass> list = new ArrayList<Pass>(1); list.add(new PsFake(true)); final Opt<Identity> identity = new PsAll(list, 0).enter(new RqFake()); MatcherAssert.assertThat( identity.has(), Matchers.is(true) ); }

Target:
public void testOneSuccessfull() throws Exception { final List<Pass> list = new ArrayList<Pass>(1); list.add(new PsFake(true)); final Opt<Identity> identity = new PsAll(list, 0).enter(new RqFake()); MatcherAssert.assertThat( identity.has(), Matchers.is(true) ); }
Source:
private void serverSend(final ProtonServerReceiverContext context, final Transaction transaction, final Message message, final Delivery delivery, final Receiver receiver, final RoutingContext routingContext) throws Exception { message.setConnectionID(receiver.getSession().getConnection().getRemoteContainer()); if (invokeIncoming((AMQPMessage) message, (ActiveMQProtonRemotingConnection) transportConnection.getProtocolConnection()) == null) { serverSession.send(transaction, message, directDeliver, false, routingContext); } afterIO(new IOCallback() { @Override public void done() { connection.runLater(() -> { if (delivery.getRemoteState() instanceof TransactionalState) { TransactionalState txAccepted = new TransactionalState(); txAccepted.setOutcome(Accepted.getInstance()); txAccepted.setTxnId(((TransactionalState) delivery.getRemoteState()).getTxnId()); delivery.disposition(txAccepted); } else { delivery.disposition(Accepted.getInstance()); } delivery.settle(); context.flow(); connection.flush(); }); } @Override public void onError(int errorCode, String errorMessage) { connection.runNow(() -> { receiver.setCondition(new ErrorCondition(AmqpError.ILLEGAL_STATE, errorCode + ":" + errorMessage)); connection.flush(); }); } }); }

Target:
private void serverSend(final ProtonServerReceiverContext context, final Transaction transaction, final Message message, final Delivery delivery, final Receiver receiver, final RoutingContext routingContext) throws Exception { message.setConnectionID(receiver.getSession().getConnection().getRemoteContainer()); if (invokeIncoming((AMQPMessage) message, (ActiveMQProtonRemotingConnection) transportConnection.getProtocolConnection()) == null) { serverSession.send(transaction, message, directDeliver, false, routingContext); afterIO(new IOCallback() { @Override public void done() { connection.runLater(() -> { if (delivery.getRemoteState() instanceof TransactionalState) { TransactionalState txAccepted = new TransactionalState(); txAccepted.setOutcome(Accepted.getInstance()); txAccepted.setTxnId(((TransactionalState) delivery.getRemoteState()).getTxnId()); delivery.disposition(txAccepted); } else { delivery.disposition(Accepted.getInstance()); } delivery.settle(); context.flow(); connection.flush(); }); } @Override public void onError(int errorCode, String errorMessage) { connection.runNow(() -> { receiver.setCondition(new ErrorCondition(AmqpError.ILLEGAL_STATE, errorCode + ":" + errorMessage)); connection.flush(); }); } }); } else { rejectMessage(delivery, Symbol.valueOf("failed"), "Interceptor rejected message"); } }
Source:
public String getOperation() { return "delete"; }

Target:
public Operation getOperation() { return Operation.DELETE; }
Source:
public void onPreMerge(Repository repo, CodeReviewCommit commit, ProjectState destProject, NameKey destBranch, Id patchSetId) throws MergeValidationException { try { db = schemaFactory.open(); PatchSetApproval psa = approvalsUtil.getSubmitter(db, commit.notes(), patchSetId); if (psa == null) { throw new MergeValidationException( CommitMergeStatus.REJECTED_BY_PLUGIN, "Submitter not found"); } final IdentifiedUser submitter = identifiedUserFactory.create(psa.getAccountId()); if (!submitter.getCapabilities().canAdministrateServer()) { throw new MergeValidationException(CommitMergeStatus.REJECTED_BY_PLUGIN, "Submitter is not admin"); } } catch (OrmException e) { throw new MergeValidationException( CommitMergeStatus.REJECTED_BY_PLUGIN, "DB error"); } finally { if (db != null) { db.close(); } } }

Target:
public void onPreMerge(Repository repo, CodeReviewCommit commit, ProjectState destProject, NameKey destBranch, Id patchSetId) throws MergeValidationException { try { db = schemaFactory.open(); PatchSetApproval psa = approvalsUtil.getSubmitter(db, commit.notes(), patchSetId); if (psa == null) { throw new MergeValidationException( CommitMergeStatus.REJECTED_BY_PLUGIN); } final IdentifiedUser submitter = identifiedUserFactory.create(psa.getAccountId()); if (!submitter.getCapabilities().canAdministrateServer()) { throw new MergeValidationException(CommitMergeStatus.REJECTED_BY_PLUGIN); } } catch (OrmException e) { throw new MergeValidationException(CommitMergeStatus.REJECTED_BY_PLUGIN); } finally { if (db != null) { db.close(); } } }
Source:
public DruidAggregationColumnNode(ExpressionType expressionType, VariableReferenceExpression outputColumn) { this.expressionType = expressionType; this.outputColumn = outputColumn; }

Target:
public DruidAggregationColumnNode(ExpressionType expressionType, VariableReferenceExpression outputColumn) { this.expressionType = requireNonNull(expressionType, "expressionType is null"); this.outputColumn = requireNonNull(outputColumn, "outputColumn is null"); }
Source:
private ConnectorBucketNodeMap(int bucketCount, Optional<Map<Integer, Node>> bucketToNode) { if (bucketCount <= 0) { throw new IllegalArgumentException("bucketCount must be positive"); } if (bucketToNode.isPresent() && bucketToNode.get().size() != bucketCount) { throw new IllegalArgumentException(format("Mismatched bucket count in bucketToNode (%s) and bucketCount (%s)", bucketToNode.get().size(), bucketCount)); } this.bucketCount = bucketCount; this.bucketToNode = requireNonNull(bucketToNode, "bucketCount is null"); }

Target:
private ConnectorBucketNodeMap(int bucketCount, Optional<Map<Integer, Node>> bucketToNode) { if (bucketCount <= 0) { throw new IllegalArgumentException("bucketCount must be positive"); } if (bucketToNode.isPresent() && bucketToNode.get().size() != bucketCount) { throw new IllegalArgumentException(format("Mismatched bucket count in bucketToNode (%s) and bucketCount (%s)", bucketToNode.get().size(), bucketCount)); } this.bucketCount = bucketCount; this.bucketToNode = requireNonNull(bucketToNode, "bucketToNode is null") .map(mapping -> unmodifiableMap(new HashMap<>(mapping))); }
Source:
public void testCorrectUserCustomCredentialSecurityFactoryException() throws Exception { try (CLIWrapper cli = new CLIWrapper(true)) { StringBuilder configuration = new StringBuilder("throwException").append("=").append(true); cli.sendLine(String.format( "/subsystem=elytron/custom-credential-security-factory=%s:write-attribute(name=configuration, value={%s})", CUSTOM_CRED_SEC_FACTORY_NAME, configuration)); cli.sendLine("reload"); } CoreUtils.makeCallWithBasicAuthn(createSimpleManagementOperationUrl(), USER, CORRECT_PASSWORD, HttpStatus.SC_INTERNAL_SERVER_ERROR); }

Target:
public void testCorrectUserCustomCredentialSecurityFactoryException() throws Exception { try (CLIWrapper cli = new CLIWrapper(true)) { StringBuilder configuration = new StringBuilder("throwException").append("=").append(true); cli.sendLine(String.format( "/subsystem=elytron/custom-credential-security-factory=%s:write-attribute(name=configuration, value={%s})", CUSTOM_CRED_SEC_FACTORY_NAME, configuration)); ServerReload.executeReloadAndWaitForCompletion(CONTROLLER.getClient().getControllerClient()); } CoreUtils.makeCallWithBasicAuthn(createSimpleManagementOperationUrl(), USER, CORRECT_PASSWORD, HttpStatus.SC_INTERNAL_SERVER_ERROR); }
Source:
public int setCustomValues(User loggedInUser, Integer sid, Map<String, String> values) throws FaultException { Server server = lookupServer(loggedInUser, sid); Org org = loggedInUser.getOrg(); List<String> skippedKeys = new ArrayList<String>(); Set<String> keys = values.keySet(); for (Iterator<String> itr = keys.iterator(); itr.hasNext();) { String label = itr.next(); String value = StringUtils.trim(values.get(label).toString()); if (org.hasCustomDataKey(label) && !value.isEmpty()) { server.addCustomDataValue(label, values.get(label).toString(), loggedInUser); } else { skippedKeys.add(label); } } if (skippedKeys.size() > 0) { StringBuilder msg = new StringBuilder("One or more of the following " + "custom info fields was not defined: "); for (Iterator<String> itr = skippedKeys.iterator(); itr.hasNext();) { String label = itr.next(); msg.append("\n" + label); } throw new UndefinedCustomFieldsException(msg.toString()); } return 1; }

Target:
public int setCustomValues(User loggedInUser, Integer sid, Map<String, String> values) throws FaultException { Server server = lookupServer(loggedInUser, sid); Org org = loggedInUser.getOrg(); List<String> skippedKeys = new ArrayList<String>(); Set<String> keys = values.keySet(); for (Iterator<String> itr = keys.iterator(); itr.hasNext();) { String label = itr.next(); String value = StringUtils.trim(values.get(label)); if (org.hasCustomDataKey(label) && !value.isEmpty()) { server.addCustomDataValue(label, values.get(label), loggedInUser); } else { skippedKeys.add(label); } } if (skippedKeys.size() > 0) { StringBuilder msg = new StringBuilder("One or more of the following " + "custom info fields was not defined: "); for (Iterator<String> itr = skippedKeys.iterator(); itr.hasNext();) { String label = itr.next(); msg.append("\n" + label); } throw new UndefinedCustomFieldsException(msg.toString()); } return 1; }
Source:
protected void invokeTestMethod(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor) { ExtensionContext extensionContext = context.getExtensionContext(); context.getThrowableCollector().execute(() -> { Object instance = extensionContext.getRequiredTestInstance(); Object testFactoryMethodResult = executableInvoker.invoke(getTestMethod(), instance, extensionContext, context.getExtensionRegistry(), INTERCEPTOR_CALL); TestSource defaultTestSource = getSource().orElseThrow( () -> new JUnitException("Illegal state: TestSource must be present")); try (Stream<DynamicNode> dynamicNodeStream = toDynamicNodeStream(testFactoryMethodResult)) { int index = 1; Iterator<DynamicNode> iterator = dynamicNodeStream.iterator(); while (iterator.hasNext()) { DynamicNode dynamicNode = iterator.next(); Optional<JupiterTestDescriptor> descriptor = createDynamicDescriptor(this, dynamicNode, index++, defaultTestSource, getDynamicDescendantFilter(), configuration); descriptor.ifPresent(dynamicTestExecutor::execute); } } catch (ClassCastException ex) { throw invalidReturnTypeException(ex); } dynamicTestExecutor.awaitFinished(); }); }

Target:
protected void invokeTestMethod(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor) { ExtensionContext extensionContext = context.getExtensionContext(); context.getThrowableCollector().execute(() -> { Object instance = extensionContext.getRequiredTestInstance(); Object testFactoryMethodResult = executableInvoker.invoke(getTestMethod(), instance, extensionContext, context.getExtensionRegistry(), interceptorCall); TestSource defaultTestSource = getSource().orElseThrow( () -> new JUnitException("Illegal state: TestSource must be present")); try (Stream<DynamicNode> dynamicNodeStream = toDynamicNodeStream(testFactoryMethodResult)) { int index = 1; Iterator<DynamicNode> iterator = dynamicNodeStream.iterator(); while (iterator.hasNext()) { DynamicNode dynamicNode = iterator.next(); Optional<JupiterTestDescriptor> descriptor = createDynamicDescriptor(this, dynamicNode, index++, defaultTestSource, getDynamicDescendantFilter(), configuration); descriptor.ifPresent(dynamicTestExecutor::execute); } } catch (ClassCastException ex) { throw invalidReturnTypeException(ex); } dynamicTestExecutor.awaitFinished(); }); }
Source:
private int index(final Talk talk) throws IOException { final List<Integer> indexes = new ListOf<>( new Mapped<>( input -> new NumberOf(input).intValue(), talk.read() .xpath("/talk/archive/log/@index|/talk/request/@index") ) ); final int index; if (indexes.iterator().hasNext()) { try { index = new MaxOf( indexes.toArray(new Integer[indexes.size()]) ).intValue(); } catch (final Throwable ex) { throw new IOException(ex); } } else { index = 0; } return index; }

Target:
private int index(final Talk talk) throws IOException { final SolidList<Number> indexes = new SolidList<>( new Mapped<>( input -> new NumberOf(input), talk.read() .xpath("/talk/archive/log/@index|/talk/request/@index") ) ); final int index; if (indexes.iterator().hasNext()) { index = new MaxOf(indexes).intValue(); } else { index = 0; } return index; }