auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void testUseCache( List<Result> expectedResults, Query query, QueryToolChest toolchest ) throws Exception { DefaultObjectMapper objectMapper = new DefaultObjectMapper(); String segmentIdentifier = "segment"; SegmentDescriptor segmentDescriptor = new SegmentDescriptor(Intervals.of("2011/2012"), "version", 0); CacheStrategy cacheStrategy = toolchest.getCacheStrategy(query); Cache.NamedKey cacheKey = CacheUtil.computeSegmentCacheKey( segmentIdentifier, segmentDescriptor, cacheStrategy.computeCacheKey(query) ); Cache cache = MapCache.create(1024 * 1024); CacheUtil.populate( cache, objectMapper, cacheKey, Iterables.transform(expectedResults, cacheStrategy.prepareForCache()), 0 ); CachingQueryRunner runner = new CachingQueryRunner( segmentIdentifier, segmentDescriptor, objectMapper, cache, toolchest, new QueryRunner() { @Override public Sequence run(QueryPlus queryPlus, Map responseContext) { return Sequences.empty(); } }, backgroundExecutorService, new CacheConfig() { @Override public boolean isPopulateCache() { return true; } @Override public boolean isUseCache() { return true; } } ); HashMap<String, Object> context = new HashMap<String, Object>(); List<Result> results = Sequences.toList(runner.run(QueryPlus.wrap(query), context), new ArrayList()); Assert.assertEquals(expectedResults.toString(), results.toString()); }

Target:
private void testUseCache( List<Result> expectedResults, Query query, QueryToolChest toolchest ) { DefaultObjectMapper objectMapper = new DefaultObjectMapper(); String segmentIdentifier = "segment"; SegmentDescriptor segmentDescriptor = new SegmentDescriptor(Intervals.of("2011/2012"), "version", 0); CacheStrategy cacheStrategy = toolchest.getCacheStrategy(query); Cache.NamedKey cacheKey = CacheUtil.computeSegmentCacheKey( segmentIdentifier, segmentDescriptor, cacheStrategy.computeCacheKey(query) ); Cache cache = MapCache.create(1024 * 1024); CacheUtil.populate( cache, objectMapper, cacheKey, Iterables.transform(expectedResults, cacheStrategy.prepareForSegmentLevelCache()) ); CachingQueryRunner runner = new CachingQueryRunner( segmentIdentifier, segmentDescriptor, objectMapper, cache, toolchest, new QueryRunner() { @Override public Sequence run(QueryPlus queryPlus, Map responseContext) { return Sequences.empty(); } }, backgroundExecutorService, new CacheConfig() { @Override public boolean isPopulateCache() { return true; } @Override public boolean isUseCache() { return true; } } ); HashMap<String, Object> context = new HashMap<String, Object>(); List<Result> results = runner.run(QueryPlus.wrap(query), context).toList(); Assert.assertEquals(expectedResults.toString(), results.toString()); }
Source:
public void testStoredKeyTypeMismatch() { ServerStoreConfiguration serverConfiguration = new ServerStoreConfiguration(FIXED_POOL_ALLOCATION, STORED_KEY_TYPE, STORED_VALUE_TYPE, ACTUAL_KEY_TYPE, ACTUAL_VALUE_TYPE, KEY_SERIALIZER_TYPE, VALUE_SERIALIZER_TYPE, Consistency.EVENTUAL); ServerStoreConfiguration clientConfiguration = new ServerStoreConfiguration(FIXED_POOL_ALLOCATION, String.class.getName(), STORED_VALUE_TYPE, ACTUAL_KEY_TYPE, ACTUAL_VALUE_TYPE, KEY_SERIALIZER_TYPE, VALUE_SERIALIZER_TYPE, Consistency.EVENTUAL); ServerStoreCompatibility serverStoreCompatibility = new ServerStoreCompatibility(); try { serverStoreCompatibility.verify(serverConfiguration, clientConfiguration); fail("Expected ClusteredStoreValidationException"); } catch(ClusteredStoreValidationException e) { System.out.println("errorMsg: " + e.getMessage()); Assert.assertTrue("test failed", e.getMessage().equals(ERROR_MESSAGE_BASE + "storedKeyType existing: " + serverConfiguration.getStoredKeyType() + ", desired: " + clientConfiguration.getStoredKeyType())); } }

Target:
public void testStoredKeyTypeMismatch() { ServerStoreConfiguration serverConfiguration = new ServerStoreConfiguration(FIXED_POOL_ALLOCATION, STORED_KEY_TYPE, STORED_VALUE_TYPE, ACTUAL_KEY_TYPE, ACTUAL_VALUE_TYPE, KEY_SERIALIZER_TYPE, VALUE_SERIALIZER_TYPE, Consistency.EVENTUAL); ServerStoreConfiguration clientConfiguration = new ServerStoreConfiguration(FIXED_POOL_ALLOCATION, String.class.getName(), STORED_VALUE_TYPE, ACTUAL_KEY_TYPE, ACTUAL_VALUE_TYPE, KEY_SERIALIZER_TYPE, VALUE_SERIALIZER_TYPE, Consistency.EVENTUAL); ServerStoreCompatibility serverStoreCompatibility = new ServerStoreCompatibility(); try { serverStoreCompatibility.verify(serverConfiguration, clientConfiguration); fail("Expected ClusteredStoreValidationException"); } catch(ClusteredStoreValidationException e) { assertThat("test failed", e.getMessage().equals(ERROR_MESSAGE_BASE + "storedKeyType existing: " + serverConfiguration.getStoredKeyType() + ", desired: " + clientConfiguration.getStoredKeyType()),is(true)); } }
Source:
void setVisibleB(boolean show) { if (show) { removeStyleName(style.hideB()); } else { addStyleName(style.hideB()); } }

