auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Iterable<Protos.Resource> getScalarResource(Protos.Offer offer, String name, Double value, Double used) { String role = cfg.getFrameworkRole(); ArrayList<Protos.Resource> resources = new ArrayList<>(); double resourceDoubleValue = 0; for (Protos.Resource r : offer.getResourcesList()) { if (r.getName().equals(name) && r.hasRole() && r.getRole().equals(role) && r.hasScalar()) { resourceDoubleValue = r.getScalar().getValue(); if (resourceDoubleValue - used > 0) { resources.add(Protos.Resource.newBuilder().setName(name).setType(Protos.Value.Type.SCALAR) .setScalar(Protos.Value.Scalar.newBuilder().setValue(Math.min(value, resourceDoubleValue - used)).build()) .setRole(role).build()); } break; } else if (r.getName().equals(name) && r.hasRole() && r.getRole().equals(role)) { LOGGER.warn("Resource with name: " + name + "expected type to be SCALAR check configuration on: " + offer.getHostname()); } } if (value - Math.max((resourceDoubleValue - used), 0) > 0) { resources.add(Protos.Resource.newBuilder().setName(name).setType(Protos.Value.Type.SCALAR) .setScalar(Protos.Value.Scalar.newBuilder().setValue(value - Math.max((resourceDoubleValue - used), 0)).build()) .build()); } return resources; }

Target:
public Iterable<Protos.Resource> getScalarResource(Protos.Offer offer, String name, Double value, Double used) { String role = cfg.getFrameworkRole(); ArrayList<Protos.Resource> resources = new ArrayList<>(); double resourceDifference = 0; for (Protos.Resource r : offer.getResourcesList()) { if (r.getName().equals(name) && r.hasRole() && r.getRole().equals(role) && r.hasScalar()) { resourceDifference = Math.max(r.getScalar().getValue() - used, 0.0); if (resourceDifference > 0) { resources.add(Protos.Resource.newBuilder().setName(name).setType(Protos.Value.Type.SCALAR) .setScalar(Protos.Value.Scalar.newBuilder().setValue(Math.min(value, resourceDifference)).build()) .setRole(role).build()); } break; } else if (r.getName().equals(name) && r.hasRole() && r.getRole().equals(role)) { LOGGER.warn("Resource with name: " + name + "expected type to be SCALAR check configuration on: " + offer.getHostname()); } } if (value - resourceDifference > 0) { resources.add(Protos.Resource.newBuilder().setName(name).setType(Protos.Value.Type.SCALAR) .setScalar(Protos.Value.Scalar.newBuilder().setValue(value - resourceDifference).build()) .build()); } return resources; }
Source:
public void importExportKMeansModelTest(){ Path mdlPath = Paths.get(mdlFilePath); KMeansModel mdl = getClusterModel(); Exporter<KMeansModelFormat, String> exporter = new FileExporter<>(); mdl.saveModel(exporter, mdlFilePath); Assert.assertTrue(String.format("File %s not found", mdlPath.toString()), Files.exists(mdlPath)); KMeansModelFormat load = exporter.load(mdlFilePath); KMeansModel importedMdl = new KMeansModel(load.getCenters(), load.getDistance()); Assert.assertTrue("", mdl.equals(importedMdl)); }

Target:
public void importExportKMeansModelTest(){ Path mdlPath = Paths.get(mdlFilePath); KMeansModel mdl = getClusterModel(); Exporter<KMeansModelFormat, String> exporter = new FileExporter<>(); mdl.saveModel(exporter, mdlFilePath); Assert.assertTrue(String.format("File %s not found.", mdlPath.toString()), Files.exists(mdlPath)); KMeansModelFormat load = exporter.load(mdlFilePath); KMeansModel importedMdl = new KMeansModel(load.getCenters(), load.getDistance()); Assert.assertTrue("", mdl.equals(importedMdl)); }
Source:
public void testComposedFunctionIsAppliedToExistingMessageSource() { try (ConfigurableApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(FunctionsConfiguration.class)).web( WebApplicationType.NONE) .run("--spring.cloud.stream.function.definition=toUpperCase|concatWithSelf", "--spring.jmx.enabled=false")) { OutputDestination target = context.getBean(OutputDestination.class); assertThat(target.receive(1000).getPayload()).isEqualTo( "HELLO FUNCTION:HELLO FUNCTION".getBytes(StandardCharsets.UTF_8)); context.close(); } }

Target:
public void testComposedFunctionIsAppliedToExistingMessageSource() { try (ConfigurableApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(FunctionsConfiguration.class)).web( WebApplicationType.NONE) .run("--spring.cloud.stream.function.definition=toUpperCase|concatWithSelf", "--spring.jmx.enabled=false")) { OutputDestination target = context.getBean(OutputDestination.class); assertThat(target.receive(1000).getPayload()).isEqualTo( "HELLO FUNCTION:HELLO FUNCTION".getBytes(StandardCharsets.UTF_8)); } }
Source:
protected void buttonPressed(int buttonId) { switch (buttonId) { case DELETE_ID: ILaunchConfiguration c = getLaunchConfiguration(); if (c.isWorkingCopy()) c = ((ILaunchConfigurationWorkingCopy)c).getOriginal(); final ILaunchConfiguration config = c; if (MessageDialog.openConfirm(getShell(), Messages.LaunchConfigurationEditDialog_3, Messages.LaunchConfigurationEditDialog_4 + config.getName())) { new Job(Messages.LaunchConfigurationEditDialog_5) { protected IStatus run(IProgressMonitor monitor) { try { config.delete(); return Status.OK_STATUS; } catch (CoreException e) { return e.getStatus(); } }; }.schedule(); cancelPressed(); } break; case DUPLICATE_ID: final ILaunchConfiguration original = getLaunchConfiguration(); final String newName = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(original.getName()); final Shell shell = getParentShell(); final LaunchGroupExtension group = getLaunchGroup(); new Job(Messages.LaunchConfigurationEditDialog_6) { protected IStatus run(IProgressMonitor monitor) { try { final ILaunchConfigurationWorkingCopy newWorkingCopy = original.copy(newName); final ILaunchConfiguration newConfig = newWorkingCopy.doSave(); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { new LaunchConfigurationEditDialog(shell, newConfig, group).open(); } }); return Status.OK_STATUS; } catch (CoreException e) { return e.getStatus(); } }; }.schedule(); cancelPressed(); break; case LAUNCH_ID: okPressed(); Activator.runCommand(Activator.CMD_LAUNCH); break; default: super.buttonPressed(buttonId); } }

