code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public List<BeanType<ValidationMappingDescriptor>> getAllBean()
{
List<BeanType<ValidationMappingDescriptor>> list = new ArrayList<BeanType<ValidationMappingDescriptor>>();
List<Node> nodeList = model.get("bean");
for(Node node: nodeList)
{
BeanType<ValidationMappingDescriptor> type = new BeanTypeImpl<ValidationMappingDescriptor>(this, "bean", model, node);
list.add(type);
}
return list;
} }
|
public class class_name {
public List<BeanType<ValidationMappingDescriptor>> getAllBean()
{
List<BeanType<ValidationMappingDescriptor>> list = new ArrayList<BeanType<ValidationMappingDescriptor>>();
List<Node> nodeList = model.get("bean");
for(Node node: nodeList)
{
BeanType<ValidationMappingDescriptor> type = new BeanTypeImpl<ValidationMappingDescriptor>(this, "bean", model, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
protected static NodeDiscoveryProvider buildLocationProvider(ClusterConfig config) {
NodeDiscoveryConfig discoveryProviderConfig = config.getDiscoveryConfig();
if (discoveryProviderConfig != null) {
return discoveryProviderConfig.getType().newProvider(discoveryProviderConfig);
}
if (config.getMulticastConfig().isEnabled()) {
return new MulticastDiscoveryProvider(new MulticastDiscoveryConfig());
} else {
return new BootstrapDiscoveryProvider(Collections.emptyList());
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
protected static NodeDiscoveryProvider buildLocationProvider(ClusterConfig config) {
NodeDiscoveryConfig discoveryProviderConfig = config.getDiscoveryConfig();
if (discoveryProviderConfig != null) {
return discoveryProviderConfig.getType().newProvider(discoveryProviderConfig); // depends on control dependency: [if], data = [(discoveryProviderConfig]
}
if (config.getMulticastConfig().isEnabled()) {
return new MulticastDiscoveryProvider(new MulticastDiscoveryConfig()); // depends on control dependency: [if], data = [none]
} else {
return new BootstrapDiscoveryProvider(Collections.emptyList()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static ClassLoader getDefaultClassLoader() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (Exception e) {
} // Cannot access thread context ClassLoader - falling back to system class loader...
if (cl == null) { // No thread context class loader -> use class loader of this class.
cl = ReflectionUtils.class.getClassLoader();
}
return cl;
} }
|
public class class_name {
public static ClassLoader getDefaultClassLoader() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // Cannot access thread context ClassLoader - falling back to system class loader... // depends on control dependency: [catch], data = [none]
if (cl == null) { // No thread context class loader -> use class loader of this class.
cl = ReflectionUtils.class.getClassLoader(); // depends on control dependency: [if], data = [none]
}
return cl;
} }
|
public class class_name {
@Override
public FittingFunctionResult eval(double x, double[] params) {
final int len = params.length;
// We always need triples: (mean, stddev, scaling)
assert (len % 3) == 0;
double y = 0.0;
double[] gradients = new double[len];
// Loosely based on the book:
// Numerical Recipes in C: The Art of Scientific Computing
// Due to their license, we cannot use their code, but we have to implement
// the mathematics ourselves. We hope the loss in precision is not too big.
for(int i = 2; i < params.length; i += 3) {
// Standardized Gaussian parameter (centered, scaled by stddev)
double stdpar = (x - params[i - 2]) / params[i - 1];
double e = FastMath.exp(-.5 * stdpar * stdpar);
double localy = params[i] / (params[i - 1] * MathUtil.SQRTTWOPI) * e;
y += localy;
// mean gradient
gradients[i - 2] = localy * stdpar;
// stddev gradient
gradients[i - 1] = (stdpar * stdpar - 1.0) * localy;
// amplitude gradient
gradients[i] = e / (params[i - 1] * MathUtil.SQRTTWOPI);
}
return new FittingFunctionResult(y, gradients);
} }
|
public class class_name {
@Override
public FittingFunctionResult eval(double x, double[] params) {
final int len = params.length;
// We always need triples: (mean, stddev, scaling)
assert (len % 3) == 0;
double y = 0.0;
double[] gradients = new double[len];
// Loosely based on the book:
// Numerical Recipes in C: The Art of Scientific Computing
// Due to their license, we cannot use their code, but we have to implement
// the mathematics ourselves. We hope the loss in precision is not too big.
for(int i = 2; i < params.length; i += 3) {
// Standardized Gaussian parameter (centered, scaled by stddev)
double stdpar = (x - params[i - 2]) / params[i - 1];
double e = FastMath.exp(-.5 * stdpar * stdpar);
double localy = params[i] / (params[i - 1] * MathUtil.SQRTTWOPI) * e;
y += localy; // depends on control dependency: [for], data = [none]
// mean gradient
gradients[i - 2] = localy * stdpar; // depends on control dependency: [for], data = [i]
// stddev gradient
gradients[i - 1] = (stdpar * stdpar - 1.0) * localy; // depends on control dependency: [for], data = [i]
// amplitude gradient
gradients[i] = e / (params[i - 1] * MathUtil.SQRTTWOPI); // depends on control dependency: [for], data = [i]
}
return new FittingFunctionResult(y, gradients);
} }
|
public class class_name {
public String rolesToYml(Collection<Role> roles) {
try {
Map<String, Role> map = new TreeMap<>();
roles.forEach(role -> map.put(role.getKey(), role));
return mapper.writeValueAsString(map);
} catch (Exception e) {
log.error("Failed to create roles YML file from collection, error: {}", e.getMessage(), e);
}
return null;
} }
|
public class class_name {
public String rolesToYml(Collection<Role> roles) {
try {
Map<String, Role> map = new TreeMap<>();
roles.forEach(role -> map.put(role.getKey(), role)); // depends on control dependency: [try], data = [none]
return mapper.writeValueAsString(map); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Failed to create roles YML file from collection, error: {}", e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
public void pushMessages(List<Pair<K, V>> messages) {
for (Pair<K, V> message: messages) {
this.producer.send(new ProducerRecord<>(topic, message.getKey(), message.getValue()), (recordMetadata, e) -> {
if (e != null) {
log.error("Failed to send message to topic {} due to exception: ", topic, e);
}
});
}
} }
|
public class class_name {
public void pushMessages(List<Pair<K, V>> messages) {
for (Pair<K, V> message: messages) {
this.producer.send(new ProducerRecord<>(topic, message.getKey(), message.getValue()), (recordMetadata, e) -> {
if (e != null) {
log.error("Failed to send message to topic {} due to exception: ", topic, e); // depends on control dependency: [if], data = [none]
}
});
}
} }
|
public class class_name {
public OutlierResult run(Database database, Relation<O> relation) {
StepProgress stepprog = LOG.isVerbose() ? new StepProgress("IDOS", 3) : null;
if(stepprog != null) {
stepprog.beginStep(1, "Precomputing neighborhoods", LOG);
}
KNNQuery<O> knnQ = DatabaseUtil.precomputedKNNQuery(database, relation, getDistanceFunction(), Math.max(k_c, k_r) + 1);
DBIDs ids = relation.getDBIDs();
if(stepprog != null) {
stepprog.beginStep(2, "Computing intrinsic dimensionalities", LOG);
}
DoubleDataStore intDims = computeIDs(ids, knnQ);
if(stepprog != null) {
stepprog.beginStep(3, "Computing IDOS scores", LOG);
}
DoubleMinMax idosminmax = new DoubleMinMax();
DoubleDataStore ldms = computeIDOS(ids, knnQ, intDims, idosminmax);
if(stepprog != null) {
stepprog.setCompleted(LOG);
}
DoubleRelation scoreResult = new MaterializedDoubleRelation("Intrinsic Dimensionality Outlier Score", "idos", ldms, ids);
OutlierScoreMeta scoreMeta = new QuotientOutlierScoreMeta(idosminmax.getMin(), idosminmax.getMax(), 0.0, Double.POSITIVE_INFINITY, 1.0);
return new OutlierResult(scoreMeta, scoreResult);
} }
|
public class class_name {
public OutlierResult run(Database database, Relation<O> relation) {
StepProgress stepprog = LOG.isVerbose() ? new StepProgress("IDOS", 3) : null;
if(stepprog != null) {
stepprog.beginStep(1, "Precomputing neighborhoods", LOG); // depends on control dependency: [if], data = [none]
}
KNNQuery<O> knnQ = DatabaseUtil.precomputedKNNQuery(database, relation, getDistanceFunction(), Math.max(k_c, k_r) + 1);
DBIDs ids = relation.getDBIDs();
if(stepprog != null) {
stepprog.beginStep(2, "Computing intrinsic dimensionalities", LOG); // depends on control dependency: [if], data = [none]
}
DoubleDataStore intDims = computeIDs(ids, knnQ);
if(stepprog != null) {
stepprog.beginStep(3, "Computing IDOS scores", LOG); // depends on control dependency: [if], data = [none]
}
DoubleMinMax idosminmax = new DoubleMinMax();
DoubleDataStore ldms = computeIDOS(ids, knnQ, intDims, idosminmax);
if(stepprog != null) {
stepprog.setCompleted(LOG); // depends on control dependency: [if], data = [none]
}
DoubleRelation scoreResult = new MaterializedDoubleRelation("Intrinsic Dimensionality Outlier Score", "idos", ldms, ids);
OutlierScoreMeta scoreMeta = new QuotientOutlierScoreMeta(idosminmax.getMin(), idosminmax.getMax(), 0.0, Double.POSITIVE_INFINITY, 1.0);
return new OutlierResult(scoreMeta, scoreResult);
} }
|
public class class_name {
@Override
public com.ibm.websphere.cache.CacheEntry getEntry(Object id, int source, boolean ignoreCounting, boolean incrementRefCount) {
final String methodName = "getEntry()";
com.ibm.websphere.cache.CacheEntry ce = this.coreCache.get(id);
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id + " cacheEntry=" + ce);
}
return ce;
} }
|
public class class_name {
@Override
public com.ibm.websphere.cache.CacheEntry getEntry(Object id, int source, boolean ignoreCounting, boolean incrementRefCount) {
final String methodName = "getEntry()";
com.ibm.websphere.cache.CacheEntry ce = this.coreCache.get(id);
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id + " cacheEntry=" + ce); // depends on control dependency: [if], data = [none]
}
return ce;
} }
|
public class class_name {
public EEnum getIfcElectricFlowStorageDeviceTypeEnum() {
if (ifcElectricFlowStorageDeviceTypeEnumEEnum == null) {
ifcElectricFlowStorageDeviceTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(825);
}
return ifcElectricFlowStorageDeviceTypeEnumEEnum;
} }
|
public class class_name {
public EEnum getIfcElectricFlowStorageDeviceTypeEnum() {
if (ifcElectricFlowStorageDeviceTypeEnumEEnum == null) {
ifcElectricFlowStorageDeviceTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(825);
// depends on control dependency: [if], data = [none]
}
return ifcElectricFlowStorageDeviceTypeEnumEEnum;
} }
|
public class class_name {
public EClass getIfcTextTransformation() {
if (ifcTextTransformationEClass == null) {
ifcTextTransformationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(748);
}
return ifcTextTransformationEClass;
} }
|
public class class_name {
public EClass getIfcTextTransformation() {
if (ifcTextTransformationEClass == null) {
ifcTextTransformationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(748);
// depends on control dependency: [if], data = [none]
}
return ifcTextTransformationEClass;
} }
|
public class class_name {
private void buildImplementedMethodList() {
Set<TypeMirror> intfacs = utils.getAllInterfaces(typeElement);
for (TypeMirror interfaceType : intfacs) {
ExecutableElement found = utils.findMethod(utils.asTypeElement(interfaceType), method);
if (found != null) {
removeOverriddenMethod(found);
if (!overridingMethodFound(found)) {
methlist.add(found);
interfaces.put(found, interfaceType);
}
}
}
} }
|
public class class_name {
private void buildImplementedMethodList() {
Set<TypeMirror> intfacs = utils.getAllInterfaces(typeElement);
for (TypeMirror interfaceType : intfacs) {
ExecutableElement found = utils.findMethod(utils.asTypeElement(interfaceType), method);
if (found != null) {
removeOverriddenMethod(found); // depends on control dependency: [if], data = [(found]
if (!overridingMethodFound(found)) {
methlist.add(found); // depends on control dependency: [if], data = [none]
interfaces.put(found, interfaceType); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public GetAuthorizersResult withItems(Authorizer... items) {
if (this.items == null) {
setItems(new java.util.ArrayList<Authorizer>(items.length));
}
for (Authorizer ele : items) {
this.items.add(ele);
}
return this;
} }
|
public class class_name {
public GetAuthorizersResult withItems(Authorizer... items) {
if (this.items == null) {
setItems(new java.util.ArrayList<Authorizer>(items.length)); // depends on control dependency: [if], data = [none]
}
for (Authorizer ele : items) {
this.items.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static boolean matchPattern(String name, String pattern) {
if (name == null || pattern == null) {
return false;
}
if (name.equals(pattern)) {
// exact match
return true;
}
if (matchWildcard(name, pattern)) {
return true;
}
if (matchRegex(name, pattern)) {
return true;
}
// no match
return false;
} }
|
public class class_name {
public static boolean matchPattern(String name, String pattern) {
if (name == null || pattern == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (name.equals(pattern)) {
// exact match
return true; // depends on control dependency: [if], data = [none]
}
if (matchWildcard(name, pattern)) {
return true; // depends on control dependency: [if], data = [none]
}
if (matchRegex(name, pattern)) {
return true; // depends on control dependency: [if], data = [none]
}
// no match
return false;
} }
|
public class class_name {
public final DSLMapParser.mapping_file_return mapping_file() throws RecognitionException {
DSLMapParser.mapping_file_return retval = new DSLMapParser.mapping_file_return();
retval.start = input.LT(1);
Object root_0 = null;
ParserRuleReturnScope statement1 =null;
RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
try {
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:107:5: ( ( statement )* -> ^( VT_DSL_GRAMMAR ( statement )* ) )
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:107:7: ( statement )*
{
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:107:7: ( statement )*
loop1:
while (true) {
int alt1=2;
int LA1_0 = input.LA(1);
if ( (LA1_0==EOL||LA1_0==LEFT_SQUARE) ) {
alt1=1;
}
switch (alt1) {
case 1 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:107:7: statement
{
pushFollow(FOLLOW_statement_in_mapping_file275);
statement1=statement();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_statement.add(statement1.getTree());
}
break;
default :
break loop1;
}
}
// AST REWRITE
// elements: statement
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if ( state.backtracking==0 ) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (Object)adaptor.nil();
// 108:5: -> ^( VT_DSL_GRAMMAR ( statement )* )
{
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:108:8: ^( VT_DSL_GRAMMAR ( statement )* )
{
Object root_1 = (Object)adaptor.nil();
root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(VT_DSL_GRAMMAR, "VT_DSL_GRAMMAR"), root_1);
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:108:25: ( statement )*
while ( stream_statement.hasNext() ) {
adaptor.addChild(root_1, stream_statement.nextTree());
}
stream_statement.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
retval.stop = input.LT(-1);
if ( state.backtracking==0 ) {
retval.tree = (Object)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} }
|
public class class_name {
public final DSLMapParser.mapping_file_return mapping_file() throws RecognitionException {
DSLMapParser.mapping_file_return retval = new DSLMapParser.mapping_file_return();
retval.start = input.LT(1);
Object root_0 = null;
ParserRuleReturnScope statement1 =null;
RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
try {
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:107:5: ( ( statement )* -> ^( VT_DSL_GRAMMAR ( statement )* ) )
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:107:7: ( statement )*
{
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:107:7: ( statement )*
loop1:
while (true) {
int alt1=2;
int LA1_0 = input.LA(1);
if ( (LA1_0==EOL||LA1_0==LEFT_SQUARE) ) {
alt1=1; // depends on control dependency: [if], data = [none]
}
switch (alt1) {
case 1 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:107:7: statement
{
pushFollow(FOLLOW_statement_in_mapping_file275);
statement1=statement();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_statement.add(statement1.getTree());
}
break;
default :
break loop1;
}
}
// AST REWRITE
// elements: statement
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if ( state.backtracking==0 ) {
retval.tree = root_0; // depends on control dependency: [if], data = [none]
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (Object)adaptor.nil(); // depends on control dependency: [if], data = [none]
// 108:5: -> ^( VT_DSL_GRAMMAR ( statement )* )
{
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:108:8: ^( VT_DSL_GRAMMAR ( statement )* )
{
Object root_1 = (Object)adaptor.nil();
root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(VT_DSL_GRAMMAR, "VT_DSL_GRAMMAR"), root_1);
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:108:25: ( statement )*
while ( stream_statement.hasNext() ) {
adaptor.addChild(root_1, stream_statement.nextTree()); // depends on control dependency: [while], data = [none]
}
stream_statement.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0; // depends on control dependency: [if], data = [none]
}
}
retval.stop = input.LT(-1);
if ( state.backtracking==0 ) {
retval.tree = (Object)adaptor.rulePostProcessing(root_0); // depends on control dependency: [if], data = [none]
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} }
|
public class class_name {
private boolean hasImportFile(String resourcepath) {
Long value = m_importFileUpdateCache.get(resourcepath);
if (value == null) {
return false;
}
long age = System.currentTimeMillis() - value.longValue();
return age < 5000;
} }
|
public class class_name {
private boolean hasImportFile(String resourcepath) {
Long value = m_importFileUpdateCache.get(resourcepath);
if (value == null) {
return false; // depends on control dependency: [if], data = [none]
}
long age = System.currentTimeMillis() - value.longValue();
return age < 5000;
} }
|
public class class_name {
public void removeListener(UserTransactionListener listener)
{
UserTransactionListenerImpl impl = listeners.get(listener);
if (impl != null)
{
delegator.removeListener(impl);
listeners.remove(listener);
}
} }
|
public class class_name {
public void removeListener(UserTransactionListener listener)
{
UserTransactionListenerImpl impl = listeners.get(listener);
if (impl != null)
{
delegator.removeListener(impl); // depends on control dependency: [if], data = [(impl]
listeners.remove(listener); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void main(final String[] args) {
try {
new Main().run(args);
} catch (final JBakeException e) {
System.err.println(e.getMessage());
e.printStackTrace();
System.exit(1);
} catch (final Throwable e) {
System.err.println("An unexpected error occurred: " + e.getMessage());
e.printStackTrace();
System.exit(2);
}
} }
|
public class class_name {
public static void main(final String[] args) {
try {
new Main().run(args); // depends on control dependency: [try], data = [none]
} catch (final JBakeException e) {
System.err.println(e.getMessage());
e.printStackTrace();
System.exit(1);
} catch (final Throwable e) { // depends on control dependency: [catch], data = [none]
System.err.println("An unexpected error occurred: " + e.getMessage());
e.printStackTrace();
System.exit(2);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public <T> T toOnlyElement(Function<? super Cursor, T> singleRowTransform, T defaultValue) {
if (moveToFirst()) {
return toOnlyElement(singleRowTransform);
} else {
close();
return defaultValue;
}
} }
|
public class class_name {
public <T> T toOnlyElement(Function<? super Cursor, T> singleRowTransform, T defaultValue) {
if (moveToFirst()) {
return toOnlyElement(singleRowTransform); // depends on control dependency: [if], data = [none]
} else {
close(); // depends on control dependency: [if], data = [none]
return defaultValue; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean isRunning()
{
if (tc.isEntryEnabled())
{
SibTr.entry(tc, "isRunning");
SibTr.exit(tc, "isRunning", new Boolean(_isRunning));
}
return _isRunning;
} }
|
public class class_name {
public boolean isRunning()
{
if (tc.isEntryEnabled())
{
SibTr.entry(tc, "isRunning"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "isRunning", new Boolean(_isRunning)); // depends on control dependency: [if], data = [none]
}
return _isRunning;
} }
|
public class class_name {
private List<OutputFile> processTemplates(List<TemplateFile> inputs) throws IOException {
List<OutputFile> outputs = new ArrayList<>();
for (TemplateFile f : inputs) {
String fileName = f.getFileName();
if (!fileName.contains("VType") && fileName.contains("KType")) {
for (Type ktype : Type.values()) {
TemplateOptions options = new TemplateOptions(ktype);
options.templateFile = f.path;
generate(f, outputs, options);
}
}
if (fileName.contains("KTypeVType")) {
for (Type ktype : Type.values()) {
for (Type vtype : Type.values()) {
TemplateOptions options = new TemplateOptions(ktype, vtype);
options.templateFile = f.path;
generate(f, outputs, options);
}
}
}
}
return outputs;
} }
|
public class class_name {
private List<OutputFile> processTemplates(List<TemplateFile> inputs) throws IOException {
List<OutputFile> outputs = new ArrayList<>();
for (TemplateFile f : inputs) {
String fileName = f.getFileName();
if (!fileName.contains("VType") && fileName.contains("KType")) {
for (Type ktype : Type.values()) {
TemplateOptions options = new TemplateOptions(ktype);
options.templateFile = f.path;
// depends on control dependency: [for], data = [none]
generate(f, outputs, options);
// depends on control dependency: [for], data = [none]
}
}
if (fileName.contains("KTypeVType")) {
for (Type ktype : Type.values()) {
for (Type vtype : Type.values()) {
TemplateOptions options = new TemplateOptions(ktype, vtype);
options.templateFile = f.path;
// depends on control dependency: [for], data = [none]
generate(f, outputs, options);
// depends on control dependency: [for], data = [none]
}
}
}
}
return outputs;
} }
|
public class class_name {
public synchronized Country getCountryV6(InetAddress addr) {
if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) {
throw new IllegalStateException("Database has been closed.");
}
int ret = seekCountryV6(addr) - COUNTRY_BEGIN;
if (ret == 0) {
return UNKNOWN_COUNTRY;
} else {
return new Country(countryCode[ret], countryName[ret]);
}
} }
|
public class class_name {
public synchronized Country getCountryV6(InetAddress addr) {
if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) {
throw new IllegalStateException("Database has been closed.");
}
int ret = seekCountryV6(addr) - COUNTRY_BEGIN;
if (ret == 0) {
return UNKNOWN_COUNTRY; // depends on control dependency: [if], data = [none]
} else {
return new Country(countryCode[ret], countryName[ret]); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public CloseableStaticBitmap decodeJpeg(
final EncodedImage encodedImage,
int length,
QualityInfo qualityInfo,
ImageDecodeOptions options) {
CloseableReference<Bitmap> bitmapReference =
mPlatformDecoder.decodeJPEGFromEncodedImageWithColorSpace(
encodedImage, options.bitmapConfig, null, length, options.colorSpace);
try {
maybeApplyTransformation(options.bitmapTransformation, bitmapReference);
return new CloseableStaticBitmap(
bitmapReference,
qualityInfo,
encodedImage.getRotationAngle(),
encodedImage.getExifOrientation());
} finally {
bitmapReference.close();
}
} }
|
public class class_name {
public CloseableStaticBitmap decodeJpeg(
final EncodedImage encodedImage,
int length,
QualityInfo qualityInfo,
ImageDecodeOptions options) {
CloseableReference<Bitmap> bitmapReference =
mPlatformDecoder.decodeJPEGFromEncodedImageWithColorSpace(
encodedImage, options.bitmapConfig, null, length, options.colorSpace);
try {
maybeApplyTransformation(options.bitmapTransformation, bitmapReference); // depends on control dependency: [try], data = [none]
return new CloseableStaticBitmap(
bitmapReference,
qualityInfo,
encodedImage.getRotationAngle(),
encodedImage.getExifOrientation()); // depends on control dependency: [try], data = [none]
} finally {
bitmapReference.close();
}
} }
|
public class class_name {
public synchronized MultiUserChatLight getMultiUserChatLight(EntityBareJid jid) {
WeakReference<MultiUserChatLight> weakRefMultiUserChat = multiUserChatLights.get(jid);
if (weakRefMultiUserChat == null) {
return createNewMucLightAndAddToMap(jid);
}
MultiUserChatLight multiUserChatLight = weakRefMultiUserChat.get();
if (multiUserChatLight == null) {
return createNewMucLightAndAddToMap(jid);
}
return multiUserChatLight;
} }
|
public class class_name {
public synchronized MultiUserChatLight getMultiUserChatLight(EntityBareJid jid) {
WeakReference<MultiUserChatLight> weakRefMultiUserChat = multiUserChatLights.get(jid);
if (weakRefMultiUserChat == null) {
return createNewMucLightAndAddToMap(jid); // depends on control dependency: [if], data = [none]
}
MultiUserChatLight multiUserChatLight = weakRefMultiUserChat.get();
if (multiUserChatLight == null) {
return createNewMucLightAndAddToMap(jid); // depends on control dependency: [if], data = [none]
}
return multiUserChatLight;
} }
|
public class class_name {
protected Boolean _hasSideEffects(XIfExpression expression, ISideEffectContext context) {
if (hasSideEffects(expression.getIf(), context)) {
return true;
}
final Map<String, List<XExpression>> buffer1 = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(expression.getThen(), context.branch(buffer1))) {
return true;
}
final Map<String, List<XExpression>> buffer2 = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(expression.getElse(), context.branch(buffer2))) {
return true;
}
context.mergeBranchVariableAssignments(Arrays.asList(buffer1, buffer2));
return false;
} }
|
public class class_name {
protected Boolean _hasSideEffects(XIfExpression expression, ISideEffectContext context) {
if (hasSideEffects(expression.getIf(), context)) {
return true; // depends on control dependency: [if], data = [none]
}
final Map<String, List<XExpression>> buffer1 = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(expression.getThen(), context.branch(buffer1))) {
return true; // depends on control dependency: [if], data = [none]
}
final Map<String, List<XExpression>> buffer2 = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(expression.getElse(), context.branch(buffer2))) {
return true; // depends on control dependency: [if], data = [none]
}
context.mergeBranchVariableAssignments(Arrays.asList(buffer1, buffer2));
return false;
} }
|
public class class_name {
public static <K, V> Map<K, V> newmap(Map.Entry<K, V>... entries) {
Map<K, V> result = new HashMap<>();
for(Map.Entry<K, V> entry : entries) {
result.put(entry.getKey(), entry.getValue());
}
return result;
} }
|
public class class_name {
public static <K, V> Map<K, V> newmap(Map.Entry<K, V>... entries) {
Map<K, V> result = new HashMap<>();
for(Map.Entry<K, V> entry : entries) {
result.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
return result;
} }
|
public class class_name {
public boolean scheduleRegularReboot ()
{
// maybe schedule an automatic reboot based on our configuration
int freq = getDayFrequency();
int hour = getRebootHour();
if (freq <= 0) {
return false;
}
Calendars.Builder cal = Calendars.now();
int curHour = cal.get(Calendar.HOUR_OF_DAY);
cal = cal.zeroTime().addHours(hour).addDays((curHour < hour) ? (freq - 1) : freq);
// maybe avoid weekends
if (getSkipWeekends()) {
switch (cal.get(Calendar.DAY_OF_WEEK)) {
case Calendar.SATURDAY:
cal.addDays(2);
break;
case Calendar.SUNDAY:
cal.addDays(1);
break;
}
}
scheduleReboot(cal.toTime(), true, AUTOMATIC_INITIATOR); // schedule exactly
return true;
} }
|
public class class_name {
public boolean scheduleRegularReboot ()
{
// maybe schedule an automatic reboot based on our configuration
int freq = getDayFrequency();
int hour = getRebootHour();
if (freq <= 0) {
return false; // depends on control dependency: [if], data = [none]
}
Calendars.Builder cal = Calendars.now();
int curHour = cal.get(Calendar.HOUR_OF_DAY);
cal = cal.zeroTime().addHours(hour).addDays((curHour < hour) ? (freq - 1) : freq);
// maybe avoid weekends
if (getSkipWeekends()) {
switch (cal.get(Calendar.DAY_OF_WEEK)) {
case Calendar.SATURDAY:
cal.addDays(2);
break;
case Calendar.SUNDAY:
cal.addDays(1);
break;
}
}
scheduleReboot(cal.toTime(), true, AUTOMATIC_INITIATOR); // schedule exactly
return true;
} }
|
public class class_name {
public Map<String, String> getJspAttributes() {
if (null == this.jspAttributes) {
this.jspAttributes = new HashMap<String, String>();
}
return this.jspAttributes;
} }
|
public class class_name {
public Map<String, String> getJspAttributes() {
if (null == this.jspAttributes) {
this.jspAttributes = new HashMap<String, String>(); // depends on control dependency: [if], data = [none]
}
return this.jspAttributes;
} }
|
public class class_name {
public static Type addWildcardParameters(Class<?> clazz) {
if (clazz.isArray()) {
return GenericArrayTypeImpl.createArrayType(addWildcardParameters(clazz.getComponentType()));
} else if (isMissingTypeParameters(clazz)) {
TypeVariable<?>[] vars = clazz.getTypeParameters();
Type[] arguments = new Type[vars.length];
Arrays.fill(arguments, UNBOUND_WILDCARD);
Type owner = clazz.getDeclaringClass() == null ? null : addWildcardParameters(clazz.getDeclaringClass());
return new ParameterizedTypeImpl(clazz, arguments, owner);
} else {
return clazz;
}
} }
|
public class class_name {
public static Type addWildcardParameters(Class<?> clazz) {
if (clazz.isArray()) {
return GenericArrayTypeImpl.createArrayType(addWildcardParameters(clazz.getComponentType())); // depends on control dependency: [if], data = [none]
} else if (isMissingTypeParameters(clazz)) {
TypeVariable<?>[] vars = clazz.getTypeParameters();
Type[] arguments = new Type[vars.length];
Arrays.fill(arguments, UNBOUND_WILDCARD); // depends on control dependency: [if], data = [none]
Type owner = clazz.getDeclaringClass() == null ? null : addWildcardParameters(clazz.getDeclaringClass());
return new ParameterizedTypeImpl(clazz, arguments, owner); // depends on control dependency: [if], data = [none]
} else {
return clazz; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(OutputUpdate outputUpdate, ProtocolMarshaller protocolMarshaller) {
if (outputUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(outputUpdate.getOutputId(), OUTPUTID_BINDING);
protocolMarshaller.marshall(outputUpdate.getNameUpdate(), NAMEUPDATE_BINDING);
protocolMarshaller.marshall(outputUpdate.getKinesisStreamsOutputUpdate(), KINESISSTREAMSOUTPUTUPDATE_BINDING);
protocolMarshaller.marshall(outputUpdate.getKinesisFirehoseOutputUpdate(), KINESISFIREHOSEOUTPUTUPDATE_BINDING);
protocolMarshaller.marshall(outputUpdate.getLambdaOutputUpdate(), LAMBDAOUTPUTUPDATE_BINDING);
protocolMarshaller.marshall(outputUpdate.getDestinationSchemaUpdate(), DESTINATIONSCHEMAUPDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(OutputUpdate outputUpdate, ProtocolMarshaller protocolMarshaller) {
if (outputUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(outputUpdate.getOutputId(), OUTPUTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(outputUpdate.getNameUpdate(), NAMEUPDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(outputUpdate.getKinesisStreamsOutputUpdate(), KINESISSTREAMSOUTPUTUPDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(outputUpdate.getKinesisFirehoseOutputUpdate(), KINESISFIREHOSEOUTPUTUPDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(outputUpdate.getLambdaOutputUpdate(), LAMBDAOUTPUTUPDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(outputUpdate.getDestinationSchemaUpdate(), DESTINATIONSCHEMAUPDATE_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 {
@SuppressWarnings("unchecked")
@Override
public synchronized <T> Evaluator<T> createEvaluator(String source, ClassType projection, String[] names,
Type[] types, Class<?>[] classes, Map<String, Object> constants) {
try {
final String id = toId(source, projection.getJavaClass(), types, constants.values());
Method method = cache.get(id);
if (method == null) {
Class<?> clazz;
try {
clazz = loader.loadClass(id);
} catch (ClassNotFoundException e) {
compile(source, projection, names, types, id, constants);
// reload
clazz = loader.loadClass(id);
}
method = findEvalMethod(clazz);
cache.put(id, method);
}
return new MethodEvaluator<T>(method, constants, (Class) projection.getJavaClass());
} catch (ClassNotFoundException e) {
throw new CodegenException(e);
} catch (SecurityException e) {
throw new CodegenException(e);
} catch (IOException e) {
throw new CodegenException(e);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public synchronized <T> Evaluator<T> createEvaluator(String source, ClassType projection, String[] names,
Type[] types, Class<?>[] classes, Map<String, Object> constants) {
try {
final String id = toId(source, projection.getJavaClass(), types, constants.values());
Method method = cache.get(id);
if (method == null) {
Class<?> clazz;
try {
clazz = loader.loadClass(id); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
compile(source, projection, names, types, id, constants);
// reload
clazz = loader.loadClass(id);
} // depends on control dependency: [catch], data = [none]
method = findEvalMethod(clazz); // depends on control dependency: [if], data = [none]
cache.put(id, method); // depends on control dependency: [if], data = [none]
}
return new MethodEvaluator<T>(method, constants, (Class) projection.getJavaClass()); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new CodegenException(e);
} catch (SecurityException e) { // depends on control dependency: [catch], data = [none]
throw new CodegenException(e);
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
throw new CodegenException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private String toPEM() {
byte[] data = (this.keyData == null) ? this.encodedKey : Base64.encode(this.keyData);
String header = HEADER;
if (isEncrypted()) {
StringBuffer buf = new StringBuffer(header);
buf.append(PEMUtil.LINE_SEP);
buf.append("Proc-Type: 4,ENCRYPTED");
buf.append(PEMUtil.LINE_SEP);
buf.append("DEK-Info: ").append(this.encAlgStr);
buf.append(",").append(PEMUtil.toHex(initializationVector.getIV()));
buf.append(PEMUtil.LINE_SEP);
header = buf.toString();
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
PEMUtil.writeBase64(out,
header,
data,
"-----END RSA PRIVATE KEY-----");
} catch (IOException e) {
// JGLOBUS-91
throw new RuntimeException("Unexpected error", e);
}
return new String(out.toByteArray());
} }
|
public class class_name {
private String toPEM() {
byte[] data = (this.keyData == null) ? this.encodedKey : Base64.encode(this.keyData);
String header = HEADER;
if (isEncrypted()) {
StringBuffer buf = new StringBuffer(header);
buf.append(PEMUtil.LINE_SEP); // depends on control dependency: [if], data = [none]
buf.append("Proc-Type: 4,ENCRYPTED"); // depends on control dependency: [if], data = [none]
buf.append(PEMUtil.LINE_SEP); // depends on control dependency: [if], data = [none]
buf.append("DEK-Info: ").append(this.encAlgStr); // depends on control dependency: [if], data = [none]
buf.append(",").append(PEMUtil.toHex(initializationVector.getIV())); // depends on control dependency: [if], data = [none]
buf.append(PEMUtil.LINE_SEP); // depends on control dependency: [if], data = [none]
header = buf.toString(); // depends on control dependency: [if], data = [none]
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
PEMUtil.writeBase64(out,
header,
data,
"-----END RSA PRIVATE KEY-----"); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// JGLOBUS-91
throw new RuntimeException("Unexpected error", e);
} // depends on control dependency: [catch], data = [none]
return new String(out.toByteArray());
} }
|
public class class_name {
public LockTable getLockTable(String strDatabaseName, String strRecordName)
{
String strKey = strDatabaseName + ':' + strRecordName;
LockTable lockTable = (LockTable)m_htLockTables.get(strKey);
if (lockTable == null)
{
synchronized (m_htLockTables)
{
if ((lockTable = (LockTable)m_htLockTables.get(strKey)) == null)
m_htLockTables.put(strKey, lockTable = new LockTable());
}
m_hsMyLockTables.add(lockTable); // Keep track of the lock tables that I used
}
return lockTable;
} }
|
public class class_name {
public LockTable getLockTable(String strDatabaseName, String strRecordName)
{
String strKey = strDatabaseName + ':' + strRecordName;
LockTable lockTable = (LockTable)m_htLockTables.get(strKey);
if (lockTable == null)
{
synchronized (m_htLockTables) // depends on control dependency: [if], data = [none]
{
if ((lockTable = (LockTable)m_htLockTables.get(strKey)) == null)
m_htLockTables.put(strKey, lockTable = new LockTable());
}
m_hsMyLockTables.add(lockTable); // Keep track of the lock tables that I used // depends on control dependency: [if], data = [(lockTable]
}
return lockTable;
} }
|
public class class_name {
public static StringBuilder appendCalcArgs(StringBuilder sb, CalcArgs args) {
final String astr = args.evaluate(CalcArgs.stringEvaluator);
if (!astr.startsWith(FUNCTION_OPENING)) {
sb.append(FUNCTION_OPENING);
sb.append(astr);
sb.append(FUNCTION_CLOSING);
} else {
sb.append(astr);
}
return sb;
} }
|
public class class_name {
public static StringBuilder appendCalcArgs(StringBuilder sb, CalcArgs args) {
final String astr = args.evaluate(CalcArgs.stringEvaluator);
if (!astr.startsWith(FUNCTION_OPENING)) {
sb.append(FUNCTION_OPENING); // depends on control dependency: [if], data = [none]
sb.append(astr); // depends on control dependency: [if], data = [none]
sb.append(FUNCTION_CLOSING); // depends on control dependency: [if], data = [none]
} else {
sb.append(astr); // depends on control dependency: [if], data = [none]
}
return sb;
} }
|
public class class_name {
@Override
public void visit(final int version, int access, final String name, final String signature, final String superName, String[] interfaces) {
wd.init(name, superName, this.suffix, this.reqProxyClassName);
// no superclass
wd.superName = AsmUtil.SIGNATURE_JAVA_LANG_OBJECT;
// change access of destination
access &= ~AsmUtil.ACC_ABSTRACT;
access &= ~AsmUtil.ACC_INTERFACE;
// write destination class
if (targetClassOrInterface.isInterface()) {
// target is interface
wd.wrapInterface = true;
interfaces = new String[] {targetClassOrInterface.getName().replace('.', '/')};
} else {
// target is class
wd.wrapInterface = false;
if (targetInterface != null) {
// interface provided
interfaces = new String[] {targetInterface.getName().replace('.', '/')};
} else {
// no interface provided, use all
//interfaces = null;
}
}
final int v = ProxettaAsmUtil.resolveJavaVersion(version);
wd.dest.visit(v, access, wd.thisReference, signature, wd.superName, interfaces);
wd.proxyAspects = new ProxyAspectData[aspects.length];
for (int i = 0; i < aspects.length; i++) {
wd.proxyAspects[i] = new ProxyAspectData(wd, aspects[i], i);
}
// create new field wrapper field and store it's reference into work-data
wd.wrapperRef = targetFieldName;
wd.wrapperType = 'L' + name + ';';
if (createTargetInDefaultCtor) {
// create private, final field
final FieldVisitor fv = wd.dest.visitField(AsmUtil.ACC_PRIVATE | AsmUtil.ACC_FINAL, wd.wrapperRef, wd.wrapperType, null, null);
fv.visitEnd();
createEmptyCtorThatCreatesTarget();
}
else {
// create public, non-final field
final FieldVisitor fv = wd.dest.visitField(AsmUtil.ACC_PUBLIC, wd.wrapperRef, wd.wrapperType, null, null);
fv.visitEnd();
createEmptyCtor();
}
} }
|
public class class_name {
@Override
public void visit(final int version, int access, final String name, final String signature, final String superName, String[] interfaces) {
wd.init(name, superName, this.suffix, this.reqProxyClassName);
// no superclass
wd.superName = AsmUtil.SIGNATURE_JAVA_LANG_OBJECT;
// change access of destination
access &= ~AsmUtil.ACC_ABSTRACT;
access &= ~AsmUtil.ACC_INTERFACE;
// write destination class
if (targetClassOrInterface.isInterface()) {
// target is interface
wd.wrapInterface = true; // depends on control dependency: [if], data = [none]
interfaces = new String[] {targetClassOrInterface.getName().replace('.', '/')}; // depends on control dependency: [if], data = [none]
} else {
// target is class
wd.wrapInterface = false; // depends on control dependency: [if], data = [none]
if (targetInterface != null) {
// interface provided
interfaces = new String[] {targetInterface.getName().replace('.', '/')}; // depends on control dependency: [if], data = [none]
} else {
// no interface provided, use all
//interfaces = null;
}
}
final int v = ProxettaAsmUtil.resolveJavaVersion(version);
wd.dest.visit(v, access, wd.thisReference, signature, wd.superName, interfaces);
wd.proxyAspects = new ProxyAspectData[aspects.length];
for (int i = 0; i < aspects.length; i++) {
wd.proxyAspects[i] = new ProxyAspectData(wd, aspects[i], i); // depends on control dependency: [for], data = [i]
}
// create new field wrapper field and store it's reference into work-data
wd.wrapperRef = targetFieldName;
wd.wrapperType = 'L' + name + ';';
if (createTargetInDefaultCtor) {
// create private, final field
final FieldVisitor fv = wd.dest.visitField(AsmUtil.ACC_PRIVATE | AsmUtil.ACC_FINAL, wd.wrapperRef, wd.wrapperType, null, null);
fv.visitEnd(); // depends on control dependency: [if], data = [none]
createEmptyCtorThatCreatesTarget(); // depends on control dependency: [if], data = [none]
}
else {
// create public, non-final field
final FieldVisitor fv = wd.dest.visitField(AsmUtil.ACC_PUBLIC, wd.wrapperRef, wd.wrapperType, null, null);
fv.visitEnd(); // depends on control dependency: [if], data = [none]
createEmptyCtor(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public CallSite createPogoCallSite(CallSite site, Object[] args) {
if (!GroovyCategorySupport.hasCategoryInCurrentThread() && !(this instanceof AdaptingMetaClass)) {
Class [] params = MetaClassHelper.convertToTypeArray(args);
CallSite tempSite = site;
if (site.getName().equals("call") && GeneratedClosure.class.isAssignableFrom(theClass)) {
// here, we want to point to a method named "doCall" instead of "call"
// but we don't want to replace the original call site name, otherwise
// we loose the fact that the original method name was "call" so instead
// we will point to a metamethod called "doCall"
// see GROOVY-5806 for details
tempSite = new AbstractCallSite(site.getArray(),site.getIndex(),"doCall");
}
MetaMethod metaMethod = getMethodWithCachingInternal(theClass, tempSite, params);
if (metaMethod != null)
return PogoMetaMethodSite.createPogoMetaMethodSite(site, this, metaMethod, params, args);
}
return new PogoMetaClassSite(site, this);
} }
|
public class class_name {
public CallSite createPogoCallSite(CallSite site, Object[] args) {
if (!GroovyCategorySupport.hasCategoryInCurrentThread() && !(this instanceof AdaptingMetaClass)) {
Class [] params = MetaClassHelper.convertToTypeArray(args);
CallSite tempSite = site;
if (site.getName().equals("call") && GeneratedClosure.class.isAssignableFrom(theClass)) {
// here, we want to point to a method named "doCall" instead of "call"
// but we don't want to replace the original call site name, otherwise
// we loose the fact that the original method name was "call" so instead
// we will point to a metamethod called "doCall"
// see GROOVY-5806 for details
tempSite = new AbstractCallSite(site.getArray(),site.getIndex(),"doCall"); // depends on control dependency: [if], data = [none]
}
MetaMethod metaMethod = getMethodWithCachingInternal(theClass, tempSite, params);
if (metaMethod != null)
return PogoMetaMethodSite.createPogoMetaMethodSite(site, this, metaMethod, params, args);
}
return new PogoMetaClassSite(site, this);
} }
|
public class class_name {
public static String getName(final Constructor<?> c) {
StringBuilder ret = new StringBuilder("(");
Class<?>[] parameterTypes = c.getParameterTypes();
for (int i = 0; i < parameterTypes.length; i++) {
if (i > 0)
ret.append(',');
ret.append(getName(parameterTypes[i]));
}
ret.append(')');
return ret.toString();
} }
|
public class class_name {
public static String getName(final Constructor<?> c) {
StringBuilder ret = new StringBuilder("(");
Class<?>[] parameterTypes = c.getParameterTypes();
for (int i = 0; i < parameterTypes.length; i++) {
if (i > 0)
ret.append(',');
ret.append(getName(parameterTypes[i])); // depends on control dependency: [for], data = [i]
}
ret.append(')');
return ret.toString();
} }
|
public class class_name {
public void handleGet(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource, boolean endsWithSlash) throws ServletException, IOException
{
if (resource == null || !resource.exists())
response.sendError(HttpResponse.__404_Not_Found);
else
{
// check if directory
if (resource.isDirectory())
{
if (!endsWithSlash && !pathInContext.equals("/"))
{
String q = request.getQueryString();
StringBuffer buf = request.getRequestURL();
if (q != null && q.length() != 0)
{
buf.append('?');
buf.append(q);
}
response.setContentLength(0);
response.sendRedirect(response.encodeRedirectURL(URI.addPaths(buf.toString(), "/")));
return;
}
// See if index file exists
String welcome = _httpContext.getWelcomeFile(resource);
if (welcome != null)
{
String ipath = URI.addPaths(pathInContext, welcome);
if (_redirectWelcomeFiles)
{
// Redirect to the index
response.setContentLength(0);
response.sendRedirect(URI.addPaths(_httpContext.getContextPath(), ipath));
}
else
{
// Forward to the index
RequestDispatcher dispatcher = _servletHandler.getRequestDispatcher(ipath);
dispatcher.forward(request, response);
}
return;
}
// Check modified dates
if (!passConditionalHeaders(request, response, resource))
return;
// If we got here, no forward to index took place
sendDirectory(request, response, resource, pathInContext.length() > 1);
}
else
{
// Check modified dates
if (!passConditionalHeaders(request, response, resource))
return;
// just send it
sendData(request, response, pathInContext, resource);
}
}
} }
|
public class class_name {
public void handleGet(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource, boolean endsWithSlash) throws ServletException, IOException
{
if (resource == null || !resource.exists())
response.sendError(HttpResponse.__404_Not_Found);
else
{
// check if directory
if (resource.isDirectory())
{
if (!endsWithSlash && !pathInContext.equals("/"))
{
String q = request.getQueryString();
StringBuffer buf = request.getRequestURL();
if (q != null && q.length() != 0)
{
buf.append('?'); // depends on control dependency: [if], data = [none]
buf.append(q); // depends on control dependency: [if], data = [(q]
}
response.setContentLength(0); // depends on control dependency: [if], data = [none]
response.sendRedirect(response.encodeRedirectURL(URI.addPaths(buf.toString(), "/"))); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// See if index file exists
String welcome = _httpContext.getWelcomeFile(resource);
if (welcome != null)
{
String ipath = URI.addPaths(pathInContext, welcome);
if (_redirectWelcomeFiles)
{
// Redirect to the index
response.setContentLength(0); // depends on control dependency: [if], data = [none]
response.sendRedirect(URI.addPaths(_httpContext.getContextPath(), ipath)); // depends on control dependency: [if], data = [none]
}
else
{
// Forward to the index
RequestDispatcher dispatcher = _servletHandler.getRequestDispatcher(ipath);
dispatcher.forward(request, response); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
// Check modified dates
if (!passConditionalHeaders(request, response, resource))
return;
// If we got here, no forward to index took place
sendDirectory(request, response, resource, pathInContext.length() > 1); // depends on control dependency: [if], data = [none]
}
else
{
// Check modified dates
if (!passConditionalHeaders(request, response, resource))
return;
// just send it
sendData(request, response, pathInContext, resource); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public final void initDefault() {
try {
this.messages = null;
this.messages = ResourceBundle.getBundle("Messages");
} catch (Exception e) {
this.logger.error(null, SrvI18n.class,
" when loading msgs for default locale ", e);
}
if (messages != null) {
this.messagesMap.put(Locale.getDefault().getLanguage(), this.messages);
this.logger.info(null, SrvI18n.class,
"Added messages for default locale: " + Locale.getDefault());
} else {
//If there is no MessagesBundle[current-locale].properties
this.logger.error(null, SrvI18n.class,
"There is no messages for current locale: " + Locale.getDefault());
}
} }
|
public class class_name {
public final void initDefault() {
try {
this.messages = null; // depends on control dependency: [try], data = [none]
this.messages = ResourceBundle.getBundle("Messages"); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
this.logger.error(null, SrvI18n.class,
" when loading msgs for default locale ", e);
} // depends on control dependency: [catch], data = [none]
if (messages != null) {
this.messagesMap.put(Locale.getDefault().getLanguage(), this.messages); // depends on control dependency: [if], data = [none]
this.logger.info(null, SrvI18n.class,
"Added messages for default locale: " + Locale.getDefault()); // depends on control dependency: [if], data = [none]
} else {
//If there is no MessagesBundle[current-locale].properties
this.logger.error(null, SrvI18n.class,
"There is no messages for current locale: " + Locale.getDefault()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static URI getJournalLocation() {
String journalDirectory = ServerConfiguration.get(PropertyKey.MASTER_JOURNAL_FOLDER);
if (!journalDirectory.endsWith(AlluxioURI.SEPARATOR)) {
journalDirectory += AlluxioURI.SEPARATOR;
}
try {
return new URI(journalDirectory);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
public static URI getJournalLocation() {
String journalDirectory = ServerConfiguration.get(PropertyKey.MASTER_JOURNAL_FOLDER);
if (!journalDirectory.endsWith(AlluxioURI.SEPARATOR)) {
journalDirectory += AlluxioURI.SEPARATOR; // depends on control dependency: [if], data = [none]
}
try {
return new URI(journalDirectory); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void doPeriodicWork(final long now) {
if (m_lastKnownSchedule == null)
{
setState(State.STARTUP);
return;
}
if (m_frequencyUnit == null) {
return;
}
if (m_state == State.STARTUP) {
initiateSnapshotScan();
} else if (m_state == State.SCANNING) {
RateLimitedLogger.tryLogForMessage(System.currentTimeMillis(), 5, TimeUnit.MINUTES, SNAP_LOG, Level.INFO, "Blocked in scanning");
return;
} else if (m_state == State.WAITING){
processWaitingPeriodicWork(now);
} else if (m_state == State.SNAPSHOTTING) {
return;
} else if (m_state == State.DELETING){
return;
}
} }
|
public class class_name {
private void doPeriodicWork(final long now) {
if (m_lastKnownSchedule == null)
{
setState(State.STARTUP); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (m_frequencyUnit == null) {
return; // depends on control dependency: [if], data = [none]
}
if (m_state == State.STARTUP) {
initiateSnapshotScan(); // depends on control dependency: [if], data = [none]
} else if (m_state == State.SCANNING) {
RateLimitedLogger.tryLogForMessage(System.currentTimeMillis(), 5, TimeUnit.MINUTES, SNAP_LOG, Level.INFO, "Blocked in scanning"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else if (m_state == State.WAITING){
processWaitingPeriodicWork(now); // depends on control dependency: [if], data = [none]
} else if (m_state == State.SNAPSHOTTING) {
return; // depends on control dependency: [if], data = [none]
} else if (m_state == State.DELETING){
return; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected PreparedStatement executeSql(String sql,
MapSqlParameterSource args)
{
// XXX: uses raw type, what are the parameters to Map in MapSqlParameterSource?
Map<String, Object> parameters = args != null ? args.getValues()
: new HashMap<String, Object>();
for (Map.Entry<String, Object> placeHolderEntry : parameters.entrySet())
{
String key = placeHolderEntry.getKey();
String value = placeHolderEntry.getValue().toString();
log.debug("substitution for parameter '" + key + "' in SQL script: "
+ value);
sql = sql.replaceAll(key, Matcher.quoteReplacement(value));
}
log.debug("Executing SQL\n{}", sql);
CancelableStatements cancelableStats
= new CancelableStatements(
sql, statementController);
// register the statement, so we could try to interrupt it in the gui.
if (statementController != null)
{
statementController.registerStatement(cancelableStats.statement);
}
else
{
log.debug("statement controller is not initialized");
}
getJdbcTemplate().execute(cancelableStats, cancelableStats);
return cancelableStats.statement;
} }
|
public class class_name {
protected PreparedStatement executeSql(String sql,
MapSqlParameterSource args)
{
// XXX: uses raw type, what are the parameters to Map in MapSqlParameterSource?
Map<String, Object> parameters = args != null ? args.getValues()
: new HashMap<String, Object>();
for (Map.Entry<String, Object> placeHolderEntry : parameters.entrySet())
{
String key = placeHolderEntry.getKey();
String value = placeHolderEntry.getValue().toString();
log.debug("substitution for parameter '" + key + "' in SQL script: "
+ value); // depends on control dependency: [for], data = [none]
sql = sql.replaceAll(key, Matcher.quoteReplacement(value)); // depends on control dependency: [for], data = [none]
}
log.debug("Executing SQL\n{}", sql);
CancelableStatements cancelableStats
= new CancelableStatements(
sql, statementController);
// register the statement, so we could try to interrupt it in the gui.
if (statementController != null)
{
statementController.registerStatement(cancelableStats.statement); // depends on control dependency: [if], data = [none]
}
else
{
log.debug("statement controller is not initialized"); // depends on control dependency: [if], data = [none]
}
getJdbcTemplate().execute(cancelableStats, cancelableStats);
return cancelableStats.statement;
} }
|
public class class_name {
private void startNewTransition() {
if (!hasBounds()) {
return; // Can't start transition if the drawable has no bounds.
}
mCurrentTrans = mTransGen.generateNextTransition(mDrawableRect, mViewportRect);
mElapsedTime = 0;
mLastFrameTime = System.currentTimeMillis();
fireTransitionStart(mCurrentTrans);
} }
|
public class class_name {
private void startNewTransition() {
if (!hasBounds()) {
return; // Can't start transition if the drawable has no bounds. // depends on control dependency: [if], data = [none]
}
mCurrentTrans = mTransGen.generateNextTransition(mDrawableRect, mViewportRect);
mElapsedTime = 0;
mLastFrameTime = System.currentTimeMillis();
fireTransitionStart(mCurrentTrans);
} }
|
public class class_name {
public static ResidueNumber fromString(String pdb_code) {
if(pdb_code == null)
return null;
ResidueNumber residueNumber = new ResidueNumber();
Integer resNum = null;
String icode = null;
try {
resNum = Integer.parseInt(pdb_code);
} catch ( NumberFormatException e){
// there is an insertion code..
// Split at any position that's either:
// preceded by a digit and followed by a non-digit, or
// preceded by a non-digit and followed by a digit.
String[] spl = pdb_code.split("(?<=\\d)(?=\\D)|(?<=\\D)(?=\\d)");
if ( spl.length == 2){
resNum = Integer.parseInt(spl[0]);
icode = spl[1];
}
}
residueNumber.setSeqNum(resNum);
if ( icode == null)
residueNumber.setInsCode(null);
else if ( icode.length() > 0)
residueNumber.setInsCode(icode.charAt(0));
return residueNumber;
} }
|
public class class_name {
public static ResidueNumber fromString(String pdb_code) {
if(pdb_code == null)
return null;
ResidueNumber residueNumber = new ResidueNumber();
Integer resNum = null;
String icode = null;
try {
resNum = Integer.parseInt(pdb_code); // depends on control dependency: [try], data = [none]
} catch ( NumberFormatException e){
// there is an insertion code..
// Split at any position that's either:
// preceded by a digit and followed by a non-digit, or
// preceded by a non-digit and followed by a digit.
String[] spl = pdb_code.split("(?<=\\d)(?=\\D)|(?<=\\D)(?=\\d)");
if ( spl.length == 2){
resNum = Integer.parseInt(spl[0]);
icode = spl[1];
} // depends on control dependency: [catch], data = [none]
}
residueNumber.setSeqNum(resNum);
if ( icode == null)
residueNumber.setInsCode(null);
else if ( icode.length() > 0)
residueNumber.setInsCode(icode.charAt(0));
return residueNumber;
} }
|
public class class_name {
public final void init(String... packageNames) {
Collection<Class<?>> classes = discoverClasses(packageNames);
if (classes.isEmpty()) {
log.warn("No annotated controllers found in package(s) '{}'", Arrays.toString(packageNames));
return;
}
log.debug("Found {} controller classes in {} package(s)", classes.size(), packageNames.length);
init(classes);
} }
|
public class class_name {
public final void init(String... packageNames) {
Collection<Class<?>> classes = discoverClasses(packageNames);
if (classes.isEmpty()) {
log.warn("No annotated controllers found in package(s) '{}'", Arrays.toString(packageNames)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
log.debug("Found {} controller classes in {} package(s)", classes.size(), packageNames.length);
init(classes);
} }
|
public class class_name {
public final int pop() {
if (stackPointer == 0) {
return null_value;
}
final int element = stack[--stackPointer];
stack[stackPointer] = null_value;
return element;
} }
|
public class class_name {
public final int pop() {
if (stackPointer == 0) {
return null_value; // depends on control dependency: [if], data = [none]
}
final int element = stack[--stackPointer];
stack[stackPointer] = null_value;
return element;
} }
|
public class class_name {
public State encode(HeaderMap headers, ByteBuffer target) {
if(overflowData != null) {
for(int i = overflowPos; i < overflowLength; ++i) {
if(!target.hasRemaining()) {
overflowPos = i;
return State.OVERFLOW;
}
target.put(overflowData[i]);
}
overflowData = null;
}
long it = headersIterator;
if (headersIterator == -1) {
handleTableSizeChange(target);
//new headers map
it = headers.fastIterate();
currentHeaders = headers;
} else {
if (headers != currentHeaders) {
throw new IllegalStateException();
}
}
while (it != -1) {
HeaderValues values = headers.fiCurrent(it);
boolean skip = false;
if (firstPass) {
if (values.getHeaderName().byteAt(0) != ':') {
skip = true;
}
} else {
if (values.getHeaderName().byteAt(0) == ':') {
skip = true;
}
}
if(SKIP.contains(values.getHeaderName())) {
//ignore connection specific headers
skip = true;
}
if (!skip) {
for (int i = 0; i < values.size(); ++i) {
HttpString headerName = values.getHeaderName();
int required = 11 + headerName.length(); //we use 11 to make sure we have enough room for the variable length itegers
String val = values.get(i);
for(int v = 0; v < val.length(); ++v) {
char c = val.charAt(v);
if(c == '\r' || c == '\n') {
val = val.replace('\r', ' ').replace('\n', ' ');
break;
}
}
TableEntry tableEntry = findInTable(headerName, val);
required += (1 + val.length());
boolean overflowing = false;
ByteBuffer current = target;
if (current.remaining() < required) {
overflowing = true;
current = ByteBuffer.wrap(overflowData = new byte[required]);
overflowPos = 0;
}
boolean canIndex = hpackHeaderFunction.shouldUseIndexing(headerName, val) && (headerName.length() + val.length() + 32) < maxTableSize; //only index if it will fit
if (tableEntry == null && canIndex) {
//add the entry to the dynamic table
current.put((byte) (1 << 6));
writeHuffmanEncodableName(current, headerName);
writeHuffmanEncodableValue(current, headerName, val);
addToDynamicTable(headerName, val);
} else if (tableEntry == null) {
//literal never indexed
current.put((byte) (1 << 4));
writeHuffmanEncodableName(current, headerName);
writeHuffmanEncodableValue(current, headerName, val);
} else {
//so we know something is already in the table
if (val.equals(tableEntry.value)) {
//the whole thing is in the table
current.put((byte) (1 << 7));
encodeInteger(current, tableEntry.getPosition(), 7);
} else {
if (canIndex) {
//add the entry to the dynamic table
current.put((byte) (1 << 6));
encodeInteger(current, tableEntry.getPosition(), 6);
writeHuffmanEncodableValue(current, headerName, val);
addToDynamicTable(headerName, val);
} else {
current.put((byte) (1 << 4));
encodeInteger(current, tableEntry.getPosition(), 4);
writeHuffmanEncodableValue(current, headerName, val);
}
}
}
if(overflowing) {
it = headers.fiNext(it);
this.headersIterator = it;
this.overflowLength = current.position();
return State.OVERFLOW;
}
}
}
it = headers.fiNext(it);
if (it == -1 && firstPass) {
firstPass = false;
it = headers.fastIterate();
}
}
headersIterator = -1;
firstPass = true;
return State.COMPLETE;
} }
|
public class class_name {
public State encode(HeaderMap headers, ByteBuffer target) {
if(overflowData != null) {
for(int i = overflowPos; i < overflowLength; ++i) {
if(!target.hasRemaining()) {
overflowPos = i; // depends on control dependency: [if], data = [none]
return State.OVERFLOW; // depends on control dependency: [if], data = [none]
}
target.put(overflowData[i]); // depends on control dependency: [for], data = [i]
}
overflowData = null; // depends on control dependency: [if], data = [none]
}
long it = headersIterator;
if (headersIterator == -1) {
handleTableSizeChange(target); // depends on control dependency: [if], data = [none]
//new headers map
it = headers.fastIterate(); // depends on control dependency: [if], data = [none]
currentHeaders = headers; // depends on control dependency: [if], data = [none]
} else {
if (headers != currentHeaders) {
throw new IllegalStateException();
}
}
while (it != -1) {
HeaderValues values = headers.fiCurrent(it);
boolean skip = false;
if (firstPass) {
if (values.getHeaderName().byteAt(0) != ':') {
skip = true; // depends on control dependency: [if], data = [none]
}
} else {
if (values.getHeaderName().byteAt(0) == ':') {
skip = true; // depends on control dependency: [if], data = [none]
}
}
if(SKIP.contains(values.getHeaderName())) {
//ignore connection specific headers
skip = true; // depends on control dependency: [if], data = [none]
}
if (!skip) {
for (int i = 0; i < values.size(); ++i) {
HttpString headerName = values.getHeaderName();
int required = 11 + headerName.length(); //we use 11 to make sure we have enough room for the variable length itegers
String val = values.get(i);
for(int v = 0; v < val.length(); ++v) {
char c = val.charAt(v);
if(c == '\r' || c == '\n') {
val = val.replace('\r', ' ').replace('\n', ' '); // depends on control dependency: [if], data = [none]
break;
}
}
TableEntry tableEntry = findInTable(headerName, val);
required += (1 + val.length()); // depends on control dependency: [for], data = [none]
boolean overflowing = false;
ByteBuffer current = target;
if (current.remaining() < required) {
overflowing = true; // depends on control dependency: [if], data = [none]
current = ByteBuffer.wrap(overflowData = new byte[required]); // depends on control dependency: [if], data = [none]
overflowPos = 0; // depends on control dependency: [if], data = [none]
}
boolean canIndex = hpackHeaderFunction.shouldUseIndexing(headerName, val) && (headerName.length() + val.length() + 32) < maxTableSize; //only index if it will fit
if (tableEntry == null && canIndex) {
//add the entry to the dynamic table
current.put((byte) (1 << 6)); // depends on control dependency: [if], data = [none]
writeHuffmanEncodableName(current, headerName); // depends on control dependency: [if], data = [none]
writeHuffmanEncodableValue(current, headerName, val); // depends on control dependency: [if], data = [none]
addToDynamicTable(headerName, val); // depends on control dependency: [if], data = [none]
} else if (tableEntry == null) {
//literal never indexed
current.put((byte) (1 << 4)); // depends on control dependency: [if], data = [none]
writeHuffmanEncodableName(current, headerName); // depends on control dependency: [if], data = [none]
writeHuffmanEncodableValue(current, headerName, val); // depends on control dependency: [if], data = [none]
} else {
//so we know something is already in the table
if (val.equals(tableEntry.value)) {
//the whole thing is in the table
current.put((byte) (1 << 7)); // depends on control dependency: [if], data = [none]
encodeInteger(current, tableEntry.getPosition(), 7); // depends on control dependency: [if], data = [none]
} else {
if (canIndex) {
//add the entry to the dynamic table
current.put((byte) (1 << 6)); // depends on control dependency: [if], data = [none]
encodeInteger(current, tableEntry.getPosition(), 6); // depends on control dependency: [if], data = [none]
writeHuffmanEncodableValue(current, headerName, val); // depends on control dependency: [if], data = [none]
addToDynamicTable(headerName, val); // depends on control dependency: [if], data = [none]
} else {
current.put((byte) (1 << 4)); // depends on control dependency: [if], data = [none]
encodeInteger(current, tableEntry.getPosition(), 4); // depends on control dependency: [if], data = [none]
writeHuffmanEncodableValue(current, headerName, val); // depends on control dependency: [if], data = [none]
}
}
}
if(overflowing) {
it = headers.fiNext(it); // depends on control dependency: [if], data = [none]
this.headersIterator = it; // depends on control dependency: [if], data = [none]
this.overflowLength = current.position(); // depends on control dependency: [if], data = [none]
return State.OVERFLOW; // depends on control dependency: [if], data = [none]
}
}
}
it = headers.fiNext(it); // depends on control dependency: [while], data = [(it]
if (it == -1 && firstPass) {
firstPass = false; // depends on control dependency: [if], data = [none]
it = headers.fastIterate(); // depends on control dependency: [if], data = [none]
}
}
headersIterator = -1;
firstPass = true;
return State.COMPLETE;
} }
|
public class class_name {
void executeInABox(final Job job) {
try {
job.execute();
} catch (Exception e) {
System.err.println("The execution of the job threw an exception");
e.printStackTrace(System.err);
}
} }
|
public class class_name {
void executeInABox(final Job job) {
try {
job.execute(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
System.err.println("The execution of the job threw an exception");
e.printStackTrace(System.err);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static int ensureOutputParameterInRange(String name, long size) {
if (size > Integer.MAX_VALUE) {
LOG.warn("cos: {} capped to ~2.14GB"
+ " (maximum allowed size with current output mechanism)", name);
return Integer.MAX_VALUE;
} else {
return (int) size;
}
} }
|
public class class_name {
public static int ensureOutputParameterInRange(String name, long size) {
if (size > Integer.MAX_VALUE) {
LOG.warn("cos: {} capped to ~2.14GB"
+ " (maximum allowed size with current output mechanism)", name); // depends on control dependency: [if], data = [none]
return Integer.MAX_VALUE; // depends on control dependency: [if], data = [none]
} else {
return (int) size; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Nullable
static LineOptions fromFeature(@NonNull Feature feature) {
if (feature.geometry() == null) {
throw new RuntimeException("geometry field is required");
}
if (!(feature.geometry() instanceof LineString)) {
return null;
}
LineOptions options = new LineOptions();
options.geometry = (LineString) feature.geometry();
if (feature.hasProperty(PROPERTY_LINE_JOIN)) {
options.lineJoin = feature.getProperty(PROPERTY_LINE_JOIN).getAsString();
}
if (feature.hasProperty(PROPERTY_LINE_OPACITY)) {
options.lineOpacity = feature.getProperty(PROPERTY_LINE_OPACITY).getAsFloat();
}
if (feature.hasProperty(PROPERTY_LINE_COLOR)) {
options.lineColor = feature.getProperty(PROPERTY_LINE_COLOR).getAsString();
}
if (feature.hasProperty(PROPERTY_LINE_WIDTH)) {
options.lineWidth = feature.getProperty(PROPERTY_LINE_WIDTH).getAsFloat();
}
if (feature.hasProperty(PROPERTY_LINE_GAP_WIDTH)) {
options.lineGapWidth = feature.getProperty(PROPERTY_LINE_GAP_WIDTH).getAsFloat();
}
if (feature.hasProperty(PROPERTY_LINE_OFFSET)) {
options.lineOffset = feature.getProperty(PROPERTY_LINE_OFFSET).getAsFloat();
}
if (feature.hasProperty(PROPERTY_LINE_BLUR)) {
options.lineBlur = feature.getProperty(PROPERTY_LINE_BLUR).getAsFloat();
}
if (feature.hasProperty(PROPERTY_LINE_PATTERN)) {
options.linePattern = feature.getProperty(PROPERTY_LINE_PATTERN).getAsString();
}
if (feature.hasProperty(PROPERTY_IS_DRAGGABLE)) {
options.isDraggable = feature.getProperty(PROPERTY_IS_DRAGGABLE).getAsBoolean();
}
return options;
} }
|
public class class_name {
@Nullable
static LineOptions fromFeature(@NonNull Feature feature) {
if (feature.geometry() == null) {
throw new RuntimeException("geometry field is required");
}
if (!(feature.geometry() instanceof LineString)) {
return null; // depends on control dependency: [if], data = [none]
}
LineOptions options = new LineOptions();
options.geometry = (LineString) feature.geometry();
if (feature.hasProperty(PROPERTY_LINE_JOIN)) {
options.lineJoin = feature.getProperty(PROPERTY_LINE_JOIN).getAsString(); // depends on control dependency: [if], data = [none]
}
if (feature.hasProperty(PROPERTY_LINE_OPACITY)) {
options.lineOpacity = feature.getProperty(PROPERTY_LINE_OPACITY).getAsFloat(); // depends on control dependency: [if], data = [none]
}
if (feature.hasProperty(PROPERTY_LINE_COLOR)) {
options.lineColor = feature.getProperty(PROPERTY_LINE_COLOR).getAsString(); // depends on control dependency: [if], data = [none]
}
if (feature.hasProperty(PROPERTY_LINE_WIDTH)) {
options.lineWidth = feature.getProperty(PROPERTY_LINE_WIDTH).getAsFloat(); // depends on control dependency: [if], data = [none]
}
if (feature.hasProperty(PROPERTY_LINE_GAP_WIDTH)) {
options.lineGapWidth = feature.getProperty(PROPERTY_LINE_GAP_WIDTH).getAsFloat(); // depends on control dependency: [if], data = [none]
}
if (feature.hasProperty(PROPERTY_LINE_OFFSET)) {
options.lineOffset = feature.getProperty(PROPERTY_LINE_OFFSET).getAsFloat(); // depends on control dependency: [if], data = [none]
}
if (feature.hasProperty(PROPERTY_LINE_BLUR)) {
options.lineBlur = feature.getProperty(PROPERTY_LINE_BLUR).getAsFloat(); // depends on control dependency: [if], data = [none]
}
if (feature.hasProperty(PROPERTY_LINE_PATTERN)) {
options.linePattern = feature.getProperty(PROPERTY_LINE_PATTERN).getAsString(); // depends on control dependency: [if], data = [none]
}
if (feature.hasProperty(PROPERTY_IS_DRAGGABLE)) {
options.isDraggable = feature.getProperty(PROPERTY_IS_DRAGGABLE).getAsBoolean(); // depends on control dependency: [if], data = [none]
}
return options;
} }
|
public class class_name {
public boolean hasDeclaredMethodParameterAnnotation(final String methodParameterAnnotationName) {
for (final MethodInfo mi : getDeclaredMethodInfo()) {
if (mi.hasParameterAnnotation(methodParameterAnnotationName)) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean hasDeclaredMethodParameterAnnotation(final String methodParameterAnnotationName) {
for (final MethodInfo mi : getDeclaredMethodInfo()) {
if (mi.hasParameterAnnotation(methodParameterAnnotationName)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public static String format(LogRecord logRecord, File sourceDirectory) {
final Cursor cursor = logRecord.getCursor();
String relativePath = "";
try {
if (cursor != null) {
relativePath = new File(cursor.getFile()).getCanonicalPath()
.substring(sourceDirectory.getCanonicalPath().length() + 1);
}
} catch (IOException e) {
// use the absolute path as fail-safe
relativePath = cursor.getFile();
}
return relativePath.length() > 0 ?
String.format(ASCIIDOCTOR_FULL_LOG_FORMAT, logRecord.getSeverity(), relativePath, cursor.getLineNumber(), logRecord.getMessage())
:
String.format(ASCIIDOCTOR_SIMPLE_LOG_FORMAT, logRecord.getSeverity(), logRecord.getMessage())
;
} }
|
public class class_name {
public static String format(LogRecord logRecord, File sourceDirectory) {
final Cursor cursor = logRecord.getCursor();
String relativePath = "";
try {
if (cursor != null) {
relativePath = new File(cursor.getFile()).getCanonicalPath()
.substring(sourceDirectory.getCanonicalPath().length() + 1); // depends on control dependency: [if], data = [(cursor]
}
} catch (IOException e) {
// use the absolute path as fail-safe
relativePath = cursor.getFile();
} // depends on control dependency: [catch], data = [none]
return relativePath.length() > 0 ?
String.format(ASCIIDOCTOR_FULL_LOG_FORMAT, logRecord.getSeverity(), relativePath, cursor.getLineNumber(), logRecord.getMessage())
:
String.format(ASCIIDOCTOR_SIMPLE_LOG_FORMAT, logRecord.getSeverity(), logRecord.getMessage())
;
} }
|
public class class_name {
public static String canonical(File p) {
try {
return p.getCanonicalPath();
} catch (IOException e) {
String x = p.getAbsolutePath();
return x == null ? p.getPath() : x;
}
} }
|
public class class_name {
public static String canonical(File p) {
try {
return p.getCanonicalPath(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
String x = p.getAbsolutePath();
return x == null ? p.getPath() : x;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void writeOutput(DataPipe cr) {
try {
context.write(NullWritable.get(), new Text(cr.getPipeDelimited(outTemplate)));
} catch (Exception e) {
throw new RuntimeException("Exception occurred while writing to Context", e);
}
} }
|
public class class_name {
public void writeOutput(DataPipe cr) {
try {
context.write(NullWritable.get(), new Text(cr.getPipeDelimited(outTemplate))); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Exception occurred while writing to Context", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void handleIntent() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
handleHideNavigationIntent(extras);
handleShowButtonBarIntent(extras);
handleNextButtonTextIntent(extras);
handleBackButtonTextIntent(extras);
handleFinishButtonTextIntent(extras);
handleShowProgressIntent(extras);
handleProgressFormatIntent(extras);
handleNoBreadcrumbsIntent(extras);
}
} }
|
public class class_name {
private void handleIntent() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
handleHideNavigationIntent(extras); // depends on control dependency: [if], data = [(extras]
handleShowButtonBarIntent(extras); // depends on control dependency: [if], data = [(extras]
handleNextButtonTextIntent(extras); // depends on control dependency: [if], data = [(extras]
handleBackButtonTextIntent(extras); // depends on control dependency: [if], data = [(extras]
handleFinishButtonTextIntent(extras); // depends on control dependency: [if], data = [(extras]
handleShowProgressIntent(extras); // depends on control dependency: [if], data = [(extras]
handleProgressFormatIntent(extras); // depends on control dependency: [if], data = [(extras]
handleNoBreadcrumbsIntent(extras); // depends on control dependency: [if], data = [(extras]
}
} }
|
public class class_name {
public void putAll(Map<? extends K,? extends V> m) {
try {
MethodCall call=new MethodCall(PUT_ALL, m);
disp.callRemoteMethods(null, call, call_options);
}
catch(Throwable t) {
throw new RuntimeException("putAll() failed", t);
}
} }
|
public class class_name {
public void putAll(Map<? extends K,? extends V> m) {
try {
MethodCall call=new MethodCall(PUT_ALL, m);
disp.callRemoteMethods(null, call, call_options); // depends on control dependency: [try], data = [none]
}
catch(Throwable t) {
throw new RuntimeException("putAll() failed", t);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void commit() throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "commit", _txn);
// replay must have finished
if (_tranManager.isReplayComplete())
{
final int state = _txn.getTransactionState().getState();
switch (state)
{
case TransactionState.STATE_PREPARED :
try
{
// Suspend local transaction if present
suspend(); // @LIDB2110AA
try
{
// Resume imported transaction
_tranManager.resume(_txn);
}
catch (InvalidTransactionException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw InvalidTransactionException", e });
resume();
throw new XAException(XAException.XAER_RMERR);
}
catch (IllegalStateException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw IllegalStateException", e });
resume();
throw new XAException(XAException.XAER_PROTO);
} // @LIDB2110AA
_txn.getTransactionState().setState(TransactionState.STATE_COMMITTING);
_txn.internalCommit();
_txn.notifyCompletion();
}
catch (HeuristicMixedException e)
{
_heuristic = StatefulResource.HEURISTIC_MIXED;
}
catch (HeuristicHazardException e)
{
_heuristic = StatefulResource.HEURISTIC_HAZARD;
}
catch (HeuristicRollbackException e)
{
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
}
catch (SystemException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "internalCommit threw SystemException");
throw new XAException(XAException.XAER_RMERR);
}
finally // @LIDB2110AA
{
// Resume local transaction if we suspended it earlier
resume();
} // @LIDB2110AA
break;
case TransactionState.STATE_HEURISTIC_ON_ROLLBACK :
case TransactionState.STATE_HEURISTIC_ON_COMMIT :
// We had a heuristic on commit or rollback.
// Let's use whatever that was
_heuristic = _txn.getResources().getHeuristicOutcome();
if (tc.isDebugEnabled()) Tr.debug(tc, "Heuristic was: " + ResourceWrapper.printResourceStatus(_heuristic));
break;
case TransactionState.STATE_COMMITTED :
case TransactionState.STATE_COMMITTING :
// could be a retry, so just accept
break;
case TransactionState.STATE_ROLLING_BACK :
case TransactionState.STATE_ROLLED_BACK :
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
break;
case TransactionState.STATE_NONE :
// transaction has completed and has now finished
break;
default :
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "transaction is not in a prepared state");
throw new XAException(XAException.XAER_PROTO);
}
recordHeuristicOnCommit();
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "throwing XAER_RMFAIL");
throw new XAException(XAException.XAER_RMFAIL);
}
if (tc.isEntryEnabled()) Tr.exit(tc, "commit");
} }
|
public class class_name {
public void commit() throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "commit", _txn);
// replay must have finished
if (_tranManager.isReplayComplete())
{
final int state = _txn.getTransactionState().getState();
switch (state)
{
case TransactionState.STATE_PREPARED :
try
{
// Suspend local transaction if present
suspend(); // @LIDB2110AA // depends on control dependency: [try], data = [none]
try
{
// Resume imported transaction
_tranManager.resume(_txn); // depends on control dependency: [try], data = [none]
}
catch (InvalidTransactionException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw InvalidTransactionException", e });
resume();
throw new XAException(XAException.XAER_RMERR);
} // depends on control dependency: [catch], data = [none]
catch (IllegalStateException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw IllegalStateException", e });
resume();
throw new XAException(XAException.XAER_PROTO);
} // @LIDB2110AA // depends on control dependency: [catch], data = [none]
_txn.getTransactionState().setState(TransactionState.STATE_COMMITTING); // depends on control dependency: [try], data = [none]
_txn.internalCommit(); // depends on control dependency: [try], data = [none]
_txn.notifyCompletion(); // depends on control dependency: [try], data = [none]
}
catch (HeuristicMixedException e)
{
_heuristic = StatefulResource.HEURISTIC_MIXED;
} // depends on control dependency: [catch], data = [none]
catch (HeuristicHazardException e)
{
_heuristic = StatefulResource.HEURISTIC_HAZARD;
} // depends on control dependency: [catch], data = [none]
catch (HeuristicRollbackException e)
{
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
} // depends on control dependency: [catch], data = [none]
catch (SystemException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "internalCommit threw SystemException");
throw new XAException(XAException.XAER_RMERR);
} // depends on control dependency: [catch], data = [none]
finally // @LIDB2110AA
{
// Resume local transaction if we suspended it earlier
resume();
} // @LIDB2110AA
break;
case TransactionState.STATE_HEURISTIC_ON_ROLLBACK :
case TransactionState.STATE_HEURISTIC_ON_COMMIT :
// We had a heuristic on commit or rollback.
// Let's use whatever that was
_heuristic = _txn.getResources().getHeuristicOutcome();
if (tc.isDebugEnabled()) Tr.debug(tc, "Heuristic was: " + ResourceWrapper.printResourceStatus(_heuristic));
break;
case TransactionState.STATE_COMMITTED :
case TransactionState.STATE_COMMITTING :
// could be a retry, so just accept
break;
case TransactionState.STATE_ROLLING_BACK :
case TransactionState.STATE_ROLLED_BACK :
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
break;
case TransactionState.STATE_NONE :
// transaction has completed and has now finished
break;
default :
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "transaction is not in a prepared state");
throw new XAException(XAException.XAER_PROTO);
}
recordHeuristicOnCommit();
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "throwing XAER_RMFAIL");
throw new XAException(XAException.XAER_RMFAIL);
}
if (tc.isEntryEnabled()) Tr.exit(tc, "commit");
} }
|
public class class_name {
@Override
public void onConnect(int rst, HuaweiApiClient client) {
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
onSnsGetMsgIntentResult(rst, null);
return;
}
PendingResult<IntentResult> sendMsgResult = HuaweiSns.HuaweiSnsApi.getMsgSendIntent(client, msg, needResult);
sendMsgResult.setResultCallback(new ResultCallback<IntentResult>() {
@Override
public void onResult(IntentResult result) {
if (result == null) {
HMSAgentLog.e("result is null");
onSnsGetMsgIntentResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
return;
}
Status status = result.getStatus();
if (status == null) {
HMSAgentLog.e("status is null");
onSnsGetMsgIntentResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
return;
}
int rstCode = status.getStatusCode();
HMSAgentLog.d("status=" + status);
// 需要重试的错误码,并且可以重试
if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
|| rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
retryTimes--;
connect();
} else if (rstCode == SNSCode.OK) {
//回调GetMsgIntent结果
Intent nxtIntent = result.getIntent();
if (nxtIntent == null) {
HMSAgentLog.e("nxtIntent is null");
onSnsGetMsgIntentResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
return;
} else {
onSnsGetMsgIntentResult(rstCode, nxtIntent);
return;
}
}else {
onSnsGetMsgIntentResult(rstCode, null);
}
}
});
} }
|
public class class_name {
@Override
public void onConnect(int rst, HuaweiApiClient client) {
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
// depends on control dependency: [if], data = [none]
onSnsGetMsgIntentResult(rst, null);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
PendingResult<IntentResult> sendMsgResult = HuaweiSns.HuaweiSnsApi.getMsgSendIntent(client, msg, needResult);
sendMsgResult.setResultCallback(new ResultCallback<IntentResult>() {
@Override
public void onResult(IntentResult result) {
if (result == null) {
HMSAgentLog.e("result is null");
// depends on control dependency: [if], data = [none]
onSnsGetMsgIntentResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
// depends on control dependency: [if], data = [null)]
return;
// depends on control dependency: [if], data = [none]
}
Status status = result.getStatus();
if (status == null) {
HMSAgentLog.e("status is null");
// depends on control dependency: [if], data = [none]
onSnsGetMsgIntentResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
// depends on control dependency: [if], data = [null)]
return;
// depends on control dependency: [if], data = [none]
}
int rstCode = status.getStatusCode();
HMSAgentLog.d("status=" + status);
// 需要重试的错误码,并且可以重试
if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
|| rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
retryTimes--;
// depends on control dependency: [if], data = [none]
connect();
// depends on control dependency: [if], data = [none]
} else if (rstCode == SNSCode.OK) {
//回调GetMsgIntent结果
Intent nxtIntent = result.getIntent();
if (nxtIntent == null) {
HMSAgentLog.e("nxtIntent is null");
// depends on control dependency: [if], data = [none]
onSnsGetMsgIntentResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
// depends on control dependency: [if], data = [null)]
return;
// depends on control dependency: [if], data = [none]
} else {
onSnsGetMsgIntentResult(rstCode, nxtIntent);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
}else {
onSnsGetMsgIntentResult(rstCode, null);
// depends on control dependency: [if], data = [(rstCode]
}
}
});
} }
|
public class class_name {
public static IWorkbenchPage getActivePage()
{
IWorkbenchWindow w = getActiveWorkbenchWindow();
if (w != null)
{
return w.getActivePage();
}
return null;
} }
|
public class class_name {
public static IWorkbenchPage getActivePage()
{
IWorkbenchWindow w = getActiveWorkbenchWindow();
if (w != null)
{
return w.getActivePage(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public static Vector3i load(InputStream stream, TFloatList positions, TFloatList normals, TFloatList textureCoords, TIntList indices) {
int positionSize = -1;
final TFloatList rawTextureCoords = new TFloatArrayList();
int textureCoordSize = -1;
final TFloatList rawNormalComponents = new TFloatArrayList();
int normalSize = -1;
final TIntList textureCoordIndices = new TIntArrayList();
final TIntList normalIndices = new TIntArrayList();
String line = null;
try (Scanner scanner = new Scanner(stream)) {
while (scanner.hasNextLine()) {
line = scanner.nextLine();
if (line.startsWith(POSITION_LIST_PREFIX + COMPONENT_SEPARATOR)) {
parseComponents(positions, line);
if (positionSize == -1) {
positionSize = positions.size();
}
} else if (textureCoords != null && line.startsWith(TEXTURE_LIST_PREFIX + COMPONENT_SEPARATOR)) {
parseComponents(rawTextureCoords, line);
if (textureCoordSize == -1) {
textureCoordSize = rawTextureCoords.size();
}
} else if (normals != null && line.startsWith(NORMAL_LIST_PREFIX + COMPONENT_SEPARATOR)) {
parseComponents(rawNormalComponents, line);
if (normalSize == -1) {
normalSize = rawNormalComponents.size();
}
} else if (line.startsWith(INDEX_LIST_PREFIX + COMPONENT_SEPARATOR)) {
parseIndices(indices, textureCoordIndices, normalIndices, line);
}
}
line = null;
final boolean hasTextureCoords;
final boolean hasNormals;
if (!textureCoordIndices.isEmpty() && !rawTextureCoords.isEmpty()) {
textureCoords.fill(0, positions.size() / positionSize * textureCoordSize, 0);
hasTextureCoords = true;
} else {
hasTextureCoords = false;
}
if (!normalIndices.isEmpty() && !rawNormalComponents.isEmpty()) {
normals.fill(0, positions.size() / positionSize * normalSize, 0);
hasNormals = true;
} else {
hasNormals = false;
}
if (hasTextureCoords) {
for (int i = 0; i < textureCoordIndices.size(); i++) {
final int textureCoordIndex = textureCoordIndices.get(i) * textureCoordSize;
final int positionIndex = indices.get(i) * textureCoordSize;
for (int ii = 0; ii < textureCoordSize; ii++) {
textureCoords.set(positionIndex + ii, rawTextureCoords.get(textureCoordIndex + ii));
}
}
}
if (hasNormals) {
for (int i = 0; i < normalIndices.size(); i++) {
final int normalIndex = normalIndices.get(i) * normalSize;
final int positionIndex = indices.get(i) * normalSize;
for (int ii = 0; ii < normalSize; ii++) {
normals.set(positionIndex + ii, rawNormalComponents.get(normalIndex + ii));
}
}
}
} catch (Exception ex) {
throw new MalformedObjFileException(line, ex);
}
return new Vector3i(positionSize, normalSize, textureCoordSize).max(0, 0, 0);
} }
|
public class class_name {
public static Vector3i load(InputStream stream, TFloatList positions, TFloatList normals, TFloatList textureCoords, TIntList indices) {
int positionSize = -1;
final TFloatList rawTextureCoords = new TFloatArrayList();
int textureCoordSize = -1;
final TFloatList rawNormalComponents = new TFloatArrayList();
int normalSize = -1;
final TIntList textureCoordIndices = new TIntArrayList();
final TIntList normalIndices = new TIntArrayList();
String line = null;
try (Scanner scanner = new Scanner(stream)) {
while (scanner.hasNextLine()) {
line = scanner.nextLine(); // depends on control dependency: [while], data = [none]
if (line.startsWith(POSITION_LIST_PREFIX + COMPONENT_SEPARATOR)) {
parseComponents(positions, line); // depends on control dependency: [if], data = [none]
if (positionSize == -1) {
positionSize = positions.size(); // depends on control dependency: [if], data = [none]
}
} else if (textureCoords != null && line.startsWith(TEXTURE_LIST_PREFIX + COMPONENT_SEPARATOR)) {
parseComponents(rawTextureCoords, line); // depends on control dependency: [if], data = [none]
if (textureCoordSize == -1) {
textureCoordSize = rawTextureCoords.size(); // depends on control dependency: [if], data = [none]
}
} else if (normals != null && line.startsWith(NORMAL_LIST_PREFIX + COMPONENT_SEPARATOR)) {
parseComponents(rawNormalComponents, line); // depends on control dependency: [if], data = [none]
if (normalSize == -1) {
normalSize = rawNormalComponents.size(); // depends on control dependency: [if], data = [none]
}
} else if (line.startsWith(INDEX_LIST_PREFIX + COMPONENT_SEPARATOR)) {
parseIndices(indices, textureCoordIndices, normalIndices, line); // depends on control dependency: [if], data = [none]
}
}
line = null;
final boolean hasTextureCoords;
final boolean hasNormals;
if (!textureCoordIndices.isEmpty() && !rawTextureCoords.isEmpty()) {
textureCoords.fill(0, positions.size() / positionSize * textureCoordSize, 0); // depends on control dependency: [if], data = [none]
hasTextureCoords = true; // depends on control dependency: [if], data = [none]
} else {
hasTextureCoords = false; // depends on control dependency: [if], data = [none]
}
if (!normalIndices.isEmpty() && !rawNormalComponents.isEmpty()) {
normals.fill(0, positions.size() / positionSize * normalSize, 0); // depends on control dependency: [if], data = [none]
hasNormals = true; // depends on control dependency: [if], data = [none]
} else {
hasNormals = false; // depends on control dependency: [if], data = [none]
}
if (hasTextureCoords) {
for (int i = 0; i < textureCoordIndices.size(); i++) {
final int textureCoordIndex = textureCoordIndices.get(i) * textureCoordSize;
final int positionIndex = indices.get(i) * textureCoordSize;
for (int ii = 0; ii < textureCoordSize; ii++) {
textureCoords.set(positionIndex + ii, rawTextureCoords.get(textureCoordIndex + ii)); // depends on control dependency: [for], data = [ii]
}
}
}
if (hasNormals) {
for (int i = 0; i < normalIndices.size(); i++) {
final int normalIndex = normalIndices.get(i) * normalSize;
final int positionIndex = indices.get(i) * normalSize;
for (int ii = 0; ii < normalSize; ii++) {
normals.set(positionIndex + ii, rawNormalComponents.get(normalIndex + ii)); // depends on control dependency: [for], data = [ii]
}
}
}
} catch (Exception ex) {
throw new MalformedObjFileException(line, ex);
}
return new Vector3i(positionSize, normalSize, textureCoordSize).max(0, 0, 0);
} }
|
public class class_name {
@UiThread
private void updateExpandedParent(@NonNull ExpandableWrapper<P, C> parentWrapper, int flatParentPosition, boolean expansionTriggeredByListItemClick) {
if (parentWrapper.isExpanded()) {
return;
}
parentWrapper.setExpanded(true);
mExpansionStateMap.put(parentWrapper.getParent(), true);
List<ExpandableWrapper<P, C>> wrappedChildList = parentWrapper.getWrappedChildList();
if (wrappedChildList != null) {
int childCount = wrappedChildList.size();
for (int i = 0; i < childCount; i++) {
mFlatItemList.add(flatParentPosition + i + 1, wrappedChildList.get(i));
}
notifyItemRangeInserted(flatParentPosition + 1, childCount);
}
if (expansionTriggeredByListItemClick && mExpandCollapseListener != null) {
mExpandCollapseListener.onParentExpanded(getNearestParentPosition(flatParentPosition));
}
} }
|
public class class_name {
@UiThread
private void updateExpandedParent(@NonNull ExpandableWrapper<P, C> parentWrapper, int flatParentPosition, boolean expansionTriggeredByListItemClick) {
if (parentWrapper.isExpanded()) {
return; // depends on control dependency: [if], data = [none]
}
parentWrapper.setExpanded(true);
mExpansionStateMap.put(parentWrapper.getParent(), true);
List<ExpandableWrapper<P, C>> wrappedChildList = parentWrapper.getWrappedChildList();
if (wrappedChildList != null) {
int childCount = wrappedChildList.size();
for (int i = 0; i < childCount; i++) {
mFlatItemList.add(flatParentPosition + i + 1, wrappedChildList.get(i)); // depends on control dependency: [for], data = [i]
}
notifyItemRangeInserted(flatParentPosition + 1, childCount); // depends on control dependency: [if], data = [none]
}
if (expansionTriggeredByListItemClick && mExpandCollapseListener != null) {
mExpandCollapseListener.onParentExpanded(getNearestParentPosition(flatParentPosition)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static String getStyleClasses(Button button, boolean isResponsive) {
StringBuilder sb;
sb = new StringBuilder(40); // optimize int
sb.append("btn");
String size = button.getSize();
if (size != null) {
sb.append(" btn-").append(size);
}
String look = button.getLook();
if (look != null) {
sb.append(" btn-").append(look);
} else {
sb.append(" btn-default");
}
if (button.isDisabled()) {
sb.append(" disabled");
}
if (isResponsive) {
sb.append(" btn-block");
}
String sclass = button.getStyleClass();
if (sclass != null) {
sb.append(" ").append(sclass);
}
return sb.toString().trim();
} }
|
public class class_name {
private static String getStyleClasses(Button button, boolean isResponsive) {
StringBuilder sb;
sb = new StringBuilder(40); // optimize int
sb.append("btn");
String size = button.getSize();
if (size != null) {
sb.append(" btn-").append(size); // depends on control dependency: [if], data = [(size]
}
String look = button.getLook();
if (look != null) {
sb.append(" btn-").append(look); // depends on control dependency: [if], data = [(look]
} else {
sb.append(" btn-default"); // depends on control dependency: [if], data = [none]
}
if (button.isDisabled()) {
sb.append(" disabled"); // depends on control dependency: [if], data = [none]
}
if (isResponsive) {
sb.append(" btn-block"); // depends on control dependency: [if], data = [none]
}
String sclass = button.getStyleClass();
if (sclass != null) {
sb.append(" ").append(sclass); // depends on control dependency: [if], data = [(sclass]
}
return sb.toString().trim();
} }
|
public class class_name {
public final Dur add(final Dur duration) {
if ((!isNegative() && duration.isNegative())
|| (isNegative() && !duration.isNegative())) {
throw new IllegalArgumentException(
"Cannot add a negative and a positive duration");
}
Dur sum;
if (weeks > 0 && duration.weeks > 0) {
sum = new Dur(weeks + duration.weeks);
}
else {
int daySum = (weeks > 0) ? weeks * DAYS_PER_WEEK + days : days;
int hourSum = hours;
int minuteSum = minutes;
int secondSum = seconds;
if ((secondSum + duration.seconds) / SECONDS_PER_MINUTE > 0) {
minuteSum += (secondSum + duration.seconds) / SECONDS_PER_MINUTE;
secondSum = (secondSum + duration.seconds) % SECONDS_PER_MINUTE;
}
else {
secondSum += duration.seconds;
}
if ((minuteSum + duration.minutes) / MINUTES_PER_HOUR > 0) {
hourSum += (minuteSum + duration.minutes) / MINUTES_PER_HOUR;
minuteSum = (minuteSum + duration.minutes) % MINUTES_PER_HOUR;
}
else {
minuteSum += duration.minutes;
}
if ((hourSum + duration.hours) / HOURS_PER_DAY > 0) {
daySum += (hourSum + duration.hours) / HOURS_PER_DAY;
hourSum = (hourSum + duration.hours) % HOURS_PER_DAY;
}
else {
hourSum += duration.hours;
}
daySum += (duration.weeks > 0) ? duration.weeks * DAYS_PER_WEEK
+ duration.days : duration.days;
sum = new Dur(daySum, hourSum, minuteSum, secondSum);
}
sum.negative = negative;
return sum;
} }
|
public class class_name {
public final Dur add(final Dur duration) {
if ((!isNegative() && duration.isNegative())
|| (isNegative() && !duration.isNegative())) {
throw new IllegalArgumentException(
"Cannot add a negative and a positive duration");
}
Dur sum;
if (weeks > 0 && duration.weeks > 0) {
sum = new Dur(weeks + duration.weeks); // depends on control dependency: [if], data = [(weeks]
}
else {
int daySum = (weeks > 0) ? weeks * DAYS_PER_WEEK + days : days;
int hourSum = hours;
int minuteSum = minutes;
int secondSum = seconds;
if ((secondSum + duration.seconds) / SECONDS_PER_MINUTE > 0) {
minuteSum += (secondSum + duration.seconds) / SECONDS_PER_MINUTE; // depends on control dependency: [if], data = [none]
secondSum = (secondSum + duration.seconds) % SECONDS_PER_MINUTE; // depends on control dependency: [if], data = [none]
}
else {
secondSum += duration.seconds; // depends on control dependency: [if], data = [none]
}
if ((minuteSum + duration.minutes) / MINUTES_PER_HOUR > 0) {
hourSum += (minuteSum + duration.minutes) / MINUTES_PER_HOUR; // depends on control dependency: [if], data = [none]
minuteSum = (minuteSum + duration.minutes) % MINUTES_PER_HOUR; // depends on control dependency: [if], data = [none]
}
else {
minuteSum += duration.minutes; // depends on control dependency: [if], data = [none]
}
if ((hourSum + duration.hours) / HOURS_PER_DAY > 0) {
daySum += (hourSum + duration.hours) / HOURS_PER_DAY; // depends on control dependency: [if], data = [none]
hourSum = (hourSum + duration.hours) % HOURS_PER_DAY; // depends on control dependency: [if], data = [none]
}
else {
hourSum += duration.hours; // depends on control dependency: [if], data = [none]
}
daySum += (duration.weeks > 0) ? duration.weeks * DAYS_PER_WEEK
+ duration.days : duration.days; // depends on control dependency: [if], data = [none]
sum = new Dur(daySum, hourSum, minuteSum, secondSum); // depends on control dependency: [if], data = [none]
}
sum.negative = negative;
return sum;
} }
|
public class class_name {
public static int getBackgroundColor(Context context, AttributeSet attrs) {
int color = Color.TRANSPARENT;
if (isHaveAttribute(attrs, "background")) {
int styleId = attrs.getStyleAttribute();
int[] attributesArray = new int[]{android.R.attr.background};
try {
TypedArray typedArray = context.obtainStyledAttributes(styleId, attributesArray);
if (typedArray.length() > 0)
color = typedArray.getColor(0, color);
typedArray.recycle();
} catch (Resources.NotFoundException e) {
e.printStackTrace();
}
}
return color;
} }
|
public class class_name {
public static int getBackgroundColor(Context context, AttributeSet attrs) {
int color = Color.TRANSPARENT;
if (isHaveAttribute(attrs, "background")) {
int styleId = attrs.getStyleAttribute();
int[] attributesArray = new int[]{android.R.attr.background};
try {
TypedArray typedArray = context.obtainStyledAttributes(styleId, attributesArray);
if (typedArray.length() > 0)
color = typedArray.getColor(0, color);
typedArray.recycle(); // depends on control dependency: [try], data = [none]
} catch (Resources.NotFoundException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return color;
} }
|
public class class_name {
@Override
protected void _predict(Dataframe newData) {
Map<List<Object>, Double> similarities = knowledgeBase.getModelParameters().getSimilarities();
//generate recommendation for each record in the list
for(Map.Entry<Integer, Record> e : newData.entries()) {
Integer rId = e.getKey();
Record r = e.getValue();
Map<Object, Double> recommendations = new HashMap<>();
Map<Object, Double> simSums = new HashMap<>();
for(Map.Entry<Object, Object> entry : r.getX().entrySet()) {
Object row = entry.getKey();
Double score = TypeInference.toDouble(entry.getValue());
for(Map.Entry<List<Object>, Double> entry2 : similarities.entrySet()) {
List<Object> tpk = entry2.getKey();
if(!tpk.get(0).equals(row)) {
continue; //filter the irrelevant two pair key combinations that do not include the row
}
Object column = tpk.get(1);
Double previousRecValue = recommendations.getOrDefault(column, 0.0);
Double previousSimsumValue = simSums.getOrDefault(column, 0.0);
Double similarity = entry2.getValue();
recommendations.put(column, previousRecValue+similarity*score);
simSums.put(column, previousSimsumValue+similarity);
}
}
for(Map.Entry<Object, Double> entry : recommendations.entrySet()) {
Object column = entry.getKey();
Double score = entry.getValue();
recommendations.put(column, score/simSums.get(column));
}
//simSums = null;
recommendations = MapMethods.sortNumberMapByValueDescending(recommendations);
newData._unsafe_set(rId, new Record(r.getX(), r.getY(), recommendations.keySet().iterator().next(), new AssociativeArray((Map)recommendations)));
}
} }
|
public class class_name {
@Override
protected void _predict(Dataframe newData) {
Map<List<Object>, Double> similarities = knowledgeBase.getModelParameters().getSimilarities();
//generate recommendation for each record in the list
for(Map.Entry<Integer, Record> e : newData.entries()) {
Integer rId = e.getKey();
Record r = e.getValue();
Map<Object, Double> recommendations = new HashMap<>();
Map<Object, Double> simSums = new HashMap<>();
for(Map.Entry<Object, Object> entry : r.getX().entrySet()) {
Object row = entry.getKey();
Double score = TypeInference.toDouble(entry.getValue());
for(Map.Entry<List<Object>, Double> entry2 : similarities.entrySet()) {
List<Object> tpk = entry2.getKey();
if(!tpk.get(0).equals(row)) {
continue; //filter the irrelevant two pair key combinations that do not include the row
}
Object column = tpk.get(1);
Double previousRecValue = recommendations.getOrDefault(column, 0.0);
Double previousSimsumValue = simSums.getOrDefault(column, 0.0);
Double similarity = entry2.getValue();
recommendations.put(column, previousRecValue+similarity*score); // depends on control dependency: [for], data = [none]
simSums.put(column, previousSimsumValue+similarity); // depends on control dependency: [for], data = [none]
}
}
for(Map.Entry<Object, Double> entry : recommendations.entrySet()) {
Object column = entry.getKey();
Double score = entry.getValue();
recommendations.put(column, score/simSums.get(column)); // depends on control dependency: [for], data = [none]
}
//simSums = null;
recommendations = MapMethods.sortNumberMapByValueDescending(recommendations); // depends on control dependency: [for], data = [e]
newData._unsafe_set(rId, new Record(r.getX(), r.getY(), recommendations.keySet().iterator().next(), new AssociativeArray((Map)recommendations))); // depends on control dependency: [for], data = [e]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> T fromXml(String xml) {
try {
StringReader reader = new StringReader(xml);
return (T) createUnmarshaller().unmarshal(reader);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> T fromXml(String xml) {
try {
StringReader reader = new StringReader(xml);
return (T) createUnmarshaller().unmarshal(reader); // depends on control dependency: [try], data = [none]
} catch (JAXBException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static String getMethodSignature(final String returnType, final String methodName, final Class<?>[] argTypes) {
final StringBuilder sb = new StringBuilder();
if (returnType != null) {
sb.append(returnType);
sb.append(" ");
}
sb.append(methodName);
sb.append("(");
if (argTypes != null) {
for (int i = 0; i < argTypes.length; i++) {
if (i > 0) {
sb.append(", ");
}
sb.append(argTypes[i].getName());
}
}
sb.append(")");
return sb.toString();
} }
|
public class class_name {
private static String getMethodSignature(final String returnType, final String methodName, final Class<?>[] argTypes) {
final StringBuilder sb = new StringBuilder();
if (returnType != null) {
sb.append(returnType);
// depends on control dependency: [if], data = [(returnType]
sb.append(" ");
// depends on control dependency: [if], data = [none]
}
sb.append(methodName);
sb.append("(");
if (argTypes != null) {
for (int i = 0; i < argTypes.length; i++) {
if (i > 0) {
sb.append(", ");
// depends on control dependency: [if], data = [none]
}
sb.append(argTypes[i].getName());
// depends on control dependency: [for], data = [i]
}
}
sb.append(")");
return sb.toString();
} }
|
public class class_name {
protected double multiply(double[][] mat, double[] in, double[] out) {
double l = 0.;
// Matrix multiplication:
for(int d1 = 0; d1 < in.length; d1++) {
final double[] row = mat[d1];
double t = 0.;
for(int d2 = 0; d2 < in.length; d2++) {
t += row[d2] * in[d2];
}
out[d1] = t;
l += t * t;
}
return l > 0 ? FastMath.sqrt(l) : 0.;
} }
|
public class class_name {
protected double multiply(double[][] mat, double[] in, double[] out) {
double l = 0.;
// Matrix multiplication:
for(int d1 = 0; d1 < in.length; d1++) {
final double[] row = mat[d1];
double t = 0.;
for(int d2 = 0; d2 < in.length; d2++) {
t += row[d2] * in[d2]; // depends on control dependency: [for], data = [d2]
}
out[d1] = t; // depends on control dependency: [for], data = [d1]
l += t * t; // depends on control dependency: [for], data = [none]
}
return l > 0 ? FastMath.sqrt(l) : 0.;
} }
|
public class class_name {
public static DynamicPropertyFactory initWithConfigurationSource(DynamicPropertySupport dynamicPropertySupport) {
synchronized (ConfigurationManager.class) {
if (dynamicPropertySupport == null) {
throw new IllegalArgumentException("dynamicPropertySupport is null");
}
AbstractConfiguration configuration = null;
if (dynamicPropertySupport instanceof AbstractConfiguration) {
configuration = (AbstractConfiguration) dynamicPropertySupport;
} else if (dynamicPropertySupport instanceof ConfigurationBackedDynamicPropertySupportImpl) {
configuration = ((ConfigurationBackedDynamicPropertySupportImpl) dynamicPropertySupport).getConfiguration();
}
if (initializedWithDefaultConfig) {
config = null;
} else if (config != null && config != dynamicPropertySupport) {
throw new IllegalStateException("DynamicPropertyFactory is already initialized with a diffrerent configuration source: " + config);
}
if (ConfigurationManager.isConfigurationInstalled()
&& (configuration != null && configuration != ConfigurationManager.instance)) {
throw new IllegalStateException("ConfigurationManager is already initialized with configuration "
+ ConfigurationManager.getConfigInstance());
}
if (configuration != null && configuration != ConfigurationManager.instance) {
ConfigurationManager.setDirect(configuration);
}
setDirect(dynamicPropertySupport);
return instance;
}
} }
|
public class class_name {
public static DynamicPropertyFactory initWithConfigurationSource(DynamicPropertySupport dynamicPropertySupport) {
synchronized (ConfigurationManager.class) {
if (dynamicPropertySupport == null) {
throw new IllegalArgumentException("dynamicPropertySupport is null");
}
AbstractConfiguration configuration = null;
if (dynamicPropertySupport instanceof AbstractConfiguration) {
configuration = (AbstractConfiguration) dynamicPropertySupport; // depends on control dependency: [if], data = [none]
} else if (dynamicPropertySupport instanceof ConfigurationBackedDynamicPropertySupportImpl) {
configuration = ((ConfigurationBackedDynamicPropertySupportImpl) dynamicPropertySupport).getConfiguration(); // depends on control dependency: [if], data = [none]
}
if (initializedWithDefaultConfig) {
config = null; // depends on control dependency: [if], data = [none]
} else if (config != null && config != dynamicPropertySupport) {
throw new IllegalStateException("DynamicPropertyFactory is already initialized with a diffrerent configuration source: " + config);
}
if (ConfigurationManager.isConfigurationInstalled()
&& (configuration != null && configuration != ConfigurationManager.instance)) {
throw new IllegalStateException("ConfigurationManager is already initialized with configuration "
+ ConfigurationManager.getConfigInstance());
}
if (configuration != null && configuration != ConfigurationManager.instance) {
ConfigurationManager.setDirect(configuration); // depends on control dependency: [if], data = [(configuration]
}
setDirect(dynamicPropertySupport);
return instance;
}
} }
|
public class class_name {
public SemanticType extractElementType(SemanticType.Reference type, SyntacticItem item) {
if (type == null) {
return null;
} else {
return type.getElement();
}
} }
|
public class class_name {
public SemanticType extractElementType(SemanticType.Reference type, SyntacticItem item) {
if (type == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
return type.getElement(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void replaceStringChildren(List<String> strings) {
ArrayList<StringEntity> entities = new ArrayList<>();
for (String string : strings) {
StringEntity entity = new StringEntity();
entity.setValue(string);
entities.add(entity);
}
replaceAll(entities);
} }
|
public class class_name {
public void replaceStringChildren(List<String> strings) {
ArrayList<StringEntity> entities = new ArrayList<>();
for (String string : strings) {
StringEntity entity = new StringEntity();
entity.setValue(string); // depends on control dependency: [for], data = [string]
entities.add(entity); // depends on control dependency: [for], data = [none]
}
replaceAll(entities);
} }
|
public class class_name {
public StringExpression asText() {
if (text == null) {
text = Expressions.stringOperation(SpatialOps.AS_TEXT, mixin);
}
return text;
} }
|
public class class_name {
public StringExpression asText() {
if (text == null) {
text = Expressions.stringOperation(SpatialOps.AS_TEXT, mixin); // depends on control dependency: [if], data = [none]
}
return text;
} }
|
public class class_name {
public IconType<WebFragmentDescriptor> getOrCreateIcon()
{
List<Node> nodeList = model.get("icon");
if (nodeList != null && nodeList.size() > 0)
{
return new IconTypeImpl<WebFragmentDescriptor>(this, "icon", model, nodeList.get(0));
}
return createIcon();
} }
|
public class class_name {
public IconType<WebFragmentDescriptor> getOrCreateIcon()
{
List<Node> nodeList = model.get("icon");
if (nodeList != null && nodeList.size() > 0)
{
return new IconTypeImpl<WebFragmentDescriptor>(this, "icon", model, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createIcon();
} }
|
public class class_name {
@Override
public List<JqassistantPlugin> getPlugins() {
if (this.plugins == null) {
final Enumeration<URL> resources;
try {
resources = pluginClassLoader.getResources(PLUGIN_RESOURCE);
} catch (IOException e) {
throw new IllegalStateException("Cannot get plugin resources.", e);
}
this.plugins = new ArrayList<>();
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
LOGGER.debug("Reading plugin descriptor from '{}'.", url);
this.plugins.add(readPlugin(url));
}
SortedSet<String> pluginNames = new TreeSet<>();
for (JqassistantPlugin plugin : plugins) {
pluginNames.add(plugin.getName());
}
LOGGER.info("Loaded jQAssistant plugins {}.", pluginNames);
}
return this.plugins;
} }
|
public class class_name {
@Override
public List<JqassistantPlugin> getPlugins() {
if (this.plugins == null) {
final Enumeration<URL> resources;
try {
resources = pluginClassLoader.getResources(PLUGIN_RESOURCE); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalStateException("Cannot get plugin resources.", e);
} // depends on control dependency: [catch], data = [none]
this.plugins = new ArrayList<>(); // depends on control dependency: [if], data = [none]
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
LOGGER.debug("Reading plugin descriptor from '{}'.", url); // depends on control dependency: [while], data = [none]
this.plugins.add(readPlugin(url)); // depends on control dependency: [while], data = [none]
}
SortedSet<String> pluginNames = new TreeSet<>();
for (JqassistantPlugin plugin : plugins) {
pluginNames.add(plugin.getName()); // depends on control dependency: [for], data = [plugin]
}
LOGGER.info("Loaded jQAssistant plugins {}.", pluginNames); // depends on control dependency: [if], data = [none]
}
return this.plugins;
} }
|
public class class_name {
public void marshall(S3OutputUrl s3OutputUrl, ProtocolMarshaller protocolMarshaller) {
if (s3OutputUrl == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(s3OutputUrl.getOutputUrl(), OUTPUTURL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(S3OutputUrl s3OutputUrl, ProtocolMarshaller protocolMarshaller) {
if (s3OutputUrl == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(s3OutputUrl.getOutputUrl(), OUTPUTURL_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 marshall(DeviceMethod deviceMethod, ProtocolMarshaller protocolMarshaller) {
if (deviceMethod == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deviceMethod.getDeviceType(), DEVICETYPE_BINDING);
protocolMarshaller.marshall(deviceMethod.getMethodName(), METHODNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeviceMethod deviceMethod, ProtocolMarshaller protocolMarshaller) {
if (deviceMethod == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deviceMethod.getDeviceType(), DEVICETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceMethod.getMethodName(), METHODNAME_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 auditRegisterDocumentSetBEvent(
RFC3881EventOutcomeCodes eventOutcome,
String repositoryUserId,
String userName,
String registryEndpointUri,
String submissionSetUniqueId, String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
auditRegisterEvent(new IHETransactionEventTypeCodes.RegisterDocumentSetB(), eventOutcome, repositoryUserId,
userName,
registryEndpointUri, submissionSetUniqueId, patientId, purposesOfUse, userRoles);
} }
|
public class class_name {
public void auditRegisterDocumentSetBEvent(
RFC3881EventOutcomeCodes eventOutcome,
String repositoryUserId,
String userName,
String registryEndpointUri,
String submissionSetUniqueId, String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return; // depends on control dependency: [if], data = [none]
}
auditRegisterEvent(new IHETransactionEventTypeCodes.RegisterDocumentSetB(), eventOutcome, repositoryUserId,
userName,
registryEndpointUri, submissionSetUniqueId, patientId, purposesOfUse, userRoles);
} }
|
public class class_name {
public void close()
{
LOGGER.entering(CLASS_NAME, "close");
for (String pid : serviceAgents.keySet())
{
deleted(pid);
}
LOGGER.exiting(CLASS_NAME, "close");
} }
|
public class class_name {
public void close()
{
LOGGER.entering(CLASS_NAME, "close");
for (String pid : serviceAgents.keySet())
{
deleted(pid); // depends on control dependency: [for], data = [pid]
}
LOGGER.exiting(CLASS_NAME, "close");
} }
|
public class class_name {
private void awaitTasks() {
if (_tasksPending.get() == 0) {
return;
}
synchronized (this) {
while (_tasksPending.get() != 0) {
try {
logger.info("Scan tasks still pending, waiting");
wait();
} catch (final InterruptedException e) {
logger.debug("Interrupted while awaiting task completion", e);
}
}
}
} }
|
public class class_name {
private void awaitTasks() {
if (_tasksPending.get() == 0) {
return; // depends on control dependency: [if], data = [none]
}
synchronized (this) {
while (_tasksPending.get() != 0) {
try {
logger.info("Scan tasks still pending, waiting"); // depends on control dependency: [try], data = [none]
wait(); // depends on control dependency: [try], data = [none]
} catch (final InterruptedException e) {
logger.debug("Interrupted while awaiting task completion", e);
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
public List<Categories> getCategories(final boolean inline) {
final Categories cats = new Categories();
cats.setFixed(true);
cats.setScheme(contextURI + "/" + handle + "/" + singular);
if (inline) {
for (final String catName : catNames) {
final Category cat = new Category();
cat.setTerm(catName);
cats.addCategory(cat);
}
} else {
cats.setHref(getCategoriesURI());
}
return Collections.singletonList(cats);
} }
|
public class class_name {
public List<Categories> getCategories(final boolean inline) {
final Categories cats = new Categories();
cats.setFixed(true);
cats.setScheme(contextURI + "/" + handle + "/" + singular);
if (inline) {
for (final String catName : catNames) {
final Category cat = new Category();
cat.setTerm(catName); // depends on control dependency: [for], data = [catName]
cats.addCategory(cat); // depends on control dependency: [for], data = [none]
}
} else {
cats.setHref(getCategoriesURI()); // depends on control dependency: [if], data = [none]
}
return Collections.singletonList(cats);
} }
|
public class class_name {
public Map<Object, String> read(Reader reader) throws IOException {
Map<Object, String> cvs = new HashMap<>();
try (CSVReader r = new CSVReader(reader, '\t')) {
String[] cols;
int i = 1;
while ((cols = r.readNext()) != null) {
switch (cols.length) {
case 0:
break;
case 1:
String col0 = cols[0];
if (col0.length() > 1) {
cvs.put(col0, "");
}
break;
case 2:
cvs.put(cols[1], cols[0]);
break;
default:
throw new IOException("Invalid mapping in line " + i + ": mapping has length " + cols.length);
}
i++;
}
}
return cvs;
} }
|
public class class_name {
public Map<Object, String> read(Reader reader) throws IOException {
Map<Object, String> cvs = new HashMap<>();
try (CSVReader r = new CSVReader(reader, '\t')) {
String[] cols;
int i = 1;
while ((cols = r.readNext()) != null) {
switch (cols.length) {
case 0:
break;
case 1:
String col0 = cols[0];
if (col0.length() > 1) {
cvs.put(col0, ""); // depends on control dependency: [if], data = [none]
}
break;
case 2:
cvs.put(cols[1], cols[0]);
break;
default:
throw new IOException("Invalid mapping in line " + i + ": mapping has length " + cols.length);
}
i++; // depends on control dependency: [while], data = [none]
}
}
return cvs;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
protected Class<T> determineBasicMessageClass() {
// all of this is usually going to just return AbstractMessage.class - but in case there is a subclass hierarchy
// that makes it more specific, this will help discover the message class.
Class<?> thisClazz = this.getClass();
Type superClazz = thisClazz.getGenericSuperclass();
// we might be a internal generated class (like a MDB within a container) so walk up the hierarchy
// to find our real paramaterized superclass
while (superClazz instanceof Class) {
superClazz = ((Class<?>) superClazz).getGenericSuperclass();
}
ParameterizedType parameterizedType = (ParameterizedType) superClazz;
Type actualTypeArgument = parameterizedType.getActualTypeArguments()[0];
Class<T> clazz;
if (actualTypeArgument instanceof Class<?>) {
clazz = (Class<T>) actualTypeArgument;
} else {
TypeVariable<?> typeVar = (TypeVariable<?>) actualTypeArgument;
clazz = (Class<T>) typeVar.getBounds()[0];
}
return clazz;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
protected Class<T> determineBasicMessageClass() {
// all of this is usually going to just return AbstractMessage.class - but in case there is a subclass hierarchy
// that makes it more specific, this will help discover the message class.
Class<?> thisClazz = this.getClass();
Type superClazz = thisClazz.getGenericSuperclass();
// we might be a internal generated class (like a MDB within a container) so walk up the hierarchy
// to find our real paramaterized superclass
while (superClazz instanceof Class) {
superClazz = ((Class<?>) superClazz).getGenericSuperclass(); // depends on control dependency: [while], data = [none]
}
ParameterizedType parameterizedType = (ParameterizedType) superClazz;
Type actualTypeArgument = parameterizedType.getActualTypeArguments()[0];
Class<T> clazz;
if (actualTypeArgument instanceof Class<?>) {
clazz = (Class<T>) actualTypeArgument; // depends on control dependency: [if], data = [)]
} else {
TypeVariable<?> typeVar = (TypeVariable<?>) actualTypeArgument;
clazz = (Class<T>) typeVar.getBounds()[0]; // depends on control dependency: [if], data = [)]
}
return clazz;
} }
|
public class class_name {
public void setResource(String resource, RequestParams params) {
if (null == resource) {
WonderPush.logError("null resource provided to WonderPushView");
return;
}
mInitialResource = resource;
mInitialRequestParams = params;
mIsPreloading = false;
if (null == params)
params = new RequestParams();
WonderPushRequestParamsDecorator.decorate(resource, params);
String url = String.format(Locale.getDefault(), "%s?%s",
WonderPushUriHelper.getNonSecureAbsoluteUrl(resource),
params.getURLEncodedString());
mWebView.loadUrl(url);
} }
|
public class class_name {
public void setResource(String resource, RequestParams params) {
if (null == resource) {
WonderPush.logError("null resource provided to WonderPushView"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
mInitialResource = resource;
mInitialRequestParams = params;
mIsPreloading = false;
if (null == params)
params = new RequestParams();
WonderPushRequestParamsDecorator.decorate(resource, params);
String url = String.format(Locale.getDefault(), "%s?%s",
WonderPushUriHelper.getNonSecureAbsoluteUrl(resource),
params.getURLEncodedString());
mWebView.loadUrl(url);
} }
|
public class class_name {
int sendMessageToTopicForSessions(Collection<Session> sessions, MessageToClient mtc, Object payload) {
int sended = 0;
JsTopicMessageController msgControl = messageControllerManager.getJsTopicMessageController(mtc.getId());
Collection<Session> sessionsClosed = new ArrayList<>();
for (Session session : sessions) {
try {
sended += checkAndSendMtcToSession(session, msgControl, mtc, payload);
} catch (SessionException se) {
sessionsClosed.add(se.getSession());
}
}
if (logger.isDebugEnabled()) {
logger.debug("Send message to '{}' topic {} client(s) : {}", new Object[]{mtc.getId(), sessions.size() - sessionsClosed.size(), mtc});
}
topicManager.removeSessionsToTopic(sessionsClosed);
return sended;
} }
|
public class class_name {
int sendMessageToTopicForSessions(Collection<Session> sessions, MessageToClient mtc, Object payload) {
int sended = 0;
JsTopicMessageController msgControl = messageControllerManager.getJsTopicMessageController(mtc.getId());
Collection<Session> sessionsClosed = new ArrayList<>();
for (Session session : sessions) {
try {
sended += checkAndSendMtcToSession(session, msgControl, mtc, payload);
// depends on control dependency: [try], data = [none]
} catch (SessionException se) {
sessionsClosed.add(se.getSession());
}
// depends on control dependency: [catch], data = [none]
}
if (logger.isDebugEnabled()) {
logger.debug("Send message to '{}' topic {} client(s) : {}", new Object[]{mtc.getId(), sessions.size() - sessionsClosed.size(), mtc});
// depends on control dependency: [if], data = [none]
}
topicManager.removeSessionsToTopic(sessionsClosed);
return sended;
} }
|
public class class_name {
private <T extends Annotation> boolean checkReusable(MetricResolver.Of<T> of) {
String name = of.metadata().getName();
// If the metric has been registered before (eg. metrics found in RequestScoped beans),
// we don't need to worry about re-usable
if (!of.isInitialDiscovery()) {
return true;
}
Metadata existingMetadata = registry.getMetadata().get(name);
if (existingMetadata != null && (existingMetadata.isReusable() == false || of.metadata().isReusable() == false)) {
throw new IllegalArgumentException("Cannot reuse metric for " + of.metricName());
}
return true;
} }
|
public class class_name {
private <T extends Annotation> boolean checkReusable(MetricResolver.Of<T> of) {
String name = of.metadata().getName();
// If the metric has been registered before (eg. metrics found in RequestScoped beans),
// we don't need to worry about re-usable
if (!of.isInitialDiscovery()) {
return true; // depends on control dependency: [if], data = [none]
}
Metadata existingMetadata = registry.getMetadata().get(name);
if (existingMetadata != null && (existingMetadata.isReusable() == false || of.metadata().isReusable() == false)) {
throw new IllegalArgumentException("Cannot reuse metric for " + of.metricName());
}
return true;
} }
|
public class class_name {
public static <T> T getField(Class<T> returnType, Class<?> targetClass, Object target, String field) {
try {
Field declaredField = targetClass.getDeclaredField(field);
return AccessController.doPrivileged(
new GetFieldPrivilegedAction<T>(declaredField, target));
} catch (NoSuchFieldException e) {
throw new TransfuseInjectionException(
"NoSuchFieldException Exception during field injection: " + field + " in " + target.getClass(), e);
} catch (PrivilegedActionException e) {
throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e);
} catch (Exception e) {
throw new TransfuseInjectionException("Exception during field injection", e);
}
} }
|
public class class_name {
public static <T> T getField(Class<T> returnType, Class<?> targetClass, Object target, String field) {
try {
Field declaredField = targetClass.getDeclaredField(field);
return AccessController.doPrivileged(
new GetFieldPrivilegedAction<T>(declaredField, target)); // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException e) {
throw new TransfuseInjectionException(
"NoSuchFieldException Exception during field injection: " + field + " in " + target.getClass(), e);
} catch (PrivilegedActionException e) { // depends on control dependency: [catch], data = [none]
throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new TransfuseInjectionException("Exception during field injection", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity ssoStatus(final HttpServletRequest request) {
val tgtId = this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request);
if (StringUtils.isNotBlank(tgtId)) {
val auth = this.ticketRegistrySupport.getAuthenticationFrom(tgtId);
if (auth != null) {
val ticketState = this.ticketRegistrySupport.getTicketState(tgtId);
val body = CollectionUtils.wrap("principal", auth.getPrincipal().getId(),
"authenticationDate", auth.getAuthenticationDate(),
"ticketGrantingTicketCreationTime", ticketState.getCreationTime(),
"ticketGrantingTicketPreviousTimeUsed", ticketState.getPreviousTimeUsed(),
"ticketGrantingTicketLastTimeUsed", ticketState.getLastTimeUsed());
return ResponseEntity.ok(body);
}
}
return ResponseEntity.badRequest().build();
} }
|
public class class_name {
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity ssoStatus(final HttpServletRequest request) {
val tgtId = this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request);
if (StringUtils.isNotBlank(tgtId)) {
val auth = this.ticketRegistrySupport.getAuthenticationFrom(tgtId);
if (auth != null) {
val ticketState = this.ticketRegistrySupport.getTicketState(tgtId);
val body = CollectionUtils.wrap("principal", auth.getPrincipal().getId(),
"authenticationDate", auth.getAuthenticationDate(),
"ticketGrantingTicketCreationTime", ticketState.getCreationTime(),
"ticketGrantingTicketPreviousTimeUsed", ticketState.getPreviousTimeUsed(),
"ticketGrantingTicketLastTimeUsed", ticketState.getLastTimeUsed());
return ResponseEntity.ok(body); // depends on control dependency: [if], data = [none]
}
}
return ResponseEntity.badRequest().build();
} }
|
public class class_name {
public static void clearDateFormats(Map<String, DateFormat> copy) {
synchronized(dateFormats) {
if (copy != null) {
copy.putAll(dateFormats);
}
dateFormats.clear();
}
} }
|
public class class_name {
public static void clearDateFormats(Map<String, DateFormat> copy) {
synchronized(dateFormats) {
if (copy != null) {
copy.putAll(dateFormats);
// depends on control dependency: [if], data = [none]
}
dateFormats.clear();
}
} }
|
public class class_name {
public static int binarySearchValueOrHigher(ListNumber values, double value) {
if (value <= values.getDouble(0)) {
return 0;
}
if (value >= values.getDouble(values.size() -1)) {
return values.size() - 1;
}
int index = binarySearch(0, values.size() - 1, values, value);
while (index != values.size() - 1 && value > values.getDouble(index)) {
index++;
}
while (index != values.size() - 1 && value == values.getDouble(index + 1)) {
index++;
}
return index;
} }
|
public class class_name {
public static int binarySearchValueOrHigher(ListNumber values, double value) {
if (value <= values.getDouble(0)) {
return 0;
// depends on control dependency: [if], data = [none]
}
if (value >= values.getDouble(values.size() -1)) {
return values.size() - 1;
// depends on control dependency: [if], data = [none]
}
int index = binarySearch(0, values.size() - 1, values, value);
while (index != values.size() - 1 && value > values.getDouble(index)) {
index++;
// depends on control dependency: [while], data = [none]
}
while (index != values.size() - 1 && value == values.getDouble(index + 1)) {
index++;
// depends on control dependency: [while], data = [none]
}
return index;
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsNextWithServiceResponseAsync(final String nextPageLink) {
return listPoolNodeCountsNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listPoolNodeCountsNextWithServiceResponseAsync(nextPageLink, null));
}
});
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsNextWithServiceResponseAsync(final String nextPageLink) {
return listPoolNodeCountsNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(listPoolNodeCountsNextWithServiceResponseAsync(nextPageLink, null));
}
});
} }
|
public class class_name {
public static AbstractGraphDatabase getSocialGraphDatabase(
final Configuration config) {
// prepare neo4j graph configuration
final Map<String, String> graphConfig = loadDatabaseConfig(config);
// load database from path specified
AbstractGraphDatabase database;
if (config.getReadOnly()) {
database = new EmbeddedReadOnlyGraphDatabase(
config.getDatabasePath(), graphConfig);
} else {
database = new EmbeddedGraphDatabase(config.getDatabasePath(),
graphConfig);
}
// load lucene indices
DATABASE = database;
loadLuceneIndices(database);
return database;
} }
|
public class class_name {
public static AbstractGraphDatabase getSocialGraphDatabase(
final Configuration config) {
// prepare neo4j graph configuration
final Map<String, String> graphConfig = loadDatabaseConfig(config);
// load database from path specified
AbstractGraphDatabase database;
if (config.getReadOnly()) {
database = new EmbeddedReadOnlyGraphDatabase(
config.getDatabasePath(), graphConfig); // depends on control dependency: [if], data = [none]
} else {
database = new EmbeddedGraphDatabase(config.getDatabasePath(),
graphConfig); // depends on control dependency: [if], data = [none]
}
// load lucene indices
DATABASE = database;
loadLuceneIndices(database);
return database;
} }
|
public class class_name {
@Override
public boolean sqlMapDeleteByExampleElementGenerated(XmlElement element, IntrospectedTable introspectedTable) {
if (this.versionColumn != null) {
this.sqlMaps.get(introspectedTable).add(
this.replaceExampleXmlElement(introspectedTable, element, METHOD_DELETE_WITH_VERSION_BY_EXAMPLE)
);
}
return super.sqlMapDeleteByExampleElementGenerated(element, introspectedTable);
} }
|
public class class_name {
@Override
public boolean sqlMapDeleteByExampleElementGenerated(XmlElement element, IntrospectedTable introspectedTable) {
if (this.versionColumn != null) {
this.sqlMaps.get(introspectedTable).add(
this.replaceExampleXmlElement(introspectedTable, element, METHOD_DELETE_WITH_VERSION_BY_EXAMPLE)
); // depends on control dependency: [if], data = [none]
}
return super.sqlMapDeleteByExampleElementGenerated(element, introspectedTable);
} }
|
public class class_name {
@Override
public void destroy() throws ResourceException {
final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.entry(this, tc, "destroy");
}
if (state != STATE_ACTIVE_FREE) { // && state != STATE_ACTIVE_INUSE) {
//IllegalStateException e = new IllegalStateException("destroy: illegal state exception. State = " + getStateString() + " MCW = " + mcWrapperObject_hexString);
//- add pmiName to message
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName;
}
Tr.warning(tc, "ATTEMPT_TO_DESTORY_CONNECTION_IN_USE_J2CA0088", STATESTRINGS[state], pmiName);
//throw e;
}
try {
if (mc != null) {
mc.removeConnectionEventListener(eventListener);
} else if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "mc is null, mc.removeConnectionEventListener() not called.");
}
} catch (Exception e) {
// Eat this exception since we are destroying the connection anyway.
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "782", this);
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName;
}
if (!stale && !do_not_reuse_mcw) {
Object[] parms = new Object[] { "destroy",
"removeConnectionEventListener", mc, e, pmiName };
Tr.error(tc, "MCERROR_J2CA0081", parms);
} else {
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "got a SCE when doing removeConnectionEventListener on the mc, { mc, e, pmiName}; is:", new Object[] { mc, e, pmiName });
}
}
}
try {
if (mc != null) {
mc.destroy();
} else if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "mc is null, mc.destroy() not called.");
}
} catch (ResourceException e) {
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "791", this);
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName;
}
if (!stale && !do_not_reuse_mcw) {
Object[] parms = new Object[] { "destroy", "destroy", mc, e, pmiName };
Tr.error(tc, "MCERROR_J2CA0081", parms);
} else {
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "got a SCE when doing destroy on the mc, { mc, e, pmiName}; is:", new Object[] { mc, e, pmiName });
}
}
throw e;
} catch (Exception e) {
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "797", this);
ResourceException re = null;
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName;
}
if (!stale && !do_not_reuse_mcw) {
Object[] parms = new Object[] { "destroy", "destroy", mc, e, pmiName };
Tr.error(tc, "MCERROR_J2CA0081", parms);
} else {
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "got a SCE when doing destroy on the mc, { mc, e, pmiName}; is:", new Object[] { mc, e, pmiName });
}
}
re = new ResourceException("destroy: Exception caught");
re.initCause(e);
throw re;
} finally {
// The following call is added for the case when destroy is called without cleanup.
for (int i = mcConnectionCount; i > 0; i--) {
decrementHandleCount();
}
mc = null;
try {
if (xaTranWrapper != null && !isMCAborted()) {
xaTranWrapper.releaseResources();
}
if (localTranWrapper != null && !isMCAborted()) {
localTranWrapper.releaseResources();
}
if (noTranWrapper != null) {
noTranWrapper.releaseResources();
}
if (rrsGlobalTranWrapper != null) {
rrsGlobalTranWrapper.releaseResources();
}
if (rrsLocalTranWrapper != null) {
rrsLocalTranWrapper.releaseResources();
}
} catch (Exception e) {
switch (tranWrapperInUse) {
case XATXWRAPPER:
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "814", this);
if (isTracingEnabled && tc.isDebugEnabled()) {
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName;
}
Tr.debug(this, tc, "destroy: xaTranWrapper.releaseResources() call for resource pool " + pmiName + " failed with exception", e);
}
break;
case LOCALTXWRAPPER:
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "823", this);
if (isTracingEnabled && tc.isDebugEnabled()) {
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName;
}
Tr.debug(this, tc, "destroy: localTranWrapper.releaseResources() call for resource pool " + pmiName + " failed with exception", e);
}
break;
case NOTXWRAPPER:
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "832", this);
if (isTracingEnabled && tc.isDebugEnabled()) {
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName;
}
Tr.debug(this, tc, "destroy: noTranWrapper.releaseResources() call for resource pool " + pmiName + " failed with exception", e);
}
break;
case RRSGLOBALTXWRAPPER:
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "825", this);
if (isTracingEnabled && tc.isDebugEnabled()) {
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName;
}
Tr.debug(this, tc, "destroy: rrsGlobalTranWrapper.releaseResources() call for resource pool " + pmiName + " failed with exception", e);
}
break;
case RRSLOCALTXWRAPPER:
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "827", this);
if (isTracingEnabled && tc.isDebugEnabled()) {
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName;
}
Tr.debug(this, tc, "destroy: rrsLocalTranWrapper.releaseResources() call for resource pool " + pmiName + " failed with exception", e);
}
break;
default:
break;
}
}
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Resetting stale, tranFailed, and _transactionErrorOccurred flags");
}
stale = false;
_transactionErrorOccurred = false;
state = STATE_INACTIVE;
destroyState = false;
purgeState = false;
}
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.exit(this, tc, "destroy");
}
} }
|
public class class_name {
@Override
public void destroy() throws ResourceException {
final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.entry(this, tc, "destroy");
}
if (state != STATE_ACTIVE_FREE) { // && state != STATE_ACTIVE_INUSE) {
//IllegalStateException e = new IllegalStateException("destroy: illegal state exception. State = " + getStateString() + " MCW = " + mcWrapperObject_hexString);
//- add pmiName to message
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName; // depends on control dependency: [if], data = [none]
}
Tr.warning(tc, "ATTEMPT_TO_DESTORY_CONNECTION_IN_USE_J2CA0088", STATESTRINGS[state], pmiName);
//throw e;
}
try {
if (mc != null) {
mc.removeConnectionEventListener(eventListener); // depends on control dependency: [if], data = [none]
} else if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "mc is null, mc.removeConnectionEventListener() not called."); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
// Eat this exception since we are destroying the connection anyway.
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "782", this);
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName; // depends on control dependency: [if], data = [none]
}
if (!stale && !do_not_reuse_mcw) {
Object[] parms = new Object[] { "destroy",
"removeConnectionEventListener", mc, e, pmiName };
Tr.error(tc, "MCERROR_J2CA0081", parms); // depends on control dependency: [if], data = [none]
} else {
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "got a SCE when doing removeConnectionEventListener on the mc, { mc, e, pmiName}; is:", new Object[] { mc, e, pmiName }); // depends on control dependency: [if], data = [none]
}
}
}
try {
if (mc != null) {
mc.destroy(); // depends on control dependency: [if], data = [none]
} else if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "mc is null, mc.destroy() not called."); // depends on control dependency: [if], data = [none]
}
} catch (ResourceException e) {
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "791", this);
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName; // depends on control dependency: [if], data = [none]
}
if (!stale && !do_not_reuse_mcw) {
Object[] parms = new Object[] { "destroy", "destroy", mc, e, pmiName };
Tr.error(tc, "MCERROR_J2CA0081", parms); // depends on control dependency: [if], data = [none]
} else {
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "got a SCE when doing destroy on the mc, { mc, e, pmiName}; is:", new Object[] { mc, e, pmiName }); // depends on control dependency: [if], data = [none]
}
}
throw e;
} catch (Exception e) {
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "797", this);
ResourceException re = null;
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName; // depends on control dependency: [if], data = [none]
}
if (!stale && !do_not_reuse_mcw) {
Object[] parms = new Object[] { "destroy", "destroy", mc, e, pmiName };
Tr.error(tc, "MCERROR_J2CA0081", parms); // depends on control dependency: [if], data = [none]
} else {
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "got a SCE when doing destroy on the mc, { mc, e, pmiName}; is:", new Object[] { mc, e, pmiName }); // depends on control dependency: [if], data = [none]
}
}
re = new ResourceException("destroy: Exception caught");
re.initCause(e);
throw re;
} finally {
// The following call is added for the case when destroy is called without cleanup.
for (int i = mcConnectionCount; i > 0; i--) {
decrementHandleCount(); // depends on control dependency: [for], data = [none]
}
mc = null;
try {
if (xaTranWrapper != null && !isMCAborted()) {
xaTranWrapper.releaseResources(); // depends on control dependency: [if], data = [none]
}
if (localTranWrapper != null && !isMCAborted()) {
localTranWrapper.releaseResources(); // depends on control dependency: [if], data = [none]
}
if (noTranWrapper != null) {
noTranWrapper.releaseResources(); // depends on control dependency: [if], data = [none]
}
if (rrsGlobalTranWrapper != null) {
rrsGlobalTranWrapper.releaseResources(); // depends on control dependency: [if], data = [none]
}
if (rrsLocalTranWrapper != null) {
rrsLocalTranWrapper.releaseResources(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
switch (tranWrapperInUse) {
case XATXWRAPPER:
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "814", this);
if (isTracingEnabled && tc.isDebugEnabled()) {
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName; // depends on control dependency: [if], data = [none]
}
Tr.debug(this, tc, "destroy: xaTranWrapper.releaseResources() call for resource pool " + pmiName + " failed with exception", e); // depends on control dependency: [if], data = [none]
}
break;
case LOCALTXWRAPPER:
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "823", this);
if (isTracingEnabled && tc.isDebugEnabled()) {
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName; // depends on control dependency: [if], data = [none]
}
Tr.debug(this, tc, "destroy: localTranWrapper.releaseResources() call for resource pool " + pmiName + " failed with exception", e); // depends on control dependency: [if], data = [none]
}
break;
case NOTXWRAPPER:
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "832", this);
if (isTracingEnabled && tc.isDebugEnabled()) {
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName; // depends on control dependency: [if], data = [none]
}
Tr.debug(this, tc, "destroy: noTranWrapper.releaseResources() call for resource pool " + pmiName + " failed with exception", e); // depends on control dependency: [if], data = [none]
}
break;
case RRSGLOBALTXWRAPPER:
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "825", this);
if (isTracingEnabled && tc.isDebugEnabled()) {
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName; // depends on control dependency: [if], data = [none]
}
Tr.debug(this, tc, "destroy: rrsGlobalTranWrapper.releaseResources() call for resource pool " + pmiName + " failed with exception", e); // depends on control dependency: [if], data = [none]
}
break;
case RRSLOCALTXWRAPPER:
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.destroy", "827", this);
if (isTracingEnabled && tc.isDebugEnabled()) {
String pmiName = "No longer available";
if (cm != null) {
pmiName = gConfigProps.cfName; // depends on control dependency: [if], data = [none]
}
Tr.debug(this, tc, "destroy: rrsLocalTranWrapper.releaseResources() call for resource pool " + pmiName + " failed with exception", e); // depends on control dependency: [if], data = [none]
}
break;
default:
break;
}
} // depends on control dependency: [catch], data = [none]
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Resetting stale, tranFailed, and _transactionErrorOccurred flags"); // depends on control dependency: [if], data = [none]
}
stale = false;
_transactionErrorOccurred = false;
state = STATE_INACTIVE;
destroyState = false;
purgeState = false;
}
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.exit(this, tc, "destroy");
}
} }
|
public class class_name {
@Override
public boolean nextPacket(Packet packet) {
try {
if (packet.hasProtocol(Protocol.IPv4)) {
final IPPacket ip = (IPPacket) packet.getPacket(Protocol.IPv4);
if (ip.isFragmented()) {
packet = handleFragmentation(ip);
if (packet == null) {
return true;
}
}
}
if (this.sipStreamHandler != null && packet.hasProtocol(Protocol.SIP)) {
this.sipStreamHandler.processFrame(packet);
} else if (this.rtpStreamHandler != null && packet.hasProtocol(Protocol.RTP)) {
this.rtpStreamHandler.processFrame(packet);
}
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final PacketParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
} }
|
public class class_name {
@Override
public boolean nextPacket(Packet packet) {
try {
if (packet.hasProtocol(Protocol.IPv4)) {
final IPPacket ip = (IPPacket) packet.getPacket(Protocol.IPv4);
if (ip.isFragmented()) {
packet = handleFragmentation(ip); // depends on control dependency: [if], data = [none]
if (packet == null) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
if (this.sipStreamHandler != null && packet.hasProtocol(Protocol.SIP)) {
this.sipStreamHandler.processFrame(packet); // depends on control dependency: [if], data = [none]
} else if (this.rtpStreamHandler != null && packet.hasProtocol(Protocol.RTP)) {
this.rtpStreamHandler.processFrame(packet); // depends on control dependency: [if], data = [none]
}
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final PacketParseException e) { // depends on control dependency: [catch], data = [none]
// TODO Auto-generated catch block
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return true;
} }
|
public class class_name {
protected void loadContentConversionPropertyValues(
final Map<String, String> data,
final ExecutionContext context,
final List<Property> pluginProperties
) throws ConfigurationException
{
//look for "valueConversion" properties
for (Property property : pluginProperties) {
String name = property.getName();
String propValue = data.get(name);
if (null == propValue) {
continue;
}
Map<String, Object> renderingOptions = property.getRenderingOptions();
if (renderingOptions != null) {
Object conversion = renderingOptions.get(StringRenderingConstants.VALUE_CONVERSION_KEY);
if (StringRenderingConstants.ValueConversion.STORAGE_PATH_AUTOMATIC_READ.equalsOrString(conversion)) {
convertStoragePathValue(data, context.getStorageTree(), name, propValue, renderingOptions);
} else if (StringRenderingConstants.ValueConversion.PRIVATE_DATA_CONTEXT.equalsOrString(conversion)) {
convertPrivateDataValue(data, context.getPrivateDataContextObject(), name, propValue, renderingOptions);
}
}
}
} }
|
public class class_name {
protected void loadContentConversionPropertyValues(
final Map<String, String> data,
final ExecutionContext context,
final List<Property> pluginProperties
) throws ConfigurationException
{
//look for "valueConversion" properties
for (Property property : pluginProperties) {
String name = property.getName();
String propValue = data.get(name);
if (null == propValue) {
continue;
}
Map<String, Object> renderingOptions = property.getRenderingOptions();
if (renderingOptions != null) {
Object conversion = renderingOptions.get(StringRenderingConstants.VALUE_CONVERSION_KEY);
if (StringRenderingConstants.ValueConversion.STORAGE_PATH_AUTOMATIC_READ.equalsOrString(conversion)) {
convertStoragePathValue(data, context.getStorageTree(), name, propValue, renderingOptions); // depends on control dependency: [if], data = [none]
} else if (StringRenderingConstants.ValueConversion.PRIVATE_DATA_CONTEXT.equalsOrString(conversion)) {
convertPrivateDataValue(data, context.getPrivateDataContextObject(), name, propValue, renderingOptions); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public void setValues(CharSequence[] values) {
if (this.values != values) {
this.values = values;
if (this.values != null) {
layouts = new BoringLayout[this.values.length];
for (int i = 0; i < layouts.length; i++) {
layouts[i] = new BoringLayout(this.values[i], textPaint, itemWidth, Layout.Alignment.ALIGN_CENTER,
1f, 1f, boringMetrics, false, ellipsize, itemWidth);
}
} else {
layouts = new BoringLayout[0];
}
// start marque only if has already been measured
if (getWidth() > 0) {
startMarqueeIfNeeded();
}
requestLayout();
invalidate();
}
} }
|
public class class_name {
public void setValues(CharSequence[] values) {
if (this.values != values) {
this.values = values; // depends on control dependency: [if], data = [none]
if (this.values != null) {
layouts = new BoringLayout[this.values.length]; // depends on control dependency: [if], data = [none]
for (int i = 0; i < layouts.length; i++) {
layouts[i] = new BoringLayout(this.values[i], textPaint, itemWidth, Layout.Alignment.ALIGN_CENTER,
1f, 1f, boringMetrics, false, ellipsize, itemWidth); // depends on control dependency: [for], data = [i]
}
} else {
layouts = new BoringLayout[0]; // depends on control dependency: [if], data = [none]
}
// start marque only if has already been measured
if (getWidth() > 0) {
startMarqueeIfNeeded(); // depends on control dependency: [if], data = [none]
}
requestLayout(); // depends on control dependency: [if], data = [none]
invalidate(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String getMacAddress() {
try {
List<String> macAddress = new ArrayList<String>();
Enumeration<NetworkInterface> enumNetWorkInterface = NetworkInterface.getNetworkInterfaces();
while (enumNetWorkInterface.hasMoreElements()) {
NetworkInterface netWorkInterface = enumNetWorkInterface.nextElement();
byte[] hardwareAddress = netWorkInterface.getHardwareAddress();
if (hardwareAddress != null && netWorkInterface.isUp() && !netWorkInterface.isVirtual()) {
String displayName = netWorkInterface.getDisplayName().toLowerCase();
if (!displayName.contains("virtual") && !displayName.contains("tunnel")) {
String strMac = "";
for (int i = 0; i < hardwareAddress.length; i++) {
strMac += String.format("%02X%s", hardwareAddress[i], (i < hardwareAddress.length - 1) ? "-" : "");
}
if (strMac.trim().length() > 0) {
macAddress.add(strMac);
}
}
}
}
return macAddress.toString().replace(",", ";").replace("[", "").replace("]", "");
} catch (Exception e) {
throw new JKException(e);
}
} }
|
public class class_name {
public static String getMacAddress() {
try {
List<String> macAddress = new ArrayList<String>();
Enumeration<NetworkInterface> enumNetWorkInterface = NetworkInterface.getNetworkInterfaces();
while (enumNetWorkInterface.hasMoreElements()) {
NetworkInterface netWorkInterface = enumNetWorkInterface.nextElement();
byte[] hardwareAddress = netWorkInterface.getHardwareAddress();
if (hardwareAddress != null && netWorkInterface.isUp() && !netWorkInterface.isVirtual()) {
String displayName = netWorkInterface.getDisplayName().toLowerCase();
if (!displayName.contains("virtual") && !displayName.contains("tunnel")) {
String strMac = "";
for (int i = 0; i < hardwareAddress.length; i++) {
strMac += String.format("%02X%s", hardwareAddress[i], (i < hardwareAddress.length - 1) ? "-" : ""); // depends on control dependency: [for], data = [i]
}
if (strMac.trim().length() > 0) {
macAddress.add(strMac); // depends on control dependency: [if], data = [none]
}
}
}
}
return macAddress.toString().replace(",", ";").replace("[", "").replace("]", ""); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new JKException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Object jsonCompatible(boolean includePoints, boolean includeGeometries) {
Object jsonObject = null;
if (rows == null || rows.isEmpty()) {
jsonObject = count;
} else {
List<Object> jsonRows = new ArrayList<>();
for (FeatureRowData row : rows) {
jsonRows.add(row.jsonCompatible(includePoints, includeGeometries));
}
jsonObject = jsonRows;
}
return jsonObject;
} }
|
public class class_name {
public Object jsonCompatible(boolean includePoints, boolean includeGeometries) {
Object jsonObject = null;
if (rows == null || rows.isEmpty()) {
jsonObject = count; // depends on control dependency: [if], data = [none]
} else {
List<Object> jsonRows = new ArrayList<>();
for (FeatureRowData row : rows) {
jsonRows.add(row.jsonCompatible(includePoints, includeGeometries)); // depends on control dependency: [for], data = [row]
}
jsonObject = jsonRows; // depends on control dependency: [if], data = [none]
}
return jsonObject;
} }
|
public class class_name {
public static Asset getAsset(AssetVersionSpec spec) {
Asset match = null, assetVO = null;
try {
// Get asset from package based on asset version spec
if (spec.getPackageName() != null) {
// get all the versions of packages based on package name
List<Package> allPackgeVOs = PackageCache.getAllPackages(spec.getPackageName());
for (Package pkgVO : allPackgeVOs) {
for (Asset asset : pkgVO.getAssets()) {
if (spec.getName().equals(asset.getName())) {
if (asset.meetsVersionSpec(spec.getVersion()) && (match == null || asset.getVersion() > match.getVersion()))
match = asset;
}
}
}
if (match != null) {
if (!match.isLoaded())
assetVO = DataAccess.getProcessLoader().getAsset(match.getId());
else
assetVO = match;
}
else if (!spec.getVersion().equals("0")) { // check ASSET_REF DB table to retrieve from git history
AssetRef ref = AssetRefCache.getAssetRef(spec);
if (ref != null)
assetVO = AssetRefConverter.getAsset(ref);
}
return assetVO;
}
for (Asset asset : getAllAssets()) {
if (spec.getName().equals(asset.getName())) {
if (asset.meetsVersionSpec(spec.getVersion()) && (match == null || asset.getVersion() > match.getVersion()))
match = asset;
}
}
if (match != null && !match.isLoaded()) {
assetVO = DataAccess.getProcessLoader().getAsset(match.getId());
}
// If match == null, check ASSET_REF DB table to retrieve from git history
if (match == null && !spec.getVersion().equals("0")) {
AssetRef ref = AssetRefCache.getAssetRef(spec);
if (ref != null)
assetVO = AssetRefConverter.getAsset(ref);
}
} catch (Exception ex) {
logger.severeException("Failed to load asset: "+spec.toString()+ " : "+ex.getMessage(), ex);
}
return assetVO;
} }
|
public class class_name {
public static Asset getAsset(AssetVersionSpec spec) {
Asset match = null, assetVO = null;
try {
// Get asset from package based on asset version spec
if (spec.getPackageName() != null) {
// get all the versions of packages based on package name
List<Package> allPackgeVOs = PackageCache.getAllPackages(spec.getPackageName());
for (Package pkgVO : allPackgeVOs) {
for (Asset asset : pkgVO.getAssets()) {
if (spec.getName().equals(asset.getName())) {
if (asset.meetsVersionSpec(spec.getVersion()) && (match == null || asset.getVersion() > match.getVersion()))
match = asset;
}
}
}
if (match != null) {
if (!match.isLoaded())
assetVO = DataAccess.getProcessLoader().getAsset(match.getId());
else
assetVO = match;
}
else if (!spec.getVersion().equals("0")) { // check ASSET_REF DB table to retrieve from git history
AssetRef ref = AssetRefCache.getAssetRef(spec);
if (ref != null)
assetVO = AssetRefConverter.getAsset(ref);
}
return assetVO; // depends on control dependency: [if], data = [none]
}
for (Asset asset : getAllAssets()) {
if (spec.getName().equals(asset.getName())) {
if (asset.meetsVersionSpec(spec.getVersion()) && (match == null || asset.getVersion() > match.getVersion()))
match = asset;
}
}
if (match != null && !match.isLoaded()) {
assetVO = DataAccess.getProcessLoader().getAsset(match.getId()); // depends on control dependency: [if], data = [(match]
}
// If match == null, check ASSET_REF DB table to retrieve from git history
if (match == null && !spec.getVersion().equals("0")) {
AssetRef ref = AssetRefCache.getAssetRef(spec);
if (ref != null)
assetVO = AssetRefConverter.getAsset(ref);
}
} catch (Exception ex) {
logger.severeException("Failed to load asset: "+spec.toString()+ " : "+ex.getMessage(), ex);
} // depends on control dependency: [catch], data = [none]
return assetVO;
} }
|
public class class_name {
public void marshall(StageKey stageKey, ProtocolMarshaller protocolMarshaller) {
if (stageKey == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stageKey.getRestApiId(), RESTAPIID_BINDING);
protocolMarshaller.marshall(stageKey.getStageName(), STAGENAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StageKey stageKey, ProtocolMarshaller protocolMarshaller) {
if (stageKey == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stageKey.getRestApiId(), RESTAPIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stageKey.getStageName(), STAGENAME_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 Exception generateException(int rc, String text,
Exception linkedException, boolean throwIt)
throws SIResourceException, SIConnectionLostException,
SILimitExceededException, SIErrorException, SINotAuthorizedException,
SINotPossibleInCurrentConfigurationException,
SIIncorrectCallException, SIAuthenticationException {
Exception theException;
if (rc == TrmConstantsImpl.RETURN_CODE_SIResourceException) {
SIResourceException sire = new SIResourceException(text);
if (null != linkedException) {
sire.initCause(linkedException);
}
if (throwIt) {
throw sire;
} else {
theException = sire;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SIConnectionLostException) {
SIConnectionLostException sicle = new SIConnectionLostException(text);
if (null != linkedException) {
sicle.initCause(linkedException);
}
if (throwIt) {
throw sicle;
} else {
theException = sicle;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SILimitExceededException) {
SILimitExceededException silee = new SILimitExceededException(text);
if (null != linkedException) {
}
if (throwIt) {
throw silee;
} else {
theException = silee;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SIErrorException) {
SIErrorException siee = new SIErrorException(text);
if (null != linkedException) {
siee.initCause(linkedException);
}
if (throwIt) {
throw siee;
} else {
theException = siee;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SINotAuthorizedException) {
SINotAuthorizedException sinae = new SINotAuthorizedException(text);
if (null != linkedException) {
// This is not permitted!
}
if (throwIt) {
throw sinae;
} else {
theException = sinae;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SINotPossibleInCurrentConfigurationException) {
SINotPossibleInCurrentConfigurationException sinpicce = new SINotPossibleInCurrentConfigurationException(
text);
if (null != linkedException) {
sinpicce.initCause(linkedException);
}
if (throwIt) {
throw sinpicce;
} else {
theException = sinpicce;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SIIncorrectCallException) {
SIIncorrectCallException siice = new SIIncorrectCallException(text);
if (null != linkedException) {
siice.initCause(linkedException);
}
if (throwIt) {
throw siice;
} else {
theException = siice;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SIAuthenticationException) {
SIAuthenticationException siae = new SIAuthenticationException(text);
if (null != linkedException) {
// This is not permitted!
}
if (throwIt) {
throw siae;
} else {
theException = siae;
}
} else {
SIErrorException siee = new SIErrorException(text);
if (null != linkedException) {
siee.initCause(linkedException);
}
if (throwIt) {
throw siee;
} else {
theException = siee;
}
}
return theException;
} }
|
public class class_name {
private Exception generateException(int rc, String text,
Exception linkedException, boolean throwIt)
throws SIResourceException, SIConnectionLostException,
SILimitExceededException, SIErrorException, SINotAuthorizedException,
SINotPossibleInCurrentConfigurationException,
SIIncorrectCallException, SIAuthenticationException {
Exception theException;
if (rc == TrmConstantsImpl.RETURN_CODE_SIResourceException) {
SIResourceException sire = new SIResourceException(text);
if (null != linkedException) {
sire.initCause(linkedException); // depends on control dependency: [if], data = [linkedException)]
}
if (throwIt) {
throw sire;
} else {
theException = sire; // depends on control dependency: [if], data = [none]
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SIConnectionLostException) {
SIConnectionLostException sicle = new SIConnectionLostException(text);
if (null != linkedException) {
sicle.initCause(linkedException);
}
if (throwIt) {
throw sicle;
} else {
theException = sicle;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SILimitExceededException) {
SILimitExceededException silee = new SILimitExceededException(text);
if (null != linkedException) {
}
if (throwIt) {
throw silee;
} else {
theException = silee;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SIErrorException) {
SIErrorException siee = new SIErrorException(text);
if (null != linkedException) {
siee.initCause(linkedException);
}
if (throwIt) {
throw siee;
} else {
theException = siee;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SINotAuthorizedException) {
SINotAuthorizedException sinae = new SINotAuthorizedException(text);
if (null != linkedException) {
// This is not permitted!
}
if (throwIt) {
throw sinae;
} else {
theException = sinae;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SINotPossibleInCurrentConfigurationException) {
SINotPossibleInCurrentConfigurationException sinpicce = new SINotPossibleInCurrentConfigurationException(
text);
if (null != linkedException) {
sinpicce.initCause(linkedException);
}
if (throwIt) {
throw sinpicce;
} else {
theException = sinpicce;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SIIncorrectCallException) {
SIIncorrectCallException siice = new SIIncorrectCallException(text);
if (null != linkedException) {
siice.initCause(linkedException);
}
if (throwIt) {
throw siice;
} else {
theException = siice;
}
} else if (rc == TrmConstantsImpl.RETURN_CODE_SIAuthenticationException) {
SIAuthenticationException siae = new SIAuthenticationException(text);
if (null != linkedException) {
// This is not permitted!
}
if (throwIt) {
throw siae;
} else {
theException = siae;
}
} else {
SIErrorException siee = new SIErrorException(text);
if (null != linkedException) {
siee.initCause(linkedException);
}
if (throwIt) {
throw siee;
} else {
theException = siee;
}
}
return theException;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.