code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static <T extends Appendable> T appendNumber(T result, int n,
int radix, int minDigits)
{
try {
if (radix < 2 || radix > 36) {
throw new IllegalArgumentException("Illegal radix " + radix);
}
int abs = n;
if (n < 0) {
abs = -n;
result.append("-");
}
recursiveAppendNumber(result, abs, radix, minDigits);
return result;
} catch (IOException e) {
throw new IllegalIcuArgumentException(e);
}
} }
|
public class class_name {
public static <T extends Appendable> T appendNumber(T result, int n,
int radix, int minDigits)
{
try {
if (radix < 2 || radix > 36) {
throw new IllegalArgumentException("Illegal radix " + radix);
}
int abs = n;
if (n < 0) {
abs = -n; // depends on control dependency: [if], data = [none]
result.append("-"); // depends on control dependency: [if], data = [none]
}
recursiveAppendNumber(result, abs, radix, minDigits); // depends on control dependency: [try], data = [none]
return result; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalIcuArgumentException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private String getCommandParam(String paramName, String defaultValue) throws CommandLineParsingException {
for (String param : commandParams) {
if (!param.contains("=")) {
continue;
}
String[] splitArg = splitArg(param);
String attributeName = splitArg[0];
String value = splitArg[1];
if (attributeName.equalsIgnoreCase(paramName)) {
return value;
}
}
return defaultValue;
} }
|
public class class_name {
private String getCommandParam(String paramName, String defaultValue) throws CommandLineParsingException {
for (String param : commandParams) {
if (!param.contains("=")) {
continue;
}
String[] splitArg = splitArg(param);
String attributeName = splitArg[0];
String value = splitArg[1];
if (attributeName.equalsIgnoreCase(paramName)) {
return value; // depends on control dependency: [if], data = [none]
}
}
return defaultValue;
} }
|
public class class_name {
private void registerEngines() {
ClassLoader classLoader = Orient.class.getClassLoader();
Iterator<OEngine> engines = OClassLoaderHelper.lookupProviderWithOrientClassLoader(OEngine.class, classLoader);
OEngine engine = null;
while (engines.hasNext()) {
try {
engine = engines.next();
registerEngine(engine);
} catch (IllegalArgumentException e) {
if (engine != null)
OLogManager.instance().debug(this, "Failed to replace engine " + engine.getName(), e);
}
}
} }
|
public class class_name {
private void registerEngines() {
ClassLoader classLoader = Orient.class.getClassLoader();
Iterator<OEngine> engines = OClassLoaderHelper.lookupProviderWithOrientClassLoader(OEngine.class, classLoader);
OEngine engine = null;
while (engines.hasNext()) {
try {
engine = engines.next(); // depends on control dependency: [try], data = [none]
registerEngine(engine); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
if (engine != null)
OLogManager.instance().debug(this, "Failed to replace engine " + engine.getName(), e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
private boolean isPermissionCheckingEnabled(INode[] pathNodes) {
if (this.isPermissionEnabled) {
if (permissionEnabled == null) {
return false;
}
for (INode enableDir : this.permissionEnabled) {
for (INode pathNode : pathNodes) {
if (pathNode == enableDir) {
return true;
}
}
}
return false;
}
return false;
} }
|
public class class_name {
private boolean isPermissionCheckingEnabled(INode[] pathNodes) {
if (this.isPermissionEnabled) {
if (permissionEnabled == null) {
return false; // depends on control dependency: [if], data = [none]
}
for (INode enableDir : this.permissionEnabled) {
for (INode pathNode : pathNodes) {
if (pathNode == enableDir) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
protected void write(PrintWriter writer, String indent) {
writer.print("(");
if (!isEmpty()) {
Token root = getRoot(true);
int type = root.getType();
int meaning = root.getMeaning();
//
// Display our type, text, and (optional) meaning
writer.print(Types.getDescription(type));
if (meaning != type) {
writer.print(" as ");
writer.print(Types.getDescription(meaning));
}
if (getStartLine() > -1) {
writer.print(" at " + getStartLine() + ":" + getStartColumn());
}
String text = root.getText();
int length = text.length();
if (length > 0) {
writer.print(": ");
if (length > 40) {
text = text.substring(0, 17) + "..." + text.substring(length - 17, length);
}
writer.print(" \"");
writer.print(text);
writer.print("\" ");
} else if (children() > 0) {
writer.print(": ");
}
//
// Recurse to display the children.
int count = size();
if (count > 1) {
writer.println("");
String indent1 = indent + " ";
String indent2 = indent + " ";
for (int i = 1; i < count; i++) {
writer.print(indent1);
writer.print(i);
writer.print(": ");
get(i, true).write(writer, indent2);
}
writer.print(indent);
}
}
if (indent.length() > 0) {
writer.println(")");
} else {
writer.print(")");
}
} }
|
public class class_name {
protected void write(PrintWriter writer, String indent) {
writer.print("(");
if (!isEmpty()) {
Token root = getRoot(true);
int type = root.getType();
int meaning = root.getMeaning();
//
// Display our type, text, and (optional) meaning
writer.print(Types.getDescription(type)); // depends on control dependency: [if], data = [none]
if (meaning != type) {
writer.print(" as "); // depends on control dependency: [if], data = [none]
writer.print(Types.getDescription(meaning)); // depends on control dependency: [if], data = [(meaning]
}
if (getStartLine() > -1) {
writer.print(" at " + getStartLine() + ":" + getStartColumn()); // depends on control dependency: [if], data = [none]
}
String text = root.getText();
int length = text.length();
if (length > 0) {
writer.print(": "); // depends on control dependency: [if], data = [none]
if (length > 40) {
text = text.substring(0, 17) + "..." + text.substring(length - 17, length); // depends on control dependency: [if], data = [(length]
}
writer.print(" \""); // depends on control dependency: [if], data = [none]
writer.print(text); // depends on control dependency: [if], data = [none]
writer.print("\" "); // depends on control dependency: [if], data = [none]
} else if (children() > 0) {
writer.print(": "); // depends on control dependency: [if], data = [none]
}
//
// Recurse to display the children.
int count = size();
if (count > 1) {
writer.println(""); // depends on control dependency: [if], data = [none]
String indent1 = indent + " ";
String indent2 = indent + " ";
for (int i = 1; i < count; i++) {
writer.print(indent1); // depends on control dependency: [for], data = [none]
writer.print(i); // depends on control dependency: [for], data = [i]
writer.print(": "); // depends on control dependency: [for], data = [none]
get(i, true).write(writer, indent2); // depends on control dependency: [for], data = [i]
}
writer.print(indent); // depends on control dependency: [if], data = [none]
}
}
if (indent.length() > 0) {
writer.println(")"); // depends on control dependency: [if], data = [none]
} else {
writer.print(")"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public boolean sendEvent(LrsStatement statement) {
if (!isEnabled()) {
return false;
}
ResponseEntity<Object> response =
sendRequest(
STATEMENTS_REST_ENDPOINT, HttpMethod.POST, null, statement, Object.class);
if (response.getStatusCode().series() == Series.SUCCESSFUL) {
logger.trace("LRS provider successfully sent to {}, statement: {}", LRSUrl, statement);
} else {
logger.error("LRS provider failed to send to {}, statement: {}", LRSUrl, statement);
logger.error("- Response: {}", response);
return false;
}
return true;
} }
|
public class class_name {
@Override
public boolean sendEvent(LrsStatement statement) {
if (!isEnabled()) {
return false; // depends on control dependency: [if], data = [none]
}
ResponseEntity<Object> response =
sendRequest(
STATEMENTS_REST_ENDPOINT, HttpMethod.POST, null, statement, Object.class);
if (response.getStatusCode().series() == Series.SUCCESSFUL) {
logger.trace("LRS provider successfully sent to {}, statement: {}", LRSUrl, statement); // depends on control dependency: [if], data = [none]
} else {
logger.error("LRS provider failed to send to {}, statement: {}", LRSUrl, statement); // depends on control dependency: [if], data = [none]
logger.error("- Response: {}", response); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
void addRelationshipAttributeType(String attributeName, AtlasRelationshipType relationshipType) {
List<AtlasRelationshipType> relationshipTypes = relationshipAttributesType.get(attributeName);
if (relationshipTypes == null) {
relationshipTypes = new ArrayList<>();
relationshipAttributesType.put(attributeName, relationshipTypes);
}
relationshipTypes.add(relationshipType);
} }
|
public class class_name {
void addRelationshipAttributeType(String attributeName, AtlasRelationshipType relationshipType) {
List<AtlasRelationshipType> relationshipTypes = relationshipAttributesType.get(attributeName);
if (relationshipTypes == null) {
relationshipTypes = new ArrayList<>(); // depends on control dependency: [if], data = [none]
relationshipAttributesType.put(attributeName, relationshipTypes); // depends on control dependency: [if], data = [none]
}
relationshipTypes.add(relationshipType);
} }
|
public class class_name {
private void insertOrUpdateTasks(TaskStartEvent event) {
Assignment old = event.getOldAssignment();
Assignment current = event.getNewAssignment();
Map<Integer, String> task2Component = event.getTask2Component();
List<KVSerializable> taskTrackList = new ArrayList<>();
// assign
if (old == null) {
Set<ResourceWorkerSlot> workers = current.getWorkers();
logger.info("old workers are null, assigned workers:{}", Joiner.on(",").join(workers));
for (ResourceWorkerSlot worker : workers) {
Set<Integer> tasks = worker.getTasks();
for (Integer task : tasks) {
TaskTrack track = new TaskTrack(
event.getClusterMetricsContext().getClusterName(), event.getTopologyId());
track.setStart(new Date(event.getTimestamp()));
track.setComponent(task2Component.get(task));
track.setHost(worker.getHostname());
track.setPort(worker.getPort());
track.setTaskId(task);
taskTrackList.add(track);
}
}
} else { // rebalance, we only insert newly assigned tasks
Set<ResourceWorkerSlot> oldWorkers = old.getWorkers();
Joiner joiner = Joiner.on(",");
logger.info("old workers:{}, new workers:{}", joiner.join(oldWorkers), joiner.join(current.getWorkers()));
for (ResourceWorkerSlot worker : current.getWorkers()) {
// a new worker, insert all tasks
if (!oldWorkers.contains(worker)) {
for (Integer task : worker.getTasks()) {
TaskTrack track = new TaskTrack(
event.getClusterMetricsContext().getClusterName(),
event.getTopologyId());
track.setStart(new Date(event.getTimestamp()));
track.setComponent(task2Component.get(task));
track.setHost(worker.getHostname());
track.setPort(worker.getPort());
track.setTaskId(task);
taskTrackList.add(track);
}
} else {
for (Integer task : worker.getTasks()) {
ResourceWorkerSlot oldWorker = old.getWorkerByTaskId(task);
if (oldWorker != null) {
// update end time of old task
TaskTrack oldTrack = new TaskTrack(
event.getClusterMetricsContext().getClusterName(),
event.getTopologyId());
oldTrack.setEnd(new Date(event.getTimestamp()));
oldTrack.setTaskId(task);
oldTrack.setHost(oldWorker.getHostname());
oldTrack.setPort(oldWorker.getPort());
taskTrackList.add(oldTrack);
// insert new task
TaskTrack track = new TaskTrack(
event.getClusterMetricsContext().getClusterName(),
event.getTopologyId());
track.setStart(new Date());
track.setComponent(task2Component.get(task));
track.setHost(worker.getHostname());
track.setPort(worker.getPort());
track.setTaskId(task);
taskTrackList.add(track);
}
}
}
}
}
if (taskTrackList.size() > 0) {
batchAdd(taskTrackList, TABLE_TASK_TRACK);
}
} }
|
public class class_name {
private void insertOrUpdateTasks(TaskStartEvent event) {
Assignment old = event.getOldAssignment();
Assignment current = event.getNewAssignment();
Map<Integer, String> task2Component = event.getTask2Component();
List<KVSerializable> taskTrackList = new ArrayList<>();
// assign
if (old == null) {
Set<ResourceWorkerSlot> workers = current.getWorkers();
logger.info("old workers are null, assigned workers:{}", Joiner.on(",").join(workers)); // depends on control dependency: [if], data = [none]
for (ResourceWorkerSlot worker : workers) {
Set<Integer> tasks = worker.getTasks();
for (Integer task : tasks) {
TaskTrack track = new TaskTrack(
event.getClusterMetricsContext().getClusterName(), event.getTopologyId());
track.setStart(new Date(event.getTimestamp())); // depends on control dependency: [for], data = [none]
track.setComponent(task2Component.get(task)); // depends on control dependency: [for], data = [task]
track.setHost(worker.getHostname()); // depends on control dependency: [for], data = [none]
track.setPort(worker.getPort()); // depends on control dependency: [for], data = [none]
track.setTaskId(task); // depends on control dependency: [for], data = [task]
taskTrackList.add(track); // depends on control dependency: [for], data = [task]
}
}
} else { // rebalance, we only insert newly assigned tasks
Set<ResourceWorkerSlot> oldWorkers = old.getWorkers();
Joiner joiner = Joiner.on(",");
logger.info("old workers:{}, new workers:{}", joiner.join(oldWorkers), joiner.join(current.getWorkers())); // depends on control dependency: [if], data = [(old]
for (ResourceWorkerSlot worker : current.getWorkers()) {
// a new worker, insert all tasks
if (!oldWorkers.contains(worker)) {
for (Integer task : worker.getTasks()) {
TaskTrack track = new TaskTrack(
event.getClusterMetricsContext().getClusterName(),
event.getTopologyId());
track.setStart(new Date(event.getTimestamp())); // depends on control dependency: [for], data = [none]
track.setComponent(task2Component.get(task)); // depends on control dependency: [for], data = [task]
track.setHost(worker.getHostname()); // depends on control dependency: [for], data = [none]
track.setPort(worker.getPort()); // depends on control dependency: [for], data = [none]
track.setTaskId(task); // depends on control dependency: [for], data = [task]
taskTrackList.add(track); // depends on control dependency: [for], data = [task]
}
} else {
for (Integer task : worker.getTasks()) {
ResourceWorkerSlot oldWorker = old.getWorkerByTaskId(task);
if (oldWorker != null) {
// update end time of old task
TaskTrack oldTrack = new TaskTrack(
event.getClusterMetricsContext().getClusterName(),
event.getTopologyId());
oldTrack.setEnd(new Date(event.getTimestamp())); // depends on control dependency: [if], data = [none]
oldTrack.setTaskId(task); // depends on control dependency: [if], data = [none]
oldTrack.setHost(oldWorker.getHostname()); // depends on control dependency: [if], data = [(oldWorker]
oldTrack.setPort(oldWorker.getPort()); // depends on control dependency: [if], data = [(oldWorker]
taskTrackList.add(oldTrack); // depends on control dependency: [if], data = [none]
// insert new task
TaskTrack track = new TaskTrack(
event.getClusterMetricsContext().getClusterName(),
event.getTopologyId());
track.setStart(new Date()); // depends on control dependency: [if], data = [none]
track.setComponent(task2Component.get(task)); // depends on control dependency: [if], data = [none]
track.setHost(worker.getHostname()); // depends on control dependency: [if], data = [none]
track.setPort(worker.getPort()); // depends on control dependency: [if], data = [none]
track.setTaskId(task); // depends on control dependency: [if], data = [none]
taskTrackList.add(track); // depends on control dependency: [if], data = [none]
}
}
}
}
}
if (taskTrackList.size() > 0) {
batchAdd(taskTrackList, TABLE_TASK_TRACK); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String getString(String key, String defaultValue, boolean required) {
String value = map.get(key);
if (value == null || value.length() == 0) {
if (required) {
throw new NullPointerException("Property value for key '" + key + "' is required");
} else {
return defaultValue == null ? value : defaultValue;
}
} else {
return value;
}
} }
|
public class class_name {
private String getString(String key, String defaultValue, boolean required) {
String value = map.get(key);
if (value == null || value.length() == 0) {
if (required) {
throw new NullPointerException("Property value for key '" + key + "' is required");
} else {
return defaultValue == null ? value : defaultValue; // depends on control dependency: [if], data = [none]
}
} else {
return value; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void createAnalyzers(final AnalysisJobBuilder ajb, final Class<? extends Analyzer<?>> analyzerClass,
final List<InputColumn<?>> columns) {
final int columnsPerAnalyzer = getColumnsPerAnalyzer();
AnalyzerComponentBuilder<?> analyzerJobBuilder = ajb.addAnalyzer(analyzerClass);
int columnCount = 0;
for (final InputColumn<?> inputColumn : columns) {
if (columnCount == columnsPerAnalyzer) {
analyzerJobBuilder = ajb.addAnalyzer(analyzerClass);
columnCount = 0;
}
analyzerJobBuilder.addInputColumn(inputColumn);
if (isIncludeValueDistribution()) {
ajb.addAnalyzer(ValueDistributionAnalyzer.class).addInputColumn(inputColumn);
}
if (inputColumn.getDataType() == String.class && isIncludePatternFinder()) {
ajb.addAnalyzer(PatternFinderAnalyzer.class).addInputColumn(inputColumn);
}
columnCount++;
}
} }
|
public class class_name {
private void createAnalyzers(final AnalysisJobBuilder ajb, final Class<? extends Analyzer<?>> analyzerClass,
final List<InputColumn<?>> columns) {
final int columnsPerAnalyzer = getColumnsPerAnalyzer();
AnalyzerComponentBuilder<?> analyzerJobBuilder = ajb.addAnalyzer(analyzerClass);
int columnCount = 0;
for (final InputColumn<?> inputColumn : columns) {
if (columnCount == columnsPerAnalyzer) {
analyzerJobBuilder = ajb.addAnalyzer(analyzerClass); // depends on control dependency: [if], data = [none]
columnCount = 0; // depends on control dependency: [if], data = [none]
}
analyzerJobBuilder.addInputColumn(inputColumn);
if (isIncludeValueDistribution()) {
ajb.addAnalyzer(ValueDistributionAnalyzer.class).addInputColumn(inputColumn); // depends on control dependency: [if], data = [none]
}
if (inputColumn.getDataType() == String.class && isIncludePatternFinder()) {
ajb.addAnalyzer(PatternFinderAnalyzer.class).addInputColumn(inputColumn); // depends on control dependency: [if], data = [none]
}
columnCount++;
}
} }
|
public class class_name {
public void addDependency(T from, T to) {
if (from == null || to == null || from.equals(to)) {
throw new IllegalArgumentException("Invalid parameters");
}
lock.writeLock().lock();
try {
if (addOutgoingEdge(from, to)) {
addIncomingEdge(to, from);
}
} finally {
lock.writeLock().unlock();
}
} }
|
public class class_name {
public void addDependency(T from, T to) {
if (from == null || to == null || from.equals(to)) {
throw new IllegalArgumentException("Invalid parameters");
}
lock.writeLock().lock();
try {
if (addOutgoingEdge(from, to)) {
addIncomingEdge(to, from); // depends on control dependency: [if], data = [none]
}
} finally {
lock.writeLock().unlock();
}
} }
|
public class class_name {
public static IDifference construct(String name, boolean[] first, boolean[] second) {
if (first == null && second == null) return null;
BooleanArrayDifference totalDiff = new BooleanArrayDifference(name);
int firstLength = first == null ? 0 : first.length;
int secondLength = second == null ? 0 : second.length;
if (firstLength == secondLength) {
for (int i = 0; i < firstLength; i++) {
totalDiff.addChild(BooleanDifference.construct("" + i, first[i], second[i]));
}
} else if (firstLength < secondLength) {
for (int i = 0; i < firstLength; i++) {
totalDiff.addChild(BooleanDifference.construct("" + i, first[i], second[i]));
}
for (int i = firstLength; i < secondLength; i++) {
totalDiff.addChild(BooleanDifference.construct("" + i, null, second[i]));
}
} else { // secondLength < firstLength
for (int i = 0; i < secondLength; i++) {
totalDiff.addChild(BooleanDifference.construct("" + i, first[i], second[i]));
}
for (int i = secondLength; i < firstLength; i++) {
totalDiff.addChild(BooleanDifference.construct("" + i, first[i], null));
}
}
if (totalDiff.childCount() == 0) {
return null;
}
return totalDiff;
} }
|
public class class_name {
public static IDifference construct(String name, boolean[] first, boolean[] second) {
if (first == null && second == null) return null;
BooleanArrayDifference totalDiff = new BooleanArrayDifference(name);
int firstLength = first == null ? 0 : first.length;
int secondLength = second == null ? 0 : second.length;
if (firstLength == secondLength) {
for (int i = 0; i < firstLength; i++) {
totalDiff.addChild(BooleanDifference.construct("" + i, first[i], second[i])); // depends on control dependency: [for], data = [i]
}
} else if (firstLength < secondLength) {
for (int i = 0; i < firstLength; i++) {
totalDiff.addChild(BooleanDifference.construct("" + i, first[i], second[i])); // depends on control dependency: [for], data = [i]
}
for (int i = firstLength; i < secondLength; i++) {
totalDiff.addChild(BooleanDifference.construct("" + i, null, second[i])); // depends on control dependency: [for], data = [i]
}
} else { // secondLength < firstLength
for (int i = 0; i < secondLength; i++) {
totalDiff.addChild(BooleanDifference.construct("" + i, first[i], second[i])); // depends on control dependency: [for], data = [i]
}
for (int i = secondLength; i < firstLength; i++) {
totalDiff.addChild(BooleanDifference.construct("" + i, first[i], null)); // depends on control dependency: [for], data = [i]
}
}
if (totalDiff.childCount() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
return totalDiff;
} }
|
public class class_name {
@Override
public EEnum getIfcEvaporativeCoolerTypeEnum() {
if (ifcEvaporativeCoolerTypeEnumEEnum == null) {
ifcEvaporativeCoolerTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(983);
}
return ifcEvaporativeCoolerTypeEnumEEnum;
} }
|
public class class_name {
@Override
public EEnum getIfcEvaporativeCoolerTypeEnum() {
if (ifcEvaporativeCoolerTypeEnumEEnum == null) {
ifcEvaporativeCoolerTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(983);
// depends on control dependency: [if], data = [none]
}
return ifcEvaporativeCoolerTypeEnumEEnum;
} }
|
public class class_name {
public Cursor query(long geoPackageId, String tableName, GeometryEnvelope envelope) {
StringBuilder selection = new StringBuilder();
selection.append(GeometryMetadata.COLUMN_GEOPACKAGE_ID).append(" = ? AND ")
.append(GeometryMetadata.COLUMN_TABLE_NAME).append(" = ?");
selection.append(" AND ").append(GeometryMetadata.COLUMN_MIN_X).append(" <= ?");
selection.append(" AND ").append(GeometryMetadata.COLUMN_MAX_X).append(" >= ?");
selection.append(" AND ").append(GeometryMetadata.COLUMN_MIN_Y).append(" <= ?");
selection.append(" AND ").append(GeometryMetadata.COLUMN_MAX_Y).append(" >= ?");
int args = 6;
if (envelope.hasZ()) {
args += 2;
selection.append(" AND ").append(GeometryMetadata.COLUMN_MIN_Z).append(" <= ?");
selection.append(" AND ").append(GeometryMetadata.COLUMN_MAX_Z).append(" >= ?");
}
if (envelope.hasM()) {
args += 2;
selection.append(" AND ").append(GeometryMetadata.COLUMN_MIN_M).append(" <= ?");
selection.append(" AND ").append(GeometryMetadata.COLUMN_MAX_M).append(" >= ?");
}
double minX = envelope.getMinX() - tolerance;
double maxX = envelope.getMaxX() + tolerance;
double minY = envelope.getMinY() - tolerance;
double maxY = envelope.getMaxY() + tolerance;
String[] selectionArgs = new String[args];
int argCount = 0;
selectionArgs[argCount++] = String.valueOf(geoPackageId);
selectionArgs[argCount++] = tableName;
selectionArgs[argCount++] = String.valueOf(maxX);
selectionArgs[argCount++] = String.valueOf(minX);
selectionArgs[argCount++] = String.valueOf(maxY);
selectionArgs[argCount++] = String.valueOf(minY);
if (envelope.hasZ()) {
double minZ = envelope.getMinZ() - tolerance;
double maxZ = envelope.getMaxZ() + tolerance;
selectionArgs[argCount++] = String.valueOf(maxZ);
selectionArgs[argCount++] = String.valueOf(minZ);
}
if (envelope.hasM()) {
double minM = envelope.getMinM() - tolerance;
double maxM = envelope.getMaxM() + tolerance;
selectionArgs[argCount++] = String.valueOf(maxM);
selectionArgs[argCount++] = String.valueOf(minM);
}
Cursor cursor = db.query(
GeometryMetadata.TABLE_NAME,
GeometryMetadata.COLUMNS, selection.toString(), selectionArgs, null, null, null);
return cursor;
} }
|
public class class_name {
public Cursor query(long geoPackageId, String tableName, GeometryEnvelope envelope) {
StringBuilder selection = new StringBuilder();
selection.append(GeometryMetadata.COLUMN_GEOPACKAGE_ID).append(" = ? AND ")
.append(GeometryMetadata.COLUMN_TABLE_NAME).append(" = ?");
selection.append(" AND ").append(GeometryMetadata.COLUMN_MIN_X).append(" <= ?");
selection.append(" AND ").append(GeometryMetadata.COLUMN_MAX_X).append(" >= ?");
selection.append(" AND ").append(GeometryMetadata.COLUMN_MIN_Y).append(" <= ?");
selection.append(" AND ").append(GeometryMetadata.COLUMN_MAX_Y).append(" >= ?");
int args = 6;
if (envelope.hasZ()) {
args += 2; // depends on control dependency: [if], data = [none]
selection.append(" AND ").append(GeometryMetadata.COLUMN_MIN_Z).append(" <= ?"); // depends on control dependency: [if], data = [none]
selection.append(" AND ").append(GeometryMetadata.COLUMN_MAX_Z).append(" >= ?"); // depends on control dependency: [if], data = [none]
}
if (envelope.hasM()) {
args += 2; // depends on control dependency: [if], data = [none]
selection.append(" AND ").append(GeometryMetadata.COLUMN_MIN_M).append(" <= ?"); // depends on control dependency: [if], data = [none]
selection.append(" AND ").append(GeometryMetadata.COLUMN_MAX_M).append(" >= ?"); // depends on control dependency: [if], data = [none]
}
double minX = envelope.getMinX() - tolerance;
double maxX = envelope.getMaxX() + tolerance;
double minY = envelope.getMinY() - tolerance;
double maxY = envelope.getMaxY() + tolerance;
String[] selectionArgs = new String[args];
int argCount = 0;
selectionArgs[argCount++] = String.valueOf(geoPackageId);
selectionArgs[argCount++] = tableName;
selectionArgs[argCount++] = String.valueOf(maxX);
selectionArgs[argCount++] = String.valueOf(minX);
selectionArgs[argCount++] = String.valueOf(maxY);
selectionArgs[argCount++] = String.valueOf(minY);
if (envelope.hasZ()) {
double minZ = envelope.getMinZ() - tolerance;
double maxZ = envelope.getMaxZ() + tolerance;
selectionArgs[argCount++] = String.valueOf(maxZ); // depends on control dependency: [if], data = [none]
selectionArgs[argCount++] = String.valueOf(minZ); // depends on control dependency: [if], data = [none]
}
if (envelope.hasM()) {
double minM = envelope.getMinM() - tolerance;
double maxM = envelope.getMaxM() + tolerance;
selectionArgs[argCount++] = String.valueOf(maxM); // depends on control dependency: [if], data = [none]
selectionArgs[argCount++] = String.valueOf(minM); // depends on control dependency: [if], data = [none]
}
Cursor cursor = db.query(
GeometryMetadata.TABLE_NAME,
GeometryMetadata.COLUMNS, selection.toString(), selectionArgs, null, null, null);
return cursor;
} }
|
public class class_name {
public Properties getProperties() {
Properties props = new Properties();
for(String name : this.users.keySet()) {
SimpleAccount acct = this.users.get(name);
props.setProperty(USERNAME_PREFIX + name, acct.getCredentials().toString());
}
return props;
} }
|
public class class_name {
public Properties getProperties() {
Properties props = new Properties();
for(String name : this.users.keySet()) {
SimpleAccount acct = this.users.get(name);
props.setProperty(USERNAME_PREFIX + name, acct.getCredentials().toString()); // depends on control dependency: [for], data = [name]
}
return props;
} }
|
public class class_name {
private void setupOutputStream() {
synchronized (failureLogFile) {
// Setup is done by some thread
if (hasSetupOutputStream) {
return;
}
try {
boolean append = false;
if (fs.exists(failureLogFile)) {
log.info("Failure log file %s already exists, appending to it", failureLogFile);
append = true;
}
OutputStream outputStream = append ? fs.append(failureLogFile) : fs.create(failureLogFile);
output = this.closer.register(new PrintStream(outputStream, false, Charsets.UTF_8.toString()));
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
hasSetupOutputStream = true;
}
}
} }
|
public class class_name {
private void setupOutputStream() {
synchronized (failureLogFile) {
// Setup is done by some thread
if (hasSetupOutputStream) {
return; // depends on control dependency: [if], data = [none]
}
try {
boolean append = false;
if (fs.exists(failureLogFile)) {
log.info("Failure log file %s already exists, appending to it", failureLogFile); // depends on control dependency: [if], data = [none]
append = true; // depends on control dependency: [if], data = [none]
}
OutputStream outputStream = append ? fs.append(failureLogFile) : fs.create(failureLogFile);
output = this.closer.register(new PrintStream(outputStream, false, Charsets.UTF_8.toString())); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} finally { // depends on control dependency: [catch], data = [none]
hasSetupOutputStream = true;
}
}
} }
|
public class class_name {
private void log(@NonNull Logger log, @NonNull ComapiResult r, String msg) {
if (!r.isSuccessful()) {
log.e(msg + ". Error calling services" + " (" + r.getCode() + "). " + r.getMessage() + ". " + r.getErrorBody());
}
} }
|
public class class_name {
private void log(@NonNull Logger log, @NonNull ComapiResult r, String msg) {
if (!r.isSuccessful()) {
log.e(msg + ". Error calling services" + " (" + r.getCode() + "). " + r.getMessage() + ". " + r.getErrorBody()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void handleTypeFailure(VirtualForm virtualForm, Object bean, String name, Object exp, PropertyDesc pd, Class<?> propertyType,
StringBuilder pathSb, RuntimeException cause) {
final ValidateTypeFailure annotation = extractTypeFailureAnnotation(pd);
if (annotation != null) {
if (ThreadCacheContext.exists()) { // just in case
saveTypeFailureBean(virtualForm, bean, name, exp, propertyType, pathSb, annotation, cause);
} else { // basically no way
logger.debug("*Not found the thread cache for validation of type failure: {}", pathSb, cause);
}
return;
} else {
throw cause;
}
} }
|
public class class_name {
protected void handleTypeFailure(VirtualForm virtualForm, Object bean, String name, Object exp, PropertyDesc pd, Class<?> propertyType,
StringBuilder pathSb, RuntimeException cause) {
final ValidateTypeFailure annotation = extractTypeFailureAnnotation(pd);
if (annotation != null) {
if (ThreadCacheContext.exists()) { // just in case
saveTypeFailureBean(virtualForm, bean, name, exp, propertyType, pathSb, annotation, cause); // depends on control dependency: [if], data = [none]
} else { // basically no way
logger.debug("*Not found the thread cache for validation of type failure: {}", pathSb, cause); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
} else {
throw cause;
}
} }
|
public class class_name {
private void mapIds() {
if (queryReferences != null) {
queryReferencesMap = new HashMap<String,Sequence>(queryReferences.size());
for (int counter=0; counter < queryReferences.size() ; counter ++){
String id = "Query_"+(counter+1);
queryReferencesMap.put(id, queryReferences.get(counter));
}
}
if (databaseReferences != null) {
databaseReferencesMap = new HashMap<String,Sequence>(databaseReferences.size());
for (int counter=0; counter < databaseReferences.size() ; counter ++){
// this is strange: while Query_id are 1 based, Hit (database) id are 0 based
String id = "gnl|BL_ORD_ID|"+(counter);
databaseReferencesMap.put(id, databaseReferences.get(counter));
}
}
} }
|
public class class_name {
private void mapIds() {
if (queryReferences != null) {
queryReferencesMap = new HashMap<String,Sequence>(queryReferences.size()); // depends on control dependency: [if], data = [(queryReferences]
for (int counter=0; counter < queryReferences.size() ; counter ++){
String id = "Query_"+(counter+1);
queryReferencesMap.put(id, queryReferences.get(counter)); // depends on control dependency: [for], data = [counter]
}
}
if (databaseReferences != null) {
databaseReferencesMap = new HashMap<String,Sequence>(databaseReferences.size()); // depends on control dependency: [if], data = [(databaseReferences]
for (int counter=0; counter < databaseReferences.size() ; counter ++){
// this is strange: while Query_id are 1 based, Hit (database) id are 0 based
String id = "gnl|BL_ORD_ID|"+(counter);
databaseReferencesMap.put(id, databaseReferences.get(counter)); // depends on control dependency: [for], data = [counter]
}
}
} }
|
public class class_name {
public synchronized Node parse(URL url) throws IOException,SAXException
{
Node n=null;
InputStream is=url.openStream();
try
{
n=parse(is);
}
finally
{
try
{
is.close();
}
catch(Exception e)
{
// xerces closes streams you give it to parse, so this close() will throw an
// exception.
// This behavior is stupid, so we should not assume it.
}
}
return n;
} }
|
public class class_name {
public synchronized Node parse(URL url) throws IOException,SAXException
{
Node n=null;
InputStream is=url.openStream();
try
{
n=parse(is);
}
finally
{
try
{
is.close(); // depends on control dependency: [try], data = [none]
}
catch(Exception e)
{
// xerces closes streams you give it to parse, so this close() will throw an
// exception.
// This behavior is stupid, so we should not assume it.
} // depends on control dependency: [catch], data = [none]
}
return n;
} }
|
public class class_name {
public static base_responses add(nitro_service client, sslcertkey resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
sslcertkey addresources[] = new sslcertkey[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new sslcertkey();
addresources[i].certkey = resources[i].certkey;
addresources[i].cert = resources[i].cert;
addresources[i].key = resources[i].key;
addresources[i].password = resources[i].password;
addresources[i].fipskey = resources[i].fipskey;
addresources[i].inform = resources[i].inform;
addresources[i].passplain = resources[i].passplain;
addresources[i].expirymonitor = resources[i].expirymonitor;
addresources[i].notificationperiod = resources[i].notificationperiod;
addresources[i].bundle = resources[i].bundle;
}
result = add_bulk_request(client, addresources);
}
return result;
} }
|
public class class_name {
public static base_responses add(nitro_service client, sslcertkey resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
sslcertkey addresources[] = new sslcertkey[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new sslcertkey(); // depends on control dependency: [for], data = [i]
addresources[i].certkey = resources[i].certkey; // depends on control dependency: [for], data = [i]
addresources[i].cert = resources[i].cert; // depends on control dependency: [for], data = [i]
addresources[i].key = resources[i].key; // depends on control dependency: [for], data = [i]
addresources[i].password = resources[i].password; // depends on control dependency: [for], data = [i]
addresources[i].fipskey = resources[i].fipskey; // depends on control dependency: [for], data = [i]
addresources[i].inform = resources[i].inform; // depends on control dependency: [for], data = [i]
addresources[i].passplain = resources[i].passplain; // depends on control dependency: [for], data = [i]
addresources[i].expirymonitor = resources[i].expirymonitor; // depends on control dependency: [for], data = [i]
addresources[i].notificationperiod = resources[i].notificationperiod; // depends on control dependency: [for], data = [i]
addresources[i].bundle = resources[i].bundle; // depends on control dependency: [for], data = [i]
}
result = add_bulk_request(client, addresources);
}
return result;
} }
|
public class class_name {
private void checkNocache(final HttpServletRequest request,
final HttpServletResponse response,
final UtilActionForm form) {
String reqpar = request.getParameter("nocacheSticky");
if (reqpar != null) {
/* (re)set the default */
form.setNocache(reqpar.equals("yes"));
}
/** Look for a one-shot setting
*/
reqpar = request.getParameter("nocache");
if ((reqpar == null) && (!form.getNocache())) {
return;
}
/** If we got a request parameter it overrides the default
*/
boolean nocache = form.getNocache();
if (reqpar != null) {
nocache = reqpar.equals("yes");
}
if (nocache) {
response.setHeader("Pragma", "No-cache");
//response.setHeader("Cache-Control", "no-cache");
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
response.setDateHeader("Expires", 1);
}
} }
|
public class class_name {
private void checkNocache(final HttpServletRequest request,
final HttpServletResponse response,
final UtilActionForm form) {
String reqpar = request.getParameter("nocacheSticky");
if (reqpar != null) {
/* (re)set the default */
form.setNocache(reqpar.equals("yes")); // depends on control dependency: [if], data = [(reqpar]
}
/** Look for a one-shot setting
*/
reqpar = request.getParameter("nocache");
if ((reqpar == null) && (!form.getNocache())) {
return; // depends on control dependency: [if], data = [none]
}
/** If we got a request parameter it overrides the default
*/
boolean nocache = form.getNocache();
if (reqpar != null) {
nocache = reqpar.equals("yes"); // depends on control dependency: [if], data = [none]
}
if (nocache) {
response.setHeader("Pragma", "No-cache"); // depends on control dependency: [if], data = [none]
//response.setHeader("Cache-Control", "no-cache");
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); // depends on control dependency: [if], data = [none]
response.setDateHeader("Expires", 1); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void downloadJobOutput(String accountId, String vaultName,
String jobId, File file, ProgressListener progressListener) {
long archiveSize = 0;
long chunkSize = DEFAULT_DOWNLOAD_CHUNK_SIZE;
long currentPosition = 0;
long endPosition = 0;
RandomAccessFile output = null;
String customizedChunkSize = null;
customizedChunkSize = System.getProperty("com.amazonaws.services.glacier.transfer.downloadChunkSizeInMB");
DescribeJobResult describeJobResult = glacier.describeJob(new DescribeJobRequest(accountId, vaultName, jobId));
archiveSize = describeJobResult.getArchiveSizeInBytes();
if (customizedChunkSize != null) {
try {
chunkSize = Long.parseLong(customizedChunkSize) * 1024 * 1024;
} catch (NumberFormatException e) {
publishProgress(progressListener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw new AmazonClientException("Invalid chunk size: " + e.getMessage());
}
validateChunkSize(chunkSize);
}
try {
output = new RandomAccessFile(file, "rw");
} catch (FileNotFoundException e) {
publishProgress(progressListener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw new AmazonClientException("Unable to open the output file " + file.getPath(), e);
}
try {
publishProgress(progressListener, ProgressEventType.TRANSFER_STARTED_EVENT);
while (currentPosition < archiveSize) {
if (currentPosition + chunkSize > archiveSize) {
endPosition = archiveSize - 1;
} else {
endPosition = currentPosition + chunkSize - 1;
}
// Download the chunk
try {
downloadOneChunk(accountId, vaultName, jobId, output,
currentPosition, endPosition, progressListener);
} catch (Throwable t) {
publishProgress(progressListener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw failure(t);
}
currentPosition += chunkSize;
}
publishProgress(progressListener, ProgressEventType.TRANSFER_COMPLETED_EVENT);
} finally {
closeQuietly(output, log);
}
} }
|
public class class_name {
public void downloadJobOutput(String accountId, String vaultName,
String jobId, File file, ProgressListener progressListener) {
long archiveSize = 0;
long chunkSize = DEFAULT_DOWNLOAD_CHUNK_SIZE;
long currentPosition = 0;
long endPosition = 0;
RandomAccessFile output = null;
String customizedChunkSize = null;
customizedChunkSize = System.getProperty("com.amazonaws.services.glacier.transfer.downloadChunkSizeInMB");
DescribeJobResult describeJobResult = glacier.describeJob(new DescribeJobRequest(accountId, vaultName, jobId));
archiveSize = describeJobResult.getArchiveSizeInBytes();
if (customizedChunkSize != null) {
try {
chunkSize = Long.parseLong(customizedChunkSize) * 1024 * 1024; // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
publishProgress(progressListener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw new AmazonClientException("Invalid chunk size: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
validateChunkSize(chunkSize); // depends on control dependency: [if], data = [none]
}
try {
output = new RandomAccessFile(file, "rw"); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
publishProgress(progressListener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw new AmazonClientException("Unable to open the output file " + file.getPath(), e);
} // depends on control dependency: [catch], data = [none]
try {
publishProgress(progressListener, ProgressEventType.TRANSFER_STARTED_EVENT); // depends on control dependency: [try], data = [none]
while (currentPosition < archiveSize) {
if (currentPosition + chunkSize > archiveSize) {
endPosition = archiveSize - 1; // depends on control dependency: [if], data = [none]
} else {
endPosition = currentPosition + chunkSize - 1; // depends on control dependency: [if], data = [none]
}
// Download the chunk
try {
downloadOneChunk(accountId, vaultName, jobId, output,
currentPosition, endPosition, progressListener); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
publishProgress(progressListener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw failure(t);
} // depends on control dependency: [catch], data = [none]
currentPosition += chunkSize; // depends on control dependency: [while], data = [none]
}
publishProgress(progressListener, ProgressEventType.TRANSFER_COMPLETED_EVENT); // depends on control dependency: [try], data = [none]
} finally {
closeQuietly(output, log);
}
} }
|
public class class_name {
public void cleanDataSources() {
Hashtable<String, List<String>> removedDsKeyTable = null;
//gather all the empty ds's key, can't remove item while iterate
Enumeration<String> allPoolKeys = dbmsPoolTable.keys();
while (allPoolKeys.hasMoreElements()) {
String dbPoolKey = allPoolKeys.nextElement();
Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbPoolKey);
Enumeration<String> allDsKeys = dsTable.keys();
while (allDsKeys.hasMoreElements()) {
String dsKey = allDsKeys.nextElement();
DataSource ds = dsTable.get(dsKey);
//c3p0 impl
if (ds != null && ds instanceof PooledDataSource) {
PooledDataSource pDs = (PooledDataSource) ds;
int conCount;
try {
conCount = pDs.getNumConnectionsAllUsers();
} catch (SQLException e) {
// todo logger.error
// ("Failed to get total number of connections for datasource. dbmsPoolKey = "
// + dbPoolKey, e);
continue;
}
//no connections
if (conCount == 0) {
List<String> removedList = null;
if (removedDsKeyTable == null) {
removedDsKeyTable = new Hashtable<>();
} else {
removedList = removedDsKeyTable.get(dbPoolKey);
}
if (removedList == null) {
removedList = new ArrayList<>();
removedList.add(dsKey);
removedDsKeyTable.put(dbPoolKey, removedList);
} else {
removedList.add(dsKey);
}
}
}
}
}
//have empty ds
if (removedDsKeyTable != null && !removedDsKeyTable.isEmpty()) {
Enumeration<String> removedPoolKeys = removedDsKeyTable.keys();
while (removedPoolKeys.hasMoreElements()) {
String removedPoolKey = removedPoolKeys.nextElement();
PooledDataSourceProvider provider = this.getProvider(removedPoolKey);
List<String> removedDsList = removedDsKeyTable.get(removedPoolKey);
Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(removedPoolKey);
for (String dsKey : removedDsList) {
DataSource removedDs = dsTable.remove(dsKey);
try {
provider.closePooledDataSource(removedDs);
} catch (SQLException e) {
//can't show the dsKey since it has encrypted password there
// todo logger.error("Failed to close datadsource in dmbs poolKey = "
// + removedPoolKey, e);
continue;
}
//tracing
// todo if (logger.isDebugEnabled()) {
// logger.debug("Removed one datasource in dbms poolKey = "
// + removedPoolKey);
// }
}
//don't have any ds for the pool key
if (dsTable.isEmpty()) {
dbmsPoolTable.remove(removedPoolKey);
//tracing
// todo if (logger.isDebugEnabled()) {
// logger.debug("Removed dbms poolKey = " + removedPoolKey);
// }
}
}
}
} }
|
public class class_name {
public void cleanDataSources() {
Hashtable<String, List<String>> removedDsKeyTable = null;
//gather all the empty ds's key, can't remove item while iterate
Enumeration<String> allPoolKeys = dbmsPoolTable.keys();
while (allPoolKeys.hasMoreElements()) {
String dbPoolKey = allPoolKeys.nextElement();
Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbPoolKey);
Enumeration<String> allDsKeys = dsTable.keys();
while (allDsKeys.hasMoreElements()) {
String dsKey = allDsKeys.nextElement();
DataSource ds = dsTable.get(dsKey);
//c3p0 impl
if (ds != null && ds instanceof PooledDataSource) {
PooledDataSource pDs = (PooledDataSource) ds;
int conCount;
try {
conCount = pDs.getNumConnectionsAllUsers(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
// todo logger.error
// ("Failed to get total number of connections for datasource. dbmsPoolKey = "
// + dbPoolKey, e);
continue;
} // depends on control dependency: [catch], data = [none]
//no connections
if (conCount == 0) {
List<String> removedList = null;
if (removedDsKeyTable == null) {
removedDsKeyTable = new Hashtable<>(); // depends on control dependency: [if], data = [none]
} else {
removedList = removedDsKeyTable.get(dbPoolKey); // depends on control dependency: [if], data = [none]
}
if (removedList == null) {
removedList = new ArrayList<>(); // depends on control dependency: [if], data = [none]
removedList.add(dsKey); // depends on control dependency: [if], data = [none]
removedDsKeyTable.put(dbPoolKey, removedList); // depends on control dependency: [if], data = [none]
} else {
removedList.add(dsKey); // depends on control dependency: [if], data = [none]
}
}
}
}
}
//have empty ds
if (removedDsKeyTable != null && !removedDsKeyTable.isEmpty()) {
Enumeration<String> removedPoolKeys = removedDsKeyTable.keys();
while (removedPoolKeys.hasMoreElements()) {
String removedPoolKey = removedPoolKeys.nextElement();
PooledDataSourceProvider provider = this.getProvider(removedPoolKey);
List<String> removedDsList = removedDsKeyTable.get(removedPoolKey);
Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(removedPoolKey);
for (String dsKey : removedDsList) {
DataSource removedDs = dsTable.remove(dsKey);
try {
provider.closePooledDataSource(removedDs); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
//can't show the dsKey since it has encrypted password there
// todo logger.error("Failed to close datadsource in dmbs poolKey = "
// + removedPoolKey, e);
continue;
} // depends on control dependency: [catch], data = [none]
//tracing
// todo if (logger.isDebugEnabled()) {
// logger.debug("Removed one datasource in dbms poolKey = "
// + removedPoolKey);
// }
}
//don't have any ds for the pool key
if (dsTable.isEmpty()) {
dbmsPoolTable.remove(removedPoolKey); // depends on control dependency: [if], data = [none]
//tracing
// todo if (logger.isDebugEnabled()) {
// logger.debug("Removed dbms poolKey = " + removedPoolKey);
// }
}
}
}
} }
|
public class class_name {
public void beginLayer(PdfOCG layer) {
if ((layer instanceof PdfLayer) && ((PdfLayer)layer).getTitle() != null)
throw new IllegalArgumentException("A title is not a layer");
if (layerDepth == null)
layerDepth = new ArrayList();
if (layer instanceof PdfLayerMembership) {
layerDepth.add(Integer.valueOf(1));
beginLayer2(layer);
return;
}
int n = 0;
PdfLayer la = (PdfLayer)layer;
while (la != null) {
if (la.getTitle() == null) {
beginLayer2(la);
++n;
}
la = la.getParent();
}
layerDepth.add(Integer.valueOf(n));
} }
|
public class class_name {
public void beginLayer(PdfOCG layer) {
if ((layer instanceof PdfLayer) && ((PdfLayer)layer).getTitle() != null)
throw new IllegalArgumentException("A title is not a layer");
if (layerDepth == null)
layerDepth = new ArrayList();
if (layer instanceof PdfLayerMembership) {
layerDepth.add(Integer.valueOf(1)); // depends on control dependency: [if], data = [none]
beginLayer2(layer); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
int n = 0;
PdfLayer la = (PdfLayer)layer;
while (la != null) {
if (la.getTitle() == null) {
beginLayer2(la); // depends on control dependency: [if], data = [none]
++n; // depends on control dependency: [if], data = [none]
}
la = la.getParent(); // depends on control dependency: [while], data = [none]
}
layerDepth.add(Integer.valueOf(n));
} }
|
public class class_name {
protected int addPacket(OggPacket packet, int offset) {
if(packet.isBeginningOfStream()) {
isBOS = true;
}
if(packet.isEndOfStream()) {
isEOS = true;
}
// Add on in 255 byte chunks
int size = packet.getData().length;
for(int i = numLVs; i< 255; i++) {
int remains = size - offset;
int toAdd = 255;
if(remains < 255) {
toAdd = remains;
}
lvs[i] = IOUtils.fromInt(toAdd);
tmpData.write(packet.getData(), offset, toAdd);
numLVs++;
offset += toAdd;
if(toAdd < 255) {
break;
}
}
return offset;
} }
|
public class class_name {
protected int addPacket(OggPacket packet, int offset) {
if(packet.isBeginningOfStream()) {
isBOS = true; // depends on control dependency: [if], data = [none]
}
if(packet.isEndOfStream()) {
isEOS = true; // depends on control dependency: [if], data = [none]
}
// Add on in 255 byte chunks
int size = packet.getData().length;
for(int i = numLVs; i< 255; i++) {
int remains = size - offset;
int toAdd = 255;
if(remains < 255) {
toAdd = remains; // depends on control dependency: [if], data = [none]
}
lvs[i] = IOUtils.fromInt(toAdd); // depends on control dependency: [for], data = [i]
tmpData.write(packet.getData(), offset, toAdd); // depends on control dependency: [for], data = [none]
numLVs++; // depends on control dependency: [for], data = [none]
offset += toAdd; // depends on control dependency: [for], data = [none]
if(toAdd < 255) {
break;
}
}
return offset;
} }
|
public class class_name {
@Override
public Collection<BioPAXElement> generate(Match match, int... ind)
{
Collection<BioPAXElement> gen = new HashSet<BioPAXElement> (
con[0].generate(match, ind));
Set<BioPAXElement> input = new HashSet<BioPAXElement>();
Set<BioPAXElement> output = new HashSet<BioPAXElement>(gen);
int[] tempInd = {0, 1};
for (int i = 1; i < con.length; i++)
{
if (output.isEmpty()) break;
input.clear();
input.addAll(output);
output.clear();
for (BioPAXElement ele : input)
{
Match m = new Match(2);
m.set(ele, 0);
output.addAll(con[i].generate(m, tempInd));
}
}
return output;
} }
|
public class class_name {
@Override
public Collection<BioPAXElement> generate(Match match, int... ind)
{
Collection<BioPAXElement> gen = new HashSet<BioPAXElement> (
con[0].generate(match, ind));
Set<BioPAXElement> input = new HashSet<BioPAXElement>();
Set<BioPAXElement> output = new HashSet<BioPAXElement>(gen);
int[] tempInd = {0, 1};
for (int i = 1; i < con.length; i++)
{
if (output.isEmpty()) break;
input.clear(); // depends on control dependency: [for], data = [none]
input.addAll(output); // depends on control dependency: [for], data = [none]
output.clear(); // depends on control dependency: [for], data = [none]
for (BioPAXElement ele : input)
{
Match m = new Match(2);
m.set(ele, 0); // depends on control dependency: [for], data = [ele]
output.addAll(con[i].generate(m, tempInd)); // depends on control dependency: [for], data = [none]
}
}
return output;
} }
|
public class class_name {
public EventSubscription withSourceIdsList(String... sourceIdsList) {
if (this.sourceIdsList == null) {
setSourceIdsList(new com.amazonaws.internal.SdkInternalList<String>(sourceIdsList.length));
}
for (String ele : sourceIdsList) {
this.sourceIdsList.add(ele);
}
return this;
} }
|
public class class_name {
public EventSubscription withSourceIdsList(String... sourceIdsList) {
if (this.sourceIdsList == null) {
setSourceIdsList(new com.amazonaws.internal.SdkInternalList<String>(sourceIdsList.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : sourceIdsList) {
this.sourceIdsList.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void setParameterGroups(java.util.Collection<ParameterGroup> parameterGroups) {
if (parameterGroups == null) {
this.parameterGroups = null;
return;
}
this.parameterGroups = new java.util.ArrayList<ParameterGroup>(parameterGroups);
} }
|
public class class_name {
public void setParameterGroups(java.util.Collection<ParameterGroup> parameterGroups) {
if (parameterGroups == null) {
this.parameterGroups = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.parameterGroups = new java.util.ArrayList<ParameterGroup>(parameterGroups);
} }
|
public class class_name {
public static synchronized void reloadExistingConfigurations() {
if (LOG.isDebugEnabled()) {
LOG.debug("Reloading " + REGISTRY.keySet().size()
+ " existing configurations");
}
for (Configuration conf : REGISTRY.keySet()) {
conf.reloadConfiguration();
}
} }
|
public class class_name {
public static synchronized void reloadExistingConfigurations() {
if (LOG.isDebugEnabled()) {
LOG.debug("Reloading " + REGISTRY.keySet().size()
+ " existing configurations"); // depends on control dependency: [if], data = [none]
}
for (Configuration conf : REGISTRY.keySet()) {
conf.reloadConfiguration(); // depends on control dependency: [for], data = [conf]
}
} }
|
public class class_name {
protected void removeMessageJobDeclarationWithJobConfiguration(ActivityImpl activity, String jobConfiguration) {
List<MessageJobDeclaration> messageJobDeclarations = (List<MessageJobDeclaration>) activity.getProperty(PROPERTYNAME_MESSAGE_JOB_DECLARATION);
if (messageJobDeclarations != null) {
Iterator<MessageJobDeclaration> iter = messageJobDeclarations.iterator();
while (iter.hasNext()) {
MessageJobDeclaration msgDecl = iter.next();
if (msgDecl.getJobConfiguration().equalsIgnoreCase(jobConfiguration)
&& msgDecl.getActivityId().equalsIgnoreCase(activity.getActivityId())) {
iter.remove();
}
}
}
ProcessDefinition procDef = (ProcessDefinition) activity.getProcessDefinition();
List<JobDeclaration<?, ?>> declarations = jobDeclarations.get(procDef.getKey());
if (declarations != null) {
Iterator<JobDeclaration<?, ?>> iter = declarations.iterator();
while (iter.hasNext()) {
JobDeclaration<?, ?> jobDcl = iter.next();
if (jobDcl.getJobConfiguration().equalsIgnoreCase(jobConfiguration)
&& jobDcl.getActivityId().equalsIgnoreCase(activity.getActivityId())) {
iter.remove();
}
}
}
} }
|
public class class_name {
protected void removeMessageJobDeclarationWithJobConfiguration(ActivityImpl activity, String jobConfiguration) {
List<MessageJobDeclaration> messageJobDeclarations = (List<MessageJobDeclaration>) activity.getProperty(PROPERTYNAME_MESSAGE_JOB_DECLARATION);
if (messageJobDeclarations != null) {
Iterator<MessageJobDeclaration> iter = messageJobDeclarations.iterator();
while (iter.hasNext()) {
MessageJobDeclaration msgDecl = iter.next();
if (msgDecl.getJobConfiguration().equalsIgnoreCase(jobConfiguration)
&& msgDecl.getActivityId().equalsIgnoreCase(activity.getActivityId())) {
iter.remove(); // depends on control dependency: [if], data = [none]
}
}
}
ProcessDefinition procDef = (ProcessDefinition) activity.getProcessDefinition();
List<JobDeclaration<?, ?>> declarations = jobDeclarations.get(procDef.getKey());
if (declarations != null) {
Iterator<JobDeclaration<?, ?>> iter = declarations.iterator(); // depends on control dependency: [if], data = [none]
while (iter.hasNext()) {
JobDeclaration<?, ?> jobDcl = iter.next(); // depends on control dependency: [while], data = [none]
if (jobDcl.getJobConfiguration().equalsIgnoreCase(jobConfiguration)
&& jobDcl.getActivityId().equalsIgnoreCase(activity.getActivityId())) {
iter.remove(); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public Locomotive waitForWindow(String regex) {
Set<String> windows = driver.getWindowHandles();
for (String window : windows) {
try {
driver.switchTo().window(window);
p = Pattern.compile(regex);
m = p.matcher(driver.getCurrentUrl());
if (m.find()) {
attempts = 0;
return switchToWindow(regex);
}
else {
// try for title
m = p.matcher(driver.getTitle());
if (m.find()) {
attempts = 0;
return switchToWindow(regex);
}
}
} catch(NoSuchWindowException e) {
if (attempts <= MAX_ATTEMPTS) {
attempts++;
try {Thread.sleep(1000);}catch(Exception x) { x.printStackTrace(); }
return waitForWindow(regex);
} else {
fail("Window with url|title: " + regex + " did not appear after " + MAX_ATTEMPTS + " tries. Exiting.");
}
}
}
// when we reach this point, that means no window exists with that title..
if (attempts == MAX_ATTEMPTS) {
fail("Window with title: " + regex + " did not appear after " + MAX_ATTEMPTS + " tries. Exiting.");
return this;
} else {
System.out.println("#waitForWindow() : Window doesn't exist yet. [" + regex + "] Trying again. " + (attempts+1) + "/" + MAX_ATTEMPTS);
attempts++;
try {Thread.sleep(1000);}catch(Exception x) { x.printStackTrace(); }
return waitForWindow(regex);
}
} }
|
public class class_name {
public Locomotive waitForWindow(String regex) {
Set<String> windows = driver.getWindowHandles();
for (String window : windows) {
try {
driver.switchTo().window(window); // depends on control dependency: [try], data = [none]
p = Pattern.compile(regex); // depends on control dependency: [try], data = [none]
m = p.matcher(driver.getCurrentUrl()); // depends on control dependency: [try], data = [none]
if (m.find()) {
attempts = 0; // depends on control dependency: [if], data = [none]
return switchToWindow(regex); // depends on control dependency: [if], data = [none]
}
else {
// try for title
m = p.matcher(driver.getTitle()); // depends on control dependency: [if], data = [none]
if (m.find()) {
attempts = 0; // depends on control dependency: [if], data = [none]
return switchToWindow(regex); // depends on control dependency: [if], data = [none]
}
}
} catch(NoSuchWindowException e) {
if (attempts <= MAX_ATTEMPTS) {
attempts++; // depends on control dependency: [if], data = [none]
try {Thread.sleep(1000);}catch(Exception x) { x.printStackTrace(); } // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
return waitForWindow(regex); // depends on control dependency: [if], data = [none]
} else {
fail("Window with url|title: " + regex + " did not appear after " + MAX_ATTEMPTS + " tries. Exiting."); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
// when we reach this point, that means no window exists with that title..
if (attempts == MAX_ATTEMPTS) {
fail("Window with title: " + regex + " did not appear after " + MAX_ATTEMPTS + " tries. Exiting.");
return this; // depends on control dependency: [if], data = [none]
} else {
System.out.println("#waitForWindow() : Window doesn't exist yet. [" + regex + "] Trying again. " + (attempts+1) + "/" + MAX_ATTEMPTS); // depends on control dependency: [if], data = [(attempts]
attempts++; // depends on control dependency: [if], data = [none]
try {Thread.sleep(1000);}catch(Exception x) { x.printStackTrace(); } // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
return waitForWindow(regex); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected final InnerContextAccess getInnerContextAccessSkill() {
if (this.skillBufferInnerContextAccess == null || this.skillBufferInnerContextAccess.get() == null) {
this.skillBufferInnerContextAccess = $getSkill(InnerContextAccess.class);
}
return $castSkill(InnerContextAccess.class, this.skillBufferInnerContextAccess);
} }
|
public class class_name {
protected final InnerContextAccess getInnerContextAccessSkill() {
if (this.skillBufferInnerContextAccess == null || this.skillBufferInnerContextAccess.get() == null) {
this.skillBufferInnerContextAccess = $getSkill(InnerContextAccess.class); // depends on control dependency: [if], data = [none]
}
return $castSkill(InnerContextAccess.class, this.skillBufferInnerContextAccess);
} }
|
public class class_name {
public static boolean contains3D(Coordinate[] coords, Coordinate coord) {
for (Coordinate coordinate : coords) {
if (coordinate.equals3D(coord)) {
return true;
}
}
return false;
} }
|
public class class_name {
public static boolean contains3D(Coordinate[] coords, Coordinate coord) {
for (Coordinate coordinate : coords) {
if (coordinate.equals3D(coord)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
private static String convertSecondsToString(int totalSeconds) {
if (totalSeconds < 0) {
return null;
}
int hours = totalSeconds / 3600;
int remainder = totalSeconds - (hours * 3600);
int minutes = remainder / 60;
int seconds = remainder - (minutes * 60);
if (hours > 0) {
return String.format("%2d:%02d:%02d", hours, minutes, seconds);
} else {
return String.format("%02d:%02d", minutes, seconds);
}
} }
|
public class class_name {
private static String convertSecondsToString(int totalSeconds) {
if (totalSeconds < 0) {
return null; // depends on control dependency: [if], data = [none]
}
int hours = totalSeconds / 3600;
int remainder = totalSeconds - (hours * 3600);
int minutes = remainder / 60;
int seconds = remainder - (minutes * 60);
if (hours > 0) {
return String.format("%2d:%02d:%02d", hours, minutes, seconds); // depends on control dependency: [if], data = [none]
} else {
return String.format("%02d:%02d", minutes, seconds); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String parseExplainCall(String statement)
{
Matcher matcher = ExplainCallPreamble.matcher(statement);
if ( ! matcher.lookingAt()) {
return null;
}
return statement.substring(matcher.end());
} }
|
public class class_name {
public static String parseExplainCall(String statement)
{
Matcher matcher = ExplainCallPreamble.matcher(statement);
if ( ! matcher.lookingAt()) {
return null; // depends on control dependency: [if], data = [none]
}
return statement.substring(matcher.end());
} }
|
public class class_name {
@NonNull
@Override
public MutableArray insertValue(int index, Object value) {
synchronized (lock) {
if (!internalArray.insert(index, Fleece.toCBLObject(value))) { throwRangeException(index); }
return this;
}
} }
|
public class class_name {
@NonNull
@Override
public MutableArray insertValue(int index, Object value) {
synchronized (lock) {
if (!internalArray.insert(index, Fleece.toCBLObject(value))) { throwRangeException(index); } // depends on control dependency: [if], data = [none]
return this;
}
} }
|
public class class_name {
public EClass getIfcPreDefinedCurveFont() {
if (ifcPreDefinedCurveFontEClass == null) {
ifcPreDefinedCurveFontEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(373);
}
return ifcPreDefinedCurveFontEClass;
} }
|
public class class_name {
public EClass getIfcPreDefinedCurveFont() {
if (ifcPreDefinedCurveFontEClass == null) {
ifcPreDefinedCurveFontEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(373);
// depends on control dependency: [if], data = [none]
}
return ifcPreDefinedCurveFontEClass;
} }
|
public class class_name {
private void visitYield(NodeTraversal t, Node n) {
JSType jsType = getJSType(t.getEnclosingFunction());
JSType declaredYieldType = getNativeType(UNKNOWN_TYPE);
if (jsType.isFunctionType()) {
FunctionType functionType = jsType.toMaybeFunctionType();
JSType returnType = functionType.getReturnType();
declaredYieldType = JsIterables.getElementType(returnType, typeRegistry);
if (t.getEnclosingFunction().isAsyncGeneratorFunction()) {
// Can yield x|IThenable<x> in an AsyncGenerator<x>, no await needed. Note that we must
// first wrap the type in IThenable as createAsyncReturnableType will map a non-IThenable to
// `?`.
declaredYieldType =
Promises.createAsyncReturnableType(
typeRegistry, Promises.wrapInIThenable(typeRegistry, declaredYieldType));
}
}
// fetching the yielded value's type
Node valueNode = n.getFirstChild();
JSType actualYieldType;
if (valueNode == null) {
actualYieldType = getNativeType(VOID_TYPE);
valueNode = n;
} else {
actualYieldType = getJSType(valueNode);
}
if (n.isYieldAll()) {
if (t.getEnclosingFunction().isAsyncGeneratorFunction()) {
Optional<JSType> maybeActualYieldType =
validator.expectAutoboxesToIterableOrAsyncIterable(
n, actualYieldType, "Expression yield* expects an iterable or async iterable");
if (!maybeActualYieldType.isPresent()) {
// don't do any further typechecking of the yield* type.
return;
}
actualYieldType = maybeActualYieldType.get();
} else {
if (!validator.expectAutoboxesToIterable(
n, actualYieldType, "Expression yield* expects an iterable")) {
// don't do any further typechecking of the yield* type.
return;
}
actualYieldType =
actualYieldType.autobox().getInstantiatedTypeArgument(getNativeType(ITERABLE_TYPE));
}
}
// verifying
validator.expectCanAssignTo(
valueNode,
actualYieldType,
declaredYieldType,
"Yielded type does not match declared return type.");
} }
|
public class class_name {
private void visitYield(NodeTraversal t, Node n) {
JSType jsType = getJSType(t.getEnclosingFunction());
JSType declaredYieldType = getNativeType(UNKNOWN_TYPE);
if (jsType.isFunctionType()) {
FunctionType functionType = jsType.toMaybeFunctionType();
JSType returnType = functionType.getReturnType();
declaredYieldType = JsIterables.getElementType(returnType, typeRegistry); // depends on control dependency: [if], data = [none]
if (t.getEnclosingFunction().isAsyncGeneratorFunction()) {
// Can yield x|IThenable<x> in an AsyncGenerator<x>, no await needed. Note that we must
// first wrap the type in IThenable as createAsyncReturnableType will map a non-IThenable to
// `?`.
declaredYieldType =
Promises.createAsyncReturnableType(
typeRegistry, Promises.wrapInIThenable(typeRegistry, declaredYieldType)); // depends on control dependency: [if], data = [none]
}
}
// fetching the yielded value's type
Node valueNode = n.getFirstChild();
JSType actualYieldType;
if (valueNode == null) {
actualYieldType = getNativeType(VOID_TYPE); // depends on control dependency: [if], data = [none]
valueNode = n; // depends on control dependency: [if], data = [none]
} else {
actualYieldType = getJSType(valueNode); // depends on control dependency: [if], data = [(valueNode]
}
if (n.isYieldAll()) {
if (t.getEnclosingFunction().isAsyncGeneratorFunction()) {
Optional<JSType> maybeActualYieldType =
validator.expectAutoboxesToIterableOrAsyncIterable(
n, actualYieldType, "Expression yield* expects an iterable or async iterable");
if (!maybeActualYieldType.isPresent()) {
// don't do any further typechecking of the yield* type.
return; // depends on control dependency: [if], data = [none]
}
actualYieldType = maybeActualYieldType.get(); // depends on control dependency: [if], data = [none]
} else {
if (!validator.expectAutoboxesToIterable(
n, actualYieldType, "Expression yield* expects an iterable")) {
// don't do any further typechecking of the yield* type.
return; // depends on control dependency: [if], data = [none]
}
actualYieldType =
actualYieldType.autobox().getInstantiatedTypeArgument(getNativeType(ITERABLE_TYPE)); // depends on control dependency: [if], data = [none]
}
}
// verifying
validator.expectCanAssignTo(
valueNode,
actualYieldType,
declaredYieldType,
"Yielded type does not match declared return type.");
} }
|
public class class_name {
public FileDefinition buildFileDefinition( Collection<Instance> rootInstances, File targetFile, boolean addComment, boolean saveRuntimeInformation ) {
FileDefinition result = new FileDefinition( targetFile );
result.setFileType( FileDefinition.INSTANCE );
if( addComment ) {
String s = "# File created from an in-memory model,\n# without a binding to existing files.";
BlockComment initialComment = new BlockComment( result, s );
result.getBlocks().add( initialComment );
result.getBlocks().add( new BlockBlank( result, "\n" ));
}
for( Instance rootInstance : rootInstances )
result.getBlocks().addAll( buildInstanceOf( result, rootInstance, addComment, saveRuntimeInformation ));
return result;
} }
|
public class class_name {
public FileDefinition buildFileDefinition( Collection<Instance> rootInstances, File targetFile, boolean addComment, boolean saveRuntimeInformation ) {
FileDefinition result = new FileDefinition( targetFile );
result.setFileType( FileDefinition.INSTANCE );
if( addComment ) {
String s = "# File created from an in-memory model,\n# without a binding to existing files.";
BlockComment initialComment = new BlockComment( result, s );
result.getBlocks().add( initialComment ); // depends on control dependency: [if], data = [none]
result.getBlocks().add( new BlockBlank( result, "\n" )); // depends on control dependency: [if], data = [none]
}
for( Instance rootInstance : rootInstances )
result.getBlocks().addAll( buildInstanceOf( result, rootInstance, addComment, saveRuntimeInformation ));
return result;
} }
|
public class class_name {
public boolean isDeviceCodeError() {
ErrorObject errorObject = getErrorObject();
if (errorObject == null) {
return false;
}
String code = errorObject.getCode();
if (code == null) {
return false;
}
switch (code) {
case "authorization_pending":
case "slow_down":
case "access_denied":
case "code_expired":
return true;
default:
return false;
}
} }
|
public class class_name {
public boolean isDeviceCodeError() {
ErrorObject errorObject = getErrorObject();
if (errorObject == null) {
return false; // depends on control dependency: [if], data = [none]
}
String code = errorObject.getCode();
if (code == null) {
return false; // depends on control dependency: [if], data = [none]
}
switch (code) {
case "authorization_pending":
case "slow_down":
case "access_denied":
case "code_expired":
return true;
default:
return false;
}
} }
|
public class class_name {
public static synchronized List getPropertyNames(String entityTypeName) {
if (entityTypeName == null) {
return null;
}
if (!entityTypeName.equals("Entity")) {
return (List) properties.get(entityTypeName);
}
if (propertyNames != null) {
return propertyNames;
} else {
{
List names = new ArrayList();
names.add(PROP_IDENTIFIER);
names.add(PROP_VIEW_IDENTIFIERS);
names.add(PROP_PARENT);
names.add(PROP_CHILDREN);
names.add(PROP_GROUPS);
names.add(PROP_CREATE_TIMESTAMP);
names.add(PROP_MODIFY_TIMESTAMP);
names.add(PROP_ENTITLEMENT_INFO);
names.add(PROP_CHANGE_TYPE);
propertyNames = Collections.unmodifiableList(names);
return propertyNames;
}
}
} }
|
public class class_name {
public static synchronized List getPropertyNames(String entityTypeName) {
if (entityTypeName == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (!entityTypeName.equals("Entity")) {
return (List) properties.get(entityTypeName); // depends on control dependency: [if], data = [none]
}
if (propertyNames != null) {
return propertyNames; // depends on control dependency: [if], data = [none]
} else {
{
List names = new ArrayList();
names.add(PROP_IDENTIFIER);
names.add(PROP_VIEW_IDENTIFIERS);
names.add(PROP_PARENT);
names.add(PROP_CHILDREN);
names.add(PROP_GROUPS);
names.add(PROP_CREATE_TIMESTAMP);
names.add(PROP_MODIFY_TIMESTAMP);
names.add(PROP_ENTITLEMENT_INFO);
names.add(PROP_CHANGE_TYPE);
propertyNames = Collections.unmodifiableList(names);
return propertyNames;
}
}
} }
|
public class class_name {
@Override
public IBucket read(final long pKey) throws TTIOException {
Future<IBucket> secondReturn = mService.submit(new Callable<IBucket>() {
@Override
public IBucket call() throws Exception {
return mSecondWriter.read(pKey);
}
});
IBucket returnVal = mFirstWriter.read(pKey);
try {
if (returnVal == null) {
return secondReturn.get();
} else {
return returnVal;
}
} catch (ExecutionException | InterruptedException exc) {
throw new TTIOException(exc);
}
} }
|
public class class_name {
@Override
public IBucket read(final long pKey) throws TTIOException {
Future<IBucket> secondReturn = mService.submit(new Callable<IBucket>() {
@Override
public IBucket call() throws Exception {
return mSecondWriter.read(pKey);
}
});
IBucket returnVal = mFirstWriter.read(pKey);
try {
if (returnVal == null) {
return secondReturn.get(); // depends on control dependency: [if], data = [none]
} else {
return returnVal; // depends on control dependency: [if], data = [none]
}
} catch (ExecutionException | InterruptedException exc) {
throw new TTIOException(exc);
}
} }
|
public class class_name {
public ResultSet getResults() {
final SQLListenerContextImpl context = startContext(connection(), queryMixin.getMetadata());
String queryString = null;
List<Object> constants = ImmutableList.of();
try {
listeners.preRender(context);
SQLSerializer serializer = serialize(false);
queryString = serializer.toString();
logQuery(queryString, serializer.getConstants());
context.addSQL(getSQL(serializer));
listeners.rendered(context);
listeners.notifyQuery(queryMixin.getMetadata());
constants = serializer.getConstants();
listeners.prePrepare(context);
final PreparedStatement stmt = getPreparedStatement(queryString);
setParameters(stmt, constants, serializer.getConstantPaths(), getMetadata().getParams());
context.addPreparedStatement(stmt);
listeners.prepared(context);
listeners.preExecute(context);
final ResultSet rs = stmt.executeQuery();
listeners.executed(context);
return new ResultSetAdapter(rs) {
@Override
public void close() throws SQLException {
try {
super.close();
} finally {
stmt.close();
reset();
endContext(context);
}
}
};
} catch (SQLException e) {
onException(context, e);
reset();
endContext(context);
throw configuration.translate(queryString, constants, e);
}
} }
|
public class class_name {
public ResultSet getResults() {
final SQLListenerContextImpl context = startContext(connection(), queryMixin.getMetadata());
String queryString = null;
List<Object> constants = ImmutableList.of();
try {
listeners.preRender(context); // depends on control dependency: [try], data = [none]
SQLSerializer serializer = serialize(false);
queryString = serializer.toString(); // depends on control dependency: [try], data = [none]
logQuery(queryString, serializer.getConstants()); // depends on control dependency: [try], data = [none]
context.addSQL(getSQL(serializer)); // depends on control dependency: [try], data = [none]
listeners.rendered(context); // depends on control dependency: [try], data = [none]
listeners.notifyQuery(queryMixin.getMetadata()); // depends on control dependency: [try], data = [none]
constants = serializer.getConstants(); // depends on control dependency: [try], data = [none]
listeners.prePrepare(context); // depends on control dependency: [try], data = [none]
final PreparedStatement stmt = getPreparedStatement(queryString);
setParameters(stmt, constants, serializer.getConstantPaths(), getMetadata().getParams()); // depends on control dependency: [try], data = [none]
context.addPreparedStatement(stmt); // depends on control dependency: [try], data = [none]
listeners.prepared(context); // depends on control dependency: [try], data = [none]
listeners.preExecute(context); // depends on control dependency: [try], data = [none]
final ResultSet rs = stmt.executeQuery();
listeners.executed(context); // depends on control dependency: [try], data = [none]
return new ResultSetAdapter(rs) {
@Override
public void close() throws SQLException {
try {
super.close();
} finally {
stmt.close();
reset();
endContext(context);
}
}
};
} catch (SQLException e) {
onException(context, e);
reset();
endContext(context);
throw configuration.translate(queryString, constants, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Result getResult() {
Set<SourceFile> transpiledFiles = new HashSet<>();
if (jsRoot != null) {
for (Node scriptNode : jsRoot.children()) {
if (scriptNode.getBooleanProp(Node.TRANSPILED)) {
transpiledFiles.add(getSourceFileByName(scriptNode.getSourceFileName()));
}
}
}
return new Result(
getErrors(),
getWarnings(),
this.variableMap,
this.propertyMap,
this.anonymousFunctionNameMap,
this.stringMap,
this.sourceMap,
this.externExports,
this.cssNames,
this.idGeneratorMap,
transpiledFiles);
} }
|
public class class_name {
public Result getResult() {
Set<SourceFile> transpiledFiles = new HashSet<>();
if (jsRoot != null) {
for (Node scriptNode : jsRoot.children()) {
if (scriptNode.getBooleanProp(Node.TRANSPILED)) {
transpiledFiles.add(getSourceFileByName(scriptNode.getSourceFileName())); // depends on control dependency: [if], data = [none]
}
}
}
return new Result(
getErrors(),
getWarnings(),
this.variableMap,
this.propertyMap,
this.anonymousFunctionNameMap,
this.stringMap,
this.sourceMap,
this.externExports,
this.cssNames,
this.idGeneratorMap,
transpiledFiles);
} }
|
public class class_name {
@Override
public void addListener(final WorkerListener listener, final WorkerEvent... events) {
if (listener != null) {
for (final WorkerEvent event : events) {
final ConcurrentSet<WorkerListener> listeners = this.eventListenerMap.get(event);
if (listeners != null) {
listeners.add(listener);
}
}
}
} }
|
public class class_name {
@Override
public void addListener(final WorkerListener listener, final WorkerEvent... events) {
if (listener != null) {
for (final WorkerEvent event : events) {
final ConcurrentSet<WorkerListener> listeners = this.eventListenerMap.get(event);
if (listeners != null) {
listeners.add(listener); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public static final Path resolveSecurely(Path rootPath, String path) {
Path resolvedPath;
if(path == null || path.isEmpty()) {
resolvedPath = rootPath.normalize();
} else {
String relativePath = removeSuperflousSlashes(path);
resolvedPath = rootPath.resolve(relativePath).normalize();
}
if(!resolvedPath.startsWith(rootPath)) {
throw DeploymentRepositoryLogger.ROOT_LOGGER.forbiddenPath(path);
}
return resolvedPath;
} }
|
public class class_name {
public static final Path resolveSecurely(Path rootPath, String path) {
Path resolvedPath;
if(path == null || path.isEmpty()) {
resolvedPath = rootPath.normalize(); // depends on control dependency: [if], data = [none]
} else {
String relativePath = removeSuperflousSlashes(path);
resolvedPath = rootPath.resolve(relativePath).normalize(); // depends on control dependency: [if], data = [none]
}
if(!resolvedPath.startsWith(rootPath)) {
throw DeploymentRepositoryLogger.ROOT_LOGGER.forbiddenPath(path);
}
return resolvedPath;
} }
|
public class class_name {
public boolean hasDeclaredFieldAnnotation(final String fieldAnnotationName) {
for (final FieldInfo fi : getDeclaredFieldInfo()) {
if (fi.hasAnnotation(fieldAnnotationName)) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean hasDeclaredFieldAnnotation(final String fieldAnnotationName) {
for (final FieldInfo fi : getDeclaredFieldInfo()) {
if (fi.hasAnnotation(fieldAnnotationName)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
private void writeBytesSlow(final byte[] bytes, int off, int len)
{
while (len > 0)
{
final Block block = current;
final int amount = Math.min(len, block.remaining());
System.arraycopy(bytes, off, block.data, block.limit, amount);
block.limit += amount;
off += amount;
len -= amount;
if (block.remaining() == 0)
{
if (index == blocks.size() - 1)
{
allocateNewBlock();
}
index++;
current = blocks.get(index);
}
}
} }
|
public class class_name {
private void writeBytesSlow(final byte[] bytes, int off, int len)
{
while (len > 0)
{
final Block block = current;
final int amount = Math.min(len, block.remaining());
System.arraycopy(bytes, off, block.data, block.limit, amount); // depends on control dependency: [while], data = [none]
block.limit += amount; // depends on control dependency: [while], data = [none]
off += amount; // depends on control dependency: [while], data = [none]
len -= amount; // depends on control dependency: [while], data = [none]
if (block.remaining() == 0)
{
if (index == blocks.size() - 1)
{
allocateNewBlock(); // depends on control dependency: [if], data = [none]
}
index++; // depends on control dependency: [if], data = [none]
current = blocks.get(index); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void show() {
if (mAnchorViewRef.get() != null) {
mPopupContent = new PopupContentView(mContext);
TextView body = (TextView) mPopupContent.findViewById(
R.id.com_facebook_tooltip_bubble_view_text_body);
body.setText(mText);
if (mStyle == Style.BLUE) {
mPopupContent.bodyFrame.setBackgroundResource(
R.drawable.com_facebook_tooltip_blue_background);
mPopupContent.bottomArrow.setImageResource(
R.drawable.com_facebook_tooltip_blue_bottomnub);
mPopupContent.topArrow.setImageResource(
R.drawable.com_facebook_tooltip_blue_topnub);
mPopupContent.xOut.setImageResource(R.drawable.com_facebook_tooltip_blue_xout);
} else {
mPopupContent.bodyFrame.setBackgroundResource(
R.drawable.com_facebook_tooltip_black_background);
mPopupContent.bottomArrow.setImageResource(
R.drawable.com_facebook_tooltip_black_bottomnub);
mPopupContent.topArrow.setImageResource(
R.drawable.com_facebook_tooltip_black_topnub);
mPopupContent.xOut.setImageResource(R.drawable.com_facebook_tooltip_black_xout);
}
final Window window = ((Activity) mContext).getWindow();
final View decorView = window.getDecorView();
final int decorWidth = decorView.getWidth();
final int decorHeight = decorView.getHeight();
registerObserver();
mPopupContent.onMeasure(
View.MeasureSpec.makeMeasureSpec(decorWidth, View.MeasureSpec.AT_MOST),
View.MeasureSpec.makeMeasureSpec(decorHeight, View.MeasureSpec.AT_MOST));
mPopupWindow = new PopupWindow(
mPopupContent,
mPopupContent.getMeasuredWidth(),
mPopupContent.getMeasuredHeight());
mPopupWindow.showAsDropDown(mAnchorViewRef.get());
updateArrows();
if (mNuxDisplayTime > 0) {
mPopupContent.postDelayed(new Runnable() {
@Override
public void run() {
dismiss();
}
}, mNuxDisplayTime);
}
mPopupWindow.setTouchable(true);
mPopupContent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
} }
|
public class class_name {
public void show() {
if (mAnchorViewRef.get() != null) {
mPopupContent = new PopupContentView(mContext); // depends on control dependency: [if], data = [none]
TextView body = (TextView) mPopupContent.findViewById(
R.id.com_facebook_tooltip_bubble_view_text_body);
body.setText(mText); // depends on control dependency: [if], data = [none]
if (mStyle == Style.BLUE) {
mPopupContent.bodyFrame.setBackgroundResource(
R.drawable.com_facebook_tooltip_blue_background); // depends on control dependency: [if], data = [none]
mPopupContent.bottomArrow.setImageResource(
R.drawable.com_facebook_tooltip_blue_bottomnub); // depends on control dependency: [if], data = [none]
mPopupContent.topArrow.setImageResource(
R.drawable.com_facebook_tooltip_blue_topnub); // depends on control dependency: [if], data = [none]
mPopupContent.xOut.setImageResource(R.drawable.com_facebook_tooltip_blue_xout); // depends on control dependency: [if], data = [none]
} else {
mPopupContent.bodyFrame.setBackgroundResource(
R.drawable.com_facebook_tooltip_black_background); // depends on control dependency: [if], data = [none]
mPopupContent.bottomArrow.setImageResource(
R.drawable.com_facebook_tooltip_black_bottomnub); // depends on control dependency: [if], data = [none]
mPopupContent.topArrow.setImageResource(
R.drawable.com_facebook_tooltip_black_topnub); // depends on control dependency: [if], data = [none]
mPopupContent.xOut.setImageResource(R.drawable.com_facebook_tooltip_black_xout); // depends on control dependency: [if], data = [none]
}
final Window window = ((Activity) mContext).getWindow();
final View decorView = window.getDecorView();
final int decorWidth = decorView.getWidth();
final int decorHeight = decorView.getHeight();
registerObserver(); // depends on control dependency: [if], data = [none]
mPopupContent.onMeasure(
View.MeasureSpec.makeMeasureSpec(decorWidth, View.MeasureSpec.AT_MOST),
View.MeasureSpec.makeMeasureSpec(decorHeight, View.MeasureSpec.AT_MOST)); // depends on control dependency: [if], data = [none]
mPopupWindow = new PopupWindow(
mPopupContent,
mPopupContent.getMeasuredWidth(),
mPopupContent.getMeasuredHeight()); // depends on control dependency: [if], data = [none]
mPopupWindow.showAsDropDown(mAnchorViewRef.get()); // depends on control dependency: [if], data = [(mAnchorViewRef.get()]
updateArrows(); // depends on control dependency: [if], data = [none]
if (mNuxDisplayTime > 0) {
mPopupContent.postDelayed(new Runnable() {
@Override
public void run() {
dismiss();
}
}, mNuxDisplayTime); // depends on control dependency: [if], data = [none]
}
mPopupWindow.setTouchable(true); // depends on control dependency: [if], data = [none]
mPopupContent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
}); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@ConditionalOnClass({Pcap.class, Inet4Address.class, Context.class})
//@ConditionalOnBean({Pcap.Builder.class, Inet4Address.class})
@Bean(CONTEXT_BEAN_NAME)
public Context context(@Qualifier(PCAP_BUILDER_BEAN_NAME) Pcap.Builder builder,
@Qualifier(NETMASK_BEAN_NAME) Inet4Address netmask) {
switch (properties.getPcapType()) {
case DEAD:
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Opening pcap dead handler : {}", builder);
}
builder.pcapType(Pcap.PcapType.DEAD);
break;
case OFFLINE:
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Opening pcap offline hadler : {}", builder);
}
builder.pcapType(Pcap.PcapType.OFFLINE);
break;
default:
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Opening pcap live hadler : {}", builder);
}
builder.pcapType(Pcap.PcapType.LIVE);
break;
}
Application.run(applicationName, applicationDisplayName, applicationVersion, builder);
Context context = Application.getApplicationContext();
if (properties.getFilter() != null) {
if (context.pcapCompile(properties.getFilter(),
properties.getBpfCompileMode(),
netmask.toInt()) == PcapCode.PCAP_OK) {
if (context.pcapSetFilter() != PcapCode.PCAP_OK) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn(context.pcapGetErr());
}
} else {
LOGGER.debug("Filter \'{}\' has been applied.", this.properties.getFilter());
}
} else {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn(context.pcapGetErr());
}
}
} else {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("No filter has been applied.");
}
}
return context;
} }
|
public class class_name {
@ConditionalOnClass({Pcap.class, Inet4Address.class, Context.class})
//@ConditionalOnBean({Pcap.Builder.class, Inet4Address.class})
@Bean(CONTEXT_BEAN_NAME)
public Context context(@Qualifier(PCAP_BUILDER_BEAN_NAME) Pcap.Builder builder,
@Qualifier(NETMASK_BEAN_NAME) Inet4Address netmask) {
switch (properties.getPcapType()) {
case DEAD:
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Opening pcap dead handler : {}", builder); // depends on control dependency: [if], data = [none]
}
builder.pcapType(Pcap.PcapType.DEAD);
break;
case OFFLINE:
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Opening pcap offline hadler : {}", builder); // depends on control dependency: [if], data = [none]
}
builder.pcapType(Pcap.PcapType.OFFLINE);
break;
default:
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Opening pcap live hadler : {}", builder); // depends on control dependency: [if], data = [none]
}
builder.pcapType(Pcap.PcapType.LIVE);
break;
}
Application.run(applicationName, applicationDisplayName, applicationVersion, builder);
Context context = Application.getApplicationContext();
if (properties.getFilter() != null) {
if (context.pcapCompile(properties.getFilter(),
properties.getBpfCompileMode(),
netmask.toInt()) == PcapCode.PCAP_OK) {
if (context.pcapSetFilter() != PcapCode.PCAP_OK) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn(context.pcapGetErr()); // depends on control dependency: [if], data = [none]
}
} else {
LOGGER.debug("Filter \'{}\' has been applied.", this.properties.getFilter()); // depends on control dependency: [if], data = [none]
}
} else {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn(context.pcapGetErr()); // depends on control dependency: [if], data = [none]
}
}
} else {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("No filter has been applied."); // depends on control dependency: [if], data = [none]
}
}
return context;
} }
|
public class class_name {
public static String getLabel(Language lang, String section, String idInSection) {
if (idInSection==null || "".equals(idInSection)){
log.warn("Empty label for section:"+section+" and lang:"+lang);
return "";
} else if (lang.isDebug()){
return lang.getLanguageId()+"|"+idInSection+"|"+section;
} else {
return connector.i18nLabel(lang, section, idInSection);
}
} }
|
public class class_name {
public static String getLabel(Language lang, String section, String idInSection) {
if (idInSection==null || "".equals(idInSection)){
log.warn("Empty label for section:"+section+" and lang:"+lang); // depends on control dependency: [if], data = [none]
return ""; // depends on control dependency: [if], data = [none]
} else if (lang.isDebug()){
return lang.getLanguageId()+"|"+idInSection+"|"+section; // depends on control dependency: [if], data = [none]
} else {
return connector.i18nLabel(lang, section, idInSection); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void sendRequest(String username, String servicename,
String methodname, byte[] requestdata) throws SshException {
ByteArrayWriter msg = new ByteArrayWriter();
try {
msg.write(SSH_MSG_USERAUTH_REQUEST);
msg.writeString(username);
msg.writeString(servicename);
msg.writeString(methodname);
if (requestdata != null) {
msg.write(requestdata);
}
transport.sendMessage(msg.toByteArray(), true);
} catch (IOException ex) {
throw new SshException(ex, SshException.INTERNAL_ERROR);
} finally {
try {
msg.close();
} catch (IOException e) {
}
}
} }
|
public class class_name {
public void sendRequest(String username, String servicename,
String methodname, byte[] requestdata) throws SshException {
ByteArrayWriter msg = new ByteArrayWriter();
try {
msg.write(SSH_MSG_USERAUTH_REQUEST);
msg.writeString(username);
msg.writeString(servicename);
msg.writeString(methodname);
if (requestdata != null) {
msg.write(requestdata); // depends on control dependency: [if], data = [(requestdata]
}
transport.sendMessage(msg.toByteArray(), true);
} catch (IOException ex) {
throw new SshException(ex, SshException.INTERNAL_ERROR);
} finally {
try {
msg.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static void outputResultTreeFragment(
SerializationHandler handler,
XObject obj,
XPathContext support)
throws org.xml.sax.SAXException
{
int doc = obj.rtf();
DTM dtm = support.getDTM(doc);
if (null != dtm)
{
for (int n = dtm.getFirstChild(doc);
DTM.NULL != n;
n = dtm.getNextSibling(n))
{
handler.flushPending();
// I think. . . . This used to have a (true) arg
// to flush prefixes, will that cause problems ???
if (dtm.getNodeType(n) == DTM.ELEMENT_NODE
&& dtm.getNamespaceURI(n) == null)
handler.startPrefixMapping("", "");
dtm.dispatchToEvents(n, handler);
}
}
} }
|
public class class_name {
public static void outputResultTreeFragment(
SerializationHandler handler,
XObject obj,
XPathContext support)
throws org.xml.sax.SAXException
{
int doc = obj.rtf();
DTM dtm = support.getDTM(doc);
if (null != dtm)
{
for (int n = dtm.getFirstChild(doc);
DTM.NULL != n;
n = dtm.getNextSibling(n))
{
handler.flushPending(); // depends on control dependency: [for], data = [none]
// I think. . . . This used to have a (true) arg
// to flush prefixes, will that cause problems ???
if (dtm.getNodeType(n) == DTM.ELEMENT_NODE
&& dtm.getNamespaceURI(n) == null)
handler.startPrefixMapping("", "");
dtm.dispatchToEvents(n, handler); // depends on control dependency: [for], data = [n]
}
}
} }
|
public class class_name {
@Override
public GeneratedCode generate(ClassTemplateSpec templateSpec) {
String code;
SwiftProperties swiftProperties = globalConfig.lookupSwiftProperties(templateSpec);
if (swiftProperties.omit) return null;
SwiftSyntax syntax = new SwiftSyntax(templateSpec, swiftProperties, globalConfig);
SwiftyJSON swifty = new SwiftyJSON(syntax);
try {
if (templateSpec instanceof RecordTemplateSpec) {
code = engine.render("rythm-swift/record.txt", templateSpec, syntax, swifty);
} else if (templateSpec instanceof EnumTemplateSpec) {
code = engine.render("rythm-swift/enum.txt", templateSpec);
} else if (templateSpec instanceof UnionTemplateSpec) {
code = engine.render("rythm-swift/union.txt", templateSpec, syntax, swifty);
} else {
return null; // Indicates that we are declining to generate code for the type (e.g. map or array)
}
} catch (RythmException e) {
throw new RuntimeException(
"Internal error in generator while processing " + templateSpec.getFullName(), e);
}
SwiftCompilationUnit compilationUnit =
new SwiftCompilationUnit(
templateSpec.getClassName(), "");
code = formatter.format(code);
return new GeneratedCode(compilationUnit, code);
} }
|
public class class_name {
@Override
public GeneratedCode generate(ClassTemplateSpec templateSpec) {
String code;
SwiftProperties swiftProperties = globalConfig.lookupSwiftProperties(templateSpec);
if (swiftProperties.omit) return null;
SwiftSyntax syntax = new SwiftSyntax(templateSpec, swiftProperties, globalConfig);
SwiftyJSON swifty = new SwiftyJSON(syntax);
try {
if (templateSpec instanceof RecordTemplateSpec) {
code = engine.render("rythm-swift/record.txt", templateSpec, syntax, swifty); // depends on control dependency: [if], data = [none]
} else if (templateSpec instanceof EnumTemplateSpec) {
code = engine.render("rythm-swift/enum.txt", templateSpec); // depends on control dependency: [if], data = [none]
} else if (templateSpec instanceof UnionTemplateSpec) {
code = engine.render("rythm-swift/union.txt", templateSpec, syntax, swifty); // depends on control dependency: [if], data = [none]
} else {
return null; // Indicates that we are declining to generate code for the type (e.g. map or array) // depends on control dependency: [if], data = [none]
}
} catch (RythmException e) {
throw new RuntimeException(
"Internal error in generator while processing " + templateSpec.getFullName(), e);
} // depends on control dependency: [catch], data = [none]
SwiftCompilationUnit compilationUnit =
new SwiftCompilationUnit(
templateSpec.getClassName(), "");
code = formatter.format(code);
return new GeneratedCode(compilationUnit, code);
} }
|
public class class_name {
public void toSrt(Path srtFile) {
try (FileOutputStream fos = new FileOutputStream(srtFile.toFile());
OutputStreamWriter osw = new OutputStreamWriter(fos, Charset.forName("UTF-8"));
PrintWriter writer = new PrintWriter(osw)) {
long counter = 1;
for (Subtitle title : subtitleList) {
writer.println(counter);
writer.println(srtFormat.format(title.begin) + " --> " + srtFormat.format(title.end));
for (StyledString entry : title.listOfStrings) {
if (!entry.color.isEmpty()) {
writer.print("<font color=\"" + entry.color + "\">");
}
writer.print(entry.text);
if (!entry.color.isEmpty()) {
writer.print("</font>");
}
writer.println();
}
writer.println("");
counter++;
}
} catch (Exception ex) {
Log.errorLog(201036470, ex, "File: " + srtFile);
}
} }
|
public class class_name {
public void toSrt(Path srtFile) {
try (FileOutputStream fos = new FileOutputStream(srtFile.toFile());
OutputStreamWriter osw = new OutputStreamWriter(fos, Charset.forName("UTF-8"));
PrintWriter writer = new PrintWriter(osw)) {
long counter = 1;
for (Subtitle title : subtitleList) {
writer.println(counter); // depends on control dependency: [for], data = [none]
writer.println(srtFormat.format(title.begin) + " --> " + srtFormat.format(title.end)); // depends on control dependency: [for], data = [title]
for (StyledString entry : title.listOfStrings) {
if (!entry.color.isEmpty()) {
writer.print("<font color=\"" + entry.color + "\">"); // depends on control dependency: [if], data = [none]
}
writer.print(entry.text); // depends on control dependency: [for], data = [entry]
if (!entry.color.isEmpty()) {
writer.print("</font>"); // depends on control dependency: [if], data = [none]
}
writer.println(); // depends on control dependency: [for], data = [none]
}
writer.println(""); // depends on control dependency: [for], data = [none]
counter++; // depends on control dependency: [for], data = [none]
}
} catch (Exception ex) {
Log.errorLog(201036470, ex, "File: " + srtFile);
}
} }
|
public class class_name {
private void fillMethods(final SQLiteDaoDefinition currentDaoDefinition, Element daoElement) {
final One<Boolean> methodWithAnnotation=new One<Boolean>(false);
// create method for dao
SqlBuilderHelper.forEachMethods((TypeElement) daoElement, new MethodFoundListener() {
@Override
public void onMethod(ExecutableElement element) {
if (excludedMethods.contains(element.getSimpleName().toString()))
return;
methodWithAnnotation.value0=false;
final List<ModelAnnotation> annotationList = new ArrayList<>();
// optional annotations
final List<ModelAnnotation> supportAnnotationList = new ArrayList<>();
AnnotationUtility.forEachAnnotations(element, new AnnotationFoundListener() {
@Override
public void onAcceptAnnotation(Element element, String annotationClassName,
Map<String, String> attributes) {
if // @formatter:off
(annotationClassName.equals(BindSqlInsert.class.getCanonicalName())
|| annotationClassName.equals(BindSqlUpdate.class.getCanonicalName())
|| annotationClassName.equals(BindSqlDelete.class.getCanonicalName())
|| annotationClassName.equals(BindSqlSelect.class.getCanonicalName())
|| annotationClassName.equals(BindContentProviderEntry.class.getCanonicalName()))
// @formatter:on
{
if (!annotationClassName.equals(BindContentProviderEntry.class.getCanonicalName())) {
methodWithAnnotation.value0=true;
}
ModelAnnotation annotation = new ModelAnnotation(annotationClassName, attributes);
annotationList.add(annotation);
}
// we don't insert annotation
}
});
annotationList.addAll(supportAnnotationList);
final SQLiteModelMethod currentMethod = new SQLiteModelMethod(currentDaoDefinition, element,
annotationList);
AssertKripton.assertTrueOrInvalidMethodSignException(methodWithAnnotation.value0, currentMethod, "method must be annotated with @%s, @%s, @%s or @%s",
BindSqlSelect.class.getSimpleName(),
BindSqlInsert.class.getSimpleName(),
BindSqlUpdate.class.getSimpleName(),
BindSqlDelete.class.getSimpleName());
// annotated", currentDaoDefinition.getName(),
// element.getSimpleName());
addWithCheckMethod(currentDaoDefinition, currentMethod);
}
private void addWithCheckMethod(SQLiteDaoDefinition currentDaoDefinition, SQLiteModelMethod newMethod) {
SQLiteModelMethod oldMethod = currentDaoDefinition.findPropertyByName(newMethod.getName());
// ASSERT: same name and same number
if (oldMethod != null && oldMethod.getParameters().size() == newMethod.getParameters().size()) {
boolean sameParameters = true;
for (int i = 0; i < oldMethod.getParameters().size(); i++) {
if (!oldMethod.getParameters().get(i).value1.equals(newMethod.getParameters().get(i).value1)) {
sameParameters = false;
break;
}
}
AssertKripton.failWithInvalidMethodSignException(sameParameters, newMethod,
"conflict between generated method and declared method.");
}
// add method
currentDaoDefinition.add(newMethod);
}
});
} }
|
public class class_name {
private void fillMethods(final SQLiteDaoDefinition currentDaoDefinition, Element daoElement) {
final One<Boolean> methodWithAnnotation=new One<Boolean>(false);
// create method for dao
SqlBuilderHelper.forEachMethods((TypeElement) daoElement, new MethodFoundListener() {
@Override
public void onMethod(ExecutableElement element) {
if (excludedMethods.contains(element.getSimpleName().toString()))
return;
methodWithAnnotation.value0=false;
final List<ModelAnnotation> annotationList = new ArrayList<>();
// optional annotations
final List<ModelAnnotation> supportAnnotationList = new ArrayList<>();
AnnotationUtility.forEachAnnotations(element, new AnnotationFoundListener() {
@Override
public void onAcceptAnnotation(Element element, String annotationClassName,
Map<String, String> attributes) {
if // @formatter:off
(annotationClassName.equals(BindSqlInsert.class.getCanonicalName())
|| annotationClassName.equals(BindSqlUpdate.class.getCanonicalName())
|| annotationClassName.equals(BindSqlDelete.class.getCanonicalName())
|| annotationClassName.equals(BindSqlSelect.class.getCanonicalName())
|| annotationClassName.equals(BindContentProviderEntry.class.getCanonicalName()))
// @formatter:on
{
if (!annotationClassName.equals(BindContentProviderEntry.class.getCanonicalName())) {
methodWithAnnotation.value0=true; // depends on control dependency: [if], data = [none]
}
ModelAnnotation annotation = new ModelAnnotation(annotationClassName, attributes);
annotationList.add(annotation); // depends on control dependency: [if], data = [none]
}
// we don't insert annotation
}
});
annotationList.addAll(supportAnnotationList);
final SQLiteModelMethod currentMethod = new SQLiteModelMethod(currentDaoDefinition, element,
annotationList);
AssertKripton.assertTrueOrInvalidMethodSignException(methodWithAnnotation.value0, currentMethod, "method must be annotated with @%s, @%s, @%s or @%s",
BindSqlSelect.class.getSimpleName(),
BindSqlInsert.class.getSimpleName(),
BindSqlUpdate.class.getSimpleName(),
BindSqlDelete.class.getSimpleName());
// annotated", currentDaoDefinition.getName(),
// element.getSimpleName());
addWithCheckMethod(currentDaoDefinition, currentMethod);
}
private void addWithCheckMethod(SQLiteDaoDefinition currentDaoDefinition, SQLiteModelMethod newMethod) {
SQLiteModelMethod oldMethod = currentDaoDefinition.findPropertyByName(newMethod.getName());
// ASSERT: same name and same number
if (oldMethod != null && oldMethod.getParameters().size() == newMethod.getParameters().size()) {
boolean sameParameters = true;
for (int i = 0; i < oldMethod.getParameters().size(); i++) {
if (!oldMethod.getParameters().get(i).value1.equals(newMethod.getParameters().get(i).value1)) {
sameParameters = false; // depends on control dependency: [if], data = [none]
break;
}
}
AssertKripton.failWithInvalidMethodSignException(sameParameters, newMethod,
"conflict between generated method and declared method."); // depends on control dependency: [if], data = [none]
}
// add method
currentDaoDefinition.add(newMethod);
}
});
} }
|
public class class_name {
public static void init(Map<String, ?> conf) {
if (null != engine) throw new IllegalStateException("Rythm is already initialized");
engine = new RythmEngine(conf);
// See #296
ShutdownService service = getShutdownService(engine.conf().gae());
service.setShutdown(new Runnable() {
@Override
public void run() {
if (null != engine) {
engine.shutdown();
}
}
});
engine.setShutdownListener(new RythmEngine.IShutdownListener() {
@Override
public void onShutdown() {
Rythm.engine = null;
}
});
} }
|
public class class_name {
public static void init(Map<String, ?> conf) {
if (null != engine) throw new IllegalStateException("Rythm is already initialized");
engine = new RythmEngine(conf);
// See #296
ShutdownService service = getShutdownService(engine.conf().gae());
service.setShutdown(new Runnable() {
@Override
public void run() {
if (null != engine) {
engine.shutdown(); // depends on control dependency: [if], data = [none]
}
}
});
engine.setShutdownListener(new RythmEngine.IShutdownListener() {
@Override
public void onShutdown() {
Rythm.engine = null;
}
});
} }
|
public class class_name {
private boolean computeScore(Sentence sentence, SmartForest<Double> forest, boolean offset) {
SmartGetWord<Double> sgw = new SmartGetWord<Double>(forest, sentence.value.toLowerCase());
String name = null;
boolean flag = false;
while ((name = sgw.getFrontWords()) != null) {
flag = true;
sentence.updateScore(name, sgw.getParam());
if (offset) {
Triplet<Integer, Integer, Double> triplet = new Triplet<Integer, Integer, Double>(sgw.offe, sgw.offe+name.length(), sgw.getParam());
sentence.offset.add(triplet);
}
}
if (sentence.score == 0) {
sentence.score = sentence.value.length() * -0.005;
} else {
sentence.score /= Math.log(sentence.value.length() + 3);
}
return flag;
} }
|
public class class_name {
private boolean computeScore(Sentence sentence, SmartForest<Double> forest, boolean offset) {
SmartGetWord<Double> sgw = new SmartGetWord<Double>(forest, sentence.value.toLowerCase());
String name = null;
boolean flag = false;
while ((name = sgw.getFrontWords()) != null) {
flag = true; // depends on control dependency: [while], data = [none]
sentence.updateScore(name, sgw.getParam()); // depends on control dependency: [while], data = [none]
if (offset) {
Triplet<Integer, Integer, Double> triplet = new Triplet<Integer, Integer, Double>(sgw.offe, sgw.offe+name.length(), sgw.getParam());
sentence.offset.add(triplet); // depends on control dependency: [if], data = [none]
}
}
if (sentence.score == 0) {
sentence.score = sentence.value.length() * -0.005; // depends on control dependency: [if], data = [none]
} else {
sentence.score /= Math.log(sentence.value.length() + 3); // depends on control dependency: [if], data = [none]
}
return flag;
} }
|
public class class_name {
public static List<String> split(
final String str
)
{
String s = str;
if (s != null) {
s = s.trim();
}
List<String> list = new ArrayList<String>();
if (s == null || s.length() == 0) {
return list;
}
String[] tokens = s.split( "[ \t\n\r\f]" );
// NOTE: tokens[i] may be an empty string "".
// excludes empty strings.
for (String t : tokens) {
if (t.length() > 0) {
list.add( t );
}
}
return list;
} }
|
public class class_name {
public static List<String> split(
final String str
)
{
String s = str;
if (s != null) {
s = s.trim(); // depends on control dependency: [if], data = [none]
}
List<String> list = new ArrayList<String>();
if (s == null || s.length() == 0) {
return list; // depends on control dependency: [if], data = [none]
}
String[] tokens = s.split( "[ \t\n\r\f]" );
// NOTE: tokens[i] may be an empty string "".
// excludes empty strings.
for (String t : tokens) {
if (t.length() > 0) {
list.add( t ); // depends on control dependency: [if], data = [none]
}
}
return list;
} }
|
public class class_name {
private int computeMemoryPercentUsed(Object cache) {
final int maxElementsInMemory = ((Ehcache) cache).getCacheConfiguration()
.getMaxElementsInMemory();
if (maxElementsInMemory == 0) {
// maxElementsInMemory peut être 0 (sans limite), cf issue 73
return -1;
}
return (int) (100 * inMemoryObjectCount / maxElementsInMemory);
} }
|
public class class_name {
private int computeMemoryPercentUsed(Object cache) {
final int maxElementsInMemory = ((Ehcache) cache).getCacheConfiguration()
.getMaxElementsInMemory();
if (maxElementsInMemory == 0) {
// maxElementsInMemory peut être 0 (sans limite), cf issue 73
return -1;
// depends on control dependency: [if], data = [none]
}
return (int) (100 * inMemoryObjectCount / maxElementsInMemory);
} }
|
public class class_name {
public String getParentXPath() {
Iterator<Level> levelIterator = path.descendingIterator();
if (levelIterator.hasNext()) {
levelIterator.next();
}
return getXPath(levelIterator);
} }
|
public class class_name {
public String getParentXPath() {
Iterator<Level> levelIterator = path.descendingIterator();
if (levelIterator.hasNext()) {
levelIterator.next(); // depends on control dependency: [if], data = [none]
}
return getXPath(levelIterator);
} }
|
public class class_name {
public AccessToken blockingIssueAccessToken(FullHttpRequest req) throws OAuthException {
TokenRequest tokenRequest = TokenRequest.create(req);
tokenRequest.validate();
// check valid client_id, client_secret and status of the client app should be active
if (!isActiveClient(tokenRequest.getClientId(), tokenRequest.getClientSecret()).blockingGet()) {
throw new OAuthException(ResponseBuilder.INVALID_CLIENT_CREDENTIALS, HttpResponseStatus.BAD_REQUEST);
}
AccessToken accessToken = null;
if (TokenRequest.AUTHORIZATION_CODE.equals(tokenRequest.getGrantType())) {
AuthCode authCode = findAuthCode(tokenRequest).blockingGet();
// TODO: REVISIT: Move client_id check to db query
if (authCode != null) {
if (!tokenRequest.getClientId().equals(authCode.getClientId())) {
throw new OAuthException(ResponseBuilder.INVALID_CLIENT_ID, HttpResponseStatus.BAD_REQUEST);
}
if (authCode.getRedirectUri() != null
&& !tokenRequest.getRedirectUri().equals(authCode.getRedirectUri())) {
throw new OAuthException(ResponseBuilder.INVALID_REDIRECT_URI, HttpResponseStatus.BAD_REQUEST);
} else {
// invalidate the auth code
db.updateAuthCodeValidStatus(authCode.getCode(), false).blockingAwait();
accessToken = new AccessToken(TOKEN_TYPE_BEARER, getExpiresIn(TokenRequest.PASSWORD, authCode.getScope()),
authCode.getScope(), getExpiresIn(TokenRequest.REFRESH_TOKEN, authCode.getScope()));
accessToken.setUserId(authCode.getUserId());
accessToken.setClientId(authCode.getClientId());
accessToken.setCodeId(authCode.getId());
db.storeAccessToken(accessToken).blockingAwait();
}
} else {
throw new OAuthException(ResponseBuilder.INVALID_AUTH_CODE, HttpResponseStatus.BAD_REQUEST);
}
} else if (TokenRequest.REFRESH_TOKEN.equals(tokenRequest.getGrantType())) {
accessToken = db.findAccessTokenByRefreshToken(tokenRequest.getRefreshToken(), tokenRequest.getClientId()).blockingGet();
if (accessToken != null) {
if (!accessToken.refreshTokenExpired()) {
String validScope;
if (tokenRequest.getScope() != null) {
if (scopeService.scopeAllowed(tokenRequest.getScope(), accessToken.getScope())) {
validScope = tokenRequest.getScope();
} else {
throw new OAuthException(ResponseBuilder.SCOPE_NOK_MESSAGE, HttpResponseStatus.BAD_REQUEST);
}
} else {
validScope = accessToken.getScope();
}
db.updateAccessTokenValidStatus(accessToken.getToken(), false).blockingAwait();
AccessToken newAccessToken = new AccessToken(TOKEN_TYPE_BEARER, getExpiresIn(TokenRequest.PASSWORD,
validScope), validScope, accessToken.getRefreshToken(), accessToken.getRefreshExpiresIn());
newAccessToken.setUserId(accessToken.getUserId());
newAccessToken.setDetails(accessToken.getDetails());
newAccessToken.setClientId(accessToken.getClientId());
db.storeAccessToken(newAccessToken).blockingAwait();
db.removeAccessToken(accessToken.getToken()).blockingAwait();
return newAccessToken;
} else {
db.removeAccessToken(accessToken.getToken()).blockingAwait();
throw new OAuthException(ResponseBuilder.INVALID_REFRESH_TOKEN, HttpResponseStatus.BAD_REQUEST);
}
} else {
throw new OAuthException(ResponseBuilder.INVALID_REFRESH_TOKEN, HttpResponseStatus.BAD_REQUEST);
}
} else if (TokenRequest.CLIENT_CREDENTIALS.equals(tokenRequest.getGrantType())) {
ClientCredentials clientCredentials = db.findClientCredentials(tokenRequest.getClientId()).blockingGet();
String scope = scopeService.getValidScopeByScope(tokenRequest.getScope(), clientCredentials.getScope());
if (scope == null) {
throw new OAuthException(ResponseBuilder.SCOPE_NOK_MESSAGE, HttpResponseStatus.BAD_REQUEST);
}
accessToken = new AccessToken(TOKEN_TYPE_BEARER, getExpiresIn(TokenRequest.CLIENT_CREDENTIALS, scope),
scope, false, null);
accessToken.setClientId(tokenRequest.getClientId());
Map<String, String> applicationDetails = clientCredentials.getApplicationDetails();
if ((applicationDetails != null) && (applicationDetails.size() > 0)) {
accessToken.setDetails(applicationDetails); // For backward compatibility
accessToken.setApplicationDetails(applicationDetails);
}
db.storeAccessToken(accessToken).blockingAwait();
} else if (TokenRequest.PASSWORD.equals(tokenRequest.getGrantType())) {
ClientCredentials clientCredentials = db.findClientCredentials(tokenRequest.getClientId()).blockingGet();
String scope = scopeService.getValidScopeByScope(tokenRequest.getScope(), clientCredentials.getScope());
if (scope == null) {
throw new OAuthException(ResponseBuilder.SCOPE_NOK_MESSAGE, HttpResponseStatus.BAD_REQUEST);
}
try {
UserDetails userDetails = authenticateUser(tokenRequest.getUsername(), tokenRequest.getPassword(), req);
if (userDetails != null && userDetails.getUserId() != null) {
accessToken = new AccessToken(TOKEN_TYPE_BEARER, getExpiresIn(TokenRequest.PASSWORD, scope), scope,
getExpiresIn(TokenRequest.REFRESH_TOKEN, scope));
accessToken.setUserId(userDetails.getUserId());
accessToken.setDetails(userDetails.getDetails());
accessToken.setClientId(tokenRequest.getClientId());
accessToken.setApplicationDetails(clientCredentials.getApplicationDetails());
db.storeAccessToken(accessToken).blockingAwait();
} else {
throw new OAuthException(ResponseBuilder.INVALID_USERNAME_PASSWORD, HttpResponseStatus.UNAUTHORIZED);
}
} catch (AuthenticationException e) {
// in case some custom response should be returned other than HTTP 401
// for instance, if the user authentication requires more user details as a subsequent step
if (e.getResponse() != null) {
String responseContent = ((FullHttpResponse) (e.getResponse())).content().toString(CharsetUtil.UTF_8);
throw new OAuthException(e, responseContent, e.getResponse().getStatus());
} else {
LOG.error("Cannot authenticate user", e);
throw new OAuthException(e, ResponseBuilder.CANNOT_AUTHENTICATE_USER, HttpResponseStatus.UNAUTHORIZED); // NOSONAR
}
}
} else if (tokenRequest.getGrantType().equals(OAuthConfig.getCustomGrantType())) {
String scope = scopeService.getValidScope(tokenRequest.getScope(), tokenRequest.getClientId()).blockingGet();
if (scope == null) {
throw new OAuthException(ResponseBuilder.SCOPE_NOK_MESSAGE, HttpResponseStatus.BAD_REQUEST);
}
try {
accessToken = new AccessToken(TOKEN_TYPE_BEARER, getExpiresIn(TokenRequest.PASSWORD, scope), scope,
getExpiresIn(TokenRequest.REFRESH_TOKEN, scope));
accessToken.setClientId(tokenRequest.getClientId());
UserDetails userDetails = callCustomGrantTypeHandler(req);
if (userDetails != null && userDetails.getUserId() != null) {
accessToken.setUserId(userDetails.getUserId());
accessToken.setDetails(userDetails.getDetails());
}
db.storeAccessToken(accessToken).blockingAwait();
} catch (AuthenticationException e) {
LOG.error("Cannot authenticate user", e);
throw new OAuthException(e, ResponseBuilder.CANNOT_AUTHENTICATE_USER, HttpResponseStatus.UNAUTHORIZED);
}
}
return accessToken;
} }
|
public class class_name {
public AccessToken blockingIssueAccessToken(FullHttpRequest req) throws OAuthException {
TokenRequest tokenRequest = TokenRequest.create(req);
tokenRequest.validate();
// check valid client_id, client_secret and status of the client app should be active
if (!isActiveClient(tokenRequest.getClientId(), tokenRequest.getClientSecret()).blockingGet()) {
throw new OAuthException(ResponseBuilder.INVALID_CLIENT_CREDENTIALS, HttpResponseStatus.BAD_REQUEST);
}
AccessToken accessToken = null;
if (TokenRequest.AUTHORIZATION_CODE.equals(tokenRequest.getGrantType())) {
AuthCode authCode = findAuthCode(tokenRequest).blockingGet();
// TODO: REVISIT: Move client_id check to db query
if (authCode != null) {
if (!tokenRequest.getClientId().equals(authCode.getClientId())) {
throw new OAuthException(ResponseBuilder.INVALID_CLIENT_ID, HttpResponseStatus.BAD_REQUEST);
}
if (authCode.getRedirectUri() != null
&& !tokenRequest.getRedirectUri().equals(authCode.getRedirectUri())) {
throw new OAuthException(ResponseBuilder.INVALID_REDIRECT_URI, HttpResponseStatus.BAD_REQUEST);
} else {
// invalidate the auth code
db.updateAuthCodeValidStatus(authCode.getCode(), false).blockingAwait(); // depends on control dependency: [if], data = [none]
accessToken = new AccessToken(TOKEN_TYPE_BEARER, getExpiresIn(TokenRequest.PASSWORD, authCode.getScope()),
authCode.getScope(), getExpiresIn(TokenRequest.REFRESH_TOKEN, authCode.getScope())); // depends on control dependency: [if], data = [none]
accessToken.setUserId(authCode.getUserId()); // depends on control dependency: [if], data = [none]
accessToken.setClientId(authCode.getClientId()); // depends on control dependency: [if], data = [none]
accessToken.setCodeId(authCode.getId()); // depends on control dependency: [if], data = [none]
db.storeAccessToken(accessToken).blockingAwait(); // depends on control dependency: [if], data = [none]
}
} else {
throw new OAuthException(ResponseBuilder.INVALID_AUTH_CODE, HttpResponseStatus.BAD_REQUEST);
}
} else if (TokenRequest.REFRESH_TOKEN.equals(tokenRequest.getGrantType())) {
accessToken = db.findAccessTokenByRefreshToken(tokenRequest.getRefreshToken(), tokenRequest.getClientId()).blockingGet();
if (accessToken != null) {
if (!accessToken.refreshTokenExpired()) {
String validScope;
if (tokenRequest.getScope() != null) {
if (scopeService.scopeAllowed(tokenRequest.getScope(), accessToken.getScope())) {
validScope = tokenRequest.getScope(); // depends on control dependency: [if], data = [none]
} else {
throw new OAuthException(ResponseBuilder.SCOPE_NOK_MESSAGE, HttpResponseStatus.BAD_REQUEST);
}
} else {
validScope = accessToken.getScope(); // depends on control dependency: [if], data = [none]
}
db.updateAccessTokenValidStatus(accessToken.getToken(), false).blockingAwait(); // depends on control dependency: [if], data = [none]
AccessToken newAccessToken = new AccessToken(TOKEN_TYPE_BEARER, getExpiresIn(TokenRequest.PASSWORD,
validScope), validScope, accessToken.getRefreshToken(), accessToken.getRefreshExpiresIn());
newAccessToken.setUserId(accessToken.getUserId()); // depends on control dependency: [if], data = [none]
newAccessToken.setDetails(accessToken.getDetails()); // depends on control dependency: [if], data = [none]
newAccessToken.setClientId(accessToken.getClientId()); // depends on control dependency: [if], data = [none]
db.storeAccessToken(newAccessToken).blockingAwait(); // depends on control dependency: [if], data = [none]
db.removeAccessToken(accessToken.getToken()).blockingAwait(); // depends on control dependency: [if], data = [none]
return newAccessToken; // depends on control dependency: [if], data = [none]
} else {
db.removeAccessToken(accessToken.getToken()).blockingAwait(); // depends on control dependency: [if], data = [none]
throw new OAuthException(ResponseBuilder.INVALID_REFRESH_TOKEN, HttpResponseStatus.BAD_REQUEST);
}
} else {
throw new OAuthException(ResponseBuilder.INVALID_REFRESH_TOKEN, HttpResponseStatus.BAD_REQUEST);
}
} else if (TokenRequest.CLIENT_CREDENTIALS.equals(tokenRequest.getGrantType())) {
ClientCredentials clientCredentials = db.findClientCredentials(tokenRequest.getClientId()).blockingGet();
String scope = scopeService.getValidScopeByScope(tokenRequest.getScope(), clientCredentials.getScope());
if (scope == null) {
throw new OAuthException(ResponseBuilder.SCOPE_NOK_MESSAGE, HttpResponseStatus.BAD_REQUEST);
}
accessToken = new AccessToken(TOKEN_TYPE_BEARER, getExpiresIn(TokenRequest.CLIENT_CREDENTIALS, scope),
scope, false, null);
accessToken.setClientId(tokenRequest.getClientId());
Map<String, String> applicationDetails = clientCredentials.getApplicationDetails();
if ((applicationDetails != null) && (applicationDetails.size() > 0)) {
accessToken.setDetails(applicationDetails); // For backward compatibility // depends on control dependency: [if], data = [none]
accessToken.setApplicationDetails(applicationDetails); // depends on control dependency: [if], data = [none]
}
db.storeAccessToken(accessToken).blockingAwait();
} else if (TokenRequest.PASSWORD.equals(tokenRequest.getGrantType())) {
ClientCredentials clientCredentials = db.findClientCredentials(tokenRequest.getClientId()).blockingGet();
String scope = scopeService.getValidScopeByScope(tokenRequest.getScope(), clientCredentials.getScope());
if (scope == null) {
throw new OAuthException(ResponseBuilder.SCOPE_NOK_MESSAGE, HttpResponseStatus.BAD_REQUEST);
}
try {
UserDetails userDetails = authenticateUser(tokenRequest.getUsername(), tokenRequest.getPassword(), req);
if (userDetails != null && userDetails.getUserId() != null) {
accessToken = new AccessToken(TOKEN_TYPE_BEARER, getExpiresIn(TokenRequest.PASSWORD, scope), scope,
getExpiresIn(TokenRequest.REFRESH_TOKEN, scope)); // depends on control dependency: [if], data = [none]
accessToken.setUserId(userDetails.getUserId()); // depends on control dependency: [if], data = [(userDetails]
accessToken.setDetails(userDetails.getDetails()); // depends on control dependency: [if], data = [(userDetails]
accessToken.setClientId(tokenRequest.getClientId()); // depends on control dependency: [if], data = [none]
accessToken.setApplicationDetails(clientCredentials.getApplicationDetails()); // depends on control dependency: [if], data = [none]
db.storeAccessToken(accessToken).blockingAwait(); // depends on control dependency: [if], data = [none]
} else {
throw new OAuthException(ResponseBuilder.INVALID_USERNAME_PASSWORD, HttpResponseStatus.UNAUTHORIZED);
}
} catch (AuthenticationException e) {
// in case some custom response should be returned other than HTTP 401
// for instance, if the user authentication requires more user details as a subsequent step
if (e.getResponse() != null) {
String responseContent = ((FullHttpResponse) (e.getResponse())).content().toString(CharsetUtil.UTF_8);
throw new OAuthException(e, responseContent, e.getResponse().getStatus());
} else {
LOG.error("Cannot authenticate user", e); // depends on control dependency: [if], data = [none]
throw new OAuthException(e, ResponseBuilder.CANNOT_AUTHENTICATE_USER, HttpResponseStatus.UNAUTHORIZED); // NOSONAR
}
} // depends on control dependency: [catch], data = [none]
} else if (tokenRequest.getGrantType().equals(OAuthConfig.getCustomGrantType())) {
String scope = scopeService.getValidScope(tokenRequest.getScope(), tokenRequest.getClientId()).blockingGet();
if (scope == null) {
throw new OAuthException(ResponseBuilder.SCOPE_NOK_MESSAGE, HttpResponseStatus.BAD_REQUEST);
}
try {
accessToken = new AccessToken(TOKEN_TYPE_BEARER, getExpiresIn(TokenRequest.PASSWORD, scope), scope,
getExpiresIn(TokenRequest.REFRESH_TOKEN, scope)); // depends on control dependency: [try], data = [none]
accessToken.setClientId(tokenRequest.getClientId()); // depends on control dependency: [try], data = [none]
UserDetails userDetails = callCustomGrantTypeHandler(req);
if (userDetails != null && userDetails.getUserId() != null) {
accessToken.setUserId(userDetails.getUserId()); // depends on control dependency: [if], data = [(userDetails]
accessToken.setDetails(userDetails.getDetails()); // depends on control dependency: [if], data = [(userDetails]
}
db.storeAccessToken(accessToken).blockingAwait(); // depends on control dependency: [try], data = [none]
} catch (AuthenticationException e) {
LOG.error("Cannot authenticate user", e);
throw new OAuthException(e, ResponseBuilder.CANNOT_AUTHENTICATE_USER, HttpResponseStatus.UNAUTHORIZED);
} // depends on control dependency: [catch], data = [none]
}
return accessToken;
} }
|
public class class_name {
public void setIntents(java.util.Collection<Intent> intents) {
if (intents == null) {
this.intents = null;
return;
}
this.intents = new java.util.ArrayList<Intent>(intents);
} }
|
public class class_name {
public void setIntents(java.util.Collection<Intent> intents) {
if (intents == null) {
this.intents = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.intents = new java.util.ArrayList<Intent>(intents);
} }
|
public class class_name {
@Deprecated
@Override
public synchronized Facebook getFacebook(Context context) {
if(facebook == null) {
facebook = new Facebook(config.getProperty(SocializeConfig.FACEBOOK_APP_ID));
}
return facebook;
} }
|
public class class_name {
@Deprecated
@Override
public synchronized Facebook getFacebook(Context context) {
if(facebook == null) {
facebook = new Facebook(config.getProperty(SocializeConfig.FACEBOOK_APP_ID)); // depends on control dependency: [if], data = [none]
}
return facebook;
} }
|
public class class_name {
public DescribeRemediationConfigurationsResult withRemediationConfigurations(RemediationConfiguration... remediationConfigurations) {
if (this.remediationConfigurations == null) {
setRemediationConfigurations(new com.amazonaws.internal.SdkInternalList<RemediationConfiguration>(remediationConfigurations.length));
}
for (RemediationConfiguration ele : remediationConfigurations) {
this.remediationConfigurations.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeRemediationConfigurationsResult withRemediationConfigurations(RemediationConfiguration... remediationConfigurations) {
if (this.remediationConfigurations == null) {
setRemediationConfigurations(new com.amazonaws.internal.SdkInternalList<RemediationConfiguration>(remediationConfigurations.length)); // depends on control dependency: [if], data = [none]
}
for (RemediationConfiguration ele : remediationConfigurations) {
this.remediationConfigurations.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static String getCredentialStringOutput(HTTP http) {
if (http == null || !http.useCredentials()) {
return "";
}
StringBuilder credentials = new StringBuilder();
String uuid = getUUID();
credentials.append(ONCLICK_TOGGLE).append(uuid).append("\")'>Toggle Credentials</a> ");
credentials.append(SPAN_ID).append(uuid).append(DISPLAY_NONE);
credentials.append("<div><i>");
credentials.append("Username: ");
credentials.append(http.getUser());
credentials.append("</div><div>");
credentials.append("Password: ");
credentials.append(http.getPass());
credentials.append("</i></div>");
credentials.append(END_SPAN);
return credentials.toString();
} }
|
public class class_name {
public static String getCredentialStringOutput(HTTP http) {
if (http == null || !http.useCredentials()) {
return ""; // depends on control dependency: [if], data = [none]
}
StringBuilder credentials = new StringBuilder();
String uuid = getUUID();
credentials.append(ONCLICK_TOGGLE).append(uuid).append("\")'>Toggle Credentials</a> ");
credentials.append(SPAN_ID).append(uuid).append(DISPLAY_NONE);
credentials.append("<div><i>");
credentials.append("Username: ");
credentials.append(http.getUser());
credentials.append("</div><div>");
credentials.append("Password: ");
credentials.append(http.getPass());
credentials.append("</i></div>");
credentials.append(END_SPAN);
return credentials.toString();
} }
|
public class class_name {
@Override
public void visitConstantPool(ConstantPool obj) {
super.visitConstantPool(obj);
Constant[] constant_pool = obj.getConstantPool();
for (int i = 1; i < constant_pool.length; i++) {
constant_pool[i].accept(this);
byte tag = constant_pool[i].getTag();
if ((tag == Const.CONSTANT_Double) || (tag == Const.CONSTANT_Long)) {
i++;
}
}
} }
|
public class class_name {
@Override
public void visitConstantPool(ConstantPool obj) {
super.visitConstantPool(obj);
Constant[] constant_pool = obj.getConstantPool();
for (int i = 1; i < constant_pool.length; i++) {
constant_pool[i].accept(this); // depends on control dependency: [for], data = [i]
byte tag = constant_pool[i].getTag();
if ((tag == Const.CONSTANT_Double) || (tag == Const.CONSTANT_Long)) {
i++; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void setQueueUrls(java.util.Collection<String> queueUrls) {
if (queueUrls == null) {
this.queueUrls = null;
return;
}
this.queueUrls = new com.amazonaws.internal.SdkInternalList<String>(queueUrls);
} }
|
public class class_name {
public void setQueueUrls(java.util.Collection<String> queueUrls) {
if (queueUrls == null) {
this.queueUrls = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.queueUrls = new com.amazonaws.internal.SdkInternalList<String>(queueUrls);
} }
|
public class class_name {
public Double isValidSum(IMolecularFormula formula) {
double result = 1.0;
IMolecularFormula formulaWith = isValid(formula);
Map<Object, Object> properties = formulaWith.getProperties();
Iterator<IRule> iterRules = rules.iterator();
while (iterRules.hasNext()) {
result *= (Double) properties.get(iterRules.next().getClass());
}
return result;
} }
|
public class class_name {
public Double isValidSum(IMolecularFormula formula) {
double result = 1.0;
IMolecularFormula formulaWith = isValid(formula);
Map<Object, Object> properties = formulaWith.getProperties();
Iterator<IRule> iterRules = rules.iterator();
while (iterRules.hasNext()) {
result *= (Double) properties.get(iterRules.next().getClass()); // depends on control dependency: [while], data = [none]
}
return result;
} }
|
public class class_name {
public JdbcNeo4JDeepJobConfig<T> initialize(ExtractorConfig config) {
Map<String, Serializable> values = config.getValues();
if(values.get(JDBC_CONNECTION_URL) != null) {
connectionUrl(config.getString(JDBC_CONNECTION_URL));
}
if(values.get(JDBC_QUERY) != null) {
cypherQuery(config.getString(JDBC_QUERY));
}
super.initialize(config);
return this;
} }
|
public class class_name {
public JdbcNeo4JDeepJobConfig<T> initialize(ExtractorConfig config) {
Map<String, Serializable> values = config.getValues();
if(values.get(JDBC_CONNECTION_URL) != null) {
connectionUrl(config.getString(JDBC_CONNECTION_URL)); // depends on control dependency: [if], data = [none]
}
if(values.get(JDBC_QUERY) != null) {
cypherQuery(config.getString(JDBC_QUERY)); // depends on control dependency: [if], data = [none]
}
super.initialize(config);
return this;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> Paging<T> flattenPaging(Collection<?> collectionOfPaging, PageCriteria pageCriteria,
Comparator<T> sorter, BooleanExpression<T> filter)
{
if (collectionOfPaging == null || collectionOfPaging.isEmpty())
return null;
Paging<T> pagingResults = null;
if (sorter != null)
{
// Create tree set based paging
TreeSet<T> treeSet = new TreeSet<T>(sorter);
pagingResults = new PagingCollection<T>(treeSet, pageCriteria);
}
// Add all to an aggregated collection
Paging<T> paging = null;
for (Object item : collectionOfPaging)
{
if (item instanceof Paging)
{
paging = (Paging<T>) item;
if (pagingResults != null)
addAll(pagingResults, paging, filter);
else
pagingResults = paging;
}
else if (item != null)
{
// initialize paging results if needed
if (pagingResults == null)
{
if (sorter != null)
{
// Create tree set based paging
TreeSet<T> treeSet = new TreeSet<T>(sorter);
pagingResults = new PagingCollection<T>(treeSet, pageCriteria);
}
else
pagingResults = new PagingCollection<T>(new ArrayList<T>(), pageCriteria);
}
pagingResults.add((T) item);
}
}
return pagingResults;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> Paging<T> flattenPaging(Collection<?> collectionOfPaging, PageCriteria pageCriteria,
Comparator<T> sorter, BooleanExpression<T> filter)
{
if (collectionOfPaging == null || collectionOfPaging.isEmpty())
return null;
Paging<T> pagingResults = null;
if (sorter != null)
{
// Create tree set based paging
TreeSet<T> treeSet = new TreeSet<T>(sorter);
pagingResults = new PagingCollection<T>(treeSet, pageCriteria);
// depends on control dependency: [if], data = [none]
}
// Add all to an aggregated collection
Paging<T> paging = null;
for (Object item : collectionOfPaging)
{
if (item instanceof Paging)
{
paging = (Paging<T>) item;
// depends on control dependency: [if], data = [none]
if (pagingResults != null)
addAll(pagingResults, paging, filter);
else
pagingResults = paging;
}
else if (item != null)
{
// initialize paging results if needed
if (pagingResults == null)
{
if (sorter != null)
{
// Create tree set based paging
TreeSet<T> treeSet = new TreeSet<T>(sorter);
pagingResults = new PagingCollection<T>(treeSet, pageCriteria);
// depends on control dependency: [if], data = [none]
}
else
pagingResults = new PagingCollection<T>(new ArrayList<T>(), pageCriteria);
}
pagingResults.add((T) item);
// depends on control dependency: [if], data = [none]
}
}
return pagingResults;
} }
|
public class class_name {
private void startListenerThreadIfNewService(URL url) {
String serviceName = url.getPath();
if (!lookupServices.containsKey(serviceName)) {
Long value = lookupServices.putIfAbsent(serviceName, 0L);
if (value == null) {
ServiceLookupThread lookupThread = new ServiceLookupThread(serviceName);
lookupThread.setDaemon(true);
lookupThread.start();
}
}
} }
|
public class class_name {
private void startListenerThreadIfNewService(URL url) {
String serviceName = url.getPath();
if (!lookupServices.containsKey(serviceName)) {
Long value = lookupServices.putIfAbsent(serviceName, 0L);
if (value == null) {
ServiceLookupThread lookupThread = new ServiceLookupThread(serviceName);
lookupThread.setDaemon(true); // depends on control dependency: [if], data = [none]
lookupThread.start(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
public D loadInBackground() {
synchronized (this) {
if (isLoadInBackgroundCanceled()) {
throw new OperationCanceledException();
}
mCancellationSignal = new CancellationSignal();
}
try {
Cursor cursor = getContext().getContentResolver()
.query(mUri, mProjection, mSelection, mSelectionArgs, mSortOrder,
mCancellationSignal);
if (cursor != null) {
try {
// Ensure the cursor window is filled.
cursor.getCount();
cursor.registerContentObserver(mObserver);
} catch (RuntimeException ex) {
cursor.close();
throw ex;
}
return wrap(cursor);
}
return null;
} finally {
synchronized (this) {
mCancellationSignal = null;
}
}
} }
|
public class class_name {
@Override
public D loadInBackground() {
synchronized (this) {
if (isLoadInBackgroundCanceled()) {
throw new OperationCanceledException();
}
mCancellationSignal = new CancellationSignal();
}
try {
Cursor cursor = getContext().getContentResolver()
.query(mUri, mProjection, mSelection, mSelectionArgs, mSortOrder,
mCancellationSignal);
if (cursor != null) {
try {
// Ensure the cursor window is filled.
cursor.getCount(); // depends on control dependency: [try], data = [none]
cursor.registerContentObserver(mObserver); // depends on control dependency: [try], data = [none]
} catch (RuntimeException ex) {
cursor.close();
throw ex;
} // depends on control dependency: [catch], data = [none]
return wrap(cursor); // depends on control dependency: [if], data = [(cursor]
}
return null; // depends on control dependency: [try], data = [none]
} finally {
synchronized (this) {
mCancellationSignal = null;
}
}
} }
|
public class class_name {
public Observable<ServiceResponse<Page<SiteInner>>> resumeNextWithServiceResponseAsync(final String nextPageLink) {
return resumeNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(resumeNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<SiteInner>>> resumeNextWithServiceResponseAsync(final String nextPageLink) {
return resumeNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(resumeNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public EventFilter withLastUpdatedTimes(DateTimeRange... lastUpdatedTimes) {
if (this.lastUpdatedTimes == null) {
setLastUpdatedTimes(new java.util.ArrayList<DateTimeRange>(lastUpdatedTimes.length));
}
for (DateTimeRange ele : lastUpdatedTimes) {
this.lastUpdatedTimes.add(ele);
}
return this;
} }
|
public class class_name {
public EventFilter withLastUpdatedTimes(DateTimeRange... lastUpdatedTimes) {
if (this.lastUpdatedTimes == null) {
setLastUpdatedTimes(new java.util.ArrayList<DateTimeRange>(lastUpdatedTimes.length)); // depends on control dependency: [if], data = [none]
}
for (DateTimeRange ele : lastUpdatedTimes) {
this.lastUpdatedTimes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
void defineCoordinateSystem(View viewA, Motion motion) {
View viewB = motion.destination(viewA);
viewA.viewToWorld.reset(); // identity since it's the origin
viewB.viewToWorld.set(motion.motionSrcToDst(viewB));
// translation is only known up to a scale factor so pick a reasonable scale factor
double scale = viewB.viewToWorld.T.norm();
viewB.viewToWorld.T.scale(1.0/scale);
viewsAdded.add(viewA);
viewsAdded.add(viewB);
viewA.state = ViewState.PROCESSED;
viewB.state = ViewState.PROCESSED;
// Take the already triangulated points and turn them into official 3D features
boolean originIsDst = viewA == motion.viewDst;
for (int i = 0; i < motion.stereoTriangulations.size(); i++) {
Feature3D f = motion.stereoTriangulations.get(i);
if( f.obsIdx.size != 2 )
throw new RuntimeException("BUG");
int indexSrc = f.obsIdx.get(0);
int indexDst = f.obsIdx.get(1);
motion.viewSrc.features3D[indexSrc] = f;
motion.viewDst.features3D[indexDst] = f;
if( originIsDst ) {
SePointOps_F64.transform(motion.a_to_b,f.worldPt,f.worldPt);
}
f.worldPt.scale(1.0/scale);
graph.features3D.add(f);
}
// free memory and mark as already processed
motion.stereoTriangulations = new ArrayList<>();
// All features which can be added using triangulation should now be added
addTriangulatedFeaturesForAllEdges(viewA);
addTriangulatedFeaturesForAllEdges(viewB);
if( verbose != null ) {
verbose.println("root = " + viewA.index);
verbose.println("other = " + viewB.index);
verbose.println("-------------");
}
} }
|
public class class_name {
void defineCoordinateSystem(View viewA, Motion motion) {
View viewB = motion.destination(viewA);
viewA.viewToWorld.reset(); // identity since it's the origin
viewB.viewToWorld.set(motion.motionSrcToDst(viewB));
// translation is only known up to a scale factor so pick a reasonable scale factor
double scale = viewB.viewToWorld.T.norm();
viewB.viewToWorld.T.scale(1.0/scale);
viewsAdded.add(viewA);
viewsAdded.add(viewB);
viewA.state = ViewState.PROCESSED;
viewB.state = ViewState.PROCESSED;
// Take the already triangulated points and turn them into official 3D features
boolean originIsDst = viewA == motion.viewDst;
for (int i = 0; i < motion.stereoTriangulations.size(); i++) {
Feature3D f = motion.stereoTriangulations.get(i);
if( f.obsIdx.size != 2 )
throw new RuntimeException("BUG");
int indexSrc = f.obsIdx.get(0);
int indexDst = f.obsIdx.get(1);
motion.viewSrc.features3D[indexSrc] = f; // depends on control dependency: [for], data = [none]
motion.viewDst.features3D[indexDst] = f; // depends on control dependency: [for], data = [none]
if( originIsDst ) {
SePointOps_F64.transform(motion.a_to_b,f.worldPt,f.worldPt); // depends on control dependency: [if], data = [none]
}
f.worldPt.scale(1.0/scale); // depends on control dependency: [for], data = [none]
graph.features3D.add(f); // depends on control dependency: [for], data = [none]
}
// free memory and mark as already processed
motion.stereoTriangulations = new ArrayList<>();
// All features which can be added using triangulation should now be added
addTriangulatedFeaturesForAllEdges(viewA);
addTriangulatedFeaturesForAllEdges(viewB);
if( verbose != null ) {
verbose.println("root = " + viewA.index); // depends on control dependency: [if], data = [none]
verbose.println("other = " + viewB.index); // depends on control dependency: [if], data = [none]
verbose.println("-------------"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static <T> T[] copyOf(final T[] original, final int newLength) {
if (newLength == original.length) {
return original.clone();
}
return (T[]) copyOf(original, newLength, original.getClass());
} }
|
public class class_name {
public static <T> T[] copyOf(final T[] original, final int newLength) {
if (newLength == original.length) {
return original.clone();
// depends on control dependency: [if], data = [none]
}
return (T[]) copyOf(original, newLength, original.getClass());
} }
|
public class class_name {
public static void update(Registry registry) {
Iterator<Map.Entry<Id, Object>> iter = registry.state().entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<Id, Object> entry = iter.next();
if (entry.getValue() instanceof AbstractMeterState) {
AbstractMeterState tuple = (AbstractMeterState) entry.getValue();
tuple.doUpdate(registry);
if (tuple.hasExpired()) {
iter.remove();
}
}
}
} }
|
public class class_name {
public static void update(Registry registry) {
Iterator<Map.Entry<Id, Object>> iter = registry.state().entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<Id, Object> entry = iter.next();
if (entry.getValue() instanceof AbstractMeterState) {
AbstractMeterState tuple = (AbstractMeterState) entry.getValue();
tuple.doUpdate(registry); // depends on control dependency: [if], data = [none]
if (tuple.hasExpired()) {
iter.remove(); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public QualifiedName qualifiedName(String prefix, String local, ProvFactory pFactory) {
if (prefix == null) {
String tmp = getDefaultNamespace();
if (tmp == null && parent != null) tmp = parent.getDefaultNamespace();
if (tmp==null) throw new NullPointerException("Namespace.stringToQualifiedName(: Null namespace for "+ local);
return pFactory.newQualifiedName(tmp, local, null);
}
//TODO: why have special cases here, prov and xsd are now declared prefixes in namespaces
if ("prov".equals(prefix)) {
return pFactory.newQualifiedName(NamespacePrefixMapper.PROV_NS, local, prefix);
} else if ("xsd".equals(prefix)) {
return pFactory.newQualifiedName(NamespacePrefixMapper.XSD_NS, // + "#", // RDF ns ends
// in #, not
// XML ns.
local, prefix);
} else {
String tmp=prefixes.get(prefix);
if (tmp==null) {
if (parent!=null) {
return parent.qualifiedName(prefix, local, pFactory);
} else {
throw new QualifiedNameException("Namespace.stringToQualifiedName(): Null namespace for " + prefix + ":" + local + " namespace " + this);
}
}
return pFactory.newQualifiedName(tmp, local, prefix);
}
} }
|
public class class_name {
public QualifiedName qualifiedName(String prefix, String local, ProvFactory pFactory) {
if (prefix == null) {
String tmp = getDefaultNamespace();
if (tmp == null && parent != null) tmp = parent.getDefaultNamespace();
if (tmp==null) throw new NullPointerException("Namespace.stringToQualifiedName(: Null namespace for "+ local);
return pFactory.newQualifiedName(tmp, local, null); // depends on control dependency: [if], data = [null)]
}
//TODO: why have special cases here, prov and xsd are now declared prefixes in namespaces
if ("prov".equals(prefix)) {
return pFactory.newQualifiedName(NamespacePrefixMapper.PROV_NS, local, prefix); // depends on control dependency: [if], data = [none]
} else if ("xsd".equals(prefix)) {
return pFactory.newQualifiedName(NamespacePrefixMapper.XSD_NS, // + "#", // RDF ns ends
// in #, not
// XML ns.
local, prefix); // depends on control dependency: [if], data = [none]
} else {
String tmp=prefixes.get(prefix);
if (tmp==null) {
if (parent!=null) {
return parent.qualifiedName(prefix, local, pFactory); // depends on control dependency: [if], data = [none]
} else {
throw new QualifiedNameException("Namespace.stringToQualifiedName(): Null namespace for " + prefix + ":" + local + " namespace " + this);
}
}
return pFactory.newQualifiedName(tmp, local, prefix); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public java.util.List<String> getDrop() {
if (drop == null) {
drop = new com.amazonaws.internal.SdkInternalList<String>();
}
return drop;
} }
|
public class class_name {
public java.util.List<String> getDrop() {
if (drop == null) {
drop = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return drop;
} }
|
public class class_name {
public void restart(FailureHandler failureHandler) {
if (!this.enabled) {
this.logger.debug("Application restart is disabled");
return;
}
this.logger.debug("Restarting application");
getLeakSafeThread().call(() -> {
Restarter.this.stop();
Restarter.this.start(failureHandler);
return null;
});
} }
|
public class class_name {
public void restart(FailureHandler failureHandler) {
if (!this.enabled) {
this.logger.debug("Application restart is disabled"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.logger.debug("Restarting application");
getLeakSafeThread().call(() -> {
Restarter.this.stop();
Restarter.this.start(failureHandler);
return null;
});
} }
|
public class class_name {
public Wepay init(){
pays = new Pays(this);
orders = new Orders(this);
refunds = new Refunds(this);
notifies = new Notifies(this);
bills = new Bills(this);
if (certs != null && !Strings.isNullOrEmpty(certPasswd)){
sslSocketFactory = initSSLSocketFactory();
}
return this;
} }
|
public class class_name {
public Wepay init(){
pays = new Pays(this);
orders = new Orders(this);
refunds = new Refunds(this);
notifies = new Notifies(this);
bills = new Bills(this);
if (certs != null && !Strings.isNullOrEmpty(certPasswd)){
sslSocketFactory = initSSLSocketFactory(); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public int occurrences(byte[] bytes) {
if (bytes.length == 0) {
return -1;
}
int occurrences = 0;
int currentPos = -1;
int offset = 0;
while (offset < size()) {
// search for the delimiter
currentPos = indexOf(bytes, offset);
if (currentPos < 0) {
break;
}
occurrences++;
offset = currentPos + bytes.length;
}
return occurrences;
} }
|
public class class_name {
public int occurrences(byte[] bytes) {
if (bytes.length == 0) {
return -1; // depends on control dependency: [if], data = [none]
}
int occurrences = 0;
int currentPos = -1;
int offset = 0;
while (offset < size()) {
// search for the delimiter
currentPos = indexOf(bytes, offset); // depends on control dependency: [while], data = [none]
if (currentPos < 0) {
break;
}
occurrences++; // depends on control dependency: [while], data = [none]
offset = currentPos + bytes.length; // depends on control dependency: [while], data = [none]
}
return occurrences;
} }
|
public class class_name {
private Set<T> getTransitiveDeps(T server) {
Set<T> result = new HashSet<>();
Deque<T> queue = new ArrayDeque<>();
queue.add(server);
while (!queue.isEmpty()) {
Set<Class<? extends Server>> deps = queue.pop().getDependencies();
if (deps == null) {
continue;
}
for (Class<? extends Server> clazz : deps) {
T dep = mRegistry.get(clazz);
if (dep == null) {
continue;
}
if (dep.equals(server)) {
throw new RuntimeException("Dependency cycle encountered");
}
if (result.contains(dep)) {
continue;
}
queue.add(dep);
result.add(dep);
}
}
return result;
} }
|
public class class_name {
private Set<T> getTransitiveDeps(T server) {
Set<T> result = new HashSet<>();
Deque<T> queue = new ArrayDeque<>();
queue.add(server);
while (!queue.isEmpty()) {
Set<Class<? extends Server>> deps = queue.pop().getDependencies(); // depends on control dependency: [while], data = [none]
if (deps == null) {
continue;
}
for (Class<? extends Server> clazz : deps) {
T dep = mRegistry.get(clazz);
if (dep == null) {
continue;
}
if (dep.equals(server)) {
throw new RuntimeException("Dependency cycle encountered");
}
if (result.contains(dep)) {
continue;
}
queue.add(dep);
result.add(dep);
}
}
return result;
} }
|
public class class_name {
public void setResponseURL(String responseURL) {
String newURL = _substitutor.replace(responseURL);
if (!_urlValidator.isValid(newURL)) {
error("The RespondTo URL specified is invalid. Continuing with previous value.");
} else {
this._responseURL = newURL;
}
} }
|
public class class_name {
public void setResponseURL(String responseURL) {
String newURL = _substitutor.replace(responseURL);
if (!_urlValidator.isValid(newURL)) {
error("The RespondTo URL specified is invalid. Continuing with previous value."); // depends on control dependency: [if], data = [none]
} else {
this._responseURL = newURL; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void renameUid(final String type, final String oldname,
final String newname) {
Tags.validateString(type, oldname);
Tags.validateString(type, newname);
if (type.toLowerCase().equals("metric")) {
try {
this.metrics.getId(oldname);
this.metrics.rename(oldname, newname);
} catch (NoSuchUniqueName nsue) {
throw new IllegalArgumentException("Name(\"" + oldname +
"\") does not exist");
}
} else if (type.toLowerCase().equals("tagk")) {
try {
this.tag_names.getId(oldname);
this.tag_names.rename(oldname, newname);
} catch (NoSuchUniqueName nsue) {
throw new IllegalArgumentException("Name(\"" + oldname +
"\") does not exist");
}
} else if (type.toLowerCase().equals("tagv")) {
try {
this.tag_values.getId(oldname);
this.tag_values.rename(oldname, newname);
} catch (NoSuchUniqueName nsue) {
throw new IllegalArgumentException("Name(\"" + oldname +
"\") does not exist");
}
} else {
LOG.warn("Unknown type name: " + type);
throw new IllegalArgumentException("Unknown type name");
}
} }
|
public class class_name {
public void renameUid(final String type, final String oldname,
final String newname) {
Tags.validateString(type, oldname);
Tags.validateString(type, newname);
if (type.toLowerCase().equals("metric")) {
try {
this.metrics.getId(oldname); // depends on control dependency: [try], data = [none]
this.metrics.rename(oldname, newname); // depends on control dependency: [try], data = [none]
} catch (NoSuchUniqueName nsue) {
throw new IllegalArgumentException("Name(\"" + oldname +
"\") does not exist");
} // depends on control dependency: [catch], data = [none]
} else if (type.toLowerCase().equals("tagk")) {
try {
this.tag_names.getId(oldname); // depends on control dependency: [try], data = [none]
this.tag_names.rename(oldname, newname); // depends on control dependency: [try], data = [none]
} catch (NoSuchUniqueName nsue) {
throw new IllegalArgumentException("Name(\"" + oldname +
"\") does not exist");
} // depends on control dependency: [catch], data = [none]
} else if (type.toLowerCase().equals("tagv")) {
try {
this.tag_values.getId(oldname); // depends on control dependency: [try], data = [none]
this.tag_values.rename(oldname, newname); // depends on control dependency: [try], data = [none]
} catch (NoSuchUniqueName nsue) {
throw new IllegalArgumentException("Name(\"" + oldname +
"\") does not exist");
} // depends on control dependency: [catch], data = [none]
} else {
LOG.warn("Unknown type name: " + type); // depends on control dependency: [if], data = [none]
throw new IllegalArgumentException("Unknown type name");
}
} }
|
public class class_name {
public static <A extends Annotation> A getAnnotation(Field field, Class<A> annotationType) {
if (field == null || annotationType == null) {
return null;
}
return field.getAnnotation(annotationType);
} }
|
public class class_name {
public static <A extends Annotation> A getAnnotation(Field field, Class<A> annotationType) {
if (field == null || annotationType == null) {
return null; // depends on control dependency: [if], data = [none]
}
return field.getAnnotation(annotationType);
} }
|
public class class_name {
public void setBackupVaultEvents(java.util.Collection<String> backupVaultEvents) {
if (backupVaultEvents == null) {
this.backupVaultEvents = null;
return;
}
this.backupVaultEvents = new java.util.ArrayList<String>(backupVaultEvents);
} }
|
public class class_name {
public void setBackupVaultEvents(java.util.Collection<String> backupVaultEvents) {
if (backupVaultEvents == null) {
this.backupVaultEvents = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.backupVaultEvents = new java.util.ArrayList<String>(backupVaultEvents);
} }
|
public class class_name {
private void setNonnullIfAnalyzeable(Updates updates, Node node) {
AccessPath ap = AccessPath.getAccessPathForNodeWithMapGet(node, types);
if (ap != null) {
updates.set(ap, NONNULL);
}
} }
|
public class class_name {
private void setNonnullIfAnalyzeable(Updates updates, Node node) {
AccessPath ap = AccessPath.getAccessPathForNodeWithMapGet(node, types);
if (ap != null) {
updates.set(ap, NONNULL); // depends on control dependency: [if], data = [(ap]
}
} }
|
public class class_name {
public void message(int level, String message,
String spec1, String spec2) {
if (debug >= level) {
System.out.println(message + ": " + spec1);
System.out.println("\t" + spec2);
}
} }
|
public class class_name {
public void message(int level, String message,
String spec1, String spec2) {
if (debug >= level) {
System.out.println(message + ": " + spec1); // depends on control dependency: [if], data = [none]
System.out.println("\t" + spec2); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public final EObject ruleXCatchClause() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token otherlv_1=null;
Token otherlv_3=null;
EObject lv_declaredParam_2_0 = null;
EObject lv_expression_4_0 = null;
enterRule();
try {
// InternalXbase.g:5222:2: ( ( ( ( 'catch' )=>otherlv_0= 'catch' ) otherlv_1= '(' ( (lv_declaredParam_2_0= ruleFullJvmFormalParameter ) ) otherlv_3= ')' ( (lv_expression_4_0= ruleXExpression ) ) ) )
// InternalXbase.g:5223:2: ( ( ( 'catch' )=>otherlv_0= 'catch' ) otherlv_1= '(' ( (lv_declaredParam_2_0= ruleFullJvmFormalParameter ) ) otherlv_3= ')' ( (lv_expression_4_0= ruleXExpression ) ) )
{
// InternalXbase.g:5223:2: ( ( ( 'catch' )=>otherlv_0= 'catch' ) otherlv_1= '(' ( (lv_declaredParam_2_0= ruleFullJvmFormalParameter ) ) otherlv_3= ')' ( (lv_expression_4_0= ruleXExpression ) ) )
// InternalXbase.g:5224:3: ( ( 'catch' )=>otherlv_0= 'catch' ) otherlv_1= '(' ( (lv_declaredParam_2_0= ruleFullJvmFormalParameter ) ) otherlv_3= ')' ( (lv_expression_4_0= ruleXExpression ) )
{
// InternalXbase.g:5224:3: ( ( 'catch' )=>otherlv_0= 'catch' )
// InternalXbase.g:5225:4: ( 'catch' )=>otherlv_0= 'catch'
{
otherlv_0=(Token)match(input,84,FOLLOW_44); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_0, grammarAccess.getXCatchClauseAccess().getCatchKeyword_0());
}
}
otherlv_1=(Token)match(input,49,FOLLOW_13); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXCatchClauseAccess().getLeftParenthesisKeyword_1());
}
// InternalXbase.g:5235:3: ( (lv_declaredParam_2_0= ruleFullJvmFormalParameter ) )
// InternalXbase.g:5236:4: (lv_declaredParam_2_0= ruleFullJvmFormalParameter )
{
// InternalXbase.g:5236:4: (lv_declaredParam_2_0= ruleFullJvmFormalParameter )
// InternalXbase.g:5237:5: lv_declaredParam_2_0= ruleFullJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXCatchClauseAccess().getDeclaredParamFullJvmFormalParameterParserRuleCall_2_0());
}
pushFollow(FOLLOW_29);
lv_declaredParam_2_0=ruleFullJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXCatchClauseRule());
}
set(
current,
"declaredParam",
lv_declaredParam_2_0,
"org.eclipse.xtext.xbase.Xbase.FullJvmFormalParameter");
afterParserOrEnumRuleCall();
}
}
}
otherlv_3=(Token)match(input,50,FOLLOW_4); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getXCatchClauseAccess().getRightParenthesisKeyword_3());
}
// InternalXbase.g:5258:3: ( (lv_expression_4_0= ruleXExpression ) )
// InternalXbase.g:5259:4: (lv_expression_4_0= ruleXExpression )
{
// InternalXbase.g:5259:4: (lv_expression_4_0= ruleXExpression )
// InternalXbase.g:5260:5: lv_expression_4_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXCatchClauseAccess().getExpressionXExpressionParserRuleCall_4_0());
}
pushFollow(FOLLOW_2);
lv_expression_4_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXCatchClauseRule());
}
set(
current,
"expression",
lv_expression_4_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject ruleXCatchClause() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token otherlv_1=null;
Token otherlv_3=null;
EObject lv_declaredParam_2_0 = null;
EObject lv_expression_4_0 = null;
enterRule();
try {
// InternalXbase.g:5222:2: ( ( ( ( 'catch' )=>otherlv_0= 'catch' ) otherlv_1= '(' ( (lv_declaredParam_2_0= ruleFullJvmFormalParameter ) ) otherlv_3= ')' ( (lv_expression_4_0= ruleXExpression ) ) ) )
// InternalXbase.g:5223:2: ( ( ( 'catch' )=>otherlv_0= 'catch' ) otherlv_1= '(' ( (lv_declaredParam_2_0= ruleFullJvmFormalParameter ) ) otherlv_3= ')' ( (lv_expression_4_0= ruleXExpression ) ) )
{
// InternalXbase.g:5223:2: ( ( ( 'catch' )=>otherlv_0= 'catch' ) otherlv_1= '(' ( (lv_declaredParam_2_0= ruleFullJvmFormalParameter ) ) otherlv_3= ')' ( (lv_expression_4_0= ruleXExpression ) ) )
// InternalXbase.g:5224:3: ( ( 'catch' )=>otherlv_0= 'catch' ) otherlv_1= '(' ( (lv_declaredParam_2_0= ruleFullJvmFormalParameter ) ) otherlv_3= ')' ( (lv_expression_4_0= ruleXExpression ) )
{
// InternalXbase.g:5224:3: ( ( 'catch' )=>otherlv_0= 'catch' )
// InternalXbase.g:5225:4: ( 'catch' )=>otherlv_0= 'catch'
{
otherlv_0=(Token)match(input,84,FOLLOW_44); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_0, grammarAccess.getXCatchClauseAccess().getCatchKeyword_0()); // depends on control dependency: [if], data = [none]
}
}
otherlv_1=(Token)match(input,49,FOLLOW_13); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXCatchClauseAccess().getLeftParenthesisKeyword_1()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:5235:3: ( (lv_declaredParam_2_0= ruleFullJvmFormalParameter ) )
// InternalXbase.g:5236:4: (lv_declaredParam_2_0= ruleFullJvmFormalParameter )
{
// InternalXbase.g:5236:4: (lv_declaredParam_2_0= ruleFullJvmFormalParameter )
// InternalXbase.g:5237:5: lv_declaredParam_2_0= ruleFullJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXCatchClauseAccess().getDeclaredParamFullJvmFormalParameterParserRuleCall_2_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_29);
lv_declaredParam_2_0=ruleFullJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXCatchClauseRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"declaredParam",
lv_declaredParam_2_0,
"org.eclipse.xtext.xbase.Xbase.FullJvmFormalParameter");
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_3=(Token)match(input,50,FOLLOW_4); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getXCatchClauseAccess().getRightParenthesisKeyword_3()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:5258:3: ( (lv_expression_4_0= ruleXExpression ) )
// InternalXbase.g:5259:4: (lv_expression_4_0= ruleXExpression )
{
// InternalXbase.g:5259:4: (lv_expression_4_0= ruleXExpression )
// InternalXbase.g:5260:5: lv_expression_4_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXCatchClauseAccess().getExpressionXExpressionParserRuleCall_4_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_2);
lv_expression_4_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXCatchClauseRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"expression",
lv_expression_4_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public Excel07SaxReader read(OPCPackage opcPackage, int sheetIndex) throws POIException {
InputStream sheetInputStream = null;
try {
final XSSFReader xssfReader = new XSSFReader(opcPackage);
// 获取共享样式表
stylesTable = xssfReader.getStylesTable();
// 获取共享字符串表
this.sharedStringsTable = xssfReader.getSharedStringsTable();
if (sheetIndex > -1) {
this.sheetIndex = sheetIndex;
// 根据 rId# 或 rSheet# 查找sheet
sheetInputStream = xssfReader.getSheet(RID_PREFIX + (sheetIndex + 1));
parse(sheetInputStream);
} else {
this.sheetIndex = -1;
// 遍历所有sheet
final Iterator<InputStream> sheetInputStreams = xssfReader.getSheetsData();
while (sheetInputStreams.hasNext()) {
// 重新读取一个sheet时行归零
curRow = 0;
this.sheetIndex++;
sheetInputStream = sheetInputStreams.next();
parse(sheetInputStream);
}
}
} catch (DependencyException e) {
throw e;
} catch (Exception e) {
throw ExceptionUtil.wrap(e, POIException.class);
} finally {
IoUtil.close(sheetInputStream);
}
return this;
} }
|
public class class_name {
public Excel07SaxReader read(OPCPackage opcPackage, int sheetIndex) throws POIException {
InputStream sheetInputStream = null;
try {
final XSSFReader xssfReader = new XSSFReader(opcPackage);
// 获取共享样式表
stylesTable = xssfReader.getStylesTable();
// 获取共享字符串表
this.sharedStringsTable = xssfReader.getSharedStringsTable();
if (sheetIndex > -1) {
this.sheetIndex = sheetIndex;
// depends on control dependency: [if], data = [none]
// 根据 rId# 或 rSheet# 查找sheet
sheetInputStream = xssfReader.getSheet(RID_PREFIX + (sheetIndex + 1));
// depends on control dependency: [if], data = [(sheetIndex]
parse(sheetInputStream);
// depends on control dependency: [if], data = [none]
} else {
this.sheetIndex = -1;
// depends on control dependency: [if], data = [none]
// 遍历所有sheet
final Iterator<InputStream> sheetInputStreams = xssfReader.getSheetsData();
while (sheetInputStreams.hasNext()) {
// 重新读取一个sheet时行归零
curRow = 0;
// depends on control dependency: [while], data = [none]
this.sheetIndex++;
// depends on control dependency: [while], data = [none]
sheetInputStream = sheetInputStreams.next();
// depends on control dependency: [while], data = [none]
parse(sheetInputStream);
// depends on control dependency: [while], data = [none]
}
}
} catch (DependencyException e) {
throw e;
} catch (Exception e) {
throw ExceptionUtil.wrap(e, POIException.class);
} finally {
IoUtil.close(sheetInputStream);
}
return this;
} }
|
public class class_name {
public void run() {
/* check if running the routine is still necessary */
if(shutDownHookExecuted) {
return;
}
synchronized (processes) {
running = true;
Enumeration e = processes.elements();
while (e.hasMoreElements()) {
destroy((Process) e.nextElement());
}
processes.clear();
shutDownHookExecuted = true;
}
} }
|
public class class_name {
public void run() {
/* check if running the routine is still necessary */
if(shutDownHookExecuted) {
return; // depends on control dependency: [if], data = [none]
}
synchronized (processes) {
running = true;
Enumeration e = processes.elements();
while (e.hasMoreElements()) {
destroy((Process) e.nextElement()); // depends on control dependency: [while], data = [none]
}
processes.clear();
shutDownHookExecuted = true;
}
} }
|
public class class_name {
public java.util.List<String> getGpuIds() {
if (gpuIds == null) {
gpuIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return gpuIds;
} }
|
public class class_name {
public java.util.List<String> getGpuIds() {
if (gpuIds == null) {
gpuIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return gpuIds;
} }
|
public class class_name {
@Override
public void onApplicationEvent(HttpSessionDestroyedEvent event) {
final HttpSession session = ((HttpSessionDestroyedEvent) event).getSession();
@SuppressWarnings("unchecked")
final Map<String, PortletSession> portletSessions =
(Map<String, PortletSession>) session.getAttribute(PORTLET_SESSIONS_MAP);
if (portletSessions == null) {
return;
}
/*
* Since (at least) Tomcat 7.0.47, this method has the potential to
* generate a StackOverflowError because PortletSession.invalidate()
* will trigger another HttpSessionDestroyedEvent, which means this
* method will be called again. I don't know if this behavior is a bug
* in Tomcat or Spring, if this behavior is entirely proper, or if the
* reality somewhere in between.
*
* For the present, let's put a token in the HttpSession (which is
* available from the event object) as soon as we start invalidating it.
* We'll then ignore sessions that already have this token.
*/
if (session.getAttribute(ALREADY_INVALIDATING_SESSION_ATTRIBUTE) != null) {
// We're already invalidating; don't do it again
return;
}
session.setAttribute(ALREADY_INVALIDATING_SESSION_ATTRIBUTE, Boolean.TRUE);
for (final Map.Entry<String, PortletSession> portletSessionEntry :
portletSessions.entrySet()) {
final String contextPath = portletSessionEntry.getKey();
final PortletSession portletSession = portletSessionEntry.getValue();
try {
portletSession.invalidate();
} catch (IllegalStateException e) {
this.logger.info(
"PortletSession with id '"
+ portletSession.getId()
+ "' for context '"
+ contextPath
+ "' has already been invalidated.");
} catch (Exception e) {
this.logger.warn(
"Failed to invalidate PortletSession with id '"
+ portletSession.getId()
+ "' for context '"
+ contextPath
+ "'",
e);
}
}
} }
|
public class class_name {
@Override
public void onApplicationEvent(HttpSessionDestroyedEvent event) {
final HttpSession session = ((HttpSessionDestroyedEvent) event).getSession();
@SuppressWarnings("unchecked")
final Map<String, PortletSession> portletSessions =
(Map<String, PortletSession>) session.getAttribute(PORTLET_SESSIONS_MAP);
if (portletSessions == null) {
return; // depends on control dependency: [if], data = [none]
}
/*
* Since (at least) Tomcat 7.0.47, this method has the potential to
* generate a StackOverflowError because PortletSession.invalidate()
* will trigger another HttpSessionDestroyedEvent, which means this
* method will be called again. I don't know if this behavior is a bug
* in Tomcat or Spring, if this behavior is entirely proper, or if the
* reality somewhere in between.
*
* For the present, let's put a token in the HttpSession (which is
* available from the event object) as soon as we start invalidating it.
* We'll then ignore sessions that already have this token.
*/
if (session.getAttribute(ALREADY_INVALIDATING_SESSION_ATTRIBUTE) != null) {
// We're already invalidating; don't do it again
return; // depends on control dependency: [if], data = [none]
}
session.setAttribute(ALREADY_INVALIDATING_SESSION_ATTRIBUTE, Boolean.TRUE);
for (final Map.Entry<String, PortletSession> portletSessionEntry :
portletSessions.entrySet()) {
final String contextPath = portletSessionEntry.getKey();
final PortletSession portletSession = portletSessionEntry.getValue();
try {
portletSession.invalidate(); // depends on control dependency: [try], data = [none]
} catch (IllegalStateException e) {
this.logger.info(
"PortletSession with id '"
+ portletSession.getId()
+ "' for context '"
+ contextPath
+ "' has already been invalidated.");
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
this.logger.warn(
"Failed to invalidate PortletSession with id '"
+ portletSession.getId()
+ "' for context '"
+ contextPath
+ "'",
e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public boolean saveConfiguration(final String path)
{
if (xmlConfig != null && !errors.hasFailed()) {
boolean success = true;
FileWriter writer = null;
try {
writer = new FileWriter(path);
writer.write(xmlConfig.toString());
writer.flush();
}
catch (IOException ioe) {
ioe.printStackTrace();
success = false;
}
finally {
if (writer != null) {
try {
writer.close();
}
catch (IOException ioe) {
success = false;
}
}
}
return success;
}
return false;
} }
|
public class class_name {
public boolean saveConfiguration(final String path)
{
if (xmlConfig != null && !errors.hasFailed()) {
boolean success = true;
FileWriter writer = null;
try {
writer = new FileWriter(path); // depends on control dependency: [try], data = [none]
writer.write(xmlConfig.toString()); // depends on control dependency: [try], data = [none]
writer.flush(); // depends on control dependency: [try], data = [none]
}
catch (IOException ioe) {
ioe.printStackTrace();
success = false;
} // depends on control dependency: [catch], data = [none]
finally {
if (writer != null) {
try {
writer.close(); // depends on control dependency: [try], data = [none]
}
catch (IOException ioe) {
success = false;
} // depends on control dependency: [catch], data = [none]
}
}
return success; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
@Override
protected void visitAndOpNode(AndOpNode node) {
// Recurse.
visitChildren(node);
// Can simplify if either child is constant. We assume no side-effects.
SoyValue operand0 = getConstantOrNull(node.getChild(0));
if (operand0 != null) {
ExprNode replacementNode = operand0.coerceToBoolean() ? node.getChild(1) : node.getChild(0);
node.getParent().replaceChild(node, replacementNode);
}
} }
|
public class class_name {
@Override
protected void visitAndOpNode(AndOpNode node) {
// Recurse.
visitChildren(node);
// Can simplify if either child is constant. We assume no side-effects.
SoyValue operand0 = getConstantOrNull(node.getChild(0));
if (operand0 != null) {
ExprNode replacementNode = operand0.coerceToBoolean() ? node.getChild(1) : node.getChild(0);
node.getParent().replaceChild(node, replacementNode); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String getPropertyString()
{
String str = position() + "@" + size() + " | Screen=" + screenPosition();
if (this instanceof IPadded)
{
Padding p = Padding.of(this);
str += " | Padding " + p.left() + "." + p.right() + "." + p.right() + "." + p.right();
}
return str;
} }
|
public class class_name {
public String getPropertyString()
{
String str = position() + "@" + size() + " | Screen=" + screenPosition();
if (this instanceof IPadded)
{
Padding p = Padding.of(this);
str += " | Padding " + p.left() + "." + p.right() + "." + p.right() + "." + p.right(); // depends on control dependency: [if], data = [none]
}
return str;
} }
|
public class class_name {
public java.lang.String getProviderId() {
java.lang.Object ref = providerId_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
providerId_ = s;
return s;
}
} }
|
public class class_name {
public java.lang.String getProviderId() {
java.lang.Object ref = providerId_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref; // depends on control dependency: [if], data = [none]
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
providerId_ = s; // depends on control dependency: [if], data = [none]
return s; // depends on control dependency: [if], data = [none]
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.