Target:
void setVisibleB(boolean show) { if (show) { removeStyleName(style.hideB()); parent.syncScroll(DisplaySide.A); } else { addStyleName(style.hideB()); } }
Source:
public static void parseDeclarationControls(Element element, BeanDefinitionBuilder builder) { NamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-declare", "shouldDeclare"); String admins = element.getAttribute("declared-by"); if (StringUtils.hasText(admins)) { String[] adminBeanNames = admins.split(","); ManagedList<BeanReference> adminBeanRefs = new ManagedList<BeanReference>(); for (String adminBean : adminBeanNames) { adminBeanRefs.add(new RuntimeBeanReference(adminBean.trim())); } builder.addPropertyValue("adminsThatShouldDeclare", adminBeanRefs); } }

Target:
public static void parseDeclarationControls(Element element, BeanDefinitionBuilder builder) { NamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-declare", "shouldDeclare"); String admins = element.getAttribute("declared-by"); if (StringUtils.hasText(admins)) { String[] adminBeanNames = admins.split(","); ManagedList<BeanReference> adminBeanRefs = new ManagedList<BeanReference>(); for (String adminBeanName : adminBeanNames) { adminBeanRefs.add(new RuntimeBeanReference(adminBeanName.trim())); } builder.addPropertyValue("adminsThatShouldDeclare", adminBeanRefs); } }
Source:
protected void init() { updateMigrateOnError(); oldCluster = clusterDao.get(getCluster().getId()); if (oldCluster != null && !Objects.equals(oldCluster.getCompatibilityVersion(), getCluster().getCompatibilityVersion())) { vmsLockedForUpdate = filterVmsInClusterNeedUpdate(); templatesLockedForUpdate = filterTemplatesInClusterNeedUpdate(); } if (oldCluster == null || (oldCluster != null && !oldCluster.getCpuName().equals(getCluster().getCpuName()))) { getParameters().setUpdateCpuFlags(true); } if (getParameters().isUpdateCpuFlags()) { clusterCpuFlagsManager.updateCpuFlags(getCluster()); } }

Target:
protected void init() { updateMigrateOnError(); oldCluster = clusterDao.get(getCluster().getId()); if (oldCluster != null && !Objects.equals(oldCluster.getCompatibilityVersion(), getCluster().getCompatibilityVersion())) { vmsLockedForUpdate = filterVmsInClusterNeedUpdate(); templatesLockedForUpdate = filterTemplatesInClusterNeedUpdate(); } if (oldCluster == null || !Objects.equals(oldCluster.getCpuName(), getCluster().getCpuName())) { getParameters().setUpdateCpuFlags(true); } if (getParameters().isUpdateCpuFlags()) { clusterCpuFlagsManager.updateCpuFlags(getCluster()); } }
Source:
public boolean addRule(RelOptRule rule) { if (locked) { return false; } if (ruleSet.contains(rule)) { return false; } final boolean added = ruleSet.add(rule); assert added; final String ruleName = rule.toString(); if (ruleNames.containsKey(ruleName)) { throw new RuntimeException("Rule description '" + ruleName + "' is not unique. "); } else { ruleNames.put(ruleName, rule); } mapRuleDescription(rule); for (RelOptRuleOperand operand : rule.getOperands()) { for (Class<? extends RelNode> subClass : subClasses(operand.getMatchedClass())) { classOperands.put(subClass, operand); } } if (rule instanceof ConverterRule) { ConverterRule converterRule = (ConverterRule) rule; final RelTrait ruleTrait = converterRule.getInTrait(); final RelTraitDef ruleTraitDef = ruleTrait.getTraitDef(); if (traitDefs.contains(ruleTraitDef)) { ruleTraitDef.registerConverterRule(this, converterRule); } } return true; }

Target:
public boolean addRule(RelOptRule rule) { if (locked) { return false; } if (ruleSet.contains(rule)) { return false; } final boolean added = ruleSet.add(rule); assert added; final String ruleName = rule.toString(); if (ruleNames.put(ruleName, rule) != null) { throw new RuntimeException("Rule description '" + ruleName + "' is not unique. "); } mapRuleDescription(rule); for (RelOptRuleOperand operand : rule.getOperands()) { for (Class<? extends RelNode> subClass : subClasses(operand.getMatchedClass())) { classOperands.put(subClass, operand); } } if (rule instanceof ConverterRule) { ConverterRule converterRule = (ConverterRule) rule; final RelTrait ruleTrait = converterRule.getInTrait(); final RelTraitDef ruleTraitDef = ruleTrait.getTraitDef(); if (traitDefs.contains(ruleTraitDef)) { ruleTraitDef.registerConverterRule(this, converterRule); } } return true; }
Source:
public EquivalenceGenerators( Iterable<? extends EquivalenceGenerator<T>> generators, Set<String> excludedUris, Set<String> excludedIds ) { this.generators = ImmutableList.copyOf(generators); this.excludedUris = excludedUris; this.excludedIds = excludedIds; this.codec = SubstitutionTableNumberCodec.lowerCaseOnly(); }

Target:
private EquivalenceGenerators( Iterable<? extends EquivalenceGenerator<T>> generators, Set<String> excludedUris, Set<String> excludedIds ) { this.generators = ImmutableList.copyOf(generators); this.excludedUris = excludedUris; this.excludedIds = excludedIds; this.codec = SubstitutionTableNumberCodec.lowerCaseOnly(); }
Source:
void renewMessageLock() { Duration renewAfterSeconds = Duration.ofSeconds(1); long takeTimeToProcessMessageMillis = 10000; final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, "id-1", 0); AtomicReference<Integer> renewMessageLockCounter = new AtomicReference<>(0); StepVerifier.create(sender.send(message).thenMany(receiverManual.receive() .take(1) .delayElements(renewAfterSeconds) .map(receivedMessage -> { Disposable disposable = receiverManual.renewMessageLock(receivedMessage.getLockToken()) .repeat(() -> true) .delayElements(renewAfterSeconds) .doOnNext(instant -> { if (instant != null) { logger.info(" Received new refresh time " + instant); renewMessageLockCounter.set(renewMessageLockCounter.get() + 1); } }) .subscribe(); try { Thread.sleep(takeTimeToProcessMessageMillis); } catch (InterruptedException ignored) { } disposable.dispose(); return receivedMessage; }))) .assertNext(Assertions::assertNotNull) .verifyComplete(); Assertions.assertTrue(renewMessageLockCounter.get() > 0); }

Target:
void renewMessageLock() { Duration renewAfterSeconds = Duration.ofSeconds(1); long takeTimeToProcessMessageMillis = 10000; final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, "id-1", 0); AtomicReference<Integer> renewMessageLockCounter = new AtomicReference<>(0); StepVerifier.create(sender.send(message).thenMany(receiverManual.receive() .take(1) .delayElements(renewAfterSeconds) .map(receivedMessage -> { Disposable disposable = receiverManual.renewMessageLock(receivedMessage.getLockToken()) .repeat() .delayElements(renewAfterSeconds) .doOnNext(instant -> { if (instant != null) { logger.info(" Received new refresh time " + instant); renewMessageLockCounter.set(renewMessageLockCounter.get() + 1); } }) .subscribe(); try { Thread.sleep(takeTimeToProcessMessageMillis); } catch (InterruptedException ignored) { } disposable.dispose(); return receivedMessage; }))) .assertNext(receivedMessage -> { Assertions.assertNotNull(receivedMessage.getLockedUntil()); }) .verifyComplete(); Assertions.assertTrue(renewMessageLockCounter.get() > 0); }
Source:
public IndexUpdater newUpdater( final IndexUpdateMode mode ) { IndexUpdater actual = accessor.newUpdater( mode == IndexUpdateMode.ONLINE && forcedIdempotentMode ? IndexUpdateMode.ONLINE_IDEMPOTENT : mode ); return started ? updateCountingUpdater( actual ) : actual; }