Target:
protected void buttonPressed(int buttonId) { switch (buttonId) { case DELETE_ID: ILaunchConfiguration c = getLaunchConfiguration(); if (c.isWorkingCopy()) c = ((ILaunchConfigurationWorkingCopy)c).getOriginal(); final ILaunchConfiguration config = c; if (MessageDialog.openConfirm(getShell(), Messages.LaunchConfigurationEditDialog_3, Messages.LaunchConfigurationEditDialog_4 + config.getName())) { new Job(Messages.LaunchConfigurationEditDialog_5) { protected IStatus run(IProgressMonitor monitor) { try { config.delete(); return Status.OK_STATUS; } catch (CoreException e) { return e.getStatus(); } }; }.schedule(); cancelPressed(); } break; case DUPLICATE_ID: final ILaunchConfiguration original = getLaunchConfiguration(); final String newName = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(original.getName()); final Shell shell = getParentShell(); final LaunchGroupExtension group = getLaunchGroup(); new UIJob(Messages.LaunchConfigurationEditDialog_6) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { try { final ILaunchConfigurationWorkingCopy newWorkingCopy = original.copy(newName); final ILaunchConfiguration newConfig = newWorkingCopy.doSave(); new LaunchConfigurationEditDialog(shell, newConfig, group).open(); } catch (CoreException e) { return e.getStatus(); } return Status.OK_STATUS; } }.schedule(); cancelPressed(); break; case LAUNCH_ID: okPressed(); Activator.runCommand(Activator.CMD_LAUNCH); break; default: super.buttonPressed(buttonId); } }
Source:
public Symbol newSymbol(Expression expression, Type type, String suffix) { String nameHint = "expr"; if (expression instanceof Identifier) { nameHint = ((Identifier) expression).getName(); } else if (expression instanceof FunctionCall) { nameHint = ((FunctionCall) expression).getName().getSuffix(); } else if (expression instanceof SymbolReference) { nameHint = ((SymbolReference) expression).getName(); } else if (expression instanceof GroupingOperation) { nameHint = "grouping_operation"; } return newSymbol(nameHint, type, suffix); }

Target:
public Symbol newSymbol(Expression expression, Type type, String suffix) { String nameHint = "expr"; if (expression instanceof Identifier) { nameHint = ((Identifier) expression).getName(); } else if (expression instanceof FunctionCall) { nameHint = ((FunctionCall) expression).getName().getSuffix(); } else if (expression instanceof SymbolReference) { nameHint = ((SymbolReference) expression).getName(); } else if (expression instanceof GroupingOperation) { nameHint = "grouping"; } return newSymbol(nameHint, type, suffix); }
Source:
public Object sampleVal() { checkHasParams(); double x = lower + Math.floor(Util.random() * (upper - lower + 1)); return new Integer((int) x); }

Target:
public Object sampleVal() { return sample_value(); }
Source:
private String createConsumerClientId(Properties props) { String prefix = props.getProperty(KafkaSourceOptions.CLIENT_ID_PREFIX.key()); return prefix + "-" + new Random().nextLong(); }

Target:
private String createConsumerClientId(Properties props) { String prefix = props.getProperty(KafkaSourceOptions.CLIENT_ID_PREFIX.key()); return prefix + "-" + subtaskId; }
Source:
static Spannable getSpannableContentForRanges(FormattableContent formattableContent, TextView textView, final NoteBlock.OnNoteBlockTextClickListener onNoteBlockTextClickListener, boolean isFooter) { return getSpannableContentForRanges(formattableContent, textView, isFooter, new Function1<NoteBlockClickableSpan, Unit>() { @Override public Unit invoke(NoteBlockClickableSpan noteBlockClickableSpan) { onNoteBlockTextClickListener.onNoteBlockTextClicked(noteBlockClickableSpan); return null; } }); }

Target:
static Spannable getSpannableContentForRanges(FormattableContent formattableContent, TextView textView, final NoteBlock.OnNoteBlockTextClickListener onNoteBlockTextClickListener, boolean isFooter) { Function1<NoteBlockClickableSpan, Unit> clickListener = onNoteBlockTextClickListener != null ? new Function1<NoteBlockClickableSpan, Unit>() { @Override public Unit invoke(NoteBlockClickableSpan noteBlockClickableSpan) { onNoteBlockTextClickListener.onNoteBlockTextClicked(noteBlockClickableSpan); return null; } } : null; return getSpannableContentForRanges(formattableContent, textView, isFooter, clickListener); }
Source:
public void loadBalancingTargetPath() { String name = "LoadBalancingTargetTest-loadBalancingDefaultPolicyRoundRobin"; String serverListKey = name + ".ribbon.listOfServers"; server1.enqueue(new MockResponse().setBody("success!")); server2.enqueue(new MockResponse().setBody("success!")); getConfigInstance().setProperty(serverListKey, hostAndPort(server1.url("").url()) + "," + hostAndPort( server2.url("").url())); try { LoadBalancingTarget<TestInterface> target = LoadBalancingTarget.create(TestInterface.class, "http://" + name + "/servers"); TestInterface api = Feign.builder().target(target); api.get(); api.get(); assertEquals(1, server1.getRequestCount()); assertEquals(1, server2.getRequestCount()); } finally { getConfigInstance().clearProperty(serverListKey); } }

