code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public void clearUnused() {
Log log = getLog();
try {
// create cleaner engine for session/client scope
if (session == null) session = new StorageScopeEngine(factory, log, new StorageScopeCleaner[] { new FileStorageScopeCleaner(Scope.SCOPE_SESSION, null)// new
// SessionEndListener())
, new DatasourceStorageScopeCleaner(Scope.SCOPE_SESSION, null)// new
// SessionEndListener())
// ,new CacheStorageScopeCleaner(Scope.SCOPE_SESSION, new SessionEndListener())
});
if (client == null) client = new StorageScopeEngine(factory, log,
new StorageScopeCleaner[] { new FileStorageScopeCleaner(Scope.SCOPE_CLIENT, null), new DatasourceStorageScopeCleaner(Scope.SCOPE_CLIENT, null)
// ,new CacheStorageScopeCleaner(Scope.SCOPE_CLIENT, null) //Cache storage need no control, if
// there is no listener
});
// store session/client scope and remove from memory
storeUnusedStorageScope(factory, Scope.SCOPE_CLIENT);
storeUnusedStorageScope(factory, Scope.SCOPE_SESSION);
// remove unused memory based client/session scope (invoke onSessonEnd)
clearUnusedMemoryScope(factory, Scope.SCOPE_CLIENT);
clearUnusedMemoryScope(factory, Scope.SCOPE_SESSION);
// session must be executed first, because session creates a reference from client scope
session.clean();
client.clean();
// clean all unused application scopes
clearUnusedApplications(factory);
}
catch (Exception t) {
error(t);
}
} }
|
public class class_name {
public void clearUnused() {
Log log = getLog();
try {
// create cleaner engine for session/client scope
if (session == null) session = new StorageScopeEngine(factory, log, new StorageScopeCleaner[] { new FileStorageScopeCleaner(Scope.SCOPE_SESSION, null)// new
// SessionEndListener())
, new DatasourceStorageScopeCleaner(Scope.SCOPE_SESSION, null)// new
// SessionEndListener())
// ,new CacheStorageScopeCleaner(Scope.SCOPE_SESSION, new SessionEndListener())
});
if (client == null) client = new StorageScopeEngine(factory, log,
new StorageScopeCleaner[] { new FileStorageScopeCleaner(Scope.SCOPE_CLIENT, null), new DatasourceStorageScopeCleaner(Scope.SCOPE_CLIENT, null)
// ,new CacheStorageScopeCleaner(Scope.SCOPE_CLIENT, null) //Cache storage need no control, if
// there is no listener
});
// store session/client scope and remove from memory
storeUnusedStorageScope(factory, Scope.SCOPE_CLIENT); // depends on control dependency: [try], data = [none]
storeUnusedStorageScope(factory, Scope.SCOPE_SESSION); // depends on control dependency: [try], data = [none]
// remove unused memory based client/session scope (invoke onSessonEnd)
clearUnusedMemoryScope(factory, Scope.SCOPE_CLIENT); // depends on control dependency: [try], data = [none]
clearUnusedMemoryScope(factory, Scope.SCOPE_SESSION); // depends on control dependency: [try], data = [none]
// session must be executed first, because session creates a reference from client scope
session.clean(); // depends on control dependency: [try], data = [none]
client.clean(); // depends on control dependency: [try], data = [none]
// clean all unused application scopes
clearUnusedApplications(factory); // depends on control dependency: [try], data = [none]
}
catch (Exception t) {
error(t);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static NumericalValue intersect (final NumericalValue a, final NumericalValue b) {
// early exit
if (a == null || b == null) return null;
// get ranges of a and b
int aMin, aMax, bMin, bMax;
if (a instanceof SingleNumericalValue) {
final SingleNumericalValue v = (SingleNumericalValue) a;
aMin = v.getValue();
aMax = aMin;
} else {
final NumericalValueRange r = (NumericalValueRange) a;
aMin = r.getMin();
aMax = r.getMax();
}
if (b instanceof SingleNumericalValue) {
final SingleNumericalValue v = (SingleNumericalValue) b;
bMin = v.getValue();
bMax = bMin;
} else {
final NumericalValueRange r = (NumericalValueRange) b;
bMin = r.getMin();
bMax = r.getMax();
}
// intersect ranges
final int min = Math.max(aMin, bMin);
final int max = Math.min(aMax, bMax);
if (min == max)
return SingleNumericalValue.create(min);
else
return NumericalValueRange.create(min, max);
} }
|
public class class_name {
public static NumericalValue intersect (final NumericalValue a, final NumericalValue b) {
// early exit
if (a == null || b == null) return null;
// get ranges of a and b
int aMin, aMax, bMin, bMax;
if (a instanceof SingleNumericalValue) {
final SingleNumericalValue v = (SingleNumericalValue) a;
aMin = v.getValue();
// depends on control dependency: [if], data = [none]
aMax = aMin;
// depends on control dependency: [if], data = [none]
} else {
final NumericalValueRange r = (NumericalValueRange) a;
aMin = r.getMin();
// depends on control dependency: [if], data = [none]
aMax = r.getMax();
// depends on control dependency: [if], data = [none]
}
if (b instanceof SingleNumericalValue) {
final SingleNumericalValue v = (SingleNumericalValue) b;
bMin = v.getValue();
// depends on control dependency: [if], data = [none]
bMax = bMin;
// depends on control dependency: [if], data = [none]
} else {
final NumericalValueRange r = (NumericalValueRange) b;
bMin = r.getMin();
// depends on control dependency: [if], data = [none]
bMax = r.getMax();
// depends on control dependency: [if], data = [none]
}
// intersect ranges
final int min = Math.max(aMin, bMin);
final int max = Math.min(aMax, bMax);
if (min == max)
return SingleNumericalValue.create(min);
else
return NumericalValueRange.create(min, max);
} }
|
public class class_name {
@Override
public TaskStatus getTaskStatus(final JobId jobId) {
final byte[] data = taskStatuses.get(jobId.toString());
if (data == null) {
return null;
}
try {
return parse(data, TaskStatus.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
@Override
public TaskStatus getTaskStatus(final JobId jobId) {
final byte[] data = taskStatuses.get(jobId.toString());
if (data == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
return parse(data, TaskStatus.class); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void onBusStopChanged(BusStop stop) {
if (stop.getContainer() == this) {
final boolean oldValidity = !ListUtil.contains(this.invalidBusStops, INVALID_STOP_COMPARATOR, stop);
final boolean currentValidity = stop.isValidPrimitive();
if (oldValidity != currentValidity) {
if (currentValidity) {
ListUtil.remove(this.invalidBusStops, INVALID_STOP_COMPARATOR, stop);
this.validBusStops.add(stop);
} else {
this.validBusStops.remove(stop);
ListUtil.addIfAbsent(this.invalidBusStops, INVALID_STOP_COMPARATOR, stop);
}
}
}
} }
|
public class class_name {
private void onBusStopChanged(BusStop stop) {
if (stop.getContainer() == this) {
final boolean oldValidity = !ListUtil.contains(this.invalidBusStops, INVALID_STOP_COMPARATOR, stop);
final boolean currentValidity = stop.isValidPrimitive();
if (oldValidity != currentValidity) {
if (currentValidity) {
ListUtil.remove(this.invalidBusStops, INVALID_STOP_COMPARATOR, stop); // depends on control dependency: [if], data = [none]
this.validBusStops.add(stop); // depends on control dependency: [if], data = [none]
} else {
this.validBusStops.remove(stop); // depends on control dependency: [if], data = [none]
ListUtil.addIfAbsent(this.invalidBusStops, INVALID_STOP_COMPARATOR, stop); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
private Object mergeReferenceAttributes(String attributeName, EvaluationContext context, ExtendedAttributeDefinition attributeDef, ConfigElement config, Object rawValues) {
Object rawValue;
String[] referenceAttributes = getReferenceAttributes(attributeName);
context.addProcessed(referenceAttributes[0]);
context.addProcessed(referenceAttributes[1]);
// get value for the nested element
rawValue = config.getAttribute(referenceAttributes[1]);
if (rawValue == null) {
// if no nested element, then lookup the attribute
rawValue = config.getAttribute(referenceAttributes[0]);
} else if (attributeDef.getCardinality() != 0) {
// we have nested element and attribute allows multiple
// we must merge if attribute is non null
Object refRawValue = config.getAttribute(referenceAttributes[0]);
if (refRawValue != null) {
rawValue = mergeReferenceValues(attributeDef, refRawValue, rawValue);
}
} else {
// nested value wins if cardinality == 0
}
if (rawValues == null) {
return rawValue;
}
if (rawValue == null || attributeDef.getCardinality() == 0) {
return rawValues;
}
return mergeReferenceValues(attributeDef, rawValues, rawValue);
} }
|
public class class_name {
private Object mergeReferenceAttributes(String attributeName, EvaluationContext context, ExtendedAttributeDefinition attributeDef, ConfigElement config, Object rawValues) {
Object rawValue;
String[] referenceAttributes = getReferenceAttributes(attributeName);
context.addProcessed(referenceAttributes[0]);
context.addProcessed(referenceAttributes[1]);
// get value for the nested element
rawValue = config.getAttribute(referenceAttributes[1]);
if (rawValue == null) {
// if no nested element, then lookup the attribute
rawValue = config.getAttribute(referenceAttributes[0]); // depends on control dependency: [if], data = [none]
} else if (attributeDef.getCardinality() != 0) {
// we have nested element and attribute allows multiple
// we must merge if attribute is non null
Object refRawValue = config.getAttribute(referenceAttributes[0]);
if (refRawValue != null) {
rawValue = mergeReferenceValues(attributeDef, refRawValue, rawValue); // depends on control dependency: [if], data = [none]
}
} else {
// nested value wins if cardinality == 0
}
if (rawValues == null) {
return rawValue; // depends on control dependency: [if], data = [none]
}
if (rawValue == null || attributeDef.getCardinality() == 0) {
return rawValues; // depends on control dependency: [if], data = [none]
}
return mergeReferenceValues(attributeDef, rawValues, rawValue);
} }
|
public class class_name {
protected VelocityEngine createTemplateEngine(Properties properties) {
Properties actualProperties = properties;
if (actualProperties == null) {
actualProperties = new Properties();
}
String resourceLoader = actualProperties.getProperty(VelocityEngine.RESOURCE_LOADER);
if (StringUtils.isBlank(resourceLoader)) {
actualProperties.setProperty(VelocityEngine.RESOURCE_LOADER, "classpath");
actualProperties.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
}
String loggerClass = actualProperties.getProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS);
if (StringUtils.isBlank(loggerClass)) {
actualProperties.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS,
"org.apache.velocity.runtime.log.NullLogChute");
}
VelocityEngine velocity = new VelocityEngine(actualProperties);
velocity.init();
return velocity;
} }
|
public class class_name {
protected VelocityEngine createTemplateEngine(Properties properties) {
Properties actualProperties = properties;
if (actualProperties == null) {
actualProperties = new Properties();
// depends on control dependency: [if], data = [none]
}
String resourceLoader = actualProperties.getProperty(VelocityEngine.RESOURCE_LOADER);
if (StringUtils.isBlank(resourceLoader)) {
actualProperties.setProperty(VelocityEngine.RESOURCE_LOADER, "classpath");
// depends on control dependency: [if], data = [none]
actualProperties.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
// depends on control dependency: [if], data = [none]
}
String loggerClass = actualProperties.getProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS);
if (StringUtils.isBlank(loggerClass)) {
actualProperties.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS,
"org.apache.velocity.runtime.log.NullLogChute");
// depends on control dependency: [if], data = [none]
}
VelocityEngine velocity = new VelocityEngine(actualProperties);
velocity.init();
return velocity;
} }
|
public class class_name {
private static Set<LexiconEntry> getLexiconEntriesFromParses(Collection<CcgParse> parses) {
// Generate candidate lexicon entries from the correct max parses.
Set<LexiconEntry> candidateEntries = Sets.newHashSet();
for (CcgParse correctMaxParse : parses) {
for (LexiconEntryInfo info : correctMaxParse.getSpannedLexiconEntries()) {
CcgCategory category = info.getCategory();
Object trigger = info.getLexiconTrigger();
List<String> words = (List<String>) trigger;
candidateEntries.add(new LexiconEntry(words, category));
}
}
return candidateEntries;
} }
|
public class class_name {
private static Set<LexiconEntry> getLexiconEntriesFromParses(Collection<CcgParse> parses) {
// Generate candidate lexicon entries from the correct max parses.
Set<LexiconEntry> candidateEntries = Sets.newHashSet();
for (CcgParse correctMaxParse : parses) {
for (LexiconEntryInfo info : correctMaxParse.getSpannedLexiconEntries()) {
CcgCategory category = info.getCategory();
Object trigger = info.getLexiconTrigger();
List<String> words = (List<String>) trigger;
candidateEntries.add(new LexiconEntry(words, category)); // depends on control dependency: [for], data = [none]
}
}
return candidateEntries;
} }
|
public class class_name {
public void setWaitForExternalEvents(boolean shouldWait) {
if (waitForExternalEvents && !shouldWait) {
waitForExternalEvents = false;
recentlyEnqueuedExternalEvents.add(NO_MORE_WAIT_EXTERNAL);
} else {
waitForExternalEvents = shouldWait;
}
} }
|
public class class_name {
public void setWaitForExternalEvents(boolean shouldWait) {
if (waitForExternalEvents && !shouldWait) {
waitForExternalEvents = false; // depends on control dependency: [if], data = [none]
recentlyEnqueuedExternalEvents.add(NO_MORE_WAIT_EXTERNAL); // depends on control dependency: [if], data = [none]
} else {
waitForExternalEvents = shouldWait; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static CmsRole valueOfId(CmsUUID roleId) {
Iterator<CmsRole> it = SYSTEM_ROLES.iterator();
while (it.hasNext()) {
CmsRole role = it.next();
if (roleId.equals(role.getId())) {
return role;
}
}
return null;
} }
|
public class class_name {
public static CmsRole valueOfId(CmsUUID roleId) {
Iterator<CmsRole> it = SYSTEM_ROLES.iterator();
while (it.hasNext()) {
CmsRole role = it.next();
if (roleId.equals(role.getId())) {
return role; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static boolean isJavaArchive(IResource resource) {
if (resource == null || (resource.getType() != IResource.FILE)) {
return false;
}
String name = resource.getName();
return Archive.isArchiveFileName(name);
} }
|
public class class_name {
public static boolean isJavaArchive(IResource resource) {
if (resource == null || (resource.getType() != IResource.FILE)) {
return false; // depends on control dependency: [if], data = [none]
}
String name = resource.getName();
return Archive.isArchiveFileName(name);
} }
|
public class class_name {
public static <T> boolean anyValuesInCommon(Collection<T> c1, Collection<T> c2)
{
// Let's always iterate over smaller collection:
if (c1.size() > c2.size()) {
Collection<T> tmp = c1;
c1 = c2;
c2 = tmp;
}
Iterator<T> it = c1.iterator();
while (it.hasNext()) {
if (c2.contains(it.next())) {
return true;
}
}
return false;
} }
|
public class class_name {
public static <T> boolean anyValuesInCommon(Collection<T> c1, Collection<T> c2)
{
// Let's always iterate over smaller collection:
if (c1.size() > c2.size()) {
Collection<T> tmp = c1;
c1 = c2; // depends on control dependency: [if], data = [none]
c2 = tmp; // depends on control dependency: [if], data = [none]
}
Iterator<T> it = c1.iterator();
while (it.hasNext()) {
if (c2.contains(it.next())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@Override
@SuppressWarnings("unused")
public void parseURL(URLStreamHandlerSetter setter, URL url, String arg2, int arg3, int arg4) {
// ------------------------------------------------------------------------------
// NOTE: the java.net.URLStreamHandler expects that parseURL will be called
// for the handler associated with a given URL. This associated handler is
// actually an OSGi handler proxy. Thus we must tempoorarily alter the URL's
// handler.
//
// See org.eclipse.osgi.framework.internal.protocol.URLStreamHandlerProxy
// and java.net.URLStreamHandler for details.
// ------------------------------------------------------------------------------
URLStreamHandler currentHandler = null;
try {
currentHandler = (URLStreamHandler) _handlerField.get(url);
_handlerField.set(url, getInstance());
_parseURL.invoke(getInstance(), new Object[] { url, arg2, Integer.valueOf(arg3), Integer.valueOf(arg4) });
} catch (Exception e) {
FFDCFilter.processException(e, getClass().getName(), "parseURL", new Object[] { url, this, currentHandler });
} finally {
if (currentHandler != null) {
try {
_handlerField.set(url, currentHandler);
} catch (Exception e) {
FFDCFilter.processException(e, getClass().getName(), "parseURL", new Object[] { url, this, currentHandler });
}
}
}
} }
|
public class class_name {
@Override
@SuppressWarnings("unused")
public void parseURL(URLStreamHandlerSetter setter, URL url, String arg2, int arg3, int arg4) {
// ------------------------------------------------------------------------------
// NOTE: the java.net.URLStreamHandler expects that parseURL will be called
// for the handler associated with a given URL. This associated handler is
// actually an OSGi handler proxy. Thus we must tempoorarily alter the URL's
// handler.
//
// See org.eclipse.osgi.framework.internal.protocol.URLStreamHandlerProxy
// and java.net.URLStreamHandler for details.
// ------------------------------------------------------------------------------
URLStreamHandler currentHandler = null;
try {
currentHandler = (URLStreamHandler) _handlerField.get(url); // depends on control dependency: [try], data = [none]
_handlerField.set(url, getInstance()); // depends on control dependency: [try], data = [none]
_parseURL.invoke(getInstance(), new Object[] { url, arg2, Integer.valueOf(arg3), Integer.valueOf(arg4) }); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
FFDCFilter.processException(e, getClass().getName(), "parseURL", new Object[] { url, this, currentHandler });
} finally { // depends on control dependency: [catch], data = [none]
if (currentHandler != null) {
try {
_handlerField.set(url, currentHandler); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
FFDCFilter.processException(e, getClass().getName(), "parseURL", new Object[] { url, this, currentHandler });
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
protected void parse(Node node) {
parsed = true;
NodeList childNodes = node.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node child = childNodes.item(i);
String nodeName = child.getNodeName();
if ("Name".equalsIgnoreCase(nodeName)) {
name = getValueRecursive(child);
} else if ("Title".equalsIgnoreCase(nodeName)) {
title = getValueRecursive(child);
} else if ("Abstract".equalsIgnoreCase(nodeName)) {
abstractt = getValueRecursive(child);
} else if ("Keywords".equalsIgnoreCase(nodeName)) {
addKeyWords(child);
} else if ("SRS".equalsIgnoreCase(nodeName)) {
defaultCrs = getValueRecursive(child);
} else if ("LatLongBoundingBox".equalsIgnoreCase(nodeName)) {
addLatLonBoundingBox(child);
}
}
} }
|
public class class_name {
protected void parse(Node node) {
parsed = true;
NodeList childNodes = node.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node child = childNodes.item(i);
String nodeName = child.getNodeName();
if ("Name".equalsIgnoreCase(nodeName)) {
name = getValueRecursive(child); // depends on control dependency: [if], data = [none]
} else if ("Title".equalsIgnoreCase(nodeName)) {
title = getValueRecursive(child); // depends on control dependency: [if], data = [none]
} else if ("Abstract".equalsIgnoreCase(nodeName)) {
abstractt = getValueRecursive(child); // depends on control dependency: [if], data = [none]
} else if ("Keywords".equalsIgnoreCase(nodeName)) {
addKeyWords(child); // depends on control dependency: [if], data = [none]
} else if ("SRS".equalsIgnoreCase(nodeName)) {
defaultCrs = getValueRecursive(child); // depends on control dependency: [if], data = [none]
} else if ("LatLongBoundingBox".equalsIgnoreCase(nodeName)) {
addLatLonBoundingBox(child); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void addNamespace(String prefix, String namespaceURI) {
this.prefixToNsUriMap.put(prefix, namespaceURI);
if (this.nsUriToPrefixesMap.get(namespaceURI) == null) {
this.nsUriToPrefixesMap.put(namespaceURI, new HashSet<String>());
}
this.nsUriToPrefixesMap.get(namespaceURI).add(prefix);
} }
|
public class class_name {
public void addNamespace(String prefix, String namespaceURI) {
this.prefixToNsUriMap.put(prefix, namespaceURI);
if (this.nsUriToPrefixesMap.get(namespaceURI) == null) {
this.nsUriToPrefixesMap.put(namespaceURI, new HashSet<String>()); // depends on control dependency: [if], data = [none]
}
this.nsUriToPrefixesMap.get(namespaceURI).add(prefix);
} }
|
public class class_name {
private String generatePageSQLStatement(boolean tableExists,
Map<String, Set<Integer>> dataSourceToUse)
{
StringBuffer output = new StringBuffer();
// Statement creates table for Template Id -> Page Id
output.append("CREATE TABLE IF NOT EXISTS "
+ GeneratorConstants.TABLE_TPLID_PAGEID
+ " ("
+ "templateId INTEGER UNSIGNED NOT NULL,"
+ "pageId INTEGER UNSIGNED NOT NULL, UNIQUE(templateId, pageId));\r\n");
// Statement for data into templateId -> pageId
output.append(this.generateSQLStatementForDataInTable(dataSourceToUse,
GeneratorConstants.TABLE_TPLID_PAGEID));
if (!tableExists) {
// Create index statement if table does not exists
output.append("CREATE INDEX pageIdx ON "
+ GeneratorConstants.TABLE_TPLID_PAGEID
+ "(pageId);");
output.append("\r\n");
}
return output.toString();
} }
|
public class class_name {
private String generatePageSQLStatement(boolean tableExists,
Map<String, Set<Integer>> dataSourceToUse)
{
StringBuffer output = new StringBuffer();
// Statement creates table for Template Id -> Page Id
output.append("CREATE TABLE IF NOT EXISTS "
+ GeneratorConstants.TABLE_TPLID_PAGEID
+ " ("
+ "templateId INTEGER UNSIGNED NOT NULL,"
+ "pageId INTEGER UNSIGNED NOT NULL, UNIQUE(templateId, pageId));\r\n");
// Statement for data into templateId -> pageId
output.append(this.generateSQLStatementForDataInTable(dataSourceToUse,
GeneratorConstants.TABLE_TPLID_PAGEID));
if (!tableExists) {
// Create index statement if table does not exists
output.append("CREATE INDEX pageIdx ON "
+ GeneratorConstants.TABLE_TPLID_PAGEID
+ "(pageId);");
output.append("\r\n"); // depends on control dependency: [if], data = [none]
}
return output.toString();
} }
|
public class class_name {
private ILexLocation location(int tokline, int tokpos, int startOffset,
int endOffset)
{
// Fix for location on traces
if (this.location != null)
{
return this.location;
} else
{
return new LexLocation(file, currentModule, tokline, tokpos, linecount, charpos, startOffset, endOffset);
}
} }
|
public class class_name {
private ILexLocation location(int tokline, int tokpos, int startOffset,
int endOffset)
{
// Fix for location on traces
if (this.location != null)
{
return this.location; // depends on control dependency: [if], data = [none]
} else
{
return new LexLocation(file, currentModule, tokline, tokpos, linecount, charpos, startOffset, endOffset); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(StartTopicsDetectionJobRequest startTopicsDetectionJobRequest, ProtocolMarshaller protocolMarshaller) {
if (startTopicsDetectionJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getInputDataConfig(), INPUTDATACONFIG_BINDING);
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getOutputDataConfig(), OUTPUTDATACONFIG_BINDING);
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getDataAccessRoleArn(), DATAACCESSROLEARN_BINDING);
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getJobName(), JOBNAME_BINDING);
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getNumberOfTopics(), NUMBEROFTOPICS_BINDING);
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING);
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getVolumeKmsKeyId(), VOLUMEKMSKEYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StartTopicsDetectionJobRequest startTopicsDetectionJobRequest, ProtocolMarshaller protocolMarshaller) {
if (startTopicsDetectionJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getInputDataConfig(), INPUTDATACONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getOutputDataConfig(), OUTPUTDATACONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getDataAccessRoleArn(), DATAACCESSROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getJobName(), JOBNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getNumberOfTopics(), NUMBEROFTOPICS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTopicsDetectionJobRequest.getVolumeKmsKeyId(), VOLUMEKMSKEYID_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 {
@Override
public int countByG_B_A(long groupId, boolean billingAllowed, boolean active) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_G_B_A;
Object[] finderArgs = new Object[] { groupId, billingAllowed, active };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_COUNT_COMMERCECOUNTRY_WHERE);
query.append(_FINDER_COLUMN_G_B_A_GROUPID_2);
query.append(_FINDER_COLUMN_G_B_A_BILLINGALLOWED_2);
query.append(_FINDER_COLUMN_G_B_A_ACTIVE_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
qPos.add(billingAllowed);
qPos.add(active);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} }
|
public class class_name {
@Override
public int countByG_B_A(long groupId, boolean billingAllowed, boolean active) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_G_B_A;
Object[] finderArgs = new Object[] { groupId, billingAllowed, active };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_COUNT_COMMERCECOUNTRY_WHERE); // depends on control dependency: [if], data = [none]
query.append(_FINDER_COLUMN_G_B_A_GROUPID_2); // depends on control dependency: [if], data = [none]
query.append(_FINDER_COLUMN_G_B_A_BILLINGALLOWED_2); // depends on control dependency: [if], data = [none]
query.append(_FINDER_COLUMN_G_B_A_ACTIVE_2); // depends on control dependency: [if], data = [none]
String sql = query.toString();
Session session = null;
try {
session = openSession(); // depends on control dependency: [try], data = [none]
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId); // depends on control dependency: [try], data = [none]
qPos.add(billingAllowed); // depends on control dependency: [try], data = [none]
qPos.add(active); // depends on control dependency: [try], data = [none]
count = (Long)q.uniqueResult(); // depends on control dependency: [try], data = [none]
finderCache.putResult(finderPath, finderArgs, count); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
} // depends on control dependency: [catch], data = [none]
finally {
closeSession(session);
}
}
return count.intValue();
} }
|
public class class_name {
JCExpression term1Rest(JCExpression t) {
if (token.kind == QUES) {
int pos = token.pos;
nextToken();
JCExpression t1 = term();
accept(COLON);
JCExpression t2 = term1();
return F.at(pos).Conditional(t, t1, t2);
} else {
return t;
}
} }
|
public class class_name {
JCExpression term1Rest(JCExpression t) {
if (token.kind == QUES) {
int pos = token.pos;
nextToken(); // depends on control dependency: [if], data = [none]
JCExpression t1 = term();
accept(COLON); // depends on control dependency: [if], data = [none]
JCExpression t2 = term1();
return F.at(pos).Conditional(t, t1, t2); // depends on control dependency: [if], data = [none]
} else {
return t; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void fireHistoricActivityInstanceUpdate() {
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
HistoryLevel historyLevel = configuration.getHistoryLevel();
if (historyLevel.isHistoryEventProduced(HistoryEventTypes.ACTIVITY_INSTANCE_UPDATE, this)) {
// publish update event for current activity instance (containing the id
// of the sub process/case)
HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
@Override
public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
return producer.createActivityInstanceUpdateEvt(ExecutionEntity.this);
}
});
}
} }
|
public class class_name {
public void fireHistoricActivityInstanceUpdate() {
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
HistoryLevel historyLevel = configuration.getHistoryLevel();
if (historyLevel.isHistoryEventProduced(HistoryEventTypes.ACTIVITY_INSTANCE_UPDATE, this)) {
// publish update event for current activity instance (containing the id
// of the sub process/case)
HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
@Override
public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
return producer.createActivityInstanceUpdateEvt(ExecutionEntity.this);
}
}); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public DescribeLaunchConfigurationsRequest withLaunchConfigurationNames(String... launchConfigurationNames) {
if (this.launchConfigurationNames == null) {
setLaunchConfigurationNames(new com.amazonaws.internal.SdkInternalList<String>(launchConfigurationNames.length));
}
for (String ele : launchConfigurationNames) {
this.launchConfigurationNames.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeLaunchConfigurationsRequest withLaunchConfigurationNames(String... launchConfigurationNames) {
if (this.launchConfigurationNames == null) {
setLaunchConfigurationNames(new com.amazonaws.internal.SdkInternalList<String>(launchConfigurationNames.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : launchConfigurationNames) {
this.launchConfigurationNames.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
protected void addStringValue(Document doc, String fieldName, Object internalValue, boolean tokenized,
boolean includeInNodeIndex, float boost, boolean useInExcerpt)
{
// simple String
String stringValue = (String)internalValue;
doc.add(createFieldWithoutNorms(fieldName, stringValue, PropertyType.STRING));
if (tokenized)
{
if (stringValue.length() == 0)
{
return;
}
// create fulltext index on property
int idx = fieldName.indexOf(':');
fieldName = fieldName.substring(0, idx + 1) + FieldNames.FULLTEXT_PREFIX + fieldName.substring(idx + 1);
Field f = new Field(fieldName, stringValue, Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.NO);
f.setBoost(boost);
doc.add(f);
if (includeInNodeIndex)
{
// also create fulltext index of this value
boolean store = supportHighlighting && useInExcerpt;
f = createFulltextField(stringValue, store, supportHighlighting);
if (useInExcerpt)
{
doc.add(f);
}
else
{
doNotUseInExcerpt.add(f);
}
}
}
} }
|
public class class_name {
protected void addStringValue(Document doc, String fieldName, Object internalValue, boolean tokenized,
boolean includeInNodeIndex, float boost, boolean useInExcerpt)
{
// simple String
String stringValue = (String)internalValue;
doc.add(createFieldWithoutNorms(fieldName, stringValue, PropertyType.STRING));
if (tokenized)
{
if (stringValue.length() == 0)
{
return; // depends on control dependency: [if], data = [none]
}
// create fulltext index on property
int idx = fieldName.indexOf(':');
fieldName = fieldName.substring(0, idx + 1) + FieldNames.FULLTEXT_PREFIX + fieldName.substring(idx + 1); // depends on control dependency: [if], data = [none]
Field f = new Field(fieldName, stringValue, Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.NO);
f.setBoost(boost); // depends on control dependency: [if], data = [none]
doc.add(f); // depends on control dependency: [if], data = [none]
if (includeInNodeIndex)
{
// also create fulltext index of this value
boolean store = supportHighlighting && useInExcerpt;
f = createFulltextField(stringValue, store, supportHighlighting); // depends on control dependency: [if], data = [none]
if (useInExcerpt)
{
doc.add(f); // depends on control dependency: [if], data = [none]
}
else
{
doNotUseInExcerpt.add(f); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
private void repairBrokenLatticeBefore(ViterbiLattice lattice, int index) {
ViterbiNode[][] nodeStartIndices = lattice.getStartIndexArr();
for (int startIndex = index; startIndex > 0; startIndex--) {
if (nodeStartIndices[startIndex] != null) {
ViterbiNode glueBase = findGlueNodeCandidate(index, nodeStartIndices[startIndex], startIndex);
if (glueBase != null) {
int length = index + 1 - startIndex;
String surface = glueBase.getSurface().substring(0, length);
ViterbiNode glueNode = createGlueNode(startIndex, glueBase, surface);
lattice.addNode(glueNode, startIndex, startIndex + glueNode.getSurface().length());
return;
}
}
}
} }
|
public class class_name {
private void repairBrokenLatticeBefore(ViterbiLattice lattice, int index) {
ViterbiNode[][] nodeStartIndices = lattice.getStartIndexArr();
for (int startIndex = index; startIndex > 0; startIndex--) {
if (nodeStartIndices[startIndex] != null) {
ViterbiNode glueBase = findGlueNodeCandidate(index, nodeStartIndices[startIndex], startIndex);
if (glueBase != null) {
int length = index + 1 - startIndex;
String surface = glueBase.getSurface().substring(0, length);
ViterbiNode glueNode = createGlueNode(startIndex, glueBase, surface);
lattice.addNode(glueNode, startIndex, startIndex + glueNode.getSurface().length()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public boolean getBoolean(String key) {
if (containsKey(key)) {
return "true".equalsIgnoreCase(get(key));
} else {
throw new IllegalArgumentException("Missing key " + key + ".");
}
} }
|
public class class_name {
public boolean getBoolean(String key) {
if (containsKey(key)) {
return "true".equalsIgnoreCase(get(key)); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Missing key " + key + ".");
}
} }
|
public class class_name {
synchronized int getNonCorruptUnderReplicatedBlocksCount() {
int size = 0;
for (int i=0; i<QUEUE_WITH_CORRUPT_BLOCKS; i++) {
size += priorityQueues.get(i).size();
}
return size;
} }
|
public class class_name {
synchronized int getNonCorruptUnderReplicatedBlocksCount() {
int size = 0;
for (int i=0; i<QUEUE_WITH_CORRUPT_BLOCKS; i++) {
size += priorityQueues.get(i).size(); // depends on control dependency: [for], data = [i]
}
return size;
} }
|
public class class_name {
public void closeGeoPackages() {
for (PropertiesCoreExtension<T, ?, ?, ?> properties : propertiesMap
.values()) {
properties.getGeoPackage().close();
}
propertiesMap.clear();
} }
|
public class class_name {
public void closeGeoPackages() {
for (PropertiesCoreExtension<T, ?, ?, ?> properties : propertiesMap
.values()) {
properties.getGeoPackage().close(); // depends on control dependency: [for], data = [properties]
}
propertiesMap.clear();
} }
|
public class class_name {
public boolean isClientSideWindowHandlerRequest(FacesContext facesContext)
{
if (!isJavaScriptEnabled())
{
return false;
}
String userAgent = getUserAgent(facesContext);
if (userAgent != null &&
( userAgent.indexOf("bot") >= 0 || // Googlebot, etc
userAgent.indexOf("Bot") >= 0 || // BingBot, etc
userAgent.indexOf("Slurp") >= 0 || // Yahoo Slurp
userAgent.indexOf("Crawler") >= 0 // various other Crawlers
) )
{
return false;
}
return true;
} }
|
public class class_name {
public boolean isClientSideWindowHandlerRequest(FacesContext facesContext)
{
if (!isJavaScriptEnabled())
{
return false; // depends on control dependency: [if], data = [none]
}
String userAgent = getUserAgent(facesContext);
if (userAgent != null &&
( userAgent.indexOf("bot") >= 0 || // Googlebot, etc
userAgent.indexOf("Bot") >= 0 || // BingBot, etc
userAgent.indexOf("Slurp") >= 0 || // Yahoo Slurp
userAgent.indexOf("Crawler") >= 0 // various other Crawlers
) )
{
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
public AdminGetUserResult withUserMFASettingList(String... userMFASettingList) {
if (this.userMFASettingList == null) {
setUserMFASettingList(new java.util.ArrayList<String>(userMFASettingList.length));
}
for (String ele : userMFASettingList) {
this.userMFASettingList.add(ele);
}
return this;
} }
|
public class class_name {
public AdminGetUserResult withUserMFASettingList(String... userMFASettingList) {
if (this.userMFASettingList == null) {
setUserMFASettingList(new java.util.ArrayList<String>(userMFASettingList.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : userMFASettingList) {
this.userMFASettingList.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
@Override
public String getExternalIdentifier() {
try {
LOGGER.debug("getExternalIdentifier for property {} ", property().getName());
return property().getValue().getString();
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} }
|
public class class_name {
@Override
public String getExternalIdentifier() {
try {
LOGGER.debug("getExternalIdentifier for property {} ", property().getName()); // depends on control dependency: [try], data = [none]
return property().getValue().getString(); // depends on control dependency: [try], data = [none]
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private ExtendedInfo getInfo(Object o)
{
if (_info == null && o != null) {
_info = new ExtendedInfo();
}
return _info;
} }
|
public class class_name {
private ExtendedInfo getInfo(Object o)
{
if (_info == null && o != null) {
_info = new ExtendedInfo(); // depends on control dependency: [if], data = [none]
}
return _info;
} }
|
public class class_name {
public static Set<File> getLooseConfigFiles(BootstrapConfig bootProps) {
Set<File> files = new HashSet<File>();
List<Pattern> patterns = new ArrayList<Pattern>();
patterns.add(Pattern.compile(".*(\\.xml)$"));
// Add loose files under ${server.config.dir}/dropins
File dropins = getFileFromDirectory(new File(bootProps.get(BootstrapConstants.LOC_PROPERTY_SRVCFG_DIR)), BootstrapConstants.LOC_AREA_NAME_DROP);
if (dropins.exists()) {
files.addAll(Arrays.asList(FileUtils.listFiles(dropins, patterns, true)));
}
// Add loose files under ${server.config.dir}/apps
File apps = getFileFromDirectory(new File(bootProps.get(BootstrapConstants.LOC_PROPERTY_SRVCFG_DIR)), BootstrapConstants.LOC_AREA_NAME_APP);
if (apps.exists()) {
files.addAll(Arrays.asList(FileUtils.listFiles(apps, patterns, true)));
}
// Add loose files under ${shared.app.dir}
File shared = new File(bootProps.get(BootstrapConstants.LOC_PROPERTY_SHARED_APP_DIR));
if (shared.exists()) {
files.addAll(Arrays.asList(FileUtils.listFiles(shared, patterns, true)));
}
return files;
} }
|
public class class_name {
public static Set<File> getLooseConfigFiles(BootstrapConfig bootProps) {
Set<File> files = new HashSet<File>();
List<Pattern> patterns = new ArrayList<Pattern>();
patterns.add(Pattern.compile(".*(\\.xml)$"));
// Add loose files under ${server.config.dir}/dropins
File dropins = getFileFromDirectory(new File(bootProps.get(BootstrapConstants.LOC_PROPERTY_SRVCFG_DIR)), BootstrapConstants.LOC_AREA_NAME_DROP);
if (dropins.exists()) {
files.addAll(Arrays.asList(FileUtils.listFiles(dropins, patterns, true))); // depends on control dependency: [if], data = [none]
}
// Add loose files under ${server.config.dir}/apps
File apps = getFileFromDirectory(new File(bootProps.get(BootstrapConstants.LOC_PROPERTY_SRVCFG_DIR)), BootstrapConstants.LOC_AREA_NAME_APP);
if (apps.exists()) {
files.addAll(Arrays.asList(FileUtils.listFiles(apps, patterns, true))); // depends on control dependency: [if], data = [none]
}
// Add loose files under ${shared.app.dir}
File shared = new File(bootProps.get(BootstrapConstants.LOC_PROPERTY_SHARED_APP_DIR));
if (shared.exists()) {
files.addAll(Arrays.asList(FileUtils.listFiles(shared, patterns, true))); // depends on control dependency: [if], data = [none]
}
return files;
} }
|
public class class_name {
public void marshall(ListShardsRequest listShardsRequest, ProtocolMarshaller protocolMarshaller) {
if (listShardsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listShardsRequest.getStreamName(), STREAMNAME_BINDING);
protocolMarshaller.marshall(listShardsRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listShardsRequest.getExclusiveStartShardId(), EXCLUSIVESTARTSHARDID_BINDING);
protocolMarshaller.marshall(listShardsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listShardsRequest.getStreamCreationTimestamp(), STREAMCREATIONTIMESTAMP_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListShardsRequest listShardsRequest, ProtocolMarshaller protocolMarshaller) {
if (listShardsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listShardsRequest.getStreamName(), STREAMNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listShardsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listShardsRequest.getExclusiveStartShardId(), EXCLUSIVESTARTSHARDID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listShardsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listShardsRequest.getStreamCreationTimestamp(), STREAMCREATIONTIMESTAMP_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 {
protected synchronized void decorateWithTLS(TLSClientParameters tlsClientParameters,
HttpURLConnection connection) throws GeneralSecurityException {
int hash = tlsClientParameters.hashCode();
if (hash != lastTlsHash) {
lastTlsHash = hash;
socketFactory = null;
}
// always reload socketFactory from HttpsURLConnection.defaultSSLSocketFactory and
// tlsClientParameters.sslSocketFactory to allow runtime configuration change
if (tlsClientParameters.isUseHttpsURLConnectionDefaultSslSocketFactory()) {
socketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
} else if (tlsClientParameters.getSSLSocketFactory() != null) {
// see if an SSLSocketFactory was set. This allows easy interop
// with not-yet-commons-ssl.jar, or even just people who like doing their
// own JSSE.
socketFactory = tlsClientParameters.getSSLSocketFactory();
} else if (socketFactory == null) {
// ssl socket factory not yet instantiated, create a new one with tlsClientParameters's Trust
// Managers, Key Managers, etc
SSLContext ctx = org.apache.cxf.transport.https.SSLUtils.getSSLContext(tlsClientParameters);
String[] cipherSuites = SSLUtils.getCiphersuitesToInclude(tlsClientParameters.getCipherSuites(),
tlsClientParameters.getCipherSuitesFilter(),
ctx.getSocketFactory().getDefaultCipherSuites(),
SSLUtils.getSupportedCipherSuites(ctx),
LOG);
// The SSLSocketFactoryWrapper enables certain cipher suites
// from the policy.
String protocol = tlsClientParameters.getSecureSocketProtocol() != null ? tlsClientParameters.getSecureSocketProtocol() : "TLS";
socketFactory = new SSLSocketFactoryWrapper(ctx.getSocketFactory(), cipherSuites, protocol);
//recalc the hashcode since some of the above MAY have changed the tlsClientParameters
lastTlsHash = tlsClientParameters.hashCode();
} else {
// ssl socket factory already initialized, reuse it to benefit of keep alive
}
HostnameVerifier verifier = org.apache.cxf.transport.https.SSLUtils.getHostnameVerifier(tlsClientParameters);
if (connection instanceof HttpsURLConnection) {
// handle the expected case (javax.net.ssl)
final HttpsURLConnection conn = (HttpsURLConnection) connection;
conn.setHostnameVerifier(verifier);
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
conn.setSSLSocketFactory(socketFactory);
return null;
}
});
} else {
// handle the deprecated sun case and other possible hidden API's
// that are similar to the Sun cases
try {
Method method = connection.getClass().getMethod("getHostnameVerifier");
InvocationHandler handler = new ReflectionInvokationHandler(verifier) {
@Override
public Object invoke(Object proxy,
Method method,
Object[] args) throws Throwable {
try {
return super.invoke(proxy, method, args);
} catch (Exception ex) {
return false;
}
}
};
Object proxy = java.lang.reflect.Proxy.newProxyInstance(this.getClass().getClassLoader(),
new Class[] { method.getReturnType() },
handler);
method = connection.getClass().getMethod("setHostnameVerifier", method.getReturnType());
method.invoke(connection, proxy);
} catch (Exception ex) {
//Ignore this one
}
try {
Method getSSLSocketFactory = connection.getClass().getMethod("getSSLSocketFactory");
Method setSSLSocketFactory = connection.getClass().getMethod("setSSLSocketFactory", getSSLSocketFactory.getReturnType());
if (getSSLSocketFactory.getReturnType().isInstance(socketFactory)) {
setSSLSocketFactory.invoke(connection, socketFactory);
} else {
//need to see if we can create one - mostly the weblogic case. The
//weblogic SSLSocketFactory has a protected constructor that can take
//a JSSE SSLSocketFactory so we'll try and use that
Constructor<?> c = getSSLSocketFactory.getReturnType().getDeclaredConstructor(SSLSocketFactory.class);
ReflectionUtil.setAccessible(c);
setSSLSocketFactory.invoke(connection, c.newInstance(socketFactory));
}
} catch (Exception ex) {
if (connection.getClass().getName().contains("weblogic")) {
if (!weblogicWarned) {
weblogicWarned = true;
LOG.warning("Could not configure SSLSocketFactory on Weblogic. "
+ " Use the Weblogic control panel to configure the SSL settings.");
}
return;
}
//if we cannot set the SSLSocketFactor, we're in serious trouble.
throw new IllegalArgumentException("Error decorating connection class "
+ connection.getClass().getName(), ex);
}
}
} }
|
public class class_name {
protected synchronized void decorateWithTLS(TLSClientParameters tlsClientParameters,
HttpURLConnection connection) throws GeneralSecurityException {
int hash = tlsClientParameters.hashCode();
if (hash != lastTlsHash) {
lastTlsHash = hash;
socketFactory = null;
}
// always reload socketFactory from HttpsURLConnection.defaultSSLSocketFactory and
// tlsClientParameters.sslSocketFactory to allow runtime configuration change
if (tlsClientParameters.isUseHttpsURLConnectionDefaultSslSocketFactory()) {
socketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
} else if (tlsClientParameters.getSSLSocketFactory() != null) {
// see if an SSLSocketFactory was set. This allows easy interop
// with not-yet-commons-ssl.jar, or even just people who like doing their
// own JSSE.
socketFactory = tlsClientParameters.getSSLSocketFactory();
} else if (socketFactory == null) {
// ssl socket factory not yet instantiated, create a new one with tlsClientParameters's Trust
// Managers, Key Managers, etc
SSLContext ctx = org.apache.cxf.transport.https.SSLUtils.getSSLContext(tlsClientParameters);
String[] cipherSuites = SSLUtils.getCiphersuitesToInclude(tlsClientParameters.getCipherSuites(),
tlsClientParameters.getCipherSuitesFilter(),
ctx.getSocketFactory().getDefaultCipherSuites(),
SSLUtils.getSupportedCipherSuites(ctx),
LOG);
// The SSLSocketFactoryWrapper enables certain cipher suites
// from the policy.
String protocol = tlsClientParameters.getSecureSocketProtocol() != null ? tlsClientParameters.getSecureSocketProtocol() : "TLS";
socketFactory = new SSLSocketFactoryWrapper(ctx.getSocketFactory(), cipherSuites, protocol);
//recalc the hashcode since some of the above MAY have changed the tlsClientParameters
lastTlsHash = tlsClientParameters.hashCode();
} else {
// ssl socket factory already initialized, reuse it to benefit of keep alive
}
HostnameVerifier verifier = org.apache.cxf.transport.https.SSLUtils.getHostnameVerifier(tlsClientParameters);
if (connection instanceof HttpsURLConnection) {
// handle the expected case (javax.net.ssl)
final HttpsURLConnection conn = (HttpsURLConnection) connection;
conn.setHostnameVerifier(verifier);
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
conn.setSSLSocketFactory(socketFactory);
return null;
}
});
} else {
// handle the deprecated sun case and other possible hidden API's
// that are similar to the Sun cases
try {
Method method = connection.getClass().getMethod("getHostnameVerifier");
InvocationHandler handler = new ReflectionInvokationHandler(verifier) {
@Override
public Object invoke(Object proxy,
Method method,
Object[] args) throws Throwable {
try {
return super.invoke(proxy, method, args);
} catch (Exception ex) {
return false;
}
}
};
Object proxy = java.lang.reflect.Proxy.newProxyInstance(this.getClass().getClassLoader(),
new Class[] { method.getReturnType() },
handler);
method = connection.getClass().getMethod("setHostnameVerifier", method.getReturnType());
method.invoke(connection, proxy);
} catch (Exception ex) {
//Ignore this one
}
try {
Method getSSLSocketFactory = connection.getClass().getMethod("getSSLSocketFactory");
Method setSSLSocketFactory = connection.getClass().getMethod("setSSLSocketFactory", getSSLSocketFactory.getReturnType());
if (getSSLSocketFactory.getReturnType().isInstance(socketFactory)) {
setSSLSocketFactory.invoke(connection, socketFactory);
} else {
//need to see if we can create one - mostly the weblogic case. The
//weblogic SSLSocketFactory has a protected constructor that can take
//a JSSE SSLSocketFactory so we'll try and use that
Constructor<?> c = getSSLSocketFactory.getReturnType().getDeclaredConstructor(SSLSocketFactory.class);
ReflectionUtil.setAccessible(c);
setSSLSocketFactory.invoke(connection, c.newInstance(socketFactory));
}
} catch (Exception ex) {
if (connection.getClass().getName().contains("weblogic")) {
if (!weblogicWarned) {
weblogicWarned = true; // depends on control dependency: [if], data = [none]
LOG.warning("Could not configure SSLSocketFactory on Weblogic. "
+ " Use the Weblogic control panel to configure the SSL settings."); // depends on control dependency: [if], data = [none]
}
return;
}
//if we cannot set the SSLSocketFactor, we're in serious trouble.
throw new IllegalArgumentException("Error decorating connection class "
+ connection.getClass().getName(), ex);
}
}
} }
|
public class class_name {
public ActivityImpl getInnerActivity(PvmActivity miBodyActivity) {
for (PvmActivity activity : miBodyActivity.getActivities()) {
ActivityImpl innerActivity = (ActivityImpl) activity;
// note that miBody can contains also a compensation handler
if (!innerActivity.isCompensationHandler()) {
return innerActivity;
}
}
throw new ProcessEngineException("inner activity of multi instance body activity '" + miBodyActivity.getId() + "' not found");
} }
|
public class class_name {
public ActivityImpl getInnerActivity(PvmActivity miBodyActivity) {
for (PvmActivity activity : miBodyActivity.getActivities()) {
ActivityImpl innerActivity = (ActivityImpl) activity;
// note that miBody can contains also a compensation handler
if (!innerActivity.isCompensationHandler()) {
return innerActivity; // depends on control dependency: [if], data = [none]
}
}
throw new ProcessEngineException("inner activity of multi instance body activity '" + miBodyActivity.getId() + "' not found");
} }
|
public class class_name {
public Correspondence convert(JSONObject jResponse) throws JSONException {
Correspondence correspondence = null;
if (jResponse.getJSONObject("response").has("Correspondence")) {
JSONObject jResponseItem = jResponse.getJSONObject("response");
JSONArray jcorrespondenceItems = jResponseItem.getJSONArray("Correspondence");
List<CorrespondenceItem> correspondenceItems = new ArrayList<CorrespondenceItem>();
for (int i = 0; i < jcorrespondenceItems.length(); i++) {
JSONObject jCorrespondenceItem = jcorrespondenceItems.getJSONObject(i);
String relation = jCorrespondenceItem.optString("Relation");
String source = jCorrespondenceItem.optString("Source");
String target = jCorrespondenceItem.optString("Target");
char cRelation = relation.charAt(0);
try {
correspondenceItems.add(new CorrespondenceItem(source, target, cRelation));
} catch (UnknownRelationException ex) {
Logger.getLogger(MatchMethods.class.getName()).log(Level.SEVERE, null, ex);
}
}
correspondence = new Correspondence(correspondenceItems);
}
return correspondence;
} }
|
public class class_name {
public Correspondence convert(JSONObject jResponse) throws JSONException {
Correspondence correspondence = null;
if (jResponse.getJSONObject("response").has("Correspondence")) {
JSONObject jResponseItem = jResponse.getJSONObject("response");
JSONArray jcorrespondenceItems = jResponseItem.getJSONArray("Correspondence");
List<CorrespondenceItem> correspondenceItems = new ArrayList<CorrespondenceItem>();
for (int i = 0; i < jcorrespondenceItems.length(); i++) {
JSONObject jCorrespondenceItem = jcorrespondenceItems.getJSONObject(i);
String relation = jCorrespondenceItem.optString("Relation");
String source = jCorrespondenceItem.optString("Source");
String target = jCorrespondenceItem.optString("Target");
char cRelation = relation.charAt(0);
try {
correspondenceItems.add(new CorrespondenceItem(source, target, cRelation)); // depends on control dependency: [try], data = [none]
} catch (UnknownRelationException ex) {
Logger.getLogger(MatchMethods.class.getName()).log(Level.SEVERE, null, ex);
} // depends on control dependency: [catch], data = [none]
}
correspondence = new Correspondence(correspondenceItems);
}
return correspondence;
} }
|
public class class_name {
public java.util.List<String> getPolicyNames() {
if (policyNames == null) {
policyNames = new com.amazonaws.internal.SdkInternalList<String>();
}
return policyNames;
} }
|
public class class_name {
public java.util.List<String> getPolicyNames() {
if (policyNames == null) {
policyNames = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return policyNames;
} }
|
public class class_name {
public Repository getRepository() {
if (!isInTransaction()) {
throw new IllegalStateException("Repository may only be accessed from within a " + Transaction.class.getSimpleName());
}
if (repository == null) {
repository = Repository.create(Application.getInstance());
}
return repository;
} }
|
public class class_name {
public Repository getRepository() {
if (!isInTransaction()) {
throw new IllegalStateException("Repository may only be accessed from within a " + Transaction.class.getSimpleName());
}
if (repository == null) {
repository = Repository.create(Application.getInstance()); // depends on control dependency: [if], data = [none]
}
return repository;
} }
|
public class class_name {
public synchronized String createTempFile(CmsObject cms, String resourceName, CmsUUID currentProjectId)
throws CmsException {
// check that the current user has write permissions
if (!cms.hasPermissions(cms.readResource(resourceName, CmsResourceFilter.ALL), CmsPermissionSet.ACCESS_WRITE)) {
throw new CmsPermissionViolationException(
org.opencms.db.Messages.get().container(org.opencms.db.Messages.ERR_PERM_DENIED_2, resourceName, "w"));
}
// initialize admin cms context
CmsObject adminCms = getAdminCms(cms);
// generate the filename of the temporary file
String temporaryFilename = CmsWorkplace.getTemporaryFileName(resourceName);
// check if the temporary file is already present
if (adminCms.existsResource(temporaryFilename, CmsResourceFilter.ALL)) {
// delete old temporary file
if (!cms.getLock(temporaryFilename).isUnlocked()) {
// steal lock
cms.changeLock(temporaryFilename);
} else {
// lock resource to current user
cms.lockResource(temporaryFilename);
}
cms.deleteResource(temporaryFilename, CmsResource.DELETE_PRESERVE_SIBLINGS);
}
try {
// switch to the temporary file project
adminCms.getRequestContext().setCurrentProject(cms.readProject(getTempFileProjectId()));
// copy the file to edit to a temporary file
adminCms.copyResource(resourceName, temporaryFilename, CmsResource.COPY_AS_NEW);
} finally {
// switch back to current project
adminCms.getRequestContext().setCurrentProject(cms.readProject(currentProjectId));
}
try {
// switch to the temporary file project
cms.getRequestContext().setCurrentProject(
cms.readProject(OpenCms.getWorkplaceManager().getTempFileProjectId()));
// lock the temporary file
cms.changeLock(temporaryFilename);
// touch the temporary file
cms.setDateLastModified(temporaryFilename, System.currentTimeMillis(), false);
// set the temporary file flag
CmsResource tempFile = cms.readResource(temporaryFilename, CmsResourceFilter.ALL);
int flags = tempFile.getFlags();
if ((flags & CmsResource.FLAG_TEMPFILE) == 0) {
flags += CmsResource.FLAG_TEMPFILE;
}
cms.chflags(temporaryFilename, flags);
// remove eventual release & expiration date from temporary file to make preview in editor work
cms.setDateReleased(temporaryFilename, CmsResource.DATE_RELEASED_DEFAULT, false);
cms.setDateExpired(temporaryFilename, CmsResource.DATE_EXPIRED_DEFAULT, false);
// remove visibility permissions for everybody on temporary file if possible
if (cms.hasPermissions(tempFile, CmsPermissionSet.ACCESS_CONTROL)) {
cms.chacc(
temporaryFilename,
I_CmsPrincipal.PRINCIPAL_GROUP,
OpenCms.getDefaultUsers().getGroupUsers(),
"-v");
}
} finally {
// switch back to current project
cms.getRequestContext().setCurrentProject(cms.readProject(currentProjectId));
}
return temporaryFilename;
} }
|
public class class_name {
public synchronized String createTempFile(CmsObject cms, String resourceName, CmsUUID currentProjectId)
throws CmsException {
// check that the current user has write permissions
if (!cms.hasPermissions(cms.readResource(resourceName, CmsResourceFilter.ALL), CmsPermissionSet.ACCESS_WRITE)) {
throw new CmsPermissionViolationException(
org.opencms.db.Messages.get().container(org.opencms.db.Messages.ERR_PERM_DENIED_2, resourceName, "w"));
}
// initialize admin cms context
CmsObject adminCms = getAdminCms(cms);
// generate the filename of the temporary file
String temporaryFilename = CmsWorkplace.getTemporaryFileName(resourceName);
// check if the temporary file is already present
if (adminCms.existsResource(temporaryFilename, CmsResourceFilter.ALL)) {
// delete old temporary file
if (!cms.getLock(temporaryFilename).isUnlocked()) {
// steal lock
cms.changeLock(temporaryFilename); // depends on control dependency: [if], data = [none]
} else {
// lock resource to current user
cms.lockResource(temporaryFilename); // depends on control dependency: [if], data = [none]
}
cms.deleteResource(temporaryFilename, CmsResource.DELETE_PRESERVE_SIBLINGS);
}
try {
// switch to the temporary file project
adminCms.getRequestContext().setCurrentProject(cms.readProject(getTempFileProjectId()));
// copy the file to edit to a temporary file
adminCms.copyResource(resourceName, temporaryFilename, CmsResource.COPY_AS_NEW);
} finally {
// switch back to current project
adminCms.getRequestContext().setCurrentProject(cms.readProject(currentProjectId));
}
try {
// switch to the temporary file project
cms.getRequestContext().setCurrentProject(
cms.readProject(OpenCms.getWorkplaceManager().getTempFileProjectId()));
// lock the temporary file
cms.changeLock(temporaryFilename);
// touch the temporary file
cms.setDateLastModified(temporaryFilename, System.currentTimeMillis(), false);
// set the temporary file flag
CmsResource tempFile = cms.readResource(temporaryFilename, CmsResourceFilter.ALL);
int flags = tempFile.getFlags();
if ((flags & CmsResource.FLAG_TEMPFILE) == 0) {
flags += CmsResource.FLAG_TEMPFILE; // depends on control dependency: [if], data = [none]
}
cms.chflags(temporaryFilename, flags);
// remove eventual release & expiration date from temporary file to make preview in editor work
cms.setDateReleased(temporaryFilename, CmsResource.DATE_RELEASED_DEFAULT, false);
cms.setDateExpired(temporaryFilename, CmsResource.DATE_EXPIRED_DEFAULT, false);
// remove visibility permissions for everybody on temporary file if possible
if (cms.hasPermissions(tempFile, CmsPermissionSet.ACCESS_CONTROL)) {
cms.chacc(
temporaryFilename,
I_CmsPrincipal.PRINCIPAL_GROUP,
OpenCms.getDefaultUsers().getGroupUsers(),
"-v"); // depends on control dependency: [if], data = [none]
}
} finally {
// switch back to current project
cms.getRequestContext().setCurrentProject(cms.readProject(currentProjectId));
}
return temporaryFilename;
} }
|
public class class_name {
public ListExclusionsResult withExclusionArns(String... exclusionArns) {
if (this.exclusionArns == null) {
setExclusionArns(new java.util.ArrayList<String>(exclusionArns.length));
}
for (String ele : exclusionArns) {
this.exclusionArns.add(ele);
}
return this;
} }
|
public class class_name {
public ListExclusionsResult withExclusionArns(String... exclusionArns) {
if (this.exclusionArns == null) {
setExclusionArns(new java.util.ArrayList<String>(exclusionArns.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : exclusionArns) {
this.exclusionArns.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void marshall(S3ReferenceDataSource s3ReferenceDataSource, ProtocolMarshaller protocolMarshaller) {
if (s3ReferenceDataSource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(s3ReferenceDataSource.getBucketARN(), BUCKETARN_BINDING);
protocolMarshaller.marshall(s3ReferenceDataSource.getFileKey(), FILEKEY_BINDING);
protocolMarshaller.marshall(s3ReferenceDataSource.getReferenceRoleARN(), REFERENCEROLEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(S3ReferenceDataSource s3ReferenceDataSource, ProtocolMarshaller protocolMarshaller) {
if (s3ReferenceDataSource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(s3ReferenceDataSource.getBucketARN(), BUCKETARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(s3ReferenceDataSource.getFileKey(), FILEKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(s3ReferenceDataSource.getReferenceRoleARN(), REFERENCEROLEARN_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 eval(int[] context, double[] outsums) {
for (int oid = 0; oid < numOutcomes; oid++) {
outsums[oid] = iprob;
numfeats[oid] = 0;
}
int[] activeOutcomes;
double[] activeParameters;
for (int i = 0; i < context.length; i++) {
Context predParams = params[context[i]];
activeOutcomes = predParams.getOutcomes();
activeParameters = predParams.getParameters();
for (int j = 0; j < activeOutcomes.length; j++) {
int oid = activeOutcomes[j];
numfeats[oid]++;
outsums[oid] += constantInverse * activeParameters[j];
}
}
double SUM = 0.0;
for (int oid = 0; oid < numOutcomes; oid++) {
outsums[oid] = Math.exp(outsums[oid]);
if (_useSlackParameter) {
outsums[oid] += ((1.0 - ((double) numfeats[oid] / constant)) * correctionParam);
}
SUM += outsums[oid];
}
for (int oid = 0; oid < numOutcomes; oid++)
outsums[oid] /= SUM;
} }
|
public class class_name {
public void eval(int[] context, double[] outsums) {
for (int oid = 0; oid < numOutcomes; oid++) {
outsums[oid] = iprob; // depends on control dependency: [for], data = [oid]
numfeats[oid] = 0; // depends on control dependency: [for], data = [oid]
}
int[] activeOutcomes;
double[] activeParameters;
for (int i = 0; i < context.length; i++) {
Context predParams = params[context[i]];
activeOutcomes = predParams.getOutcomes(); // depends on control dependency: [for], data = [none]
activeParameters = predParams.getParameters(); // depends on control dependency: [for], data = [none]
for (int j = 0; j < activeOutcomes.length; j++) {
int oid = activeOutcomes[j];
numfeats[oid]++; // depends on control dependency: [for], data = [none]
outsums[oid] += constantInverse * activeParameters[j]; // depends on control dependency: [for], data = [j]
}
}
double SUM = 0.0;
for (int oid = 0; oid < numOutcomes; oid++) {
outsums[oid] = Math.exp(outsums[oid]); // depends on control dependency: [for], data = [oid]
if (_useSlackParameter) {
outsums[oid] += ((1.0 - ((double) numfeats[oid] / constant)) * correctionParam); // depends on control dependency: [if], data = [none]
}
SUM += outsums[oid]; // depends on control dependency: [for], data = [oid]
}
for (int oid = 0; oid < numOutcomes; oid++)
outsums[oid] /= SUM;
} }
|
public class class_name {
public String run() {
if (def != null) {
return System.getProperty(property, def);
}
return System.getProperty(property);
} }
|
public class class_name {
public String run() {
if (def != null) {
return System.getProperty(property, def); // depends on control dependency: [if], data = [none]
}
return System.getProperty(property);
} }
|
public class class_name {
public static <K> boolean containsAny(Set<K> aSet, K[] arr) {
for (K obj : arr) {
if (aSet.contains(obj)) {
return true;
}
}
return false;
} }
|
public class class_name {
public static <K> boolean containsAny(Set<K> aSet, K[] arr) {
for (K obj : arr) {
if (aSet.contains(obj)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public void marshall(Scte27SourceSettings scte27SourceSettings, ProtocolMarshaller protocolMarshaller) {
if (scte27SourceSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(scte27SourceSettings.getPid(), PID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Scte27SourceSettings scte27SourceSettings, ProtocolMarshaller protocolMarshaller) {
if (scte27SourceSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(scte27SourceSettings.getPid(), PID_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 synchronized INDArray[] output(boolean train, boolean clearInputs, INDArray... input){
boolean detachedInputs = !clearInputs; //If !clearInputs, then inputs should be detached (otherwise: will be out of scope)
try {
return outputOfLayersDetached(train, FwdPassType.STANDARD, getOutputLayerIndices(), input, null, null, clearInputs, detachedInputs, null);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
} }
|
public class class_name {
public synchronized INDArray[] output(boolean train, boolean clearInputs, INDArray... input){
boolean detachedInputs = !clearInputs; //If !clearInputs, then inputs should be detached (otherwise: will be out of scope)
try {
return outputOfLayersDetached(train, FwdPassType.STANDARD, getOutputLayerIndices(), input, null, null, clearInputs, detachedInputs, null); // depends on control dependency: [try], data = [none]
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void add(int value) {
int key = toIntUnsigned(highbits(value));
if (key != currentKey) {
if (key < currentKey) {
underlying.add(value);
return;
} else {
appendToUnderlying();
currentKey = key;
}
}
C tmp = container.add(lowbits(value));
if (tmp != container) {
container = tmp;
}
} }
|
public class class_name {
@Override
public void add(int value) {
int key = toIntUnsigned(highbits(value));
if (key != currentKey) {
if (key < currentKey) {
underlying.add(value); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else {
appendToUnderlying(); // depends on control dependency: [if], data = [none]
currentKey = key; // depends on control dependency: [if], data = [none]
}
}
C tmp = container.add(lowbits(value));
if (tmp != container) {
container = tmp; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String getRealPath(String path) {
if (!myResourceBaseURL.getProtocol().equals("file"))
return (null);
if (!path.startsWith("/"))
return (null);
try {
return
(getResource(path).getFile().replace('/', File.separatorChar));
} catch (Throwable t) {
return (null);
}
} }
|
public class class_name {
public String getRealPath(String path) {
if (!myResourceBaseURL.getProtocol().equals("file"))
return (null);
if (!path.startsWith("/"))
return (null);
try {
return
(getResource(path).getFile().replace('/', File.separatorChar)); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return (null);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Double getDouble(final int index) {
if (_values[index] == null || _values[index].isEmpty()) {
return null;
} else {
return Double.parseDouble(_values[index]);
}
} }
|
public class class_name {
public Double getDouble(final int index) {
if (_values[index] == null || _values[index].isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
} else {
return Double.parseDouble(_values[index]); // depends on control dependency: [if], data = [(_values[index]]
}
} }
|
public class class_name {
private boolean isValid(CharSequence text) {
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
// as defined by http://www.w3.org/TR/REC-xml/#charsets.
boolean valid = c == 0x9 || c == 0xA || c == 0xD
|| (c >= 0x20 && c <= 0xd7ff)
|| (c >= 0xe000 && c <= 0xfffd);
if (!valid) {
return false;
}
}
return true;
} }
|
public class class_name {
private boolean isValid(CharSequence text) {
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
// as defined by http://www.w3.org/TR/REC-xml/#charsets.
boolean valid = c == 0x9 || c == 0xA || c == 0xD
|| (c >= 0x20 && c <= 0xd7ff)
|| (c >= 0xe000 && c <= 0xfffd);
if (!valid) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public static void collectCollection(IndexReader reader, List<Integer> docSet,
ComponentCollection collectionInfo) throws IOException {
if (collectionInfo.action().equals(ComponentCollection.ACTION_CHECK)) {
// can't do anything in lucene for check
} else if (collectionInfo.action()
.equals(ComponentCollection.ACTION_LIST)) {
// can't do anything in lucene for list
} else if (collectionInfo.action()
.equals(ComponentCollection.ACTION_CREATE)) {
BytesRef term = null;
PostingsEnum postingsEnum = null;
Integer docId;
Integer termDocId = -1;
Terms terms;
LeafReaderContext lrc;
LeafReader r;
ListIterator<LeafReaderContext> iterator = reader.leaves().listIterator();
while (iterator.hasNext()) {
lrc = iterator.next();
r = lrc.reader();
for (String field : collectionInfo.fields()) {
if ((terms = r.terms(field)) != null) {
TermsEnum termsEnum = terms.iterator();
while ((term = termsEnum.next()) != null) {
Iterator<Integer> docIterator = docSet.iterator();
postingsEnum = termsEnum.postings(postingsEnum,
PostingsEnum.NONE);
termDocId = -1;
while (docIterator.hasNext()) {
docId = docIterator.next() - lrc.docBase;
if ((docId >= termDocId) && ((docId.equals(termDocId))
|| ((termDocId = postingsEnum.advance(docId))
.equals(docId)))) {
collectionInfo.addValue(term.utf8ToString());
break;
}
if (termDocId.equals(PostingsEnum.NO_MORE_DOCS)) {
break;
}
}
}
}
}
}
}
} }
|
public class class_name {
public static void collectCollection(IndexReader reader, List<Integer> docSet,
ComponentCollection collectionInfo) throws IOException {
if (collectionInfo.action().equals(ComponentCollection.ACTION_CHECK)) {
// can't do anything in lucene for check
} else if (collectionInfo.action()
.equals(ComponentCollection.ACTION_LIST)) {
// can't do anything in lucene for list
} else if (collectionInfo.action()
.equals(ComponentCollection.ACTION_CREATE)) {
BytesRef term = null;
PostingsEnum postingsEnum = null;
Integer docId;
Integer termDocId = -1;
Terms terms;
LeafReaderContext lrc;
LeafReader r;
ListIterator<LeafReaderContext> iterator = reader.leaves().listIterator();
while (iterator.hasNext()) {
lrc = iterator.next(); // depends on control dependency: [while], data = [none]
r = lrc.reader(); // depends on control dependency: [while], data = [none]
for (String field : collectionInfo.fields()) {
if ((terms = r.terms(field)) != null) {
TermsEnum termsEnum = terms.iterator();
while ((term = termsEnum.next()) != null) {
Iterator<Integer> docIterator = docSet.iterator();
postingsEnum = termsEnum.postings(postingsEnum,
PostingsEnum.NONE); // depends on control dependency: [while], data = [none]
termDocId = -1; // depends on control dependency: [while], data = [none]
while (docIterator.hasNext()) {
docId = docIterator.next() - lrc.docBase; // depends on control dependency: [while], data = [none]
if ((docId >= termDocId) && ((docId.equals(termDocId))
|| ((termDocId = postingsEnum.advance(docId))
.equals(docId)))) {
collectionInfo.addValue(term.utf8ToString()); // depends on control dependency: [if], data = [none]
break;
}
if (termDocId.equals(PostingsEnum.NO_MORE_DOCS)) {
break;
}
}
}
}
}
}
}
} }
|
public class class_name {
public static ICompositeNode findActualNodeFor(/* @Nullable */ EObject semanticObject) {
ICompositeNode node = getNode(semanticObject);
if (node != null) {
while(GrammarUtil.containingAssignment(node.getGrammarElement()) == null) {
ICompositeNode parent = node.getParent();
if (parent != null && !parent.hasDirectSemanticElement() && !GrammarUtil.isEObjectFragmentRuleCall(parent.getGrammarElement())) {
node = parent;
} else {
break;
}
}
}
return node;
} }
|
public class class_name {
public static ICompositeNode findActualNodeFor(/* @Nullable */ EObject semanticObject) {
ICompositeNode node = getNode(semanticObject);
if (node != null) {
while(GrammarUtil.containingAssignment(node.getGrammarElement()) == null) {
ICompositeNode parent = node.getParent();
if (parent != null && !parent.hasDirectSemanticElement() && !GrammarUtil.isEObjectFragmentRuleCall(parent.getGrammarElement())) {
node = parent; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
}
return node;
} }
|
public class class_name {
public final ConnectFuture connect(SocketAddress remoteAddress,
SocketAddress localAddress, IoSessionInitializer<? extends ConnectFuture> sessionInitializer) {
if (isDisposing()) {
throw new IllegalStateException("Already disposed.");
}
if (remoteAddress == null) {
throw new NullPointerException("remoteAddress");
}
if (!getTransportMetadata().getAddressType().isAssignableFrom(
remoteAddress.getClass())) {
throw new IllegalArgumentException("remoteAddress type: "
+ remoteAddress.getClass() + " (expected: "
+ getTransportMetadata().getAddressType() + ")");
}
if (localAddress != null
&& !getTransportMetadata().getAddressType().isAssignableFrom(
localAddress.getClass())) {
throw new IllegalArgumentException("localAddress type: "
+ localAddress.getClass() + " (expected: "
+ getTransportMetadata().getAddressType() + ")");
}
if (getHandler() == null) {
if (getSessionConfig().isUseReadOperation()) {
setHandler(new IoHandler() {
public void exceptionCaught(IoSession session,
Throwable cause) throws Exception {
// Empty handler
}
public void messageReceived(IoSession session,
Object message) throws Exception {
// Empty handler
}
public void messageSent(IoSession session, Object message)
throws Exception {
// Empty handler
}
public void sessionClosed(IoSession session)
throws Exception {
// Empty handler
}
public void sessionCreated(IoSession session)
throws Exception {
// Empty handler
}
public void sessionIdle(IoSession session, IdleStatus status)
throws Exception {
// Empty handler
}
public void sessionOpened(IoSession session)
throws Exception {
// Empty handler
}
});
} else {
throw new IllegalStateException("handler is not set.");
}
}
return connect0(remoteAddress, localAddress, sessionInitializer);
} }
|
public class class_name {
public final ConnectFuture connect(SocketAddress remoteAddress,
SocketAddress localAddress, IoSessionInitializer<? extends ConnectFuture> sessionInitializer) {
if (isDisposing()) {
throw new IllegalStateException("Already disposed.");
}
if (remoteAddress == null) {
throw new NullPointerException("remoteAddress");
}
if (!getTransportMetadata().getAddressType().isAssignableFrom(
remoteAddress.getClass())) {
throw new IllegalArgumentException("remoteAddress type: "
+ remoteAddress.getClass() + " (expected: "
+ getTransportMetadata().getAddressType() + ")");
}
if (localAddress != null
&& !getTransportMetadata().getAddressType().isAssignableFrom(
localAddress.getClass())) {
throw new IllegalArgumentException("localAddress type: "
+ localAddress.getClass() + " (expected: "
+ getTransportMetadata().getAddressType() + ")");
}
if (getHandler() == null) {
if (getSessionConfig().isUseReadOperation()) {
setHandler(new IoHandler() {
public void exceptionCaught(IoSession session,
Throwable cause) throws Exception {
// Empty handler
}
public void messageReceived(IoSession session,
Object message) throws Exception {
// Empty handler
}
public void messageSent(IoSession session, Object message)
throws Exception {
// Empty handler
}
public void sessionClosed(IoSession session)
throws Exception {
// Empty handler
}
public void sessionCreated(IoSession session)
throws Exception {
// Empty handler
}
public void sessionIdle(IoSession session, IdleStatus status)
throws Exception {
// Empty handler
}
public void sessionOpened(IoSession session)
throws Exception {
// Empty handler
}
});
} else {
throw new IllegalStateException("handler is not set.");
}
}
return connect0(remoteAddress, localAddress, sessionInitializer); // depends on control dependency: [if], data = [none]
} }
|
public class class_name {
public void dismiss() {
if (!isShowing) {
Log.w("AlertWindow", "AlertWindow is not displayed.");
} else if (mContentView != null) {
isShowing = false;
mWindowManager.removeViewImmediate(mContentView);
}
} }
|
public class class_name {
public void dismiss() {
if (!isShowing) {
Log.w("AlertWindow", "AlertWindow is not displayed."); // depends on control dependency: [if], data = [none]
} else if (mContentView != null) {
isShowing = false; // depends on control dependency: [if], data = [none]
mWindowManager.removeViewImmediate(mContentView); // depends on control dependency: [if], data = [(mContentView]
}
} }
|
public class class_name {
@Override
public long getAllocatedMemory() {
long total = 0L;
for (MapInternals segment : segments) {
total += segment.getAllocatedMemory();
}
return total;
} }
|
public class class_name {
@Override
public long getAllocatedMemory() {
long total = 0L;
for (MapInternals segment : segments) {
total += segment.getAllocatedMemory(); // depends on control dependency: [for], data = [segment]
}
return total;
} }
|
public class class_name {
static String obfuscateCredentials(String originalUrl, HttpUrl parsedUrl) {
String username = parsedUrl.username();
String password = parsedUrl.password();
if (username.isEmpty() && password.isEmpty()) {
return originalUrl;
}
if (!username.isEmpty() && !password.isEmpty()) {
String encodedUsername = parsedUrl.encodedUsername();
String encodedPassword = parsedUrl.encodedPassword();
return Stream.<Supplier<String>>of(
() -> replaceOrDie(originalUrl, username, password),
() -> replaceOrDie(originalUrl, encodedUsername, encodedPassword),
() -> replaceOrDie(originalUrl, encodedUsername, password),
() -> replaceOrDie(originalUrl, username, encodedPassword))
.map(Supplier::get)
.filter(Objects::nonNull)
.findFirst()
.orElse(originalUrl);
}
if (!username.isEmpty()) {
return Stream.<Supplier<String>>of(
() -> replaceOrDie(originalUrl, username, null),
() -> replaceOrDie(originalUrl, parsedUrl.encodedUsername(), null))
.map(Supplier::get)
.filter(Objects::nonNull)
.findFirst()
.orElse(originalUrl);
}
checkState(password.isEmpty(), "having a password without a username should never occur");
return originalUrl;
} }
|
public class class_name {
static String obfuscateCredentials(String originalUrl, HttpUrl parsedUrl) {
String username = parsedUrl.username();
String password = parsedUrl.password();
if (username.isEmpty() && password.isEmpty()) {
return originalUrl; // depends on control dependency: [if], data = [none]
}
if (!username.isEmpty() && !password.isEmpty()) {
String encodedUsername = parsedUrl.encodedUsername();
String encodedPassword = parsedUrl.encodedPassword();
return Stream.<Supplier<String>>of(
() -> replaceOrDie(originalUrl, username, password),
() -> replaceOrDie(originalUrl, encodedUsername, encodedPassword),
() -> replaceOrDie(originalUrl, encodedUsername, password),
() -> replaceOrDie(originalUrl, username, encodedPassword))
.map(Supplier::get)
.filter(Objects::nonNull)
.findFirst()
.orElse(originalUrl); // depends on control dependency: [if], data = [none]
}
if (!username.isEmpty()) {
return Stream.<Supplier<String>>of(
() -> replaceOrDie(originalUrl, username, null),
() -> replaceOrDie(originalUrl, parsedUrl.encodedUsername(), null))
.map(Supplier::get)
.filter(Objects::nonNull)
.findFirst()
.orElse(originalUrl); // depends on control dependency: [if], data = [none]
}
checkState(password.isEmpty(), "having a password without a username should never occur");
return originalUrl;
} }
|
public class class_name {
public void doStop() {
try {
stopAutoStarter();
stopSafeModeContainer();
stopLevel234Containers();
stopLevel1Container();
currentLevel = null;
dbConnected = false;
started = false;
} catch (Exception e) {
LOGGER.error("Fail to stop server - ignored", e);
}
} }
|
public class class_name {
public void doStop() {
try {
stopAutoStarter(); // depends on control dependency: [try], data = [none]
stopSafeModeContainer(); // depends on control dependency: [try], data = [none]
stopLevel234Containers(); // depends on control dependency: [try], data = [none]
stopLevel1Container(); // depends on control dependency: [try], data = [none]
currentLevel = null; // depends on control dependency: [try], data = [none]
dbConnected = false; // depends on control dependency: [try], data = [none]
started = false; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.error("Fail to stop server - ignored", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setRegisterBlueprints(Collection blueprints) throws RegisterBlueprintException {
for (Object blueprint : blueprints) {
if (blueprint instanceof Class) {
registerBlueprint((Class) blueprint);
} else if (blueprint instanceof String) {
registerBlueprint((String) blueprint);
} else if (blueprint instanceof String) {
registerBlueprint(blueprint);
} else {
throw new RegisterBlueprintException("Only supports List comprised of Class<Blueprint>, Blueprint, or String className");
}
}
} }
|
public class class_name {
public void setRegisterBlueprints(Collection blueprints) throws RegisterBlueprintException {
for (Object blueprint : blueprints) {
if (blueprint instanceof Class) {
registerBlueprint((Class) blueprint); // depends on control dependency: [if], data = [none]
} else if (blueprint instanceof String) {
registerBlueprint((String) blueprint); // depends on control dependency: [if], data = [none]
} else if (blueprint instanceof String) {
registerBlueprint(blueprint); // depends on control dependency: [if], data = [none]
} else {
throw new RegisterBlueprintException("Only supports List comprised of Class<Blueprint>, Blueprint, or String className");
}
}
} }
|
public class class_name {
public static void setLogfile(Class<? extends IRTLogger> loggerClass,
File outputFile) throws FileNotFoundException
{
for (IRTLogger logger : loggers)
{
if (logger.getClass() == loggerClass)
{
logger.setLogfile(outputFile);
logger.dump(true); // Write out and close previous
}
}
enable(true);
} }
|
public class class_name {
public static void setLogfile(Class<? extends IRTLogger> loggerClass,
File outputFile) throws FileNotFoundException
{
for (IRTLogger logger : loggers)
{
if (logger.getClass() == loggerClass)
{
logger.setLogfile(outputFile); // depends on control dependency: [if], data = [none]
logger.dump(true); // Write out and close previous // depends on control dependency: [if], data = [none]
}
}
enable(true);
} }
|
public class class_name {
public List<Error> validate(Object target) {
DeleteItemRequest instance = (DeleteItemRequest) target;
List<Error> errors = ValidatorUtils.invokeValidator(new TableNameValidator(), instance.getTableName());
errors.addAll(ValidatorUtils.invokeValidator(new KeyValidator(), instance.getKey()));
if (instance.getExpected() != null) {
errors.addAll(ValidatorUtils.invokeValidator(new ExpectedValidator(), instance.getExpected()));
}
if (instance.getReturnValues() != null) {
errors.addAll(ValidatorUtils.rejectIfNotMatchRegex(instance.getReturnValues(), "^(NONE|ALL_OLD)$"));
}
return removeNulls(errors);
} }
|
public class class_name {
public List<Error> validate(Object target) {
DeleteItemRequest instance = (DeleteItemRequest) target;
List<Error> errors = ValidatorUtils.invokeValidator(new TableNameValidator(), instance.getTableName());
errors.addAll(ValidatorUtils.invokeValidator(new KeyValidator(), instance.getKey()));
if (instance.getExpected() != null) {
errors.addAll(ValidatorUtils.invokeValidator(new ExpectedValidator(), instance.getExpected())); // depends on control dependency: [if], data = [none]
}
if (instance.getReturnValues() != null) {
errors.addAll(ValidatorUtils.rejectIfNotMatchRegex(instance.getReturnValues(), "^(NONE|ALL_OLD)$")); // depends on control dependency: [if], data = [(instance.getReturnValues()]
}
return removeNulls(errors);
} }
|
public class class_name {
public void step() {
if (this.isSolved()) return;
explain = true;
session.setGlobal("explain", explain);
this.counter.setCount(1);
session.update(session.getFactHandle(this.counter), this.counter);
if( steppingFactHandle == null ){
steppingFactHandle = session.insert( stepping = new Stepping() );
}
this.session.fireUntilHalt();
if( stepping.isEmergency() ){
this.unsolvable = true;
}
// dumpGrid();
} }
|
public class class_name {
public void step() {
if (this.isSolved()) return;
explain = true;
session.setGlobal("explain", explain);
this.counter.setCount(1);
session.update(session.getFactHandle(this.counter), this.counter);
if( steppingFactHandle == null ){
steppingFactHandle = session.insert( stepping = new Stepping() ); // depends on control dependency: [if], data = [none]
}
this.session.fireUntilHalt();
if( stepping.isEmergency() ){
this.unsolvable = true; // depends on control dependency: [if], data = [none]
}
// dumpGrid();
} }
|
public class class_name {
public List<Double> getRDBEValue(IMolecularFormula formula) {
List<Double> RDBEList = new ArrayList<Double>();
// The number of combinations with repetition
// (v+n-1)!/[n!(v-1)!]
int nE = 0; // number of elements to change
List<Integer> nV = new ArrayList<Integer>(); // number of valence changing
for (Iterator<IIsotope> it = formula.isotopes().iterator(); it.hasNext();) {
IIsotope isotope = it.next();
int[] valence = getOxidationState(formula.getBuilder().newInstance(IAtom.class, isotope.getSymbol()));
if (valence.length != 1) {
for (int i = 0; i < valence.length; i++) {
nV.add(valence[i]);
}
nE += MolecularFormulaManipulator.getElementCount(formula,
formula.getBuilder().newInstance(IElement.class, isotope.getSymbol()));
}
}
double RDBE = 0;
if (nE == 0) {
for (Iterator<IIsotope> it = formula.isotopes().iterator(); it.hasNext();) {
IIsotope isotope = it.next();
int[] valence = getOxidationState(formula.getBuilder().newInstance(IAtom.class, isotope.getSymbol()));
double value = (valence[0] - 2) * formula.getIsotopeCount(isotope) / 2.0;
RDBE += value;
}
RDBE += 1;
RDBEList.add(RDBE);
} else {
double RDBE_1 = 0;
for (Iterator<IIsotope> it = formula.isotopes().iterator(); it.hasNext();) {
IIsotope isotope = it.next();
int[] valence = getOxidationState(formula.getBuilder().newInstance(IAtom.class, isotope.getSymbol()));
double value = (valence[0] - 2) * formula.getIsotopeCount(isotope) * 0.5;
RDBE_1 += value;
}
String[] valences = new String[nV.size()];
for (int i = 0; i < valences.length; i++)
valences[i] = Integer.toString(nV.get(i));
Combinations c = new Combinations(valences, nE);
while (c.hasMoreElements()) {
double RDBE_int = 0.0;
Object[] combo = (Object[]) c.nextElement();
for (int i = 0; i < combo.length; i++) {
int value = (Integer.parseInt((String) combo[i]) - 2) / 2;
RDBE_int += value;
}
RDBE = 1 + RDBE_1 + RDBE_int;
RDBEList.add(RDBE);
}
}
return RDBEList;
} }
|
public class class_name {
public List<Double> getRDBEValue(IMolecularFormula formula) {
List<Double> RDBEList = new ArrayList<Double>();
// The number of combinations with repetition
// (v+n-1)!/[n!(v-1)!]
int nE = 0; // number of elements to change
List<Integer> nV = new ArrayList<Integer>(); // number of valence changing
for (Iterator<IIsotope> it = formula.isotopes().iterator(); it.hasNext();) {
IIsotope isotope = it.next();
int[] valence = getOxidationState(formula.getBuilder().newInstance(IAtom.class, isotope.getSymbol()));
if (valence.length != 1) {
for (int i = 0; i < valence.length; i++) {
nV.add(valence[i]); // depends on control dependency: [for], data = [i]
}
nE += MolecularFormulaManipulator.getElementCount(formula,
formula.getBuilder().newInstance(IElement.class, isotope.getSymbol())); // depends on control dependency: [if], data = [none]
}
}
double RDBE = 0;
if (nE == 0) {
for (Iterator<IIsotope> it = formula.isotopes().iterator(); it.hasNext();) {
IIsotope isotope = it.next();
int[] valence = getOxidationState(formula.getBuilder().newInstance(IAtom.class, isotope.getSymbol()));
double value = (valence[0] - 2) * formula.getIsotopeCount(isotope) / 2.0;
RDBE += value; // depends on control dependency: [for], data = [none]
}
RDBE += 1; // depends on control dependency: [if], data = [none]
RDBEList.add(RDBE); // depends on control dependency: [if], data = [none]
} else {
double RDBE_1 = 0;
for (Iterator<IIsotope> it = formula.isotopes().iterator(); it.hasNext();) {
IIsotope isotope = it.next();
int[] valence = getOxidationState(formula.getBuilder().newInstance(IAtom.class, isotope.getSymbol()));
double value = (valence[0] - 2) * formula.getIsotopeCount(isotope) * 0.5;
RDBE_1 += value; // depends on control dependency: [for], data = [none]
}
String[] valences = new String[nV.size()];
for (int i = 0; i < valences.length; i++)
valences[i] = Integer.toString(nV.get(i));
Combinations c = new Combinations(valences, nE);
while (c.hasMoreElements()) {
double RDBE_int = 0.0;
Object[] combo = (Object[]) c.nextElement();
for (int i = 0; i < combo.length; i++) {
int value = (Integer.parseInt((String) combo[i]) - 2) / 2;
RDBE_int += value; // depends on control dependency: [for], data = [none]
}
RDBE = 1 + RDBE_1 + RDBE_int; // depends on control dependency: [while], data = [none]
RDBEList.add(RDBE); // depends on control dependency: [while], data = [none]
}
}
return RDBEList;
} }
|
public class class_name {
public static BufferedImage stripAlphaChannel( BufferedImage image ) {
int numBands = image.getRaster().getNumBands();
if( numBands == 4 ) {
BufferedImage output = new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_INT_RGB);
output.createGraphics().drawImage(image,0,0,null);
return output;
} else {
return image;
}
} }
|
public class class_name {
public static BufferedImage stripAlphaChannel( BufferedImage image ) {
int numBands = image.getRaster().getNumBands();
if( numBands == 4 ) {
BufferedImage output = new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_INT_RGB);
output.createGraphics().drawImage(image,0,0,null); // depends on control dependency: [if], data = [none]
return output; // depends on control dependency: [if], data = [none]
} else {
return image; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setReservedInstancesModifications(java.util.Collection<ReservedInstancesModification> reservedInstancesModifications) {
if (reservedInstancesModifications == null) {
this.reservedInstancesModifications = null;
return;
}
this.reservedInstancesModifications = new com.amazonaws.internal.SdkInternalList<ReservedInstancesModification>(reservedInstancesModifications);
} }
|
public class class_name {
public void setReservedInstancesModifications(java.util.Collection<ReservedInstancesModification> reservedInstancesModifications) {
if (reservedInstancesModifications == null) {
this.reservedInstancesModifications = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.reservedInstancesModifications = new com.amazonaws.internal.SdkInternalList<ReservedInstancesModification>(reservedInstancesModifications);
} }
|
public class class_name {
public static <T> List<T> filter( List<T> list, Filter<T>... filters )
{
if ( Arrays.isEmpty( filters ) ) {
return new ArrayList<T>( list );
}
return filterToList( list, filters );
} }
|
public class class_name {
public static <T> List<T> filter( List<T> list, Filter<T>... filters )
{
if ( Arrays.isEmpty( filters ) ) {
return new ArrayList<T>( list ); // depends on control dependency: [if], data = [none]
}
return filterToList( list, filters );
} }
|
public class class_name {
private Object convertReturnValue(Object result) {
if (boolean.class.isInstance(result) || result instanceof Boolean) {
return ScriptExtensionUtils.computeReturnObject(1, ((Boolean) result).booleanValue(), 0, 0.0, null);
} else if (long.class.isInstance(result)) {
return (Long) result;
} else if (int.class.isInstance(result) || result instanceof Integer) {
return new Long((Integer) result);
} else if (double.class.isInstance(result)) {
return (Double) result;
}
// String/Double/Long/Float
return result;
} }
|
public class class_name {
private Object convertReturnValue(Object result) {
if (boolean.class.isInstance(result) || result instanceof Boolean) {
return ScriptExtensionUtils.computeReturnObject(1, ((Boolean) result).booleanValue(), 0, 0.0, null); // depends on control dependency: [if], data = [none]
} else if (long.class.isInstance(result)) {
return (Long) result; // depends on control dependency: [if], data = [none]
} else if (int.class.isInstance(result) || result instanceof Integer) {
return new Long((Integer) result); // depends on control dependency: [if], data = [none]
} else if (double.class.isInstance(result)) {
return (Double) result; // depends on control dependency: [if], data = [none]
}
// String/Double/Long/Float
return result;
} }
|
public class class_name {
protected void addBreakpoint(final IDbgpSession session,
IVdmBreakpoint breakpoint) throws CoreException, DbgpException
{
final IDbgpCoreCommands commands = session.getCoreCommands();
DbgpBreakpointConfig config = createBreakpointConfig(breakpoint);
String id = null;
URI bpUri = null;
// map the outgoing uri if we're a line breakpoint
if (breakpoint instanceof IVdmLineBreakpoint)
{
IVdmLineBreakpoint bp = (IVdmLineBreakpoint) breakpoint;
bpUri = bpPathMapper.map(bp.getResourceURI());
}
// Type specific
if (breakpoint instanceof IVdmWatchpoint)
{
IVdmWatchpoint watchpoint = (IVdmWatchpoint) breakpoint;
config.setExpression(makeWatchpointExpression(watchpoint));
id = commands.setWatchBreakpoint(bpUri, watchpoint.getLineNumber(), config);
} else if (breakpoint instanceof IVdmMethodEntryBreakpoint)
{
IVdmMethodEntryBreakpoint entryBreakpoint = (IVdmMethodEntryBreakpoint) breakpoint;
if (entryBreakpoint.breakOnExit())
{
final String exitId = commands.setReturnBreakpoint(bpUri, entryBreakpoint.getMethodName(), config);
entryBreakpoint.setExitBreakpointId(exitId);
}
if (entryBreakpoint.breakOnEntry())
{
final String entryId = commands.setCallBreakpoint(bpUri, entryBreakpoint.getMethodName(), config);
entryBreakpoint.setEntryBreakpointId(entryId);
}
} else if (breakpoint instanceof IVdmLineBreakpoint)
{
IVdmLineBreakpoint lineBreakpoint = (IVdmLineBreakpoint) breakpoint;
if (VdmBreakpointUtils.isConditional(lineBreakpoint))
{
id = commands.setConditionalBreakpoint(bpUri, lineBreakpoint.getLineNumber(), config);
} else
{
id = commands.setLineBreakpoint(bpUri, lineBreakpoint.getLineNumber(), config);
}
}
// else if (breakpoint instanceof IVdmExceptionBreakpoint) {
// IVdmExceptionBreakpoint lineBreakpoint = (IVdmExceptionBreakpoint) breakpoint;
// id = commands.setExceptionBreakpoint(lineBreakpoint.getTypeName(),
// config);
// }
// Identifier
breakpoint.setId(session, id);
} }
|
public class class_name {
protected void addBreakpoint(final IDbgpSession session,
IVdmBreakpoint breakpoint) throws CoreException, DbgpException
{
final IDbgpCoreCommands commands = session.getCoreCommands();
DbgpBreakpointConfig config = createBreakpointConfig(breakpoint);
String id = null;
URI bpUri = null;
// map the outgoing uri if we're a line breakpoint
if (breakpoint instanceof IVdmLineBreakpoint)
{
IVdmLineBreakpoint bp = (IVdmLineBreakpoint) breakpoint;
bpUri = bpPathMapper.map(bp.getResourceURI());
}
// Type specific
if (breakpoint instanceof IVdmWatchpoint)
{
IVdmWatchpoint watchpoint = (IVdmWatchpoint) breakpoint;
config.setExpression(makeWatchpointExpression(watchpoint));
id = commands.setWatchBreakpoint(bpUri, watchpoint.getLineNumber(), config);
} else if (breakpoint instanceof IVdmMethodEntryBreakpoint)
{
IVdmMethodEntryBreakpoint entryBreakpoint = (IVdmMethodEntryBreakpoint) breakpoint;
if (entryBreakpoint.breakOnExit())
{
final String exitId = commands.setReturnBreakpoint(bpUri, entryBreakpoint.getMethodName(), config);
entryBreakpoint.setExitBreakpointId(exitId); // depends on control dependency: [if], data = [none]
}
if (entryBreakpoint.breakOnEntry())
{
final String entryId = commands.setCallBreakpoint(bpUri, entryBreakpoint.getMethodName(), config);
entryBreakpoint.setEntryBreakpointId(entryId); // depends on control dependency: [if], data = [none]
}
} else if (breakpoint instanceof IVdmLineBreakpoint)
{
IVdmLineBreakpoint lineBreakpoint = (IVdmLineBreakpoint) breakpoint;
if (VdmBreakpointUtils.isConditional(lineBreakpoint))
{
id = commands.setConditionalBreakpoint(bpUri, lineBreakpoint.getLineNumber(), config); // depends on control dependency: [if], data = [none]
} else
{
id = commands.setLineBreakpoint(bpUri, lineBreakpoint.getLineNumber(), config); // depends on control dependency: [if], data = [none]
}
}
// else if (breakpoint instanceof IVdmExceptionBreakpoint) {
// IVdmExceptionBreakpoint lineBreakpoint = (IVdmExceptionBreakpoint) breakpoint;
// id = commands.setExceptionBreakpoint(lineBreakpoint.getTypeName(),
// config);
// }
// Identifier
breakpoint.setId(session, id);
} }
|
public class class_name {
public void setUUID(String id) {
try {
this.value = (id != null) ? UUID.fromString(id) : null;
} catch (Throwable exception) {
assert id != null;
this.value = UUID.nameUUIDFromBytes(id.getBytes());
}
this.type = AttributeType.UUID;
this.assigned = this.value != null;
} }
|
public class class_name {
public void setUUID(String id) {
try {
this.value = (id != null) ? UUID.fromString(id) : null; // depends on control dependency: [try], data = [none]
} catch (Throwable exception) {
assert id != null;
this.value = UUID.nameUUIDFromBytes(id.getBytes());
} // depends on control dependency: [catch], data = [none]
this.type = AttributeType.UUID;
this.assigned = this.value != null;
} }
|
public class class_name {
public static void add() {
String current = System.getProperties().getProperty(HANDLER_PKGS, "");
if (current.length() > 0) {
if (current.contains(PKG)) {
return;
}
current = current + "|";
}
System.getProperties().put(HANDLER_PKGS, current + PKG);
} }
|
public class class_name {
public static void add() {
String current = System.getProperties().getProperty(HANDLER_PKGS, "");
if (current.length() > 0) {
if (current.contains(PKG)) {
return; // depends on control dependency: [if], data = [none]
}
current = current + "|"; // depends on control dependency: [if], data = [none]
}
System.getProperties().put(HANDLER_PKGS, current + PKG);
} }
|
public class class_name {
public static boolean isValidRandomIdentifier( String identifier ) {
if (identifier.length() == UUID_LENGTH) {
// It's the right length, but see if it's a UUID ...
try {
UUID.fromString(identifier);
return true;
} catch (IllegalArgumentException e) {
// Nope
return false;
}
}
return false;
} }
|
public class class_name {
public static boolean isValidRandomIdentifier( String identifier ) {
if (identifier.length() == UUID_LENGTH) {
// It's the right length, but see if it's a UUID ...
try {
UUID.fromString(identifier); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
// Nope
return false;
} // depends on control dependency: [catch], data = [none]
}
return false;
} }
|
public class class_name {
public void marshall(CreateGlobalTableRequest createGlobalTableRequest, ProtocolMarshaller protocolMarshaller) {
if (createGlobalTableRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createGlobalTableRequest.getGlobalTableName(), GLOBALTABLENAME_BINDING);
protocolMarshaller.marshall(createGlobalTableRequest.getReplicationGroup(), REPLICATIONGROUP_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CreateGlobalTableRequest createGlobalTableRequest, ProtocolMarshaller protocolMarshaller) {
if (createGlobalTableRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createGlobalTableRequest.getGlobalTableName(), GLOBALTABLENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createGlobalTableRequest.getReplicationGroup(), REPLICATIONGROUP_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 PageSnapshot highlightWithText(WebElement element, String text) {
try {
highlightWithText(element, Color.red, 3, text, Color.red, new Font("Serif", Font.BOLD, 20));
} catch (RasterFormatException rfe) {
throw new ElementOutsideViewportException(ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE, rfe);
}
return this;
} }
|
public class class_name {
public PageSnapshot highlightWithText(WebElement element, String text) {
try {
highlightWithText(element, Color.red, 3, text, Color.red, new Font("Serif", Font.BOLD, 20)); // depends on control dependency: [try], data = [none]
} catch (RasterFormatException rfe) {
throw new ElementOutsideViewportException(ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE, rfe);
} // depends on control dependency: [catch], data = [none]
return this;
} }
|
public class class_name {
private void configure(ModelMapper modelMapper) {
if (configurers != null) {
for (ModelMapperConfigurer modelMapperConfigurer : configurers) {
modelMapperConfigurer.configure(modelMapper);
}
}
} }
|
public class class_name {
private void configure(ModelMapper modelMapper) {
if (configurers != null) {
for (ModelMapperConfigurer modelMapperConfigurer : configurers) {
modelMapperConfigurer.configure(modelMapper); // depends on control dependency: [for], data = [modelMapperConfigurer]
}
}
} }
|
public class class_name {
public static String objectId(Object o) {
if (o == null) {
return "null";
} else {
return o.getClass().getName() + "@" + System.identityHashCode(o);
}
} }
|
public class class_name {
public static String objectId(Object o) {
if (o == null) {
return "null"; // depends on control dependency: [if], data = [none]
} else {
return o.getClass().getName() + "@" + System.identityHashCode(o); // depends on control dependency: [if], data = [(o]
}
} }
|
public class class_name {
private ImmutableList<Node> getCallParams(Node n) {
Preconditions.checkArgument(n.isCall(), "Expected a call node, found %s", n);
ImmutableList.Builder<Node> builder = new ImmutableList.Builder<>();
for (int i = 0; i < getCallParamCount(n); i++) {
builder.add(getCallArgument(n, i));
}
return builder.build();
} }
|
public class class_name {
private ImmutableList<Node> getCallParams(Node n) {
Preconditions.checkArgument(n.isCall(), "Expected a call node, found %s", n);
ImmutableList.Builder<Node> builder = new ImmutableList.Builder<>();
for (int i = 0; i < getCallParamCount(n); i++) {
builder.add(getCallArgument(n, i)); // depends on control dependency: [for], data = [i]
}
return builder.build();
} }
|
public class class_name {
public ScatteredConsistentHash union(ScatteredConsistentHash sch2) {
checkSameHashAndSegments(sch2);
List<Address> unionMembers = new ArrayList<>(this.members);
mergeLists(unionMembers, sch2.getMembers());
Address[] unionSegmentOwners = new Address[segmentOwners.length];
for (int i = 0; i < unionSegmentOwners.length; i++) {
unionSegmentOwners[i] = Optional.ofNullable(sch2.locatePrimaryOwnerForSegment(i)).orElse(locatePrimaryOwnerForSegment(i));
}
Map<Address, Float> unionCapacityFactors = unionCapacityFactors(sch2);
return new ScatteredConsistentHash(hashFunction, unionSegmentOwners.length, unionMembers, unionCapacityFactors, unionSegmentOwners, false);
} }
|
public class class_name {
public ScatteredConsistentHash union(ScatteredConsistentHash sch2) {
checkSameHashAndSegments(sch2);
List<Address> unionMembers = new ArrayList<>(this.members);
mergeLists(unionMembers, sch2.getMembers());
Address[] unionSegmentOwners = new Address[segmentOwners.length];
for (int i = 0; i < unionSegmentOwners.length; i++) {
unionSegmentOwners[i] = Optional.ofNullable(sch2.locatePrimaryOwnerForSegment(i)).orElse(locatePrimaryOwnerForSegment(i)); // depends on control dependency: [for], data = [i]
}
Map<Address, Float> unionCapacityFactors = unionCapacityFactors(sch2);
return new ScatteredConsistentHash(hashFunction, unionSegmentOwners.length, unionMembers, unionCapacityFactors, unionSegmentOwners, false);
} }
|
public class class_name {
private void closeFileObject(String typeName, FileObject fileObject) {
/*
* If typeName is non-null, the file object was opened as a
* source or class file by the user. If a file was opened as
* a resource, typeName will be null and the file is *not*
* subject to annotation processing.
*/
if ((typeName != null)) {
if (!(fileObject instanceof JavaFileObject))
throw new AssertionError("JavaFileOject not found for " + fileObject);
JavaFileObject javaFileObject = (JavaFileObject)fileObject;
switch(javaFileObject.getKind()) {
case SOURCE:
generatedSourceNames.add(typeName);
generatedSourceFileObjects.add(javaFileObject);
openTypeNames.remove(typeName);
break;
case CLASS:
generatedClasses.put(typeName, javaFileObject);
openTypeNames.remove(typeName);
break;
default:
break;
}
}
} }
|
public class class_name {
private void closeFileObject(String typeName, FileObject fileObject) {
/*
* If typeName is non-null, the file object was opened as a
* source or class file by the user. If a file was opened as
* a resource, typeName will be null and the file is *not*
* subject to annotation processing.
*/
if ((typeName != null)) {
if (!(fileObject instanceof JavaFileObject))
throw new AssertionError("JavaFileOject not found for " + fileObject);
JavaFileObject javaFileObject = (JavaFileObject)fileObject;
switch(javaFileObject.getKind()) {
case SOURCE:
generatedSourceNames.add(typeName); // depends on control dependency: [if], data = [none]
generatedSourceFileObjects.add(javaFileObject); // depends on control dependency: [if], data = [none]
openTypeNames.remove(typeName); // depends on control dependency: [if], data = [none]
break;
case CLASS:
generatedClasses.put(typeName, javaFileObject);
openTypeNames.remove(typeName); // depends on control dependency: [if], data = [none]
break;
default:
break;
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private void verifyBeanValidation(Object as) throws Exception
{
if (beanValidation != null)
{
ValidatorFactory vf = null;
try
{
vf = beanValidation.getValidatorFactory();
Validator v = vf.getValidator();
Collection<String> l = bvGroups;
if (l == null || l.isEmpty())
l = Arrays.asList(javax.validation.groups.Default.class.getName());
Collection<Class<?>> groups = new ArrayList<>();
for (String clz : l)
{
groups.add(Class.forName(clz, true, resourceAdapter.getClass().getClassLoader()));
}
Set failures = v.validate(as, groups.toArray(new Class<?>[groups.size()]));
if (!failures.isEmpty())
{
throw new ConstraintViolationException("Violation for " + as, failures);
}
}
finally
{
if (vf != null)
vf.close();
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private void verifyBeanValidation(Object as) throws Exception
{
if (beanValidation != null)
{
ValidatorFactory vf = null;
try
{
vf = beanValidation.getValidatorFactory();
Validator v = vf.getValidator();
Collection<String> l = bvGroups;
if (l == null || l.isEmpty())
l = Arrays.asList(javax.validation.groups.Default.class.getName());
Collection<Class<?>> groups = new ArrayList<>();
for (String clz : l)
{
groups.add(Class.forName(clz, true, resourceAdapter.getClass().getClassLoader())); // depends on control dependency: [for], data = [clz]
}
Set failures = v.validate(as, groups.toArray(new Class<?>[groups.size()]));
if (!failures.isEmpty())
{
throw new ConstraintViolationException("Violation for " + as, failures);
}
}
finally
{
if (vf != null)
vf.close();
}
}
} }
|
public class class_name {
public static void set(MutableDoubleTuple t, double v)
{
for (int i=0; i<t.getSize(); i++)
{
t.set(i, v);
}
} }
|
public class class_name {
public static void set(MutableDoubleTuple t, double v)
{
for (int i=0; i<t.getSize(); i++)
{
t.set(i, v);
// depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public static IDocTypeProcessor unwrap(final IDocTypeProcessor processor) {
if (processor == null) {
return null;
}
if (processor instanceof AbstractProcessorWrapper) {
return (IDocTypeProcessor)((AbstractProcessorWrapper) processor).unwrap();
}
return processor;
} }
|
public class class_name {
public static IDocTypeProcessor unwrap(final IDocTypeProcessor processor) {
if (processor == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (processor instanceof AbstractProcessorWrapper) {
return (IDocTypeProcessor)((AbstractProcessorWrapper) processor).unwrap(); // depends on control dependency: [if], data = [none]
}
return processor;
} }
|
public class class_name {
public void marshall(UnclaimDeviceRequest unclaimDeviceRequest, ProtocolMarshaller protocolMarshaller) {
if (unclaimDeviceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(unclaimDeviceRequest.getDeviceId(), DEVICEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UnclaimDeviceRequest unclaimDeviceRequest, ProtocolMarshaller protocolMarshaller) {
if (unclaimDeviceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(unclaimDeviceRequest.getDeviceId(), DEVICEID_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 sendHandshakeResponse(HandshakeResponse wsResponse) {
log.debug("Writing handshake on session: {}", session.getId());
// create write future
handshakeWriteFuture = session.write(wsResponse);
handshakeWriteFuture.addListener(new IoFutureListener<WriteFuture>() {
@Override
public void operationComplete(WriteFuture future) {
IoSession sess = future.getSession();
if (future.isWritten()) {
// handshake is finished
log.debug("Handshake write success! {}", sess.getId());
// set completed flag
sess.setAttribute(Constants.HANDSHAKE_COMPLETE);
// set connected state on ws connection
if (connected.compareAndSet(false, true)) {
try {
// send queued packets
queue.forEach(entry -> {
sess.write(entry);
queue.remove(entry);
});
} catch (Exception e) {
log.warn("Exception draining queued packets on session: {}", sess.getId(), e);
}
}
} else {
log.warn("Handshake write failed from: {} to: {}", sess.getLocalAddress(), sess.getRemoteAddress());
}
}
});
} }
|
public class class_name {
public void sendHandshakeResponse(HandshakeResponse wsResponse) {
log.debug("Writing handshake on session: {}", session.getId());
// create write future
handshakeWriteFuture = session.write(wsResponse);
handshakeWriteFuture.addListener(new IoFutureListener<WriteFuture>() {
@Override
public void operationComplete(WriteFuture future) {
IoSession sess = future.getSession();
if (future.isWritten()) {
// handshake is finished
log.debug("Handshake write success! {}", sess.getId()); // depends on control dependency: [if], data = [none]
// set completed flag
sess.setAttribute(Constants.HANDSHAKE_COMPLETE); // depends on control dependency: [if], data = [none]
// set connected state on ws connection
if (connected.compareAndSet(false, true)) {
try {
// send queued packets
queue.forEach(entry -> {
sess.write(entry); // depends on control dependency: [try], data = [none]
queue.remove(entry); // depends on control dependency: [try], data = [none]
});
} catch (Exception e) {
log.warn("Exception draining queued packets on session: {}", sess.getId(), e);
} // depends on control dependency: [catch], data = [none]
}
} else {
log.warn("Handshake write failed from: {} to: {}", sess.getLocalAddress(), sess.getRemoteAddress()); // depends on control dependency: [if], data = [none]
}
}
});
} }
|
public class class_name {
public static Properties initialize(URI uri, Configuration conf) throws IOException,
ConfigurationParseException {
String host = Utils.getHost(uri);
Properties props = new Properties();
if (!Utils.validSchema(uri)) {
props.setProperty(SWIFT_AUTH_METHOD_PROPERTY, PUBLIC_ACCESS);
} else {
final String container = Utils.getContainerName(host);
final String service = Utils.getServiceName(host);
final String[] prefix = new String[]{SWIFT_SERVICE_PREFIX + service};
final String prefix2D = SWIFT2D_SERVICE_PREFIX + service;
props.setProperty(SWIFT_CONTAINER_PROPERTY, container);
Utils.updateProperty(conf, prefix2D, prefix, AUTH_URL, props, SWIFT_AUTH_PROPERTY, true);
Utils.updateProperty(conf, prefix2D, prefix, USERNAME, props, SWIFT_USERNAME_PROPERTY, true);
Utils.updateProperty(conf, prefix2D, prefix, PASSWORD, props, SWIFT_PASSWORD_PROPERTY, true);
Utils.updateProperty(conf, prefix2D, prefix, BUFFER_DIR, props, BUFFER_DIR_PROPERTY, false);
Utils.updateProperty(conf, prefix2D, prefix, NON_STREAMING_UPLOAD, props,
NON_STREAMING_UPLOAD_PROPERTY, false);
Utils.updateProperty(conf, prefix2D, prefix, AUTH_METHOD, props, SWIFT_AUTH_METHOD_PROPERTY,
false);
Utils.updateProperty(conf, prefix2D, prefix, BLOCK_SIZE, props, SWIFT_BLOCK_SIZE_PROPERTY,
false);
Utils.updateProperty(conf, prefix2D, prefix, FMODE_DELETE_TEMP_DATA, props,
FMODE_AUTOMATIC_DELETE_PROPERTY, false);
Utils.updateProperty(conf, prefix2D, prefix, PUBLIC, props, SWIFT_PUBLIC_PROPERTY, false);
String authMethod = props.getProperty(SWIFT_AUTH_METHOD_PROPERTY, KEYSTONE_V3_AUTH);
props.setProperty(SWIFT_AUTH_METHOD_PROPERTY, authMethod);
if (authMethod.equals(KEYSTONE_V3_AUTH)) {
Utils.updateProperty(conf, prefix2D, prefix, TENANT, props, SWIFT_TENANT_PROPERTY, false);
Utils.updateProperty(conf, prefix2D, prefix, REGION, props, SWIFT_REGION_PROPERTY, true);
props.setProperty(SWIFT_PROJECT_ID_PROPERTY, props.getProperty(SWIFT_TENANT_PROPERTY));
props.setProperty(SWIFT_USER_ID_PROPERTY, props.getProperty(SWIFT_USERNAME_PROPERTY));
} else if (authMethod.equals("basic")) {
Utils.updateProperty(conf, prefix2D, prefix, REGION, props, SWIFT_REGION_PROPERTY, false);
Utils.updateProperty(conf, prefix2D, prefix, TENANT, props, SWIFT_TENANT_PROPERTY, false);
} else {
Utils.updateProperty(conf, prefix2D, prefix, REGION, props, SWIFT_REGION_PROPERTY, false);
Utils.updateProperty(conf, prefix2D, prefix, TENANT, props, SWIFT_TENANT_PROPERTY, true);
}
}
return props;
} }
|
public class class_name {
public static Properties initialize(URI uri, Configuration conf) throws IOException,
ConfigurationParseException {
String host = Utils.getHost(uri);
Properties props = new Properties();
if (!Utils.validSchema(uri)) {
props.setProperty(SWIFT_AUTH_METHOD_PROPERTY, PUBLIC_ACCESS);
} else {
final String container = Utils.getContainerName(host);
final String service = Utils.getServiceName(host);
final String[] prefix = new String[]{SWIFT_SERVICE_PREFIX + service};
final String prefix2D = SWIFT2D_SERVICE_PREFIX + service;
props.setProperty(SWIFT_CONTAINER_PROPERTY, container);
Utils.updateProperty(conf, prefix2D, prefix, AUTH_URL, props, SWIFT_AUTH_PROPERTY, true);
Utils.updateProperty(conf, prefix2D, prefix, USERNAME, props, SWIFT_USERNAME_PROPERTY, true);
Utils.updateProperty(conf, prefix2D, prefix, PASSWORD, props, SWIFT_PASSWORD_PROPERTY, true);
Utils.updateProperty(conf, prefix2D, prefix, BUFFER_DIR, props, BUFFER_DIR_PROPERTY, false);
Utils.updateProperty(conf, prefix2D, prefix, NON_STREAMING_UPLOAD, props,
NON_STREAMING_UPLOAD_PROPERTY, false);
Utils.updateProperty(conf, prefix2D, prefix, AUTH_METHOD, props, SWIFT_AUTH_METHOD_PROPERTY,
false);
Utils.updateProperty(conf, prefix2D, prefix, BLOCK_SIZE, props, SWIFT_BLOCK_SIZE_PROPERTY,
false);
Utils.updateProperty(conf, prefix2D, prefix, FMODE_DELETE_TEMP_DATA, props,
FMODE_AUTOMATIC_DELETE_PROPERTY, false);
Utils.updateProperty(conf, prefix2D, prefix, PUBLIC, props, SWIFT_PUBLIC_PROPERTY, false);
String authMethod = props.getProperty(SWIFT_AUTH_METHOD_PROPERTY, KEYSTONE_V3_AUTH);
props.setProperty(SWIFT_AUTH_METHOD_PROPERTY, authMethod);
if (authMethod.equals(KEYSTONE_V3_AUTH)) {
Utils.updateProperty(conf, prefix2D, prefix, TENANT, props, SWIFT_TENANT_PROPERTY, false); // depends on control dependency: [if], data = [none]
Utils.updateProperty(conf, prefix2D, prefix, REGION, props, SWIFT_REGION_PROPERTY, true); // depends on control dependency: [if], data = [none]
props.setProperty(SWIFT_PROJECT_ID_PROPERTY, props.getProperty(SWIFT_TENANT_PROPERTY)); // depends on control dependency: [if], data = [none]
props.setProperty(SWIFT_USER_ID_PROPERTY, props.getProperty(SWIFT_USERNAME_PROPERTY)); // depends on control dependency: [if], data = [none]
} else if (authMethod.equals("basic")) {
Utils.updateProperty(conf, prefix2D, prefix, REGION, props, SWIFT_REGION_PROPERTY, false); // depends on control dependency: [if], data = [none]
Utils.updateProperty(conf, prefix2D, prefix, TENANT, props, SWIFT_TENANT_PROPERTY, false); // depends on control dependency: [if], data = [none]
} else {
Utils.updateProperty(conf, prefix2D, prefix, REGION, props, SWIFT_REGION_PROPERTY, false); // depends on control dependency: [if], data = [none]
Utils.updateProperty(conf, prefix2D, prefix, TENANT, props, SWIFT_TENANT_PROPERTY, true); // depends on control dependency: [if], data = [none]
}
}
return props;
} }
|
public class class_name {
@Override
public void exists(final Runnable runnable) {
StringBuilder sql = new StringBuilder("select 1 from (")
.append(System.lineSeparator())
.append(aggregationSourceSql())
.append(System.lineSeparator())
.append(") t_");
context().setSql(sql.toString());
try (ResultSet rs = agent().query(context())) {
if (rs.next()) {
runnable.run();
}
} catch (final SQLException e) {
throw new EntitySqlRuntimeException(SqlKind.SELECT, e);
}
} }
|
public class class_name {
@Override
public void exists(final Runnable runnable) {
StringBuilder sql = new StringBuilder("select 1 from (")
.append(System.lineSeparator())
.append(aggregationSourceSql())
.append(System.lineSeparator())
.append(") t_");
context().setSql(sql.toString());
try (ResultSet rs = agent().query(context())) {
if (rs.next()) {
runnable.run(); // depends on control dependency: [if], data = [none]
}
} catch (final SQLException e) {
throw new EntitySqlRuntimeException(SqlKind.SELECT, e);
}
} }
|
public class class_name {
public static Type getFieldType(Class<?> containingClass, String fieldName) {
String suffix = // uppercase first letter
fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
// look for getFieldName() or isFieldName()
for(String prefix : new String[]{"get", "is"}) {
try {
Method method = containingClass.getDeclaredMethod(prefix + suffix);
return method.getGenericReturnType();
} catch (NoSuchMethodException e) {
}
}
// look for bean style accessors get_fieldName and is_fieldName
for(String prefix : new String[]{"get_", "is_"}) {
try {
Method method = containingClass.getDeclaredMethod(prefix + fieldName);
return method.getGenericReturnType();
} catch (NoSuchMethodException e) {
}
}
throw new RuntimeException("could not find type for " + fieldName +
" in " + containingClass);
} }
|
public class class_name {
public static Type getFieldType(Class<?> containingClass, String fieldName) {
String suffix = // uppercase first letter
fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
// look for getFieldName() or isFieldName()
for(String prefix : new String[]{"get", "is"}) {
try {
Method method = containingClass.getDeclaredMethod(prefix + suffix);
return method.getGenericReturnType(); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
} // depends on control dependency: [catch], data = [none]
}
// look for bean style accessors get_fieldName and is_fieldName
for(String prefix : new String[]{"get_", "is_"}) {
try {
Method method = containingClass.getDeclaredMethod(prefix + fieldName);
return method.getGenericReturnType(); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
} // depends on control dependency: [catch], data = [none]
}
throw new RuntimeException("could not find type for " + fieldName +
" in " + containingClass);
} }
|
public class class_name {
public static int getPort(String uriString) {
try {
return (new URI(uriString)).getPort();
}
catch (URISyntaxException e) {
try {
return (new NetworkInterfaceURI(uriString)).getPort();
}
catch (IllegalArgumentException ne) {
throw new IllegalArgumentException(ne.getMessage(), ne);
}
}
} }
|
public class class_name {
public static int getPort(String uriString) {
try {
return (new URI(uriString)).getPort(); // depends on control dependency: [try], data = [none]
}
catch (URISyntaxException e) {
try {
return (new NetworkInterfaceURI(uriString)).getPort(); // depends on control dependency: [try], data = [none]
}
catch (IllegalArgumentException ne) {
throw new IllegalArgumentException(ne.getMessage(), ne);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
void joinGroup(String niName) throws TransportConfigException {
InetSocketAddress socketAddress = new InetSocketAddress(multicastAddress, multicastPort);
try {
// Setup for incoming multicast requests
InetAddress maddress = InetAddress.getByName(multicastAddress);
if (niName != null)
networkInterface = NetworkInterface.getByName(niName);
if (networkInterface == null) {
InetAddress localhost = InetAddress.getLocalHost();
LOGGER.debug("Network Interface name not specified. Using the NI for localhost " + localhost.getHostAddress());
networkInterface = NetworkInterface.getByInetAddress(localhost);
}
this.outboundSocket = new MulticastSocket(multicastPort);
if (networkInterface == null) {
// for some reason NI is still NULL. Not sure why this happens.
this.outboundSocket.joinGroup(maddress);
LOGGER.warn("Unable to determine the network interface for the localhost address. Check /etc/hosts for weird entry like 127.0.1.1 mapped to DNS name.");
LOGGER.info("Unknown network interface joined group " + socketAddress.toString());
} else {
this.outboundSocket.joinGroup(socketAddress, networkInterface);
LOGGER.info(networkInterface.getName() + " joined group " + socketAddress.toString());
}
} catch (IOException e) {
if (networkInterface == null) {
throw new TransportConfigException("Error attempting to joint multicast address: ", e);
} else {
StringBuffer buf = new StringBuffer();
try {
buf.append("(lb:" + networkInterface.isLoopback() + " ");
} catch (SocketException e2) {
buf.append("(lb:err ");
}
try {
buf.append("m:" + networkInterface.supportsMulticast() + " ");
} catch (SocketException e3) {
buf.append("(m:err ");
}
try {
buf.append("p2p:" + networkInterface.isPointToPoint() + " ");
} catch (SocketException e1) {
buf.append("p2p:err ");
}
try {
buf.append("up:" + networkInterface.isUp() + " ");
} catch (SocketException e1) {
buf.append("up:err ");
}
buf.append("v:" + networkInterface.isVirtual() + ") ");
throw new TransportConfigException(networkInterface.getName() + " " + buf.toString() + ": could not join group " + socketAddress.toString(), e);
}
}
} }
|
public class class_name {
void joinGroup(String niName) throws TransportConfigException {
InetSocketAddress socketAddress = new InetSocketAddress(multicastAddress, multicastPort);
try {
// Setup for incoming multicast requests
InetAddress maddress = InetAddress.getByName(multicastAddress);
if (niName != null)
networkInterface = NetworkInterface.getByName(niName);
if (networkInterface == null) {
InetAddress localhost = InetAddress.getLocalHost();
LOGGER.debug("Network Interface name not specified. Using the NI for localhost " + localhost.getHostAddress()); // depends on control dependency: [if], data = [none]
networkInterface = NetworkInterface.getByInetAddress(localhost); // depends on control dependency: [if], data = [none]
}
this.outboundSocket = new MulticastSocket(multicastPort);
if (networkInterface == null) {
// for some reason NI is still NULL. Not sure why this happens.
this.outboundSocket.joinGroup(maddress); // depends on control dependency: [if], data = [none]
LOGGER.warn("Unable to determine the network interface for the localhost address. Check /etc/hosts for weird entry like 127.0.1.1 mapped to DNS name."); // depends on control dependency: [if], data = [none]
LOGGER.info("Unknown network interface joined group " + socketAddress.toString()); // depends on control dependency: [if], data = [none]
} else {
this.outboundSocket.joinGroup(socketAddress, networkInterface); // depends on control dependency: [if], data = [none]
LOGGER.info(networkInterface.getName() + " joined group " + socketAddress.toString()); // depends on control dependency: [if], data = [(networkInterface]
}
} catch (IOException e) {
if (networkInterface == null) {
throw new TransportConfigException("Error attempting to joint multicast address: ", e);
} else {
StringBuffer buf = new StringBuffer();
try {
buf.append("(lb:" + networkInterface.isLoopback() + " ");
} catch (SocketException e2) {
buf.append("(lb:err ");
}
try {
buf.append("m:" + networkInterface.supportsMulticast() + " ");
} catch (SocketException e3) {
buf.append("(m:err ");
}
try {
buf.append("p2p:" + networkInterface.isPointToPoint() + " ");
} catch (SocketException e1) {
buf.append("p2p:err ");
}
try {
buf.append("up:" + networkInterface.isUp() + " ");
} catch (SocketException e1) {
buf.append("up:err ");
}
buf.append("v:" + networkInterface.isVirtual() + ") ");
throw new TransportConfigException(networkInterface.getName() + " " + buf.toString() + ": could not join group " + socketAddress.toString(), e);
}
}
} }
|
public class class_name {
public IRenderingElement generate(IBond currentBond, RendererModel model) {
IRing ring = RingSetManipulator.getHeaviestRing(ringSet, currentBond);
if (ring != null) {
return generateRingElements(currentBond, ring, model);
} else {
return generateBond(currentBond, model);
}
} }
|
public class class_name {
public IRenderingElement generate(IBond currentBond, RendererModel model) {
IRing ring = RingSetManipulator.getHeaviestRing(ringSet, currentBond);
if (ring != null) {
return generateRingElements(currentBond, ring, model); // depends on control dependency: [if], data = [none]
} else {
return generateBond(currentBond, model); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String decamelize(String s) {
if (isEmpty(s)) {
return s;
}
int length = s.length();
StringBuilder buf = new StringBuilder(length);
for (int i = 0; i < length - 1; i++) {
if (Character.isLowerCase(s.charAt(i)) && Character.isUpperCase(s.charAt(i + 1))) {
buf.append(s.charAt(i));
buf.append('_');
} else {
buf.append(s.charAt(i));
}
}
buf.append(s.charAt(length - 1));
return buf.toString().toUpperCase();
} }
|
public class class_name {
public static String decamelize(String s) {
if (isEmpty(s)) {
return s; // depends on control dependency: [if], data = [none]
}
int length = s.length();
StringBuilder buf = new StringBuilder(length);
for (int i = 0; i < length - 1; i++) {
if (Character.isLowerCase(s.charAt(i)) && Character.isUpperCase(s.charAt(i + 1))) {
buf.append(s.charAt(i)); // depends on control dependency: [if], data = [none]
buf.append('_'); // depends on control dependency: [if], data = [none]
} else {
buf.append(s.charAt(i)); // depends on control dependency: [if], data = [none]
}
}
buf.append(s.charAt(length - 1));
return buf.toString().toUpperCase();
} }
|
public class class_name {
public void registerJsonBeanProcessor( Class target, JsonBeanProcessor jsonBeanProcessor ) {
if( target != null && jsonBeanProcessor != null ) {
beanProcessorMap.put( target, jsonBeanProcessor );
}
} }
|
public class class_name {
public void registerJsonBeanProcessor( Class target, JsonBeanProcessor jsonBeanProcessor ) {
if( target != null && jsonBeanProcessor != null ) {
beanProcessorMap.put( target, jsonBeanProcessor ); // depends on control dependency: [if], data = [( target]
}
} }
|
public class class_name {
public Database createDatabase(String instanceId, String databaseId) {
// [START createDatabase]
OperationFuture<Database, CreateDatabaseMetadata> op =
dbAdminClient.createDatabase(
instanceId,
databaseId,
Arrays.asList(
"CREATE TABLE Singers (\n"
+ " SingerId INT64 NOT NULL,\n"
+ " FirstName STRING(1024),\n"
+ " LastName STRING(1024),\n"
+ " SingerInfo BYTES(MAX)\n"
+ ") PRIMARY KEY (SingerId)",
"CREATE TABLE Albums (\n"
+ " SingerId INT64 NOT NULL,\n"
+ " AlbumId INT64 NOT NULL,\n"
+ " AlbumTitle STRING(MAX)\n"
+ ") PRIMARY KEY (SingerId, AlbumId),\n"
+ " INTERLEAVE IN PARENT Singers ON DELETE CASCADE"));
Database db;
try {
db = op.get();
} catch (ExecutionException e) {
throw (SpannerException) e.getCause();
} catch (InterruptedException e) {
throw SpannerExceptionFactory.propagateInterrupt(e);
}
// [END createDatabase]
return db;
} }
|
public class class_name {
public Database createDatabase(String instanceId, String databaseId) {
// [START createDatabase]
OperationFuture<Database, CreateDatabaseMetadata> op =
dbAdminClient.createDatabase(
instanceId,
databaseId,
Arrays.asList(
"CREATE TABLE Singers (\n"
+ " SingerId INT64 NOT NULL,\n"
+ " FirstName STRING(1024),\n"
+ " LastName STRING(1024),\n"
+ " SingerInfo BYTES(MAX)\n"
+ ") PRIMARY KEY (SingerId)",
"CREATE TABLE Albums (\n"
+ " SingerId INT64 NOT NULL,\n"
+ " AlbumId INT64 NOT NULL,\n"
+ " AlbumTitle STRING(MAX)\n"
+ ") PRIMARY KEY (SingerId, AlbumId),\n"
+ " INTERLEAVE IN PARENT Singers ON DELETE CASCADE"));
Database db;
try {
db = op.get(); // depends on control dependency: [try], data = [none]
} catch (ExecutionException e) {
throw (SpannerException) e.getCause();
} catch (InterruptedException e) { // depends on control dependency: [catch], data = [none]
throw SpannerExceptionFactory.propagateInterrupt(e);
} // depends on control dependency: [catch], data = [none]
// [END createDatabase]
return db;
} }
|
public class class_name {
public void mkPackage(String pkgName, File dir) {
try {
File metaDir = new File(dir + "/.mdw");
if (!metaDir.exists() && !metaDir.mkdirs())
throw new IOException("Cannot create directory: " + metaDir.getAbsolutePath());
File pkgFile = new File(metaDir + "/package.yaml");
if (!pkgFile.exists()) {
JSONObject pkgJson = new JSONObject();
pkgJson.put("name", pkgName);
pkgJson.put("version", "1.0.01");
pkgJson.put("schemaVersion", "6.1");
Files.write(Paths.get(pkgFile.getPath()), pkgJson.toString(2).getBytes());
}
}
catch (IOException ex) {
ex.printStackTrace();
}
} }
|
public class class_name {
public void mkPackage(String pkgName, File dir) {
try {
File metaDir = new File(dir + "/.mdw");
if (!metaDir.exists() && !metaDir.mkdirs())
throw new IOException("Cannot create directory: " + metaDir.getAbsolutePath());
File pkgFile = new File(metaDir + "/package.yaml");
if (!pkgFile.exists()) {
JSONObject pkgJson = new JSONObject();
pkgJson.put("name", pkgName);
pkgJson.put("version", "1.0.01");
pkgJson.put("schemaVersion", "6.1");
Files.write(Paths.get(pkgFile.getPath()), pkgJson.toString(2).getBytes());
}
}
catch (IOException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Pure
public static String getUserHomeDirectoryName() {
final String userHome = System.getProperty("user.home"); //$NON-NLS-1$
if ((userHome == null || userHome.isEmpty()) && (OperatingSystem.ANDROID.isCurrentOS())) {
return join(File.listRoots()[0], Android.HOME_DIRECTORY).toString();
}
return userHome;
} }
|
public class class_name {
@Pure
public static String getUserHomeDirectoryName() {
final String userHome = System.getProperty("user.home"); //$NON-NLS-1$
if ((userHome == null || userHome.isEmpty()) && (OperatingSystem.ANDROID.isCurrentOS())) {
return join(File.listRoots()[0], Android.HOME_DIRECTORY).toString(); // depends on control dependency: [if], data = [none]
}
return userHome;
} }
|
public class class_name {
private void displayError(String message, boolean showForgotPassword, boolean showTime) {
message = message.replace("\n", "<br />");
if (showForgotPassword) {
message += "<br /><br /><a href=\""
+ getResetPasswordLink()
+ "\">"
+ CmsVaadinUtils.getMessageText(Messages.GUI_FORGOT_PASSWORD_0)
+ "</a>";
}
if (showTime) {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
message += "<div style=\"position:absolute;right:6px;bottom:5px;\">"
+ CmsVaadinUtils.getMessageText(Messages.GUI_TIME_1, sdf.format(new Date()))
+ "</div>";
}
m_ui.showLoginError(message);
} }
|
public class class_name {
private void displayError(String message, boolean showForgotPassword, boolean showTime) {
message = message.replace("\n", "<br />");
if (showForgotPassword) {
message += "<br /><br /><a href=\""
+ getResetPasswordLink()
+ "\">"
+ CmsVaadinUtils.getMessageText(Messages.GUI_FORGOT_PASSWORD_0)
+ "</a>"; // depends on control dependency: [if], data = [none]
}
if (showTime) {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
message += "<div style=\"position:absolute;right:6px;bottom:5px;\">" // depends on control dependency: [if], data = [none]
+ CmsVaadinUtils.getMessageText(Messages.GUI_TIME_1, sdf.format(new Date()))
+ "</div>"; // depends on control dependency: [if], data = [none]
}
m_ui.showLoginError(message);
} }
|
public class class_name {
public void marshall(GameSession gameSession, ProtocolMarshaller protocolMarshaller) {
if (gameSession == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(gameSession.getGameSessionId(), GAMESESSIONID_BINDING);
protocolMarshaller.marshall(gameSession.getName(), NAME_BINDING);
protocolMarshaller.marshall(gameSession.getFleetId(), FLEETID_BINDING);
protocolMarshaller.marshall(gameSession.getCreationTime(), CREATIONTIME_BINDING);
protocolMarshaller.marshall(gameSession.getTerminationTime(), TERMINATIONTIME_BINDING);
protocolMarshaller.marshall(gameSession.getCurrentPlayerSessionCount(), CURRENTPLAYERSESSIONCOUNT_BINDING);
protocolMarshaller.marshall(gameSession.getMaximumPlayerSessionCount(), MAXIMUMPLAYERSESSIONCOUNT_BINDING);
protocolMarshaller.marshall(gameSession.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(gameSession.getStatusReason(), STATUSREASON_BINDING);
protocolMarshaller.marshall(gameSession.getGameProperties(), GAMEPROPERTIES_BINDING);
protocolMarshaller.marshall(gameSession.getIpAddress(), IPADDRESS_BINDING);
protocolMarshaller.marshall(gameSession.getPort(), PORT_BINDING);
protocolMarshaller.marshall(gameSession.getPlayerSessionCreationPolicy(), PLAYERSESSIONCREATIONPOLICY_BINDING);
protocolMarshaller.marshall(gameSession.getCreatorId(), CREATORID_BINDING);
protocolMarshaller.marshall(gameSession.getGameSessionData(), GAMESESSIONDATA_BINDING);
protocolMarshaller.marshall(gameSession.getMatchmakerData(), MATCHMAKERDATA_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(GameSession gameSession, ProtocolMarshaller protocolMarshaller) {
if (gameSession == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(gameSession.getGameSessionId(), GAMESESSIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getFleetId(), FLEETID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getCreationTime(), CREATIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getTerminationTime(), TERMINATIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getCurrentPlayerSessionCount(), CURRENTPLAYERSESSIONCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getMaximumPlayerSessionCount(), MAXIMUMPLAYERSESSIONCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getStatusReason(), STATUSREASON_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getGameProperties(), GAMEPROPERTIES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getIpAddress(), IPADDRESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getPort(), PORT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getPlayerSessionCreationPolicy(), PLAYERSESSIONCREATIONPOLICY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getCreatorId(), CREATORID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getGameSessionData(), GAMESESSIONDATA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(gameSession.getMatchmakerData(), MATCHMAKERDATA_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void appendToBuffer( final StringBuffer buffer,
final String string,
final String delimiter )
{
if ( string == null )
{
return;
}
//
// Only append the delimiter in front if the buffer isn't empty.
//
if ( buffer.length() == 0 || delimiter == null )
{
buffer.append( string );
}
else
{
buffer.append( delimiter ).append( string );
}
} }
|
public class class_name {
public static void appendToBuffer( final StringBuffer buffer,
final String string,
final String delimiter )
{
if ( string == null )
{
return; // depends on control dependency: [if], data = [none]
}
//
// Only append the delimiter in front if the buffer isn't empty.
//
if ( buffer.length() == 0 || delimiter == null )
{
buffer.append( string ); // depends on control dependency: [if], data = [none]
}
else
{
buffer.append( delimiter ).append( string ); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private OnValueChangeListener createNumberPickerListener() {
return new OnValueChangeListener() {
@Override
public void onValueChange(final android.widget.NumberPicker picker, final int oldValue,
final int newValue) {
int value = 0;
for (int i = 0; i < numberPickers.length; i++) {
int exponent = numberPickers.length - i - 1;
value += numberPickers[i].getValue() * Math.pow(NUMERIC_SYTEM, exponent);
}
currentNumber = value;
}
};
} }
|
public class class_name {
private OnValueChangeListener createNumberPickerListener() {
return new OnValueChangeListener() {
@Override
public void onValueChange(final android.widget.NumberPicker picker, final int oldValue,
final int newValue) {
int value = 0;
for (int i = 0; i < numberPickers.length; i++) {
int exponent = numberPickers.length - i - 1;
value += numberPickers[i].getValue() * Math.pow(NUMERIC_SYTEM, exponent); // depends on control dependency: [for], data = [i]
}
currentNumber = value;
}
};
} }
|
public class class_name {
public static String getTrustManagerFactoryAlgorithm() {
if (trustManagerFactoryAlgorithm == null) {
trustManagerFactoryAlgorithm = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return Security.getProperty("ssl.TrustManagerFactory.algorithm");
}
});
}
return trustManagerFactoryAlgorithm;
} }
|
public class class_name {
public static String getTrustManagerFactoryAlgorithm() {
if (trustManagerFactoryAlgorithm == null) {
trustManagerFactoryAlgorithm = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return Security.getProperty("ssl.TrustManagerFactory.algorithm");
}
}); // depends on control dependency: [if], data = [none]
}
return trustManagerFactoryAlgorithm;
} }
|
public class class_name {
public static String encodeUrl(String stringToEncode) {
try {
return URLEncoder.encode(stringToEncode, "UTF-8");
} catch (UnsupportedEncodingException e1) {
throw new RuntimeException(e1);
}
} }
|
public class class_name {
public static String encodeUrl(String stringToEncode) {
try {
return URLEncoder.encode(stringToEncode, "UTF-8"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e1) {
throw new RuntimeException(e1);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String getHexString( byte[] bytes ) {
try {
byte[] hex = new byte[2 * bytes.length];
int index = 0;
for (byte b : bytes) {
int v = b & 0xFF;
hex[index++] = HEX_CHAR_TABLE[v >>> 4];
hex[index++] = HEX_CHAR_TABLE[v & 0xF];
}
return new String(hex, "ASCII");
} catch (UnsupportedEncodingException e) {
BigInteger bi = new BigInteger(1, bytes);
return String.format("%0" + (bytes.length << 1) + "x", bi);
}
} }
|
public class class_name {
public static String getHexString( byte[] bytes ) {
try {
byte[] hex = new byte[2 * bytes.length];
int index = 0;
for (byte b : bytes) {
int v = b & 0xFF;
hex[index++] = HEX_CHAR_TABLE[v >>> 4]; // depends on control dependency: [for], data = [none]
hex[index++] = HEX_CHAR_TABLE[v & 0xF]; // depends on control dependency: [for], data = [none]
}
return new String(hex, "ASCII"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
BigInteger bi = new BigInteger(1, bytes);
return String.format("%0" + (bytes.length << 1) + "x", bi);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Namespace jelly(Class t) {
String n = t.getName();
if(TagLibrary.class.isAssignableFrom(t)) {
// if the given class is a tag library itself, just record it
context.registerTagLibrary(n,n);
} else {
String path = n.replace('.', '/');
URL res = t.getClassLoader().getResource(path+"/taglib");
if(res!=null) {
// this class itself is not a tag library, but it contains Jelly side files that are tag files.
// (some of them might be views, but some of them are tag files, anyway.
JellyContext parseContext = MetaClassLoader.get(t.getClassLoader()).loadTearOff(JellyClassLoaderTearOff.class).createContext();
context.registerTagLibrary(n,
new CustomTagLibrary(parseContext, t.getClassLoader(), n, path));
} else {
throw new IllegalArgumentException("Cannot find taglib from "+t);
}
}
return new Namespace(this,n,"-"); // doesn't matter what the prefix is, since they are known to be taglibs
} }
|
public class class_name {
public Namespace jelly(Class t) {
String n = t.getName();
if(TagLibrary.class.isAssignableFrom(t)) {
// if the given class is a tag library itself, just record it
context.registerTagLibrary(n,n); // depends on control dependency: [if], data = [none]
} else {
String path = n.replace('.', '/');
URL res = t.getClassLoader().getResource(path+"/taglib");
if(res!=null) {
// this class itself is not a tag library, but it contains Jelly side files that are tag files.
// (some of them might be views, but some of them are tag files, anyway.
JellyContext parseContext = MetaClassLoader.get(t.getClassLoader()).loadTearOff(JellyClassLoaderTearOff.class).createContext();
context.registerTagLibrary(n,
new CustomTagLibrary(parseContext, t.getClassLoader(), n, path)); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Cannot find taglib from "+t);
}
}
return new Namespace(this,n,"-"); // doesn't matter what the prefix is, since they are known to be taglibs
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.