code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public EClass getListDataValue() {
if (listDataValueEClass == null) {
listDataValueEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(24);
}
return listDataValueEClass;
} } | public class class_name {
@Override
public EClass getListDataValue() {
if (listDataValueEClass == null) {
listDataValueEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(24);
// depends on control dependency: [if], data = [none]
}
return listDataValueEClass;
} } |
public class class_name {
public Element createDefaultXml(CmsObject cms, I_CmsXmlDocument document, Element root, Locale locale) {
Iterator<I_CmsXmlSchemaType> i = m_typeSequence.iterator();
while (i.hasNext()) {
I_CmsXmlSchemaType type = i.next();
for (int j = 0; j < type.getMinOccurs(); j++) {
Element typeElement = type.generateXml(cms, document, root, locale);
// need to check for default value again because of the appinfo "mappings" node
I_CmsXmlContentValue value = type.createValue(document, typeElement, locale);
String defaultValue = document.getHandler().getDefault(cms, value, locale);
if (defaultValue != null) {
// only if there is a default value available use it to overwrite the initial default
value.setStringValue(cms, defaultValue);
}
}
}
return root;
} } | public class class_name {
public Element createDefaultXml(CmsObject cms, I_CmsXmlDocument document, Element root, Locale locale) {
Iterator<I_CmsXmlSchemaType> i = m_typeSequence.iterator();
while (i.hasNext()) {
I_CmsXmlSchemaType type = i.next();
for (int j = 0; j < type.getMinOccurs(); j++) {
Element typeElement = type.generateXml(cms, document, root, locale);
// need to check for default value again because of the appinfo "mappings" node
I_CmsXmlContentValue value = type.createValue(document, typeElement, locale);
String defaultValue = document.getHandler().getDefault(cms, value, locale);
if (defaultValue != null) {
// only if there is a default value available use it to overwrite the initial default
value.setStringValue(cms, defaultValue); // depends on control dependency: [if], data = [none]
}
}
}
return root;
} } |
public class class_name {
public CreateCommitResult withFilesDeleted(FileMetadata... filesDeleted) {
if (this.filesDeleted == null) {
setFilesDeleted(new java.util.ArrayList<FileMetadata>(filesDeleted.length));
}
for (FileMetadata ele : filesDeleted) {
this.filesDeleted.add(ele);
}
return this;
} } | public class class_name {
public CreateCommitResult withFilesDeleted(FileMetadata... filesDeleted) {
if (this.filesDeleted == null) {
setFilesDeleted(new java.util.ArrayList<FileMetadata>(filesDeleted.length)); // depends on control dependency: [if], data = [none]
}
for (FileMetadata ele : filesDeleted) {
this.filesDeleted.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void copyDeploymentValuesToProcessDefinitions(DeploymentEntity deployment,
List<ProcessDefinitionEntity> processDefinitions) {
String engineVersion = deployment.getEngineVersion();
String tenantId = deployment.getTenantId();
String deploymentId = deployment.getId();
for (ProcessDefinitionEntity processDefinition : processDefinitions) {
// Backwards compatibility
if (engineVersion != null) {
processDefinition.setEngineVersion(engineVersion);
}
// process definition inherits the tenant id
if (tenantId != null) {
processDefinition.setTenantId(tenantId);
}
processDefinition.setDeploymentId(deploymentId);
}
} } | public class class_name {
public void copyDeploymentValuesToProcessDefinitions(DeploymentEntity deployment,
List<ProcessDefinitionEntity> processDefinitions) {
String engineVersion = deployment.getEngineVersion();
String tenantId = deployment.getTenantId();
String deploymentId = deployment.getId();
for (ProcessDefinitionEntity processDefinition : processDefinitions) {
// Backwards compatibility
if (engineVersion != null) {
processDefinition.setEngineVersion(engineVersion); // depends on control dependency: [if], data = [(engineVersion]
}
// process definition inherits the tenant id
if (tenantId != null) {
processDefinition.setTenantId(tenantId); // depends on control dependency: [if], data = [(tenantId]
}
processDefinition.setDeploymentId(deploymentId); // depends on control dependency: [for], data = [processDefinition]
}
} } |
public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public RemoteObjectInstance create(Object envEntry) {
Class<?> clazz = envEntry.getClass();
if (clazz.isEnum()) {
return new RemoteObjectInstanceEnumImpl((Class<Enum>) clazz, ((Enum) envEntry).name());
}
return new RemoteObjectInstanceImpl(envEntry);
} } | public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public RemoteObjectInstance create(Object envEntry) {
Class<?> clazz = envEntry.getClass();
if (clazz.isEnum()) {
return new RemoteObjectInstanceEnumImpl((Class<Enum>) clazz, ((Enum) envEntry).name()); // depends on control dependency: [if], data = [none]
}
return new RemoteObjectInstanceImpl(envEntry);
} } |
public class class_name {
public final void streamBufferWithoutGroups(Iterator<IN> iterator, Collector<OUT> c) {
SingleElementPushBackIterator<IN> i = new SingleElementPushBackIterator<>(iterator);
try {
int size;
if (i.hasNext()) {
while (true) {
int sig = in.readInt();
switch (sig) {
case SIGNAL_BUFFER_REQUEST:
if (i.hasNext()) {
size = sender.sendBuffer(i);
sendWriteNotification(size, i.hasNext());
} else {
throw new RuntimeException("External process requested data even though none is available.");
}
break;
case SIGNAL_FINISHED:
return;
case SIGNAL_ERROR:
try {
outPrinter.join();
} catch (InterruptedException e) {
outPrinter.interrupt();
}
try {
errorPrinter.join();
} catch (InterruptedException e) {
errorPrinter.interrupt();
}
throw new RuntimeException(
"External process for task " + function.getRuntimeContext().getTaskName() + " terminated prematurely due to an error." + msg);
default:
receiver.collectBuffer(c, sig);
sendReadConfirmation();
break;
}
}
}
} catch (SocketTimeoutException ignored) {
throw new RuntimeException("External process for task " + function.getRuntimeContext().getTaskName() + " stopped responding." + msg.get());
} catch (Exception e) {
throw new RuntimeException("Critical failure for task " + function.getRuntimeContext().getTaskName() + ". " + msg.get(), e);
}
} } | public class class_name {
public final void streamBufferWithoutGroups(Iterator<IN> iterator, Collector<OUT> c) {
SingleElementPushBackIterator<IN> i = new SingleElementPushBackIterator<>(iterator);
try {
int size;
if (i.hasNext()) {
while (true) {
int sig = in.readInt();
switch (sig) {
case SIGNAL_BUFFER_REQUEST:
if (i.hasNext()) {
size = sender.sendBuffer(i); // depends on control dependency: [if], data = [none]
sendWriteNotification(size, i.hasNext()); // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("External process requested data even though none is available.");
}
break;
case SIGNAL_FINISHED:
return;
case SIGNAL_ERROR:
try {
outPrinter.join(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
outPrinter.interrupt();
} // depends on control dependency: [catch], data = [none]
try {
errorPrinter.join(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
errorPrinter.interrupt();
} // depends on control dependency: [catch], data = [none]
throw new RuntimeException(
"External process for task " + function.getRuntimeContext().getTaskName() + " terminated prematurely due to an error." + msg);
default:
receiver.collectBuffer(c, sig);
sendReadConfirmation();
break;
}
}
}
} catch (SocketTimeoutException ignored) {
throw new RuntimeException("External process for task " + function.getRuntimeContext().getTaskName() + " stopped responding." + msg.get());
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException("Critical failure for task " + function.getRuntimeContext().getTaskName() + ". " + msg.get(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private MediaDetails getCacheMediaDetails() throws IOException {
ZipEntry zipEntry = zipFile.getEntry(CACHE_DETAILS_ENTRY);
if (zipEntry == null) {
return null; // No details available.
}
InputStream is = zipFile.getInputStream(zipEntry);
try {
DataInputStream dis = new DataInputStream(is);
try {
byte[] detailBytes = new byte[(int)zipEntry.getSize()];
dis.readFully(detailBytes);
return new MediaDetails(detailBytes, detailBytes.length);
} finally {
dis.close();
}
} finally {
is.close();
}
} } | public class class_name {
private MediaDetails getCacheMediaDetails() throws IOException {
ZipEntry zipEntry = zipFile.getEntry(CACHE_DETAILS_ENTRY);
if (zipEntry == null) {
return null; // No details available.
}
InputStream is = zipFile.getInputStream(zipEntry);
try {
DataInputStream dis = new DataInputStream(is);
try {
byte[] detailBytes = new byte[(int)zipEntry.getSize()];
dis.readFully(detailBytes); // depends on control dependency: [try], data = [none]
return new MediaDetails(detailBytes, detailBytes.length); // depends on control dependency: [try], data = [none]
} finally {
dis.close();
}
} finally {
is.close();
}
} } |
public class class_name {
@Override
protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
for (val delegate : this.delegates) {
if (delegate.canHandle(request, response)) {
return delegate.handleRequestInternal(request, response);
}
}
return generateErrorView(CasProtocolConstants.ERROR_CODE_INVALID_REQUEST, null);
} } | public class class_name {
@Override
protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
for (val delegate : this.delegates) {
if (delegate.canHandle(request, response)) {
return delegate.handleRequestInternal(request, response); // depends on control dependency: [if], data = [none]
}
}
return generateErrorView(CasProtocolConstants.ERROR_CODE_INVALID_REQUEST, null);
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T extends View> T get(View view, int id) {
SparseArray<View> viewHolder = (SparseArray<View>) view.getTag();
if (viewHolder == null) {
viewHolder = new SparseArray<View>();
view.setTag(viewHolder);
}
View childView = viewHolder.get(id);
if (childView == null) {
childView = view.findViewById(id);
viewHolder.put(id, childView);
}
return (T) childView;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T extends View> T get(View view, int id) {
SparseArray<View> viewHolder = (SparseArray<View>) view.getTag();
if (viewHolder == null) {
viewHolder = new SparseArray<View>(); // depends on control dependency: [if], data = [none]
view.setTag(viewHolder); // depends on control dependency: [if], data = [(viewHolder]
}
View childView = viewHolder.get(id);
if (childView == null) {
childView = view.findViewById(id); // depends on control dependency: [if], data = [none]
viewHolder.put(id, childView); // depends on control dependency: [if], data = [none]
}
return (T) childView;
} } |
public class class_name {
public List<EntityType> resolve(Collection<EntityType> entityTypes) {
if (entityTypes.isEmpty()) {
return emptyList();
}
if (entityTypes.size() == 1) {
return singletonList(entityTypes.iterator().next());
}
// EntityType doesn't have equals/hashcode methods, map to nodes first
// ensure that nodes exist for all dependencies
Set<EntityTypeNode> entityTypeNodes =
entityTypes
.stream()
.map(EntityTypeNode::new)
.flatMap(
node -> Stream.concat(Stream.of(node), expandEntityTypeDependencies(node).stream()))
.collect(toCollection(HashSet::new));
// Sort nodes based on dependencies
List<EntityTypeNode> resolvedEntityMetaNodes =
genericDependencyResolver.resolve(entityTypeNodes, getDependencies());
// Map nodes back to EntityType
List<EntityType> resolvedEntityMetas =
resolvedEntityMetaNodes.stream().map(EntityTypeNode::getEntityType).collect(toList());
// getDependencies might have included items that are not in the input list, remove additional
// items
if (resolvedEntityMetas.size() == entityTypes.size()) {
return resolvedEntityMetas;
} else {
Map<String, EntityType> entityTypeMap =
entityTypes.stream().collect(toMap(EntityType::getId, Function.identity()));
return resolvedEntityMetas
.stream()
.filter(resolvedEntityMeta -> entityTypeMap.containsKey(resolvedEntityMeta.getId()))
.collect(toList());
}
} } | public class class_name {
public List<EntityType> resolve(Collection<EntityType> entityTypes) {
if (entityTypes.isEmpty()) {
return emptyList(); // depends on control dependency: [if], data = [none]
}
if (entityTypes.size() == 1) {
return singletonList(entityTypes.iterator().next()); // depends on control dependency: [if], data = [none]
}
// EntityType doesn't have equals/hashcode methods, map to nodes first
// ensure that nodes exist for all dependencies
Set<EntityTypeNode> entityTypeNodes =
entityTypes
.stream()
.map(EntityTypeNode::new)
.flatMap(
node -> Stream.concat(Stream.of(node), expandEntityTypeDependencies(node).stream()))
.collect(toCollection(HashSet::new));
// Sort nodes based on dependencies
List<EntityTypeNode> resolvedEntityMetaNodes =
genericDependencyResolver.resolve(entityTypeNodes, getDependencies());
// Map nodes back to EntityType
List<EntityType> resolvedEntityMetas =
resolvedEntityMetaNodes.stream().map(EntityTypeNode::getEntityType).collect(toList());
// getDependencies might have included items that are not in the input list, remove additional
// items
if (resolvedEntityMetas.size() == entityTypes.size()) {
return resolvedEntityMetas; // depends on control dependency: [if], data = [none]
} else {
Map<String, EntityType> entityTypeMap =
entityTypes.stream().collect(toMap(EntityType::getId, Function.identity()));
return resolvedEntityMetas
.stream()
.filter(resolvedEntityMeta -> entityTypeMap.containsKey(resolvedEntityMeta.getId()))
.collect(toList()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void addExecutionGoals(MavenPluginExecutionDescriptor executionDescriptor, PluginExecution pluginExecution, Store store) {
List<String> goals = pluginExecution.getGoals();
for (String goal : goals) {
MavenExecutionGoalDescriptor goalDescriptor = store.create(MavenExecutionGoalDescriptor.class);
goalDescriptor.setName(goal);
executionDescriptor.getGoals().add(goalDescriptor);
}
} } | public class class_name {
private void addExecutionGoals(MavenPluginExecutionDescriptor executionDescriptor, PluginExecution pluginExecution, Store store) {
List<String> goals = pluginExecution.getGoals();
for (String goal : goals) {
MavenExecutionGoalDescriptor goalDescriptor = store.create(MavenExecutionGoalDescriptor.class);
goalDescriptor.setName(goal); // depends on control dependency: [for], data = [goal]
executionDescriptor.getGoals().add(goalDescriptor); // depends on control dependency: [for], data = [goal]
}
} } |
public class class_name {
public int getCardinality() {
int cardinality = 1;
for (FieldPartitioner fieldPartitioner : fieldPartitioners) {
if (fieldPartitioner.getCardinality() == FieldPartitioner.UNKNOWN_CARDINALITY) {
return FieldPartitioner.UNKNOWN_CARDINALITY;
}
cardinality *= fieldPartitioner.getCardinality();
}
return cardinality;
} } | public class class_name {
public int getCardinality() {
int cardinality = 1;
for (FieldPartitioner fieldPartitioner : fieldPartitioners) {
if (fieldPartitioner.getCardinality() == FieldPartitioner.UNKNOWN_CARDINALITY) {
return FieldPartitioner.UNKNOWN_CARDINALITY; // depends on control dependency: [if], data = [none]
}
cardinality *= fieldPartitioner.getCardinality(); // depends on control dependency: [for], data = [fieldPartitioner]
}
return cardinality;
} } |
public class class_name {
public void setReplicationGroup(java.util.Collection<Replica> replicationGroup) {
if (replicationGroup == null) {
this.replicationGroup = null;
return;
}
this.replicationGroup = new java.util.ArrayList<Replica>(replicationGroup);
} } | public class class_name {
public void setReplicationGroup(java.util.Collection<Replica> replicationGroup) {
if (replicationGroup == null) {
this.replicationGroup = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.replicationGroup = new java.util.ArrayList<Replica>(replicationGroup);
} } |
public class class_name {
@Override
public Object convertToType(ELContext context,
Object obj,
Class<?> targetType) {
context.setPropertyResolved(false);
Object value = null;
for (int i = 0; i < size; i++) {
value = elResolvers[i].convertToType(context, obj, targetType);
if (context.isPropertyResolved()) {
return value;
}
}
return null;
} } | public class class_name {
@Override
public Object convertToType(ELContext context,
Object obj,
Class<?> targetType) {
context.setPropertyResolved(false);
Object value = null;
for (int i = 0; i < size; i++) {
value = elResolvers[i].convertToType(context, obj, targetType); // depends on control dependency: [for], data = [i]
if (context.isPropertyResolved()) {
return value; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private void ensureRowIsVisible(int nRow) {
Rectangle visibleRect = jtable.getCellRect(nRow, 0, true);
if (visibleRect != null) {
visibleRect.x = scrollPane.getViewport().getViewPosition().x;
jtable.scrollRectToVisible(visibleRect);
jtable.repaint();
}
} } | public class class_name {
private void ensureRowIsVisible(int nRow) {
Rectangle visibleRect = jtable.getCellRect(nRow, 0, true);
if (visibleRect != null) {
visibleRect.x = scrollPane.getViewport().getViewPosition().x; // depends on control dependency: [if], data = [none]
jtable.scrollRectToVisible(visibleRect); // depends on control dependency: [if], data = [(visibleRect]
jtable.repaint(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static List<? extends CmsPrincipal> filterCoreFlag(List<? extends CmsPrincipal> principals, int flag) {
Iterator<? extends CmsPrincipal> it = principals.iterator();
while (it.hasNext()) {
CmsPrincipal p = it.next();
if ((p.getFlags() > I_CmsPrincipal.FLAG_CORE_LIMIT) && ((p.getFlags() & flag) != flag)) {
it.remove();
}
}
return principals;
} } | public class class_name {
public static List<? extends CmsPrincipal> filterCoreFlag(List<? extends CmsPrincipal> principals, int flag) {
Iterator<? extends CmsPrincipal> it = principals.iterator();
while (it.hasNext()) {
CmsPrincipal p = it.next();
if ((p.getFlags() > I_CmsPrincipal.FLAG_CORE_LIMIT) && ((p.getFlags() & flag) != flag)) {
it.remove(); // depends on control dependency: [if], data = [none]
}
}
return principals;
} } |
public class class_name {
public boolean close() {
List t = (List)((ArrayList)windows).clone();
Iterator e = t.iterator();
while (e.hasNext()) {
ApplicationWindow window = (ApplicationWindow)e.next();
if (!window.close()) { return false; }
}
if (subManagers != null) {
e = subManagers.iterator();
while (e.hasNext()) {
WindowManager wm = (WindowManager)e.next();
if (!wm.close()) { return false; }
}
}
return true;
} } | public class class_name {
public boolean close() {
List t = (List)((ArrayList)windows).clone();
Iterator e = t.iterator();
while (e.hasNext()) {
ApplicationWindow window = (ApplicationWindow)e.next();
if (!window.close()) { return false; } // depends on control dependency: [if], data = [none]
}
if (subManagers != null) {
e = subManagers.iterator(); // depends on control dependency: [if], data = [none]
while (e.hasNext()) {
WindowManager wm = (WindowManager)e.next();
if (!wm.close()) { return false; } // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public CreateCommitResult withFilesAdded(FileMetadata... filesAdded) {
if (this.filesAdded == null) {
setFilesAdded(new java.util.ArrayList<FileMetadata>(filesAdded.length));
}
for (FileMetadata ele : filesAdded) {
this.filesAdded.add(ele);
}
return this;
} } | public class class_name {
public CreateCommitResult withFilesAdded(FileMetadata... filesAdded) {
if (this.filesAdded == null) {
setFilesAdded(new java.util.ArrayList<FileMetadata>(filesAdded.length)); // depends on control dependency: [if], data = [none]
}
for (FileMetadata ele : filesAdded) {
this.filesAdded.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public String getLabel(String path) {
if (labelGenerator != null) {
return labelGenerator.getLabelForPath(path).toString();
}
if (fileNameMap != null && fileNameMap.containsKey(path))
return fileNameMap.get(path);
return (new File(path)).getParentFile().getName();
} } | public class class_name {
public String getLabel(String path) {
if (labelGenerator != null) {
return labelGenerator.getLabelForPath(path).toString(); // depends on control dependency: [if], data = [none]
}
if (fileNameMap != null && fileNameMap.containsKey(path))
return fileNameMap.get(path);
return (new File(path)).getParentFile().getName();
} } |
public class class_name {
protected void update (Map<Integer, SceneBlock> blocks)
{
boolean recover = false;
// link up to our neighbors
for (int ii = 0; ii < DX.length; ii++) {
SceneBlock neigh = blocks.get(neighborKey(DX[ii], DY[ii]));
if (neigh != _neighbors[ii]) {
_neighbors[ii] = neigh;
// if we're linking up to a neighbor for the first time;
// we need to recalculate our coverage
recover = recover || (neigh != null);
// Log.info(this + " was introduced to " + neigh + ".");
}
}
// if we need to regenerate the set of tiles covered by our
// objects, do so
if (recover) {
for (SceneObject _object : _objects) {
setCovered(blocks, _object);
}
}
} } | public class class_name {
protected void update (Map<Integer, SceneBlock> blocks)
{
boolean recover = false;
// link up to our neighbors
for (int ii = 0; ii < DX.length; ii++) {
SceneBlock neigh = blocks.get(neighborKey(DX[ii], DY[ii]));
if (neigh != _neighbors[ii]) {
_neighbors[ii] = neigh; // depends on control dependency: [if], data = [none]
// if we're linking up to a neighbor for the first time;
// we need to recalculate our coverage
recover = recover || (neigh != null); // depends on control dependency: [if], data = [(neigh]
// Log.info(this + " was introduced to " + neigh + ".");
}
}
// if we need to regenerate the set of tiles covered by our
// objects, do so
if (recover) {
for (SceneObject _object : _objects) {
setCovered(blocks, _object); // depends on control dependency: [for], data = [_object]
}
}
} } |
public class class_name {
public synchronized static AdHocCompilerCache getCacheForCatalogHash(byte[] catalogHash) {
String hashString = Encoder.hexEncode(catalogHash);
AdHocCompilerCache cache = m_catalogHashMatch.getIfPresent(hashString);
if (cache == null) {
cache = new AdHocCompilerCache();
m_catalogHashMatch.put(hashString, cache);
}
return cache;
} } | public class class_name {
public synchronized static AdHocCompilerCache getCacheForCatalogHash(byte[] catalogHash) {
String hashString = Encoder.hexEncode(catalogHash);
AdHocCompilerCache cache = m_catalogHashMatch.getIfPresent(hashString);
if (cache == null) {
cache = new AdHocCompilerCache(); // depends on control dependency: [if], data = [none]
m_catalogHashMatch.put(hashString, cache); // depends on control dependency: [if], data = [none]
}
return cache;
} } |
public class class_name {
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> takeLast(int count) {
if (count < 0) {
throw new IndexOutOfBoundsException("count >= 0 required but it was " + count);
} else
if (count == 0) {
return RxJavaPlugins.onAssembly(new FlowableIgnoreElements<T>(this));
} else
if (count == 1) {
return RxJavaPlugins.onAssembly(new FlowableTakeLastOne<T>(this));
}
return RxJavaPlugins.onAssembly(new FlowableTakeLast<T>(this, count));
} } | public class class_name {
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> takeLast(int count) {
if (count < 0) {
throw new IndexOutOfBoundsException("count >= 0 required but it was " + count);
} else
if (count == 0) {
return RxJavaPlugins.onAssembly(new FlowableIgnoreElements<T>(this)); // depends on control dependency: [if], data = [none]
} else
if (count == 1) {
return RxJavaPlugins.onAssembly(new FlowableTakeLastOne<T>(this)); // depends on control dependency: [if], data = [none]
}
return RxJavaPlugins.onAssembly(new FlowableTakeLast<T>(this, count));
} } |
public class class_name {
public void setClusterLogging(java.util.Collection<LogSetup> clusterLogging) {
if (clusterLogging == null) {
this.clusterLogging = null;
return;
}
this.clusterLogging = new java.util.ArrayList<LogSetup>(clusterLogging);
} } | public class class_name {
public void setClusterLogging(java.util.Collection<LogSetup> clusterLogging) {
if (clusterLogging == null) {
this.clusterLogging = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.clusterLogging = new java.util.ArrayList<LogSetup>(clusterLogging);
} } |
public class class_name {
public void getPlanNodeList_recurse(ArrayList<AbstractPlanNode> collected,
HashSet<AbstractPlanNode> visited) {
if (visited.contains(this)) {
assert(false): "do not expect loops in plangraph.";
return;
}
visited.add(this);
for (AbstractPlanNode n : m_children) {
n.getPlanNodeList_recurse(collected, visited);
}
collected.add(this);
} } | public class class_name {
public void getPlanNodeList_recurse(ArrayList<AbstractPlanNode> collected,
HashSet<AbstractPlanNode> visited) {
if (visited.contains(this)) {
assert(false): "do not expect loops in plangraph.";
return;
}
visited.add(this);
for (AbstractPlanNode n : m_children) {
n.getPlanNodeList_recurse(collected, visited); // depends on control dependency: [for], data = [n]
}
collected.add(this);
} } |
public class class_name {
@Override
public boolean removeFirstOccurrence(DelayedEntry entry) {
DelayedEntry removedEntry = deque.pollFirst();
if (removedEntry == null) {
return false;
}
decreaseCountIndex(entry);
return true;
} } | public class class_name {
@Override
public boolean removeFirstOccurrence(DelayedEntry entry) {
DelayedEntry removedEntry = deque.pollFirst();
if (removedEntry == null) {
return false; // depends on control dependency: [if], data = [none]
}
decreaseCountIndex(entry);
return true;
} } |
public class class_name {
public String getDomain(Class<?> clazz) {
StringBuilder ret = new StringBuilder();
String computedDomainPrefix = getDomainPrefix(clazz);
if(computedDomainPrefix != null) {
ret.append(computedDomainPrefix);
ret.append(".");
}
String camelCaseString = clazz.getSimpleName();
ret.append(StringUtil.toLowerFirstChar(camelCaseString));
return ret.toString();
} } | public class class_name {
public String getDomain(Class<?> clazz) {
StringBuilder ret = new StringBuilder();
String computedDomainPrefix = getDomainPrefix(clazz);
if(computedDomainPrefix != null) {
ret.append(computedDomainPrefix); // depends on control dependency: [if], data = [(computedDomainPrefix]
ret.append("."); // depends on control dependency: [if], data = [none]
}
String camelCaseString = clazz.getSimpleName();
ret.append(StringUtil.toLowerFirstChar(camelCaseString));
return ret.toString();
} } |
public class class_name {
private List<Glyph> getInformation(Entity e) {
List<Glyph> list = new ArrayList<Glyph>();
// Add the molecule type before states if this is a nucleic acid or gene
if (e instanceof NucleicAcid || e instanceof Gene) {
Glyph g = factory.createGlyph();
g.setClazz(GlyphClazz.UNIT_OF_INFORMATION.getClazz());
Label label = factory.createLabel();
String s;
if(e instanceof Dna)
s = "mt:DNA";
else if(e instanceof DnaRegion)
s = "ct:DNA";
else if(e instanceof Rna)
s = "mt:RNA";
else if(e instanceof RnaRegion)
s = "ct:RNA";
else if(e instanceof Gene)
s = "ct:gene";
else
s = "mt:NuclAc";
label.setText(s);
g.setLabel(label);
list.add(g);
}
// Extract state variables
if(e instanceof PhysicalEntity) {
PhysicalEntity pe = (PhysicalEntity) e;
extractFeatures(pe.getFeature(), true, list);
extractFeatures(pe.getNotFeature(), false, list);
}
return list;
} } | public class class_name {
private List<Glyph> getInformation(Entity e) {
List<Glyph> list = new ArrayList<Glyph>();
// Add the molecule type before states if this is a nucleic acid or gene
if (e instanceof NucleicAcid || e instanceof Gene) {
Glyph g = factory.createGlyph();
g.setClazz(GlyphClazz.UNIT_OF_INFORMATION.getClazz()); // depends on control dependency: [if], data = [none]
Label label = factory.createLabel();
String s;
if(e instanceof Dna)
s = "mt:DNA";
else if(e instanceof DnaRegion)
s = "ct:DNA";
else if(e instanceof Rna)
s = "mt:RNA";
else if(e instanceof RnaRegion)
s = "ct:RNA";
else if(e instanceof Gene)
s = "ct:gene";
else
s = "mt:NuclAc";
label.setText(s); // depends on control dependency: [if], data = [none]
g.setLabel(label); // depends on control dependency: [if], data = [none]
list.add(g); // depends on control dependency: [if], data = [none]
}
// Extract state variables
if(e instanceof PhysicalEntity) {
PhysicalEntity pe = (PhysicalEntity) e;
extractFeatures(pe.getFeature(), true, list); // depends on control dependency: [if], data = [none]
extractFeatures(pe.getNotFeature(), false, list); // depends on control dependency: [if], data = [none]
}
return list;
} } |
public class class_name {
@Override
public ArrayList<ItemT> getAvailableItems() {
if (availableItems == null) {
availableItems = getArguments().getParcelableArrayList(ARG_AVAILABLE_ITEMS);
if (availableItems == null || availableItems.isEmpty()) {
throw new RuntimeException("StringPickerDialogFragment needs some items to pick from");
}
}
return availableItems;
} } | public class class_name {
@Override
public ArrayList<ItemT> getAvailableItems() {
if (availableItems == null) {
availableItems = getArguments().getParcelableArrayList(ARG_AVAILABLE_ITEMS); // depends on control dependency: [if], data = [none]
if (availableItems == null || availableItems.isEmpty()) {
throw new RuntimeException("StringPickerDialogFragment needs some items to pick from");
}
}
return availableItems;
} } |
public class class_name {
public EClass getGPARC() {
if (gparcEClass == null) {
gparcEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(459);
}
return gparcEClass;
} } | public class class_name {
public EClass getGPARC() {
if (gparcEClass == null) {
gparcEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(459); // depends on control dependency: [if], data = [none]
}
return gparcEClass;
} } |
public class class_name {
private static String mergeTickets(ProbeTest mAnnotation, ProbeTestClass cAnnotation) {
List<String> tickets = new ArrayList<>();
if (mAnnotation != null) {
tickets.addAll(Arrays.asList(mAnnotation.tickets()));
}
if (cAnnotation != null) {
tickets.addAll(Arrays.asList(cAnnotation.tickets()));
}
return Arrays.toString(tickets.toArray(new String[tickets.size()]));
} } | public class class_name {
private static String mergeTickets(ProbeTest mAnnotation, ProbeTestClass cAnnotation) {
List<String> tickets = new ArrayList<>();
if (mAnnotation != null) {
tickets.addAll(Arrays.asList(mAnnotation.tickets())); // depends on control dependency: [if], data = [(mAnnotation]
}
if (cAnnotation != null) {
tickets.addAll(Arrays.asList(cAnnotation.tickets())); // depends on control dependency: [if], data = [(cAnnotation]
}
return Arrays.toString(tickets.toArray(new String[tickets.size()]));
} } |
public class class_name {
@Override
public boolean isSameNodeInfo(final NodeInfo other) {
boolean retVal;
if (!(other instanceof NodeInfo)) {
retVal = false;
} else {
retVal = ((NodeWrapper)other).mKey == mKey;
}
return retVal;
} } | public class class_name {
@Override
public boolean isSameNodeInfo(final NodeInfo other) {
boolean retVal;
if (!(other instanceof NodeInfo)) {
retVal = false; // depends on control dependency: [if], data = [none]
} else {
retVal = ((NodeWrapper)other).mKey == mKey; // depends on control dependency: [if], data = [none]
}
return retVal;
} } |
public class class_name {
public static long generateLong(int length) {
if (length <= 0 || length > 19) {
throw new IllegalArgumentException("Can't generate random id with length: " + length);
}
SecureRandom random = new SecureRandom();
StringBuilder sb = new StringBuilder(length);
// 1st digit should not be a 0 or 9 if desired length is 19 (as max long is: 9223372036854775807)
if (length == 19) {
sb.append(NUMBERS_NO_NINE_AND_ZERO.charAt(random.nextInt(NUMBERS_NO_NINE_AND_ZERO.length())));
}
else {
sb.append(NUMBERS_NO_ZERO.charAt(random.nextInt(NUMBERS_NO_ZERO.length())));
}
// all other digits can contain a 0
for (int i = 1; i < length; i++) {
sb.append(NUMBERS.charAt(random.nextInt(NUMBERS.length())));
}
return Long.parseLong(sb.toString());
} } | public class class_name {
public static long generateLong(int length) {
if (length <= 0 || length > 19) {
throw new IllegalArgumentException("Can't generate random id with length: " + length);
}
SecureRandom random = new SecureRandom();
StringBuilder sb = new StringBuilder(length);
// 1st digit should not be a 0 or 9 if desired length is 19 (as max long is: 9223372036854775807)
if (length == 19) {
sb.append(NUMBERS_NO_NINE_AND_ZERO.charAt(random.nextInt(NUMBERS_NO_NINE_AND_ZERO.length()))); // depends on control dependency: [if], data = [none]
}
else {
sb.append(NUMBERS_NO_ZERO.charAt(random.nextInt(NUMBERS_NO_ZERO.length()))); // depends on control dependency: [if], data = [none]
}
// all other digits can contain a 0
for (int i = 1; i < length; i++) {
sb.append(NUMBERS.charAt(random.nextInt(NUMBERS.length()))); // depends on control dependency: [for], data = [none]
}
return Long.parseLong(sb.toString());
} } |
public class class_name {
private Node tryFoldStringSplit(Node n, Node stringNode, Node arg1) {
if (late) {
return n;
}
checkArgument(n.isCall());
checkArgument(stringNode.isString());
String separator = null;
String stringValue = stringNode.getString();
// Maximum number of possible splits
int limit = stringValue.length() + 1;
if (arg1 != null) {
if (arg1.isString()) {
separator = arg1.getString();
} else if (!arg1.isNull()) {
return n;
}
Node arg2 = arg1.getNext();
if (arg2 != null) {
if (arg2.isNumber()) {
limit = Math.min((int) arg2.getDouble(), limit);
if (limit < 0) {
return n;
}
} else {
return n;
}
}
}
// Split the string and convert the returned array into JS nodes
String[] stringArray = jsSplit(stringValue, separator, limit);
Node arrayOfStrings = IR.arraylit();
for (String element : stringArray) {
arrayOfStrings.addChildToBack(IR.string(element).srcref(stringNode));
}
Node parent = n.getParent();
parent.replaceChild(n, arrayOfStrings);
reportChangeToEnclosingScope(parent);
return arrayOfStrings;
} } | public class class_name {
private Node tryFoldStringSplit(Node n, Node stringNode, Node arg1) {
if (late) {
return n; // depends on control dependency: [if], data = [none]
}
checkArgument(n.isCall());
checkArgument(stringNode.isString());
String separator = null;
String stringValue = stringNode.getString();
// Maximum number of possible splits
int limit = stringValue.length() + 1;
if (arg1 != null) {
if (arg1.isString()) {
separator = arg1.getString(); // depends on control dependency: [if], data = [none]
} else if (!arg1.isNull()) {
return n; // depends on control dependency: [if], data = [none]
}
Node arg2 = arg1.getNext();
if (arg2 != null) {
if (arg2.isNumber()) {
limit = Math.min((int) arg2.getDouble(), limit); // depends on control dependency: [if], data = [none]
if (limit < 0) {
return n; // depends on control dependency: [if], data = [none]
}
} else {
return n; // depends on control dependency: [if], data = [none]
}
}
}
// Split the string and convert the returned array into JS nodes
String[] stringArray = jsSplit(stringValue, separator, limit);
Node arrayOfStrings = IR.arraylit();
for (String element : stringArray) {
arrayOfStrings.addChildToBack(IR.string(element).srcref(stringNode)); // depends on control dependency: [for], data = [element]
}
Node parent = n.getParent();
parent.replaceChild(n, arrayOfStrings);
reportChangeToEnclosingScope(parent);
return arrayOfStrings;
} } |
public class class_name {
public Reflect call(String name, Object... args) throws ReflectException {
Class<?>[] types = types(args);
// Try invoking the "canonical" method, i.e. the one with exact
// matching argument types
try {
Method method = exactMethod(name, types);
return on(method, object, args);
}
// If there is no exact match, try to find a method that has a "similar"
// signature if primitive argument types are converted to their wrappers
catch (NoSuchMethodException e) {
try {
Method method = similarMethod(name, types);
return on(method, object, args);
} catch (NoSuchMethodException e1) {
throw new ReflectException(e1);
}
}
} } | public class class_name {
public Reflect call(String name, Object... args) throws ReflectException {
Class<?>[] types = types(args);
// Try invoking the "canonical" method, i.e. the one with exact
// matching argument types
try {
Method method = exactMethod(name, types);
return on(method, object, args); // depends on control dependency: [try], data = [none]
}
// If there is no exact match, try to find a method that has a "similar"
// signature if primitive argument types are converted to their wrappers
catch (NoSuchMethodException e) {
try {
Method method = similarMethod(name, types);
return on(method, object, args); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e1) {
throw new ReflectException(e1);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setControlValue(Object objValue)
{
try {
if (!(this.getConverter() instanceof FieldInfo))
objValue = null;
if (objValue instanceof String)
objValue = ((FieldInfo)this.getConverter()).stringToDate((String)objValue);
} catch (Exception ex) {
objValue = null;
}
this.setTargetDate((Date)objValue);
} } | public class class_name {
public void setControlValue(Object objValue)
{
try {
if (!(this.getConverter() instanceof FieldInfo))
objValue = null;
if (objValue instanceof String)
objValue = ((FieldInfo)this.getConverter()).stringToDate((String)objValue);
} catch (Exception ex) {
objValue = null;
} // depends on control dependency: [catch], data = [none]
this.setTargetDate((Date)objValue);
} } |
public class class_name {
public static TwoDimTable createScoringHistoryTableDR(LinkedHashMap<String, ArrayList> scoreTable, String tableName,
long startTime) {
List<String> colHeaders = new ArrayList<>();
List<String> colTypes = new ArrayList<>();
List<String> colFormat = new ArrayList<>();
ArrayList<String> otherTableEntries = new ArrayList<String>();
for (String fieldName:scoreTable.keySet()) {
if (fieldName.equals("Timestamp")) {
colHeaders.add("Timestamp"); colTypes.add("string"); colFormat.add("%s");
colHeaders.add("Duration"); colTypes.add("string"); colFormat.add("%s");
colHeaders.add("Iterations"); colTypes.add("long"); colFormat.add("%d");
} else {
otherTableEntries.add(fieldName); colHeaders.add(fieldName); colTypes.add("double"); colFormat.add("%.5f");
}
}
int rows = scoreTable.get("Timestamp").size(); // number of entries of training history
TwoDimTable table = new TwoDimTable(
tableName, null,
new String[rows],
colHeaders.toArray(new String[0]),
colTypes.toArray(new String[0]),
colFormat.toArray(new String[0]),
"");
assert (rows <= table.getRowDim());
for (int row = 0; row < rows; row++) {
int col = 0;
// take care of Timestamp, Duration, Iteration.
DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
table.set(row, col++, fmt.print((long) scoreTable.get("Timestamp").get(row)));
table.set(row, col++, PrettyPrint.msecs((long) scoreTable.get("Timestamp").get(row) - startTime, true));
table.set(row, col++, row);
// take care of the extra field
for (int remaining_cols = 0; remaining_cols < otherTableEntries.size(); remaining_cols++) {
table.set(row, col++, (double) scoreTable.get(otherTableEntries.get(remaining_cols)).get(row));
}
}
return table;
} } | public class class_name {
public static TwoDimTable createScoringHistoryTableDR(LinkedHashMap<String, ArrayList> scoreTable, String tableName,
long startTime) {
List<String> colHeaders = new ArrayList<>();
List<String> colTypes = new ArrayList<>();
List<String> colFormat = new ArrayList<>();
ArrayList<String> otherTableEntries = new ArrayList<String>();
for (String fieldName:scoreTable.keySet()) {
if (fieldName.equals("Timestamp")) {
colHeaders.add("Timestamp"); colTypes.add("string"); colFormat.add("%s"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
colHeaders.add("Duration"); colTypes.add("string"); colFormat.add("%s"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
colHeaders.add("Iterations"); colTypes.add("long"); colFormat.add("%d"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
} else {
otherTableEntries.add(fieldName); colHeaders.add(fieldName); colTypes.add("double"); colFormat.add("%.5f"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
}
int rows = scoreTable.get("Timestamp").size(); // number of entries of training history
TwoDimTable table = new TwoDimTable(
tableName, null,
new String[rows],
colHeaders.toArray(new String[0]),
colTypes.toArray(new String[0]),
colFormat.toArray(new String[0]),
"");
assert (rows <= table.getRowDim());
for (int row = 0; row < rows; row++) {
int col = 0;
// take care of Timestamp, Duration, Iteration.
DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
table.set(row, col++, fmt.print((long) scoreTable.get("Timestamp").get(row))); // depends on control dependency: [for], data = [row]
table.set(row, col++, PrettyPrint.msecs((long) scoreTable.get("Timestamp").get(row) - startTime, true)); // depends on control dependency: [for], data = [row]
table.set(row, col++, row); // depends on control dependency: [for], data = [row]
// take care of the extra field
for (int remaining_cols = 0; remaining_cols < otherTableEntries.size(); remaining_cols++) {
table.set(row, col++, (double) scoreTable.get(otherTableEntries.get(remaining_cols)).get(row)); // depends on control dependency: [for], data = [remaining_cols]
}
}
return table;
} } |
public class class_name {
public String processIfMatches(final I input) {
String uriAsString = input.getUri();
String text = input.getTextToProcess();
Matcher m = patternImpl.matcher(uriAsString);
if (!m.find()) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Rule " + getClass().getSimpleName()
+ ": skipped " + uriAsString);
}
return text;
}
String result = new String(text);
for (PatternBasedTextProcessor proc : processors) {
result = proc.process(result);
}
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Rule " + getClass().getSimpleName()
+ ": processed " + uriAsString);
}
return result;
} } | public class class_name {
public String processIfMatches(final I input) {
String uriAsString = input.getUri();
String text = input.getTextToProcess();
Matcher m = patternImpl.matcher(uriAsString);
if (!m.find()) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Rule " + getClass().getSimpleName()
+ ": skipped " + uriAsString); // depends on control dependency: [if], data = [none]
}
return text; // depends on control dependency: [if], data = [none]
}
String result = new String(text);
for (PatternBasedTextProcessor proc : processors) {
result = proc.process(result); // depends on control dependency: [for], data = [proc]
}
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Rule " + getClass().getSimpleName()
+ ": processed " + uriAsString); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public void preShutdown(boolean transactionsLeft) throws Exception /* @PK31789C */
{
if (tc.isEntryEnabled())
Tr.entry(tc, "preShutdown", transactionsLeft);
try {
// Terminate partner log activity
getPartnerLogTable().terminate(); // 172471
// If the tranlog is null then we're using in memory logging and
// the work the shutdown the log is not required.
if (_tranLog != null) {
//
// Check if any transactions still active...
//
if (!transactionsLeft) {
if (tc.isDebugEnabled())
Tr.debug(tc, "There is no transaction data requiring future recovery");
if (_tranlogServiceData != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Erasing service data from transaction log");
// transactions stopped running now
try {
_tranLog.removeRecoverableUnit(_tranlogServiceData.identity());
} catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RecoveryManager.preShutdown", "359", this);
Tr.error(tc, "WTRN0029_ERROR_CLOSE_LOG_IN_SHUTDOWN");
throw e; /* @PK31789A */
}
} else {
if (tc.isDebugEnabled())
Tr.debug(tc, "No service data to erase from transaction log");
}
} else if (_tranlogServiceData != null) // Only update epoch if there is data in the log - d671043
{
// Force the tranlog by rewriting the epoch in the servicedata. This will ensure
// any previous completed transactions will have their end-records forced. Then
// it is safe to remove partner log records. Otherwise, we can get into the state
// of recovering completed txns that are still in-doubt in the txn log but have
// no partner log entries as we've cleaned them up. We can add code to cope with
// this but it gets very messy especially if recovery/shutdown keeps repeating
// itself - we need to check for NPE at every partner log check.
if (tc.isDebugEnabled())
Tr.debug(tc, "There is transaction data requiring future recovery. Updating epoch");
if (_failureScopeController.localFailureScope() || (_tranlogServiceData != null && _tranlogEpochSection != null)) {
try {
_tranlogEpochSection.addData(Util.intToBytes(_ourEpoch));
_tranlogServiceData.forceSections();
} catch (Exception e) {
// We were unable to force the tranlog, so just return as if we had crashed
// (or did an immediate shutdown) and we will recover everything at the next restart.
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RecoveryManager.preShutdown", "608", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "Exception raised forcing tranlog at shutdown", e);
throw e; /* @PK31789C */
}
} else {
if (tc.isDebugEnabled())
Tr.debug(tc, "No service data to update in transaction log");
}
}
}
} finally {
// If this is a peer server, or a local server where there are no transactions left running
// then close the log. In the case of the local failure scope, we are unable to close the log if
// there are transactions running as this shutdown represents the real server shutdown and
// transactions may still attempt to write to the recovery log. If we close the log now in this
// situation, server shutdown will be peppered with LogClosedException errors. Needs refinement.
if (_tranLog != null && ((!_failureScopeController.localFailureScope()) || (!transactionsLeft))) {
try {
_tranLog.closeLog();
} catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RecoveryManager.preShutdown", "360", this);
Tr.error(tc, "WTRN0029_ERROR_CLOSE_LOG_IN_SHUTDOWN");
if (tc.isEntryEnabled())
Tr.exit(tc, "preShutdown");
throw e; /* @PK31789A */
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "preShutdown");
}
} } | public class class_name {
public void preShutdown(boolean transactionsLeft) throws Exception /* @PK31789C */
{
if (tc.isEntryEnabled())
Tr.entry(tc, "preShutdown", transactionsLeft);
try {
// Terminate partner log activity
getPartnerLogTable().terminate(); // 172471
// If the tranlog is null then we're using in memory logging and
// the work the shutdown the log is not required.
if (_tranLog != null) {
//
// Check if any transactions still active...
//
if (!transactionsLeft) {
if (tc.isDebugEnabled())
Tr.debug(tc, "There is no transaction data requiring future recovery");
if (_tranlogServiceData != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Erasing service data from transaction log");
// transactions stopped running now
try {
_tranLog.removeRecoverableUnit(_tranlogServiceData.identity()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RecoveryManager.preShutdown", "359", this);
Tr.error(tc, "WTRN0029_ERROR_CLOSE_LOG_IN_SHUTDOWN");
throw e; /* @PK31789A */
} // depends on control dependency: [catch], data = [none]
} else {
if (tc.isDebugEnabled())
Tr.debug(tc, "No service data to erase from transaction log");
}
} else if (_tranlogServiceData != null) // Only update epoch if there is data in the log - d671043
{
// Force the tranlog by rewriting the epoch in the servicedata. This will ensure
// any previous completed transactions will have their end-records forced. Then
// it is safe to remove partner log records. Otherwise, we can get into the state
// of recovering completed txns that are still in-doubt in the txn log but have
// no partner log entries as we've cleaned them up. We can add code to cope with
// this but it gets very messy especially if recovery/shutdown keeps repeating
// itself - we need to check for NPE at every partner log check.
if (tc.isDebugEnabled())
Tr.debug(tc, "There is transaction data requiring future recovery. Updating epoch");
if (_failureScopeController.localFailureScope() || (_tranlogServiceData != null && _tranlogEpochSection != null)) {
try {
_tranlogEpochSection.addData(Util.intToBytes(_ourEpoch)); // depends on control dependency: [try], data = [none]
_tranlogServiceData.forceSections(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// We were unable to force the tranlog, so just return as if we had crashed
// (or did an immediate shutdown) and we will recover everything at the next restart.
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RecoveryManager.preShutdown", "608", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "Exception raised forcing tranlog at shutdown", e);
throw e; /* @PK31789C */
} // depends on control dependency: [catch], data = [none]
} else {
if (tc.isDebugEnabled())
Tr.debug(tc, "No service data to update in transaction log");
}
}
}
} finally {
// If this is a peer server, or a local server where there are no transactions left running
// then close the log. In the case of the local failure scope, we are unable to close the log if
// there are transactions running as this shutdown represents the real server shutdown and
// transactions may still attempt to write to the recovery log. If we close the log now in this
// situation, server shutdown will be peppered with LogClosedException errors. Needs refinement.
if (_tranLog != null && ((!_failureScopeController.localFailureScope()) || (!transactionsLeft))) {
try {
_tranLog.closeLog(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RecoveryManager.preShutdown", "360", this);
Tr.error(tc, "WTRN0029_ERROR_CLOSE_LOG_IN_SHUTDOWN");
if (tc.isEntryEnabled())
Tr.exit(tc, "preShutdown");
throw e; /* @PK31789A */
} // depends on control dependency: [catch], data = [none]
}
if (tc.isEntryEnabled())
Tr.exit(tc, "preShutdown");
}
} } |
public class class_name {
private boolean hasReferringDU() throws Exception {
// Get SleeContainer instance from JNDI
SleeContainer sC = SleeContainer.lookupFromJndi();
for (String componentIdString : this.getComponents()) {
ComponentIDPropertyEditor cidpe = new ComponentIDPropertyEditor();
cidpe.setAsText( componentIdString );
ComponentID componentId = (ComponentID) cidpe.getValue();
for (ComponentID referringComponentId : sC.getComponentRepository().getReferringComponents(componentId)) {
ComponentIDPropertyEditor rcidpe = new ComponentIDPropertyEditor();
rcidpe.setValue( referringComponentId );
String referringComponentIdString = rcidpe.getAsText();
if (!this.getComponents().contains( referringComponentIdString )) {
return true;
}
}
}
return false;
} } | public class class_name {
private boolean hasReferringDU() throws Exception {
// Get SleeContainer instance from JNDI
SleeContainer sC = SleeContainer.lookupFromJndi();
for (String componentIdString : this.getComponents()) {
ComponentIDPropertyEditor cidpe = new ComponentIDPropertyEditor();
cidpe.setAsText( componentIdString );
ComponentID componentId = (ComponentID) cidpe.getValue();
for (ComponentID referringComponentId : sC.getComponentRepository().getReferringComponents(componentId)) {
ComponentIDPropertyEditor rcidpe = new ComponentIDPropertyEditor();
rcidpe.setValue( referringComponentId );
// depends on control dependency: [for], data = [referringComponentId]
String referringComponentIdString = rcidpe.getAsText();
if (!this.getComponents().contains( referringComponentIdString )) {
return true;
// depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
private void replacePlaceholdersWithCorrespondingMentionSpans(@NonNull Editable text) {
PlaceholderSpan[] tempSpans = text.getSpans(0, text.length(), PlaceholderSpan.class);
for (PlaceholderSpan span : tempSpans) {
int spanStart = text.getSpanStart(span);
String mentionDisplayString = span.holder.getDisplayString();
int end = Math.min(spanStart + mentionDisplayString.length(), text.length());
text.replace(spanStart, end, mentionDisplayString);
text.setSpan(span.holder, spanStart, spanStart + mentionDisplayString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
text.removeSpan(span);
}
} } | public class class_name {
private void replacePlaceholdersWithCorrespondingMentionSpans(@NonNull Editable text) {
PlaceholderSpan[] tempSpans = text.getSpans(0, text.length(), PlaceholderSpan.class);
for (PlaceholderSpan span : tempSpans) {
int spanStart = text.getSpanStart(span);
String mentionDisplayString = span.holder.getDisplayString();
int end = Math.min(spanStart + mentionDisplayString.length(), text.length());
text.replace(spanStart, end, mentionDisplayString); // depends on control dependency: [for], data = [span]
text.setSpan(span.holder, spanStart, spanStart + mentionDisplayString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // depends on control dependency: [for], data = [span]
text.removeSpan(span); // depends on control dependency: [for], data = [span]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {
if (metric instanceof MetricSet) {
registerAll(name, (MetricSet) metric);
} else {
final Metric existing = metrics.putIfAbsent(name, metric);
if (existing == null) {
onMetricAdded(name, metric);
} else {
throw new IllegalArgumentException("A metric named " + name + " already exists");
}
}
return metric;
} } | public class class_name {
@SuppressWarnings("unchecked")
public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {
if (metric instanceof MetricSet) {
registerAll(name, (MetricSet) metric);
} else {
final Metric existing = metrics.putIfAbsent(name, metric);
if (existing == null) {
onMetricAdded(name, metric); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("A metric named " + name + " already exists");
}
}
return metric;
} } |
public class class_name {
public void setDeclaredParam(JvmFormalParameter newDeclaredParam)
{
if (newDeclaredParam != declaredParam)
{
NotificationChain msgs = null;
if (declaredParam != null)
msgs = ((InternalEObject)declaredParam).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XCATCH_CLAUSE__DECLARED_PARAM, null, msgs);
if (newDeclaredParam != null)
msgs = ((InternalEObject)newDeclaredParam).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XCATCH_CLAUSE__DECLARED_PARAM, null, msgs);
msgs = basicSetDeclaredParam(newDeclaredParam, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XCATCH_CLAUSE__DECLARED_PARAM, newDeclaredParam, newDeclaredParam));
} } | public class class_name {
public void setDeclaredParam(JvmFormalParameter newDeclaredParam)
{
if (newDeclaredParam != declaredParam)
{
NotificationChain msgs = null;
if (declaredParam != null)
msgs = ((InternalEObject)declaredParam).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XCATCH_CLAUSE__DECLARED_PARAM, null, msgs);
if (newDeclaredParam != null)
msgs = ((InternalEObject)newDeclaredParam).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XCATCH_CLAUSE__DECLARED_PARAM, null, msgs);
msgs = basicSetDeclaredParam(newDeclaredParam, msgs); // depends on control dependency: [if], data = [(newDeclaredParam]
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XCATCH_CLAUSE__DECLARED_PARAM, newDeclaredParam, newDeclaredParam));
} } |
public class class_name {
protected boolean containsElem(int index, final T key, int hashCode) {
for (LinkedElement<T> e = entries[index]; e != null; e = e.next) {
// element found
if (hashCode == e.hashCode && e.element.equals(key)) {
return true;
}
}
// element not found
return false;
} } | public class class_name {
protected boolean containsElem(int index, final T key, int hashCode) {
for (LinkedElement<T> e = entries[index]; e != null; e = e.next) {
// element found
if (hashCode == e.hashCode && e.element.equals(key)) {
return true; // depends on control dependency: [if], data = [none]
}
}
// element not found
return false;
} } |
public class class_name {
protected void addScripts()
{
if (loadPlugins == null || loadPlugins.size() == 0)
{
return;
}
for (GroovyScript2RestLoaderPlugin loadPlugin : loadPlugins)
{
// If no one script configured then skip this item,
// there is no reason to do anything.
if (loadPlugin.getXMLConfigs().size() == 0)
{
continue;
}
Session session = null;
try
{
ManageableRepository repository = repositoryService.getRepository(loadPlugin.getRepository());
String workspace = loadPlugin.getWorkspace();
session = repository.getSystemSession(workspace);
String nodeName = loadPlugin.getNode();
Node node = null;
try
{
node = (Node)session.getItem(nodeName);
}
catch (PathNotFoundException e)
{
StringTokenizer tokens = new StringTokenizer(nodeName, "/");
node = session.getRootNode();
while (tokens.hasMoreTokens())
{
String t = tokens.nextToken();
if (node.hasNode(t))
{
node = node.getNode(t);
}
else
{
node = node.addNode(t, "nt:folder");
}
}
}
for (XMLGroovyScript2Rest xg : loadPlugin.getXMLConfigs())
{
String scriptName = xg.getName();
if (node.hasNode(scriptName))
{
LOG.debug("Script {} already created", scriptName);
continue;
}
createScript(node, scriptName, xg.isAutoload(), configurationManager.getInputStream(xg.getPath()));
}
session.save();
}
catch (Exception e)
{
LOG.error("Failed add scripts. ", e);
}
finally
{
if (session != null)
{
session.logout();
}
}
}
} } | public class class_name {
protected void addScripts()
{
if (loadPlugins == null || loadPlugins.size() == 0)
{
return; // depends on control dependency: [if], data = [none]
}
for (GroovyScript2RestLoaderPlugin loadPlugin : loadPlugins)
{
// If no one script configured then skip this item,
// there is no reason to do anything.
if (loadPlugin.getXMLConfigs().size() == 0)
{
continue;
}
Session session = null;
try
{
ManageableRepository repository = repositoryService.getRepository(loadPlugin.getRepository());
String workspace = loadPlugin.getWorkspace();
session = repository.getSystemSession(workspace); // depends on control dependency: [try], data = [none]
String nodeName = loadPlugin.getNode();
Node node = null;
try
{
node = (Node)session.getItem(nodeName); // depends on control dependency: [try], data = [none]
}
catch (PathNotFoundException e)
{
StringTokenizer tokens = new StringTokenizer(nodeName, "/");
node = session.getRootNode();
while (tokens.hasMoreTokens())
{
String t = tokens.nextToken();
if (node.hasNode(t))
{
node = node.getNode(t); // depends on control dependency: [if], data = [none]
}
else
{
node = node.addNode(t, "nt:folder"); // depends on control dependency: [if], data = [none]
}
}
} // depends on control dependency: [catch], data = [none]
for (XMLGroovyScript2Rest xg : loadPlugin.getXMLConfigs())
{
String scriptName = xg.getName();
if (node.hasNode(scriptName))
{
LOG.debug("Script {} already created", scriptName); // depends on control dependency: [if], data = [none]
continue;
}
createScript(node, scriptName, xg.isAutoload(), configurationManager.getInputStream(xg.getPath())); // depends on control dependency: [for], data = [xg]
}
session.save(); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
LOG.error("Failed add scripts. ", e);
} // depends on control dependency: [catch], data = [none]
finally
{
if (session != null)
{
session.logout(); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
@Override
public Map<String, Set<String>> cleanObsoleteContent() {
if(!readWrite) {
return Collections.emptyMap();
}
Map<String, Set<String>> cleanedContents = new HashMap<>(2);
cleanedContents.put(MARKED_CONTENT, new HashSet<>());
cleanedContents.put(DELETED_CONTENT, new HashSet<>());
synchronized (contentHashReferences) {
for (ContentReference fsContent : listLocalContents()) {
if (!readWrite) {
return Collections.emptyMap();
}
if (!contentHashReferences.containsKey(fsContent.getHexHash())) { //We have no reference to this content
if (markAsObsolete(fsContent)) {
cleanedContents.get(DELETED_CONTENT).add(fsContent.getContentIdentifier());
} else {
cleanedContents.get(MARKED_CONTENT).add(fsContent.getContentIdentifier());
}
} else {
obsoleteContents.remove(fsContent.getHexHash()); //Remove existing references from obsoleteContents
}
}
}
return cleanedContents;
} } | public class class_name {
@Override
public Map<String, Set<String>> cleanObsoleteContent() {
if(!readWrite) {
return Collections.emptyMap(); // depends on control dependency: [if], data = [none]
}
Map<String, Set<String>> cleanedContents = new HashMap<>(2);
cleanedContents.put(MARKED_CONTENT, new HashSet<>());
cleanedContents.put(DELETED_CONTENT, new HashSet<>());
synchronized (contentHashReferences) {
for (ContentReference fsContent : listLocalContents()) {
if (!readWrite) {
return Collections.emptyMap(); // depends on control dependency: [if], data = [none]
}
if (!contentHashReferences.containsKey(fsContent.getHexHash())) { //We have no reference to this content
if (markAsObsolete(fsContent)) {
cleanedContents.get(DELETED_CONTENT).add(fsContent.getContentIdentifier()); // depends on control dependency: [if], data = [none]
} else {
cleanedContents.get(MARKED_CONTENT).add(fsContent.getContentIdentifier()); // depends on control dependency: [if], data = [none]
}
} else {
obsoleteContents.remove(fsContent.getHexHash()); //Remove existing references from obsoleteContents // depends on control dependency: [if], data = [none]
}
}
}
return cleanedContents;
} } |
public class class_name {
static List<IDataModel> toDataModels(final Workbook book, final String function) {
if (book == null || function == null) { return emptyList(); }
List<IDataModel> list = new LinkedList<>();
final FormulaParsingWorkbook parsingBook = create((XSSFWorkbook) book);
Sheet s = book.getSheetAt(0); /* TODO: only one sheet is supported */
for (Row r : s) {
for (Cell c : r) {
if (c == null || CELL_TYPE_FORMULA != c.getCellType()) { continue; }
try {
if (ConverterUtils.isFunctionInFormula(c.getCellFormula(), function))
{ list.add(createDataModelFromCell(s, parsingBook, fromRowColumn(c.getRowIndex(), c.getColumnIndex()))); } }
catch (FormulaParseException e) { log.warn("Warning while parsing excel formula. Probably this is OK.", e); }
}
}
return list;
} } | public class class_name {
static List<IDataModel> toDataModels(final Workbook book, final String function) {
if (book == null || function == null) { return emptyList(); }
// depends on control dependency: [if], data = [none]
List<IDataModel> list = new LinkedList<>();
final FormulaParsingWorkbook parsingBook = create((XSSFWorkbook) book);
Sheet s = book.getSheetAt(0); /* TODO: only one sheet is supported */
for (Row r : s) {
for (Cell c : r) {
if (c == null || CELL_TYPE_FORMULA != c.getCellType()) { continue; }
try {
if (ConverterUtils.isFunctionInFormula(c.getCellFormula(), function))
{ list.add(createDataModelFromCell(s, parsingBook, fromRowColumn(c.getRowIndex(), c.getColumnIndex()))); } }
// depends on control dependency: [if], data = [none]
catch (FormulaParseException e) { log.warn("Warning while parsing excel formula. Probably this is OK.", e); }
// depends on control dependency: [catch], data = [none]
}
}
return list;
} } |
public class class_name {
private void labelBrowseCurrentLinkMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelBrowseCurrentLinkMouseClicked
if (evt.getClickCount() > 1) {
try {
UiUtils.browseURI(new URI(this.getText().trim()), false);
}
catch (URISyntaxException ex) {
LOGGER.error("Can't start browser for URI syntax error", ex); //NOI18N
Toolkit.getDefaultToolkit().beep();
}
}
} } | public class class_name {
private void labelBrowseCurrentLinkMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelBrowseCurrentLinkMouseClicked
if (evt.getClickCount() > 1) {
try {
UiUtils.browseURI(new URI(this.getText().trim()), false); // depends on control dependency: [try], data = [none]
}
catch (URISyntaxException ex) {
LOGGER.error("Can't start browser for URI syntax error", ex); //NOI18N
Toolkit.getDefaultToolkit().beep();
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void marshall(DeleteDirectoryRequest deleteDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDirectoryRequest.getDirectoryId(), DIRECTORYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteDirectoryRequest deleteDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDirectoryRequest.getDirectoryId(), DIRECTORYID_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 Document loadDocument(String file) {
Document doc = null;
URL url = null;
File f = new File(file);
if (f.exists()) {
try {
url = f.toURI().toURL();
} catch (MalformedURLException e) {
throw new ConfigurationException("Unable to load " + file, e);
}
}
if (url == null) {
url = ClassLoader.getSystemResource(file);
}
InputStream is = null;
if (url == null) {
if (errorIfMissing) {
throw new ConfigurationException("Could not open files of the name " + file);
} else {
LOG.info("Unable to locate configuration files of the name " + file + ", skipping");
return doc;
}
}
try {
is = url.openStream();
InputSource in = new InputSource(is);
in.setSystemId(url.toString());
doc = DomHelper.parse(in, dtdMappings);
} catch (Exception e) {
throw new ConfigurationException("Unable to load " + file, e);
} finally {
try {
is.close();
} catch (IOException e) {
LOG.error("Unable to close input stream", e);
}
}
if (doc != null) {
LOG.debug("Wallmod configuration parsed");
}
return doc;
} } | public class class_name {
private Document loadDocument(String file) {
Document doc = null;
URL url = null;
File f = new File(file);
if (f.exists()) {
try {
url = f.toURI().toURL();
// depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
throw new ConfigurationException("Unable to load " + file, e);
}
// depends on control dependency: [catch], data = [none]
}
if (url == null) {
url = ClassLoader.getSystemResource(file);
// depends on control dependency: [if], data = [none]
}
InputStream is = null;
if (url == null) {
if (errorIfMissing) {
throw new ConfigurationException("Could not open files of the name " + file);
} else {
LOG.info("Unable to locate configuration files of the name " + file + ", skipping");
// depends on control dependency: [if], data = [none]
return doc;
// depends on control dependency: [if], data = [none]
}
}
try {
is = url.openStream();
// depends on control dependency: [try], data = [none]
InputSource in = new InputSource(is);
in.setSystemId(url.toString());
// depends on control dependency: [try], data = [none]
doc = DomHelper.parse(in, dtdMappings);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new ConfigurationException("Unable to load " + file, e);
} finally {
// depends on control dependency: [catch], data = [none]
try {
is.close();
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOG.error("Unable to close input stream", e);
}
// depends on control dependency: [catch], data = [none]
}
if (doc != null) {
LOG.debug("Wallmod configuration parsed");
// depends on control dependency: [if], data = [none]
}
return doc;
} } |
public class class_name {
public List<MessageDestinationRefType<WebAppType<T>>> getAllMessageDestinationRef()
{
List<MessageDestinationRefType<WebAppType<T>>> list = new ArrayList<MessageDestinationRefType<WebAppType<T>>>();
List<Node> nodeList = childNode.get("message-destination-ref");
for(Node node: nodeList)
{
MessageDestinationRefType<WebAppType<T>> type = new MessageDestinationRefTypeImpl<WebAppType<T>>(this, "message-destination-ref", childNode, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<MessageDestinationRefType<WebAppType<T>>> getAllMessageDestinationRef()
{
List<MessageDestinationRefType<WebAppType<T>>> list = new ArrayList<MessageDestinationRefType<WebAppType<T>>>();
List<Node> nodeList = childNode.get("message-destination-ref");
for(Node node: nodeList)
{
MessageDestinationRefType<WebAppType<T>> type = new MessageDestinationRefTypeImpl<WebAppType<T>>(this, "message-destination-ref", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
@GET
@Path("create")
public Response createFromRedirect() {
KeycloakPrincipal principal = (KeycloakPrincipal) sessionContext.getCallerPrincipal();
RefreshableKeycloakSecurityContext kcSecurityContext = (RefreshableKeycloakSecurityContext)
principal.getKeycloakSecurityContext();
String refreshToken = kcSecurityContext.getRefreshToken();
Token token = create(refreshToken);
try {
String redirectTo = System.getProperty("secretstore.redirectTo");
if (null == redirectTo || redirectTo.isEmpty()) {
return Response.ok("Redirect URL was not specified but token was created.").build();
}
URI location;
if (redirectTo.toLowerCase().startsWith("http")) {
location = new URI(redirectTo);
} else {
URI uri = uriInfo.getAbsolutePath();
String newPath = redirectTo.replace("{tokenId}", token.getId().toString());
location = new URI(
uri.getScheme(),
uri.getUserInfo(),
uri.getHost(),
uri.getPort(),
newPath,
uri.getQuery(),
uri.getFragment()
);
}
return Response.seeOther(location).build();
} catch (URISyntaxException e) {
e.printStackTrace();
return Response.ok("Could not redirect back to the original URL, but token was created.").build();
}
} } | public class class_name {
@GET
@Path("create")
public Response createFromRedirect() {
KeycloakPrincipal principal = (KeycloakPrincipal) sessionContext.getCallerPrincipal();
RefreshableKeycloakSecurityContext kcSecurityContext = (RefreshableKeycloakSecurityContext)
principal.getKeycloakSecurityContext();
String refreshToken = kcSecurityContext.getRefreshToken();
Token token = create(refreshToken);
try {
String redirectTo = System.getProperty("secretstore.redirectTo");
if (null == redirectTo || redirectTo.isEmpty()) {
return Response.ok("Redirect URL was not specified but token was created.").build(); // depends on control dependency: [if], data = [none]
}
URI location;
if (redirectTo.toLowerCase().startsWith("http")) {
location = new URI(redirectTo); // depends on control dependency: [if], data = [none]
} else {
URI uri = uriInfo.getAbsolutePath();
String newPath = redirectTo.replace("{tokenId}", token.getId().toString());
location = new URI(
uri.getScheme(),
uri.getUserInfo(),
uri.getHost(),
uri.getPort(),
newPath,
uri.getQuery(),
uri.getFragment()
); // depends on control dependency: [if], data = [none]
}
return Response.seeOther(location).build(); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
e.printStackTrace();
return Response.ok("Could not redirect back to the original URL, but token was created.").build();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Stream<IRI> ldpResourceTypes(final IRI ixnModel) {
final Stream.Builder<IRI> supertypes = Stream.builder();
if (ixnModel != null) {
LOGGER.debug("Finding types that subsume {}", ixnModel.getIRIString());
supertypes.accept(ixnModel);
final IRI superClass = LDP.getSuperclassOf(ixnModel);
LOGGER.debug("... including {}", superClass);
ldpResourceTypes(superClass).forEach(supertypes::accept);
}
return supertypes.build();
} } | public class class_name {
public static Stream<IRI> ldpResourceTypes(final IRI ixnModel) {
final Stream.Builder<IRI> supertypes = Stream.builder();
if (ixnModel != null) {
LOGGER.debug("Finding types that subsume {}", ixnModel.getIRIString()); // depends on control dependency: [if], data = [none]
supertypes.accept(ixnModel); // depends on control dependency: [if], data = [(ixnModel]
final IRI superClass = LDP.getSuperclassOf(ixnModel);
LOGGER.debug("... including {}", superClass); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
ldpResourceTypes(superClass).forEach(supertypes::accept); // depends on control dependency: [if], data = [none]
}
return supertypes.build();
} } |
public class class_name {
public void marshall(ReputationOptions reputationOptions, ProtocolMarshaller protocolMarshaller) {
if (reputationOptions == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(reputationOptions.getReputationMetricsEnabled(), REPUTATIONMETRICSENABLED_BINDING);
protocolMarshaller.marshall(reputationOptions.getLastFreshStart(), LASTFRESHSTART_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ReputationOptions reputationOptions, ProtocolMarshaller protocolMarshaller) {
if (reputationOptions == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(reputationOptions.getReputationMetricsEnabled(), REPUTATIONMETRICSENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(reputationOptions.getLastFreshStart(), LASTFRESHSTART_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 static <T> T parse(byte[] data, Class<? extends Request<T>> classType) {
Type[] types = doResolveTypeArguments(classType, classType, Request.class);
if (types == null || types.length == 0) {
throw new ParseException("Request<T> was not found for " + classType);
}
Type type = types[0];
try {
return Holder.parser.parse(data, type);
} catch (RuntimeException e) {
String json = HttpUtil.getUTF8String(data);
throw new ParseException("Failed to parse JSON:" + json, e);
}
} } | public class class_name {
public static <T> T parse(byte[] data, Class<? extends Request<T>> classType) {
Type[] types = doResolveTypeArguments(classType, classType, Request.class);
if (types == null || types.length == 0) {
throw new ParseException("Request<T> was not found for " + classType);
}
Type type = types[0];
try {
return Holder.parser.parse(data, type); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
String json = HttpUtil.getUTF8String(data);
throw new ParseException("Failed to parse JSON:" + json, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
InstanceWrapper getInstanceForKey(final Object key) throws ContainerException {
// common case has "no" contention
InstanceWrapper wrapper = instances.get(key);
if(wrapper != null)
return wrapper;
// otherwise we will be working to get one.
final Boolean tmplock = Boolean.TRUE;
Boolean lock = keysBeingWorked.putIfAbsent(key, tmplock);
if(lock == null)
lock = tmplock;
// otherwise we'll do an atomic check-and-update
synchronized(lock) {
wrapper = instances.get(key); // double checked lock?????
if(wrapper != null)
return wrapper;
Object instance = null;
try {
instance = prototype.newInstance();
} catch(final DempsyException e) {
if(e.userCaused()) {
LOGGER.warn("The message processor prototype " + SafeString.valueOf(prototype)
+ " threw an exception when trying to create a new message processor for they key " + SafeString.objectDescription(key));
statCollector.messageFailed(true);
instance = null;
} else
throw new ContainerException("the container for " + clusterId + " failed to create a new instance of " +
SafeString.valueOf(prototype) + " for the key " + SafeString.objectDescription(key) +
" because the clone method threw an exception.", e);
} catch(final RuntimeException e) {
throw new ContainerException("the container for " + clusterId + " failed to create a new instance of " +
SafeString.valueOf(prototype) + " for the key " + SafeString.objectDescription(key) +
" because the clone invocation resulted in an unknown exception.", e);
}
if(instance == null)
throw new ContainerException("the container for " + clusterId + " failed to create a new instance of " +
SafeString.valueOf(prototype) + " for the key " + SafeString.objectDescription(key) +
". The value returned from the clone call appears to be null.");
// activate
boolean activateSuccessful = false;
try {
if(instance != null) {
if(LOGGER.isTraceEnabled())
LOGGER.trace("the container for " + clusterId + " is activating instance " + String.valueOf(instance)
+ " via " + SafeString.valueOf(prototype) + " for " + SafeString.valueOf(key));
prototype.activate(instance, key);
activateSuccessful = true;
}
} catch(final DempsyException e) {
if(e.userCaused()) {
LOGGER.warn("The message processor " + SafeString.objectDescription(instance) + " activate call threw an exception.");
statCollector.messageFailed(true);
instance = null;
} else
throw new ContainerException(
"the container for " + clusterId + " failed to invoke the activate method of " + SafeString.valueOf(prototype)
+ ". Is the active method accessible - the class is public and the method is public?",
e);
} catch(final RuntimeException e) {
throw new ContainerException(
"the container for " + clusterId + " failed to invoke the activate method of " + SafeString.valueOf(prototype) +
" because of an unknown exception.",
e);
}
if(activateSuccessful) {
// we only want to create a wrapper and place the instance into the container
// if the instance activated correctly. If we got here then the above try block
// must have been successful.
wrapper = new InstanceWrapper(instance); // null check above.
instances.putIfAbsent(key, wrapper); // once it goes into the map, we can remove it from the 'being worked' set
keysBeingWorked.remove(key); // remove it from the keysBeingWorked since any subsequent call will get
// the newly added one.
statCollector.messageProcessorCreated(key);
}
return wrapper;
}
} } | public class class_name {
InstanceWrapper getInstanceForKey(final Object key) throws ContainerException {
// common case has "no" contention
InstanceWrapper wrapper = instances.get(key);
if(wrapper != null)
return wrapper;
// otherwise we will be working to get one.
final Boolean tmplock = Boolean.TRUE;
Boolean lock = keysBeingWorked.putIfAbsent(key, tmplock);
if(lock == null)
lock = tmplock;
// otherwise we'll do an atomic check-and-update
synchronized(lock) {
wrapper = instances.get(key); // double checked lock?????
if(wrapper != null)
return wrapper;
Object instance = null;
try {
instance = prototype.newInstance(); // depends on control dependency: [try], data = [none]
} catch(final DempsyException e) {
if(e.userCaused()) {
LOGGER.warn("The message processor prototype " + SafeString.valueOf(prototype)
+ " threw an exception when trying to create a new message processor for they key " + SafeString.objectDescription(key)); // depends on control dependency: [if], data = [none]
statCollector.messageFailed(true); // depends on control dependency: [if], data = [none]
instance = null; // depends on control dependency: [if], data = [none]
} else
throw new ContainerException("the container for " + clusterId + " failed to create a new instance of " +
SafeString.valueOf(prototype) + " for the key " + SafeString.objectDescription(key) +
" because the clone method threw an exception.", e);
} catch(final RuntimeException e) { // depends on control dependency: [catch], data = [none]
throw new ContainerException("the container for " + clusterId + " failed to create a new instance of " +
SafeString.valueOf(prototype) + " for the key " + SafeString.objectDescription(key) +
" because the clone invocation resulted in an unknown exception.", e);
} // depends on control dependency: [catch], data = [none]
if(instance == null)
throw new ContainerException("the container for " + clusterId + " failed to create a new instance of " +
SafeString.valueOf(prototype) + " for the key " + SafeString.objectDescription(key) +
". The value returned from the clone call appears to be null.");
// activate
boolean activateSuccessful = false;
try {
if(instance != null) {
if(LOGGER.isTraceEnabled())
LOGGER.trace("the container for " + clusterId + " is activating instance " + String.valueOf(instance)
+ " via " + SafeString.valueOf(prototype) + " for " + SafeString.valueOf(key));
prototype.activate(instance, key); // depends on control dependency: [if], data = [(instance]
activateSuccessful = true; // depends on control dependency: [if], data = [none]
}
} catch(final DempsyException e) {
if(e.userCaused()) {
LOGGER.warn("The message processor " + SafeString.objectDescription(instance) + " activate call threw an exception."); // depends on control dependency: [if], data = [none]
statCollector.messageFailed(true); // depends on control dependency: [if], data = [none]
instance = null; // depends on control dependency: [if], data = [none]
} else
throw new ContainerException(
"the container for " + clusterId + " failed to invoke the activate method of " + SafeString.valueOf(prototype)
+ ". Is the active method accessible - the class is public and the method is public?",
e);
} catch(final RuntimeException e) { // depends on control dependency: [catch], data = [none]
throw new ContainerException(
"the container for " + clusterId + " failed to invoke the activate method of " + SafeString.valueOf(prototype) +
" because of an unknown exception.",
e);
} // depends on control dependency: [catch], data = [none]
if(activateSuccessful) {
// we only want to create a wrapper and place the instance into the container
// if the instance activated correctly. If we got here then the above try block
// must have been successful.
wrapper = new InstanceWrapper(instance); // null check above. // depends on control dependency: [if], data = [none]
instances.putIfAbsent(key, wrapper); // once it goes into the map, we can remove it from the 'being worked' set // depends on control dependency: [if], data = [none]
keysBeingWorked.remove(key); // remove it from the keysBeingWorked since any subsequent call will get // depends on control dependency: [if], data = [none]
// the newly added one.
statCollector.messageProcessorCreated(key); // depends on control dependency: [if], data = [none]
}
return wrapper;
}
} } |
public class class_name {
@Override
public AtmosphereRequestBuilder newRequestBuilder(Class<AtmosphereRequest.AtmosphereRequestBuilder> clazz) {
AtmosphereRequestBuilder b;
try {
b = clazz.newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
return AtmosphereRequestBuilder.class.cast(b.resolver(FunctionResolver.DEFAULT));
} } | public class class_name {
@Override
public AtmosphereRequestBuilder newRequestBuilder(Class<AtmosphereRequest.AtmosphereRequestBuilder> clazz) {
AtmosphereRequestBuilder b;
try {
b = clazz.newInstance(); // depends on control dependency: [try], data = [none]
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
return AtmosphereRequestBuilder.class.cast(b.resolver(FunctionResolver.DEFAULT));
} } |
public class class_name {
public Renderable<?> render(Template template, Object... parameters) {
Map<String, Object> map = Maps.newHashMap();
String key = null;
for (Object parameter : parameters) {
if (key == null) {
if (!(parameter instanceof String)) {
throw new IllegalArgumentException("The template variable name " + parameter + " must be a string");
} else {
key = (String) parameter;
}
} else {
map.put(key, parameter);
key = null;
}
}
if (key != null) {
throw new IllegalArgumentException("Illegal number of parameter, the variable " + key + " has no value");
}
return template.render(this, map);
} } | public class class_name {
public Renderable<?> render(Template template, Object... parameters) {
Map<String, Object> map = Maps.newHashMap();
String key = null;
for (Object parameter : parameters) {
if (key == null) {
if (!(parameter instanceof String)) {
throw new IllegalArgumentException("The template variable name " + parameter + " must be a string");
} else {
key = (String) parameter; // depends on control dependency: [if], data = [none]
}
} else {
map.put(key, parameter); // depends on control dependency: [if], data = [(key]
key = null; // depends on control dependency: [if], data = [none]
}
}
if (key != null) {
throw new IllegalArgumentException("Illegal number of parameter, the variable " + key + " has no value");
}
return template.render(this, map);
} } |
public class class_name {
public void setMaintenanceTracks(java.util.Collection<MaintenanceTrack> maintenanceTracks) {
if (maintenanceTracks == null) {
this.maintenanceTracks = null;
return;
}
this.maintenanceTracks = new com.amazonaws.internal.SdkInternalList<MaintenanceTrack>(maintenanceTracks);
} } | public class class_name {
public void setMaintenanceTracks(java.util.Collection<MaintenanceTrack> maintenanceTracks) {
if (maintenanceTracks == null) {
this.maintenanceTracks = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.maintenanceTracks = new com.amazonaws.internal.SdkInternalList<MaintenanceTrack>(maintenanceTracks);
} } |
public class class_name {
public static void unregisterMessageHandler(Class<? extends AVIMMessage> clazz,
MessageHandler<?> handler) {
Set<MessageHandler> handlerSet = messageHandlerRepository.get(clazz);
if (handlerSet != null) {
handlerSet.remove(handler);
}
} } | public class class_name {
public static void unregisterMessageHandler(Class<? extends AVIMMessage> clazz,
MessageHandler<?> handler) {
Set<MessageHandler> handlerSet = messageHandlerRepository.get(clazz);
if (handlerSet != null) {
handlerSet.remove(handler); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void print(ConsoleLevel level, String message) {
if (level.compareTo(_level) <= 0) {
if (_printLogLevel) {
level.getStream().println(level.name() + ": " + message);
}
else {
level.getStream().println(message);
}
level.getStream().flush();
}
} } | public class class_name {
public static void print(ConsoleLevel level, String message) {
if (level.compareTo(_level) <= 0) {
if (_printLogLevel) {
level.getStream().println(level.name() + ": " + message);
// depends on control dependency: [if], data = [none]
}
else {
level.getStream().println(message);
// depends on control dependency: [if], data = [none]
}
level.getStream().flush();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SafeVarargs
public static float max(final float... array) {
// Validates input
if (N.isNullOrEmpty(array)) {
throw new IllegalArgumentException("Array cannot be null or empty.");
}
// Finds and returns max
float max = array[0];
for (int j = 1; j < array.length; j++) {
max = max(array[j], max);
}
return max;
} } | public class class_name {
@SafeVarargs
public static float max(final float... array) {
// Validates input
if (N.isNullOrEmpty(array)) {
throw new IllegalArgumentException("Array cannot be null or empty.");
}
// Finds and returns max
float max = array[0];
for (int j = 1; j < array.length; j++) {
max = max(array[j], max);
// depends on control dependency: [for], data = [j]
}
return max;
} } |
public class class_name {
@Override
public Collection<String> getMonomerNames() {
Iterator<String> keys = strands.keySet().iterator();
Map<String, IMonomer> monomers = new Hashtable<String, IMonomer>();
if (!keys.hasNext()) // no strands
return super.getMonomerNames();
while (keys.hasNext()) {
Strand oStrand = (Strand) strands.get(keys.next());
monomers.putAll(oStrand.getMonomers());
}
return monomers.keySet();
} } | public class class_name {
@Override
public Collection<String> getMonomerNames() {
Iterator<String> keys = strands.keySet().iterator();
Map<String, IMonomer> monomers = new Hashtable<String, IMonomer>();
if (!keys.hasNext()) // no strands
return super.getMonomerNames();
while (keys.hasNext()) {
Strand oStrand = (Strand) strands.get(keys.next());
monomers.putAll(oStrand.getMonomers()); // depends on control dependency: [while], data = [none]
}
return monomers.keySet();
} } |
public class class_name {
public String createUniqueName(String name) {
if (!isDuplicateName(name)) {
return name;
}
if (name.matches(".*\\(\\d*\\)")) { //$NON-NLS-1$
final int start = name.lastIndexOf('(');
final int end = name.lastIndexOf(')');
final String stringInt = name.substring(start + 1, end);
final int numericValue = Integer.parseInt(stringInt);
final String newName = name.substring(0, start + 1) + (numericValue + 1) + ")"; //$NON-NLS-1$
return createUniqueName(newName);
}
return createUniqueName(name + " (1)"); //$NON-NLS-1$
} } | public class class_name {
public String createUniqueName(String name) {
if (!isDuplicateName(name)) {
return name; // depends on control dependency: [if], data = [none]
}
if (name.matches(".*\\(\\d*\\)")) { //$NON-NLS-1$
final int start = name.lastIndexOf('(');
final int end = name.lastIndexOf(')');
final String stringInt = name.substring(start + 1, end);
final int numericValue = Integer.parseInt(stringInt);
final String newName = name.substring(0, start + 1) + (numericValue + 1) + ")"; //$NON-NLS-1$
return createUniqueName(newName); // depends on control dependency: [if], data = [none]
}
return createUniqueName(name + " (1)"); //$NON-NLS-1$
} } |
public class class_name {
@Override
public OkHttpChannelBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit) {
Preconditions.checkArgument(keepAliveTime > 0L, "keepalive time must be positive");
keepAliveTimeNanos = timeUnit.toNanos(keepAliveTime);
keepAliveTimeNanos = KeepAliveManager.clampKeepAliveTimeInNanos(keepAliveTimeNanos);
if (keepAliveTimeNanos >= AS_LARGE_AS_INFINITE) {
// Bump keepalive time to infinite. This disables keepalive.
keepAliveTimeNanos = KEEPALIVE_TIME_NANOS_DISABLED;
}
return this;
} } | public class class_name {
@Override
public OkHttpChannelBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit) {
Preconditions.checkArgument(keepAliveTime > 0L, "keepalive time must be positive");
keepAliveTimeNanos = timeUnit.toNanos(keepAliveTime);
keepAliveTimeNanos = KeepAliveManager.clampKeepAliveTimeInNanos(keepAliveTimeNanos);
if (keepAliveTimeNanos >= AS_LARGE_AS_INFINITE) {
// Bump keepalive time to infinite. This disables keepalive.
keepAliveTimeNanos = KEEPALIVE_TIME_NANOS_DISABLED; // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public static <T extends ContentMeta> ResourceSelector<T> regexMetadataResourceSelector(final Map<String,
String> required, final boolean requireAll) {
return new ResourceSelector<T>() {
Map<String, Pattern> patternMap = new HashMap<String, Pattern>();
private Pattern forString(String regex) {
if (null == patternMap.get(regex)) {
Pattern compile = null;
try {
compile = Pattern.compile(regex);
} catch (PatternSyntaxException ignored) {
return null;
}
patternMap.put(regex, compile);
}
return patternMap.get(regex);
}
@Override
public boolean matchesContent(T content) {
for (String key : required.keySet()) {
Pattern pattern = forString(required.get(key));
String test = content.getMeta().get(key);
if (null != test && null != pattern && pattern.matcher(test).matches()) {
if (!requireAll) {
return true;
}
} else if (requireAll) {
return false;
}
}
return requireAll;
}
};
} } | public class class_name {
public static <T extends ContentMeta> ResourceSelector<T> regexMetadataResourceSelector(final Map<String,
String> required, final boolean requireAll) {
return new ResourceSelector<T>() {
Map<String, Pattern> patternMap = new HashMap<String, Pattern>();
private Pattern forString(String regex) {
if (null == patternMap.get(regex)) {
Pattern compile = null;
try {
compile = Pattern.compile(regex); // depends on control dependency: [try], data = [none]
} catch (PatternSyntaxException ignored) {
return null;
} // depends on control dependency: [catch], data = [none]
patternMap.put(regex, compile); // depends on control dependency: [if], data = [none]
}
return patternMap.get(regex);
}
@Override
public boolean matchesContent(T content) {
for (String key : required.keySet()) {
Pattern pattern = forString(required.get(key));
String test = content.getMeta().get(key);
if (null != test && null != pattern && pattern.matcher(test).matches()) {
if (!requireAll) {
return true; // depends on control dependency: [if], data = [none]
}
} else if (requireAll) {
return false; // depends on control dependency: [if], data = [none]
}
}
return requireAll;
}
};
} } |
public class class_name {
public AbstractRelationship getRelationship(final String id) {
if (id == null) {
return null;
}
final SecurityContext securityContext = getWebSocket().getSecurityContext();
final App app = StructrApp.getInstance(securityContext);
try (final Tx tx = app.tx()) {
final AbstractRelationship rel = (AbstractRelationship) app.getRelationshipById(id);
tx.success();
return rel;
} catch (FrameworkException fex) {
logger.warn("Unable to get relationship", fex);
}
return null;
} } | public class class_name {
public AbstractRelationship getRelationship(final String id) {
if (id == null) {
return null; // depends on control dependency: [if], data = [none]
}
final SecurityContext securityContext = getWebSocket().getSecurityContext();
final App app = StructrApp.getInstance(securityContext);
try (final Tx tx = app.tx()) {
final AbstractRelationship rel = (AbstractRelationship) app.getRelationshipById(id);
tx.success();
return rel;
} catch (FrameworkException fex) {
logger.warn("Unable to get relationship", fex);
}
return null;
} } |
public class class_name {
public static boolean isOptional(TypeRef type) {
if (!(type instanceof ClassRef)) {
return false;
}
return JAVA_UTIL_OPTIONAL.equals(((ClassRef)type).getDefinition().getFullyQualifiedName());
} } | public class class_name {
public static boolean isOptional(TypeRef type) {
if (!(type instanceof ClassRef)) {
return false; // depends on control dependency: [if], data = [none]
}
return JAVA_UTIL_OPTIONAL.equals(((ClassRef)type).getDefinition().getFullyQualifiedName());
} } |
public class class_name {
public boolean matches(HttpServletRequest request) {
if (httpMethod != null && httpMethod != HttpMethod.valueOf(request.getMethod())) { return false; }
String url = request.getServletPath();
String pathInfo = request.getPathInfo();
String query = request.getQueryString();
if (pathInfo != null || query != null) {
StringBuilder sb = new StringBuilder(url);
if (pathInfo != null) sb.append(pathInfo);
if (query != null) sb.append(query);
url = sb.toString();
}
logger.debug("Checking match of request : '{}'; against '{}'", url, pattern);
return pattern.matcher(url).matches();
} } | public class class_name {
public boolean matches(HttpServletRequest request) {
if (httpMethod != null && httpMethod != HttpMethod.valueOf(request.getMethod())) { return false; } // depends on control dependency: [if], data = [none]
String url = request.getServletPath();
String pathInfo = request.getPathInfo();
String query = request.getQueryString();
if (pathInfo != null || query != null) {
StringBuilder sb = new StringBuilder(url);
if (pathInfo != null) sb.append(pathInfo);
if (query != null) sb.append(query);
url = sb.toString(); // depends on control dependency: [if], data = [none]
}
logger.debug("Checking match of request : '{}'; against '{}'", url, pattern);
return pattern.matcher(url).matches();
} } |
public class class_name {
@Override
public Object getProperty(String name) {
if(binding.containsKey(name)) {
return binding.get(name);
}
else {
if(springConfig.containsBean(name)) {
BeanConfiguration beanConfig = springConfig.getBeanConfig(name);
if(beanConfig != null) {
return new ConfigurableRuntimeBeanReference(name, springConfig.getBeanConfig(name) ,false);
}
else
return new RuntimeBeanReference(name,false);
}
// this is to deal with the case where the property setter is the last
// statement in a closure (hence the return value)
else if(currentBeanConfig != null) {
if(currentBeanConfig.hasProperty(name))
return currentBeanConfig.getPropertyValue(name);
else {
DeferredProperty dp = deferredProperties.get(currentBeanConfig.getName()+name);
if(dp!=null) {
return dp.value;
}
else {
return super.getProperty(name);
}
}
}
else {
return super.getProperty(name);
}
}
} } | public class class_name {
@Override
public Object getProperty(String name) {
if(binding.containsKey(name)) {
return binding.get(name); // depends on control dependency: [if], data = [none]
}
else {
if(springConfig.containsBean(name)) {
BeanConfiguration beanConfig = springConfig.getBeanConfig(name);
if(beanConfig != null) {
return new ConfigurableRuntimeBeanReference(name, springConfig.getBeanConfig(name) ,false); // depends on control dependency: [if], data = [none]
}
else
return new RuntimeBeanReference(name,false);
}
// this is to deal with the case where the property setter is the last
// statement in a closure (hence the return value)
else if(currentBeanConfig != null) {
if(currentBeanConfig.hasProperty(name))
return currentBeanConfig.getPropertyValue(name);
else {
DeferredProperty dp = deferredProperties.get(currentBeanConfig.getName()+name);
if(dp!=null) {
return dp.value; // depends on control dependency: [if], data = [none]
}
else {
return super.getProperty(name); // depends on control dependency: [if], data = [none]
}
}
}
else {
return super.getProperty(name); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public String waitAck(){
try {
this.latch.await(5000, TimeUnit.MILLISECONDS);
return consumerGroup;
} catch (Exception e) {}
return null;
} } | public class class_name {
public String waitAck(){
try {
this.latch.await(5000, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
return consumerGroup; // depends on control dependency: [try], data = [none]
} catch (Exception e) {} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public void setTypeInfos(java.util.Collection<ActivityTypeInfo> typeInfos) {
if (typeInfos == null) {
this.typeInfos = null;
return;
}
this.typeInfos = new java.util.ArrayList<ActivityTypeInfo>(typeInfos);
} } | public class class_name {
public void setTypeInfos(java.util.Collection<ActivityTypeInfo> typeInfos) {
if (typeInfos == null) {
this.typeInfos = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.typeInfos = new java.util.ArrayList<ActivityTypeInfo>(typeInfos);
} } |
public class class_name {
private void parseAttribute(final Attributes atts) {
final URI attrValue = toURI(atts.getValue(ATTRIBUTE_NAME_HREF));
if (attrValue == null) {
return;
}
final String attrScope = atts.getValue(ATTRIBUTE_NAME_SCOPE);
if (isExternal(attrValue, attrScope)) {
return;
}
String attrFormat = atts.getValue(ATTRIBUTE_NAME_FORMAT);
if (attrFormat == null || ATTR_FORMAT_VALUE_DITA.equals(attrFormat)) {
final File target = toFile(attrValue);
topicHref = target.isAbsolute() ? attrValue : currentDir.resolve(attrValue);
if (attrValue.getFragment() != null) {
topicId = attrValue.getFragment();
} else {
if (attrFormat == null || attrFormat.equals(ATTR_FORMAT_VALUE_DITA) || attrFormat.equals(ATTR_FORMAT_VALUE_DITAMAP)) {
topicId = topicHref + QUESTION;
}
}
} else {
topicHref = null;
topicId = null;
}
} } | public class class_name {
private void parseAttribute(final Attributes atts) {
final URI attrValue = toURI(atts.getValue(ATTRIBUTE_NAME_HREF));
if (attrValue == null) {
return; // depends on control dependency: [if], data = [none]
}
final String attrScope = atts.getValue(ATTRIBUTE_NAME_SCOPE);
if (isExternal(attrValue, attrScope)) {
return; // depends on control dependency: [if], data = [none]
}
String attrFormat = atts.getValue(ATTRIBUTE_NAME_FORMAT);
if (attrFormat == null || ATTR_FORMAT_VALUE_DITA.equals(attrFormat)) {
final File target = toFile(attrValue);
topicHref = target.isAbsolute() ? attrValue : currentDir.resolve(attrValue); // depends on control dependency: [if], data = [none]
if (attrValue.getFragment() != null) {
topicId = attrValue.getFragment(); // depends on control dependency: [if], data = [none]
} else {
if (attrFormat == null || attrFormat.equals(ATTR_FORMAT_VALUE_DITA) || attrFormat.equals(ATTR_FORMAT_VALUE_DITAMAP)) {
topicId = topicHref + QUESTION; // depends on control dependency: [if], data = [none]
}
}
} else {
topicHref = null; // depends on control dependency: [if], data = [none]
topicId = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void printDetails() {
StringBuilder builder = new StringBuilder("\"Name\",\"Phone\",\"Roles\",\"Identifier\"\n");
for (Object contact : repeater.getBeanList()) {
builder.append(contact).append('\n');
}
printOutput.setText(builder.toString());
} } | public class class_name {
private void printDetails() {
StringBuilder builder = new StringBuilder("\"Name\",\"Phone\",\"Roles\",\"Identifier\"\n");
for (Object contact : repeater.getBeanList()) {
builder.append(contact).append('\n'); // depends on control dependency: [for], data = [contact]
}
printOutput.setText(builder.toString());
} } |
public class class_name {
public void skipWhitespace()
{
while(hasMore())
{
char c=read();
if(c=='#')
{
readUntil('\n');
return;
}
if(!Character.isWhitespace(c))
{
rewind(1);
return;
}
}
} } | public class class_name {
public void skipWhitespace()
{
while(hasMore())
{
char c=read();
if(c=='#')
{
readUntil('\n'); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if(!Character.isWhitespace(c))
{
rewind(1); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private CommunicationParam buildParams(String addr) {
CommunicationParam params = new CommunicationParam();
String[] strs = StringUtils.split(addr, ":");
if (strs == null || strs.length != 2) {
throw new IllegalArgumentException("addr example: 127.0.0.1:1099");
}
InetAddress address = null;
try {
address = InetAddress.getByName(strs[0]);
} catch (UnknownHostException e) {
throw new CommunicationException("addr_error", "addr[" + addr + "] is unknow!");
}
params.setIp(address.getHostAddress());
params.setPort(Integer.valueOf(strs[1]));
return params;
} } | public class class_name {
private CommunicationParam buildParams(String addr) {
CommunicationParam params = new CommunicationParam();
String[] strs = StringUtils.split(addr, ":");
if (strs == null || strs.length != 2) {
throw new IllegalArgumentException("addr example: 127.0.0.1:1099");
}
InetAddress address = null;
try {
address = InetAddress.getByName(strs[0]); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
throw new CommunicationException("addr_error", "addr[" + addr + "] is unknow!");
} // depends on control dependency: [catch], data = [none]
params.setIp(address.getHostAddress());
params.setPort(Integer.valueOf(strs[1]));
return params;
} } |
public class class_name {
public static int count(final String host, final char charactor) {
int count = 0;
for (int i = 0; i < host.length(); i++) {
if (host.charAt(i) == charactor) {
count++;
}
}
return count;
} } | public class class_name {
public static int count(final String host, final char charactor) {
int count = 0;
for (int i = 0; i < host.length(); i++) {
if (host.charAt(i) == charactor) {
count++; // depends on control dependency: [if], data = [none]
}
}
return count;
} } |
public class class_name {
static public long swapLong(byte[] b, int offset) {
// 8 bytes
long accum = 0;
long shiftedval;
for (int shiftBy = 0, i = offset; shiftBy < 64; shiftBy += 8, i++) {
shiftedval = ((long) (b[i] & 0xff)) << shiftBy;
accum |= shiftedval;
}
return accum;
} } | public class class_name {
static public long swapLong(byte[] b, int offset) {
// 8 bytes
long accum = 0;
long shiftedval;
for (int shiftBy = 0, i = offset; shiftBy < 64; shiftBy += 8, i++) {
shiftedval = ((long) (b[i] & 0xff)) << shiftBy; // depends on control dependency: [for], data = [shiftBy]
accum |= shiftedval; // depends on control dependency: [for], data = [none]
}
return accum;
} } |
public class class_name {
public static CommercePriceEntry toModel(CommercePriceEntrySoap soapModel) {
if (soapModel == null) {
return null;
}
CommercePriceEntry model = new CommercePriceEntryImpl();
model.setUuid(soapModel.getUuid());
model.setExternalReferenceCode(soapModel.getExternalReferenceCode());
model.setCommercePriceEntryId(soapModel.getCommercePriceEntryId());
model.setGroupId(soapModel.getGroupId());
model.setCompanyId(soapModel.getCompanyId());
model.setUserId(soapModel.getUserId());
model.setUserName(soapModel.getUserName());
model.setCreateDate(soapModel.getCreateDate());
model.setModifiedDate(soapModel.getModifiedDate());
model.setCommercePriceListId(soapModel.getCommercePriceListId());
model.setCPInstanceUuid(soapModel.getCPInstanceUuid());
model.setCProductId(soapModel.getCProductId());
model.setPrice(soapModel.getPrice());
model.setPromoPrice(soapModel.getPromoPrice());
model.setHasTierPrice(soapModel.isHasTierPrice());
model.setLastPublishDate(soapModel.getLastPublishDate());
return model;
} } | public class class_name {
public static CommercePriceEntry toModel(CommercePriceEntrySoap soapModel) {
if (soapModel == null) {
return null; // depends on control dependency: [if], data = [none]
}
CommercePriceEntry model = new CommercePriceEntryImpl();
model.setUuid(soapModel.getUuid());
model.setExternalReferenceCode(soapModel.getExternalReferenceCode());
model.setCommercePriceEntryId(soapModel.getCommercePriceEntryId());
model.setGroupId(soapModel.getGroupId());
model.setCompanyId(soapModel.getCompanyId());
model.setUserId(soapModel.getUserId());
model.setUserName(soapModel.getUserName());
model.setCreateDate(soapModel.getCreateDate());
model.setModifiedDate(soapModel.getModifiedDate());
model.setCommercePriceListId(soapModel.getCommercePriceListId());
model.setCPInstanceUuid(soapModel.getCPInstanceUuid());
model.setCProductId(soapModel.getCProductId());
model.setPrice(soapModel.getPrice());
model.setPromoPrice(soapModel.getPromoPrice());
model.setHasTierPrice(soapModel.isHasTierPrice());
model.setLastPublishDate(soapModel.getLastPublishDate());
return model;
} } |
public class class_name {
private boolean makeSpace() {
clearCaches();
int offset = savedScannerPosition == -1 ?
position : savedScannerPosition;
buf.position(offset);
// Gain space by compacting buffer
if (offset > 0) {
buf.compact();
translateSavedIndexes(offset);
position -= offset;
buf.flip();
return true;
}
// Gain space by growing buffer
int newSize = buf.capacity() * 2;
CharBuffer newBuf = CharBuffer.allocate(newSize);
newBuf.put(buf);
newBuf.flip();
translateSavedIndexes(offset);
position -= offset;
buf = newBuf;
matcher.reset(buf);
return true;
} } | public class class_name {
private boolean makeSpace() {
clearCaches();
int offset = savedScannerPosition == -1 ?
position : savedScannerPosition;
buf.position(offset);
// Gain space by compacting buffer
if (offset > 0) {
buf.compact(); // depends on control dependency: [if], data = [none]
translateSavedIndexes(offset); // depends on control dependency: [if], data = [(offset]
position -= offset; // depends on control dependency: [if], data = [none]
buf.flip(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
// Gain space by growing buffer
int newSize = buf.capacity() * 2;
CharBuffer newBuf = CharBuffer.allocate(newSize);
newBuf.put(buf);
newBuf.flip();
translateSavedIndexes(offset);
position -= offset;
buf = newBuf;
matcher.reset(buf);
return true;
} } |
public class class_name {
public void onSuccessRespEvent(ResponseEvent event, ActivityContextInterface aci) {
if (tracer.isFineEnabled())
tracer.fine("Received 2xx (SUCCESS) response:\n"+event.getResponse());
final SbbLocalObject sbbLocalObject = sbbContext.getSbbLocalObject();
aci.detach(sbbLocalObject);
final Response response = event.getResponse();
final SIPETagHeader sipeTagHeader = (SIPETagHeader) response.getHeader(SIPETagHeader.NAME);
if(sipeTagHeader != null) {
this.setETagCMP(sipeTagHeader.getETag());
}
final PublishRequestType type = getPublishRequestTypeCMP();
if (type != PublishRequestType.REMOVE) {
final ExpiresHeader expiresHeader = (ExpiresHeader) response.getHeader(ExpiresHeader.NAME);
if(expiresHeader!=null && expiresHeader.getExpires() != 0) {
//update expires time.
setExpiresCMP(expiresHeader.getExpires());
startExpiresTimer();
}
}
PostponedRequest postponedRequest = null;
setPublishRequestTypeCMP(null);
try{
switch (type) {
case NEW:
postponedRequest = getPostponedRequestCMP();
getParent().newPublicationSucceed((PublicationClientChildSbbLocalObject) sbbLocalObject);
break;
case REFRESH:
postponedRequest = getPostponedRequestCMP();
break;
case UPDATE:
postponedRequest = getPostponedRequestCMP();
getParent().modifyPublicationSucceed((PublicationClientChildSbbLocalObject) sbbLocalObject);
break;
case REMOVE:
getParent().removePublicationSucceed((PublicationClientChildSbbLocalObject) sbbLocalObject);
break;
}
}
catch(Exception e) {
if(tracer.isSevereEnabled()) {
tracer.severe("Exception in publication parent!", e);
}
}
if (postponedRequest != null) {
// refresh may be concurrent with another request, if there is a
// postponed request resume it now
postponedRequest.resume(this);
}
} } | public class class_name {
public void onSuccessRespEvent(ResponseEvent event, ActivityContextInterface aci) {
if (tracer.isFineEnabled())
tracer.fine("Received 2xx (SUCCESS) response:\n"+event.getResponse());
final SbbLocalObject sbbLocalObject = sbbContext.getSbbLocalObject();
aci.detach(sbbLocalObject);
final Response response = event.getResponse();
final SIPETagHeader sipeTagHeader = (SIPETagHeader) response.getHeader(SIPETagHeader.NAME);
if(sipeTagHeader != null) {
this.setETagCMP(sipeTagHeader.getETag()); // depends on control dependency: [if], data = [(sipeTagHeader]
}
final PublishRequestType type = getPublishRequestTypeCMP();
if (type != PublishRequestType.REMOVE) {
final ExpiresHeader expiresHeader = (ExpiresHeader) response.getHeader(ExpiresHeader.NAME);
if(expiresHeader!=null && expiresHeader.getExpires() != 0) {
//update expires time.
setExpiresCMP(expiresHeader.getExpires()); // depends on control dependency: [if], data = [(expiresHeader]
startExpiresTimer(); // depends on control dependency: [if], data = [none]
}
}
PostponedRequest postponedRequest = null;
setPublishRequestTypeCMP(null);
try{
switch (type) {
case NEW:
postponedRequest = getPostponedRequestCMP();
getParent().newPublicationSucceed((PublicationClientChildSbbLocalObject) sbbLocalObject);
break;
case REFRESH:
postponedRequest = getPostponedRequestCMP();
break;
case UPDATE:
postponedRequest = getPostponedRequestCMP();
getParent().modifyPublicationSucceed((PublicationClientChildSbbLocalObject) sbbLocalObject);
break;
case REMOVE:
getParent().removePublicationSucceed((PublicationClientChildSbbLocalObject) sbbLocalObject);
break;
}
}
catch(Exception e) {
if(tracer.isSevereEnabled()) {
tracer.severe("Exception in publication parent!", e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
if (postponedRequest != null) {
// refresh may be concurrent with another request, if there is a
// postponed request resume it now
postponedRequest.resume(this); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void compile() throws EFapsException
{
final Map<String, String> compiled = readCompiledSources();
final List<T> allsource = readSources();
for (final T onesource : allsource) {
if (AbstractStaticSourceCompiler.LOG.isInfoEnabled()) {
AbstractStaticSourceCompiler.LOG.info("compiling " + onesource.getName());
}
final List<Instance> supers = getSuper(onesource.getInstance());
final StringBuilder builder = new StringBuilder();
while (!supers.isEmpty()) {
builder.append(getCompiledString(supers.get(supers.size() - 1)));
supers.remove(supers.size() - 1);
}
builder.append(getCompiledString(onesource.getInstance()));
final Update update;
if (compiled.containsKey(onesource.getName())) {
update = new Update(compiled.get(onesource.getName()));
} else {
update = new Insert(getClassName4TypeCompiled());
}
update.add("Name", onesource.getName());
update.add("ProgramLink", "" + onesource.getInstance().getId());
update.executeWithoutAccessCheck();
final Instance instance = update.getInstance();
update.close();
byte[] mybytes = null;
try {
mybytes = builder.toString().getBytes("UTF-8");
} catch (final UnsupportedEncodingException e) {
AbstractStaticSourceCompiler.LOG.error("error in reading Bytes from String using UTF-8", e);
}
final ByteArrayInputStream str = new ByteArrayInputStream(mybytes);
String name = onesource.getName().substring(0, onesource.getName().lastIndexOf("."));
name = name.substring(name.lastIndexOf(".") + 1)
+ onesource.getName().substring(onesource.getName().lastIndexOf("."));
final Checkin checkin = new Checkin(instance);
checkin.executeWithoutAccessCheck(name, str, mybytes.length);
}
} } | public class class_name {
public void compile() throws EFapsException
{
final Map<String, String> compiled = readCompiledSources();
final List<T> allsource = readSources();
for (final T onesource : allsource) {
if (AbstractStaticSourceCompiler.LOG.isInfoEnabled()) {
AbstractStaticSourceCompiler.LOG.info("compiling " + onesource.getName()); // depends on control dependency: [if], data = [none]
}
final List<Instance> supers = getSuper(onesource.getInstance());
final StringBuilder builder = new StringBuilder();
while (!supers.isEmpty()) {
builder.append(getCompiledString(supers.get(supers.size() - 1))); // depends on control dependency: [while], data = [none]
supers.remove(supers.size() - 1); // depends on control dependency: [while], data = [none]
}
builder.append(getCompiledString(onesource.getInstance()));
final Update update;
if (compiled.containsKey(onesource.getName())) {
update = new Update(compiled.get(onesource.getName())); // depends on control dependency: [if], data = [none]
} else {
update = new Insert(getClassName4TypeCompiled()); // depends on control dependency: [if], data = [none]
}
update.add("Name", onesource.getName());
update.add("ProgramLink", "" + onesource.getInstance().getId());
update.executeWithoutAccessCheck();
final Instance instance = update.getInstance();
update.close();
byte[] mybytes = null;
try {
mybytes = builder.toString().getBytes("UTF-8"); // depends on control dependency: [try], data = [none]
} catch (final UnsupportedEncodingException e) {
AbstractStaticSourceCompiler.LOG.error("error in reading Bytes from String using UTF-8", e);
} // depends on control dependency: [catch], data = [none]
final ByteArrayInputStream str = new ByteArrayInputStream(mybytes);
String name = onesource.getName().substring(0, onesource.getName().lastIndexOf("."));
name = name.substring(name.lastIndexOf(".") + 1)
+ onesource.getName().substring(onesource.getName().lastIndexOf("."));
final Checkin checkin = new Checkin(instance);
checkin.executeWithoutAccessCheck(name, str, mybytes.length);
}
} } |
public class class_name {
public static <T> T get(Future<T> future, long timeout, TimeUnit timeUnit) {
try {
return future.get(timeout, timeUnit);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static <T> T get(Future<T> future, long timeout, TimeUnit timeUnit) {
try {
return future.get(timeout, timeUnit); // depends on control dependency: [try], data = [none]
} catch (InterruptedException | ExecutionException | TimeoutException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void replaceDefaultFont(Context context, String fontFilePath) {
final Typeface newTypeface = Typeface.createFromAsset(context.getAssets(), fontFilePath);
TypedValue tv = new TypedValue();
String staticTypefaceFieldName = null;
Map<String, Typeface> newMap = null;
Resources.Theme apptentiveTheme = context.getResources().newTheme();
ApptentiveInternal.getInstance().updateApptentiveInteractionTheme(context, apptentiveTheme);
if (apptentiveTheme == null) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (apptentiveTheme.resolveAttribute(R.attr.apptentiveFontFamilyDefault, tv, true)) {
newMap = new HashMap<String, Typeface>();
newMap.put(tv.string.toString(), newTypeface);
}
if (apptentiveTheme.resolveAttribute(R.attr.apptentiveFontFamilyMediumDefault, tv, true)) {
if (newMap == null) {
newMap = new HashMap<String, Typeface>();
}
newMap.put(tv.string.toString(), newTypeface);
}
if (newMap != null) {
try {
final Field staticField = Typeface.class.getDeclaredField("sSystemFontMap");
staticField.setAccessible(true);
staticField.set(null, newMap);
} catch (NoSuchFieldException e) {
ApptentiveLog.e(e, "Exception replacing system font");
logException(e);
} catch (IllegalAccessException e) {
ApptentiveLog.e(e, "Exception replacing system font");
logException(e);
}
}
} else {
if (apptentiveTheme.resolveAttribute(R.attr.apptentiveTypefaceDefault, tv, true)) {
staticTypefaceFieldName = "DEFAULT";
if (tv.data == context.getResources().getInteger(R.integer.apptentive_typeface_monospace)) {
staticTypefaceFieldName = "MONOSPACE";
} else if (tv.data == context.getResources().getInteger(R.integer.apptentive_typeface_serif)) {
staticTypefaceFieldName = "SERIF";
} else if (tv.data == context.getResources().getInteger(R.integer.apptentive_typeface_sans)) {
staticTypefaceFieldName = "SANS_SERIF";
}
try {
final Field staticField = Typeface.class.getDeclaredField(staticTypefaceFieldName);
staticField.setAccessible(true);
staticField.set(null, newTypeface);
} catch (NoSuchFieldException e) {
ApptentiveLog.e(e, "Exception replacing system font");
logException(e);
} catch (IllegalAccessException e) {
ApptentiveLog.e(e, "Exception replacing system font");
logException(e);
}
}
}
} } | public class class_name {
public static void replaceDefaultFont(Context context, String fontFilePath) {
final Typeface newTypeface = Typeface.createFromAsset(context.getAssets(), fontFilePath);
TypedValue tv = new TypedValue();
String staticTypefaceFieldName = null;
Map<String, Typeface> newMap = null;
Resources.Theme apptentiveTheme = context.getResources().newTheme();
ApptentiveInternal.getInstance().updateApptentiveInteractionTheme(context, apptentiveTheme);
if (apptentiveTheme == null) {
return; // depends on control dependency: [if], data = [none]
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (apptentiveTheme.resolveAttribute(R.attr.apptentiveFontFamilyDefault, tv, true)) {
newMap = new HashMap<String, Typeface>(); // depends on control dependency: [if], data = [none]
newMap.put(tv.string.toString(), newTypeface); // depends on control dependency: [if], data = [none]
}
if (apptentiveTheme.resolveAttribute(R.attr.apptentiveFontFamilyMediumDefault, tv, true)) {
if (newMap == null) {
newMap = new HashMap<String, Typeface>(); // depends on control dependency: [if], data = [none]
}
newMap.put(tv.string.toString(), newTypeface); // depends on control dependency: [if], data = [none]
}
if (newMap != null) {
try {
final Field staticField = Typeface.class.getDeclaredField("sSystemFontMap");
staticField.setAccessible(true); // depends on control dependency: [try], data = [none]
staticField.set(null, newMap); // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException e) {
ApptentiveLog.e(e, "Exception replacing system font");
logException(e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
ApptentiveLog.e(e, "Exception replacing system font");
logException(e);
} // depends on control dependency: [catch], data = [none]
}
} else {
if (apptentiveTheme.resolveAttribute(R.attr.apptentiveTypefaceDefault, tv, true)) {
staticTypefaceFieldName = "DEFAULT"; // depends on control dependency: [if], data = [none]
if (tv.data == context.getResources().getInteger(R.integer.apptentive_typeface_monospace)) {
staticTypefaceFieldName = "MONOSPACE"; // depends on control dependency: [if], data = [none]
} else if (tv.data == context.getResources().getInteger(R.integer.apptentive_typeface_serif)) {
staticTypefaceFieldName = "SERIF"; // depends on control dependency: [if], data = [none]
} else if (tv.data == context.getResources().getInteger(R.integer.apptentive_typeface_sans)) {
staticTypefaceFieldName = "SANS_SERIF"; // depends on control dependency: [if], data = [none]
}
try {
final Field staticField = Typeface.class.getDeclaredField(staticTypefaceFieldName);
staticField.setAccessible(true); // depends on control dependency: [try], data = [none]
staticField.set(null, newTypeface); // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException e) {
ApptentiveLog.e(e, "Exception replacing system font");
logException(e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
ApptentiveLog.e(e, "Exception replacing system font");
logException(e);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public void marshall(CreateBGPPeerRequest createBGPPeerRequest, ProtocolMarshaller protocolMarshaller) {
if (createBGPPeerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createBGPPeerRequest.getVirtualInterfaceId(), VIRTUALINTERFACEID_BINDING);
protocolMarshaller.marshall(createBGPPeerRequest.getNewBGPPeer(), NEWBGPPEER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateBGPPeerRequest createBGPPeerRequest, ProtocolMarshaller protocolMarshaller) {
if (createBGPPeerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createBGPPeerRequest.getVirtualInterfaceId(), VIRTUALINTERFACEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createBGPPeerRequest.getNewBGPPeer(), NEWBGPPEER_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 splash() {
frame = shadowBorder ? new ShadowBorderFrame() : new JFrame();
if (isRootFrame())
JOptionPane.setRootFrame(frame);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.setUndecorated(true);
frame.setTitle(loadFrameTitle());
frame.setIconImage(loadFrameIcon());
Component content = createContentPane();
if (content != null) {
frame.getContentPane().add(content);
}
frame.pack();
WindowUtils.centerOnScreen(frame);
frame.setVisible(true);
} } | public class class_name {
public void splash() {
frame = shadowBorder ? new ShadowBorderFrame() : new JFrame();
if (isRootFrame())
JOptionPane.setRootFrame(frame);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.setUndecorated(true);
frame.setTitle(loadFrameTitle());
frame.setIconImage(loadFrameIcon());
Component content = createContentPane();
if (content != null) {
frame.getContentPane().add(content); // depends on control dependency: [if], data = [(content]
}
frame.pack();
WindowUtils.centerOnScreen(frame);
frame.setVisible(true);
} } |
public class class_name {
public Directory getDirectory(final String name) throws IOException
{
return SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Directory>()
{
public Directory run() throws Exception
{
File dir;
if (name.equals("."))
{
dir = baseDir;
}
else
{
dir = new File(baseDir, name);
}
// FSDirectory itself doesnt create dirs now
if (!dir.exists())
{
if (!dir.mkdirs())
{
throw new IOException("Cannot create directory: " + dir);
}
}
LockFactory lockFactory =
(LOCK_FACTORY_CLASS == null) ? new NativeFSLockFactory() : (LockFactory)LOCK_FACTORY_CLASS.newInstance();
if (FS_DIRECTORY_CLASS == null)
{
return FSDirectory.open(dir, lockFactory);
}
else
{
Constructor<? extends FSDirectory> constructor =
FS_DIRECTORY_CLASS.getConstructor(File.class, LockFactory.class);
return constructor.newInstance(dir, lockFactory);
}
}
});
} } | public class class_name {
public Directory getDirectory(final String name) throws IOException
{
return SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Directory>()
{
public Directory run() throws Exception
{
File dir;
if (name.equals("."))
{
dir = baseDir; // depends on control dependency: [if], data = [none]
}
else
{
dir = new File(baseDir, name); // depends on control dependency: [if], data = [none]
}
// FSDirectory itself doesnt create dirs now
if (!dir.exists())
{
if (!dir.mkdirs())
{
throw new IOException("Cannot create directory: " + dir);
}
}
LockFactory lockFactory =
(LOCK_FACTORY_CLASS == null) ? new NativeFSLockFactory() : (LockFactory)LOCK_FACTORY_CLASS.newInstance();
if (FS_DIRECTORY_CLASS == null)
{
return FSDirectory.open(dir, lockFactory); // depends on control dependency: [if], data = [none]
}
else
{
Constructor<? extends FSDirectory> constructor =
FS_DIRECTORY_CLASS.getConstructor(File.class, LockFactory.class); // depends on control dependency: [if], data = [none]
return constructor.newInstance(dir, lockFactory); // depends on control dependency: [if], data = [none]
}
}
});
} } |
public class class_name {
static String convertURLToString(URL url) {
if (URISchemeType.FILE.isURL(url)) {
final StringBuilder externalForm = new StringBuilder();
externalForm.append(url.getPath());
final String ref = url.getRef();
if (!Strings.isEmpty(ref)) {
externalForm.append("#").append(ref); //$NON-NLS-1$
}
return externalForm.toString();
}
return url.toExternalForm();
} } | public class class_name {
static String convertURLToString(URL url) {
if (URISchemeType.FILE.isURL(url)) {
final StringBuilder externalForm = new StringBuilder();
externalForm.append(url.getPath()); // depends on control dependency: [if], data = [none]
final String ref = url.getRef();
if (!Strings.isEmpty(ref)) {
externalForm.append("#").append(ref); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
return externalForm.toString(); // depends on control dependency: [if], data = [none]
}
return url.toExternalForm();
} } |
public class class_name {
private MenuItem addInternal(int group, int id, int categoryOrder, CharSequence title) {
final int ordering = getOrdering(categoryOrder);
final MenuItemImpl item = new MenuItemImpl(this, group, id, categoryOrder,
ordering, title, mDefaultShowAsAction);
if (mCurrentMenuInfo != null) {
// Pass along the current menu info
item.setMenuInfo(mCurrentMenuInfo);
}
mItems.add(findInsertIndex(mItems, ordering), item);
onItemsChanged(true);
return item;
} } | public class class_name {
private MenuItem addInternal(int group, int id, int categoryOrder, CharSequence title) {
final int ordering = getOrdering(categoryOrder);
final MenuItemImpl item = new MenuItemImpl(this, group, id, categoryOrder,
ordering, title, mDefaultShowAsAction);
if (mCurrentMenuInfo != null) {
// Pass along the current menu info
item.setMenuInfo(mCurrentMenuInfo); // depends on control dependency: [if], data = [(mCurrentMenuInfo]
}
mItems.add(findInsertIndex(mItems, ordering), item);
onItemsChanged(true);
return item;
} } |
public class class_name {
private String getSuggestionMessage(ConstructorKey key) {
StringBuilder sb = new StringBuilder(200);
sb.append("No constructor found for '").append(key);
sb.append("' candidates are: ");
Iterator<ConstructorKey> iterator = suggest(key.intf());
while (iterator.hasNext()) {
sb.append(iterator.next());
if (iterator.hasNext()) {
sb.append(", ");
}
}
return sb.toString();
} } | public class class_name {
private String getSuggestionMessage(ConstructorKey key) {
StringBuilder sb = new StringBuilder(200);
sb.append("No constructor found for '").append(key);
sb.append("' candidates are: ");
Iterator<ConstructorKey> iterator = suggest(key.intf());
while (iterator.hasNext()) {
sb.append(iterator.next()); // depends on control dependency: [while], data = [none]
if (iterator.hasNext()) {
sb.append(", "); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} } |
public class class_name {
public int unprotect(RtpPacket packet) {
if (txSessAuthKey == null) {
// Only the tx session key is set at session start, rx is done when
// 1st packet received
log("unprotect() called out of session");
return UNPROTECT_SESSION_NOT_STARTED;
}
if (packet == null) {
logWarning("unprotect() called with null RtpPacket");
return UNPROTECT_NULL_PACKET;
}
if (previousSSRC != packet.getSscr()) {
previousSSRC = packet.getSscr();
// reset indexes & Seq
rxRoc = 0;
rxSeq = packet.getSequenceNumber();
replayWindow.removeAllElements();
logWarning("New SSRC detected. Resetting SRTP replay protection");
}
if (!receivedFirst) {
receivedFirst = true;
rxSeq = packet.getSequenceNumber();
if (VERBOSE) {
log("unprotect() iRxSeq = " + rxSeq);
}
if (!rxSessionKeyDerivation()) {
logWarning("unprotect() unable to create session keys");
return UNPROTECT_ERROR_DECRYPTING;
}
}
// First need to work out the implicit srtp sequence number,
// see rfc3711 appendix A & section 3.3.1
// Using same naming convention as in rfc for ROC estimate (v)
// Needs to be done before authentication as v is used as part of auth
long v;
int seq = packet.getSequenceNumber();
if (rxSeq < 0x8000) {
if ((seq - rxSeq) > 0x8000) {
v = rxRoc - 0x10000L;
} else {
v = rxRoc;
}
} else {
if ((rxSeq - 0x8000) > seq) {
v = rxRoc + 0x10000L;
} else {
v = rxRoc;
}
}
long index = v + seq;
if (SUPER_VERBOSE) {
log("unprotect(), seq = " + seq);
logBuffer("unprotect(), rcvd pkt = ", packet.getPacket());
}
if (isReplayedPacket(index)) {
logWarning("Replayed packet received, sequence number=#" + seq
+ ", index=" + index);
return UNPROTECT_REPLAYED_PACKET;
}
// Now need to check authentication & remove auth bytes from payload
int originalLen = packet.getPayloadLength();
int newLen = originalLen - getHmacAuthSizeBytes();
// we'll reduce the payload length but the auth-code will still be
// present after the payload for comparison
int pktAuthCodePos = packet.getHeaderLength() + newLen;
packet.setPayloadLength(newLen);
byte[] authCode = null;
try {
authCode = getAuthentication(packet, v, false); // iRxSessAuthKey);
} catch (Throwable e) {
logError("unprotect() error getting authCode EX: " + e);
e.printStackTrace();
return UNPROTECT_ERROR_DECRYPTING;
}
if (!platform.getUtils().equals(authCode, 0, packet.getPacket(),
pktAuthCodePos, getHmacAuthSizeBytes())) {
// Auth failed
logWarning("unprotect() Authentication failed");
logBuffer("authCode:", authCode);
byte[] pktAuthCode = new byte[getHmacAuthSizeBytes()];
System.arraycopy(packet.getPacket(), pktAuthCodePos, pktAuthCode,
0, getHmacAuthSizeBytes());
logBuffer("pktAuthCode:", pktAuthCode);
logBuffer("iRxSessAuthKey:", rxSessAuthKey);
log("v = " + Integer.toHexString((int) v) + " (" + v + ")");
return UNPROTECT_INVALID_PACKET;
}
if (VERBOSE) {
log("unprotect() -------- Authenticated OK --------");
}
// Authenticated, now unprotect the payload
// Note the use of encryptIV() in transformPayload is correct
// At 1st sight, might expect to use decrypt but unprotection consists
// of XORing payload with an encrypted IV to obtain original payload
// data
if (!transformPayload(packet, v, seq, rxSessSaltKey, false)) {
log("unprotect() transformPayload error, decryption failed");
return UNPROTECT_ERROR_DECRYPTING;
}
// Payload now unprotected. Update the latest seq & ROC ready for next
// packet
if (v == rxRoc) {
if (seq > rxSeq) {
rxSeq = seq;
}
} else if (v == rxRoc + 0x10000L) {
rxRoc += 0x10000L;
rxSeq = seq;
}
if (SUPER_VERBOSE) {
logBuffer("unprotect(), new packet - ", packet.getPacket());
}
return UNPROTECT_OK;
} } | public class class_name {
public int unprotect(RtpPacket packet) {
if (txSessAuthKey == null) {
// Only the tx session key is set at session start, rx is done when
// 1st packet received
log("unprotect() called out of session"); // depends on control dependency: [if], data = [none]
return UNPROTECT_SESSION_NOT_STARTED; // depends on control dependency: [if], data = [none]
}
if (packet == null) {
logWarning("unprotect() called with null RtpPacket"); // depends on control dependency: [if], data = [none]
return UNPROTECT_NULL_PACKET; // depends on control dependency: [if], data = [none]
}
if (previousSSRC != packet.getSscr()) {
previousSSRC = packet.getSscr(); // depends on control dependency: [if], data = [none]
// reset indexes & Seq
rxRoc = 0; // depends on control dependency: [if], data = [none]
rxSeq = packet.getSequenceNumber(); // depends on control dependency: [if], data = [none]
replayWindow.removeAllElements(); // depends on control dependency: [if], data = [none]
logWarning("New SSRC detected. Resetting SRTP replay protection"); // depends on control dependency: [if], data = [none]
}
if (!receivedFirst) {
receivedFirst = true; // depends on control dependency: [if], data = [none]
rxSeq = packet.getSequenceNumber(); // depends on control dependency: [if], data = [none]
if (VERBOSE) {
log("unprotect() iRxSeq = " + rxSeq); // depends on control dependency: [if], data = [none]
}
if (!rxSessionKeyDerivation()) {
logWarning("unprotect() unable to create session keys"); // depends on control dependency: [if], data = [none]
return UNPROTECT_ERROR_DECRYPTING; // depends on control dependency: [if], data = [none]
}
}
// First need to work out the implicit srtp sequence number,
// see rfc3711 appendix A & section 3.3.1
// Using same naming convention as in rfc for ROC estimate (v)
// Needs to be done before authentication as v is used as part of auth
long v;
int seq = packet.getSequenceNumber();
if (rxSeq < 0x8000) {
if ((seq - rxSeq) > 0x8000) {
v = rxRoc - 0x10000L; // depends on control dependency: [if], data = [none]
} else {
v = rxRoc; // depends on control dependency: [if], data = [none]
}
} else {
if ((rxSeq - 0x8000) > seq) {
v = rxRoc + 0x10000L; // depends on control dependency: [if], data = [none]
} else {
v = rxRoc; // depends on control dependency: [if], data = [none]
}
}
long index = v + seq;
if (SUPER_VERBOSE) {
log("unprotect(), seq = " + seq); // depends on control dependency: [if], data = [none]
logBuffer("unprotect(), rcvd pkt = ", packet.getPacket()); // depends on control dependency: [if], data = [none]
}
if (isReplayedPacket(index)) {
logWarning("Replayed packet received, sequence number=#" + seq
+ ", index=" + index); // depends on control dependency: [if], data = [none]
return UNPROTECT_REPLAYED_PACKET; // depends on control dependency: [if], data = [none]
}
// Now need to check authentication & remove auth bytes from payload
int originalLen = packet.getPayloadLength();
int newLen = originalLen - getHmacAuthSizeBytes();
// we'll reduce the payload length but the auth-code will still be
// present after the payload for comparison
int pktAuthCodePos = packet.getHeaderLength() + newLen;
packet.setPayloadLength(newLen);
byte[] authCode = null;
try {
authCode = getAuthentication(packet, v, false); // iRxSessAuthKey); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
logError("unprotect() error getting authCode EX: " + e);
e.printStackTrace();
return UNPROTECT_ERROR_DECRYPTING;
} // depends on control dependency: [catch], data = [none]
if (!platform.getUtils().equals(authCode, 0, packet.getPacket(),
pktAuthCodePos, getHmacAuthSizeBytes())) {
// Auth failed
logWarning("unprotect() Authentication failed"); // depends on control dependency: [if], data = [none]
logBuffer("authCode:", authCode); // depends on control dependency: [if], data = [none]
byte[] pktAuthCode = new byte[getHmacAuthSizeBytes()];
System.arraycopy(packet.getPacket(), pktAuthCodePos, pktAuthCode,
0, getHmacAuthSizeBytes()); // depends on control dependency: [if], data = [none]
logBuffer("pktAuthCode:", pktAuthCode); // depends on control dependency: [if], data = [none]
logBuffer("iRxSessAuthKey:", rxSessAuthKey); // depends on control dependency: [if], data = [none]
log("v = " + Integer.toHexString((int) v) + " (" + v + ")");
return UNPROTECT_INVALID_PACKET;
}
if (VERBOSE) {
log("unprotect() -------- Authenticated OK --------");
}
// Authenticated, now unprotect the payload
// Note the use of encryptIV() in transformPayload is correct
// At 1st sight, might expect to use decrypt but unprotection consists
// of XORing payload with an encrypted IV to obtain original payload
// data
if (!transformPayload(packet, v, seq, rxSessSaltKey, false)) {
log("unprotect() transformPayload error, decryption failed"); // depends on control dependency: [if], data = [none]
return UNPROTECT_ERROR_DECRYPTING; // depends on control dependency: [if], data = [none]
}
// Payload now unprotected. Update the latest seq & ROC ready for next
// packet
if (v == rxRoc) {
if (seq > rxSeq) {
rxSeq = seq; // depends on control dependency: [if], data = [none]
}
} else if (v == rxRoc + 0x10000L) {
rxRoc += 0x10000L; // depends on control dependency: [if], data = [none]
rxSeq = seq; // depends on control dependency: [if], data = [none]
}
if (SUPER_VERBOSE) {
logBuffer("unprotect(), new packet - ", packet.getPacket()); // depends on control dependency: [if], data = [none]
}
return UNPROTECT_OK; // depends on control dependency: [if], data = [none]
} } |
public class class_name {
@Override
public void removeByC_C(long classNameId, long classPK) {
for (CPAttachmentFileEntry cpAttachmentFileEntry : findByC_C(
classNameId, classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpAttachmentFileEntry);
}
} } | public class class_name {
@Override
public void removeByC_C(long classNameId, long classPK) {
for (CPAttachmentFileEntry cpAttachmentFileEntry : findByC_C(
classNameId, classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpAttachmentFileEntry); // depends on control dependency: [for], data = [cpAttachmentFileEntry]
}
} } |
public class class_name {
private String getJoinColumnName(Field relation)
{
String columnName = null;
JoinColumn ann = relation.getAnnotation(JoinColumn.class);
if (ann != null)
{
columnName = ann.name();
}
return StringUtils.isBlank(columnName) ? relation.getName() : columnName;
} } | public class class_name {
private String getJoinColumnName(Field relation)
{
String columnName = null;
JoinColumn ann = relation.getAnnotation(JoinColumn.class);
if (ann != null)
{
columnName = ann.name();
// depends on control dependency: [if], data = [none]
}
return StringUtils.isBlank(columnName) ? relation.getName() : columnName;
} } |
public class class_name {
public static boolean isCompositeComponentExpression(String expression)
{
if (expression.contains(CC))
{
return CC_EXPRESSION_REGEX.matcher(expression).matches();
}
else
{
return false;
}
} } | public class class_name {
public static boolean isCompositeComponentExpression(String expression)
{
if (expression.contains(CC))
{
return CC_EXPRESSION_REGEX.matcher(expression).matches(); // depends on control dependency: [if], data = [none]
}
else
{
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(GetGroupRequest getGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (getGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getGroupRequest.getGroupName(), GROUPNAME_BINDING);
protocolMarshaller.marshall(getGroupRequest.getGroupARN(), GROUPARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetGroupRequest getGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (getGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getGroupRequest.getGroupName(), GROUPNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getGroupRequest.getGroupARN(), GROUPARN_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 ServiceCall<Translation> getWord(GetWordOptions getWordOptions) {
Validator.notNull(getWordOptions, "getWordOptions cannot be null");
String[] pathSegments = { "v1/customizations", "words" };
String[] pathParameters = { getWordOptions.customizationId(), getWordOptions.word() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "getWord");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Translation.class));
} } | public class class_name {
public ServiceCall<Translation> getWord(GetWordOptions getWordOptions) {
Validator.notNull(getWordOptions, "getWordOptions cannot be null");
String[] pathSegments = { "v1/customizations", "words" };
String[] pathParameters = { getWordOptions.customizationId(), getWordOptions.word() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "getWord");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Translation.class));
} } |
public class class_name {
@SuppressWarnings("unchecked")
void merge(final long key, final S summary, final SummarySetOperations<S> summarySetOps) {
isEmpty_ = false;
if (key < theta_) {
final int index = findOrInsert(key);
if (index < 0) {
insertSummary(~index, (S)summary.copy());
} else {
insertSummary(index, summarySetOps.union(summaries_[index], summary));
}
rebuildIfNeeded();
}
} } | public class class_name {
@SuppressWarnings("unchecked")
void merge(final long key, final S summary, final SummarySetOperations<S> summarySetOps) {
isEmpty_ = false;
if (key < theta_) {
final int index = findOrInsert(key);
if (index < 0) {
insertSummary(~index, (S)summary.copy()); // depends on control dependency: [if], data = [none]
} else {
insertSummary(index, summarySetOps.union(summaries_[index], summary)); // depends on control dependency: [if], data = [(index]
}
rebuildIfNeeded(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String createAutoFormHtml(String reqUrl, Map<String, String> hiddens,String encoding) {
StringBuffer sf = new StringBuffer();
sf.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset="+encoding+"\"/></head><body>");
sf.append("<form id = \"pay_form\" action=\"" + reqUrl
+ "\" method=\"post\">");
if (null != hiddens && 0 != hiddens.size()) {
Set<Entry<String, String>> set = hiddens.entrySet();
Iterator<Entry<String, String>> it = set.iterator();
while (it.hasNext()) {
Entry<String, String> ey = it.next();
String key = ey.getKey();
String value = ey.getValue();
sf.append("<input type=\"hidden\" name=\"" + key + "\" id=\""
+ key + "\" value=\"" + value + "\"/>");
}
}
sf.append("</form>");
sf.append("</body>");
sf.append("<script type=\"text/javascript\">");
sf.append("document.all.pay_form.submit();");
sf.append("</script>");
sf.append("</html>");
return sf.toString();
} } | public class class_name {
public static String createAutoFormHtml(String reqUrl, Map<String, String> hiddens,String encoding) {
StringBuffer sf = new StringBuffer();
sf.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset="+encoding+"\"/></head><body>");
sf.append("<form id = \"pay_form\" action=\"" + reqUrl
+ "\" method=\"post\">");
if (null != hiddens && 0 != hiddens.size()) {
Set<Entry<String, String>> set = hiddens.entrySet();
Iterator<Entry<String, String>> it = set.iterator();
while (it.hasNext()) {
Entry<String, String> ey = it.next();
String key = ey.getKey();
String value = ey.getValue();
sf.append("<input type=\"hidden\" name=\"" + key + "\" id=\""
+ key + "\" value=\"" + value + "\"/>"); // depends on control dependency: [while], data = [none]
}
}
sf.append("</form>");
sf.append("</body>");
sf.append("<script type=\"text/javascript\">");
sf.append("document.all.pay_form.submit();");
sf.append("</script>");
sf.append("</html>");
return sf.toString();
} } |
public class class_name {
Map<String,Object> executeEvent(Transaction trans, Map<String,Object> args, StringBuilder statementHolder) throws PersistenceException {
logger.debug("enter - execute(Transaction, Map)");
state = "EXECUTING";
try {
if( logger.isDebugEnabled() ) {
logger.debug("Getting connection from transaction: " + trans.getTransactionId());
}
connection = trans.getConnection();
data = args;
try {
String sql = loadStatement(connection, args);
Map<String,Object> res;
if( logger.isDebugEnabled() ) {
logger.debug("Preparing: " + sql);
}
if( statementHolder != null ) {
statementHolder.append(sql);
}
statement = connection.prepareStatement(sql);
try {
logger.debug("And executing the prepared statement.");
res = run(trans, args);
}
finally {
try { statement.close(); statement = null; }
catch( Throwable ignore ) { }
}
if( logger.isDebugEnabled() ) {
logger.debug("RESULTS: " + res);
}
if( res == null ) {
return null;
}
else if( res instanceof HashMap ) {
return (HashMap<String,Object>)res;
}
else {
HashMap<String,Object> tmp = new HashMap<String,Object>();
tmp.putAll(res);
return tmp;
}
}
catch( SQLException e ) {
logger.debug("Error executing event: " + e.getMessage(), e);
throw new PersistenceException(e.getMessage());
}
}
finally {
state = "IDLE";
logger.debug("exit - execute(Transaction, Map)");
}
} } | public class class_name {
Map<String,Object> executeEvent(Transaction trans, Map<String,Object> args, StringBuilder statementHolder) throws PersistenceException {
logger.debug("enter - execute(Transaction, Map)");
state = "EXECUTING";
try {
if( logger.isDebugEnabled() ) {
logger.debug("Getting connection from transaction: " + trans.getTransactionId()); // depends on control dependency: [if], data = [none]
}
connection = trans.getConnection();
data = args;
try {
String sql = loadStatement(connection, args);
Map<String,Object> res;
if( logger.isDebugEnabled() ) {
logger.debug("Preparing: " + sql); // depends on control dependency: [if], data = [none]
}
if( statementHolder != null ) {
statementHolder.append(sql); // depends on control dependency: [if], data = [none]
}
statement = connection.prepareStatement(sql); // depends on control dependency: [try], data = [none]
try {
logger.debug("And executing the prepared statement."); // depends on control dependency: [try], data = [none]
res = run(trans, args); // depends on control dependency: [try], data = [none]
}
finally {
try { statement.close(); statement = null; } // depends on control dependency: [try], data = [none] // depends on control dependency: [try], data = [none]
catch( Throwable ignore ) { } // depends on control dependency: [catch], data = [none]
}
if( logger.isDebugEnabled() ) {
logger.debug("RESULTS: " + res); // depends on control dependency: [if], data = [none]
}
if( res == null ) {
return null; // depends on control dependency: [if], data = [none]
}
else if( res instanceof HashMap ) {
return (HashMap<String,Object>)res; // depends on control dependency: [if], data = [none]
}
else {
HashMap<String,Object> tmp = new HashMap<String,Object>();
tmp.putAll(res); // depends on control dependency: [if], data = [none]
return tmp; // depends on control dependency: [if], data = [none]
}
}
catch( SQLException e ) {
logger.debug("Error executing event: " + e.getMessage(), e);
throw new PersistenceException(e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
finally {
state = "IDLE";
logger.debug("exit - execute(Transaction, Map)");
}
} } |
public class class_name {
public Map<Computer,List<LogRecord>> getSlaveLogRecords() {
Map<Computer,List<LogRecord>> result = new TreeMap<Computer,List<LogRecord>>(new Comparator<Computer>() {
final Collator COLL = Collator.getInstance();
public int compare(Computer c1, Computer c2) {
return COLL.compare(c1.getDisplayName(), c2.getDisplayName());
}
});
for (Computer c : Jenkins.getInstance().getComputers()) {
if (c.getName().length() == 0) {
continue; // master
}
List<LogRecord> recs = new ArrayList<LogRecord>();
try {
for (LogRecord rec : c.getLogRecords()) {
for (Target t : targets) {
if (t.includes(rec)) {
recs.add(rec);
break;
}
}
}
} catch (IOException x) {
continue;
} catch (InterruptedException x) {
continue;
}
if (!recs.isEmpty()) {
result.put(c, recs);
}
}
return result;
} } | public class class_name {
public Map<Computer,List<LogRecord>> getSlaveLogRecords() {
Map<Computer,List<LogRecord>> result = new TreeMap<Computer,List<LogRecord>>(new Comparator<Computer>() {
final Collator COLL = Collator.getInstance();
public int compare(Computer c1, Computer c2) {
return COLL.compare(c1.getDisplayName(), c2.getDisplayName());
}
});
for (Computer c : Jenkins.getInstance().getComputers()) {
if (c.getName().length() == 0) {
continue; // master
}
List<LogRecord> recs = new ArrayList<LogRecord>();
try {
for (LogRecord rec : c.getLogRecords()) {
for (Target t : targets) {
if (t.includes(rec)) {
recs.add(rec); // depends on control dependency: [if], data = [none]
break;
}
}
}
} catch (IOException x) {
continue;
} catch (InterruptedException x) { // depends on control dependency: [catch], data = [none]
continue;
} // depends on control dependency: [catch], data = [none]
if (!recs.isEmpty()) {
result.put(c, recs); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public List<MessageDestinationRefType<WebFragmentDescriptor>> getAllMessageDestinationRef()
{
List<MessageDestinationRefType<WebFragmentDescriptor>> list = new ArrayList<MessageDestinationRefType<WebFragmentDescriptor>>();
List<Node> nodeList = model.get("message-destination-ref");
for(Node node: nodeList)
{
MessageDestinationRefType<WebFragmentDescriptor> type = new MessageDestinationRefTypeImpl<WebFragmentDescriptor>(this, "message-destination-ref", model, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<MessageDestinationRefType<WebFragmentDescriptor>> getAllMessageDestinationRef()
{
List<MessageDestinationRefType<WebFragmentDescriptor>> list = new ArrayList<MessageDestinationRefType<WebFragmentDescriptor>>();
List<Node> nodeList = model.get("message-destination-ref");
for(Node node: nodeList)
{
MessageDestinationRefType<WebFragmentDescriptor> type = new MessageDestinationRefTypeImpl<WebFragmentDescriptor>(this, "message-destination-ref", model, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.