code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public long setCommitIndex(long commitIndex) {
checkArgument(commitIndex >= 0, "commitIndex must be positive");
long previousCommitIndex = this.commitIndex;
if (commitIndex > previousCommitIndex) {
this.commitIndex = commitIndex;
logWriter.commit(Math.min(commitIndex, logWriter.getLastIndex()));
long configurationIndex = cluster.getConfiguration().index();
if (configurationIndex > previousCommitIndex && configurationIndex <= commitIndex) {
cluster.commit();
}
setFirstCommitIndex(commitIndex);
}
return previousCommitIndex;
} } | public class class_name {
public long setCommitIndex(long commitIndex) {
checkArgument(commitIndex >= 0, "commitIndex must be positive");
long previousCommitIndex = this.commitIndex;
if (commitIndex > previousCommitIndex) {
this.commitIndex = commitIndex; // depends on control dependency: [if], data = [none]
logWriter.commit(Math.min(commitIndex, logWriter.getLastIndex())); // depends on control dependency: [if], data = [(commitIndex]
long configurationIndex = cluster.getConfiguration().index();
if (configurationIndex > previousCommitIndex && configurationIndex <= commitIndex) {
cluster.commit(); // depends on control dependency: [if], data = [none]
}
setFirstCommitIndex(commitIndex); // depends on control dependency: [if], data = [(commitIndex]
}
return previousCommitIndex;
} } |
public class class_name {
public DomainCommandBuilder setInterProcessHostControllerPort(final String port) {
if (port != null) {
setInterProcessHostControllerPort(Integer.parseInt(port));
}
return this;
} } | public class class_name {
public DomainCommandBuilder setInterProcessHostControllerPort(final String port) {
if (port != null) {
setInterProcessHostControllerPort(Integer.parseInt(port)); // depends on control dependency: [if], data = [(port]
}
return this;
} } |
public class class_name {
private void makeDirectories(String dirPath, String permissions) throws IOException {
if (!dirPath.contains("/")) return;
String[] pathElements = dirPath.split("/");
if (pathElements.length == 1) return;
// if the string ends with / it means that the dir path contains only directories,
// otherwise if it does not contain /, the last element of the path is the file name,
// so it must be ignored when creating the directory structure
int lastElement = dirPath.endsWith("/") ? pathElements.length : pathElements.length - 1;
for (int i = 0; i < lastElement; i++) {
String singleDir = pathElements[i];
if (singleDir.isEmpty()) continue;
if (!ftpClient.changeWorkingDirectory(singleDir)) {
if (ftpClient.makeDirectory(singleDir)) {
Logger.debug(LOG_TAG, "Created remote directory: " + singleDir);
if (permissions != null) {
setPermission(singleDir, permissions);
}
ftpClient.changeWorkingDirectory(singleDir);
} else {
throw new IOException("Unable to create remote directory: " + singleDir);
}
}
}
} } | public class class_name {
private void makeDirectories(String dirPath, String permissions) throws IOException {
if (!dirPath.contains("/")) return;
String[] pathElements = dirPath.split("/");
if (pathElements.length == 1) return;
// if the string ends with / it means that the dir path contains only directories,
// otherwise if it does not contain /, the last element of the path is the file name,
// so it must be ignored when creating the directory structure
int lastElement = dirPath.endsWith("/") ? pathElements.length : pathElements.length - 1;
for (int i = 0; i < lastElement; i++) {
String singleDir = pathElements[i];
if (singleDir.isEmpty()) continue;
if (!ftpClient.changeWorkingDirectory(singleDir)) {
if (ftpClient.makeDirectory(singleDir)) {
Logger.debug(LOG_TAG, "Created remote directory: " + singleDir);
if (permissions != null) {
setPermission(singleDir, permissions); // depends on control dependency: [if], data = [none]
}
ftpClient.changeWorkingDirectory(singleDir);
} else {
throw new IOException("Unable to create remote directory: " + singleDir);
}
}
}
} } |
public class class_name {
public void resolveBuilderType() {
if (getBuilderTypeStyle() == null) {
setBuilderTypeStyle("");
}
final String fieldType = getFieldType();
String generics = "";
if (fieldType.contains("<")) {
generics = fieldType.substring(fieldType.indexOf('<'));
}
if (getBuilderTypeStyle().equals("smart")) {
setBuilderType(fieldType);
} else if (getBuilderTypeStyle().length() > 0) {
if (getBuilderTypeStyle().contains("<>")) {
setBuilderType(getBuilderTypeStyle().replace("<>", generics));
} else if (getBuilderTypeStyle().contains("<")) {
setBuilderType(getBuilderTypeStyle());
} else {
setBuilderType(getBuilderTypeStyle() + generics);
}
} else {
setBuilderType(fieldType);
}
} } | public class class_name {
public void resolveBuilderType() {
if (getBuilderTypeStyle() == null) {
setBuilderTypeStyle(""); // depends on control dependency: [if], data = [none]
}
final String fieldType = getFieldType();
String generics = "";
if (fieldType.contains("<")) {
generics = fieldType.substring(fieldType.indexOf('<')); // depends on control dependency: [if], data = [none]
}
if (getBuilderTypeStyle().equals("smart")) {
setBuilderType(fieldType); // depends on control dependency: [if], data = [none]
} else if (getBuilderTypeStyle().length() > 0) {
if (getBuilderTypeStyle().contains("<>")) {
setBuilderType(getBuilderTypeStyle().replace("<>", generics)); // depends on control dependency: [if], data = [none]
} else if (getBuilderTypeStyle().contains("<")) {
setBuilderType(getBuilderTypeStyle()); // depends on control dependency: [if], data = [none]
} else {
setBuilderType(getBuilderTypeStyle() + generics); // depends on control dependency: [if], data = [none]
}
} else {
setBuilderType(fieldType); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Version parse(String version) {
Assert.hasText(version, "Version must not be null o empty!");
String[] parts = version.trim().split("\\.");
int[] intParts = new int[parts.length];
for (int i = 0; i < parts.length; i++) {
String input = i == parts.length - 1 ? parts[i].replaceAll("\\D.*", "") : parts[i];
if (StringUtils.hasText(input)) {
try {
intParts[i] = Integer.parseInt(input);
} catch (IllegalArgumentException o_O) {
throw new IllegalArgumentException(String.format(VERSION_PARSE_ERROR, input, version), o_O);
}
}
}
return new Version(intParts);
} } | public class class_name {
public static Version parse(String version) {
Assert.hasText(version, "Version must not be null o empty!");
String[] parts = version.trim().split("\\.");
int[] intParts = new int[parts.length];
for (int i = 0; i < parts.length; i++) {
String input = i == parts.length - 1 ? parts[i].replaceAll("\\D.*", "") : parts[i];
if (StringUtils.hasText(input)) {
try {
intParts[i] = Integer.parseInt(input); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException o_O) {
throw new IllegalArgumentException(String.format(VERSION_PARSE_ERROR, input, version), o_O);
} // depends on control dependency: [catch], data = [none]
}
}
return new Version(intParts);
} } |
public class class_name {
public static Character[] valuesOf(char[] array) {
Character[] dest = new Character[array.length];
for (int i = 0; i < array.length; i++) {
dest[i] = Character.valueOf(array[i]);
}
return dest;
} } | public class class_name {
public static Character[] valuesOf(char[] array) {
Character[] dest = new Character[array.length];
for (int i = 0; i < array.length; i++) {
dest[i] = Character.valueOf(array[i]); // depends on control dependency: [for], data = [i]
}
return dest;
} } |
public class class_name {
public Finder<SQLProperty> getEntityBySimpleName(String entityName) {
if (entityName == null)
return null;
SQLiteEntity result = entitiesBySimpleName.get(entityName.toLowerCase());
if (result != null)
return result;
for (GeneratedTypeElement item : this.generatedEntities) {
if (item.typeSpec.name.toLowerCase().equals(entityName.toLowerCase())) {
return item;
}
}
return null;
} } | public class class_name {
public Finder<SQLProperty> getEntityBySimpleName(String entityName) {
if (entityName == null)
return null;
SQLiteEntity result = entitiesBySimpleName.get(entityName.toLowerCase());
if (result != null)
return result;
for (GeneratedTypeElement item : this.generatedEntities) {
if (item.typeSpec.name.toLowerCase().equals(entityName.toLowerCase())) {
return item; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public WriteResult insert(DBObject dbObject, QueryOptions options) {
if(options != null && (options.containsKey("w") || options.containsKey("wtimeout"))) {
// Some info about params: http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html
return dbCollection.insert(dbObject, new WriteConcern(options.getInt("w", 1),
options.getInt("wtimeout", 0)));
}else {
return dbCollection.insert(dbObject);
}
} } | public class class_name {
public WriteResult insert(DBObject dbObject, QueryOptions options) {
if(options != null && (options.containsKey("w") || options.containsKey("wtimeout"))) {
// Some info about params: http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html
return dbCollection.insert(dbObject, new WriteConcern(options.getInt("w", 1),
options.getInt("wtimeout", 0))); // depends on control dependency: [if], data = [none]
}else {
return dbCollection.insert(dbObject); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean add(Task task) {
// Check that this slot has been assigned to the job sending this task
Preconditions.checkArgument(task.getJobID().equals(jobId), "The task's job id does not match the " +
"job id for which the slot has been allocated.");
Preconditions.checkArgument(task.getAllocationId().equals(allocationId), "The task's allocation " +
"id does not match the allocation id for which the slot has been allocated.");
Preconditions.checkState(TaskSlotState.ACTIVE == state, "The task slot is not in state active.");
Task oldTask = tasks.put(task.getExecutionId(), task);
if (oldTask != null) {
tasks.put(task.getExecutionId(), oldTask);
return false;
} else {
return true;
}
} } | public class class_name {
public boolean add(Task task) {
// Check that this slot has been assigned to the job sending this task
Preconditions.checkArgument(task.getJobID().equals(jobId), "The task's job id does not match the " +
"job id for which the slot has been allocated.");
Preconditions.checkArgument(task.getAllocationId().equals(allocationId), "The task's allocation " +
"id does not match the allocation id for which the slot has been allocated.");
Preconditions.checkState(TaskSlotState.ACTIVE == state, "The task slot is not in state active.");
Task oldTask = tasks.put(task.getExecutionId(), task);
if (oldTask != null) {
tasks.put(task.getExecutionId(), oldTask); // 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]
}
} } |
public class class_name {
private static TableColumnModelListener createTableColumnModelListener(final JTable table) {
return new TableColumnModelListener() {
public void columnAdded(TableColumnModelEvent e) {
if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) {
table.getParent().repaint();
}
}
public void columnMarginChanged(ChangeEvent e) {
if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) {
table.getParent().repaint();
}
}
public void columnMoved(TableColumnModelEvent e) {
if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) {
table.getParent().repaint();
}
}
public void columnRemoved(TableColumnModelEvent e) {
if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) {
table.getParent().repaint();
}
}
public void columnSelectionChanged(ListSelectionEvent e) {
if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) {
table.getParent().repaint();
}
}
};
} } | public class class_name {
private static TableColumnModelListener createTableColumnModelListener(final JTable table) {
return new TableColumnModelListener() {
public void columnAdded(TableColumnModelEvent e) {
if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) {
table.getParent().repaint(); // depends on control dependency: [if], data = [none]
}
}
public void columnMarginChanged(ChangeEvent e) {
if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) {
table.getParent().repaint(); // depends on control dependency: [if], data = [none]
}
}
public void columnMoved(TableColumnModelEvent e) {
if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) {
table.getParent().repaint(); // depends on control dependency: [if], data = [none]
}
}
public void columnRemoved(TableColumnModelEvent e) {
if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) {
table.getParent().repaint(); // depends on control dependency: [if], data = [none]
}
}
public void columnSelectionChanged(ListSelectionEvent e) {
if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) {
table.getParent().repaint(); // depends on control dependency: [if], data = [none]
}
}
};
} } |
public class class_name {
public void setCompatibilities(java.util.Collection<String> compatibilities) {
if (compatibilities == null) {
this.compatibilities = null;
return;
}
this.compatibilities = new com.amazonaws.internal.SdkInternalList<String>(compatibilities);
} } | public class class_name {
public void setCompatibilities(java.util.Collection<String> compatibilities) {
if (compatibilities == null) {
this.compatibilities = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.compatibilities = new com.amazonaws.internal.SdkInternalList<String>(compatibilities);
} } |
public class class_name {
public DataSet query(final Class<?> targetClass, Collection<String> selectColumnNames, Condition whereClause, String groupBy, String having, String orderBy,
int offset, int count) {
if (N.isNullOrEmpty(selectColumnNames)) {
selectColumnNames = ClassUtil.getPropGetMethodList(targetClass).keySet();
}
final String[] columns = selectColumnNames.toArray(new String[selectColumnNames.size()]);
final Type<Object>[] selectColumnTypes = new Type[columns.length];
for (int i = 0, len = columns.length; i < len; i++) {
selectColumnTypes[i] = Type.valueOf(ClassUtil.getPropGetMethod(targetClass, columns[i]).getReturnType());
}
return query(ClassUtil.getSimpleClassName(targetClass), columns, selectColumnTypes, whereClause, groupBy, having, orderBy, offset, count);
} } | public class class_name {
public DataSet query(final Class<?> targetClass, Collection<String> selectColumnNames, Condition whereClause, String groupBy, String having, String orderBy,
int offset, int count) {
if (N.isNullOrEmpty(selectColumnNames)) {
selectColumnNames = ClassUtil.getPropGetMethodList(targetClass).keySet();
// depends on control dependency: [if], data = [none]
}
final String[] columns = selectColumnNames.toArray(new String[selectColumnNames.size()]);
final Type<Object>[] selectColumnTypes = new Type[columns.length];
for (int i = 0, len = columns.length; i < len; i++) {
selectColumnTypes[i] = Type.valueOf(ClassUtil.getPropGetMethod(targetClass, columns[i]).getReturnType());
// depends on control dependency: [for], data = [i]
}
return query(ClassUtil.getSimpleClassName(targetClass), columns, selectColumnTypes, whereClause, groupBy, having, orderBy, offset, count);
} } |
public class class_name {
static int getUsageIndex(DSAKeyValidationParameters.Usage usage)
{
if (usage == DSAKeyValidationParameters.Usage.DIGITAL_SIGNATURE) {
return DSAParameterGenerationParameters.DIGITAL_SIGNATURE_USAGE;
} else if (usage == DSAKeyValidationParameters.Usage.KEY_ESTABLISHMENT) {
return DSAParameterGenerationParameters.KEY_ESTABLISHMENT_USAGE;
}
return -1;
} } | public class class_name {
static int getUsageIndex(DSAKeyValidationParameters.Usage usage)
{
if (usage == DSAKeyValidationParameters.Usage.DIGITAL_SIGNATURE) {
return DSAParameterGenerationParameters.DIGITAL_SIGNATURE_USAGE; // depends on control dependency: [if], data = [none]
} else if (usage == DSAKeyValidationParameters.Usage.KEY_ESTABLISHMENT) {
return DSAParameterGenerationParameters.KEY_ESTABLISHMENT_USAGE; // depends on control dependency: [if], data = [none]
}
return -1;
} } |
public class class_name {
public EClass getIfcMaterialLayerSet() {
if (ifcMaterialLayerSetEClass == null) {
ifcMaterialLayerSetEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(310);
}
return ifcMaterialLayerSetEClass;
} } | public class class_name {
public EClass getIfcMaterialLayerSet() {
if (ifcMaterialLayerSetEClass == null) {
ifcMaterialLayerSetEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(310);
// depends on control dependency: [if], data = [none]
}
return ifcMaterialLayerSetEClass;
} } |
public class class_name {
public void setFrom(Address address) {
assertArgumentNotNull("address", address);
from = address;
try {
message.setFrom(address);
} catch (MessagingException e) {
String msg = buildAddressSettingFailureMessage("from", address);
throw new SMailMessageSettingFailureException(msg, e);
}
} } | public class class_name {
public void setFrom(Address address) {
assertArgumentNotNull("address", address);
from = address;
try {
message.setFrom(address); // depends on control dependency: [try], data = [none]
} catch (MessagingException e) {
String msg = buildAddressSettingFailureMessage("from", address);
throw new SMailMessageSettingFailureException(msg, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int compareTo(Object o) {
if (!(o instanceof UrlMapping)) {
throw new IllegalArgumentException("Cannot compare with Object [" + o + "]. It is not an instance of UrlMapping!");
}
if (equals(o)) return 0;
UrlMapping other = (UrlMapping) o;
// this wild card count
final int thisStaticTokenCount = getStaticTokenCount(this);
final int thisSingleWildcardCount = getSingleWildcardCount(this);
final int thisDoubleWildcardCount = getDoubleWildcardCount(this);
// the other wild card count
final int otherStaticTokenCount = getStaticTokenCount(other);
final int otherSingleWildcardCount = getSingleWildcardCount(other);
final int otherDoubleWildcardCount = getDoubleWildcardCount(other);
final boolean hasWildCards = thisDoubleWildcardCount > 0 || thisSingleWildcardCount > 0;
final boolean otherHasWildCards = otherDoubleWildcardCount > 0 || otherSingleWildcardCount > 0;
// Always prioritise the / root mapping
boolean isThisRoot = thisStaticTokenCount == 0 && thisSingleWildcardCount == 0 && thisDoubleWildcardCount == 0;
boolean isThatRoot = otherStaticTokenCount == 0 && otherDoubleWildcardCount == 0 && otherSingleWildcardCount == 0;
if(isThisRoot && isThatRoot) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has equal precedence with mapping [{}]", this.toString(), other.toString());
}
return 0;
}
else if(isThisRoot) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it is the root", this.toString(), other.toString());
}
return 1;
}
else if(isThatRoot) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] because the latter is the root", this.toString(), other.toString());
}
return -1;
}
if (otherStaticTokenCount == 0 && thisStaticTokenCount > 0) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it has more path tokens", this.toString(), other.toString());
}
return 1;
}
if (thisStaticTokenCount == 0 && otherStaticTokenCount > 0) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] because it has fewer path tokens", this.toString(), other.toString());
}
return -1;
}
final int thisStaticAndWildcardTokenCount = getStaticAndWildcardTokenCount(this);
final int otherStaticAndWildcardTokenCount = getStaticAndWildcardTokenCount(other);
if (otherStaticAndWildcardTokenCount==0 && thisStaticAndWildcardTokenCount>0) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it has more path tokens [{} vs {}]", this.toString(), other.toString(), thisStaticAndWildcardTokenCount, otherStaticAndWildcardTokenCount);
}
return 1;
}
if (thisStaticAndWildcardTokenCount==0 && otherStaticAndWildcardTokenCount>0) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because the latter has more path tokens [{} vs {}]", this.toString(), other.toString(), thisStaticAndWildcardTokenCount, otherStaticAndWildcardTokenCount);
}
return -1;
}
final int staticDiff = thisStaticTokenCount - otherStaticTokenCount;
if (staticDiff < 0 && !otherHasWildCards) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] because the latter has more concrete path tokens [{} vs {}]", this.toString(), other.toString(), thisStaticTokenCount, otherStaticTokenCount);
}
return -1;
}
else if(staticDiff > 0 && !hasWildCards) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it has more concrete path tokens [{} vs {}]", this.toString(), other.toString(), thisStaticTokenCount, otherStaticTokenCount);
}
return 1;
}
String[] thisTokens = getUrlData().getTokens();
String[] otherTokens = other.getUrlData().getTokens();
final int thisTokensLength = thisTokens.length;
final int otherTokensLength = otherTokens.length;
int greaterLength = thisTokensLength > otherTokensLength ? thisTokensLength : otherTokensLength;
for (int i = 0; i < greaterLength; i++) {
final boolean thisHasMoreTokens = i < thisTokensLength;
final boolean otherHasMoreTokens = i < otherTokensLength;
boolean thisTokenIsWildcard = !thisHasMoreTokens || isSingleWildcard(thisTokens[i]);
boolean otherTokenIsWildcard = !otherHasMoreTokens || isSingleWildcard(otherTokens[i]);
if (thisTokenIsWildcard && !otherTokenIsWildcard) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] because the latter contains more concrete tokens", this.toString(), other.toString());
}
return -1;
}
if (!thisTokenIsWildcard && otherTokenIsWildcard) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it contains more concrete tokens", this.toString(), other.toString());
}
return 1;
}
}
final int doubleWildcardDiff = otherDoubleWildcardCount - thisDoubleWildcardCount;
if (doubleWildcardDiff != 0) {
if(LOG.isDebugEnabled()) {
if(doubleWildcardDiff > 0) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] due containing more double wild cards [{} vs. {}]", this.toString(), other.toString(), thisDoubleWildcardCount, otherDoubleWildcardCount);
}
else if(doubleWildcardDiff < 0) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] due to the latter containing more double wild cards [{} vs. {}]", this.toString(), other.toString(), thisDoubleWildcardCount, otherDoubleWildcardCount);
}
}
return doubleWildcardDiff;
}
final int singleWildcardDiff = otherSingleWildcardCount - thisSingleWildcardCount;
if (singleWildcardDiff != 0) {
if(LOG.isDebugEnabled()) {
if(singleWildcardDiff > 0) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it contains more single wild card matches [{} vs. {}]", this.toString(), other.toString(), thisSingleWildcardCount, otherSingleWildcardCount);
}
else if(singleWildcardDiff < 0) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] due to the latter containing more single wild card matches[{} vs. {}]", this.toString(), other.toString(), thisSingleWildcardCount, otherSingleWildcardCount);
}
}
return singleWildcardDiff;
}
int thisConstraintCount = getAppliedConstraintsCount(this);
int thatConstraintCount = getAppliedConstraintsCount(other);
int constraintDiff = thisConstraintCount - thatConstraintCount;
if (constraintDiff != 0) {
if(LOG.isDebugEnabled()) {
if(constraintDiff > 0) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] since it defines more constraints [{} vs. {}]", this.toString(), other.toString(), thisConstraintCount, thatConstraintCount);
}
else if(constraintDiff < 0) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] since the latter defines more constraints [{} vs. {}]", this.toString(), other.toString(), thisConstraintCount, thatConstraintCount);
}
}
return constraintDiff;
}
int allDiff = (thisStaticTokenCount - otherStaticTokenCount) + (thisSingleWildcardCount - otherSingleWildcardCount) + (thisDoubleWildcardCount - otherDoubleWildcardCount);
if(allDiff != 0) {
if(LOG.isDebugEnabled()) {
if(allDiff > 0) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] due to the overall diff", this.toString(), other.toString());
}
else if(allDiff < 0) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] due to the overall diff", this.toString(), other.toString());
}
}
return allDiff;
}
String thisVersion = getVersion();
String thatVersion = other.getVersion();
if((thisVersion.equals(thatVersion))) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has equal precedence with mapping [{}]", this.toString(), other.toString());
}
return 0;
}
else if(thisVersion.equals(ANY_VERSION) && !thatVersion.equals(ANY_VERSION)) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] due to version precedence [{} vs {}]", this.toString(), other.toString(), thisVersion, thatVersion);
}
return -1;
}
else if(!thisVersion.equals(ANY_VERSION) && thatVersion.equals(ANY_VERSION)) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] due to version precedence [{} vs {}]", this.toString(), other.toString(), thisVersion, thatVersion);
}
return 1;
}
else {
int i = new VersionComparator().compare(thisVersion, thatVersion);
if(LOG.isDebugEnabled()) {
if(i > 0) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] due to version precedence [{} vs. {}]", this.toString(), other.toString(), thisVersion, thatVersion);
}
else if(i < 0) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] due to version precedence [{} vs. {}]", this.toString(), other.toString(), thisVersion, thatVersion);
}
else {
LOG.debug("Mapping [{}] has equal precedence with mapping [{}]", this.toString(), other.toString());
}
}
return i;
}
} } | public class class_name {
public int compareTo(Object o) {
if (!(o instanceof UrlMapping)) {
throw new IllegalArgumentException("Cannot compare with Object [" + o + "]. It is not an instance of UrlMapping!");
}
if (equals(o)) return 0;
UrlMapping other = (UrlMapping) o;
// this wild card count
final int thisStaticTokenCount = getStaticTokenCount(this);
final int thisSingleWildcardCount = getSingleWildcardCount(this);
final int thisDoubleWildcardCount = getDoubleWildcardCount(this);
// the other wild card count
final int otherStaticTokenCount = getStaticTokenCount(other);
final int otherSingleWildcardCount = getSingleWildcardCount(other);
final int otherDoubleWildcardCount = getDoubleWildcardCount(other);
final boolean hasWildCards = thisDoubleWildcardCount > 0 || thisSingleWildcardCount > 0;
final boolean otherHasWildCards = otherDoubleWildcardCount > 0 || otherSingleWildcardCount > 0;
// Always prioritise the / root mapping
boolean isThisRoot = thisStaticTokenCount == 0 && thisSingleWildcardCount == 0 && thisDoubleWildcardCount == 0;
boolean isThatRoot = otherStaticTokenCount == 0 && otherDoubleWildcardCount == 0 && otherSingleWildcardCount == 0;
if(isThisRoot && isThatRoot) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has equal precedence with mapping [{}]", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
return 0; // depends on control dependency: [if], data = [none]
}
else if(isThisRoot) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it is the root", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
return 1; // depends on control dependency: [if], data = [none]
}
else if(isThatRoot) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] because the latter is the root", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
return -1; // depends on control dependency: [if], data = [none]
}
if (otherStaticTokenCount == 0 && thisStaticTokenCount > 0) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it has more path tokens", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
return 1; // depends on control dependency: [if], data = [none]
}
if (thisStaticTokenCount == 0 && otherStaticTokenCount > 0) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] because it has fewer path tokens", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
return -1; // depends on control dependency: [if], data = [none]
}
final int thisStaticAndWildcardTokenCount = getStaticAndWildcardTokenCount(this);
final int otherStaticAndWildcardTokenCount = getStaticAndWildcardTokenCount(other);
if (otherStaticAndWildcardTokenCount==0 && thisStaticAndWildcardTokenCount>0) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it has more path tokens [{} vs {}]", this.toString(), other.toString(), thisStaticAndWildcardTokenCount, otherStaticAndWildcardTokenCount); // depends on control dependency: [if], data = [none]
}
return 1; // depends on control dependency: [if], data = [none]
}
if (thisStaticAndWildcardTokenCount==0 && otherStaticAndWildcardTokenCount>0) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because the latter has more path tokens [{} vs {}]", this.toString(), other.toString(), thisStaticAndWildcardTokenCount, otherStaticAndWildcardTokenCount); // depends on control dependency: [if], data = [none]
}
return -1; // depends on control dependency: [if], data = [none]
}
final int staticDiff = thisStaticTokenCount - otherStaticTokenCount;
if (staticDiff < 0 && !otherHasWildCards) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] because the latter has more concrete path tokens [{} vs {}]", this.toString(), other.toString(), thisStaticTokenCount, otherStaticTokenCount); // depends on control dependency: [if], data = [none]
}
return -1; // depends on control dependency: [if], data = [none]
}
else if(staticDiff > 0 && !hasWildCards) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it has more concrete path tokens [{} vs {}]", this.toString(), other.toString(), thisStaticTokenCount, otherStaticTokenCount); // depends on control dependency: [if], data = [none]
}
return 1; // depends on control dependency: [if], data = [none]
}
String[] thisTokens = getUrlData().getTokens();
String[] otherTokens = other.getUrlData().getTokens();
final int thisTokensLength = thisTokens.length;
final int otherTokensLength = otherTokens.length;
int greaterLength = thisTokensLength > otherTokensLength ? thisTokensLength : otherTokensLength;
for (int i = 0; i < greaterLength; i++) {
final boolean thisHasMoreTokens = i < thisTokensLength;
final boolean otherHasMoreTokens = i < otherTokensLength;
boolean thisTokenIsWildcard = !thisHasMoreTokens || isSingleWildcard(thisTokens[i]);
boolean otherTokenIsWildcard = !otherHasMoreTokens || isSingleWildcard(otherTokens[i]);
if (thisTokenIsWildcard && !otherTokenIsWildcard) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] because the latter contains more concrete tokens", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
return -1; // depends on control dependency: [if], data = [none]
}
if (!thisTokenIsWildcard && otherTokenIsWildcard) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it contains more concrete tokens", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
return 1; // depends on control dependency: [if], data = [none]
}
}
final int doubleWildcardDiff = otherDoubleWildcardCount - thisDoubleWildcardCount;
if (doubleWildcardDiff != 0) {
if(LOG.isDebugEnabled()) {
if(doubleWildcardDiff > 0) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] due containing more double wild cards [{} vs. {}]", this.toString(), other.toString(), thisDoubleWildcardCount, otherDoubleWildcardCount); // depends on control dependency: [if], data = [none]
}
else if(doubleWildcardDiff < 0) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] due to the latter containing more double wild cards [{} vs. {}]", this.toString(), other.toString(), thisDoubleWildcardCount, otherDoubleWildcardCount); // depends on control dependency: [if], data = [none]
}
}
return doubleWildcardDiff; // depends on control dependency: [if], data = [none]
}
final int singleWildcardDiff = otherSingleWildcardCount - thisSingleWildcardCount;
if (singleWildcardDiff != 0) {
if(LOG.isDebugEnabled()) {
if(singleWildcardDiff > 0) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] because it contains more single wild card matches [{} vs. {}]", this.toString(), other.toString(), thisSingleWildcardCount, otherSingleWildcardCount); // depends on control dependency: [if], data = [none]
}
else if(singleWildcardDiff < 0) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] due to the latter containing more single wild card matches[{} vs. {}]", this.toString(), other.toString(), thisSingleWildcardCount, otherSingleWildcardCount); // depends on control dependency: [if], data = [none]
}
}
return singleWildcardDiff; // depends on control dependency: [if], data = [none]
}
int thisConstraintCount = getAppliedConstraintsCount(this);
int thatConstraintCount = getAppliedConstraintsCount(other);
int constraintDiff = thisConstraintCount - thatConstraintCount;
if (constraintDiff != 0) {
if(LOG.isDebugEnabled()) {
if(constraintDiff > 0) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] since it defines more constraints [{} vs. {}]", this.toString(), other.toString(), thisConstraintCount, thatConstraintCount); // depends on control dependency: [if], data = [none]
}
else if(constraintDiff < 0) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] since the latter defines more constraints [{} vs. {}]", this.toString(), other.toString(), thisConstraintCount, thatConstraintCount); // depends on control dependency: [if], data = [none]
}
}
return constraintDiff; // depends on control dependency: [if], data = [none]
}
int allDiff = (thisStaticTokenCount - otherStaticTokenCount) + (thisSingleWildcardCount - otherSingleWildcardCount) + (thisDoubleWildcardCount - otherDoubleWildcardCount);
if(allDiff != 0) {
if(LOG.isDebugEnabled()) {
if(allDiff > 0) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] due to the overall diff", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
else if(allDiff < 0) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] due to the overall diff", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
}
return allDiff; // depends on control dependency: [if], data = [none]
}
String thisVersion = getVersion();
String thatVersion = other.getVersion();
if((thisVersion.equals(thatVersion))) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has equal precedence with mapping [{}]", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
return 0; // depends on control dependency: [if], data = [none]
}
else if(thisVersion.equals(ANY_VERSION) && !thatVersion.equals(ANY_VERSION)) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] due to version precedence [{} vs {}]", this.toString(), other.toString(), thisVersion, thatVersion); // depends on control dependency: [if], data = [none]
}
return -1; // depends on control dependency: [if], data = [none]
}
else if(!thisVersion.equals(ANY_VERSION) && thatVersion.equals(ANY_VERSION)) {
if(LOG.isDebugEnabled()) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] due to version precedence [{} vs {}]", this.toString(), other.toString(), thisVersion, thatVersion); // depends on control dependency: [if], data = [none]
}
return 1; // depends on control dependency: [if], data = [none]
}
else {
int i = new VersionComparator().compare(thisVersion, thatVersion);
if(LOG.isDebugEnabled()) {
if(i > 0) {
LOG.debug("Mapping [{}] has a higher precedence than [{}] due to version precedence [{} vs. {}]", this.toString(), other.toString(), thisVersion, thatVersion); // depends on control dependency: [if], data = [none]
}
else if(i < 0) {
LOG.debug("Mapping [{}] has a lower precedence than [{}] due to version precedence [{} vs. {}]", this.toString(), other.toString(), thisVersion, thatVersion); // depends on control dependency: [if], data = [none]
}
else {
LOG.debug("Mapping [{}] has equal precedence with mapping [{}]", this.toString(), other.toString()); // depends on control dependency: [if], data = [none]
}
}
return i; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void auditProvideAndRegisterEvent(
IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String userName,
String submissionSetUniqueId,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
ExportEvent exportEvent = new ExportEvent(true, eventOutcome, transaction, purposesOfUse);
exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
/*
* FIXME: Overriding endpoint URI with "anonymous", for now
*/
String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous";
//String replyToUri = getSystemUserId();
exportEvent.addSourceActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true);
if (!EventUtils.isEmptyOrNull(userName)) {
exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles);
}
exportEvent.addDestinationActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
if (!EventUtils.isEmptyOrNull(patientId)) {
exportEvent.addPatientParticipantObject(patientId);
}
exportEvent.addSubmissionSetParticipantObject(submissionSetUniqueId);
audit(exportEvent);
} } | public class class_name {
protected void auditProvideAndRegisterEvent(
IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String userName,
String submissionSetUniqueId,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
ExportEvent exportEvent = new ExportEvent(true, eventOutcome, transaction, purposesOfUse);
exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
/*
* FIXME: Overriding endpoint URI with "anonymous", for now
*/
String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous";
//String replyToUri = getSystemUserId();
exportEvent.addSourceActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true);
if (!EventUtils.isEmptyOrNull(userName)) {
exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); // depends on control dependency: [if], data = [none]
}
exportEvent.addDestinationActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
if (!EventUtils.isEmptyOrNull(patientId)) {
exportEvent.addPatientParticipantObject(patientId); // depends on control dependency: [if], data = [none]
}
exportEvent.addSubmissionSetParticipantObject(submissionSetUniqueId);
audit(exportEvent);
} } |
public class class_name {
public void marshall(SetStatusRequest setStatusRequest, ProtocolMarshaller protocolMarshaller) {
if (setStatusRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(setStatusRequest.getPipelineId(), PIPELINEID_BINDING);
protocolMarshaller.marshall(setStatusRequest.getObjectIds(), OBJECTIDS_BINDING);
protocolMarshaller.marshall(setStatusRequest.getStatus(), STATUS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(SetStatusRequest setStatusRequest, ProtocolMarshaller protocolMarshaller) {
if (setStatusRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(setStatusRequest.getPipelineId(), PIPELINEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(setStatusRequest.getObjectIds(), OBJECTIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(setStatusRequest.getStatus(), STATUS_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 visitCode(Code obj) {
try {
stack.resetForMethodEntry(this);
reportedType = ImmutabilityType.UNKNOWN;
super.visitCode(obj);
} catch (StopOpcodeParsingException e) {
// report type is immutable
}
} } | public class class_name {
@Override
public void visitCode(Code obj) {
try {
stack.resetForMethodEntry(this); // depends on control dependency: [try], data = [none]
reportedType = ImmutabilityType.UNKNOWN; // depends on control dependency: [try], data = [none]
super.visitCode(obj); // depends on control dependency: [try], data = [none]
} catch (StopOpcodeParsingException e) {
// report type is immutable
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static void processResourceFilter(ProjectFile project, Filter filter)
{
for (Resource resource : project.getResources())
{
if (filter.evaluate(resource, null))
{
System.out.println(resource.getID() + "," + resource.getUniqueID() + "," + resource.getName());
}
}
} } | public class class_name {
private static void processResourceFilter(ProjectFile project, Filter filter)
{
for (Resource resource : project.getResources())
{
if (filter.evaluate(resource, null))
{
System.out.println(resource.getID() + "," + resource.getUniqueID() + "," + resource.getName()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected boolean parseFields(ByteBuffer buffer) {
// Process headers
while ((_state == State.HEADER || _state == State.TRAILER) && buffer.hasRemaining()) {
// process each character
HttpTokens.Token t = next(buffer);
if (t == null)
break;
if (_maxHeaderBytes > 0 && ++_headerBytes > _maxHeaderBytes) {
boolean header = _state == State.HEADER;
LOG.warn("{} is too large {}>{}", header ? "Header" : "Trailer", _headerBytes, _maxHeaderBytes);
throw new BadMessageException(header ?
HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE_431 :
HttpStatus.PAYLOAD_TOO_LARGE_413);
}
switch (_fieldState) {
case FIELD:
switch (t.getType()) {
case COLON:
case SPACE:
case HTAB: {
if (complianceViolation(HttpComplianceSection.NO_FIELD_FOLDING, _headerString))
throw new BadMessageException(HttpStatus.BAD_REQUEST_400, "Header Folding");
// header value without name - continuation?
if (_valueString == null || _valueString.isEmpty()) {
_string.setLength(0);
_length = 0;
} else {
setString(_valueString);
_string.append(' ');
_length++;
_valueString = null;
}
setState(FieldState.VALUE);
break;
}
case LF: {
// process previous header
if (_state == State.HEADER)
parsedHeader();
else
parsedTrailer();
_contentPosition = 0;
// End of headers or trailers?
if (_state == State.TRAILER) {
setState(State.END);
return _handler.messageComplete();
}
// Was there a required host header?
if (!_host && _version == HttpVersion.HTTP_1_1 && _requestHandler != null) {
throw new BadMessageException(HttpStatus.BAD_REQUEST_400, "No Host");
}
// is it a response that cannot have a body?
if (_responseHandler != null && // response
(_responseStatus == 304 || // not-modified response
_responseStatus == 204 || // no-content response
_responseStatus < 200)) // 1xx response
_endOfContent = EndOfContent.NO_CONTENT; // ignore any other headers set
// else if we don't know framing
else if (_endOfContent == EndOfContent.UNKNOWN_CONTENT) {
if (_responseStatus == 0 // request
|| _responseStatus == 304 // not-modified response
|| _responseStatus == 204 // no-content response
|| _responseStatus < 200) // 1xx response
_endOfContent = EndOfContent.NO_CONTENT;
else
_endOfContent = EndOfContent.EOF_CONTENT;
}
// How is the message ended?
switch (_endOfContent) {
case EOF_CONTENT: {
setState(State.EOF_CONTENT);
boolean handle = _handler.headerComplete();
_headerComplete = true;
return handle;
}
case CHUNKED_CONTENT: {
setState(State.CHUNKED_CONTENT);
boolean handle = _handler.headerComplete();
_headerComplete = true;
return handle;
}
case NO_CONTENT: {
setState(State.END);
return handleHeaderContentMessage();
}
default: {
setState(State.CONTENT);
boolean handle = _handler.headerComplete();
_headerComplete = true;
return handle;
}
}
}
case ALPHA:
case DIGIT:
case TCHAR: {
// process previous header
if (_state == State.HEADER)
parsedHeader();
else
parsedTrailer();
// handle new header
if (buffer.hasRemaining()) {
// Try a look ahead for the known header name and value.
HttpField cached_field = _fieldCache == null ? null : _fieldCache.getBest(buffer, -1, buffer.remaining());
if (cached_field == null)
cached_field = CACHE.getBest(buffer, -1, buffer.remaining());
if (cached_field != null) {
String n = cached_field.getName();
String v = cached_field.getValue();
if (!_compliances.contains(HttpComplianceSection.FIELD_NAME_CASE_INSENSITIVE)) {
// Have to get the fields exactly from the buffer to match case
String en = BufferUtils.toString(buffer, buffer.position() - 1, n.length(), StandardCharsets.US_ASCII);
if (!n.equals(en)) {
handleViolation(HttpComplianceSection.FIELD_NAME_CASE_INSENSITIVE, en);
n = en;
cached_field = new HttpField(cached_field.getHeader(), n, v);
}
}
if (v != null && !_compliances.contains(HttpComplianceSection.CASE_INSENSITIVE_FIELD_VALUE_CACHE)) {
String ev = BufferUtils.toString(buffer, buffer.position() + n.length() + 1, v.length(), StandardCharsets.ISO_8859_1);
if (!v.equals(ev)) {
handleViolation(HttpComplianceSection.CASE_INSENSITIVE_FIELD_VALUE_CACHE, ev + "!=" + v);
v = ev;
cached_field = new HttpField(cached_field.getHeader(), n, v);
}
}
_header = cached_field.getHeader();
_headerString = n;
if (v == null) {
// Header only
setState(FieldState.VALUE);
_string.setLength(0);
_length = 0;
buffer.position(buffer.position() + n.length() + 1);
break;
}
// Header and value
int pos = buffer.position() + n.length() + v.length() + 1;
byte peek = buffer.get(pos);
if (peek == HttpTokens.CARRIAGE_RETURN || peek == HttpTokens.LINE_FEED) {
_field = cached_field;
_valueString = v;
setState(FieldState.IN_VALUE);
if (peek == HttpTokens.CARRIAGE_RETURN) {
_cr = true;
buffer.position(pos + 1);
} else
buffer.position(pos);
break;
}
setState(FieldState.IN_VALUE);
setString(v);
buffer.position(pos);
break;
}
}
// New header
setState(FieldState.IN_NAME);
_string.setLength(0);
_string.append(t.getChar());
_length = 1;
}
break;
default:
throw new IllegalCharacterException(_state, t, buffer);
}
break;
case IN_NAME:
switch (t.getType()) {
case SPACE:
case HTAB:
//Ignore trailing whitespaces ?
if (!complianceViolation(HttpComplianceSection.NO_WS_AFTER_FIELD_NAME, null)) {
_headerString = takeString();
_header = HttpHeader.CACHE.get(_headerString);
_length = -1;
setState(FieldState.WS_AFTER_NAME);
break;
}
throw new IllegalCharacterException(_state, t, buffer);
case COLON:
_headerString = takeString();
_header = HttpHeader.CACHE.get(_headerString);
_length = -1;
setState(FieldState.VALUE);
break;
case LF:
_headerString = takeString();
_header = HttpHeader.CACHE.get(_headerString);
_string.setLength(0);
_valueString = "";
_length = -1;
if (!complianceViolation(HttpComplianceSection.FIELD_COLON, _headerString)) {
setState(FieldState.FIELD);
break;
}
throw new IllegalCharacterException(_state, t, buffer);
case ALPHA:
case DIGIT:
case TCHAR:
_string.append(t.getChar());
_length = _string.length();
break;
default:
throw new IllegalCharacterException(_state, t, buffer);
}
break;
case WS_AFTER_NAME:
switch (t.getType()) {
case SPACE:
case HTAB:
break;
case COLON:
setState(FieldState.VALUE);
break;
case LF:
if (!complianceViolation(HttpComplianceSection.FIELD_COLON, _headerString)) {
setState(FieldState.FIELD);
break;
}
throw new IllegalCharacterException(_state, t, buffer);
default:
throw new IllegalCharacterException(_state, t, buffer);
}
break;
case VALUE:
switch (t.getType()) {
case LF:
_string.setLength(0);
_valueString = "";
_length = -1;
setState(FieldState.FIELD);
break;
case SPACE:
case HTAB:
break;
case ALPHA:
case DIGIT:
case TCHAR:
case VCHAR:
case COLON:
case OTEXT: // TODO review? should this be a utf8 string?
_string.append(t.getChar());
_length = _string.length();
setState(FieldState.IN_VALUE);
break;
default:
throw new IllegalCharacterException(_state, t, buffer);
}
break;
case IN_VALUE:
switch (t.getType()) {
case LF:
if (_length > 0) {
_valueString = takeString();
_length = -1;
}
setState(FieldState.FIELD);
break;
case SPACE:
case HTAB:
_string.append(t.getChar());
break;
case ALPHA:
case DIGIT:
case TCHAR:
case VCHAR:
case COLON:
case OTEXT: // TODO review? should this be a utf8 string?
_string.append(t.getChar());
_length = _string.length();
break;
default:
throw new IllegalCharacterException(_state, t, buffer);
}
break;
default:
throw new IllegalStateException(_state.toString());
}
}
return false;
} } | public class class_name {
protected boolean parseFields(ByteBuffer buffer) {
// Process headers
while ((_state == State.HEADER || _state == State.TRAILER) && buffer.hasRemaining()) {
// process each character
HttpTokens.Token t = next(buffer);
if (t == null)
break;
if (_maxHeaderBytes > 0 && ++_headerBytes > _maxHeaderBytes) {
boolean header = _state == State.HEADER;
LOG.warn("{} is too large {}>{}", header ? "Header" : "Trailer", _headerBytes, _maxHeaderBytes); // depends on control dependency: [if], data = [none]
throw new BadMessageException(header ?
HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE_431 :
HttpStatus.PAYLOAD_TOO_LARGE_413);
}
switch (_fieldState) {
case FIELD:
switch (t.getType()) {
case COLON:
case SPACE:
case HTAB: {
if (complianceViolation(HttpComplianceSection.NO_FIELD_FOLDING, _headerString))
throw new BadMessageException(HttpStatus.BAD_REQUEST_400, "Header Folding");
// header value without name - continuation?
if (_valueString == null || _valueString.isEmpty()) {
_string.setLength(0); // depends on control dependency: [if], data = [none]
_length = 0; // depends on control dependency: [if], data = [none]
} else {
setString(_valueString); // depends on control dependency: [if], data = [(_valueString]
_string.append(' '); // depends on control dependency: [if], data = [none]
_length++; // depends on control dependency: [if], data = [none]
_valueString = null; // depends on control dependency: [if], data = [none]
}
setState(FieldState.VALUE);
break;
}
case LF: {
// process previous header
if (_state == State.HEADER)
parsedHeader();
else
parsedTrailer();
_contentPosition = 0;
// End of headers or trailers?
if (_state == State.TRAILER) {
setState(State.END); // depends on control dependency: [if], data = [none]
return _handler.messageComplete(); // depends on control dependency: [if], data = [none]
}
// Was there a required host header?
if (!_host && _version == HttpVersion.HTTP_1_1 && _requestHandler != null) {
throw new BadMessageException(HttpStatus.BAD_REQUEST_400, "No Host");
}
// is it a response that cannot have a body?
if (_responseHandler != null && // response
(_responseStatus == 304 || // not-modified response
_responseStatus == 204 || // no-content response
_responseStatus < 200)) // 1xx response
_endOfContent = EndOfContent.NO_CONTENT; // ignore any other headers set
// else if we don't know framing
else if (_endOfContent == EndOfContent.UNKNOWN_CONTENT) {
if (_responseStatus == 0 // request
|| _responseStatus == 304 // not-modified response
|| _responseStatus == 204 // no-content response
|| _responseStatus < 200) // 1xx response
_endOfContent = EndOfContent.NO_CONTENT;
else
_endOfContent = EndOfContent.EOF_CONTENT;
}
// How is the message ended?
switch (_endOfContent) {
case EOF_CONTENT: {
setState(State.EOF_CONTENT);
boolean handle = _handler.headerComplete();
_headerComplete = true;
return handle;
}
case CHUNKED_CONTENT: {
setState(State.CHUNKED_CONTENT);
boolean handle = _handler.headerComplete();
_headerComplete = true;
return handle;
}
case NO_CONTENT: {
setState(State.END);
return handleHeaderContentMessage();
}
default: {
setState(State.CONTENT);
boolean handle = _handler.headerComplete();
_headerComplete = true;
return handle;
}
}
}
case ALPHA:
case DIGIT:
case TCHAR: {
// process previous header
if (_state == State.HEADER)
parsedHeader();
else
parsedTrailer();
// handle new header
if (buffer.hasRemaining()) {
// Try a look ahead for the known header name and value.
HttpField cached_field = _fieldCache == null ? null : _fieldCache.getBest(buffer, -1, buffer.remaining());
if (cached_field == null)
cached_field = CACHE.getBest(buffer, -1, buffer.remaining());
if (cached_field != null) {
String n = cached_field.getName();
String v = cached_field.getValue();
if (!_compliances.contains(HttpComplianceSection.FIELD_NAME_CASE_INSENSITIVE)) {
// Have to get the fields exactly from the buffer to match case
String en = BufferUtils.toString(buffer, buffer.position() - 1, n.length(), StandardCharsets.US_ASCII);
if (!n.equals(en)) {
handleViolation(HttpComplianceSection.FIELD_NAME_CASE_INSENSITIVE, en); // depends on control dependency: [if], data = [none]
n = en; // depends on control dependency: [if], data = [none]
cached_field = new HttpField(cached_field.getHeader(), n, v); // depends on control dependency: [if], data = [none]
}
}
if (v != null && !_compliances.contains(HttpComplianceSection.CASE_INSENSITIVE_FIELD_VALUE_CACHE)) {
String ev = BufferUtils.toString(buffer, buffer.position() + n.length() + 1, v.length(), StandardCharsets.ISO_8859_1);
if (!v.equals(ev)) {
handleViolation(HttpComplianceSection.CASE_INSENSITIVE_FIELD_VALUE_CACHE, ev + "!=" + v); // depends on control dependency: [if], data = [none]
v = ev; // depends on control dependency: [if], data = [none]
cached_field = new HttpField(cached_field.getHeader(), n, v); // depends on control dependency: [if], data = [none]
}
}
_header = cached_field.getHeader();
_headerString = n;
if (v == null) {
// Header only
setState(FieldState.VALUE); // depends on control dependency: [if], data = [none]
_string.setLength(0); // depends on control dependency: [if], data = [none]
_length = 0; // depends on control dependency: [if], data = [none]
buffer.position(buffer.position() + n.length() + 1); // depends on control dependency: [if], data = [none]
break;
}
// Header and value
int pos = buffer.position() + n.length() + v.length() + 1;
byte peek = buffer.get(pos);
if (peek == HttpTokens.CARRIAGE_RETURN || peek == HttpTokens.LINE_FEED) {
_field = cached_field; // depends on control dependency: [if], data = [none]
_valueString = v; // depends on control dependency: [if], data = [none]
setState(FieldState.IN_VALUE); // depends on control dependency: [if], data = [none]
if (peek == HttpTokens.CARRIAGE_RETURN) {
_cr = true; // depends on control dependency: [if], data = [none]
buffer.position(pos + 1); // depends on control dependency: [if], data = [none]
} else
buffer.position(pos);
break;
}
setState(FieldState.IN_VALUE);
setString(v);
buffer.position(pos);
break;
}
}
// New header
setState(FieldState.IN_NAME);
_string.setLength(0);
_string.append(t.getChar());
_length = 1;
}
break;
default:
throw new IllegalCharacterException(_state, t, buffer);
}
break;
case IN_NAME:
switch (t.getType()) {
case SPACE:
case HTAB:
//Ignore trailing whitespaces ?
if (!complianceViolation(HttpComplianceSection.NO_WS_AFTER_FIELD_NAME, null)) {
_headerString = takeString();
_header = HttpHeader.CACHE.get(_headerString);
_length = -1;
setState(FieldState.WS_AFTER_NAME);
break;
}
throw new IllegalCharacterException(_state, t, buffer);
case COLON:
_headerString = takeString();
_header = HttpHeader.CACHE.get(_headerString);
_length = -1;
setState(FieldState.VALUE);
break;
case LF:
_headerString = takeString();
_header = HttpHeader.CACHE.get(_headerString);
_string.setLength(0);
_valueString = "";
_length = -1;
if (!complianceViolation(HttpComplianceSection.FIELD_COLON, _headerString)) {
setState(FieldState.FIELD);
break;
}
throw new IllegalCharacterException(_state, t, buffer);
case ALPHA:
case DIGIT:
case TCHAR:
_string.append(t.getChar());
_length = _string.length();
break;
default:
throw new IllegalCharacterException(_state, t, buffer);
}
break;
case WS_AFTER_NAME:
switch (t.getType()) {
case SPACE:
case HTAB:
break;
case COLON:
setState(FieldState.VALUE);
break;
case LF:
if (!complianceViolation(HttpComplianceSection.FIELD_COLON, _headerString)) {
setState(FieldState.FIELD);
break;
}
throw new IllegalCharacterException(_state, t, buffer);
default:
throw new IllegalCharacterException(_state, t, buffer);
}
break;
case VALUE:
switch (t.getType()) {
case LF:
_string.setLength(0);
_valueString = "";
_length = -1;
setState(FieldState.FIELD);
break;
case SPACE:
case HTAB:
break;
case ALPHA:
case DIGIT:
case TCHAR:
case VCHAR:
case COLON:
case OTEXT: // TODO review? should this be a utf8 string?
_string.append(t.getChar());
_length = _string.length();
setState(FieldState.IN_VALUE);
break;
default:
throw new IllegalCharacterException(_state, t, buffer);
}
break;
case IN_VALUE:
switch (t.getType()) {
case LF:
if (_length > 0) {
_valueString = takeString();
_length = -1;
}
setState(FieldState.FIELD);
break;
case SPACE:
case HTAB:
_string.append(t.getChar());
break;
case ALPHA:
case DIGIT:
case TCHAR:
case VCHAR:
case COLON:
case OTEXT: // TODO review? should this be a utf8 string?
_string.append(t.getChar());
_length = _string.length();
break;
default:
throw new IllegalCharacterException(_state, t, buffer);
}
break;
default:
throw new IllegalStateException(_state.toString());
}
}
return false;
} } |
public class class_name {
public void setRegionCoverageSize(int size){
if(size < 0){
return;
}
int lg = (int)Math.ceil(Math.log(size)/Math.log(2));
//int lg = 31 - Integer.numberOfLeadingZeros(size);
int newRegionCoverageSize = 1 << lg;
int newRegionCoverageMask = newRegionCoverageSize - 1;
RegionCoverage newCoverage = new RegionCoverage(newRegionCoverageSize);
if(coverage != null){
for(int i = 0; i < (end-start); i++){
newCoverage.getA()[(int)((start+i)&newRegionCoverageMask)] = coverage.getA()[(int)((start+i)®ionCoverageMask)];
}
}
regionCoverageSize = newRegionCoverageSize;
regionCoverageMask = newRegionCoverageMask;
coverage = newCoverage;
// System.out.println("Region Coverage Mask : " + regionCoverageMask);
} } | public class class_name {
public void setRegionCoverageSize(int size){
if(size < 0){
return; // depends on control dependency: [if], data = [none]
}
int lg = (int)Math.ceil(Math.log(size)/Math.log(2));
//int lg = 31 - Integer.numberOfLeadingZeros(size);
int newRegionCoverageSize = 1 << lg;
int newRegionCoverageMask = newRegionCoverageSize - 1;
RegionCoverage newCoverage = new RegionCoverage(newRegionCoverageSize);
if(coverage != null){
for(int i = 0; i < (end-start); i++){
newCoverage.getA()[(int)((start+i)&newRegionCoverageMask)] = coverage.getA()[(int)((start+i)®ionCoverageMask)]; // depends on control dependency: [for], data = [i]
}
}
regionCoverageSize = newRegionCoverageSize;
regionCoverageMask = newRegionCoverageMask;
coverage = newCoverage;
// System.out.println("Region Coverage Mask : " + regionCoverageMask);
} } |
public class class_name {
@Nullable
public File deleteFile(@NotNull final Transaction txn, @NotNull final String path) {
final ArrayByteIterable key = StringBinding.stringToEntry(path);
final ByteIterable fileMetadata;
try (Cursor cursor = pathnames.openCursor(txn)) {
fileMetadata = cursor.getSearchKey(key);
if (fileMetadata != null) {
cursor.deleteCurrent();
}
}
if (fileMetadata != null) {
final File result = new File(path, fileMetadata);
// at first delete contents
try (ClusterIterator iterator = new ClusterIterator(this, txn, result)) {
while (iterator.hasCluster()) {
iterator.deleteCurrent();
iterator.moveToNext();
}
}
return result;
}
return null;
} } | public class class_name {
@Nullable
public File deleteFile(@NotNull final Transaction txn, @NotNull final String path) {
final ArrayByteIterable key = StringBinding.stringToEntry(path);
final ByteIterable fileMetadata;
try (Cursor cursor = pathnames.openCursor(txn)) {
fileMetadata = cursor.getSearchKey(key);
if (fileMetadata != null) {
cursor.deleteCurrent(); // depends on control dependency: [if], data = [none]
}
}
if (fileMetadata != null) {
final File result = new File(path, fileMetadata);
// at first delete contents
try (ClusterIterator iterator = new ClusterIterator(this, txn, result)) {
while (iterator.hasCluster()) {
iterator.deleteCurrent(); // depends on control dependency: [while], data = [none]
iterator.moveToNext(); // depends on control dependency: [while], data = [none]
}
}
return result;
}
return null;
} } |
public class class_name {
public void setSelect(final String select) {
if (null == select) {
this.select = null;
} else {
if (Strings.contains(select.toLowerCase(), "select")) {
this.select = select;
} else {
this.select = "select " + select;
}
}
} } | public class class_name {
public void setSelect(final String select) {
if (null == select) {
this.select = null; // depends on control dependency: [if], data = [none]
} else {
if (Strings.contains(select.toLowerCase(), "select")) {
this.select = select; // depends on control dependency: [if], data = [none]
} else {
this.select = "select " + select; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static byte[] hexToByteArray(String hex) {
int length = hex.length();
byte[] result = new byte[(length / 2) + (length % 2)];
for (int i = length, j = result.length - 1; i > 0; i -= 2, j--) {
result[j] = hexToByte(hex.charAt(i - 1));
if (i > 1) {
result[j] |= (hexToByte(hex.charAt(i - 2)) << 4);
}
}
return result;
} } | public class class_name {
public static byte[] hexToByteArray(String hex) {
int length = hex.length();
byte[] result = new byte[(length / 2) + (length % 2)];
for (int i = length, j = result.length - 1; i > 0; i -= 2, j--) {
result[j] = hexToByte(hex.charAt(i - 1)); // depends on control dependency: [for], data = [i]
if (i > 1) {
result[j] |= (hexToByte(hex.charAt(i - 2)) << 4); // depends on control dependency: [if], data = [(i]
}
}
return result;
} } |
public class class_name {
public static HtmlTree MAIN(HtmlStyle styleClass, Content body) {
HtmlTree htmltree = HtmlTree.MAIN(body);
if (styleClass != null) {
htmltree.addStyle(styleClass);
}
return htmltree;
} } | public class class_name {
public static HtmlTree MAIN(HtmlStyle styleClass, Content body) {
HtmlTree htmltree = HtmlTree.MAIN(body);
if (styleClass != null) {
htmltree.addStyle(styleClass); // depends on control dependency: [if], data = [(styleClass]
}
return htmltree;
} } |
public class class_name {
private static void start(Context context, Class<?> daemonClazzName, int interval) {
String cmd = context.getDir(BIN_DIR_NAME, Context.MODE_PRIVATE)
.getAbsolutePath() + File.separator + DAEMON_BIN_NAME;
/* create the command string */
StringBuilder cmdBuilder = new StringBuilder();
cmdBuilder.append(cmd);
cmdBuilder.append(" -p ");
cmdBuilder.append(context.getPackageName());
cmdBuilder.append(" -s ");
cmdBuilder.append(daemonClazzName.getName());
cmdBuilder.append(" -t ");
cmdBuilder.append(interval);
try {
Runtime.getRuntime().exec(cmdBuilder.toString()).waitFor();
} catch (IOException | InterruptedException e) {
Log.e(TAG, "start daemon error: " + e.getMessage());
}
} } | public class class_name {
private static void start(Context context, Class<?> daemonClazzName, int interval) {
String cmd = context.getDir(BIN_DIR_NAME, Context.MODE_PRIVATE)
.getAbsolutePath() + File.separator + DAEMON_BIN_NAME;
/* create the command string */
StringBuilder cmdBuilder = new StringBuilder();
cmdBuilder.append(cmd);
cmdBuilder.append(" -p ");
cmdBuilder.append(context.getPackageName());
cmdBuilder.append(" -s ");
cmdBuilder.append(daemonClazzName.getName());
cmdBuilder.append(" -t ");
cmdBuilder.append(interval);
try {
Runtime.getRuntime().exec(cmdBuilder.toString()).waitFor(); // depends on control dependency: [try], data = [none]
} catch (IOException | InterruptedException e) {
Log.e(TAG, "start daemon error: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void splitPixels( int indexStart , int indexStop ) {
// too short to split
if( indexStart+1 >= indexStop )
return;
int indexSplit = selectSplitBetween(indexStart, indexStop);
if( indexSplit >= 0 ) {
splitPixels(indexStart, indexSplit);
splits.add(indexSplit);
splitPixels(indexSplit, indexStop);
}
} } | public class class_name {
protected void splitPixels( int indexStart , int indexStop ) {
// too short to split
if( indexStart+1 >= indexStop )
return;
int indexSplit = selectSplitBetween(indexStart, indexStop);
if( indexSplit >= 0 ) {
splitPixels(indexStart, indexSplit); // depends on control dependency: [if], data = [none]
splits.add(indexSplit); // depends on control dependency: [if], data = [none]
splitPixels(indexSplit, indexStop); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setCharacterEncoding(String encoding)
{
if (this._outputState==0 && !isCommitted())
{
_charEncodingSetInContentType=true;
_httpResponse.setCharacterEncoding(encoding,true);
}
} } | public class class_name {
public void setCharacterEncoding(String encoding)
{
if (this._outputState==0 && !isCommitted())
{
_charEncodingSetInContentType=true; // depends on control dependency: [if], data = [none]
_httpResponse.setCharacterEncoding(encoding,true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(AlgorithmSpecification algorithmSpecification, ProtocolMarshaller protocolMarshaller) {
if (algorithmSpecification == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(algorithmSpecification.getTrainingImage(), TRAININGIMAGE_BINDING);
protocolMarshaller.marshall(algorithmSpecification.getAlgorithmName(), ALGORITHMNAME_BINDING);
protocolMarshaller.marshall(algorithmSpecification.getTrainingInputMode(), TRAININGINPUTMODE_BINDING);
protocolMarshaller.marshall(algorithmSpecification.getMetricDefinitions(), METRICDEFINITIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AlgorithmSpecification algorithmSpecification, ProtocolMarshaller protocolMarshaller) {
if (algorithmSpecification == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(algorithmSpecification.getTrainingImage(), TRAININGIMAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(algorithmSpecification.getAlgorithmName(), ALGORITHMNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(algorithmSpecification.getTrainingInputMode(), TRAININGINPUTMODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(algorithmSpecification.getMetricDefinitions(), METRICDEFINITIONS_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 {
synchronized private MeetmeRoom findMeetmeRoom(final String roomNumber)
{
MeetmeRoom foundRoom = null;
for (final MeetmeRoom room : this.rooms)
{
if (room.getRoomNumber().compareToIgnoreCase(roomNumber) == 0)
{
foundRoom = room;
break;
}
}
return foundRoom;
} } | public class class_name {
synchronized private MeetmeRoom findMeetmeRoom(final String roomNumber)
{
MeetmeRoom foundRoom = null;
for (final MeetmeRoom room : this.rooms)
{
if (room.getRoomNumber().compareToIgnoreCase(roomNumber) == 0)
{
foundRoom = room;
// depends on control dependency: [if], data = [none]
break;
}
}
return foundRoom;
} } |
public class class_name {
public boolean containsRequiredAnnotations(Collection<Class<? extends Annotation>> requiredAnnotations) {
if (annotatedType instanceof BackedAnnotatedType<?>) {
return containsAnnotation((BackedAnnotatedType<?>) annotatedType, requiredAnnotations);
} else if (annotatedType instanceof UnbackedAnnotatedType<?>) {
return containsAnnotation((UnbackedAnnotatedType<?>) annotatedType, requiredAnnotations);
} else {
throw new IllegalArgumentException("Unknown SlimAnnotatedType implementation: " + annotatedType.getClass().toString());
}
} } | public class class_name {
public boolean containsRequiredAnnotations(Collection<Class<? extends Annotation>> requiredAnnotations) {
if (annotatedType instanceof BackedAnnotatedType<?>) {
return containsAnnotation((BackedAnnotatedType<?>) annotatedType, requiredAnnotations); // depends on control dependency: [if], data = [)]
} else if (annotatedType instanceof UnbackedAnnotatedType<?>) {
return containsAnnotation((UnbackedAnnotatedType<?>) annotatedType, requiredAnnotations); // depends on control dependency: [if], data = [)]
} else {
throw new IllegalArgumentException("Unknown SlimAnnotatedType implementation: " + annotatedType.getClass().toString());
}
} } |
public class class_name {
private static void flipMaskedWord(int[] array, int index, int from, int to) {
if (from == to) {
return;
}
to = 32 - to;
int word = wordAt(array, index);
word ^= ((0xffffffff >>> from) << (from + to)) >>> to;
array[index] = word & WORD_MASK;
} } | public class class_name {
private static void flipMaskedWord(int[] array, int index, int from, int to) {
if (from == to) {
return; // depends on control dependency: [if], data = [none]
}
to = 32 - to;
int word = wordAt(array, index);
word ^= ((0xffffffff >>> from) << (from + to)) >>> to;
array[index] = word & WORD_MASK;
} } |
public class class_name {
public void clear ()
{
for (int icount = _items.size(); icount > 0; icount--) {
DirtyItem item = _items.remove(0);
item.clear();
_freelist.add(item);
}
} } | public class class_name {
public void clear ()
{
for (int icount = _items.size(); icount > 0; icount--) {
DirtyItem item = _items.remove(0);
item.clear(); // depends on control dependency: [for], data = [none]
_freelist.add(item); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public ServiceCall<Void> updateVoiceModel(UpdateVoiceModelOptions updateVoiceModelOptions) {
Validator.notNull(updateVoiceModelOptions, "updateVoiceModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
String[] pathParameters = { updateVoiceModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "updateVoiceModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateVoiceModelOptions.name() != null) {
contentJson.addProperty("name", updateVoiceModelOptions.name());
}
if (updateVoiceModelOptions.description() != null) {
contentJson.addProperty("description", updateVoiceModelOptions.description());
}
if (updateVoiceModelOptions.words() != null) {
contentJson.add("words", GsonSingleton.getGson().toJsonTree(updateVoiceModelOptions.words()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} } | public class class_name {
public ServiceCall<Void> updateVoiceModel(UpdateVoiceModelOptions updateVoiceModelOptions) {
Validator.notNull(updateVoiceModelOptions, "updateVoiceModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
String[] pathParameters = { updateVoiceModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "updateVoiceModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (updateVoiceModelOptions.name() != null) {
contentJson.addProperty("name", updateVoiceModelOptions.name()); // depends on control dependency: [if], data = [none]
}
if (updateVoiceModelOptions.description() != null) {
contentJson.addProperty("description", updateVoiceModelOptions.description()); // depends on control dependency: [if], data = [none]
}
if (updateVoiceModelOptions.words() != null) {
contentJson.add("words", GsonSingleton.getGson().toJsonTree(updateVoiceModelOptions.words())); // depends on control dependency: [if], data = [(updateVoiceModelOptions.words()]
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} } |
public class class_name {
public Map<String, CmsModuleVersion> getInstalledModules() {
String file = CmsModuleConfiguration.DEFAULT_XML_FILE_NAME;
// /opencms/modules/module[?]
String basePath = new StringBuffer("/").append(CmsConfigurationManager.N_ROOT).append("/").append(
CmsModuleConfiguration.N_MODULES).append("/").append(CmsModuleXmlHandler.N_MODULE).append(
"[?]/").toString();
Map<String, CmsModuleVersion> modules = new HashMap<String, CmsModuleVersion>();
String name = "";
for (int i = 1; name != null; i++) {
if (i > 1) {
String ver = CmsModuleVersion.DEFAULT_VERSION;
try {
ver = getXmlHelper().getValue(
file,
CmsStringUtil.substitute(basePath, "?", "" + (i - 1)) + CmsModuleXmlHandler.N_VERSION);
} catch (@SuppressWarnings("unused") CmsXmlException e) {
// ignore
}
modules.put(name, new CmsModuleVersion(ver));
}
try {
name = getXmlHelper().getValue(
file,
CmsStringUtil.substitute(basePath, "?", "" + i) + CmsModuleXmlHandler.N_NAME);
} catch (@SuppressWarnings("unused") CmsXmlException e) {
// ignore
}
}
return modules;
} } | public class class_name {
public Map<String, CmsModuleVersion> getInstalledModules() {
String file = CmsModuleConfiguration.DEFAULT_XML_FILE_NAME;
// /opencms/modules/module[?]
String basePath = new StringBuffer("/").append(CmsConfigurationManager.N_ROOT).append("/").append(
CmsModuleConfiguration.N_MODULES).append("/").append(CmsModuleXmlHandler.N_MODULE).append(
"[?]/").toString();
Map<String, CmsModuleVersion> modules = new HashMap<String, CmsModuleVersion>();
String name = "";
for (int i = 1; name != null; i++) {
if (i > 1) {
String ver = CmsModuleVersion.DEFAULT_VERSION;
try {
ver = getXmlHelper().getValue(
file,
CmsStringUtil.substitute(basePath, "?", "" + (i - 1)) + CmsModuleXmlHandler.N_VERSION); // depends on control dependency: [try], data = [none]
} catch (@SuppressWarnings("unused") CmsXmlException e) {
// ignore
} // depends on control dependency: [catch], data = [none]
modules.put(name, new CmsModuleVersion(ver)); // depends on control dependency: [if], data = [none]
}
try {
name = getXmlHelper().getValue(
file,
CmsStringUtil.substitute(basePath, "?", "" + i) + CmsModuleXmlHandler.N_NAME); // depends on control dependency: [try], data = [none]
} catch (@SuppressWarnings("unused") CmsXmlException e) {
// ignore
} // depends on control dependency: [catch], data = [none]
}
return modules;
} } |
public class class_name {
public EClass getIfcStructuralLoadStatic() {
if (ifcStructuralLoadStaticEClass == null) {
ifcStructuralLoadStaticEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(553);
}
return ifcStructuralLoadStaticEClass;
} } | public class class_name {
public EClass getIfcStructuralLoadStatic() {
if (ifcStructuralLoadStaticEClass == null) {
ifcStructuralLoadStaticEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(553);
// depends on control dependency: [if], data = [none]
}
return ifcStructuralLoadStaticEClass;
} } |
public class class_name {
public static void deleteFile(@NonNull File file) {
boolean deleted = file.delete();
if (!deleted) {
Log.w(LOG_TAG, "Could not delete file: " + file);
}
} } | public class class_name {
public static void deleteFile(@NonNull File file) {
boolean deleted = file.delete();
if (!deleted) {
Log.w(LOG_TAG, "Could not delete file: " + file); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@FFDCIgnore(AuthenticationException.class)
protected Subject recreateFullSubject(WSPrincipal wsPrincipal, SecurityService securityService,
AtomicServiceReference<UnauthenticatedSubjectService> unauthenticatedSubjectServiceRef, String customCacheKey) {
Subject subject = null;
if (wsPrincipal != null) {
String userName = wsPrincipal.getName();
AuthenticateUserHelper authHelper = new AuthenticateUserHelper();
if (jaasLoginContextEntry == null) {
jaasLoginContextEntry = DESERIALIZE_LOGINCONTEXT_DEFAULT;
}
try {
subject = authHelper.authenticateUser(securityService.getAuthenticationService(), userName, jaasLoginContextEntry, customCacheKey);
} catch (AuthenticationException e) {
Tr.error(tc, "SEC_CONTEXT_DESERIALIZE_AUTHN_ERROR", new Object[] { e.getLocalizedMessage() });
}
}
if (subject == null) {
subject = unauthenticatedSubjectServiceRef.getService().getUnauthenticatedSubject();
}
return subject;
} } | public class class_name {
@FFDCIgnore(AuthenticationException.class)
protected Subject recreateFullSubject(WSPrincipal wsPrincipal, SecurityService securityService,
AtomicServiceReference<UnauthenticatedSubjectService> unauthenticatedSubjectServiceRef, String customCacheKey) {
Subject subject = null;
if (wsPrincipal != null) {
String userName = wsPrincipal.getName();
AuthenticateUserHelper authHelper = new AuthenticateUserHelper();
if (jaasLoginContextEntry == null) {
jaasLoginContextEntry = DESERIALIZE_LOGINCONTEXT_DEFAULT; // depends on control dependency: [if], data = [none]
}
try {
subject = authHelper.authenticateUser(securityService.getAuthenticationService(), userName, jaasLoginContextEntry, customCacheKey); // depends on control dependency: [try], data = [none]
} catch (AuthenticationException e) {
Tr.error(tc, "SEC_CONTEXT_DESERIALIZE_AUTHN_ERROR", new Object[] { e.getLocalizedMessage() });
} // depends on control dependency: [catch], data = [none]
}
if (subject == null) {
subject = unauthenticatedSubjectServiceRef.getService().getUnauthenticatedSubject(); // depends on control dependency: [if], data = [none]
}
return subject;
} } |
public class class_name {
public void marshall(PublishLayerVersionRequest publishLayerVersionRequest, ProtocolMarshaller protocolMarshaller) {
if (publishLayerVersionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(publishLayerVersionRequest.getLayerName(), LAYERNAME_BINDING);
protocolMarshaller.marshall(publishLayerVersionRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(publishLayerVersionRequest.getContent(), CONTENT_BINDING);
protocolMarshaller.marshall(publishLayerVersionRequest.getCompatibleRuntimes(), COMPATIBLERUNTIMES_BINDING);
protocolMarshaller.marshall(publishLayerVersionRequest.getLicenseInfo(), LICENSEINFO_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PublishLayerVersionRequest publishLayerVersionRequest, ProtocolMarshaller protocolMarshaller) {
if (publishLayerVersionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(publishLayerVersionRequest.getLayerName(), LAYERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(publishLayerVersionRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(publishLayerVersionRequest.getContent(), CONTENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(publishLayerVersionRequest.getCompatibleRuntimes(), COMPATIBLERUNTIMES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(publishLayerVersionRequest.getLicenseInfo(), LICENSEINFO_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Variant loadVariantWhenAuthorized(final HttpServletRequest request) {
// extract the pushApplicationID and its secret from the HTTP Basic
// header:
final String[] credentials = HttpBasicHelper.extractUsernameAndPasswordFromBasicHeader(request);
final String variantID = credentials[0];
final String secret = credentials[1];
final Variant variant = genericVariantService.findByVariantID(variantID);
if (variant != null && variant.getSecret().equals(secret)) {
return variant;
}
// unauthorized...
return null;
} } | public class class_name {
private Variant loadVariantWhenAuthorized(final HttpServletRequest request) {
// extract the pushApplicationID and its secret from the HTTP Basic
// header:
final String[] credentials = HttpBasicHelper.extractUsernameAndPasswordFromBasicHeader(request);
final String variantID = credentials[0];
final String secret = credentials[1];
final Variant variant = genericVariantService.findByVariantID(variantID);
if (variant != null && variant.getSecret().equals(secret)) {
return variant; // depends on control dependency: [if], data = [none]
}
// unauthorized...
return null;
} } |
public class class_name {
public void marshall(CreateDiskFromSnapshotRequest createDiskFromSnapshotRequest, ProtocolMarshaller protocolMarshaller) {
if (createDiskFromSnapshotRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDiskFromSnapshotRequest.getDiskName(), DISKNAME_BINDING);
protocolMarshaller.marshall(createDiskFromSnapshotRequest.getDiskSnapshotName(), DISKSNAPSHOTNAME_BINDING);
protocolMarshaller.marshall(createDiskFromSnapshotRequest.getAvailabilityZone(), AVAILABILITYZONE_BINDING);
protocolMarshaller.marshall(createDiskFromSnapshotRequest.getSizeInGb(), SIZEINGB_BINDING);
protocolMarshaller.marshall(createDiskFromSnapshotRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateDiskFromSnapshotRequest createDiskFromSnapshotRequest, ProtocolMarshaller protocolMarshaller) {
if (createDiskFromSnapshotRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDiskFromSnapshotRequest.getDiskName(), DISKNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDiskFromSnapshotRequest.getDiskSnapshotName(), DISKSNAPSHOTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDiskFromSnapshotRequest.getAvailabilityZone(), AVAILABILITYZONE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDiskFromSnapshotRequest.getSizeInGb(), SIZEINGB_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDiskFromSnapshotRequest.getTags(), TAGS_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 setChild(Element parent, Element child, String[] names, boolean firstToLast) {
Assert.isTrue(isDAVElement(parent));
Assert.isNotNull(child);
Assert.isTrue(DAV_NS.equals(resolve(getNSPrefix(child), parent)));
Assert.isNotNull(names);
boolean found = false;
String name = getNSLocalName(child);
for (int i = 0; !found && i < names.length; ++i) {
found = names[i].equals(name);
}
Assert.isTrue(found);
Node sibling = getChild(parent, name, names, firstToLast);
if (isDAVElement(sibling, name)) {
parent.replaceChild(child, sibling);
} else if (firstToLast) {
if (sibling == null) {
parent.appendChild(child);
} else {
parent.insertBefore(child, sibling);
}
} else {
Node refChild = null;
if (sibling == null) {
refChild = parent.getFirstChild();
} else {
refChild = sibling.getNextSibling();
}
if (refChild == null) {
parent.appendChild(child);
} else {
parent.insertBefore(child, refChild);
}
}
} } | public class class_name {
public static void setChild(Element parent, Element child, String[] names, boolean firstToLast) {
Assert.isTrue(isDAVElement(parent));
Assert.isNotNull(child);
Assert.isTrue(DAV_NS.equals(resolve(getNSPrefix(child), parent)));
Assert.isNotNull(names);
boolean found = false;
String name = getNSLocalName(child);
for (int i = 0; !found && i < names.length; ++i) {
found = names[i].equals(name); // depends on control dependency: [for], data = [i]
}
Assert.isTrue(found);
Node sibling = getChild(parent, name, names, firstToLast);
if (isDAVElement(sibling, name)) {
parent.replaceChild(child, sibling); // depends on control dependency: [if], data = [none]
} else if (firstToLast) {
if (sibling == null) {
parent.appendChild(child); // depends on control dependency: [if], data = [none]
} else {
parent.insertBefore(child, sibling); // depends on control dependency: [if], data = [none]
}
} else {
Node refChild = null;
if (sibling == null) {
refChild = parent.getFirstChild(); // depends on control dependency: [if], data = [none]
} else {
refChild = sibling.getNextSibling(); // depends on control dependency: [if], data = [none]
}
if (refChild == null) {
parent.appendChild(child); // depends on control dependency: [if], data = [none]
} else {
parent.insertBefore(child, refChild); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public QueryAtom bind(QueryBinding binding)
{
List<QueryArgument> args = new ArrayList<QueryArgument>();
for(QueryArgument arg : this.args) {
if(binding.isBound(arg)) {
args.add(binding.get(arg));
}
else {
args.add(arg);
}
}
return new QueryAtom(type, args);
} } | public class class_name {
public QueryAtom bind(QueryBinding binding)
{
List<QueryArgument> args = new ArrayList<QueryArgument>();
for(QueryArgument arg : this.args) {
if(binding.isBound(arg)) {
args.add(binding.get(arg)); // depends on control dependency: [if], data = [none]
}
else {
args.add(arg); // depends on control dependency: [if], data = [none]
}
}
return new QueryAtom(type, args);
} } |
public class class_name {
private byte[] bufX( long bias, int scale, int off, int log ) {
byte[] bs = new byte[(_len<<log)+off];
int j = 0;
for( int i=0; i<_len; i++ ) {
long le = -bias;
if(_id == null || _id.length == 0 || (j < _id.length && _id[j] == i)){
if( isNA2(j) ) {
le = NAS[log];
} else {
int x = (_xs[j]==Integer.MIN_VALUE+1 ? 0 : _xs[j])-scale;
le += x >= 0
? _ls[j]*PrettyPrint.pow10i( x)
: _ls[j]/PrettyPrint.pow10i(-x);
}
++j;
}
switch( log ) {
case 0: bs [i +off] = (byte)le ; break;
case 1: UDP.set2(bs,(i<<1)+off, (short)le); break;
case 2: UDP.set4(bs,(i<<2)+off, (int)le); break;
case 3: UDP.set8(bs,(i<<3)+off, le); break;
default: throw H2O.fail();
}
}
assert j == _sparseLen:"j = " + j + ", len = " + _sparseLen + ", len2 = " + _len + ", id[j] = " + _id[j];
return bs;
} } | public class class_name {
private byte[] bufX( long bias, int scale, int off, int log ) {
byte[] bs = new byte[(_len<<log)+off];
int j = 0;
for( int i=0; i<_len; i++ ) {
long le = -bias;
if(_id == null || _id.length == 0 || (j < _id.length && _id[j] == i)){
if( isNA2(j) ) {
le = NAS[log]; // depends on control dependency: [if], data = [none]
} else {
int x = (_xs[j]==Integer.MIN_VALUE+1 ? 0 : _xs[j])-scale;
le += x >= 0
? _ls[j]*PrettyPrint.pow10i( x)
: _ls[j]/PrettyPrint.pow10i(-x); // depends on control dependency: [if], data = [none]
}
++j; // depends on control dependency: [if], data = [none]
}
switch( log ) {
case 0: bs [i +off] = (byte)le ; break;
case 1: UDP.set2(bs,(i<<1)+off, (short)le); break;
case 2: UDP.set4(bs,(i<<2)+off, (int)le); break;
case 3: UDP.set8(bs,(i<<3)+off, le); break;
default: throw H2O.fail();
}
}
assert j == _sparseLen:"j = " + j + ", len = " + _sparseLen + ", len2 = " + _len + ", id[j] = " + _id[j];
return bs;
} } |
public class class_name {
public static ImmutablePair<PrivateKey, X509Certificate> extractCertificateWithKey(KeyStore keyStore, char [] keyStorePassword) {
Assert.notNull(keyStore, "KeyStore is mandatory");
Assert.notNull(keyStorePassword, "Password for key store is mandatory");
try {
Enumeration<String> aliases = keyStore.aliases();
while (aliases.hasMoreElements()) {
String aliasName = aliases.nextElement();
Key key = keyStore.getKey(aliasName, keyStorePassword);
if (key instanceof PrivateKey) {
PrivateKey privateKey = (PrivateKey) key;
Object cert = keyStore.getCertificate(aliasName);
if (cert instanceof X509Certificate) {
X509Certificate certificate = (X509Certificate) cert;
return ImmutablePair.of(privateKey, certificate);
}
}
}
throw new IllegalStateException("No valid key-certificate pair in the key store");
} catch (KeyStoreException | UnrecoverableKeyException | NoSuchAlgorithmException ex) {
throw new IllegalStateException("Failed to extract a valid key-certificate pair from key store", ex);
}
} } | public class class_name {
public static ImmutablePair<PrivateKey, X509Certificate> extractCertificateWithKey(KeyStore keyStore, char [] keyStorePassword) {
Assert.notNull(keyStore, "KeyStore is mandatory");
Assert.notNull(keyStorePassword, "Password for key store is mandatory");
try {
Enumeration<String> aliases = keyStore.aliases();
while (aliases.hasMoreElements()) {
String aliasName = aliases.nextElement();
Key key = keyStore.getKey(aliasName, keyStorePassword);
if (key instanceof PrivateKey) {
PrivateKey privateKey = (PrivateKey) key;
Object cert = keyStore.getCertificate(aliasName);
if (cert instanceof X509Certificate) {
X509Certificate certificate = (X509Certificate) cert;
return ImmutablePair.of(privateKey, certificate); // depends on control dependency: [if], data = [none]
}
}
}
throw new IllegalStateException("No valid key-certificate pair in the key store");
} catch (KeyStoreException | UnrecoverableKeyException | NoSuchAlgorithmException ex) {
throw new IllegalStateException("Failed to extract a valid key-certificate pair from key store", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public Byte getReportCOD()
{
// If the cached reference isn't set up, then get one now.
if (!_reportCODSet)
{
JsMessage localMsg = getJSMessage(true);
_reportCODSet = true;
_reportCOD = localMsg.getReportCOD();
}
return _reportCOD;
} } | public class class_name {
@Override
public Byte getReportCOD()
{
// If the cached reference isn't set up, then get one now.
if (!_reportCODSet)
{
JsMessage localMsg = getJSMessage(true);
_reportCODSet = true; // depends on control dependency: [if], data = [none]
_reportCOD = localMsg.getReportCOD(); // depends on control dependency: [if], data = [none]
}
return _reportCOD;
} } |
public class class_name {
@Override
public URL getResource(String name)
{
URL result = null;
for (Deployment deployment : kernel.getDeployments())
{
if (!(deployment instanceof WARDeployment))
{
result = deployment.getClassLoader().getResource(name);
if (result != null)
return result;
}
}
return super.getResource(name);
} } | public class class_name {
@Override
public URL getResource(String name)
{
URL result = null;
for (Deployment deployment : kernel.getDeployments())
{
if (!(deployment instanceof WARDeployment))
{
result = deployment.getClassLoader().getResource(name); // depends on control dependency: [if], data = [none]
if (result != null)
return result;
}
}
return super.getResource(name);
} } |
public class class_name {
public Map<String, String> getImageDnd() {
if (m_imageDnd == null) {
m_imageDnd = CmsCollectionsGenericWrapper.createLazyMap(new CmsImageDndTransformer());
}
return m_imageDnd;
} } | public class class_name {
public Map<String, String> getImageDnd() {
if (m_imageDnd == null) {
m_imageDnd = CmsCollectionsGenericWrapper.createLazyMap(new CmsImageDndTransformer()); // depends on control dependency: [if], data = [none]
}
return m_imageDnd;
} } |
public class class_name {
public CdnPathBuilder sharp(int strength) {
if (strength < 0 || strength > 20) {
strength = 5;
}
sb.append("/-/sharp/")
.append(strength);
return this;
} } | public class class_name {
public CdnPathBuilder sharp(int strength) {
if (strength < 0 || strength > 20) {
strength = 5; // depends on control dependency: [if], data = [none]
}
sb.append("/-/sharp/")
.append(strength);
return this;
} } |
public class class_name {
public static void openPropertyDialog(
CmsPropertiesBean result,
final I_CmsContextMenuHandler contextMenuHandler,
final boolean editName,
final Runnable cancelHandler,
final boolean enableAdeTemplateSelect,
final PropertyEditingContext editContext) {
final PropertyEditorHandler handler = new PropertyEditorHandler(contextMenuHandler);
handler.setPropertySaver(editContext.getPropertySaver());
handler.setEnableAdeTemplateSelect(enableAdeTemplateSelect);
editContext.setCancelHandler(cancelHandler);
handler.setPropertiesBean(result);
handler.setEditableName(editName);
final CmsVfsModePropertyEditor editor = new CmsVfsModePropertyEditor(result.getPropertyDefinitions(), handler);
editor.setShowResourceProperties(!handler.isFolder());
editor.setReadOnly(result.isReadOnly());
final CmsFormDialog dialog = new PropertiesFormDialog(handler.getDialogTitle(), editor.getForm());
editContext.setDialog(dialog);
if (editContext.allowCreateProperties()) {
CmsPropertyDefinitionButton defButton = editContext.createPropertyDefinitionButton();
defButton.installOnDialog(dialog);
defButton.getElement().getStyle().setFloat(Float.LEFT);
}
final CmsDialogFormHandler formHandler = new CmsDialogFormHandler();
editContext.setFormHandler(formHandler);
editContext.initCloseHandler();
formHandler.setDialog(dialog);
I_CmsFormSubmitHandler submitHandler = new CmsPropertySubmitHandler(handler);
formHandler.setSubmitHandler(submitHandler);
editor.getForm().setFormHandler(formHandler);
editor.initializeWidgets(dialog);
dialog.centerHorizontally(50);
if (editContext.isFocusNameField()) {
editor.focusNameField();
}
dialog.catchNotifications();
} } | public class class_name {
public static void openPropertyDialog(
CmsPropertiesBean result,
final I_CmsContextMenuHandler contextMenuHandler,
final boolean editName,
final Runnable cancelHandler,
final boolean enableAdeTemplateSelect,
final PropertyEditingContext editContext) {
final PropertyEditorHandler handler = new PropertyEditorHandler(contextMenuHandler);
handler.setPropertySaver(editContext.getPropertySaver());
handler.setEnableAdeTemplateSelect(enableAdeTemplateSelect);
editContext.setCancelHandler(cancelHandler);
handler.setPropertiesBean(result);
handler.setEditableName(editName);
final CmsVfsModePropertyEditor editor = new CmsVfsModePropertyEditor(result.getPropertyDefinitions(), handler);
editor.setShowResourceProperties(!handler.isFolder());
editor.setReadOnly(result.isReadOnly());
final CmsFormDialog dialog = new PropertiesFormDialog(handler.getDialogTitle(), editor.getForm());
editContext.setDialog(dialog);
if (editContext.allowCreateProperties()) {
CmsPropertyDefinitionButton defButton = editContext.createPropertyDefinitionButton();
defButton.installOnDialog(dialog); // depends on control dependency: [if], data = [none]
defButton.getElement().getStyle().setFloat(Float.LEFT); // depends on control dependency: [if], data = [none]
}
final CmsDialogFormHandler formHandler = new CmsDialogFormHandler();
editContext.setFormHandler(formHandler);
editContext.initCloseHandler();
formHandler.setDialog(dialog);
I_CmsFormSubmitHandler submitHandler = new CmsPropertySubmitHandler(handler);
formHandler.setSubmitHandler(submitHandler);
editor.getForm().setFormHandler(formHandler);
editor.initializeWidgets(dialog);
dialog.centerHorizontally(50);
if (editContext.isFocusNameField()) {
editor.focusNameField(); // depends on control dependency: [if], data = [none]
}
dialog.catchNotifications();
} } |
public class class_name {
protected String getTag(ILoggingEvent event) {
// format tag based on encoder layout; truncate if max length
// exceeded (only necessary for isLoggable(), which throws
// IllegalArgumentException)
String tag = (this.tagEncoder != null) ? this.tagEncoder.getLayout().doLayout(event) : event.getLoggerName();
if (checkLoggable && (tag.length() > MAX_TAG_LENGTH)) {
tag = tag.substring(0, MAX_TAG_LENGTH - 1) + "*";
}
return tag;
} } | public class class_name {
protected String getTag(ILoggingEvent event) {
// format tag based on encoder layout; truncate if max length
// exceeded (only necessary for isLoggable(), which throws
// IllegalArgumentException)
String tag = (this.tagEncoder != null) ? this.tagEncoder.getLayout().doLayout(event) : event.getLoggerName();
if (checkLoggable && (tag.length() > MAX_TAG_LENGTH)) {
tag = tag.substring(0, MAX_TAG_LENGTH - 1) + "*"; // depends on control dependency: [if], data = [none]
}
return tag;
} } |
public class class_name {
void iteratorSpecialDelete(
Iterator iter,
GBSNode node,
int index)
{
_vno++;
if ((_vno&1) == 1)
{
node.deleteByLeftShift(index);
node.adjustMedian();
_population--;
}
synchronized(iter)
{
}
_vno++;
} } | public class class_name {
void iteratorSpecialDelete(
Iterator iter,
GBSNode node,
int index)
{
_vno++;
if ((_vno&1) == 1)
{
node.deleteByLeftShift(index); // depends on control dependency: [if], data = [none]
node.adjustMedian(); // depends on control dependency: [if], data = [none]
_population--; // depends on control dependency: [if], data = [none]
}
synchronized(iter)
{
}
_vno++;
} } |
public class class_name {
private static int sizeofPrimitiveType(final Class type) {
if (type == int.class) {
return INT_FIELD_SIZE;
} else if (type == long.class) {
return LONG_FIELD_SIZE;
} else if (type == short.class) {
return SHORT_FIELD_SIZE;
} else if (type == byte.class) {
return BYTE_FIELD_SIZE;
} else if (type == boolean.class) {
return BOOLEAN_FIELD_SIZE;
} else if (type == char.class) {
return CHAR_FIELD_SIZE;
} else if (type == double.class) {
return DOUBLE_FIELD_SIZE;
} else if (type == float.class) {
return FLOAT_FIELD_SIZE;
} else {
throw new IllegalArgumentException("not primitive: " + type);
}
} } | public class class_name {
private static int sizeofPrimitiveType(final Class type) {
if (type == int.class) {
return INT_FIELD_SIZE; // depends on control dependency: [if], data = [none]
} else if (type == long.class) {
return LONG_FIELD_SIZE; // depends on control dependency: [if], data = [none]
} else if (type == short.class) {
return SHORT_FIELD_SIZE; // depends on control dependency: [if], data = [none]
} else if (type == byte.class) {
return BYTE_FIELD_SIZE; // depends on control dependency: [if], data = [none]
} else if (type == boolean.class) {
return BOOLEAN_FIELD_SIZE; // depends on control dependency: [if], data = [none]
} else if (type == char.class) {
return CHAR_FIELD_SIZE; // depends on control dependency: [if], data = [none]
} else if (type == double.class) {
return DOUBLE_FIELD_SIZE; // depends on control dependency: [if], data = [none]
} else if (type == float.class) {
return FLOAT_FIELD_SIZE; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("not primitive: " + type);
}
} } |
public class class_name {
public JSONObject simnet(String text1, String text2, HashMap<String, Object> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("text_1", text1);
request.addBody("text_2", text2);
if (options != null) {
request.addBody(options);
}
request.setUri(NlpConsts.SIMNET);
request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK);
request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} } | public class class_name {
public JSONObject simnet(String text1, String text2, HashMap<String, Object> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("text_1", text1);
request.addBody("text_2", text2);
if (options != null) {
request.addBody(options); // depends on control dependency: [if], data = [(options]
}
request.setUri(NlpConsts.SIMNET);
request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK);
request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} } |
public class class_name {
public synchronized SpiderMonitor register(Spider... spiders) throws JMException {
for (Spider spider : spiders) {
MonitorSpiderListener monitorSpiderListener = new MonitorSpiderListener();
if (spider.getSpiderListeners() == null) {
List<SpiderListener> spiderListeners = new ArrayList<SpiderListener>();
spiderListeners.add(monitorSpiderListener);
spider.setSpiderListeners(spiderListeners);
} else {
spider.getSpiderListeners().add(monitorSpiderListener);
}
SpiderStatusMXBean spiderStatusMBean = getSpiderStatusMBean(spider, monitorSpiderListener);
registerMBean(spiderStatusMBean);
spiderStatuses.add(spiderStatusMBean);
}
return this;
} } | public class class_name {
public synchronized SpiderMonitor register(Spider... spiders) throws JMException {
for (Spider spider : spiders) {
MonitorSpiderListener monitorSpiderListener = new MonitorSpiderListener();
if (spider.getSpiderListeners() == null) {
List<SpiderListener> spiderListeners = new ArrayList<SpiderListener>();
spiderListeners.add(monitorSpiderListener); // depends on control dependency: [if], data = [none]
spider.setSpiderListeners(spiderListeners); // depends on control dependency: [if], data = [none]
} else {
spider.getSpiderListeners().add(monitorSpiderListener); // depends on control dependency: [if], data = [none]
}
SpiderStatusMXBean spiderStatusMBean = getSpiderStatusMBean(spider, monitorSpiderListener);
registerMBean(spiderStatusMBean); // depends on control dependency: [for], data = [spider]
spiderStatuses.add(spiderStatusMBean); // depends on control dependency: [for], data = [spider]
}
return this;
} } |
public class class_name {
private static ImmutableList<ErrorProneToken> annotationTokens(
Tree tree, VisitorState state, int annotationEnd) {
int endPos;
if (tree instanceof JCMethodDecl) {
JCMethodDecl methodTree = (JCMethodDecl) tree;
endPos =
methodTree.getBody() == null
? state.getEndPosition(methodTree)
: methodTree.getBody().getStartPosition();
} else if (tree instanceof JCVariableDecl) {
endPos = ((JCVariableDecl) tree).getType().getStartPosition();
} else if (tree instanceof JCClassDecl) {
JCClassDecl classTree = (JCClassDecl) tree;
endPos =
classTree.getMembers().isEmpty()
? state.getEndPosition(classTree)
: classTree.getMembers().get(0).getStartPosition();
} else {
throw new AssertionError();
}
return ErrorProneTokens.getTokens(
state.getSourceCode().subSequence(annotationEnd, endPos).toString(), state.context);
} } | public class class_name {
private static ImmutableList<ErrorProneToken> annotationTokens(
Tree tree, VisitorState state, int annotationEnd) {
int endPos;
if (tree instanceof JCMethodDecl) {
JCMethodDecl methodTree = (JCMethodDecl) tree;
endPos =
methodTree.getBody() == null
? state.getEndPosition(methodTree)
: methodTree.getBody().getStartPosition(); // depends on control dependency: [if], data = [none]
} else if (tree instanceof JCVariableDecl) {
endPos = ((JCVariableDecl) tree).getType().getStartPosition(); // depends on control dependency: [if], data = [none]
} else if (tree instanceof JCClassDecl) {
JCClassDecl classTree = (JCClassDecl) tree;
endPos =
classTree.getMembers().isEmpty()
? state.getEndPosition(classTree)
: classTree.getMembers().get(0).getStartPosition(); // depends on control dependency: [if], data = [none]
} else {
throw new AssertionError();
}
return ErrorProneTokens.getTokens(
state.getSourceCode().subSequence(annotationEnd, endPos).toString(), state.context);
} } |
public class class_name {
public void recording() {
if (null != dialog && dialog.isShowing()) {
mImageView.setImageResource(R.drawable.hlklib_record_animate_01);
mWarningText.setText(R.string.hlklib_voice_recorder_warning_text_cancel);
}
} } | public class class_name {
public void recording() {
if (null != dialog && dialog.isShowing()) {
mImageView.setImageResource(R.drawable.hlklib_record_animate_01); // depends on control dependency: [if], data = [none]
mWarningText.setText(R.string.hlklib_voice_recorder_warning_text_cancel); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void runEKBPreCommitHooks(EKBCommit commit) throws EKBException {
for (EKBPreCommitHook hook : preCommitHooks) {
try {
hook.onPreCommit(commit);
} catch (EKBException e) {
throw new EKBException("EDBException is thrown in a pre commit hook.", e);
} catch (Exception e) {
LOGGER.warn("An exception is thrown in a EKB pre commit hook.", e);
}
}
} } | public class class_name {
private void runEKBPreCommitHooks(EKBCommit commit) throws EKBException {
for (EKBPreCommitHook hook : preCommitHooks) {
try {
hook.onPreCommit(commit); // depends on control dependency: [try], data = [none]
} catch (EKBException e) {
throw new EKBException("EDBException is thrown in a pre commit hook.", e);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
LOGGER.warn("An exception is thrown in a EKB pre commit hook.", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private boolean getBoolean(String key, boolean defaultValue) {
try {
return optBoolean(key, defaultValue);
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while getting boolean key '%s'", key);
logException(e);
return defaultValue;
}
} } | public class class_name {
private boolean getBoolean(String key, boolean defaultValue) {
try {
return optBoolean(key, defaultValue); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while getting boolean key '%s'", key);
logException(e);
return defaultValue;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Nonnull
private static String leftpad(@Nonnull String s, int n, char padChar) {
int diff = n - s.length();
if (diff <= 0) {
return s;
}
StringBuilder buf = new StringBuilder(n);
for (int i = 0; i < diff; ++i) {
buf.append(padChar);
}
buf.append(s);
return buf.toString();
} } | public class class_name {
@Nonnull
private static String leftpad(@Nonnull String s, int n, char padChar) {
int diff = n - s.length();
if (diff <= 0) {
return s; // depends on control dependency: [if], data = [none]
}
StringBuilder buf = new StringBuilder(n);
for (int i = 0; i < diff; ++i) {
buf.append(padChar); // depends on control dependency: [for], data = [none]
}
buf.append(s);
return buf.toString();
} } |
public class class_name {
public java.util.List<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>> getTaskParameters() {
if (taskParameters == null) {
taskParameters = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>>();
}
return taskParameters;
} } | public class class_name {
public java.util.List<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>> getTaskParameters() {
if (taskParameters == null) {
taskParameters = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>>(); // depends on control dependency: [if], data = [none]
}
return taskParameters;
} } |
public class class_name {
void removeDeadEndTransitions()
{
Iterator<CharRange> it = transitions.keySet().iterator();
while (it.hasNext())
{
CharRange r = it.next();
if (transitions.get(r).getTo().isDeadEnd())
{
it.remove();
}
}
} } | public class class_name {
void removeDeadEndTransitions()
{
Iterator<CharRange> it = transitions.keySet().iterator();
while (it.hasNext())
{
CharRange r = it.next();
if (transitions.get(r).getTo().isDeadEnd())
{
it.remove();
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public AppRequestToken login(
String usernameParam, String passwordParam, Long sessionLifespanSecondsParam) {
if (this.isEmpty(usernameParam) || this.isEmpty(passwordParam)) {
throw new FluidClientException(
"Username and Password required.",
FluidClientException.ErrorCode.FIELD_VALIDATE);
}
AuthRequest authRequest = new AuthRequest();
authRequest.setUsername(usernameParam);
authRequest.setLifetime(sessionLifespanSecondsParam);
//Init the session...
//Init the session to get the salt...
AuthResponse authResponse;
try {
authResponse = new AuthResponse(
this.postJson(
true,
authRequest,
WS.Path.User.Version1.userInitSession()));
}
//JSON format problem...
catch (JSONException jsonException) {
throw new FluidClientException(
jsonException.getMessage(),jsonException,FluidClientException.ErrorCode.JSON_PARSING);
}
AuthEncryptedData authEncData =
this.initializeSession(passwordParam, authResponse);
//Issue the token...
AppRequestToken appReqToken = this.issueAppRequestToken(
authResponse.getServiceTicketBase64(),
usernameParam, authEncData);
appReqToken.setRoleString(authEncData.getRoleListing());
appReqToken.setSalt(authResponse.getSalt());
return appReqToken;
} } | public class class_name {
public AppRequestToken login(
String usernameParam, String passwordParam, Long sessionLifespanSecondsParam) {
if (this.isEmpty(usernameParam) || this.isEmpty(passwordParam)) {
throw new FluidClientException(
"Username and Password required.",
FluidClientException.ErrorCode.FIELD_VALIDATE);
}
AuthRequest authRequest = new AuthRequest();
authRequest.setUsername(usernameParam);
authRequest.setLifetime(sessionLifespanSecondsParam);
//Init the session...
//Init the session to get the salt...
AuthResponse authResponse;
try {
authResponse = new AuthResponse(
this.postJson(
true,
authRequest,
WS.Path.User.Version1.userInitSession())); // depends on control dependency: [try], data = [none]
}
//JSON format problem...
catch (JSONException jsonException) {
throw new FluidClientException(
jsonException.getMessage(),jsonException,FluidClientException.ErrorCode.JSON_PARSING);
} // depends on control dependency: [catch], data = [none]
AuthEncryptedData authEncData =
this.initializeSession(passwordParam, authResponse);
//Issue the token...
AppRequestToken appReqToken = this.issueAppRequestToken(
authResponse.getServiceTicketBase64(),
usernameParam, authEncData);
appReqToken.setRoleString(authEncData.getRoleListing());
appReqToken.setSalt(authResponse.getSalt());
return appReqToken;
} } |
public class class_name {
public static String formatSlices(List<DataSlice> slices, int max)
{
if (slices != null)
{
StringBuilder builder = new StringBuilder();
if (slices.size() != 0)
{
int number = 1;
int sliceCount = slices.size();
for(DataSlice slice : slices)
{
builder.append("List<DataSlice>@");
builder.append(Integer.toHexString(System.identityHashCode(slices)));
builder.append(" Slice ");
builder.append(number++);
builder.append(" of ");
builder.append(sliceCount);
// OK, now get the slice added into the builder
builder.append(" :" + ls + " ");
formatSliceToSB(builder, slice, max);
builder.append(ls);
}
}
else
{
builder.append("List<DataSlice>@");
builder.append(Integer.toHexString(System.identityHashCode(slices)));
builder.append(" has no slices");
}
return builder.toString();
}
else
{
return "List<DataSlice> is null";
}
} } | public class class_name {
public static String formatSlices(List<DataSlice> slices, int max)
{
if (slices != null)
{
StringBuilder builder = new StringBuilder();
if (slices.size() != 0)
{
int number = 1;
int sliceCount = slices.size();
for(DataSlice slice : slices)
{
builder.append("List<DataSlice>@"); // depends on control dependency: [for], data = [none]
builder.append(Integer.toHexString(System.identityHashCode(slices))); // depends on control dependency: [for], data = [slice]
builder.append(" Slice "); // depends on control dependency: [for], data = [none]
builder.append(number++); // depends on control dependency: [for], data = [none]
builder.append(" of "); // depends on control dependency: [for], data = [none]
builder.append(sliceCount); // depends on control dependency: [for], data = [slice]
// OK, now get the slice added into the builder
builder.append(" :" + ls + " "); // depends on control dependency: [for], data = [none]
formatSliceToSB(builder, slice, max); // depends on control dependency: [for], data = [slice]
builder.append(ls); // depends on control dependency: [for], data = [none]
}
}
else
{
builder.append("List<DataSlice>@"); // depends on control dependency: [if], data = [none]
builder.append(Integer.toHexString(System.identityHashCode(slices))); // depends on control dependency: [if], data = [none]
builder.append(" has no slices"); // depends on control dependency: [if], data = [none]
}
return builder.toString(); // depends on control dependency: [if], data = [none]
}
else
{
return "List<DataSlice> is null"; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void run () throws MojoExecutionException, MojoFailureException
{
ESuccess exitCode;
try
{
if (getLog ().isDebugEnabled ())
{
getLog ().debug ("Running " + getToolName () + ": " + this);
}
exitCode = execute ();
}
catch (final Exception e)
{
throw new MojoExecutionException ("Failed to execute " + getToolName (), e);
}
if (exitCode.isFailure ())
{
throw new MojoFailureException (getToolName () + " reported failure: " + this);
}
} } | public class class_name {
public void run () throws MojoExecutionException, MojoFailureException
{
ESuccess exitCode;
try
{
if (getLog ().isDebugEnabled ())
{
getLog ().debug ("Running " + getToolName () + ": " + this); // depends on control dependency: [if], data = [none]
}
exitCode = execute ();
}
catch (final Exception e)
{
throw new MojoExecutionException ("Failed to execute " + getToolName (), e);
}
if (exitCode.isFailure ())
{
throw new MojoFailureException (getToolName () + " reported failure: " + this);
}
} } |
public class class_name {
public boolean collectResponse(final ODistributedResponse response) {
final String executorNode = response.getExecutorNodeName();
final String senderNode = response.getSenderNodeName();
response.setDistributedResponseManager(this);
synchronousResponsesLock.lock();
try {
if (!executorNode.equals(dManager.getLocalNodeName()) && !responses.containsKey(executorNode)) {
ODistributedServerLog.warn(this, senderNode, executorNode, DIRECTION.IN,
"Received response for request (%s) from unexpected node. Expected are: %s", request, getExpectedNodes());
Orient.instance().getProfiler()
.updateCounter("distributed.node.unexpectedNodeResponse", "Number of responses from unexpected nodes", +1);
return false;
}
dManager.getMessageService().updateLatency(executorNode, sentOn);
responses.put(executorNode, response);
receivedResponses++;
if (waitForLocalNode && executorNode.equals(senderNode))
receivedCurrentNode = true;
if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog.debug(this, senderNode, executorNode, DIRECTION.IN,
"Received response '%s' for request (%s) (receivedCurrentNode=%s receivedResponses=%d totalExpectedResponses=%d quorum=%d)",
response, request, receivedCurrentNode, receivedResponses, totalExpectedResponses, quorum);
if (groupResponsesByResult) {
// PUT THE RESPONSE IN THE RIGHT RESPONSE GROUP
// TODO: AVOID TO KEEP ALL THE RESULT FOR THE SAME RESP GROUP, BUT RATHER THE FIRST ONE + COUNTER
final Object responsePayload = response.getPayload();
boolean foundBucket = false;
for (int i = 0; i < responseGroups.size(); ++i) {
final List<ODistributedResponse> responseGroup = responseGroups.get(i);
if (responseGroup.isEmpty())
// ABSENT
foundBucket = true;
else {
final Object rgPayload = responseGroup.get(0).getPayload();
if (rgPayload == null && responsePayload == null)
// BOTH NULL
foundBucket = true;
else if (rgPayload != null) {
if (rgPayload instanceof ODocument && responsePayload instanceof ODocument && !((ODocument) rgPayload).getIdentity()
.isValid() && ((ODocument) rgPayload).hasSameContentOf((ODocument) responsePayload))
// SAME RESULT
foundBucket = true;
else if (rgPayload.equals(responsePayload))
// SAME RESULT
foundBucket = true;
else if (rgPayload instanceof Collection && responsePayload instanceof Collection) {
if (OMultiValue.equals((Collection) rgPayload, (Collection) responsePayload))
// COLLECTIONS WITH THE SAME VALUES
foundBucket = true;
}
}
}
if (foundBucket) {
responseGroup.add(response);
break;
}
}
if (!foundBucket) {
// CREATE A NEW BUCKET
final ArrayList<ODistributedResponse> newBucket = new ArrayList<ODistributedResponse>();
responseGroups.add(newBucket);
newBucket.add(response);
}
}
// FOR EVERY RESPONSE COLLECTED, COMPUTE THE FINAL QUORUM RESPONSE IF POSSIBLE
computeQuorumResponse(false);
return checkForCompletion();
} finally {
synchronousResponsesLock.unlock();
}
} } | public class class_name {
public boolean collectResponse(final ODistributedResponse response) {
final String executorNode = response.getExecutorNodeName();
final String senderNode = response.getSenderNodeName();
response.setDistributedResponseManager(this);
synchronousResponsesLock.lock();
try {
if (!executorNode.equals(dManager.getLocalNodeName()) && !responses.containsKey(executorNode)) {
ODistributedServerLog.warn(this, senderNode, executorNode, DIRECTION.IN,
"Received response for request (%s) from unexpected node. Expected are: %s", request, getExpectedNodes()); // depends on control dependency: [if], data = [none]
Orient.instance().getProfiler()
.updateCounter("distributed.node.unexpectedNodeResponse", "Number of responses from unexpected nodes", +1); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
dManager.getMessageService().updateLatency(executorNode, sentOn); // depends on control dependency: [try], data = [none]
responses.put(executorNode, response); // depends on control dependency: [try], data = [none]
receivedResponses++; // depends on control dependency: [try], data = [none]
if (waitForLocalNode && executorNode.equals(senderNode))
receivedCurrentNode = true;
if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog.debug(this, senderNode, executorNode, DIRECTION.IN,
"Received response '%s' for request (%s) (receivedCurrentNode=%s receivedResponses=%d totalExpectedResponses=%d quorum=%d)",
response, request, receivedCurrentNode, receivedResponses, totalExpectedResponses, quorum); // depends on control dependency: [try], data = [none]
if (groupResponsesByResult) {
// PUT THE RESPONSE IN THE RIGHT RESPONSE GROUP
// TODO: AVOID TO KEEP ALL THE RESULT FOR THE SAME RESP GROUP, BUT RATHER THE FIRST ONE + COUNTER
final Object responsePayload = response.getPayload();
boolean foundBucket = false;
for (int i = 0; i < responseGroups.size(); ++i) {
final List<ODistributedResponse> responseGroup = responseGroups.get(i);
if (responseGroup.isEmpty())
// ABSENT
foundBucket = true;
else {
final Object rgPayload = responseGroup.get(0).getPayload();
if (rgPayload == null && responsePayload == null)
// BOTH NULL
foundBucket = true;
else if (rgPayload != null) {
if (rgPayload instanceof ODocument && responsePayload instanceof ODocument && !((ODocument) rgPayload).getIdentity()
.isValid() && ((ODocument) rgPayload).hasSameContentOf((ODocument) responsePayload))
// SAME RESULT
foundBucket = true;
else if (rgPayload.equals(responsePayload))
// SAME RESULT
foundBucket = true;
else if (rgPayload instanceof Collection && responsePayload instanceof Collection) {
if (OMultiValue.equals((Collection) rgPayload, (Collection) responsePayload))
// COLLECTIONS WITH THE SAME VALUES
foundBucket = true;
}
}
}
if (foundBucket) {
responseGroup.add(response); // depends on control dependency: [if], data = [none]
break;
}
}
if (!foundBucket) {
// CREATE A NEW BUCKET
final ArrayList<ODistributedResponse> newBucket = new ArrayList<ODistributedResponse>();
responseGroups.add(newBucket); // depends on control dependency: [if], data = [none]
newBucket.add(response); // depends on control dependency: [if], data = [none]
}
}
// FOR EVERY RESPONSE COLLECTED, COMPUTE THE FINAL QUORUM RESPONSE IF POSSIBLE
computeQuorumResponse(false); // depends on control dependency: [try], data = [none]
return checkForCompletion(); // depends on control dependency: [try], data = [none]
} finally {
synchronousResponsesLock.unlock();
}
} } |
public class class_name {
public boolean cancelShutdown()
{
if (scheduledGraceful != null)
{
boolean result = scheduledGraceful.cancel(false);
if (result)
{
shutdown.set(false);
if (gracefulCallback != null)
gracefulCallback.cancel();
if (pool != null)
pool.prefill();
scheduledGraceful = null;
gracefulCallback = null;
}
else
{
return false;
}
}
else if (shutdown.get())
{
shutdown.set(false);
if (gracefulCallback != null)
gracefulCallback.cancel();
if (pool != null)
pool.prefill();
gracefulCallback = null;
}
else
{
return false;
}
return true;
} } | public class class_name {
public boolean cancelShutdown()
{
if (scheduledGraceful != null)
{
boolean result = scheduledGraceful.cancel(false);
if (result)
{
shutdown.set(false); // depends on control dependency: [if], data = [none]
if (gracefulCallback != null)
gracefulCallback.cancel();
if (pool != null)
pool.prefill();
scheduledGraceful = null; // depends on control dependency: [if], data = [none]
gracefulCallback = null; // depends on control dependency: [if], data = [none]
}
else
{
return false; // depends on control dependency: [if], data = [none]
}
}
else if (shutdown.get())
{
shutdown.set(false); // depends on control dependency: [if], data = [none]
if (gracefulCallback != null)
gracefulCallback.cancel();
if (pool != null)
pool.prefill();
gracefulCallback = null; // depends on control dependency: [if], data = [none]
}
else
{
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public Integer getPosition(String parameterName) {
Integer position = null;
for (int i = 0; i < this.sqlParameterNames.size(); i++) {
if (this.sqlParameterNames.get(i).equals(parameterName) == true) {
position = i;
break;
}
}
return position;
} } | public class class_name {
public Integer getPosition(String parameterName) {
Integer position = null;
for (int i = 0; i < this.sqlParameterNames.size(); i++) {
if (this.sqlParameterNames.get(i).equals(parameterName) == true) {
position = i;
// depends on control dependency: [if], data = [none]
break;
}
}
return position;
} } |
public class class_name {
private String getCallerUniqueName() throws WIMApplicationException {
String uniqueName = null;
Subject subject = null;
WSCredential cred = null;
try {
/* Get the subject */
if ((subject = WSSubject.getRunAsSubject()) == null) {
subject = WSSubject.getCallerSubject();
}
/* Get the credential */
if (subject != null) {
Iterator<WSCredential> iter = subject.getPublicCredentials(WSCredential.class).iterator();
if (iter.hasNext()) {
cred = iter.next();
}
}
/* Get the unique name */
if (cred == null)
return null;
else
uniqueName = cred.getUniqueSecurityName();
} //throw exception in case there is some issue while retrieving authentication details from subject
catch (Exception excp) {
excp.getMessage();
return null;
}
//return unique name obtained from subject
return uniqueName;
} } | public class class_name {
private String getCallerUniqueName() throws WIMApplicationException {
String uniqueName = null;
Subject subject = null;
WSCredential cred = null;
try {
/* Get the subject */
if ((subject = WSSubject.getRunAsSubject()) == null) {
subject = WSSubject.getCallerSubject(); // depends on control dependency: [if], data = [none]
}
/* Get the credential */
if (subject != null) {
Iterator<WSCredential> iter = subject.getPublicCredentials(WSCredential.class).iterator();
if (iter.hasNext()) {
cred = iter.next(); // depends on control dependency: [if], data = [none]
}
}
/* Get the unique name */
if (cred == null)
return null;
else
uniqueName = cred.getUniqueSecurityName();
} //throw exception in case there is some issue while retrieving authentication details from subject
catch (Exception excp) {
excp.getMessage();
return null;
}
//return unique name obtained from subject
return uniqueName;
} } |
public class class_name {
public void marshall(UpdateLoggerDefinitionRequest updateLoggerDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (updateLoggerDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateLoggerDefinitionRequest.getLoggerDefinitionId(), LOGGERDEFINITIONID_BINDING);
protocolMarshaller.marshall(updateLoggerDefinitionRequest.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateLoggerDefinitionRequest updateLoggerDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (updateLoggerDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateLoggerDefinitionRequest.getLoggerDefinitionId(), LOGGERDEFINITIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateLoggerDefinitionRequest.getName(), NAME_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 Routed<T> route(M method, String path) {
MethodlessRouter<T> router = routers.get(method);
if (router == null) router = anyMethodRouter;
Routed<T> ret = router.route(path);
if (ret != null) return ret;
if (router != anyMethodRouter) {
ret = anyMethodRouter.route(path);
if (ret != null) return ret;
}
if (notFound != null) return new Routed<T>(notFound, true, Collections.<String, String>emptyMap());
return null;
} } | public class class_name {
public Routed<T> route(M method, String path) {
MethodlessRouter<T> router = routers.get(method);
if (router == null) router = anyMethodRouter;
Routed<T> ret = router.route(path);
if (ret != null) return ret;
if (router != anyMethodRouter) {
ret = anyMethodRouter.route(path); // depends on control dependency: [if], data = [none]
if (ret != null) return ret;
}
if (notFound != null) return new Routed<T>(notFound, true, Collections.<String, String>emptyMap());
return null;
} } |
public class class_name {
public static double Manhattan(double[] p, double[] q) {
double sum = 0;
for (int i = 0; i < p.length; i++) {
sum += Math.abs(p[i] - q[i]);
}
return sum;
} } | public class class_name {
public static double Manhattan(double[] p, double[] q) {
double sum = 0;
for (int i = 0; i < p.length; i++) {
sum += Math.abs(p[i] - q[i]); // depends on control dependency: [for], data = [i]
}
return sum;
} } |
public class class_name {
public void marshall(UpdateManagedInstanceRoleRequest updateManagedInstanceRoleRequest, ProtocolMarshaller protocolMarshaller) {
if (updateManagedInstanceRoleRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateManagedInstanceRoleRequest.getInstanceId(), INSTANCEID_BINDING);
protocolMarshaller.marshall(updateManagedInstanceRoleRequest.getIamRole(), IAMROLE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateManagedInstanceRoleRequest updateManagedInstanceRoleRequest, ProtocolMarshaller protocolMarshaller) {
if (updateManagedInstanceRoleRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateManagedInstanceRoleRequest.getInstanceId(), INSTANCEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateManagedInstanceRoleRequest.getIamRole(), IAMROLE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static boolean hasPossibleMutatingMethods(@Nonnull final List<Method> methods) {
boolean result = false;
for (final Method method : methods) {
if (!method.getAttributes().isEmpty()) {
result = true;
break;
}
}
return result;
} } | public class class_name {
private static boolean hasPossibleMutatingMethods(@Nonnull final List<Method> methods) {
boolean result = false;
for (final Method method : methods) {
if (!method.getAttributes().isEmpty()) {
result = true; // depends on control dependency: [if], data = [none]
break;
}
}
return result;
} } |
public class class_name {
public static void unexplode(File dir, int compressionLevel) {
try {
// Find a new unique name is the same directory
File zip = FileUtils.getTempFileFor(dir);
// Pack it
pack(dir, zip, compressionLevel);
// Delete the directory
FileUtils.deleteDirectory(dir);
// Rename the archive
FileUtils.moveFile(zip, dir);
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
} } | public class class_name {
public static void unexplode(File dir, int compressionLevel) {
try {
// Find a new unique name is the same directory
File zip = FileUtils.getTempFileFor(dir);
// Pack it
pack(dir, zip, compressionLevel); // depends on control dependency: [try], data = [none]
// Delete the directory
FileUtils.deleteDirectory(dir); // depends on control dependency: [try], data = [none]
// Rename the archive
FileUtils.moveFile(zip, dir); // depends on control dependency: [try], data = [none]
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Variable getDeclaredVariable(String name, boolean publicOnly) {
//private Set mPrivateVars;
Variable var = mDeclared.get(name);
if (var != null) {
// If its okay to be private or its public then...
if (!publicOnly || mPrivateVars == null ||
!mPrivateVars.contains(var)) {
return var;
}
}
if (mParent != null) {
return mParent.getDeclaredVariable(name);
}
return null;
} } | public class class_name {
public Variable getDeclaredVariable(String name, boolean publicOnly) {
//private Set mPrivateVars;
Variable var = mDeclared.get(name);
if (var != null) {
// If its okay to be private or its public then...
if (!publicOnly || mPrivateVars == null ||
!mPrivateVars.contains(var)) {
return var; // depends on control dependency: [if], data = [none]
}
}
if (mParent != null) {
return mParent.getDeclaredVariable(name); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
protected boolean isSetterMethod(Method method) {
Matcher matcher = _setterRegex.matcher(method.getName());
if (matcher.matches()) {
if (Modifier.isStatic(method.getModifiers())) return false;
if (!Modifier.isPublic(method.getModifiers())) return false;
if (!Void.TYPE.equals(method.getReturnType())) return false;
// method parameter checks
Class[] params = method.getParameterTypes();
if (params.length != 1) return false;
if (TypeMappingsFactory.TYPE_UNKNOWN == _tmf.getTypeId(params[0])) return false;
return true;
}
return false;
} } | public class class_name {
protected boolean isSetterMethod(Method method) {
Matcher matcher = _setterRegex.matcher(method.getName());
if (matcher.matches()) {
if (Modifier.isStatic(method.getModifiers())) return false;
if (!Modifier.isPublic(method.getModifiers())) return false;
if (!Void.TYPE.equals(method.getReturnType())) return false;
// method parameter checks
Class[] params = method.getParameterTypes();
if (params.length != 1) return false;
if (TypeMappingsFactory.TYPE_UNKNOWN == _tmf.getTypeId(params[0])) return false;
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void init(HttpInboundServiceContext sc, BNFHeaders hdrs) {
// for requests, we don't care about the validation
setHeaderValidation(false);
setOwner(sc);
setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
if (null != hdrs) {
hdrs.duplicate(this);
}
} } | public class class_name {
public void init(HttpInboundServiceContext sc, BNFHeaders hdrs) {
// for requests, we don't care about the validation
setHeaderValidation(false);
setOwner(sc);
setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
if (null != hdrs) {
hdrs.duplicate(this); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static double min(double[][] values) {
double min = Double.MAX_VALUE;
for (int i = 0; i < values.length; i++) {
for (int j = 0; j < values[i].length; j++) {
min = (values[i][j] < min) ? values[i][j] : min;
}
}
return min;
} } | public class class_name {
public static double min(double[][] values) {
double min = Double.MAX_VALUE;
for (int i = 0; i < values.length; i++) {
for (int j = 0; j < values[i].length; j++) {
min = (values[i][j] < min) ? values[i][j] : min; // depends on control dependency: [for], data = [j]
}
}
return min;
} } |
public class class_name {
void close() {
final String methodName = "close";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName);
}
/*
* Cancel any ongoing dispatch
*/
_cancelled = true;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} } | public class class_name {
void close() {
final String methodName = "close";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName); // depends on control dependency: [if], data = [none]
}
/*
* Cancel any ongoing dispatch
*/
_cancelled = true;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
ClusterHeartbeat createCluster(String clusterName)
{
ClusterHeartbeat cluster = _clusterMap.get(clusterName);
if (cluster == null) {
cluster = new ClusterHeartbeat(clusterName, this);
_clusterMap.putIfAbsent(clusterName, cluster);
cluster = _clusterMap.get(clusterName);
}
return cluster;
} } | public class class_name {
ClusterHeartbeat createCluster(String clusterName)
{
ClusterHeartbeat cluster = _clusterMap.get(clusterName);
if (cluster == null) {
cluster = new ClusterHeartbeat(clusterName, this); // depends on control dependency: [if], data = [(cluster]
_clusterMap.putIfAbsent(clusterName, cluster); // depends on control dependency: [if], data = [(cluster]
cluster = _clusterMap.get(clusterName); // depends on control dependency: [if], data = [(cluster]
}
return cluster;
} } |
public class class_name {
public java.util.List<String> getActivityIds() {
if (activityIds == null) {
activityIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return activityIds;
} } | public class class_name {
public java.util.List<String> getActivityIds() {
if (activityIds == null) {
activityIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return activityIds;
} } |
public class class_name {
public void marshall(GetCommitRequest getCommitRequest, ProtocolMarshaller protocolMarshaller) {
if (getCommitRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getCommitRequest.getRepositoryName(), REPOSITORYNAME_BINDING);
protocolMarshaller.marshall(getCommitRequest.getCommitId(), COMMITID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetCommitRequest getCommitRequest, ProtocolMarshaller protocolMarshaller) {
if (getCommitRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getCommitRequest.getRepositoryName(), REPOSITORYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getCommitRequest.getCommitId(), COMMITID_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 restore(ObjectInputStream ois, int dataVersion)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc, "restore", new Object[] { ois, Integer.valueOf(dataVersion) });
checkPersistentVersionId(dataVersion);
try
{
HashMap hm = (HashMap)ois.readObject();
restorePersistentDestinationData(hm);
restorePersistentLinkData(hm);
// Restore mqLinkUuid
_mqLinkUuid = new SIBUuid8((byte[])hm.get("mqlinkuuid"));
// Restore the mqLinkName
_mqLinkName = (String)hm.get("mqlinkname");
// Restore the MessageStore id of the MQLinkStateItemStream
_mqLinkStateItemStreamId = ((Long)hm.get("mqlinkstateid")).longValue();
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.restore",
"1:536:1.71",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.MQLinkHandler",
"1:543:1.71",
e });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restore", "SIErrorException");
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.MQLinkHandler",
"1:553:1.71",
e },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restore");
} } | public class class_name {
public void restore(ObjectInputStream ois, int dataVersion)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc, "restore", new Object[] { ois, Integer.valueOf(dataVersion) });
checkPersistentVersionId(dataVersion);
try
{
HashMap hm = (HashMap)ois.readObject();
restorePersistentDestinationData(hm); // depends on control dependency: [try], data = [none]
restorePersistentLinkData(hm); // depends on control dependency: [try], data = [none]
// Restore mqLinkUuid
_mqLinkUuid = new SIBUuid8((byte[])hm.get("mqlinkuuid")); // depends on control dependency: [try], data = [none]
// Restore the mqLinkName
_mqLinkName = (String)hm.get("mqlinkname"); // depends on control dependency: [try], data = [none]
// Restore the MessageStore id of the MQLinkStateItemStream
_mqLinkStateItemStreamId = ((Long)hm.get("mqlinkstateid")).longValue(); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.restore",
"1:536:1.71",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.MQLinkHandler",
"1:543:1.71",
e });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restore", "SIErrorException");
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.MQLinkHandler",
"1:553:1.71",
e },
null),
e);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restore");
} } |
public class class_name {
void free(ClientSocket stream)
{
success();
_activeCount.decrementAndGet();
synchronized (this) {
int size = (_idleHead - _idleTail + _idle.length) % _idle.length;
if (_state != State.CLOSED && size < _idleSize) {
_idleHead = (_idleHead + 1) % _idle.length;
_idle[_idleHead] = stream;
stream = null;
}
long now = CurrentTime.currentTime();
long prevSuccessTime = _prevSuccessTime;
if (prevSuccessTime > 0) {
_latencyFactor = (0.95 * _latencyFactor
+ 0.05 * (now - prevSuccessTime));
}
if (_activeCount.get() > 0)
_prevSuccessTime = now;
else
_prevSuccessTime = 0;
_lastSuccessTime = now;
if (log.isLoggable(Level.FINEST)) {
logFinest(L.l("free: _lastSuccessTime={0}, _failTime={1}",
now, _failTime));
}
}
updateWarmup();
long now = CurrentTime.currentTime();
long maxIdleTime = _loadBalanceIdleTime;
ClientSocket oldStream = null;
do {
oldStream = null;
synchronized (this) {
if (_idleHead != _idleTail) {
int nextTail = (_idleTail + 1) % _idle.length;
oldStream = _idle[nextTail];
if (oldStream != null
&& oldStream.getIdleStartTime() + maxIdleTime < now) {
_idle[nextTail] = null;
_idleTail = nextTail;
}
else
oldStream = null;
}
}
if (oldStream != null)
oldStream.closeImpl();
} while (oldStream != null);
if (stream != null) {
stream.closeImpl();
}
} } | public class class_name {
void free(ClientSocket stream)
{
success();
_activeCount.decrementAndGet();
synchronized (this) {
int size = (_idleHead - _idleTail + _idle.length) % _idle.length;
if (_state != State.CLOSED && size < _idleSize) {
_idleHead = (_idleHead + 1) % _idle.length; // depends on control dependency: [if], data = [none]
_idle[_idleHead] = stream; // depends on control dependency: [if], data = [none]
stream = null; // depends on control dependency: [if], data = [none]
}
long now = CurrentTime.currentTime();
long prevSuccessTime = _prevSuccessTime;
if (prevSuccessTime > 0) {
_latencyFactor = (0.95 * _latencyFactor
+ 0.05 * (now - prevSuccessTime)); // depends on control dependency: [if], data = [none]
}
if (_activeCount.get() > 0)
_prevSuccessTime = now;
else
_prevSuccessTime = 0;
_lastSuccessTime = now;
if (log.isLoggable(Level.FINEST)) {
logFinest(L.l("free: _lastSuccessTime={0}, _failTime={1}",
now, _failTime)); // depends on control dependency: [if], data = [none]
}
}
updateWarmup();
long now = CurrentTime.currentTime();
long maxIdleTime = _loadBalanceIdleTime;
ClientSocket oldStream = null;
do {
oldStream = null;
synchronized (this) {
if (_idleHead != _idleTail) {
int nextTail = (_idleTail + 1) % _idle.length;
oldStream = _idle[nextTail]; // depends on control dependency: [if], data = [none]
if (oldStream != null
&& oldStream.getIdleStartTime() + maxIdleTime < now) {
_idle[nextTail] = null; // depends on control dependency: [if], data = [null]
_idleTail = nextTail; // depends on control dependency: [if], data = [none]
}
else
oldStream = null;
}
}
if (oldStream != null)
oldStream.closeImpl();
} while (oldStream != null);
if (stream != null) {
stream.closeImpl(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static base_responses enable(nitro_service client, String trapname[]) throws Exception {
base_responses result = null;
if (trapname != null && trapname.length > 0) {
snmpalarm enableresources[] = new snmpalarm[trapname.length];
for (int i=0;i<trapname.length;i++){
enableresources[i] = new snmpalarm();
enableresources[i].trapname = trapname[i];
}
result = perform_operation_bulk_request(client, enableresources,"enable");
}
return result;
} } | public class class_name {
public static base_responses enable(nitro_service client, String trapname[]) throws Exception {
base_responses result = null;
if (trapname != null && trapname.length > 0) {
snmpalarm enableresources[] = new snmpalarm[trapname.length];
for (int i=0;i<trapname.length;i++){
enableresources[i] = new snmpalarm(); // depends on control dependency: [for], data = [i]
enableresources[i].trapname = trapname[i]; // depends on control dependency: [for], data = [i]
}
result = perform_operation_bulk_request(client, enableresources,"enable");
}
return result;
} } |
public class class_name {
public GetCostForecastResult withForecastResultsByTime(ForecastResult... forecastResultsByTime) {
if (this.forecastResultsByTime == null) {
setForecastResultsByTime(new java.util.ArrayList<ForecastResult>(forecastResultsByTime.length));
}
for (ForecastResult ele : forecastResultsByTime) {
this.forecastResultsByTime.add(ele);
}
return this;
} } | public class class_name {
public GetCostForecastResult withForecastResultsByTime(ForecastResult... forecastResultsByTime) {
if (this.forecastResultsByTime == null) {
setForecastResultsByTime(new java.util.ArrayList<ForecastResult>(forecastResultsByTime.length)); // depends on control dependency: [if], data = [none]
}
for (ForecastResult ele : forecastResultsByTime) {
this.forecastResultsByTime.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public final String render() {
RythmEngine engine = __engine();
boolean engineSet = RythmEngine.set(engine);
try {
long l = 0l;
boolean logTime = __logTime();
if (logTime) {
l = System.currentTimeMillis();
}
__triggerRenderEvent(RythmEvents.ON_RENDER, engine);
__setup();
if (logTime) {
__logger.debug("< preprocess [%s]: %sms", getClass().getName(), System.currentTimeMillis() - l);
l = System.currentTimeMillis();
}
try {
String s = __internalRender();
return s;
} finally {
__triggerRenderEvent(RythmEvents.RENDERED, engine);
if (logTime) {
__logger.debug("<<<<<<<<<<<< [%s] total render: %sms", getClass().getName(), System.currentTimeMillis() - l);
}
}
} catch (ClassReloadException e) {
engine.restart(e);
return render();
} finally {
if (engineSet) {
RythmEngine.clear();
}
}
} } | public class class_name {
@Override
public final String render() {
RythmEngine engine = __engine();
boolean engineSet = RythmEngine.set(engine);
try {
long l = 0l;
boolean logTime = __logTime();
if (logTime) {
l = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
}
__triggerRenderEvent(RythmEvents.ON_RENDER, engine); // depends on control dependency: [try], data = [none]
__setup(); // depends on control dependency: [try], data = [none]
if (logTime) {
__logger.debug("< preprocess [%s]: %sms", getClass().getName(), System.currentTimeMillis() - l); // depends on control dependency: [if], data = [none]
l = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
}
try {
String s = __internalRender();
return s; // depends on control dependency: [try], data = [none]
} finally {
__triggerRenderEvent(RythmEvents.RENDERED, engine);
if (logTime) {
__logger.debug("<<<<<<<<<<<< [%s] total render: %sms", getClass().getName(), System.currentTimeMillis() - l); // depends on control dependency: [if], data = [none]
}
}
} catch (ClassReloadException e) {
engine.restart(e);
return render();
} finally { // depends on control dependency: [catch], data = [none]
if (engineSet) {
RythmEngine.clear(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected static boolean unsecureSaveAuthentication(URL url, String postBody)
throws IOException {
HttpURLConnection connection = null;
boolean result = false;
try {
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
OutputStreamWriter wr = null;
try {
// CAUSE: Reliance on default encoding
wr = new OutputStreamWriter(connection.getOutputStream(),
"UTF-8");
wr.write(postBody);
wr.flush();
// CAUSE: Method may fail to close stream on exception
} finally {
if (wr != null) {
wr.close();
}
}
BufferedReader rd = null;
try {
// CAUSE: Reliance on default encoding
rd = new BufferedReader(new InputStreamReader(
connection.getInputStream(), "UTF-8"));
// CAUSE: Method may fail to close stream on exception
} finally {
if (rd != null) {
rd.close();
}
}
result = connection.getResponseCode() == 201;
// CAUSE: Method may fail to close connection on exception
} finally {
if (connection != null) {
connection.disconnect();
}
}
return result;
} } | public class class_name {
protected static boolean unsecureSaveAuthentication(URL url, String postBody)
throws IOException {
HttpURLConnection connection = null;
boolean result = false;
try {
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
OutputStreamWriter wr = null;
try {
// CAUSE: Reliance on default encoding
wr = new OutputStreamWriter(connection.getOutputStream(),
"UTF-8"); // depends on control dependency: [try], data = [none]
wr.write(postBody); // depends on control dependency: [try], data = [none]
wr.flush(); // depends on control dependency: [try], data = [none]
// CAUSE: Method may fail to close stream on exception
} finally {
if (wr != null) {
wr.close(); // depends on control dependency: [if], data = [none]
}
}
BufferedReader rd = null;
try {
// CAUSE: Reliance on default encoding
rd = new BufferedReader(new InputStreamReader(
connection.getInputStream(), "UTF-8")); // depends on control dependency: [try], data = [none]
// CAUSE: Method may fail to close stream on exception
} finally {
if (rd != null) {
rd.close(); // depends on control dependency: [if], data = [none]
}
}
result = connection.getResponseCode() == 201;
// CAUSE: Method may fail to close connection on exception
} finally {
if (connection != null) {
connection.disconnect(); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public void load(File file) {
try {
PropertiesConfiguration config = new PropertiesConfiguration();
// disabled to prevent accumulo classpath value from being shortened
config.setDelimiterParsingDisabled(true);
config.load(file);
((CompositeConfiguration) internalConfig).addConfiguration(config);
} catch (ConfigurationException e) {
throw new IllegalArgumentException(e);
}
} } | public class class_name {
public void load(File file) {
try {
PropertiesConfiguration config = new PropertiesConfiguration();
// disabled to prevent accumulo classpath value from being shortened
config.setDelimiterParsingDisabled(true); // depends on control dependency: [try], data = [none]
config.load(file); // depends on control dependency: [try], data = [none]
((CompositeConfiguration) internalConfig).addConfiguration(config); // depends on control dependency: [try], data = [none]
} catch (ConfigurationException e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public SelectorDomain getSelectorDomain()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getSelectorDomain");
SibTr.exit(tc, "getSelectorDomain", domain);
}
return domain;
} } | public class class_name {
public SelectorDomain getSelectorDomain()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getSelectorDomain"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "getSelectorDomain", domain); // depends on control dependency: [if], data = [none]
}
return domain;
} } |
public class class_name {
protected synchronized int[] getMaxMapAndReduceLoad(int localMaxMapLoad,
int localMaxReduceLoad) {
// Approximate because of concurrency
final int numTaskTrackers =
taskTrackerManager.getClusterStatus().getTaskTrackers();
/* Hold the result */
int maxMapLoad = 0;
int maxReduceLoad = 0;
int neededMaps = 0;
int neededReduces = 0;
Collection<JobInProgress> jobQueue =
jobQueueJobInProgressListener.getJobQueue();
synchronized (jobQueue) {
for (JobInProgress job : jobQueue) {
if (job.getStatus().getRunState() == JobStatus.RUNNING) {
neededMaps += job.desiredMaps() - job.finishedMaps();
neededReduces += job.desiredReduces() - job.finishedReduces();
}
}
}
if (numTaskTrackers > 0) {
maxMapLoad = Math.min(localMaxMapLoad, (int) Math
.ceil((double) neededMaps / numTaskTrackers));
maxReduceLoad = Math.min(localMaxReduceLoad, (int) Math
.ceil((double) neededReduces / numTaskTrackers));
}
return new int[] { maxMapLoad, maxReduceLoad };
} } | public class class_name {
protected synchronized int[] getMaxMapAndReduceLoad(int localMaxMapLoad,
int localMaxReduceLoad) {
// Approximate because of concurrency
final int numTaskTrackers =
taskTrackerManager.getClusterStatus().getTaskTrackers();
/* Hold the result */
int maxMapLoad = 0;
int maxReduceLoad = 0;
int neededMaps = 0;
int neededReduces = 0;
Collection<JobInProgress> jobQueue =
jobQueueJobInProgressListener.getJobQueue();
synchronized (jobQueue) {
for (JobInProgress job : jobQueue) {
if (job.getStatus().getRunState() == JobStatus.RUNNING) {
neededMaps += job.desiredMaps() - job.finishedMaps(); // depends on control dependency: [if], data = [none]
neededReduces += job.desiredReduces() - job.finishedReduces(); // depends on control dependency: [if], data = [none]
}
}
}
if (numTaskTrackers > 0) {
maxMapLoad = Math.min(localMaxMapLoad, (int) Math
.ceil((double) neededMaps / numTaskTrackers)); // depends on control dependency: [if], data = [none]
maxReduceLoad = Math.min(localMaxReduceLoad, (int) Math
.ceil((double) neededReduces / numTaskTrackers)); // depends on control dependency: [if], data = [none]
}
return new int[] { maxMapLoad, maxReduceLoad };
} } |
public class class_name {
public static String extractTaskID(String path, String identifier) {
LOG.debug("extract task id for {}", path);
if (path.contains(HADOOP_ATTEMPT)) {
String prf = path.substring(path.indexOf(HADOOP_ATTEMPT));
if (prf.contains("/")) {
return TaskAttemptID.forName(prf.substring(0, prf.indexOf("/"))).toString();
}
return TaskAttemptID.forName(prf).toString();
} else if (identifier != null && path.contains(identifier)) {
int ind = path.indexOf(identifier);
String prf = path.substring(ind + identifier.length());
int boundary = prf.length();
if (prf.indexOf("/") > 0) {
boundary = prf.indexOf("/");
}
String taskID = prf.substring(0, boundary);
LOG.debug("extracted task id {} for {}", taskID, path);
return taskID;
}
return null;
} } | public class class_name {
public static String extractTaskID(String path, String identifier) {
LOG.debug("extract task id for {}", path);
if (path.contains(HADOOP_ATTEMPT)) {
String prf = path.substring(path.indexOf(HADOOP_ATTEMPT));
if (prf.contains("/")) {
return TaskAttemptID.forName(prf.substring(0, prf.indexOf("/"))).toString(); // depends on control dependency: [if], data = [none]
}
return TaskAttemptID.forName(prf).toString(); // depends on control dependency: [if], data = [none]
} else if (identifier != null && path.contains(identifier)) {
int ind = path.indexOf(identifier);
String prf = path.substring(ind + identifier.length());
int boundary = prf.length();
if (prf.indexOf("/") > 0) {
boundary = prf.indexOf("/"); // depends on control dependency: [if], data = [none]
}
String taskID = prf.substring(0, boundary);
LOG.debug("extracted task id {} for {}", taskID, path); // depends on control dependency: [if], data = [none]
return taskID; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final String model) {
final char[] chars = model.toCharArray();
for (final char c : chars) {
if (Character.isWhitespace(c)) {
problems.add(ValidationBundle.getMessage(MayNotContainSpacesValidator.class, "MAY_NOT_CONTAIN_WHITESPACE", compName)); // NOI18N
return false;
}
}
return true;
} } | public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final String model) {
final char[] chars = model.toCharArray();
for (final char c : chars) {
if (Character.isWhitespace(c)) {
problems.add(ValidationBundle.getMessage(MayNotContainSpacesValidator.class, "MAY_NOT_CONTAIN_WHITESPACE", compName)); // NOI18N // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
private static void applyStyle(TextView v, AttributeSet attrs, int defStyleAttr, int defStyleRes){
String fontFamily = null;
int typefaceIndex = -1;
int styleIndex = -1;
int shadowColor = 0;
float dx = 0, dy = 0, r = 0;
Drawable drawableLeft = null, drawableTop = null, drawableRight = null,
drawableBottom = null, drawableStart = null, drawableEnd = null;
boolean drawableDefined = false;
boolean drawableRelativeDefined = false;
/*
* Look the appearance up without checking first if it exists because
* almost every TextView has one and it greatly simplifies the logic
* to be able to parse the appearance first and then let specific tags
* for this View override it.
*/
TypedArray a = v.getContext().obtainStyledAttributes(attrs, R.styleable.TextViewAppearance, defStyleAttr, defStyleRes);
TypedArray appearance = null;
int ap = a.getResourceId(R.styleable.TextViewAppearance_android_textAppearance, 0);
a.recycle();
if (ap != 0)
appearance = v.getContext().obtainStyledAttributes(ap, R.styleable.TextAppearance);
if (appearance != null) {
int n = appearance.getIndexCount();
for (int i = 0; i < n; i++) {
int attr = appearance.getIndex(i);
if (attr == R.styleable.TextAppearance_android_textColorHighlight) {
v.setHighlightColor(appearance.getColor(attr, 0));
} else if (attr == R.styleable.TextAppearance_android_textColor) {
v.setTextColor(appearance.getColorStateList(attr));
} else if (attr == R.styleable.TextAppearance_android_textColorHint) {
v.setHintTextColor(appearance.getColorStateList(attr));
} else if (attr == R.styleable.TextAppearance_android_textColorLink) {
v.setLinkTextColor(appearance.getColorStateList(attr));
} else if (attr == R.styleable.TextAppearance_android_textSize) {
v.setTextSize(TypedValue.COMPLEX_UNIT_PX, appearance.getDimensionPixelSize(attr, 0));
} else if (attr == R.styleable.TextAppearance_android_typeface) {
typefaceIndex = appearance.getInt(attr, -1);
} else if (attr == R.styleable.TextAppearance_android_fontFamily) {
fontFamily = appearance.getString(attr);
} else if (attr == R.styleable.TextAppearance_tv_fontFamily) {
fontFamily = appearance.getString(attr);
} else if (attr == R.styleable.TextAppearance_android_textStyle) {
styleIndex = appearance.getInt(attr, -1);
} else if (attr == R.styleable.TextAppearance_android_textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
v.setAllCaps(appearance.getBoolean(attr, false));
} else if (attr == R.styleable.TextAppearance_android_shadowColor) {
shadowColor = appearance.getInt(attr, 0);
} else if (attr == R.styleable.TextAppearance_android_shadowDx) {
dx = appearance.getFloat(attr, 0);
} else if (attr == R.styleable.TextAppearance_android_shadowDy) {
dy = appearance.getFloat(attr, 0);
} else if (attr == R.styleable.TextAppearance_android_shadowRadius) {
r = appearance.getFloat(attr, 0);
} else if (attr == R.styleable.TextAppearance_android_elegantTextHeight) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setElegantTextHeight(appearance.getBoolean(attr, false));
} else if (attr == R.styleable.TextAppearance_android_letterSpacing) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setLetterSpacing(appearance.getFloat(attr, 0));
} else if (attr == R.styleable.TextAppearance_android_fontFeatureSettings) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setFontFeatureSettings(appearance.getString(attr));
}
}
appearance.recycle();
}
a = v.getContext().obtainStyledAttributes(attrs, R.styleable.TextView, defStyleAttr, defStyleRes);
int n = a.getIndexCount();
for (int i = 0; i < n; i++) {
int attr = a.getIndex(i);
if (attr == R.styleable.TextView_android_drawableLeft) {
drawableLeft = a.getDrawable(attr);
drawableDefined = true;
} else if (attr == R.styleable.TextView_android_drawableTop) {
drawableTop = a.getDrawable(attr);
drawableDefined = true;
} else if (attr == R.styleable.TextView_android_drawableRight) {
drawableRight = a.getDrawable(attr);
drawableDefined = true;
} else if (attr == R.styleable.TextView_android_drawableBottom) {
drawableBottom = a.getDrawable(attr);
drawableDefined = true;
} else if (attr == R.styleable.TextView_android_drawableStart) {
drawableStart = a.getDrawable(attr);
drawableRelativeDefined = true;
} else if (attr == R.styleable.TextView_android_drawableEnd) {
drawableEnd = a.getDrawable(attr);
drawableRelativeDefined = true;
} else if (attr == R.styleable.TextView_android_drawablePadding) {
v.setCompoundDrawablePadding(a.getDimensionPixelSize(attr, 0));
} else if (attr == R.styleable.TextView_android_maxLines) {
v.setMaxLines(a.getInt(attr, -1));
} else if (attr == R.styleable.TextView_android_maxHeight) {
v.setMaxHeight(a.getDimensionPixelSize(attr, -1));
} else if (attr == R.styleable.TextView_android_lines) {
v.setLines(a.getInt(attr, -1));
} else if (attr == R.styleable.TextView_android_height) {
v.setHeight(a.getDimensionPixelSize(attr, -1));
} else if (attr == R.styleable.TextView_android_minLines) {
v.setMinLines(a.getInt(attr, -1));
} else if (attr == R.styleable.TextView_android_minHeight) {
v.setMinHeight(a.getDimensionPixelSize(attr, -1));
} else if (attr == R.styleable.TextView_android_maxEms) {
v.setMaxEms(a.getInt(attr, -1));
} else if (attr == R.styleable.TextView_android_maxWidth) {
v.setMaxWidth(a.getDimensionPixelSize(attr, -1));
} else if (attr == R.styleable.TextView_android_ems) {
v.setEms(a.getInt(attr, -1));
} else if (attr == R.styleable.TextView_android_width) {
v.setWidth(a.getDimensionPixelSize(attr, -1));
} else if (attr == R.styleable.TextView_android_minEms) {
v.setMinEms(a.getInt(attr, -1));
} else if (attr == R.styleable.TextView_android_minWidth) {
v.setMinWidth(a.getDimensionPixelSize(attr, -1));
} else if (attr == R.styleable.TextView_android_gravity) {
v.setGravity(a.getInt(attr, -1));
} else if (attr == R.styleable.TextView_android_scrollHorizontally) {
v.setHorizontallyScrolling(a.getBoolean(attr, false));
} else if (attr == R.styleable.TextView_android_includeFontPadding) {
v.setIncludeFontPadding(a.getBoolean(attr, true));
} else if (attr == R.styleable.TextView_android_cursorVisible) {
v.setCursorVisible(a.getBoolean(attr, true));
} else if (attr == R.styleable.TextView_android_textScaleX) {
v.setTextScaleX(a.getFloat(attr, 1.0f));
} else if (attr == R.styleable.TextView_android_shadowColor) {
shadowColor = a.getInt(attr, 0);
} else if (attr == R.styleable.TextView_android_shadowDx) {
dx = a.getFloat(attr, 0);
} else if (attr == R.styleable.TextView_android_shadowDy) {
dy = a.getFloat(attr, 0);
} else if (attr == R.styleable.TextView_android_shadowRadius) {
r = a.getFloat(attr, 0);
} else if (attr == R.styleable.TextView_android_textColorHighlight) {
v.setHighlightColor(a.getColor(attr, 0));
} else if (attr == R.styleable.TextView_android_textColor) {
v.setTextColor(a.getColorStateList(attr));
} else if (attr == R.styleable.TextView_android_textColorHint) {
v.setHintTextColor(a.getColorStateList(attr));
} else if (attr == R.styleable.TextView_android_textColorLink) {
v.setLinkTextColor(a.getColorStateList(attr));
} else if (attr == R.styleable.TextView_android_textSize) {
v.setTextSize(TypedValue.COMPLEX_UNIT_PX, a.getDimensionPixelSize(attr, 0));
} else if (attr == R.styleable.TextView_android_typeface) {
typefaceIndex = a.getInt(attr, -1);
} else if (attr == R.styleable.TextView_android_textStyle) {
styleIndex = a.getInt(attr, -1);
} else if (attr == R.styleable.TextView_android_fontFamily) {
fontFamily = a.getString(attr);
} else if (attr == R.styleable.TextView_tv_fontFamily) {
fontFamily = a.getString(attr);
} else if (attr == R.styleable.TextView_android_textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
v.setAllCaps(a.getBoolean(attr, false));
} else if (attr == R.styleable.TextView_android_elegantTextHeight) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setElegantTextHeight(a.getBoolean(attr, false));
} else if (attr == R.styleable.TextView_android_letterSpacing) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setLetterSpacing(a.getFloat(attr, 0));
} else if (attr == R.styleable.TextView_android_fontFeatureSettings) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setFontFeatureSettings(a.getString(attr));
}
}
a.recycle();
if (shadowColor != 0)
v.setShadowLayer(r, dx, dy, shadowColor);
if(drawableDefined) {
Drawable[] drawables = v.getCompoundDrawables();
if (drawableStart != null)
drawables[0] = drawableStart;
else if (drawableLeft != null)
drawables[0] = drawableLeft;
if (drawableTop != null)
drawables[1] = drawableTop;
if (drawableEnd != null)
drawables[2] = drawableEnd;
else if (drawableRight != null)
drawables[2] = drawableRight;
if (drawableBottom != null)
drawables[3] = drawableBottom;
v.setCompoundDrawablesWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]);
}
if(drawableRelativeDefined && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1){
Drawable[] drawables = v.getCompoundDrawablesRelative();
if (drawableStart != null)
drawables[0] = drawableStart;
if (drawableEnd != null)
drawables[2] = drawableEnd;
v.setCompoundDrawablesRelativeWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]);
}
Typeface tf = null;
if (fontFamily != null) {
tf = TypefaceUtil.load(v.getContext(), fontFamily, styleIndex);
if (tf != null)
v.setTypeface(tf);
}
if(tf != null) {
switch (typefaceIndex) {
case 1:
tf = Typeface.SANS_SERIF;
break;
case 2:
tf = Typeface.SERIF;
break;
case 3:
tf = Typeface.MONOSPACE;
break;
}
v.setTypeface(tf, styleIndex);
}
if(v instanceof AutoCompleteTextView)
applyStyle((AutoCompleteTextView)v, attrs, defStyleAttr, defStyleRes);
} } | public class class_name {
private static void applyStyle(TextView v, AttributeSet attrs, int defStyleAttr, int defStyleRes){
String fontFamily = null;
int typefaceIndex = -1;
int styleIndex = -1;
int shadowColor = 0;
float dx = 0, dy = 0, r = 0;
Drawable drawableLeft = null, drawableTop = null, drawableRight = null,
drawableBottom = null, drawableStart = null, drawableEnd = null;
boolean drawableDefined = false;
boolean drawableRelativeDefined = false;
/*
* Look the appearance up without checking first if it exists because
* almost every TextView has one and it greatly simplifies the logic
* to be able to parse the appearance first and then let specific tags
* for this View override it.
*/
TypedArray a = v.getContext().obtainStyledAttributes(attrs, R.styleable.TextViewAppearance, defStyleAttr, defStyleRes);
TypedArray appearance = null;
int ap = a.getResourceId(R.styleable.TextViewAppearance_android_textAppearance, 0);
a.recycle();
if (ap != 0)
appearance = v.getContext().obtainStyledAttributes(ap, R.styleable.TextAppearance);
if (appearance != null) {
int n = appearance.getIndexCount();
for (int i = 0; i < n; i++) {
int attr = appearance.getIndex(i);
if (attr == R.styleable.TextAppearance_android_textColorHighlight) {
v.setHighlightColor(appearance.getColor(attr, 0)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_textColor) {
v.setTextColor(appearance.getColorStateList(attr)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_textColorHint) {
v.setHintTextColor(appearance.getColorStateList(attr)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_textColorLink) {
v.setLinkTextColor(appearance.getColorStateList(attr)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_textSize) {
v.setTextSize(TypedValue.COMPLEX_UNIT_PX, appearance.getDimensionPixelSize(attr, 0)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_typeface) {
typefaceIndex = appearance.getInt(attr, -1); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_fontFamily) {
fontFamily = appearance.getString(attr); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_tv_fontFamily) {
fontFamily = appearance.getString(attr); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_textStyle) {
styleIndex = appearance.getInt(attr, -1); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
v.setAllCaps(appearance.getBoolean(attr, false));
} else if (attr == R.styleable.TextAppearance_android_shadowColor) {
shadowColor = appearance.getInt(attr, 0); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_shadowDx) {
dx = appearance.getFloat(attr, 0); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_shadowDy) {
dy = appearance.getFloat(attr, 0); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_shadowRadius) {
r = appearance.getFloat(attr, 0); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextAppearance_android_elegantTextHeight) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setElegantTextHeight(appearance.getBoolean(attr, false));
} else if (attr == R.styleable.TextAppearance_android_letterSpacing) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setLetterSpacing(appearance.getFloat(attr, 0));
} else if (attr == R.styleable.TextAppearance_android_fontFeatureSettings) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setFontFeatureSettings(appearance.getString(attr));
}
}
appearance.recycle(); // depends on control dependency: [if], data = [none]
}
a = v.getContext().obtainStyledAttributes(attrs, R.styleable.TextView, defStyleAttr, defStyleRes);
int n = a.getIndexCount();
for (int i = 0; i < n; i++) {
int attr = a.getIndex(i);
if (attr == R.styleable.TextView_android_drawableLeft) {
drawableLeft = a.getDrawable(attr); // depends on control dependency: [if], data = [(attr]
drawableDefined = true; // depends on control dependency: [if], data = [none]
} else if (attr == R.styleable.TextView_android_drawableTop) {
drawableTop = a.getDrawable(attr); // depends on control dependency: [if], data = [(attr]
drawableDefined = true; // depends on control dependency: [if], data = [none]
} else if (attr == R.styleable.TextView_android_drawableRight) {
drawableRight = a.getDrawable(attr); // depends on control dependency: [if], data = [(attr]
drawableDefined = true; // depends on control dependency: [if], data = [none]
} else if (attr == R.styleable.TextView_android_drawableBottom) {
drawableBottom = a.getDrawable(attr); // depends on control dependency: [if], data = [(attr]
drawableDefined = true; // depends on control dependency: [if], data = [none]
} else if (attr == R.styleable.TextView_android_drawableStart) {
drawableStart = a.getDrawable(attr); // depends on control dependency: [if], data = [(attr]
drawableRelativeDefined = true; // depends on control dependency: [if], data = [none]
} else if (attr == R.styleable.TextView_android_drawableEnd) {
drawableEnd = a.getDrawable(attr); // depends on control dependency: [if], data = [(attr]
drawableRelativeDefined = true; // depends on control dependency: [if], data = [none]
} else if (attr == R.styleable.TextView_android_drawablePadding) {
v.setCompoundDrawablePadding(a.getDimensionPixelSize(attr, 0)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_maxLines) {
v.setMaxLines(a.getInt(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_maxHeight) {
v.setMaxHeight(a.getDimensionPixelSize(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_lines) {
v.setLines(a.getInt(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_height) {
v.setHeight(a.getDimensionPixelSize(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_minLines) {
v.setMinLines(a.getInt(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_minHeight) {
v.setMinHeight(a.getDimensionPixelSize(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_maxEms) {
v.setMaxEms(a.getInt(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_maxWidth) {
v.setMaxWidth(a.getDimensionPixelSize(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_ems) {
v.setEms(a.getInt(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_width) {
v.setWidth(a.getDimensionPixelSize(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_minEms) {
v.setMinEms(a.getInt(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_minWidth) {
v.setMinWidth(a.getDimensionPixelSize(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_gravity) {
v.setGravity(a.getInt(attr, -1)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_scrollHorizontally) {
v.setHorizontallyScrolling(a.getBoolean(attr, false)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_includeFontPadding) {
v.setIncludeFontPadding(a.getBoolean(attr, true)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_cursorVisible) {
v.setCursorVisible(a.getBoolean(attr, true)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_textScaleX) {
v.setTextScaleX(a.getFloat(attr, 1.0f)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_shadowColor) {
shadowColor = a.getInt(attr, 0); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_shadowDx) {
dx = a.getFloat(attr, 0); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_shadowDy) {
dy = a.getFloat(attr, 0); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_shadowRadius) {
r = a.getFloat(attr, 0); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_textColorHighlight) {
v.setHighlightColor(a.getColor(attr, 0)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_textColor) {
v.setTextColor(a.getColorStateList(attr)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_textColorHint) {
v.setHintTextColor(a.getColorStateList(attr)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_textColorLink) {
v.setLinkTextColor(a.getColorStateList(attr)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_textSize) {
v.setTextSize(TypedValue.COMPLEX_UNIT_PX, a.getDimensionPixelSize(attr, 0)); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_typeface) {
typefaceIndex = a.getInt(attr, -1); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_textStyle) {
styleIndex = a.getInt(attr, -1); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_fontFamily) {
fontFamily = a.getString(attr); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_tv_fontFamily) {
fontFamily = a.getString(attr); // depends on control dependency: [if], data = [(attr]
} else if (attr == R.styleable.TextView_android_textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
v.setAllCaps(a.getBoolean(attr, false));
} else if (attr == R.styleable.TextView_android_elegantTextHeight) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setElegantTextHeight(a.getBoolean(attr, false));
} else if (attr == R.styleable.TextView_android_letterSpacing) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setLetterSpacing(a.getFloat(attr, 0));
} else if (attr == R.styleable.TextView_android_fontFeatureSettings) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
v.setFontFeatureSettings(a.getString(attr));
}
}
a.recycle();
if (shadowColor != 0)
v.setShadowLayer(r, dx, dy, shadowColor);
if(drawableDefined) {
Drawable[] drawables = v.getCompoundDrawables();
if (drawableStart != null)
drawables[0] = drawableStart;
else if (drawableLeft != null)
drawables[0] = drawableLeft;
if (drawableTop != null)
drawables[1] = drawableTop;
if (drawableEnd != null)
drawables[2] = drawableEnd;
else if (drawableRight != null)
drawables[2] = drawableRight;
if (drawableBottom != null)
drawables[3] = drawableBottom;
v.setCompoundDrawablesWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]); // depends on control dependency: [if], data = [none]
}
if(drawableRelativeDefined && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1){
Drawable[] drawables = v.getCompoundDrawablesRelative();
if (drawableStart != null)
drawables[0] = drawableStart;
if (drawableEnd != null)
drawables[2] = drawableEnd;
v.setCompoundDrawablesRelativeWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]); // depends on control dependency: [if], data = [none]
}
Typeface tf = null;
if (fontFamily != null) {
tf = TypefaceUtil.load(v.getContext(), fontFamily, styleIndex); // depends on control dependency: [if], data = [none]
if (tf != null)
v.setTypeface(tf);
}
if(tf != null) {
switch (typefaceIndex) {
case 1:
tf = Typeface.SANS_SERIF;
break;
case 2:
tf = Typeface.SERIF;
break;
case 3:
tf = Typeface.MONOSPACE;
break;
}
v.setTypeface(tf, styleIndex); // depends on control dependency: [if], data = [(tf]
}
if(v instanceof AutoCompleteTextView)
applyStyle((AutoCompleteTextView)v, attrs, defStyleAttr, defStyleRes);
} } |
public class class_name {
@Override
public void initialize(IAggregator aggregator, IAggregatorExtension extension,
IExtensionRegistrar registrar) {
final String sourceMethod = "initialize"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(BundleVersionsHash.class.getName(), sourceMethod, new Object[]{aggregator, extension, registrar});
}
// get the name of the function from the extension attributes
propName = extension.getInitParams().getValue("propName"); //$NON-NLS-1$
if (propName == null) {
propName = DEFAULT_PROPNAME;
}
if (isTraceLogging) {
log.finer("propName = " + propName); //$NON-NLS-1$
}
if (aggregator instanceof AggregatorImpl) { // can be an IAggregator mock when unit testing
setContributingBundle(((AggregatorImpl)aggregator).getContributingBundle());
}
if (isTraceLogging) {
log.exiting(BundleVersionsHash.class.getName(), sourceMethod);
}
} } | public class class_name {
@Override
public void initialize(IAggregator aggregator, IAggregatorExtension extension,
IExtensionRegistrar registrar) {
final String sourceMethod = "initialize"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(BundleVersionsHash.class.getName(), sourceMethod, new Object[]{aggregator, extension, registrar});
// depends on control dependency: [if], data = [none]
}
// get the name of the function from the extension attributes
propName = extension.getInitParams().getValue("propName"); //$NON-NLS-1$
if (propName == null) {
propName = DEFAULT_PROPNAME;
// depends on control dependency: [if], data = [none]
}
if (isTraceLogging) {
log.finer("propName = " + propName); //$NON-NLS-1$
// depends on control dependency: [if], data = [none]
}
if (aggregator instanceof AggregatorImpl) { // can be an IAggregator mock when unit testing
setContributingBundle(((AggregatorImpl)aggregator).getContributingBundle());
// depends on control dependency: [if], data = [none]
}
if (isTraceLogging) {
log.exiting(BundleVersionsHash.class.getName(), sourceMethod);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean visitTree(VisitContext context, VisitCallback callback)
{
// push the Component to EL
pushComponentToEL(context.getFacesContext(), this);
try
{
if (!isVisitable(context))
{
return false;
}
boolean isCachedFacesContext = isCachedFacesContext();
if (!isCachedFacesContext)
{
setCachedFacesContext(context.getFacesContext());
}
// save the current row index
int oldRowIndex = getRowIndex();
// set row index to -1 to process the facets and to get the rowless clientId
setRowIndex(-1);
try
{
VisitResult visitResult = context.invokeVisitCallback(this,
callback);
switch (visitResult)
{
//we are done nothing has to be processed anymore
case COMPLETE:
return true;
case REJECT:
return false;
//accept
default:
// determine if we need to visit our children
Collection<String> subtreeIdsToVisit = context
.getSubtreeIdsToVisit(this);
boolean doVisitChildren = subtreeIdsToVisit != null
&& !subtreeIdsToVisit.isEmpty();
if (doVisitChildren)
{
// visit the facets of the component
if (getFacetCount() > 0)
{
for (UIComponent facet : getFacets().values())
{
if (facet.visitTree(context, callback))
{
return true;
}
}
}
boolean skipIterationHint = context.getHints().contains(VisitHint.SKIP_ITERATION);
if (skipIterationHint)
{
// If SKIP_ITERATION is enabled, do not take into account rows.
for (int i = 0, childCount = getChildCount(); i < childCount; i++ )
{
UIComponent child = getChildren().get(i);
if (child.visitTree(context, callback))
{
return true;
}
}
}
else
{
// visit every column directly without visiting its children
// (the children of every UIColumn will be visited later for
// every row) and also visit the column's facets
for (int i = 0, childCount = getChildCount(); i < childCount; i++)
{
UIComponent child = getChildren().get(i);
if (child instanceof UIColumn)
{
VisitResult columnResult = context.invokeVisitCallback(child, callback);
if (columnResult == VisitResult.COMPLETE)
{
return true;
}
if (child.getFacetCount() > 0)
{
for (UIComponent facet : child.getFacets().values())
{
if (facet.visitTree(context, callback))
{
return true;
}
}
}
}
}
// iterate over the rows
int rowsToProcess = getRows();
// if getRows() returns 0, all rows have to be processed
if (rowsToProcess == 0)
{
rowsToProcess = getRowCount();
}
int rowIndex = getFirst();
for (int rowsProcessed = 0; rowsProcessed < rowsToProcess; rowsProcessed++, rowIndex++)
{
setRowIndex(rowIndex);
if (!isRowAvailable())
{
return false;
}
// visit the children of every child of the UIData that is an instance of UIColumn
for (int i = 0, childCount = getChildCount(); i < childCount; i++)
{
UIComponent child = getChildren().get(i);
if (child instanceof UIColumn)
{
for (int j = 0, grandChildCount = child.getChildCount();
j < grandChildCount; j++)
{
UIComponent grandchild = child.getChildren().get(j);
if (grandchild.visitTree(context, callback))
{
return true;
}
}
}
}
}
}
}
}
}
finally
{
// restore the old row index
setRowIndex(oldRowIndex);
if (!isCachedFacesContext)
{
setCachedFacesContext(null);
}
}
}
finally
{
// pop the component from EL
popComponentFromEL(context.getFacesContext());
}
// Return false to allow the visiting to continue
return false;
} } | public class class_name {
@Override
public boolean visitTree(VisitContext context, VisitCallback callback)
{
// push the Component to EL
pushComponentToEL(context.getFacesContext(), this);
try
{
if (!isVisitable(context))
{
return false; // depends on control dependency: [if], data = [none]
}
boolean isCachedFacesContext = isCachedFacesContext();
if (!isCachedFacesContext)
{
setCachedFacesContext(context.getFacesContext()); // depends on control dependency: [if], data = [none]
}
// save the current row index
int oldRowIndex = getRowIndex();
// set row index to -1 to process the facets and to get the rowless clientId
setRowIndex(-1); // depends on control dependency: [try], data = [none]
try
{
VisitResult visitResult = context.invokeVisitCallback(this,
callback);
switch (visitResult)
{
//we are done nothing has to be processed anymore
case COMPLETE:
return true;
case REJECT:
return false;
//accept
default:
// determine if we need to visit our children
Collection<String> subtreeIdsToVisit = context
.getSubtreeIdsToVisit(this);
boolean doVisitChildren = subtreeIdsToVisit != null
&& !subtreeIdsToVisit.isEmpty();
if (doVisitChildren)
{
// visit the facets of the component
if (getFacetCount() > 0)
{
for (UIComponent facet : getFacets().values())
{
if (facet.visitTree(context, callback))
{
return true; // depends on control dependency: [if], data = [none]
}
}
}
boolean skipIterationHint = context.getHints().contains(VisitHint.SKIP_ITERATION);
if (skipIterationHint)
{
// If SKIP_ITERATION is enabled, do not take into account rows.
for (int i = 0, childCount = getChildCount(); i < childCount; i++ )
{
UIComponent child = getChildren().get(i);
if (child.visitTree(context, callback))
{
return true; // depends on control dependency: [if], data = [none]
}
}
}
else
{
// visit every column directly without visiting its children
// (the children of every UIColumn will be visited later for
// every row) and also visit the column's facets
for (int i = 0, childCount = getChildCount(); i < childCount; i++)
{
UIComponent child = getChildren().get(i);
if (child instanceof UIColumn)
{
VisitResult columnResult = context.invokeVisitCallback(child, callback);
if (columnResult == VisitResult.COMPLETE)
{
return true; // depends on control dependency: [if], data = [none]
}
if (child.getFacetCount() > 0)
{
for (UIComponent facet : child.getFacets().values())
{
if (facet.visitTree(context, callback))
{
return true; // depends on control dependency: [if], data = [none]
}
}
}
}
}
// iterate over the rows
int rowsToProcess = getRows();
// if getRows() returns 0, all rows have to be processed
if (rowsToProcess == 0)
{
rowsToProcess = getRowCount(); // depends on control dependency: [if], data = [none]
}
int rowIndex = getFirst();
for (int rowsProcessed = 0; rowsProcessed < rowsToProcess; rowsProcessed++, rowIndex++)
{
setRowIndex(rowIndex); // depends on control dependency: [for], data = [none]
if (!isRowAvailable())
{
return false; // depends on control dependency: [if], data = [none]
}
// visit the children of every child of the UIData that is an instance of UIColumn
for (int i = 0, childCount = getChildCount(); i < childCount; i++)
{
UIComponent child = getChildren().get(i);
if (child instanceof UIColumn)
{
for (int j = 0, grandChildCount = child.getChildCount();
j < grandChildCount; j++)
{
UIComponent grandchild = child.getChildren().get(j);
if (grandchild.visitTree(context, callback))
{
return true; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
}
}
}
finally
{
// restore the old row index
setRowIndex(oldRowIndex);
if (!isCachedFacesContext)
{
setCachedFacesContext(null); // depends on control dependency: [if], data = [none]
}
}
}
finally
{
// pop the component from EL
popComponentFromEL(context.getFacesContext());
}
// Return false to allow the visiting to continue
return false;
} } |
public class class_name {
public boolean isServerStarted() {
String thisMethodName = CLASS_NAME + ".isServerStarted()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(_serverStarted));
}
return _serverStarted;
} } | public class class_name {
public boolean isServerStarted() {
String thisMethodName = CLASS_NAME + ".isServerStarted()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(_serverStarted)); // depends on control dependency: [if], data = [none]
}
return _serverStarted;
} } |
public class class_name {
private static void removeStaleCachedMisconfiguredHosts() {
long currentTime = System.currentTimeMillis();
if (!((currentTime - timeStampLastStaleCheck) >= MAX_AGE_MISCONFIGURED_HOST_IN_MS)) {
return;
}
timeStampLastStaleCheck = currentTime;
for (MapIterator it = misconfiguredHosts.mapIterator(); it.hasNext();) {
it.next();
MisconfiguredHostCacheEntry entry = (MisconfiguredHostCacheEntry) it.getValue();
if (entry.isStale(currentTime)) {
logger.info("Removing stale cached address of misconfigured (\"unrecognized_name\") host [host="
+ entry.getHost() + ", port=" + entry.getPort()
+ "], following connections will be attempted with the hostname.");
it.remove();
}
}
} } | public class class_name {
private static void removeStaleCachedMisconfiguredHosts() {
long currentTime = System.currentTimeMillis();
if (!((currentTime - timeStampLastStaleCheck) >= MAX_AGE_MISCONFIGURED_HOST_IN_MS)) {
return;
// depends on control dependency: [if], data = [none]
}
timeStampLastStaleCheck = currentTime;
for (MapIterator it = misconfiguredHosts.mapIterator(); it.hasNext();) {
it.next();
// depends on control dependency: [for], data = [it]
MisconfiguredHostCacheEntry entry = (MisconfiguredHostCacheEntry) it.getValue();
if (entry.isStale(currentTime)) {
logger.info("Removing stale cached address of misconfigured (\"unrecognized_name\") host [host="
+ entry.getHost() + ", port=" + entry.getPort()
+ "], following connections will be attempted with the hostname.");
// depends on control dependency: [if], data = [none]
it.remove();
// depends on control dependency: [if], data = [none]
}
}
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.