Target:
public IndexUpdater newUpdater( final IndexUpdateMode mode ) { IndexUpdater actual = accessor.newUpdater( escalateModeIfNecessary( mode ) ); return started ? updateCountingUpdater( actual ) : actual; }
Source:
private Parser(Module module) throws IOException { if (module.name().endsWith(RuleGrammarGenerator.RULE_CELLS)) { org.kframework.definition.Definition definitionWithBuiltins = Definition.from("require \"domians.k\"", "K"); this.parseInModule = new RuleGrammarGenerator(definitionWithBuiltins, true).getCombinedGrammar(module); } else { this.parseInModule = new ParseInModule(module); } }

Target:
private Parser(Module module) { if (module.name().endsWith(RuleGrammarGenerator.RULE_CELLS)) { org.kframework.definition.Definition definitionWithBuiltins = Definition.from("require \"domians.k\"", "K"); this.parseInModule = new RuleGrammarGenerator(definitionWithBuiltins, true).getCombinedGrammar(module); } else { this.parseInModule = new ParseInModule(module); } }
Source:
protected LoginPackage preLogin() throws BankException, IOException { try { urlopen = login(); LoginPackage lp = new LoginPackage(urlopen, null, response, "<LINK_0>"); lp.setIsLoggedIn(true); return lp; } catch (LoginException e) { return null; } }

Target:
protected LoginPackage preLogin() throws BankException, IOException { try { urlopen = login(); LoginPackage lp = new LoginPackage(urlopen, null, response, OVERVIEW_URL); lp.setIsLoggedIn(true); return lp; } catch (LoginException e) { return null; } }
Source:
protected void endVmCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { final boolean taskGroupSucceeded = getParameters().getTaskGroupSuccess(); Snapshot createdSnapshot = getSnapshotDao().get(getVmId(), getParameters().getSnapshotType(), SnapshotStatus.LOCKED); if (taskGroupSucceeded) { getSnapshotDao().updateStatus(createdSnapshot.getId(), SnapshotStatus.OK); if (isLiveSnapshotApplicable()) { performLiveSnapshot(createdSnapshot); } else if (!createdSnapshot.getMemoryVolume().isEmpty() && getVm() != null) { String[] strings = getVm().getHibernationVolHandle().split(","); Guid[] guids = new Guid[strings.length]; for (int i=0; i<strings.length; ++i) { guids[i] = new Guid(strings[i]); } VDSReturnValue vdsRetValue1 = runVdsCommand( VDSCommandType.DeleteImageGroup, new DeleteImageGroupVDSCommandParameters(guids[1], guids[0], guids[2], false, false, getVm().getVdsGroupCompatibilityVersion().toString())); if (!vdsRetValue1.getSucceeded()) { } } } else { revertToActiveSnapshot(createdSnapshot.getId()); } incrementVmGeneration(); endActionOnDisks(); setSucceeded(taskGroupSucceeded); getReturnValue().setEndActionTryAgain(false); return null; } }); if (getVm() != null && getVm().isAutoStartup() && isVmDownUnintentionally() && getParameters().getInitialVmStatus() != VMStatus.Down) { Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(getVmId()), ExecutionHandler.createInternalJobContext()); } }

Target:
protected void endVmCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { final boolean taskGroupSucceeded = getParameters().getTaskGroupSuccess(); Snapshot createdSnapshot = getSnapshotDao().get(getVmId(), getParameters().getSnapshotType(), SnapshotStatus.LOCKED); if (taskGroupSucceeded) { getSnapshotDao().updateStatus(createdSnapshot.getId(), SnapshotStatus.OK); if (isLiveSnapshotApplicable()) { performLiveSnapshot(createdSnapshot); } } else { revertToActiveSnapshot(createdSnapshot.getId()); } incrementVmGeneration(); endActionOnDisks(); setSucceeded(taskGroupSucceeded); getReturnValue().setEndActionTryAgain(false); return null; } }); if (getVm() != null && getVm().isAutoStartup() && isVmDownUnintentionally() && getParameters().getInitialVmStatus() != VMStatus.Down) { Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(getVmId()), ExecutionHandler.createInternalJobContext()); } }
Source:
public OAuth2InitialClientMessage parseInitialClientMessage(byte[] fromBytes) throws AuthenticationMechanismException { byte[] messageBytes = fromBytes.clone(); ByteIterator byteIterator = ByteIterator.ofBytes(fromBytes.clone()); try { final char cbindFlag = (char) byteIterator.next(); if (cbindFlag != 'n') { throw ElytronMessages.log.mechChannelBindingNotSupported(this.mechanismName); } String authorizationID = null; if (byteIterator.next() == ',') { final int c = byteIterator.next(); if (c == 'a') { if (byteIterator.next() != '=') { throw log.mechInvalidClientMessage(this.mechanismName); } authorizationID = byteIterator.delimitedBy(',').asUtf8String().drainToString(); } else if (c == ',') { throw log.mechInvalidClientMessage(this.mechanismName); } } String oauth2Part = byteIterator.asUtf8String().drainToString(); String[] keyValues = oauth2Part.split(KV_DELIMITER); String auth = getValue("auth", keyValues); if (auth == null) { throw log.mechInvalidClientMessage(this.mechanismName); } return new OAuth2InitialClientMessage(authorizationID, auth, messageBytes); } catch (NoSuchElementException ignored) { throw ElytronMessages.log.mechInvalidMessageReceived(this.mechanismName); } }

