auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LargeServerMessage createLargeMessage(final long id, final Message message) throws Exception { readLock(); try { if (isReplicated()) { replicator.largeMessageBegin(id); } LargeServerMessageImpl largeMessage = (LargeServerMessageImpl) createLargeMessage(); largeMessage.copyHeadersAndProperties(message); largeMessage.setMessageID(id); if (largeMessage.isDurable()) { final long maxRecordSize = getMaxRecordSize(); final int messageEncodeSize = largeMessage.getEncodeSize(); if (messageEncodeSize > maxRecordSize) { if (logger.isDebugEnabled()) { logger.debug("Message header too large for " + largeMessage); } else { logger.warn("Message with id " + largeMessage.getMessageID() + " has a header too large. Set log level to debug to log the message header."); } throw ActiveMQJournalBundle.BUNDLE.recordLargerThanStoreMax(messageEncodeSize, maxRecordSize); } } largeMessage.validateFile(); if (largeMessage.isDurable()) { long pendingRecordID = storePendingLargeMessage(id, LargeServerMessage.NO_PENDING_ID); largeMessage.setPendingRecordID(pendingRecordID); } return largeMessage; } finally { readUnLock(); } }

Target:
public LargeServerMessage createLargeMessage(final long id, final Message message) throws Exception { readLock(); try { if (isReplicated()) { replicator.largeMessageBegin(id); } LargeServerMessageImpl largeMessage = (LargeServerMessageImpl) createLargeMessage(); largeMessage.copyHeadersAndProperties(message); largeMessage.setMessageID(id); if (largeMessage.isDurable()) { final long maxRecordSize = getMaxRecordSize(); final int messageEncodeSize = largeMessage.getEncodeSize(); if (messageEncodeSize > maxRecordSize) { ActiveMQServerLogger.LOGGER.messageWithHeaderTooLarge(largeMessage.getMessageID(), logger.getName()); if (logger.isDebugEnabled()) { logger.debug("Message header too large for " + largeMessage); } throw ActiveMQJournalBundle.BUNDLE.recordLargerThanStoreMax(messageEncodeSize, maxRecordSize); } } largeMessage.validateFile(); if (largeMessage.isDurable()) { long pendingRecordID = storePendingLargeMessage(id, LargeServerMessage.NO_PENDING_ID); largeMessage.setPendingRecordID(pendingRecordID); } return largeMessage; } finally { readUnLock(); } }
Source:
public boolean isEmpty() { return this.components.isEmpty(); }

Target:
public boolean isEmpty() { return !(this.bold.isPresent() || this.italic.isPresent() || this.underline.isPresent() || this.strikethrough.isPresent() || this.obfuscated.isPresent()); }
Source:
public String getQueuedFlowIds() { final List<Integer> allIds = new ArrayList<>(); try { getExecutionIdsHelper(allIds, this.executorLoader.fetchQueuedFlows()); } catch (final ExecutorManagerException e) { this.logger.error("Failed to get queued flow ids.", e); } return allIds.toString(); }

Target:
public List<Integer> getQueuedFlowIds() { final List<Integer> allIds = new ArrayList<>(); try { getExecutionIdsHelper(allIds, this.executorLoader.fetchQueuedFlows()); } catch (final ExecutorManagerException e) { this.logger.error("Failed to get queued flow ids.", e); } return allIds; }
Source:
private EVCacheClient selectClient(List<EVCacheClient> clients) { if (clients == null) { if (log.isDebugEnabled()) log.debug("clients is null returning null!!!"); return null; } if (clients.size() == 1) { return clients.get(0); } final long currentVal = Math.abs(numberOfModOps.incrementAndGet()); final int index = (int) (currentVal % clients.size()); return clients.get(index); }

Target:
private EVCacheClient selectClient(List<EVCacheClient> clients) { if (clients == null) { if (log.isDebugEnabled()) log.debug("clients is null returning null!!!"); return null; } if (clients.size() == 1) { return clients.get(0); } final long currentVal = numberOfModOps.incrementAndGet(); final int index = Math.abs((int) (currentVal % clients.size())); return clients.get(index); }
Source:
private boolean isConsoleCommandsExecutionAllowed() { if (getSelectedItem() == null) { return false; } return getSelectedItems() .stream() .map(consolesFactory::getVmConsolesForVm) .anyMatch(VmConsoles::canConnectToConsole); }

Target:
private boolean isConsoleCommandsExecutionAllowed() { if (getSelectedItems() == null) { return false; } return getSelectedItems() .stream() .map(consolesFactory::getVmConsolesForVm) .anyMatch(VmConsoles::canConnectToConsole); }
Source:
public List<Shard> getShards() { InputStream response = null; try { response = client.get(buildUri(db.getDBUri()).path("/_shards").build()); return getResponseList(response, client.getGson(), Shard.class, new TypeToken<List<Shard>>() { }.getType()); } finally { close(response); } }

Target:
public List<Shard> getShards() { InputStream response = null; try { response = client.get(buildUri(getDBUri()).path("_shards").build()); return getResponseList(response, client.getGson(), Shard.class, new TypeToken<List<Shard>>() { }.getType()); } finally { close(response); } }
Source:
public List<Diagnosis> getDiagnoses(Encounter encounter){ Query query = sessionFactory.getCurrentSession().createQuery( "from Diagnosis d where d.encounter = :encounterId order by dateCreated desc"); query.setInteger("encounterId", encounter.getId()); return query.list(); }

Target:
public List<Diagnosis> getDiagnoses(Encounter encounter){ Query query = sessionFactory.getCurrentSession().createQuery( "from Diagnosis d where d.encounter.encounterId = :encounterId order by dateCreated desc"); query.setInteger("encounterId", encounter.getId()); return query.list(); }
Source:
public static Iterable<? extends Object> data() { return Arrays.asList(true, false); }

Target:
public static Iterable<? extends Object> data() { return Arrays.asList(Boolean.TRUE, Boolean.FALSE); }
Source:
protected TmfXYChartViewer createChartViewer(Composite parent) { TmfXYChartSettings settings = new TmfXYChartSettings(Messages.ScriptedXYTreeViewer_DefaultViewerTitle, Messages.ScriptedXYTreeViewer_DefaultXAxis, Messages.ScriptedXYTreeViewer_DefaultYAxis, 1); return new TmfFilteredXYChartViewer(parent, settings, getViewSite().getSecondaryId().replace(ScriptedXYView.COLON, ":")); }

