id stringlengths 7 14 | source stringlengths 135 41.2k | target stringlengths 36 20.4k | context_text stringlengths 183 4k | prompt_context stringlengths 0 1.52k | source_ctx stringlengths 198 41.2k | ctx_included bool 2
classes | static_status stringclasses 2
values | static_context stringlengths 1.96k 252k |
|---|---|---|---|---|---|---|---|---|
123788136_10 | class Interval {
public boolean isEmpty() {
return this.start >= this.end;
}
private Interval(int start, boolean startInclusive, int end, boolean endInclusive);
public static Interval ofOpenOpen(int start, int end);
public static Interval ofOpenClosed(int start, int end);
public static Interval ofCl... | assertTrue(Interval.ofOpenOpen(0, 0).isEmpty());
assertFalse(Interval.ofClosedClosed(0, 0).isEmpty());
assertFalse(Interval.ofClosedOpen(0, 1).isEmpty());
assertTrue(Interval.ofOpenClosed(1, 0).isEmpty());
}
} | [FOCAL] public boolean Interval.isEmpty()
[CLASS] class Interval
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[FIELDS] read=end, start
[CLASS-MEMBERS] Interval(int start, boolean startInclusive, int end, boolean endInclusive); Interval ofOpenOpen(int start, int end); Interval ofOpenClosed(int st... | /* static context
[FOCAL] public boolean Interval.isEmpty()
[FIELDS] read=end, start
*/
| /* static context
[FOCAL] public boolean Interval.isEmpty()
[FIELDS] read=end, start
*/
class Interval {
public boolean isEmpty() {
return this.start >= this.end;
}
private Interval(int start, boolean startInclusive, int end, boolean endInclusive);
public static Interval ofOpenOpen(int start, int end);
... | true | ok | {"focal": {"class": "Interval", "name": "isEmpty", "signature": "boolean isEmpty()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "boolean"}, "class_info": {"name": "Interval", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [], "members": [{"name": "Interval"... |
123808995_14 | class MergeBasicProcessorOptions extends ProcessorOptions {
public MergeBasicProcessorOptions() {
}
public MergeBasicProcessorOptions();
public MergeBasicProcessorOptions(MergeBasicProcessorOptions other);
public MergeBasicProcessorOptions(ProcessorOptions other);
public MergeBasicProcess... | new MergeBasicProcessorOptionsConverter();
String badStr = "{\"name\": 10, \"type\": 20, \"fields\": false}";
String optStr = "{\"instances\":1,\"name\":\"name\",\"type\":\"type\",\"defaultCapacity\":100,\"onFlush\":{},\"operations\":{}}";
ProcessorOptions optPump = new ProcessorOption... | [FOCAL] public MergeBasicProcessorOptions.MergeBasicProcessorOptions()
[CLASS] class MergeBasicProcessorOptions extends ProcessorOptions
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[CLASS-MEMBERS] MergeBasicProcessorOptions(); MergeBasicProcessorOptions(MergeBasicProcessorOptions other); MergeB... | /* static context
[FOCAL] public MergeBasicProcessorOptions.MergeBasicProcessorOptions()
*/
| /* static context
[FOCAL] public MergeBasicProcessorOptions.MergeBasicProcessorOptions()
*/
class MergeBasicProcessorOptions extends ProcessorOptions {
public MergeBasicProcessorOptions() {
}
public MergeBasicProcessorOptions();
public MergeBasicProcessorOptions(MergeBasicProcessorOptions other);
... | true | ok | {"focal": {"class": "MergeBasicProcessorOptions", "name": "MergeBasicProcessorOptions", "signature": "MergeBasicProcessorOptions()", "start_line": 3, "modifiers": "public", "params": [], "return_type": null}, "class_info": {"name": "MergeBasicProcessorOptions", "kind": "class", "modifiers": "", "superclass": "Processor... |
123822761_2 | class VertxVaadinContext implements VaadinContext {
@Override
public <T> T getAttribute(Class<T> type, Supplier<T> defaultValueSupplier) {
T result = context.get(type.getName());
if (result == null && defaultValueSupplier != null) {
result = defaultValueSupplier.get();
c... | String value = context.getAttribute(String.class);
Assert.assertNull(value);
}
} | [FOCAL] @Override public T VertxVaadinContext.getAttribute(Class<T> type, Supplier<T> defaultValueSupplier)
[CLASS] class VertxVaadinContext implements VaadinContext
[METRICS] loc=9 cc=2 branches=1 loops=0 returns=1 throws=0 nesting=1
[CALLS-EXTERNAL] VertxVaadinContext.get/1, Class<T>.getName/0, Supplier<T>.get/0, Ver... | /* static context
[FOCAL] @Override public T VertxVaadinContext.getAttribute(Class<T> type, Supplier<T> defaultValueSupplier)
[PATH1] if(result == null && defaultValueSupplier != null)=T -> return result
[PATH2] if(result == null && defaultValueSupplier != null)=F -> return result
[INPUTS] branches=defaultValueSupplier... | /* static context
[FOCAL] @Override public T VertxVaadinContext.getAttribute(Class<T> type, Supplier<T> defaultValueSupplier)
[PATH1] if(result == null && defaultValueSupplier != null)=T -> return result
[PATH2] if(result == null && defaultValueSupplier != null)=F -> return result
[INPUTS] branches=defaultValueSupplier... | true | ok | {"focal": {"class": "VertxVaadinContext", "name": "getAttribute", "signature": "T getAttribute(Class<T> type, Supplier<T> defaultValueSupplier)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "type", "type": "Class<T>"}, {"name": "defaultValueSupplier", "type": "Supplier<T>"}], "return_type": "T... |
123949037_0 | class CloudProvider {
public String getName() {
return this.name;
}
public CloudProvider(String providerName, Integer limitOfVMs, String runtimeConnectorClass, String connectorJarPath,
String connectorMainClass, Map<String, String> connectorProperties);
public void addCloudImage(Clou... | Map<String, String> properties = new HashMap<>();
CloudProvider cp = null;
try {
cp = new CloudProvider(PROVIDER_NAME, 0, RUNTIME_CONNECTOR, null, null, properties);
} catch (Exception e) {
fail("Could not create the Cloud Provider");
return;
}... | [FOCAL] public String CloudProvider.getName()
[CLASS] class CloudProvider
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[FIELDS] read=name
[CLASS-MEMBERS] CloudProvider(String providerName, Integer limitOfVMs, String runtimeConnectorClass, String connectorJarPath, String connectorMainClass, Map<S... | /* static context
[FOCAL] public String CloudProvider.getName()
[FIELDS] read=name
*/
| /* static context
[FOCAL] public String CloudProvider.getName()
[FIELDS] read=name
*/
class CloudProvider {
public String getName() {
return this.name;
}
public CloudProvider(String providerName, Integer limitOfVMs, String runtimeConnectorClass, String connectorJarPath,
String connectorMa... | true | ok | {"focal": {"class": "CloudProvider", "name": "getName", "signature": "String getName()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "String"}, "class_info": {"name": "CloudProvider", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [{"name": "PROVIDER_NAME", ... |
123960848_6 | class AllowListMetricFilter extends SimpleRegexMetricFilter {
@Override
public boolean isAllowed(Metric metric) {
return allowList.stream()
.anyMatch(filter -> super.filterMatches(filter, metric));
}
public AllowListMetricFilter(List<String> allowList);
@Override public S... | List<String> allowList = Lists.newArrayList();
allowList.add("*pcs*");
AllowListMetricFilter filter = new AllowListMetricFilter(allowList);
Assert.assertTrue(filter.isAllowed(metric("some.pcs.metric")));
Assert.assertTrue(filter.isAllowed(metric("pcs.metric")));
Assert.assertTrue(filter.isAllowed(metric("me... | [FOCAL] @Override public boolean AllowListMetricFilter.isAllowed(Metric metric)
[CLASS] class AllowListMetricFilter extends SimpleRegexMetricFilter
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] allowList.stream().anyMatch/1, allowList.stream/0, SimpleRegexMetricFilter.filterMatch... | /* static context
[FOCAL] @Override public boolean AllowListMetricFilter.isAllowed(Metric metric)
[INPUTS] branches=- | result=metric
[COLLABORATORS] field allowList stream/0
[CALLS-EXTERNAL] allowList.stream().anyMatch/1, allowList.stream/0, SimpleRegexMetricFilter.filterMatches/2
*/
| /* static context
[FOCAL] @Override public boolean AllowListMetricFilter.isAllowed(Metric metric)
[INPUTS] branches=- | result=metric
[COLLABORATORS] field allowList stream/0
[CALLS-EXTERNAL] allowList.stream().anyMatch/1, allowList.stream/0, SimpleRegexMetricFilter.filterMatches/2
*/
class AllowListMetricFilter extend... | true | ok | {"focal": {"class": "AllowListMetricFilter", "name": "isAllowed", "signature": "boolean isAllowed(Metric metric)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "metric", "type": "Metric"}], "return_type": "boolean"}, "class_info": {"name": "AllowListMetricFilter", "kind": "class", "modifiers": ... |
123970806_41 | class CryptoCompareClientService {
public CryptoCompareResponseDTO getHistorical(CryptoCompareCurrency fromCurrency, List<CryptoCompareCurrency> toCurrency, long timeInSecond) throws Exception {
CryptoCompareResponseDTO cryptoCompareResponseDTO = restTemplate.getForObject(
getPriceHistorica... | CryptoCompareConversionRateResponse rateResponseUSD = new CryptoCompareConversionRateResponse(CryptoCompareCurrency.USD, new BigDecimal(401.25));
CryptoCompareConversionRateResponse rateResponseBTC = new CryptoCompareConversionRateResponse(CryptoCompareCurrency.BTC, new BigDecimal(0.0056));
Cryp... | [FOCAL] public CryptoCompareResponseDTO CryptoCompareClientService.getHistorical(CryptoCompareCurrency fromCurrency, List<CryptoCompareCurrency> toCurrency, long timeInSecond)
[CLASS] class CryptoCompareClientService
[METRICS] loc=7 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] URI getPriceHisto... | /* static context
[FOCAL] public CryptoCompareResponseDTO CryptoCompareClientService.getHistorical(CryptoCompareCurrency fromCurrency, List<CryptoCompareCurrency> toCurrency, long timeInSecond)
[INPUTS] branches=- | result=fromCurrency, timeInSecond, toCurrency, restTemplate
[COLLABORATORS] field restTemplate:RestTempl... | /* static context
[FOCAL] public CryptoCompareResponseDTO CryptoCompareClientService.getHistorical(CryptoCompareCurrency fromCurrency, List<CryptoCompareCurrency> toCurrency, long timeInSecond)
[INPUTS] branches=- | result=fromCurrency, timeInSecond, toCurrency, restTemplate
[COLLABORATORS] field restTemplate:RestTempl... | true | ok | {"focal": {"class": "CryptoCompareClientService", "name": "getHistorical", "signature": "CryptoCompareResponseDTO getHistorical(CryptoCompareCurrency fromCurrency, List<CryptoCompareCurrency> toCurrency, long timeInSecond) throws Exception", "start_line": 3, "modifiers": "public", "params": [{"name": "fromCurrency", "t... |
124004218_29 | class FileSystemUtil {
public static List<FileStatus> listAll(FileSystem fs, Path path, boolean recursive, PathFilter... filters) throws IOException {
List<FileStatus> statuses = new ArrayList<>();
listAll(fs, path, recursive, statuses, mergeFilters(filters));
return statuses;
}
public static List<F... | List<FileStatus> statuses = FileSystemUtil.listAll(fs, new Path(base, "a"), true, new PathFilter() {
@Override
public boolean accept(Path path) {
return path.getName().endsWith("a") || path.getName().endsWith(".txt");
}
});
assertEquals("Directory and file count should match", 7, s... | [FOCAL] public static List<FileStatus> FileSystemUtil.listAll(FileSystem fs, Path path, boolean recursive, PathFilter... filters)
[CLASS] class FileSystemUtil
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] List<FileStatus> listAll(FileSystem fs, Path path, boolean recursive, List<... | /* static context
[FOCAL] public static List<FileStatus> FileSystemUtil.listAll(FileSystem fs, Path path, boolean recursive, PathFilter... filters)
[EXCEPTIONS] declares IOException
[CALLS-INTERNAL] List<FileStatus> listAll(FileSystem fs, Path path, boolean recursive, List<FileStatus> statuses, PathFilter filter); Path... | /* static context
[FOCAL] public static List<FileStatus> FileSystemUtil.listAll(FileSystem fs, Path path, boolean recursive, PathFilter... filters)
[EXCEPTIONS] declares IOException
[CALLS-INTERNAL] List<FileStatus> listAll(FileSystem fs, Path path, boolean recursive, List<FileStatus> statuses, PathFilter filter); Path... | true | ok | {"focal": {"class": "FileSystemUtil", "name": "listAll", "signature": "List<FileStatus> listAll(FileSystem fs, Path path, boolean recursive, PathFilter... filters) throws IOException", "start_line": 3, "modifiers": "public static", "params": [{"name": "fs", "type": "FileSystem"}, {"name": "path", "type": "Path"}, {"nam... |
124063585_3 | class ReplayController {
@PostMapping("/replay")
public String replay() {
replayer.replay("nl.fourscouts.blog.replays.projections");
return "Replay started...";
}
@GetMapping("/replay") public String progress();
@Autowired
private MockMvc mvc;
@MockBean
private Replayer replayer;
}
class ReplayControl... | mvc
.perform(post("/replay"))
.andExpect(status().isOk());
verify(replayer).replay(any());
}
} | [FOCAL] @PostMapping("/replay") public String ReplayController.replay()
[CLASS] class ReplayController
[METRICS] loc=6 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] Replayer.replay/1
[FIELDS] read=replayer:Replayer
[COLLABORATORS] field replayer:Replayer replay/1
[DATAFLOW] this.replayer@param->... | /* static context
[FOCAL] @PostMapping("/replay") public String ReplayController.replay()
[COLLABORATORS] field replayer:Replayer replay/1
[FIELDS] read=replayer:Replayer
[CALLS-EXTERNAL] Replayer.replay/1
*/
| /* static context
[FOCAL] @PostMapping("/replay") public String ReplayController.replay()
[COLLABORATORS] field replayer:Replayer replay/1
[FIELDS] read=replayer:Replayer
[CALLS-EXTERNAL] Replayer.replay/1
*/
class ReplayController {
@PostMapping("/replay")
public String replay() {
replayer.replay("nl.fourscouts.b... | true | ok | {"focal": {"class": "ReplayController", "name": "replay", "signature": "String replay()", "start_line": 3, "modifiers": "@PostMapping(\"/replay\") public", "params": [], "return_type": "String"}, "class_info": {"name": "ReplayController", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields... |
124093107_0 | class BufferedLiveEvent extends SingleLiveEvent<T> {
@Override public void setValue(@Nullable T t) {
if (hasActiveObservers() && mBuffer.isEmpty()) { // See onActive
super.setValue(t);
} else {
mBuffer.add(t);
}
}
@Override public void postValue(@Nullable f... | ble.setValue("a");
assertObserved();
lifecycle.handleLifecycleEvent(ON_START);
assertObserved("a");
ble.setValue("b");
assertObserved("b");
ble.setValue("c");
lifecycle.handleLifecycleEvent(ON_STOP);
ble.setValue("d");
ble.setValue("e");
... | [FOCAL] @Override public void BufferedLiveEvent.setValue(T t)
[CLASS] class BufferedLiveEvent extends SingleLiveEvent<T>
[METRICS] loc=7 cc=2 branches=1 loops=0 returns=0 throws=0 nesting=1
[CALLS-EXTERNAL] hasActiveObservers/0 (inherited), mBuffer.isEmpty/0, SingleLiveEvent<T>.setValue/1, mBuffer.add/1
[PATH1] if(hasA... | /* static context
[FOCAL] @Override public void BufferedLiveEvent.setValue(T t)
[PATH1] if(hasActiveObservers() && mBuffer.isEmpty())=T
[PATH2] if(hasActiveObservers() && mBuffer.isEmpty())=F
[COLLABORATORS] field mBuffer isEmpty/0,add/1
[CALLS-EXTERNAL] hasActiveObservers/0 (inherited), mBuffer.isEmpty/0, SingleLiveEv... | /* static context
[FOCAL] @Override public void BufferedLiveEvent.setValue(T t)
[PATH1] if(hasActiveObservers() && mBuffer.isEmpty())=T
[PATH2] if(hasActiveObservers() && mBuffer.isEmpty())=F
[COLLABORATORS] field mBuffer isEmpty/0,add/1
[CALLS-EXTERNAL] hasActiveObservers/0 (inherited), mBuffer.isEmpty/0, SingleLiveEv... | true | ok | {"focal": {"class": "BufferedLiveEvent", "name": "setValue", "signature": "void setValue(T t)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "t", "type": "T"}], "return_type": "void"}, "class_info": {"name": "BufferedLiveEvent", "kind": "class", "modifiers": "", "superclass": "SingleLiveEvent<T... |
124140585_0 | class MinimumDistanceCalculator extends Attribute {
public static int calculateDistance(Object[] entities, int start, int end) {
boolean[] visited = new boolean[entities.length];
int[] distance = new int[entities.length];
for (int i = 0; i < entities.length; i++) {
distance[i] =... | List<Entity> entityList = testModel.entityList();
int result = MinimumDistanceCalculator
.calculateDistance(entityList.toArray(), 0, 2);
Assert.assertEquals(1, result);
result = MinimumDistanceCalculator
.calculateDistance(entityList.toArray(), 0, 0);
... | [FOCAL] public static int MinimumDistanceCalculator.calculateDistance(Object[] entities, int start, int end)
[CLASS] class MinimumDistanceCalculator extends Attribute
[METRICS] loc=68 cc=13 branches=6 loops=6 returns=1 throws=0 nesting=5
[CALLS-EXTERNAL] Map<Object, Integer>.put/2, Integer.valueOf/1, Entity.portList/0,... | /* static context
[FOCAL] public static int MinimumDistanceCalculator.calculateDistance(Object[] entities, int start, int end)
[PATH1] for(i < entities.length)#1=T -> exit loop -> for(i < entities.length)#2=T -> exit loop -> while(!done)=T -> foreach(IOPort port : ports)=T -> if(port.isOutput())=T -> foreach(IOPort rem... | /* static context
[FOCAL] public static int MinimumDistanceCalculator.calculateDistance(Object[] entities, int start, int end)
[PATH1] for(i < entities.length)#1=T -> exit loop -> for(i < entities.length)#2=T -> exit loop -> while(!done)=T -> foreach(IOPort port : ports)=T -> if(port.isOutput())=T -> foreach(IOPort rem... | true | ok | {"focal": {"class": "MinimumDistanceCalculator", "name": "calculateDistance", "signature": "int calculateDistance(Object[] entities, int start, int end)", "start_line": 3, "modifiers": "public static", "params": [{"name": "entities", "type": "Object[]"}, {"name": "start", "type": "int"}, {"name": "end", "type": "int"}]... |
124201472_2 | class DataType {
public static @Nullable String nameForOid(int oid) { return dataTypes.get(oid); public static @Nullable String nameForOid(int oid) { return dataTypes.get(oid); }
public static @Nullable String nameForOid(int oid) { return dataTypes.get(oid); private DataType();
public static @Nullable String nameFo... | for (Field oidField : oidFields)
Assert.assertEquals(oidField.getName(), DataType.nameForOid((int) oidField.get(null)));
}
} | [FOCAL] public static @Nullable String DataType.nameForOid(int oid)
[CLASS] class DataType
[METRICS] loc=1 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] dataTypes.get/1
[INPUTS] branches=- | result=oid
[COLLABORATORS] field dataTypes get/1
[DATAFLOW] oid@param->L1
[CLASS-MEMBERS] DataType(); int... | /* static context
[FOCAL] public static @Nullable String DataType.nameForOid(int oid)
[INPUTS] branches=- | result=oid
[COLLABORATORS] field dataTypes get/1
[CALLS-EXTERNAL] dataTypes.get/1
*/
| /* static context
[FOCAL] public static @Nullable String DataType.nameForOid(int oid)
[INPUTS] branches=- | result=oid
[COLLABORATORS] field dataTypes get/1
[CALLS-EXTERNAL] dataTypes.get/1
*/
class DataType {
public static @Nullable String nameForOid(int oid) { return dataTypes.get(oid); public static @Nullable Strin... | true | ok | {"focal": {"class": "DataType", "name": "nameForOid", "signature": "String nameForOid(int oid)", "start_line": 3, "modifiers": "public static @Nullable", "params": [{"name": "oid", "type": "int"}], "return_type": "String"}, "class_info": {"name": "DataType", "kind": "class", "modifiers": "", "superclass": null, "interf... |
124230133_6 | class PwnedPasswordClient {
CompletableFuture<List<Hex>> fetchHashesAsync(Hex hashedPassword) {
Call call = httpClient.newCall(buildRequest(hashedPassword));
CompletableFuture<List<Hex>> future = new CompletableFuture<>();
call.enqueue(new Callback() {
@Override
pu... | PwnedPasswordClient pwnedPasswordClient = new PwnedPasswordClient(new OkHttpClient(), "http://localhost:8089", "unit-test");
try {
pwnedPasswordClient.fetchHashesAsync(Hex.from("password")).get();
fail();
} catch (ExecutionException e) {
assertTrue(e.getCause... | [FOCAL] CompletableFuture<List<Hex>> PwnedPasswordClient.fetchHashesAsync(Hex hashedPassword)
[CLASS] class PwnedPasswordClient
[METRICS] loc=28 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=2
[CALLS-INTERNAL] List<Hex> parseResponse(Hex range, Response response); Request buildRequest(Hex hashedPassword)
[CALLS-EX... | /* static context
[FOCAL] CompletableFuture<List<Hex>> PwnedPasswordClient.fetchHashesAsync(Hex hashedPassword)
[COLLABORATORS] field httpClient newCall/1; field response isSuccessful/0,close/0; param hashedPassword:Hex firstFive/0
[CALLS-INTERNAL] List<Hex> parseResponse(Hex range, Response response); Request buildReq... | /* static context
[FOCAL] CompletableFuture<List<Hex>> PwnedPasswordClient.fetchHashesAsync(Hex hashedPassword)
[COLLABORATORS] field httpClient newCall/1; field response isSuccessful/0,close/0; param hashedPassword:Hex firstFive/0
[CALLS-INTERNAL] List<Hex> parseResponse(Hex range, Response response); Request buildReq... | true | ok | {"focal": {"class": "PwnedPasswordClient", "name": "fetchHashesAsync", "signature": "CompletableFuture<List<Hex>> fetchHashesAsync(Hex hashedPassword)", "start_line": 3, "modifiers": "", "params": [{"name": "hashedPassword", "type": "Hex"}], "return_type": "CompletableFuture<List<Hex>>"}, "class_info": {"name": "PwnedP... |
124364226_0 | class ClusterConfig {
protected ClusterProperties getClusterProperties() {
String keyPrefix = "yfs.gateway.";
ClusterProperties clusterProperties = new ClusterProperties();
Map<String, String> map = PropertiesUtil.getProperty("cluster.properties");
Set<Integer> nodeIds = new HashSet... | ClusterProperties clusterProperties = new ClusterConfig().getClusterProperties();
Assert.assertEquals("server1", clusterProperties.getLocal());
Assert.assertEquals("yfs-gateway/data/metadata", clusterProperties.getMetadataDir());
Assert.assertEquals(6003, clusterProperties.getNode().get(... | [FOCAL] protected ClusterProperties ClusterConfig.getClusterProperties()
[CLASS] class ClusterConfig
[METRICS] loc=57 cc=4 branches=1 loops=2 returns=1 throws=1 nesting=6
[CALLS-EXTERNAL] PropertiesUtil.getProperty/1, map.entrySet().stream().forEach/1, map.entrySet().stream/0, Map<String, String>.entrySet/0, entry.getK... | /* static context
[FOCAL] protected ClusterProperties ClusterConfig.getClusterProperties()
[THROWS-WHEN] RuntimeException when i < nodeIds.size() && !nodeIds.contains(i)
[PATH1] for(i < nodeIds.size())#1=T -> if(!nodeIds.contains(i))=F -> exit loop -> for(i < nodeIds.size())#2=F -> return clusterProperties
[PATH2] for(... | /* static context
[FOCAL] protected ClusterProperties ClusterConfig.getClusterProperties()
[THROWS-WHEN] RuntimeException when i < nodeIds.size() && !nodeIds.contains(i)
[PATH1] for(i < nodeIds.size())#1=T -> if(!nodeIds.contains(i))=F -> exit loop -> for(i < nodeIds.size())#2=F -> return clusterProperties
[PATH2] for(... | true | ok | {"focal": {"class": "ClusterConfig", "name": "getClusterProperties", "signature": "ClusterProperties getClusterProperties()", "start_line": 3, "modifiers": "protected", "params": [], "return_type": "ClusterProperties"}, "class_info": {"name": "ClusterConfig", "kind": "class", "modifiers": "", "superclass": null, "inter... |
124397000_25 | class OAuth2AccessTokenService {
public OAuth2AccessTokenResponse getAccessToken(ClientProperties clientProperties) {
if (clientProperties == null) {
throw new OAuth2ClientException("ClientProperties cannot be null");
}
log.debug("getting access_token for grant={}", clientProper... | assertThatExceptionOfType(OAuth2ClientException.class)
.isThrownBy(() -> oAuth2AccessTokenService.getAccessToken(onBehalfOfProperties()))
.withMessageContaining("no authenticated jwt token found in validation context, cannot do on-behalf-of");
}
} | [FOCAL] public OAuth2AccessTokenResponse OAuth2AccessTokenService.getAccessToken(ClientProperties clientProperties)
[CLASS] class OAuth2AccessTokenService
[METRICS] loc=17 cc=5 branches=4 loops=0 returns=3 throws=2 nesting=3
[CALLS-INTERNAL] OAuth2AccessTokenResponse executeClientCredentials(ClientProperties clientProp... | /* static context
[FOCAL] public OAuth2AccessTokenResponse OAuth2AccessTokenService.getAccessToken(ClientProperties clientProperties)
[THROWS-WHEN] OAuth2ClientException when clientProperties == null
[THROWS-WHEN] OAuth2ClientException when !(clientProperties == null) && !isGrantType(clientProperties, OAuth2GrantType.J... | /* static context
[FOCAL] public OAuth2AccessTokenResponse OAuth2AccessTokenService.getAccessToken(ClientProperties clientProperties)
[THROWS-WHEN] OAuth2ClientException when clientProperties == null
[THROWS-WHEN] OAuth2ClientException when !(clientProperties == null) && !isGrantType(clientProperties, OAuth2GrantType.J... | true | ok | {"focal": {"class": "OAuth2AccessTokenService", "name": "getAccessToken", "signature": "OAuth2AccessTokenResponse getAccessToken(ClientProperties clientProperties)", "start_line": 3, "modifiers": "public", "params": [{"name": "clientProperties", "type": "ClientProperties"}], "return_type": "OAuth2AccessTokenResponse"},... |
124447570_0 | class TranslationService {
Maybe<TranslationResult> getOnlineTranslation(String question, String langFrom, String langTo) {
if (appState.isOfflineMode) {
return Maybe.empty();
}
return seznamRetrofit.create(SeznamRestInterface.class)
.doTranslate(langFrom + "_" +... | TranslationResult translationResult = translationService.getOnlineTranslation("pas", "cz", "ru")
.blockingGet();
assertEquals(3, translationResult.getTranslations().size());
assertEquals("pas", translationResult.getWord());
}
} | [FOCAL] Maybe<TranslationResult> TranslationService.getOnlineTranslation(String question, String langFrom, String langTo)
[CLASS] class TranslationService
[METRICS] loc=9 cc=2 branches=1 loops=0 returns=2 throws=0 nesting=1
[CALLS-INTERNAL] Observable<TranslationResult> parseTranslationJson(ResponseBody response, Strin... | /* static context
[FOCAL] Maybe<TranslationResult> TranslationService.getOnlineTranslation(String question, String langFrom, String langTo)
[PATH1] if(appState.isOfflineMode)=T -> return Maybe.empty()
[PATH2] if(appState.isOfflineMode)=F -> return seznamRetrofit.create(SeznamRestInterface.class) .doTranslate(langF...
[... | /* static context
[FOCAL] Maybe<TranslationResult> TranslationService.getOnlineTranslation(String question, String langFrom, String langTo)
[PATH1] if(appState.isOfflineMode)=T -> return Maybe.empty()
[PATH2] if(appState.isOfflineMode)=F -> return seznamRetrofit.create(SeznamRestInterface.class) .doTranslate(langF...
[... | true | ok | {"focal": {"class": "TranslationService", "name": "getOnlineTranslation", "signature": "Maybe<TranslationResult> getOnlineTranslation(String question, String langFrom, String langTo)", "start_line": 3, "modifiers": "", "params": [{"name": "question", "type": "String"}, {"name": "langFrom", "type": "String"}, {"name": "... |
124503196_5 | class MainPagerPresenter extends BasePresenter<MainPagerContract.View> implements MainPagerContract.Presenter {
@Override
public void addCollectArticle(int position, FeedArticleData feedArticleData) {
addSubscribe(mDataManager.addCollectArticle(feedArticleData.getId())
.compose(RxUtils.... | login();
FeedArticleData feedArticleData = getFeedArticleData();
mMainPagerPresenter.addCollectArticle(0, feedArticleData);
Mockito.verify(mView).showCollectArticleData(ArgumentMatchers.eq(0),
ArgumentMatchers.eq(feedArticleData),
ArgumentMatchers.any(Feed... | [FOCAL] @Override public void MainPagerPresenter.addCollectArticle(int position, FeedArticleData feedArticleData)
[CLASS] class MainPagerPresenter extends BasePresenter<MainPagerContract.View> implements MainPagerContract.Presenter
[METRICS] loc=14 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[CALLS-EXTERNAL] a... | /* static context
[FOCAL] @Override public void MainPagerPresenter.addCollectArticle(int position, FeedArticleData feedArticleData)
[COLLABORATORS] field mDataManager addCollectArticle/1; param feedArticleData:FeedArticleData getId/0,setCollect/1; field mView:MainPagerContract.View showCollectArticleData/3
[FIELDS] rea... | /* static context
[FOCAL] @Override public void MainPagerPresenter.addCollectArticle(int position, FeedArticleData feedArticleData)
[COLLABORATORS] field mDataManager addCollectArticle/1; param feedArticleData:FeedArticleData getId/0,setCollect/1; field mView:MainPagerContract.View showCollectArticleData/3
[FIELDS] rea... | true | ok | {"focal": {"class": "MainPagerPresenter", "name": "addCollectArticle", "signature": "void addCollectArticle(int position, FeedArticleData feedArticleData)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "position", "type": "int"}, {"name": "feedArticleData", "type": "FeedArticleData"}], "return_... |
124518729_11 | class QuoteRule implements Rule {
@Override
public boolean conforms(final List<String> pMarkdownLines) {
return QUOTE_PATTERN.matcher(pMarkdownLines.get(0)).matches();
}
@Override public int getLinesConsumed();
@Override public MarkdownItem toMarkdownItem(final List<String> pMarkdownLines);
private QuoteRule... | List<String> strings = new ArrayList<>();
strings.add("< Quote");
assertFalse(mQuoteRule.conforms(strings));
}
} | [FOCAL] @Override public boolean QuoteRule.conforms(List<String> pMarkdownLines)
[CLASS] class QuoteRule implements Rule
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] QUOTE_PATTERN.matcher(pMarkdownLines.get(0)).matches/0, QUOTE_PATTERN.matcher/1, List<String>.get/1
[INPUTS] bran... | /* static context
[FOCAL] @Override public boolean QuoteRule.conforms(List<String> pMarkdownLines)
[INPUTS] branches=- | result=pMarkdownLines
[COLLABORATORS] param pMarkdownLines:List<String> get/1
[CALLS-EXTERNAL] QUOTE_PATTERN.matcher(pMarkdownLines.get(0)).matches/0, QUOTE_PATTERN.matcher/1, List<String>.get/1
*/
| /* static context
[FOCAL] @Override public boolean QuoteRule.conforms(List<String> pMarkdownLines)
[INPUTS] branches=- | result=pMarkdownLines
[COLLABORATORS] param pMarkdownLines:List<String> get/1
[CALLS-EXTERNAL] QUOTE_PATTERN.matcher(pMarkdownLines.get(0)).matches/0, QUOTE_PATTERN.matcher/1, List<String>.get/1
*/
c... | true | ok | {"focal": {"class": "QuoteRule", "name": "conforms", "signature": "boolean conforms(List<String> pMarkdownLines)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "pMarkdownLines", "type": "List<String>"}], "return_type": "boolean"}, "class_info": {"name": "QuoteRule", "kind": "class", "modifiers"... |
124578706_11 | class TypePostProcessorResultHandler implements ResultHandler<Object> {
@Override
public void handleResult(Object result) {
if (result == null) {
return;
}
if (result instanceof Throwable) {
THREAD_CONTEXT.set((Throwable) result);
}
Object obj = r... | IllegalArgumentException ex = new IllegalArgumentException("[TEST]");
rh.handleResult(ex);
assertEquals(1, captor.getAllValues().size());
assertEquals(ex, captor.getAllValues().get(0));
}
} | [FOCAL] @Override public void TypePostProcessorResultHandler.handleResult(Object result)
[CLASS] class TypePostProcessorResultHandler implements ResultHandler<Object>
[METRICS] loc=37 cc=8 branches=5 loops=1 returns=2 throws=0 nesting=4
[CALLS-INTERNAL] void printError(String error); void printLogWarn(String warn)
[CAL... | /* static context
[FOCAL] @Override public void TypePostProcessorResultHandler.handleResult(Object result)
[PATH1] if(result == null)=F -> if(result instanceof Throwable)=T -> if(ctx != null && ctx.getPostProcessorsList() != null)=T -> foreach(PostProcessorObject postProcessorObject : ctx.getPostProcessorsList())=T -> ... | /* static context
[FOCAL] @Override public void TypePostProcessorResultHandler.handleResult(Object result)
[PATH1] if(result == null)=F -> if(result instanceof Throwable)=T -> if(ctx != null && ctx.getPostProcessorsList() != null)=T -> foreach(PostProcessorObject postProcessorObject : ctx.getPostProcessorsList())=T -> ... | true | ok | {"focal": {"class": "TypePostProcessorResultHandler", "name": "handleResult", "signature": "void handleResult(Object result)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "result", "type": "Object"}], "return_type": "void"}, "class_info": {"name": "TypePostProcessorResultHandler", "kind": "cla... |
124743561_1 | class HttpHeaders {
public void set(String name, String value) {
List<String> values = headers.get(name);
if (values == null) {
values = new ArrayList<>(1);
headers.put(name, values);
} else {
values.clear();
}
values.add(value);
}
... | HttpHeaders headers = new HttpHeaders(2);
headers.set("Connection", "close");
headers.set("Connection", "Keep-Alive");
headers.set("Accept-Encoding", "gzip, deflate");
Assert.assertEquals("Keep-Alive", headers.get("Connection"));
Assert.assertEquals("gzip, deflate", head... | [FOCAL] public void HttpHeaders.set(String name, String value)
[CLASS] class HttpHeaders
[METRICS] loc=10 cc=2 branches=1 loops=0 returns=0 throws=0 nesting=1
[CALLS-EXTERNAL] headers.get/1, headers.put/2, List<String>.clear/0, List<String>.add/1
[NEW] ArrayList<>
[PATH1] if(values == null)=T
[PATH2] if(values == null)... | /* static context
[FOCAL] public void HttpHeaders.set(String name, String value)
[PATH1] if(values == null)=T
[PATH2] if(values == null)=F
[INPUTS] branches=name | result=-
[COLLABORATORS] field headers get/1,put/2
[NEW] ArrayList<>
[CALLS-EXTERNAL] headers.get/1, headers.put/2, List<String>.clear/0, List<String>.add/1... | /* static context
[FOCAL] public void HttpHeaders.set(String name, String value)
[PATH1] if(values == null)=T
[PATH2] if(values == null)=F
[INPUTS] branches=name | result=-
[COLLABORATORS] field headers get/1,put/2
[NEW] ArrayList<>
[CALLS-EXTERNAL] headers.get/1, headers.put/2, List<String>.clear/0, List<String>.add/1... | true | ok | {"focal": {"class": "HttpHeaders", "name": "set", "signature": "void set(String name, String value)", "start_line": 3, "modifiers": "public", "params": [{"name": "name", "type": "String"}, {"name": "value", "type": "String"}], "return_type": "void"}, "class_info": {"name": "HttpHeaders", "kind": "class", "modifiers": "... |
124775013_2 | class NestedRadioGroupManager {
public void check(@IdRes int id) {
// don't even bother
if (id != -1 && (id == checkedId)) {
return;
}
if (checkedId != -1) {
setCheckedStateForView(checkedId, false);
}
if (id != -1) {
setCheckedS... | //given
int initialCheckId = 12345;
int newCheckId = 54321;
nestedRadioGroupManager.initCheckedId(initialCheckId);
//when
nestedRadioGroupManager.check(newCheckId);
//then
verify(nestedRadioGroupManager).setCheckedStateForView(initialCheckId, false);
... | [FOCAL] public void NestedRadioGroupManager.check(int id)
[CLASS] class NestedRadioGroupManager
[METRICS] loc=16 cc=4 branches=3 loops=0 returns=1 throws=0 nesting=1
[CALLS-INTERNAL] void setCheckedId(int id); void setCheckedStateForView(int viewId, boolean checked)
[PATH1] if(id != -1 && (id == checkedId))=F -> if(che... | /* static context
[FOCAL] public void NestedRadioGroupManager.check(int id)
[PATH1] if(id != -1 && (id == checkedId))=F -> if(checkedId != -1)=T -> if(id != -1)=T
[PATH2] if(id != -1 && (id == checkedId))=T -> return
[PATH3] if(id != -1 && (id == checkedId))=F -> if(checkedId != -1)=F -> if(id != -1)=F
[INPUTS] branche... | /* static context
[FOCAL] public void NestedRadioGroupManager.check(int id)
[PATH1] if(id != -1 && (id == checkedId))=F -> if(checkedId != -1)=T -> if(id != -1)=T
[PATH2] if(id != -1 && (id == checkedId))=T -> return
[PATH3] if(id != -1 && (id == checkedId))=F -> if(checkedId != -1)=F -> if(id != -1)=F
[INPUTS] branche... | true | ok | {"focal": {"class": "NestedRadioGroupManager", "name": "check", "signature": "void check(int id)", "start_line": 3, "modifiers": "public", "params": [{"name": "id", "type": "int"}], "return_type": "void"}, "class_info": {"name": "NestedRadioGroupManager", "kind": "class", "modifiers": "", "superclass": null, "interface... |
124862112_29 | class BizCommandProvider implements CommandProvider {
@Override
public String handleCommand(String command) {
return new BizCommand(command).process();
}
@Override public String getHelp();
@Override public boolean validate(String command);
private BizManagerService bizManagerService;
... | Biz bizA1 = ((MockBiz) bizManagerService.getBizByIdentity("A1:V1"))
.setBizState(BizState.ACTIVATED);
Biz bizA2 = ((MockBiz) bizManagerService.getBizByIdentity("A1:V2"))
.setBizState(BizState.DEACTIVATED);
Biz bizB1 = ((MockBiz) bizManagerService.getBizByIdentity("B1:V1")... | [FOCAL] @Override public String BizCommandProvider.handleCommand(String command)
[CLASS] class BizCommandProvider implements CommandProvider
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] new BizCommand(command).process/0
[NEW] BizCommand
[INPUTS] branches=- | result=command
[DATA... | /* static context
[FOCAL] @Override public String BizCommandProvider.handleCommand(String command)
[INPUTS] branches=- | result=command
[NEW] BizCommand
[CALLS-EXTERNAL] new BizCommand(command).process/0
*/
| /* static context
[FOCAL] @Override public String BizCommandProvider.handleCommand(String command)
[INPUTS] branches=- | result=command
[NEW] BizCommand
[CALLS-EXTERNAL] new BizCommand(command).process/0
*/
class BizCommandProvider implements CommandProvider {
@Override
public String handleCommand(String comma... | true | ok | {"focal": {"class": "BizCommandProvider", "name": "handleCommand", "signature": "String handleCommand(String command)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "command", "type": "String"}], "return_type": "String"}, "class_info": {"name": "BizCommandProvider", "kind": "class", "modifiers"... |
124863824_5 | class TimeWaitRunner {
public void doWithRunnable(Runnable runnable) {
long currentTimeMillis = System.currentTimeMillis();
if (runImmediately) {
runnable.run();
} else if (currentTimeMillis > lastLogTime + waitTime) {
synchronized (this) {
if (curren... | TimeWaitRunner timeWaitLogger = new TimeWaitRunner(1000);
AtomicLong atomicLong = new AtomicLong();
new Thread(()->{
while (true){
timeWaitLogger.doWithRunnable(atomicLong::incrementAndGet);
}
}).start();
Thread.sleep(1500);
Assert.... | [FOCAL] public void TimeWaitRunner.doWithRunnable(Runnable runnable)
[CLASS] class TimeWaitRunner
[METRICS] loc=15 cc=4 branches=3 loops=0 returns=0 throws=0 nesting=4
[CALLS-EXTERNAL] System.currentTimeMillis/0, Runnable.run/0
[PATH1] if(runImmediately)=F -> if(currentTimeMillis > lastLogTime + waitTime)#1=T -> if(cur... | /* static context
[FOCAL] public void TimeWaitRunner.doWithRunnable(Runnable runnable)
[PATH1] if(runImmediately)=F -> if(currentTimeMillis > lastLogTime + waitTime)#1=T -> if(currentTimeMillis > lastLogTime + waitTime)#2=T
[PATH2] if(runImmediately)=T
[PATH3] if(runImmediately)=F -> if(currentTimeMillis > lastLogTime ... | /* static context
[FOCAL] public void TimeWaitRunner.doWithRunnable(Runnable runnable)
[PATH1] if(runImmediately)=F -> if(currentTimeMillis > lastLogTime + waitTime)#1=T -> if(currentTimeMillis > lastLogTime + waitTime)#2=T
[PATH2] if(runImmediately)=T
[PATH3] if(runImmediately)=F -> if(currentTimeMillis > lastLogTime ... | true | ok | {"focal": {"class": "TimeWaitRunner", "name": "doWithRunnable", "signature": "void doWithRunnable(Runnable runnable)", "start_line": 3, "modifiers": "public", "params": [{"name": "runnable", "type": "Runnable"}], "return_type": "void"}, "class_info": {"name": "TimeWaitRunner", "kind": "class", "modifiers": "", "supercl... |
124869132_4 | class App {
public List<ChangedFile> getChangedFilesForCommit(RevCommit commit) throws IOException, GitAPIException {
List<ChangedFile> changedFiles = new ArrayList<>();
int rangeSize = 6;
int lowerIntervall = (-1) * (rangeSize / 2);
int upperIntervall = (rangeSize / 2) + 1;
... | //arrange
App app = appToBeTested;
RevCommit commit = revCommitsToBeTested.get(0);
//act
List<ChangedFile> changedFiles = app.getChangedFilesForCommit(commit);
//assert
assertEquals(changedFiles.size(),31);
}
} | [FOCAL] public List<ChangedFile> App.getChangedFilesForCommit(RevCommit commit)
[CLASS] class App
[METRICS] loc=17 cc=3 branches=1 loops=1 returns=1 throws=0 nesting=2
[CALLS-EXTERNAL] CommitProcessor.getChangedFilesWithinCommit/6, project.getRepositoryPath/0, List<ChangedFile>.size/0, List<ChangedFile>.forEach/1, List... | /* static context
[FOCAL] public List<ChangedFile> App.getChangedFilesForCommit(RevCommit commit)
[PATH1] for(i < upperIntervall)=T -> if(i < 0 && tempChangedFiles.size() > 0)=T -> exit loop -> return changedFiles
[PATH2] for(i < upperIntervall)=F -> return changedFiles
[PATH3] for(i < upperIntervall)=T -> if(i < 0 && ... | /* static context
[FOCAL] public List<ChangedFile> App.getChangedFilesForCommit(RevCommit commit)
[PATH1] for(i < upperIntervall)=T -> if(i < 0 && tempChangedFiles.size() > 0)=T -> exit loop -> return changedFiles
[PATH2] for(i < upperIntervall)=F -> return changedFiles
[PATH3] for(i < upperIntervall)=T -> if(i < 0 && ... | true | ok | {"focal": {"class": "App", "name": "getChangedFilesForCommit", "signature": "List<ChangedFile> getChangedFilesForCommit(RevCommit commit) throws IOException, GitAPIException", "start_line": 3, "modifiers": "public", "params": [{"name": "commit", "type": "RevCommit"}], "return_type": "List<ChangedFile>"}, "class_info": ... |
124882400_142 | class Element extends Node {
@Override
public Element wrap(String html) {
return (Element) super.wrap(html);
}
public Element(String tag);
public Element(Tag tag, String baseUri, Attributes attributes);
public Element(Tag tag, String baseUri);
protected List<Node> ensureChildNo... | Document doc = Jsoup.parse("<div><p>Hello</p><p>There</p></div>");
Element p = doc.select("p").first();
p.wrap("<div class='head'></div>");
assertEquals("<div><div class=\"head\"><p>Hello</p></div><p>There</p></div>", TextUtil.stripNewlines(doc.body().html()));
Element ret = p.w... | [FOCAL] @Override public Element Element.wrap(String html)
[CLASS] class Element extends Node
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] Node.wrap/1
[INPUTS] branches=- | result=html
[DATAFLOW] html@param->L3
[CLASS-MEMBERS] Element(String tag); Element(Tag tag, String baseUri... | /* static context
[FOCAL] @Override public Element Element.wrap(String html)
[INPUTS] branches=- | result=html
[CALLS-EXTERNAL] Node.wrap/1
*/
| /* static context
[FOCAL] @Override public Element Element.wrap(String html)
[INPUTS] branches=- | result=html
[CALLS-EXTERNAL] Node.wrap/1
*/
class Element extends Node {
@Override
public Element wrap(String html) {
return (Element) super.wrap(html);
}
public Element(String tag);
public ... | true | ok | {"focal": {"class": "Element", "name": "wrap", "signature": "Element wrap(String html)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "html", "type": "String"}], "return_type": "Element"}, "class_info": {"name": "Element", "kind": "class", "modifiers": "", "superclass": "Node", "interfaces": nu... |
124900009_15 | class CustomerRepository {
public Customer getFallbackCustomer(Long id, Throwable e) {
log.warn("Failed to obtain Customer, " + e.getMessage() + " for customer with id " + id);
Customer c = new Customer();
c.setId(id);
c.setUsername("Unknown");
c.setName("Unknown");
c.setSurname("Unknown");
c.setAddress... | Customer c = new Customer();
c.setId(new Long(1));
c.setUsername("Unknown");
c.setName("Unknown");
c.setSurname("Unknown");
c.setAddress("Unknown");
c.setCity("Unknown");
c.setCountry("Unknown");
c.setZipCode("Unknown");
Customer found = repository.getFallbackCustomer(new Long(1), new Exception()... | [FOCAL] public Customer CustomerRepository.getFallbackCustomer(Long id, Throwable e)
[CLASS] class CustomerRepository
[METRICS] loc=13 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] log.warn/1, Throwable.getMessage/0, Customer.setId/1, Customer.setUsername/1, Customer.setName/1, Customer.setSurna... | /* static context
[FOCAL] public Customer CustomerRepository.getFallbackCustomer(Long id, Throwable e)
[COLLABORATORS] param e:Throwable getMessage/0
[NEW] Customer
[CALLS-EXTERNAL] log.warn/1, Throwable.getMessage/0, Customer.setId/1, Customer.setUsername/1, Customer.setName/1, Customer.setSurname/1, Customer.setAddre... | /* static context
[FOCAL] public Customer CustomerRepository.getFallbackCustomer(Long id, Throwable e)
[COLLABORATORS] param e:Throwable getMessage/0
[NEW] Customer
[CALLS-EXTERNAL] log.warn/1, Throwable.getMessage/0, Customer.setId/1, Customer.setUsername/1, Customer.setName/1, Customer.setSurname/1, Customer.setAddre... | true | ok | {"focal": {"class": "CustomerRepository", "name": "getFallbackCustomer", "signature": "Customer getFallbackCustomer(Long id, Throwable e)", "start_line": 3, "modifiers": "public", "params": [{"name": "id", "type": "Long"}, {"name": "e", "type": "Throwable"}], "return_type": "Customer"}, "class_info": {"name": "Customer... |
124923731_1 | class CustomMetricsExample implements Predictor<Integer, Float> {
@Override
public CompletionStage<List<Prediction<Integer, Float>>> predict(
final ScheduledExecutorService scheduler, final Duration timeout, final Integer... input) {
return predictorBuilder.predictor().predict(scheduler, timeout, input);... | // #SemanticMetricRegistry
final SemanticMetricRegistry registry = new SemanticMetricRegistry();
final MetricId metricId = MetricId.build().tagged("service", "my-application");
// #SemanticMetricRegistry
final CustomMetricsExample example = new CustomMetricsExample(registry, metricId);
example... | [FOCAL] @Override public CompletionStage<List<Prediction<Integer, Float>>> CustomMetricsExample.predict(ScheduledExecutorService scheduler, Duration timeout, Integer... input)
[CLASS] class CustomMetricsExample implements Predictor<Integer, Float>
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CA... | /* static context
[FOCAL] @Override public CompletionStage<List<Prediction<Integer, Float>>> CustomMetricsExample.predict(ScheduledExecutorService scheduler, Duration timeout, Integer... input)
[INPUTS] branches=- | result=input, scheduler, timeout
[COLLABORATORS] field predictorBuilder predictor/0
[CALLS-EXTERNAL] pre... | /* static context
[FOCAL] @Override public CompletionStage<List<Prediction<Integer, Float>>> CustomMetricsExample.predict(ScheduledExecutorService scheduler, Duration timeout, Integer... input)
[INPUTS] branches=- | result=input, scheduler, timeout
[COLLABORATORS] field predictorBuilder predictor/0
[CALLS-EXTERNAL] pre... | true | ok | {"focal": {"class": "CustomMetricsExample", "name": "predict", "signature": "CompletionStage<List<Prediction<Integer, Float>>> predict(ScheduledExecutorService scheduler, Duration timeout, Integer... input)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "scheduler", "type": "ScheduledExecutorSe... |
125110164_1 | class WireSafeEnum {
@Nonnull
@SuppressWarnings("unchecked")
public static <T extends Enum<T>> WireSafeEnum<T> of(@Nonnull T value) {
checkNotNull(value, "value");
Class<T> enumType = (Class<T>) value.getClass();
ensureEnumCacheInitialized(enumType);
return (WireSafeEnum<T>) ENUM_LOOKUP_CACHE.ge... | Throwable t = catchThrowable(() -> WireSafeEnum.of(NumericJsonEnum.ABC));
assertThat(t)
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("NumericJsonEnum");
}
} | [FOCAL] @Nonnull @SuppressWarnings("unchecked") public static WireSafeEnum<T> WireSafeEnum.of(T value)
[CLASS] class WireSafeEnum
[METRICS] loc=9 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] T checkNotNull(T o, String name); void ensureEnumCacheInitialized(Class<T> enumType)
[CALLS-EXTERNAL] T.... | /* static context
[FOCAL] @Nonnull @SuppressWarnings("unchecked") public static WireSafeEnum<T> WireSafeEnum.of(T value)
[INPUTS] branches=- | result=value
[COLLABORATORS] param value:T getClass/0
[CALLS-INTERNAL] T checkNotNull(T o, String name); void ensureEnumCacheInitialized(Class<T> enumType)
[CALLS-EXTERNAL] T.ge... | /* static context
[FOCAL] @Nonnull @SuppressWarnings("unchecked") public static WireSafeEnum<T> WireSafeEnum.of(T value)
[INPUTS] branches=- | result=value
[COLLABORATORS] param value:T getClass/0
[CALLS-INTERNAL] T checkNotNull(T o, String name); void ensureEnumCacheInitialized(Class<T> enumType)
[CALLS-EXTERNAL] T.ge... | true | ok | {"focal": {"class": "WireSafeEnum", "name": "of", "signature": "WireSafeEnum<T> of(T value)", "start_line": 3, "modifiers": "@Nonnull @SuppressWarnings(\"unchecked\") public static", "params": [{"name": "value", "type": "T"}], "return_type": "WireSafeEnum<T>"}, "class_info": {"name": "WireSafeEnum", "kind": "class", "m... |
125157861_34 | class Promise implements HasPromise<DATA>, HasResult<DATA>, Pipeable<HasPromise<DATA>> {
@SuppressWarnings("unchecked")
public final <TARGET> Promise<TARGET> mapResult(Function<Result<? super DATA>, Result<? extends TARGET>> mapper) {
requireNonNull(mapper);
return (Promise<TARGET>)newSubPromis... | val promise = Promise.ofException(new IOException());
assertEquals (PromiseStatus.COMPLETED, promise.getStatus());
assertStrings("Result:{ Exception: java.io.IOException }", promise.getCurrentResult());
val promise2 = promise.mapResult(result -> result.whenEx... | [FOCAL] @SuppressWarnings("unchecked") public final Promise<TARGET> Promise.mapResult(Function<Result<? super DATA>, Result<? extends TARGET>> mapper)
[CLASS] class Promise implements HasPromise<DATA>, HasResult<DATA>, Pipeable<HasPromise<DATA>>
[METRICS] loc=8 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALL... | /* static context
[FOCAL] @SuppressWarnings("unchecked") public final Promise<TARGET> Promise.mapResult(Function<Result<? super DATA>, Result<? extends TARGET>> mapper)
[INPUTS] branches=- | result=mapper
[CALLS-INTERNAL] Promise<T> newSubPromise(FuncUnit2<Result<DATA>, Promise<T>> resultConsumer)
*/
| /* static context
[FOCAL] @SuppressWarnings("unchecked") public final Promise<TARGET> Promise.mapResult(Function<Result<? super DATA>, Result<? extends TARGET>> mapper)
[INPUTS] branches=- | result=mapper
[CALLS-INTERNAL] Promise<T> newSubPromise(FuncUnit2<Result<DATA>, Promise<T>> resultConsumer)
*/
class Promise impl... | true | ok | {"focal": {"class": "Promise", "name": "mapResult", "signature": "Promise<TARGET> mapResult(Function<Result<? super DATA>, Result<? extends TARGET>> mapper)", "start_line": 3, "modifiers": "@SuppressWarnings(\"unchecked\") public final", "params": [{"name": "mapper", "type": "Function<Result<? super DATA>, Result<? ext... |
125371981_24 | class DateRange implements Serializable, Comparable<DateRange> {
@Nonnull
public Optional<DateRange> getOverlap(@Nonnull DateRange otherRange) {
if (this.getGueltigAb().isAfter(otherRange.getGueltigBis()) || this.getGueltigBis().isBefore(otherRange.getGueltigAb())) {
return Optional.empty();
}
LocalDate ab... | LocalDate schnittpunkt = LocalDate.of(1976, 11, 19);
DateRange schnittpunktRange = new DateRange(schnittpunkt, schnittpunkt);
DateRange a = new DateRange(schnittpunkt.minusYears(1), schnittpunkt);
DateRange b = new DateRange(schnittpunkt, schnittpunkt.plusYears(1));
Optional<DateRange> overlap = a.getOverla... | [FOCAL] @Nonnull public Optional<DateRange> DateRange.getOverlap(DateRange otherRange)
[CLASS] class DateRange implements Serializable, Comparable<DateRange>
[METRICS] loc=11 cc=2 branches=1 loops=0 returns=2 throws=0 nesting=1
[CALLS-INTERNAL] LocalDate getGueltigAb(); LocalDate getGueltigBis()
[CALLS-EXTERNAL] this.g... | /* static context
[FOCAL] @Nonnull public Optional<DateRange> DateRange.getOverlap(DateRange otherRange)
[PATH1] if(this.getGueltigAb().isAfter(otherRange.getGueltigBis()) || this.getGueltigBis().isBefore(otherRange.getGueltigAb()))=T -> return Optional.empty()
[PATH2] if(this.getGueltigAb().isAfter(otherRange.getGuelt... | /* static context
[FOCAL] @Nonnull public Optional<DateRange> DateRange.getOverlap(DateRange otherRange)
[PATH1] if(this.getGueltigAb().isAfter(otherRange.getGueltigBis()) || this.getGueltigBis().isBefore(otherRange.getGueltigAb()))=T -> return Optional.empty()
[PATH2] if(this.getGueltigAb().isAfter(otherRange.getGuelt... | true | ok | {"focal": {"class": "DateRange", "name": "getOverlap", "signature": "Optional<DateRange> getOverlap(DateRange otherRange)", "start_line": 3, "modifiers": "@Nonnull public", "params": [{"name": "otherRange", "type": "DateRange"}], "return_type": "Optional<DateRange>"}, "class_info": {"name": "DateRange", "kind": "class"... |
125381655_0 | class User implements Serializable {
public void setName(String name) {
this.name = name;
}
public User();
public User(String name, String email);
public Integer getId();
public void setId(Integer id);
public String getName();
public String getEmail();
public void setEma... | User user = new User("User", "user@test.com");
user = userBean.add(user);
user.setName("User1");
userBean.update(user);
Assert.assertNotNull(userBean.findByName("User1"));
}
} | [FOCAL] public void User.setName(String name)
[CLASS] class User implements Serializable
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[FIELDS] write=name
[STATE] name via getName()
[DATAFLOW] name@param->L2
[CLASS-MEMBERS] User(); User(String name, String email); Integer getId(); void setId(Inte... | /* static context
[FOCAL] public void User.setName(String name)
[STATE] name via getName()
[FIELDS] write=name
*/
| /* static context
[FOCAL] public void User.setName(String name)
[STATE] name via getName()
[FIELDS] write=name
*/
class User implements Serializable {
public void setName(String name) {
this.name = name;
}
public User();
public User(String name, String email);
public Integer getId();
... | true | ok | {"focal": {"class": "User", "name": "setName", "signature": "void setName(String name)", "start_line": 3, "modifiers": "public", "params": [{"name": "name", "type": "String"}], "return_type": "void"}, "class_info": {"name": "User", "kind": "class", "modifiers": "", "superclass": null, "interfaces": "Serializable", "fie... |
125417291_49 | class EnableState extends BinaryState {
void setDrawable(@NonNull StateDraweeView view) {
FrescoImageController.create()
.load(getDrawable(view.isEnabled() ? STATE_ON : STATE_OFF))
.into(view);
}
@Override public void attach(@NonNull final StateDraweeView view);
@Overri... | StateDraweeView view = Mockito.spy(new StateDraweeView(RuntimeEnvironment.application));
EnableState state = new EnableState();
state.add(BinaryState.STATE_ON, R.drawable.ui_ic_clear);
state.add(BinaryState.STATE_OFF, R.drawable.ui_ic_clear);
state.setDrawable(view);
Mo... | [FOCAL] void EnableState.setDrawable(StateDraweeView view)
[CLASS] class EnableState extends BinaryState
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[CALLS-EXTERNAL] FrescoImageController.create() .load(getDrawable(view.isE....into/1, FrescoImageController.create().load/1, FrescoImageController... | /* static context
[FOCAL] void EnableState.setDrawable(StateDraweeView view)
[COLLABORATORS] param view:StateDraweeView isEnabled/0
[CALLS-EXTERNAL] FrescoImageController.create() .load(getDrawable(view.isE....into/1, FrescoImageController.create().load/1, FrescoImageController.create/0, getDrawable/1 (inherited), Stat... | /* static context
[FOCAL] void EnableState.setDrawable(StateDraweeView view)
[COLLABORATORS] param view:StateDraweeView isEnabled/0
[CALLS-EXTERNAL] FrescoImageController.create() .load(getDrawable(view.isE....into/1, FrescoImageController.create().load/1, FrescoImageController.create/0, getDrawable/1 (inherited), Stat... | true | ok | {"focal": {"class": "EnableState", "name": "setDrawable", "signature": "void setDrawable(StateDraweeView view)", "start_line": 3, "modifiers": "", "params": [{"name": "view", "type": "StateDraweeView"}], "return_type": "void"}, "class_info": {"name": "EnableState", "kind": "class", "modifiers": "", "superclass": "Binar... |
125471878_1 | class AddNewItemViewModel extends ViewModel {
public void addNewStock(String symbolName, BigDecimal shareCount) {
Date date = new Date();
symbolName = symbolName.trim();
StockPortfolioItem item = new StockPortfolioItem(
symbolName,
shareCount,
... | viewModel.addNewStock("GOOG", BigDecimal.ONE);
verify(portfolioRepository, atLeast(1))
.save(any(StockPortfolioItem.class));
}
} | [FOCAL] public void AddNewItemViewModel.addNewStock(String symbolName, BigDecimal shareCount)
[CLASS] class AddNewItemViewModel extends ViewModel
[METRICS] loc=14 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[CALLS-EXTERNAL] String.trim/0, PortfolioRepository.save/1, getActivity().finish/0, getActivity/0 (inher... | /* static context
[FOCAL] public void AddNewItemViewModel.addNewStock(String symbolName, BigDecimal shareCount)
[COLLABORATORS] field portfolioRepository:PortfolioRepository save/1
[FIELDS] read=portfolioRepository:PortfolioRepository
[NEW] Date, StockPortfolioItem
[CALLS-EXTERNAL] String.trim/0, PortfolioRepository.sa... | /* static context
[FOCAL] public void AddNewItemViewModel.addNewStock(String symbolName, BigDecimal shareCount)
[COLLABORATORS] field portfolioRepository:PortfolioRepository save/1
[FIELDS] read=portfolioRepository:PortfolioRepository
[NEW] Date, StockPortfolioItem
[CALLS-EXTERNAL] String.trim/0, PortfolioRepository.sa... | true | ok | {"focal": {"class": "AddNewItemViewModel", "name": "addNewStock", "signature": "void addNewStock(String symbolName, BigDecimal shareCount)", "start_line": 3, "modifiers": "public", "params": [{"name": "symbolName", "type": "String"}, {"name": "shareCount", "type": "BigDecimal"}], "return_type": "void"}, "class_info": {... |
125498620_7 | class CryptoCavaWrapper {
public static byte[] base64Decode(byte[] base64Decoded) {
return ((SodiumDecoder)
(in, out, reference) ->
Sodium.sodium_base642bin(out, in.length, in, in.length, null, reference, null, VARIANT_URLSAFE_NO_PADDING)
).decode(base64Decod... | byte[] base64Encoded = getUrlEncoder().withoutPadding().encode("test".getBytes());
assertArrayEquals("test".getBytes(StandardCharsets.UTF_8), CryptoCavaWrapper.base64Decode(base64Encoded));
}
} | [FOCAL] public static byte[] CryptoCavaWrapper.base64Decode(byte[] base64Decoded)
[CLASS] class CryptoCavaWrapper
[METRICS] loc=6 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] ((SodiumDecoder) (in, out, reference) -> Sodium.sodium_ba....decode/1, Sodium.sodium_base642bin/8
[INPUTS] branches=- | ... | /* static context
[FOCAL] public static byte[] CryptoCavaWrapper.base64Decode(byte[] base64Decoded)
[INPUTS] branches=- | result=base64Decoded
[CALLS-EXTERNAL] ((SodiumDecoder) (in, out, reference) -> Sodium.sodium_ba....decode/1, Sodium.sodium_base642bin/8
*/
| /* static context
[FOCAL] public static byte[] CryptoCavaWrapper.base64Decode(byte[] base64Decoded)
[INPUTS] branches=- | result=base64Decoded
[CALLS-EXTERNAL] ((SodiumDecoder) (in, out, reference) -> Sodium.sodium_ba....decode/1, Sodium.sodium_base642bin/8
*/
class CryptoCavaWrapper {
public static byte[] base64D... | true | ok | {"focal": {"class": "CryptoCavaWrapper", "name": "base64Decode", "signature": "byte[] base64Decode(byte[] base64Decoded)", "start_line": 3, "modifiers": "public static", "params": [{"name": "base64Decoded", "type": "byte[]"}], "return_type": "byte[]"}, "class_info": {"name": "CryptoCavaWrapper", "kind": "class", "modif... |
125508132_80 | class SyncCheck {
private SyncCheck(final int syncRateFactor, final int minThresholdSeconds, final int syncRateInSeconds) {
this.syncRateInSeconds = syncRateInSeconds;
this.lastSyncThresholdSeconds = Math.max(minThresholdSeconds, syncRateFactor * syncRateInSeconds);
LOG.info("lastSyncThres... | int syncRateFactor = 1;
int syncRateInSeconds = 1;
SyncCheck syncCheck = SyncCheck.createForTests(syncRateFactor, 1, syncRateInSeconds);
CheckResult notStartedCheck = syncCheck.syncCheck(scheduler);
assertFalse(notStartedCheck.isUp());
assertEquals(Status.DOWN, notStarted... | [FOCAL] private SyncCheck.SyncCheck(int syncRateFactor, int minThresholdSeconds, int syncRateInSeconds)
[CLASS] class SyncCheck
[METRICS] loc=6 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[CALLS-EXTERNAL] Math.max/2, Logger.info/2
[FIELDS] read=LOG:Logger | write=lastSyncThresholdSeconds, syncRateInSeconds
[ST... | /* static context
[FOCAL] private SyncCheck.SyncCheck(int syncRateFactor, int minThresholdSeconds, int syncRateInSeconds)
[STATE] lastSyncThresholdSeconds, syncRateInSeconds
[FIELDS] read=LOG:Logger | write=lastSyncThresholdSeconds, syncRateInSeconds
[CALLS-EXTERNAL] Math.max/2, Logger.info/2
*/
| /* static context
[FOCAL] private SyncCheck.SyncCheck(int syncRateFactor, int minThresholdSeconds, int syncRateInSeconds)
[STATE] lastSyncThresholdSeconds, syncRateInSeconds
[FIELDS] read=LOG:Logger | write=lastSyncThresholdSeconds, syncRateInSeconds
[CALLS-EXTERNAL] Math.max/2, Logger.info/2
*/
class SyncCheck {
... | true | ok | {"focal": {"class": "SyncCheck", "name": "SyncCheck", "signature": "SyncCheck(int syncRateFactor, int minThresholdSeconds, int syncRateInSeconds)", "start_line": 3, "modifiers": "private", "params": [{"name": "syncRateFactor", "type": "int"}, {"name": "minThresholdSeconds", "type": "int"}, {"name": "syncRateInSeconds",... |
125578728_2 | class StreamContext implements Context {
@Override
public final Collection<String> deleteState(final Collection<String> addresses)
throws InternalError, InvalidTransactionException {
TpStateDeleteRequest delRequest = TpStateDeleteRequest.newBuilder().addAllAddresses(addresses)
.setContextId(this.... | Stream stream = mock(Stream.class);
Context ctx = new StreamContext(stream, "test-context-id");
List<String> deleteList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
deleteList.add(RandomString.make(70));
}
FutureByteString okResponse = new FutureByteString("test-correlation-id");... | [FOCAL] @Override public final Collection<String> StreamContext.deleteState(Collection<String> addresses)
[CLASS] class StreamContext implements Context
[METRICS] loc=31 cc=8 branches=2 loops=1 returns=1 throws=5 nesting=2
[CALLS-EXTERNAL] TpStateDeleteRequest.newBuilder().addAllAddresses(address....build/0, TpStateDel... | /* static context
[FOCAL] @Override public final Collection<String> StreamContext.deleteState(Collection<String> addresses)
[THROWS-WHEN] InternalError when try-body throws
[THROWS-WHEN] InvalidTransactionException when delResponse != null && delResponse.getStatus() == TpStateDeleteResponse.Status.AUTHORIZATION_ERROR
[... | /* static context
[FOCAL] @Override public final Collection<String> StreamContext.deleteState(Collection<String> addresses)
[THROWS-WHEN] InternalError when try-body throws
[THROWS-WHEN] InvalidTransactionException when delResponse != null && delResponse.getStatus() == TpStateDeleteResponse.Status.AUTHORIZATION_ERROR
[... | true | ok | {"focal": {"class": "StreamContext", "name": "deleteState", "signature": "Collection<String> deleteState(Collection<String> addresses) throws InternalError, InvalidTransactionException", "start_line": 3, "modifiers": "@Override public final", "params": [{"name": "addresses", "type": "Collection<String>"}], "return_type... |
125602657_0 | class Sample3Controller {
@PostMapping("/sample3")
public String save(@RequestBody PointDto requestDto){
messagingTemplate.convertAndSend("sample3", requestDto);
return "success";
}
@MockBean PointRepository pointRepository;
@Autowired ObjectMapper objectMapper;
@Autowired Samp... | // given:
PointDto requestDto = PointDto.builder()
.userId(1L)
.savePoint(1000L)
.description("buy laptop")
.build();
given(pointRepository.save(any()))
.willThrow(new IllegalArgumentException("fail"));
poi... | [FOCAL] @PostMapping("/sample3") public String Sample3Controller.save(PointDto requestDto)
[CLASS] class Sample3Controller
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] QueueMessagingTemplate.convertAndSend/2
[FIELDS] read=messagingTemplate:QueueMessagingTemplate
[COLLABORATORS] ... | /* static context
[FOCAL] @PostMapping("/sample3") public String Sample3Controller.save(PointDto requestDto)
[COLLABORATORS] field messagingTemplate:QueueMessagingTemplate convertAndSend/2
[FIELDS] read=messagingTemplate:QueueMessagingTemplate
[CALLS-EXTERNAL] QueueMessagingTemplate.convertAndSend/2
*/
| /* static context
[FOCAL] @PostMapping("/sample3") public String Sample3Controller.save(PointDto requestDto)
[COLLABORATORS] field messagingTemplate:QueueMessagingTemplate convertAndSend/2
[FIELDS] read=messagingTemplate:QueueMessagingTemplate
[CALLS-EXTERNAL] QueueMessagingTemplate.convertAndSend/2
*/
class Sample3Con... | true | ok | {"focal": {"class": "Sample3Controller", "name": "save", "signature": "String save(PointDto requestDto)", "start_line": 3, "modifiers": "@PostMapping(\"/sample3\") public", "params": [{"name": "requestDto", "type": "PointDto"}], "return_type": "String"}, "class_info": {"name": "Sample3Controller", "kind": "class", "mod... |
125627767_0 | class FunctionApp {
public static JsonObject main(JsonObject args) {
JsonObject response = new JsonObject();
response.addProperty("greetings", "Hello! Welcome to OpenWhisk on OpenShift");
return response;
}
}
class FunctionAppTest {
@Test
public void testFunction() {
| JsonObject args = new JsonObject();
JsonObject response = FunctionApp.main(args);
assertNotNull(response);
String greetings = response.getAsJsonPrimitive("greetings").getAsString();
assertNotNull(greetings);
assertEquals("Hello! Welcome to OpenWhisk on OpenShift", greetin... | [FOCAL] public static JsonObject FunctionApp.main(JsonObject args)
[CLASS] class FunctionApp
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] JsonObject.addProperty/2
[NEW] JsonObject
[INPUTS] branches=- | result=- | unused=args
[DATAFLOW] response@L2->L3,L4
[TEST] FunctionAppTest: ... | /* static context
[FOCAL] public static JsonObject FunctionApp.main(JsonObject args)
[INPUTS] branches=- | result=- | unused=args
[NEW] JsonObject
[CALLS-EXTERNAL] JsonObject.addProperty/2
*/
| /* static context
[FOCAL] public static JsonObject FunctionApp.main(JsonObject args)
[INPUTS] branches=- | result=- | unused=args
[NEW] JsonObject
[CALLS-EXTERNAL] JsonObject.addProperty/2
*/
class FunctionApp {
public static JsonObject main(JsonObject args) {
JsonObject response = new JsonObject();
... | true | ok | {"focal": {"class": "FunctionApp", "name": "main", "signature": "JsonObject main(JsonObject args)", "start_line": 3, "modifiers": "public static", "params": [{"name": "args", "type": "JsonObject"}], "return_type": "JsonObject"}, "class_info": {"name": "FunctionApp", "kind": "class", "modifiers": "", "superclass": null,... |
125691541_55 | class Solver {
public int moves() {
return solution.size() - 1;
}
public Solver(WorldState initial);
public Iterable<WorldState> solution();
}
class TestSolver {
@Test
public void test4x4BoardPuzzles() {
| for (int i = 0; i <= 30; i += 1) {
String pnum = String.format("%02d", i);
String puzzleName = "input/puzzle4x4-" + pnum + ".txt";
Board b = readBoard(puzzleName);
int numMoves = i;
BoardPuzzleSolution bps = new BoardPuzzleSolution(puzzleName, b, numMo... | [FOCAL] public int Solver.moves()
[CLASS] class Solver
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] solution.size/0
[COLLABORATORS] field solution size/0
[CLASS-MEMBERS] Solver(WorldState initial); Iterable<WorldState> solution()
[TEST] TestSolver: @Test public void test4x4Board... | /* static context
[FOCAL] public int Solver.moves()
[COLLABORATORS] field solution size/0
[CALLS-EXTERNAL] solution.size/0
*/
| /* static context
[FOCAL] public int Solver.moves()
[COLLABORATORS] field solution size/0
[CALLS-EXTERNAL] solution.size/0
*/
class Solver {
public int moves() {
return solution.size() - 1;
}
public Solver(WorldState initial);
public Iterable<WorldState> solution();
}
class TestSolver {
... | true | ok | {"focal": {"class": "Solver", "name": "moves", "signature": "int moves()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "int"}, "class_info": {"name": "Solver", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [], "members": [{"name": "Solver", "kind": "constru... |
125705175_1 | class CurrentPlayerSwitch extends AbstractGameRules {
public void switchCurrentPlayer(Game game) {
if (game.isFinished()) {
return;
}
int iterations = 0;
Player player = game.getCurrentPlayer();
boolean isMoveFeasible;
do {
player = getNextPlayer(game, player.getId());
is... | game.setFinished(true);
currentPlayerSwitch.switchCurrentPlayer(game);
assertThat(game.getCurrentPlayer().getId()).isEqualTo(FIRST_PLAYER_ID);
}
} | [FOCAL] public void CurrentPlayerSwitch.switchCurrentPlayer(Game game)
[CLASS] class CurrentPlayerSwitch extends AbstractGameRules
[METRICS] loc=27 cc=5 branches=3 loops=1 returns=1 throws=1 nesting=2
[CALLS-INTERNAL] void switchPlayerCells(Game game, long playerId)
[CALLS-EXTERNAL] Game.isFinished/0, Game.getCurrentPl... | /* static context
[FOCAL] public void CurrentPlayerSwitch.switchCurrentPlayer(Game game)
[THROWS-WHEN] IllegalStateException when !game.isFinished() && !isMoveFeasible && iterations > game.getPlayers().size()
[THROWS-WHEN] IllegalStateException when !game.isFinished() && isMoveFeasible && iterations > game.getPlayers()... | /* static context
[FOCAL] public void CurrentPlayerSwitch.switchCurrentPlayer(Game game)
[THROWS-WHEN] IllegalStateException when !game.isFinished() && !isMoveFeasible && iterations > game.getPlayers().size()
[THROWS-WHEN] IllegalStateException when !game.isFinished() && isMoveFeasible && iterations > game.getPlayers()... | true | ok | {"focal": {"class": "CurrentPlayerSwitch", "name": "switchCurrentPlayer", "signature": "void switchCurrentPlayer(Game game)", "start_line": 3, "modifiers": "public", "params": [{"name": "game", "type": "Game"}], "return_type": "void"}, "class_info": {"name": "CurrentPlayerSwitch", "kind": "class", "modifiers": "", "sup... |
125752732_452 | class OfflineQueryController extends AbstractQueryController {
@Override
public <T extends ParseObject> Task<Integer> countAsync(
ParseQuery.State<T> state,
ParseUser user,
Task<Void> cancellationToken) {
if (state.isFromLocalDatastore()) {
return offlineStore.countFromPinAsync(state.pi... | TestNetworkQueryController networkController = new TestNetworkQueryController();
OfflineQueryController controller = new OfflineQueryController(null, networkController);
ParseQuery.State<ParseObject> state = new ParseQuery.State.Builder<>("TestObject")
.build();
controller.countAsync(state, nul... | [FOCAL] @Override public Task<Integer> OfflineQueryController.countAsync(ParseQuery.State<T> state, ParseUser user, Task<Void> cancellationToken)
[CLASS] class OfflineQueryController extends AbstractQueryController
[METRICS] loc=11 cc=2 branches=1 loops=0 returns=2 throws=0 nesting=1
[CALLS-EXTERNAL] ParseQuery.State<T... | /* static context
[FOCAL] @Override public Task<Integer> OfflineQueryController.countAsync(ParseQuery.State<T> state, ParseUser user, Task<Void> cancellationToken)
[PATH1] if(state.isFromLocalDatastore())=T -> return offlineStore.countFromPinAsync(state.pinName(), state, user)
[PATH2] if(state.isFromLocalDatastore())=F... | /* static context
[FOCAL] @Override public Task<Integer> OfflineQueryController.countAsync(ParseQuery.State<T> state, ParseUser user, Task<Void> cancellationToken)
[PATH1] if(state.isFromLocalDatastore())=T -> return offlineStore.countFromPinAsync(state.pinName(), state, user)
[PATH2] if(state.isFromLocalDatastore())=F... | true | ok | {"focal": {"class": "OfflineQueryController", "name": "countAsync", "signature": "Task<Integer> countAsync(ParseQuery.State<T> state, ParseUser user, Task<Void> cancellationToken)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "state", "type": "ParseQuery.State<T>"}, {"name": "user", "type": "P... |
125770258_0 | class HelloWorldView extends Composite {
@UiHandler("showButton")
void handleShowButtonClick(ClickEvent e) {
if (bananaCount != 0) {
foodMultipleSelect.getSelectedItems()
.forEach(item -> Notify.notify(item.toString()));
} else {
notify("No banana, no food.");
}
eventBus.fireEvent(new ChangeViewE... | // CUT
view.handleShowButtonClick(null);
// Asserts
verify(foodMultipleSelect, times(1)).getSelectedItems();
}
} | [FOCAL] @UiHandler("showButton") void HelloWorldView.handleShowButtonClick(ClickEvent e)
[CLASS] class HelloWorldView extends Composite
[METRICS] loc=11 cc=2 branches=1 loops=0 returns=0 throws=0 nesting=1
[CALLS-INTERNAL] void notify(String s)
[CALLS-EXTERNAL] foodMultipleSelect.getSelectedItems().forEach/1, MultipleS... | /* static context
[FOCAL] @UiHandler("showButton") void HelloWorldView.handleShowButtonClick(ClickEvent e)
[PATH1] if(bananaCount != 0)=T
[PATH2] if(bananaCount != 0)=F
[INPUTS] branches=- | result=- | unused=e
[COLLABORATORS] field foodMultipleSelect:MultipleSelect getSelectedItems/0; field item toString/0; field even... | /* static context
[FOCAL] @UiHandler("showButton") void HelloWorldView.handleShowButtonClick(ClickEvent e)
[PATH1] if(bananaCount != 0)=T
[PATH2] if(bananaCount != 0)=F
[INPUTS] branches=- | result=- | unused=e
[COLLABORATORS] field foodMultipleSelect:MultipleSelect getSelectedItems/0; field item toString/0; field even... | true | ok | {"focal": {"class": "HelloWorldView", "name": "handleShowButtonClick", "signature": "void handleShowButtonClick(ClickEvent e)", "start_line": 3, "modifiers": "@UiHandler(\"showButton\")", "params": [{"name": "e", "type": "ClickEvent"}], "return_type": "void"}, "class_info": {"name": "HelloWorldView", "kind": "class", "... |
125843963_15 | class RESTService {
@GET
@Context
@Path("/questionsold")
@Produces(MediaType.APPLICATION_JSON)
public RESTQuestions getQuestionsJSON(@Context ServletContext context, @QueryParam("domain") String domain, @QueryParam("type") List<String> questionTypes, @QueryParam("limit") int maxNrOfQuestions) {
logger.info("RES... | fail("Not yet implemented");
}
} | [FOCAL] @GET @Context @Path("/questionsold") @Produces(MediaType.APPLICATION_JSON) public RESTQuestions RESTService.getQuestionsJSON(ServletContext context, String domain, List<String> questionTypes, int maxNrOfQuestions)
[CLASS] class RESTService
[METRICS] loc=74 cc=10 branches=4 loops=5 returns=1 throws=0 nesting=4
[... | /* static context
[FOCAL] @GET @Context @Path("/questionsold") @Produces(MediaType.APPLICATION_JSON) public RESTQuestions RESTService.getQuestionsJSON(ServletContext context, String domain, List<String> questionTypes, int maxNrOfQuestions)
[PATH1] foreach(String type : questionTypes)=T -> if(type.equals(QuestionType.MC... | /* static context
[FOCAL] @GET @Context @Path("/questionsold") @Produces(MediaType.APPLICATION_JSON) public RESTQuestions RESTService.getQuestionsJSON(ServletContext context, String domain, List<String> questionTypes, int maxNrOfQuestions)
[PATH1] foreach(String type : questionTypes)=T -> if(type.equals(QuestionType.MC... | true | ok | {"focal": {"class": "RESTService", "name": "getQuestionsJSON", "signature": "RESTQuestions getQuestionsJSON(ServletContext context, String domain, List<String> questionTypes, int maxNrOfQuestions)", "start_line": 3, "modifiers": "@GET @Context @Path(\"/questionsold\") @Produces(MediaType.APPLICATION_JSON) public", "par... |
125942409_0 | class OnlineShopping {
public void switchStore(Store storeToSwitchTo) {
Cart cart = (Cart) session.get("CART");
DeliveryInformation deliveryInformation = (DeliveryInformation) session.get("DELIVERY_INFO");
if (storeToSwitchTo == null) {
if (cart != null) {
for (I... | DeliveryInformation deliveryInfo = new DeliveryInformation("HOME_DELIVERY", nordstan, 60);
deliveryInfo.setDeliveryAddress("NEARBY");
Cart cart = new Cart();
cart.addItem(cherryBloom);
cart.addItem(blusherBrush);
cart.addItem(masterclass);
cart.addItem(makeoverNo... | [FOCAL] public void OnlineShopping.switchStore(Store storeToSwitchTo)
[CLASS] class OnlineShopping
[METRICS] loc=68 cc=17 branches=12 loops=4 returns=0 throws=0 nesting=5
[CALLS-EXTERNAL] session.get/1, Cart.getItems/0, "EVENT".equals/1, Item.getType/0, Cart.markAsUnavailable/1, DeliveryInformation.setType/1, DeliveryI... | /* static context
[FOCAL] public void OnlineShopping.switchStore(Store storeToSwitchTo)
[PATH1] if(storeToSwitchTo == null)=F -> if(cart != null)#2=T -> foreach(Item item : cart.getItems())#2=T -> if("EVENT".equals(item.getType()))#2=T -> if(storeToSwitchTo.hasItem(item))=T -> exit loop -> foreach(Item item : cart.getU... | /* static context
[FOCAL] public void OnlineShopping.switchStore(Store storeToSwitchTo)
[PATH1] if(storeToSwitchTo == null)=F -> if(cart != null)#2=T -> foreach(Item item : cart.getItems())#2=T -> if("EVENT".equals(item.getType()))#2=T -> if(storeToSwitchTo.hasItem(item))=T -> exit loop -> foreach(Item item : cart.getU... | true | ok | {"focal": {"class": "OnlineShopping", "name": "switchStore", "signature": "void switchStore(Store storeToSwitchTo)", "start_line": 3, "modifiers": "public", "params": [{"name": "storeToSwitchTo", "type": "Store"}], "return_type": "void"}, "class_info": {"name": "OnlineShopping", "kind": "class", "modifiers": "", "super... |
125985734_86 | class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer {
@Override
public void customize(WebServerFactory server) {
setMimeMappings(server);
// When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
setLocationForStati... | props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
webConfigurer.customize(container);
Builder builder = Undertow.builder();
container.getBuilderCustomizers().forEach(c -> c.customi... | [FOCAL] @Override public void WebConfigurer.customize(WebServerFactory server)
[CLASS] class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer
[METRICS] loc=20 cc=2 branches=1 loops=0 returns=0 throws=0 nesting=1
[CALLS-INTERNAL] void setLocationForStaticAssets(WebServerFactory server); voi... | /* static context
[FOCAL] @Override public void WebConfigurer.customize(WebServerFactory server)
[PATH1] if((jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof Underto...)=T
[PATH2] if((jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Ver... | /* static context
[FOCAL] @Override public void WebConfigurer.customize(WebServerFactory server)
[PATH1] if((jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof Underto...)=T
[PATH2] if((jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Ver... | true | ok | {"focal": {"class": "WebConfigurer", "name": "customize", "signature": "void customize(WebServerFactory server)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "server", "type": "WebServerFactory"}], "return_type": "void"}, "class_info": {"name": "WebConfigurer", "kind": "class", "modifiers": ""... |
126022604_1 | class Util {
public static Calendar getCalendarForLocale(Calendar oldCalendar, Locale locale) {
if (locale == null)
throw new IllegalArgumentException("You must specify the Locate value");
if (oldCalendar == null)
return Calendar.getInstance(locale);
long currentTi... | Locale locale = new Locale("en", "US");
Calendar calendar = Calendar.getInstance(locale);
Calendar result = Util.getCalendarForLocale(calendar, locale);
assertEquals(result.getTime(), result.getTime());
}
} | [FOCAL] public static Calendar Util.getCalendarForLocale(Calendar oldCalendar, Locale locale)
[CLASS] class Util
[METRICS] loc=12 cc=3 branches=2 loops=0 returns=2 throws=1 nesting=1
[CALLS-EXTERNAL] Calendar.getInstance/1, Calendar.getTimeInMillis/0, Calendar.setTimeInMillis/1
[NEW] IllegalArgumentException
[EXCEPTION... | /* static context
[FOCAL] public static Calendar Util.getCalendarForLocale(Calendar oldCalendar, Locale locale)
[THROWS-WHEN] IllegalArgumentException when locale == null
[PATH1] if(locale == null)=F -> if(oldCalendar == null)=T -> return Calendar.getInstance(locale)
[PATH2] if(locale == null)=T -> throw new IllegalArg... | /* static context
[FOCAL] public static Calendar Util.getCalendarForLocale(Calendar oldCalendar, Locale locale)
[THROWS-WHEN] IllegalArgumentException when locale == null
[PATH1] if(locale == null)=F -> if(oldCalendar == null)=T -> return Calendar.getInstance(locale)
[PATH2] if(locale == null)=T -> throw new IllegalArg... | true | ok | {"focal": {"class": "Util", "name": "getCalendarForLocale", "signature": "Calendar getCalendarForLocale(Calendar oldCalendar, Locale locale)", "start_line": 3, "modifiers": "public static", "params": [{"name": "oldCalendar", "type": "Calendar"}, {"name": "locale", "type": "Locale"}], "return_type": "Calendar"}, "class_... |
126149876_50 | class FallbackJSBundleLoader extends JSBundleLoader {
@Override
public String loadScript(CatalystInstanceImpl instance) {
while (true) {
try {
return getDelegateLoader().loadScript(instance);
} catch (Exception e) {
if (e.getMessage() == null || !e.getMessage().startsWith(RECOVERABL... | JSBundleLoader delegates[] = new JSBundleLoader[] {
recoverableLoader("url1", "error1"),
recoverableLoader("url2", "error2")
};
FallbackJSBundleLoader fallbackLoader =
new FallbackJSBundleLoader(new ArrayList<>(Arrays.asList(delegates)));
try {
fallbackLoader.loadScript(null);
... | [FOCAL] @Override public String FallbackJSBundleLoader.loadScript(CatalystInstanceImpl instance)
[CLASS] class FallbackJSBundleLoader extends JSBundleLoader
[METRICS] loc=16 cc=3 branches=1 loops=1 returns=1 throws=1 nesting=3
[CALLS-INTERNAL] JSBundleLoader getDelegateLoader()
[CALLS-EXTERNAL] getDelegateLoader().load... | /* static context
[FOCAL] @Override public String FallbackJSBundleLoader.loadScript(CatalystInstanceImpl instance)
[THROWS-WHEN] e when true && try-body throws && e.getMessage() == null || !e.getMessage().startsWith(RECOVERABLE)
[PATH1] while(true)=T -> try-body throws -> if(e.getMessage() == null || !e.getMessage().st... | /* static context
[FOCAL] @Override public String FallbackJSBundleLoader.loadScript(CatalystInstanceImpl instance)
[THROWS-WHEN] e when true && try-body throws && e.getMessage() == null || !e.getMessage().startsWith(RECOVERABLE)
[PATH1] while(true)=T -> try-body throws -> if(e.getMessage() == null || !e.getMessage().st... | true | ok | {"focal": {"class": "FallbackJSBundleLoader", "name": "loadScript", "signature": "String loadScript(CatalystInstanceImpl instance)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "instance", "type": "CatalystInstanceImpl"}], "return_type": "String"}, "class_info": {"name": "FallbackJSBundleLoade... |
126250036_0 | class SQLLookupService extends AbstractSQLLookupService<String> {
@Override
public Class<?> getValueType() {
return String.class;
}
public SQLLookupService();
@Override protected List<PropertyDescriptor> getSupportedPropertyDescriptors();
@Override Optional<String> databaseLookup(Map... | assertEquals(sqlLookupService.getValueType(), String.class);
}
} | [FOCAL] @Override public Class<?> SQLLookupService.getValueType()
[CLASS] class SQLLookupService extends AbstractSQLLookupService<String>
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CLASS-MEMBERS] SQLLookupService(); List<PropertyDescriptor> getSupportedPropertyDescriptors(); Optional<String> ... | /* static context
[FOCAL] @Override public Class<?> SQLLookupService.getValueType()
*/
| /* static context
[FOCAL] @Override public Class<?> SQLLookupService.getValueType()
*/
class SQLLookupService extends AbstractSQLLookupService<String> {
@Override
public Class<?> getValueType() {
return String.class;
}
public SQLLookupService();
@Override protected List<PropertyDescripto... | true | ok | {"focal": {"class": "SQLLookupService", "name": "getValueType", "signature": "Class<?> getValueType()", "start_line": 3, "modifiers": "@Override public", "params": [], "return_type": "Class<?>"}, "class_info": {"name": "SQLLookupService", "kind": "class", "modifiers": "", "superclass": "AbstractSQLLookupService<String>... |
126275473_1175 | class ResourceTypesResource extends RealmAwareResource {
@Override
public Promise<ResourceResponse, ResourceException> createInstance(Context context, CreateRequest request) {
String principalName = "unknown";
try {
final Subject subject = getSubject(context);
principalN... | //given
CreateRequest mockCreateRequest = mock(CreateRequest.class);
JsonValue content = mock(JsonValue.class);
given(mockCreateRequest.getContent()).willReturn(content);
given(mockCreateRequest.getNewResourceId()).willReturn(null);
given(content.toString()).willReturn(... | [FOCAL] @Override public Promise<ResourceResponse, ResourceException> ResourceTypesResource.createInstance(Context context, CreateRequest request)
[CLASS] class ResourceTypesResource extends RealmAwareResource
[METRICS] loc=27 cc=3 branches=1 loops=0 returns=2 throws=1 nesting=2
[CALLS-INTERNAL] JsonResourceType create... | /* static context
[FOCAL] @Override public Promise<ResourceResponse, ResourceException> ResourceTypesResource.createInstance(Context context, CreateRequest request)
[PATH1] if(isEmpty(jsonWrapper.getName()))=T -> throw new EntitlementException(MISSING_RESOURCE_TYPE_NAME) -> return exceptionMappingHandler.handleError(co... | /* static context
[FOCAL] @Override public Promise<ResourceResponse, ResourceException> ResourceTypesResource.createInstance(Context context, CreateRequest request)
[PATH1] if(isEmpty(jsonWrapper.getName()))=T -> throw new EntitlementException(MISSING_RESOURCE_TYPE_NAME) -> return exceptionMappingHandler.handleError(co... | true | ok | {"focal": {"class": "ResourceTypesResource", "name": "createInstance", "signature": "Promise<ResourceResponse, ResourceException> createInstance(Context context, CreateRequest request)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "context", "type": "Context"}, {"name": "request", "type": "Cre... |
126316912_98 | class FieldAgent implements IOFogModule {
public String deProvision(boolean isTokenExpired) {
logInfo("Start Deprovisioning");
if (!provisioningLock.tryLock()) {
String msg = "Provisioning in progress";
logInfo(msg);
return msg;
}
try {
... | try {
initiateMockStart();
when(fieldAgentStatus.getControllerStatus()).thenReturn(Constants.ControllerStatus.OK);
when(orchestrator.request(eq("deprovision"), any(), any(), any())).thenThrow(new SSLHandshakeException("Invalid operation"));
String response = field... | [FOCAL] public String FieldAgent.deProvision(boolean isTokenExpired)
[CLASS] class FieldAgent implements IOFogModule
[METRICS] loc=51 cc=9 branches=3 loops=0 returns=3 throws=0 nesting=3
[CALLS-INTERNAL] JsonObject getDeprovisionBody(); boolean notProvisioned(); void notifyModules(); void verificationFailed(Exception e... | /* static context
[FOCAL] public String FieldAgent.deProvision(boolean isTokenExpired)
[PATH1] if(!provisioningLock.tryLock())=F -> if(notProvisioned())=F -> if(!isTokenExpired)=T -> try-body throws -> return "\nSuccess - tokens, identifiers and keys removed"
[PATH2] if(!provisioningLock.tryLock())=T -> return msg
[PAT... | /* static context
[FOCAL] public String FieldAgent.deProvision(boolean isTokenExpired)
[PATH1] if(!provisioningLock.tryLock())=F -> if(notProvisioned())=F -> if(!isTokenExpired)=T -> try-body throws -> return "\nSuccess - tokens, identifiers and keys removed"
[PATH2] if(!provisioningLock.tryLock())=T -> return msg
[PAT... | true | ok | {"focal": {"class": "FieldAgent", "name": "deProvision", "signature": "String deProvision(boolean isTokenExpired)", "start_line": 3, "modifiers": "public", "params": [{"name": "isTokenExpired", "type": "boolean"}], "return_type": "String"}, "class_info": {"name": "FieldAgent", "kind": "class", "modifiers": "", "supercl... |
126590345_3 | class ActivityLifebus extends BaseLifebus<Activity, ActivityEvent> {
@NonNull
public static Lifebus<ActivityEvent> create(@NonNull Activity activity) {
final Application application = activity.getApplication();
if (application == null) {
throw new IllegalStateException("Provided act... | // when created lifebus immediately registers callbacks
final Activity activity = mock(Activity.class);
final Application application = mock(Application.class);
ActivityLifebus.create(application, activity);
verify(application, times(1))
.registerActivityLifecy... | [FOCAL] @NonNull public static Lifebus<ActivityEvent> ActivityLifebus.create(Activity activity)
[CLASS] class ActivityLifebus extends BaseLifebus<Activity, ActivityEvent>
[METRICS] loc=10 cc=2 branches=1 loops=0 returns=1 throws=1 nesting=1
[CALLS-EXTERNAL] Activity.getApplication/0, activity.getClass().getName/0, Acti... | /* static context
[FOCAL] @NonNull public static Lifebus<ActivityEvent> ActivityLifebus.create(Activity activity)
[THROWS-WHEN] IllegalStateException when application == null
[PATH1] if(application == null)=T -> throw new IllegalStateException("Provided activity '" + activity.getClass...
[PATH2] if(application == null)... | /* static context
[FOCAL] @NonNull public static Lifebus<ActivityEvent> ActivityLifebus.create(Activity activity)
[THROWS-WHEN] IllegalStateException when application == null
[PATH1] if(application == null)=T -> throw new IllegalStateException("Provided activity '" + activity.getClass...
[PATH2] if(application == null)... | true | ok | {"focal": {"class": "ActivityLifebus", "name": "create", "signature": "Lifebus<ActivityEvent> create(Activity activity)", "start_line": 3, "modifiers": "@NonNull public static", "params": [{"name": "activity", "type": "Activity"}], "return_type": "Lifebus<ActivityEvent>"}, "class_info": {"name": "ActivityLifebus", "kin... |
126705523_2 | class MyServiceImpl implements MyService {
@Override
@ServiceValidation
public DTO getDto (final DTO dto){
return dto;
}
@Autowired
private MyService myService;
}
class MyServiceImplTest {
@Autowired
private MyService myService;
@Test
public void everythingFine(){
|
final DTO dto = new DTO();
dto.setNumber(1);
dto.setText("test");
final DTO result = myService.getDto(dto);
Assert.assertEquals(result.getNumber(), dto.getNumber());
Assert.assertEquals(result.getText(), dto.getText());
}
} | [FOCAL] @Override @ServiceValidation public DTO MyServiceImpl.getDto(DTO dto)
[CLASS] class MyServiceImpl implements MyService
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[INPUTS] branches=- | result=dto
[DATAFLOW] dto@param->L4
[TEST] MyServiceImplTest: @Test public void everythingFine()
[TEST... | /* static context
[FOCAL] @Override @ServiceValidation public DTO MyServiceImpl.getDto(DTO dto)
[INPUTS] branches=- | result=dto
*/
| /* static context
[FOCAL] @Override @ServiceValidation public DTO MyServiceImpl.getDto(DTO dto)
[INPUTS] branches=- | result=dto
*/
class MyServiceImpl implements MyService {
@Override
@ServiceValidation
public DTO getDto (final DTO dto){
return dto;
}
@Autowired
private MyService mySe... | true | ok | {"focal": {"class": "MyServiceImpl", "name": "getDto", "signature": "DTO getDto(DTO dto)", "start_line": 3, "modifiers": "@Override @ServiceValidation public", "params": [{"name": "dto", "type": "DTO"}], "return_type": "DTO"}, "class_info": {"name": "MyServiceImpl", "kind": "class", "modifiers": "", "superclass": null,... |
126711206_181 | class Ed25519DsaSigner implements DsaSigner {
@Override
@SuppressWarnings("squid:S00117")
public Signature sign(final byte[] data) {
if (!this.getKeyPair().hasPrivateKey()) {
throw new CryptoException("cannot sign without private key");
}
Hasher hasher32 = Hashes::sha512;
Hasher hasher64 =... | // Arrange:
final CryptoEngine engine = this.getCryptoEngine();
final KeyPair keyPair = KeyPair.random(engine);
final Ed25519DsaSigner dsaSigner =
new Ed25519DsaSigner(keyPair) {
@Override
public boolean isCanonicalSignature(Signature signature) {
return false;
... | [FOCAL] @Override @SuppressWarnings("squid:S00117") public Signature Ed25519DsaSigner.sign(byte[] data)
[CLASS] class Ed25519DsaSigner implements DsaSigner
[METRICS] loc=55 cc=3 branches=2 loops=0 returns=1 throws=2 nesting=1
[CALLS-INTERNAL] KeyPair getKeyPair(); boolean isCanonicalSignature(Signature signature)
[CALL... | /* static context
[FOCAL] @Override @SuppressWarnings("squid:S00117") public Signature Ed25519DsaSigner.sign(byte[] data)
[THROWS-WHEN] CryptoException when !this.getKeyPair().hasPrivateKey()
[THROWS-WHEN] CryptoException when !(!this.getKeyPair().hasPrivateKey()) && !this.isCanonicalSignature(signature)
[PATH1] if(!th... | /* static context
[FOCAL] @Override @SuppressWarnings("squid:S00117") public Signature Ed25519DsaSigner.sign(byte[] data)
[THROWS-WHEN] CryptoException when !this.getKeyPair().hasPrivateKey()
[THROWS-WHEN] CryptoException when !(!this.getKeyPair().hasPrivateKey()) && !this.isCanonicalSignature(signature)
[PATH1] if(!th... | true | ok | {"focal": {"class": "Ed25519DsaSigner", "name": "sign", "signature": "Signature sign(byte[] data)", "start_line": 3, "modifiers": "@Override @SuppressWarnings(\"squid:S00117\") public", "params": [{"name": "data", "type": "byte[]"}], "return_type": "Signature"}, "class_info": {"name": "Ed25519DsaSigner", "kind": "class... |
126785618_6 | class CoconutValidator {
public static boolean areFieldsValid(CoconutView... views) {
boolean ret = true;
for (CoconutView view : views) {
CoconutInput inputView = view.getCoconutView();
if (inputView == null || inputView.isOptional()) {
continue;
... | when(coconutView.getCoconutView()).thenReturn(coconutInput);
when(coconutInput.getInput()).thenReturn("1234");
when(coconutInput.getValidationRegex()).thenReturn("[0-9]+");
when(coconutInput.getErrorMessages()).thenReturn("only numbers");
boolean condition = CoconutValidator.areF... | [FOCAL] public static boolean CoconutValidator.areFieldsValid(CoconutView... views)
[CLASS] class CoconutValidator
[METRICS] loc=27 cc=6 branches=4 loops=1 returns=1 throws=0 nesting=3
[CALLS-EXTERNAL] CoconutView.getCoconutView/0, CoconutInput.isOptional/0, CoconutInput.getInput/0, CoconutInput.getValidationRegex/0, C... | /* static context
[FOCAL] public static boolean CoconutValidator.areFieldsValid(CoconutView... views)
[PATH1] foreach(CoconutView view : views)=T -> if(inputView == null || inputView.isOptional())=F -> if(!inputView.isOptional() && input == null)=F -> if(regex != null && errorMessage != null && input != null)=T -> if(!... | /* static context
[FOCAL] public static boolean CoconutValidator.areFieldsValid(CoconutView... views)
[PATH1] foreach(CoconutView view : views)=T -> if(inputView == null || inputView.isOptional())=F -> if(!inputView.isOptional() && input == null)=F -> if(regex != null && errorMessage != null && input != null)=T -> if(!... | true | ok | {"focal": {"class": "CoconutValidator", "name": "areFieldsValid", "signature": "boolean areFieldsValid(CoconutView... views)", "start_line": 3, "modifiers": "public static", "params": [{"name": "views", "type": "CoconutView..."}], "return_type": "boolean"}, "class_info": {"name": "CoconutValidator", "kind": "class", "m... |
126825296_298 | class CommandRunner implements Runnable, Closeable {
void fetchAndRunCommands() {
ConsumerRecords<CommandId, Command> records = commandStore.getNewCommands();
log.trace("Found {} new writes to command topic", records.count());
for (ConsumerRecord<CommandId, Command> record : records) {
CommandId co... | StatementExecutor statementExecutor = mock(StatementExecutor.class);
statementExecutor.handleStatement(anyObject(), anyObject());
expectLastCall().times(4);
replay(statementExecutor);
CommandStore commandStore = mock(CommandStore.class);
expect(commandStore.getNewCommands()).andReturn(new Consu... | [FOCAL] void CommandRunner.fetchAndRunCommands()
[CLASS] class CommandRunner implements Runnable, Closeable
[METRICS] loc=11 cc=3 branches=1 loops=1 returns=0 throws=0 nesting=2
[CALLS-INTERNAL] void executeStatement(Command command, CommandId commandId)
[CALLS-EXTERNAL] commandStore.getNewCommands/0, log.trace/2, Cons... | /* static context
[FOCAL] void CommandRunner.fetchAndRunCommands()
[PATH1] foreach(ConsumerRecord<CommandId, Command> record : records)=T -> if(command != null)=T -> exit loop
[PATH2] foreach(ConsumerRecord<CommandId, Command> record : records)=F
[PATH3] foreach(ConsumerRecord<CommandId, Command> record : records)=T ->... | /* static context
[FOCAL] void CommandRunner.fetchAndRunCommands()
[PATH1] foreach(ConsumerRecord<CommandId, Command> record : records)=T -> if(command != null)=T -> exit loop
[PATH2] foreach(ConsumerRecord<CommandId, Command> record : records)=F
[PATH3] foreach(ConsumerRecord<CommandId, Command> record : records)=T ->... | true | ok | {"focal": {"class": "CommandRunner", "name": "fetchAndRunCommands", "signature": "void fetchAndRunCommands()", "start_line": 3, "modifiers": "", "params": [], "return_type": "void"}, "class_info": {"name": "CommandRunner", "kind": "class", "modifiers": "", "superclass": null, "interfaces": "Runnable, Closeable", "field... |
126844782_4 | class DefaultEventStoreService implements EventStoreService {
@Override
public Optional<ContractEventDetails> getLatestContractEvent(
String eventSignature, String contractAddress) {
int page = eventStore.isPagingZeroIndexed() ? 0 : 1;
final PageRequest pagination = new PageRequest... | when(mockPage.getContent()).thenReturn(null);
when(mockEventStore.getContractEventsForSignature(
eq(EVENT_SIGNATURE), eq(CONTRACT_ADDRESS), any(PageRequest.class))).thenReturn(mockPage);
assertEquals(false, underTest.getLatestContractEvent(EVENT_SIGNATURE, CONTRACT_ADDRESS).isPre... | [FOCAL] @Override public Optional<ContractEventDetails> DefaultEventStoreService.getLatestContractEvent(String eventSignature, String contractAddress)
[CLASS] class DefaultEventStoreService implements EventStoreService
[METRICS] loc=23 cc=3 branches=2 loops=0 returns=3 throws=0 nesting=1
[CALLS-EXTERNAL] eventStore.isP... | /* static context
[FOCAL] @Override public Optional<ContractEventDetails> DefaultEventStoreService.getLatestContractEvent(String eventSignature, String contractAddress)
[PATH1] if(eventsPage == null)=F -> if(events == null || events.isEmpty())=T -> return Optional.empty()
[PATH2] if(eventsPage == null)=F -> if(events =... | /* static context
[FOCAL] @Override public Optional<ContractEventDetails> DefaultEventStoreService.getLatestContractEvent(String eventSignature, String contractAddress)
[PATH1] if(eventsPage == null)=F -> if(events == null || events.isEmpty())=T -> return Optional.empty()
[PATH2] if(eventsPage == null)=F -> if(events =... | true | ok | {"focal": {"class": "DefaultEventStoreService", "name": "getLatestContractEvent", "signature": "Optional<ContractEventDetails> getLatestContractEvent(String eventSignature, String contractAddress)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "eventSignature", "type": "String"}, {"name": "cont... |
126886615_2 | class DefaultDiffUtilComparator implements DiffUtilComparator<MODEL> {
@Override
public boolean areContentsTheSame(MODEL oldModel, MODEL newModel) {
return oldModel == newModel;
}
@Override public boolean areItemsTheSame(MODEL oldModel, MODEL newModel);
@Override public Object getChangePayload(MODEL old... | //funny but we can't actually mock equals with any mock lib !
//SOF: https://stackoverflow.com/q/3007532/693752
//GIVEN
DefaultDiffUtilComparator<String> itemComparatorUnderTest = new DefaultDiffUtilComparator<>();
//WHEN
final boolean areContentsTheSame = itemComparatorUnderTest.areContentsThe... | [FOCAL] @Override public boolean DefaultDiffUtilComparator.areContentsTheSame(MODEL oldModel, MODEL newModel)
[CLASS] class DefaultDiffUtilComparator implements DiffUtilComparator<MODEL>
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[INPUTS] branches=- | result=newModel, oldModel
[DATAFLOW] newMo... | /* static context
[FOCAL] @Override public boolean DefaultDiffUtilComparator.areContentsTheSame(MODEL oldModel, MODEL newModel)
[INPUTS] branches=- | result=newModel, oldModel
*/
| /* static context
[FOCAL] @Override public boolean DefaultDiffUtilComparator.areContentsTheSame(MODEL oldModel, MODEL newModel)
[INPUTS] branches=- | result=newModel, oldModel
*/
class DefaultDiffUtilComparator implements DiffUtilComparator<MODEL> {
@Override
public boolean areContentsTheSame(MODEL oldModel, MODEL... | true | ok | {"focal": {"class": "DefaultDiffUtilComparator", "name": "areContentsTheSame", "signature": "boolean areContentsTheSame(MODEL oldModel, MODEL newModel)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "oldModel", "type": "MODEL"}, {"name": "newModel", "type": "MODEL"}], "return_type": "boolean"},... |
126941683_6 | class FileNasStorage implements RdfFileStorageSpi {
private List<String> listFilesWithRegexs(String folderName, boolean all, String[] regexs) {
List<String> paths = listFilesHandler(folderName, all);
if (regexs == null || regexs.length == 0) {
return paths;
}
List<String... | List<String> paths = storage.listFiles(File.class.getResource("/storage").getPath(),
new String[] { "folder1*" });
Assert.assertEquals(1, paths.size());
}
} | [FOCAL] private List<String> FileNasStorage.listFilesWithRegexs(String folderName, boolean all, String[] regexs)
[CLASS] class FileNasStorage implements RdfFileStorageSpi
[METRICS] loc=18 cc=5 branches=2 loops=2 returns=2 throws=0 nesting=3
[CALLS-INTERNAL] List<String> listFilesHandler(String folderName, boolean all)
... | /* static context
[FOCAL] private List<String> FileNasStorage.listFilesWithRegexs(String folderName, boolean all, String[] regexs)
[PATH1] if(regexs == null || regexs.length == 0)=F -> foreach(String filePath : paths)=T -> foreach(String regex : regexs)=T -> if(pattern.matcher(name).matches())=T -> exit loop -> return ... | /* static context
[FOCAL] private List<String> FileNasStorage.listFilesWithRegexs(String folderName, boolean all, String[] regexs)
[PATH1] if(regexs == null || regexs.length == 0)=F -> foreach(String filePath : paths)=T -> foreach(String regex : regexs)=T -> if(pattern.matcher(name).matches())=T -> exit loop -> return ... | true | ok | {"focal": {"class": "FileNasStorage", "name": "listFilesWithRegexs", "signature": "List<String> listFilesWithRegexs(String folderName, boolean all, String[] regexs)", "start_line": 3, "modifiers": "private", "params": [{"name": "folderName", "type": "String"}, {"name": "all", "type": "boolean"}, {"name": "regexs", "typ... |
127004420_52 | class DL4JSequenceRecommender extends RecommendationEngine {
@Override
public EvaluationResult evaluate(List<CAS> aCas, DataSplitter aDataSplitter)
{
// Prepare a map where we store the mapping from labels to numeric label IDs - i.e.
// which index in the label vector represents which label... | IncrementalSplitter splitStrategy = new IncrementalSplitter(0.8, 50, 10);
DL4JSequenceRecommender sut = new DL4JSequenceRecommender(buildNerRecommender(), traits,
cache);
JCas cas = loadNerDevelopmentData("thatIncrementalNerEvaluationWorks");
int i = 0;
while (sp... | [FOCAL] @Override public EvaluationResult DL4JSequenceRecommender.evaluate(List<CAS> aCas, DataSplitter aDataSplitter)
[CLASS] class DL4JSequenceRecommender extends RecommendationEngine
[METRICS] loc=85 cc=10 branches=2 loops=5 returns=2 throws=1 nesting=4
[CALLS-INTERNAL] List<Outcome<T>> predict(MultiLayerNetwork aCl... | /* static context
[FOCAL] @Override public EvaluationResult DL4JSequenceRecommender.evaluate(List<CAS> aCas, DataSplitter aDataSplitter)
[THROWS-WHEN] IllegalStateException when foreach(Sample sample : data)=T && switch(aDataSplitter.getTargetSet(sample))=case TRAIN && !(trainingSetSize < 2 || testSetSize < 2) && try-b... | /* static context
[FOCAL] @Override public EvaluationResult DL4JSequenceRecommender.evaluate(List<CAS> aCas, DataSplitter aDataSplitter)
[THROWS-WHEN] IllegalStateException when foreach(Sample sample : data)=T && switch(aDataSplitter.getTargetSet(sample))=case TRAIN && !(trainingSetSize < 2 || testSetSize < 2) && try-b... | true | ok | {"focal": {"class": "DL4JSequenceRecommender", "name": "evaluate", "signature": "EvaluationResult evaluate(List<CAS> aCas, DataSplitter aDataSplitter)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "aCas", "type": "List<CAS>"}, {"name": "aDataSplitter", "type": "DataSplitter"}], "return_type": ... |
127047174_1 | class StoreByMetroAreaQueryController {
@GetMapping("/stores-by-metro-area")
public Collection<StoreByMetroAreaProjection> listStoresByLocation(@RequestParam String metroArea) {
return repository.findAllProjectedByLocation(metroArea);
}
public StoreByMetroAreaQueryController(StoreByMetroAreaR... | StoreByMetroAreaProjection storeProjection = makeStoreByMetroAreaProjection();
doReturn(singletonList(storeProjection))
.when(mockRepository)
.findAllProjectedByLocation(any());
mockMvc
.perform(
get("/stores-by-metro-area"... | [FOCAL] @GetMapping("/stores-by-metro-area") public Collection<StoreByMetroAreaProjection> StoreByMetroAreaQueryController.listStoresByLocation(String metroArea)
[CLASS] class StoreByMetroAreaQueryController
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] repository.findAllProjecte... | /* static context
[FOCAL] @GetMapping("/stores-by-metro-area") public Collection<StoreByMetroAreaProjection> StoreByMetroAreaQueryController.listStoresByLocation(String metroArea)
[INPUTS] branches=- | result=metroArea
[COLLABORATORS] field repository findAllProjectedByLocation/1
[CALLS-EXTERNAL] repository.findAllProj... | /* static context
[FOCAL] @GetMapping("/stores-by-metro-area") public Collection<StoreByMetroAreaProjection> StoreByMetroAreaQueryController.listStoresByLocation(String metroArea)
[INPUTS] branches=- | result=metroArea
[COLLABORATORS] field repository findAllProjectedByLocation/1
[CALLS-EXTERNAL] repository.findAllProj... | true | ok | {"focal": {"class": "StoreByMetroAreaQueryController", "name": "listStoresByLocation", "signature": "Collection<StoreByMetroAreaProjection> listStoresByLocation(String metroArea)", "start_line": 3, "modifiers": "@GetMapping(\"/stores-by-metro-area\") public", "params": [{"name": "metroArea", "type": "String"}], "return... |
127063666_2 | class ButtplugWSClient extends ButtplugClient {
public void connect(URI url) throws Exception {
connect(url, false);
}
public ButtplugWSClient(String clientName);
public void connect(String url, boolean trustAll);
public void connect(URI url, boolean trustAll);
@Override public void ... | ButtplugWSClient client = new ButtplugWSClient("Java Test");
client.connect(new URI("wss://localhost:12345/buttplug"), true);
Assert.assertTrue(client.startScanning());
Thread.sleep(5000);
client.requestDeviceList();
for (DeviceMessageInfo deviceInfo : client.getDevices(... | [FOCAL] public void ButtplugWSClient.connect(URI url)
[CLASS] class ButtplugWSClient extends ButtplugClient
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[CALLS-INTERNAL] void connect(String url, boolean trustAll)
[EXCEPTIONS] declares Exception
[DATAFLOW] url@param->L2
[CLASS-MEMBERS] ButtplugWS... | /* static context
[FOCAL] public void ButtplugWSClient.connect(URI url)
[EXCEPTIONS] declares Exception
[CALLS-INTERNAL] void connect(String url, boolean trustAll)
*/
| /* static context
[FOCAL] public void ButtplugWSClient.connect(URI url)
[EXCEPTIONS] declares Exception
[CALLS-INTERNAL] void connect(String url, boolean trustAll)
*/
class ButtplugWSClient extends ButtplugClient {
public void connect(URI url) throws Exception {
connect(url, false);
}
public Butt... | true | ok | {"focal": {"class": "ButtplugWSClient", "name": "connect", "signature": "void connect(URI url) throws Exception", "start_line": 3, "modifiers": "public", "params": [{"name": "url", "type": "URI"}], "return_type": "void"}, "class_info": {"name": "ButtplugWSClient", "kind": "class", "modifiers": "", "superclass": "Buttpl... |
127102257_1 | class CertificateCoder2 {
public static String sign(byte[] sign, String keyStorePath, String alias,
String password) throws Exception {
// 获得证书
X509Certificate x509Certificate = (X509Certificate) getCertificate(
keyStorePath, alias, password);
/... | System.err.println("私钥加密——公钥解密");
String inputStr = "sign";
byte[] data = inputStr.getBytes();
byte[] encodedData = CertificateCoder2.encryptByPrivateKey(data,
keyStorePath, alias, password);
byte[] decodedData = CertificateCoder2.decryptByPublicKey(encodedData... | [FOCAL] public static String CertificateCoder2.sign(byte[] sign, String keyStorePath, String alias, String password)
[CLASS] class CertificateCoder2
[METRICS] loc=18 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] Certificate getCertificate(String keyStorePath, String alias, String password); KeyS... | /* static context
[FOCAL] public static String CertificateCoder2.sign(byte[] sign, String keyStorePath, String alias, String password)
[INPUTS] branches=- | result=alias, keyStorePath, password
[EXCEPTIONS] declares Exception
[CALLS-INTERNAL] Certificate getCertificate(String keyStorePath, String alias, String password... | /* static context
[FOCAL] public static String CertificateCoder2.sign(byte[] sign, String keyStorePath, String alias, String password)
[INPUTS] branches=- | result=alias, keyStorePath, password
[EXCEPTIONS] declares Exception
[CALLS-INTERNAL] Certificate getCertificate(String keyStorePath, String alias, String password... | true | ok | {"focal": {"class": "CertificateCoder2", "name": "sign", "signature": "String sign(byte[] sign, String keyStorePath, String alias, String password) throws Exception", "start_line": 3, "modifiers": "public static", "params": [{"name": "sign", "type": "byte[]"}, {"name": "keyStorePath", "type": "String"}, {"name": "alias... |
127160868_1 | class Money {
public Money add(Money money) {
BigDecimal total = this.getAmount().add(money.getAmount());
return new Money(total);
}
public Money();
public Money(BigDecimal amount);
public Money(int amount);
public boolean isGreaterThan(Money comparison);
public BigDecimal getAmount();
@Override publ... | Money base = new Money();
assertEquals(BigDecimal.ZERO, base.getAmount());
Money moneyToAdd = new Money(100);
assertEquals(new Money(100), base.add(moneyToAdd));
}
} | [FOCAL] public Money Money.add(Money money)
[CLASS] class Money
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] BigDecimal getAmount()
[CALLS-EXTERNAL] this.getAmount().add/1, Money.getAmount/0
[NEW] Money
[INPUTS] branches=- | result=money
[COLLABORATORS] param money:Money getAmou... | /* static context
[FOCAL] public Money Money.add(Money money)
[INPUTS] branches=- | result=money
[COLLABORATORS] param money:Money getAmount/0
[CALLS-INTERNAL] BigDecimal getAmount()
[NEW] Money
[CALLS-EXTERNAL] this.getAmount().add/1, Money.getAmount/0
*/
| /* static context
[FOCAL] public Money Money.add(Money money)
[INPUTS] branches=- | result=money
[COLLABORATORS] param money:Money getAmount/0
[CALLS-INTERNAL] BigDecimal getAmount()
[NEW] Money
[CALLS-EXTERNAL] this.getAmount().add/1, Money.getAmount/0
*/
class Money {
public Money add(Money money) {
BigDecimal to... | true | ok | {"focal": {"class": "Money", "name": "add", "signature": "Money add(Money money)", "start_line": 3, "modifiers": "public", "params": [{"name": "money", "type": "Money"}], "return_type": "Money"}, "class_info": {"name": "Money", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [], "mem... |
127163887_0 | class RocketLander {
static Point2D thrustVector(final float rotation, final float thurstAcceleration) {
return new Point2D.Float(-thurstAcceleration*(float)Math.sin(rotation), thurstAcceleration*(float)Math.cos(rotation));
}
public RocketLander();
public RocketLander(final RocketLander toCopy);
public void... | final float delta = 0.0001f;
Point2D vec;
vec = RocketLander.thrustVector(0, 5);
assertEquals(vec.getX(), 0f, delta);
assertEquals(vec.getY(), 5f, delta);
vec = RocketLander.thrustVector((float)Math.toRadians(180), 5);
assertEquals(vec.getX(), 0f, delta);
assertEquals(vec.getY(), -5f, delta);
vec... | [FOCAL] static Point2D RocketLander.thrustVector(float rotation, float thurstAcceleration)
[CLASS] class RocketLander
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] Math.sin/1, Math.cos/1
[NEW] Point2D.Float
[INPUTS] branches=- | result=rotation, thurstAcceleration
[DATAFLOW] rota... | /* static context
[FOCAL] static Point2D RocketLander.thrustVector(float rotation, float thurstAcceleration)
[INPUTS] branches=- | result=rotation, thurstAcceleration
[NEW] Point2D.Float
[CALLS-EXTERNAL] Math.sin/1, Math.cos/1
*/
| /* static context
[FOCAL] static Point2D RocketLander.thrustVector(float rotation, float thurstAcceleration)
[INPUTS] branches=- | result=rotation, thurstAcceleration
[NEW] Point2D.Float
[CALLS-EXTERNAL] Math.sin/1, Math.cos/1
*/
class RocketLander {
static Point2D thrustVector(final float rotation, final float thurs... | true | ok | {"focal": {"class": "RocketLander", "name": "thrustVector", "signature": "Point2D thrustVector(float rotation, float thurstAcceleration)", "start_line": 3, "modifiers": "static", "params": [{"name": "rotation", "type": "float"}, {"name": "thurstAcceleration", "type": "float"}], "return_type": "Point2D"}, "class_info": ... |
127330859_9 | class FeatureFlagsService {
public boolean shouldApplyFeatureWithFlag(long flagId) {
final Optional<FlagDTO> flag = featureFlagsRepo.getFlag(flagId);
return flag.map(FlagDTO::getPortionIn).map(this::randomWithinPortion)
.orElse(false);
}
@Autowired public FeatureFlagsServi... | when(featureFlagsRepo.getFlag(anyLong())).thenReturn(Optional.of(new FlagDTO(randomLong(), randomString(), 50)));
when(random.nextInt(100)).thenReturn(20);
assertTrue(featureFlagsService.shouldApplyFeatureWithFlag(randomLong()));
}
} | [FOCAL] public boolean FeatureFlagsService.shouldApplyFeatureWithFlag(long flagId)
[CLASS] class FeatureFlagsService
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] FeatureFlagsRepo.getFlag/1, flag.map(FlagDTO::getPortionIn).map(this::randomWithinPor....orElse/1, flag.map(FlagDTO::... | /* static context
[FOCAL] public boolean FeatureFlagsService.shouldApplyFeatureWithFlag(long flagId)
[INPUTS] branches=- | result=flagId, featureFlagsRepo
[COLLABORATORS] field featureFlagsRepo:FeatureFlagsRepo getFlag/1
[FIELDS] read=featureFlagsRepo:FeatureFlagsRepo
[CALLS-EXTERNAL] FeatureFlagsRepo.getFlag/1, flag.m... | /* static context
[FOCAL] public boolean FeatureFlagsService.shouldApplyFeatureWithFlag(long flagId)
[INPUTS] branches=- | result=flagId, featureFlagsRepo
[COLLABORATORS] field featureFlagsRepo:FeatureFlagsRepo getFlag/1
[FIELDS] read=featureFlagsRepo:FeatureFlagsRepo
[CALLS-EXTERNAL] FeatureFlagsRepo.getFlag/1, flag.m... | true | ok | {"focal": {"class": "FeatureFlagsService", "name": "shouldApplyFeatureWithFlag", "signature": "boolean shouldApplyFeatureWithFlag(long flagId)", "start_line": 3, "modifiers": "public", "params": [{"name": "flagId", "type": "long"}], "return_type": "boolean"}, "class_info": {"name": "FeatureFlagsService", "kind": "class... |
127346527_5 | class PropertiesResolver implements Verifications<T> {
public Resolved<Set<T>> resolve(List<T> props, DefaultProperties defProps) {
if (props == null) {
return resolvedEmptyProps();
}
DefaultProperties defaultProperties = createDefaultProperties(defProps);
List<Resolved<T>> allResults = resolve... | T props = copy(mockProps);
props.setResponders(null);
Resolved<Set<T>> resolved = propertiesResolver
.resolve(Collections.singletonList(props), mockDefProps);
assertThat(resolved.isErr()).isFalse();
assertThat(resolved.succ()).hasSize(1);
}
} | [FOCAL] public Resolved<Set<T>> PropertiesResolver.resolve(List<T> props, DefaultProperties defProps)
[CLASS] class PropertiesResolver implements Verifications<T>
[METRICS] loc=19 cc=4 branches=3 loops=0 returns=4 throws=0 nesting=1
[CALLS-INTERNAL] DefaultProperties createDefaultProperties(DefaultProperties defProps);... | /* static context
[FOCAL] public Resolved<Set<T>> PropertiesResolver.resolve(List<T> props, DefaultProperties defProps)
[PATH1] if(props == null)=F -> if(!allErrors.isEmpty())=F -> if(configNames.size() != allProperties.size())=T -> return nonUniqueNamesError()
[PATH2] if(props == null)=T -> return resolvedEmptyProps()... | /* static context
[FOCAL] public Resolved<Set<T>> PropertiesResolver.resolve(List<T> props, DefaultProperties defProps)
[PATH1] if(props == null)=F -> if(!allErrors.isEmpty())=F -> if(configNames.size() != allProperties.size())=T -> return nonUniqueNamesError()
[PATH2] if(props == null)=T -> return resolvedEmptyProps()... | true | ok | {"focal": {"class": "PropertiesResolver", "name": "resolve", "signature": "Resolved<Set<T>> resolve(List<T> props, DefaultProperties defProps)", "start_line": 3, "modifiers": "public", "params": [{"name": "props", "type": "List<T>"}, {"name": "defProps", "type": "DefaultProperties"}], "return_type": "Resolved<Set<T>>"}... |
127468887_24 | class CassandraCQLClient extends DB {
@Override
public Status read(String table, String key, Set<String> fields,
HashMap<String, ByteIterator> result) {
try {
Statement stmt;
Select.Builder selectBuilder;
if (fields == null) {
selectBuilder = QueryBuilder.select().all();
... | insertRow();
final HashMap<String, ByteIterator> result = new HashMap<String, ByteIterator>();
final Status status = client.read(CoreWorkload.table, DEFAULT_ROW_KEY, null, result);
assertThat(status, is(Status.OK));
assertThat(result.entrySet(), hasSize(11));
assertThat(result, hasEntry("field2... | [FOCAL] @Override public Status CassandraCQLClient.read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result)
[CLASS] class CassandraCQLClient extends DB
[METRICS] loc=52 cc=8 branches=4 loops=2 returns=3 throws=0 nesting=3
[CALLS-EXTERNAL] QueryBuilder.select().all/0, QueryBuilder.select/... | /* static context
[FOCAL] @Override public Status CassandraCQLClient.read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result)
[PATH1] if(fields == null)=F -> foreach(String col : fields)=F -> if(debug)=T -> if(rs.isExhausted())=F -> foreach(ColumnDefinitions.Definition def : cd)=T -> if(... | /* static context
[FOCAL] @Override public Status CassandraCQLClient.read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result)
[PATH1] if(fields == null)=F -> foreach(String col : fields)=F -> if(debug)=T -> if(rs.isExhausted())=F -> foreach(ColumnDefinitions.Definition def : cd)=T -> if(... | true | ok | {"focal": {"class": "CassandraCQLClient", "name": "read", "signature": "Status read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "table", "type": "String"}, {"name": "key", "type": "String"}, {"name": "fields"... |
127471055_64 | class MovieController {
@GetMapping("/movie/delete/{id}")
public String deleteMovie(
@PathVariable("id") final UUID id,
@RequestParam(value = "returnUrl", defaultValue = "") final String returnUrl,
final RedirectAttributes redirectAttributes,
final Authentication authentication,... | final UUID movieId = UUID.randomUUID();
when(movieService.isAuthorizedOnMovie(TEST_AUTHENTICATED_USER, movieId)).thenReturn(true);
mockMvc.perform(post("/movie/delete")
.with(csrf())
.with(user(TEST_AUTHENTICATED_USER))
.param("id", movieId.toString())
... | [FOCAL] @GetMapping("/movie/delete/{id}") public String MovieController.deleteMovie(UUID id, String returnUrl, RedirectAttributes redirectAttributes, Authentication authentication, Model model)
[CLASS] class MovieController
[METRICS] loc=36 cc=4 branches=1 loops=0 returns=4 throws=0 nesting=2
[CALLS-EXTERNAL] MovieServ... | /* static context
[FOCAL] @GetMapping("/movie/delete/{id}") public String MovieController.deleteMovie(UUID id, String returnUrl, RedirectAttributes redirectAttributes, Authentication authentication, Model model)
[PATH1] try-body throws -> return "redirect:/"
[PATH2] if(!movieService.isAuthorizedOnMovie(authentication.g... | /* static context
[FOCAL] @GetMapping("/movie/delete/{id}") public String MovieController.deleteMovie(UUID id, String returnUrl, RedirectAttributes redirectAttributes, Authentication authentication, Model model)
[PATH1] try-body throws -> return "redirect:/"
[PATH2] if(!movieService.isAuthorizedOnMovie(authentication.g... | true | ok | {"focal": {"class": "MovieController", "name": "deleteMovie", "signature": "String deleteMovie(UUID id, String returnUrl, RedirectAttributes redirectAttributes, Authentication authentication, Model model)", "start_line": 3, "modifiers": "@GetMapping(\"/movie/delete/{id}\") public", "params": [{"name": "id", "type": "UU... |
127518477_1 | class ExecutorEngine implements AutoCloseable {
@SuppressWarnings("unchecked")
public <I, O> List<O> execute(final I input, final Collection<ExecuteUnit<I, O>> executeUnits, Long timeout,
TimeUnit timeUnit) {
if (executeUnits.size() == 1) {
try {
... | ExecutorService delegate = Executors.newFixedThreadPool(3);
ExecutorEngine executorEngine = new ExecutorEngine(delegate);
List<Integer> inputs = Lists.newArrayList(1, 2, 3);
thrown.expect(ExecuteException.class);
thrown.expectMessage("execute task throw exception");
try {... | [FOCAL] @SuppressWarnings("unchecked") public List<O> ExecutorEngine.execute(I input, Collection<ExecuteUnit<I, O>> executeUnits, Long timeout, TimeUnit timeUnit)
[CLASS] class ExecutorEngine implements AutoCloseable
[METRICS] loc=14 cc=3 branches=1 loops=0 returns=2 throws=1 nesting=2
[CALLS-INTERNAL] ListenableFuture... | /* static context
[FOCAL] @SuppressWarnings("unchecked") public List<O> ExecutorEngine.execute(I input, Collection<ExecuteUnit<I, O>> executeUnits, Long timeout, TimeUnit timeUnit)
[THROWS-WHEN] ExecuteException when executeUnits.size() == 1 && try-body throws
[PATH1] if(executeUnits.size() == 1)=T -> try-body throws -... | /* static context
[FOCAL] @SuppressWarnings("unchecked") public List<O> ExecutorEngine.execute(I input, Collection<ExecuteUnit<I, O>> executeUnits, Long timeout, TimeUnit timeUnit)
[THROWS-WHEN] ExecuteException when executeUnits.size() == 1 && try-body throws
[PATH1] if(executeUnits.size() == 1)=T -> try-body throws -... | true | ok | {"focal": {"class": "ExecutorEngine", "name": "execute", "signature": "List<O> execute(I input, Collection<ExecuteUnit<I, O>> executeUnits, Long timeout, TimeUnit timeUnit)", "start_line": 3, "modifiers": "@SuppressWarnings(\"unchecked\") public", "params": [{"name": "input", "type": "I"}, {"name": "executeUnits", "typ... |
127565224_36 | class ArrayListMultimap implements Multimap<K, V> {
@Override
public Multiset<K> keys() {
return new ArrayListMultiset<>(map.entrySet()
.stream()
.flatMap(this::toKeys)
.collect(Collectors.toList()));
}
private ArrayListMultimap();
public s... | final var given = ArrayListMultimap.create();
given.put("key1", "item1");
given.put("key1", "item1");
given.put("key2", "item2");
final var values = List.of("key1", "key1", "key2");
final var expected = new ArrayListMultiset<>(values);
final var actual = given.... | [FOCAL] @Override public Multiset<K> ArrayListMultimap.keys()
[CLASS] class ArrayListMultimap implements Multimap<K, V>
[METRICS] loc=7 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] map.entrySet() .stream() .flatMap(this::toKeys).collect/1, map.entrySet() .stream().flatMap/1, map.entrySet().stre... | /* static context
[FOCAL] @Override public Multiset<K> ArrayListMultimap.keys()
[COLLABORATORS] field map entrySet/0
[NEW] ArrayListMultiset<>
[CALLS-EXTERNAL] map.entrySet() .stream() .flatMap(this::toKeys).collect/1, map.entrySet() .stream().flatMap/1, map.entrySet().stream/0, map.entrySet/0, Collectors.toList/0
*/
| /* static context
[FOCAL] @Override public Multiset<K> ArrayListMultimap.keys()
[COLLABORATORS] field map entrySet/0
[NEW] ArrayListMultiset<>
[CALLS-EXTERNAL] map.entrySet() .stream() .flatMap(this::toKeys).collect/1, map.entrySet() .stream().flatMap/1, map.entrySet().stream/0, map.entrySet/0, Collectors.toList/0
*/
c... | true | ok | {"focal": {"class": "ArrayListMultimap", "name": "keys", "signature": "Multiset<K> keys()", "start_line": 3, "modifiers": "@Override public", "params": [], "return_type": "Multiset<K>"}, "class_info": {"name": "ArrayListMultimap", "kind": "class", "modifiers": "", "superclass": null, "interfaces": "Multimap<K, V>", "fi... |
127623072_6 | class TypeLiteral {
public static <K, V> TypeLiteral<Map<K, V>> mapOf(Class<? extends K> keyType, Class<? extends V> valueType) {
return new TypeLiteral<>(Map.class, keyType, valueType);
}
@SuppressWarnings("unchecked") protected TypeLiteral();
@SuppressWarnings("unchecked") private TypeLite... | TypeLiteral<Map<String, List<? extends Number>>> typeLiteral1 = new TypeLiteral<Map<String, List<? extends Number>>>(){};
TypeLiteral<Map<String, List<? extends Number>>> typeLiteral2 = TypeLiteral.mapOf(new TypeLiteral<String>(){}, new TypeLiteral<List<? extends Number>>(){});
TypeLiteral<Map... | [FOCAL] public static TypeLiteral<Map<K, V>> TypeLiteral.mapOf(Class<? extends K> keyType, Class<? extends V> valueType)
[CLASS] class TypeLiteral
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[NEW] TypeLiteral<>
[INPUTS] branches=- | result=keyType, valueType
[DATAFLOW] keyType@param->L2; valueT... | /* static context
[FOCAL] public static TypeLiteral<Map<K, V>> TypeLiteral.mapOf(Class<? extends K> keyType, Class<? extends V> valueType)
[INPUTS] branches=- | result=keyType, valueType
[NEW] TypeLiteral<>
*/
| /* static context
[FOCAL] public static TypeLiteral<Map<K, V>> TypeLiteral.mapOf(Class<? extends K> keyType, Class<? extends V> valueType)
[INPUTS] branches=- | result=keyType, valueType
[NEW] TypeLiteral<>
*/
class TypeLiteral {
public static <K, V> TypeLiteral<Map<K, V>> mapOf(Class<? extends K> keyType, Class<?... | true | ok | {"focal": {"class": "TypeLiteral", "name": "mapOf", "signature": "TypeLiteral<Map<K, V>> mapOf(Class<? extends K> keyType, Class<? extends V> valueType)", "start_line": 3, "modifiers": "public static", "params": [{"name": "keyType", "type": "Class<? extends K>"}, {"name": "valueType", "type": "Class<? extends V>"}], "r... |
127727728_0 | class SofaBootVersionEndpoint {
@ReadOperation
public List<Object> versions() {
if (endpointResult.isEmpty()) {
try {
endpointResult = Stream
.of(resourcePatternResolver.getResources(SOFA_BOOT_VERSION_PROPERTIES))
.map(this::lo... | SofaBootVersionEndpoint sofaBootVersionEndpoint = new SofaBootVersionEndpoint();
List<Object> list = sofaBootVersionEndpoint.versions();
Assert.assertTrue(list.size() > 0);
}
} | [FOCAL] @ReadOperation public List<Object> SofaBootVersionEndpoint.versions()
[CLASS] class SofaBootVersionEndpoint
[METRICS] loc=13 cc=3 branches=1 loops=0 returns=1 throws=0 nesting=2
[CALLS-EXTERNAL] endpointResult.isEmpty/0, Stream .of(resourcePatternResolver.getResources(SOFA_BOOT....collect/1, Stream .of(resource... | /* static context
[FOCAL] @ReadOperation public List<Object> SofaBootVersionEndpoint.versions()
[PATH1] if(endpointResult.isEmpty())=T -> try-body throws -> return endpointResult
[PATH2] if(endpointResult.isEmpty())=F -> return endpointResult
[COLLABORATORS] field endpointResult isEmpty/0; field resourcePatternResolver... | /* static context
[FOCAL] @ReadOperation public List<Object> SofaBootVersionEndpoint.versions()
[PATH1] if(endpointResult.isEmpty())=T -> try-body throws -> return endpointResult
[PATH2] if(endpointResult.isEmpty())=F -> return endpointResult
[COLLABORATORS] field endpointResult isEmpty/0; field resourcePatternResolver... | true | ok | {"focal": {"class": "SofaBootVersionEndpoint", "name": "versions", "signature": "List<Object> versions()", "start_line": 3, "modifiers": "@ReadOperation public", "params": [], "return_type": "List<Object>"}, "class_info": {"name": "SofaBootVersionEndpoint", "kind": "class", "modifiers": "", "superclass": null, "interfa... |
127777820_0 | class InMemoryCache {
public synchronized ImmutableSet<Feature> getFeatures() {
return ImmutableSet.copyOf(features.values());
}
@Inject public InMemoryCache();
public synchronized void putFeature(Feature feature);
public void removeFeature(String id);
public void clear();
public Optional<Feature>... | assertThat(inMemoryCache.getFeatures()).isEmpty();
}
} | [FOCAL] public synchronized ImmutableSet<Feature> InMemoryCache.getFeatures()
[CLASS] class InMemoryCache
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] ImmutableSet.copyOf/1, features.values/0
[COLLABORATORS] field features values/0
[CLASS-MEMBERS] InMemoryCache(); void putFeatur... | /* static context
[FOCAL] public synchronized ImmutableSet<Feature> InMemoryCache.getFeatures()
[COLLABORATORS] field features values/0
[CALLS-EXTERNAL] ImmutableSet.copyOf/1, features.values/0
*/
| /* static context
[FOCAL] public synchronized ImmutableSet<Feature> InMemoryCache.getFeatures()
[COLLABORATORS] field features values/0
[CALLS-EXTERNAL] ImmutableSet.copyOf/1, features.values/0
*/
class InMemoryCache {
public synchronized ImmutableSet<Feature> getFeatures() {
return ImmutableSet.copyOf(features.... | true | ok | {"focal": {"class": "InMemoryCache", "name": "getFeatures", "signature": "ImmutableSet<Feature> getFeatures()", "start_line": 3, "modifiers": "public synchronized", "params": [], "return_type": "ImmutableSet<Feature>"}, "class_info": {"name": "InMemoryCache", "kind": "class", "modifiers": "", "superclass": null, "inter... |
127906050_0 | class CipherStorageFactory {
public static CipherStorage newInstance(Context context, Storage storage) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return new CipherStorageAndroidKeystore(context, storage);
}
return new CipherStorageSharedPreferencesKeystore(context, ... | assertThat(CipherStorageFactory.newInstance(null))
.isSameAs(InMemoryCipherStorage.INSTANCE);
}
} | [FOCAL] public static CipherStorage CipherStorageFactory.newInstance(Context context, Storage storage)
[CLASS] class CipherStorageFactory
[METRICS] loc=6 cc=2 branches=1 loops=0 returns=2 throws=0 nesting=1
[NEW] CipherStorageAndroidKeystore, CipherStorageSharedPreferencesKeystore
[PATH1] if(Build.VERSION.SDK_INT >= Bu... | /* static context
[FOCAL] public static CipherStorage CipherStorageFactory.newInstance(Context context, Storage storage)
[PATH1] if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)=T -> return new CipherStorageAndroidKeystore(context, storage)
[PATH2] if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)=F -> return new Ci... | /* static context
[FOCAL] public static CipherStorage CipherStorageFactory.newInstance(Context context, Storage storage)
[PATH1] if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)=T -> return new CipherStorageAndroidKeystore(context, storage)
[PATH2] if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)=F -> return new Ci... | true | ok | {"focal": {"class": "CipherStorageFactory", "name": "newInstance", "signature": "CipherStorage newInstance(Context context, Storage storage)", "start_line": 3, "modifiers": "public static", "params": [{"name": "context", "type": "Context"}, {"name": "storage", "type": "Storage"}], "return_type": "CipherStorage"}, "clas... |
127906883_15 | class DateUtil {
public static long getMillSecond(String data){
long time = Long.parseLong(data);
if(data.length() == LENGTH_SECOND){
time = Long.parseLong(data) * 1000;
} else if(data.length() == LENGTH_MILLISECOND){
time = Long.parseLong(data);
} else if(d... | long result = DateUtil.getMillSecond("1584500160000");
Assert.assertEquals(result, 1584500160000L);
result = DateUtil.getMillSecond("1584500160000000");
Assert.assertEquals(result, 1584500160000L);
result = DateUtil.getMillSecond("1584500160000000000");
Assert.assertEqu... | [FOCAL] public static long DateUtil.getMillSecond(String data)
[CLASS] class DateUtil
[METRICS] loc=23 cc=7 branches=5 loops=0 returns=1 throws=0 nesting=6
[CALLS-EXTERNAL] Long.parseLong/1, String.length/0, datetimeFormatter.get().get(DATE_FORMAT).parse/1, datetimeFormatter.get().get/1, datetimeFormatter.get/0, Calend... | /* static context
[FOCAL] public static long DateUtil.getMillSecond(String data)
[PATH1] if(data.length() == LENGTH_SECOND)=F -> if(data.length() == LENGTH_MILLISECOND)=F -> if(data.length() == LENGTH_MICROSECOND)=F -> if(data.length() == LENGTH_NANOSECOND)=F -> if(data.length() < LENGTH_SECOND)=T -> try-body throws ->... | /* static context
[FOCAL] public static long DateUtil.getMillSecond(String data)
[PATH1] if(data.length() == LENGTH_SECOND)=F -> if(data.length() == LENGTH_MILLISECOND)=F -> if(data.length() == LENGTH_MICROSECOND)=F -> if(data.length() == LENGTH_NANOSECOND)=F -> if(data.length() < LENGTH_SECOND)=T -> try-body throws ->... | true | ok | {"focal": {"class": "DateUtil", "name": "getMillSecond", "signature": "long getMillSecond(String data)", "start_line": 3, "modifiers": "public static", "params": [{"name": "data", "type": "String"}], "return_type": "long"}, "class_info": {"name": "DateUtil", "kind": "class", "modifiers": "", "superclass": null, "interf... |
127918464_1 | class DatabaseOLAPService implements OLAPService<PhysicalTable, Field> {
@Override
public DataSet<Field> fetchData(Connector connector, Cube cube) {
SelectJoinStep<Record> fact = using((DataSource) null, null).select(cube.getFields().stream().map((c) -> {
return field(c.asField()).as(c.getColumnNameAlias());
... | assertEquals(2, olapService.fetchData(connector, cube).getDatas().size());
}
} | [FOCAL] @Override public DataSet<Field> DatabaseOLAPService.fetchData(Connector connector, Cube cube)
[CLASS] class DatabaseOLAPService implements OLAPService<PhysicalTable, Field>
[METRICS] loc=15 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] Dialect resolveDialect(Connector connector)
[CALLS-E... | /* static context
[FOCAL] @Override public DataSet<Field> DatabaseOLAPService.fetchData(Connector connector, Cube cube)
[INPUTS] branches=- | result=connector, cube
[COLLABORATORS] param cube:Cube getFields/0,getFact/0,getDimensions/0; field c asField/0,getColumnNameAlias/0,asCondition/1; field d getTarget/0,getType/0,... | /* static context
[FOCAL] @Override public DataSet<Field> DatabaseOLAPService.fetchData(Connector connector, Cube cube)
[INPUTS] branches=- | result=connector, cube
[COLLABORATORS] param cube:Cube getFields/0,getFact/0,getDimensions/0; field c asField/0,getColumnNameAlias/0,asCondition/1; field d getTarget/0,getType/0,... | true | ok | {"focal": {"class": "DatabaseOLAPService", "name": "fetchData", "signature": "DataSet<Field> fetchData(Connector connector, Cube cube)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "connector", "type": "Connector"}, {"name": "cube", "type": "Cube"}], "return_type": "DataSet<Field>"}, "class_in... |
128018428_130 | class TokenCacheNodeManager {
public static void putTokenCacheNode(long tokenId, TokenCacheNode cacheNode) {
TOKEN_CACHE_NODE_MAP.put(tokenId, cacheNode);
}
public static void prepare(int concurrencyLevel, int maximumWeightedCapacity);
public static TokenCacheNode getTokenCacheNode(long tokenI... | setCurrentMillis(System.currentTimeMillis());
for (long i = 0; i < 100; i++) {
final TokenCacheNode node = new TokenCacheNode();
node.setTokenId(i);
node.setFlowId(111L);
node.setResourceTimeout(10000L);
node.setClientTimeout(10000L);
... | [FOCAL] public static void TokenCacheNodeManager.putTokenCacheNode(long tokenId, TokenCacheNode cacheNode)
[CLASS] class TokenCacheNodeManager
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[CALLS-EXTERNAL] TOKEN_CACHE_NODE_MAP.put/2
[DATAFLOW] cacheNode@param->L2; tokenId@param->L2
[CLASS-MEMBERS... | /* static context
[FOCAL] public static void TokenCacheNodeManager.putTokenCacheNode(long tokenId, TokenCacheNode cacheNode)
[CALLS-EXTERNAL] TOKEN_CACHE_NODE_MAP.put/2
*/
| /* static context
[FOCAL] public static void TokenCacheNodeManager.putTokenCacheNode(long tokenId, TokenCacheNode cacheNode)
[CALLS-EXTERNAL] TOKEN_CACHE_NODE_MAP.put/2
*/
class TokenCacheNodeManager {
public static void putTokenCacheNode(long tokenId, TokenCacheNode cacheNode) {
TOKEN_CACHE_NODE_MAP.put(t... | true | ok | {"focal": {"class": "TokenCacheNodeManager", "name": "putTokenCacheNode", "signature": "void putTokenCacheNode(long tokenId, TokenCacheNode cacheNode)", "start_line": 3, "modifiers": "public static", "params": [{"name": "tokenId", "type": "long"}, {"name": "cacheNode", "type": "TokenCacheNode"}], "return_type": "void"}... |
128022542_2 | class Tesseract1 extends TessAPI1 implements ITesseract {
@Override
public String doOCR(File imageFile) throws TesseractException {
return doOCR(imageFile, null);
}
protected TessBaseAPI getHandle();
@Override public void setDatapath(String datapath);
@Override public void setLanguage(... | logger.info("doOCR on a BMP image with bounding rectangle");
File imageFile = new File(this.testResourcesDataPath, "eurotext.bmp");
Rectangle rect = new Rectangle(0, 0, 1024, 800); // define an equal or smaller region of interest on the image
String expResult = "The (quick) [brown] {fox}... | [FOCAL] @Override public String Tesseract1.doOCR(File imageFile)
[CLASS] class Tesseract1 extends TessAPI1 implements ITesseract
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] String doOCR(File imageFile, Rectangle rect)
[EXCEPTIONS] declares TesseractException
[INPUTS] branches=-... | /* static context
[FOCAL] @Override public String Tesseract1.doOCR(File imageFile)
[INPUTS] branches=- | result=imageFile
[EXCEPTIONS] declares TesseractException
[CALLS-INTERNAL] String doOCR(File imageFile, Rectangle rect)
*/
| /* static context
[FOCAL] @Override public String Tesseract1.doOCR(File imageFile)
[INPUTS] branches=- | result=imageFile
[EXCEPTIONS] declares TesseractException
[CALLS-INTERNAL] String doOCR(File imageFile, Rectangle rect)
*/
class Tesseract1 extends TessAPI1 implements ITesseract {
@Override
public String d... | true | ok | {"focal": {"class": "Tesseract1", "name": "doOCR", "signature": "String doOCR(File imageFile) throws TesseractException", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "imageFile", "type": "File"}], "return_type": "String"}, "class_info": {"name": "Tesseract1", "kind": "class", "modifiers": "", ... |
128056094_15 | class MultisourceBeanLocator implements ConfiguredBeanLocator {
@Override
public boolean hasBeanOfName(String name) {
return locators.stream()
.map(locator -> locator.hasBeanOfName(name))
.filter(Boolean::booleanValue)
.findFirst().orElse(false);
}
... | when(source1.hasBeanOfName(eq("test"))).thenReturn(false);
when(source2.hasBeanOfName(eq("test"))).thenReturn(false);
Assert.assertFalse(multisourceBeanLocator.hasBeanOfName("test"));
}
} | [FOCAL] @Override public boolean MultisourceBeanLocator.hasBeanOfName(String name)
[CLASS] class MultisourceBeanLocator implements ConfiguredBeanLocator
[METRICS] loc=7 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] locators.stream() .map(locator -> locator.hasBeanOfName(n....orElse/1, locators.s... | /* static context
[FOCAL] @Override public boolean MultisourceBeanLocator.hasBeanOfName(String name)
[INPUTS] branches=- | result=name
[COLLABORATORS] field locators stream/0; field locator hasBeanOfName/1
[CALLS-EXTERNAL] locators.stream() .map(locator -> locator.hasBeanOfName(n....orElse/1, locators.stream() .map(loc... | /* static context
[FOCAL] @Override public boolean MultisourceBeanLocator.hasBeanOfName(String name)
[INPUTS] branches=- | result=name
[COLLABORATORS] field locators stream/0; field locator hasBeanOfName/1
[CALLS-EXTERNAL] locators.stream() .map(locator -> locator.hasBeanOfName(n....orElse/1, locators.stream() .map(loc... | true | ok | {"focal": {"class": "MultisourceBeanLocator", "name": "hasBeanOfName", "signature": "boolean hasBeanOfName(String name)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "name", "type": "String"}], "return_type": "boolean"}, "class_info": {"name": "MultisourceBeanLocator", "kind": "class", "modifi... |
128169626_1 | class TimeZoneEngine {
public Optional<ZoneId> query(double latitude, double longitude) {
final List<ZoneId> result = index.query(latitude, longitude);
return result.size() > 0 ? Optional.of(result.get(0)) : Optional.empty();
}
private TimeZoneEngine(Index index);
private static void... | assertEquals(Optional.of(ZoneId.of("Europe/Amsterdam")), engine.query(51.4457, 4.9248));
assertEquals(Optional.of(ZoneId.of("Europe/Brussels")), engine.query(51.4457, 4.9250));
assertEquals(Optional.of(ZoneId.of("Europe/Brussels")), engine.query(51.4437,4.9186));
assertEquals(Optional.of... | [FOCAL] public Optional<ZoneId> TimeZoneEngine.query(double latitude, double longitude)
[CLASS] class TimeZoneEngine
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] index.query/2, List<ZoneId>.size/0, Optional.of/1, List<ZoneId>.get/1, Optional.empty/0
[INPUTS] branches=- | result=... | /* static context
[FOCAL] public Optional<ZoneId> TimeZoneEngine.query(double latitude, double longitude)
[INPUTS] branches=- | result=latitude, longitude
[COLLABORATORS] field index query/2
[CALLS-EXTERNAL] index.query/2, List<ZoneId>.size/0, Optional.of/1, List<ZoneId>.get/1, Optional.empty/0
*/
| /* static context
[FOCAL] public Optional<ZoneId> TimeZoneEngine.query(double latitude, double longitude)
[INPUTS] branches=- | result=latitude, longitude
[COLLABORATORS] field index query/2
[CALLS-EXTERNAL] index.query/2, List<ZoneId>.size/0, Optional.of/1, List<ZoneId>.get/1, Optional.empty/0
*/
class TimeZoneEngine ... | true | ok | {"focal": {"class": "TimeZoneEngine", "name": "query", "signature": "Optional<ZoneId> query(double latitude, double longitude)", "start_line": 3, "modifiers": "public", "params": [{"name": "latitude", "type": "double"}, {"name": "longitude", "type": "double"}], "return_type": "Optional<ZoneId>"}, "class_info": {"name":... |
128191219_0 | class StyleBuilders {
public FontBuilder fontArial() {
return Styles.fontArial();
}
public FontBuilder font();
public FontBuilder font(String fontName, boolean bold, boolean italic, int fontSize);
public FontBuilder fontArialBold();
public FontBuilder fontTimesNewRoman();
public Fo... | FontBuilder fontBuilder = cut.fontArial();
Assert.assertEquals(ARIAL, fontBuilder.getFont().getFontName());
Assert.assertFalse(fontBuilder.getFont().getBold());
Assert.assertFalse(fontBuilder.getFont().getItalic());
}
} | [FOCAL] public FontBuilder StyleBuilders.fontArial()
[CLASS] class StyleBuilders
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] Styles.fontArial/0
[CLASS-MEMBERS] FontBuilder font(); FontBuilder font(String fontName, boolean bold, boolean italic, int fontSize); FontBuilder fontAri... | /* static context
[FOCAL] public FontBuilder StyleBuilders.fontArial()
[CALLS-EXTERNAL] Styles.fontArial/0
*/
| /* static context
[FOCAL] public FontBuilder StyleBuilders.fontArial()
[CALLS-EXTERNAL] Styles.fontArial/0
*/
class StyleBuilders {
public FontBuilder fontArial() {
return Styles.fontArial();
}
public FontBuilder font();
public FontBuilder font(String fontName, boolean bold, boolean italic, in... | true | ok | {"focal": {"class": "StyleBuilders", "name": "fontArial", "signature": "FontBuilder fontArial()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "FontBuilder"}, "class_info": {"name": "StyleBuilders", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [{"name": "cu... |
128219123_103 | class RdsLookupService {
public Optional<GatekeeperRDSInstance> getOneInstance(AWSEnvironment environment, String dbInstanceIdentifier, String instanceName) {
logger.info(dbInstanceIdentifier);
Long startTime = System.currentTimeMillis();
List<String> securityGroupIds = sgLookupService.fetc... | Mockito.when(amazonRDSClient.describeDBInstances(Mockito.any())).thenReturn(
new DescribeDBInstancesResult().withDBInstances(
initializeInstance("instance1", RDS_ENGINE_PG, "gk-A-instance", "db-gk1", STATUS_AVAILABLE, SG_ONE, null)));
Optional<GatekeeperRDSInstanc... | [FOCAL] public Optional<GatekeeperRDSInstance> RdsLookupService.getOneInstance(AWSEnvironment environment, String dbInstanceIdentifier, String instanceName)
[CLASS] class RdsLookupService
[METRICS] loc=22 cc=2 branches=1 loops=0 returns=1 throws=0 nesting=1
[CALLS-INTERNAL] List<GatekeeperRDSInstance> loadToGatekeeperR... | /* static context
[FOCAL] public Optional<GatekeeperRDSInstance> RdsLookupService.getOneInstance(AWSEnvironment environment, String dbInstanceIdentifier, String instanceName)
[PATH1] if(dbInstanceIdentifier.startsWith("cluster"))=T -> return gatekeeperRDSInstance
*/
| /* static context
[FOCAL] public Optional<GatekeeperRDSInstance> RdsLookupService.getOneInstance(AWSEnvironment environment, String dbInstanceIdentifier, String instanceName)
[PATH1] if(dbInstanceIdentifier.startsWith("cluster"))=T -> return gatekeeperRDSInstance
*/
class RdsLookupService {
public Optional<Gatekee... | true | ok | {"focal": {"class": "RdsLookupService", "name": "getOneInstance", "signature": "Optional<GatekeeperRDSInstance> getOneInstance(AWSEnvironment environment, String dbInstanceIdentifier, String instanceName)", "start_line": 3, "modifiers": "public", "params": [{"name": "environment", "type": "AWSEnvironment"}, {"name": "d... |
128272183_81 | class CatalogFactory {
public static CatalogService getCatalogService(HttpClient httpClient) throws ConnectorSDKException {
ConnectorSDKUtil adobeResourceUtil = ConnectorSDKUtil.getInstance();
String catalogEndpoint = adobeResourceUtil.getEndPoint(ResourceName.CATALOG);
return new CatalogSe... | setUp();
assertTrue(CatalogFactory.getCatalogService()!=null);
CatalogService cat = CatalogFactory.getCatalogService(null);
assertTrue(cat != null);
}
} | [FOCAL] public static CatalogService CatalogFactory.getCatalogService(HttpClient httpClient)
[CLASS] class CatalogFactory
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] ConnectorSDKUtil.getInstance/0, ConnectorSDKUtil.getEndPoint/1
[NEW] CatalogServiceImpl
[EXCEPTIONS] declares Co... | /* static context
[FOCAL] public static CatalogService CatalogFactory.getCatalogService(HttpClient httpClient)
[INPUTS] branches=- | result=httpClient
[EXCEPTIONS] declares ConnectorSDKException
[NEW] CatalogServiceImpl
[CALLS-EXTERNAL] ConnectorSDKUtil.getInstance/0, ConnectorSDKUtil.getEndPoint/1
*/
| /* static context
[FOCAL] public static CatalogService CatalogFactory.getCatalogService(HttpClient httpClient)
[INPUTS] branches=- | result=httpClient
[EXCEPTIONS] declares ConnectorSDKException
[NEW] CatalogServiceImpl
[CALLS-EXTERNAL] ConnectorSDKUtil.getInstance/0, ConnectorSDKUtil.getEndPoint/1
*/
class CatalogFact... | true | ok | {"focal": {"class": "CatalogFactory", "name": "getCatalogService", "signature": "CatalogService getCatalogService(HttpClient httpClient) throws ConnectorSDKException", "start_line": 3, "modifiers": "public static", "params": [{"name": "httpClient", "type": "HttpClient"}], "return_type": "CatalogService"}, "class_info":... |
128309964_0 | class CartesianChromosome extends Chromosome<T> implements LinearChromosome<Integer>, Cloneable {
public String getExpression() {
Map<Integer, List<Integer>> nodes = getPhenome();
String[] expressions = new String[genome.size() + getOutputs().size()];
Set<Integer> keysSet = nodes.keySet();
... | CartesianChromosome<Double> chrome = new CartesianChromosome<>(Arrays.asList(
new Addition(), new Subtraction(), new Multiplication(), new Division(),
new Power(), new Root(), new Sin(), new Cos(), new Tan()
),0,0,0,0, Arrays.asList(0), null, null);
String expecte... | [FOCAL] public String CartesianChromosome.getExpression()
[CLASS] class CartesianChromosome extends Chromosome<T> implements LinearChromosome<Integer>, Cloneable
[METRICS] loc=31 cc=6 branches=2 loops=3 returns=1 throws=0 nesting=3
[CALLS-INTERNAL] List<Integer> getOutputs(); Map<Integer, List<Integer>> getPhenome(); i... | /* static context
[FOCAL] public String CartesianChromosome.getExpression()
[PATH1] for(i < getInputs())=F -> for(i < getOutputs().size())=T -> for(j < actualNodes.size())=T -> if(index < getInputs())=F -> if(arity == 1)=T -> exit loop -> exit loop -> return expressions[nodeToIndex(actualNodes.get(actualNodes.size() - ... | /* static context
[FOCAL] public String CartesianChromosome.getExpression()
[PATH1] for(i < getInputs())=F -> for(i < getOutputs().size())=T -> for(j < actualNodes.size())=T -> if(index < getInputs())=F -> if(arity == 1)=T -> exit loop -> exit loop -> return expressions[nodeToIndex(actualNodes.get(actualNodes.size() - ... | true | ok | {"focal": {"class": "CartesianChromosome", "name": "getExpression", "signature": "String getExpression()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "String"}, "class_info": {"name": "CartesianChromosome", "kind": "class", "modifiers": "", "superclass": "Chromosome<T>", "interfaces": "LinearC... |
128403104_0 | class NibbleArray {
public int get(int index) {
int bitStartIndex = index * bitsPreEntry;
int arrayStartIndex = bitStartIndex >>> 6; // bitStartIndex / 64
int arrayEndIndex = (bitStartIndex + bitsPreEntry - 1) >>> 6;
Validate.inclusiveBetween(0, array.length - 1, arrayEndIndex);
... | assertArrayEquals(bit8RawArray, bit8Array.toArray());
assertArrayEquals(bit24RawArray, bit24Array.toArray());
assertArrayEquals(bit31RawArray, bit31Array.toArray());
}
} | [FOCAL] public int NibbleArray.get(int index)
[CLASS] class NibbleArray
[METRICS] loc=13 cc=2 branches=1 loops=0 returns=2 throws=0 nesting=1
[CALLS-EXTERNAL] Validate.inclusiveBetween/3
[FIELDS] read=maxEntryValue
[PATH1] if(arrayStartIndex == arrayEndIndex)=T -> return (int) (array[arrayStartIndex] >>> offset & maxEn... | /* static context
[FOCAL] public int NibbleArray.get(int index)
[PATH1] if(arrayStartIndex == arrayEndIndex)=T -> return (int) (array[arrayStartIndex] >>> offset & maxEntryValue)
[PATH2] if(arrayStartIndex == arrayEndIndex)=F -> return (int) ((array[arrayStartIndex] >>> offset | array[arrayEndIndex] <<...
[INPUTS] bran... | /* static context
[FOCAL] public int NibbleArray.get(int index)
[PATH1] if(arrayStartIndex == arrayEndIndex)=T -> return (int) (array[arrayStartIndex] >>> offset & maxEntryValue)
[PATH2] if(arrayStartIndex == arrayEndIndex)=F -> return (int) ((array[arrayStartIndex] >>> offset | array[arrayEndIndex] <<...
[INPUTS] bran... | true | ok | {"focal": {"class": "NibbleArray", "name": "get", "signature": "int get(int index)", "start_line": 3, "modifiers": "public", "params": [{"name": "index", "type": "int"}], "return_type": "int"}, "class_info": {"name": "NibbleArray", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [{"n... |
128535513_29 | class StreamUtil {
public static String toString(final InputStream in, final String encoding) throws IOException {
return new String(streamToByteArray(in), encoding);
}
public static byte[] streamToByteArray(final InputStream in);
public static InputStream copyStream(final InputStream in);
... | final InputStream is = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
assertThat("foo").isEqualTo(StreamUtil.toString(is, "UTF-8"));
}
} | [FOCAL] public static String StreamUtil.toString(InputStream in, String encoding)
[CLASS] class StreamUtil
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] byte[] streamToByteArray(InputStream in)
[NEW] String
[EXCEPTIONS] declares IOException
[INPUTS] branches=- | result=encoding, ... | /* static context
[FOCAL] public static String StreamUtil.toString(InputStream in, String encoding)
[INPUTS] branches=- | result=encoding, in
[EXCEPTIONS] declares IOException
[CALLS-INTERNAL] byte[] streamToByteArray(InputStream in)
[NEW] String
*/
| /* static context
[FOCAL] public static String StreamUtil.toString(InputStream in, String encoding)
[INPUTS] branches=- | result=encoding, in
[EXCEPTIONS] declares IOException
[CALLS-INTERNAL] byte[] streamToByteArray(InputStream in)
[NEW] String
*/
class StreamUtil {
public static String toString(final InputStrea... | true | ok | {"focal": {"class": "StreamUtil", "name": "toString", "signature": "String toString(InputStream in, String encoding) throws IOException", "start_line": 3, "modifiers": "public static", "params": [{"name": "in", "type": "InputStream"}, {"name": "encoding", "type": "String"}], "return_type": "String"}, "class_info": {"na... |
128639728_0 | class ChaincodeRepositoryConfigurationExtension extends RepositoryConfigurationExtensionSupport {
@Override
protected Collection<Class<? extends Annotation>> getIdentifyingAnnotations() {
logger.debug("getIdentifyingAnnotations return {" + Chaincode.class.getName() + "}");
return Collections.si... | Assert.assertTrue("Not contain correct annotation", extension.getIdentifyingAnnotations().contains(Chaincode.class));
}
} | [FOCAL] @Override protected Collection<Class<? extends Annotation>> ChaincodeRepositoryConfigurationExtension.getIdentifyingAnnotations()
[CLASS] class ChaincodeRepositoryConfigurationExtension extends RepositoryConfigurationExtensionSupport
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EX... | /* static context
[FOCAL] @Override protected Collection<Class<? extends Annotation>> ChaincodeRepositoryConfigurationExtension.getIdentifyingAnnotations()
[CALLS-EXTERNAL] logger.debug/1, Chaincode.class.getName/0, Collections.singleton/1
*/
| /* static context
[FOCAL] @Override protected Collection<Class<? extends Annotation>> ChaincodeRepositoryConfigurationExtension.getIdentifyingAnnotations()
[CALLS-EXTERNAL] logger.debug/1, Chaincode.class.getName/0, Collections.singleton/1
*/
class ChaincodeRepositoryConfigurationExtension extends RepositoryConfigurati... | true | ok | {"focal": {"class": "ChaincodeRepositoryConfigurationExtension", "name": "getIdentifyingAnnotations", "signature": "Collection<Class<? extends Annotation>> getIdentifyingAnnotations()", "start_line": 3, "modifiers": "@Override protected", "params": [], "return_type": "Collection<Class<? extends Annotation>>"}, "class_i... |
128753992_42 | class CountDown {
public int countDown(int n) {
if (0 <= n) { // bug here
n--;
}
return n;
}
public int doNothing(int n);
}
class CountDownTest {
@Test
public void test03() {
| assertEquals(0, new CountDown().countDown(0));
}
} | [FOCAL] public int CountDown.countDown(int n)
[CLASS] class CountDown
[METRICS] loc=6 cc=2 branches=1 loops=0 returns=1 throws=0 nesting=1
[PATH1] if(0 <= n)=T -> return n
[PATH2] if(0 <= n)=F -> return n
[INPUTS] branches=n | result=n
[DATAFLOW] n@param->L2,L3,L5; n@L3->L5
[CLASS-MEMBERS] int doNothing(int n)
[TEST] C... | /* static context
[FOCAL] public int CountDown.countDown(int n)
[PATH1] if(0 <= n)=T -> return n
[PATH2] if(0 <= n)=F -> return n
[INPUTS] branches=n | result=n
*/
| /* static context
[FOCAL] public int CountDown.countDown(int n)
[PATH1] if(0 <= n)=T -> return n
[PATH2] if(0 <= n)=F -> return n
[INPUTS] branches=n | result=n
*/
class CountDown {
public int countDown(int n) {
if (0 <= n) { // bug here
n--;
}
return n;
}
public int doNothing(int n);
}
clas... | true | ok | {"focal": {"class": "CountDown", "name": "countDown", "signature": "int countDown(int n)", "start_line": 3, "modifiers": "public", "params": [{"name": "n", "type": "int"}], "return_type": "int"}, "class_info": {"name": "CountDown", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [], ... |
129100096_33 | class WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
if (env.getActiveProfiles().length != 0) {
log.info("Web application configuration, using profiles: {}", (O... | env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
webConfigurer.onStartup(servletContext);
assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry);
assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY))... | [FOCAL] @Override public void WebConfigurer.onStartup(ServletContext servletContext)
[CLASS] class WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer
[METRICS] loc=12 cc=3 branches=2 loops=0 returns=0 throws=0 nesting=1
[CALLS-INTERNAL] void initCachingHttpHeadersFilter(ServletContex... | /* static context
[FOCAL] @Override public void WebConfigurer.onStartup(ServletContext servletContext)
[PATH1] if(env.getActiveProfiles().length != 0)=T -> if(env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION))=T
[PATH2] if(env.getActiveProfiles().length != 0)=F -> if(env.acceptsProfiles(JHipsterConstants... | /* static context
[FOCAL] @Override public void WebConfigurer.onStartup(ServletContext servletContext)
[PATH1] if(env.getActiveProfiles().length != 0)=T -> if(env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION))=T
[PATH2] if(env.getActiveProfiles().length != 0)=F -> if(env.acceptsProfiles(JHipsterConstants... | true | ok | {"focal": {"class": "WebConfigurer", "name": "onStartup", "signature": "void onStartup(ServletContext servletContext) throws ServletException", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "servletContext", "type": "ServletContext"}], "return_type": "void"}, "class_info": {"name": "WebConfigure... |
129118555_5 | class FormEditorValidator extends ContentTypeValidatorBase {
@Override
public void validate(Content content, Issues issues) {
Struct formData = content.getStruct(formDataProperty);
String action = content.getString(formActionProperty);
// Validate form fields
if (formData != null && formData.get(... | Content testContent = contentRepository.getContent("8");
IssuesImpl<Content> issues = new IssuesImpl<>(testContent, testContent.getProperties().keySet());
formEditorValidator.validate(testContent, issues);
// Ensure, all expected validation errors occurred.
String key = "formData.formElements.TextFi... | [FOCAL] @Override public void FormEditorValidator.validate(Content content, Issues issues)
[CLASS] class FormEditorValidator extends ContentTypeValidatorBase
[METRICS] loc=21 cc=3 branches=2 loops=0 returns=0 throws=0 nesting=1
[CALLS-INTERNAL] void validateFormElement(Issues issues, String action, Map.Entry<String, Ob... | /* static context
[FOCAL] @Override public void FormEditorValidator.validate(Content content, Issues issues)
[PATH1] if(formData != null && formData.get(FormEditor.FORM_ELEMENTS) != null)=T -> if(FormEditor.MAIL_ACTION.equals(action) && !StringUtils.hasText(content.getString(FormEditor.ADMIN_MAILS)))=T
[PATH2] if(formD... | /* static context
[FOCAL] @Override public void FormEditorValidator.validate(Content content, Issues issues)
[PATH1] if(formData != null && formData.get(FormEditor.FORM_ELEMENTS) != null)=T -> if(FormEditor.MAIL_ACTION.equals(action) && !StringUtils.hasText(content.getString(FormEditor.ADMIN_MAILS)))=T
[PATH2] if(formD... | true | ok | {"focal": {"class": "FormEditorValidator", "name": "validate", "signature": "void validate(Content content, Issues issues)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "content", "type": "Content"}, {"name": "issues", "type": "Issues"}], "return_type": "void"}, "class_info": {"name": "FormEdi... |
129126757_5 | class DateUtils {
public String getPeriodUIString(PeriodType periodType, Date date, Locale locale) {
String formattedDate;
Date initDate = getNextPeriod(periodType, date, 0);
Calendar cal = getCalendar();
cal.setTime(getNextPeriod(periodType, date, 1));
cal.add(Calendar.DA... | Date testDate = DateUtils.oldUiDateFormat().parse("2019-01-11");
assertEquals("11/1/2019", DateUtils.getInstance().getPeriodUIString(null, testDate, Locale.ENGLISH));
assertEquals("11/1/2019", DateUtils.getInstance().getPeriodUIString(PeriodType.Daily, testDate, Locale.ENGLISH));
assert... | [FOCAL] public String DateUtils.getPeriodUIString(PeriodType periodType, Date date, Locale locale)
[CLASS] class DateUtils
[METRICS] loc=57 cc=18 branches=2 loops=0 returns=1 throws=0 nesting=1
[CALLS-INTERNAL] Calendar getCalendar(); Date getNextPeriod(PeriodType period, Date currentDate, int page); SimpleDateFormat u... | class DateUtils {
public String getPeriodUIString(PeriodType periodType, Date date, Locale locale) {
String formattedDate;
Date initDate = getNextPeriod(periodType, date, 0);
Calendar cal = getCalendar();
cal.setTime(getNextPeriod(periodType, date, 1));
cal.add(Calendar.DA... | false | ok | {"focal": {"class": "DateUtils", "name": "getPeriodUIString", "signature": "String getPeriodUIString(PeriodType periodType, Date date, Locale locale)", "start_line": 3, "modifiers": "public", "params": [{"name": "periodType", "type": "PeriodType"}, {"name": "date", "type": "Date"}, {"name": "locale", "type": "Locale"}]... | |
129169685_0 | class PassiveAdminClient extends AdminClient {
public static PassiveAdminClient getInstance() { return INSTANCE; public static PassiveAdminClient getInstance() { return INSTANCE; }
public static PassiveAdminClient getInstance() { return INSTANCE; private PassiveAdminClient();
public static PassiveAdminClient getIns... | assertSame(adminClient, PassiveAdminClient.getInstance());
}
} | [FOCAL] public static PassiveAdminClient PassiveAdminClient.getInstance()
[CLASS] class PassiveAdminClient extends AdminClient
[METRICS] loc=1 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CLASS-MEMBERS] PassiveAdminClient(); void close(Duration timeout); Map<K, KafkaFuture<Void>> complete(Collection<T> inputs,... | /* static context
[FOCAL] public static PassiveAdminClient PassiveAdminClient.getInstance()
*/
| /* static context
[FOCAL] public static PassiveAdminClient PassiveAdminClient.getInstance()
*/
class PassiveAdminClient extends AdminClient {
public static PassiveAdminClient getInstance() { return INSTANCE; public static PassiveAdminClient getInstance() { return INSTANCE; }
public static PassiveAdminClient getInstan... | true | ok | {"focal": {"class": "PassiveAdminClient", "name": "getInstance", "signature": "PassiveAdminClient getInstance()", "start_line": 3, "modifiers": "public static", "params": [], "return_type": "PassiveAdminClient"}, "class_info": {"name": "PassiveAdminClient", "kind": "class", "modifiers": "", "superclass": "AdminClient",... |
129194897_0 | class LrcUtil {
public static String getArtist(String lrcString) {
String pattern = "\\[ar:(.*)\\]";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(lrcString);
if (m.find()) {
return m.group(1);
} else {
return null;
}
}
... | assertEquals("中文", LrcUtil.getArtist("[ar:中文]"));
assertEquals("1125", LrcUtil.getArtist("[ar:1125]"));
assertEquals("[1125]", LrcUtil.getArtist("[ar:[1125]]"));
assertEquals(null, LrcUtil.getArtist("[ar1235]"));
}
} | [FOCAL] public static String LrcUtil.getArtist(String lrcString)
[CLASS] class LrcUtil
[METRICS] loc=10 cc=2 branches=1 loops=0 returns=2 throws=0 nesting=1
[CALLS-EXTERNAL] Pattern.compile/1, Pattern.matcher/1, Matcher.find/0, Matcher.group/1
[PATH1] if(m.find())=T -> return m.group(1)
[PATH2] if(m.find())=F -> return... | /* static context
[FOCAL] public static String LrcUtil.getArtist(String lrcString)
[PATH1] if(m.find())=T -> return m.group(1)
[PATH2] if(m.find())=F -> return null
[INPUTS] branches=lrcString | result=lrcString
[CALLS-EXTERNAL] Pattern.compile/1, Pattern.matcher/1, Matcher.find/0, Matcher.group/1
*/
| /* static context
[FOCAL] public static String LrcUtil.getArtist(String lrcString)
[PATH1] if(m.find())=T -> return m.group(1)
[PATH2] if(m.find())=F -> return null
[INPUTS] branches=lrcString | result=lrcString
[CALLS-EXTERNAL] Pattern.compile/1, Pattern.matcher/1, Matcher.find/0, Matcher.group/1
*/
class LrcUtil {
... | true | ok | {"focal": {"class": "LrcUtil", "name": "getArtist", "signature": "String getArtist(String lrcString)", "start_line": 3, "modifiers": "public static", "params": [{"name": "lrcString", "type": "String"}], "return_type": "String"}, "class_info": {"name": "LrcUtil", "kind": "class", "modifiers": "", "superclass": null, "in... |
129196583_5 | class ServiceMethodInvoker {
public Flux<ServiceMessage> invokeMany(
ServiceMessage message, BiFunction<ServiceMessage, Class<?>, ServiceMessage> dataDecoder) {
return Flux.from(invoke(toRequest(message, dataDecoder))).map(this::toResponse);
}
public ServiceMethodInvoker(Method method, Object service... | final String methodName = "throwException2";
final Class<? extends StubService> serviceClass = stubService.getClass();
final Method method = serviceClass.getMethod(methodName);
final MethodInfo methodInfo =
new MethodInfo(
serviceClass.getName(),
methodName,
... | [FOCAL] public Flux<ServiceMessage> ServiceMethodInvoker.invokeMany(ServiceMessage message, BiFunction<ServiceMessage, Class<?>, ServiceMessage> dataDecoder)
[CLASS] class ServiceMethodInvoker
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] Object toRequest(ServiceMessage message, ... | /* static context
[FOCAL] public Flux<ServiceMessage> ServiceMethodInvoker.invokeMany(ServiceMessage message, BiFunction<ServiceMessage, Class<?>, ServiceMessage> dataDecoder)
[INPUTS] branches=- | result=dataDecoder, message
[CALLS-INTERNAL] Object toRequest(ServiceMessage message, BiFunction<ServiceMessage, Class<?>,... | /* static context
[FOCAL] public Flux<ServiceMessage> ServiceMethodInvoker.invokeMany(ServiceMessage message, BiFunction<ServiceMessage, Class<?>, ServiceMessage> dataDecoder)
[INPUTS] branches=- | result=dataDecoder, message
[CALLS-INTERNAL] Object toRequest(ServiceMessage message, BiFunction<ServiceMessage, Class<?>,... | true | ok | {"focal": {"class": "ServiceMethodInvoker", "name": "invokeMany", "signature": "Flux<ServiceMessage> invokeMany(ServiceMessage message, BiFunction<ServiceMessage, Class<?>, ServiceMessage> dataDecoder)", "start_line": 3, "modifiers": "public", "params": [{"name": "message", "type": "ServiceMessage"}, {"name": "dataDeco... |
129207304_0 | class RpcBindingConverter implements BindingConverter<RpcBindingParam, RpcBinding> {
protected List<RpcBindingMethodInfo> parseSofaMethods(SofaMethod[] sofaMethods) {
List<RpcBindingMethodInfo> rpcBindingMethodInfos = new ArrayList<RpcBindingMethodInfo>();
for (SofaMethod sofaMethod : sofaMethods)... |
RpcBindingConverter rpcBindingConverter = new BoltBindingConverter();
SofaReference reference = null;
try {
reference = RpcBindingConverterTest.class.getDeclaredField("testAnnotation").getAnnotation(
SofaReference.class);
} catch (NoSuchFieldException e) {
... | [FOCAL] protected List<RpcBindingMethodInfo> RpcBindingConverter.parseSofaMethods(SofaMethod[] sofaMethods)
[CLASS] class RpcBindingConverter implements BindingConverter<RpcBindingParam, RpcBinding>
[METRICS] loc=17 cc=2 branches=0 loops=1 returns=1 throws=0 nesting=1
[CALLS-EXTERNAL] RpcBindingMethodInfo.setName/1, So... | /* static context
[FOCAL] protected List<RpcBindingMethodInfo> RpcBindingConverter.parseSofaMethods(SofaMethod[] sofaMethods)
[PATH1] foreach(SofaMethod sofaMethod : sofaMethods)=T -> exit loop -> return rpcBindingMethodInfos
[PATH2] foreach(SofaMethod sofaMethod : sofaMethods)=F -> return rpcBindingMethodInfos
[INPUTS... | /* static context
[FOCAL] protected List<RpcBindingMethodInfo> RpcBindingConverter.parseSofaMethods(SofaMethod[] sofaMethods)
[PATH1] foreach(SofaMethod sofaMethod : sofaMethods)=T -> exit loop -> return rpcBindingMethodInfos
[PATH2] foreach(SofaMethod sofaMethod : sofaMethods)=F -> return rpcBindingMethodInfos
[INPUTS... | true | ok | {"focal": {"class": "RpcBindingConverter", "name": "parseSofaMethods", "signature": "List<RpcBindingMethodInfo> parseSofaMethods(SofaMethod[] sofaMethods)", "start_line": 3, "modifiers": "protected", "params": [{"name": "sofaMethods", "type": "SofaMethod[]"}], "return_type": "List<RpcBindingMethodInfo>"}, "class_info":... |
129428289_6 | class WebFormHandler {
public BaseConsent login(String appId, String sessionId, String sessionData, String username, String password, BaseClient.CookieStorage cookieStorage) throws UserLoginFailedException {
String result = this.client.login(appId, sessionId, sessionData, username, password, cookieStorage)... | Mockito.when(client.login(anyString(), anyString(), anyString(), anyString(), anyString(), any(BaseClient.CookieStorage.class))).thenReturn(consentFormHTML);
assertThat(webFormHandler.login("app-id", "session-id", "session-data", "user", "password", cookieStorage))
.isInstanceOf(BaseCons... | [FOCAL] public BaseConsent WebFormHandler.login(String appId, String sessionId, String sessionData, String username, String password, BaseClient.CookieStorage cookieStorage)
[CLASS] class WebFormHandler
[METRICS] loc=11 cc=3 branches=1 loops=0 returns=1 throws=2 nesting=1
[CALLS-EXTERNAL] WebFormClient.login/6, Strings... | /* static context
[FOCAL] public BaseConsent WebFormHandler.login(String appId, String sessionId, String sessionData, String username, String password, BaseClient.CookieStorage cookieStorage)
[THROWS-WHEN] UserLoginFailedException when Strings.isNullOrEmpty(result)
[THROWS-WHEN] UserLoginFailedException when !Strings.i... | /* static context
[FOCAL] public BaseConsent WebFormHandler.login(String appId, String sessionId, String sessionData, String username, String password, BaseClient.CookieStorage cookieStorage)
[THROWS-WHEN] UserLoginFailedException when Strings.isNullOrEmpty(result)
[THROWS-WHEN] UserLoginFailedException when !Strings.i... | true | ok | {"focal": {"class": "WebFormHandler", "name": "login", "signature": "BaseConsent login(String appId, String sessionId, String sessionData, String username, String password, BaseClient.CookieStorage cookieStorage) throws UserLoginFailedException", "start_line": 3, "modifiers": "public", "params": [{"name": "appId", "typ... |
129498280_9 | class AccountController {
@RequestMapping(path = "/account", method = RequestMethod.POST)
public ResponseEntity<Account> addAccount(@RequestBody Account account) {
return ResponseEntity.status(HttpStatus.CREATED).body(service.addAccount(account));
}
@RequestMapping(path = "/account/{id}", method = RequestMethod... | Account mockAccount = mock(Account.class);
Long id = new Long(1);
when(mockAccount.getId()).thenReturn(id);
when(mockAccount.getName()).thenReturn("Sagar Jadhav");
when(service.addAccount(mockAccount)).thenReturn(mockAccount);
ResponseEntity<Account> responseEntity = controller.addAccount(mockAccount);
... | [FOCAL] @RequestMapping(path = "/account", method = RequestMethod.POST) public ResponseEntity<Account> AccountController.addAccount(Account account)
[CLASS] class AccountController
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] ResponseEntity.status(HttpStatus.CREATED).body/1, Res... | /* static context
[FOCAL] @RequestMapping(path = "/account", method = RequestMethod.POST) public ResponseEntity<Account> AccountController.addAccount(Account account)
[INPUTS] branches=- | result=account, service
[COLLABORATORS] field service:AccountService addAccount/1
[FIELDS] read=service:AccountService
[CALLS-EXTER... | /* static context
[FOCAL] @RequestMapping(path = "/account", method = RequestMethod.POST) public ResponseEntity<Account> AccountController.addAccount(Account account)
[INPUTS] branches=- | result=account, service
[COLLABORATORS] field service:AccountService addAccount/1
[FIELDS] read=service:AccountService
[CALLS-EXTER... | true | ok | {"focal": {"class": "AccountController", "name": "addAccount", "signature": "ResponseEntity<Account> addAccount(Account account)", "start_line": 3, "modifiers": "@RequestMapping(path = \"/account\", method = RequestMethod.POST) public", "params": [{"name": "account", "type": "Account"}], "return_type": "ResponseEntity<... |
129501565_13 | class Octree {
public List<T> flatten() {
List<T> list = new ArrayList<T>();
Deque<Octree<T>> queue = new ArrayDeque<>();
queue.push(this);
while (queue.size() > 0) {
Octree<T> tree = queue.pop();
if (tree.item != null) {
list.add(tree.item)... | Octree<String> o = new Octree<>();
o.insert(0, 0, 0, 8, "Foo");
o.insert(32, 16, 8, 4, "Bar");
List<String> f = o.flatten();
assertEquals(2, f.size());
assertTrue(f.contains("Foo"));
assertTrue(f.contains("Bar"));
}
} | [FOCAL] public List<T> Octree.flatten()
[CLASS] class Octree
[METRICS] loc=21 cc=5 branches=2 loops=2 returns=1 throws=0 nesting=3
[CALLS-EXTERNAL] Deque<Octree<T>>.push/1, Deque<Octree<T>>.size/0, Deque<Octree<T>>.pop/0, List<T>.add/1, Octree<T>.get/1
[NEW] ArrayList<T>, ArrayDeque<>
[PATH1] while(queue.size() > 0)=T ... | /* static context
[FOCAL] public List<T> Octree.flatten()
[PATH1] while(queue.size() > 0)=T -> if(tree.item != null)=T -> for(oct < 8)=T -> if(o != null)=T -> exit loop -> exit loop -> return list
[PATH2] while(queue.size() > 0)=T -> if(tree.item != null)=F -> for(oct < 8)=F -> exit loop -> return list
[PATH3] while(qu... | /* static context
[FOCAL] public List<T> Octree.flatten()
[PATH1] while(queue.size() > 0)=T -> if(tree.item != null)=T -> for(oct < 8)=T -> if(o != null)=T -> exit loop -> exit loop -> return list
[PATH2] while(queue.size() > 0)=T -> if(tree.item != null)=F -> for(oct < 8)=F -> exit loop -> return list
[PATH3] while(qu... | true | ok | {"focal": {"class": "Octree", "name": "flatten", "signature": "List<T> flatten()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "List<T>"}, "class_info": {"name": "Octree", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [], "members": [{"name": "Octree", "kin... |
129508952_16 | class Utils {
public static synchronized String getCountryName(Context context) {
String countryName = "";
try {
Locale locale =
context.getApplicationContext().getResources().getConfiguration().locale;
countryName = locale.getDisplayCountry();
} ... | String countryName = Utils.getCountryName(context);
assertThat(countryName, is(notNullValue()));
}
} | [FOCAL] public static synchronized String Utils.getCountryName(Context context)
[CLASS] class Utils
[METRICS] loc=13 cc=2 branches=0 loops=0 returns=1 throws=0 nesting=1
[CALLS-EXTERNAL] context.getApplicationContext().getResources().getConfiguration/0, context.getApplicationContext().getResources/0, Context.getApplica... | /* static context
[FOCAL] public static synchronized String Utils.getCountryName(Context context)
[PATH1] try-body throws -> return countryName
[INPUTS] branches=- | result=context
[COLLABORATORS] param context:Context getApplicationContext/0
[EXCEPTIONS] catches Exception e
[CALLS-EXTERNAL] context.getApplicationConte... | /* static context
[FOCAL] public static synchronized String Utils.getCountryName(Context context)
[PATH1] try-body throws -> return countryName
[INPUTS] branches=- | result=context
[COLLABORATORS] param context:Context getApplicationContext/0
[EXCEPTIONS] catches Exception e
[CALLS-EXTERNAL] context.getApplicationConte... | true | ok | {"focal": {"class": "Utils", "name": "getCountryName", "signature": "String getCountryName(Context context)", "start_line": 3, "modifiers": "public static synchronized", "params": [{"name": "context", "type": "Context"}], "return_type": "String"}, "class_info": {"name": "Utils", "kind": "class", "modifiers": "", "super... |
129699491_18 | class Classes {
public static <T> T getValueFromProtectedField(Object object, String fieldName) {
Class<?> clazz = object.getClass();
try {
Field field = clazz.getDeclaredField(fieldName);
if (!field.isAccessible()) {
field.setAccessible(true);
}
... | Object object = new Instanciable();
assertThatExceptionOfType(IllegalStateException.class)
.isThrownBy(() -> Classes.getValueFromProtectedField(object, "missingField"))
.withMessage("Cannot find field missingField in class com.github.fridujo.automocker.utils.ClassesTest$Instancia... | [FOCAL] public static T Classes.getValueFromProtectedField(Object object, String fieldName)
[CLASS] class Classes
[METRICS] loc=12 cc=3 branches=1 loops=0 returns=1 throws=1 nesting=2
[CALLS-EXTERNAL] Object.getClass/0, Class<?>.getDeclaredField/1, Field.isAccessible/0, Field.setAccessible/1, Field.get/1, Class<?>.getN... | /* static context
[FOCAL] public static T Classes.getValueFromProtectedField(Object object, String fieldName)
[THROWS-WHEN] IllegalStateException when try-body throws
[PATH1] try-body throws -> throw new IllegalStateException("Cannot find field " + fieldName + " in c...
[PATH2] if(!field.isAccessible())=T -> return (T)... | /* static context
[FOCAL] public static T Classes.getValueFromProtectedField(Object object, String fieldName)
[THROWS-WHEN] IllegalStateException when try-body throws
[PATH1] try-body throws -> throw new IllegalStateException("Cannot find field " + fieldName + " in c...
[PATH2] if(!field.isAccessible())=T -> return (T)... | true | ok | {"focal": {"class": "Classes", "name": "getValueFromProtectedField", "signature": "T getValueFromProtectedField(Object object, String fieldName)", "start_line": 3, "modifiers": "public static", "params": [{"name": "object", "type": "Object"}, {"name": "fieldName", "type": "String"}], "return_type": "T"}, "class_info": ... |
129712230_1 | class FieldUtils {
public static Object getPrivateField(Class<?> clazz, Object target, String fieldName) {
Field field = ReflectionUtils.findField(clazz, fieldName);
if (field != null) {
ReflectionUtils.makeAccessible(field);
return ReflectionUtils.getField(field, target);
... | Feign.Builder builder = Feign.builder();
Request.Options options = (Request.Options) FieldUtils.getPrivateField(Feign.Builder.class, builder, "options");
Assert.assertNotNull(options);
System.out.println(options.connectTimeoutMillis() + ":" + options.readTimeoutMillis());
}
} | [FOCAL] public static Object FieldUtils.getPrivateField(Class<?> clazz, Object target, String fieldName)
[CLASS] class FieldUtils
[METRICS] loc=8 cc=2 branches=1 loops=0 returns=2 throws=0 nesting=1
[CALLS-EXTERNAL] ReflectionUtils.findField/2, ReflectionUtils.makeAccessible/1, ReflectionUtils.getField/2
[PATH1] if(fie... | /* static context
[FOCAL] public static Object FieldUtils.getPrivateField(Class<?> clazz, Object target, String fieldName)
[PATH1] if(field != null)=T -> return ReflectionUtils.getField(field, target)
[PATH2] if(field != null)=F -> return null
[INPUTS] branches=clazz, fieldName | result=clazz, fieldName, target
[CALLS-... | /* static context
[FOCAL] public static Object FieldUtils.getPrivateField(Class<?> clazz, Object target, String fieldName)
[PATH1] if(field != null)=T -> return ReflectionUtils.getField(field, target)
[PATH2] if(field != null)=F -> return null
[INPUTS] branches=clazz, fieldName | result=clazz, fieldName, target
[CALLS-... | true | ok | {"focal": {"class": "FieldUtils", "name": "getPrivateField", "signature": "Object getPrivateField(Class<?> clazz, Object target, String fieldName)", "start_line": 3, "modifiers": "public static", "params": [{"name": "clazz", "type": "Class<?>"}, {"name": "target", "type": "Object"}, {"name": "fieldName", "type": "Strin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.