auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static String injectRealAccounts(String jsonString) { return jsonString .replace("${test.student1}", TestProperties.inst().TEST_STUDENT1_ACCOUNT) .replace("${test.student2}", TestProperties.inst().TEST_STUDENT2_ACCOUNT) .replace("${test.instructor}", TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT) .replace("${test.unreg}", TestProperties.inst().TEST_UNREG_ACCOUNT) .replace("${test.admin}", TestProperties.inst().TEST_ADMIN_ACCOUNT) .replace("${test.truncatedAdmin}", StringHelper.truncate(TestProperties.inst().TEST_ADMIN_ACCOUNT, Const.SystemParams.USER_ID_MAX_DISPLAY_LENGTH)) .replace("${support.email}", Config.SUPPORT_EMAIL); }

Target:
private static String injectRealAccounts(String jsonString) { return jsonString .replace("${test.student1}", TestProperties.inst().TEST_STUDENT1_ACCOUNT) .replace("${test.student2}", TestProperties.inst().TEST_STUDENT2_ACCOUNT) .replace("${test.instructor}", TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT) .replace("${test.unreg}", TestProperties.inst().TEST_UNREG_ACCOUNT) .replace("${test.admin}", TestProperties.inst().TEST_ADMIN_ACCOUNT) .replace("${support.email}", Config.SUPPORT_EMAIL); }
Source:
public synchronized static VertexHopCriteria createCriteria(String namespace, String nodeId, String nodeLabel) { VertexHopCriteria criterion = new LinkdHopCriteria(namespace,nodeId, nodeLabel); return criterion; }

Target:
public static VertexHopCriteria createCriteria(String namespace, String nodeId, String nodeLabel) { VertexHopCriteria criterion = new LinkdHopCriteria(namespace, nodeId, nodeLabel); return criterion; }
Source:
public void close() { this.reactivateExecutorService.shutdown(); }

Target:
public void close() { this.reactivateExecutorService.shutdownNow(); }
Source:
public static String generateScript(Script script, Map<String, Object> parameterValues) { StringWriter stringWriter = new StringWriter(); try { Template template = new Template(null, new StringReader(script.getContent()), new Configuration(Configuration.VERSION_2_3_21)); template.process(parameterValues, stringWriter); } catch (TemplateException | IOException e) { throw new InvalidParameterException(script.getName(), e); } return stringWriter.toString(); }

Target:
public static String generateScript(Script script, Map<String, Object> parameterValues) { StringWriter stringWriter = new StringWriter(); try { Template template = new Template(null, new StringReader(script.getContent()), new Configuration(Configuration.VERSION_2_3_21)); template.process(parameterValues, stringWriter); } catch (TemplateException e) { throw new InvalidParameterException(script.getName(), e); } catch (IOException e) { throw new TemplateCreationException(script.getName(), e); } return stringWriter.toString(); }
Source:
public List<CssValueNode> getCallResultNodes(List<CssValueNode> cssValueNodes, ErrorManager errorManager) throws GssFunctionException { CssValueNode functionToEval = cssValueNodes.get(0); CssDotPathNode dotPathValue = new CssDotPathNode(functionToEval.getValue(), "", "", functionToEval.getSourceCodeLocation()); JType methodType; try { List<String> parts = dotPathValue.getParts(); methodType = ResourceGeneratorUtil.getMethodByPath(context.getClientBundleType(), parts, null).getReturnType(); } catch (NotFoundException e) { String message = e.getMessage(); errorManager.report(new GssError(message, functionToEval.getSourceCodeLocation())); throw new GssFunctionException(message); } if (!dataResourceType.isAssignableFrom((JClassType) methodType) && !imageResourceType.isAssignableFrom((JClassType) methodType)) { String message = "Invalid method type for url substitution: " + methodType + ". " + "Only DataResource and ImageResource are supported."; errorManager.report(new GssError(message, functionToEval.getSourceCodeLocation())); throw new GssFunctionException(message); } String instance = context.getImplementationSimpleSourceName() + ".this." + dotPathValue.getValue() + ".getSafeUri().asString()"; CssFunctionNode node = GssFunctions.createUrlNode("", functionToEval.getSourceCodeLocation()); CssJavaExpressionNode cssJavaExpressionNode = new CssJavaExpressionNode(instance); CssFunctionArgumentsNode arguments = new CssFunctionArgumentsNode(ImmutableList.<CssValueNode>of(cssJavaExpressionNode)); node.setArguments(arguments); return ImmutableList.of((CssValueNode) node); }

Target:
public List<CssValueNode> getCallResultNodes(List<CssValueNode> cssValueNodes, ErrorManager errorManager) throws GssFunctionException { CssValueNode functionToEval = cssValueNodes.get(0); String value = functionToEval.getValue(); SourceCodeLocation location = functionToEval.getSourceCodeLocation(); String javaExpression = buildJavaExpression(value, location, errorManager); CssFunctionNode urlNode = buildUrlNode(javaExpression, location); return ImmutableList.<CssValueNode>of(urlNode); }
Source:
private void updateSDCardSwitch(){ final PrefManager prefManager = new PrefManager(getActivity().getBaseContext(), PrefManager.Pref.SD_CARD); if (FileUtil.isRemovableStorageAvailable(getContext())) { mSDCardSwitch.setEnabled(true); mSDCardSwitch.setOnCheckedChangeListener(null); mSDCardSwitch.setChecked(prefManager.getBoolean(PrefManager.Key.DOWNLOAD_TO_SDCARD, true)); if ( !prefManager.contains(PrefManager.Key.DOWNLOAD_TO_SDCARD)){ prefManager.put(PrefManager.Key.DOWNLOAD_TO_SDCARD, true); } mSDCardSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { prefManager.put(PrefManager.Key.DOWNLOAD_TO_SDCARD, isChecked); } }); } else { prefManager.put(PrefManager.Key.DOWNLOAD_TO_SDCARD, false); mSDCardSwitch.setEnabled(false); } }

Target:
private void updateSDCardSwitch() { final PrefManager prefManager = new PrefManager(getActivity().getBaseContext(), PrefManager.Pref.SD_CARD); if (!environment.getConfig().isSDCardDownloadEnabled()){ sdCardSettinglayout.setVisibility(View.GONE); } else { sdCardSwitch.setOnCheckedChangeListener(null); sdCardSwitch.setChecked(prefManager.getBoolean(PrefManager.Key.DOWNLOAD_TO_SDCARD, true)); sdCardSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { prefManager.put(PrefManager.Key.DOWNLOAD_TO_SDCARD, isChecked); } }); } }
Source:
public Set<ProcessingDetails> getProcessingDetails() { if (details == null) { details = new HashSet<>(); } return details; }

