auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Type getTypeBound() { Type boundingBase = this; if ( typeMirror.getKind() == TypeKind.WILDCARD ) { WildcardType wildCardType = (WildcardType) typeMirror; if ( wildCardType.getExtendsBound() != null ) { boundingBase = typeFactory.getType( wildCardType.getExtendsBound() ); } else if ( wildCardType.getSuperBound() != null ) { boundingBase = typeFactory.getType( wildCardType.getSuperBound() ); } else { String wildCardName = wildCardType.toString(); if ( "?".equals( wildCardName ) ) { boundingBase = typeFactory.getType( Object.class ); } } } else if ( typeMirror.getKind() == TypeKind.TYPEVAR ) { TypeVariable typeVariableType = (TypeVariable) typeMirror; if ( typeVariableType.getUpperBound() != null ) { boundingBase = typeFactory.getType( typeVariableType.getUpperBound() ); } } return boundingBase; }

Target:
public Type getTypeBound() { if ( boundingBase != null ) { return boundingBase; } boundingBase = this; if ( typeMirror.getKind() == TypeKind.WILDCARD ) { WildcardType wildCardType = (WildcardType) typeMirror; if ( wildCardType.getExtendsBound() != null ) { boundingBase = typeFactory.getType( wildCardType.getExtendsBound() ); } else if ( wildCardType.getSuperBound() != null ) { boundingBase = typeFactory.getType( wildCardType.getSuperBound() ); } else { String wildCardName = wildCardType.toString(); if ( "?".equals( wildCardName ) ) { boundingBase = typeFactory.getType( Object.class ); } } } else if ( typeMirror.getKind() == TypeKind.TYPEVAR ) { TypeVariable typeVariableType = (TypeVariable) typeMirror; if ( typeVariableType.getUpperBound() != null ) { boundingBase = typeFactory.getType( typeVariableType.getUpperBound() ); } } return boundingBase; }
Source:
public Object getContentObject() { throw new UnsupportedOperationException("Not implemented for JPA"); }

Target:
public Object getContentObject() { return null; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.activity_group); setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); getSupportActionBar().setTitle(null); getSupportActionBar().setDisplayHomeAsUpEnabled(true); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler); recyclerView.addItemDecoration(new GroupReportBackItemDecoration()); adapter = new GroupAdapter(generateSampleData(), this); recyclerView.setAdapter(adapter); GridLayoutManager layoutManager = new GridLayoutManager(this, 6); layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { switch(adapter.getItemViewType(position)) { case GroupAdapter.VIEW_TYPE_FRIEND: return 1; case GroupAdapter.VIEW_TYPE_REPORT_BACK : return 3; default: return 6; } } }); recyclerView.setLayoutManager(layoutManager); int campaignId = getIntent().getIntExtra(EXTRA_CAMPAIGN_ID, - 1); String userId = getIntent().getStringExtra(EXTRA_USER_ID); if(campaignId != - 1) { TaskQueue.loadQueueDefault(this).execute(new CampaignGroupDetailsTask(campaignId, userId)); TaskQueue.loadQueueDefault(this).execute( new IndividualCampaignReportBackList(- 1, Integer.toString(campaignId), currentPage)); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.activity_group); initUI(); int campaignId = getIntent().getIntExtra(EXTRA_CAMPAIGN_ID, - 1); String userId = getIntent().getStringExtra(EXTRA_USER_ID); if(campaignId != - 1) { TaskQueue.loadQueueDefault(this).execute(new CampaignGroupDetailsTask(campaignId, userId)); TaskQueue.loadQueueDefault(this).execute( new IndividualCampaignReportBackList(- 1, Integer.toString(campaignId), currentPage)); } }
Source:
public void valueOutOfDefaultLowerRange() { initConfiguredWithDefaultMinValue(); Set<ConstraintViolation<ConfiguredRangeContainer>> validate = validate(new ConfiguredRangeContainer(TEST_DEFAULT_MIN_RANGE - 1)); Assert.assertTrue(validate.size() > 0); }

Target:
public void valueOutOfDefaultLowerRange() { initConfiguredWithDefaultMinValue(); validateAndAssertResult(new ConfiguredRangeContainerDefaultMin(TEST_DEFAULT_MIN_RANGE - 1), false); }
Source:
public int getParameterCount() { return jjtGetNumChildren() > 0 && getFirstChildOfType(ASTFormalParameter.class).isExplicitReceiverParameter() ? jjtGetNumChildren() - 1 : jjtGetNumChildren(); }

Target:
public int getParameterCount() { final List<ASTFormalParameter> parameters = findChildrenOfType(ASTFormalParameter.class); return !parameters.isEmpty() && parameters.get(0).isExplicitReceiverParameter() ? parameters.size() - 1 : parameters.size(); }
Source:
public String getPath(){ if(getAssetName().equals("system folder") && getParentPath().equals("/System folder")) return "/"; else { String x = getParentPath() + getAssetName(); if("folder".equals(assetType)){ if(! x.endsWith("/")){ x= x + "/"; } } return x; } }

Target:
public String getPath(){ if(("system folder").equals(getAssetName()) && ("/System folder").equals(getParentPath())){ return "/"; } else { String x = getParentPath() + getAssetName(); if("folder".equals(assetType)){ if(! x.endsWith("/")){ x= x + "/"; } } return x; } }
Source:
public void testZeroReconnectAttemptsBadHost() { Assume.assumeTrue("Test does not run on Windows Server", SystemUtils.OS_NAME.contains("Windows Server")); badHostUdpOperation.get(ElytronDescriptionConstants.ICMP_ERROR_RECONNECT_ATTEMPTS).set(0); ModelNode response = services.executeOperation(badHostUdpOperation); assertCorrectError(response, "The maximum icmp-error-reconnect-attempts value of 0 was reached"); assertFailed(response); }

Target:
public void testZeroReconnectAttemptsBadHost() { Assume.assumeFalse("Test does not run on Windows Server", SystemUtils.OS_NAME.contains("Windows Server")); badHostUdpOperation.get(ElytronDescriptionConstants.RECONNECT_ATTEMPTS).set(0); ModelNode response = services.executeOperation(badHostUdpOperation); assertCorrectError(response, new String[] {"ELY12001", "0"}); assertFailed(response); }
Source:
public Optional<FlyingData> from(DataHolder dataHolder) { if (supports(dataHolder)) { final SpongeFlyingData flyingData = new SpongeFlyingData(); final boolean flying = ((net.minecraft.entity.Entity) dataHolder).isAirBorne; return Optional.<FlyingData>of(flyingData.setFlying(flying)); } else { return Optional.absent(); } }