Target:
public OAuth2InitialClientMessage parseInitialClientMessage(byte[] fromBytes) throws AuthenticationMechanismException { byte[] messageBytes = fromBytes.clone(); ByteIterator byteIterator = ByteIterator.ofBytes(fromBytes.clone()); try { final char cbindFlag = (char) byteIterator.next(); if (cbindFlag != 'n') { throw ElytronMessages.log.mechChannelBindingNotSupported(this.mechanismName); } String authorizationID = null; if (byteIterator.next() == ',') { final int c = byteIterator.next(); if (c == 'a') { if (byteIterator.next() != '=') { throw log.mechInvalidClientMessage(this.mechanismName); } authorizationID = byteIterator.delimitedBy(',').asUtf8String().drainToString(); if (byteIterator.next() != ',') { throw ElytronMessages.log.mechInvalidClientMessage(this.mechanismName); } } } String auth = getValue("auth", byteIterator.asUtf8String().drainToString()); if (auth == null) { throw log.mechInvalidClientMessage(this.mechanismName); } return new OAuth2InitialClientMessage(authorizationID, auth, messageBytes); } catch (NoSuchElementException ignored) { throw ElytronMessages.log.mechInvalidMessageReceived(this.mechanismName); } }
Source:
public String toString() { return new StringBuilder() .append(getJavaClass().getName()) .append('#').append(getJavaMethodName()) .append('(').append(nullSafeToString(getJavaMethodParameterTypes())).append(')') .toString(); }

Target:
public String toString() { return new ToStringBuilder(this) .append("javaClass", javaClass) .append("javaMethodName", javaMethodName) .append("javaMethodParameterTypes", nullSafeToString(getJavaMethodParameterTypes())) .toString(); }
Source:
public void addRegionResults(RestoreRedundancyResults results) { satisfiedRedundancyRegionsResults.putAll(results.getSatisfiedRedundancyRegionResults()); underRedundancyRegionsResults.putAll(results.getUnderRedundancyRegionResults()); zeroRedundancyRegionsResults.putAll(results.getZeroRedundancyRegionResults()); totalPrimaryTransfersCompleted += results.getTotalPrimaryTransfersCompleted(); totalPrimaryTransferTime = totalPrimaryTransferTime + results.getTotalPrimaryTransferTime(); }

Target:
public void addRegionResults(RestoreRedundancyResults results) { satisfiedRedundancyRegionsResults.putAll(results.getSatisfiedRedundancyRegionResults()); underRedundancyRegionsResults.putAll(results.getUnderRedundancyRegionResults()); zeroRedundancyRegionsResults.putAll(results.getZeroRedundancyRegionResults()); totalPrimaryTransfersCompleted += results.getTotalPrimaryTransfersCompleted(); totalPrimaryTransferTime += results.getTotalPrimaryTransferTime(); }
Source:
public KinesisClientLibConfiguration(String applicationName, String streamName, AwsCredentialsProvider kinesisCredentialsProvider, AwsCredentialsProvider dynamoDBCredentialsProvider, AwsCredentialsProvider cloudWatchCredentialsProvider, String workerId) { this(applicationName, streamName, null, null, DEFAULT_INITIAL_POSITION_IN_STREAM, kinesisCredentialsProvider, dynamoDBCredentialsProvider, cloudWatchCredentialsProvider, DEFAULT_FAILOVER_TIME_MILLIS, workerId, DEFAULT_MAX_RECORDS, DEFAULT_IDLETIME_BETWEEN_READS_MILLIS, DEFAULT_DONT_CALL_PROCESS_RECORDS_FOR_EMPTY_RECORD_LIST, DEFAULT_PARENT_SHARD_POLL_INTERVAL_MILLIS, DEFAULT_SHARD_SYNC_INTERVAL_MILLIS, DEFAULT_CLEANUP_LEASES_UPON_SHARDS_COMPLETION, DEFAULT_TASK_BACKOFF_TIME_MILLIS, DEFAULT_METRICS_BUFFER_TIME_MILLIS, DEFAULT_METRICS_MAX_QUEUE_SIZE, DEFAULT_VALIDATE_SEQUENCE_NUMBER_BEFORE_CHECKPOINTING, null, DEFAULT_SHUTDOWN_GRACE_MILLIS, DEFAULT_SCHEDULER_INITIALIZATION_RETRY_INTERVAL_MILLIS); }

Target:
public KinesisClientLibConfiguration(String applicationName, String streamName, AwsCredentialsProvider kinesisCredentialsProvider, AwsCredentialsProvider dynamoDBCredentialsProvider, AwsCredentialsProvider cloudWatchCredentialsProvider, String workerId) { this(applicationName, streamName, null, null, DEFAULT_INITIAL_POSITION_IN_STREAM, kinesisCredentialsProvider, dynamoDBCredentialsProvider, cloudWatchCredentialsProvider, DEFAULT_FAILOVER_TIME_MILLIS, workerId, DEFAULT_MAX_RECORDS, DEFAULT_IDLETIME_BETWEEN_READS_MILLIS, DEFAULT_DONT_CALL_PROCESS_RECORDS_FOR_EMPTY_RECORD_LIST, DEFAULT_PARENT_SHARD_POLL_INTERVAL_MILLIS, DEFAULT_SHARD_SYNC_INTERVAL_MILLIS, DEFAULT_CLEANUP_LEASES_UPON_SHARDS_COMPLETION, DEFAULT_TASK_BACKOFF_TIME_MILLIS, DEFAULT_METRICS_BUFFER_TIME_MILLIS, DEFAULT_METRICS_MAX_QUEUE_SIZE, DEFAULT_VALIDATE_SEQUENCE_NUMBER_BEFORE_CHECKPOINTING, null, DEFAULT_SHUTDOWN_GRACE_MILLIS, DEFAULT_SCHEDULER_INITIALIZATION_BACKOFF_TIME_MILLIS); }
Source:
protected String doDelete(String apiUrl, Map<String,String> data) throws Exception { String fullUrl = BASE_URL + apiUrl; if (data != null) { if (data.size() > 0) { fullUrl += "?"; } for (Map.Entry<String,String> entry : data.entrySet()) { fullUrl += entry.getKey() + "=" + uriEncode(entry.getValue()) + "&"; } } if (_clientId != null) { if (data == null || data.size() == 0) { fullUrl += "?"; } fullUrl += "clientUUID=" + _clientId; } fullUrl += "&profileIdentifier=" + uriEncode(this._profileName); OkHttpClient okHttpClient = new OkHttpClient(); Request request = new Request.Builder() .url(fullUrl) .delete() .build(); Response response = okHttpClient.newCall(request).execute(); return response.body().string(); }

Target:
protected String doDelete(String apiUrl, Map<String,String> data) throws Exception { String fullUrl = getRequestUrlFromMap(apiUrl, data); if (_clientId != null) { if ( data == null || (data.isEmpty())) { fullUrl += "?"; } fullUrl += "clientUUID=" + _clientId; } fullUrl += "&profileIdentifier=" + uriEncode(this._profileName); Request request = new Request.Builder() .url(fullUrl) .delete() .build(); Response response = okHttpClient.newCall(request).execute(); return response.body().string(); }
Source:
private int[] getOrCreatePropertyIds( String[] propertyKeyNames ) throws ProcedureException { int[] propertyKeyIds = new int[propertyKeyNames.length]; for ( int i = 0; i < propertyKeyIds.length; i++ ) { try { propertyKeyIds[i] = ktx.tokenWrite().propertyKeyGetOrCreateForName( propertyKeyNames[i] ); } catch ( IllegalTokenNameException e ) { throw new ProcedureException( e.status(), e, "" ); } } return propertyKeyIds; }