Target:
public Set<ProcessingDetails> getProcessingDetails() { return details; }
Source:
public void newClientCanBeCreated() { PaxosLearner learner = paxosComponents.learner(CLIENT); learner.learn(PAXOS_ROUND_ONE, PAXOS_VALUE); assertThat(learner.getGreatestLearnedValue()) .isPresent() .hasValueSatisfying(paxosValue -> { assertThat(paxosValue.getLeaderUUID()).isEqualTo(PAXOS_UUID); assertThat(paxosValue.getData()).isEqualTo(PAXOS_DATA); }); PaxosAcceptor acceptor = paxosComponents.acceptor(CLIENT); acceptor.accept(PAXOS_ROUND_TWO, PAXOS_PROPOSAL); assertThat(acceptor.getLatestSequencePreparedOrAccepted()).isEqualTo(PAXOS_ROUND_TWO); }

Target:
public void newClientCanBeCreated() { PaxosLearner learner = paxosComponents.learner(CLIENT); learner.learn(PAXOS_ROUND_ONE, PAXOS_VALUE); assertThat(learner.getGreatestLearnedValue()).map(PaxosValue::getLeaderUUID).contains(PAXOS_UUID); assertThat(learner.getGreatestLearnedValue()).map(PaxosValue::getData).contains(PAXOS_DATA); PaxosAcceptor acceptor = paxosComponents.acceptor(CLIENT); acceptor.accept(PAXOS_ROUND_TWO, PAXOS_PROPOSAL); assertThat(acceptor.getLatestSequencePreparedOrAccepted()).isEqualTo(PAXOS_ROUND_TWO); }
Source:
public JNDIObjectLocator build() { Map<String, String> environment; switch (this.environmentKey == null ? 0 : this.environmentKey.size()) { case 0: environment = Collections.emptyMap(); break; case 1: environment = Collections.singletonMap(this.environmentKey.get(0), this.environmentValue.get(0)); break; default: environment = new LinkedHashMap<>(this.environmentKey.size() < 1073741824 ? 1 + this.environmentKey.size() + (this.environmentKey.size() - 3) / 3 : Integer.MAX_VALUE); for (int ii = 0; ii < this.environmentKey.size(); ii++) { environment.put(this.environmentKey.get(ii), this.environmentValue.get(ii)); } environment = unmodifiableMap(environment); } String namespaceValue = this.namespaceValue; if (!this.namespaceSet) { namespaceValue = JNDI.JNDI_NAMESPACE_MODULE; } return new JNDIObjectLocator(environment, namespaceValue, this.noCaching, this.cacheRemote); }

Target:
public JNDIObjectLocator build() { Map<String, String> environment; switch (this.environmentKeys == null ? 0 : this.environmentKeys.size()) { case 0: environment = Collections.emptyMap(); break; case 1: environment = Collections.singletonMap(this.environmentKeys.get(0), this.environmentValues.get(0)); break; default: environment = new LinkedHashMap<>(this.environmentKeys.size() < 1073741824 ? 1 + this.environmentKeys.size() + (this.environmentKeys.size() - 3) / 3 : Integer.MAX_VALUE); for (int ii = 0; ii < this.environmentKeys.size(); ii++) { environment.put(this.environmentKeys.get(ii), this.environmentValues.get(ii)); } environment = unmodifiableMap(environment); } String namespaceValue = this.namespaceValue; if (!this.namespaceSet) { namespaceValue = JNDI.JNDI_NAMESPACE_MODULE; } return new JNDIObjectLocator(environment, namespaceValue, this.noCaching, this.cacheRemote); }
Source:
default String getName() { return this.shadow$getName(); }

Target:
default String api$getName() { return this.shadow$getName(); }
Source:
private void writeCatchHandler(ICPPASTCatchHandler catchStatement) { writeAttributes(catchStatement, EnumSet.of(SpaceLocation.AFTER)); scribe.print(CATCH); if (catchStatement.isCatchAll()) { scribe.print(VAR_ARGS); } else { scribe.noSemicolon(); scribe.noNewLines(); catchStatement.getDeclaration().accept(visitor); scribe.newLines(); } scribe.print(')'); writeBodyStatement(catchStatement.getCatchBody(), true); }

Target:
private void writeCatchHandler(ICPPASTCatchHandler catchStatement) { scribe.print(CATCH); if (catchStatement.isCatchAll()) { scribe.print(VAR_ARGS); } else { scribe.noSemicolon(); scribe.noNewLines(); catchStatement.getDeclaration().accept(visitor); scribe.newLines(); } scribe.print(')'); writeBodyStatement(catchStatement.getCatchBody(), true); }
Source:
public void validate(ValidationContext vCxt, Shape shape, Node focusNode, Path path, Set<Node> pathNodes, Set<Node> compareNodes) { for ( Node vn : pathNodes ) { if ( ! compareNodes.contains(vn) ) { String msg = toString()+": not disjoint: vakue node "+displayStr(vn)+" is not in "+compareNodes; vCxt.builder().addReportEntry(msg, shape, focusNode, path, vn, this); } } for ( Node v : compareNodes ) { if ( ! pathNodes.contains(v) ) { String msg = toString()+": not disjoint: value "+displayStr(v)+" is not in "+pathNodes; vCxt.builder().addReportEntry(msg, shape, focusNode, path, v, this); } } }

Target:
public void validate(ValidationContext vCxt, Shape shape, Node focusNode, Path path, Set<Node> pathNodes, Set<Node> compareNodes) { for ( Node vn : pathNodes ) { if ( ! compareNodes.contains(vn) ) { String msg = toString()+": not disjoint: value node "+displayStr(vn)+" is not in "+compareNodes; vCxt.reportEntry(msg, shape, focusNode, path, vn, this); } } for ( Node v : compareNodes ) { if ( ! pathNodes.contains(v) ) { String msg = toString()+": not disjoint: value "+displayStr(v)+" is not in "+pathNodes; vCxt.reportEntry(msg, shape, focusNode, path, v, this); } } }
Source:
public DbSchedulerAutoConfiguration(DbSchedulerProperties dbSchedulerProperties, DataSource dataSource, List<Task<?>> configuredTasks) { this.config = Objects.requireNonNull(dbSchedulerProperties, "Can't configure DB Scheduler without required configuration"); this.existingDataSource = Objects.requireNonNull(dataSource, "An existing javax.sql.DataSource is required"); this.configuredTasks = Objects.requireNonNull(configuredTasks, "At least one Task must be configured"); }