Target:
public Optional<FlyingData> from(DataHolder dataHolder) { if (supports(dataHolder)) { boolean flying = ((Entity) dataHolder).isAirBorne; if (dataHolder instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) dataHolder; flying = player.capabilities.isFlying; } final SpongeFlyingData flyingData = new SpongeFlyingData(flying); return Optional.<FlyingData>of(flyingData); } else { return Optional.absent(); } }
Source:
@Theory public void retainsPerSampleRate(int reservoir) throws Exception { Sampler sampler = RateLimitingSampler.create(reservoir); long startTick = System.nanoTime(); long lastDecisecond = startTick + TimeUnit.MILLISECONDS.toNanos(990); long deadline = startTick + TimeUnit.MILLISECONDS.toNanos(998); AtomicBoolean hitLastDecisecond = new AtomicBoolean(); AtomicLong passed = new AtomicLong(); Runnable sample = () -> { long tick = System.nanoTime(); if (tick > deadline) return; if (tick >= lastDecisecond) hitLastDecisecond.set(true); if (sampler.isSampled(0L)) passed.incrementAndGet(); }; ExecutorService service = Executors.newFixedThreadPool(10); List<Future<?>> futures = new ArrayList<>(); do { if (reservoir > 10) { for (int i = 0; i < reservoir / 10; i++) futures.add(service.submit(sample)); } else { service.submit(sample); } for (Future<?> future : futures) future.get(); futures.clear(); Thread.sleep(9); } while (System.nanoTime() < deadline); service.shutdown(); service.awaitTermination(1, TimeUnit.SECONDS); assertThat(passed.get()).isEqualTo(reservoir); assumeThat(hitLastDecisecond.get()) .withFailMessage("ran out of samples before the end of the second") .isTrue(); }

Target:
@Theory public void retainsPerSampleRate(int reservoir) throws Exception { Sampler sampler = RateLimitingSampler.create(reservoir); long startTick = System.nanoTime(); long lastDecisecond = startTick + TimeUnit.MILLISECONDS.toNanos(990); long deadline = startTick + TimeUnit.MILLISECONDS.toNanos(998); AtomicBoolean hitLastDecisecond = new AtomicBoolean(); AtomicLong passed = new AtomicLong(); Runnable sample = () -> { long tick = System.nanoTime(); if (tick > deadline) return; if (tick >= lastDecisecond) hitLastDecisecond.set(true); if (sampler.isSampled(0L)) passed.incrementAndGet(); }; Runnable loopAndSample = () -> { do { if (reservoir > 10) { for (int j = 0; j < reservoir / 10; j++) sample.run(); } else { sample.run(); } sleepUninterruptibly(9, TimeUnit.MILLISECONDS); } while (System.nanoTime() < deadline); }; int threadCount = 10; ExecutorService service = Executors.newFixedThreadPool(threadCount); List<Future<?>> futures = new ArrayList<>(); for (int i = 0; i < threadCount; i++) { futures.add(service.submit(loopAndSample)); } service.shutdown(); service.awaitTermination(1, TimeUnit.SECONDS); assertThat(passed.get()).isEqualTo(reservoir); assumeThat(hitLastDecisecond.get()) .withFailMessage("ran out of samples before the end of the second") .isTrue(); }
Source:
public synchronized void onBlobReplicaCreated(String sourceHost, int port, String blobId, BlobReplicaSourceType sourceType) { int numberOfReplicas; try { BlobId blobIdObj = new BlobId(blobId, clusterMap); PartitionId partitionId = blobIdObj.getPartition(); numberOfReplicas = partitionId.getReplicaIds().size(); } catch (Exception e) { throw new IllegalArgumentException("Invalid blob ID: " + blobId); } objectTracker.computeIfAbsent(blobId, k -> new Tracker(numberOfReplicas)).trackCreation(sourceHost, port); }

Target:
public synchronized void onBlobReplicaCreated(String sourceHost, int port, String blobId, BlobReplicaSourceType sourceType) { int numberOfReplicas; try { BlobId blobIdObj = new BlobId(blobId, clusterMap); PartitionId partitionId = blobIdObj.getPartition(); numberOfReplicas = partitionId.getReplicaIds().size(); } catch (Exception e) { throw new IllegalArgumentException("Invalid blob ID: " + blobId, e); } objectTracker.computeIfAbsent(blobId, k -> new Tracker(numberOfReplicas)).trackCreation(sourceHost, port); }
Source:
int getNumDataChunks() { return chunksToStitch != null ? chunksToStitch.size() : RouterUtils.getNumChunksForBlobAndChunkSize(getBlobSize(), routerConfig.routerMaxPutChunkSizeBytes); }

Target:
int getNumDataChunks() { return isStitchOperation() ? chunksToStitch.size() : RouterUtils.getNumChunksForBlobAndChunkSize(getBlobSize(), routerConfig.routerMaxPutChunkSizeBytes); }
Source:
public void testExectueQuery() { DbFacade dbFacadeMock = mock(DbFacade.class); mockStatic(DbFacade.class); when(DbFacade.getInstance()).thenReturn(dbFacadeMock); VmNetworkInterfaceDAO daoMock = mock(VmNetworkInterfaceDAO.class); when(dbFacadeMock.getVmNetworkInterfaceDAO()).thenReturn(daoMock); Guid guid = new Guid(); Guid userID = new Guid(); IVdcUser user = mock(IVdcUser.class); when(user.getUserId()).thenReturn(userID); GetVmByVmIdParameters params = mock(GetVmByVmIdParameters.class); when(params.getId()).thenReturn(guid); when(params.isFiltered()).thenReturn(true); GetVmInterfacesByVmIdQuery query = spy(new GetVmInterfacesByVmIdQuery(params)); when(query.getUser()).thenReturn(user); query.executeQueryCommand(); verify(daoMock, times(1)).getAllForVm(guid, userID, true); }