Target:
private int[] getOrCreatePropertyIds( String[] propertyKeyNames ) throws ProcedureException { int[] propertyKeyIds = new int[propertyKeyNames.length]; for ( int i = 0; i < propertyKeyIds.length; i++ ) { try { propertyKeyIds[i] = ktx.tokenWrite().propertyKeyGetOrCreateForName( propertyKeyNames[i] ); } catch ( IllegalTokenNameException e ) { throw new ProcedureException( e.status(), e, e.getMessage() ); } } return propertyKeyIds; }
Source:
public void onNext(CorfuStreamEntries results) { if (!discoveryService.getIsLeader().get()) { log.info("The onNext call with will be skipped as the current node in the cluster is not the leader.", results, discoveryService.getLocalNodeDescriptor(), discoveryService.getLocalClusterDescriptor()); return; } log.info("LogReplicationEventListener onNext will be processed at node in the cluster {}", results, discoveryService.getLocalNodeDescriptor(), discoveryService.getLocalClusterDescriptor()); for (List<CorfuStreamEntry> entryList : results.getEntries().values()) { for (CorfuStreamEntry entry : entryList) { ReplicationEvent event = (ReplicationEvent) entry.getPayload(); log.info("ReplicationEventListener at node put an event to its local discoveryServiceQueue", discoveryService.getLocalNodeDescriptor(), event); discoveryService.input(new DiscoveryServiceEvent(DiscoveryServiceEvent.DiscoveryServiceEventType.ENFORCE_SNAPSHOT_SYNC, event.getClusterId())); } } }

Target:
public void onNext(CorfuStreamEntries results) { synchronized (discoveryService) { if (!discoveryService.getIsLeader().get()) { log.info("The onNext call with will be skipped as the current node as it is not the leader.", results); return; } log.info("LogReplicationEventListener onNext will be processed at node in the cluster {}", results, discoveryService.getLocalNodeDescriptor(), discoveryService.getLocalClusterDescriptor()); for (List<CorfuStreamEntry> entryList : results.getEntries().values()) { for (CorfuStreamEntry entry : entryList) { ReplicationEvent event = (ReplicationEvent) entry.getPayload(); log.info("ReplicationEventListener put an event to its local discoveryServiceQueue", event); discoveryService.input(new DiscoveryServiceEvent(DiscoveryServiceEvent.DiscoveryServiceEventType.ENFORCE_SNAPSHOT_SYNC, event.getClusterId())); } } } }
Source:
static <T> CheckedFunction0<T> decorateCheckedSupplier(Timer timer, CheckedFunction0<T> supplier){ return () -> { final Context context = timer.context(); try { T returnValue = supplier.apply(); timer.onSuccess(context); return returnValue; }catch (Throwable e){ timer.onError(context); throw e; } }; }

Target:
static <T> CheckedFunction0<T> decorateCheckedSupplier(Timer timer, CheckedFunction0<T> supplier){ return () -> { final Timer.Context context = timer.context(); try { T returnValue = supplier.apply(); context.onSuccess(); return returnValue; }catch (Throwable e){ context.onError(); throw e; } }; }
Source:
public Field notFound(Class<?> type, boolean isInstanceField) throws FieldNotFoundException { throw new FieldNotFoundException(String.format( "No %s field of type \"%s\" could be found in the class hierarchy of %s.", isInstanceField ? "instance" : "static", expectedFieldType.getName(), type.getName())); }

Target:
public void notFound(Class<?> type, boolean isInstanceField) throws FieldNotFoundException { throw new FieldNotFoundException(String.format( "No %s field of type \"%s\" could be found in the class hierarchy of %s.", isInstanceField ? "instance" : "static", expectedFieldType.getName(), type.getName())); }
Source:
public void save(Savable object, OutputStream f) throws IOException { if (!(object instanceof Material)) { throw new IllegalArgumentException("J3MExporter can only save com.jme3.material.Material class"); } try (OutputStreamWriter out = new OutputStreamWriter(f, StandardCharsets.UTF_8); BufferedWriter writer = new BufferedWriter(out)) { rootCapsule.clear(); object.write(this); rootCapsule.writeToStream(writer); } }

Target:
public void save(Savable object, OutputStream f) throws IOException { if (!(object instanceof Material)) { throw new IllegalArgumentException("J3MExporter can only save com.jme3.material.Material class"); } try (OutputStreamWriter out = new OutputStreamWriter(f, StandardCharsets.UTF_8)) { rootCapsule.clear(); object.write(this); rootCapsule.writeToStream(out); } }
Source:
private void putSketch(final ByteBuffer buffer, final int position, final UpdateDoublesSketch sketch) { Int2ObjectMap<UpdateDoublesSketch> map = sketches.get(buffer); if (map == null) { map = new Int2ObjectOpenHashMap<>(); sketches.put(buffer, map); } map.put(position, sketch); }

Target:
private void putSketch(final ByteBuffer buffer, final int position, final UpdateDoublesSketch sketch) { Int2ObjectMap<UpdateDoublesSketch> map = sketches.computeIfAbsent(buffer, buf -> new Int2ObjectOpenHashMap<>()); map.put(position, sketch); }
Source:
public static void main(String[] args) throws Exception { Args myArgs = new Args(); CmdLineParser parser = new CmdLineParser(myArgs, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); return; } Directory dir = FSDirectory.open(Paths.get(myArgs.index)); IndexReader reader = DirectoryReader.open(dir); PrintStream out = new PrintStream(new FileOutputStream(new File(myArgs.output))); out.println("docid\tnorm"); for (LeafReaderContext context : reader.leaves()) { LeafReader leafReader = context.reader(); NumericDocValues docValues = leafReader.getNormValues("contents"); while (docValues.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) { out.println(String.format("%d\t%d", docValues.docID() + context.docBase, SmallFloat.byte4ToInt((byte) docValues.longValue()))); } } out.close(); }