Target:
public DbSchedulerAutoConfiguration(DbSchedulerProperties dbSchedulerProperties, DataSource dataSource, List<Task<?>> configuredTasks) { this.config = Objects.requireNonNull(dbSchedulerProperties, "Can't configure db-scheduler without required configuration"); this.existingDataSource = Objects.requireNonNull(dataSource, "An existing javax.sql.DataSource is required"); this.configuredTasks = Objects.requireNonNull(configuredTasks, "At least one Task must be configured"); }
Source:
public AtomicBoolean getCancelFlag(Meta.StatementHandle h) throws NoSuchStatementException { return new AtomicBoolean(); }

Target:
public AtomicBoolean getCancelFlag(Meta.StatementHandle h) throws NoSuchStatementException { AvaticaUtils.upgrade("after dropping JDK 1.7, use Map.computeIfAbsent"); synchronized (flagMap) { AtomicBoolean b = flagMap.get(h.id); if (b == null) { b = new AtomicBoolean(); flagMap.put(h.id, b); } return b; } }
Source:
private void doTestNewSessionRetrieveByTime(final WBORepository repository, final String expectedGUID) { final SuccessCreationDelegate createDelegate = new SuccessCreationDelegate() { @Override public void onSessionCreated(final RepositorySession session) { System.out.println("Session created."); session.begin(new SuccessBeginDelegate() { @Override public void onBeginSucceeded(final RepositorySession session) { session.fetchSince(0, new SuccessFetchDelegate() { @Override public void onFetchedRecord(Record record) { assertEq(expectedGUID, record.guid); } @Override public void onFetchCompleted(long end) { session.finish(new SuccessFinishDelegate() { @Override public void onFinishSucceeded(RepositorySession session, RepositorySessionBundle bundle) { performNotify(); } }); } }); } }); } }; Runnable create = new Runnable() { @Override public void run() { repository.createSession(createDelegate, getApplicationContext()); } }; performWait(create); }

Target:
private void doTestNewSessionRetrieveByTime(final WBORepository repository, final String expectedGUID) { final SuccessCreationDelegate createDelegate = new SuccessCreationDelegate() { @Override public void onSessionCreated(final RepositorySession session) { Log.i(getName(), "Session created."); session.begin(new SuccessBeginDelegate() { @Override public void onBeginSucceeded(final RepositorySession session) { session.fetchSince(0, new SuccessFetchDelegate() { @Override public void onFetchedRecord(Record record) { assertEq(expectedGUID, record.guid); } @Override public void onFetchCompleted(long end) { session.finish(new SuccessFinishDelegate() { @Override public void onFinishSucceeded(RepositorySession session, RepositorySessionBundle bundle) { performNotify(); } }); } }); } }); } }; Runnable create = new Runnable() { @Override public void run() { repository.createSession(createDelegate, getApplicationContext()); } }; performWait(create); }
Source:
public List<T> getAllValues() { return Arrays.asList((T[]) arguments.toArray()); }

Target:
public List<T> getAllValues() { readLock.lock(); try { return new ArrayList<T>((List) arguments); } finally { readLock.unlock(); } }
Source:
public void whenSwitchingOnOperationSquareMe_thenWillReturnSquare() { var me = 4; var operation = "squareMe"; var result = switch (operation) { case "doubleMe" -> { yield me * 2; } case "squareMe" -> { yield me * me; } default -> me; }; assertEquals(result, 16); }

Target:
public void whenSwitchingOnOperationSquareMe_thenWillReturnSquare() { var me = 4; var operation = "squareMe"; var result = switch (operation) { case "doubleMe" -> { yield me * 2; } case "squareMe" -> { yield me * me; } default -> me; }; assertEquals(16, result); }
Source:
@Override public OperationSecurityContext withContext(UUID subjId) { try { ClusterNode node = Optional.ofNullable(ctx.discovery().node(subjId)) .orElseGet(() -> ctx.discovery().historicalNode(subjId)); SecurityContext res = node != null ? secCtxs.computeIfAbsent(subjId, uuid -> nodeSecurityContext(marsh, U.resolveClassLoader(ctx.config()), node)) : secPrc.securityContext(subjId); if (res == null) throw new IllegalStateException("Failed to find security context for subject with given ID : " + subjId); return withContext(res); } catch (Throwable e) { log.error("Failed to obtain a security context.", e); throw e; } }

Target:
@Override public OperationSecurityContext withContext(UUID subjId) { try { ClusterNode node = Optional.ofNullable(ctx.discovery().node(subjId)) .orElseGet(() -> ctx.discovery().historicalNode(subjId)); SecurityContext res = node != null ? secCtxs.computeIfAbsent(subjId, uuid -> nodeSecurityContext(marsh, U.resolveClassLoader(ctx.config()), node)) : secPrc.securityContext(subjId); if (res != null) return withContext(res); } catch (Throwable e) { log.error(FAILED_OBTAIN_SEC_CTX_MSG, e); throw e; } IllegalStateException error = new IllegalStateException("Failed to find security context " + "for subject with given ID : " + subjId); log.error(FAILED_OBTAIN_SEC_CTX_MSG, error); throw error; }
Source:
private Eh107CacheManager createCacheManager(URI uri, Configuration config, Properties properties) { Eh107CacheLoaderWriterProvider cacheLoaderWriterFactory = new Eh107CacheLoaderWriterProvider(); Object[] serviceCreationConfigurations = config.getServiceCreationConfigurations().toArray(); Jsr107Service jsr107Service = new DefaultJsr107Service(ServiceUtils.findSingletonAmongst(Jsr107Configuration.class, serviceCreationConfigurations)); Collection<Service> services = new ArrayList<>(4); services.add(cacheLoaderWriterFactory); services.add(jsr107Service); if (ServiceUtils.findSingletonAmongst(DefaultSerializationProviderConfiguration.class, serviceCreationConfigurations) == null) { services.add(new DefaultJsr107SerializationProvider()); } org.ehcache.CacheManager ehcacheManager = new EhcacheManager(config, services, !jsr107Service.jsr107CompliantAtomics()); ehcacheManager.init(); return new Eh107CacheManager(this, ehcacheManager, jsr107Service.getStatistics(), properties, config.getClassLoader(), uri, new ConfigurationMerger(config, jsr107Service, cacheLoaderWriterFactory)); }