Target:
protected TmfXYChartViewer createChartViewer(Composite parent) { TmfXYChartSettings settings = new TmfXYChartSettings(Messages.ScriptedXYTreeViewer_DefaultViewerTitle, Messages.ScriptedXYTreeViewer_DefaultXAxis, Messages.ScriptedXYTreeViewer_DefaultYAxis, 1); return new TmfFilteredXYChartViewer(parent, settings, secondaryId); }
Source:
public static Script createP2WPKHOutputScript(byte[] hash) { checkArgument(hash.length == 20); return new ScriptBuilder().smallNum(0).data(hash).build(); }

Target:
public static Script createP2WPKHOutputScript(byte[] hash) { checkArgument(hash.length == SegwitAddress.WITNESS_PROGRAM_LENGTH_PKH); return new ScriptBuilder().smallNum(0).data(hash).build(); }
Source:
private BundleDescription[] addDevConstraints(BundleDescription[] reRefresh) { if (!developmentMode) return reRefresh; Set<BundleDescription> additionalRefresh = new HashSet<>(); ResolverBundle[] unresolved = unresolvedBundles.toArray(new ResolverBundle[unresolvedBundles.size()]); for (ResolverBundle unresolved1 : unresolved) { addUnresolvedWithDependents(unresolved1, additionalRefresh); addHostsFromFragmentConstraints(unresolved1, additionalRefresh); } if (additionalRefresh.size() == 0) return reRefresh; if (reRefresh != null) for (BundleDescription reRefresh1 : reRefresh) { additionalRefresh.add(reRefresh1); } return additionalRefresh.toArray(new BundleDescription[additionalRefresh.size()]); }

Target:
private BundleDescription[] addDevConstraints(BundleDescription[] reRefresh) { if (!developmentMode) return reRefresh; Set<BundleDescription> additionalRefresh = new HashSet<>(); ResolverBundle[] allUnresolved = unresolvedBundles.toArray(new ResolverBundle[unresolvedBundles.size()]); for (ResolverBundle unresolved : allUnresolved ) { addUnresolvedWithDependents(unresolved, additionalRefresh); addHostsFromFragmentConstraints(unresolved, additionalRefresh); } if (additionalRefresh.size() == 0) return reRefresh; if (reRefresh != null) for (BundleDescription description : reRefresh) { additionalRefresh.add(description); } return additionalRefresh.toArray(new BundleDescription[additionalRefresh.size()]); }
Source:
public AbstractSolaceDirectInputOperator() { throwable = new AtomicReference<Throwable>(); currentWindowRecoveryState = Maps.newLinkedHashMap(); }

Target:
public AbstractSolaceDirectInputOperator() { }
Source:
public List<Citation> getByLicenseAndDOB(String driversLicenseNumber, String driversLiscenseState, LocalDate dob, String lastName) { List<CitationDataSource> sources = citationDataSourceFactory.getAllCitationDataSources(); List<Observable<Citation>> citationSearches = Lists.newArrayList(); for(CitationDataSource source : sources) { citationSearches.add(Observable.from(source.getByLicenseAndDOB(driversLicenseNumber, driversLiscenseState, dob, lastName))); } return Observable.merge(citationSearches).onExceptionResumeNext(Observable.just(null)).toList().toBlocking().first(); }

Target:
public List<Citation> getByLicenseAndDOB(String driversLicenseNumber, String driversLiscenseState, LocalDate dob, String lastName) { List<CitationDataSource> sources = citationDataSourceFactory.getAllCitationDataSources(); List<Observable<Citation>> citationSearches = Lists.newArrayList(); for(CitationDataSource source : sources) { citationSearches.add(Observable.from(source.getByLicenseAndDOBAndLastName(driversLicenseNumber, driversLiscenseState, dob, lastName))); } return Observable.merge(citationSearches).onExceptionResumeNext(Observable.just(null)).toList().toBlocking().first(); }
Source:
public void getStatesByApplicationIdShouldReturnAnEmptyList() { given(applicationsRepository.findOne(FIRST_ID)).willReturn(APPLICATION_ENTITY_WITHOUT_STATES); given(statesRepository.findByApplicationEntityOrderByStateIndexDesc(APPLICATION_ENTITY_WITHOUT_STATES)).willReturn(EMPTY_STATE_ENTITY_LIST); given(modelMapper.map(EMPTY_STATE_ENTITY_LIST, STATE_VIEW_DTO_LIST_TYPE)).willReturn(EMPTY_STATE_VIEW_DTO_LIST); List<StateViewDTO> stateViewDTOList = statesService.getStatesByApplicationId(FIRST_ID); assertThat(stateViewDTOList, notNullValue()); assertThat(stateViewDTOList.isEmpty(), is(true)); then(applicationsRepository).should(times(AT_ONE_TIME)).findOne(FIRST_ID); then(statesRepository).should(times(AT_ONE_TIME)).findByApplicationEntityOrderByStateIndexDesc(APPLICATION_ENTITY_WITHOUT_STATES); }

Target:
public void getStatesByApplicationIdShouldReturnAnEmptyList() { given(applicationsRepository.findOne(FIRST_ID)).willReturn(APPLICATION_ENTITY_WITHOUT_STATES); given(statesRepository.findByApplicationEntityOrderByStateIndexDesc(APPLICATION_ENTITY_WITHOUT_STATES)).willReturn(EMPTY_STATE_ENTITY_LIST); given(modelMapper.map(EMPTY_STATE_ENTITY_LIST, STATE_VIEW_DTO_LIST_TYPE)).willReturn(EMPTY_STATE_VIEW_DTO_LIST); List<StateViewDTO> stateViewDTOList = statesService.getStatesByApplicationId(FIRST_ID); assertThat(stateViewDTOList, notNullValue()); assertThat(stateViewDTOList.isEmpty(), is(true)); then(applicationsRepository).should().findOne(FIRST_ID); then(statesRepository).should().findByApplicationEntityOrderByStateIndexDesc(APPLICATION_ENTITY_WITHOUT_STATES); }
Source:
public GroupTrainer( IgniteCache<GroupTrainerCacheKey<K>, V> cache, Ignite ignite) { this.cache = cache; this.ignite = ignite; }