Target:
public void testExectueQuery() { DbFacade dbFacadeMock = mock(DbFacade.class); mockStatic(DbFacade.class); when(DbFacade.getInstance()).thenReturn(dbFacadeMock); VmNetworkInterfaceDAO daoMock = mock(VmNetworkInterfaceDAO.class); when(dbFacadeMock.getVmNetworkInterfaceDAO()).thenReturn(daoMock); Guid guid = new Guid(); Guid userID = new Guid(); IVdcUser user = mock(IVdcUser.class); when(user.getUserId()).thenReturn(userID); GetVmByVmIdParameters params = mock(GetVmByVmIdParameters.class); when(params.getId()).thenReturn(guid); when(params.isFiltered()).thenReturn(true); GetVmInterfacesByVmIdQuery query = spy(new GetVmInterfacesByVmIdQuery(params)); when(query.getUser()).thenReturn(user); query.executeQueryCommand(); verify(daoMock).getAllForVm(guid, userID, true); }
Source:
protected void show() { if (TextUtils.isEmpty(placementName)) { IronSource.showRewardedVideo(); } else { IronSource.showRewardedVideo(placementName); } }

Target:
protected void show() { if (TextUtils.isEmpty(mPlacementName)) { IronSource.showISDemandOnlyRewardedVideo(mInstanceId); } else { IronSource.showISDemandOnlyRewardedVideo(mInstanceId,mPlacementName); } }
Source:
public ListenableFuture<Void> updateProgress( @NonNull final Context context, @NonNull final UUID id, @NonNull final Data data) { final SettableFuture<Void> future = SettableFuture.create(); mTaskExecutor.executeOnBackgroundThread(new Runnable() { @Override public void run() { String workSpecId = id.toString(); Logger.get().info(TAG, String.format("Updating progress for %s (%s)", id, data)); mWorkDatabase.beginTransaction(); try { State state = mWorkDatabase.workSpecDao().getState(workSpecId); if (state != null && !state.isFinished()) { WorkProgress progress = new WorkProgress(workSpecId, data); mWorkDatabase.workProgressDao().insert(progress); } else { Logger.get().warning(TAG, String.format( "Ignoring setProgress(...). WorkSpec (%s) has finished " + "execution.", workSpecId)); } future.set(null); mWorkDatabase.setTransactionSuccessful(); } catch (Throwable throwable) { Logger.get().error(TAG, "Error updating Worker progress", throwable); future.setException(throwable); } finally { mWorkDatabase.endTransaction(); } } }); return future; }

Target:
public ListenableFuture<Void> updateProgress( @NonNull final Context context, @NonNull final UUID id, @NonNull final Data data) { final SettableFuture<Void> future = SettableFuture.create(); mTaskExecutor.executeOnBackgroundThread(new Runnable() { @Override public void run() { String workSpecId = id.toString(); Logger.get().info(TAG, String.format("Updating progress for %s (%s)", id, data)); mWorkDatabase.beginTransaction(); try { State state = mWorkDatabase.workSpecDao().getState(workSpecId); if (state == null) { Logger.get().warning(TAG, String.format( "Ignoring setProgress(...). WorkSpec (%s) does not exist.", workSpecId)); } else if (state.isFinished()) { Logger.get().warning(TAG, String.format( "Ignoring setProgress(...). WorkSpec (%s) has finished " + "execution.", workSpecId)); } else { WorkProgress progress = new WorkProgress(workSpecId, data); mWorkDatabase.workProgressDao().insert(progress); } future.set(null); mWorkDatabase.setTransactionSuccessful(); } catch (Throwable throwable) { Logger.get().error(TAG, "Error updating Worker progress", throwable); future.setException(throwable); } finally { mWorkDatabase.endTransaction(); } } }); return future; }
Source:
public void applyPlacement(final KVector offset) { if (layoutDirection.isHorizontal()) { applyHorizontalPlacement(offset); } else { applyVerticalPlacement(offset); } }

Target:
public void applyPlacement(final KVector offset) { if (layoutDirection.isHorizontal()) { applyPlacementForHorizontalLayout(offset); } else { applyPlacementVerticalForVerticalLayout(offset); } }
Source:
private static void createMainGoloFile(File intoDir, String projectName) { final File mainGoloFile = new File(intoDir, "main.golo"); PrintWriter writer; try { writer = new PrintWriter(mainGoloFile, "UTF-8"); writer.println("module " + projectName); writer.println(""); writer.println("function main = |args| {"); writer.println(" println(\"Hello " + projectName + "!\")"); writer.println("}"); writer.close(); } catch (FileNotFoundException e) { System.err.println(e.getMessage()); } catch (UnsupportedEncodingException e) { System.err.println(e.getMessage()); } }

Target:
private static void createMainGoloFile(File intoDir, String projectName) throws FileNotFoundException, UnsupportedEncodingException { File mainGoloFile = new File(intoDir, "main.golo"); PrintWriter writer = new PrintWriter(mainGoloFile, "UTF-8"); writer.println("module " + projectName); writer.println(""); writer.println("function main = |args| {"); writer.println(" println(\"Hello " + projectName + "!\")"); writer.println("}"); writer.close(); }
Source:
public void start() { if (!started) { Thread connectThread = new Thread(); connectThread.setName("DubboZkclientConnector"); connectThread.setDaemon(true); connectThread.start(); try { client = completableFuture.get(timeout, TimeUnit.MILLISECONDS); } catch (Throwable t) { logger.error("Timeout! zookeeper server can not be connected in : " + timeout + "ms!", t); } started = true; } else { logger.warn("Zkclient has already been started!"); } }

Target:
public void start() { if (!started) { try { client = completableFuture.get(timeout, TimeUnit.MILLISECONDS); } catch (Throwable t) { logger.error("Timeout! zookeeper server can not be connected in : " + timeout + "ms!", t); completableFuture.whenComplete(this::makeClientReady); } started = true; } else { logger.warn("Zkclient has already been started!"); } }
Source:
public void testInjectionOfOperatorName() throws Exception { final LocalMode lma = LocalMode.newInstance(); StreamingApplication testApp = new StreamingApplication() { @Override public void populateDAG(DAG dag, Configuration conf) { MockInputOperator input = dag.addOperator("input", new MockInputOperator()); GenericNodeTest.GenericOperator output = dag.addOperator("output", new GenericNodeTest.GenericOperator()); dag.addStream("stream", input.output, output.ip1); } }; lma.prepareDAG(testApp, new Configuration()); LocalMode.Controller lc = lma.getController(); lc.runAsync(); long startTime = System.currentTimeMillis(); while (!foundOperatorName && System.currentTimeMillis() - startTime < 2000) { Thread.sleep(100); } Assert.assertTrue("operator name found", foundOperatorName); lc.shutdown(); }