Target:
public static void main(String[] args) throws Exception { Args myArgs = new Args(); CmdLineParser parser = new CmdLineParser(myArgs, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); return; } Directory dir = FSDirectory.open(Paths.get(myArgs.index)); IndexReader reader = DirectoryReader.open(dir); PrintStream out = new PrintStream(new FileOutputStream(new File(myArgs.output))); out.println("docid\tnorm"); for (LeafReaderContext context : reader.leaves()) { LeafReader leafReader = context.reader(); NumericDocValues docValues = leafReader.getNormValues("contents"); if (docValues == null) { throw new Exception("Norms do not appear to have been indexed!"); } while (docValues.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) { out.println(String.format("%d\t%d", docValues.docID() + context.docBase, SmallFloat.byte4ToInt((byte) docValues.longValue()))); } } out.close(); }
Source:
public Map<String, SystemStreamMetadata> getSystemStreamMetadata(Set<String> streamNames) { Map<String, SystemStreamMetadata> requestedMetadata = new HashMap<>(); try { for (String streamName : streamNames) { if (!streamPartitions.containsKey(streamName)) { LOG.debug(String.format("Partition ids for Stream=%s not found", streamName)); EventHubClientManager eventHubClientManager = getOrCreateStreamEventHubClient(streamName); CompletableFuture<EventHubRuntimeInformation> runtimeInfo = eventHubClientManager.getEventHubClient().getRuntimeInformation(); long timeoutMs = eventHubConfig.getRuntimeInfoWaitTimeMS(systemName); EventHubRuntimeInformation ehInfo = runtimeInfo.get(timeoutMs, TimeUnit.MILLISECONDS); LOG.debug(String.format("Adding partition ids for Stream=%s", streamName)); streamPartitions.put(streamName, ehInfo.getPartitionIds()); } String[] partitionIds = streamPartitions.get(streamName); Map<Partition, SystemStreamPartitionMetadata> sspMetadataMap = getPartitionMetadata(streamName, partitionIds); SystemStreamMetadata systemStreamMetadata = new SystemStreamMetadata(streamName, sspMetadataMap); requestedMetadata.put(streamName, systemStreamMetadata); } } catch (Exception e) { String msg = String.format("Error while fetching EventHubRuntimeInfo for System:%s", systemName); LOG.error(msg, e); throw new SamzaException(msg, e); } finally { eventHubClients.forEach((streamName, client) -> client.close(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS)); eventHubClients.clear(); } return requestedMetadata; }

Target:
public Map<String, SystemStreamMetadata> getSystemStreamMetadata(Set<String> streamNames) { Map<String, SystemStreamMetadata> requestedMetadata = new HashMap<>(); try { for (String streamName : streamNames) { if (!streamPartitions.containsKey(streamName)) { LOG.debug(String.format("Partition ids for Stream=%s not found", streamName)); EventHubClientManager eventHubClientManager = getOrCreateStreamEventHubClient(streamName); CompletableFuture<EventHubRuntimeInformation> runtimeInfo = eventHubClientManager.getEventHubClient().getRuntimeInformation(); long timeoutMs = eventHubConfig.getRuntimeInfoWaitTimeMS(systemName); EventHubRuntimeInformation ehInfo = runtimeInfo.get(timeoutMs, TimeUnit.MILLISECONDS); LOG.info(String.format("Adding partition ids=%s for stream=%s", Arrays.toString(ehInfo.getPartitionIds()), streamName)); streamPartitions.put(streamName, ehInfo.getPartitionIds()); } String[] partitionIds = streamPartitions.get(streamName); Map<Partition, SystemStreamPartitionMetadata> sspMetadataMap = getPartitionMetadata(streamName, partitionIds); SystemStreamMetadata systemStreamMetadata = new SystemStreamMetadata(streamName, sspMetadataMap); requestedMetadata.put(streamName, systemStreamMetadata); } } catch (Exception e) { String msg = String.format("Error while fetching EventHubRuntimeInfo for System:%s", systemName); LOG.error(msg, e); throw new SamzaException(msg, e); } finally { eventHubClients.forEach((streamName, client) -> client.close(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS)); eventHubClients.clear(); } return requestedMetadata; }
Source:
public IccOpenLogicalChannelResponse iccOpenLogicalChannel( int subId, String callingPackage, String aid, int p2) { TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege( mApp, subId, "iccOpenLogicalChannel"); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); if (DBG) { log("iccOpenLogicalChannel: subId=" + subId + " aid=" + aid + " p2=" + p2); } return iccOpenLogicalChannelWithPermission(mSubscriptionController.getPhoneId(subId), callingPackage, aid, p2); }

Target:
public IccOpenLogicalChannelResponse iccOpenLogicalChannel( int subId, String callingPackage, String aid, int p2) { TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege( mApp, subId, "iccOpenLogicalChannel"); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); if (DBG) { log("iccOpenLogicalChannel: subId=" + subId + " aid=" + aid + " p2=" + p2); } return iccOpenLogicalChannelWithPermission(getPhoneFromSubId(subId), callingPackage, aid, p2); }
Source:
public void writeData(ObjectDataOutput out) throws IOException { out.writeUTF(name); writeNullableList(attributes, out); }

Target:
public void writeData(ObjectDataOutput out) throws IOException { out.writeUTF(name); out.writeInt(type.getId()); writeNullableList(attributes, out); }
Source:
public void notifyLinkPropertiesChanged(final LinkProperties lp) { getHandler().post(() -> mLinkProperties = lp); }

Target:
public void notifyLinkPropertiesChanged(final LinkProperties lp) { sendMessage(EVENT_LINK_PROPERTIES_CHANGED, lp); }
Source:
public void read(BitBuffer input) { alignRead(input, this.declaration); boolean signed = declaration.isSigned(); int length = declaration.getLength(); long bits = 0; ByteOrder previousByteOrder = input.getByteOrder(); if ((this.declaration.getByteOrder() != null) && (this.declaration.getByteOrder() != input.getByteOrder())) { input.setByteOrder(this.declaration.getByteOrder()); } if (length > 64) { throw new IllegalArgumentException("Cannot read an integer with over 64 bits. Length given: " + length); } else if (length == 64) { try { bits = input.getLong(); } catch (CTFReaderException e) { } } else if (length > 32) { try { bits = input.getLong(length, signed); } catch (CTFReaderException e) { } } else { bits = input.getInt(length, signed); if (!signed) { bits = bits & 0x00000000FFFFFFFFL; } } if (previousByteOrder != input.getByteOrder()) { input.setByteOrder(previousByteOrder); } value = bits; }