Target:
GroupTrainer( IgniteCache<GroupTrainerCacheKey<K>, V> cache, Ignite ignite) { this.cache = cache; this.ignite = ignite; }
Source:
public void insertMetadata(String name, Metadata metadata) throws EntityNotFoundException { Product product = null; try { product = productManager.load(name); } catch (Exception e) { log.warning("EntityNotFoundException: " + e.getMessage()); throw new APIException(new EntityNotFoundException(Product.class, name, e)); } product.addMetadata(metadata); productManager.update(product); }

Target:
public void insertMetadata(String name, Metadata metadata) throws APIException { Product product = null; try { product = productManager.load(name); } catch (Exception e) { log.warning("EntityNotFoundException: " + e.getMessage()); throw new APIException(new EntityNotFoundException(Product.class, name, e)); } product.addMetadata(metadata); productManager.update(product); }
Source:
public CompletableFuture<Void> visitRollbackCommand(TxInvocationContext ctx, RollbackCommand command) throws Throwable { return ctx.onReturn((rCtx, rCommand, rv, throwable) -> { lockManager.unlockAll(ctx); return null; }); }

Target:
public CompletableFuture<Void> visitRollbackCommand(TxInvocationContext ctx, RollbackCommand command) throws Throwable { return ctx.onReturn(unlockAllReturnHandler); }
Source:
private <T extends JestResult> T deserializeResponse(HttpResponse response, final HttpRequest httpRequest, Action<T> clientRequest) throws IOException { StatusLine statusLine = response.getStatusLine(); try { return clientRequest.createNewElasticSearchResult( response.getEntity() == null ? null : EntityUtils.toString(response.getEntity()), statusLine.getStatusCode(), statusLine.getReasonPhrase(), gson ); } catch (com.google.gson.JsonSyntaxException e) { for (Header header : response.getAllHeaders()) { final String mimeType = header.getValue(); if (!mimeType.startsWith("application/json")) { throw new IOException("Request " + httpRequest.toString() + " yielded " + mimeType + ", should be json: " + statusLine.toString()); } } throw e; } }

Target:
private <T extends JestResult> T deserializeResponse(HttpResponse response, final HttpRequest httpRequest, Action<T> clientRequest) throws IOException { StatusLine statusLine = response.getStatusLine(); try { return clientRequest.createNewElasticSearchResult( response.getEntity() == null ? null : EntityUtils.toString(response.getEntity()), statusLine.getStatusCode(), statusLine.getReasonPhrase(), gson ); } catch (com.google.gson.JsonSyntaxException e) { for (Header header : response.getAllHeaders()) { final String mimeType = header.getValue(); if (!mimeType.startsWith("application/json")) { final String message = "Request " + httpRequest.toString() + " yielded " + mimeType + ", should be json: " + statusLine.toString(); throw new IOException(message, e); } } throw e; } }
Source:
private void showResults(final Shell shell) { if (this.results.isEmpty()) return; else if (this.results.size() == 1) { Entry<Repository, Object> entry = this.results.entrySet() .iterator().next(); if (entry.getValue() instanceof PullResult) new PullResultDialog(shell, entry.getKey(), (PullResult) entry .getValue()).open(); else { IStatus status = (IStatus) entry.getValue(); if (status == NOT_TRIED_STATUS) { MessageDialog .openInformation( shell, UIText.PullOperationUI_PullCanceledWindowTitle, UIText.PullOperationUI_PullOperationCanceledMessage); } else if (status.getException() instanceof TransportException) { MessageDialog .openWarning( shell, UIText.PullOperationUI_PullFailed, NLS.bind( UIText.PullOperationUI_GitDataTransferFailed, status.getMessage())); } else Activator.handleError(status.getMessage(), status .getException(), true); } } else new MultiPullResultDialog(shell, results).open(); }

Target:
private void showResults(final Shell shell) { if (this.results.isEmpty()) return; else if (this.results.size() == 1) { Entry<Repository, Object> entry = this.results.entrySet() .iterator().next(); if (entry.getValue() instanceof PullResult) new PullResultDialog(shell, entry.getKey(), (PullResult) entry .getValue()).open(); else { IStatus status = (IStatus) entry.getValue(); if (status == NOT_TRIED_STATUS) { MessageDialog .openInformation( shell, UIText.PullOperationUI_PullCanceledWindowTitle, UIText.PullOperationUI_PullOperationCanceledMessage); } else if (status.getException() instanceof TransportException) { ErrorDialog.openError(shell, UIText.PullOperationUI_PullFailed, UIText.PullOperationUI_ConnectionProblem, status); } else Activator.handleError(status.getMessage(), status .getException(), true); } } else new MultiPullResultDialog(shell, results).open(); }
Source:
private void fetchAdvancedDetails(String volumeName) { VDSReturnValue returnValue = executeCommand(volumeName); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); }

Target:
private GlusterVolumeAdvancedDetails fetchAdvancedDetails(String volumeName) { VDSReturnValue returnValue = getBackendResourceManager().RunVdsCommand(VDSCommandType.GetGlusterVolumeAdvancedDetails, new GlusterVolumeAdvancedDetailsVDSParameters(getUpServerId(getParameters().getClusterId()), getParameters().getClusterId(), volumeName, getParameters().getBrickName(), getParameters().isDetailRequired())); return (GlusterVolumeAdvancedDetails) returnValue.getReturnValue(); }
Source:
public void handleData(final ITmfEvent event) { super.handleData(event); if (event != null && event.getTrace() == trace) { sci.processEvent(event); } else if (event != null && experiment != null) { for (ITmfTrace childTrace : experiment.getTraces()) { if (childTrace == event.getTrace()) { sci.processEvent(event); } } } }

Target:
public void handleData(final ITmfEvent event) { super.handleData(event); if (event != null) { for (ITmfTrace onetrace : TmfTraceManager.getTraceSet(trace)) { if (event.getTrace() == onetrace) { sci.processEvent(event); } } } }
Source:
public SimpleDocumentModel(String... schemas) { this(Arrays.asList(schemas)); }

Target:
public SimpleDocumentModel(String... schemas) { this(List.of(schemas)); }
Source:
public void registerCachedFile(String filePath, String name) throws RuntimeException, IOException { if (!this.cacheFile.containsKey(name)) { try { URI u = new URI(filePath); if (!u.getPath().startsWith("/")) { u = new URI(new File(filePath).getAbsolutePath()); } FileSystem fs = FileSystem.get(u); if (fs.exists(new Path(u.getPath()))) { this.cacheFile.put(name, u.toString()); } else { throw new RuntimeException("File " + u.toString() + " oesn't exist."); } } catch (URISyntaxException ex) { throw new RuntimeException("Invalid path: " + filePath); } } else { throw new RuntimeException("cache file " + name + "already exists!"); } }