Target:
private Eh107CacheManager createCacheManager(URI uri, Configuration config, Properties properties) { Eh107CacheLoaderWriterProvider cacheLoaderWriterFactory = new Eh107CacheLoaderWriterProvider(); Collection<ServiceCreationConfiguration<?>> serviceCreationConfigurations = config.getServiceCreationConfigurations(); Jsr107Service jsr107Service = new DefaultJsr107Service(ServiceUtils.findSingletonAmongst(Jsr107Configuration.class, serviceCreationConfigurations)); Collection<Service> services = new ArrayList<>(4); services.add(cacheLoaderWriterFactory); services.add(jsr107Service); if (ServiceUtils.findSingletonAmongst(DefaultSerializationProviderConfiguration.class, serviceCreationConfigurations) == null) { services.add(new DefaultJsr107SerializationProvider()); } org.ehcache.CacheManager ehcacheManager = new EhcacheManager(config, services, !jsr107Service.jsr107CompliantAtomics()); ehcacheManager.init(); return new Eh107CacheManager(this, ehcacheManager, jsr107Service, properties, config.getClassLoader(), uri, new ConfigurationMerger(config, jsr107Service, cacheLoaderWriterFactory)); }
Source:
public void setMultiline(boolean aMultiline) { _multiline = aMultiline; }

Target:
public void setMultiline(boolean aMultiline) { multiline = aMultiline; }
Source:
private void txRemoteNodeFailover() throws Exception { startGrid(1); awaitPartitionMapExchange(); IgniteCache<String, Integer> remoteCache = jcache(1); String remotePrimaryKey = String.valueOf(primaryKey(remoteCache)); assert remotePrimaryKey != null; try { performTransactionFailover(remotePrimaryKey, 1, 0); if (transactionConcurrency.equals(TransactionConcurrency.PESSIMISTIC)) fail("Broken remote node must have caused exception"); } catch (ClusterTopologyCheckedException e) { } boolean txFinished = GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { GridCacheAdapter<?, ?> cache = ((IgniteKernal)ignite(0)).internalCache(DEFAULT_CACHE_NAME); IgniteTxManager txMgr = cache.isNear() ? ((GridNearCacheAdapter)cache).dht().context().tm() : cache.context().tm(); int txNum = txMgr.idMapSize(); return txNum == 0; } }, 10000); assertTrue(txFinished); IgniteCache<String, Integer> localCache = jcache(); if (transactionConcurrency.equals(TransactionConcurrency.OPTIMISTIC)) Assert.assertEquals(1, (long)localCache.get(remotePrimaryKey)); else Assert.assertNull(localCache.get(remotePrimaryKey)); localCache.removeAll(); }

Target:
private void txRemoteNodeFailover() throws Exception { startGrid(1); awaitPartitionMapExchange(); IgniteCache<String, Integer> remoteCache = jcache(1); String remotePrimaryKey = String.valueOf(primaryKey(remoteCache)); assert remotePrimaryKey != null; performTransactionFailover(remotePrimaryKey, 1, 0); waitAllTransactionsHasFinished(); IgniteCache<String, Integer> clientCache = jcache(0); assertEquals(1, (long)clientCache.get(remotePrimaryKey)); clientCache.removeAll(); }
Source:
private static Schema resolveUnion(JsonNode datum, Collection<Schema> schemas) { for (Schema schema : schemas) { switch (schema.getType()) { case RECORD: if (datum.isObject()) { boolean missingField = false; for (Schema.Field field : schema.getFields()) { if (!datum.has(field.name()) && field.defaultValue() == null) { missingField = true; break; } } if (!missingField) { return schema; } } break; case MAP: if (datum.isObject()) { return schema; } break; case ARRAY: if (datum.isArray()) { return schema; } break; case BOOLEAN: if (datum.isBoolean()) { return schema; } break; case FLOAT: if (datum.isFloat() || datum.isInt()) { return schema; } break; case DOUBLE: if (datum.isDouble() || datum.isFloat() || datum.isLong() || datum.isInt()) { return schema; } break; case INT: if (datum.isInt()) { return schema; } break; case LONG: if (datum.isLong() || datum.isInt()) { return schema; } break; case STRING: if (datum.isTextual()) { return schema; } break; case ENUM: if (datum.isTextual() && schema.hasEnumSymbol(datum.textValue())) { return schema; } break; case BYTES: case FIXED: if (datum.isBinary()) { return schema; } break; case NULL: if (datum == null || datum.isNull()) { return schema; } break; default: throw new IllegalArgumentException("Unsupported schema: " + schema); } } throw new DatasetException(String.format( "Cannot resolve union: %s not in %s", datum, schemas)); }

Target:
private static Schema resolveUnion(JsonNode datum, Collection<Schema> schemas) { Set<Schema.Type> primitives = Sets.newHashSet(); List<Schema> others = Lists.newArrayList(); for (Schema schema : schemas) { if (PRIMITIVES.containsKey(schema.getType())) { primitives.add(schema.getType()); } else { others.add(schema); } } Schema primitiveSchema = null; if (datum == null || datum.isNull()) { primitiveSchema = closestPrimitive(primitives, Schema.Type.NULL); } else if (datum.isShort() || datum.isInt()) { primitiveSchema = closestPrimitive(primitives, Schema.Type.INT, Schema.Type.LONG, Schema.Type.FLOAT, Schema.Type.DOUBLE); } else if (datum.isLong()) { primitiveSchema = closestPrimitive(primitives, Schema.Type.LONG, Schema.Type.DOUBLE); } else if (datum.isFloat()) { primitiveSchema = closestPrimitive(primitives, Schema.Type.FLOAT, Schema.Type.DOUBLE); } else if (datum.isDouble()) { primitiveSchema = closestPrimitive(primitives, Schema.Type.DOUBLE); } else if (datum.isBoolean()) { primitiveSchema = closestPrimitive(primitives, Schema.Type.BOOLEAN); } if (primitiveSchema != null) { return primitiveSchema; } for (Schema schema : others) { if (matches(datum, schema)) { return schema; } } throw new DatasetException(String.format( "Cannot resolve union: %s not in %s", datum, schemas)); }
Source:
public void processStreamControl(String exportSource, List<String> exportTargets, OperationMode operation, VoltTable results) { exportLog.info("Export " + operation + " source:" + exportSource + " targets:" + exportTargets); synchronized (m_dataSourcesByPartition) { RealVoltDB volt = (RealVoltDB) VoltDB.instance(); for (Iterator<Integer> partitionIt = m_dataSourcesByPartition.keySet().iterator(); partitionIt.hasNext();) { Integer partition = partitionIt.next(); boolean isLeader = ((SpInitiator)volt.getInitiator(partition)).isLeader(); if (!isLeader) { continue; } Map<String, ExportDataSource> sources = m_dataSourcesByPartition.get(partition); for (Iterator<ExportDataSource> it = sources.values().iterator(); it.hasNext();) { ExportDataSource eds = it.next(); if (!eds.isBlocked() || !eds.isMastershipAccepted()) { continue; } if (!StringUtil.isEmpty(exportSource) && !eds.getTableName().equalsIgnoreCase(exportSource)) { continue; } if (!exportTargets.isEmpty() && !exportTargets.contains(eds.getTarget())) { continue; } eds.processStreamControl(operation); results.addRow(eds.getTableName(), eds.getTarget(), partition, VoltSystemProcedure.STATUS_OK, ""); } } } }