Target:
public void loadBalancingTargetPath() throws InterruptedException { String name = "LoadBalancingTargetTest-loadBalancingDefaultPolicyRoundRobin"; String serverListKey = name + ".ribbon.listOfServers"; server1.enqueue(new MockResponse().setBody("success!")); getConfigInstance().setProperty(serverListKey, hostAndPort(server1.url("").url())); try { LoadBalancingTarget<TestInterface> target = LoadBalancingTarget.create(TestInterface.class, "http://" + name + "/context-path"); TestInterface api = Feign.builder().target(target); api.get(); assertEquals("http:/ assertEquals("/context-path/servers", server1.takeRequest().getPath()); } finally { getConfigInstance().clearProperty(serverListKey); } }
Source:
protected HttpURLConnection create(URL url) throws IOException, GeneralSecurityException { Boolean verifyHost = false; Boolean verifyChain = true; String httpsProtocol = "TLSv1"; String trustManagerAlgorithm = TrustManagerFactory.getDefaultAlgorithm(); String trustStore = EngineLocalConfig.getInstance().getProperty("ENGINE_PKI_TRUST_STORE"); String trustStoreType = KeyStore.getDefaultType(); String trustStorePassword = EngineLocalConfig.getInstance().getPKITrustStorePassword(); Integer readTimeout = 0; return new HttpURLConnectionBuilder(url).setHttpsProtocol(httpsProtocol) .setReadTimeout(readTimeout) .setTrustManagerAlgorithm(trustManagerAlgorithm) .setTrustStore(trustStore) .setTrustStorePassword(trustStorePassword) .setTrustStoreType(trustStoreType) .setURL(url) .setVerifyChain(verifyChain) .setVerifyHost(verifyHost).create(); }

Target:
protected HttpURLConnection create(URL url) throws IOException, GeneralSecurityException { return new HttpURLConnectionBuilder(url).setHttpsProtocol("TLSv1") .setReadTimeout(0) .setTrustManagerAlgorithm(TrustManagerFactory.getDefaultAlgorithm()) .setTrustStore(EngineLocalConfig.getInstance().getProperty("ENGINE_PKI_TRUST_STORE")) .setTrustStorePassword(EngineLocalConfig.getInstance().getPKITrustStorePassword()) .setTrustStoreType(KeyStore.getDefaultType()) .setURL(url) .setVerifyChain(true) .setVerifyHost(false).create(); }
Source:
public void delete(Context context, Relationship relationship, boolean copyToLeftItem, boolean copyToRightItem) throws SQLException, AuthorizeException { log.info(org.dspace.core.LogManager.getHeader(context, "delete_relationship", "relationship_id=" + relationship.getID() + "&" + "copyToLeftItem=" + copyToLeftItem + "&" + "copyToRightItem=" + copyToRightItem)); if (isRelationshipValidToDelete(context, relationship) && copyToItemPermissionCheck(context, relationship, copyToLeftItem, copyToRightItem)) { copyMetadataValues(context, relationship, copyToLeftItem, copyToRightItem); if (authorizeService.authorizeActionBoolean(context, relationship.getLeftItem(), Constants.WRITE) || authorizeService.authorizeActionBoolean(context, relationship.getRightItem(), Constants.WRITE)) { relationshipDAO.delete(context, relationship); updatePlaceInRelationship(context, relationship, false); } else { throw new AuthorizeException( "You do not have write rights on this relationship's items"); } } else { throw new IllegalArgumentException("The relationship given was not valid"); } }

Target:
public void delete(Context context, Relationship relationship, boolean copyToLeftItem, boolean copyToRightItem) throws SQLException, AuthorizeException { log.info(org.dspace.core.LogManager.getHeader(context, "delete_relationship", "relationship_id=" + relationship.getID() + "&" + "copyMetadataValuesToLeftItem=" + copyToLeftItem + "&" + "copyMetadataValuesToRightItem=" + copyToRightItem)); if (isRelationshipValidToDelete(context, relationship) && copyToItemPermissionCheck(context, relationship, copyToLeftItem, copyToRightItem)) { copyMetadataValues(context, relationship, copyToLeftItem, copyToRightItem); if (authorizeService.authorizeActionBoolean(context, relationship.getLeftItem(), Constants.WRITE) || authorizeService.authorizeActionBoolean(context, relationship.getRightItem(), Constants.WRITE)) { relationshipDAO.delete(context, relationship); updatePlaceInRelationship(context, relationship); } else { throw new AuthorizeException( "You do not have write rights on this relationship's items"); } } else { throw new IllegalArgumentException("The relationship given was not valid"); } }
Source:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case END_FAILURE: return AuditLogType.USER_DEACTIVATE_STORAGE_DOMAIN_FAILED; default: return AuditLogType.UNASSIGNED; } }

Target:
public AuditLogType getAuditLogTypeValue() { return getActionState() == CommandActionState.END_FAILURE ? AuditLogType.USER_DEACTIVATE_STORAGE_DOMAIN_FAILED : AuditLogType.UNASSIGNED; }
Source:
public void onError(Throwable t) { if (t == null) { throw new NullPointerException("t is null"); } if (once.compareAndSet(false, true)) { error = t; done = true; drain(); } else { RxJavaPlugins.onError(t); } }

Target:
public void onError(Throwable t) { ObjectHelper.requireNonNull(t, "onError called with null. Null values are generally not allowed in 2.x operators and sources."); if (once.compareAndSet(false, true)) { error = t; done = true; drain(); } else { RxJavaPlugins.onError(t); } }
Source:
protected Stream<List<String>> getMappedStream(final SnomedReferenceSetMembers results, final RepositoryContext context, final String branch) { final List<String> extraColumns = newArrayList(getHeader()); for (int i = 0; i < 6; i++) { extraColumns.remove(0); } for (int j = 0; j < extraColumns.size(); j++) { switch (extraColumns.get(j)) { case SnomedRf2Headers.FIELD_TARGET_COMPONENT_ID: extraColumns.set(j, SnomedRf2Headers.FIELD_TARGET_COMPONENT); break; default: break; } } return results.stream() .map(member -> { final ImmutableList.Builder<String> builder = ImmutableList.<String>builder() .add(member.getId()) .add(getEffectiveTime(member)) .add(getActive(member)) .add(member.getModuleId()) .add(member.getReferenceSetId()) .add(member.getReferencedComponent().getId()); final Map<String, Object> properties = member.getProperties(); for (final String extraColumn : extraColumns) { Object property = properties.get(extraColumn); if (extraColumn.equals(SnomedRf2Headers.FIELD_QUERY)) { String query = (String) property; query = query.replace("\r", " "); query = query.replace("\n", " "); query = query.replace("\t", " "); property = query; } builder.add(toColumn(property)); } return builder.build(); }); }

Target:
protected Stream<List<String>> getMappedStream(final SnomedReferenceSetMembers results, final RepositoryContext context, final String branch) { final List<String> extraColumns = newArrayList(getHeader()); for (int i = 0; i < 6; i++) { extraColumns.remove(0); } for (int j = 0; j < extraColumns.size(); j++) { switch (extraColumns.get(j)) { case SnomedRf2Headers.FIELD_TARGET_COMPONENT_ID: extraColumns.set(j, SnomedRf2Headers.FIELD_TARGET_COMPONENT); break; default: break; } } return results.stream() .map(member -> { final ImmutableList.Builder<String> builder = ImmutableList.<String>builder() .add(member.getId()) .add(getEffectiveTime(member)) .add(getActive(member)) .add(member.getModuleId()) .add(member.getReferenceSetId()) .add(member.getReferencedComponent().getId()); final Map<String, Object> properties = member.getProperties(); for (final String extraColumn : extraColumns) { builder.add(toColumn(extraColumn, properties.get(extraColumn))); } return builder.build(); }); }
Source:
public void createUser_shouldThrowWhenCalledOutsideContextDAO() throws Throwable { try { Daemon.createUser(new User(), "password", null); Assert.fail("Should not be here, an exception should have been thrown in the line above"); } catch (APIException e) { Assert.assertTrue(e.getMessage().startsWith(Context.getMessageSourceService().getMessage("Context.DAO.only", new Object[] { this.getClass().getName() }, null))); } }

Target:
public void createUser_shouldThrowWhenCalledOutsideContextDAO() throws Throwable { expectedException.expect(APIException.class); expectedException.expectMessage(Context.getMessageSourceService().getMessage("Context.DAO.only", new Object[] { this.getClass().getName() }, null)); Daemon.createUser(new User(), "password", null); }
Source:
protected void copyTemplateToTargetFilesystemStorageIfNeeded(VolumeInfo srcVolumeInfo, StoragePool srcStoragePool, DataStore destDataStore, StoragePool destStoragePool, Host destHost) { VMTemplateStoragePoolVO sourceVolumeTemplateStoragePoolVO = vmTemplatePoolDao.findByPoolTemplate(destStoragePool.getId(), srcVolumeInfo.getTemplateId()); if (sourceVolumeTemplateStoragePoolVO == null && destStoragePool.getPoolType() == StoragePoolType.Filesystem) { DataStore sourceTemplateDataStore = dataStoreManagerImpl.getImageStore(srcVolumeInfo.getDataCenterId()); if (sourceTemplateDataStore != null) { TemplateInfo sourceTemplateInfo = templateDataFactory.getTemplate(srcVolumeInfo.getTemplateId(), sourceTemplateDataStore); TemplateObjectTO sourceTemplate = new TemplateObjectTO(sourceTemplateInfo); LOGGER.debug(String.format("Could not find template [id=%s, name=%s] on the storage pool [id=%s]; copying the template to the target storage pool.", srcVolumeInfo.getTemplateId(), sourceTemplateInfo.getName(), destDataStore.getId())); TemplateInfo destTemplateInfo = templateDataFactory.getTemplate(srcVolumeInfo.getTemplateId(), destDataStore); final TemplateObjectTO destTemplate = new TemplateObjectTO(destTemplateInfo); Answer copyCommandAnswer = sendCopyCommand(destHost, sourceTemplate, destTemplate, destDataStore); if (copyCommandAnswer != null && copyCommandAnswer.getResult()) { updateTemplateReferenceIfSuccessfulCopy(srcVolumeInfo, srcStoragePool, destTemplateInfo, destDataStore); } } } }

Target:
protected void copyTemplateToTargetFilesystemStorageIfNeeded(VolumeInfo srcVolumeInfo, StoragePool srcStoragePool, DataStore destDataStore, StoragePool destStoragePool, Host destHost) { VMTemplateStoragePoolVO sourceVolumeTemplateStoragePoolVO = vmTemplatePoolDao.findByPoolTemplate(destStoragePool.getId(), srcVolumeInfo.getTemplateId()); if (sourceVolumeTemplateStoragePoolVO == null && destStoragePool.getPoolType() == StoragePoolType.Filesystem) { DataStore sourceTemplateDataStore = dataStoreManagerImpl.getRandomImageStore(srcVolumeInfo.getDataCenterId()); if (sourceTemplateDataStore != null) { TemplateInfo sourceTemplateInfo = templateDataFactory.getTemplate(srcVolumeInfo.getTemplateId(), sourceTemplateDataStore); TemplateObjectTO sourceTemplate = new TemplateObjectTO(sourceTemplateInfo); LOGGER.debug(String.format("Could not find template [id=%s, name=%s] on the storage pool [id=%s]; copying the template to the target storage pool.", srcVolumeInfo.getTemplateId(), sourceTemplateInfo.getName(), destDataStore.getId())); TemplateInfo destTemplateInfo = templateDataFactory.getTemplate(srcVolumeInfo.getTemplateId(), destDataStore); final TemplateObjectTO destTemplate = new TemplateObjectTO(destTemplateInfo); Answer copyCommandAnswer = sendCopyCommand(destHost, sourceTemplate, destTemplate, destDataStore); if (copyCommandAnswer != null && copyCommandAnswer.getResult()) { updateTemplateReferenceIfSuccessfulCopy(srcVolumeInfo, srcStoragePool, destTemplateInfo, destDataStore); } } } }
Source:
public NicWithLogicalNetworks(VmNetworkInterface networkInterface) { super(); this.networkInterface = networkInterface; }

Target:
public NicWithLogicalNetworks(VmNetworkInterface networkInterface) { this.networkInterface = networkInterface; }
Source:
PageData split(int splitPoint) { int newPageId = index.getPageStore().allocatePage(); PageDataNode p2 = PageDataNode.create(index, newPageId, parentPageId); int firstChild = childPageIds[splitPoint]; for (; splitPoint < entryCount; ) { p2.addChild(p2.entryCount, childPageIds[splitPoint + 1], keys[splitPoint]); removeChild(splitPoint); } int lastChild = childPageIds[splitPoint - 1]; removeChild(splitPoint - 1); childPageIds[splitPoint - 1] = lastChild; p2.childPageIds[0] = firstChild; p2.remapChildren(getPos()); return p2; }

Target:
PageData split(int splitPoint) { int newPageId = index.getPageStore().allocatePage(); PageDataNode p2 = PageDataNode.create(index, newPageId, parentPageId); int firstChild = childPageIds[splitPoint]; while (splitPoint < entryCount) { p2.addChild(p2.entryCount, childPageIds[splitPoint + 1], keys[splitPoint]); removeChild(splitPoint); } int lastChild = childPageIds[splitPoint - 1]; removeChild(splitPoint - 1); childPageIds[splitPoint - 1] = lastChild; p2.childPageIds[0] = firstChild; p2.remapChildren(getPos()); return p2; }
Source:
private void displayCloudStatus() { boolean isConnected = false; String message; DbxAccountInfo info = null; DbxClient client = DbxUtil.getDbxClient(); if (client != null) { String userToken = client.getAccessToken(); if (userToken != null && !userToken.isEmpty()) { try { info = client.getAccountInfo(); isConnected = true; } catch (DbxException ex) { Exceptions.printStackTrace(ex); } } } if (isConnected) { message = "Connected to Dropbox account as " + info.displayName + "."; CloudStatus.getInstance().setStatus(CloudStatus.STATUS_DBX_CONNECTED, " (" + info.displayName + ")"); } else { message = "Working locally."; CloudStatus.getInstance().setStatus(CloudStatus.STATUS_DISCONNECTED); } LOGGER.log(message); }

Target:
private void displayCloudStatus() { boolean isConnected = false; String message; DbxAccountInfo info = null; DbxClient client = DbxUtil.getDbxClient(); if (client != null) { String userToken = client.getAccessToken(); if (userToken != null && !userToken.isEmpty()) { try { info = client.getAccountInfo(); isConnected = true; } catch (DbxException ex) { } } } if (isConnected) { message = "Connected to Dropbox account as " + info.displayName + "."; Cloud.getInstance().setStatus(Cloud.Status.DBX_CONNECTED, " (" + info.displayName + ")"); } else { message = "Working locally."; Cloud.getInstance().setStatus(Cloud.Status.DISCONNECTED); } LOGGER.log(message); }
Source:
public synchronized void export() { checkAndUpdateSubConfigs(); if (provider != null) { if (export == null) { export = provider.getExport(); } if (delay == null) { delay = provider.getDelay(); } } if (export != null && !export) { return; } if (delay != null && delay > 0) { new NamedThreadFactory("DubboServiceDelayExporter", true).newThread(() -> { try { logger.info("Dubbo service " + interfaceClass.getName() + " will delay export for " + delay + " ms"); TimeUnit.MILLISECONDS.sleep(delay); doExport(); } catch (InterruptedException e) { logger.error("Expected error occured when export " + interfaceClass.getName(), e); } }).start(); } else { doExport(); } }

Target:
public synchronized void export() { checkAndUpdateSubConfigs(); if (provider != null) { if (export == null) { export = provider.getExport(); } if (delay == null) { delay = provider.getDelay(); } } if (export != null && !export) { return; } if (delay != null && delay > 0) { delayExportExecutor.schedule(this::doExport, delay, TimeUnit.MILLISECONDS); } else { doExport(); } }
Source:
protected void startBackgroundDiscovery() { Expression expression = null; try { expression = new CronExpression( CronHelper.createCronForRepeatEverySeconds(LOCATION_CHANGED_CHECK_INTERVAL)); } catch (ParseException e) { return; } if (expression != null && backgroundJob == null) { AstroDiscoveryLocationChangedTask job = new AstroDiscoveryLocationChangedTask(this); scheduledExecutor.schedule(job, expression); logger.info("Scheduled astro location-changed job every seconds", LOCATION_CHANGED_CHECK_INTERVAL); backgroundJob = job; } }

Target:
protected void startBackgroundDiscovery() { if (astroDiscoveryJob == null) { astroDiscoveryJob = scheduler.scheduleAtFixedRate(() -> { PointType currentLocation = locationProvider.getLocation(); if (!Objects.equals(currentLocation, previousLocation)) { logger.info("Location has been changed from to {}: Creating new Discovery Results", previousLocation, currentLocation); createResults(currentLocation); previousLocation = currentLocation; } }, 0, LOCATION_CHANGED_CHECK_INTERVAL, TimeUnit.SECONDS); logger.debug("Scheduled astro location-changed job every seconds", LOCATION_CHANGED_CHECK_INTERVAL); } }
Source:
public Symbol getColumn() { if (expression instanceof SymbolReference) { return Symbol.from(expression); } return null; }

Target:
public Symbol getColumn() { verify(expression instanceof SymbolReference, "Expect the expression to be a SymbolReference"); return Symbol.from(expression); }
Source:
public boolean followUp(Token t, boolean isPredict) { boolean follow = ( isDynamicResolution() && FEELParser.isVariableNameValid( t.getText() ) ) || this.currentScope.followUp( t.getText(), isPredict ); return follow; }

Target:
public boolean followUp(Token t, boolean isPredict) { boolean follow = ( isDynamicResolution() && FEELParser.isVariableNamePartValid( t.getText() ) ) || this.currentScope.followUp( t.getText(), isPredict ); return follow; }
Source:
public void messageSizeFuzzTest() throws IOException { int maxSize = 1 << 16; Random random = new Random(11); for ( int i = 0; i < 1000; i++) { int size = random.nextInt( maxSize + 1); byte[] expected = new byte[size]; Arrays.fill(expected, (byte)42); BufferingChunkedInput input = new BufferingChunkedInput( channel( expected, 0, size ) ); byte[] dst = new byte[size]; input.readBytes( dst, 0, size); assertThat( dst, equalTo( expected ) ); } }

Target:
public void messageSizeFuzzTest() throws IOException { int maxSize = 1 << 16; Random random = new Random(); for ( int i = 0; i < 1000; i++) { int size = random.nextInt( maxSize + 1); byte[] expected = new byte[size]; Arrays.fill(expected, (byte)42); BufferingChunkedInput input = new BufferingChunkedInput( channel( expected, 0, size ) ); byte[] dst = new byte[size]; input.readBytes( dst, 0, size); assertThat( dst, equalTo( expected ) ); } }
Source:
public BugzillaRestConfiguration getConfiguration(TaskRepository repository, IOperationMonitor monitor) { try { return new BugzillaRestConfiguration(repository.getUrl(), getProducts(monitor), getFields(monitor)); } catch (Exception e) { StatusHandler.log(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, "Could not get the Configuration", e)); return null; } }