Target:
public void registerCachedFile(String filePath, String name) throws RuntimeException, IOException { if (!this.cacheFile.containsKey(name)) { try { URI u = new URI(filePath); if (!u.getPath().startsWith("/")) { u = new URI(new File(filePath).getAbsolutePath()); } FileSystem fs = FileSystem.get(u); if (fs.exists(new Path(u.getPath()))) { this.cacheFile.put(name, u.toString()); } else { throw new RuntimeException("File " + u.toString() + " doesn't exist."); } } catch (URISyntaxException ex) { throw new RuntimeException("Invalid path: " + filePath, ex); } } else { throw new RuntimeException("cache file " + name + "already exists!"); } }
Source:
public static void checkAcidTable(CatalogTable catalogTable, ObjectPath tablePath) { if (catalogTable != null && catalogTable.getOptions() != null) { String tableIsTransactional = catalogTable.getOptions().get("transactional"); if (tableIsTransactional == null) { tableIsTransactional = catalogTable.getOptions().get("transactional".toUpperCase()); } if (tableIsTransactional != null && tableIsTransactional.equalsIgnoreCase("true")) { throw new FlinkHiveException(String.format("Reading or writing ACID table %s is not supported.", tablePath)); } } }

Target:
public static void checkAcidTable(CatalogTable catalogTable, ObjectPath tablePath) { String tableIsTransactional = catalogTable.getOptions().get("transactional"); if (tableIsTransactional == null) { tableIsTransactional = catalogTable.getOptions().get("transactional".toUpperCase()); } if (tableIsTransactional != null && tableIsTransactional.equalsIgnoreCase("true")) { throw new FlinkHiveException(String.format("Reading or writing ACID table %s is not supported.", tablePath)); } }
Source:
private double calculateWeightedAverageResponse(List<DiseaseOccurrenceReview> reviews) { double weightedResponseTotal = 0.0; double expertWeightingsTotal = 0.0; for (DiseaseOccurrenceReview review : reviews) { double expertWeighting = review.getExpert().getWeighting(); weightedResponseTotal += review.getResponse().getValue() * expertWeighting; expertWeightingsTotal += expertWeighting; } double normalisedValue = weightedResponseTotal / expertWeightingsTotal; return shift(normalisedValue); }

Target:
private double calculateWeightedAverageResponse(List<DiseaseOccurrenceReview> reviews) { double weightedResponseTotal = 0.0; double expertWeightingsTotal = 0.0; for (DiseaseOccurrenceReview review : reviews) { double expertWeighting = review.getExpert().getWeighting(); weightedResponseTotal += review.getResponse().getValue() * expertWeighting; expertWeightingsTotal += expertWeighting; } return (expertWeightingsTotal == 0.0) ? 0.0 : shift(weightedResponseTotal / expertWeightingsTotal); }
Source:
private AuthConfig authConfigUsingStore(final JsonNode config, final String reposName) throws Exception { final JsonNode credsStoreNode = config.get("credsStore"); if (credsStoreNode != null && !credsStoreNode.isMissingNode() && credsStoreNode.isTextual()) { final String credsStore = credsStoreNode.asText(); if (isBlank(credsStore)) { log.warn("CredStore field will be ignored, because value is blank"); return null; } return runCredentialProvider(reposName, credsStore); } return null; }

Target:
private AuthConfig authConfigUsingStore(final JsonNode config, final String reposName) throws Exception { final JsonNode credsStoreNode = config.get("credsStore"); if (credsStoreNode != null && !credsStoreNode.isMissingNode() && credsStoreNode.isTextual()) { final String credsStore = credsStoreNode.asText(); if (isBlank(credsStore)) { log.warn("Docker auth config credsStore field will be ignored, because value is blank"); return null; } return runCredentialProvider(reposName, credsStore); } return null; }
Source:
public void testShutdown() { final int POOL_SIZE = 25; final int CHECKOUT = POOL_SIZE; SynchronousLifecycle lifecycle = new SynchronousLifecycle(); final AsyncPool<AtomicBoolean> pool = new AsyncPoolImpl<AtomicBoolean>("object pool", lifecycle, POOL_SIZE, 100, _executor ); pool.start(); List<AtomicBoolean> objects = new ArrayList<AtomicBoolean>(CHECKOUT); for (int i = 0; i < CHECKOUT; i++) { FutureCallback<AtomicBoolean> cb = new FutureCallback<AtomicBoolean>(); pool.get(cb); try { AtomicBoolean o = cb.get(); Assert.assertNotNull(o); objects.add(o); } catch (Exception e) { Assert.fail("unexpected error", e); } } FutureCallback<None> shutdown = new FutureCallback<None>(); pool.shutdown(shutdown); for (AtomicBoolean o : objects) { Assert.assertFalse(shutdown.isDone(), "Pool shutdown with objects checked out"); pool.put(o); } try { shutdown.get(); } catch (Exception e) { Assert.fail("unexpected error", e); } }

Target:
public void testShutdown() { final int POOL_SIZE = 25; final int CHECKOUT = POOL_SIZE; SynchronousLifecycle lifecycle = new SynchronousLifecycle(); final AsyncPool<Object> pool = new AsyncPoolImpl<Object>("object pool", lifecycle, POOL_SIZE, 100, _executor ); pool.start(); List<Object> objects = new ArrayList<Object>(CHECKOUT); for (int i = 0; i < CHECKOUT; i++) { FutureCallback<Object> cb = new FutureCallback<Object>(); pool.get(cb); try { Object o = cb.get(); Assert.assertNotNull(o); objects.add(o); } catch (Exception e) { Assert.fail("unexpected error", e); } } FutureCallback<None> shutdown = new FutureCallback<None>(); pool.shutdown(shutdown); for (Object o : objects) { Assert.assertFalse(shutdown.isDone(), "Pool shutdown with objects checked out"); pool.put(o); } try { shutdown.get(); } catch (Exception e) { Assert.fail("unexpected error", e); } }
Source:
HdfsConfiguration createHdfsConfiguration(HiveClientConfig config) { S3ConfigurationUpdater s3Config = new PrestoS3ConfigurationUpdater(new HiveS3Config() .setS3AwsAccessKey(awsAccessKey) .setS3AwsSecretKey(awsSecretKey)); return new HiveHdfsConfiguration(new HdfsConfigurationUpdater(config, s3Config), emptySet()); }