Target:
public void processStreamControl(String exportSource, List<String> exportTargets, OperationMode operation, VoltTable results) { exportLog.info("Export " + operation + " source:" + exportSource + " targets:" + exportTargets); synchronized (m_dataSourcesByPartition) { RealVoltDB volt = (RealVoltDB) VoltDB.instance(); for (Iterator<Integer> partitionIt = m_dataSourcesByPartition.keySet().iterator(); partitionIt.hasNext();) { Integer partition = partitionIt.next(); boolean isLeader = ((SpInitiator)volt.getInitiator(partition)).isLeader(); if (!isLeader) { continue; } Map<String, ExportDataSource> sources = m_dataSourcesByPartition.get(partition); for (Iterator<ExportDataSource> it = sources.values().iterator(); it.hasNext();) { ExportDataSource eds = it.next(); if (!StringUtil.isEmpty(exportSource) && !eds.getTableName().equalsIgnoreCase(exportSource)) { continue; } if (!exportTargets.isEmpty() && !exportTargets.contains(eds.getTarget())) { continue; } eds.processStreamControl(operation); results.addRow(eds.getTableName(), eds.getTarget(), partition, VoltSystemProcedure.STATUS_OK, ""); } } } }
Source:
public HandlerStatus onRead() { src.flip(); try { if (src.remaining() < PROTOCOL_LENGTH) { return CLEAN; } String protocol = loadProtocol(); if (protocol.equals(supportedProtocol.getDescriptor())) { channel.inboundPipeline().replace(this, inboundHandlers); } else { throw new IllegalStateException("Unsupported protocol exchange detected"); } if (shouldSignalProtocolLoaded()) { encoder.signalProtocolLoaded(); } return CLEAN; } finally { compactOrClear(src); } }

Target:
public HandlerStatus onRead() { src.flip(); try { if (src.remaining() < PROTOCOL_LENGTH) { return CLEAN; } String protocol = loadProtocol(); if (protocol.equals(supportedProtocol.getDescriptor())) { channel.inboundPipeline().replace(this, inboundHandlers); } else { throw new IllegalStateException("Unsupported protocol exchange detected, " + "expected protocol: " + supportedProtocol.name()); } if (shouldSignalProtocolLoaded()) { encoder.signalProtocolLoaded(); } return CLEAN; } finally { compactOrClear(src); } }
Source:
private static String interpolateLine(String line, Properties properties, String[] delimiters) { if (delimiters == null) { return line; } Pattern propertyPattern = Pattern.compile("(?<variable>" + Pattern.quote(delimiters[0]) + "(?<prop>.*?)" + Pattern.quote(delimiters[1]) + ")"); Matcher matcher = propertyPattern.matcher(line); StringBuffer ret = new StringBuffer(); while (matcher.find()) { String prop = matcher.group("prop"); String value = properties.containsKey(prop) ? properties.getProperty(prop) : matcher.group("variable"); matcher.appendReplacement(ret, value.replace("$","\\$")); } matcher.appendTail(ret); return ret.toString(); }

Target:
private static String interpolateLine(String line, Properties properties, String[] delimiters) { if (delimiters == null || delimiters.length == 0) { return line; } Pattern propertyPattern = Pattern.compile("(?<variable>" + Pattern.quote(delimiters[0]) + "(?<prop>.*?)" + Pattern.quote(delimiters[1]) + ")"); Matcher matcher = propertyPattern.matcher(line); StringBuffer ret = new StringBuffer(); while (matcher.find()) { String prop = matcher.group("prop"); String value = properties.containsKey(prop) ? properties.getProperty(prop) : matcher.group("variable"); matcher.appendReplacement(ret, value.replace("$","\\$")); } matcher.appendTail(ret); return ret.toString(); }
Source:
public Collection<ITemplate> getTemplates() { Collection<ITemplate> all = new ArrayList<ITemplate>(); try { all.addAll(client.<ITemplate>list(ResourceKind.Template, DEFAULT_NAMESPACE)); }catch(UnauthorizedException e) { LOG.warn("Unauthorized to list templates in the default namespace", DEFAULT_NAMESPACE, e); }catch(OpenShiftException e) { LOG.error("Error getting templates from the default namespace", DEFAULT_NAMESPACE, e); } all.addAll(client.<ITemplate>list(ResourceKind.Template, project.getNamespace())); return all; }

Target:
public Collection<ITemplate> getTemplates() { return client.<ITemplate>list(ResourceKind.Template, project.getNamespace()); }
Source:
public EmailLogEntry(AppLogLine appLog) { time = appLog.getTimeUsec() / 1000; String[] tokens = appLog.getLogMessage() .split(Pattern.quote(Const.EmailLog.FIELD_SEPARATOR), -1); try { receiver = tokens[1]; subject = tokens[2]; content = tokens[3]; } catch (ArrayIndexOutOfBoundsException e) { receiver = ""; subject = ""; content = ""; } }