Target:
public BugzillaRestConfiguration getConfiguration(TaskRepository repository, IOperationMonitor monitor) { try { BugzillaRestConfiguration config = new BugzillaRestConfiguration(repository.getUrl()); config.setFields(getFields(monitor)); config.setProducts(getProducts(monitor)); return config; } catch (Exception e) { StatusHandler.log(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, "Could not get the Configuration", e)); return null; } }
Source:
private Set<Long> getDeletedSurveys(DeviceNotificationRequest req) { Set<Long> surveyIds = new HashSet<>(); String[] args = req.getSurveyIds(); if (args != null) { for (String sid : args) { try { surveyIds.add(Long.parseLong(sid)); } catch (NumberFormatException e) { } } if (surveyIds.isEmpty()) { return surveyIds; } Set<Long> foundIds = new HashSet<>(); for (Survey s : new SurveyDAO().listByKeys(surveyIds.toArray(new Long[surveyIds.size()]))) { foundIds.add(s.getKey().getId()); } surveyIds.removeAll(foundIds); } return surveyIds; }

Target:
private Set<Long> getDeletedSurveys(DeviceNotificationRequest req) { Set<Long> surveyIds = req.getSurveyIds(); if (surveyIds.isEmpty()) { return surveyIds; } Set<Long> foundIds = new HashSet<Long>(); Long[] surveyIdsArray = surveyIds.toArray(new Long[surveyIds.size()]); for (Survey s : new SurveyDAO().listByKeys(surveyIdsArray)) { foundIds.add(s.getKey().getId()); } surveyIds.removeAll(foundIds); return surveyIds; }
Source:
private void changeTagListener() { final EditText editTextTag = new EditText(GroupSettingsActivity.this); editTextTag.setId(R.id.editText); final AlertDialog dialog = new AlertDialog.Builder(GroupSettingsActivity.this) .setTitle("Add new tag") .setMessage("The new tag must be between 2 and 20 characters" + ", in lowercase, with no spaces.") .setView(editTextTag) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .create(); dialog.show(); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String text = editTextTag.getText().toString(); if (text.length() < Group.Tag.MIN_TAG_LENGTH) { YieldsApplication.showToast(getApplicationContext(), "The tag is too short"); } else if (text.length() > Group.Tag.MAX_TAG_LENGTH) { YieldsApplication.showToast(getApplicationContext(), "The tag is too long"); } else if (!text.toLowerCase().equals(text)) { YieldsApplication.showToast(getApplicationContext(), "The tag is not in lowercase"); } else if (text.contains(" ")) { YieldsApplication.showToast(getApplicationContext(), "The tag contains spaces"); } else { YieldsApplication.showToast(getApplicationContext(), "Tag \"" + text + "\" added"); Group.Tag tag = new Group.Tag(text); mGroup.addTag(tag); dialog.dismiss(); } } }); }