Target:
public void testInjectionOfOperatorName() throws Exception { final LocalMode lma = LocalMode.newInstance(); StreamingApplication testApp = new StreamingApplication() { @Override public void populateDAG(DAG dag, Configuration conf) { dag.addOperator("input", new MockInputOperator()); } }; lma.prepareDAG(testApp, new Configuration()); LocalMode.Controller lc = lma.getController(); lc.runAsync(); long startTime = System.currentTimeMillis(); while (operatorName == null && System.currentTimeMillis() - startTime < 2000) { Thread.sleep(100); } Assert.assertEquals("operator name", "input", operatorName); lc.shutdown(); }
Source:
private void rebuildQuarks(final int nbAttributes, Boolean value) { fQuarksAdded.ensureCapacity(nbAttributes); while (fQuarksAdded.size() < nbAttributes) { fQuarksAdded.add(value); } }

Target:
private void rebuildQuarks(final int nbAttributes, Boolean value) { fAddedQuarks.ensureCapacity(nbAttributes); while (fAddedQuarks.size() < nbAttributes) { fAddedQuarks.add(value); } }
Source:
public AMQPMessage setAddress(SimpleString address) { this.address = address; setProtonAddress(address.toString()); return this; }

Target:
public AMQPMessage setAddress(SimpleString address) { this.address = address; createExtraProperties().putSimpleStringProperty(ADDRESS_PROPERTY, address); return this; }
Source:
private void approve(RevisionResource rsrc, ChangeUpdate update, IdentifiedUser caller, Timestamp timestamp) throws OrmException { PatchSet.Id psId = rsrc.getPatchSet().getId(); List<PatchSetApproval> approvals = Lists.newArrayList( approvalsUtil.byPatchSet(dbProvider.get(), rsrc.getNotes(), psId)); PatchSetApproval submit = ApprovalsUtil.getSubmitter(psId, approvals); if (submit == null || submit.getAccountId() != caller.getAccountId()) { submit = new PatchSetApproval( new PatchSetApproval.Key( rsrc.getPatchSet().getId(), caller.getAccountId(), LabelId.SUBMIT), (short) 1, TimeUtil.nowTs()); approvals.add(submit); } submit.setValue((short) 1); submit.setGranted(timestamp); approvals = labelNormalizer.normalize(rsrc.getControl(), approvals); update.putApproval(submit.getLabel(), submit.getValue()); update.submit(approvals); dbProvider.get().patchSetApprovals().upsert(approvals); }

Target:
private BatchMetaDataUpdate approve(RevisionResource rsrc, ChangeUpdate update, IdentifiedUser caller, Timestamp timestamp) throws OrmException { PatchSet.Id psId = rsrc.getPatchSet().getId(); List<PatchSetApproval> approvals = approvalsUtil.byPatchSet(dbProvider.get(), rsrc.getNotes(), psId); Map<PatchSetApproval.Key, PatchSetApproval> byKey = Maps.newHashMapWithExpectedSize(approvals.size()); for (PatchSetApproval psa : approvals) { if (!byKey.containsKey(psa.getKey())) { byKey.put(psa.getKey(), psa); } } PatchSetApproval submit = ApprovalsUtil.getSubmitter(psId, byKey.values()); if (submit == null || submit.getAccountId() != caller.getAccountId()) { submit = new PatchSetApproval( new PatchSetApproval.Key( rsrc.getPatchSet().getId(), caller.getAccountId(), LabelId.SUBMIT), (short) 1, TimeUtil.nowTs()); byKey.put(submit.getKey(), submit); } submit.setValue((short) 1); submit.setGranted(timestamp); approvals = labelNormalizer.normalize(rsrc.getControl(), byKey.values()); update.putApproval(submit.getLabel(), submit.getValue()); dbProvider.get().patchSetApprovals().upsert(approvals); try { return saveToBatch(rsrc, update, approvals, timestamp); } catch (IOException e) { throw new OrmException(e); } }
Source:
public void bundleChanged(BundleEvent event) { Bundle bundle = event.getBundle(); String loggerName = (bundle != null) ? LOGGER_BUNDLE_EVENT + "." + bundle.getSymbolicName() : LOGGER_BUNDLE_EVENT; if (logReaderServiceFactory.isLoggable(bundle, loggerName, LogService.LOG_INFO)) { LoggerImpl logger = (LoggerImpl) systemBundleLog.getLogger(loggerName); int eventType = event.getType(); logger.log(bundle, event, null, LogService.LOG_INFO, getBundleEventTypeName(eventType), null, null); } }

Target:
public void bundleChanged(BundleEvent event) { Bundle bundle = event.getBundle(); String bsn = (bundle == null) ? null : bundle.getSymbolicName(); String loggerName = (bsn == null) ? LOGGER_BUNDLE_EVENT : LOGGER_BUNDLE_EVENT + "." + bsn; if (logReaderServiceFactory.isLoggable(bundle, loggerName, LogService.LOG_INFO)) { LoggerImpl logger = (LoggerImpl) systemBundleLog.getLogger(loggerName); int eventType = event.getType(); logger.log(bundle, event, null, LogService.LOG_INFO, getBundleEventTypeName(eventType), null, null); } }
Source:
public void createEcKey(HttpClient httpClient, KeyServiceVersion serviceVersion) { getKeyClient(httpClient, serviceVersion); createEcKeyRunner((expected) -> assertKeyEquals(expected, client.createEcKey(expected))); }

Target:
public void createEcKey(HttpClient httpClient, KeyServiceVersion serviceVersion) { getKeyClient(httpClient, serviceVersion); createEcKeyRunner((expected) -> StepVerifier.create(client.createEcKey(expected)) .assertNext(response -> assertKeyEquals(expected, response)) .verifyComplete()); }
Source:
public void acknowledgeAlert(@NonNull Alert alert, @NonNull Callback<List<String>> callback) { alert.setId(alert.getId()); savePipe(BackendPipes.Names.ALERT_ACKNOWLEDGE, alert, callback, Alert.class); }