Target:
public EmailLogEntry(AppLogLine appLog) { time = appLog.getTimeUsec() / 1000; String[] tokens = appLog.getLogMessage() .split(Pattern.quote(Const.EmailLog.FIELD_SEPARATOR), -1); try { receiver = tokens[1]; subject = tokens[2]; content = tokens[3]; } catch (ArrayIndexOutOfBoundsException e) { receiver = ""; subject = ""; content = ""; log.severe(String.format(Const.EmailLog.ERROR_LOG_FORMAT, appLog.getLogMessage())); } }
Source:
public void announceSegment(DataSegment segment) throws IOException { int newBytesLen = jsonMapper.writeValueAsBytes(segment).length; if (newBytesLen > config.getMaxBytesPerNode()) { throw new ISE("byte size %,d exceeds %,d", newBytesLen, config.getMaxBytesPerNode()); } synchronized (lock) { boolean done = false; if (!availableZNodes.isEmpty()) { Iterator<SegmentZNode> iter = availableZNodes.iterator(); while (iter.hasNext() && !done) { SegmentZNode availableZNode = iter.next(); if (availableZNode.getBytes().length + newBytesLen < config.getMaxBytesPerNode()) { availableZNode.addSegment(segment); log.info("Announcing segment[%s] at path[%s]", segment.getIdentifier(), availableZNode.getPath()); announcer.update(availableZNode.getPath(), availableZNode.getBytes()); segmentLookup.put(segment, availableZNode); if (availableZNode.getCount() >= config.getSegmentsPerNode()) { availableZNodes.remove(availableZNode); } done = true; } else { availableZNodes.remove(availableZNode); } } } if (!done) { assert (availableZNodes.isEmpty()); SegmentZNode availableZNode = new SegmentZNode(makeServedSegmentPath()); availableZNode.addSegment(segment); log.info("Announcing segment[%s] at path[%s]", segment.getIdentifier(), availableZNode.getPath()); announcer.announce(availableZNode.getPath(), availableZNode.getBytes()); segmentLookup.put(segment, availableZNode); availableZNodes.add(availableZNode); } } }

Target:
public void announceSegment(DataSegment segment) throws IOException { int newBytesLen = jsonMapper.writeValueAsBytes(segment).length; if (newBytesLen > config.getMaxBytesPerNode()) { throw new ISE("byte size %,d exceeds %,d", newBytesLen, config.getMaxBytesPerNode()); } synchronized (lock) { boolean done = false; if (!availableZNodes.isEmpty()) { Iterator<SegmentZNode> iter = availableZNodes.iterator(); while (iter.hasNext() && !done) { SegmentZNode availableZNode = iter.next(); if (availableZNode.getBytes().length + newBytesLen < config.getMaxBytesPerNode()) { availableZNode.addSegment(segment); log.info("Announcing segment[%s] at existing path[%s]", segment.getIdentifier(), availableZNode.getPath()); announcer.update(availableZNode.getPath(), availableZNode.getBytes()); segmentLookup.put(segment, availableZNode); if (availableZNode.getCount() >= config.getSegmentsPerNode()) { availableZNodes.remove(availableZNode); } done = true; } else { availableZNodes.remove(availableZNode); } } } if (!done) { assert (availableZNodes.isEmpty()); SegmentZNode availableZNode = new SegmentZNode(makeServedSegmentPath()); availableZNode.addSegment(segment); log.info("Announcing segment[%s] at new path[%s]", segment.getIdentifier(), availableZNode.getPath()); announcer.announce(availableZNode.getPath(), availableZNode.getBytes()); segmentLookup.put(segment, availableZNode); availableZNodes.add(availableZNode); } } }
Source:
public void convertDevicePropertiesToMap() { String customDevPropSpec = "{type=interface;prop={speed=[0-9]{1,5};duplex=^(full|half)$}}"; DevicePropertiesUtils utils = mockDevicePropertiesUtils(customDevPropSpec); assertTrue(utils.isDevicePropertiesDefinitionValid(customDevPropSpec)); VmDevice device = new VmDevice(); device.setType(VmDeviceGeneralType.INTERFACE); device.setCustomProperties("speed=1024;duplex=half"); Map<String, String> map = utils.getDeviceProperties(Version.v3_3, device); String value; assertNotNull(map); assertTrue(map.size() == 2); value = map.get("speed"); assertNotNull(value); assertTrue(value.equals("1024")); value = map.get("duplex"); assertNotNull(value); assertTrue(value.equals("half")); }

Target:
public void convertDevicePropertiesToMap() { String customDevPropSpec = "{type=interface;prop={speed=[0-9]{1,5};duplex=^(full|half)$}}"; DevicePropertiesUtils utils = mockDevicePropertiesUtils(customDevPropSpec); assertTrue(utils.isDevicePropertiesDefinitionValid(customDevPropSpec)); VmDevice device = new VmDevice(); device.setType(VmDeviceGeneralType.INTERFACE); device.setCustomProperties("speed=1024;duplex=half"); Map<String, String> map = utils.getDeviceProperties(Version.v3_3, device); String value; assertNotNull(map); assertEquals(2, map.size()); value = map.get("speed"); assertNotNull(value); assertEquals("1024", value); value = map.get("duplex"); assertNotNull(value); assertEquals("half", value); }
Source:
protected String enumValueToSchemaString(Enum<?> value) { StringBuilder serialized = new StringBuilder(); serialized.append(value.name()); serialized.append("::"); if(value instanceof HasName) { serialized.append(((HasName)value).getName()); } else { serialized.append(String.valueOf(value)); } if(value instanceof HasAliases) { String[] aliases = ((HasAliases)value).getAliases(); if(aliases != null) { for(String alias: aliases) { if(alias != null && !alias.isEmpty()) { serialized.append("::").append(alias); } } } } return serialized.toString(); }

Target:
protected String enumValueToSchemaString(Enum<?> value) { StringBuilder serialized = new StringBuilder(); serialized.append(value.name()); serialized.append(ENUM_ALIAS_SEPARATOR); if(value instanceof HasName) { serialized.append(((HasName)value).getName()); } else { serialized.append(String.valueOf(value)); } if(value instanceof HasAliases) { String[] aliases = ((HasAliases)value).getAliases(); if(aliases != null) { for(String alias: aliases) { if(alias != null && !alias.isEmpty()) { serialized.append(ENUM_ALIAS_SEPARATOR).append(alias); } } } } return serialized.toString(); }
Source:
public void expand(IProgressMonitor monitor) { this.progressMonitor = monitor; item.setExpanded(true); refreshContent(); }