Target:
public void read(BitBuffer input) { alignRead(input, this.declaration); boolean signed = declaration.isSigned(); int length = declaration.getLength(); long bits = 0; ByteOrder previousByteOrder = input.getByteOrder(); if ((this.declaration.getByteOrder() != null) && (this.declaration.getByteOrder() != input.getByteOrder())) { input.setByteOrder(this.declaration.getByteOrder()); } if (length > 64) { value = 0; return; } else if (length > 32) { try { bits = input.getLong(length, signed); } catch (CTFReaderException e) { } } else { bits = input.getInt(length, signed); if (!signed) { bits = bits & 0x00000000FFFFFFFFL; } } if (previousByteOrder != input.getByteOrder()) { input.setByteOrder(previousByteOrder); } value = bits; }
Source:
private void checkDeactivatedDirectEdit(SWTBotGefEditPart dEdgeNameEditPartBot, IFigure nameFigure) { Option<IFigure> wrapLabelFigureOption = new FigureQuery(nameFigure).getLabelFigure(); assertTrue("This figure should have a label figure.", wrapLabelFigureOption.some()); assertTrue("The figure of this label should be a SiriusWrapLabel.", wrapLabelFigureOption.get() instanceof SiriusWrapLabel); SiriusWrapLabel viewpointWrapLabel = (SiriusWrapLabel) wrapLabelFigureOption.get(); String wrapText = viewpointWrapLabel.getText(); final long oldTimeout = SWTBotPreferences.TIMEOUT; boolean oldErrorCatchActive = isErrorCatchActive(); setErrorCatchActive(false); SWTBotPreferences.TIMEOUT = 1000; assertLabelMultiLines(nameFigure, 1); boolean noException = editor.directEditType("O\n1\n2", dEdgeNameEditPartBot); if (noException) { SWTBotPreferences.TIMEOUT = oldTimeout; fail("DirectEdit should not be enabled on begin and end edge labels."); } SWTBotUtils.waitAllUiEvents(); assertEquals("DirectEdit should not be enabled on begin and end edge labels.", wrapText, viewpointWrapLabel.getText()); setErrorCatchActive(oldErrorCatchActive); editor.close(); SWTBotUtils.waitAllUiEvents(); }

Target:
private void checkDeactivatedDirectEdit(SWTBotGefEditPart dEdgeNameEditPartBot, IFigure nameFigure) { Option<IFigure> wrapLabelFigureOption = new FigureQuery(nameFigure).getLabelFigure(); assertTrue("This figure should have a label figure.", wrapLabelFigureOption.some()); assertTrue("The figure of this label should be a SiriusWrapLabel.", wrapLabelFigureOption.get() instanceof SiriusWrapLabel); SiriusWrapLabel viewpointWrapLabel = (SiriusWrapLabel) wrapLabelFigureOption.get(); String wrapText = viewpointWrapLabel.getText(); final long oldTimeout = SWTBotPreferences.TIMEOUT; boolean oldErrorCatchActive = isErrorCatchActive(); setErrorCatchActive(false); SWTBotPreferences.TIMEOUT = 1000; try { assertLabelMultiLines(nameFigure, 1); boolean noException = editor.directEditType("O\n1\n2", dEdgeNameEditPartBot); if (noException) { fail("DirectEdit should not be enabled on begin and end edge labels."); } SWTBotUtils.waitAllUiEvents(); assertEquals("DirectEdit should not be enabled on begin and end edge labels.", wrapText, viewpointWrapLabel.getText()); } finally { SWTBotPreferences.TIMEOUT = oldTimeout; setErrorCatchActive(oldErrorCatchActive); editor.close(); SWTBotUtils.waitAllUiEvents(); } }
Source:
public Void call() throws Exception { final long begin = System.currentTimeMillis(); final LongAdder nmodified = new LongAdder(); BigdataSailRepositoryConnection repoConn = null; try { repoConn = getConnection(); new MergingUpdater(repoConn.getTripleStore()) .handleMergingUpdate(namespace, baseURI, getInputStreamFromFileItem(insertStatements), getInputStreamFromFileItem(refSet), getInputStreamFromFileItem(valueSet), uris, nmodified); final long elapsed = System.currentTimeMillis() - begin; reportModifiedCount(nmodified.longValue(), elapsed); return null; } finally { if (repoConn != null) { repoConn.close(); } } }

Target:
public Void call() throws Exception { final long begin = System.nanoTime(); final LongAdder nmodified = new LongAdder(); BigdataSailRepositoryConnection repoConn = null; try { repoConn = getConnection(); new MergingUpdater(repoConn.getTripleStore(), outputDumps) .handleMergingUpdate(namespace, baseURI, getInputStreamFromFileItem(insertStatements), getInputStreamFromFileItem(refSet), getInputStreamFromFileItem(valueSet), uris, nmodified); final long elapsed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - begin); reportModifiedCount(nmodified.longValue(), elapsed); return null; } finally { if (repoConn != null) { repoConn.close(); } } }
Source:
protected void onPostExecuteInternal(final Boolean result) { if (activity != null) { final Context nonNullActivity = activity; if (result) { ActivityMixin.showToast(activity, nonNullActivity.getString(R.string.export_fieldnotes_upload_success)); } else { ActivityMixin.showToast(activity, nonNullActivity.getString(R.string.export_failed)); } } }

Target:
protected void onPostExecuteInternal(final Boolean result) { if (activity != null) { final Context nonNullActivity = activity; if (result) { ActivityMixin.showToast(activity, nonNullActivity.getString(R.string.export_persnotes_upload_success, persNotesCount)); } else { ActivityMixin.showToast(activity, nonNullActivity.getString(R.string.export_failed)); } } }
Source:
public HSQuery createHSQuery(Query luceneQuery, Class<?>... entityTypes) { IndexedTypeIdentifier[] newtypes = Arrays.asList( entityTypes ) .stream() .map( PojoIndexedTypeIdentifier::new ) .toArray( IndexedTypeIdentifier[]::new ); QueryDescriptor descriptor = createQueryDescriptor( luceneQuery, newtypes ); return descriptor.createHSQuery( this ).targetedEntities( IndexedTypesSets.fromClasses( entityTypes ) ); }

Target:
public HSQuery createHSQuery(Query luceneQuery, Class<?>... entityTypes) { IndexedTypeSet newtypes = IndexedTypesSets.fromClasses( entityTypes ); QueryDescriptor descriptor = createQueryDescriptor( luceneQuery, newtypes ); return descriptor.createHSQuery( this ).targetedEntities( newtypes ); }
Source:
public void generateDailyReport(MotechEvent event) { LocalDate startDate = (LocalDate) event.getParameters().get(EbodacConstants.DAILY_REPORT_EVENT_START_DATE); reportService.generateDailyReports(); LOGGER.info("Daily Reports generation completed"); }