Target:
public void acknowledgeAlert(@NonNull Alert alert, @NonNull Callback<List<String>> callback) { savePipe(BackendPipes.Names.ALERT_ACKNOWLEDGE, alert, callback); }
Source:
public List<File> getExtensionsDirectories() { String path = getProperty("ENGINE_EXTENSION_PATH"); if (path == null) { log.warn("No extension configurations directories were provided"); return Collections.emptyList(); } List<File> results = new ArrayList<File>(); for (String currentPath : path.split(":")) { if (StringUtils.isNotBlank(currentPath)) { results.add(new File(currentPath)); } } return results; }

Target:
public List<File> getExtensionsDirectories() { String path = getProperty("ENGINE_EXTENSION_PATH"); if (path == null) { return Collections.emptyList(); } List<File> results = new ArrayList<File>(); for (String currentPath : path.split(":")) { if (StringUtils.isNotBlank(currentPath)) { results.add(new File(currentPath)); } } return results; }
Source:
protected void execute(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException { JobParameters nextParameters = new JobParametersBuilder(jobParameters, this.taskJobExplorer).getNextJobParameters(job).toJobParameters(); JobExecution execution = this.taskJobLauncher.run(job, nextParameters); if (this.taskApplicationEventPublisher != null) { this.taskApplicationEventPublisher.publishEvent(new JobExecutionEvent(execution)); } this.jobExecutionList.add(execution); if (execution.getExitStatus().getExitCode().equals(ExitStatus.FAILED.getExitCode())) { throwJobFailedException(Collections.singletonList(execution)); } }

Target:
protected void execute(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException { String jobName = job.getName(); JobParameters parameters = jobParameters; boolean jobInstanceExists = this.taskJobRepository.isJobInstanceExists(jobName, parameters); if (jobInstanceExists) { JobExecution lastJobExecution = this.taskJobRepository .getLastJobExecution(jobName, jobParameters); if (lastJobExecution != null && isStoppedOrFailed(lastJobExecution) && job.isRestartable()) { JobParameters previousParameters = lastJobExecution.getJobParameters(); JobParameters previousIdentifyingParameters = removeNonIdentifying( previousParameters); parameters = merge(previousIdentifyingParameters, jobParameters); } } else { JobParametersIncrementer incrementer = job.getJobParametersIncrementer(); if (incrementer != null) { JobParameters nextParameters = new JobParametersBuilder(jobParameters, this.taskJobExplorer).getNextJobParameters(job).toJobParameters(); parameters = merge(nextParameters, jobParameters); } } JobExecution execution = this.taskJobLauncher.run(job, parameters); if (this.taskApplicationEventPublisher != null) { this.taskApplicationEventPublisher.publishEvent(new JobExecutionEvent(execution)); } this.jobExecutionList.add(execution); if (execution.getStatus().equals(BatchStatus.FAILED)) { throwJobFailedException(Collections.singletonList(execution)); } }
Source:
private static Optional<Expression> searchForBadCsrfSettingInDictionary(DictionaryLiteral dict) { return dict.elements().stream() .filter(KeyValuePair.class::isInstance) .map(KeyValuePair.class::cast) .filter(kvp -> checkedCast(StringLiteral.class, kvp.key()) .filter(strLit -> "csrf".equals(strLit.trimmedQuotesValue())) .isPresent()) .findFirst() .filter(kvp -> Expressions.isFalsy(kvp.value())) .map(KeyValuePair::value); }

Target:
private static Optional<Expression> searchForBadCsrfSettingInDictionary(DictionaryLiteral dict) { return dict.elements().stream() .filter(e -> e.is(Tree.Kind.KEY_VALUE_PAIR)) .map(KeyValuePair.class::cast) .filter(kvp -> Optional.ofNullable(kvp.key()) .filter(s -> s.is(Tree.Kind.STRING_LITERAL) && "csrf".equals(((StringLiteral) s).trimmedQuotesValue())) .isPresent()) .findFirst() .filter(kvp -> Expressions.isFalsy(kvp.value())) .map(KeyValuePair::value); }
Source:
public void onStateReceived(int segmentId, boolean isLastChunk) { if (!isCancelled && isLastChunk) { boolean isCompleted = false; synchronized (segments) { if (segments.contains((Object) segmentId)) { finishedSegments.add((Integer) segmentId); if (finishedSegments.size() == segments.size()) { log.debugf("Finished receiving state for segments %s", segments); isCompleted = true; } } } if (isCompleted) { notifyCompletion(true); } } }

Target:
public void onStateReceived(int segmentId, boolean isLastChunk) { if (!isCancelled && isLastChunk) { boolean isCompleted = false; synchronized (segments) { if (segments.contains(segmentId)) { finishedSegments.add(segmentId); if (finishedSegments.size() == segments.size()) { log.debugf("Finished receiving state for segments %s", segments); isCompleted = true; } } } if (isCompleted) { notifyCompletion(true); } } }
Source:
public Class< ? > getType() { Class<?> clazz; if (this.parameterType instanceof Class) { clazz = (Class) this.parameterType; } else if (this.parameterType instanceof ParameterizedType) { clazz = (Class) ((ParameterizedType) this.parameterType).getRawType(); } else { clazz = String.class; } return clazz; }

Target:
public Class<?> getType() { Class<?> type = ReflectionUtils.getTypeClass(this.parameterType); if (type == null) { type = String.class; } return type; }
Source:
public JsonArrayBuilder handleDirectory(DataverseRequest dataverseRequest, File dir, ImportUtil.ImportType importType, PrintWriter validationLog, PrintWriter cleanupLog, Boolean createDV) throws ImportException{ JsonArrayBuilder status = Json.createArrayBuilder(); Dataverse owner = dataverseService.findByAlias(dir.getName()); if (owner == null ) { if (createDV) { System.out.println("creating new dataverse: " + dir.getName()); owner = importService.createDataverse(dir.getName(), dataverseRequest); } else { throw new ImportException("Can't find dataverse with identifier='" + dir.getName() + "'"); } } for (File file : dir.listFiles()) { if(null!=file) { if (!file.isHidden()) { try { JsonObjectBuilder fileStatus = importService.handleFile(dataverseRequest, owner, file, importType, validationLog, cleanupLog); status.add(fileStatus); } catch (ImportException | IOException e) { status.add(Json.createObjectBuilder().add("importStatus", "Exception importing " + file.getName() + ", message = " + e.getMessage())); } } } } return status; }

Target:
public JsonArrayBuilder handleDirectory(DataverseRequest dataverseRequest, File dir, ImportUtil.ImportType importType, PrintWriter validationLog, PrintWriter cleanupLog, Boolean createDV) throws ImportException{ JsonArrayBuilder status = Json.createArrayBuilder(); Dataverse owner = dataverseService.findByAlias(dir.getName()); if (owner == null ) { if (createDV) { System.out.println("creating new dataverse: " + dir.getName()); owner = importService.createDataverse(dir.getName(), dataverseRequest); } else { throw new ImportException("Can't find dataverse with identifier='" + dir.getName() + "'"); } } for (File file : dir.listFiles()) { if (!file.isHidden()) { try { JsonObjectBuilder fileStatus = importService.handleFile(dataverseRequest, owner, file, importType, validationLog, cleanupLog); status.add(fileStatus); } catch (ImportException | IOException e) { status.add(Json.createObjectBuilder().add("importStatus", "Exception importing " + file.getName() + ", message = " + e.getMessage())); } } } return status; }
Source:
public static Group findByName(Context context, String name) throws SQLException { String query = "select * from epersongroup e " + "LEFT JOIN metadatavalue m on (m.resource_id = e.eperson_group_id and m.resource_type_id = ? and m.metadata_field_id = ?) " + "where "; if("oracle".equals(ConfigurationManager.getProperty("db.name"))) { query += " dbms_lob.substr(m.text_value) = ?"; }else{ query += " m.text_value = ?"; } TableRow row = DatabaseManager.querySingle(context, query, Constants.GROUP, MetadataField.findByElement(context, MetadataSchema.find(context, MetadataSchema.DC_SCHEMA).getSchemaID(), "title", null).getFieldID(), name ); if (row == null) { return null; } else { Group fromCache = (Group) context.fromCache(Group.class, row .getIntColumn("eperson_group_id")); if (fromCache != null) { return fromCache; } else { return new Group(context, row); } } }

Target:
public static Group findByName(Context context, String name) throws SQLException { String query = "select * from epersongroup e " + "LEFT JOIN metadatavalue m on (m.resource_id = e.eperson_group_id and m.resource_type_id = ? and m.metadata_field_id = ?) " + "where "; if(DatabaseManager.isOracle()) { query += " dbms_lob.substr(m.text_value) = ?"; }else{ query += " m.text_value = ?"; } TableRow row = DatabaseManager.querySingle(context, query, Constants.GROUP, MetadataField.findByElement(context, MetadataSchema.find(context, MetadataSchema.DC_SCHEMA).getSchemaID(), "title", null).getFieldID(), name ); if (row == null) { return null; } else { Group fromCache = (Group) context.fromCache(Group.class, row .getIntColumn("eperson_group_id")); if (fromCache != null) { return fromCache; } else { return new Group(context, row); } } }
Source:
private static Optional<OsFamily> findInStandardFamilies(final String osFamily) { return tryFind(asList(OsFamily.values()), new Predicate<OsFamily>() { @Override public boolean apply(OsFamily input) { if (osFamily != null) { return osFamily.toLowerCase().contains(input.value().toLowerCase()); } else { return false; } } }); }

Target:
private static Optional<OsFamily> findInStandardFamilies(final String osFamily) { if (osFamily == null) { return Optional.absent(); } return tryFind(asList(OsFamily.values()), new Predicate<OsFamily>() { @Override public boolean apply(OsFamily input) { return osFamily.toLowerCase().contains(input.value().toLowerCase()); } }); }
Source:
public List<Brick> getReversedCheckedBrickList() { List<Brick> reverseCheckedList = new ArrayList<>(); for (int counter = checkedBricks.size() - 1; counter >= 0; counter--) { reverseCheckedList.add(checkedBricks.get(counter)); } return reverseCheckedList; }

Target:
public List<Brick> getReversedCheckedBrickList() { return Lists.reverse(checkedBricks); }
Source:
private static Geocache parseCache(final JSONObject response) { final Geocache cache = new Geocache(); cache.setReliableLatLon(true); try { cache.setGeocode("EC" + response.getString("cache_id")); cache.setName(response.getString("title")); cache.setCoords(new Geopoint(response.getString("lat"), response.getString("lon"))); cache.setType(getCacheType(response.getString("type"))); cache.setDifficulty((float) response.getDouble("difficulty")); cache.setTerrain((float) response.getDouble("terrain")); cache.setFound(response.getInt("found") == 1 ? true : false); DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_CACHE)); } catch (final JSONException e) { Log.e("ECApi.parseCache", e); } return cache; }