Target:
private void changeTagListener() { final EditText editTextTag = new EditText(GroupSettingsActivity.this); editTextTag.setId(R.id.editText); final AlertDialog dialog = new AlertDialog.Builder(GroupSettingsActivity.this) .setTitle("Add new tag") .setMessage("The new tag must be between 2 and 20 characters" + ", in lowercase, with no spaces.") .setView(editTextTag) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .create(); dialog.show(); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String text = editTextTag.getText().toString().toLowerCase().replace(' ', '_'); if (text.length() < Group.Tag.MIN_TAG_LENGTH) { YieldsApplication.showToast(getApplicationContext(), "The tag is too short"); } else if (text.length() > Group.Tag.MAX_TAG_LENGTH) { YieldsApplication.showToast(getApplicationContext(), "The tag is too long"); } else { YieldsApplication.showToast(getApplicationContext(), "Tag \"" + text + "\" added"); Group.Tag tag = new Group.Tag(text); mGroup.addTag(tag); dialog.dismiss(); } } }); }
Source:
public void testDescribeImagesWithInvalidFilter() { String region = getFirst(ec2Api.getConfiguredRegions(), null); if (region != null) { Set<? extends Image> allResults = client.describeImagesInRegion(region); assertNotNull(allResults); assert allResults.size() >= 2 : allResults.size(); Iterator<? extends Image> iterator = allResults.iterator(); String id1 = iterator.next().getId(); Set<? extends Image> filterResult = client.describeImagesInRegionWithFilter(region, ImmutableMultimap.<String, String>builder() .put("invalid-filter-id", id1) .build()); assertNotNull(filterResult); assertEquals(filterResult.size(), 1); iterator = filterResult.iterator(); assertEquals(iterator.next().getId(), id1); } }