Target:
public void expand(IProgressMonitor monitor) { item.setExpanded(true); refreshContent(); }
Source:
public void metadataExportToCsvTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = communityService.create(null, context); Collection collection = collectionService.create(context, community); WorkspaceItem wi = workspaceItemService.create(context, collection, true); Item item = wi.getItem(); itemService.addMetadata(context, item, "dc", "contributor", "author", null, "Donald, Smith"); item = installItemService.installItem(context, wi); String fileLocation = configurationService.getProperty("dspace.dir") + testProps.get("test.exportcsv") .toString(); String[] args = new String[] {"metadata-export", "-i", String.valueOf(item.getHandle()), "-f", fileLocation}; TestDSpaceRunnableHandler testDSpaceRunnableHandler = new TestDSpaceRunnableHandler(); ScriptLauncher.handleScript(args, ScriptLauncher.getConfig(kernelImpl), testDSpaceRunnableHandler, kernelImpl); File file = new File(fileLocation); String fileContent = IOUtils.toString(new FileInputStream(file), StandardCharsets.UTF_8); assertTrue(fileContent.contains("Donald, Smith")); assertTrue(fileContent.contains(String.valueOf(item.getID()))); }

Target:
public void metadataExportToCsvTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = communityService.create(null, context); Collection collection = collectionService.create(context, community); WorkspaceItem wi = workspaceItemService.create(context, collection, true); Item item = wi.getItem(); itemService.addMetadata(context, item, "dc", "contributor", "author", null, "Donald, Smith"); item = installItemService.installItem(context, wi); context.restoreAuthSystemState(); String fileLocation = configurationService.getProperty("dspace.dir") + testProps.get("test.exportcsv") .toString(); String[] args = new String[] {"metadata-export", "-i", String.valueOf(item.getHandle()), "-f", fileLocation}; TestDSpaceRunnableHandler testDSpaceRunnableHandler = new TestDSpaceRunnableHandler(); ScriptLauncher.handleScript(args, ScriptLauncher.getConfig(kernelImpl), testDSpaceRunnableHandler, kernelImpl); File file = new File(fileLocation); String fileContent = IOUtils.toString(new FileInputStream(file), StandardCharsets.UTF_8); assertTrue(fileContent.contains("Donald, Smith")); assertTrue(fileContent.contains(String.valueOf(item.getID()))); context.turnOffAuthorisationSystem(); itemService.delete(context, itemService.find(context, item.getID())); collectionService.delete(context, collectionService.find(context, collection.getID())); communityService.delete(context, communityService.find(context, community.getID())); context.restoreAuthSystemState(); }
Source:
private void reinsertFailed(List<VoltBulkLoaderRow> rows) throws Exception { VoltTable tmpTable = new VoltTable(m_columnInfo); for (final VoltBulkLoaderRow row : rows) { try { Object row_args[] = new Object[row.m_rowData.length]; for (int i = 0; i < row_args.length; i++) { final VoltType type = m_columnTypes[i]; row_args[i] = ParameterConverter.tryToMakeCompatible(type.classFromType(), row.m_rowData[i]); } tmpTable.addRow(row_args); } catch (VoltTypeException ex) { loaderLog.error("Type conversion exception", ex); assert false: "Type conversion exception" + ex.getMessage(); continue; } ProcedureCallback callback = new ProcedureCallback() { @Override public void clientCallback(ClientResponse response) throws Exception { if (response.getStatus() != ClientResponse.SUCCESS) { row.m_loader.m_notificationCallBack.failureCallback(row.m_rowHandle, row.m_rowData, response); } row.m_loader.m_loaderCompletedCnt.incrementAndGet(); row.m_loader.m_outstandingRowCount.decrementAndGet(); } }; loadTableWithRetry(callback, tmpTable); } }

Target:
private void reinsertFailed(List<VoltBulkLoaderRow> rows) throws Exception { VoltTable tmpTable = new VoltTable(m_columnInfo); for (final VoltBulkLoaderRow row : rows) { try { Object row_args[] = new Object[row.m_rowData.length]; for (int i = 0; i < row_args.length; i++) { final VoltType type = m_columnTypes[i]; row_args[i] = ParameterConverter.tryToMakeCompatible(type.classFromType(), row.m_rowData[i]); } tmpTable.addRow(row_args); } catch (VoltTypeException ex) { loaderLog.error("Type conversion exception", ex); assert false: "Type conversion exception" + ex.getMessage(); continue; } ProcedureCallback callback = new ProcedureCallback() { @Override public void clientCallback(ClientResponse response) throws Exception { if (response.getStatus() == ClientResponse.CONNECTION_LOST && m_autoReconnect) { m_es.execute(new Runnable() { @Override public void run() { try { reinsertFailed(Arrays.asList(row)); } catch (Exception e) { loaderLog.error("Failed to re-insert failed batch", e); } } }); return; } else if (response.getStatus() != ClientResponse.SUCCESS) { row.m_loader.m_notificationCallBack.failureCallback(row.m_rowHandle, row.m_rowData, response); } row.m_loader.m_loaderCompletedCnt.incrementAndGet(); row.m_loader.m_outstandingRowCount.decrementAndGet(); } }; loadTable(callback, tmpTable); } }
Source:
public UndertowJaxrsServer deploy(ResteasyDeployment deployment, String contextPath, Map<String, String> contextParams, Map<String, String> initParams) { if (contextPath == null) contextPath = "/"; if (!contextPath.startsWith("/")) contextPath = "/" + contextPath; DeploymentInfo builder = undertowDeployment(deployment); builder.setContextPath(contextPath); builder.setDeploymentName("Resteasy" + contextPath); builder.setClassLoader(deployment.getApplication().getClass().getClassLoader()); if (contextParams != null) { for (Iterator<String> it = contextParams.keySet().iterator(); it.hasNext(); ) { String key = it.next(); builder.addInitParameter(key, contextParams.get(key)); } } if (initParams != null) { ServletInfo servletInfo = builder.getServlets().get("ResteasyServlet"); for (Iterator<String> it = initParams.keySet().iterator(); it.hasNext(); ) { String key = it.next(); servletInfo.addInitParam(key, initParams.get(key)); } } return deploy(builder); }