Target:
private static Geocache parseCache(final JSONObject response) { final Geocache cache = new Geocache(); cache.setReliableLatLon(true); try { cache.setGeocode("EC" + response.getString("cache_id")); cache.setName(response.getString("title")); cache.setCoords(new Geopoint(response.getString("lat"), response.getString("lon"))); cache.setType(getCacheType(response.getString("type"))); cache.setDifficulty((float) response.getDouble("difficulty")); cache.setTerrain((float) response.getDouble("terrain")); cache.setFound(response.getInt("found") == 1 ? true : false); DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_CACHE)); } catch (final JSONException e) { Log.e("ECApi.parseCache", e); return null; } return cache; }
Source:
public VoidResult setStarred(final String reviewId, final boolean starred, IProgressMonitor monitor) throws GerritException { final Change.Id id = new Change.Id(id(reviewId)); final ToggleStarRequest req = new ToggleStarRequest(); req.toggle(new Change.Id(id(reviewId)), starred); if (isVersion28OrLater(monitor)) { final String uri = "/a/accounts/self/starred.changes/" + id.get(); return execute(monitor, new Operation<VoidResult>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { if (starred) { executePutRestRequest(uri, req, ToggleStarRequest.class, new ErrorHandler() { @Override public void handleError(HttpMethodBase method) throws GerritException { throw new GerritException(method.getStatusLine().getReasonPhrase()); } }, monitor); } else { executeDeleteRestRequest(uri, req, ToggleStarRequest.class, new ErrorHandler() { @Override public void handleError(HttpMethodBase method) throws GerritException { throw new GerritException(method.getStatusLine().getReasonPhrase()); } }, monitor); } } }); } else { return execute(monitor, new Operation<VoidResult>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { getChangeListService(monitor).toggleStars(req, this); } }); } }