Target:
public void testDescribeImagesWithInvalidFilter() { String region = getFirst(ec2Api.getConfiguredRegions(), null); assertNotNull(region, "region should not be null"); Set<? extends Image> allResults = client.describeImagesInRegion(region); assertNotNull(allResults); assertTrue(allResults.size() >= 2); String id1 = allResults.iterator().next().getId(); Set<? extends Image> filterResult = client.describeImagesInRegionWithFilter(region, ImmutableMultimap.<String, String>builder() .put("invalid-filter-id", id1) .build()); assertNotNull(filterResult); assertEquals(filterResult.size(), 1); assertEquals(filterResult.iterator().next().getId(), id1); }
Source:
public static SecurityFactory<SSLContext> createSslContextFactory(ProtocolSelector protocolSelector, Supplier<Provider[]> providerSupplier, String providerName) { Provider[] providers = providerSupplier.get(); final Map<String, List<Provider>> preferredProviderByAlgorithm = new IdentityHashMap<>(); for (Provider provider : providers) { if (providerName != null && ! providerName.equals(provider.getName())) { continue; } Set<Service> services = provider.getServices(); if (services != null) { for (Provider.Service service : services) { if (serviceType.equals(service.getType())) { String protocolName = service.getAlgorithm(); List<Provider> providerList = preferredProviderByAlgorithm.get(protocolName); if (providerList == null) { providerList = new ArrayList<>(); preferredProviderByAlgorithm.put(protocolName, providerList); } providerList.add(provider); } } } } final String[] supportedProtocols = protocolSelector.evaluate(preferredProviderByAlgorithm.keySet().toArray(NO_STRINGS)); if (supportedProtocols.length > 0) { return () -> { for (String protocol : supportedProtocols) { List<Provider> providerList = preferredProviderByAlgorithm.get(protocol); if (providerList != null) { for (Provider provider : providerList) { try { return SSLContext.getInstance(protocol, provider); } catch (NoSuchAlgorithmException ignored) } } } throw ElytronMessages.log.noAlgorithmForSslProtocol(); }; } return SSLUtils::throwIt; }