Target:
HdfsConfiguration createHdfsConfiguration(HiveClientConfig config) { S3ConfigurationUpdater s3Config = new PrestoS3ConfigurationUpdater(new HiveS3Config() .setS3AwsAccessKey(awsAccessKey) .setS3AwsSecretKey(awsSecretKey)); return new HiveHdfsConfiguration(new HdfsConfigurationInitializer(config, s3Config, ignored -> {}), ImmutableSet.of()); }
Source:
private static byte[] generateData(int len) { byte[] bytes = new byte[len]; new Random().nextBytes(bytes); return bytes; }

Target:
static byte[] generateData(int len) { byte[] bytes = new byte[len]; new Random().nextBytes(bytes); return bytes; }
Source:
protected void addSegment(final DruidServerMetadata server, final DataSegment segment) { synchronized (lock) { final Map<DataSegment, SegmentMetadataHolder> knownSegments = segmentMetadataInfo.get(segment.getDataSource()); SegmentMetadataHolder holder = knownSegments != null ? knownSegments.get(segment) : null; if (holder == null) { final long isRealtime = server.segmentReplicatable() ? 0 : 1; final Set<String> servers = ImmutableSet.of(server.getName()); holder = SegmentMetadataHolder.builder( segment.getId(), IS_PUBLISHED, IS_AVAILABLE, isRealtime, servers, null, NUM_ROWS ).build(); setSegmentMetadataHolder(segment, holder); segmentsNeedingRefresh.add(segment); if (!server.segmentReplicatable()) { log.debug("Added new mutable segment[%s].", segment.getId()); mutableSegments.add(segment); } else { log.debug("Added new immutable segment[%s].", segment.getId()); } } else { final Set<String> segmentServers = holder.getReplicas(); final ImmutableSet<String> servers = new ImmutableSet.Builder<String>() .addAll(segmentServers) .add(server.getName()) .build(); final SegmentMetadataHolder holderWithNumReplicas = SegmentMetadataHolder .from(holder) .withReplicas(servers) .build(); knownSegments.put(segment, holderWithNumReplicas); if (server.segmentReplicatable()) { mutableSegments.remove(segment); log.debug("Segment[%s] has become immutable.", segment.getId()); } } if (!tables.containsKey(segment.getDataSource())) { refreshImmediately = true; } lock.notifyAll(); } }

Target:
void addSegment(final DruidServerMetadata server, final DataSegment segment) { synchronized (lock) { final Map<DataSegment, SegmentMetadataHolder> knownSegments = segmentMetadataInfo.get(segment.getDataSource()); SegmentMetadataHolder holder = knownSegments != null ? knownSegments.get(segment) : null; if (holder == null) { final long isRealtime = server.segmentReplicatable() ? 0 : 1; final Set<String> servers = ImmutableSet.of(server.getName()); holder = SegmentMetadataHolder.builder( segment.getId(), DEFAULT_IS_PUBLISHED, DEFAULT_IS_AVAILABLE, isRealtime, servers, null, DEFAULT_NUM_ROWS ).build(); setSegmentMetadataHolder(segment, holder); segmentsNeedingRefresh.add(segment); if (!server.segmentReplicatable()) { log.debug("Added new mutable segment[%s].", segment.getId()); mutableSegments.add(segment); } else { log.debug("Added new immutable segment[%s].", segment.getId()); } } else { final Set<String> segmentServers = holder.getReplicas(); final ImmutableSet<String> servers = new ImmutableSet.Builder<String>() .addAll(segmentServers) .add(server.getName()) .build(); final SegmentMetadataHolder holderWithNumReplicas = SegmentMetadataHolder .from(holder) .withReplicas(servers) .build(); knownSegments.put(segment, holderWithNumReplicas); if (server.segmentReplicatable()) { mutableSegments.remove(segment); log.debug("Segment[%s] has become immutable.", segment.getId()); } } if (!tables.containsKey(segment.getDataSource())) { refreshImmediately = true; } lock.notifyAll(); } }
Source:
void readLogFile() { getDisplay().asyncExec(() -> setContentDescription(Messages.LogView_readLog_loading)); fetchLogEntries().thenAccept(this::updateLogViewer); }

Target:
void readLogFile() { setContentDescription(Messages.LogView_readLog_loading); fetchLogEntries().thenAccept(this::updateLogViewer); }
Source:
private Map<String, Object> addPropertyTyping(Map<String, Object> properties) { Map<String, Object> result = new HashMap<>(); for (Map.Entry<String,Object> entry : properties.entrySet()) { if (!entry.getKey().equals(PARTITION_KEY) && !entry.getKey().equals(ROW_KEY) && !entry.getKey().equals("Timestamp") && !entry.getKey().equals("Etag") && !entry.getKey().equals("odata.etag") && !entry.getKey().equals("odata.metadata")) { String key = entry.getKey().concat(ODataConstants.ODATA_TYPE_SUFFIX); String value = getEntityProperty(entry.getValue().getClass()).toString(); result.put(key, value); } result.put(entry.getKey(), entry.getValue()); } return result; }

Target:
private Map<String, Object> addPropertyTyping(Map<String, Object> properties) { Map<String, Object> result = new HashMap<>(); for (Map.Entry<String, Object> entry : properties.entrySet()) { if (!entry.getKey().equals(PARTITION_KEY) && !entry.getKey().equals(ROW_KEY) && !entry.getKey().equals(TIMESTAMP) && !entry.getKey().equals(ETAG) && !entry.getKey().equals(ETAG_KEY) && !entry.getKey().equals(ODATA_METADATA_KEY)) { String key = entry.getKey().concat(ODataConstants.ODATA_TYPE_SUFFIX); String value = getEntityProperty(entry.getValue().getClass()).toString(); result.put(key, value); } result.put(entry.getKey(), entry.getValue()); } return result; }
Source:
public Set<LeaveGroupRequestData.MemberIdentity> members() { return members; }