Target:
public VoidResult setStarred(final String reviewId, final boolean starred, IProgressMonitor monitor) throws GerritException { final Change.Id id = new Change.Id(id(reviewId)); final ToggleStarRequest req = new ToggleStarRequest(); req.toggle(id, starred); if (isVersion28OrLater(monitor)) { final String uri = "/a/accounts/self/starred.changes/" + id.get(); return execute(monitor, new Operation<VoidResult>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { if (starred) { executePutRestRequest(uri, req, ToggleStarRequest.class, handleErrorHandler(), monitor); } else { executeDeleteRestRequest(uri, req, ToggleStarRequest.class, handleErrorHandler(), monitor); } } }); } else { return execute(monitor, new Operation<VoidResult>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { getChangeListService(monitor).toggleStars(req, this); } }); } }
Source:
public void updateConditionFromPart() { Mounted mounted = getMounted(); if (mounted != null) { mounted.setHit(false); mounted.setDestroyed(false); mounted.setRepairable(true); getUnit().repairSystem(CriticalSlot.TYPE_EQUIPMENT, equipmentNum); mounted.setShotsLeft(getFullShots() - shotsNeeded/getNumTroopers()); } }

Target:
public void updateConditionFromPart() { Mounted mounted = getMounted(); if (mounted != null) { mounted.setHit(false); mounted.setDestroyed(false); mounted.setRepairable(true); getUnit().repairSystem(CriticalSlot.TYPE_EQUIPMENT, equipmentNum); mounted.setShotsLeft(getFullShots() - (shotsNeeded / getNumTroopers())); } }
Source:
public GISModel trainModel(ObjectStream<Event> eventStream, int iterations, int cutoff) throws IOException { DataIndexer indexer=new OnePassDataIndexer(); Map<String, String> params=new HashMap<String, String>(); params.put(GIS.ITERATIONS_PARAM, Integer.toString(iterations)); params.put(GIS.CUTOFF_PARAM, Integer.toString(cutoff)); indexer.init(params, new HashMap<String, String>()); return trainModel(iterations, indexer, cutoff); }

Target:
public GISModel trainModel(ObjectStream<Event> eventStream, int iterations, int cutoff) throws IOException { DataIndexer indexer = new OnePassDataIndexer(); Map<String, String> params = new HashMap<>(); params.put(GIS.ITERATIONS_PARAM, Integer.toString(iterations)); params.put(GIS.CUTOFF_PARAM, Integer.toString(cutoff)); indexer.init(params, new HashMap<>()); return trainModel(iterations, indexer, cutoff); }
Source:
public boolean checkStopScanCondition(String interfaceName) { boolean stopScan = false; if (scanners.containsKey(interfaceName) && scanners.get(interfaceName).stream().mapToInt(e -> e.isScanning() ? 1 : 0).sum() == 1) { stopScan = true; } return stopScan; }

Target:
public boolean checkStopScanCondition(String interfaceName) { boolean stopScan = false; if (scanners.containsKey(interfaceName) && getScannersCount(interfaceName) == 1) { stopScan = true; } return stopScan; }
Source:
void processItem(final String agent) { try { if (masterModel.isHostUp(agent)) { return; } final AgentInfo agentInfo = masterModel.getAgentInfo(agent); if (agentInfo == null) { return; } final long downSince = agentInfo.getStartTime() + agentInfo.getUptime(); final long downDurationMillis = clock.now().getMillis() - downSince; if (downDurationMillis >= timeoutMillis) { try { log.info("Reaping dead agent '{}' (DOWN for hours)", agent, DurationFormatUtils.formatDurationHMS(downDurationMillis)); masterModel.deregisterHost(agent); } catch (Exception e) { log.warn("Failed to reap agent '{}'", agent, e); } } } catch (Exception e) { log.warn("Failed to determine if agent '{}' should be reaped", agent, e); } }

Target:
void processItem(final String agent) { try { final HostStatus hostStatus = masterModel.getHostStatus(agent); if (hostStatus == null || hostStatus.getStatus() != HostStatus.Status.DOWN) { return; } final AgentInfo agentInfo = hostStatus.getAgentInfo(); if (agentInfo == null) { return; } final long downSince = agentInfo.getStartTime() + agentInfo.getUptime(); final long downDurationMillis = clock.now().getMillis() - downSince; if (downDurationMillis >= timeoutMillis) { try { log.info("Reaping dead agent '{}' (DOWN for hours)", agent, DurationFormatUtils.formatDurationHMS(downDurationMillis)); masterModel.deregisterHost(agent); } catch (Exception e) { log.warn("Failed to reap agent '{}'", agent, e); } } } catch (Exception e) { log.warn("Failed to determine if agent '{}' should be reaped", agent, e); } }
Source:
public EnumActionResult onProcessRightClick(PlayerInteractionManager interactionManager, EntityPlayer player, net.minecraft.world.World worldIn, @Nullable ItemStack stack, EnumHand hand) { EnumActionResult actionResult = interactionManager.processRightClick(this.player, worldIn, stack, hand); if (!SpongeCommonEventFactory.playerInteractItemChanged) { final PhaseTracker phaseTracker = PhaseTracker.getInstance(); final PhaseData peek = phaseTracker.getCurrentPhaseData(); final ItemStack itemStack = ItemStackUtil.toNative(((PacketContext<?>) peek.context).getItemUsed()); if (!ItemStack.areItemStacksEqual(itemStack, player.getHeldItem(hand)) && SpongeCommonEventFactory.interactBlockRightClickEventCancelled) { PacketPhaseUtil.handlePlayerSlotRestore((EntityPlayerMP) player, itemStack, hand); } } SpongeCommonEventFactory.playerInteractItemChanged = false; SpongeCommonEventFactory.interactBlockRightClickEventCancelled = false; return actionResult; }