Target:
public static SecurityFactory<SSLContext> createSslContextFactory(ProtocolSelector protocolSelector, Supplier<Provider[]> providerSupplier, String providerName) { Provider[] providers = providerSupplier.get(); final Map<String, List<Provider>> preferredProviderByAlgorithm = new IdentityHashMap<>(); for (Provider provider : providers) { if (providerName != null && ! providerName.equals(provider.getName())) { continue; } Set<Service> services = provider.getServices(); if (services != null) { for (Provider.Service service : services) { if (serviceType.equals(service.getType())) { String protocolName = service.getAlgorithm(); List<Provider> providerList = preferredProviderByAlgorithm.computeIfAbsent(protocolName, s -> new ArrayList<>()); providerList.add(provider); } } } } final String[] supportedProtocols = protocolSelector.evaluate(preferredProviderByAlgorithm.keySet().toArray(NO_STRINGS)); if (supportedProtocols.length > 0) { return () -> { for (String protocol : supportedProtocols) { List<Provider> providerList = preferredProviderByAlgorithm.getOrDefault(protocol, Collections.emptyList()); for (Provider provider : providerList) { try { return SSLContext.getInstance(protocol, provider); } catch (NoSuchAlgorithmException ignored) } } throw ElytronMessages.log.noAlgorithmForSslProtocol(); }; } return SSLUtils::throwIt; }
Source:
public RowExpressionFormatter(ConnectorSession session, FunctionManager functionManager) { this.functionManager = functionManager; this.standardFunctionResolution = new FunctionResolution(functionManager); this.session = requireNonNull(session, "session is null"); }

Target:
public RowExpressionFormatter(ConnectorSession session, FunctionManager functionManager) { this.session = requireNonNull(session, "session is null"); this.functionMetadataManager = requireNonNull(functionManager, "function manager is null"); this.standardFunctionResolution = new FunctionResolution(functionManager); }
Source:
private synchronized Optional<String> getAdditionalFailureInfo(long allocated, long delta) { Map<String, Long> queryAllocations = memoryPool.getTaggedMemoryAllocations().get(queryId); StringBuilder additionalInfo = new StringBuilder() .append("Allocated: ") .append(succinctBytes(allocated)) .append(", Delta: ") .append(succinctBytes(delta)); if (queryAllocations == null) { return Optional.of(additionalInfo.toString()); } String topConsumers = queryAllocations.entrySet() .stream() .sorted(comparingByValue(Comparator.reverseOrder())) .limit(3) .collect(toMap(Entry::getKey, entry -> succinctBytes(entry.getValue()), (e1, e2) -> e1, LinkedHashMap::new)) .toString(); additionalInfo.append(", Top Consumers: ").append(topConsumers); return Optional.of(additionalInfo.toString()); }

Target:
private String getAdditionalFailureInfo(long allocated, long delta) { Map<String, Long> queryAllocations = memoryPool.getTaggedMemoryAllocations().get(queryId); String additionalInfo = format("Allocated: %s, Delta: %s", succinctBytes(allocated), succinctBytes(delta)); if (queryAllocations == null) { return additionalInfo; } String topConsumers = queryAllocations.entrySet().stream() .sorted(comparingByValue(Comparator.reverseOrder())) .limit(3) .collect(toImmutableMap(Entry::getKey, e -> succinctBytes(e.getValue()))) .toString(); return format("%s, Top Consumers: %s", additionalInfo, topConsumers); }
Source:
public void testTTL_entryShouldNotBeReachableAfterTTL() { IMap<Integer, String> map = createSimpleMap(); map.put(1, "value0", 0, TimeUnit.SECONDS); sleepSeconds(1); assertFalse(map.containsKey(1)); }

Target:
public void testTTL_entryShouldNotBeReachableAfterTTL() { IMap<Integer, String> map = createSimpleMap(); map.put(1, "value0", 1, TimeUnit.SECONDS); sleepSeconds(1); assertFalse(map.containsKey(1)); }
Source:
private ArrayList<LinkInfo> parseForLinks(String inSubType) throws IOException { PDActionRemoteGoTo goTo; PDActionLaunch launch; PDActionURI uri; PDFileSpecification fspec; ArrayList<LinkInfo> li = new ArrayList<>(); List allPages = pdfDoc.getDocumentCatalog().getAllPages(); for (Object pageObject : allPages) { PDPage page = (PDPage) pageObject; stripper.extractRegions(page); List<PDAnnotation> annotations = page.getAnnotations(); for (PDAnnotation annot : annotations) { if (!(annot instanceof PDAnnotationLink)) { continue; } PDAnnotationLink link = (PDAnnotationLink) annot; PDAction action = link.getAction(); if (!action.getSubType().equals(inSubType)) { continue; } String urlText = stripper.getTextForRegion("" + annotations.indexOf(annot)); String urlValue = null; switch (inSubType) { case PDActionRemoteGoTo.SUB_TYPE: goTo = (PDActionRemoteGoTo) action; fspec = goTo.getFile(); urlValue = fspec.getFile(); break; case PDActionLaunch.SUB_TYPE: launch = (PDActionLaunch) action; fspec = launch.getFile(); urlValue = fspec.getFile(); break; case PDActionURI.SUB_TYPE: uri = (PDActionURI) action; urlValue = uri.getURI(); break; } if (StringUtils.isNotBlank(urlValue)) { li.add(new LinkInfo(allPages.indexOf(page) + 1, inSubType, urlText, urlValue)); } } } return li; }