Target:
public Set<MemberToRemove> members() { return members; }
Source:
public void bindProducer(String name, MessageChannel outboundBindTarget, Properties properties) { BridgeHandler bridge = new BridgeHandler(); QueueChannel queue = new QueueChannel(); bridge.setOutputChannel(queue); AbstractEndpoint ae = new EventDrivenConsumer((SubscribableChannel) outboundBindTarget, bridge); ae.setBeanName("outbound." + name); Binding binding = Binding.forConsumer(name, ae, outboundBindTarget, new NullPropertiesAccessor(properties)); addBinding(binding); channelToBindings.put(outboundBindTarget, queue); binding.start(); }

Target:
public void bindProducer(String name, MessageChannel outboundBindTarget, Properties properties) { final BlockingQueue queue = messageCollector.register(outboundBindTarget); ((SubscribableChannel)outboundBindTarget).subscribe(new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { queue.add(message); } }); }
Source:
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_my_custom, container, false); RecyclerView recyclerView = view.findViewById(R.id.recyclerView_dialog); list.add(new CustomDialogModel("Take a photo", R.drawable.ic_photo_camera)); list.add(new CustomDialogModel("Choose photo", R.drawable.ic_photo_library)); if (showRemoveButton) list.add(new CustomDialogModel("Remove photo", R.drawable.ic_photo_delete)); CustomDialogAdapter adapter = new CustomDialogAdapter(getActivity(), list); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setHasFixedSize(false); recyclerView.setAdapter(adapter); return view; }

Target:
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_my_custom, container, false); RecyclerView recyclerView = view.findViewById(R.id.recyclerView_dialog); list.add(new CustomDialogModel(getString(R.string.dialog_take_photo), R.drawable.ic_photo_camera)); list.add(new CustomDialogModel(getString(R.string.dialog_choose_photo), R.drawable.ic_photo_library)); if (showRemoveButton) { list.add(new CustomDialogModel(getString(R.string.dialog_remove_photo), R.drawable.ic_photo_delete)); } CustomDialogAdapter adapter = new CustomDialogAdapter(getActivity(), list); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setHasFixedSize(false); recyclerView.setAdapter(adapter); return view; }
Source:
public void removeTraverseListener(TraverseListener listener) { if (this.text != null && !this.text.isDisposed()) this.text.removeTraverseListener(listener); if (this.dropdownTableViewer != null && !this.dropdownTable.isDisposed()) this.dropdownTable.removeTraverseListener(listener); }

Target:
public void removeTraverseListener(TraverseListener listener) { if (this.text != null && !this.text.isDisposed()) this.text.removeTraverseListener(listener); if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.removeTraverseListener(listener); }
Source:
protected void sendMetricPoint(String metricName, double value, String[] tags) { if (System.currentTimeMillis() - this.initializationTime > 300 * 1000) { this.statsDClient.stop(); init(); } statsDClient.gauge(StatsdReporter.formatDataName(metricName), value, tags); }

Target:
protected void sendMetricPoint(String metricName, double value, String[] tags) { if (System.currentTimeMillis() - this.initializationTime > 300 * 1000) { this.statsDClient.stop(); init(); } statsDClient.gauge(metricName, value, tags); }
Source:
public String toString() { return getClass().getSimpleName() + "{" + "sdkVersion=" + SDK_VERSION + ", error=" + cosmosError + ", resourceAddress='" + resourceAddress + '\'' + ", statusCode=" + statusCode + ", message=" + getMessage() + ", causeInfo=" + causeInfo() + ", responseHeaders=" + responseHeaders + ", requestHeaders=" + filterSensitiveData(requestHeaders) + '}'; }

Target:
public String toString() { return getClass().getSimpleName() + "{" + "userAgent=" + USER_AGENT + ", error=" + cosmosError + ", resourceAddress='" + resourceAddress + '\'' + ", statusCode=" + statusCode + ", message=" + getMessage() + ", causeInfo=" + causeInfo() + ", responseHeaders=" + responseHeaders + ", requestHeaders=" + filterSensitiveData(requestHeaders) + '}'; }
Source:
public boolean isValid(Map<String, Object> theMap, ConstraintValidatorContext context) { if (theMap == null) { return true; } return theMap.values().stream() .filter(value -> value == null || !allowedTypes.contains(value.getClass())) .collect(Collectors.toList()) .size() == 0; }

Target:
public boolean isValid(Map<String, Object> theMap, ConstraintValidatorContext context) { if (theMap == null) { return true; } return theMap.values().stream() .filter(Objects::nonNull) .map(Object::getClass) .allMatch(this::validType); }
Source:
private String removeFileSeparatorFromBorders(String pathToBeCleaned, boolean onlyTrailing) { if (null == pathToBeCleaned || pathToBeCleaned.equals("")) return pathToBeCleaned; int beginIndex = 0; int endIndex = pathToBeCleaned.length(); if (!onlyTrailing) { if (pathToBeCleaned.substring(0, 1).equals("/") || pathToBeCleaned.substring(0, 1).equals("\\")) beginIndex = 1; } if (pathToBeCleaned.substring(pathToBeCleaned.length() - 1).equals("/") || pathToBeCleaned.substring(pathToBeCleaned.length() - 1).equals("\\")) endIndex--; return pathToBeCleaned.substring(beginIndex, endIndex); }

Target:
private String removeFileSeparatorFromBorders(String pathToBeCleaned, boolean onlyTrailing) { if (null == pathToBeCleaned || pathToBeCleaned.equals("")) return pathToBeCleaned; int beginIndex = 0; int endIndex = pathToBeCleaned.length(); if (!onlyTrailing) { if (pathToBeCleaned.charAt(0) == '/' || pathToBeCleaned.charAt(0) == '\\') beginIndex = 1; } if (pathToBeCleaned.charAt(pathToBeCleaned.length() - 1) == '/' || pathToBeCleaned.charAt(pathToBeCleaned.length() - 1) == '\\') endIndex--; return pathToBeCleaned.substring(beginIndex, endIndex); }
Source:
public void sendAsync(final Context context, final Command command, final Callback<CommandResponse> callback) { checkNotNull(command); checkNotNull(context); final AsyncWebResource.Builder builder = configureBuilder( context, client.asyncResource(resolveCommandPath(command.getClass())) ); builder.put(new TypeListener<ClientResponse>(ClientResponse.class) { @Override public void onComplete(final Future<ClientResponse> f) throws InterruptedException { try { callback.done(handleCommandResponse(f.get(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS))); } catch (final ExecutionException e) { throw new KasperException(String.format( "ERROR handling command [%s]", command.getClass()), e ); } catch (TimeoutException e) { throw new KasperException(String.format( "ERROR handling command [%s]. Timeout exception.", command.getClass()), e ); } } }, command); }