Target:
public EnumActionResult onProcessRightClick(PlayerInteractionManager interactionManager, EntityPlayer player, net.minecraft.world.World worldIn, @Nullable ItemStack stack, EnumHand hand) { EnumActionResult actionResult = interactionManager.processRightClick(this.player, worldIn, stack, hand); final PhaseData peek = PhaseTracker.getInstance().getCurrentPhaseData(); if (!((PacketContext<?>) peek.context).getInteractItemChanged()) { final ItemStack itemStack = ItemStackUtil.toNative(((PacketContext<?>) peek.context).getItemUsed()); if (!ItemStack.areItemStacksEqual(itemStack, player.getHeldItem(hand)) && SpongeCommonEventFactory.interactBlockRightClickEventCancelled) { PacketPhaseUtil.handlePlayerSlotRestore((EntityPlayerMP) player, itemStack, hand); } } ((PacketContext<?>) peek.context).interactItemChanged(false); SpongeCommonEventFactory.interactBlockRightClickEventCancelled = false; return actionResult; }
Source:
protected int getMaxRampStage() { return 4; }

Target:
protected int getMaxRampStage() { return MAX_RAMP_STAGE; }
Source:
public void shouldFindUrlsInAreaPingElements() { SpiderHtmlParser htmlParser = new SpiderHtmlParser(new SpiderParam()); TestSpiderParserListener listener = createTestSpiderParserListener(); htmlParser.addSpiderParserListener(listener); HttpMessage messageHtmlResponse = createMessageWith("AElementsWithPingSpiderHtmlParser.html"); Source source = createSource(messageHtmlResponse); boolean completelyParsed = htmlParser.parseResource(messageHtmlResponse, source, BASE_DEPTH); assertThat(completelyParsed, is(equalTo(false))); assertThat(listener.getNumberOfUrlsFound(), is(equalTo(23))); assertThat( listener.getUrlsFound(), contains( "<LINK_6>", "<LINK_0>", "<LINK_2>", "<LINK_9>", "<LINK_1>", "<LINK_13>", "<LINK_12>", "<LINK_4>", "<LINK_8>", "<LINK_8>/ping", "ftp://a.example.com/", "<LINK_16>", "<LINK_7>", "<LINK_11>", "<LINK_14>", "<LINK_5>", "<LINK_3>", "<LINK_10>", "<LINK_15>", "<LINK_17>", "<LINK_10>", "<LINK_15>", "<LINK_17>")); }

Target:
public void shouldFindUrlsInAreaPingElements() { SpiderHtmlParser htmlParser = new SpiderHtmlParser(new SpiderParam()); TestSpiderParserListener listener = createTestSpiderParserListener(); htmlParser.addSpiderParserListener(listener); HttpMessage messageHtmlResponse = createMessageWith("AreaElementsWithPingSpiderHtmlParser.html"); Source source = createSource(messageHtmlResponse); boolean completelyParsed = htmlParser.parseResource(messageHtmlResponse, source, BASE_DEPTH); assertThat(completelyParsed, is(equalTo(false))); assertThat(listener.getNumberOfUrlsFound(), is(equalTo(23))); assertThat( listener.getUrlsFound(), contains( "<LINK_6>", "<LINK_0>", "<LINK_2>", "<LINK_9>", "<LINK_1>", "<LINK_13>", "<LINK_12>", "<LINK_4>", "<LINK_8>", "<LINK_8>/ping", "ftp://a.example.com/", "<LINK_16>", "<LINK_7>", "<LINK_11>", "<LINK_14>", "<LINK_5>", "<LINK_3>", "<LINK_10>", "<LINK_15>", "<LINK_17>", "<LINK_10>", "<LINK_15>", "<LINK_17>")); }
Source:
public static void closeConnection(Connection dbConnection) { if (dbConnection != null) { try { if (dbConnection != null && !dbConnection.isClosed()) { dbConnection.close(); } } catch (SQLRecoverableException ex) { handleSQLRecoverableException(dbConnection, ex); } catch (SQLException e) { log.error("Database error. Could not close statement. Continuing with others. - " + e.getMessage(), e); } } }

Target:
public static void closeConnection(Connection dbConnection) { close(dbConnection); }
Source:
DebuggerInfo getInfo() throws DebuggerException; void disconnect() throws DebuggerException; void start(StartAction action) throws DebuggerException; void suspend() throws DebuggerException; void addBreakpoint(Breakpoint breakpoint) throws DebuggerException; void deleteBreakpoint(Location location) throws DebuggerException; void deleteAllBreakpoints() throws DebuggerException; List<Breakpoint> getAllBreakpoints() throws DebuggerException; SimpleValue getValue(VariablePath variablePath) throws DebuggerException; void setValue(Variable variable) throws DebuggerException; String evaluate(String expression) throws DebuggerException; void stepOver(StepOverAction action) throws DebuggerException; void stepInto(StepIntoAction action) throws DebuggerException; void stepOut(StepOutAction action) throws DebuggerException; void resume(ResumeAction action) throws DebuggerException; StackFrameDump dumpStackFrame() throws DebuggerException; interface DebuggerCallback { void onEvent(DebuggerEvent event); }

Target:
DebuggerInfo getInfo() throws DebuggerException; void disconnect() throws DebuggerException; void start(StartAction action) throws DebuggerException; default void suspend() throws DebuggerException { throw new DebuggerException("Unsupported operation for current debugger implementation."); }
Source:
public synchronized CompletableFuture<RaftRole> start() { if (raft.getCluster().getActiveMemberStates().isEmpty()) { log.debug("Single member cluster. Transitioning directly to leader."); raft.transition(RaftServer.Role.LEADER); return CompletableFuture.completedFuture(this); } return super.start().thenRun(this::startElection).thenApply(v -> this); }

Target:
public synchronized CompletableFuture<RaftRole> start() { if (raft.getCluster().getActiveMemberStates().isEmpty()) { log.debug("Single member cluster. Transitioning directly to leader."); raft.setTerm(raft.getTerm() + 1); raft.setLastVotedFor(raft.getCluster().getMember().memberId()); raft.transition(RaftServer.Role.LEADER); return CompletableFuture.completedFuture(this); } return super.start().thenRun(this::startElection).thenApply(v -> this); }
Source:
public void subscribe(Subscriber<? super KeyValueEntry<K, V>> subscriber) { subscribers.add(subscriber); createContinuousQueryFlowable(); flowable.subscribe(subscriber); flowable.doOnError(e -> { log.error(e); continuousQuery.removeContinuousQueryListener(continuousQueryListener); }).doOnCancel(() -> continuousQuery.removeContinuousQueryListener(continuousQueryListener)); }

Target:
public void subscribe(Subscriber<? super KeyValueEntry<K, V>> subscriber) { createContinuousQueryFlowable(); flowable.subscribe(subscriber); }