Target:
public void generateDailyReport(MotechEvent event) { DateTime startDate = (DateTime) event.getParameters().get(EbodacConstants.DAILY_REPORT_EVENT_START_DATE); reportService.generateDailyReports(); LOGGER.info("Daily Reports generation completed"); }
Source:
static void adjust(Node<Span> node, @Nullable ClockSkew skewFromParent) { if (skewFromParent != null) { node.value(adjustTimestamps(node.value(), skewFromParent)); } ClockSkew skew = getClockSkew(node.value()); if (skew != null) { node.value(adjustTimestamps(node.value(), skew)); } else { if (skewFromParent != null) { for (int i = 0, length = node.value().binaryAnnotations.size(); i < length; i++) { BinaryAnnotation b = node.value().binaryAnnotations.get(i); if (b.endpoint == null) continue; if (b.key.equals(Constants.LOCAL_COMPONENT) && ipsMatch(skewFromParent.endpoint, b.endpoint)) { skew = skewFromParent; break; } } } } for (Node<Span> child : node.children()) { adjust(child, skew); } }

Target:
static void adjust(Node<Span> node, @Nullable ClockSkew skewFromParent) { if (skewFromParent != null) { node.value(adjustTimestamps(node.value(), skewFromParent)); } ClockSkew skew = getClockSkew(node.value()); if (skew != null) { node.value(adjustTimestamps(node.value(), skew)); } else { if (skewFromParent != null && isLocalSpan(node.value())) { skew = skewFromParent; } } for (Node<Span> child : node.children()) { adjust(child, skew); } }
Source:
public GerritEventType getEventType() { return GerritEventType.PRIVATE_STATE_CHANGED; }

Target:
public GerritEventType getEventType() { return GerritEventType.WIP_STATE_CHANGED; }
Source:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitCompositeLit(@NotNull GoCompositeLit o) { super.visitCompositeLit(o); if (PsiTreeUtil.getParentOfType(o, GoReturnStatement.class, GoShortVarDeclaration.class, GoAssignmentStatement.class) == null) return; GoType type = o.getType(); GoType typeFromTypeRef = GoPsiImplUtil.findTypeFromTypeRef(o.getTypeReferenceExpression()); if (!(type instanceof GoStructType || (typeFromTypeRef instanceof GoSpecType && ((GoSpecType) typeFromTypeRef).getType() instanceof GoStructType) )) { return; } for (GoElement element : o.getLiteralValue().getElementList()) { if (element.getKey() == null) { holder.registerProblem(element, "Unnamed field initialization", ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } } } }; }

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitCompositeLit(@NotNull GoCompositeLit o) { super.visitCompositeLit(o); if (PsiTreeUtil.getParentOfType(o, GoReturnStatement.class, GoShortVarDeclaration.class, GoAssignmentStatement.class) == null) { return; } if (!(o.getContainingFile() instanceof GoFile)) return; String myPackage = ((GoFile)o.getContainingFile()).getPackageName(); List<GoFieldDeclaration> fields; GoType type = o.getType(); if (type instanceof GoStructType) { if (!canProcess(myPackage, (GoStructType)type)) return; fields = ((GoStructType)type).getFieldDeclarationList(); if (hasAnonymousStructField(fields)) return; processLiteralValue(holder, fields, o.getLiteralValue()); return; } GoTypeReferenceExpression ref = o.getTypeReferenceExpression(); if (ref == null || ref.resolveType() == null) return; GoType refType = ref.resolveType().getUnderlyingType(); if (refType instanceof GoStructType) { if (!canProcess(myPackage, (GoStructType)refType)) return; fields = ((GoStructType)refType).getFieldDeclarationList(); if (hasAnonymousStructField(fields)) return; processLiteralValue(holder, fields, o.getLiteralValue()); } else if (refType instanceof GoArrayOrSliceType) { type = ((GoArrayOrSliceType)refType).getType(); if (type == null || !(type.getUnderlyingType() instanceof GoStructType)) return; if (!canProcess(myPackage, (GoStructType)type.getUnderlyingType())) return; fields = ((GoStructType)type.getUnderlyingType()).getFieldDeclarationList(); if (hasAnonymousStructField(fields)) return; for (GoElement element : o.getLiteralValue().getElementList()) { GoValue value = element.getValue(); if (value == null || value.getExpression() != null || value.getLiteralValue() == null) continue; processLiteralValue(holder, fields, value.getLiteralValue()); } } } }; }
Source:
public boolean test(List<WebElement> elements) { if (elements.size() != expectedTexts.size()) { return false; } for (String expectedText : expectedTexts) { boolean found = false; for (WebElement element : elements) { if (Html.text.equalsCaseSensitive(element.getText(), expectedText)) { found = true; } } if (!found) { return false; } } return true; }

Target:
public boolean test(List<WebElement> elements) { if (elements.size() != expectedTexts.size()) { return false; } List<String> elementsTexts = elements.stream().map(WebElement::getText).collect(Collectors.toList()); for (String expectedText : expectedTexts) { boolean found = false; for (String elementText : elementsTexts) { if (Html.text.equalsCaseSensitive(elementText, expectedText)) { found = true; } } if (!found) { return false; } } return true; }
Source:
private void parseUpdate(final ReceiveCommand cmd) { RefControl ctl = projectControl.controlForRef(cmd.getRefName()); if (ctl.canUpdate()) { if (isHead(cmd) && !isCommit(cmd)) { return; } validateNewCommits(ctl, cmd); } else { if (GitRepositoryManager.REF_CONFIG.equals(ctl.getRefName())) { rp.sendMessage("You are not allowed to perform this operation.\n" + "Configuration changes can only be pushed by project owners\n" + "who also have 'Push' rights"); } else { rp.sendMessage("You are not allowed to perform this operation.\n" + "To push into this reference you need 'Push' rights." + MESSAGE_FOOTER); } reject(cmd, "Current user '" + ctl.getCurrentUser().getUserName() + "' can not update the reference as a fast forward"); } }

Target:
private void parseUpdate(final ReceiveCommand cmd) { RefControl ctl = projectControl.controlForRef(cmd.getRefName()); if (ctl.canUpdate()) { if (isHead(cmd) && !isCommit(cmd)) { return; } validateNewCommits(ctl, cmd); } else { if (GitRepositoryManager.REF_CONFIG.equals(ctl.getRefName())) { errors.put(Error.CONFIG_UPDATE, Collections.<String> emptyList()); } else { addError(Error.UPDATE, ctl.getRefName()); } reject(cmd, String.format("%s cannot update the reference as a fast forward", displayName(ctl))); } }