code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static void annotateOnHttpResponseBuffer(String key) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateOnHttpResponseBuffer(key);
}
} } | public class class_name {
public static void annotateOnHttpResponseBuffer(String key) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateOnHttpResponseBuffer(key); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String getClassPath(Class<?> c) {
String strClassFullName = c.getName();
String strClassName = strClassFullName.substring(strClassFullName
.lastIndexOf(".") + 1);
String strClassPathName = getClassPathName(c);
ClassLoader cl = c.getClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
return null;
}
URL urlClass = cl.getResource(strClassPathName);
if (urlClass == null)
return null;
String strUrl = urlClass.toString();
return strUrl.substring(0, strUrl.lastIndexOf(strClassName));
} } | public class class_name {
public static String getClassPath(Class<?> c) {
String strClassFullName = c.getName();
String strClassName = strClassFullName.substring(strClassFullName
.lastIndexOf(".") + 1);
String strClassPathName = getClassPathName(c);
ClassLoader cl = c.getClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
// depends on control dependency: [if], data = [none]
return null;
// depends on control dependency: [if], data = [none]
}
URL urlClass = cl.getResource(strClassPathName);
if (urlClass == null)
return null;
String strUrl = urlClass.toString();
return strUrl.substring(0, strUrl.lastIndexOf(strClassName));
} } |
public class class_name {
@Override
public String getModuleName() {
String moduleName = moduleRef.getName();
if (moduleName == null || moduleName.isEmpty()) {
moduleName = moduleNameFromModuleDescriptor;
}
return moduleName == null || moduleName.isEmpty() ? null : moduleName;
} } | public class class_name {
@Override
public String getModuleName() {
String moduleName = moduleRef.getName();
if (moduleName == null || moduleName.isEmpty()) {
moduleName = moduleNameFromModuleDescriptor; // depends on control dependency: [if], data = [none]
}
return moduleName == null || moduleName.isEmpty() ? null : moduleName;
} } |
public class class_name {
public final String getCopyright()
{
if ( copyright == null )
{
StringBuilder sb = new StringBuilder();
sb.append( COPYRIGHT_PREAMBLE )
.append( " " )
.append( Calendar.getInstance().get( Calendar.YEAR ) )
.append( " " )
.append( companyName );
copyright = sb.toString();
}
return copyright;
} } | public class class_name {
public final String getCopyright()
{
if ( copyright == null )
{
StringBuilder sb = new StringBuilder();
sb.append( COPYRIGHT_PREAMBLE )
.append( " " )
.append( Calendar.getInstance().get( Calendar.YEAR ) )
.append( " " )
.append( companyName ); // depends on control dependency: [if], data = [none]
copyright = sb.toString(); // depends on control dependency: [if], data = [none]
}
return copyright;
} } |
public class class_name {
public void setDatabase(String databaseKey) {
m_databaseKey = databaseKey;
String vfsDriver;
String userDriver;
String projectDriver;
String historyDriver;
String subscriptionDriver;
String sqlManager;
vfsDriver = getDbProperty(m_databaseKey + ".vfs.driver");
userDriver = getDbProperty(m_databaseKey + ".user.driver");
projectDriver = getDbProperty(m_databaseKey + ".project.driver");
historyDriver = getDbProperty(m_databaseKey + ".history.driver");
subscriptionDriver = getDbProperty(m_databaseKey + ".subscription.driver");
sqlManager = getDbProperty(m_databaseKey + ".sqlmanager");
// set the db properties
setExtProperty("db.name", m_databaseKey);
setExtProperty("db.vfs.driver", vfsDriver);
setExtProperty("db.vfs.sqlmanager", sqlManager);
setExtProperty("db.user.driver", userDriver);
setExtProperty("db.user.sqlmanager", sqlManager);
setExtProperty("db.project.driver", projectDriver);
setExtProperty("db.project.sqlmanager", sqlManager);
setExtProperty("db.history.driver", historyDriver);
setExtProperty("db.history.sqlmanager", sqlManager);
setExtProperty("db.subscription.driver", subscriptionDriver);
setExtProperty("db.subscription.sqlmanager", sqlManager);
Properties dbProps = getDatabaseProperties().get(databaseKey);
String prefix = "additional.";
String dbPropBlock = "";
for (Map.Entry<Object, Object> entry : dbProps.entrySet()) {
if (entry.getKey() instanceof String) {
String key = (String)entry.getKey();
if (key.startsWith(prefix)) {
key = key.substring(prefix.length());
String val = (String)(entry.getValue());
setExtProperty(key, val);
dbPropBlock += key + "=" + val + "\n";
}
}
}
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(dbPropBlock)) {
m_additionalProperties.put("dbprops", dbPropBlock);
}
} } | public class class_name {
public void setDatabase(String databaseKey) {
m_databaseKey = databaseKey;
String vfsDriver;
String userDriver;
String projectDriver;
String historyDriver;
String subscriptionDriver;
String sqlManager;
vfsDriver = getDbProperty(m_databaseKey + ".vfs.driver");
userDriver = getDbProperty(m_databaseKey + ".user.driver");
projectDriver = getDbProperty(m_databaseKey + ".project.driver");
historyDriver = getDbProperty(m_databaseKey + ".history.driver");
subscriptionDriver = getDbProperty(m_databaseKey + ".subscription.driver");
sqlManager = getDbProperty(m_databaseKey + ".sqlmanager");
// set the db properties
setExtProperty("db.name", m_databaseKey);
setExtProperty("db.vfs.driver", vfsDriver);
setExtProperty("db.vfs.sqlmanager", sqlManager);
setExtProperty("db.user.driver", userDriver);
setExtProperty("db.user.sqlmanager", sqlManager);
setExtProperty("db.project.driver", projectDriver);
setExtProperty("db.project.sqlmanager", sqlManager);
setExtProperty("db.history.driver", historyDriver);
setExtProperty("db.history.sqlmanager", sqlManager);
setExtProperty("db.subscription.driver", subscriptionDriver);
setExtProperty("db.subscription.sqlmanager", sqlManager);
Properties dbProps = getDatabaseProperties().get(databaseKey);
String prefix = "additional.";
String dbPropBlock = "";
for (Map.Entry<Object, Object> entry : dbProps.entrySet()) {
if (entry.getKey() instanceof String) {
String key = (String)entry.getKey();
if (key.startsWith(prefix)) {
key = key.substring(prefix.length()); // depends on control dependency: [if], data = [none]
String val = (String)(entry.getValue());
setExtProperty(key, val); // depends on control dependency: [if], data = [none]
dbPropBlock += key + "=" + val + "\n"; // depends on control dependency: [if], data = [none]
}
}
}
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(dbPropBlock)) {
m_additionalProperties.put("dbprops", dbPropBlock); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean createParentDirectory(PrintStream stdout, File file) {
File parent = file.getParentFile();
if (parent == null) {
return true;
}
if (!parent.exists()) {
if (!createParentDirectory(stdout, parent)) {
return false;
}
if (!parent.mkdir()) {
stdout.println(CommandUtils.getMessage("fileUtility.failedDirCreate", resolvePath(parent)));
return false;
} else {
return true;
}
} else {
return true;
}
} } | public class class_name {
@Override
public boolean createParentDirectory(PrintStream stdout, File file) {
File parent = file.getParentFile();
if (parent == null) {
return true; // depends on control dependency: [if], data = [none]
}
if (!parent.exists()) {
if (!createParentDirectory(stdout, parent)) {
return false; // depends on control dependency: [if], data = [none]
}
if (!parent.mkdir()) {
stdout.println(CommandUtils.getMessage("fileUtility.failedDirCreate", resolvePath(parent))); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else {
return true; // depends on control dependency: [if], data = [none]
}
} else {
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
protected ISynchronizationPoint<? extends Exception> serializeMapValue(
SerializationContext context, Map<?,?> map, TypeDefinition typeDef, String path, List<SerializationRule> rules
) {
TypeDefinition type = new TypeDefinition(MapEntry.class, typeDef.getParameters());
type = new TypeDefinition(ArrayList.class, type);
ArrayList<MapEntry> entries = new ArrayList<>(map.size());
for (Map.Entry e : map.entrySet()) {
MapEntry me = new MapEntry();
me.key = e.getKey();
me.value = e.getValue();
entries.add(me);
}
return serializeValue(context, entries, type, path, rules);
} } | public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
protected ISynchronizationPoint<? extends Exception> serializeMapValue(
SerializationContext context, Map<?,?> map, TypeDefinition typeDef, String path, List<SerializationRule> rules
) {
TypeDefinition type = new TypeDefinition(MapEntry.class, typeDef.getParameters());
type = new TypeDefinition(ArrayList.class, type);
ArrayList<MapEntry> entries = new ArrayList<>(map.size());
for (Map.Entry e : map.entrySet()) {
MapEntry me = new MapEntry();
me.key = e.getKey();
// depends on control dependency: [for], data = [e]
me.value = e.getValue();
// depends on control dependency: [for], data = [e]
entries.add(me);
// depends on control dependency: [for], data = [e]
}
return serializeValue(context, entries, type, path, rules);
} } |
public class class_name {
@CheckForNull
public static OffsetDateTime parseOffsetDateTimeQuietly(@Nullable String s) {
OffsetDateTime datetime = null;
if (s != null) {
try {
datetime = parseOffsetDateTime(s);
} catch (RuntimeException e) {
// ignore
}
}
return datetime;
} } | public class class_name {
@CheckForNull
public static OffsetDateTime parseOffsetDateTimeQuietly(@Nullable String s) {
OffsetDateTime datetime = null;
if (s != null) {
try {
datetime = parseOffsetDateTime(s); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
// ignore
} // depends on control dependency: [catch], data = [none]
}
return datetime;
} } |
public class class_name {
@Override public Double getCurrency(String name)
{
Double value = getDouble(name);
if (value != null)
{
value = Double.valueOf(value.doubleValue() / 100);
}
return (value);
} } | public class class_name {
@Override public Double getCurrency(String name)
{
Double value = getDouble(name);
if (value != null)
{
value = Double.valueOf(value.doubleValue() / 100); // depends on control dependency: [if], data = [(value]
}
return (value);
} } |
public class class_name {
private void swapByteOrder() {
// NB: we are setting bigEndian to be opposite the system arch
String arch = System.getProperty("os.arch");
if (arch.equals("x86") || // Windows, Linux
arch.equals("arm") || // Window CE
arch.equals("x86_64") || // Windows64, Mac OS-X
arch.equals("amd64") || // Linux64?
arch.equals("alpha")) { // Utrix, VAX, DECOS
bigEndian = true;
} else {
bigEndian = false;
}
} } | public class class_name {
private void swapByteOrder() {
// NB: we are setting bigEndian to be opposite the system arch
String arch = System.getProperty("os.arch");
if (arch.equals("x86") || // Windows, Linux
arch.equals("arm") || // Window CE
arch.equals("x86_64") || // Windows64, Mac OS-X
arch.equals("amd64") || // Linux64?
arch.equals("alpha")) { // Utrix, VAX, DECOS
bigEndian = true;
// depends on control dependency: [if], data = [none]
} else {
bigEndian = false;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void onUnregistered(Context context) {
if(notificationCallback != null) {
notificationCallback.onUnregister(context);
if(logger != null && logger.isDebugEnabled()) {
logger.debug("SocializeC2DMReceiver successfully unregistered");
}
}
else {
logWarn("No notificationCallback found in GCM receiver. Initialization may have failed.");
}
} } | public class class_name {
@Override
public void onUnregistered(Context context) {
if(notificationCallback != null) {
notificationCallback.onUnregister(context); // depends on control dependency: [if], data = [none]
if(logger != null && logger.isDebugEnabled()) {
logger.debug("SocializeC2DMReceiver successfully unregistered"); // depends on control dependency: [if], data = [none]
}
}
else {
logWarn("No notificationCallback found in GCM receiver. Initialization may have failed."); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static SkbShellArgument[] newArgumentArray(SkbShellArgument ... args){
if(args==null){
return null;
}
Set<SkbShellArgument> ret = new HashSet<>();
for(SkbShellArgument arg : args){
if(arg!=null){
ret.add(arg);
}
}
return ret.toArray(new SkbShellArgument[args.length]);
} } | public class class_name {
public static SkbShellArgument[] newArgumentArray(SkbShellArgument ... args){
if(args==null){
return null; // depends on control dependency: [if], data = [none]
}
Set<SkbShellArgument> ret = new HashSet<>();
for(SkbShellArgument arg : args){
if(arg!=null){
ret.add(arg); // depends on control dependency: [if], data = [(arg]
}
}
return ret.toArray(new SkbShellArgument[args.length]);
} } |
public class class_name {
@Override
public RequestCtx handleRequest(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
if (logger.isDebugEnabled()) {
logger.debug("{}/handleRequest!", this.getClass().getName());
}
String[] parts = getPathParts(request);
// -/objects/{pid}/datastreams/{dsID}
if (parts.length < 4) {
logger.error("Not enough path components on the URI: {}", request.getRequestURI());
throw new ServletException("Not enough path components on the URI: " + request.getRequestURI());
}
String mimeType = request.getParameter("mimeType");
String formatURI = request.getParameter("formatURI");
String dsLocation = request.getParameter("dsLocation");
String controlGroup = request.getParameter("controlGroup");
String dsState = request.getParameter("dsState");
String checksumType = request.getParameter("checksumType");
String checksum = request.getParameter("checksum");
// String logMessage = null;
RequestCtx req = null;
Map<URI, AttributeValue> actions = new HashMap<URI, AttributeValue>();
Map<URI, AttributeValue> resAttr;
try {
resAttr = ResourceAttributes.getResources(parts);
if (mimeType != null && !mimeType.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_MIME_TYPE.getURI(),
new StringAttribute(mimeType));
}
if (formatURI != null && !formatURI.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_FORMAT_URI.getURI(),
new AnyURIAttribute(new URI(formatURI)));
}
if (dsLocation != null && !dsLocation.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_LOCATION.getURI(),
new AnyURIAttribute(new URI(dsLocation)));
}
if (controlGroup != null && !controlGroup.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_CONTROL_GROUP.getURI(),
new StringAttribute(controlGroup));
}
if (dsState != null && !dsState.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_STATE.getURI(),
new StringAttribute(dsState));
}
if (checksumType != null && !checksumType.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_CHECKSUM_TYPE.getURI(),
new StringAttribute(checksumType));
}
if (checksum != null && !checksum.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_CHECKSUM.getURI(),
new StringAttribute(checksum));
}
actions.put(Constants.ACTION.ID.getURI(),
Constants.ACTION.ADD_DATASTREAM
.getStringAttribute());
actions.put(Constants.ACTION.API.getURI(),
Constants.ACTION.APIM.getStringAttribute());
String dsID = parts[3];
// modifying the FeSL policy datastream requires policy management permissions
if (dsID != null && dsID.equals(FedoraPolicyStore.FESL_POLICY_DATASTREAM)) {
actions.put(Constants.ACTION.ID.getURI(),
Constants.ACTION.MANAGE_POLICIES.getStringAttribute());
}
req =
getContextHandler().buildRequest(getSubjects(request),
actions,
resAttr,
getEnvironment(request));
LogUtil.statLog(request.getRemoteUser(),
Constants.ACTION.ADD_DATASTREAM.uri,
parts[1],
dsID);
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new ServletException(e.getMessage(), e);
}
return req;
} } | public class class_name {
@Override
public RequestCtx handleRequest(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
if (logger.isDebugEnabled()) {
logger.debug("{}/handleRequest!", this.getClass().getName());
}
String[] parts = getPathParts(request);
// -/objects/{pid}/datastreams/{dsID}
if (parts.length < 4) {
logger.error("Not enough path components on the URI: {}", request.getRequestURI());
throw new ServletException("Not enough path components on the URI: " + request.getRequestURI());
}
String mimeType = request.getParameter("mimeType");
String formatURI = request.getParameter("formatURI");
String dsLocation = request.getParameter("dsLocation");
String controlGroup = request.getParameter("controlGroup");
String dsState = request.getParameter("dsState");
String checksumType = request.getParameter("checksumType");
String checksum = request.getParameter("checksum");
// String logMessage = null;
RequestCtx req = null;
Map<URI, AttributeValue> actions = new HashMap<URI, AttributeValue>();
Map<URI, AttributeValue> resAttr;
try {
resAttr = ResourceAttributes.getResources(parts);
if (mimeType != null && !mimeType.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_MIME_TYPE.getURI(),
new StringAttribute(mimeType)); // depends on control dependency: [if], data = [none]
}
if (formatURI != null && !formatURI.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_FORMAT_URI.getURI(),
new AnyURIAttribute(new URI(formatURI))); // depends on control dependency: [if], data = [none]
}
if (dsLocation != null && !dsLocation.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_LOCATION.getURI(),
new AnyURIAttribute(new URI(dsLocation))); // depends on control dependency: [if], data = [none]
}
if (controlGroup != null && !controlGroup.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_CONTROL_GROUP.getURI(),
new StringAttribute(controlGroup)); // depends on control dependency: [if], data = [none]
}
if (dsState != null && !dsState.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_STATE.getURI(),
new StringAttribute(dsState)); // depends on control dependency: [if], data = [none]
}
if (checksumType != null && !checksumType.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_CHECKSUM_TYPE.getURI(),
new StringAttribute(checksumType)); // depends on control dependency: [if], data = [none]
}
if (checksum != null && !checksum.isEmpty()) {
resAttr.put(Constants.DATASTREAM.NEW_CHECKSUM.getURI(),
new StringAttribute(checksum)); // depends on control dependency: [if], data = [none]
}
actions.put(Constants.ACTION.ID.getURI(),
Constants.ACTION.ADD_DATASTREAM
.getStringAttribute());
actions.put(Constants.ACTION.API.getURI(),
Constants.ACTION.APIM.getStringAttribute());
String dsID = parts[3];
// modifying the FeSL policy datastream requires policy management permissions
if (dsID != null && dsID.equals(FedoraPolicyStore.FESL_POLICY_DATASTREAM)) {
actions.put(Constants.ACTION.ID.getURI(),
Constants.ACTION.MANAGE_POLICIES.getStringAttribute()); // depends on control dependency: [if], data = [none]
}
req =
getContextHandler().buildRequest(getSubjects(request),
actions,
resAttr,
getEnvironment(request));
LogUtil.statLog(request.getRemoteUser(),
Constants.ACTION.ADD_DATASTREAM.uri,
parts[1],
dsID);
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new ServletException(e.getMessage(), e);
}
return req;
} } |
public class class_name {
private void trainRuleOnInstance(int ruleID, Instance instance) {
//System.out.println("Processor:"+this.processorId+": Rule:"+ruleID+" -> Counter="+counter);
Iterator<ActiveRule> ruleIterator= this.ruleSet.iterator();
while (ruleIterator.hasNext()) {
ActiveRule rule = ruleIterator.next();
if (rule.getRuleNumberID() == ruleID) {
// Check (again) for coverage
if (rule.isCovering(instance) == true) {
double error = rule.computeError(instance); //Use adaptive mode error
boolean changeDetected = ((RuleActiveRegressionNode)rule.getLearningNode()).updateChangeDetection(error);
if (changeDetected == true) {
ruleIterator.remove();
this.sendRemoveRuleEvent(ruleID);
} else {
rule.updateStatistics(instance);
if (rule.getInstancesSeen() % this.gracePeriod == 0.0) {
if (rule.tryToExpand(this.splitConfidence, this.tieThreshold) ) {
rule.split();
// expanded: update Aggregator with new/updated predicate
this.sendPredicate(rule.getRuleNumberID(), rule.getLastUpdatedRuleSplitNode(),
(RuleActiveRegressionNode)rule.getLearningNode());
}
}
}
}
return;
}
}
} } | public class class_name {
private void trainRuleOnInstance(int ruleID, Instance instance) {
//System.out.println("Processor:"+this.processorId+": Rule:"+ruleID+" -> Counter="+counter);
Iterator<ActiveRule> ruleIterator= this.ruleSet.iterator();
while (ruleIterator.hasNext()) {
ActiveRule rule = ruleIterator.next();
if (rule.getRuleNumberID() == ruleID) {
// Check (again) for coverage
if (rule.isCovering(instance) == true) {
double error = rule.computeError(instance); //Use adaptive mode error
boolean changeDetected = ((RuleActiveRegressionNode)rule.getLearningNode()).updateChangeDetection(error);
if (changeDetected == true) {
ruleIterator.remove(); // depends on control dependency: [if], data = [none]
this.sendRemoveRuleEvent(ruleID); // depends on control dependency: [if], data = [none]
} else {
rule.updateStatistics(instance); // depends on control dependency: [if], data = [none]
if (rule.getInstancesSeen() % this.gracePeriod == 0.0) {
if (rule.tryToExpand(this.splitConfidence, this.tieThreshold) ) {
rule.split(); // depends on control dependency: [if], data = [none]
// expanded: update Aggregator with new/updated predicate
this.sendPredicate(rule.getRuleNumberID(), rule.getLastUpdatedRuleSplitNode(),
(RuleActiveRegressionNode)rule.getLearningNode()); // depends on control dependency: [if], data = [none]
}
}
}
}
return; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void ensureClassRef(ReferenceDescriptorDef refDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
if (!refDef.hasProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF))
{
if (refDef.hasProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CLASS_REF))
{
// we use the type of the reference variable
refDef.setProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF, refDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CLASS_REF));
}
else
{
throw new ConstraintException("Reference "+refDef.getName()+" in class "+refDef.getOwner().getName()+" does not reference any class");
}
}
// now checking the type
ClassDescriptorDef ownerClassDef = (ClassDescriptorDef)refDef.getOwner();
ModelDef model = (ModelDef)ownerClassDef.getOwner();
String targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF);
ClassDescriptorDef targetClassDef = model.getClass(targetClassName);
if (targetClassDef == null)
{
throw new ConstraintException("The class "+targetClassName+" referenced by "+refDef.getName()+" in class "+ownerClassDef.getName()+" is unknown or not persistent");
}
if (!targetClassDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_OJB_PERSISTENT, false))
{
throw new ConstraintException("The class "+targetClassName+" referenced by "+refDef.getName()+" in class "+ownerClassDef.getName()+" is not persistent");
}
if (CHECKLEVEL_STRICT.equals(checkLevel))
{
try
{
InheritanceHelper helper = new InheritanceHelper();
if (refDef.isAnonymous())
{
// anonymous reference: class must be a baseclass of the owner class
if (!helper.isSameOrSubTypeOf(ownerClassDef, targetClassDef.getName(), true))
{
throw new ConstraintException("The class "+targetClassName+" referenced by the anonymous reference "+refDef.getName()+" in class "+ownerClassDef.getName()+" is not a basetype of the class");
}
}
else
{
// specified element class must be a subtype of the variable type (if it exists, i.e. not for anonymous references)
String varType = refDef.getProperty(PropertyHelper.OJB_PROPERTY_VARIABLE_TYPE);
boolean performCheck = true;
// but we first check whether there is a useable type for the the variable type
if (model.getClass(varType) == null)
{
try
{
InheritanceHelper.getClass(varType);
}
catch (ClassNotFoundException ex)
{
// no, so defer the check but issue a warning
performCheck = false;
LogHelper.warn(true,
getClass(),
"ensureClassRef",
"Cannot check whether the type "+targetClassDef.getQualifiedName()+" specified as class-ref at reference "+refDef.getName()+" in class "+ownerClassDef.getName()+" is assignable to the declared type "+varType+" of the reference because this variable type cannot be found in source or on the classpath");
}
}
if (performCheck && !helper.isSameOrSubTypeOf(targetClassDef, varType, true))
{
throw new ConstraintException("The class "+targetClassName+" referenced by "+refDef.getName()+" in class "+ownerClassDef.getName()+" is not the same or a subtype of the variable type "+varType);
}
}
}
catch (ClassNotFoundException ex)
{
throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the reference "+refDef.getName()+" in class "+refDef.getOwner().getName());
}
}
// we're adjusting the property to use the classloader-compatible form
refDef.setProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF, targetClassDef.getName());
} } | public class class_name {
private void ensureClassRef(ReferenceDescriptorDef refDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
if (!refDef.hasProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF))
{
if (refDef.hasProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CLASS_REF))
{
// we use the type of the reference variable
refDef.setProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF, refDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CLASS_REF));
// depends on control dependency: [if], data = [none]
}
else
{
throw new ConstraintException("Reference "+refDef.getName()+" in class "+refDef.getOwner().getName()+" does not reference any class");
}
}
// now checking the type
ClassDescriptorDef ownerClassDef = (ClassDescriptorDef)refDef.getOwner();
ModelDef model = (ModelDef)ownerClassDef.getOwner();
String targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF);
ClassDescriptorDef targetClassDef = model.getClass(targetClassName);
if (targetClassDef == null)
{
throw new ConstraintException("The class "+targetClassName+" referenced by "+refDef.getName()+" in class "+ownerClassDef.getName()+" is unknown or not persistent");
}
if (!targetClassDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_OJB_PERSISTENT, false))
{
throw new ConstraintException("The class "+targetClassName+" referenced by "+refDef.getName()+" in class "+ownerClassDef.getName()+" is not persistent");
}
if (CHECKLEVEL_STRICT.equals(checkLevel))
{
try
{
InheritanceHelper helper = new InheritanceHelper();
if (refDef.isAnonymous())
{
// anonymous reference: class must be a baseclass of the owner class
if (!helper.isSameOrSubTypeOf(ownerClassDef, targetClassDef.getName(), true))
{
throw new ConstraintException("The class "+targetClassName+" referenced by the anonymous reference "+refDef.getName()+" in class "+ownerClassDef.getName()+" is not a basetype of the class");
}
}
else
{
// specified element class must be a subtype of the variable type (if it exists, i.e. not for anonymous references)
String varType = refDef.getProperty(PropertyHelper.OJB_PROPERTY_VARIABLE_TYPE);
boolean performCheck = true;
// but we first check whether there is a useable type for the the variable type
if (model.getClass(varType) == null)
{
try
{
InheritanceHelper.getClass(varType);
// depends on control dependency: [try], data = [none]
}
catch (ClassNotFoundException ex)
{
// no, so defer the check but issue a warning
performCheck = false;
LogHelper.warn(true,
getClass(),
"ensureClassRef",
"Cannot check whether the type "+targetClassDef.getQualifiedName()+" specified as class-ref at reference "+refDef.getName()+" in class "+ownerClassDef.getName()+" is assignable to the declared type "+varType+" of the reference because this variable type cannot be found in source or on the classpath");
}
// depends on control dependency: [catch], data = [none]
}
if (performCheck && !helper.isSameOrSubTypeOf(targetClassDef, varType, true))
{
throw new ConstraintException("The class "+targetClassName+" referenced by "+refDef.getName()+" in class "+ownerClassDef.getName()+" is not the same or a subtype of the variable type "+varType);
}
}
}
catch (ClassNotFoundException ex)
{
throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the reference "+refDef.getName()+" in class "+refDef.getOwner().getName());
}
// depends on control dependency: [catch], data = [none]
}
// we're adjusting the property to use the classloader-compatible form
refDef.setProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF, targetClassDef.getName());
} } |
public class class_name {
private void parseFunctionDefinitions(BeanDefinitionBuilder builder, Element element) {
ManagedMap<String, Object> functions = new ManagedMap<String, Object>();
for (Element function : DomUtils.getChildElementsByTagName(element, "function")) {
if (function.hasAttribute("ref")) {
functions.put(function.getAttribute("name"), new RuntimeBeanReference(function.getAttribute("ref")));
} else {
functions.put(function.getAttribute("name"), BeanDefinitionBuilder.rootBeanDefinition(function.getAttribute("class")).getBeanDefinition());
}
}
if (!functions.isEmpty()) {
builder.addPropertyValue("members", functions);
}
} } | public class class_name {
private void parseFunctionDefinitions(BeanDefinitionBuilder builder, Element element) {
ManagedMap<String, Object> functions = new ManagedMap<String, Object>();
for (Element function : DomUtils.getChildElementsByTagName(element, "function")) {
if (function.hasAttribute("ref")) {
functions.put(function.getAttribute("name"), new RuntimeBeanReference(function.getAttribute("ref"))); // depends on control dependency: [if], data = [none]
} else {
functions.put(function.getAttribute("name"), BeanDefinitionBuilder.rootBeanDefinition(function.getAttribute("class")).getBeanDefinition()); // depends on control dependency: [if], data = [none]
}
}
if (!functions.isEmpty()) {
builder.addPropertyValue("members", functions); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void markGoogModuleExportsAsConst(Module googModule) {
for (Binding binding : googModule.namespace().values()) {
Node exportedNode = binding.originatingExport().exportNode();
undeclaredNamesForClosure.add(exportedNode);
}
} } | public class class_name {
private void markGoogModuleExportsAsConst(Module googModule) {
for (Binding binding : googModule.namespace().values()) {
Node exportedNode = binding.originatingExport().exportNode();
undeclaredNamesForClosure.add(exportedNode); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public void setRow(int i, double value) {
VectorIterator it = iteratorOfRow(i);
while (it.hasNext()) {
it.next();
it.set(value);
}
} } | public class class_name {
public void setRow(int i, double value) {
VectorIterator it = iteratorOfRow(i);
while (it.hasNext()) {
it.next(); // depends on control dependency: [while], data = [none]
it.set(value); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public String getNameByReflection(Object obj)
{
Object name = null;
try {
java.lang.reflect.Method method = obj.getClass().getMethod("getName");
if (method != null)
name = method.invoke(obj);
} catch (Exception e) {
e.printStackTrace();
}
if (name == null)
return null;
else
return name.toString();
} } | public class class_name {
public String getNameByReflection(Object obj)
{
Object name = null;
try {
java.lang.reflect.Method method = obj.getClass().getMethod("getName");
if (method != null)
name = method.invoke(obj);
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
if (name == null)
return null;
else
return name.toString();
} } |
public class class_name {
public synchronized WroModel transform(final WroModel input) {
final WroModel model = input;
for (final Group group : model.getGroups()) {
final List<Resource> resources = group.getResources();
for (final Resource resource : resources) {
processResource(group, resource);
}
}
LOG.debug("Transformed model: {}", model);
return model;
} } | public class class_name {
public synchronized WroModel transform(final WroModel input) {
final WroModel model = input;
for (final Group group : model.getGroups()) {
final List<Resource> resources = group.getResources();
for (final Resource resource : resources) {
processResource(group, resource); // depends on control dependency: [for], data = [resource]
}
}
LOG.debug("Transformed model: {}", model);
return model;
} } |
public class class_name {
public void setOutboundInterface(InetAddress inetAddress) {
if(inetAddress == null) {
throw new NullPointerException("outbound Interface param shouldn't be null");
}
String address = inetAddress.getHostAddress();
List<SipURI> list = this.sipFactoryImpl.getSipNetworkInterfaceManager().getOutboundInterfaces();
SipURI networkInterface = null;
for(SipURI networkInterfaceURI : list) {
if(networkInterfaceURI.toString().contains(address)) {
networkInterface = networkInterfaceURI;
break;
}
}
if(networkInterface == null) throw new IllegalArgumentException("Network interface for " +
inetAddress.getHostAddress() + " not found");
outboundInterface = networkInterface;
} } | public class class_name {
public void setOutboundInterface(InetAddress inetAddress) {
if(inetAddress == null) {
throw new NullPointerException("outbound Interface param shouldn't be null");
}
String address = inetAddress.getHostAddress();
List<SipURI> list = this.sipFactoryImpl.getSipNetworkInterfaceManager().getOutboundInterfaces();
SipURI networkInterface = null;
for(SipURI networkInterfaceURI : list) {
if(networkInterfaceURI.toString().contains(address)) {
networkInterface = networkInterfaceURI;
// depends on control dependency: [if], data = [none]
break;
}
}
if(networkInterface == null) throw new IllegalArgumentException("Network interface for " +
inetAddress.getHostAddress() + " not found");
outboundInterface = networkInterface;
} } |
public class class_name {
static private boolean isInsideCharClass(String s, int pos) {
boolean openBracketFound = false;
boolean closeBracketFound = false;
// find last non-escaped open-bracket
String s2 = s.substring(0, pos);
int posOpen = pos;
while ((posOpen = s2.lastIndexOf('[', posOpen - 1)) != -1) {
if (!isEscapedChar(s2, posOpen)) {
openBracketFound = true;
break;
}
}
if (openBracketFound) {
// search remainder of string (after open-bracket) for a close-bracket
String s3 = s.substring(posOpen, pos);
int posClose = -1;
while ((posClose = s3.indexOf(']', posClose + 1)) != -1) {
if (!isEscapedChar(s3, posClose)) {
closeBracketFound = true;
break;
}
}
}
return openBracketFound && !closeBracketFound;
} } | public class class_name {
static private boolean isInsideCharClass(String s, int pos) {
boolean openBracketFound = false;
boolean closeBracketFound = false;
// find last non-escaped open-bracket
String s2 = s.substring(0, pos);
int posOpen = pos;
while ((posOpen = s2.lastIndexOf('[', posOpen - 1)) != -1) {
if (!isEscapedChar(s2, posOpen)) {
openBracketFound = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (openBracketFound) {
// search remainder of string (after open-bracket) for a close-bracket
String s3 = s.substring(posOpen, pos);
int posClose = -1;
while ((posClose = s3.indexOf(']', posClose + 1)) != -1) {
if (!isEscapedChar(s3, posClose)) {
closeBracketFound = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
return openBracketFound && !closeBracketFound;
} } |
public class class_name {
public Histogram<T> setSignificantFigures( int significantFigures ) {
if (significantFigures != this.significantFigures) {
this.significantFigures = significantFigures;
this.bucketWidth = null;
this.buckets.clear();
}
return this;
} } | public class class_name {
public Histogram<T> setSignificantFigures( int significantFigures ) {
if (significantFigures != this.significantFigures) {
this.significantFigures = significantFigures; // depends on control dependency: [if], data = [none]
this.bucketWidth = null; // depends on control dependency: [if], data = [none]
this.buckets.clear(); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public void remove(T element, Class<?> accessibleClass) {
while (accessibleClass != null && accessibleClass != this.baseClass) {
this.removeSingle(element, accessibleClass);
for (Class<?> interf : accessibleClass.getInterfaces()) {
this.removeSingle(element, interf);
}
accessibleClass = accessibleClass.getSuperclass();
}
} } | public class class_name {
public void remove(T element, Class<?> accessibleClass) {
while (accessibleClass != null && accessibleClass != this.baseClass) {
this.removeSingle(element, accessibleClass); // depends on control dependency: [while], data = [none]
for (Class<?> interf : accessibleClass.getInterfaces()) {
this.removeSingle(element, interf); // depends on control dependency: [for], data = [interf]
}
accessibleClass = accessibleClass.getSuperclass(); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public void batch(Runnable transaction) {
// TODO: 不支持嵌套事务
try (Connection c = pool.getConnection()) {
boolean commit = c.getAutoCommit();
try {
c.setAutoCommit(false);
} catch (SQLException e) {
throw new TransactionException("transaction setAutoCommit(false)", e);
}
base.set(c);
try {
transaction.run();
} catch (RuntimeException e) {
try {
c.rollback();
c.setAutoCommit(commit);
} catch (SQLException ex) {
throw new TransactionException("transaction rollback: " + ex.getMessage(), e);
}
throw e;
}
try {
c.commit();
} catch (SQLException e) {
throw new TransactionException("transaction commit", e);
}
c.setAutoCommit(commit);
} catch (SQLException e) {
throw new DBOpenException(e);
} finally {
base.set(null);
}
} } | public class class_name {
public void batch(Runnable transaction) {
// TODO: 不支持嵌套事务
try (Connection c = pool.getConnection()) {
boolean commit = c.getAutoCommit();
try {
c.setAutoCommit(false); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new TransactionException("transaction setAutoCommit(false)", e);
} // depends on control dependency: [catch], data = [none]
base.set(c);
try {
transaction.run(); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
try {
c.rollback(); // depends on control dependency: [try], data = [none]
c.setAutoCommit(commit); // depends on control dependency: [try], data = [none]
} catch (SQLException ex) {
throw new TransactionException("transaction rollback: " + ex.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
throw e;
} // depends on control dependency: [catch], data = [none]
try {
c.commit(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new TransactionException("transaction commit", e);
} // depends on control dependency: [catch], data = [none]
c.setAutoCommit(commit);
} catch (SQLException e) {
throw new DBOpenException(e);
} finally {
base.set(null);
}
} } |
public class class_name {
public static CompileStates instance(Context context) {
CompileStates instance = context.get(compileStatesKey);
if (instance == null) {
instance = new CompileStates(context);
}
return instance;
} } | public class class_name {
public static CompileStates instance(Context context) {
CompileStates instance = context.get(compileStatesKey);
if (instance == null) {
instance = new CompileStates(context); // depends on control dependency: [if], data = [none]
}
return instance;
} } |
public class class_name {
public AttributeValue withNS(java.util.Collection<String> nS) {
if (nS == null) {
this.nS = null;
} else {
java.util.List<String> nSCopy = new java.util.ArrayList<String>(nS.size());
nSCopy.addAll(nS);
this.nS = nSCopy;
}
return this;
} } | public class class_name {
public AttributeValue withNS(java.util.Collection<String> nS) {
if (nS == null) {
this.nS = null; // depends on control dependency: [if], data = [none]
} else {
java.util.List<String> nSCopy = new java.util.ArrayList<String>(nS.size());
nSCopy.addAll(nS); // depends on control dependency: [if], data = [(nS]
this.nS = nSCopy; // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public final void selectNavigationPreference(final int index,
@Nullable final Bundle arguments) {
if (isAdapterCreated()) {
adapter.selectNavigationPreference(index, arguments);
}
} } | public class class_name {
public final void selectNavigationPreference(final int index,
@Nullable final Bundle arguments) {
if (isAdapterCreated()) {
adapter.selectNavigationPreference(index, arguments); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T[] toArray(Collection<T> collection, Class<T> clazz) {
if (collection == null) {
return null;
}
return collection.toArray((T[]) Array.newInstance(clazz, collection.size()));
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> T[] toArray(Collection<T> collection, Class<T> clazz) {
if (collection == null) {
return null; // depends on control dependency: [if], data = [none]
}
return collection.toArray((T[]) Array.newInstance(clazz, collection.size()));
} } |
public class class_name {
public JSONObject makeHttpRequest(String url) throws IOException {
InputStream is = null;
JSONObject jObj = null;
String json = null;
// Making HTTP request
try {
is = new URL(url).openStream();
} catch (Exception ex) {
Log.d("Networking", ex.getLocalizedMessage());
throw new IOException("Error connecting");
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
json = sb.toString();
reader.close();
} catch (Exception e) {
Log.e("Buffer Error", "Error converting result " + e.toString());
} finally{
try {
is.close();
}catch (Exception ex){}
}
// try parse the string to a JSON object
try {
jObj = new JSONObject(json);
} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
// return JSON String
return jObj;
} } | public class class_name {
public JSONObject makeHttpRequest(String url) throws IOException {
InputStream is = null;
JSONObject jObj = null;
String json = null;
// Making HTTP request
try {
is = new URL(url).openStream();
} catch (Exception ex) {
Log.d("Networking", ex.getLocalizedMessage());
throw new IOException("Error connecting");
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n"); // depends on control dependency: [while], data = [none]
}
json = sb.toString();
reader.close();
} catch (Exception e) {
Log.e("Buffer Error", "Error converting result " + e.toString());
} finally{
try {
is.close(); // depends on control dependency: [try], data = [none]
}catch (Exception ex){} // depends on control dependency: [catch], data = [none]
}
// try parse the string to a JSON object
try {
jObj = new JSONObject(json);
} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
// return JSON String
return jObj;
} } |
public class class_name {
public static void validatePath(final Session session, final String path) {
final NamespaceRegistry namespaceRegistry = getNamespaceRegistry(session);
final String[] pathSegments = path.replaceAll("^/+", "").replaceAll("/+$", "").split("/");
for (final String segment : pathSegments) {
final int colonPosition = segment.indexOf(':');
if (segment.length() > 0 && colonPosition > -1) {
final String prefix = segment.substring(0, colonPosition);
// Skip the fcr namespace registration check to avoid the FedoraInvalidNamespaceException,
// which will happen when it fails to retrieve the memento from Modeshape.
if (!prefix.equals("fedora") && !prefix.equals("fcr")) {
if (prefix.length() == 0) {
throw new FedoraInvalidNamespaceException("Empty namespace in " + segment);
}
try {
namespaceRegistry.getURI(prefix);
} catch (final NamespaceException e) {
throw new FedoraInvalidNamespaceException("Prefix " + prefix + " has not been registered", e);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
}
}
}
} } | public class class_name {
public static void validatePath(final Session session, final String path) {
final NamespaceRegistry namespaceRegistry = getNamespaceRegistry(session);
final String[] pathSegments = path.replaceAll("^/+", "").replaceAll("/+$", "").split("/");
for (final String segment : pathSegments) {
final int colonPosition = segment.indexOf(':');
if (segment.length() > 0 && colonPosition > -1) {
final String prefix = segment.substring(0, colonPosition);
// Skip the fcr namespace registration check to avoid the FedoraInvalidNamespaceException,
// which will happen when it fails to retrieve the memento from Modeshape.
if (!prefix.equals("fedora") && !prefix.equals("fcr")) {
if (prefix.length() == 0) {
throw new FedoraInvalidNamespaceException("Empty namespace in " + segment);
}
try {
namespaceRegistry.getURI(prefix); // depends on control dependency: [try], data = [none]
} catch (final NamespaceException e) {
throw new FedoraInvalidNamespaceException("Prefix " + prefix + " has not been registered", e);
} catch (final RepositoryException e) { // depends on control dependency: [catch], data = [none]
throw new RepositoryRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
}
}
} } |
public class class_name {
@Override
public void getSharesById(SocializeSession session, ShareListener listener, long... ids) {
if(ids != null) {
String[] strIds = new String[ids.length];
for (int i = 0; i < ids.length; i++) {
strIds[i] = String.valueOf(ids[i]);
}
listAsync(session, ENDPOINT, null, 0, SocializeConfig.MAX_LIST_RESULTS, listener, strIds);
}
else {
if(listener != null) {
listener.onError(new SocializeException("No ids supplied"));
}
}
} } | public class class_name {
@Override
public void getSharesById(SocializeSession session, ShareListener listener, long... ids) {
if(ids != null) {
String[] strIds = new String[ids.length];
for (int i = 0; i < ids.length; i++) {
strIds[i] = String.valueOf(ids[i]); // depends on control dependency: [for], data = [i]
}
listAsync(session, ENDPOINT, null, 0, SocializeConfig.MAX_LIST_RESULTS, listener, strIds); // depends on control dependency: [if], data = [none]
}
else {
if(listener != null) {
listener.onError(new SocializeException("No ids supplied")); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public final void release(OPointer pointer) {
if (TRACK) {
pointerMapping.remove(pointer);
}
long poolSize = pointersPoolSize.incrementAndGet();
if (poolSize > this.poolSize) {
pointersPoolSize.decrementAndGet();
allocator.deallocate(pointer);
} else {
pointersPool.add(pointer);
}
} } | public class class_name {
public final void release(OPointer pointer) {
if (TRACK) {
pointerMapping.remove(pointer); // depends on control dependency: [if], data = [none]
}
long poolSize = pointersPoolSize.incrementAndGet();
if (poolSize > this.poolSize) {
pointersPoolSize.decrementAndGet(); // depends on control dependency: [if], data = [none]
allocator.deallocate(pointer); // depends on control dependency: [if], data = [none]
} else {
pointersPool.add(pointer); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int renderNodes(final StringBuilder stringBuilder,
final List<Node> nodes,
final int index,
final List<String> mustacheKeys,
final Map<Integer, Node> cachedNodes) {
int newIndex = index;
final Iterator<Node> iterator = nodes.iterator();
while (iterator.hasNext()) {
final Node node = iterator.next();
newIndex = this.renderNode(stringBuilder, mustacheKeys, cachedNodes, newIndex, node, true);
if (iterator.hasNext()) {
stringBuilder.append(",");
}
}
return newIndex;
} } | public class class_name {
public int renderNodes(final StringBuilder stringBuilder,
final List<Node> nodes,
final int index,
final List<String> mustacheKeys,
final Map<Integer, Node> cachedNodes) {
int newIndex = index;
final Iterator<Node> iterator = nodes.iterator();
while (iterator.hasNext()) {
final Node node = iterator.next();
newIndex = this.renderNode(stringBuilder, mustacheKeys, cachedNodes, newIndex, node, true); // depends on control dependency: [while], data = [none]
if (iterator.hasNext()) {
stringBuilder.append(","); // depends on control dependency: [if], data = [none]
}
}
return newIndex;
} } |
public class class_name {
private static int getServicePort(URL casServiceUrl) {
int port = casServiceUrl.getPort();
if (port == -1) {
port = casServiceUrl.getDefaultPort();
}
return port;
} } | public class class_name {
private static int getServicePort(URL casServiceUrl) {
int port = casServiceUrl.getPort();
if (port == -1) {
port = casServiceUrl.getDefaultPort(); // depends on control dependency: [if], data = [none]
}
return port;
} } |
public class class_name {
private boolean validateProcessInstance(ProcessInstance processInst) {
Integer status = processInst.getStatusCode();
if (WorkStatus.STATUS_CANCELLED.equals(status)) {
logger.info("ProcessInstance has been cancelled. ProcessInstanceId = " + processInst.getId());
return false;
} else if (WorkStatus.STATUS_COMPLETED.equals(status)) {
logger.info("ProcessInstance has been completed. ProcessInstanceId = " + processInst.getId());
return false;
} else return true;
} } | public class class_name {
private boolean validateProcessInstance(ProcessInstance processInst) {
Integer status = processInst.getStatusCode();
if (WorkStatus.STATUS_CANCELLED.equals(status)) {
logger.info("ProcessInstance has been cancelled. ProcessInstanceId = " + processInst.getId()); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else if (WorkStatus.STATUS_COMPLETED.equals(status)) {
logger.info("ProcessInstance has been completed. ProcessInstanceId = " + processInst.getId()); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else return true;
} } |
public class class_name {
public void marshall(CreateLifecyclePolicyRequest createLifecyclePolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (createLifecyclePolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createLifecyclePolicyRequest.getExecutionRoleArn(), EXECUTIONROLEARN_BINDING);
protocolMarshaller.marshall(createLifecyclePolicyRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(createLifecyclePolicyRequest.getState(), STATE_BINDING);
protocolMarshaller.marshall(createLifecyclePolicyRequest.getPolicyDetails(), POLICYDETAILS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateLifecyclePolicyRequest createLifecyclePolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (createLifecyclePolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createLifecyclePolicyRequest.getExecutionRoleArn(), EXECUTIONROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLifecyclePolicyRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLifecyclePolicyRequest.getState(), STATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLifecyclePolicyRequest.getPolicyDetails(), POLICYDETAILS_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 {
@Transformer
public static int len(Object o) {
if (o instanceof Collection) {
return ((Collection)o).size();
} else if (o instanceof Map) {
return ((Map)o).size();
} else if (o.getClass().isArray()) {
return Array.getLength(o);
} else {
return str(o).length();
}
} } | public class class_name {
@Transformer
public static int len(Object o) {
if (o instanceof Collection) {
return ((Collection)o).size(); // depends on control dependency: [if], data = [none]
} else if (o instanceof Map) {
return ((Map)o).size(); // depends on control dependency: [if], data = [none]
} else if (o.getClass().isArray()) {
return Array.getLength(o); // depends on control dependency: [if], data = [none]
} else {
return str(o).length(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void makeSceneSelectable(GVRScene scene) {
if (this.scene == scene) {
//do nothing return
return;
}
//cleanup on the currently set scene if there is one
if (this.scene != null) {
//false to remove
updateCursorsInScene(this.scene, false);
}
this.scene = scene;
if (scene == null) {
return;
}
// process the new scene
for (GVRSceneObject object : scene.getSceneObjects()) {
addSelectableObject(object);
}
//true to add
updateCursorsInScene(scene, true);
} } | public class class_name {
public void makeSceneSelectable(GVRScene scene) {
if (this.scene == scene) {
//do nothing return
return; // depends on control dependency: [if], data = [none]
}
//cleanup on the currently set scene if there is one
if (this.scene != null) {
//false to remove
updateCursorsInScene(this.scene, false); // depends on control dependency: [if], data = [(this.scene]
}
this.scene = scene;
if (scene == null) {
return; // depends on control dependency: [if], data = [none]
}
// process the new scene
for (GVRSceneObject object : scene.getSceneObjects()) {
addSelectableObject(object); // depends on control dependency: [for], data = [object]
}
//true to add
updateCursorsInScene(scene, true);
} } |
public class class_name {
public static String arrayToPath(final String[] array) {
if (array == null) {
return "";
}
return Joiner.on(",").skipNulls().join(array);
} } | public class class_name {
public static String arrayToPath(final String[] array) {
if (array == null) {
return ""; // depends on control dependency: [if], data = [none]
}
return Joiner.on(",").skipNulls().join(array);
} } |
public class class_name {
@Override
public void handleMessage(final Channel channel, final DataInput input, final ManagementProtocolHeader header) throws IOException {
final byte type = header.getType();
if(type == ManagementProtocol.TYPE_RESPONSE) {
// Handle response to local requests
final ManagementResponseHeader response = (ManagementResponseHeader) header;
final ActiveRequest<?, ?> request = requests.remove(response.getResponseId());
if(request == null) {
ProtocolLogger.CONNECTION_LOGGER.noSuchRequest(response.getResponseId(), channel);
safeWriteErrorResponse(channel, header, ProtocolLogger.ROOT_LOGGER.responseHandlerNotFound(response.getResponseId()));
} else if(response.getError() != null) {
request.handleFailed(response);
} else {
handleRequest(channel, input, header, request);
}
} else {
// Handle requests (or other messages)
try {
final ManagementRequestHeader requestHeader = validateRequest(header);
final ManagementRequestHandler<?, ?> handler = getRequestHandler(requestHeader);
if(handler == null) {
safeWriteErrorResponse(channel, header, ProtocolLogger.ROOT_LOGGER.responseHandlerNotFound(requestHeader.getBatchId()));
} else {
handleMessage(channel, input, requestHeader, handler);
}
} catch (Exception e) {
safeWriteErrorResponse(channel, header, e);
}
}
} } | public class class_name {
@Override
public void handleMessage(final Channel channel, final DataInput input, final ManagementProtocolHeader header) throws IOException {
final byte type = header.getType();
if(type == ManagementProtocol.TYPE_RESPONSE) {
// Handle response to local requests
final ManagementResponseHeader response = (ManagementResponseHeader) header;
final ActiveRequest<?, ?> request = requests.remove(response.getResponseId());
if(request == null) {
ProtocolLogger.CONNECTION_LOGGER.noSuchRequest(response.getResponseId(), channel); // depends on control dependency: [if], data = [none]
safeWriteErrorResponse(channel, header, ProtocolLogger.ROOT_LOGGER.responseHandlerNotFound(response.getResponseId())); // depends on control dependency: [if], data = [none]
} else if(response.getError() != null) {
request.handleFailed(response); // depends on control dependency: [if], data = [none]
} else {
handleRequest(channel, input, header, request); // depends on control dependency: [if], data = [none]
}
} else {
// Handle requests (or other messages)
try {
final ManagementRequestHeader requestHeader = validateRequest(header);
final ManagementRequestHandler<?, ?> handler = getRequestHandler(requestHeader);
if(handler == null) {
safeWriteErrorResponse(channel, header, ProtocolLogger.ROOT_LOGGER.responseHandlerNotFound(requestHeader.getBatchId())); // depends on control dependency: [if], data = [none]
} else {
handleMessage(channel, input, requestHeader, handler); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
safeWriteErrorResponse(channel, header, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void processLinkListRelationshipInjections(final SpecNodeWithRelationships specNode, final Document doc, final Element node,
final boolean useFixedUrls) {
// Make sure we have some links to inject
if (specNode.getLinkListRelationships().isEmpty()) return;
// Create the paragraph and list of prerequisites.
final Element itemisedListEle = doc.createElement("itemizedlist");
itemisedListEle.setAttribute("role", ROLE_LINK_LIST_LIST);
final Element itemisedListTitleEle = doc.createElement("title");
itemisedListTitleEle.setTextContent("");
itemisedListEle.appendChild(itemisedListTitleEle);
final List<List<Element>> list = new LinkedList<List<Element>>();
// Add the Relationships
for (final Relationship linkList : specNode.getLinkListRelationships()) {
if (linkList instanceof TopicRelationship) {
final SpecTopic relatedTopic = ((TopicRelationship) linkList).getSecondaryRelationship();
list.add(
DocBookUtilities.buildXRef(doc, relatedTopic.getUniqueLinkId(useFixedUrls), ROLE_LINK_LIST));
} else {
final SpecNode relatedNode = ((TargetRelationship) linkList).getSecondaryRelationship();
list.add(DocBookUtilities.buildXRef(doc, relatedNode.getUniqueLinkId(useFixedUrls), ROLE_LINK_LIST));
}
}
// Wrap the items into an itemized list
final List<Element> items = DocBookUtilities.wrapItemsInListItems(doc, list);
for (final Element ele : items) {
itemisedListEle.appendChild(ele);
}
// Add the paragraph and list after at the end of the xml data
node.appendChild(itemisedListEle);
} } | public class class_name {
public void processLinkListRelationshipInjections(final SpecNodeWithRelationships specNode, final Document doc, final Element node,
final boolean useFixedUrls) {
// Make sure we have some links to inject
if (specNode.getLinkListRelationships().isEmpty()) return;
// Create the paragraph and list of prerequisites.
final Element itemisedListEle = doc.createElement("itemizedlist");
itemisedListEle.setAttribute("role", ROLE_LINK_LIST_LIST);
final Element itemisedListTitleEle = doc.createElement("title");
itemisedListTitleEle.setTextContent("");
itemisedListEle.appendChild(itemisedListTitleEle);
final List<List<Element>> list = new LinkedList<List<Element>>();
// Add the Relationships
for (final Relationship linkList : specNode.getLinkListRelationships()) {
if (linkList instanceof TopicRelationship) {
final SpecTopic relatedTopic = ((TopicRelationship) linkList).getSecondaryRelationship();
list.add(
DocBookUtilities.buildXRef(doc, relatedTopic.getUniqueLinkId(useFixedUrls), ROLE_LINK_LIST)); // depends on control dependency: [if], data = [none]
} else {
final SpecNode relatedNode = ((TargetRelationship) linkList).getSecondaryRelationship();
list.add(DocBookUtilities.buildXRef(doc, relatedNode.getUniqueLinkId(useFixedUrls), ROLE_LINK_LIST)); // depends on control dependency: [if], data = [none]
}
}
// Wrap the items into an itemized list
final List<Element> items = DocBookUtilities.wrapItemsInListItems(doc, list);
for (final Element ele : items) {
itemisedListEle.appendChild(ele); // depends on control dependency: [for], data = [ele]
}
// Add the paragraph and list after at the end of the xml data
node.appendChild(itemisedListEle);
} } |
public class class_name {
private List<BindingConfiguration> getPersistenceContextRefs(DeploymentUnit deploymentUnit, DeploymentDescriptorEnvironment environment, ClassLoader classLoader, DeploymentReflectionIndex deploymentReflectionIndex, ResourceInjectionTarget resourceInjectionTarget) throws
DeploymentUnitProcessingException {
List<BindingConfiguration> bindingConfigurations = new ArrayList<BindingConfiguration>();
final RemoteEnvironment remoteEnvironment = environment.getEnvironment();
if (remoteEnvironment == null) {
return bindingConfigurations;
}
if (remoteEnvironment instanceof Environment) {
PersistenceContextReferencesMetaData persistenceUnitRefs = ((Environment) remoteEnvironment).getPersistenceContextRefs();
if (persistenceUnitRefs != null) {
for (PersistenceContextReferenceMetaData puRef : persistenceUnitRefs) {
String name = puRef.getName();
String persistenceUnitName = puRef.getPersistenceUnitName();
String lookup = puRef.getLookupName();
if (!isEmpty(lookup) && !isEmpty(persistenceUnitName)) {
throw JpaLogger.ROOT_LOGGER.cannotSpecifyBoth("<lookup-name>", lookup, "persistence-unit-name", persistenceUnitName, "<persistence-context-ref/>", resourceInjectionTarget);
}
if (!name.startsWith("java:")) {
name = environment.getDefaultContext() + name;
}
// our injection (source) comes from the local (ENC) lookup, no matter what.
LookupInjectionSource injectionSource = new LookupInjectionSource(name);
//add any injection targets
processInjectionTargets(resourceInjectionTarget, injectionSource, classLoader, deploymentReflectionIndex, puRef, EntityManager.class);
BindingConfiguration bindingConfiguration = null;
if (!isEmpty(lookup)) {
bindingConfiguration = new BindingConfiguration(name, new LookupInjectionSource(lookup));
} else {
PropertiesMetaData properties = puRef.getProperties();
Map<String, String> map = new HashMap<>();
if (properties != null) {
for (PropertyMetaData prop : properties) {
map.put(prop.getKey(), prop.getValue());
}
}
PersistenceContextType type = (puRef.getPersistenceContextType() == null || puRef.getPersistenceContextType() == PersistenceContextTypeDescription.TRANSACTION) ? PersistenceContextType.TRANSACTION : PersistenceContextType.EXTENDED ;
SynchronizationType synchronizationType =
(puRef.getPersistenceContextSynchronization() == null || PersistenceContextSynchronizationType.Synchronized.equals(puRef.getPersistenceContextSynchronization()))?
SynchronizationType.SYNCHRONIZED: SynchronizationType.UNSYNCHRONIZED;
InjectionSource pcBindingSource = this.getPersistenceContextBindingSource(deploymentUnit, persistenceUnitName, type, synchronizationType, map);
bindingConfiguration = new BindingConfiguration(name, pcBindingSource);
}
bindingConfigurations.add(bindingConfiguration);
}
}
}
return bindingConfigurations;
} } | public class class_name {
private List<BindingConfiguration> getPersistenceContextRefs(DeploymentUnit deploymentUnit, DeploymentDescriptorEnvironment environment, ClassLoader classLoader, DeploymentReflectionIndex deploymentReflectionIndex, ResourceInjectionTarget resourceInjectionTarget) throws
DeploymentUnitProcessingException {
List<BindingConfiguration> bindingConfigurations = new ArrayList<BindingConfiguration>();
final RemoteEnvironment remoteEnvironment = environment.getEnvironment();
if (remoteEnvironment == null) {
return bindingConfigurations;
}
if (remoteEnvironment instanceof Environment) {
PersistenceContextReferencesMetaData persistenceUnitRefs = ((Environment) remoteEnvironment).getPersistenceContextRefs();
if (persistenceUnitRefs != null) {
for (PersistenceContextReferenceMetaData puRef : persistenceUnitRefs) {
String name = puRef.getName();
String persistenceUnitName = puRef.getPersistenceUnitName();
String lookup = puRef.getLookupName();
if (!isEmpty(lookup) && !isEmpty(persistenceUnitName)) {
throw JpaLogger.ROOT_LOGGER.cannotSpecifyBoth("<lookup-name>", lookup, "persistence-unit-name", persistenceUnitName, "<persistence-context-ref/>", resourceInjectionTarget);
}
if (!name.startsWith("java:")) {
name = environment.getDefaultContext() + name; // depends on control dependency: [if], data = [none]
}
// our injection (source) comes from the local (ENC) lookup, no matter what.
LookupInjectionSource injectionSource = new LookupInjectionSource(name);
//add any injection targets
processInjectionTargets(resourceInjectionTarget, injectionSource, classLoader, deploymentReflectionIndex, puRef, EntityManager.class); // depends on control dependency: [for], data = [puRef]
BindingConfiguration bindingConfiguration = null;
if (!isEmpty(lookup)) {
bindingConfiguration = new BindingConfiguration(name, new LookupInjectionSource(lookup)); // depends on control dependency: [if], data = [none]
} else {
PropertiesMetaData properties = puRef.getProperties();
Map<String, String> map = new HashMap<>();
if (properties != null) {
for (PropertyMetaData prop : properties) {
map.put(prop.getKey(), prop.getValue()); // depends on control dependency: [for], data = [prop]
}
}
PersistenceContextType type = (puRef.getPersistenceContextType() == null || puRef.getPersistenceContextType() == PersistenceContextTypeDescription.TRANSACTION) ? PersistenceContextType.TRANSACTION : PersistenceContextType.EXTENDED ;
SynchronizationType synchronizationType =
(puRef.getPersistenceContextSynchronization() == null || PersistenceContextSynchronizationType.Synchronized.equals(puRef.getPersistenceContextSynchronization()))?
SynchronizationType.SYNCHRONIZED: SynchronizationType.UNSYNCHRONIZED;
InjectionSource pcBindingSource = this.getPersistenceContextBindingSource(deploymentUnit, persistenceUnitName, type, synchronizationType, map);
bindingConfiguration = new BindingConfiguration(name, pcBindingSource); // depends on control dependency: [if], data = [none]
}
bindingConfigurations.add(bindingConfiguration); // depends on control dependency: [for], data = [none]
}
}
}
return bindingConfigurations;
} } |
public class class_name {
public static String unescape(String s) {
StringBuilder buf = new StringBuilder();
int[] pos = new int[1];
for (int i=0; i<s.length(); ) {
char c = s.charAt(i++);
if (c == '\\') {
pos[0] = i;
int e = unescapeAt(s, pos);
if (e < 0) {
throw new IllegalArgumentException("Invalid escape sequence " +
s.substring(i-1, Math.min(i+8, s.length())));
}
buf.appendCodePoint(e);
i = pos[0];
} else {
buf.append(c);
}
}
return buf.toString();
} } | public class class_name {
public static String unescape(String s) {
StringBuilder buf = new StringBuilder();
int[] pos = new int[1];
for (int i=0; i<s.length(); ) {
char c = s.charAt(i++);
if (c == '\\') {
pos[0] = i; // depends on control dependency: [if], data = [none]
int e = unescapeAt(s, pos);
if (e < 0) {
throw new IllegalArgumentException("Invalid escape sequence " +
s.substring(i-1, Math.min(i+8, s.length())));
}
buf.appendCodePoint(e); // depends on control dependency: [if], data = [none]
i = pos[0]; // depends on control dependency: [if], data = [none]
} else {
buf.append(c); // depends on control dependency: [if], data = [(c]
}
}
return buf.toString();
} } |
public class class_name {
public int compare(CaptureSearchResult o1, CaptureSearchResult o2) {
String k1 = objectToKey(o1);
String k2 = objectToKey(o2);
if(backwards) {
return k2.compareTo(k1);
}
return k1.compareTo(k2);
} } | public class class_name {
public int compare(CaptureSearchResult o1, CaptureSearchResult o2) {
String k1 = objectToKey(o1);
String k2 = objectToKey(o2);
if(backwards) {
return k2.compareTo(k1); // depends on control dependency: [if], data = [none]
}
return k1.compareTo(k2);
} } |
public class class_name {
public static float normalizeAngle (float a) {
while (a < -FloatMath.PI) {
a += TWO_PI;
}
while (a >= FloatMath.PI) {
a -= TWO_PI;
}
return a;
} } | public class class_name {
public static float normalizeAngle (float a) {
while (a < -FloatMath.PI) {
a += TWO_PI; // depends on control dependency: [while], data = [none]
}
while (a >= FloatMath.PI) {
a -= TWO_PI; // depends on control dependency: [while], data = [none]
}
return a;
} } |
public class class_name {
public void clearPendingComposingMessage() {
ConversationProxy conversation = getConversation();
if (conversation != null) {
conversation.setMessageCenterPendingMessage(null);
conversation.setMessageCenterPendingAttachments(null);
}
} } | public class class_name {
public void clearPendingComposingMessage() {
ConversationProxy conversation = getConversation();
if (conversation != null) {
conversation.setMessageCenterPendingMessage(null); // depends on control dependency: [if], data = [null)]
conversation.setMessageCenterPendingAttachments(null); // depends on control dependency: [if], data = [null)]
}
} } |
public class class_name {
public <T> FluentValidator onEach(T[] t, final Validator<T> v) {
Preconditions.checkNotNull(v, "Validator should not be NULL");
if (ArrayUtil.isEmpty(t)) {
lastAddCount = 0;
return this;
}
return onEach(Arrays.asList(t), v);
} } | public class class_name {
public <T> FluentValidator onEach(T[] t, final Validator<T> v) {
Preconditions.checkNotNull(v, "Validator should not be NULL");
if (ArrayUtil.isEmpty(t)) {
lastAddCount = 0; // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
}
return onEach(Arrays.asList(t), v);
} } |
public class class_name {
private void calcAlignedOrbits() {
Map<Double, List<Integer>> depthMap = new TreeMap<Double, List<Integer>>();
double[] depth = getSubunitZDepth();
alignedOrbits = calcOrbits();
// calculate the mean depth of orbit along z-axis
for (List<Integer> orbit: alignedOrbits) {
// calculate the mean depth along z-axis for each orbit
double meanDepth = 0;
for (int subunit: orbit) {
meanDepth += depth[subunit];
}
meanDepth /= orbit.size();
if (depthMap.get(meanDepth) != null) {
meanDepth += 0.01;
}
// System.out.println("calcAlignedOrbits: " + meanDepth + " orbit: " + orbit);
depthMap.put(meanDepth, orbit);
}
// now fill orbits back into list ordered by depth
alignedOrbits.clear();
for (List<Integer> orbit: depthMap.values()) {
// order subunit in a clockwise rotation around the z-axis
/// starting at the 12 O-clock position (+y position)
// TODO how should this be aligned??
// alignWithReferenceAxis(orbit);
alignedOrbits.add(orbit);
}
} } | public class class_name {
private void calcAlignedOrbits() {
Map<Double, List<Integer>> depthMap = new TreeMap<Double, List<Integer>>();
double[] depth = getSubunitZDepth();
alignedOrbits = calcOrbits();
// calculate the mean depth of orbit along z-axis
for (List<Integer> orbit: alignedOrbits) {
// calculate the mean depth along z-axis for each orbit
double meanDepth = 0;
for (int subunit: orbit) {
meanDepth += depth[subunit]; // depends on control dependency: [for], data = [subunit]
}
meanDepth /= orbit.size(); // depends on control dependency: [for], data = [orbit]
if (depthMap.get(meanDepth) != null) {
meanDepth += 0.01; // depends on control dependency: [if], data = [none]
}
// System.out.println("calcAlignedOrbits: " + meanDepth + " orbit: " + orbit);
depthMap.put(meanDepth, orbit); // depends on control dependency: [for], data = [orbit]
}
// now fill orbits back into list ordered by depth
alignedOrbits.clear();
for (List<Integer> orbit: depthMap.values()) {
// order subunit in a clockwise rotation around the z-axis
/// starting at the 12 O-clock position (+y position)
// TODO how should this be aligned??
// alignWithReferenceAxis(orbit);
alignedOrbits.add(orbit); // depends on control dependency: [for], data = [orbit]
}
} } |
public class class_name {
public ReportInstanceStatusRequest withInstances(String... instances) {
if (this.instances == null) {
setInstances(new com.amazonaws.internal.SdkInternalList<String>(instances.length));
}
for (String ele : instances) {
this.instances.add(ele);
}
return this;
} } | public class class_name {
public ReportInstanceStatusRequest withInstances(String... instances) {
if (this.instances == null) {
setInstances(new com.amazonaws.internal.SdkInternalList<String>(instances.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : instances) {
this.instances.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void marshall(GetRouteResponsesRequest getRouteResponsesRequest, ProtocolMarshaller protocolMarshaller) {
if (getRouteResponsesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getRouteResponsesRequest.getApiId(), APIID_BINDING);
protocolMarshaller.marshall(getRouteResponsesRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(getRouteResponsesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(getRouteResponsesRequest.getRouteId(), ROUTEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetRouteResponsesRequest getRouteResponsesRequest, ProtocolMarshaller protocolMarshaller) {
if (getRouteResponsesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getRouteResponsesRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getRouteResponsesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getRouteResponsesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getRouteResponsesRequest.getRouteId(), ROUTEID_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 guessEntityFieldColumnType(NutMappingField ef) {
Mirror<?> mirror = ef.getTypeMirror();
// 整型
if (mirror.isInt()) {
ef.setColumnType(ColType.INT);
ef.setWidth(8);
}
// 字符串
else if (mirror.isStringLike() || mirror.is(Email.class)) {
ef.setColumnType(ColType.VARCHAR);
ef.setWidth(Daos.DEFAULT_VARCHAR_WIDTH);
}
// 长整型
else if (mirror.isLong()) {
ef.setColumnType(ColType.INT);
ef.setWidth(16);
}
// 枚举
else if (mirror.isEnum()) {
ef.setColumnType(ColType.VARCHAR);
ef.setWidth(20);
}
// 时间戳
else if (mirror.is(Timestamp.class)) {
ef.setColumnType(ColType.TIMESTAMP);
}
// 布尔
else if (mirror.isBoolean()) {
ef.setColumnType(ColType.BOOLEAN);
ef.setWidth(1);
}
// 字符
else if (mirror.isChar()) {
ef.setColumnType(ColType.CHAR);
ef.setWidth(4);
}
// 日期
else if (mirror.is(java.sql.Date.class)) {
ef.setColumnType(ColType.DATE);
}
// 时间
else if (mirror.is(java.sql.Time.class)) {
ef.setColumnType(ColType.TIME);
}
// 日期时间
else if (mirror.isOf(Calendar.class) || mirror.is(java.util.Date.class) || mirror.isLocalDateTimeLike()) {
ef.setColumnType(ColType.DATETIME);
}
// 大数
else if (mirror.is(BigDecimal.class)) {
ef.setColumnType(ColType.INT);
ef.setWidth(32);
}
// 短整型
else if (mirror.isShort()) {
ef.setColumnType(ColType.INT);
ef.setWidth(4);
}
// 字节
else if (mirror.isByte()) {
ef.setColumnType(ColType.INT);
ef.setWidth(2);
}
// 浮点
else if (mirror.isFloat()) {
ef.setColumnType(ColType.FLOAT);
}
// 双精度浮点
else if (mirror.isDouble()) {
ef.setColumnType(ColType.FLOAT);
}
// 文本流
else if (mirror.isOf(Reader.class) || mirror.isOf(Clob.class)) {
ef.setColumnType(ColType.TEXT);
}
// 二进制流
else if (mirror.isOf(InputStream.class)
|| mirror.is(byte[].class)
|| mirror.isOf(Blob.class)) {
ef.setColumnType(ColType.BINARY);
}
/*
* 上面的都不是? 那就当作字符串好了,反正可以 toString
*/
else {
if (log.isDebugEnabled()&& ef.getEntity() != null && ef.getEntity().getType() != null)
log.debugf("take field '%s(%s)'(%s) as VARCHAR(%d)",
ef.getName(),
Lang.getTypeClass(ef.getType()).getName(),
ef.getEntity().getType().getName(),
Daos.DEFAULT_VARCHAR_WIDTH);
ef.setColumnType(ColType.VARCHAR);
ef.setWidth(Daos.DEFAULT_VARCHAR_WIDTH);
}
} } | public class class_name {
public static void guessEntityFieldColumnType(NutMappingField ef) {
Mirror<?> mirror = ef.getTypeMirror();
// 整型
if (mirror.isInt()) {
ef.setColumnType(ColType.INT); // depends on control dependency: [if], data = [none]
ef.setWidth(8); // depends on control dependency: [if], data = [none]
}
// 字符串
else if (mirror.isStringLike() || mirror.is(Email.class)) {
ef.setColumnType(ColType.VARCHAR); // depends on control dependency: [if], data = [none]
ef.setWidth(Daos.DEFAULT_VARCHAR_WIDTH); // depends on control dependency: [if], data = [none]
}
// 长整型
else if (mirror.isLong()) {
ef.setColumnType(ColType.INT); // depends on control dependency: [if], data = [none]
ef.setWidth(16); // depends on control dependency: [if], data = [none]
}
// 枚举
else if (mirror.isEnum()) {
ef.setColumnType(ColType.VARCHAR); // depends on control dependency: [if], data = [none]
ef.setWidth(20); // depends on control dependency: [if], data = [none]
}
// 时间戳
else if (mirror.is(Timestamp.class)) {
ef.setColumnType(ColType.TIMESTAMP); // depends on control dependency: [if], data = [none]
}
// 布尔
else if (mirror.isBoolean()) {
ef.setColumnType(ColType.BOOLEAN); // depends on control dependency: [if], data = [none]
ef.setWidth(1); // depends on control dependency: [if], data = [none]
}
// 字符
else if (mirror.isChar()) {
ef.setColumnType(ColType.CHAR); // depends on control dependency: [if], data = [none]
ef.setWidth(4); // depends on control dependency: [if], data = [none]
}
// 日期
else if (mirror.is(java.sql.Date.class)) {
ef.setColumnType(ColType.DATE); // depends on control dependency: [if], data = [none]
}
// 时间
else if (mirror.is(java.sql.Time.class)) {
ef.setColumnType(ColType.TIME); // depends on control dependency: [if], data = [none]
}
// 日期时间
else if (mirror.isOf(Calendar.class) || mirror.is(java.util.Date.class) || mirror.isLocalDateTimeLike()) {
ef.setColumnType(ColType.DATETIME); // depends on control dependency: [if], data = [none]
}
// 大数
else if (mirror.is(BigDecimal.class)) {
ef.setColumnType(ColType.INT); // depends on control dependency: [if], data = [none]
ef.setWidth(32); // depends on control dependency: [if], data = [none]
}
// 短整型
else if (mirror.isShort()) {
ef.setColumnType(ColType.INT); // depends on control dependency: [if], data = [none]
ef.setWidth(4); // depends on control dependency: [if], data = [none]
}
// 字节
else if (mirror.isByte()) {
ef.setColumnType(ColType.INT); // depends on control dependency: [if], data = [none]
ef.setWidth(2); // depends on control dependency: [if], data = [none]
}
// 浮点
else if (mirror.isFloat()) {
ef.setColumnType(ColType.FLOAT); // depends on control dependency: [if], data = [none]
}
// 双精度浮点
else if (mirror.isDouble()) {
ef.setColumnType(ColType.FLOAT); // depends on control dependency: [if], data = [none]
}
// 文本流
else if (mirror.isOf(Reader.class) || mirror.isOf(Clob.class)) {
ef.setColumnType(ColType.TEXT); // depends on control dependency: [if], data = [none]
}
// 二进制流
else if (mirror.isOf(InputStream.class)
|| mirror.is(byte[].class)
|| mirror.isOf(Blob.class)) {
ef.setColumnType(ColType.BINARY); // depends on control dependency: [if], data = [none]
}
/*
* 上面的都不是? 那就当作字符串好了,反正可以 toString
*/
else {
if (log.isDebugEnabled()&& ef.getEntity() != null && ef.getEntity().getType() != null)
log.debugf("take field '%s(%s)'(%s) as VARCHAR(%d)",
ef.getName(),
Lang.getTypeClass(ef.getType()).getName(),
ef.getEntity().getType().getName(),
Daos.DEFAULT_VARCHAR_WIDTH);
ef.setColumnType(ColType.VARCHAR); // depends on control dependency: [if], data = [none]
ef.setWidth(Daos.DEFAULT_VARCHAR_WIDTH); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DeploymentTarget deploymentTarget, ProtocolMarshaller protocolMarshaller) {
if (deploymentTarget == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deploymentTarget.getDeploymentTargetType(), DEPLOYMENTTARGETTYPE_BINDING);
protocolMarshaller.marshall(deploymentTarget.getInstanceTarget(), INSTANCETARGET_BINDING);
protocolMarshaller.marshall(deploymentTarget.getLambdaTarget(), LAMBDATARGET_BINDING);
protocolMarshaller.marshall(deploymentTarget.getEcsTarget(), ECSTARGET_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeploymentTarget deploymentTarget, ProtocolMarshaller protocolMarshaller) {
if (deploymentTarget == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deploymentTarget.getDeploymentTargetType(), DEPLOYMENTTARGETTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deploymentTarget.getInstanceTarget(), INSTANCETARGET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deploymentTarget.getLambdaTarget(), LAMBDATARGET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deploymentTarget.getEcsTarget(), ECSTARGET_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 static void printLogStatic(String className, String msg, Object...args) {
if (args != null) {
msg = String.format(msg, args);
}
String header = String.format("%s [%s] ",
ZonedDateTime.now().format(TIME_FORMAT),
className);
System.out.println(String.format("%s%s",
header, msg.replaceAll("\n", "\n" + header)));
} } | public class class_name {
protected static void printLogStatic(String className, String msg, Object...args) {
if (args != null) {
msg = String.format(msg, args); // depends on control dependency: [if], data = [none]
}
String header = String.format("%s [%s] ",
ZonedDateTime.now().format(TIME_FORMAT),
className);
System.out.println(String.format("%s%s",
header, msg.replaceAll("\n", "\n" + header)));
} } |
public class class_name {
public void setInput( I input ) {
this.inputImage = input;
// reset the state flag so that everything need sto be computed
if( stale != null ) {
for( int i = 0; i < stale.length; i++) {
boolean a[] = stale[i];
for( int j = 0; j < a.length; j++ ) {
a[j] = true;
}
}
}
} } | public class class_name {
public void setInput( I input ) {
this.inputImage = input;
// reset the state flag so that everything need sto be computed
if( stale != null ) {
for( int i = 0; i < stale.length; i++) {
boolean a[] = stale[i];
for( int j = 0; j < a.length; j++ ) {
a[j] = true; // depends on control dependency: [for], data = [j]
}
}
}
} } |
public class class_name {
public Index<SecondaryTable<T>> getOrCreateIndex()
{
List<Node> nodeList = childNode.get("index");
if (nodeList != null && nodeList.size() > 0)
{
return new IndexImpl<SecondaryTable<T>>(this, "index", childNode, nodeList.get(0));
}
return createIndex();
} } | public class class_name {
public Index<SecondaryTable<T>> getOrCreateIndex()
{
List<Node> nodeList = childNode.get("index");
if (nodeList != null && nodeList.size() > 0)
{
return new IndexImpl<SecondaryTable<T>>(this, "index", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createIndex();
} } |
public class class_name {
public void marshall(ListBackupsRequest listBackupsRequest, ProtocolMarshaller protocolMarshaller) {
if (listBackupsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listBackupsRequest.getTableName(), TABLENAME_BINDING);
protocolMarshaller.marshall(listBackupsRequest.getLimit(), LIMIT_BINDING);
protocolMarshaller.marshall(listBackupsRequest.getTimeRangeLowerBound(), TIMERANGELOWERBOUND_BINDING);
protocolMarshaller.marshall(listBackupsRequest.getTimeRangeUpperBound(), TIMERANGEUPPERBOUND_BINDING);
protocolMarshaller.marshall(listBackupsRequest.getExclusiveStartBackupArn(), EXCLUSIVESTARTBACKUPARN_BINDING);
protocolMarshaller.marshall(listBackupsRequest.getBackupType(), BACKUPTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListBackupsRequest listBackupsRequest, ProtocolMarshaller protocolMarshaller) {
if (listBackupsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listBackupsRequest.getTableName(), TABLENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listBackupsRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listBackupsRequest.getTimeRangeLowerBound(), TIMERANGELOWERBOUND_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listBackupsRequest.getTimeRangeUpperBound(), TIMERANGEUPPERBOUND_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listBackupsRequest.getExclusiveStartBackupArn(), EXCLUSIVESTARTBACKUPARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listBackupsRequest.getBackupType(), BACKUPTYPE_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 void visit(NodeVisitor v) {
if (v.visit(this)) {
left.visit(v);
right.visit(v);
}
} } | public class class_name {
@Override
public void visit(NodeVisitor v) {
if (v.visit(this)) {
left.visit(v); // depends on control dependency: [if], data = [none]
right.visit(v); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static List<FileItem> readMultipartFileItems(HttpServletRequest request, String tempFolderPath) {
if (!ServletFileUpload.isMultipartContent(request)) {
return null;
}
DiskFileItemFactory factory = new DiskFileItemFactory();
// maximum size that will be stored in memory
factory.setSizeThreshold(4096);
// the location for saving data that is larger than getSizeThreshold()
factory.setRepository(new File(tempFolderPath));
ServletFileUpload fu = new ServletFileUpload(factory);
// set encoding to correctly handle special chars (e.g. in filenames)
fu.setHeaderEncoding(request.getCharacterEncoding());
List<FileItem> result = new ArrayList<FileItem>();
try {
List<FileItem> items = CmsCollectionsGenericWrapper.list(fu.parseRequest(request));
if (items != null) {
result = items;
}
} catch (FileUploadException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_PARSE_MULIPART_REQ_FAILED_0), e);
}
return result;
} } | public class class_name {
public static List<FileItem> readMultipartFileItems(HttpServletRequest request, String tempFolderPath) {
if (!ServletFileUpload.isMultipartContent(request)) {
return null; // depends on control dependency: [if], data = [none]
}
DiskFileItemFactory factory = new DiskFileItemFactory();
// maximum size that will be stored in memory
factory.setSizeThreshold(4096);
// the location for saving data that is larger than getSizeThreshold()
factory.setRepository(new File(tempFolderPath));
ServletFileUpload fu = new ServletFileUpload(factory);
// set encoding to correctly handle special chars (e.g. in filenames)
fu.setHeaderEncoding(request.getCharacterEncoding());
List<FileItem> result = new ArrayList<FileItem>();
try {
List<FileItem> items = CmsCollectionsGenericWrapper.list(fu.parseRequest(request));
if (items != null) {
result = items; // depends on control dependency: [if], data = [none]
}
} catch (FileUploadException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_PARSE_MULIPART_REQ_FAILED_0), e);
} // depends on control dependency: [catch], data = [none]
return result;
} } |
public class class_name {
private Collection<CopyrightInfo> extractCopyrights(File file) {
Collection<CopyrightInfo> copyrights = new ArrayList<>();
try {
boolean commentBlock = false;
Iterator<String> iterator = FileUtils.readLines(file).iterator();
int lineIndex = 1;
while (iterator.hasNext()) {
// trim (duh..)
String line = iterator.next().trim();
// check if comment block
if (!commentBlock) {
for (Map.Entry<String, String> entry : commentStartEndMap.entrySet()) {
String commentStart = entry.getKey();
String commentEnd = entry.getValue();
if (line.startsWith(commentStart)) {
if (line.contains(commentEnd)) {
commentBlock = false;
int endIndex = line.indexOf(commentEnd);
int commentLength = commentStart.length();
if (endIndex >= commentLength) {
line = line.substring(commentLength, endIndex);
} else {
line = Constants.EMPTY_STRING;
}
} else {
commentBlock = true;
}
break;
} else if (line.contains(commentStart)) {
int startIndex = line.indexOf(commentStart);
if (line.contains(commentEnd)) {
int endIndex = line.indexOf(commentEnd);
if (startIndex < endIndex) {
commentBlock = false;
line = line.substring(startIndex, endIndex);
}
} else {
commentBlock = true;
line = line.substring(startIndex);
}
break;
}
}
}
// check for one-line comments
String lowerCaseLine = line.toLowerCase();
if ((commentBlock || line.startsWith("//") || line.startsWith(Constants.POUND))
&& (lowerCaseLine.contains(COPYRIGHT) || lowerCaseLine.contains(COPYRIGHT_SYMBOL) || lowerCaseLine.contains(COPYRIGHT_ASCII_SYMBOL))) {
// ignore lines that contain (c) and math signs (+, <, etc.) near it
// and ignore lines that contain © and have other invalid ascii symbols
if ((lowerCaseLine.contains(COPYRIGHT_SYMBOL) && isMathExpression(lowerCaseLine)) ||
lowerCaseLine.contains(COPYRIGHT_ASCII_SYMBOL) && hasInvalidAsciiChars(lowerCaseLine)) {
continue;
}
line = cleanLine(line);
if (line.toLowerCase().matches(TODO_PATTERN)) {
continue;
}
StringBuilder sb = new StringBuilder();
sb.append(line);
// check if copyright continues to next line
boolean continuedToNextLine = false;
if (iterator.hasNext()) {
String copyrightOwner = null;
lowerCaseLine = line.toLowerCase();
for (String copyrightText : COPYRIGHT_TEXTS) {
if (lowerCaseLine.startsWith(copyrightText)) {
copyrightOwner = line.substring(copyrightText.length()).trim();
break;
}
}
if (copyrightOwner != null) {
// check if copyright contains an alpha char (not just years)
if (!copyrightOwner.matches(COPYRIGHT_ALPHA_CHAR_REGEX)) {
// check if line has ending of comment block
for (String commentEnd : commentStartEndMap.values()) {
if (line.contains(commentEnd)) {
commentBlock = false;
break;
}
}
// if still in comment block, read next line
if (commentBlock) {
String nextLine = cleanLine(iterator.next());
sb.append(Constants.WHITESPACE);
sb.append(nextLine);
continuedToNextLine = true;
line = nextLine;
}
}
}
}
// remove "all rights reserved" if exists
String copyright = sb.toString();
String lowercaseCopyright = copyright.toLowerCase();
if (lowercaseCopyright.contains(ALL_RIGHTS_RESERVED)) {
int startIndex = lowercaseCopyright.indexOf(ALL_RIGHTS_RESERVED);
int endIndex = startIndex + ALL_RIGHTS_RESERVED.length();
if (endIndex == copyright.length()) {
copyright = copyright.substring(0, startIndex).trim();
} else {
copyright = copyright.substring(0, startIndex).trim() + Constants.WHITESPACE + copyright.substring(endIndex).trim();
}
}
copyrights.add(new CopyrightInfo(copyright, lineIndex));
if (continuedToNextLine) {
lineIndex++;
}
}
// check if line has ending of comment block
for (String commentEnd : commentStartEndMap.values()) {
if (line.contains(commentEnd)) {
commentBlock = false;
break;
}
}
lineIndex++;
}
} catch (FileNotFoundException e) {
logger.warn("File not found: " + file.getPath());
} catch (IOException e) {
logger.warn("Error reading file: " + file.getPath());
}
removeRedundantCopyrights(copyrights);
return copyrights;
} } | public class class_name {
private Collection<CopyrightInfo> extractCopyrights(File file) {
Collection<CopyrightInfo> copyrights = new ArrayList<>();
try {
boolean commentBlock = false;
Iterator<String> iterator = FileUtils.readLines(file).iterator();
int lineIndex = 1;
while (iterator.hasNext()) {
// trim (duh..)
String line = iterator.next().trim();
// check if comment block
if (!commentBlock) {
for (Map.Entry<String, String> entry : commentStartEndMap.entrySet()) {
String commentStart = entry.getKey();
String commentEnd = entry.getValue();
if (line.startsWith(commentStart)) {
if (line.contains(commentEnd)) {
commentBlock = false; // depends on control dependency: [if], data = [none]
int endIndex = line.indexOf(commentEnd);
int commentLength = commentStart.length();
if (endIndex >= commentLength) {
line = line.substring(commentLength, endIndex); // depends on control dependency: [if], data = [none]
} else {
line = Constants.EMPTY_STRING; // depends on control dependency: [if], data = [none]
}
} else {
commentBlock = true; // depends on control dependency: [if], data = [none]
}
break;
} else if (line.contains(commentStart)) {
int startIndex = line.indexOf(commentStart);
if (line.contains(commentEnd)) {
int endIndex = line.indexOf(commentEnd);
if (startIndex < endIndex) {
commentBlock = false; // depends on control dependency: [if], data = [none]
line = line.substring(startIndex, endIndex); // depends on control dependency: [if], data = [(startIndex]
}
} else {
commentBlock = true; // depends on control dependency: [if], data = [none]
line = line.substring(startIndex); // depends on control dependency: [if], data = [none]
}
break;
}
}
}
// check for one-line comments
String lowerCaseLine = line.toLowerCase();
if ((commentBlock || line.startsWith("//") || line.startsWith(Constants.POUND))
&& (lowerCaseLine.contains(COPYRIGHT) || lowerCaseLine.contains(COPYRIGHT_SYMBOL) || lowerCaseLine.contains(COPYRIGHT_ASCII_SYMBOL))) {
// ignore lines that contain (c) and math signs (+, <, etc.) near it
// and ignore lines that contain © and have other invalid ascii symbols
if ((lowerCaseLine.contains(COPYRIGHT_SYMBOL) && isMathExpression(lowerCaseLine)) ||
lowerCaseLine.contains(COPYRIGHT_ASCII_SYMBOL) && hasInvalidAsciiChars(lowerCaseLine)) {
continue;
}
line = cleanLine(line); // depends on control dependency: [if], data = [none]
if (line.toLowerCase().matches(TODO_PATTERN)) {
continue;
}
StringBuilder sb = new StringBuilder();
sb.append(line); // depends on control dependency: [if], data = [none]
// check if copyright continues to next line
boolean continuedToNextLine = false;
if (iterator.hasNext()) {
String copyrightOwner = null;
lowerCaseLine = line.toLowerCase(); // depends on control dependency: [if], data = [none]
for (String copyrightText : COPYRIGHT_TEXTS) {
if (lowerCaseLine.startsWith(copyrightText)) {
copyrightOwner = line.substring(copyrightText.length()).trim(); // depends on control dependency: [if], data = [none]
break;
}
}
if (copyrightOwner != null) {
// check if copyright contains an alpha char (not just years)
if (!copyrightOwner.matches(COPYRIGHT_ALPHA_CHAR_REGEX)) {
// check if line has ending of comment block
for (String commentEnd : commentStartEndMap.values()) {
if (line.contains(commentEnd)) {
commentBlock = false; // depends on control dependency: [if], data = [none]
break;
}
}
// if still in comment block, read next line
if (commentBlock) {
String nextLine = cleanLine(iterator.next());
sb.append(Constants.WHITESPACE); // depends on control dependency: [if], data = [none]
sb.append(nextLine); // depends on control dependency: [if], data = [none]
continuedToNextLine = true; // depends on control dependency: [if], data = [none]
line = nextLine; // depends on control dependency: [if], data = [none]
}
}
}
}
// remove "all rights reserved" if exists
String copyright = sb.toString();
String lowercaseCopyright = copyright.toLowerCase();
if (lowercaseCopyright.contains(ALL_RIGHTS_RESERVED)) {
int startIndex = lowercaseCopyright.indexOf(ALL_RIGHTS_RESERVED);
int endIndex = startIndex + ALL_RIGHTS_RESERVED.length();
if (endIndex == copyright.length()) {
copyright = copyright.substring(0, startIndex).trim(); // depends on control dependency: [if], data = [none]
} else {
copyright = copyright.substring(0, startIndex).trim() + Constants.WHITESPACE + copyright.substring(endIndex).trim(); // depends on control dependency: [if], data = [(endIndex]
}
}
copyrights.add(new CopyrightInfo(copyright, lineIndex)); // depends on control dependency: [if], data = [none]
if (continuedToNextLine) {
lineIndex++; // depends on control dependency: [if], data = [none]
}
}
// check if line has ending of comment block
for (String commentEnd : commentStartEndMap.values()) {
if (line.contains(commentEnd)) {
commentBlock = false; // depends on control dependency: [if], data = [none]
break;
}
}
lineIndex++; // depends on control dependency: [while], data = [none]
}
} catch (FileNotFoundException e) {
logger.warn("File not found: " + file.getPath());
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
logger.warn("Error reading file: " + file.getPath());
} // depends on control dependency: [catch], data = [none]
removeRedundantCopyrights(copyrights);
return copyrights;
} } |
public class class_name {
public void run() {
final Scanner scanner = getScanner();
// start the process by loading all of the trees in the system
final List<Tree> trees;
try {
trees = Tree.fetchAllTrees(tsdb).joinUninterruptibly();
LOG.info("[" + thread_id + "] Complete");
} catch (Exception e) {
LOG.error("[" + thread_id + "] Unexpected Exception", e);
throw new RuntimeException("[" + thread_id + "] Unexpected exception", e);
}
if (trees == null) {
LOG.warn("No tree definitions were found");
return;
} else {
boolean has_enabled_tree = false;
for (Tree tree : trees) {
if (tree.getEnabled()) {
has_enabled_tree = true;
break;
}
}
if (!has_enabled_tree) {
LOG.warn("No enabled trees were found");
return;
}
LOG.info("Found [" + trees.size() + "] trees");
}
// setup an array for storing the tree processing calls so we can block
// until each call has completed
final ArrayList<Deferred<Boolean>> tree_calls =
new ArrayList<Deferred<Boolean>>();
final Deferred<Boolean> completed = new Deferred<Boolean>();
/**
* Scanner callback that loops through the UID table recursively until
* the scanner returns a null row set.
*/
final class TsuidScanner implements Callback<Deferred<Boolean>,
ArrayList<ArrayList<KeyValue>>> {
/**
* Fetches the next set of rows from the scanner, adding this class as a
* callback
* @return A meaningless deferred used to wait on until processing has
* completed
*/
public Deferred<Boolean> scan() {
return scanner.nextRows().addCallbackDeferring(this);
}
@Override
public Deferred<Boolean> call(ArrayList<ArrayList<KeyValue>> rows)
throws Exception {
if (rows == null) {
completed.callback(true);
return null;
}
for (final ArrayList<KeyValue> row : rows) {
// convert to a string one time
final String tsuid = UniqueId.uidToString(row.get(0).key());
/**
* A throttling callback used to wait for the current TSMeta to
* complete processing through the trees before continuing on with
* the next set.
*/
final class TreeBuilderBufferCB implements Callback<Boolean,
ArrayList<ArrayList<Boolean>>> {
@Override
public Boolean call(ArrayList<ArrayList<Boolean>> builder_calls)
throws Exception {
//LOG.debug("Processed [" + builder_calls.size() + "] tree_calls");
return true;
}
}
/**
* Executed after parsing a TSMeta object and loading all of the
* associated UIDMetas. Once the meta has been loaded, this callback
* runs it through each of the configured TreeBuilder objects and
* stores the resulting deferred in an array. Once processing of all
* of the rules has completed, we group the deferreds and call
* BufferCB() to wait for their completion.
*/
final class ParseCB implements Callback<Deferred<Boolean>, TSMeta> {
final ArrayList<Deferred<ArrayList<Boolean>>> builder_calls =
new ArrayList<Deferred<ArrayList<Boolean>>>();
@Override
public Deferred<Boolean> call(TSMeta meta) throws Exception {
if (meta != null) {
LOG.debug("Processing TSMeta: " + meta + " w value: " +
JSON.serializeToString(meta));
// copy the trees into a tree builder object and iterate through
// each builder. We need to do this as a builder is not thread
// safe and cannot be used asynchronously.
final ArrayList<TreeBuilder> tree_builders =
new ArrayList<TreeBuilder>(trees.size());
for (Tree tree : trees) {
if (!tree.getEnabled()) {
continue;
}
final TreeBuilder builder = new TreeBuilder(tsdb, tree);
tree_builders.add(builder);
}
for (TreeBuilder builder : tree_builders) {
builder_calls.add(builder.processTimeseriesMeta(meta));
}
return Deferred.group(builder_calls)
.addCallback(new TreeBuilderBufferCB());
} else {
return Deferred.fromResult(false);
}
}
}
/**
* An error handler used to catch issues when loading the TSMeta such
* as a missing UID name. In these situations we want to log that the
* TSMeta had an issue and continue on.
*/
final class ErrBack implements Callback<Deferred<Boolean>, Exception> {
@Override
public Deferred<Boolean> call(Exception e) throws Exception {
if (e.getClass().equals(IllegalStateException.class)) {
LOG.error("Invalid data when processing TSUID [" + tsuid + "]", e);
} else if (e.getClass().equals(IllegalArgumentException.class)) {
LOG.error("Invalid data when processing TSUID [" + tsuid + "]", e);
} else if (e.getClass().equals(NoSuchUniqueId.class)) {
LOG.warn("Timeseries [" + tsuid +
"] includes a non-existant UID: " + e.getMessage());
} else {
LOG.error("[" + thread_id + "] Exception while processing TSUID [" +
tsuid + "]", e);
}
return Deferred.fromResult(false);
}
}
// matched a TSMeta column, so request a parsing and loading of
// associated UIDMeta objects, then pass it off to callbacks for
// parsing through the trees.
final Deferred<Boolean> process_tsmeta =
TSMeta.parseFromColumn(tsdb, row.get(0), true)
.addCallbackDeferring(new ParseCB());
process_tsmeta.addErrback(new ErrBack());
tree_calls.add(process_tsmeta);
}
/**
* Another buffer callback that waits for the current set of TSMetas to
* complete their tree calls before we fetch another set of rows from
* the scanner. This necessary to avoid OOM issues.
*/
final class ContinueCB implements Callback<Deferred<Boolean>,
ArrayList<Boolean>> {
@Override
public Deferred<Boolean> call(ArrayList<Boolean> tsuids)
throws Exception {
LOG.debug("Processed [" + tsuids.size() + "] tree_calls, continuing");
tree_calls.clear();
return scan();
}
}
// request the next set of rows from the scanner, but wait until the
// current set of TSMetas has been processed so we don't slaughter our
// host
Deferred.group(tree_calls).addCallback(new ContinueCB());
return Deferred.fromResult(null);
}
}
/**
* Used to capture unhandled exceptions from the scanner callbacks and
* exit the thread properly
*/
final class ErrBack implements Callback<Deferred<Boolean>, Exception> {
@Override
public Deferred<Boolean> call(Exception e) throws Exception {
LOG.error("Unexpected exception", e);
completed.callback(false);
return Deferred.fromResult(false);
}
}
final TsuidScanner tree_scanner = new TsuidScanner();
tree_scanner.scan().addErrback(new ErrBack());
try {
completed.joinUninterruptibly();
LOG.info("[" + thread_id + "] Complete");
} catch (Exception e) {
LOG.error("[" + thread_id + "] Scanner Exception", e);
throw new RuntimeException("[" + thread_id + "] Scanner exception", e);
}
return;
} } | public class class_name {
public void run() {
final Scanner scanner = getScanner();
// start the process by loading all of the trees in the system
final List<Tree> trees;
try {
trees = Tree.fetchAllTrees(tsdb).joinUninterruptibly(); // depends on control dependency: [try], data = [none]
LOG.info("[" + thread_id + "] Complete"); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("[" + thread_id + "] Unexpected Exception", e);
throw new RuntimeException("[" + thread_id + "] Unexpected exception", e);
} // depends on control dependency: [catch], data = [none]
if (trees == null) {
LOG.warn("No tree definitions were found"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else {
boolean has_enabled_tree = false;
for (Tree tree : trees) {
if (tree.getEnabled()) {
has_enabled_tree = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!has_enabled_tree) {
LOG.warn("No enabled trees were found"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
LOG.info("Found [" + trees.size() + "] trees"); // depends on control dependency: [if], data = [none]
}
// setup an array for storing the tree processing calls so we can block
// until each call has completed
final ArrayList<Deferred<Boolean>> tree_calls =
new ArrayList<Deferred<Boolean>>();
final Deferred<Boolean> completed = new Deferred<Boolean>();
/**
* Scanner callback that loops through the UID table recursively until
* the scanner returns a null row set.
*/
final class TsuidScanner implements Callback<Deferred<Boolean>,
ArrayList<ArrayList<KeyValue>>> {
/**
* Fetches the next set of rows from the scanner, adding this class as a
* callback
* @return A meaningless deferred used to wait on until processing has
* completed
*/
public Deferred<Boolean> scan() {
return scanner.nextRows().addCallbackDeferring(this);
}
@Override
public Deferred<Boolean> call(ArrayList<ArrayList<KeyValue>> rows)
throws Exception {
if (rows == null) {
completed.callback(true);
return null;
}
for (final ArrayList<KeyValue> row : rows) {
// convert to a string one time
final String tsuid = UniqueId.uidToString(row.get(0).key());
/**
* A throttling callback used to wait for the current TSMeta to
* complete processing through the trees before continuing on with
* the next set.
*/
final class TreeBuilderBufferCB implements Callback<Boolean,
ArrayList<ArrayList<Boolean>>> {
@Override
public Boolean call(ArrayList<ArrayList<Boolean>> builder_calls)
throws Exception {
//LOG.debug("Processed [" + builder_calls.size() + "] tree_calls");
return true;
}
}
/**
* Executed after parsing a TSMeta object and loading all of the
* associated UIDMetas. Once the meta has been loaded, this callback
* runs it through each of the configured TreeBuilder objects and
* stores the resulting deferred in an array. Once processing of all
* of the rules has completed, we group the deferreds and call
* BufferCB() to wait for their completion.
*/
final class ParseCB implements Callback<Deferred<Boolean>, TSMeta> {
final ArrayList<Deferred<ArrayList<Boolean>>> builder_calls =
new ArrayList<Deferred<ArrayList<Boolean>>>();
@Override
public Deferred<Boolean> call(TSMeta meta) throws Exception {
if (meta != null) {
LOG.debug("Processing TSMeta: " + meta + " w value: " +
JSON.serializeToString(meta));
// copy the trees into a tree builder object and iterate through
// each builder. We need to do this as a builder is not thread
// safe and cannot be used asynchronously.
final ArrayList<TreeBuilder> tree_builders =
new ArrayList<TreeBuilder>(trees.size());
for (Tree tree : trees) {
if (!tree.getEnabled()) {
continue;
}
final TreeBuilder builder = new TreeBuilder(tsdb, tree);
tree_builders.add(builder);
}
for (TreeBuilder builder : tree_builders) {
builder_calls.add(builder.processTimeseriesMeta(meta));
}
return Deferred.group(builder_calls)
.addCallback(new TreeBuilderBufferCB());
} else {
return Deferred.fromResult(false);
}
}
}
/**
* An error handler used to catch issues when loading the TSMeta such
* as a missing UID name. In these situations we want to log that the
* TSMeta had an issue and continue on.
*/
final class ErrBack implements Callback<Deferred<Boolean>, Exception> {
@Override
public Deferred<Boolean> call(Exception e) throws Exception {
if (e.getClass().equals(IllegalStateException.class)) {
LOG.error("Invalid data when processing TSUID [" + tsuid + "]", e);
} else if (e.getClass().equals(IllegalArgumentException.class)) {
LOG.error("Invalid data when processing TSUID [" + tsuid + "]", e);
} else if (e.getClass().equals(NoSuchUniqueId.class)) {
LOG.warn("Timeseries [" + tsuid +
"] includes a non-existant UID: " + e.getMessage());
} else {
LOG.error("[" + thread_id + "] Exception while processing TSUID [" +
tsuid + "]", e);
}
return Deferred.fromResult(false);
}
}
// matched a TSMeta column, so request a parsing and loading of
// associated UIDMeta objects, then pass it off to callbacks for
// parsing through the trees.
final Deferred<Boolean> process_tsmeta =
TSMeta.parseFromColumn(tsdb, row.get(0), true)
.addCallbackDeferring(new ParseCB());
process_tsmeta.addErrback(new ErrBack());
tree_calls.add(process_tsmeta);
}
/**
* Another buffer callback that waits for the current set of TSMetas to
* complete their tree calls before we fetch another set of rows from
* the scanner. This necessary to avoid OOM issues.
*/
final class ContinueCB implements Callback<Deferred<Boolean>,
ArrayList<Boolean>> {
@Override
public Deferred<Boolean> call(ArrayList<Boolean> tsuids)
throws Exception {
LOG.debug("Processed [" + tsuids.size() + "] tree_calls, continuing");
tree_calls.clear();
return scan();
}
}
// request the next set of rows from the scanner, but wait until the
// current set of TSMetas has been processed so we don't slaughter our
// host
Deferred.group(tree_calls).addCallback(new ContinueCB());
return Deferred.fromResult(null);
}
}
/**
* Used to capture unhandled exceptions from the scanner callbacks and
* exit the thread properly
*/
final class ErrBack implements Callback<Deferred<Boolean>, Exception> {
@Override
public Deferred<Boolean> call(Exception e) throws Exception {
LOG.error("Unexpected exception", e);
completed.callback(false);
return Deferred.fromResult(false);
}
}
final TsuidScanner tree_scanner = new TsuidScanner();
tree_scanner.scan().addErrback(new ErrBack());
try {
completed.joinUninterruptibly();
LOG.info("[" + thread_id + "] Complete");
} catch (Exception e) {
LOG.error("[" + thread_id + "] Scanner Exception", e);
throw new RuntimeException("[" + thread_id + "] Scanner exception", e);
}
return;
} } |
public class class_name {
public void marshall(PostToConnectionRequest postToConnectionRequest, ProtocolMarshaller protocolMarshaller) {
if (postToConnectionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(postToConnectionRequest.getData(), DATA_BINDING);
protocolMarshaller.marshall(postToConnectionRequest.getConnectionId(), CONNECTIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PostToConnectionRequest postToConnectionRequest, ProtocolMarshaller protocolMarshaller) {
if (postToConnectionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(postToConnectionRequest.getData(), DATA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(postToConnectionRequest.getConnectionId(), CONNECTIONID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(CaptionSelector captionSelector, ProtocolMarshaller protocolMarshaller) {
if (captionSelector == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(captionSelector.getCustomLanguageCode(), CUSTOMLANGUAGECODE_BINDING);
protocolMarshaller.marshall(captionSelector.getLanguageCode(), LANGUAGECODE_BINDING);
protocolMarshaller.marshall(captionSelector.getSourceSettings(), SOURCESETTINGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CaptionSelector captionSelector, ProtocolMarshaller protocolMarshaller) {
if (captionSelector == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(captionSelector.getCustomLanguageCode(), CUSTOMLANGUAGECODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(captionSelector.getLanguageCode(), LANGUAGECODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(captionSelector.getSourceSettings(), SOURCESETTINGS_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 {
@Deprecated
public SocketFactory getSocketFactory() {
if (socketFactory != null) {
return socketFactory;
} else if (getSslSettings().isEnabled()) {
return sslContext == null ? DEFAULT_SSL_SOCKET_FACTORY : sslContext.getSocketFactory();
} else {
return DEFAULT_SOCKET_FACTORY;
}
} } | public class class_name {
@Deprecated
public SocketFactory getSocketFactory() {
if (socketFactory != null) {
return socketFactory; // depends on control dependency: [if], data = [none]
} else if (getSslSettings().isEnabled()) {
return sslContext == null ? DEFAULT_SSL_SOCKET_FACTORY : sslContext.getSocketFactory(); // depends on control dependency: [if], data = [none]
} else {
return DEFAULT_SOCKET_FACTORY; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean detectWebkit()
{
if ((this.initCompleted == true) ||
(this.isWebkit == true))
return this.isWebkit;
if (userAgent.indexOf(engineWebKit) != -1) {
return true;
}
return false;
} } | public class class_name {
public boolean detectWebkit()
{
if ((this.initCompleted == true) ||
(this.isWebkit == true))
return this.isWebkit;
if (userAgent.indexOf(engineWebKit) != -1) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void marshall(DeleteTagOptionRequest deleteTagOptionRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteTagOptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteTagOptionRequest.getId(), ID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteTagOptionRequest deleteTagOptionRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteTagOptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteTagOptionRequest.getId(), ID_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 List<IndexableField> indexableFields(Columns columns) {
Double lon = readLongitude(columns);
Double lat = readLatitude(columns);
if (lon == null && lat == null) {
return Collections.emptyList();
} else if (lat == null) {
throw new IndexException("Latitude column required if there is a longitude");
} else if (lon == null) {
throw new IndexException("Longitude column required if there is a latitude");
}
Point point = CONTEXT.makePoint(lon, lat);
return Arrays.asList(strategy.createIndexableFields(point));
} } | public class class_name {
@Override
public List<IndexableField> indexableFields(Columns columns) {
Double lon = readLongitude(columns);
Double lat = readLatitude(columns);
if (lon == null && lat == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
} else if (lat == null) {
throw new IndexException("Latitude column required if there is a longitude");
} else if (lon == null) {
throw new IndexException("Longitude column required if there is a latitude");
}
Point point = CONTEXT.makePoint(lon, lat);
return Arrays.asList(strategy.createIndexableFields(point));
} } |
public class class_name {
@Scheduled(fixedRate = 60000) // run every minute
public void invalidateOldTokens() {
List<String> invalidTokens = new ArrayList<String>(); // tokens to invalidate
for (Map.Entry<String, TokenContainer> entry : tokens.entrySet()) {
if (!entry.getValue().isValid()) {
invalidTokens.add(entry.getKey());
}
}
for (String token : invalidTokens) {
logout(token);
}
} } | public class class_name {
@Scheduled(fixedRate = 60000) // run every minute
public void invalidateOldTokens() {
List<String> invalidTokens = new ArrayList<String>(); // tokens to invalidate
for (Map.Entry<String, TokenContainer> entry : tokens.entrySet()) {
if (!entry.getValue().isValid()) {
invalidTokens.add(entry.getKey()); // depends on control dependency: [if], data = [none]
}
}
for (String token : invalidTokens) {
logout(token); // depends on control dependency: [for], data = [token]
}
} } |
public class class_name {
private boolean isLocked(String path) {
// get lock for path
CmsRepositoryLockInfo lock = m_session.getLock(path);
if (lock == null) {
return false;
}
// check if found lock fits to the lock token from request
// String currentToken = "<opaquelocktoken:" + generateLockToken(req, lock) + ">";
// if (currentToken.equals(parseLockTokenHeader(req))) {
// return false;
// }
if (lock.getUsername().equals(m_username)) {
return false;
}
return true;
} } | public class class_name {
private boolean isLocked(String path) {
// get lock for path
CmsRepositoryLockInfo lock = m_session.getLock(path);
if (lock == null) {
return false; // depends on control dependency: [if], data = [none]
}
// check if found lock fits to the lock token from request
// String currentToken = "<opaquelocktoken:" + generateLockToken(req, lock) + ">";
// if (currentToken.equals(parseLockTokenHeader(req))) {
// return false;
// }
if (lock.getUsername().equals(m_username)) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public Object call(Object value) {
if (value == null) { return new Integer(0); }
return new Integer(String.valueOf(value).length());
} } | public class class_name {
public Object call(Object value) {
if (value == null) { return new Integer(0); } // depends on control dependency: [if], data = [none]
return new Integer(String.valueOf(value).length());
} } |
public class class_name {
public void marshall(UserStorage userStorage, ProtocolMarshaller protocolMarshaller) {
if (userStorage == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userStorage.getCapacity(), CAPACITY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UserStorage userStorage, ProtocolMarshaller protocolMarshaller) {
if (userStorage == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userStorage.getCapacity(), CAPACITY_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 Optional<Class> resolveSuperGenericTypeArgument(Class type) {
try {
Type genericSuperclass = type.getGenericSuperclass();
if (genericSuperclass instanceof ParameterizedType) {
return resolveSingleTypeArgument(genericSuperclass);
}
return Optional.empty();
} catch (NoClassDefFoundError e) {
return Optional.empty();
}
} } | public class class_name {
public static Optional<Class> resolveSuperGenericTypeArgument(Class type) {
try {
Type genericSuperclass = type.getGenericSuperclass();
if (genericSuperclass instanceof ParameterizedType) {
return resolveSingleTypeArgument(genericSuperclass); // depends on control dependency: [if], data = [none]
}
return Optional.empty(); // depends on control dependency: [try], data = [none]
} catch (NoClassDefFoundError e) {
return Optional.empty();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
protected boolean prepare(final Context2D context, final Attributes attr, final double alpha)
{
final double end = attr.getEndAngle();
final double beg = attr.getStartAngle();
if (beg == end)
{
return false;
}
final double ord = attr.getOuterRadius();
final double ird = attr.getInnerRadius();
final boolean ccw = attr.isCounterClockwise();
if ((ord > 0) && (ird > 0))
{
context.beginPath();
context.arc(0, 0, ord, beg, end, ccw);
context.arc(0, 0, ird, end, beg, (false == ccw));
context.closePath();
return true;
}
return false;
} } | public class class_name {
@Override
protected boolean prepare(final Context2D context, final Attributes attr, final double alpha)
{
final double end = attr.getEndAngle();
final double beg = attr.getStartAngle();
if (beg == end)
{
return false; // depends on control dependency: [if], data = [none]
}
final double ord = attr.getOuterRadius();
final double ird = attr.getInnerRadius();
final boolean ccw = attr.isCounterClockwise();
if ((ord > 0) && (ird > 0))
{
context.beginPath(); // depends on control dependency: [if], data = [none]
context.arc(0, 0, ord, beg, end, ccw); // depends on control dependency: [if], data = [none]
context.arc(0, 0, ird, end, beg, (false == ccw)); // depends on control dependency: [if], data = [none]
context.closePath(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public synchronized JtxTransactionMode getTxMode(final Class type, final String methodName, final Class[] methodArgTypes, final String unique) {
String signature = type.getName() + '#' + methodName + '%' + unique;
JtxTransactionMode txMode = txmap.get(signature);
if (txMode == null) {
if (!txmap.containsKey(signature)) {
final Method m;
try {
m = type.getMethod(methodName, methodArgTypes);
} catch (NoSuchMethodException nsmex) {
throw new ProxettaException(nsmex);
}
final TransactionAnnotationValues txAnn = readTransactionAnnotation(m);
if (txAnn != null) {
txMode = new JtxTransactionMode(
txAnn.propagation(),
txAnn.isolation(),
txAnn.readOnly(),
txAnn.timeout()
);
} else {
txMode = defaultTransactionMode;
}
txmap.put(signature, txMode);
}
}
return txMode;
} } | public class class_name {
public synchronized JtxTransactionMode getTxMode(final Class type, final String methodName, final Class[] methodArgTypes, final String unique) {
String signature = type.getName() + '#' + methodName + '%' + unique;
JtxTransactionMode txMode = txmap.get(signature);
if (txMode == null) {
if (!txmap.containsKey(signature)) {
final Method m;
try {
m = type.getMethod(methodName, methodArgTypes); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException nsmex) {
throw new ProxettaException(nsmex);
} // depends on control dependency: [catch], data = [none]
final TransactionAnnotationValues txAnn = readTransactionAnnotation(m);
if (txAnn != null) {
txMode = new JtxTransactionMode(
txAnn.propagation(),
txAnn.isolation(),
txAnn.readOnly(),
txAnn.timeout()
); // depends on control dependency: [if], data = [none]
} else {
txMode = defaultTransactionMode; // depends on control dependency: [if], data = [none]
}
txmap.put(signature, txMode); // depends on control dependency: [if], data = [none]
}
}
return txMode;
} } |
public class class_name {
public String getRemoteAddr() {
if(getTransaction() != null) {
if(((SIPTransaction)getTransaction()).getPeerPacketSourceAddress() != null &&
((SIPTransaction)getTransaction()).getPeerPacketSourceAddress().getHostAddress() != null) {
return ((SIPTransaction)getTransaction()).getPeerPacketSourceAddress().getHostAddress();
} else {
return ((SIPTransaction)getTransaction()).getPeerAddress();
}
} else {
ViaHeader via = (ViaHeader) message.getHeader(ViaHeader.NAME);
// https://code.google.com/p/sipservlets/issues/detail?id=137
boolean isExternal = sipFactoryImpl.getSipApplicationDispatcher().isViaHeaderExternal(via);
if(message instanceof Request && !isExternal) {
// locally generated messages should return null as per Javadoc
return null;
}
if(via == null) {
return null;
} else {
return via.getHost();
}
}
} } | public class class_name {
public String getRemoteAddr() {
if(getTransaction() != null) {
if(((SIPTransaction)getTransaction()).getPeerPacketSourceAddress() != null &&
((SIPTransaction)getTransaction()).getPeerPacketSourceAddress().getHostAddress() != null) {
return ((SIPTransaction)getTransaction()).getPeerPacketSourceAddress().getHostAddress(); // depends on control dependency: [if], data = [none]
} else {
return ((SIPTransaction)getTransaction()).getPeerAddress(); // depends on control dependency: [if], data = [none]
}
} else {
ViaHeader via = (ViaHeader) message.getHeader(ViaHeader.NAME);
// https://code.google.com/p/sipservlets/issues/detail?id=137
boolean isExternal = sipFactoryImpl.getSipApplicationDispatcher().isViaHeaderExternal(via);
if(message instanceof Request && !isExternal) {
// locally generated messages should return null as per Javadoc
return null; // depends on control dependency: [if], data = [none]
}
if(via == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
return via.getHost(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private synchronized TableBucket getNextBucketFromExistingBatch() {
if (this.currentBatch != null) {
TableBucket next = this.currentBatch.next();
if (!this.currentBatch.hasNext()) {
this.currentBatch = null;
}
return next;
}
return null;
} } | public class class_name {
private synchronized TableBucket getNextBucketFromExistingBatch() {
if (this.currentBatch != null) {
TableBucket next = this.currentBatch.next();
if (!this.currentBatch.hasNext()) {
this.currentBatch = null; // depends on control dependency: [if], data = [none]
}
return next; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Nullable
public static DayOfTheWeek valueOf(@Nullable final DayOfWeek dayOfWeek) {
if (dayOfWeek == null) {
return null;
}
final int value = dayOfWeek.getValue();
for (final DayOfTheWeek dow : ALL) {
if (value == dow.id) {
return dow;
}
}
throw new IllegalArgumentException("Unknown day week: " + dayOfWeek);
} } | public class class_name {
@Nullable
public static DayOfTheWeek valueOf(@Nullable final DayOfWeek dayOfWeek) {
if (dayOfWeek == null) {
return null; // depends on control dependency: [if], data = [none]
}
final int value = dayOfWeek.getValue();
for (final DayOfTheWeek dow : ALL) {
if (value == dow.id) {
return dow; // depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException("Unknown day week: " + dayOfWeek);
} } |
public class class_name {
public int getValueIndex() {
int result = 0;
Node previousSibling = getElement().getPreviousSibling();
while (previousSibling != null) {
result++;
previousSibling = previousSibling.getPreviousSibling();
}
return result;
} } | public class class_name {
public int getValueIndex() {
int result = 0;
Node previousSibling = getElement().getPreviousSibling();
while (previousSibling != null) {
result++;
// depends on control dependency: [while], data = [none]
previousSibling = previousSibling.getPreviousSibling();
// depends on control dependency: [while], data = [none]
}
return result;
} } |
public class class_name {
public static ScryptKDFParams getInstance(Object obj)
{
if (obj instanceof ScryptKDFParams) {
return (ScryptKDFParams) obj;
}
if (obj != null) {
return new ScryptKDFParams(ASN1Sequence.getInstance(obj));
}
return null;
} } | public class class_name {
public static ScryptKDFParams getInstance(Object obj)
{
if (obj instanceof ScryptKDFParams) {
return (ScryptKDFParams) obj; // depends on control dependency: [if], data = [none]
}
if (obj != null) {
return new ScryptKDFParams(ASN1Sequence.getInstance(obj)); // depends on control dependency: [if], data = [(obj]
}
return null;
} } |
public class class_name {
private static Family findFamily(final FamS fams) {
if (!fams.isSet()) {
return new Family();
}
final Family foundFamily = (Family) fams.find(fams.getToString());
if (foundFamily == null) {
return new Family();
}
return foundFamily;
} } | public class class_name {
private static Family findFamily(final FamS fams) {
if (!fams.isSet()) {
return new Family(); // depends on control dependency: [if], data = [none]
}
final Family foundFamily = (Family) fams.find(fams.getToString());
if (foundFamily == null) {
return new Family(); // depends on control dependency: [if], data = [none]
}
return foundFamily;
} } |
public class class_name {
public EEnum getIfcArithmeticOperatorEnum() {
if (ifcArithmeticOperatorEnumEEnum == null) {
ifcArithmeticOperatorEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(781);
}
return ifcArithmeticOperatorEnumEEnum;
} } | public class class_name {
public EEnum getIfcArithmeticOperatorEnum() {
if (ifcArithmeticOperatorEnumEEnum == null) {
ifcArithmeticOperatorEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(781);
// depends on control dependency: [if], data = [none]
}
return ifcArithmeticOperatorEnumEEnum;
} } |
public class class_name {
@Override
public final void setSpecifics(final SpecificsOfItem pSpecifics) {
this.specifics = pSpecifics;
if (this.itsId == null) {
this.itsId = new SeServiceSpecificsId();
}
this.itsId.setSpecifics(this.specifics);
} } | public class class_name {
@Override
public final void setSpecifics(final SpecificsOfItem pSpecifics) {
this.specifics = pSpecifics;
if (this.itsId == null) {
this.itsId = new SeServiceSpecificsId(); // depends on control dependency: [if], data = [none]
}
this.itsId.setSpecifics(this.specifics);
} } |
public class class_name {
public EClass getIfcConstraintAggregationRelationship() {
if (ifcConstraintAggregationRelationshipEClass == null) {
ifcConstraintAggregationRelationshipEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(108);
}
return ifcConstraintAggregationRelationshipEClass;
} } | public class class_name {
public EClass getIfcConstraintAggregationRelationship() {
if (ifcConstraintAggregationRelationshipEClass == null) {
ifcConstraintAggregationRelationshipEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(108);
// depends on control dependency: [if], data = [none]
}
return ifcConstraintAggregationRelationshipEClass;
} } |
public class class_name {
private <T> void preFlightCheckFields(final T target) {
ClassStreams.selfAndSupertypes(target.getClass())
.map(Class::getDeclaredFields)
.flatMap(Arrays::stream)
.filter(field -> field.getAnnotation(CliOptionGroup.class) != null)
.forEach(field -> {
field.setAccessible(true);
try {
preFlightCheck(field.get(target));
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
});
} } | public class class_name {
private <T> void preFlightCheckFields(final T target) {
ClassStreams.selfAndSupertypes(target.getClass())
.map(Class::getDeclaredFields)
.flatMap(Arrays::stream)
.filter(field -> field.getAnnotation(CliOptionGroup.class) != null)
.forEach(field -> {
field.setAccessible(true);
try {
preFlightCheck(field.get(target)); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
});
} } |
public class class_name {
static boolean containsDisallowedQuantileLabelForSummary(List<String> labelNames, Type type) {
if (!Type.SUMMARY.equals(type)) {
return false;
}
for (String label : labelNames) {
if (LABEL_NAME_QUANTILE.equals(label)) {
return true;
}
}
return false;
} } | public class class_name {
static boolean containsDisallowedQuantileLabelForSummary(List<String> labelNames, Type type) {
if (!Type.SUMMARY.equals(type)) {
return false; // depends on control dependency: [if], data = [none]
}
for (String label : labelNames) {
if (LABEL_NAME_QUANTILE.equals(label)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void setLongProperty(String pstrSection, String pstrProp,
long plngVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, Long.toString(plngVal), pstrComments);
} } | public class class_name {
public void setLongProperty(String pstrSection, String pstrProp,
long plngVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
// depends on control dependency: [if], data = [none]
this.mhmapSections.put(pstrSection, objSec);
// depends on control dependency: [if], data = [none]
}
objSec.setProperty(pstrProp, Long.toString(plngVal), pstrComments);
} } |
public class class_name {
String getWhereClause() {
final StringGrabber sgWhere = new StringGrabber();
List<Field> primaryKeyFieldList = getPrimaryKeyFieldList();
if (primaryKeyFieldList.size() > 0) {
sgWhere.append("WHERE ");
for (Field field : primaryKeyFieldList) {
DBColumn dbColumn = field.getAnnotation(DBColumn.class);
sgWhere.append(dbColumn.columnName());
sgWhere.append(" = ? AND ");
}
sgWhere.removeTail(5);
}
return sgWhere.toString();
} } | public class class_name {
String getWhereClause() {
final StringGrabber sgWhere = new StringGrabber();
List<Field> primaryKeyFieldList = getPrimaryKeyFieldList();
if (primaryKeyFieldList.size() > 0) {
sgWhere.append("WHERE ");
// depends on control dependency: [if], data = [none]
for (Field field : primaryKeyFieldList) {
DBColumn dbColumn = field.getAnnotation(DBColumn.class);
sgWhere.append(dbColumn.columnName());
// depends on control dependency: [for], data = [none]
sgWhere.append(" = ? AND ");
}
sgWhere.removeTail(5);
// depends on control dependency: [for], data = [none]
}
return sgWhere.toString();
// depends on control dependency: [if], data = [none]
} } |
public class class_name {
public void setValidatorFactory(ValidatorFactory validatorFactory) {
// Si le paramètre n'est pas null
if(validatorFactory != null) {
// On positionne la fabrique
this.validatorFactory = validatorFactory;
// On construit le validateur
this.validator = validatorFactory.getValidator();
}
} } | public class class_name {
public void setValidatorFactory(ValidatorFactory validatorFactory) {
// Si le paramètre n'est pas null
if(validatorFactory != null) {
// On positionne la fabrique
this.validatorFactory = validatorFactory;
// depends on control dependency: [if], data = [none]
// On construit le validateur
this.validator = validatorFactory.getValidator();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Deprecated
@PublicEvolving
public DataSink<T> sortLocalOutput(String fieldExpression, Order order) {
int numFields;
int[] fields;
Order[] orders;
// compute flat field positions for (nested) sorting fields
Keys.ExpressionKeys<T> ek = new Keys.ExpressionKeys<>(fieldExpression, this.type);
fields = ek.computeLogicalKeyPositions();
if (!Keys.ExpressionKeys.isSortKey(fieldExpression, this.type)) {
throw new InvalidProgramException("Selected sort key is not a sortable type");
}
numFields = fields.length;
orders = new Order[numFields];
Arrays.fill(orders, order);
if (this.sortKeyPositions == null) {
// set sorting info
this.sortKeyPositions = fields;
this.sortOrders = orders;
} else {
// append sorting info to existing info
int oldLength = this.sortKeyPositions.length;
int newLength = oldLength + numFields;
this.sortKeyPositions = Arrays.copyOf(this.sortKeyPositions, newLength);
this.sortOrders = Arrays.copyOf(this.sortOrders, newLength);
for (int i = 0; i < numFields; i++) {
this.sortKeyPositions[oldLength + i] = fields[i];
this.sortOrders[oldLength + i] = orders[i];
}
}
return this;
} } | public class class_name {
@Deprecated
@PublicEvolving
public DataSink<T> sortLocalOutput(String fieldExpression, Order order) {
int numFields;
int[] fields;
Order[] orders;
// compute flat field positions for (nested) sorting fields
Keys.ExpressionKeys<T> ek = new Keys.ExpressionKeys<>(fieldExpression, this.type);
fields = ek.computeLogicalKeyPositions();
if (!Keys.ExpressionKeys.isSortKey(fieldExpression, this.type)) {
throw new InvalidProgramException("Selected sort key is not a sortable type");
}
numFields = fields.length;
orders = new Order[numFields];
Arrays.fill(orders, order);
if (this.sortKeyPositions == null) {
// set sorting info
this.sortKeyPositions = fields; // depends on control dependency: [if], data = [none]
this.sortOrders = orders; // depends on control dependency: [if], data = [none]
} else {
// append sorting info to existing info
int oldLength = this.sortKeyPositions.length;
int newLength = oldLength + numFields;
this.sortKeyPositions = Arrays.copyOf(this.sortKeyPositions, newLength); // depends on control dependency: [if], data = [(this.sortKeyPositions]
this.sortOrders = Arrays.copyOf(this.sortOrders, newLength); // depends on control dependency: [if], data = [none]
for (int i = 0; i < numFields; i++) {
this.sortKeyPositions[oldLength + i] = fields[i]; // depends on control dependency: [for], data = [i]
this.sortOrders[oldLength + i] = orders[i]; // depends on control dependency: [for], data = [i]
}
}
return this;
} } |
public class class_name {
public void addImportName(ClassDesc classDesc, String importedClassName) {
String packageName = ClassUtil.getPackageName(importedClassName);
if (isImportTargetPackage(classDesc, packageName)) {
classDesc.addImportName(importedClassName);
}
} } | public class class_name {
public void addImportName(ClassDesc classDesc, String importedClassName) {
String packageName = ClassUtil.getPackageName(importedClassName);
if (isImportTargetPackage(classDesc, packageName)) {
classDesc.addImportName(importedClassName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected final void clearAuthenticationAttributes() {
HttpSession session = http.getCurrentRequest().getSession(false);
if (session == null) {
return;
}
session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
} } | public class class_name {
protected final void clearAuthenticationAttributes() {
HttpSession session = http.getCurrentRequest().getSession(false);
if (session == null) {
return; // depends on control dependency: [if], data = [none]
}
session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
} } |
public class class_name {
public static Map<String, String> parseFragment(String fragment)
{
Map<String, String> result = new TreeMap<String, String>();
fragment = StringUtils.removeStart(fragment, "!");
String[] split = StringUtils.split(fragment, "&");
for (String s : split)
{
String[] parts = s.split("=", 2);
String name = parts[0].trim();
String value = "";
if (parts.length == 2)
{
try
{
// every name that starts with "_" is base64 encoded
if (name.startsWith("_"))
{
value = new String(Base64.decodeBase64(parts[1]), "UTF-8");
}
else
{
value = URLDecoder.decode(parts[1], "UTF-8");
}
}
catch (UnsupportedEncodingException ex)
{
log.error(ex.getMessage(), ex);
}
}
name = StringUtils.removeStart(name, "_");
result.put(name, value);
}
return result;
} } | public class class_name {
public static Map<String, String> parseFragment(String fragment)
{
Map<String, String> result = new TreeMap<String, String>();
fragment = StringUtils.removeStart(fragment, "!");
String[] split = StringUtils.split(fragment, "&");
for (String s : split)
{
String[] parts = s.split("=", 2);
String name = parts[0].trim();
String value = "";
if (parts.length == 2)
{
try
{
// every name that starts with "_" is base64 encoded
if (name.startsWith("_"))
{
value = new String(Base64.decodeBase64(parts[1]), "UTF-8"); // depends on control dependency: [if], data = [none]
}
else
{
value = URLDecoder.decode(parts[1], "UTF-8"); // depends on control dependency: [if], data = [none]
}
}
catch (UnsupportedEncodingException ex)
{
log.error(ex.getMessage(), ex);
} // depends on control dependency: [catch], data = [none]
}
name = StringUtils.removeStart(name, "_"); // depends on control dependency: [for], data = [s]
result.put(name, value); // depends on control dependency: [for], data = [s]
}
return result;
} } |
public class class_name {
private void setMentsu(Mentsu mentsu) {
if (mentsu instanceof Toitsu) {
toitsuList.add((Toitsu) mentsu);
} else if (mentsu instanceof Shuntsu) {
shuntsuList.add((Shuntsu) mentsu);
} else if (mentsu instanceof Kotsu) {
kotsuList.add((Kotsu) mentsu);
} else if (mentsu instanceof Kantsu) {
kantsuList.add((Kantsu) mentsu);
}
} } | public class class_name {
private void setMentsu(Mentsu mentsu) {
if (mentsu instanceof Toitsu) {
toitsuList.add((Toitsu) mentsu); // depends on control dependency: [if], data = [none]
} else if (mentsu instanceof Shuntsu) {
shuntsuList.add((Shuntsu) mentsu); // depends on control dependency: [if], data = [none]
} else if (mentsu instanceof Kotsu) {
kotsuList.add((Kotsu) mentsu); // depends on control dependency: [if], data = [none]
} else if (mentsu instanceof Kantsu) {
kantsuList.add((Kantsu) mentsu); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void destroyAll() {
for (Layer layer : this.layerManager.getLayers()) {
this.layerManager.getLayers().remove(layer);
layer.onDestroy();
if (layer instanceof TileLayer) {
((TileLayer<?>) layer).getTileCache().destroy();
}
if (layer instanceof TileRendererLayer) {
LabelStore labelStore = ((TileRendererLayer) layer).getLabelStore();
if (labelStore != null) {
labelStore.clear();
}
}
}
destroy();
} } | public class class_name {
@Override
public void destroyAll() {
for (Layer layer : this.layerManager.getLayers()) {
this.layerManager.getLayers().remove(layer); // depends on control dependency: [for], data = [layer]
layer.onDestroy(); // depends on control dependency: [for], data = [layer]
if (layer instanceof TileLayer) {
((TileLayer<?>) layer).getTileCache().destroy(); // depends on control dependency: [if], data = [none]
}
if (layer instanceof TileRendererLayer) {
LabelStore labelStore = ((TileRendererLayer) layer).getLabelStore();
if (labelStore != null) {
labelStore.clear(); // depends on control dependency: [if], data = [none]
}
}
}
destroy();
} } |
public class class_name {
public static Properties getPropertiesFromClasspath(String fileName)
throws PropertiesFileNotFoundException {
Properties props = new Properties();
try {
InputStream is = ClassLoader.getSystemResourceAsStream(fileName);
if (is == null) { // try this instead
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
logger.debug("loaded properties file with Thread.currentThread()");
}
props.load(is);
} catch (Exception e) {
throw new PropertiesFileNotFoundException(
"ERROR LOADING PROPERTIES FROM CLASSPATH >" + fileName + "< !!!", e);
}
return props;
} } | public class class_name {
public static Properties getPropertiesFromClasspath(String fileName)
throws PropertiesFileNotFoundException {
Properties props = new Properties();
try {
InputStream is = ClassLoader.getSystemResourceAsStream(fileName);
if (is == null) { // try this instead
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); // depends on control dependency: [if], data = [none]
logger.debug("loaded properties file with Thread.currentThread()"); // depends on control dependency: [if], data = [none]
}
props.load(is);
} catch (Exception e) {
throw new PropertiesFileNotFoundException(
"ERROR LOADING PROPERTIES FROM CLASSPATH >" + fileName + "< !!!", e);
}
return props;
} } |
public class class_name {
void addTrigger(TriggerDef td, HsqlName otherName) {
int index = triggerList.length;
if (otherName != null) {
int pos = getTriggerIndex(otherName.name);
if (pos != -1) {
index = pos + 1;
}
}
triggerList = (TriggerDef[]) ArrayUtil.toAdjustedArray(triggerList,
td, index, 1);
TriggerDef[] list = triggerLists[td.vectorIndex];
index = list.length;
if (otherName != null) {
for (int i = 0; i < list.length; i++) {
TriggerDef trigger = list[i];
if (trigger.name.name.equals(otherName.name)) {
index = i + 1;
break;
}
}
}
list = (TriggerDef[]) ArrayUtil.toAdjustedArray(list, td, index, 1);
triggerLists[td.vectorIndex] = list;
} } | public class class_name {
void addTrigger(TriggerDef td, HsqlName otherName) {
int index = triggerList.length;
if (otherName != null) {
int pos = getTriggerIndex(otherName.name);
if (pos != -1) {
index = pos + 1; // depends on control dependency: [if], data = [none]
}
}
triggerList = (TriggerDef[]) ArrayUtil.toAdjustedArray(triggerList,
td, index, 1);
TriggerDef[] list = triggerLists[td.vectorIndex];
index = list.length;
if (otherName != null) {
for (int i = 0; i < list.length; i++) {
TriggerDef trigger = list[i];
if (trigger.name.name.equals(otherName.name)) {
index = i + 1; // depends on control dependency: [if], data = [none]
break;
}
}
}
list = (TriggerDef[]) ArrayUtil.toAdjustedArray(list, td, index, 1);
triggerLists[td.vectorIndex] = list;
} } |
public class class_name {
public void marshall(AudioSelector audioSelector, ProtocolMarshaller protocolMarshaller) {
if (audioSelector == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(audioSelector.getName(), NAME_BINDING);
protocolMarshaller.marshall(audioSelector.getSelectorSettings(), SELECTORSETTINGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AudioSelector audioSelector, ProtocolMarshaller protocolMarshaller) {
if (audioSelector == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(audioSelector.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(audioSelector.getSelectorSettings(), SELECTORSETTINGS_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 QB appendCanonicalizedAttributeToQuery(final QB queryBuilder, final String queryAttribute, final String dataAttribute, final List<Object> queryValues) {
// All logging messages were previously in generateQuery() and were
// copy/pasted verbatim
final List<Object> canonicalizedQueryValues = this.canonicalizeAttribute(queryAttribute, queryValues, caseInsensitiveQueryAttributes);
if (dataAttribute == null) {
// preserved from historical versions which just pass queryValues through without any association to a dataAttribute,
// and a slightly different log message
if (this.logger.isDebugEnabled()) {
this.logger.debug("Adding attribute '" + queryAttribute + "' with value '" + queryValues + "' to query builder '" + queryBuilder + "'");
}
return appendAttributeToQuery(queryBuilder, dataAttribute, canonicalizedQueryValues);
}
if (this.logger.isDebugEnabled()) {
this.logger.debug("Adding attribute '" + dataAttribute + "' with value '" + queryValues + "' to query builder '" + queryBuilder + "'");
}
return appendAttributeToQuery(queryBuilder, dataAttribute, canonicalizedQueryValues);
} } | public class class_name {
protected QB appendCanonicalizedAttributeToQuery(final QB queryBuilder, final String queryAttribute, final String dataAttribute, final List<Object> queryValues) {
// All logging messages were previously in generateQuery() and were
// copy/pasted verbatim
final List<Object> canonicalizedQueryValues = this.canonicalizeAttribute(queryAttribute, queryValues, caseInsensitiveQueryAttributes);
if (dataAttribute == null) {
// preserved from historical versions which just pass queryValues through without any association to a dataAttribute,
// and a slightly different log message
if (this.logger.isDebugEnabled()) {
this.logger.debug("Adding attribute '" + queryAttribute + "' with value '" + queryValues + "' to query builder '" + queryBuilder + "'"); // depends on control dependency: [if], data = [none]
}
return appendAttributeToQuery(queryBuilder, dataAttribute, canonicalizedQueryValues); // depends on control dependency: [if], data = [none]
}
if (this.logger.isDebugEnabled()) {
this.logger.debug("Adding attribute '" + dataAttribute + "' with value '" + queryValues + "' to query builder '" + queryBuilder + "'"); // depends on control dependency: [if], data = [none]
}
return appendAttributeToQuery(queryBuilder, dataAttribute, canonicalizedQueryValues);
} } |
public class class_name {
public static TypeInformation<?> PRIMITIVE_ARRAY(TypeInformation<?> elementType) {
if (elementType == BOOLEAN) {
return PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == BYTE) {
return PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == SHORT) {
return PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == INT) {
return PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == LONG) {
return PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == FLOAT) {
return PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == DOUBLE) {
return PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == CHAR) {
return PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO;
}
throw new IllegalArgumentException("Invalid element type for a primitive array.");
} } | public class class_name {
public static TypeInformation<?> PRIMITIVE_ARRAY(TypeInformation<?> elementType) {
if (elementType == BOOLEAN) {
return PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO; // depends on control dependency: [if], data = [none]
} else if (elementType == BYTE) {
return PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO; // depends on control dependency: [if], data = [none]
} else if (elementType == SHORT) {
return PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO; // depends on control dependency: [if], data = [none]
} else if (elementType == INT) {
return PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO; // depends on control dependency: [if], data = [none]
} else if (elementType == LONG) {
return PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO; // depends on control dependency: [if], data = [none]
} else if (elementType == FLOAT) {
return PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO; // depends on control dependency: [if], data = [none]
} else if (elementType == DOUBLE) {
return PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO; // depends on control dependency: [if], data = [none]
} else if (elementType == CHAR) {
return PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("Invalid element type for a primitive array.");
} } |
public class class_name {
@SuppressWarnings("unchecked")
public O withConstantSetFirst(String... constantSetFirst) {
if (this.udfSemantics == null) {
this.udfSemantics = new DualInputSemanticProperties();
}
SemanticPropUtil.getSemanticPropsDualFromString(this.udfSemantics, constantSetFirst, null,
null, null, null, null, this.getInput1Type(), this.getInput2Type(), this.getResultType());
O returnType = (O) this;
return returnType;
} } | public class class_name {
@SuppressWarnings("unchecked")
public O withConstantSetFirst(String... constantSetFirst) {
if (this.udfSemantics == null) {
this.udfSemantics = new DualInputSemanticProperties(); // depends on control dependency: [if], data = [none]
}
SemanticPropUtil.getSemanticPropsDualFromString(this.udfSemantics, constantSetFirst, null,
null, null, null, null, this.getInput1Type(), this.getInput2Type(), this.getResultType());
O returnType = (O) this;
return returnType;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.