code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
final int getSize(
final ClassWriter cw,
final byte[] code,
final int len,
final int maxStack,
final int maxLocals)
{
Attribute attr = this;
int size = 0;
while (attr != null) {
cw.newUTF8(attr.type);
size += attr.write(cw, code, len, maxStack, maxLocals).length + 6;
attr = attr.next;
}
return size;
} }
|
public class class_name {
final int getSize(
final ClassWriter cw,
final byte[] code,
final int len,
final int maxStack,
final int maxLocals)
{
Attribute attr = this;
int size = 0;
while (attr != null) {
cw.newUTF8(attr.type); // depends on control dependency: [while], data = [(attr]
size += attr.write(cw, code, len, maxStack, maxLocals).length + 6; // depends on control dependency: [while], data = [none]
attr = attr.next; // depends on control dependency: [while], data = [none]
}
return size;
} }
|
public class class_name {
public static void init(final String appid,int initialDelay,int delay,String... types){
if(firestAppid == null){
firestAppid = appid;
}
for(final String type : types){
final String key = appid + KEY_JOIN + type;
if(scheduledExecutorService == null){
initScheduledExecutorService();
}
if(futureMap.containsKey(key)){
futureMap.get(key).cancel(true);
}
//立即执行一次
if(initialDelay == 0){
doRun(appid, type, key);
}
ScheduledFuture<?> scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
doRun(appid, type, key);
}
},initialDelay == 0 ? delay : initialDelay,delay,TimeUnit.SECONDS);
futureMap.put(key,scheduledFuture);
}
} }
|
public class class_name {
public static void init(final String appid,int initialDelay,int delay,String... types){
if(firestAppid == null){
firestAppid = appid;
// depends on control dependency: [if], data = [none]
}
for(final String type : types){
final String key = appid + KEY_JOIN + type;
if(scheduledExecutorService == null){
initScheduledExecutorService();
// depends on control dependency: [if], data = [none]
}
if(futureMap.containsKey(key)){
futureMap.get(key).cancel(true);
// depends on control dependency: [if], data = [none]
}
//立即执行一次
if(initialDelay == 0){
doRun(appid, type, key);
// depends on control dependency: [if], data = [none]
}
ScheduledFuture<?> scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
doRun(appid, type, key);
}
},initialDelay == 0 ? delay : initialDelay,delay,TimeUnit.SECONDS);
futureMap.put(key,scheduledFuture);
// depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
@Override
@SuppressWarnings("unchecked")
public <E extends Entity> E getEntity(String attributeName, Class<E> clazz) {
Entity entity = delegate().getEntity(attributeName, clazz);
if (clazz.equals(FileMeta.class)) {
return entity != null ? (E) new FileMeta(newPretendingEntity(entity)) : null;
} else {
throw new UnsupportedOperationException("Can't return typed pretending entities");
}
} }
|
public class class_name {
@Override
@SuppressWarnings("unchecked")
public <E extends Entity> E getEntity(String attributeName, Class<E> clazz) {
Entity entity = delegate().getEntity(attributeName, clazz);
if (clazz.equals(FileMeta.class)) {
return entity != null ? (E) new FileMeta(newPretendingEntity(entity)) : null; // depends on control dependency: [if], data = [none]
} else {
throw new UnsupportedOperationException("Can't return typed pretending entities");
}
} }
|
public class class_name {
private void printMessage(final Throwable t) {
final String message = t.getMessage();
if (message != null && !message.trim().isEmpty()) {
printErrorMessage("Error: " + message);
}
} }
|
public class class_name {
private void printMessage(final Throwable t) {
final String message = t.getMessage();
if (message != null && !message.trim().isEmpty()) {
printErrorMessage("Error: " + message); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public int skipComment() {
char current = charAt(offset);
char next = charAt(offset + 1);
if (isSingleLineCommentBegin(current, next)) {
return skipSingleLineComment(COMMENT_BEGIN_SYMBOL_LENGTH);
} else if ('#' == current) {
return skipSingleLineComment(MYSQL_SPECIAL_COMMENT_BEGIN_SYMBOL_LENGTH);
} else if (isMultipleLineCommentBegin(current, next)) {
return skipMultiLineComment();
}
return offset;
} }
|
public class class_name {
public int skipComment() {
char current = charAt(offset);
char next = charAt(offset + 1);
if (isSingleLineCommentBegin(current, next)) {
return skipSingleLineComment(COMMENT_BEGIN_SYMBOL_LENGTH); // depends on control dependency: [if], data = [none]
} else if ('#' == current) {
return skipSingleLineComment(MYSQL_SPECIAL_COMMENT_BEGIN_SYMBOL_LENGTH); // depends on control dependency: [if], data = [none]
} else if (isMultipleLineCommentBegin(current, next)) {
return skipMultiLineComment(); // depends on control dependency: [if], data = [none]
}
return offset;
} }
|
public class class_name {
public void unusual() {
// Note that the first level does not have to be one
pyramid = FactoryPyramid.discreteGaussian(new int[]{2,6},-1,2,true, ImageType.single(imageType));
// Other kernels can also be used besides Gaussian
Kernel1D kernel;
if(GeneralizedImageOps.isFloatingPoint(imageType) ) {
kernel = FactoryKernel.table1D_F32(2,true);
} else {
kernel = FactoryKernel.table1D_I32(2);
}
} }
|
public class class_name {
public void unusual() {
// Note that the first level does not have to be one
pyramid = FactoryPyramid.discreteGaussian(new int[]{2,6},-1,2,true, ImageType.single(imageType));
// Other kernels can also be used besides Gaussian
Kernel1D kernel;
if(GeneralizedImageOps.isFloatingPoint(imageType) ) {
kernel = FactoryKernel.table1D_F32(2,true); // depends on control dependency: [if], data = [none]
} else {
kernel = FactoryKernel.table1D_I32(2); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private List<Resource> parseWarResources(Xpp3Dom warResourcesNode) {
List<Resource> resources = new ArrayList<Resource>();
Xpp3Dom[] resourceNodes = warResourcesNode.getChildren("resource");
for (Xpp3Dom resourceNode : resourceNodes) {
if (resourceNode == null || resourceNode.getChild("directory") == null) {
continue;
}
resources.add(parseResourceNode(resourceNode));
}
return resources;
} }
|
public class class_name {
private List<Resource> parseWarResources(Xpp3Dom warResourcesNode) {
List<Resource> resources = new ArrayList<Resource>();
Xpp3Dom[] resourceNodes = warResourcesNode.getChildren("resource");
for (Xpp3Dom resourceNode : resourceNodes) {
if (resourceNode == null || resourceNode.getChild("directory") == null) {
continue;
}
resources.add(parseResourceNode(resourceNode)); // depends on control dependency: [for], data = [resourceNode]
}
return resources;
} }
|
public class class_name {
private String getSign(String body) {
String signNodeName = "<" + AlipayConstants.SIGN + ">";
String signEndNodeName = "</" + AlipayConstants.SIGN + ">";
int indexOfSignNode = body.indexOf(signNodeName);
int indexOfSignEndNode = body.indexOf(signEndNodeName);
if (indexOfSignNode < 0 || indexOfSignEndNode < 0) {
return null;
}
// 签名
return body.substring(indexOfSignNode + signNodeName.length(), indexOfSignEndNode);
} }
|
public class class_name {
private String getSign(String body) {
String signNodeName = "<" + AlipayConstants.SIGN + ">";
String signEndNodeName = "</" + AlipayConstants.SIGN + ">";
int indexOfSignNode = body.indexOf(signNodeName);
int indexOfSignEndNode = body.indexOf(signEndNodeName);
if (indexOfSignNode < 0 || indexOfSignEndNode < 0) {
return null; // depends on control dependency: [if], data = [none]
}
// 签名
return body.substring(indexOfSignNode + signNodeName.length(), indexOfSignEndNode);
} }
|
public class class_name {
private Double getValueOverBorders(GriddedTile griddedTile, TImage image,
Double[][] leftLastColumns, Double[][] topLeftRows,
Double[][] topRows, int x, int y) {
Double value = null;
// Only handle locations in the current tile, to the left, top left, or
// top tiles. Tiles are processed sorted by rows and columns, so values
// to the top right, right, or any below tiles will be handled later if
// those tiles exist
if (x < image.getWidth() && y < image.getHeight()) {
if (x >= 0 && y >= 0) {
value = getValue(griddedTile, image, x, y);
} else if (x < 0 && y < 0) {
// Try to get the coverage data value from the top left tile
// values
if (topLeftRows != null) {
int row = (-1 * y) - 1;
if (row < topLeftRows.length) {
int column = x + topLeftRows[row].length;
if (column >= 0) {
value = topLeftRows[row][column];
}
}
}
} else if (x < 0) {
// Try to get the coverage data value from the left tile values
if (leftLastColumns != null) {
int column = (-1 * x) - 1;
if (column < leftLastColumns.length) {
int row = y;
if (row < leftLastColumns[column].length) {
value = leftLastColumns[column][row];
}
}
}
} else {
// Try to get the coverage data value from the top tile values
if (topRows != null) {
int row = (-1 * y) - 1;
if (row < topRows.length) {
int column = x;
if (column < topRows[row].length) {
value = topRows[row][column];
}
}
}
}
}
return value;
} }
|
public class class_name {
private Double getValueOverBorders(GriddedTile griddedTile, TImage image,
Double[][] leftLastColumns, Double[][] topLeftRows,
Double[][] topRows, int x, int y) {
Double value = null;
// Only handle locations in the current tile, to the left, top left, or
// top tiles. Tiles are processed sorted by rows and columns, so values
// to the top right, right, or any below tiles will be handled later if
// those tiles exist
if (x < image.getWidth() && y < image.getHeight()) {
if (x >= 0 && y >= 0) {
value = getValue(griddedTile, image, x, y); // depends on control dependency: [if], data = [none]
} else if (x < 0 && y < 0) {
// Try to get the coverage data value from the top left tile
// values
if (topLeftRows != null) {
int row = (-1 * y) - 1;
if (row < topLeftRows.length) {
int column = x + topLeftRows[row].length;
if (column >= 0) {
value = topLeftRows[row][column]; // depends on control dependency: [if], data = [none]
}
}
}
} else if (x < 0) {
// Try to get the coverage data value from the left tile values
if (leftLastColumns != null) {
int column = (-1 * x) - 1;
if (column < leftLastColumns.length) {
int row = y;
if (row < leftLastColumns[column].length) {
value = leftLastColumns[column][row]; // depends on control dependency: [if], data = [none]
}
}
}
} else {
// Try to get the coverage data value from the top tile values
if (topRows != null) {
int row = (-1 * y) - 1;
if (row < topRows.length) {
int column = x;
if (column < topRows[row].length) {
value = topRows[row][column]; // depends on control dependency: [if], data = [none]
}
}
}
}
}
return value;
} }
|
public class class_name {
private RingbufferConfig getRingbufferConfig(RingbufferService service, ObjectNamespace ns) {
final String serviceName = ns.getServiceName();
if (RingbufferService.SERVICE_NAME.equals(serviceName)) {
return service.getRingbufferConfig(ns.getObjectName());
} else if (MapService.SERVICE_NAME.equals(serviceName)) {
final MapService mapService = getNodeEngine().getService(MapService.SERVICE_NAME);
final MapEventJournal journal = mapService.getMapServiceContext().getEventJournal();
final EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
return journal.toRingbufferConfig(journalConfig, ns);
} else if (CacheService.SERVICE_NAME.equals(serviceName)) {
final CacheService cacheService = getNodeEngine().getService(CacheService.SERVICE_NAME);
final CacheEventJournal journal = cacheService.getEventJournal();
final EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
return journal.toRingbufferConfig(journalConfig, ns);
} else {
throw new IllegalArgumentException("Unsupported ringbuffer service name " + serviceName);
}
} }
|
public class class_name {
private RingbufferConfig getRingbufferConfig(RingbufferService service, ObjectNamespace ns) {
final String serviceName = ns.getServiceName();
if (RingbufferService.SERVICE_NAME.equals(serviceName)) {
return service.getRingbufferConfig(ns.getObjectName()); // depends on control dependency: [if], data = [none]
} else if (MapService.SERVICE_NAME.equals(serviceName)) {
final MapService mapService = getNodeEngine().getService(MapService.SERVICE_NAME);
final MapEventJournal journal = mapService.getMapServiceContext().getEventJournal();
final EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
return journal.toRingbufferConfig(journalConfig, ns); // depends on control dependency: [if], data = [none]
} else if (CacheService.SERVICE_NAME.equals(serviceName)) {
final CacheService cacheService = getNodeEngine().getService(CacheService.SERVICE_NAME);
final CacheEventJournal journal = cacheService.getEventJournal();
final EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
return journal.toRingbufferConfig(journalConfig, ns); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unsupported ringbuffer service name " + serviceName);
}
} }
|
public class class_name {
static String readAnyField(Object obj, String ... names) {
try {
for (String name : names) {
try {
Field field = obj.getClass().getDeclaredField(name);
field.setAccessible(true);
return (String) field.get(obj);
} catch (NoSuchFieldException e) {
//ignore and try next field...
}
}
return null;
} catch (IllegalAccessException e) {
return null;
}
} }
|
public class class_name {
static String readAnyField(Object obj, String ... names) {
try {
for (String name : names) {
try {
Field field = obj.getClass().getDeclaredField(name);
field.setAccessible(true); // depends on control dependency: [try], data = [none]
return (String) field.get(obj); // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException e) {
//ignore and try next field...
} // depends on control dependency: [catch], data = [none]
}
return null; // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected boolean processTopicTags(final TagProvider tagProvider, final ITopicNode specTopic, final TopicWrapper topic) {
LOG.debug("Processing topic tags");
boolean changed = false;
// Get the tags for the topic
final List<String> addTagNames = specTopic.getTags(true);
final List<TagWrapper> addTags = new ArrayList<TagWrapper>();
for (final String addTagName : addTagNames) {
final TagWrapper tag = tagProvider.getTagByName(addTagName);
if (tag != null) {
addTags.add(tag);
}
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return changed;
}
// Process the tags depending on the topic type
if (specTopic.isTopicAClonedTopic()) {
if (processClonedTopicTags(tagProvider, specTopic, topic, addTags)) changed = true;
} else if (specTopic.isTopicAnExistingTopic() && specTopic.getRevision() == null) {
if (processExistingTopicTags(tagProvider, topic, addTags)) changed = true;
} else if (specTopic.isTopicANewTopic()) {
if (processNewTopicTags(tagProvider, topic, addTags)) changed = true;
}
return changed;
} }
|
public class class_name {
protected boolean processTopicTags(final TagProvider tagProvider, final ITopicNode specTopic, final TopicWrapper topic) {
LOG.debug("Processing topic tags");
boolean changed = false;
// Get the tags for the topic
final List<String> addTagNames = specTopic.getTags(true);
final List<TagWrapper> addTags = new ArrayList<TagWrapper>();
for (final String addTagName : addTagNames) {
final TagWrapper tag = tagProvider.getTagByName(addTagName);
if (tag != null) {
addTags.add(tag); // depends on control dependency: [if], data = [(tag]
}
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return changed; // depends on control dependency: [if], data = [none]
}
// Process the tags depending on the topic type
if (specTopic.isTopicAClonedTopic()) {
if (processClonedTopicTags(tagProvider, specTopic, topic, addTags)) changed = true;
} else if (specTopic.isTopicAnExistingTopic() && specTopic.getRevision() == null) {
if (processExistingTopicTags(tagProvider, topic, addTags)) changed = true;
} else if (specTopic.isTopicANewTopic()) {
if (processNewTopicTags(tagProvider, topic, addTags)) changed = true;
}
return changed;
} }
|
public class class_name {
@Override
public void close()
{
for (KestrelClientInfo info : this.clientInfoList)
{
info.closeClient();
}
// Closing the client connection causes all the open reliable reads to be aborted.
// Thus, clear our local buffer of these reliable reads.
this.emitBuffer.clear();
this.clientInfoList.clear();
} }
|
public class class_name {
@Override
public void close()
{
for (KestrelClientInfo info : this.clientInfoList)
{
info.closeClient(); // depends on control dependency: [for], data = [info]
}
// Closing the client connection causes all the open reliable reads to be aborted.
// Thus, clear our local buffer of these reliable reads.
this.emitBuffer.clear();
this.clientInfoList.clear();
} }
|
public class class_name {
private Map<Integer, Integer> getNodeIdToPrimaryCount(Cluster cluster) {
Map<Integer, Integer> nodeIdToPrimaryCount = Maps.newHashMap();
for(Node node: cluster.getNodes()) {
nodeIdToPrimaryCount.put(node.getId(), node.getPartitionIds().size());
}
return nodeIdToPrimaryCount;
} }
|
public class class_name {
private Map<Integer, Integer> getNodeIdToPrimaryCount(Cluster cluster) {
Map<Integer, Integer> nodeIdToPrimaryCount = Maps.newHashMap();
for(Node node: cluster.getNodes()) {
nodeIdToPrimaryCount.put(node.getId(), node.getPartitionIds().size()); // depends on control dependency: [for], data = [node]
}
return nodeIdToPrimaryCount;
} }
|
public class class_name {
private static int findeol(byte b[], int pos, int len) {
int end = pos + len;
int i = pos;
while (i < end) {
if (b[i++] == '\n') {
return i - pos;
}
}
return -1;
} }
|
public class class_name {
private static int findeol(byte b[], int pos, int len) {
int end = pos + len;
int i = pos;
while (i < end) {
if (b[i++] == '\n') {
return i - pos; // depends on control dependency: [if], data = [none]
}
}
return -1;
} }
|
public class class_name {
private void fakeServiceCall() {
poller.enablePoll();
Cache.getCache().invalidate(DATA_KEY);
new Thread() {
@Override
public void run() {
try {
Thread.sleep(SERVICE_TIME);
Cache.getCache().put(DATA_KEY, "SUCCESS!");
} catch (InterruptedException e) {
LOG.error("Timed out calling service", e);
Cache.getCache().put(DATA_KEY, "Timed out!");
}
}
}.start();
} }
|
public class class_name {
private void fakeServiceCall() {
poller.enablePoll();
Cache.getCache().invalidate(DATA_KEY);
new Thread() {
@Override
public void run() {
try {
Thread.sleep(SERVICE_TIME); // depends on control dependency: [try], data = [none]
Cache.getCache().put(DATA_KEY, "SUCCESS!"); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
LOG.error("Timed out calling service", e);
Cache.getCache().put(DATA_KEY, "Timed out!");
} // depends on control dependency: [catch], data = [none]
}
}.start();
} }
|
public class class_name {
public void enable() {
updateState("up");
m_enabled = true;
// show the current file input field
if (m_fileInput != null) {
m_fileInput.getElement().getStyle().clearDisplay();
}
super.setTitle(m_title);
} }
|
public class class_name {
public void enable() {
updateState("up");
m_enabled = true;
// show the current file input field
if (m_fileInput != null) {
m_fileInput.getElement().getStyle().clearDisplay(); // depends on control dependency: [if], data = [none]
}
super.setTitle(m_title);
} }
|
public class class_name {
public Set<BuildConfiguration> getIndirectDependencies() {
Set<BuildConfiguration> indirectDependencies = new HashSet<BuildConfiguration>();
List<BuildConfiguration> configsToCheck = new ArrayList<BuildConfiguration>();
configsToCheck.addAll(getDependencies());
while (!configsToCheck.isEmpty()) {
BuildConfiguration nextConfig = configsToCheck.get(0);
for (BuildConfiguration nextDep : nextConfig.getDependencies()) {
if (!indirectDependencies.contains(nextDep)) {
indirectDependencies.add(nextDep);
configsToCheck.add(nextDep);
}
}
configsToCheck.remove(nextConfig);
}
return indirectDependencies;
} }
|
public class class_name {
public Set<BuildConfiguration> getIndirectDependencies() {
Set<BuildConfiguration> indirectDependencies = new HashSet<BuildConfiguration>();
List<BuildConfiguration> configsToCheck = new ArrayList<BuildConfiguration>();
configsToCheck.addAll(getDependencies());
while (!configsToCheck.isEmpty()) {
BuildConfiguration nextConfig = configsToCheck.get(0);
for (BuildConfiguration nextDep : nextConfig.getDependencies()) {
if (!indirectDependencies.contains(nextDep)) {
indirectDependencies.add(nextDep); // depends on control dependency: [if], data = [none]
configsToCheck.add(nextDep); // depends on control dependency: [if], data = [none]
}
}
configsToCheck.remove(nextConfig); // depends on control dependency: [while], data = [none]
}
return indirectDependencies;
} }
|
public class class_name {
public static Buckets fromCount(long start, long end, int count) {
checkTimeRange(start, end);
checkArgument(count > 0, "count is not positive: %s", count);
long quotient = (end - start) / count;
long remainder = (end - start) % count;
long step;
// count * quotient + remainder = end - start
// If the remainder is greater than zero, we should try with (quotient + 1), provided that this greater step
// does not make the number of buckets smaller than the expected count
if (remainder != 0 && (count - 1) * (quotient + 1) < (end - start)) {
step = quotient + 1;
} else {
step = quotient;
}
checkArgument(step > 0, "Computed step is equal to zero");
return new Buckets(start, step, count);
} }
|
public class class_name {
public static Buckets fromCount(long start, long end, int count) {
checkTimeRange(start, end);
checkArgument(count > 0, "count is not positive: %s", count);
long quotient = (end - start) / count;
long remainder = (end - start) % count;
long step;
// count * quotient + remainder = end - start
// If the remainder is greater than zero, we should try with (quotient + 1), provided that this greater step
// does not make the number of buckets smaller than the expected count
if (remainder != 0 && (count - 1) * (quotient + 1) < (end - start)) {
step = quotient + 1; // depends on control dependency: [if], data = [none]
} else {
step = quotient; // depends on control dependency: [if], data = [none]
}
checkArgument(step > 0, "Computed step is equal to zero");
return new Buckets(start, step, count);
} }
|
public class class_name {
private void categories(RouteMeta routeMete) {
if (routeVerify(routeMete)) {
logger.info(">>> Start categories, group = " + routeMete.getGroup() + ", path = " + routeMete.getPath() + " <<<");
Set<RouteMeta> routeMetas = groupMap.get(routeMete.getGroup());
if (CollectionUtils.isEmpty(routeMetas)) {
Set<RouteMeta> routeMetaSet = new TreeSet<>(new Comparator<RouteMeta>() {
@Override
public int compare(RouteMeta r1, RouteMeta r2) {
try {
return r1.getPath().compareTo(r2.getPath());
} catch (NullPointerException npe) {
logger.error(npe.getMessage());
return 0;
}
}
});
routeMetaSet.add(routeMete);
groupMap.put(routeMete.getGroup(), routeMetaSet);
} else {
routeMetas.add(routeMete);
}
} else {
logger.warning(">>> Route meta verify error, group is " + routeMete.getGroup() + " <<<");
}
} }
|
public class class_name {
private void categories(RouteMeta routeMete) {
if (routeVerify(routeMete)) {
logger.info(">>> Start categories, group = " + routeMete.getGroup() + ", path = " + routeMete.getPath() + " <<<"); // depends on control dependency: [if], data = [none]
Set<RouteMeta> routeMetas = groupMap.get(routeMete.getGroup());
if (CollectionUtils.isEmpty(routeMetas)) {
Set<RouteMeta> routeMetaSet = new TreeSet<>(new Comparator<RouteMeta>() {
@Override
public int compare(RouteMeta r1, RouteMeta r2) {
try {
return r1.getPath().compareTo(r2.getPath()); // depends on control dependency: [try], data = [none]
} catch (NullPointerException npe) {
logger.error(npe.getMessage());
return 0;
} // depends on control dependency: [catch], data = [none]
}
});
routeMetaSet.add(routeMete); // depends on control dependency: [if], data = [none]
groupMap.put(routeMete.getGroup(), routeMetaSet); // depends on control dependency: [if], data = [none]
} else {
routeMetas.add(routeMete); // depends on control dependency: [if], data = [none]
}
} else {
logger.warning(">>> Route meta verify error, group is " + routeMete.getGroup() + " <<<"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(DescribeClustersRequest describeClustersRequest, ProtocolMarshaller protocolMarshaller) {
if (describeClustersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeClustersRequest.getClusterNames(), CLUSTERNAMES_BINDING);
protocolMarshaller.marshall(describeClustersRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(describeClustersRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeClustersRequest describeClustersRequest, ProtocolMarshaller protocolMarshaller) {
if (describeClustersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeClustersRequest.getClusterNames(), CLUSTERNAMES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeClustersRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeClustersRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
boolean isDoubleAlias(String aliasName) {
CmsSiteMatcher testAlias = new CmsSiteMatcher(aliasName);
int count = 0;
for (Component c : m_aliases) {
if (c instanceof CmsRemovableFormRow<?>) {
String alName = (String)((CmsRemovableFormRow<? extends AbstractField<?>>)c).getInput().getValue();
if (testAlias.equals(new CmsSiteMatcher(alName))) {
count++;
}
}
}
return count > 1;
} }
|
public class class_name {
boolean isDoubleAlias(String aliasName) {
CmsSiteMatcher testAlias = new CmsSiteMatcher(aliasName);
int count = 0;
for (Component c : m_aliases) {
if (c instanceof CmsRemovableFormRow<?>) {
String alName = (String)((CmsRemovableFormRow<? extends AbstractField<?>>)c).getInput().getValue();
if (testAlias.equals(new CmsSiteMatcher(alName))) {
count++; // depends on control dependency: [if], data = [none]
}
}
}
return count > 1;
} }
|
public class class_name {
@Override
public String secureProtocol()
{
SSLSocket sslSocket = _sslSocket;
if (sslSocket == null) {
return super.secureProtocol();
}
SSLSession sslSession = sslSocket.getSession();
if (sslSession != null) {
return sslSession.getProtocol();
}
else {
return null;
}
} }
|
public class class_name {
@Override
public String secureProtocol()
{
SSLSocket sslSocket = _sslSocket;
if (sslSocket == null) {
return super.secureProtocol(); // depends on control dependency: [if], data = [none]
}
SSLSession sslSession = sslSocket.getSession();
if (sslSession != null) {
return sslSession.getProtocol(); // depends on control dependency: [if], data = [none]
}
else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String addScreenParams(BasePanel screen, String strURL)
{
int iNumCols = screen.getSFieldCount();
for (int iIndex = 0; iIndex < iNumCols; iIndex++)
{
ScreenField sField = screen.getSField(iIndex);
boolean bPrintControl = true;
if (sField instanceof BasePanel)
{
strURL = this.addScreenParams((BasePanel)sField, strURL);
bPrintControl = false; // ie., Don't print buttons
}
if (sField.getConverter() == null)
bPrintControl = false;
if (screen == this)
bPrintControl = false; // My children are the report detail (Not params).
if (!sField.isInputField())
bPrintControl = false;
if (!sField.isEnabled())
bPrintControl = false;
if (bPrintControl)
if (sField.getScreenFieldView() != null)
{
String strData = sField.getSFieldValue(false, false); // Match HTML submit (input format/go through converters).
strURL = Utility.addURLParam(strURL, sField.getSFieldParam(null, false), strData); // Don't need outside frame stuff in a window
}
}
return strURL;
} }
|
public class class_name {
public String addScreenParams(BasePanel screen, String strURL)
{
int iNumCols = screen.getSFieldCount();
for (int iIndex = 0; iIndex < iNumCols; iIndex++)
{
ScreenField sField = screen.getSField(iIndex);
boolean bPrintControl = true;
if (sField instanceof BasePanel)
{
strURL = this.addScreenParams((BasePanel)sField, strURL); // depends on control dependency: [if], data = [none]
bPrintControl = false; // ie., Don't print buttons // depends on control dependency: [if], data = [none]
}
if (sField.getConverter() == null)
bPrintControl = false;
if (screen == this)
bPrintControl = false; // My children are the report detail (Not params).
if (!sField.isInputField())
bPrintControl = false;
if (!sField.isEnabled())
bPrintControl = false;
if (bPrintControl)
if (sField.getScreenFieldView() != null)
{
String strData = sField.getSFieldValue(false, false); // Match HTML submit (input format/go through converters).
strURL = Utility.addURLParam(strURL, sField.getSFieldParam(null, false), strData); // Don't need outside frame stuff in a window // depends on control dependency: [if], data = [none]
}
}
return strURL;
} }
|
public class class_name {
public TileResultSet queryByTileGrid(TileGrid tileGrid, long zoomLevel,
String orderBy) {
TileResultSet tileCursor = null;
if (tileGrid != null) {
StringBuilder where = new StringBuilder();
where.append(buildWhere(TileTable.COLUMN_ZOOM_LEVEL, zoomLevel));
where.append(" AND ");
where.append(buildWhere(TileTable.COLUMN_TILE_COLUMN,
tileGrid.getMinX(), ">="));
where.append(" AND ");
where.append(buildWhere(TileTable.COLUMN_TILE_COLUMN,
tileGrid.getMaxX(), "<="));
where.append(" AND ");
where.append(buildWhere(TileTable.COLUMN_TILE_ROW,
tileGrid.getMinY(), ">="));
where.append(" AND ");
where.append(buildWhere(TileTable.COLUMN_TILE_ROW,
tileGrid.getMaxY(), "<="));
String[] whereArgs = buildWhereArgs(new Object[] { zoomLevel,
tileGrid.getMinX(), tileGrid.getMaxX(), tileGrid.getMinY(),
tileGrid.getMaxY() });
tileCursor = query(where.toString(), whereArgs, null, null, orderBy);
}
return tileCursor;
} }
|
public class class_name {
public TileResultSet queryByTileGrid(TileGrid tileGrid, long zoomLevel,
String orderBy) {
TileResultSet tileCursor = null;
if (tileGrid != null) {
StringBuilder where = new StringBuilder();
where.append(buildWhere(TileTable.COLUMN_ZOOM_LEVEL, zoomLevel)); // depends on control dependency: [if], data = [none]
where.append(" AND "); // depends on control dependency: [if], data = [none]
where.append(buildWhere(TileTable.COLUMN_TILE_COLUMN,
tileGrid.getMinX(), ">=")); // depends on control dependency: [if], data = [none]
where.append(" AND "); // depends on control dependency: [if], data = [none]
where.append(buildWhere(TileTable.COLUMN_TILE_COLUMN,
tileGrid.getMaxX(), "<=")); // depends on control dependency: [if], data = [none]
where.append(" AND "); // depends on control dependency: [if], data = [none]
where.append(buildWhere(TileTable.COLUMN_TILE_ROW,
tileGrid.getMinY(), ">=")); // depends on control dependency: [if], data = [none]
where.append(" AND "); // depends on control dependency: [if], data = [none]
where.append(buildWhere(TileTable.COLUMN_TILE_ROW,
tileGrid.getMaxY(), "<=")); // depends on control dependency: [if], data = [none]
String[] whereArgs = buildWhereArgs(new Object[] { zoomLevel,
tileGrid.getMinX(), tileGrid.getMaxX(), tileGrid.getMinY(),
tileGrid.getMaxY() });
tileCursor = query(where.toString(), whereArgs, null, null, orderBy); // depends on control dependency: [if], data = [none]
}
return tileCursor;
} }
|
public class class_name {
@Override
public Object xpathQuery(String xpath, QName type, NamespaceContext nsContext)
{
try {
return super.xpathQuery(xpath, type, nsContext);
} catch (XPathExpressionException e) {
throw wrapExceptionAsRuntimeException(e);
}
} }
|
public class class_name {
@Override
public Object xpathQuery(String xpath, QName type, NamespaceContext nsContext)
{
try {
return super.xpathQuery(xpath, type, nsContext); // depends on control dependency: [try], data = [none]
} catch (XPathExpressionException e) {
throw wrapExceptionAsRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setCellEditorValue(Object value) {
datePicker.clear();
if (value == null) {
return;
}
if (value instanceof LocalDate) {
LocalDate nativeValue = (LocalDate) value;
datePicker.setDate(nativeValue);
} else {
String text = value.toString();
String shorterText = InternalUtilities.safeSubstring(text, 0, 100);
datePicker.setText(shorterText);
}
} }
|
public class class_name {
public void setCellEditorValue(Object value) {
datePicker.clear();
if (value == null) {
return; // depends on control dependency: [if], data = [none]
}
if (value instanceof LocalDate) {
LocalDate nativeValue = (LocalDate) value;
datePicker.setDate(nativeValue); // depends on control dependency: [if], data = [none]
} else {
String text = value.toString();
String shorterText = InternalUtilities.safeSubstring(text, 0, 100);
datePicker.setText(shorterText); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override protected JobSpecSchedule doScheduleJob(JobSpec jobSpec, Runnable jobRunnable) {
// Build a data map that gets passed to the job
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.put(JOB_SPEC_KEY, jobSpec);
jobDataMap.put(JOB_RUNNABLE_KEY, jobRunnable);
// Build a Quartz job
JobDetail job = JobBuilder.newJob(QuartzJob.class)
.withIdentity(jobSpec.getUri().toString())
.withDescription(Strings.nullToEmpty(jobSpec.getDescription()))
.usingJobData(jobDataMap)
.build();
Trigger jobTrigger = createTrigger(job.getKey(), jobSpec);
QuartzJobSchedule jobSchedule = new QuartzJobSchedule(jobSpec, jobRunnable, jobTrigger);
try {
_scheduler.getScheduler().scheduleJob(job, jobTrigger);
getLog().info(String.format("Scheduled job %s next two fire times: %s , %s.", jobSpec, jobTrigger.getNextFireTime(),
jobTrigger.getFireTimeAfter(jobTrigger.getNextFireTime())));
} catch (SchedulerException e) {
throw new RuntimeException("Scheduling failed for " + jobSpec + ":" + e, e);
}
return jobSchedule;
} }
|
public class class_name {
@Override protected JobSpecSchedule doScheduleJob(JobSpec jobSpec, Runnable jobRunnable) {
// Build a data map that gets passed to the job
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.put(JOB_SPEC_KEY, jobSpec);
jobDataMap.put(JOB_RUNNABLE_KEY, jobRunnable);
// Build a Quartz job
JobDetail job = JobBuilder.newJob(QuartzJob.class)
.withIdentity(jobSpec.getUri().toString())
.withDescription(Strings.nullToEmpty(jobSpec.getDescription()))
.usingJobData(jobDataMap)
.build();
Trigger jobTrigger = createTrigger(job.getKey(), jobSpec);
QuartzJobSchedule jobSchedule = new QuartzJobSchedule(jobSpec, jobRunnable, jobTrigger);
try {
_scheduler.getScheduler().scheduleJob(job, jobTrigger); // depends on control dependency: [try], data = [none]
getLog().info(String.format("Scheduled job %s next two fire times: %s , %s.", jobSpec, jobTrigger.getNextFireTime(),
jobTrigger.getFireTimeAfter(jobTrigger.getNextFireTime()))); // depends on control dependency: [try], data = [none]
} catch (SchedulerException e) {
throw new RuntimeException("Scheduling failed for " + jobSpec + ":" + e, e);
} // depends on control dependency: [catch], data = [none]
return jobSchedule;
} }
|
public class class_name {
@Override
public boolean equalsIgnoringTypeParams(final TypeSignature other) {
if (this == other) {
return true;
}
if (!(other instanceof ArrayTypeSignature)) {
return false;
}
final ArrayTypeSignature o = (ArrayTypeSignature) other;
return o.elementTypeSignature.equalsIgnoringTypeParams(this.elementTypeSignature)
&& o.numDims == this.numDims;
} }
|
public class class_name {
@Override
public boolean equalsIgnoringTypeParams(final TypeSignature other) {
if (this == other) {
return true; // depends on control dependency: [if], data = [none]
}
if (!(other instanceof ArrayTypeSignature)) {
return false; // depends on control dependency: [if], data = [none]
}
final ArrayTypeSignature o = (ArrayTypeSignature) other;
return o.elementTypeSignature.equalsIgnoringTypeParams(this.elementTypeSignature)
&& o.numDims == this.numDims;
} }
|
public class class_name {
protected synchronized void refreshServers() {
StringBuilder refreshResult = new StringBuilder();
Set<Server> availableReadServers = new HashSet<>();
Server[] newReadServers;
if (writeServer == null || !writeServer.isAvailable()) {
logger.debug("[refreshServers] write server is null or not available");
for (Server server : SERVERS) {
if (server.isAvailable() && server.isMaster()) {
writeServer = server;
logger.debug("[refreshServers] new writeServer: id = {}, uri = {}", writeServer.getId(), writeServer.getManagementUri());
}
}
if (writeServer == null) {
readServers = new Server[0];
return;
}
}
for (Server server : SERVERS) {
logger.debug("[refreshServers] server: id = {}, isAvailable = {}", server.getId(), server.isAvailable());
if (!server.getId().equals(writeServer.getId()) && server.isAvailable()) {
logger.debug("[refreshServers] add read server");
availableReadServers.add(server);
}
}
if (availableReadServers.size() == 0) {
logger.debug("[refreshServers] available read servers = 0");
newReadServers = new Server[1];
newReadServers[0] = writeServer;
refreshResult
.append("refreshServers: read servers = ")
.append(writeServer.getId())
.append("=>")
.append(writeServer.getManagementUri())
.append(", write servers = ")
.append(writeServer.getId())
.append("=>")
.append(writeServer.getManagementUri());
}
else {
logger.debug("[refreshServers] available read servers = {}", availableReadServers.size());
newReadServers = new Server[availableReadServers.size()];
int i = 0;
refreshResult.append("refreshServers: read servers = [");
for (Server server : availableReadServers) {
newReadServers[i++] = server;
refreshResult
.append(server.getId())
.append("=>")
.append(server.getManagementUri())
.append(" ");
}
refreshResult
.append(", write servers = ")
.append(writeServer.getId())
.append("=>")
.append(writeServer.getManagementUri())
.append("]");
}
readServers = newReadServers;
logger.debug("[refreshServers] {}", refreshResult.toString());
} }
|
public class class_name {
protected synchronized void refreshServers() {
StringBuilder refreshResult = new StringBuilder();
Set<Server> availableReadServers = new HashSet<>();
Server[] newReadServers;
if (writeServer == null || !writeServer.isAvailable()) {
logger.debug("[refreshServers] write server is null or not available"); // depends on control dependency: [if], data = [none]
for (Server server : SERVERS) {
if (server.isAvailable() && server.isMaster()) {
writeServer = server; // depends on control dependency: [if], data = [none]
logger.debug("[refreshServers] new writeServer: id = {}, uri = {}", writeServer.getId(), writeServer.getManagementUri()); // depends on control dependency: [if], data = [none]
}
}
if (writeServer == null) {
readServers = new Server[0]; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
for (Server server : SERVERS) {
logger.debug("[refreshServers] server: id = {}, isAvailable = {}", server.getId(), server.isAvailable()); // depends on control dependency: [for], data = [server]
if (!server.getId().equals(writeServer.getId()) && server.isAvailable()) {
logger.debug("[refreshServers] add read server"); // depends on control dependency: [if], data = [none]
availableReadServers.add(server); // depends on control dependency: [if], data = [none]
}
}
if (availableReadServers.size() == 0) {
logger.debug("[refreshServers] available read servers = 0"); // depends on control dependency: [if], data = [none]
newReadServers = new Server[1]; // depends on control dependency: [if], data = [none]
newReadServers[0] = writeServer; // depends on control dependency: [if], data = [none]
refreshResult
.append("refreshServers: read servers = ")
.append(writeServer.getId())
.append("=>")
.append(writeServer.getManagementUri())
.append(", write servers = ")
.append(writeServer.getId())
.append("=>")
.append(writeServer.getManagementUri()); // depends on control dependency: [if], data = [none]
}
else {
logger.debug("[refreshServers] available read servers = {}", availableReadServers.size()); // depends on control dependency: [if], data = [none]
newReadServers = new Server[availableReadServers.size()]; // depends on control dependency: [if], data = [none]
int i = 0;
refreshResult.append("refreshServers: read servers = ["); // depends on control dependency: [if], data = [none]
for (Server server : availableReadServers) {
newReadServers[i++] = server; // depends on control dependency: [for], data = [server]
refreshResult
.append(server.getId())
.append("=>")
.append(server.getManagementUri())
.append(" "); // depends on control dependency: [for], data = [none]
}
refreshResult
.append(", write servers = ")
.append(writeServer.getId())
.append("=>")
.append(writeServer.getManagementUri())
.append("]"); // depends on control dependency: [if], data = [none]
}
readServers = newReadServers;
logger.debug("[refreshServers] {}", refreshResult.toString());
} }
|
public class class_name {
public void stop() {
if (!this.isActive) {
return;
}
cpuThread.shutdown();
try {
Thread.sleep(40);
} catch (InterruptedException e) {
}
for (int i = 0; i < taskQueues.length; i++)
taskQueues[i].clear();
heartBeatQueue.clear();
} }
|
public class class_name {
public void stop() {
if (!this.isActive) {
return; // depends on control dependency: [if], data = [none]
}
cpuThread.shutdown();
try {
Thread.sleep(40); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
} // depends on control dependency: [catch], data = [none]
for (int i = 0; i < taskQueues.length; i++)
taskQueues[i].clear();
heartBeatQueue.clear();
} }
|
public class class_name {
public Backbone compute(final Collection<Variable> variables, final BackboneType type) {
final boolean sat = solve(null) == Tristate.TRUE;
Backbone backbone = null;
if (sat) {
final List<Integer> relevantVarIndices = getRelevantVarIndices(variables);
init(relevantVarIndices, type);
compute(relevantVarIndices);
backbone = buildBackbone(variables);
}
return backbone;
} }
|
public class class_name {
public Backbone compute(final Collection<Variable> variables, final BackboneType type) {
final boolean sat = solve(null) == Tristate.TRUE;
Backbone backbone = null;
if (sat) {
final List<Integer> relevantVarIndices = getRelevantVarIndices(variables);
init(relevantVarIndices, type); // depends on control dependency: [if], data = [none]
compute(relevantVarIndices); // depends on control dependency: [if], data = [none]
backbone = buildBackbone(variables); // depends on control dependency: [if], data = [none]
}
return backbone;
} }
|
public class class_name {
@SuppressWarnings( "rawtypes" )
@Override
public ManagedConnection matchManagedConnections( Set connectionSet,
Subject subject,
ConnectionRequestInfo cxRequestInfo ) throws ResourceException {
for (Object connection : connectionSet) {
if (connection instanceof JcrManagedConnection) {
JcrManagedConnection mc = (JcrManagedConnection)connection;
if (equals(mc.getManagedConnectionFactory())) {
JcrConnectionRequestInfo otherCri = mc.getConnectionRequestInfo();
if (cxRequestInfo == otherCri || (cxRequestInfo != null && cxRequestInfo.equals(otherCri))) {
return mc;
}
}
}
}
return null;
} }
|
public class class_name {
@SuppressWarnings( "rawtypes" )
@Override
public ManagedConnection matchManagedConnections( Set connectionSet,
Subject subject,
ConnectionRequestInfo cxRequestInfo ) throws ResourceException {
for (Object connection : connectionSet) {
if (connection instanceof JcrManagedConnection) {
JcrManagedConnection mc = (JcrManagedConnection)connection;
if (equals(mc.getManagedConnectionFactory())) {
JcrConnectionRequestInfo otherCri = mc.getConnectionRequestInfo();
if (cxRequestInfo == otherCri || (cxRequestInfo != null && cxRequestInfo.equals(otherCri))) {
return mc; // depends on control dependency: [if], data = [none]
}
}
}
}
return null;
} }
|
public class class_name {
public MaterialSection getSectionByTitle(String title) {
for(MaterialSection section : sectionList) {
if(section.getTitle().equals(title)) {
return section;
}
}
for(MaterialSection section : bottomSectionList) {
if(section.getTitle().equals(title))
return section;
}
return null;
} }
|
public class class_name {
public MaterialSection getSectionByTitle(String title) {
for(MaterialSection section : sectionList) {
if(section.getTitle().equals(title)) {
return section; // depends on control dependency: [if], data = [none]
}
}
for(MaterialSection section : bottomSectionList) {
if(section.getTitle().equals(title))
return section;
}
return null;
} }
|
public class class_name {
@Override
public VoidMessage takeMessage() {
if (threadingModel != ThreadingModel.SAME_THREAD) {
try {
return messages.take();
} catch (InterruptedException e) {
// probably we don't want to do anything here
return null;
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
/**
* PLEASE NOTE: This branch is suitable for debugging only, should never be used in wild life
*/
// we do inplace poll
if (subscriptionForShards != null)
subscriptionForShards.poll(messageHandlerForShards, 512);
subscriptionForClients.poll(messageHandlerForClients, 512);
return messages.poll();
}
} }
|
public class class_name {
@Override
public VoidMessage takeMessage() {
if (threadingModel != ThreadingModel.SAME_THREAD) {
try {
return messages.take(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
// probably we don't want to do anything here
return null;
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} else {
/**
* PLEASE NOTE: This branch is suitable for debugging only, should never be used in wild life
*/
// we do inplace poll
if (subscriptionForShards != null)
subscriptionForShards.poll(messageHandlerForShards, 512);
subscriptionForClients.poll(messageHandlerForClients, 512); // depends on control dependency: [if], data = [none]
return messages.poll(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected static URL getContributorURL(Contributor contributor, Log log) {
URL url = null;
if (contributor != null) {
String rawUrl = contributor.getUrl();
if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
try {
url = new URL(rawUrl);
} catch (Throwable exception) {
url = null;
}
}
if (url == null) {
rawUrl = contributor.getEmail();
if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
try {
url = new URL("mailto:" + rawUrl); //$NON-NLS-1$
} catch (Throwable exception) {
url = null;
}
}
}
}
return url;
} }
|
public class class_name {
protected static URL getContributorURL(Contributor contributor, Log log) {
URL url = null;
if (contributor != null) {
String rawUrl = contributor.getUrl();
if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
try {
url = new URL(rawUrl); // depends on control dependency: [try], data = [none]
} catch (Throwable exception) {
url = null;
} // depends on control dependency: [catch], data = [none]
}
if (url == null) {
rawUrl = contributor.getEmail(); // depends on control dependency: [if], data = [none]
if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
try {
url = new URL("mailto:" + rawUrl); //$NON-NLS-1$ // depends on control dependency: [try], data = [none]
} catch (Throwable exception) {
url = null;
} // depends on control dependency: [catch], data = [none]
}
}
}
return url;
} }
|
public class class_name {
protected void handleOutParams(List<Param> paramList, final CallableStatement cs, Object parameter,
boolean functionCall) {
if (parameter == null){
return;
}
try {
final int start = functionCall ? 1 : 0;
for (int i = start; i < paramList.size(); i++) {
final Param param = paramList.get(i);
if (param.paramType == ParameterType.IN) {
continue;
}
PropertyDesc pd = param.propertyDesc;
@SuppressWarnings("unchecked")
Object value = param.valueType.get(param.paramClass, cs, i + 1);
if (value instanceof ResultSet) {
value = handleResultSet(pd, (ResultSet) value);
}
pd.setValue(parameter, value);
}
} catch (final SQLException e) {
throw new SQLRuntimeException(e);
}
} }
|
public class class_name {
protected void handleOutParams(List<Param> paramList, final CallableStatement cs, Object parameter,
boolean functionCall) {
if (parameter == null){
return;
// depends on control dependency: [if], data = [none]
}
try {
final int start = functionCall ? 1 : 0;
for (int i = start; i < paramList.size(); i++) {
final Param param = paramList.get(i);
if (param.paramType == ParameterType.IN) {
continue;
}
PropertyDesc pd = param.propertyDesc;
@SuppressWarnings("unchecked")
Object value = param.valueType.get(param.paramClass, cs, i + 1);
if (value instanceof ResultSet) {
value = handleResultSet(pd, (ResultSet) value);
// depends on control dependency: [if], data = [none]
}
pd.setValue(parameter, value);
// depends on control dependency: [for], data = [none]
}
} catch (final SQLException e) {
throw new SQLRuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void handleEvent(final MasqueradeEvent b)
{
if (this.isConnectedToSelf(b.getClone()))
{
// At this point we will actually have two CallTrackers
// which we now need to merge into a single CallTracker.
CallTracker original = findCall(b.getOriginal());
CallTracker clone = findCall(b.getClone());
if (original != null && clone != null)
{
clone.mergeCalls(original);
clone.setState(b.getCloneState());
this.evaluateState();
}
else
logger.warn("When processing masquradeEvent we could not find the expected calls. event=" //$NON-NLS-1$
+ b.toString() + " original=" + original + " clone=" + clone); //$NON-NLS-1$ //$NON-NLS-2$
}
} }
|
public class class_name {
public void handleEvent(final MasqueradeEvent b)
{
if (this.isConnectedToSelf(b.getClone()))
{
// At this point we will actually have two CallTrackers
// which we now need to merge into a single CallTracker.
CallTracker original = findCall(b.getOriginal());
CallTracker clone = findCall(b.getClone());
if (original != null && clone != null)
{
clone.mergeCalls(original);
// depends on control dependency: [if], data = [(original]
clone.setState(b.getCloneState());
// depends on control dependency: [if], data = [none]
this.evaluateState();
// depends on control dependency: [if], data = [none]
}
else
logger.warn("When processing masquradeEvent we could not find the expected calls. event=" //$NON-NLS-1$
+ b.toString() + " original=" + original + " clone=" + clone); //$NON-NLS-1$ //$NON-NLS-2$
}
} }
|
public class class_name {
@Override
public void makeBuildVariables(AbstractBuild build, Map<String, String> variables) {
// global var/password pairs
MaskPasswordsConfig config = MaskPasswordsConfig.getInstance();
List<VarPasswordPair> globalVarPasswordPairs = config.getGlobalVarPasswordPairs();
// we can't use variables.putAll() since passwords are ciphered when in varPasswordPairs
for(VarPasswordPair globalVarPasswordPair: globalVarPasswordPairs) {
variables.put(globalVarPasswordPair.getVar(), globalVarPasswordPair.getPassword());
}
// job's var/password pairs
if(varPasswordPairs != null) {
// cf. comment above
for(VarPasswordPair varPasswordPair: varPasswordPairs) {
if(StringUtils.isNotBlank(varPasswordPair.getVar())) {
variables.put(varPasswordPair.getVar(), varPasswordPair.getPassword());
}
}
}
} }
|
public class class_name {
@Override
public void makeBuildVariables(AbstractBuild build, Map<String, String> variables) {
// global var/password pairs
MaskPasswordsConfig config = MaskPasswordsConfig.getInstance();
List<VarPasswordPair> globalVarPasswordPairs = config.getGlobalVarPasswordPairs();
// we can't use variables.putAll() since passwords are ciphered when in varPasswordPairs
for(VarPasswordPair globalVarPasswordPair: globalVarPasswordPairs) {
variables.put(globalVarPasswordPair.getVar(), globalVarPasswordPair.getPassword());
// depends on control dependency: [for], data = [globalVarPasswordPair]
}
// job's var/password pairs
if(varPasswordPairs != null) {
// cf. comment above
for(VarPasswordPair varPasswordPair: varPasswordPairs) {
if(StringUtils.isNotBlank(varPasswordPair.getVar())) {
variables.put(varPasswordPair.getVar(), varPasswordPair.getPassword());
// depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
@Nullable
private KeyType isKeyAccessMethod(int seen) {
if (seen == Const.INVOKEINTERFACE) {
String clsName = getClassConstantOperand();
if (HTTP_SESSION.equals(clsName)) {
String methodName = getNameConstantOperand();
if (GET_ATTRIBUTE.equals(methodName)) {
String signature = getSigConstantOperand();
return (GET_ATTRIBUTE_SIG.equals(signature)) ? KeyType.ATTRIBUTE : null;
} else if (SET_ATTRIBUTE.equals(methodName)) {
String signature = getSigConstantOperand();
return (SET_ATTRIBUTE_SIG.equals(signature)) ? KeyType.ATTRIBUTE : null;
}
} else if (HTTP_SERVLET_REQUEST.equals(clsName)) {
String methodName = getNameConstantOperand();
if (GET_PARAMETER.equals(methodName)) {
String signature = getSigConstantOperand();
return (GET_PARAMETER_SIG.equals(signature)) ? KeyType.PARAMETER : null;
}
}
}
return null;
} }
|
public class class_name {
@Nullable
private KeyType isKeyAccessMethod(int seen) {
if (seen == Const.INVOKEINTERFACE) {
String clsName = getClassConstantOperand();
if (HTTP_SESSION.equals(clsName)) {
String methodName = getNameConstantOperand();
if (GET_ATTRIBUTE.equals(methodName)) {
String signature = getSigConstantOperand();
return (GET_ATTRIBUTE_SIG.equals(signature)) ? KeyType.ATTRIBUTE : null; // depends on control dependency: [if], data = [none]
} else if (SET_ATTRIBUTE.equals(methodName)) {
String signature = getSigConstantOperand();
return (SET_ATTRIBUTE_SIG.equals(signature)) ? KeyType.ATTRIBUTE : null; // depends on control dependency: [if], data = [none]
}
} else if (HTTP_SERVLET_REQUEST.equals(clsName)) {
String methodName = getNameConstantOperand();
if (GET_PARAMETER.equals(methodName)) {
String signature = getSigConstantOperand();
return (GET_PARAMETER_SIG.equals(signature)) ? KeyType.PARAMETER : null; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
public static void verifyChain(List<X509Certificate> chain)
{
if (chain == null || chain.isEmpty())
throw new IllegalArgumentException("Must provide a chain that is non-null and non-empty");
for (int i = 0; i < chain.size(); i++)
{
final X509Certificate certificate = chain.get(i);
final int issuerIndex = (i != 0) ?
i - 1 :
0; // The index of the issuer is the previous cert (& the root must, of course, sign itself)
final X509Certificate issuer = chain.get(issuerIndex);
// Verify the certificate was indeed issued by the previous certificate in the chain
try
{
certificate.verify(issuer.getPublicKey());
}
catch (GeneralSecurityException e)
{
final String msg = "Failure verifying " + certificate + " against claimed issuer " + issuer;
throw new IllegalArgumentException(msg + ": " + e.getMessage(), e);
}
}
} }
|
public class class_name {
public static void verifyChain(List<X509Certificate> chain)
{
if (chain == null || chain.isEmpty())
throw new IllegalArgumentException("Must provide a chain that is non-null and non-empty");
for (int i = 0; i < chain.size(); i++)
{
final X509Certificate certificate = chain.get(i);
final int issuerIndex = (i != 0) ?
i - 1 :
0; // The index of the issuer is the previous cert (& the root must, of course, sign itself)
final X509Certificate issuer = chain.get(issuerIndex);
// Verify the certificate was indeed issued by the previous certificate in the chain
try
{
certificate.verify(issuer.getPublicKey()); // depends on control dependency: [try], data = [none]
}
catch (GeneralSecurityException e)
{
final String msg = "Failure verifying " + certificate + " against claimed issuer " + issuer;
throw new IllegalArgumentException(msg + ": " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public AwsSecurityFindingFilters withResourceDetailsOther(MapFilter... resourceDetailsOther) {
if (this.resourceDetailsOther == null) {
setResourceDetailsOther(new java.util.ArrayList<MapFilter>(resourceDetailsOther.length));
}
for (MapFilter ele : resourceDetailsOther) {
this.resourceDetailsOther.add(ele);
}
return this;
} }
|
public class class_name {
public AwsSecurityFindingFilters withResourceDetailsOther(MapFilter... resourceDetailsOther) {
if (this.resourceDetailsOther == null) {
setResourceDetailsOther(new java.util.ArrayList<MapFilter>(resourceDetailsOther.length)); // depends on control dependency: [if], data = [none]
}
for (MapFilter ele : resourceDetailsOther) {
this.resourceDetailsOther.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public final void splitTo(AbstractNode<E> newNode, List<E> sorting, int splitPoint) {
assert (isLeaf() == newNode.isLeaf());
deleteAllEntries();
StringBuilder msg = LoggingConfiguration.DEBUG ? new StringBuilder(1000) : null;
for(int i = 0; i < splitPoint; i++) {
addEntry(sorting.get(i));
if(msg != null) {
msg.append("n_").append(getPageID()).append(' ').append(sorting.get(i)).append('\n');
}
}
for(int i = splitPoint; i < sorting.size(); i++) {
newNode.addEntry(sorting.get(i));
if(msg != null) {
msg.append("n_").append(newNode.getPageID()).append(' ').append(sorting.get(i)).append('\n');
}
}
if(msg != null) {
Logging.getLogger(this.getClass().getName()).fine(msg.toString());
}
} }
|
public class class_name {
public final void splitTo(AbstractNode<E> newNode, List<E> sorting, int splitPoint) {
assert (isLeaf() == newNode.isLeaf());
deleteAllEntries();
StringBuilder msg = LoggingConfiguration.DEBUG ? new StringBuilder(1000) : null;
for(int i = 0; i < splitPoint; i++) {
addEntry(sorting.get(i)); // depends on control dependency: [for], data = [i]
if(msg != null) {
msg.append("n_").append(getPageID()).append(' ').append(sorting.get(i)).append('\n'); // depends on control dependency: [if], data = [none]
}
}
for(int i = splitPoint; i < sorting.size(); i++) {
newNode.addEntry(sorting.get(i)); // depends on control dependency: [for], data = [i]
if(msg != null) {
msg.append("n_").append(newNode.getPageID()).append(' ').append(sorting.get(i)).append('\n'); // depends on control dependency: [if], data = [none]
}
}
if(msg != null) {
Logging.getLogger(this.getClass().getName()).fine(msg.toString()); // depends on control dependency: [if], data = [(msg]
}
} }
|
public class class_name {
public void setDefault(final UUID _selectCmdUUID)
{
final UIMenuItem menuItem = getProvider().getRoots().next();
menuItem.setHeader(true);
boolean hasDefault = false;
for (final UIMenuItem childItem : menuItem.getChildren()) {
if (_selectCmdUUID == null && childItem.isDefaultSelected()
|| _selectCmdUUID != null && _selectCmdUUID.equals(childItem.getCommandUUID())) {
hasDefault = true;
childItem.setSelected(true);
}
}
if (!hasDefault) {
menuItem.setSelected(true);
}
expand(menuItem);
expandChildren(menuItem);
} }
|
public class class_name {
public void setDefault(final UUID _selectCmdUUID)
{
final UIMenuItem menuItem = getProvider().getRoots().next();
menuItem.setHeader(true);
boolean hasDefault = false;
for (final UIMenuItem childItem : menuItem.getChildren()) {
if (_selectCmdUUID == null && childItem.isDefaultSelected()
|| _selectCmdUUID != null && _selectCmdUUID.equals(childItem.getCommandUUID())) {
hasDefault = true; // depends on control dependency: [if], data = [none]
childItem.setSelected(true); // depends on control dependency: [if], data = [none]
}
}
if (!hasDefault) {
menuItem.setSelected(true); // depends on control dependency: [if], data = [none]
}
expand(menuItem);
expandChildren(menuItem);
} }
|
public class class_name {
static public PropertyDescriptor[] getPropertyDescriptors(Class<?> clazz) {
final String SETTER_PREFIX = "set";
final String GETTER_PREFIX = "get";
final int LEN_PREFIX = SETTER_PREFIX.length();
Map<String, PropertyDescriptor> map = new HashMap<String, PropertyDescriptor>();
for (Method m : clazz.getMethods()) {
PropertyDescriptor pd = null;
String mName = m.getName();
boolean isGet = mName.startsWith(GETTER_PREFIX) && (mName.length() > LEN_PREFIX);
boolean isSet = mName.startsWith(SETTER_PREFIX) && (mName.length() > LEN_PREFIX);
if (isGet || isSet) {
String propName = decapitalize(mName.substring(LEN_PREFIX));
pd = map.get(propName);
if (pd == null) {
pd = new PropertyDescriptor(propName);
map.put(propName, pd);
}
Class<?>[] parmTypes = m.getParameterTypes();
if (isSet) {
if (parmTypes.length == 1) { // we only want the single-parm setter
pd.setWriteMethod(m);
pd.setPropertyType(parmTypes[0]);
}
} else if (isGet) {
if (parmTypes.length == 0) { // we only want the zero-parm getter
pd.setReadMethod(m);
// let setter's type take priority
if (pd.getPropertyType() == null) {
pd.setPropertyType(m.getReturnType());
}
}
}
}
}
return map.values().toArray(new PropertyDescriptor[0]);
} }
|
public class class_name {
static public PropertyDescriptor[] getPropertyDescriptors(Class<?> clazz) {
final String SETTER_PREFIX = "set";
final String GETTER_PREFIX = "get";
final int LEN_PREFIX = SETTER_PREFIX.length();
Map<String, PropertyDescriptor> map = new HashMap<String, PropertyDescriptor>();
for (Method m : clazz.getMethods()) {
PropertyDescriptor pd = null;
String mName = m.getName();
boolean isGet = mName.startsWith(GETTER_PREFIX) && (mName.length() > LEN_PREFIX);
boolean isSet = mName.startsWith(SETTER_PREFIX) && (mName.length() > LEN_PREFIX);
if (isGet || isSet) {
String propName = decapitalize(mName.substring(LEN_PREFIX));
pd = map.get(propName); // depends on control dependency: [if], data = [none]
if (pd == null) {
pd = new PropertyDescriptor(propName); // depends on control dependency: [if], data = [none]
map.put(propName, pd); // depends on control dependency: [if], data = [none]
}
Class<?>[] parmTypes = m.getParameterTypes();
if (isSet) {
if (parmTypes.length == 1) { // we only want the single-parm setter
pd.setWriteMethod(m); // depends on control dependency: [if], data = [none]
pd.setPropertyType(parmTypes[0]); // depends on control dependency: [if], data = [none]
}
} else if (isGet) {
if (parmTypes.length == 0) { // we only want the zero-parm getter
pd.setReadMethod(m); // depends on control dependency: [if], data = [none]
// let setter's type take priority
if (pd.getPropertyType() == null) {
pd.setPropertyType(m.getReturnType()); // depends on control dependency: [if], data = [none]
}
}
}
}
}
return map.values().toArray(new PropertyDescriptor[0]);
} }
|
public class class_name {
public String generateDigest(InputStream stream) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance(DIGEST_ALGORITHM_SHA1);
} catch (NoSuchAlgorithmException ae) {
throw new BoxAPIException("Digest algorithm not found", ae);
}
//Calcuate the digest using the stream.
DigestInputStream dis = new DigestInputStream(stream, digest);
try {
int value = dis.read();
while (value != -1) {
value = dis.read();
}
} catch (IOException ioe) {
throw new BoxAPIException("Reading the stream failed.", ioe);
}
//Get the calculated digest for the stream
byte[] digestBytes = digest.digest();
return Base64.encode(digestBytes);
} }
|
public class class_name {
public String generateDigest(InputStream stream) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance(DIGEST_ALGORITHM_SHA1); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException ae) {
throw new BoxAPIException("Digest algorithm not found", ae);
} // depends on control dependency: [catch], data = [none]
//Calcuate the digest using the stream.
DigestInputStream dis = new DigestInputStream(stream, digest);
try {
int value = dis.read();
while (value != -1) {
value = dis.read(); // depends on control dependency: [while], data = [none]
}
} catch (IOException ioe) {
throw new BoxAPIException("Reading the stream failed.", ioe);
} // depends on control dependency: [catch], data = [none]
//Get the calculated digest for the stream
byte[] digestBytes = digest.digest();
return Base64.encode(digestBytes);
} }
|
public class class_name {
protected QName toQName(String namespaceUri, String qualifiedName) {
int idx = qualifiedName.indexOf(':');
if (idx == -1) {
return new QName(namespaceUri, qualifiedName);
} else {
String prefix = qualifiedName.substring(0, idx);
String localPart = qualifiedName.substring(idx + 1);
return new QName(namespaceUri, localPart, prefix);
}
} }
|
public class class_name {
protected QName toQName(String namespaceUri, String qualifiedName) {
int idx = qualifiedName.indexOf(':');
if (idx == -1) {
return new QName(namespaceUri, qualifiedName); // depends on control dependency: [if], data = [none]
} else {
String prefix = qualifiedName.substring(0, idx);
String localPart = qualifiedName.substring(idx + 1);
return new QName(namespaceUri, localPart, prefix); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void modifyRequest(ResponseBuilder rb, SearchComponent who,
ShardRequest sreq) {
if ((sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) != 0) {
// do nothing
} else {
// remove stats for other requests
sreq.params.remove(PARAM_MTAS_STATS);
sreq.params.remove(PARAM_MTAS_STATS_POSITIONS);
Set<String> keys = MtasSolrResultUtil
.getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_STATS_POSITIONS);
for (String key : keys) {
sreq.params.remove(
PARAM_MTAS_STATS + "." + key + "." + NAME_MTAS_STATS_POSITIONS_KEY);
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_POSITIONS_FIELD);
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_POSITIONS_TYPE);
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_POSITIONS_MAXIMUM);
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_POSITIONS_MINIMUM);
}
sreq.params.remove(PARAM_MTAS_STATS_TOKENS);
keys = MtasSolrResultUtil.getIdsFromParameters(rb.req.getParams(),
PARAM_MTAS_STATS_TOKENS);
for (String key : keys) {
sreq.params.remove(
PARAM_MTAS_STATS + "." + key + "." + NAME_MTAS_STATS_TOKENS_KEY);
sreq.params.remove(
PARAM_MTAS_STATS + "." + key + "." + NAME_MTAS_STATS_TOKENS_FIELD);
sreq.params.remove(
PARAM_MTAS_STATS + "." + key + "." + NAME_MTAS_STATS_TOKENS_TYPE);
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_TOKENS_MAXIMUM);
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_TOKENS_MINIMUM);
}
sreq.params.remove(PARAM_MTAS_STATS_SPANS);
keys = MtasSolrResultUtil.getIdsFromParameters(rb.req.getParams(),
PARAM_MTAS_STATS_SPANS);
for (String key : keys) {
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_KEY);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_FIELD);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_TYPE);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_MAXIMUM);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_MINIMUM);
Set<String> subKeys = MtasSolrResultUtil
.getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_STATS_SPANS
+ "." + key + "." + NAME_MTAS_STATS_SPANS_FUNCTION);
for (String subKey : subKeys) {
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_FUNCTION + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_FUNCTION_EXPRESSION);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_FUNCTION + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_FUNCTION_KEY);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_FUNCTION + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_FUNCTION_TYPE);
}
subKeys = MtasSolrResultUtil.getIdsFromParameters(rb.req.getParams(),
PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY);
for (String subKey : subKeys) {
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_IGNORE);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_MAXIMUM_IGNORE_LENGTH);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_PREFIX);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_TYPE);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_VALUE);
Set<String> subSubKeys = MtasSolrResultUtil.getIdsFromParameters(
rb.req.getParams(),
PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_VARIABLE);
for (String subSubKey : subSubKeys) {
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_VARIABLE + "." + subSubKey
+ "." + SUBNAME_MTAS_STATS_SPANS_QUERY_VARIABLE_NAME);
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_VARIABLE + "." + subSubKey
+ "." + SUBNAME_MTAS_STATS_SPANS_QUERY_VARIABLE_VALUE);
}
}
}
}
} }
|
public class class_name {
public void modifyRequest(ResponseBuilder rb, SearchComponent who,
ShardRequest sreq) {
if ((sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) != 0) {
// do nothing
} else {
// remove stats for other requests
sreq.params.remove(PARAM_MTAS_STATS); // depends on control dependency: [if], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_POSITIONS); // depends on control dependency: [if], data = [none]
Set<String> keys = MtasSolrResultUtil
.getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_STATS_POSITIONS);
for (String key : keys) {
sreq.params.remove(
PARAM_MTAS_STATS + "." + key + "." + NAME_MTAS_STATS_POSITIONS_KEY); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_POSITIONS_FIELD); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_POSITIONS_TYPE); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_POSITIONS_MAXIMUM); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_POSITIONS_MINIMUM); // depends on control dependency: [for], data = [none]
}
sreq.params.remove(PARAM_MTAS_STATS_TOKENS); // depends on control dependency: [if], data = [none]
keys = MtasSolrResultUtil.getIdsFromParameters(rb.req.getParams(),
PARAM_MTAS_STATS_TOKENS); // depends on control dependency: [if], data = [none]
for (String key : keys) {
sreq.params.remove(
PARAM_MTAS_STATS + "." + key + "." + NAME_MTAS_STATS_TOKENS_KEY); // depends on control dependency: [for], data = [none]
sreq.params.remove(
PARAM_MTAS_STATS + "." + key + "." + NAME_MTAS_STATS_TOKENS_FIELD); // depends on control dependency: [for], data = [none]
sreq.params.remove(
PARAM_MTAS_STATS + "." + key + "." + NAME_MTAS_STATS_TOKENS_TYPE); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_TOKENS_MAXIMUM); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS + "." + key + "."
+ NAME_MTAS_STATS_TOKENS_MINIMUM); // depends on control dependency: [for], data = [none]
}
sreq.params.remove(PARAM_MTAS_STATS_SPANS); // depends on control dependency: [if], data = [none]
keys = MtasSolrResultUtil.getIdsFromParameters(rb.req.getParams(),
PARAM_MTAS_STATS_SPANS); // depends on control dependency: [if], data = [none]
for (String key : keys) {
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_KEY); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_FIELD); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_TYPE); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_MAXIMUM); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_MINIMUM); // depends on control dependency: [for], data = [none]
Set<String> subKeys = MtasSolrResultUtil
.getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_STATS_SPANS
+ "." + key + "." + NAME_MTAS_STATS_SPANS_FUNCTION);
for (String subKey : subKeys) {
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_FUNCTION + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_FUNCTION_EXPRESSION); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_FUNCTION + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_FUNCTION_KEY); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_FUNCTION + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_FUNCTION_TYPE); // depends on control dependency: [for], data = [none]
}
subKeys = MtasSolrResultUtil.getIdsFromParameters(rb.req.getParams(),
PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY); // depends on control dependency: [for], data = [none]
for (String subKey : subKeys) {
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_IGNORE); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_MAXIMUM_IGNORE_LENGTH); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_PREFIX); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_TYPE); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_VALUE); // depends on control dependency: [for], data = [none]
Set<String> subSubKeys = MtasSolrResultUtil.getIdsFromParameters(
rb.req.getParams(),
PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_VARIABLE);
for (String subSubKey : subSubKeys) {
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_VARIABLE + "." + subSubKey
+ "." + SUBNAME_MTAS_STATS_SPANS_QUERY_VARIABLE_NAME); // depends on control dependency: [for], data = [none]
sreq.params.remove(PARAM_MTAS_STATS_SPANS + "." + key + "."
+ NAME_MTAS_STATS_SPANS_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_STATS_SPANS_QUERY_VARIABLE + "." + subSubKey
+ "." + SUBNAME_MTAS_STATS_SPANS_QUERY_VARIABLE_VALUE); // depends on control dependency: [for], data = [none]
}
}
}
}
} }
|
public class class_name {
public static String escapeForXML(final String content) {
if (content == null) return "";
/*
* Note: The following characters should be escaped: & < > " '
*
* However, all but ampersand pose issues when other elements are included in the title.
*
* eg <title>Product A > Product B<phrase condition="beta">-Beta</phrase></title>
*
* should become
*
* <title>Product A > Product B<phrase condition="beta">-Beta</phrase></title>
*/
String fixedContent = XMLUtilities.STANDALONE_AMPERSAND_PATTERN.matcher(content).replaceAll("&");
// Loop over and find all the XML Elements as they should remain untouched.
final LinkedList<String> elements = new LinkedList<String>();
if (fixedContent.indexOf('<') != -1) {
int index = -1;
while ((index = fixedContent.indexOf('<', index + 1)) != -1) {
int endIndex = fixedContent.indexOf('>', index);
int nextIndex = fixedContent.indexOf('<', index + 1);
/*
* If the next opening tag is less than the next ending tag, than the current opening tag isn't a match for the next
* ending tag, so continue to the next one
*/
if (endIndex == -1 || (nextIndex != -1 && nextIndex < endIndex)) {
continue;
} else if (index + 1 == endIndex) {
// This is a <> sequence, so it should be ignored as well.
continue;
} else {
elements.add(fixedContent.substring(index, endIndex + 1));
}
}
}
// Find all the elements and replace them with a marker
String escapedTitle = fixedContent;
for (int count = 0; count < elements.size(); count++) {
escapedTitle = escapedTitle.replace(elements.get(count), "###" + count + "###");
}
// Perform the replacements on what's left
escapedTitle = escapedTitle.replace("<", "<").replace(">", ">").replace("\"", """);
// Replace the markers
for (int count = 0; count < elements.size(); count++) {
escapedTitle = escapedTitle.replace("###" + count + "###", elements.get(count));
}
return escapedTitle;
} }
|
public class class_name {
public static String escapeForXML(final String content) {
if (content == null) return "";
/*
* Note: The following characters should be escaped: & < > " '
*
* However, all but ampersand pose issues when other elements are included in the title.
*
* eg <title>Product A > Product B<phrase condition="beta">-Beta</phrase></title>
*
* should become
*
* <title>Product A > Product B<phrase condition="beta">-Beta</phrase></title>
*/
String fixedContent = XMLUtilities.STANDALONE_AMPERSAND_PATTERN.matcher(content).replaceAll("&");
// Loop over and find all the XML Elements as they should remain untouched.
final LinkedList<String> elements = new LinkedList<String>();
if (fixedContent.indexOf('<') != -1) {
int index = -1;
while ((index = fixedContent.indexOf('<', index + 1)) != -1) {
int endIndex = fixedContent.indexOf('>', index);
int nextIndex = fixedContent.indexOf('<', index + 1);
/*
* If the next opening tag is less than the next ending tag, than the current opening tag isn't a match for the next
* ending tag, so continue to the next one
*/
if (endIndex == -1 || (nextIndex != -1 && nextIndex < endIndex)) {
continue;
} else if (index + 1 == endIndex) {
// This is a <> sequence, so it should be ignored as well.
continue;
} else {
elements.add(fixedContent.substring(index, endIndex + 1)); // depends on control dependency: [if], data = [none]
}
}
}
// Find all the elements and replace them with a marker
String escapedTitle = fixedContent;
for (int count = 0; count < elements.size(); count++) {
escapedTitle = escapedTitle.replace(elements.get(count), "###" + count + "###"); // depends on control dependency: [for], data = [count]
}
// Perform the replacements on what's left
escapedTitle = escapedTitle.replace("<", "<").replace(">", ">").replace("\"", """);
// Replace the markers
for (int count = 0; count < elements.size(); count++) {
escapedTitle = escapedTitle.replace("###" + count + "###", elements.get(count)); // depends on control dependency: [for], data = [count]
}
return escapedTitle;
} }
|
public class class_name {
public static boolean checkAppBeforeAuth(Context context, String appKey, boolean alertUser) {
// Check if the app has set up its manifest properly.
Intent testIntent = new Intent(Intent.ACTION_VIEW);
String scheme = "db-" +appKey;
String uri = scheme + "://" + AUTH_VERSION + AUTH_PATH_CONNECT;
testIntent.setData(Uri.parse(uri));
PackageManager pm = context.getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(testIntent, 0);
if (null == activities || 0 == activities.size()) {
throw new IllegalStateException("URI scheme in your app's " +
"manifest is not set up correctly. You should have a " +
AuthActivity.class.getName() + " with the " +
"scheme: " + scheme);
} else if (activities.size() > 1) {
if (alertUser) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Security alert");
builder.setMessage("Another app on your phone may be trying to " +
"pose as the app you are currently using. The malicious " +
"app can't access your account, but linking to Dropbox " +
"has been disabled as a precaution. Please contact " +
"support@dropbox.com.");
builder.setPositiveButton("OK", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.show();
} else {
Log.w(TAG, "There are multiple apps registered for the AuthActivity " +
"URI scheme (" + scheme + "). Another app may be trying to " +
" impersonate this app, so authentication will be disabled.");
}
return false;
} else {
// Just one activity registered for the URI scheme. Now make sure
// it's within the same package so when we return from web auth
// we're going back to this app and not some other app.
ResolveInfo resolveInfo = activities.get(0);
if (null == resolveInfo || null == resolveInfo.activityInfo
|| !context.getPackageName().equals(resolveInfo.activityInfo.packageName)) {
throw new IllegalStateException("There must be a " +
AuthActivity.class.getName() + " within your app's package " +
"registered for your URI scheme (" + scheme + "). However, " +
"it appears that an activity in a different package is " +
"registered for that scheme instead. If you have " +
"multiple apps that all want to use the same access" +
"token pair, designate one of them to do " +
"authentication and have the other apps launch it " +
"and then retrieve the token pair from it.");
}
}
return true;
} }
|
public class class_name {
public static boolean checkAppBeforeAuth(Context context, String appKey, boolean alertUser) {
// Check if the app has set up its manifest properly.
Intent testIntent = new Intent(Intent.ACTION_VIEW);
String scheme = "db-" +appKey;
String uri = scheme + "://" + AUTH_VERSION + AUTH_PATH_CONNECT;
testIntent.setData(Uri.parse(uri));
PackageManager pm = context.getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(testIntent, 0);
if (null == activities || 0 == activities.size()) {
throw new IllegalStateException("URI scheme in your app's " +
"manifest is not set up correctly. You should have a " +
AuthActivity.class.getName() + " with the " +
"scheme: " + scheme);
} else if (activities.size() > 1) {
if (alertUser) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Security alert"); // depends on control dependency: [if], data = [none]
builder.setMessage("Another app on your phone may be trying to " +
"pose as the app you are currently using. The malicious " +
"app can't access your account, but linking to Dropbox " +
"has been disabled as a precaution. Please contact " +
"support@dropbox.com.");
builder.setPositiveButton("OK", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.show();
} else {
Log.w(TAG, "There are multiple apps registered for the AuthActivity " +
"URI scheme (" + scheme + "). Another app may be trying to " +
" impersonate this app, so authentication will be disabled.");
}
return false;
} else {
// Just one activity registered for the URI scheme. Now make sure
// it's within the same package so when we return from web auth
// we're going back to this app and not some other app.
ResolveInfo resolveInfo = activities.get(0); // depends on control dependency: [if], data = [none]
if (null == resolveInfo || null == resolveInfo.activityInfo
|| !context.getPackageName().equals(resolveInfo.activityInfo.packageName)) {
throw new IllegalStateException("There must be a " +
AuthActivity.class.getName() + " within your app's package " +
"registered for your URI scheme (" + scheme + "). However, " +
"it appears that an activity in a different package is " +
"registered for that scheme instead. If you have " +
"multiple apps that all want to use the same access" +
"token pair, designate one of them to do " +
"authentication and have the other apps launch it " +
"and then retrieve the token pair from it.");
}
}
return true; // depends on control dependency: [if], data = [none]
} }
|
public class class_name {
public static double calc(String ... coords) {
try {
String [] array;
switch(coords.length) {
case 1:
array = Split.split(',',coords[0]);
if(array.length!=4)return -1;
return calc(
Double.parseDouble(array[0]),
Double.parseDouble(array[1]),
Double.parseDouble(array[2]),
Double.parseDouble(array[3])
);
case 2:
array = Split.split(',',coords[0]);
String [] array2 = Split.split(',',coords[1]);
if(array.length!=2 || array2.length!=2)return -1;
return calc(
Double.parseDouble(array[0]),
Double.parseDouble(array[1]),
Double.parseDouble(array2[0]),
Double.parseDouble(array2[1])
);
case 4:
return calc(
Double.parseDouble(coords[0]),
Double.parseDouble(coords[1]),
Double.parseDouble(coords[2]),
Double.parseDouble(coords[3])
);
default:
return -1;
}
} catch (NumberFormatException e) {
return -1;
}
} }
|
public class class_name {
public static double calc(String ... coords) {
try {
String [] array;
switch(coords.length) {
case 1:
array = Split.split(',',coords[0]);
if(array.length!=4)return -1;
return calc(
Double.parseDouble(array[0]),
Double.parseDouble(array[1]),
Double.parseDouble(array[2]),
Double.parseDouble(array[3])
);
case 2:
array = Split.split(',',coords[0]);
String [] array2 = Split.split(',',coords[1]);
if(array.length!=2 || array2.length!=2)return -1;
return calc(
Double.parseDouble(array[0]),
Double.parseDouble(array[1]),
Double.parseDouble(array2[0]),
Double.parseDouble(array2[1])
);
case 4:
return calc(
Double.parseDouble(coords[0]),
Double.parseDouble(coords[1]),
Double.parseDouble(coords[2]),
Double.parseDouble(coords[3])
);
default:
return -1;
}
} catch (NumberFormatException e) {
return -1;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Type glb(List<Type> ts) {
Type t1 = ts.head;
for (Type t2 : ts.tail) {
if (t1.isErroneous())
return t1;
t1 = glb(t1, t2);
}
return t1;
} }
|
public class class_name {
public Type glb(List<Type> ts) {
Type t1 = ts.head;
for (Type t2 : ts.tail) {
if (t1.isErroneous())
return t1;
t1 = glb(t1, t2); // depends on control dependency: [for], data = [t2]
}
return t1;
} }
|
public class class_name {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "checkClientTrusted");
extendedInfo = JSSEHelper.getInstance().getInboundConnectionInfo();
if (extendedInfo != null)
peerHost = (String) extendedInfo.get(Constants.CONNECTION_INFO_REMOTE_HOST);
// if we do not have host and port just go ahead and default it to unknown
// to avoid null's
if (peerHost == null || peerHost.equals("")) {
peerHost = "unknown";
}
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
for (int j = 0; j < chain.length; j++) {
Tr.debug(tc, "chain[" + j + "]: " + chain[j].getSubjectDN());
}
}
for (int i = 0; i < tm.length; i++) {
if (tm[i] != null && tm[i] instanceof X509TrustManager) {
// skip the default trust manager if configured to do so.
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Delegating to X509TrustManager: " + tm[i].getClass().getName());
((X509TrustManager) tm[i]).checkClientTrusted(chain, authType);
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Certificate Exception occurred: " + e.getMessage());
Exception excpt = e;
if (excpt.getClass().toString().startsWith("class com.ibm.jsse2")) {
excpt = (Exception) excpt.getCause();
}
FFDCFilter.processException(excpt, getClass().getName(), "checkClientTrusted", this, new Object[] { chain, authType });
printClientHandshakeError(config, tsFile, e, chain);
// Wrap exception in CertificateException if not a
// CertificateException already
if (excpt instanceof CertificateException) {
throw (CertificateException) excpt;
}
throw new CertificateException(excpt.getMessage());
}
}
}
} catch (Throwable t) {
// here we want to try to catch any runtime exceptions that might occur,
// print a message and rethrow
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Caught exception in checkClientTrusted.", new Object[] { t });
FFDCFilter.processException(t, getClass().getName(), "checkClientTrusted", this, new Object[] { chain, authType });
if (t instanceof RuntimeException) {
throw (RuntimeException) t;
}
if (t instanceof CertificateException) {
throw (CertificateException) t;
}
throw new CertificateException(t);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "checkClientTrusted");
} }
|
public class class_name {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "checkClientTrusted");
extendedInfo = JSSEHelper.getInstance().getInboundConnectionInfo();
if (extendedInfo != null)
peerHost = (String) extendedInfo.get(Constants.CONNECTION_INFO_REMOTE_HOST);
// if we do not have host and port just go ahead and default it to unknown
// to avoid null's
if (peerHost == null || peerHost.equals("")) {
peerHost = "unknown";
}
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
for (int j = 0; j < chain.length; j++) {
Tr.debug(tc, "chain[" + j + "]: " + chain[j].getSubjectDN()); // depends on control dependency: [for], data = [j]
}
}
for (int i = 0; i < tm.length; i++) {
if (tm[i] != null && tm[i] instanceof X509TrustManager) {
// skip the default trust manager if configured to do so.
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Delegating to X509TrustManager: " + tm[i].getClass().getName());
((X509TrustManager) tm[i]).checkClientTrusted(chain, authType);
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Certificate Exception occurred: " + e.getMessage());
Exception excpt = e;
if (excpt.getClass().toString().startsWith("class com.ibm.jsse2")) {
excpt = (Exception) excpt.getCause();
}
FFDCFilter.processException(excpt, getClass().getName(), "checkClientTrusted", this, new Object[] { chain, authType });
printClientHandshakeError(config, tsFile, e, chain);
// Wrap exception in CertificateException if not a
// CertificateException already
if (excpt instanceof CertificateException) {
throw (CertificateException) excpt;
}
throw new CertificateException(excpt.getMessage());
}
}
}
} catch (Throwable t) {
// here we want to try to catch any runtime exceptions that might occur,
// print a message and rethrow
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Caught exception in checkClientTrusted.", new Object[] { t });
FFDCFilter.processException(t, getClass().getName(), "checkClientTrusted", this, new Object[] { chain, authType });
if (t instanceof RuntimeException) {
throw (RuntimeException) t;
}
if (t instanceof CertificateException) {
throw (CertificateException) t;
}
throw new CertificateException(t);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "checkClientTrusted");
} }
|
public class class_name {
public static void setPreferredRadius(double radius) {
assert !Double.isNaN(radius);
final Preferences prefs = Preferences.userNodeForPackage(MapElementConstants.class);
if (prefs != null) {
prefs.putDouble("RADIUS", radius); //$NON-NLS-1$
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} }
|
public class class_name {
public static void setPreferredRadius(double radius) {
assert !Double.isNaN(radius);
final Preferences prefs = Preferences.userNodeForPackage(MapElementConstants.class);
if (prefs != null) {
prefs.putDouble("RADIUS", radius); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
try {
prefs.flush(); // depends on control dependency: [try], data = [none]
} catch (BackingStoreException exception) {
//
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static Double getFirstScore(Set<Tuple> set) {
if (set == null || set.isEmpty()) {
return null;
}
Tuple tuple = set.iterator().next();
Double score = tuple.getScore();
return score;
} }
|
public class class_name {
public static Double getFirstScore(Set<Tuple> set) {
if (set == null || set.isEmpty()) {
return null;
// depends on control dependency: [if], data = [none]
}
Tuple tuple = set.iterator().next();
Double score = tuple.getScore();
return score;
} }
|
public class class_name {
public static List<String> getAllAncestors(String eventPath) {
// check if the path is valid.
if (eventPath == null || !eventPath.startsWith(Path.SEPARATOR)) {
return null;
}
if (eventPath.equals(Path.SEPARATOR)) {
return Arrays.asList(Path.SEPARATOR);
}
List<String> ancestors = new ArrayList<String>();
while (eventPath.length() > 0) {
ancestors.add(eventPath);
eventPath = eventPath.substring(0, eventPath.lastIndexOf(Path.SEPARATOR));
}
// add the root directory
ancestors.add(Path.SEPARATOR);
return ancestors;
} }
|
public class class_name {
public static List<String> getAllAncestors(String eventPath) {
// check if the path is valid.
if (eventPath == null || !eventPath.startsWith(Path.SEPARATOR)) {
return null; // depends on control dependency: [if], data = [none]
}
if (eventPath.equals(Path.SEPARATOR)) {
return Arrays.asList(Path.SEPARATOR); // depends on control dependency: [if], data = [none]
}
List<String> ancestors = new ArrayList<String>();
while (eventPath.length() > 0) {
ancestors.add(eventPath); // depends on control dependency: [while], data = [none]
eventPath = eventPath.substring(0, eventPath.lastIndexOf(Path.SEPARATOR)); // depends on control dependency: [while], data = [none]
}
// add the root directory
ancestors.add(Path.SEPARATOR);
return ancestors;
} }
|
public class class_name {
public List<Symbol> getAllSymbolsForType(JSType type) {
if (type == null) {
return ImmutableList.of();
}
UnionType unionType = type.toMaybeUnionType();
if (unionType != null) {
List<Symbol> result = new ArrayList<>(2);
for (JSType alt : unionType.getAlternates()) {
// Our type system never has nested unions.
Symbol altSym = getSymbolForTypeHelper(alt, true);
if (altSym != null) {
result.add(altSym);
}
}
return result;
}
Symbol result = getSymbolForTypeHelper(type, true);
return result == null ? ImmutableList.of() : ImmutableList.of(result);
} }
|
public class class_name {
public List<Symbol> getAllSymbolsForType(JSType type) {
if (type == null) {
return ImmutableList.of(); // depends on control dependency: [if], data = [none]
}
UnionType unionType = type.toMaybeUnionType();
if (unionType != null) {
List<Symbol> result = new ArrayList<>(2);
for (JSType alt : unionType.getAlternates()) {
// Our type system never has nested unions.
Symbol altSym = getSymbolForTypeHelper(alt, true);
if (altSym != null) {
result.add(altSym); // depends on control dependency: [if], data = [(altSym]
}
}
return result; // depends on control dependency: [if], data = [none]
}
Symbol result = getSymbolForTypeHelper(type, true);
return result == null ? ImmutableList.of() : ImmutableList.of(result);
} }
|
public class class_name {
private String combine(String parent, String child) {
if (parent.length() > 0) {
return parent.concat(".").concat(child);
} else {
return child;
}
} }
|
public class class_name {
private String combine(String parent, String child) {
if (parent.length() > 0) {
return parent.concat(".").concat(child); // depends on control dependency: [if], data = [none]
} else {
return child; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected CmsLazyTreeItem createItem(final CmsSitemapEntryBean sitemapEntry) {
CmsDataValue dataValue = new CmsDataValue(
600,
3,
sitemapEntry.getSmallIconClasses(),
sitemapEntry.getDisplayName());
dataValue.setUnselectable();
if (sitemapEntry.isHiddenEntry()) {
dataValue.setColor("#aaaaaa");
}
dataValue.setSearchMatch(sitemapEntry.isSearchMatch());
CmsLazyTreeItem result = new CmsLazyTreeItem(dataValue, true);
result.setData(sitemapEntry);
if (getTabHandler().hasSelectResource()) {
dataValue.addButton(
createSelectResourceButton(
m_handler.getSelectPath(sitemapEntry),
sitemapEntry.getStructureId(),
sitemapEntry.getDisplayName(),
sitemapEntry.getType()));
}
result.setLeafStyle(!sitemapEntry.isFolder());
result.setSmallView(true);
if (sitemapEntry.hasChildren()) {
for (CmsSitemapEntryBean child : sitemapEntry.getChildren()) {
result.addChild(createItem(child));
}
result.setOpen(true, false);
result.onFinishLoading();
}
if ((sitemapEntry.getChildren() != null) && sitemapEntry.getChildren().isEmpty()) {
result.setLeafStyle(true);
}
m_items.add(result);
dataValue.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent e) {
if (getTabHandler().hasSelectResource()) {
getTabHandler().selectResource(
m_handler.getSelectPath(sitemapEntry),
sitemapEntry.getStructureId(),
sitemapEntry.getDisplayName(),
sitemapEntry.getType());
}
}
});
return result;
} }
|
public class class_name {
protected CmsLazyTreeItem createItem(final CmsSitemapEntryBean sitemapEntry) {
CmsDataValue dataValue = new CmsDataValue(
600,
3,
sitemapEntry.getSmallIconClasses(),
sitemapEntry.getDisplayName());
dataValue.setUnselectable();
if (sitemapEntry.isHiddenEntry()) {
dataValue.setColor("#aaaaaa");
// depends on control dependency: [if], data = [none]
}
dataValue.setSearchMatch(sitemapEntry.isSearchMatch());
CmsLazyTreeItem result = new CmsLazyTreeItem(dataValue, true);
result.setData(sitemapEntry);
if (getTabHandler().hasSelectResource()) {
dataValue.addButton(
createSelectResourceButton(
m_handler.getSelectPath(sitemapEntry),
sitemapEntry.getStructureId(),
sitemapEntry.getDisplayName(),
sitemapEntry.getType()));
// depends on control dependency: [if], data = [none]
}
result.setLeafStyle(!sitemapEntry.isFolder());
result.setSmallView(true);
if (sitemapEntry.hasChildren()) {
for (CmsSitemapEntryBean child : sitemapEntry.getChildren()) {
result.addChild(createItem(child));
// depends on control dependency: [for], data = [child]
}
result.setOpen(true, false);
// depends on control dependency: [if], data = [none]
result.onFinishLoading();
// depends on control dependency: [if], data = [none]
}
if ((sitemapEntry.getChildren() != null) && sitemapEntry.getChildren().isEmpty()) {
result.setLeafStyle(true);
// depends on control dependency: [if], data = [none]
}
m_items.add(result);
dataValue.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent e) {
if (getTabHandler().hasSelectResource()) {
getTabHandler().selectResource(
m_handler.getSelectPath(sitemapEntry),
sitemapEntry.getStructureId(),
sitemapEntry.getDisplayName(),
sitemapEntry.getType());
// depends on control dependency: [if], data = [none]
}
}
});
return result;
} }
|
public class class_name {
public final boolean stop() {
if (booting || running) {
stopping = true;
booting = false;
onStopping();
return true;
} else {
return false;
}
} }
|
public class class_name {
public final boolean stop() {
if (booting || running) {
stopping = true; // depends on control dependency: [if], data = [none]
booting = false; // depends on control dependency: [if], data = [none]
onStopping(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static List<List<Term>> seg2sentence(String text)
{
List<List<Term>> resultList = new LinkedList<List<Term>>();
{
for (String sentence : SentencesUtil.toSentenceList(text))
{
resultList.add(segment(sentence));
}
}
return resultList;
} }
|
public class class_name {
public static List<List<Term>> seg2sentence(String text)
{
List<List<Term>> resultList = new LinkedList<List<Term>>();
{
for (String sentence : SentencesUtil.toSentenceList(text))
{
resultList.add(segment(sentence)); // depends on control dependency: [for], data = [sentence]
}
}
return resultList;
} }
|
public class class_name {
@Deprecated
public void addLibrary(Class<?> clazz, int port) {
if (!server.isStopped()) // old behavior
throw new IllegalStateException("Cannot add a library once the server is started");
if (connector.getPort() != 0 && connector.getPort() != port) {
throw new RuntimeException(
"Serving on multiple ports is no longer supported. Please use putLibrary with different paths instead.");
}
if (servlet.getLibraryMap().keySet().contains("/")) {
throw new RuntimeException("A library has already been mapped to /.");
}
Object library;
try {
library = clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
setPort(port);
putLibrary("/", library);
} }
|
public class class_name {
@Deprecated
public void addLibrary(Class<?> clazz, int port) {
if (!server.isStopped()) // old behavior
throw new IllegalStateException("Cannot add a library once the server is started");
if (connector.getPort() != 0 && connector.getPort() != port) {
throw new RuntimeException(
"Serving on multiple ports is no longer supported. Please use putLibrary with different paths instead.");
}
if (servlet.getLibraryMap().keySet().contains("/")) {
throw new RuntimeException("A library has already been mapped to /.");
}
Object library;
try {
library = clazz.newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
setPort(port);
putLibrary("/", library);
} }
|
public class class_name {
private ExtractionInfo extractMultilineTextualBlock(
JsDocToken token, WhitespaceOption option, boolean includeAnnotations) {
if (token == JsDocToken.EOC || token == JsDocToken.EOL || token == JsDocToken.EOF) {
return new ExtractionInfo("", token);
}
return extractMultilineComment(token, option, true, includeAnnotations);
} }
|
public class class_name {
private ExtractionInfo extractMultilineTextualBlock(
JsDocToken token, WhitespaceOption option, boolean includeAnnotations) {
if (token == JsDocToken.EOC || token == JsDocToken.EOL || token == JsDocToken.EOF) {
return new ExtractionInfo("", token); // depends on control dependency: [if], data = [none]
}
return extractMultilineComment(token, option, true, includeAnnotations);
} }
|
public class class_name {
public static OptionalThing<Classification> findByCode(Class<?> cdefType, Object code) {
assertArgumentNotNull("cdefType", cdefType);
assertArgumentNotNull("code", code);
// #hope switch to nativeFindByCode() in future (can be over DBFlute-1.1.1) by jflute
final Object result = nativeCodeOf(cdefType, code);
if (result == null) {
return OptionalThing.empty();
}
if (result instanceof OptionalThing<?>) { // handling for future
@SuppressWarnings("unchecked")
final OptionalThing<Classification> cast = (OptionalThing<Classification>) result;
return cast;
} else if (result instanceof Optional<?>) {
@SuppressWarnings("unchecked")
final Optional<Classification> cast = (Optional<Classification>) result;
return OptionalThing.ofNullable(cast.orElse(null), () -> {
throw new IllegalStateException("Not found the classification code: " + cdefType.getName() + "@" + code);
});
} else {
return OptionalThing.of((Classification) result);
}
} }
|
public class class_name {
public static OptionalThing<Classification> findByCode(Class<?> cdefType, Object code) {
assertArgumentNotNull("cdefType", cdefType);
assertArgumentNotNull("code", code);
// #hope switch to nativeFindByCode() in future (can be over DBFlute-1.1.1) by jflute
final Object result = nativeCodeOf(cdefType, code);
if (result == null) {
return OptionalThing.empty(); // depends on control dependency: [if], data = [none]
}
if (result instanceof OptionalThing<?>) { // handling for future
@SuppressWarnings("unchecked")
final OptionalThing<Classification> cast = (OptionalThing<Classification>) result;
return cast; // depends on control dependency: [if], data = [none]
} else if (result instanceof Optional<?>) {
@SuppressWarnings("unchecked")
final Optional<Classification> cast = (Optional<Classification>) result;
return OptionalThing.ofNullable(cast.orElse(null), () -> {
throw new IllegalStateException("Not found the classification code: " + cdefType.getName() + "@" + code);
}); // depends on control dependency: [if], data = [none]
} else {
return OptionalThing.of((Classification) result); // depends on control dependency: [if], data = [)]
}
} }
|
public class class_name {
@Override
protected boolean doEvaluate(String line)
{
line = line.substring(line.indexOf(' ') + 1);
try
{
println(line + " = " + interpreter.evaluate(line, getFrame()));
} catch (ParserException e)
{
println("Syntax: " + e);
} catch (ContextException e)
{
println("Runtime: " + e.getMessage());
} catch (RuntimeException e)
{
println("Runtime: " + e.getMessage());
} catch (Exception e)
{
println("Error: " + e.getMessage());
}
return true;
} }
|
public class class_name {
@Override
protected boolean doEvaluate(String line)
{
line = line.substring(line.indexOf(' ') + 1);
try
{
println(line + " = " + interpreter.evaluate(line, getFrame())); // depends on control dependency: [try], data = [none]
} catch (ParserException e)
{
println("Syntax: " + e);
} catch (ContextException e) // depends on control dependency: [catch], data = [none]
{
println("Runtime: " + e.getMessage());
} catch (RuntimeException e) // depends on control dependency: [catch], data = [none]
{
println("Runtime: " + e.getMessage());
} catch (Exception e) // depends on control dependency: [catch], data = [none]
{
println("Error: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
return true;
} }
|
public class class_name {
private Optional<ThriftTableMetadata> getTableMetadataInternal(SchemaTableName schemaTableName)
{
requireNonNull(schemaTableName, "schemaTableName is null");
PrestoThriftNullableTableMetadata thriftTableMetadata = getTableMetadata(schemaTableName);
if (thriftTableMetadata.getTableMetadata() == null) {
return Optional.empty();
}
ThriftTableMetadata tableMetadata = new ThriftTableMetadata(thriftTableMetadata.getTableMetadata(), typeManager);
if (!Objects.equals(schemaTableName, tableMetadata.getSchemaTableName())) {
throw new PrestoException(THRIFT_SERVICE_INVALID_RESPONSE, "Requested and actual table names are different");
}
return Optional.of(tableMetadata);
} }
|
public class class_name {
private Optional<ThriftTableMetadata> getTableMetadataInternal(SchemaTableName schemaTableName)
{
requireNonNull(schemaTableName, "schemaTableName is null");
PrestoThriftNullableTableMetadata thriftTableMetadata = getTableMetadata(schemaTableName);
if (thriftTableMetadata.getTableMetadata() == null) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
ThriftTableMetadata tableMetadata = new ThriftTableMetadata(thriftTableMetadata.getTableMetadata(), typeManager);
if (!Objects.equals(schemaTableName, tableMetadata.getSchemaTableName())) {
throw new PrestoException(THRIFT_SERVICE_INVALID_RESPONSE, "Requested and actual table names are different");
}
return Optional.of(tableMetadata);
} }
|
public class class_name {
private void ensureDefaultOccurElements(IChemObjectBuilder builder) {
if (mfRange == null) {
String[] elements = new String[]{"C", "H", "O", "N", "Si", "P", "S", "F", "Cl", "Br", "I", "Sn", "B", "Pb",
"Tl", "Ba", "In", "Pd", "Pt", "Os", "Ag", "Zr", "Se", "Zn", "Cu", "Ni", "Co", "Fe", "Cr", "Ti",
"Ca", "K", "Al", "Mg", "Na", "Ce", "Hg", "Au", "Ir", "Re", "W", "Ta", "Hf", "Lu", "Yb", "Tm", "Er",
"Ho", "Dy", "Tb", "Gd", "Eu", "Sm", "Pm", "Nd", "Pr", "La", "Cs", "Xe", "Te", "Sb", "Cd", "Rh",
"Ru", "Tc", "Mo", "Nb", "Y", "Sr", "Rb", "Kr", "As", "Ge", "Ga", "Mn", "V", "Sc", "Ar", "Ne", "Be",
"Li", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu"};
mfRange = new MolecularFormulaRange();
for (int i = 0; i < elements.length; i++)
mfRange.addIsotope(builder.newInstance(IIsotope.class, elements[i]), 0, 50);
}
} }
|
public class class_name {
private void ensureDefaultOccurElements(IChemObjectBuilder builder) {
if (mfRange == null) {
String[] elements = new String[]{"C", "H", "O", "N", "Si", "P", "S", "F", "Cl", "Br", "I", "Sn", "B", "Pb",
"Tl", "Ba", "In", "Pd", "Pt", "Os", "Ag", "Zr", "Se", "Zn", "Cu", "Ni", "Co", "Fe", "Cr", "Ti",
"Ca", "K", "Al", "Mg", "Na", "Ce", "Hg", "Au", "Ir", "Re", "W", "Ta", "Hf", "Lu", "Yb", "Tm", "Er",
"Ho", "Dy", "Tb", "Gd", "Eu", "Sm", "Pm", "Nd", "Pr", "La", "Cs", "Xe", "Te", "Sb", "Cd", "Rh",
"Ru", "Tc", "Mo", "Nb", "Y", "Sr", "Rb", "Kr", "As", "Ge", "Ga", "Mn", "V", "Sc", "Ar", "Ne", "Be",
"Li", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu"};
mfRange = new MolecularFormulaRange(); // depends on control dependency: [if], data = [none]
for (int i = 0; i < elements.length; i++)
mfRange.addIsotope(builder.newInstance(IIsotope.class, elements[i]), 0, 50);
}
} }
|
public class class_name {
public void marshall(LogStream logStream, ProtocolMarshaller protocolMarshaller) {
if (logStream == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(logStream.getLogStreamName(), LOGSTREAMNAME_BINDING);
protocolMarshaller.marshall(logStream.getCreationTime(), CREATIONTIME_BINDING);
protocolMarshaller.marshall(logStream.getFirstEventTimestamp(), FIRSTEVENTTIMESTAMP_BINDING);
protocolMarshaller.marshall(logStream.getLastEventTimestamp(), LASTEVENTTIMESTAMP_BINDING);
protocolMarshaller.marshall(logStream.getLastIngestionTime(), LASTINGESTIONTIME_BINDING);
protocolMarshaller.marshall(logStream.getUploadSequenceToken(), UPLOADSEQUENCETOKEN_BINDING);
protocolMarshaller.marshall(logStream.getArn(), ARN_BINDING);
protocolMarshaller.marshall(logStream.getStoredBytes(), STOREDBYTES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(LogStream logStream, ProtocolMarshaller protocolMarshaller) {
if (logStream == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(logStream.getLogStreamName(), LOGSTREAMNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logStream.getCreationTime(), CREATIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logStream.getFirstEventTimestamp(), FIRSTEVENTTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logStream.getLastEventTimestamp(), LASTEVENTTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logStream.getLastIngestionTime(), LASTINGESTIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logStream.getUploadSequenceToken(), UPLOADSEQUENCETOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logStream.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logStream.getStoredBytes(), STOREDBYTES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void showSelect(boolean show) {
if (show) {
m_main.addStyleName(I_CmsLayoutBundle.INSTANCE.selectAreaCss().showSelect());
return;
}
m_main.removeStyleName(I_CmsLayoutBundle.INSTANCE.selectAreaCss().showSelect());
} }
|
public class class_name {
private void showSelect(boolean show) {
if (show) {
m_main.addStyleName(I_CmsLayoutBundle.INSTANCE.selectAreaCss().showSelect()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
m_main.removeStyleName(I_CmsLayoutBundle.INSTANCE.selectAreaCss().showSelect());
} }
|
public class class_name {
public static <E extends Extension> IterableResult<E> appendSearchResults(IterableResult<E> previousSearchResult,
IterableResult<E> result)
{
AggregatedIterableResult<E> newResult;
if (previousSearchResult instanceof AggregatedIterableResult) {
newResult = ((AggregatedIterableResult<E>) previousSearchResult);
} else if (previousSearchResult != null) {
newResult = new AggregatedIterableResult<>(previousSearchResult.getOffset());
newResult.addSearchResult(previousSearchResult);
} else {
return result;
}
newResult.addSearchResult(result);
return newResult;
} }
|
public class class_name {
public static <E extends Extension> IterableResult<E> appendSearchResults(IterableResult<E> previousSearchResult,
IterableResult<E> result)
{
AggregatedIterableResult<E> newResult;
if (previousSearchResult instanceof AggregatedIterableResult) {
newResult = ((AggregatedIterableResult<E>) previousSearchResult); // depends on control dependency: [if], data = [none]
} else if (previousSearchResult != null) {
newResult = new AggregatedIterableResult<>(previousSearchResult.getOffset()); // depends on control dependency: [if], data = [(previousSearchResult]
newResult.addSearchResult(previousSearchResult); // depends on control dependency: [if], data = [(previousSearchResult]
} else {
return result; // depends on control dependency: [if], data = [none]
}
newResult.addSearchResult(result);
return newResult;
} }
|
public class class_name {
public <T> T get(Key<T> key) {
checkState(ht);
Object o = ht.get(key);
if (o instanceof Factory<?>) {
Factory<?> fac = (Factory<?>)o;
o = fac.make(this);
if (o instanceof Factory<?>)
throw new AssertionError("T extends Context.Factory");
Assert.check(ht.get(key) == o);
}
/* The following cast can't fail unless there was
* cheating elsewhere, because of the invariant on ht.
* Since we found a key of type Key<T>, the value must
* be of type T.
*/
return Context.<T>uncheckedCast(o);
} }
|
public class class_name {
public <T> T get(Key<T> key) {
checkState(ht);
Object o = ht.get(key);
if (o instanceof Factory<?>) {
Factory<?> fac = (Factory<?>)o;
o = fac.make(this); // depends on control dependency: [if], data = [)]
if (o instanceof Factory<?>)
throw new AssertionError("T extends Context.Factory");
Assert.check(ht.get(key) == o);
}
/* The following cast can't fail unless there was
* cheating elsewhere, because of the invariant on ht.
* Since we found a key of type Key<T>, the value must
* be of type T.
*/
return Context.<T>uncheckedCast(o);
} }
|
public class class_name {
private void loadYAMLResource(final File file) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line = null;
while ((line = reader.readLine()) != null) {
// 1. check for comments
String[] comments = line.split("#", 2);
String conf = comments[0];
// 2. get key and value
if (conf.length() > 0) {
String[] kv = conf.split(": ", 2);
// skip line with no valid key-value pair
if (kv.length == 1) {
LOG.warn("Error while trying to split key and value in configuration file " + file + ": " + line);
continue;
}
String key = kv[0].trim();
String value = kv[1].trim();
// sanity check
if (key.length() == 0 || value.length() == 0) {
LOG.warn("Error after splitting key and value in configuration file " + file + ": " + line);
continue;
}
LOG.debug("Loading configuration property: " + key + ", " + value);
this.confData.put(key, value);
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} }
|
public class class_name {
private void loadYAMLResource(final File file) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); // depends on control dependency: [try], data = [none]
String line = null;
while ((line = reader.readLine()) != null) {
// 1. check for comments
String[] comments = line.split("#", 2);
String conf = comments[0];
// 2. get key and value
if (conf.length() > 0) {
String[] kv = conf.split(": ", 2);
// skip line with no valid key-value pair
if (kv.length == 1) {
LOG.warn("Error while trying to split key and value in configuration file " + file + ": " + line); // depends on control dependency: [if], data = [none]
continue;
}
String key = kv[0].trim();
String value = kv[1].trim();
// sanity check
if (key.length() == 0 || value.length() == 0) {
LOG.warn("Error after splitting key and value in configuration file " + file + ": " + line); // depends on control dependency: [if], data = [none]
continue;
}
LOG.debug("Loading configuration property: " + key + ", " + value); // depends on control dependency: [if], data = [none]
this.confData.put(key, value); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException e) {
e.printStackTrace();
} finally { // depends on control dependency: [catch], data = [none]
try {
reader.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
if (a.length < events.size()) {
a = (T[]) java.lang.reflect.Array.newInstance(a.getClass()
.getComponentType(), events.size());
}
for (int i = 0; i < events.size(); i++) {
try {
a[i] = (T) events.get(i);
} catch (IOException e) {
e.printStackTrace();
}
}
return a;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
if (a.length < events.size()) {
a = (T[]) java.lang.reflect.Array.newInstance(a.getClass()
.getComponentType(), events.size()); // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < events.size(); i++) {
try {
a[i] = (T) events.get(i); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return a;
} }
|
public class class_name {
public int getMessageSetSerializedSize() {
int size = 0;
for (int i = 0; i < fields.getNumArrayEntries(); i++) {
size += getMessageSetSerializedSize(fields.getArrayEntryAt(i));
}
for (final Map.Entry<FieldDescriptorType, Object> entry :
fields.getOverflowEntries()) {
size += getMessageSetSerializedSize(entry);
}
return size;
} }
|
public class class_name {
public int getMessageSetSerializedSize() {
int size = 0;
for (int i = 0; i < fields.getNumArrayEntries(); i++) {
size += getMessageSetSerializedSize(fields.getArrayEntryAt(i)); // depends on control dependency: [for], data = [i]
}
for (final Map.Entry<FieldDescriptorType, Object> entry :
fields.getOverflowEntries()) {
size += getMessageSetSerializedSize(entry); // depends on control dependency: [for], data = [entry]
}
return size;
} }
|
public class class_name {
protected void addBehaviorListener(BehaviorListener listener) {
if (listener == null) {
throw new NullPointerException();
}
if (listeners == null) {
//noinspection CollectionWithoutInitialCapacity
listeners = new ArrayList<BehaviorListener>();
}
listeners.add(listener);
clearInitialState();
} }
|
public class class_name {
protected void addBehaviorListener(BehaviorListener listener) {
if (listener == null) {
throw new NullPointerException();
}
if (listeners == null) {
//noinspection CollectionWithoutInitialCapacity
listeners = new ArrayList<BehaviorListener>(); // depends on control dependency: [if], data = [none]
}
listeners.add(listener);
clearInitialState();
} }
|
public class class_name {
public static <T> List<T> getServices(final Class<T> intf)
{
Objects.requireNonNull(intf);
List<T> ret = new LinkedList<>();
for (final T t : ServiceLoader.load(intf)) {
ret.add(t);
}
return ret;
} }
|
public class class_name {
public static <T> List<T> getServices(final Class<T> intf)
{
Objects.requireNonNull(intf);
List<T> ret = new LinkedList<>();
for (final T t : ServiceLoader.load(intf)) {
ret.add(t); // depends on control dependency: [for], data = [t]
}
return ret;
} }
|
public class class_name {
public void marshall(DataPoint dataPoint, ProtocolMarshaller protocolMarshaller) {
if (dataPoint == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dataPoint.getTimestamp(), TIMESTAMP_BINDING);
protocolMarshaller.marshall(dataPoint.getValue(), VALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DataPoint dataPoint, ProtocolMarshaller protocolMarshaller) {
if (dataPoint == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dataPoint.getTimestamp(), TIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dataPoint.getValue(), VALUE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void paintAndClear (Graphics2D gfx)
{
int icount = _items.size();
for (int ii = 0; ii < icount; ii++) {
DirtyItem item = _items.get(ii);
item.paint(gfx);
item.clear();
_freelist.add(item);
}
_items.clear();
} }
|
public class class_name {
public void paintAndClear (Graphics2D gfx)
{
int icount = _items.size();
for (int ii = 0; ii < icount; ii++) {
DirtyItem item = _items.get(ii);
item.paint(gfx); // depends on control dependency: [for], data = [none]
item.clear(); // depends on control dependency: [for], data = [none]
_freelist.add(item); // depends on control dependency: [for], data = [none]
}
_items.clear();
} }
|
public class class_name {
public java.util.List<VpcAttachment> getVpcAttachments() {
if (vpcAttachments == null) {
vpcAttachments = new com.amazonaws.internal.SdkInternalList<VpcAttachment>();
}
return vpcAttachments;
} }
|
public class class_name {
public java.util.List<VpcAttachment> getVpcAttachments() {
if (vpcAttachments == null) {
vpcAttachments = new com.amazonaws.internal.SdkInternalList<VpcAttachment>(); // depends on control dependency: [if], data = [none]
}
return vpcAttachments;
} }
|
public class class_name {
public boolean answerCallbackQuery(String callbackQueryId, CallbackQueryResponse callbackQueryResponse) {
if(callbackQueryId != null && callbackQueryResponse.getText() != null) {
HttpResponse<String> response;
JSONObject jsonResponse;
try {
MultipartBody requests = Unirest.post(getBotAPIUrl() + "answerCallbackQuery")
.field("callback_query_id", callbackQueryId, "application/json; charset=utf8;")
.field("text", callbackQueryResponse.getText(), "application/json; charset=utf8;")
.field("show_alert", callbackQueryResponse.isShowAlert())
.field("cache_time", callbackQueryResponse.getCacheTime())
.field("url", callbackQueryResponse.getURL() != null ? callbackQueryResponse.getURL().toExternalForm() : null, "application/json; charset=utf8;");
response = requests.asString();
jsonResponse = Utils.processResponse(response);
if (jsonResponse != null) {
if (jsonResponse.getBoolean("result")) return true;
}
} catch (UnirestException e) {
e.printStackTrace();
}
}
return false;
} }
|
public class class_name {
public boolean answerCallbackQuery(String callbackQueryId, CallbackQueryResponse callbackQueryResponse) {
if(callbackQueryId != null && callbackQueryResponse.getText() != null) {
HttpResponse<String> response;
JSONObject jsonResponse;
try {
MultipartBody requests = Unirest.post(getBotAPIUrl() + "answerCallbackQuery")
.field("callback_query_id", callbackQueryId, "application/json; charset=utf8;") // depends on control dependency: [try], data = [none]
.field("text", callbackQueryResponse.getText(), "application/json; charset=utf8;") // depends on control dependency: [try], data = [none] // depends on control dependency: [try], data = [none]
.field("show_alert", callbackQueryResponse.isShowAlert())
.field("cache_time", callbackQueryResponse.getCacheTime())
.field("url", callbackQueryResponse.getURL() != null ? callbackQueryResponse.getURL().toExternalForm() : null, "application/json; charset=utf8;"); // depends on control dependency: [try], data = [none] // depends on control dependency: [try], data = [none]
response = requests.asString(); // depends on control dependency: [try], data = [none]
jsonResponse = Utils.processResponse(response); // depends on control dependency: [try], data = [none]
if (jsonResponse != null) {
if (jsonResponse.getBoolean("result")) return true;
}
} catch (UnirestException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return false;
} }
|
public class class_name {
public long getEvitableBytes() {
long bytes = 0;
for (BlockMeta blockMeta : mDir.getBlocks()) {
long blockId = blockMeta.getBlockId();
if (mManagerView.isBlockEvictable(blockId)) {
bytes += blockMeta.getBlockSize();
}
}
return bytes;
} }
|
public class class_name {
public long getEvitableBytes() {
long bytes = 0;
for (BlockMeta blockMeta : mDir.getBlocks()) {
long blockId = blockMeta.getBlockId();
if (mManagerView.isBlockEvictable(blockId)) {
bytes += blockMeta.getBlockSize(); // depends on control dependency: [if], data = [none]
}
}
return bytes;
} }
|
public class class_name {
public static List<File> getClusterLexiconFiles(final String clusterPath) {
final List<File> clusterLexicons = new ArrayList<File>();
final String[] clusterPaths = clusterPath.split(",");
for (final String clusterName : clusterPaths) {
clusterLexicons.add(new File(clusterName));
}
return clusterLexicons;
} }
|
public class class_name {
public static List<File> getClusterLexiconFiles(final String clusterPath) {
final List<File> clusterLexicons = new ArrayList<File>();
final String[] clusterPaths = clusterPath.split(",");
for (final String clusterName : clusterPaths) {
clusterLexicons.add(new File(clusterName)); // depends on control dependency: [for], data = [clusterName]
}
return clusterLexicons;
} }
|
public class class_name {
public static String nativeEventsTableName(final StreamId streamId) {
// User defined ID
if (streamId instanceof JpaStreamId) {
final JpaStreamId jpaId = (JpaStreamId) streamId;
return jpaId.getNativeTableName();
}
// Default ID
if (streamId.isProjection()) {
return camel2Underscore(streamId.getName());
}
if (streamId.getParameters().size() == 0) {
return NoParamsEvent.NO_PARAMS_EVENTS_TABLE;
}
return camel2Underscore(streamId.getName()) + "_events";
} }
|
public class class_name {
public static String nativeEventsTableName(final StreamId streamId) {
// User defined ID
if (streamId instanceof JpaStreamId) {
final JpaStreamId jpaId = (JpaStreamId) streamId;
return jpaId.getNativeTableName(); // depends on control dependency: [if], data = [none]
}
// Default ID
if (streamId.isProjection()) {
return camel2Underscore(streamId.getName()); // depends on control dependency: [if], data = [none]
}
if (streamId.getParameters().size() == 0) {
return NoParamsEvent.NO_PARAMS_EVENTS_TABLE; // depends on control dependency: [if], data = [none]
}
return camel2Underscore(streamId.getName()) + "_events";
} }
|
public class class_name {
private IterationModels computeIterationModels(final IterationWhiteSpaceHandling iterationWhiteSpaceHandling) {
/*
* Nothing to iterate
*/
if (iterationWhiteSpaceHandling == IterationWhiteSpaceHandling.ZERO_ITER) {
return IterationModels.EMPTY;
}
/*
* Get the originally gathered model. This will serve as a base for any needed modifications
*/
final Model innerModel = getInnerModel();
final int gatheredModelSize = innerModel.size();
/*
* If there is only one iteration, we need to perform no modifications at all, whichever the template mode
*/
if (iterationWhiteSpaceHandling == IterationWhiteSpaceHandling.SINGLE_ITER) {
return new IterationModels(innerModel, innerModel, innerModel);
}
/*
* If template mode is a markup one, we will only need to take care of the existence of a preceding white space
*/
if (!this.templateMode.isText()) {
if (this.precedingWhitespace != null) {
final Model modelWithWhiteSpace = new Model(innerModel);
modelWithWhiteSpace.insert(0, this.precedingWhitespace);
return new IterationModels(innerModel, modelWithWhiteSpace, modelWithWhiteSpace);
}
return new IterationModels(innerModel, innerModel, innerModel);
}
/*
* We are in a textual template mode, and it might be possible to fiddle a bit with whitespaces at the beginning
* and end of the body, so that iterations look better.
*
* The goal is that this:
* ---------------------
* List:
* [# th:each="i : ${items}"]
* - [[${i}]]
* [/]
* ---------------------
* ...doesn't look like:
* ---------------------
* List:
*
* - [[${i}]]
*
* - [[${i}]]
*
* - [[${i}]]
* ---------------------
* ...but instead like:
* ---------------------
* List:
*
* - [[${i}]]
* - [[${i}]]
* - [[${i}]]
* ---------------------
* And in order to do this, the steps to be taken will be:
*
* - Check that the iterated block starts with an 'open element' and ends with a 'close element'. If not,
* don't apply any of this.
* - Except for the first iteration, remove all whitespace after the 'open element', until the
* first '\n' (and remove that too).
* - Except for the last iteration, remove all whitespace after the last '\n' (not including it) and before
* the 'close element'.
*/
if (innerModel.size() <= 2) {
// This does only contain the template open + close events -- nothing to be done
return new IterationModels(innerModel, innerModel, innerModel);
}
int firstBodyEventCutPoint = -1;
int lastBodyEventCutPoint = -1;
final ITemplateEvent firstBodyEvent = innerModel.get(1); // we know there is at least one body event
Text firstTextBodyEvent = null;
if (innerModel.get(0) instanceof OpenElementTag && firstBodyEvent instanceof IText) {
firstTextBodyEvent = Text.asEngineText((IText)firstBodyEvent);
final int firstTextEventLen = firstTextBodyEvent.length();
int i = 0;
char c;
while (i < firstTextEventLen && firstBodyEventCutPoint < 0) {
c = firstTextBodyEvent.charAt(i);
if (c == '\n') {
firstBodyEventCutPoint = i + 1;
break; // we've already assigned the value we were looking for
} else if (Character.isWhitespace(c)) {
i++;
continue;
} else {
// We will not be able to perform any whitespace reduction here
break;
}
}
}
final ITemplateEvent lastBodyEvent = innerModel.get(gatheredModelSize - 2);
Text lastTextBodyEvent = null;
if (firstBodyEventCutPoint >= 0 &&
innerModel.get(gatheredModelSize - 1) instanceof CloseElementTag && lastBodyEvent instanceof IText) {
lastTextBodyEvent = Text.asEngineText((IText)lastBodyEvent);
final int lastTextEventLen = lastTextBodyEvent.length();
int i = lastTextEventLen - 1;
char c;
while (i >= 0 && lastBodyEventCutPoint < 0) {
c = lastTextBodyEvent.charAt(i);
if (c == '\n') {
lastBodyEventCutPoint = i + 1;
break; // we've already assigned the value we were looking for
} else if (Character.isWhitespace(c)) {
i--;
continue;
} else {
// We will not be able to perform any whitespace reduction here
break;
}
}
}
/*
* If there is no reason to perform any modifications, just use the gathered model
*/
if (firstBodyEventCutPoint < 0 || lastBodyEventCutPoint < 0) {
// We don't have the scenario required for performing the needed whitespace collapsing operation
return new IterationModels(innerModel, innerModel, innerModel);
}
/*
* At this point, we are sure that we will want to perform modifications on the first/last whitespaces
*/
if (firstBodyEvent == lastBodyEvent) {
// If the first and the last event are actually the same, we need to take better care of how we manage whitespace
final Text textForFirst = new Text(firstTextBodyEvent.subSequence(0, lastBodyEventCutPoint));
final Text textForMiddle = new Text(firstTextBodyEvent.subSequence(firstBodyEventCutPoint, lastBodyEventCutPoint));
final Text textForLast = new Text(firstTextBodyEvent.subSequence(firstBodyEventCutPoint, firstTextBodyEvent.length()));
final Model modelFirst = new Model(innerModel);
modelFirst.replace(1, textForFirst);
final Model modelMiddle = new Model(innerModel);
modelMiddle.replace(1, textForMiddle);
final Model modelLast = new Model(innerModel);
modelLast.replace(1, textForLast);
return new IterationModels(modelFirst, modelMiddle, modelLast);
}
// At this point, we know the first and last body events are different objects
final Model modelFirst = new Model(innerModel);
final Model modelMiddle = new Model(innerModel);
final Model modelLast = new Model(innerModel);
if (firstBodyEventCutPoint > 0) {
final Text headTextForMiddleAndMax = new Text(firstTextBodyEvent.subSequence(firstBodyEventCutPoint, firstTextBodyEvent.length()));
modelMiddle.replace(1, headTextForMiddleAndMax);
modelLast.replace(1, headTextForMiddleAndMax);
}
if (lastBodyEventCutPoint < lastTextBodyEvent.length()) {
final Text tailTextForFirstAndMiddle = new Text(lastTextBodyEvent.subSequence(0, lastBodyEventCutPoint));
modelFirst.replace(gatheredModelSize - 2, tailTextForFirstAndMiddle);
modelMiddle.replace(gatheredModelSize - 2, tailTextForFirstAndMiddle);
}
return new IterationModels(modelFirst, modelMiddle, modelLast);
} }
|
public class class_name {
private IterationModels computeIterationModels(final IterationWhiteSpaceHandling iterationWhiteSpaceHandling) {
/*
* Nothing to iterate
*/
if (iterationWhiteSpaceHandling == IterationWhiteSpaceHandling.ZERO_ITER) {
return IterationModels.EMPTY; // depends on control dependency: [if], data = [none]
}
/*
* Get the originally gathered model. This will serve as a base for any needed modifications
*/
final Model innerModel = getInnerModel();
final int gatheredModelSize = innerModel.size();
/*
* If there is only one iteration, we need to perform no modifications at all, whichever the template mode
*/
if (iterationWhiteSpaceHandling == IterationWhiteSpaceHandling.SINGLE_ITER) {
return new IterationModels(innerModel, innerModel, innerModel); // depends on control dependency: [if], data = [none]
}
/*
* If template mode is a markup one, we will only need to take care of the existence of a preceding white space
*/
if (!this.templateMode.isText()) {
if (this.precedingWhitespace != null) {
final Model modelWithWhiteSpace = new Model(innerModel);
modelWithWhiteSpace.insert(0, this.precedingWhitespace); // depends on control dependency: [if], data = [none]
return new IterationModels(innerModel, modelWithWhiteSpace, modelWithWhiteSpace); // depends on control dependency: [if], data = [none]
}
return new IterationModels(innerModel, innerModel, innerModel); // depends on control dependency: [if], data = [none]
}
/*
* We are in a textual template mode, and it might be possible to fiddle a bit with whitespaces at the beginning
* and end of the body, so that iterations look better.
*
* The goal is that this:
* ---------------------
* List:
* [# th:each="i : ${items}"]
* - [[${i}]]
* [/]
* ---------------------
* ...doesn't look like:
* ---------------------
* List:
*
* - [[${i}]]
*
* - [[${i}]]
*
* - [[${i}]]
* ---------------------
* ...but instead like:
* ---------------------
* List:
*
* - [[${i}]]
* - [[${i}]]
* - [[${i}]]
* ---------------------
* And in order to do this, the steps to be taken will be:
*
* - Check that the iterated block starts with an 'open element' and ends with a 'close element'. If not,
* don't apply any of this.
* - Except for the first iteration, remove all whitespace after the 'open element', until the
* first '\n' (and remove that too).
* - Except for the last iteration, remove all whitespace after the last '\n' (not including it) and before
* the 'close element'.
*/
if (innerModel.size() <= 2) {
// This does only contain the template open + close events -- nothing to be done
return new IterationModels(innerModel, innerModel, innerModel); // depends on control dependency: [if], data = [none]
}
int firstBodyEventCutPoint = -1;
int lastBodyEventCutPoint = -1;
final ITemplateEvent firstBodyEvent = innerModel.get(1); // we know there is at least one body event
Text firstTextBodyEvent = null;
if (innerModel.get(0) instanceof OpenElementTag && firstBodyEvent instanceof IText) {
firstTextBodyEvent = Text.asEngineText((IText)firstBodyEvent); // depends on control dependency: [if], data = [none]
final int firstTextEventLen = firstTextBodyEvent.length();
int i = 0;
char c;
while (i < firstTextEventLen && firstBodyEventCutPoint < 0) {
c = firstTextBodyEvent.charAt(i); // depends on control dependency: [while], data = [(i]
if (c == '\n') {
firstBodyEventCutPoint = i + 1; // depends on control dependency: [if], data = [none]
break; // we've already assigned the value we were looking for
} else if (Character.isWhitespace(c)) {
i++; // depends on control dependency: [if], data = [none]
continue;
} else {
// We will not be able to perform any whitespace reduction here
break;
}
}
}
final ITemplateEvent lastBodyEvent = innerModel.get(gatheredModelSize - 2);
Text lastTextBodyEvent = null;
if (firstBodyEventCutPoint >= 0 &&
innerModel.get(gatheredModelSize - 1) instanceof CloseElementTag && lastBodyEvent instanceof IText) {
lastTextBodyEvent = Text.asEngineText((IText)lastBodyEvent); // depends on control dependency: [if], data = [none]
final int lastTextEventLen = lastTextBodyEvent.length();
int i = lastTextEventLen - 1;
char c;
while (i >= 0 && lastBodyEventCutPoint < 0) {
c = lastTextBodyEvent.charAt(i); // depends on control dependency: [while], data = [(i]
if (c == '\n') {
lastBodyEventCutPoint = i + 1; // depends on control dependency: [if], data = [none]
break; // we've already assigned the value we were looking for
} else if (Character.isWhitespace(c)) {
i--; // depends on control dependency: [if], data = [none]
continue;
} else {
// We will not be able to perform any whitespace reduction here
break;
}
}
}
/*
* If there is no reason to perform any modifications, just use the gathered model
*/
if (firstBodyEventCutPoint < 0 || lastBodyEventCutPoint < 0) {
// We don't have the scenario required for performing the needed whitespace collapsing operation
return new IterationModels(innerModel, innerModel, innerModel); // depends on control dependency: [if], data = [none]
}
/*
* At this point, we are sure that we will want to perform modifications on the first/last whitespaces
*/
if (firstBodyEvent == lastBodyEvent) {
// If the first and the last event are actually the same, we need to take better care of how we manage whitespace
final Text textForFirst = new Text(firstTextBodyEvent.subSequence(0, lastBodyEventCutPoint));
final Text textForMiddle = new Text(firstTextBodyEvent.subSequence(firstBodyEventCutPoint, lastBodyEventCutPoint));
final Text textForLast = new Text(firstTextBodyEvent.subSequence(firstBodyEventCutPoint, firstTextBodyEvent.length()));
final Model modelFirst = new Model(innerModel);
modelFirst.replace(1, textForFirst); // depends on control dependency: [if], data = [none]
final Model modelMiddle = new Model(innerModel);
modelMiddle.replace(1, textForMiddle); // depends on control dependency: [if], data = [none]
final Model modelLast = new Model(innerModel);
modelLast.replace(1, textForLast); // depends on control dependency: [if], data = [none]
return new IterationModels(modelFirst, modelMiddle, modelLast); // depends on control dependency: [if], data = [none]
}
// At this point, we know the first and last body events are different objects
final Model modelFirst = new Model(innerModel);
final Model modelMiddle = new Model(innerModel);
final Model modelLast = new Model(innerModel);
if (firstBodyEventCutPoint > 0) {
final Text headTextForMiddleAndMax = new Text(firstTextBodyEvent.subSequence(firstBodyEventCutPoint, firstTextBodyEvent.length()));
modelMiddle.replace(1, headTextForMiddleAndMax); // depends on control dependency: [if], data = [none]
modelLast.replace(1, headTextForMiddleAndMax); // depends on control dependency: [if], data = [none]
}
if (lastBodyEventCutPoint < lastTextBodyEvent.length()) {
final Text tailTextForFirstAndMiddle = new Text(lastTextBodyEvent.subSequence(0, lastBodyEventCutPoint));
modelFirst.replace(gatheredModelSize - 2, tailTextForFirstAndMiddle); // depends on control dependency: [if], data = [none]
modelMiddle.replace(gatheredModelSize - 2, tailTextForFirstAndMiddle); // depends on control dependency: [if], data = [none]
}
return new IterationModels(modelFirst, modelMiddle, modelLast);
} }
|
public class class_name {
public void addAll( List<T> list ) {
if( list.isEmpty() )
return;
Element<T> a = requestNew();
a.object = list.get(0);
if( first == null ) {
first = a;
} else if( last != null ) {
last.next = a;
a.previous = last;
}
for (int i = 1; i < list.size(); i++) {
Element<T> b = requestNew();
b.object = list.get(i);
a.next = b;
b.previous = a;
a = b;
}
last = a;
size += list.size();
} }
|
public class class_name {
public void addAll( List<T> list ) {
if( list.isEmpty() )
return;
Element<T> a = requestNew();
a.object = list.get(0);
if( first == null ) {
first = a; // depends on control dependency: [if], data = [none]
} else if( last != null ) {
last.next = a; // depends on control dependency: [if], data = [none]
a.previous = last; // depends on control dependency: [if], data = [none]
}
for (int i = 1; i < list.size(); i++) {
Element<T> b = requestNew();
b.object = list.get(i); // depends on control dependency: [for], data = [i]
a.next = b; // depends on control dependency: [for], data = [none]
b.previous = a; // depends on control dependency: [for], data = [none]
a = b; // depends on control dependency: [for], data = [none]
}
last = a;
size += list.size();
} }
|
public class class_name {
private void processToUnicode(){
PdfObject toUni = fontDic.get(PdfName.TOUNICODE);
if (toUni != null){
try {
byte[] touni = PdfReader.getStreamBytes((PRStream)PdfReader.getPdfObjectRelease(toUni));
CMapParser cmapParser = new CMapParser();
toUnicodeCmap = cmapParser.parse(new ByteArrayInputStream(touni));
} catch (IOException e) {
throw new Error("Unable to process ToUnicode map - " + e.getMessage(), e);
}
}
} }
|
public class class_name {
private void processToUnicode(){
PdfObject toUni = fontDic.get(PdfName.TOUNICODE);
if (toUni != null){
try {
byte[] touni = PdfReader.getStreamBytes((PRStream)PdfReader.getPdfObjectRelease(toUni));
CMapParser cmapParser = new CMapParser();
toUnicodeCmap = cmapParser.parse(new ByteArrayInputStream(touni));
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new Error("Unable to process ToUnicode map - " + e.getMessage(), e);
}
// depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public EqualsVerifierReport report() {
try {
performVerification();
return EqualsVerifierReport.SUCCESS;
}
catch (MessagingException e) {
return new EqualsVerifierReport(false, buildErrorMessage(e.getDescription()), e);
}
catch (Throwable e) {
return new EqualsVerifierReport(false, buildErrorMessage(e.getMessage()), e);
}
} }
|
public class class_name {
public EqualsVerifierReport report() {
try {
performVerification(); // depends on control dependency: [try], data = [none]
return EqualsVerifierReport.SUCCESS; // depends on control dependency: [try], data = [none]
}
catch (MessagingException e) {
return new EqualsVerifierReport(false, buildErrorMessage(e.getDescription()), e);
} // depends on control dependency: [catch], data = [none]
catch (Throwable e) {
return new EqualsVerifierReport(false, buildErrorMessage(e.getMessage()), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private String ifNull(int rowIndex){
if(params.length != 2){
throw new IllegalArgumentException("Wrong number of Parameters for if null expression");
}
final RecordList.Record currentRecord = recordList.getRecords().get(rowIndex);
final String field1 = currentRecord.getValueByFieldName(params[0]);
if (!field1.isEmpty()){
return field1;
}
final String field2 = currentRecord.getValueByFieldName(params[1]);
return field2;
} }
|
public class class_name {
private String ifNull(int rowIndex){
if(params.length != 2){
throw new IllegalArgumentException("Wrong number of Parameters for if null expression");
}
final RecordList.Record currentRecord = recordList.getRecords().get(rowIndex);
final String field1 = currentRecord.getValueByFieldName(params[0]);
if (!field1.isEmpty()){
return field1; // depends on control dependency: [if], data = [none]
}
final String field2 = currentRecord.getValueByFieldName(params[1]);
return field2;
} }
|
public class class_name {
JavaArchive createWarpArchive() {
JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "arquillian-warp.jar");
// API
archive.addClass(Inspection.class);
archive.addClasses(BeforeServlet.class, AfterServlet.class);
for (String packageName : REQUIRED_WARP_PACKAGES) {
archive.addPackage(packageName);
}
archive.addAsManifestResource(getWebFragmentAsset(), "web-fragment.xml");
archive.addClasses(REQUIRED_WARP_INNER_CLASSES);
// register remote extension
archive.addClass(WarpRemoteExtension.class);
archive.addAsServiceProvider(RemoteLoadableExtension.class.getName(), WarpRemoteExtension.class.getName(),
"!org.jboss.arquillian.protocol.servlet.runner.ServletRemoteExtension");
archive.addAsServiceProvider(LifecycleManagerStore.class, LifecycleManagerStoreImpl.class);
// register RequestProcessingDelegationService
archive.addAsServiceProvider(RequestDelegationService.class, CommandBusOnServer.class);
return archive;
} }
|
public class class_name {
JavaArchive createWarpArchive() {
JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "arquillian-warp.jar");
// API
archive.addClass(Inspection.class);
archive.addClasses(BeforeServlet.class, AfterServlet.class);
for (String packageName : REQUIRED_WARP_PACKAGES) {
archive.addPackage(packageName); // depends on control dependency: [for], data = [packageName]
}
archive.addAsManifestResource(getWebFragmentAsset(), "web-fragment.xml");
archive.addClasses(REQUIRED_WARP_INNER_CLASSES);
// register remote extension
archive.addClass(WarpRemoteExtension.class);
archive.addAsServiceProvider(RemoteLoadableExtension.class.getName(), WarpRemoteExtension.class.getName(),
"!org.jboss.arquillian.protocol.servlet.runner.ServletRemoteExtension");
archive.addAsServiceProvider(LifecycleManagerStore.class, LifecycleManagerStoreImpl.class);
// register RequestProcessingDelegationService
archive.addAsServiceProvider(RequestDelegationService.class, CommandBusOnServer.class);
return archive;
} }
|
public class class_name {
protected void updateActionForInterimTarget(Action action) {
// find an interim target position
PointF scrollVector = computeScrollVectorForPosition(getTargetPosition());
if (scrollVector == null || (scrollVector.x == 0 && scrollVector.y == 0)) {
Log.e(TAG, "To support smooth scrolling, you should override \n"
+ "LayoutManager#computeScrollVectorForPosition.\n"
+ "Falling back to instant scroll");
final int target = getTargetPosition();
stop();
instantScrollToPosition(target);
return;
}
normalize(scrollVector);
mTargetVector = scrollVector;
mInterimTargetDx = (int) (TARGET_SEEK_SCROLL_DISTANCE_PX * scrollVector.x);
mInterimTargetDy = (int) (TARGET_SEEK_SCROLL_DISTANCE_PX * scrollVector.y);
final int time = calculateTimeForScrolling(TARGET_SEEK_SCROLL_DISTANCE_PX);
// To avoid UI hiccups, trigger a smooth scroll to a distance little further than the
// interim target. Since we track the distance travelled in onSeekTargetStep callback, it
// won't actually scroll more than what we need.
action.update((int) (mInterimTargetDx * TARGET_SEEK_EXTRA_SCROLL_RATIO)
, (int) (mInterimTargetDy * TARGET_SEEK_EXTRA_SCROLL_RATIO)
, (int) (time * TARGET_SEEK_EXTRA_SCROLL_RATIO), mLinearInterpolator);
} }
|
public class class_name {
protected void updateActionForInterimTarget(Action action) {
// find an interim target position
PointF scrollVector = computeScrollVectorForPosition(getTargetPosition());
if (scrollVector == null || (scrollVector.x == 0 && scrollVector.y == 0)) {
Log.e(TAG, "To support smooth scrolling, you should override \n"
+ "LayoutManager#computeScrollVectorForPosition.\n"
+ "Falling back to instant scroll"); // depends on control dependency: [if], data = [none]
final int target = getTargetPosition();
stop(); // depends on control dependency: [if], data = [none]
instantScrollToPosition(target); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
normalize(scrollVector);
mTargetVector = scrollVector;
mInterimTargetDx = (int) (TARGET_SEEK_SCROLL_DISTANCE_PX * scrollVector.x);
mInterimTargetDy = (int) (TARGET_SEEK_SCROLL_DISTANCE_PX * scrollVector.y);
final int time = calculateTimeForScrolling(TARGET_SEEK_SCROLL_DISTANCE_PX);
// To avoid UI hiccups, trigger a smooth scroll to a distance little further than the
// interim target. Since we track the distance travelled in onSeekTargetStep callback, it
// won't actually scroll more than what we need.
action.update((int) (mInterimTargetDx * TARGET_SEEK_EXTRA_SCROLL_RATIO)
, (int) (mInterimTargetDy * TARGET_SEEK_EXTRA_SCROLL_RATIO)
, (int) (time * TARGET_SEEK_EXTRA_SCROLL_RATIO), mLinearInterpolator);
} }
|
public class class_name {
public static JoinNode reconstructJoinTreeFromSubTrees(List<JoinNode> subTrees) {
if (subTrees == null || subTrees.isEmpty()) {
return null;
}
// Reconstruct the tree. The first element is the first sub-tree and so on
JoinNode joinNode = subTrees.get(0);
for (int i = 1; i < subTrees.size(); ++i) {
JoinNode nextNode = subTrees.get(i);
boolean replaced = joinNode.replaceChild(nextNode);
// There must be a node in the current tree to be replaced
assert(replaced);
}
return joinNode;
} }
|
public class class_name {
public static JoinNode reconstructJoinTreeFromSubTrees(List<JoinNode> subTrees) {
if (subTrees == null || subTrees.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
// Reconstruct the tree. The first element is the first sub-tree and so on
JoinNode joinNode = subTrees.get(0);
for (int i = 1; i < subTrees.size(); ++i) {
JoinNode nextNode = subTrees.get(i);
boolean replaced = joinNode.replaceChild(nextNode);
// There must be a node in the current tree to be replaced
assert(replaced); // depends on control dependency: [for], data = [none]
}
return joinNode;
} }
|
public class class_name {
public String getHostName() {
String hostName = mHostName;
try {
// ZAP: fixed cases, where host name is null
hostName = ((mUri.getHost() != null) ? mUri.getHost() : mHostName);
} catch (URIException e) {
if (log.isDebugEnabled()) {
log.warn(e);
}
}
return hostName;
} }
|
public class class_name {
public String getHostName() {
String hostName = mHostName;
try {
// ZAP: fixed cases, where host name is null
hostName = ((mUri.getHost() != null) ? mUri.getHost() : mHostName);
// depends on control dependency: [try], data = [none]
} catch (URIException e) {
if (log.isDebugEnabled()) {
log.warn(e);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
return hostName;
} }
|
public class class_name {
public void enter(@NonNull ID id, boolean withAnimation) {
if (GestureDebug.isDebugAnimator()) {
Log.d(TAG, "Enter requested for " + id + ", with animation = " + withAnimation);
}
enterWithAnimation = withAnimation;
request(id);
} }
|
public class class_name {
public void enter(@NonNull ID id, boolean withAnimation) {
if (GestureDebug.isDebugAnimator()) {
Log.d(TAG, "Enter requested for " + id + ", with animation = " + withAnimation); // depends on control dependency: [if], data = [none]
}
enterWithAnimation = withAnimation;
request(id);
} }
|
public class class_name {
public static String getTopActivityPackageName(Context context) {
ComponentName activity = getTopActivity(context);
if (activity == null) {
return null;
}
return activity.getPackageName();
} }
|
public class class_name {
public static String getTopActivityPackageName(Context context) {
ComponentName activity = getTopActivity(context);
if (activity == null) {
return null; // depends on control dependency: [if], data = [none]
}
return activity.getPackageName();
} }
|
public class class_name {
public synchronized Set<Service> getServices() {
checkInitialized();
if (legacyChanged || servicesChanged) {
serviceSet = null;
}
if (serviceSet == null) {
ensureLegacyParsed();
Set<Service> set = new LinkedHashSet<>();
if (serviceMap != null) {
set.addAll(serviceMap.values());
}
if (legacyMap != null) {
set.addAll(legacyMap.values());
}
serviceSet = Collections.unmodifiableSet(set);
servicesChanged = false;
}
return serviceSet;
} }
|
public class class_name {
public synchronized Set<Service> getServices() {
checkInitialized();
if (legacyChanged || servicesChanged) {
serviceSet = null; // depends on control dependency: [if], data = [none]
}
if (serviceSet == null) {
ensureLegacyParsed(); // depends on control dependency: [if], data = [none]
Set<Service> set = new LinkedHashSet<>();
if (serviceMap != null) {
set.addAll(serviceMap.values()); // depends on control dependency: [if], data = [(serviceMap]
}
if (legacyMap != null) {
set.addAll(legacyMap.values()); // depends on control dependency: [if], data = [(legacyMap]
}
serviceSet = Collections.unmodifiableSet(set); // depends on control dependency: [if], data = [none]
servicesChanged = false; // depends on control dependency: [if], data = [none]
}
return serviceSet;
} }
|
public class class_name {
private void initExpressions()
{
expressions = new LinkedList<>();
for (UriTemplateComponent c : components)
{
if (c instanceof Expression)
{
expressions.add((Expression) c);
}
}
} }
|
public class class_name {
private void initExpressions()
{
expressions = new LinkedList<>();
for (UriTemplateComponent c : components)
{
if (c instanceof Expression)
{
expressions.add((Expression) c); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
char generateStandInFor(Object obj) {
// assert(obj != null);
// Look up previous stand-in, if any. This is a short list
// (typical n is 0, 1, or 2); linear search is optimal.
for (int i=0; i<variablesVector.size(); ++i) {
if (variablesVector.get(i) == obj) { // [sic] pointer comparison
return (char) (curData.variablesBase + i);
}
}
if (variableNext >= variableLimit) {
throw new RuntimeException("Variable range exhausted");
}
variablesVector.add(obj);
return variableNext++;
} }
|
public class class_name {
char generateStandInFor(Object obj) {
// assert(obj != null);
// Look up previous stand-in, if any. This is a short list
// (typical n is 0, 1, or 2); linear search is optimal.
for (int i=0; i<variablesVector.size(); ++i) {
if (variablesVector.get(i) == obj) { // [sic] pointer comparison
return (char) (curData.variablesBase + i); // depends on control dependency: [if], data = [none]
}
}
if (variableNext >= variableLimit) {
throw new RuntimeException("Variable range exhausted");
}
variablesVector.add(obj);
return variableNext++;
} }
|
public class class_name {
public Matrix plus(Matrix B)
{
checkMatrixDimensions(B);
Matrix X = new Matrix(m, n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
C[i][j] = A[i][j] + B.A[i][j];
}
}
return X;
} }
|
public class class_name {
public Matrix plus(Matrix B)
{
checkMatrixDimensions(B);
Matrix X = new Matrix(m, n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
C[i][j] = A[i][j] + B.A[i][j]; // depends on control dependency: [for], data = [j]
}
}
return X;
} }
|
public class class_name {
protected IObjectPickler getCustomPickler(Class<?> t) {
IObjectPickler pickler = customPicklers.get(t);
if(pickler!=null) {
return pickler; // exact match
}
// check if there's a custom pickler registered for an interface or abstract base class
// that this object implements or inherits from.
for(Entry<Class<?>, IObjectPickler> x: customPicklers.entrySet()) {
if(x.getKey().isAssignableFrom(t)) {
return x.getValue();
}
}
return null;
} }
|
public class class_name {
protected IObjectPickler getCustomPickler(Class<?> t) {
IObjectPickler pickler = customPicklers.get(t);
if(pickler!=null) {
return pickler; // exact match // depends on control dependency: [if], data = [none]
}
// check if there's a custom pickler registered for an interface or abstract base class
// that this object implements or inherits from.
for(Entry<Class<?>, IObjectPickler> x: customPicklers.entrySet()) {
if(x.getKey().isAssignableFrom(t)) {
return x.getValue(); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public <R> BaasResult<R> execute(Task<R> request) {
try {
R r = request.asyncCall();
return BaasResult.success(r);
} catch (BaasException e) {
return BaasResult.failure(e);
}
} }
|
public class class_name {
public <R> BaasResult<R> execute(Task<R> request) {
try {
R r = request.asyncCall();
return BaasResult.success(r); // depends on control dependency: [try], data = [none]
} catch (BaasException e) {
return BaasResult.failure(e);
} // depends on control dependency: [catch], data = [none]
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.