Target:
public void sendAsync(final Context context, final Command command, final Callback<CommandResponse> callback) { checkNotNull(command); checkNotNull(context); final AsyncWebResource.Builder builder = configureBuilder( context, client.asyncResource(resolveCommandPath(command.getClass())) ); builder.put(new TypeListener<ClientResponse>(ClientResponse.class) { @Override public void onComplete(final Future<ClientResponse> f) throws InterruptedException { try { ClientResponse clientResponse = f.get(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS); try { callback.done(handleCommandResponse(clientResponse)); } finally { closeClientResponse(clientResponse); } } catch (final ExecutionException e) { throw new KasperException(String.format( "ERROR handling command [%s]", command.getClass()), e ); } catch (TimeoutException e) { f.cancel(true); throw new KasperException(String.format( "ERROR handling command [%s]. Timeout exception.", command.getClass()), e ); } } }, command); }
Source:
public void fire() { int fireCycle = 0; while (!pendingData.isEmpty() || !pendingEvent.isEmpty()) { log.debugf("Data found. Firing rules on [%1$d] datums and [%1$d] events.", pendingData.size(), pendingEvent.size()); TreeSet<Data> batchData = new TreeSet<Data>(pendingData); Data previousData = null; pendingData.clear(); for (Data data : batchData) { if (null == previousData || !data.getId().equals(previousData.getId())) { kSession.insert(data); previousData = data; } else { pendingData.add(data); log.debugf("Deferring more recent %1$s until older %2$s is processed", data, previousData); } } if (!pendingData.isEmpty()) { log.debugf("Deferring [%1$d] Datum(s) to next firing !!", pendingData.size()); } batchData.clear(); TreeSet<Event> batchEvent = new TreeSet<Event>(pendingEvent); Event previousEvent = null; pendingEvent.clear(); for (Event event : batchEvent) { if (null == previousEvent || (null != event.getDataId() && !event.getDataId().equals(previousEvent.getDataId()))) { kSession.insert(event); previousEvent = event; } else { pendingEvent.add(event); log.debugf("Deferring more recent %1$s until older %2$s is processed", event, previousEvent); } } if (log.isDebugEnabled()) { log.debugf("Firing cycle [%s] - with these facts: ", fireCycle); for (FactHandle fact : kSession.getFactHandles()) { Object o = kSession.getObject(fact); log.debugf("Fact: %s", o.toString()); } } kSession.fireAllRules(); fireCycle++; } }

Target:
public void fire() { int fireCycle = 0; while (!pendingData.isEmpty() || !pendingEvents.isEmpty()) { log.debugf("Data found. Firing rules on [%1$d] datums and [%1$d] events.", pendingData.size(), pendingEvents.size()); TreeSet<Data> batchData = new TreeSet<Data>(pendingData); Data previousData = null; pendingData.clear(); for (Data data : batchData) { if (null == previousData || !data.getId().equals(previousData.getId())) { kSession.insert(data); previousData = data; } else { pendingData.add(data); log.debugf("Deferring more recent %1$s until older %2$s is processed", data, previousData); } } if (!pendingData.isEmpty()) { log.debugf("Deferring [%1$d] Datum(s) to next firing !!", pendingData.size()); } batchData.clear(); TreeSet<Event> batchEvent = new TreeSet<Event>(pendingEvents); Event previousEvent = null; pendingEvents.clear(); for (Event event : batchEvent) { if (null == previousEvent || (null != event.getDataId() && !event.getDataId().equals(previousEvent.getDataId()))) { kSession.insert(event); previousEvent = event; } else { pendingEvents.add(event); log.debugf("Deferring more recent %1$s until older %2$s is processed", event, previousEvent); } } if (log.isDebugEnabled()) { log.debugf("Firing cycle [%s] - with these facts: ", fireCycle); for (FactHandle fact : kSession.getFactHandles()) { Object o = kSession.getObject(fact); log.debugf("Fact: %s", o.toString()); } } kSession.fireAllRules(); fireCycle++; } }
Source:
protected boolean persistString(String value) { if (shouldPersist()) { String persistedString = getPersistedString(null); if ((value == null && persistedString == null) || (value != null && value.equals(persistedString))) { return true; } SharedPreferences.Editor editor = mPreferenceManager.getEditor(); editor.putString(mKey, value); tryCommit(editor); return true; } return false; }

Target:
protected boolean persistString(String value) { if (shouldPersist()) { if (TextUtils.equals(value, getPersistedString(null))) { return true; } SharedPreferences.Editor editor = mPreferenceManager.getEditor(); editor.putString(mKey, value); tryCommit(editor); return true; } return false; }
Source:
public void setLocation(String location, Job job) throws IOException { if (DEBUG) LOG.debug("LoadFunc.setLocation(" + location + ", job)"); setInput(location, job); }

Target:
public void setLocation(String location, Job job) throws IOException { if (DEBUG) { String jobToString = String.format("job[id=%s, name=%s]", job.getJobID(), job.getJobName()); LOG.debug("LoadFunc.setLocation(" + location + ", " + jobToString + ")"); } setInput(location, job); }
Source:
public static String preProcess(String swaggerContent) throws APIManagementException { APIDefinition apiDefinition = getOASParser(swaggerContent); swaggerContent = apiDefinition.processOtherSchemeScopes(swaggerContent); return apiDefinition.processLegacyScopes(swaggerContent); }

Target:
public static String preProcess(String swaggerContent) throws APIManagementException { APIDefinition apiDefinition = getOASParser(swaggerContent); return apiDefinition.processOtherSchemeScopes(swaggerContent); }
Source:
private void updateMetaDataDescription(DiskImage diskImage) { try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters(getVm().getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), getJsonDiskDescription()); runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); } catch (Exception e) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0), getVm().getStoragePoolId()); AuditLogableBase auditLogableBase = new AuditLogableBase(); auditLogableBase.addCustomValue("DataCenterName", getStoragePool().getName()); auditLogableBase.addCustomValue("StorageDomainName", storageDomain.getName()); auditLogableBase.addCustomValue("DiskName", diskImage.getDiskAlias()); AuditLogDirector.log(auditLogableBase, AuditLogType.UPDATE_DESCRIPTION_FOR_DISK_FAILED); } }