Target:
public UndertowJaxrsServer deploy(ResteasyDeployment deployment, String contextPath, Map<String, String> contextParams, Map<String, String> initParams) { if (contextPath == null) contextPath = "/"; if (!contextPath.startsWith("/")) contextPath = "/" + contextPath; DeploymentInfo builder = undertowDeployment(deployment); builder.setContextPath(contextPath); builder.setDeploymentName("Resteasy" + contextPath); builder.setClassLoader(deployment.getApplication().getClass().getClassLoader()); if (contextParams != null) { for (Entry<String, String> e : contextParams.entrySet()) { builder.addInitParameter(e.getKey(), e.getValue()); } } if (initParams != null) { ServletInfo servletInfo = builder.getServlets().get("ResteasyServlet"); for (Entry<String, String> e : initParams.entrySet()) { servletInfo.addInitParam(e.getKey(), e.getValue()); } } return deploy(builder); }
Source:
private void saveQuestion(final Long accountId, final Question question, final DateTime today, final DateTime expireDate) { LOGGER.debug("action=saved_question processor=question_survey account_id={} question_id={} today={} expireDate={}", accountId, question.id, today, expireDate); this.questionResponseDAO.insertAccountQuestion(accountId, question.id, today, expireDate); }

Target:
private void saveQuestion(final Long accountId, final Question question, final DateTime today, final DateTime expireDate) { LOGGER.debug("action=saved_question processor=question_survey account_id={} question_id={} today={} expire_date={}", accountId, question.id, today, expireDate); this.questionResponseDAO.insertAccountQuestion(accountId, question.id, today, expireDate); }
Source:
public static Object handleNonNull(boolean arg) { throw new AssertionError("value of unknown type should all be NULL"); }

Target:
public static Object handleNonNull(boolean arg) { throw new IllegalArgumentException("value of unknown type should always be null"); }
Source:
public GC(FileRepository repo) { ProgressMonitor pm = NullProgressMonitor.INSTANCE; this.repo = repo; this.pm = (pm == null) ? NullProgressMonitor.INSTANCE : pm; this.expireAgeMillis = 14 * 24 * 60 * 60 * 1000l; }

Target:
public GC(FileRepository repo) { this.repo = repo; this.pm = NullProgressMonitor.INSTANCE; this.expireAgeMillis = 14 * 24 * 60 * 60 * 1000L; }
Source:
public static void main(final String args) throws IOException, XMLStreamException { final ApplicationContext context = new ClassPathXmlApplicationContext("spring/migration-bean.xml"); final Migrator m = (Migrator)context.getBean("migrator"); System.out.println("After creating bean..."); m.run(); ((ConfigurableApplicationContext)context).close(); }

Target:
public static void main(final String args) throws IOException, XMLStreamException { final ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("spring/migration-bean.xml"); final Migrator m = context.getBean("migrator", Migrator.class); m.run(); context.close(); }
Source:
protected static CommonProfile getUserProfile() { final String sessionId = session(Constants.SESSION_ID); logger.debug("sessionId for profile : {}", sessionId); CommonProfile profile = null; if (StringUtils.isNotBlank(sessionId)) { profile = StorageHelper.getProfile(sessionId); } profile = (profile != null) ? profile : (CommonProfile) ctx().args.get(HttpConstants.USER_PROFILE); logger.debug("profile : {}", profile); return profile; }

Target:
protected static CommonProfile getUserProfile() { final String sessionId = session(Pac4jConstants.SESSION_ID); logger.debug("sessionId for profile : {}", sessionId); CommonProfile profile = null; if (StringUtils.isNotBlank(sessionId)) { profile = StorageHelper.getProfile(sessionId); } if (profile == null) { return (CommonProfile) ctx().args.get(Pac4jConstants.USER_PROFILE); } else { return profile; } }
Source:
public static String convertDateToEventTimestamp(Date date) throws ParseException { return dateFormat.format(date).replaceAll(" ", "T") + "Z"; }

Target:
public static String convertDateToEventTimestamp(Date date) { return dateFormat.format(date); }
Source:
public void clickToSignInForm(){ switchToAuthModalHandle(); linkToSignInForm.click(); }

Target:
public void clickToSignInForm(){ switchToAuthModalHandle(); wait.forElementClickable(linkToSignInForm); linkToSignInForm.click(); }
Source:
public HashSet<T> removeAll(Iterable<? extends T> elements) { Objects.requireNonNull(elements, "elements is null"); HashArrayMappedTrie<T, Object> trie = tree; for (T element : elements) { trie = trie.remove(element); } return trie.size() == list.get().length() ? this : new HashSet<>(trie); }

Target:
public HashSet<T> removeAll(Iterable<? extends T> elements) { Objects.requireNonNull(elements, "elements is null"); HashArrayMappedTrie<T, Object> trie = tree; for (T element : elements) { trie = trie.remove(element); } return trie == tree ? this : new HashSet<>(trie); }
Source:
public void testSetDutyCycleSuccess() throws Exception { ATCommandResponse mockedResponse = Mockito.mock(ATCommandResponse.class); Mockito.when(mockedResponse.getResponseStatus()).thenReturn(ATCommandStatus.OK); Mockito.doReturn(mockedResponse).when(xbeeDevice).sendATCommand((ATCommand)Mockito.any()); try { xbeeDevice.setPWMDutyCycle(IOLine.DIO10_PWM0, 75); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { fail("This exception shouldn't be thrown now."); } }

Target:
public void testSetDutyCycleSuccess() throws InvalidOperatingModeException, XBeeException { ATCommandResponse mockedResponse = Mockito.mock(ATCommandResponse.class); Mockito.when(mockedResponse.getResponseStatus()).thenReturn(ATCommandStatus.OK); Mockito.doReturn(mockedResponse).when(xbeeDevice).sendATCommand((ATCommand)Mockito.any()); xbeeDevice.setPWMDutyCycle(IOLine.DIO10_PWM0, DUTY_CYCLE_VALID_VALUE); }
Source:
public void configure(ServerHttpSecurity http) { HttpsRedirectWebFilter transportSecurityFilter = new HttpsRedirectWebFilter(); if (this.serverWebExchangeMatcher != null) { transportSecurityFilter.setRequiresHttpsRedirectMatcher(this.serverWebExchangeMatcher); } http.addFilterAt(transportSecurityFilter, SecurityWebFiltersOrder.HTTPS_REDIRECT); }

Target:
protected void configure(ServerHttpSecurity http) { HttpsRedirectWebFilter httpsRedirectWebFilter = new HttpsRedirectWebFilter(); if (this.serverWebExchangeMatcher != null) { httpsRedirectWebFilter.setRequiresHttpsRedirectMatcher(this.serverWebExchangeMatcher); } if (this.portMapper != null) { httpsRedirectWebFilter.setPortMapper(this.portMapper); } http.addFilterAt(httpsRedirectWebFilter, SecurityWebFiltersOrder.HTTPS_REDIRECT); }