Target:
private List<LinkInfo> parseForLinks(String inSubType) throws IOException { PDActionRemoteGoTo goTo; PDActionLaunch launch; PDActionURI uri; PDFileSpecification fspec; List<LinkInfo> li = new ArrayList<>(); List allPages = pdfDoc.getDocumentCatalog().getAllPages(); for (Object pageObject : allPages) { PDPage page = (PDPage) pageObject; stripper.extractRegions(page); List<PDAnnotation> annotations = page.getAnnotations(); for (PDAnnotation annot : annotations) { if (!(annot instanceof PDAnnotationLink)) { continue; } PDAnnotationLink link = (PDAnnotationLink) annot; PDAction action = link.getAction(); if (!action.getSubType().equals(inSubType)) { continue; } String urlText = stripper.getTextForRegion(String.valueOf(annotations.indexOf(annot))); String urlValue = null; switch (inSubType) { case PDActionRemoteGoTo.SUB_TYPE: goTo = (PDActionRemoteGoTo) action; fspec = goTo.getFile(); urlValue = fspec.getFile(); break; case PDActionLaunch.SUB_TYPE: launch = (PDActionLaunch) action; fspec = launch.getFile(); urlValue = fspec.getFile(); break; case PDActionURI.SUB_TYPE: uri = (PDActionURI) action; urlValue = uri.getURI(); break; } if (StringUtils.isNotBlank(urlValue)) { li.add(new LinkInfo(allPages.indexOf(page) + 1, inSubType, urlText, urlValue)); } } } return li; }
Source:
public StyledString getStyledText(Object element) { try { if (element instanceof Repository) return getStyledTextFor((Repository) element); if (element instanceof GitModelRepository) return getStyledTextFor(((GitModelRepository) element) .getRepository()); } catch (IOException e) { Activator .logError(UIText.GitLabelProvider_UnableToRetrieveLabel, e); } return new StyledString(getText(element)); }

Target:
public StyledString getStyledText(Object element) { try { if (element instanceof Repository) return getStyledTextFor((Repository) element); if (element instanceof GitModelRepository) return getStyledTextFor(((GitModelRepository) element) .getRepository()); } catch (IOException e) { Activator.logError(NLS.bind( UIText.GitLabelProvider_UnableToRetrieveLabel, element.toString()), e); } return new StyledString(getText(element)); }
Source:
private Message getMessage(TopicPartition topicPartition, long offset, SimpleConsumer consumer) { LOG.info("fetching message topic " + topicPartition.getTopic() + " partition " + topicPartition.getPartition() + " offset " + offset); final int MAX_MESSAGE_SIZE_BYTES = 100000; final String clientName = getClientName(topicPartition); kafka.api.FetchRequest request = new FetchRequestBuilder().clientId(clientName) .addFetch(topicPartition.getTopic(), topicPartition.getPartition(), offset, MAX_MESSAGE_SIZE_BYTES) .build(); FetchResponse response = consumer.fetch(request); if (response.hasError()) { consumer.close(); throw new RuntimeException("Error fetching offset data. Reason: " + response.errorCode(topicPartition.getTopic(), topicPartition.getPartition())); } Iterator<MessageAndOffset> messageSetIterator = response.messageSet(topicPartition.getTopic(), topicPartition.getPartition()).iterator(); if (messageSetIterator.hasNext()) { MessageAndOffset messageAndOffset = messageSetIterator.next(); ByteBuffer payload = messageAndOffset.message().payload(); byte[] payloadBytes = new byte[payload.limit()]; payload.get(payloadBytes); return new Message(topicPartition.getTopic(), topicPartition.getPartition(), messageAndOffset.offset(), payloadBytes); } else { return null; } }

Target:
private Message getMessage(TopicPartition topicPartition, long offset, SimpleConsumer consumer) { LOG.info("fetching message topic " + topicPartition.getTopic() + " partition " + topicPartition.getPartition() + " offset " + offset); final int MAX_MESSAGE_SIZE_BYTES = mConfig.getMaxMessageSizeBytes(); final String clientName = getClientName(topicPartition); kafka.api.FetchRequest request = new FetchRequestBuilder().clientId(clientName) .addFetch(topicPartition.getTopic(), topicPartition.getPartition(), offset, MAX_MESSAGE_SIZE_BYTES) .build(); FetchResponse response = consumer.fetch(request); if (response.hasError()) { consumer.close(); throw new RuntimeException("Error fetching offset data. Reason: " + response.errorCode(topicPartition.getTopic(), topicPartition.getPartition())); } MessageAndOffset messageAndOffset = response.messageSet( topicPartition.getTopic(), topicPartition.getPartition()).iterator().next(); ByteBuffer payload = messageAndOffset.message().payload(); byte[] payloadBytes = new byte[payload.limit()]; payload.get(payloadBytes); return new Message(topicPartition.getTopic(), topicPartition.getPartition(), messageAndOffset.offset(), payloadBytes); }
Source:
private Void handleServices(ServiceNodeDiscoverer serviceNodeDiscoverer, Cluster cluster, List<String> availableServices) { availableServices.parallelStream() .filter(ServiceConfigurations::contains) .forEach(serviceName -> { try { transactionManager.beginTransaction(TransactionIsolation.SERIALIZABLE); LOG.debug("service start {}", serviceName); Service service = addService(cluster, serviceName); Map<String, String> flattenConfigurations = new ConcurrentHashMap<>(); Map<String, Map<String, String>> configurations = serviceNodeDiscoverer.getConfigurations(serviceName); handleConfigurations(serviceNodeDiscoverer, flattenConfigurations, configurations, service); List<String> components = serviceNodeDiscoverer.getComponents(serviceName); handleComponents(serviceNodeDiscoverer, serviceName, flattenConfigurations, service, components); transactionManager.commitTransaction(); } catch (Exception e) { transactionManager.rollbackTransaction(); throw e; } }); return null; }

Target:
private Void handleServices(ServiceNodeDiscoverer serviceNodeDiscoverer, Cluster cluster, List<String> availableServices) { availableServices.parallelStream() .filter(ServiceConfigurations::contains) .forEach(serviceName -> { try { transactionManager.beginTransaction(TransactionIsolation.DEFAULT); LOG.debug("service start {}", serviceName); Service service = addService(cluster, serviceName); Map<String, String> flattenConfigurations = new ConcurrentHashMap<>(); Map<String, Map<String, String>> configurations = serviceNodeDiscoverer.getConfigurations(serviceName); handleConfigurations(serviceNodeDiscoverer, flattenConfigurations, configurations, service); List<String> components = serviceNodeDiscoverer.getComponents(serviceName); handleComponents(serviceNodeDiscoverer, serviceName, flattenConfigurations, service, components); transactionManager.commitTransaction(); } catch (Exception e) { transactionManager.rollbackTransaction(); throw e; } }); return null; }