Target:
private void updateMetaDataDescription(DiskImage diskImage) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0), getVm().getStoragePoolId()); try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters(getVm().getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), getJsonDiskDescription()); runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); } catch (Exception e) { log.error("Exception while setting volume description for disk. ERROR: '{}'", e); AuditLogableBase auditLogableBase = new AuditLogableBase(); auditLogableBase.addCustomValue("DataCenterName", getStoragePool().getName()); auditLogableBase.addCustomValue("StorageDomainName", storageDomain.getName()); auditLogableBase.addCustomValue("DiskName", diskImage.getDiskAlias()); AuditLogDirector.log(auditLogableBase, AuditLogType.UPDATE_DESCRIPTION_FOR_DISK_FAILED); } }
Source:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); context.record(TransformLineageRecorderUtils .oneToOneIn(new ArrayList<>(fieldNames), "multiParse", "Parse an XML event using XPath.")); }

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); context.record(TransformLineageRecorderUtils .generateOneToMany(config.field, TransformLineageRecorderUtils.getFields(context.getOutputSchema()), "multiParse", "Parsed an XML event using XPath.")); }
Source:
protected int getExifOrientation(Request request) throws IOException { ContentResolver contentResolver = context.getContentResolver(); InputStream inputStream = contentResolver.openInputStream(request.uri); ExifInterface exifInterface = new ExifInterface(inputStream); return exifInterface.getAttributeInt(TAG_ORIENTATION, ORIENTATION_NORMAL); }

Target:
protected int getExifOrientation(Request request) throws IOException { ContentResolver contentResolver = context.getContentResolver(); InputStream inputStream = null; try { inputStream = contentResolver.openInputStream(request.uri); ExifInterface exifInterface = new ExifInterface(inputStream); return exifInterface.getAttributeInt(TAG_ORIENTATION, ORIENTATION_NORMAL); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException ignored) { } } }
Source:
private BuildConfig createBuildConfigWithLabels(IProject project, String name, HashMap<String, String> labelFilter) { BuildConfig bc = factory.stub(BUILD_CONFIG, name); if (labelFilter != null && !labelFilter.isEmpty()) { for (Map.Entry<String, String> label : labelFilter.entrySet()) { bc.addLabel(label.getKey(), label.getValue()); } } bc = client.create(bc, project.getNamespace()); assertNotNull("Exp. the bc to be found but was not", waitForResource(client, BUILD_CONFIG, project.getName(), bc.getName(), 5 * MILLISECONDS_PER_SECOND)); return bc; }

Target:
private static IBuildConfig createBuildConfigWithLabels(IProject project, String name, HashMap<String, String> labelFilter) { IBuildConfig bc = new BuildConfigBuilder(client) .named(name) .inNamespace(project.getNamespace()) .usingSourceStrategy() .fromDockerImage("centos/ruby-22-centos7:latest") .end() .toImageStreamTag("ruby-hello-world:latest") .withLabels(labelFilter) .build(); return client.create(bc); }
Source:
public void testGetTagForProject() throws Exception { String projectName = "sandbox"; ArrayList<TagInfo> mockTags = Lists.newArrayList(); mockTags.add(MOCK_TAG_INFO); GerritRestClient gerritRestClient = new GerritRestClientBuilder() .expectGet("/projects/sandbox/tags/v0.0.1", MOCK_JSON_ELEMENT) .get(); ProjectsParser projectsParser = new ProjectsParserBuilder() .expectParseSingleProjectInfo(MOCK_JSON_ELEMENT, MOCK_PROJECT_INFO) .get(); BranchInfoParser branchInfoParser = new BranchInfoParserBuilder() .get(); TagInfoParser tagInfoParser = new TagInfoParserBuilder() .expectParseTagInfos(MOCK_JSON_ELEMENT, mockTags) .get(); ProjectApiRestClient projectApiRestClient = new ProjectApiRestClient(gerritRestClient, projectsParser, branchInfoParser, tagInfoParser, projectName); TagInfo tags = projectApiRestClient.tag("v0.0.1") .get(); Truth.assertThat(tags.equals(mockTags)); }

Target:
public void testGetTagForProject() throws Exception { String projectName = "sandbox"; ArrayList<TagInfo> mockTags = Lists.newArrayList(); mockTags.add(MOCK_TAG_INFO); GerritRestClient gerritRestClient = new GerritRestClientBuilder() .expectGet("/projects/sandbox/tags/v0.0.1", MOCK_JSON_ELEMENT) .get(); ProjectsParser projectsParser = new ProjectsParserBuilder() .expectParseSingleProjectInfo(MOCK_JSON_ELEMENT, MOCK_PROJECT_INFO) .get(); BranchInfoParser branchInfoParser = new BranchInfoParserBuilder() .get(); TagInfoParser tagInfoParser = new TagInfoParserBuilder() .expectParseTagInfos(MOCK_JSON_ELEMENT, mockTags) .get(); ProjectApiRestClient projectApiRestClient = new ProjectApiRestClient(gerritRestClient, projectsParser, branchInfoParser, tagInfoParser, projectName); TagInfo tags = projectApiRestClient.tag("v0.0.1") .get(); Truth.assertThat(tags.equals(MOCK_TAG_INFO)); }
Source:
public ScopeTimer(final AceEditor editor) { timer_ = new Timer() { @Override public void run() { if (row_ >= editor.getRowCount()) return; row_ += 200; row_ = editor.buildScopeTreeUpToRow(row_); timer_.schedule(DELAY_MS); } }; row_ = 0; editor.addCursorChangedHandler(new CursorChangedHandler() { @Override public void onCursorChanged(CursorChangedEvent event) { int row = event.getPosition().getRow(); row_ = row; timer_.schedule(editor.getSuggestedScopeUpdateDelay() / 2); } }); }

Target:
public ScopeTimer(final AceEditor editor) { timer_ = new Timer() { @Override public void run() { if (row_ >= editor.getRowCount()) return; row_ += ROWS_TOKENIZED_PER_ITERATION; row_ = editor.buildScopeTreeUpToRow(row_); timer_.schedule(DELAY_MS); } }; editor.addCursorChangedHandler(new CursorChangedHandler() { @Override public void onCursorChanged(CursorChangedEvent event) { int row = event.getPosition().getRow(); row_ = row; timer_.schedule(editor.getSuggestedScopeUpdateDelay() / 2); } }); }