code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
void messagingEngineQuiescing(SibRaMessagingEngineConnection connection)
{
final String methodName = "messagingEngineQuiescing";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName, connection);
}
SibTr.info(TRACE, "ME_QUIESCING_CWSIV0785", new Object[] {
connection.getConnection().getMeName(),
_endpointConfiguration.getBusName() });
// Change the last parameters to true to stop the connection trying to stop the
// consumer. This is because the event is now processed async and the connection may get
// closed before our thread tries to stop the consumer session.
dropConnection(connection, false, true, true);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(this, TRACE, methodName);
}
} } | public class class_name {
@Override
void messagingEngineQuiescing(SibRaMessagingEngineConnection connection)
{
final String methodName = "messagingEngineQuiescing";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName, connection); // depends on control dependency: [if], data = [none]
}
SibTr.info(TRACE, "ME_QUIESCING_CWSIV0785", new Object[] {
connection.getConnection().getMeName(),
_endpointConfiguration.getBusName() });
// Change the last parameters to true to stop the connection trying to stop the
// consumer. This is because the event is now processed async and the connection may get
// closed before our thread tries to stop the consumer session.
dropConnection(connection, false, true, true);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(this, TRACE, methodName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
boolean smoothSlideTo(float slideOffset, int velocity) {
if (!isSlidingEnabled()) {
// Nothing to do.
return false;
}
int panelTop = computePanelTopPosition(slideOffset);
if (mDragHelper.smoothSlideViewTo(mSlideableView, mSlideableView.getLeft(), panelTop)) {
setAllChildrenVisible();
ViewCompat.postInvalidateOnAnimation(this);
return true;
}
return false;
} } | public class class_name {
boolean smoothSlideTo(float slideOffset, int velocity) {
if (!isSlidingEnabled()) {
// Nothing to do.
return false; // depends on control dependency: [if], data = [none]
}
int panelTop = computePanelTopPosition(slideOffset);
if (mDragHelper.smoothSlideViewTo(mSlideableView, mSlideableView.getLeft(), panelTop)) {
setAllChildrenVisible(); // depends on control dependency: [if], data = [none]
ViewCompat.postInvalidateOnAnimation(this); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
@Override
protected HttpOperation generateHttpOperation (GenericRecord inputRecord, State state) {
Map<String, String> keyAndValue = new HashMap<>();
Optional<Iterable<String>> keys = getKeys(state);
HttpOperation operation;
if (keys.isPresent()) {
for (String key : keys.get()) {
String value = inputRecord.get(key).toString();
log.debug("Http join converter: key is {}, value is {}", key, value);
keyAndValue.put(key, value);
}
operation = new HttpOperation();
operation.setKeys(keyAndValue);
} else {
operation = HttpUtils.toHttpOperation(inputRecord);
}
return operation;
} } | public class class_name {
@Override
protected HttpOperation generateHttpOperation (GenericRecord inputRecord, State state) {
Map<String, String> keyAndValue = new HashMap<>();
Optional<Iterable<String>> keys = getKeys(state);
HttpOperation operation;
if (keys.isPresent()) {
for (String key : keys.get()) {
String value = inputRecord.get(key).toString();
log.debug("Http join converter: key is {}, value is {}", key, value); // depends on control dependency: [for], data = [key]
keyAndValue.put(key, value); // depends on control dependency: [for], data = [key]
}
operation = new HttpOperation(); // depends on control dependency: [if], data = [none]
operation.setKeys(keyAndValue); // depends on control dependency: [if], data = [none]
} else {
operation = HttpUtils.toHttpOperation(inputRecord); // depends on control dependency: [if], data = [none]
}
return operation;
} } |
public class class_name {
private int[] buildIndex(final int[] counts, int[] positions, int minsupp) {
// Count the number of frequent items:
int numfreq = 0;
for(int i = 0; i < counts.length; i++) {
if(counts[i] >= minsupp) {
++numfreq;
}
}
// Build the index table
int[] idx = new int[numfreq];
for(int i = 0, j = 0; i < counts.length; i++) {
if(counts[i] >= minsupp) {
idx[j++] = i;
}
}
IntegerArrayQuickSort.sort(idx, (x, y) -> Integer.compare(counts[y], counts[x]));
Arrays.fill(positions, -1);
for(int i = 0; i < idx.length; i++) {
positions[idx[i]] = i;
}
return idx;
} } | public class class_name {
private int[] buildIndex(final int[] counts, int[] positions, int minsupp) {
// Count the number of frequent items:
int numfreq = 0;
for(int i = 0; i < counts.length; i++) {
if(counts[i] >= minsupp) {
++numfreq; // depends on control dependency: [if], data = [none]
}
}
// Build the index table
int[] idx = new int[numfreq];
for(int i = 0, j = 0; i < counts.length; i++) {
if(counts[i] >= minsupp) {
idx[j++] = i; // depends on control dependency: [if], data = [none]
}
}
IntegerArrayQuickSort.sort(idx, (x, y) -> Integer.compare(counts[y], counts[x]));
Arrays.fill(positions, -1);
for(int i = 0; i < idx.length; i++) {
positions[idx[i]] = i; // depends on control dependency: [for], data = [i]
}
return idx;
} } |
public class class_name {
public LoggingEvent rewrite(final LoggingEvent source) {
Object msg = source.getMessage();
if (msg instanceof Map) {
Map props = new HashMap(source.getProperties());
Map eventProps = (Map) msg;
//
// if the map sent in the logging request
// has "message" entry, use that as the message body
// otherwise, use the entire map.
//
Object newMsg = eventProps.get("message");
if (newMsg == null) {
newMsg = msg;
}
for(Iterator iter = eventProps.entrySet().iterator();
iter.hasNext();
) {
Map.Entry entry = (Map.Entry) iter.next();
if (!("message".equals(entry.getKey()))) {
props.put(entry.getKey(), entry.getValue());
}
}
return new LoggingEvent(
source.getFQNOfLoggerClass(),
source.getLogger() != null ? source.getLogger(): Logger.getLogger(source.getLoggerName()),
source.getTimeStamp(),
source.getLevel(),
newMsg,
source.getThreadName(),
source.getThrowableInformation(),
source.getNDC(),
source.getLocationInformation(),
props);
} else {
return source;
}
} } | public class class_name {
public LoggingEvent rewrite(final LoggingEvent source) {
Object msg = source.getMessage();
if (msg instanceof Map) {
Map props = new HashMap(source.getProperties());
Map eventProps = (Map) msg;
//
// if the map sent in the logging request
// has "message" entry, use that as the message body
// otherwise, use the entire map.
//
Object newMsg = eventProps.get("message");
if (newMsg == null) {
newMsg = msg; // depends on control dependency: [if], data = [none]
}
for(Iterator iter = eventProps.entrySet().iterator();
iter.hasNext();
) {
Map.Entry entry = (Map.Entry) iter.next();
if (!("message".equals(entry.getKey()))) {
props.put(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none]
}
}
return new LoggingEvent(
source.getFQNOfLoggerClass(),
source.getLogger() != null ? source.getLogger(): Logger.getLogger(source.getLoggerName()),
source.getTimeStamp(),
source.getLevel(),
newMsg,
source.getThreadName(),
source.getThrowableInformation(),
source.getNDC(),
source.getLocationInformation(),
props); // depends on control dependency: [if], data = [none]
} else {
return source; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void scheduleInitializationDone() {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
m_initialized = true;
if (m_active) {
removeEditorDisabledStyle();
} else {
setEditorDisabledStyle();
}
}
});
} } | public class class_name {
void scheduleInitializationDone() {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
m_initialized = true;
if (m_active) {
removeEditorDisabledStyle();
// depends on control dependency: [if], data = [none]
} else {
setEditorDisabledStyle();
// depends on control dependency: [if], data = [none]
}
}
});
} } |
public class class_name {
public static <T> MatrixCursor getCursor(final List<T> list) {
if (list == null || list.isEmpty())
return new MatrixCursor(new String[] { "_id" });
final String[] titles = getFieldTitlesFromObject(list.get(0));
final MatrixCursor cursor = new MatrixCursor(titles);
try {
addFieldValuesFromList(cursor, list);
} catch (final IllegalAccessException e) {
Logger.ex(e);
}
return cursor;
} } | public class class_name {
public static <T> MatrixCursor getCursor(final List<T> list) {
if (list == null || list.isEmpty())
return new MatrixCursor(new String[] { "_id" });
final String[] titles = getFieldTitlesFromObject(list.get(0));
final MatrixCursor cursor = new MatrixCursor(titles);
try {
addFieldValuesFromList(cursor, list); // depends on control dependency: [try], data = [none]
} catch (final IllegalAccessException e) {
Logger.ex(e);
} // depends on control dependency: [catch], data = [none]
return cursor;
} } |
public class class_name {
private Status executeReturn(Stmt.Return stmt, CallStack frame, EnclosingScope scope) {
// We know that a return statement can only appear in either a function
// or method declaration. It cannot appear, for example, in a type
// declaration. Therefore, the enclosing declaration is a function or
// method.
Decl.Callable context = scope.getEnclosingScope(FunctionOrMethodScope.class).getContext();
Tuple<Decl.Variable> returns = context.getReturns();
RValue[] values = executeExpressions(stmt.getReturns(), frame);
for (int i = 0; i != returns.size(); ++i) {
frame.putLocal(returns.get(i).getName(), values[i]);
}
return Status.RETURN;
} } | public class class_name {
private Status executeReturn(Stmt.Return stmt, CallStack frame, EnclosingScope scope) {
// We know that a return statement can only appear in either a function
// or method declaration. It cannot appear, for example, in a type
// declaration. Therefore, the enclosing declaration is a function or
// method.
Decl.Callable context = scope.getEnclosingScope(FunctionOrMethodScope.class).getContext();
Tuple<Decl.Variable> returns = context.getReturns();
RValue[] values = executeExpressions(stmt.getReturns(), frame);
for (int i = 0; i != returns.size(); ++i) {
frame.putLocal(returns.get(i).getName(), values[i]); // depends on control dependency: [for], data = [i]
}
return Status.RETURN;
} } |
public class class_name {
@Override
public void execute(TridentTuple tuple, TridentCollector collector)
{
String receivedStr = tuple.getString(0);
String[] splitedStr = StringUtils.split(receivedStr, this.delimeter);
int dataNum = splitedStr.length;
double[] points = new double[splitedStr.length];
try
{
for (int index = 0; index < dataNum; index++)
{
points[index] = Double.parseDouble(splitedStr[index].trim());
}
LofPoint result = new LofPoint();
result.setDataId(UUID.randomUUID().toString());
result.setDataPoint(points);
result.setJudgeDate(new Date(getCurrentTime()));
collector.emit(new Values(result));
}
catch (Exception ex)
{
logger.warn("Received data is invalid. skip this data. ReceivedData=" + receivedStr, ex);
}
} } | public class class_name {
@Override
public void execute(TridentTuple tuple, TridentCollector collector)
{
String receivedStr = tuple.getString(0);
String[] splitedStr = StringUtils.split(receivedStr, this.delimeter);
int dataNum = splitedStr.length;
double[] points = new double[splitedStr.length];
try
{
for (int index = 0; index < dataNum; index++)
{
points[index] = Double.parseDouble(splitedStr[index].trim()); // depends on control dependency: [for], data = [index]
}
LofPoint result = new LofPoint();
result.setDataId(UUID.randomUUID().toString()); // depends on control dependency: [try], data = [none]
result.setDataPoint(points); // depends on control dependency: [try], data = [none]
result.setJudgeDate(new Date(getCurrentTime())); // depends on control dependency: [try], data = [none]
collector.emit(new Values(result)); // depends on control dependency: [try], data = [none]
}
catch (Exception ex)
{
logger.warn("Received data is invalid. skip this data. ReceivedData=" + receivedStr, ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean addAnnotationInfo(int indent, Element element,
List<? extends AnnotationMirror> descList, boolean lineBreak, Content htmltree) {
List<Content> annotations = getAnnotations(indent, descList, lineBreak);
String sep = "";
if (annotations.isEmpty()) {
return false;
}
for (Content annotation: annotations) {
htmltree.addContent(sep);
htmltree.addContent(annotation);
if (!lineBreak) {
sep = " ";
}
}
return true;
} } | public class class_name {
private boolean addAnnotationInfo(int indent, Element element,
List<? extends AnnotationMirror> descList, boolean lineBreak, Content htmltree) {
List<Content> annotations = getAnnotations(indent, descList, lineBreak);
String sep = "";
if (annotations.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
for (Content annotation: annotations) {
htmltree.addContent(sep); // depends on control dependency: [for], data = [none]
htmltree.addContent(annotation); // depends on control dependency: [for], data = [annotation]
if (!lineBreak) {
sep = " "; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
private void setTreeModel(AlertTreeModel alertTreeModel) {
if (getView() == null) {
return;
}
getAlertPanel().getTreeAlert().setModel(alertTreeModel);
recalcAlerts();
} } | public class class_name {
private void setTreeModel(AlertTreeModel alertTreeModel) {
if (getView() == null) {
return;
// depends on control dependency: [if], data = [none]
}
getAlertPanel().getTreeAlert().setModel(alertTreeModel);
recalcAlerts();
} } |
public class class_name {
public static ImageReader getReader(String type) {
final Iterator<ImageReader> iterator = ImageIO.getImageReadersByFormatName(type);
if (iterator.hasNext()) {
return iterator.next();
}
return null;
} } | public class class_name {
public static ImageReader getReader(String type) {
final Iterator<ImageReader> iterator = ImageIO.getImageReadersByFormatName(type);
if (iterator.hasNext()) {
return iterator.next();
// depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void setRecords(java.util.Collection<Record> records) {
if (records == null) {
this.records = null;
return;
}
this.records = new com.amazonaws.internal.SdkInternalList<Record>(records);
} } | public class class_name {
public void setRecords(java.util.Collection<Record> records) {
if (records == null) {
this.records = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.records = new com.amazonaws.internal.SdkInternalList<Record>(records);
} } |
public class class_name {
public int createIds(String type) {
List<String> tables = getMissing(type);
for (String tableName : tables) {
getOrCreate(tableName);
}
return tables.size();
} } | public class class_name {
public int createIds(String type) {
List<String> tables = getMissing(type);
for (String tableName : tables) {
getOrCreate(tableName); // depends on control dependency: [for], data = [tableName]
}
return tables.size();
} } |
public class class_name {
private static List<Parameter> convert(Map<String, Object> map) {
Set<Entry<String, Object>> entries = map.entrySet();
List<Parameter> parameters = new ArrayList<>(entries.size());
for (Entry<String, Object> entry : entries) {
if (entry.getValue() != null) {
parameters.add(new Parameter(entry.getKey(), entry.getValue().toString()));
}
}
return parameters;
} } | public class class_name {
private static List<Parameter> convert(Map<String, Object> map) {
Set<Entry<String, Object>> entries = map.entrySet();
List<Parameter> parameters = new ArrayList<>(entries.size());
for (Entry<String, Object> entry : entries) {
if (entry.getValue() != null) {
parameters.add(new Parameter(entry.getKey(), entry.getValue().toString())); // depends on control dependency: [if], data = [none]
}
}
return parameters;
} } |
public class class_name {
public void init(ObjectMapper objectMapper) {
if (resultFactory == null) {
resultFactory = new ImmediateResultFactory();
}
PreconditionUtil.verifyEquals(InitializedState.NOT_INITIALIZED, initializedState, "already initialized");
this.initializedState = InitializedState.INITIALIZING;
this.objectMapper = objectMapper;
this.objectMapper.registerModules(getJacksonModules());
typeParser.setObjectMapper(objectMapper);
initializeModules();
if (isServer) {
applyRepositoryRegistrations();
applyResourceRegistrations();
}
ExceptionMapperLookup exceptionMapperLookup = getExceptionMapperLookup();
ExceptionMapperRegistryBuilder mapperRegistryBuilder = new ExceptionMapperRegistryBuilder();
exceptionMapperRegistry = mapperRegistryBuilder.build(exceptionMapperLookup);
filterBehaviorProvider =
new ResourceFilterDirectoryImpl(aggregatedModule.getResourceFilters(), httpRequestContextProvider,
resourceRegistry);
this.initializedState = InitializedState.INITIALIZED;
} } | public class class_name {
public void init(ObjectMapper objectMapper) {
if (resultFactory == null) {
resultFactory = new ImmediateResultFactory(); // depends on control dependency: [if], data = [none]
}
PreconditionUtil.verifyEquals(InitializedState.NOT_INITIALIZED, initializedState, "already initialized");
this.initializedState = InitializedState.INITIALIZING;
this.objectMapper = objectMapper;
this.objectMapper.registerModules(getJacksonModules());
typeParser.setObjectMapper(objectMapper);
initializeModules();
if (isServer) {
applyRepositoryRegistrations(); // depends on control dependency: [if], data = [none]
applyResourceRegistrations(); // depends on control dependency: [if], data = [none]
}
ExceptionMapperLookup exceptionMapperLookup = getExceptionMapperLookup();
ExceptionMapperRegistryBuilder mapperRegistryBuilder = new ExceptionMapperRegistryBuilder();
exceptionMapperRegistry = mapperRegistryBuilder.build(exceptionMapperLookup);
filterBehaviorProvider =
new ResourceFilterDirectoryImpl(aggregatedModule.getResourceFilters(), httpRequestContextProvider,
resourceRegistry);
this.initializedState = InitializedState.INITIALIZED;
} } |
public class class_name {
@Override
public PollResult startPoll(PollController conn)
{
if (! _lifecycle.isActive()) {
log.warning(this + " select disabled");
return PollResult.CLOSED;
}
SocketBar socket = conn.getSocket();
if (socket == null) {
log.warning(this + " socket empty for " + conn);
return PollResult.CLOSED;
}
SelectableChannel selChannel = socket.selectableChannel();
if (selChannel == null) {
log.warning(this + " no channel for " + socket);
return PollResult.CLOSED;
}
_connectionCount.incrementAndGet();
_activeCount.incrementAndGet();
_registerQueue.offer(conn);
return PollResult.START;
} } | public class class_name {
@Override
public PollResult startPoll(PollController conn)
{
if (! _lifecycle.isActive()) {
log.warning(this + " select disabled"); // depends on control dependency: [if], data = [none]
return PollResult.CLOSED; // depends on control dependency: [if], data = [none]
}
SocketBar socket = conn.getSocket();
if (socket == null) {
log.warning(this + " socket empty for " + conn); // depends on control dependency: [if], data = [none]
return PollResult.CLOSED; // depends on control dependency: [if], data = [none]
}
SelectableChannel selChannel = socket.selectableChannel();
if (selChannel == null) {
log.warning(this + " no channel for " + socket); // depends on control dependency: [if], data = [none]
return PollResult.CLOSED; // depends on control dependency: [if], data = [none]
}
_connectionCount.incrementAndGet();
_activeCount.incrementAndGet();
_registerQueue.offer(conn);
return PollResult.START;
} } |
public class class_name {
public void setConnections(java.util.Collection<Connection> connections) {
if (connections == null) {
this.connections = null;
return;
}
this.connections = new java.util.ArrayList<Connection>(connections);
} } | public class class_name {
public void setConnections(java.util.Collection<Connection> connections) {
if (connections == null) {
this.connections = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.connections = new java.util.ArrayList<Connection>(connections);
} } |
public class class_name {
@Override
@SuppressWarnings("fallthrough")
public Node optimizeSubtree(Node node) {
switch (node.getToken()) {
case THROW:
case RETURN: {
Node result = tryRemoveRedundantExit(node);
if (result != node) {
return result;
}
return tryReplaceExitWithBreak(node);
}
// TODO(johnlenz): Maybe remove redundant BREAK and CONTINUE. Overlaps
// with MinimizeExitPoints.
case NOT:
tryMinimizeCondition(node.getFirstChild());
return tryMinimizeNot(node);
case IF:
performConditionSubstitutions(node.getFirstChild());
return tryMinimizeIf(node);
case EXPR_RESULT:
performConditionSubstitutions(node.getFirstChild());
return tryMinimizeExprResult(node);
case HOOK:
performConditionSubstitutions(node.getFirstChild());
return tryMinimizeHook(node);
case WHILE:
case DO:
tryMinimizeCondition(NodeUtil.getConditionExpression(node));
return node;
case FOR:
tryJoinForCondition(node);
tryMinimizeCondition(NodeUtil.getConditionExpression(node));
return node;
case BLOCK:
return tryReplaceIf(node);
default:
return node; //Nothing changed
}
} } | public class class_name {
@Override
@SuppressWarnings("fallthrough")
public Node optimizeSubtree(Node node) {
switch (node.getToken()) {
case THROW:
case RETURN: {
Node result = tryRemoveRedundantExit(node);
if (result != node) {
return result; // depends on control dependency: [if], data = [none]
}
return tryReplaceExitWithBreak(node);
}
// TODO(johnlenz): Maybe remove redundant BREAK and CONTINUE. Overlaps
// with MinimizeExitPoints.
case NOT:
tryMinimizeCondition(node.getFirstChild());
return tryMinimizeNot(node);
case IF:
performConditionSubstitutions(node.getFirstChild());
return tryMinimizeIf(node);
case EXPR_RESULT:
performConditionSubstitutions(node.getFirstChild());
return tryMinimizeExprResult(node);
case HOOK:
performConditionSubstitutions(node.getFirstChild());
return tryMinimizeHook(node);
case WHILE:
case DO:
tryMinimizeCondition(NodeUtil.getConditionExpression(node));
return node;
case FOR:
tryJoinForCondition(node);
tryMinimizeCondition(NodeUtil.getConditionExpression(node));
return node;
case BLOCK:
return tryReplaceIf(node);
default:
return node; //Nothing changed
}
} } |
public class class_name {
@Override
public void post_init(ORBInitInfo info) {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Registering interceptors and policy factories");
Codec codec;
try {
codec = info.codec_factory().create_codec(CDR_1_2_ENCODING);
} catch (UnknownEncoding e) {
INITIALIZE err = new org.omg.CORBA.INITIALIZE("Could not create CDR 1.2 codec");
err.initCause(e);
throw err;
}
try {
info.add_client_request_interceptor(new ClientTransactionInterceptor(codec));
info.add_server_request_interceptor(new ServerTransactionInterceptor(codec));
info.add_ior_interceptor(new IORTransactionInterceptor(codec));
} catch (DuplicateName duplicateName) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Duplicate name", duplicateName);
}
info.register_policy_factory(ClientTransactionPolicyFactory.POLICY_TYPE, new ClientTransactionPolicyFactory());
info.register_policy_factory(ServerTransactionPolicyFactory.POLICY_TYPE, new ServerTransactionPolicyFactory());
} catch (RuntimeException re) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Error registering interceptor", re);
throw re;
}
} } | public class class_name {
@Override
public void post_init(ORBInitInfo info) {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Registering interceptors and policy factories");
Codec codec;
try {
codec = info.codec_factory().create_codec(CDR_1_2_ENCODING); // depends on control dependency: [try], data = [none]
} catch (UnknownEncoding e) {
INITIALIZE err = new org.omg.CORBA.INITIALIZE("Could not create CDR 1.2 codec");
err.initCause(e);
throw err;
} // depends on control dependency: [catch], data = [none]
try {
info.add_client_request_interceptor(new ClientTransactionInterceptor(codec)); // depends on control dependency: [try], data = [none]
info.add_server_request_interceptor(new ServerTransactionInterceptor(codec)); // depends on control dependency: [try], data = [none]
info.add_ior_interceptor(new IORTransactionInterceptor(codec)); // depends on control dependency: [try], data = [none]
} catch (DuplicateName duplicateName) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Duplicate name", duplicateName);
} // depends on control dependency: [catch], data = [none]
info.register_policy_factory(ClientTransactionPolicyFactory.POLICY_TYPE, new ClientTransactionPolicyFactory()); // depends on control dependency: [try], data = [none]
info.register_policy_factory(ServerTransactionPolicyFactory.POLICY_TYPE, new ServerTransactionPolicyFactory()); // depends on control dependency: [try], data = [none]
} catch (RuntimeException re) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Error registering interceptor", re);
throw re;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String encodeAppSecretProof(String appSecret, String accessToken) {
try {
byte[] key = appSecret.getBytes(StandardCharsets.UTF_8);
SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA256");
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(signingKey);
byte[] raw = mac.doFinal(accessToken.getBytes());
byte[] hex = encodeHex(raw);
return new String(hex, StandardCharsets.UTF_8);
} catch (Exception e) {
throw new IllegalStateException("Creation of appsecret_proof has failed", e);
}
} } | public class class_name {
public static String encodeAppSecretProof(String appSecret, String accessToken) {
try {
byte[] key = appSecret.getBytes(StandardCharsets.UTF_8);
SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA256");
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(signingKey); // depends on control dependency: [try], data = [none]
byte[] raw = mac.doFinal(accessToken.getBytes());
byte[] hex = encodeHex(raw);
return new String(hex, StandardCharsets.UTF_8); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalStateException("Creation of appsecret_proof has failed", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void updateStats(ContentEvent event) {
Instance instance;
if (event instanceof ClusteringContentEvent){
//Local Clustering
ClusteringContentEvent ev = (ClusteringContentEvent) event;
instance = ev.getInstance();
DataPoint point = new DataPoint(instance, Integer.parseInt(event.getKey()));
model.trainOnInstance(point);
instancesCount++;
}
if (event instanceof ClusteringResultContentEvent){
//Global Clustering
ClusteringResultContentEvent ev = (ClusteringResultContentEvent) event;
Clustering clustering = ev.getClustering();
for (int i=0; i<clustering.size(); i++) {
instance = new DenseInstance(1.0,clustering.get(i).getCenter());
instance.setDataset(model.getDataset());
DataPoint point = new DataPoint(instance, Integer.parseInt(event.getKey()));
model.trainOnInstance(point);
instancesCount++;
}
}
if (instancesCount % this.sampleFrequency == 0) {
logger.info("Trained model using {} events with classifier id {}", instancesCount, this.modelId); // getId());
}
} } | public class class_name {
private void updateStats(ContentEvent event) {
Instance instance;
if (event instanceof ClusteringContentEvent){
//Local Clustering
ClusteringContentEvent ev = (ClusteringContentEvent) event;
instance = ev.getInstance(); // depends on control dependency: [if], data = [none]
DataPoint point = new DataPoint(instance, Integer.parseInt(event.getKey()));
model.trainOnInstance(point); // depends on control dependency: [if], data = [none]
instancesCount++; // depends on control dependency: [if], data = [none]
}
if (event instanceof ClusteringResultContentEvent){
//Global Clustering
ClusteringResultContentEvent ev = (ClusteringResultContentEvent) event;
Clustering clustering = ev.getClustering();
for (int i=0; i<clustering.size(); i++) {
instance = new DenseInstance(1.0,clustering.get(i).getCenter()); // depends on control dependency: [for], data = [i]
instance.setDataset(model.getDataset()); // depends on control dependency: [for], data = [none]
DataPoint point = new DataPoint(instance, Integer.parseInt(event.getKey()));
model.trainOnInstance(point); // depends on control dependency: [for], data = [none]
instancesCount++; // depends on control dependency: [for], data = [none]
}
}
if (instancesCount % this.sampleFrequency == 0) {
logger.info("Trained model using {} events with classifier id {}", instancesCount, this.modelId); // getId()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ScheduledInstancesLaunchSpecification withNetworkInterfaces(ScheduledInstancesNetworkInterface... networkInterfaces) {
if (this.networkInterfaces == null) {
setNetworkInterfaces(new com.amazonaws.internal.SdkInternalList<ScheduledInstancesNetworkInterface>(networkInterfaces.length));
}
for (ScheduledInstancesNetworkInterface ele : networkInterfaces) {
this.networkInterfaces.add(ele);
}
return this;
} } | public class class_name {
public ScheduledInstancesLaunchSpecification withNetworkInterfaces(ScheduledInstancesNetworkInterface... networkInterfaces) {
if (this.networkInterfaces == null) {
setNetworkInterfaces(new com.amazonaws.internal.SdkInternalList<ScheduledInstancesNetworkInterface>(networkInterfaces.length)); // depends on control dependency: [if], data = [none]
}
for (ScheduledInstancesNetworkInterface ele : networkInterfaces) {
this.networkInterfaces.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public Map<String, String> getVMDetails(HttpInputs httpInputs, VmInputs vmInputs) throws Exception {
ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs);
try {
ManagedObjectReference vmMor = new MorObjectHandler().getMor(connectionResources,
ManagedObjectType.VIRTUAL_MACHINE.getValue(), vmInputs.getVirtualMachineName());
ObjectContent[] objectContents = GetObjectProperties.getObjectProperties(connectionResources, vmMor,
new String[]{ManagedObjectType.SUMMARY.getValue()});
if (objectContents != null) {
Map<String, String> vmDetails = new HashMap<>();
for (ObjectContent objectItem : objectContents) {
List<DynamicProperty> vmProperties = objectItem.getPropSet();
for (DynamicProperty propertyItem : vmProperties) {
VirtualMachineSummary virtualMachineSummary = (VirtualMachineSummary) propertyItem.getVal();
VirtualMachineConfigSummary virtualMachineConfigSummary = virtualMachineSummary.getConfig();
ResponseUtils.addDataToVmDetailsMap(vmDetails, virtualMachineSummary, virtualMachineConfigSummary);
}
}
String responseJson = ResponseUtils.getJsonString(vmDetails);
return ResponseUtils.getResultsMap(responseJson, Outputs.RETURN_CODE_SUCCESS);
} else {
return ResponseUtils.getResultsMap("Could not retrieve the details for: [" +
vmInputs.getVirtualMachineName() + "] VM.", Outputs.RETURN_CODE_FAILURE);
}
} catch (Exception ex) {
return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE);
} finally {
if (httpInputs.isCloseSession()) {
connectionResources.getConnection().disconnect();
clearConnectionFromContext(httpInputs.getGlobalSessionObject());
}
}
} } | public class class_name {
public Map<String, String> getVMDetails(HttpInputs httpInputs, VmInputs vmInputs) throws Exception {
ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs);
try {
ManagedObjectReference vmMor = new MorObjectHandler().getMor(connectionResources,
ManagedObjectType.VIRTUAL_MACHINE.getValue(), vmInputs.getVirtualMachineName());
ObjectContent[] objectContents = GetObjectProperties.getObjectProperties(connectionResources, vmMor,
new String[]{ManagedObjectType.SUMMARY.getValue()});
if (objectContents != null) {
Map<String, String> vmDetails = new HashMap<>();
for (ObjectContent objectItem : objectContents) {
List<DynamicProperty> vmProperties = objectItem.getPropSet();
for (DynamicProperty propertyItem : vmProperties) {
VirtualMachineSummary virtualMachineSummary = (VirtualMachineSummary) propertyItem.getVal();
VirtualMachineConfigSummary virtualMachineConfigSummary = virtualMachineSummary.getConfig();
ResponseUtils.addDataToVmDetailsMap(vmDetails, virtualMachineSummary, virtualMachineConfigSummary); // depends on control dependency: [for], data = [none]
}
}
String responseJson = ResponseUtils.getJsonString(vmDetails);
return ResponseUtils.getResultsMap(responseJson, Outputs.RETURN_CODE_SUCCESS); // depends on control dependency: [if], data = [none]
} else {
return ResponseUtils.getResultsMap("Could not retrieve the details for: [" +
vmInputs.getVirtualMachineName() + "] VM.", Outputs.RETURN_CODE_FAILURE); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE);
} finally {
if (httpInputs.isCloseSession()) {
connectionResources.getConnection().disconnect(); // depends on control dependency: [if], data = [none]
clearConnectionFromContext(httpInputs.getGlobalSessionObject()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public final Integer getCost(final AdvancementTeam team) {
Integer valoration;
checkNotNull(team, "Received a null pointer as the team");
valoration = team.getCash();
for (final AdvancementTeamPlayer player : team.getPlayers().values()) {
valoration += player.getValoration();
}
valoration += team.getCoachingDice() * getCostDie();
valoration += team.getDreadballCards() * getCostCard();
valoration += team.getCheerleaders() * getCostCheerleader();
if (team.getDefensiveCoachingStaff()) {
valoration += getCostCoaching();
}
if (team.getOffensiveCoachingStaff()) {
valoration += getCostCoaching();
}
if (team.getSupportCoachingStaff()) {
valoration += getCostCoaching();
}
return valoration;
} } | public class class_name {
@Override
public final Integer getCost(final AdvancementTeam team) {
Integer valoration;
checkNotNull(team, "Received a null pointer as the team");
valoration = team.getCash();
for (final AdvancementTeamPlayer player : team.getPlayers().values()) {
valoration += player.getValoration(); // depends on control dependency: [for], data = [player]
}
valoration += team.getCoachingDice() * getCostDie();
valoration += team.getDreadballCards() * getCostCard();
valoration += team.getCheerleaders() * getCostCheerleader();
if (team.getDefensiveCoachingStaff()) {
valoration += getCostCoaching(); // depends on control dependency: [if], data = [none]
}
if (team.getOffensiveCoachingStaff()) {
valoration += getCostCoaching(); // depends on control dependency: [if], data = [none]
}
if (team.getSupportCoachingStaff()) {
valoration += getCostCoaching(); // depends on control dependency: [if], data = [none]
}
return valoration;
} } |
public class class_name {
public Observable<ServiceResponse<RegistryListCredentialsResultInner>> regenerateCredentialWithServiceResponseAsync(String resourceGroupName, String registryName, PasswordName name) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (registryName == null) {
throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
final String apiVersion = "2017-10-01";
RegenerateCredentialParameters regenerateCredentialParameters = new RegenerateCredentialParameters();
regenerateCredentialParameters.withName(name);
return service.regenerateCredential(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), regenerateCredentialParameters, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RegistryListCredentialsResultInner>>>() {
@Override
public Observable<ServiceResponse<RegistryListCredentialsResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<RegistryListCredentialsResultInner> clientResponse = regenerateCredentialDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<RegistryListCredentialsResultInner>> regenerateCredentialWithServiceResponseAsync(String resourceGroupName, String registryName, PasswordName name) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (registryName == null) {
throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
final String apiVersion = "2017-10-01";
RegenerateCredentialParameters regenerateCredentialParameters = new RegenerateCredentialParameters();
regenerateCredentialParameters.withName(name);
return service.regenerateCredential(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), regenerateCredentialParameters, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RegistryListCredentialsResultInner>>>() {
@Override
public Observable<ServiceResponse<RegistryListCredentialsResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<RegistryListCredentialsResultInner> clientResponse = regenerateCredentialDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
@Override
protected void visitTemplateNode(TemplateNode node) {
String templateName = node.getTemplateName();
String partialName = node.getPartialTemplateName().substring(1);
String alias;
if (jsSrcOptions.shouldGenerateGoogModules() && node instanceof TemplateDelegateNode) {
alias = partialName;
} else {
alias = templateAliases.get(templateName);
}
Expression aliasExp = dottedIdNoRequire(alias);
// TODO(lukes): reserve all the namespace prefixes that are in scope
// TODO(lukes): use this for all local variable declarations
UniqueNameGenerator nameGenerator = JsSrcNameGenerators.forLocalVariables();
CodeChunk.Generator codeGenerator = CodeChunk.Generator.create(nameGenerator);
templateTranslationContext =
TranslationContext.of(
SoyToJsVariableMappings.forNewTemplate(), codeGenerator, nameGenerator);
genJsExprsVisitor =
genJsExprsVisitorFactory.create(templateTranslationContext, templateAliases, errorReporter);
assistantForMsgs = null;
JsDoc jsDoc = generateFunctionJsDoc(node, alias);
Expression function = Expression.function(jsDoc, generateFunctionBody(node, alias));
ImmutableList.Builder<Statement> declarations = ImmutableList.builder();
if (jsSrcOptions.shouldGenerateGoogModules()) {
declarations.add(VariableDeclaration.builder(alias).setJsDoc(jsDoc).setRhs(function).build());
// don't export deltemplates or private templates
if (!(node instanceof TemplateDelegateNode) && node.getVisibility() == Visibility.PUBLIC) {
declarations.add(assign(JsRuntime.EXPORTS.dotAccess(partialName), aliasExp));
}
} else {
declarations.add(Statement.assign(aliasExp, function, jsDoc));
}
// ------ Add the @typedef of opt_data. ------
if (!node.getParams().isEmpty()) {
declarations.add(
aliasExp
.dotAccess("Params")
.asStatement(
JsDoc.builder()
.addParameterizedAnnotation("typedef", genParamsRecordType(node))
.build()));
}
// ------ Add the fully qualified template name to the function to use in debug code. ------
declarations.add(
ifStatement(
GOOG_DEBUG,
assign(aliasExp.dotAccess("soyTemplateName"), stringLiteral(templateName)))
.build());
// ------ If delegate template, generate a statement to register it. ------
if (node instanceof TemplateDelegateNode) {
TemplateDelegateNode nodeAsDelTemplate = (TemplateDelegateNode) node;
declarations.add(
SOY_REGISTER_DELEGATE_FN
.call(
SOY_GET_DELTEMPLATE_ID.call(
stringLiteral(delTemplateNamer.getDelegateName(nodeAsDelTemplate))),
stringLiteral(nodeAsDelTemplate.getDelTemplateVariant()),
number(nodeAsDelTemplate.getDelPriority().getValue()),
aliasExp)
.asStatement());
}
jsCodeBuilder.append(Statement.of(declarations.build()));
} } | public class class_name {
@Override
protected void visitTemplateNode(TemplateNode node) {
String templateName = node.getTemplateName();
String partialName = node.getPartialTemplateName().substring(1);
String alias;
if (jsSrcOptions.shouldGenerateGoogModules() && node instanceof TemplateDelegateNode) {
alias = partialName; // depends on control dependency: [if], data = [none]
} else {
alias = templateAliases.get(templateName); // depends on control dependency: [if], data = [none]
}
Expression aliasExp = dottedIdNoRequire(alias);
// TODO(lukes): reserve all the namespace prefixes that are in scope
// TODO(lukes): use this for all local variable declarations
UniqueNameGenerator nameGenerator = JsSrcNameGenerators.forLocalVariables();
CodeChunk.Generator codeGenerator = CodeChunk.Generator.create(nameGenerator);
templateTranslationContext =
TranslationContext.of(
SoyToJsVariableMappings.forNewTemplate(), codeGenerator, nameGenerator);
genJsExprsVisitor =
genJsExprsVisitorFactory.create(templateTranslationContext, templateAliases, errorReporter);
assistantForMsgs = null;
JsDoc jsDoc = generateFunctionJsDoc(node, alias);
Expression function = Expression.function(jsDoc, generateFunctionBody(node, alias));
ImmutableList.Builder<Statement> declarations = ImmutableList.builder();
if (jsSrcOptions.shouldGenerateGoogModules()) {
declarations.add(VariableDeclaration.builder(alias).setJsDoc(jsDoc).setRhs(function).build()); // depends on control dependency: [if], data = [none]
// don't export deltemplates or private templates
if (!(node instanceof TemplateDelegateNode) && node.getVisibility() == Visibility.PUBLIC) {
declarations.add(assign(JsRuntime.EXPORTS.dotAccess(partialName), aliasExp)); // depends on control dependency: [if], data = [none]
}
} else {
declarations.add(Statement.assign(aliasExp, function, jsDoc)); // depends on control dependency: [if], data = [none]
}
// ------ Add the @typedef of opt_data. ------
if (!node.getParams().isEmpty()) {
declarations.add(
aliasExp
.dotAccess("Params")
.asStatement(
JsDoc.builder()
.addParameterizedAnnotation("typedef", genParamsRecordType(node))
.build())); // depends on control dependency: [if], data = [none]
}
// ------ Add the fully qualified template name to the function to use in debug code. ------
declarations.add(
ifStatement(
GOOG_DEBUG,
assign(aliasExp.dotAccess("soyTemplateName"), stringLiteral(templateName)))
.build());
// ------ If delegate template, generate a statement to register it. ------
if (node instanceof TemplateDelegateNode) {
TemplateDelegateNode nodeAsDelTemplate = (TemplateDelegateNode) node;
declarations.add(
SOY_REGISTER_DELEGATE_FN
.call(
SOY_GET_DELTEMPLATE_ID.call(
stringLiteral(delTemplateNamer.getDelegateName(nodeAsDelTemplate))),
stringLiteral(nodeAsDelTemplate.getDelTemplateVariant()),
number(nodeAsDelTemplate.getDelPriority().getValue()),
aliasExp)
.asStatement()); // depends on control dependency: [if], data = [none]
}
jsCodeBuilder.append(Statement.of(declarations.build()));
} } |
public class class_name {
private Class findClassInComponents(String name)
throws ClassNotFoundException {
// we need to search the components of the path to see if
// we can find the class we want.
String classFilename = getClassFilename(name);
Enumeration e = pathComponents.elements();
while (e.hasMoreElements()) {
File pathComponent = (File) e.nextElement();
try (final InputStream stream = getResourceStream(pathComponent, classFilename)) {
if (stream != null) {
log("Loaded from " + pathComponent + " "
+ classFilename, Project.MSG_DEBUG);
return getClassFromStream(stream, name, pathComponent);
}
} catch (SecurityException se) {
throw se;
} catch (IOException ioe) {
// ioe.printStackTrace();
log("Exception reading component " + pathComponent + " (reason: "
+ ioe.getMessage() + ")", Project.MSG_VERBOSE);
}
}
throw new ClassNotFoundException(name);
} } | public class class_name {
private Class findClassInComponents(String name)
throws ClassNotFoundException {
// we need to search the components of the path to see if
// we can find the class we want.
String classFilename = getClassFilename(name);
Enumeration e = pathComponents.elements();
while (e.hasMoreElements()) {
File pathComponent = (File) e.nextElement();
try (final InputStream stream = getResourceStream(pathComponent, classFilename)) {
if (stream != null) {
log("Loaded from " + pathComponent + " "
+ classFilename, Project.MSG_DEBUG); // depends on control dependency: [if], data = [none]
return getClassFromStream(stream, name, pathComponent); // depends on control dependency: [if], data = [(stream]
}
} catch (SecurityException se) {
throw se;
} catch (IOException ioe) {
// ioe.printStackTrace();
log("Exception reading component " + pathComponent + " (reason: "
+ ioe.getMessage() + ")", Project.MSG_VERBOSE);
}
}
throw new ClassNotFoundException(name);
} } |
public class class_name {
private <T> Observable<PollingState<T>> updateStateFromLocationHeaderOnPutAsync(final PollingState<T> pollingState) {
return pollAsync(pollingState.locationHeaderLink(), pollingState.loggingContext())
.flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(Response<ResponseBody> response) {
int statusCode = response.code();
if (statusCode == 202) {
pollingState.withResponse(response);
pollingState.withStatus(AzureAsyncOperation.IN_PROGRESS_STATUS, statusCode);
} else if (statusCode == 200 || statusCode == 201) {
try {
pollingState.updateFromResponseOnPutPatch(response);
} catch (CloudException | IOException e) {
return Observable.error(e);
}
}
return Observable.just(pollingState);
}
});
} } | public class class_name {
private <T> Observable<PollingState<T>> updateStateFromLocationHeaderOnPutAsync(final PollingState<T> pollingState) {
return pollAsync(pollingState.locationHeaderLink(), pollingState.loggingContext())
.flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(Response<ResponseBody> response) {
int statusCode = response.code();
if (statusCode == 202) {
pollingState.withResponse(response); // depends on control dependency: [if], data = [none]
pollingState.withStatus(AzureAsyncOperation.IN_PROGRESS_STATUS, statusCode); // depends on control dependency: [if], data = [none]
} else if (statusCode == 200 || statusCode == 201) {
try {
pollingState.updateFromResponseOnPutPatch(response); // depends on control dependency: [try], data = [none]
} catch (CloudException | IOException e) {
return Observable.error(e);
} // depends on control dependency: [catch], data = [none]
}
return Observable.just(pollingState);
}
});
} } |
public class class_name {
public static String getTotalStackTrace( final Throwable exception )
{
if( isBroadestFirst() )
{
StringWriter writer = new StringWriter();
exception.printStackTrace( new PrintWriter( writer, true ) );
return writer.toString();
}
//
// Reverse the order of the exceptions
//
List<Throwable> exceps = new ArrayList<Throwable>();
Throwable rev = exception;
while ( rev != null && rev.getCause() != rev )
{
exceps.add( 0, rev );
rev = rev.getCause();
}
StringBuffer buffer = new StringBuffer();
for ( int ii = 0; ii < exceps.size(); ii++ )
{
Throwable ex = exceps.get( ii );
Throwable parent = null;
if ( ii != 0 )
{
buffer.append( "\n\nIn context of:\n" );
parent = exceps.get( ii -1 );
}
buffer.append( ex.toString() );
StackTraceElement[] trace = ex.getStackTrace();
for ( int jj=0; jj < trace.length; jj++)
{
StackTraceElement traceElement = trace[jj];
boolean done = false;
if ( parent != null )
{
StackTraceElement[] parentTrace = parent.getStackTrace();
for ( int kk=0; kk < parentTrace.length; kk++ )
{
if ( parentTrace[kk].equals( traceElement ) )
{
done = true;
break;
}
}
}
buffer.append("\n\tat " + traceElement );
if ( done )
{
buffer.append( "\n\t..." );
break;
}
}
}
return buffer.toString();
} } | public class class_name {
public static String getTotalStackTrace( final Throwable exception )
{
if( isBroadestFirst() )
{
StringWriter writer = new StringWriter();
exception.printStackTrace( new PrintWriter( writer, true ) ); // depends on control dependency: [if], data = [none]
return writer.toString(); // depends on control dependency: [if], data = [none]
}
//
// Reverse the order of the exceptions
//
List<Throwable> exceps = new ArrayList<Throwable>();
Throwable rev = exception;
while ( rev != null && rev.getCause() != rev )
{
exceps.add( 0, rev ); // depends on control dependency: [while], data = [none]
rev = rev.getCause(); // depends on control dependency: [while], data = [none]
}
StringBuffer buffer = new StringBuffer();
for ( int ii = 0; ii < exceps.size(); ii++ )
{
Throwable ex = exceps.get( ii );
Throwable parent = null;
if ( ii != 0 )
{
buffer.append( "\n\nIn context of:\n" ); // depends on control dependency: [if], data = [none]
parent = exceps.get( ii -1 ); // depends on control dependency: [if], data = [( ii]
}
buffer.append( ex.toString() ); // depends on control dependency: [for], data = [none]
StackTraceElement[] trace = ex.getStackTrace();
for ( int jj=0; jj < trace.length; jj++)
{
StackTraceElement traceElement = trace[jj];
boolean done = false;
if ( parent != null )
{
StackTraceElement[] parentTrace = parent.getStackTrace();
for ( int kk=0; kk < parentTrace.length; kk++ )
{
if ( parentTrace[kk].equals( traceElement ) )
{
done = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
buffer.append("\n\tat " + traceElement ); // depends on control dependency: [for], data = [none]
if ( done )
{
buffer.append( "\n\t..." ); // depends on control dependency: [if], data = [none]
break;
}
}
}
return buffer.toString();
} } |
public class class_name {
public boolean matchesToMicros(LibertyVersion other) {
if (other == null) {
return true;
}
return this.major == other.major && this.minor == other.minor && this.micro == other.micro;
} } | public class class_name {
public boolean matchesToMicros(LibertyVersion other) {
if (other == null) {
return true; // depends on control dependency: [if], data = [none]
}
return this.major == other.major && this.minor == other.minor && this.micro == other.micro;
} } |
public class class_name {
public void setRulesPackageArns(java.util.Collection<String> rulesPackageArns) {
if (rulesPackageArns == null) {
this.rulesPackageArns = null;
return;
}
this.rulesPackageArns = new java.util.ArrayList<String>(rulesPackageArns);
} } | public class class_name {
public void setRulesPackageArns(java.util.Collection<String> rulesPackageArns) {
if (rulesPackageArns == null) {
this.rulesPackageArns = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.rulesPackageArns = new java.util.ArrayList<String>(rulesPackageArns);
} } |
public class class_name {
public <X extends FSTStruct> StructArray<X> newArray(int size, X templ, BytezAllocator alloc) {
StructArray<X> aTemplate = new StructArray<X>(size, templ);
int siz = getFactory().calcStructSize(aTemplate);
try {
if ( siz < chunkSize )
return newStruct(aTemplate);
else {
return getFactory().toStruct(aTemplate,alloc);
}
} catch (Throwable e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public <X extends FSTStruct> StructArray<X> newArray(int size, X templ, BytezAllocator alloc) {
StructArray<X> aTemplate = new StructArray<X>(size, templ);
int siz = getFactory().calcStructSize(aTemplate);
try {
if ( siz < chunkSize )
return newStruct(aTemplate);
else {
return getFactory().toStruct(aTemplate,alloc); // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private int findField(String fieldName) {
int foundIndex = 0;
for (Field field : fields) {
if (field != null && fieldName.equals(field.getName())) {
return foundIndex;
}
foundIndex++;
}
return -1;
} } | public class class_name {
private int findField(String fieldName) {
int foundIndex = 0;
for (Field field : fields) {
if (field != null && fieldName.equals(field.getName())) {
return foundIndex; // depends on control dependency: [if], data = [none]
}
foundIndex++; // depends on control dependency: [for], data = [none]
}
return -1;
} } |
public class class_name {
private void buildCallHierarchy() {
final ExecutionNodeUsage rootUsage = new ExecutionNodeUsage(this.rootNode);
callerHierarchy.put(rootUsage, null); // nothing calls this
for (final FeatureNode feature : this.rootNode.getChildren()){
addToCallHierarchy(feature);
for (final ScenarioNode scenario : feature.getChildren()){
addToCallHierarchy(scenario);
processChildrenForCallHierarchy(scenario.getChildren());
}
}
} } | public class class_name {
private void buildCallHierarchy() {
final ExecutionNodeUsage rootUsage = new ExecutionNodeUsage(this.rootNode);
callerHierarchy.put(rootUsage, null); // nothing calls this
for (final FeatureNode feature : this.rootNode.getChildren()){
addToCallHierarchy(feature); // depends on control dependency: [for], data = [feature]
for (final ScenarioNode scenario : feature.getChildren()){
addToCallHierarchy(scenario); // depends on control dependency: [for], data = [scenario]
processChildrenForCallHierarchy(scenario.getChildren()); // depends on control dependency: [for], data = [scenario]
}
}
} } |
public class class_name {
private void doAck(long id) {
// The other side of the connection has sent a message indicating which
// messages it has seen. We can clear any messages before the indicated ID.
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Received ack for messages up to %d, removing all previous messages from memory", this, id));
}
if (messages.containsKey(id+1)) {
messages.tailMap(id+1);
} else {
messages.clear();
}
checkDrain();
} } | public class class_name {
private void doAck(long id) {
// The other side of the connection has sent a message indicating which
// messages it has seen. We can clear any messages before the indicated ID.
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Received ack for messages up to %d, removing all previous messages from memory", this, id)); // depends on control dependency: [if], data = [none]
}
if (messages.containsKey(id+1)) {
messages.tailMap(id+1); // depends on control dependency: [if], data = [none]
} else {
messages.clear(); // depends on control dependency: [if], data = [none]
}
checkDrain();
} } |
public class class_name {
@SuppressWarnings("unchecked")
public String getUserEmail(String userId) {
if (userId == null) {
return null;
}
// map userId to email
// NOTE: this gets convoluted if they use OAuth logins because the email
// field is in the service!
Map<String, Object> user = getDocument("users", userId);
String email = userId;
if (user != null) {
ArrayList<Map<String, String>> emails = (ArrayList<Map<String, String>>) user
.get("emails");
if ((emails != null) && (emails.size() > 0)) {
// get first email address
Map<String, String> emailFields = emails.get(0);
email = emailFields.get("address");
}
}
return email;
} } | public class class_name {
@SuppressWarnings("unchecked")
public String getUserEmail(String userId) {
if (userId == null) {
return null; // depends on control dependency: [if], data = [none]
}
// map userId to email
// NOTE: this gets convoluted if they use OAuth logins because the email
// field is in the service!
Map<String, Object> user = getDocument("users", userId);
String email = userId;
if (user != null) {
ArrayList<Map<String, String>> emails = (ArrayList<Map<String, String>>) user
.get("emails");
if ((emails != null) && (emails.size() > 0)) {
// get first email address
Map<String, String> emailFields = emails.get(0);
email = emailFields.get("address"); // depends on control dependency: [if], data = [none]
}
}
return email;
} } |
public class class_name {
public void marshall(DescribeProjectRequest describeProjectRequest, ProtocolMarshaller protocolMarshaller) {
if (describeProjectRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeProjectRequest.getProjectId(), PROJECTID_BINDING);
protocolMarshaller.marshall(describeProjectRequest.getSyncFromResources(), SYNCFROMRESOURCES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeProjectRequest describeProjectRequest, ProtocolMarshaller protocolMarshaller) {
if (describeProjectRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeProjectRequest.getProjectId(), PROJECTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeProjectRequest.getSyncFromResources(), SYNCFROMRESOURCES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int getOrientation(RecyclerView view) {
LayoutManager layout = view.getLayoutManager();
if (layout instanceof LinearLayoutManager) {
return ((LinearLayoutManager) layout).getOrientation();
} else if (layout instanceof StaggeredGridLayoutManager) {
return ((StaggeredGridLayoutManager) layout).getOrientation();
}
return -1;
} } | public class class_name {
public static int getOrientation(RecyclerView view) {
LayoutManager layout = view.getLayoutManager();
if (layout instanceof LinearLayoutManager) {
return ((LinearLayoutManager) layout).getOrientation(); // depends on control dependency: [if], data = [none]
} else if (layout instanceof StaggeredGridLayoutManager) {
return ((StaggeredGridLayoutManager) layout).getOrientation(); // depends on control dependency: [if], data = [none]
}
return -1;
} } |
public class class_name {
public void marshall(GetModelRequest getModelRequest, ProtocolMarshaller protocolMarshaller) {
if (getModelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getModelRequest.getApiId(), APIID_BINDING);
protocolMarshaller.marshall(getModelRequest.getModelId(), MODELID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetModelRequest getModelRequest, ProtocolMarshaller protocolMarshaller) {
if (getModelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getModelRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getModelRequest.getModelId(), MODELID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static Collection<?> getCollectionFromDocumentList(Metamodel metamodel, BasicDBList documentList,
Class embeddedCollectionClass, Class embeddedObjectClass, Set<Attribute> columns)
{
Collection<Object> embeddedCollection = null;
if (embeddedCollectionClass.equals(Set.class))
{
embeddedCollection = new HashSet<Object>();
}
else if (embeddedCollectionClass.equals(List.class))
{
embeddedCollection = new ArrayList<Object>();
}
else
{
throw new PersistenceException(
"Invalid collection class " + embeddedCollectionClass + "; only Set and List allowed");
}
for (Object dbObj : documentList)
{
try
{
Object obj = embeddedObjectClass.newInstance();
embeddedCollection.add(getObjectFromDocument(metamodel, (BasicDBObject) dbObj, columns, obj));
}
catch (InstantiationException e)
{
throw new PersistenceException(e);
}
catch (IllegalAccessException e)
{
throw new PersistenceException(e);
}
}
return embeddedCollection;
} } | public class class_name {
static Collection<?> getCollectionFromDocumentList(Metamodel metamodel, BasicDBList documentList,
Class embeddedCollectionClass, Class embeddedObjectClass, Set<Attribute> columns)
{
Collection<Object> embeddedCollection = null;
if (embeddedCollectionClass.equals(Set.class))
{
embeddedCollection = new HashSet<Object>();
// depends on control dependency: [if], data = [none]
}
else if (embeddedCollectionClass.equals(List.class))
{
embeddedCollection = new ArrayList<Object>();
// depends on control dependency: [if], data = [none]
}
else
{
throw new PersistenceException(
"Invalid collection class " + embeddedCollectionClass + "; only Set and List allowed");
}
for (Object dbObj : documentList)
{
try
{
Object obj = embeddedObjectClass.newInstance();
embeddedCollection.add(getObjectFromDocument(metamodel, (BasicDBObject) dbObj, columns, obj));
// depends on control dependency: [try], data = [none]
}
catch (InstantiationException e)
{
throw new PersistenceException(e);
}
// depends on control dependency: [catch], data = [none]
catch (IllegalAccessException e)
{
throw new PersistenceException(e);
}
// depends on control dependency: [catch], data = [none]
}
return embeddedCollection;
} } |
public class class_name {
public static String readAsString( String path ) {
InputStream stream = openStream(path);
if( stream == null ) {
System.err.println("Failed to open "+path);
return null;
}
return readAsString(stream);
} } | public class class_name {
public static String readAsString( String path ) {
InputStream stream = openStream(path);
if( stream == null ) {
System.err.println("Failed to open "+path); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return readAsString(stream);
} } |
public class class_name {
public static DisqueURI create(URI uri) {
DisqueURI.Builder builder;
builder = configureDisque(uri);
if (URI_SCHEME_DISQUE_SECURE.equals(uri.getScheme())) {
builder.withSsl(true);
}
String userInfo = uri.getUserInfo();
if (isEmpty(userInfo) && isNotEmpty(uri.getAuthority()) && uri.getAuthority().indexOf('@') > 0) {
userInfo = uri.getAuthority().substring(0, uri.getAuthority().indexOf('@'));
}
if (isNotEmpty(userInfo)) {
String password = userInfo;
if (password.startsWith(":")) {
password = password.substring(1);
}
builder.withPassword(password);
}
return builder.build();
} } | public class class_name {
public static DisqueURI create(URI uri) {
DisqueURI.Builder builder;
builder = configureDisque(uri);
if (URI_SCHEME_DISQUE_SECURE.equals(uri.getScheme())) {
builder.withSsl(true); // depends on control dependency: [if], data = [none]
}
String userInfo = uri.getUserInfo();
if (isEmpty(userInfo) && isNotEmpty(uri.getAuthority()) && uri.getAuthority().indexOf('@') > 0) {
userInfo = uri.getAuthority().substring(0, uri.getAuthority().indexOf('@')); // depends on control dependency: [if], data = [none]
}
if (isNotEmpty(userInfo)) {
String password = userInfo;
if (password.startsWith(":")) {
password = password.substring(1); // depends on control dependency: [if], data = [none]
}
builder.withPassword(password); // depends on control dependency: [if], data = [none]
}
return builder.build();
} } |
public class class_name {
public void marshall(TimestampRange timestampRange, ProtocolMarshaller protocolMarshaller) {
if (timestampRange == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(timestampRange.getBeginDate(), BEGINDATE_BINDING);
protocolMarshaller.marshall(timestampRange.getEndDate(), ENDDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TimestampRange timestampRange, ProtocolMarshaller protocolMarshaller) {
if (timestampRange == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(timestampRange.getBeginDate(), BEGINDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(timestampRange.getEndDate(), ENDDATE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static List<Element> getChildElements(Element ele) {
Assert.notNull(ele, "Element must not be null");
NodeList nl = ele.getChildNodes();
List<Element> childEles = new ArrayList<Element>();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element) {
childEles.add((Element) node);
}
}
return childEles;
} } | public class class_name {
public static List<Element> getChildElements(Element ele) {
Assert.notNull(ele, "Element must not be null");
NodeList nl = ele.getChildNodes();
List<Element> childEles = new ArrayList<Element>();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element) {
childEles.add((Element) node); // depends on control dependency: [if], data = [none]
}
}
return childEles;
} } |
public class class_name {
public float[][] projToLatLon(float[][] from, float[][] to) {
int cnt = from[0].length;
float[] fromXA = from[INDEX_X];
float[] fromYA = from[INDEX_Y];
float[] toLatA = to[INDEX_LAT];
float[] toLonA = to[INDEX_LON];
double toLat, toLon;
for (int i = 0; i < cnt; i++) {
double fromX = fromXA[i] - falseEasting;
double fromY = fromYA[i] - falseNorthing;
double rhop = rho;
if (n < 0) {
rhop *= -1.0;
fromX *= -1.0;
fromY *= -1.0;
}
double yd = (rhop - fromY);
double theta = Math.atan2(fromX, yd);
double r = Math.sqrt(fromX * fromX + yd * yd);
if (n < 0.0) {
r *= -1.0;
}
toLon = (Math.toDegrees(theta / n + lon0));
if (Math.abs(r) < TOLERANCE) {
toLat = ((n < 0.0)
? -90.0
: 90.0);
} else {
double rn = Math.pow(earth_radius * F / r, 1 / n);
toLat = Math.toDegrees(2.0 * Math.atan(rn) - Math.PI / 2);
}
toLatA[i] = (float) toLat;
toLonA[i] = (float) toLon;
}
return to;
} } | public class class_name {
public float[][] projToLatLon(float[][] from, float[][] to) {
int cnt = from[0].length;
float[] fromXA = from[INDEX_X];
float[] fromYA = from[INDEX_Y];
float[] toLatA = to[INDEX_LAT];
float[] toLonA = to[INDEX_LON];
double toLat, toLon;
for (int i = 0; i < cnt; i++) {
double fromX = fromXA[i] - falseEasting;
double fromY = fromYA[i] - falseNorthing;
double rhop = rho;
if (n < 0) {
rhop *= -1.0;
// depends on control dependency: [if], data = [none]
fromX *= -1.0;
// depends on control dependency: [if], data = [none]
fromY *= -1.0;
// depends on control dependency: [if], data = [none]
}
double yd = (rhop - fromY);
double theta = Math.atan2(fromX, yd);
double r = Math.sqrt(fromX * fromX + yd * yd);
if (n < 0.0) {
r *= -1.0;
// depends on control dependency: [if], data = [none]
}
toLon = (Math.toDegrees(theta / n + lon0));
// depends on control dependency: [for], data = [none]
if (Math.abs(r) < TOLERANCE) {
toLat = ((n < 0.0)
? -90.0
: 90.0);
// depends on control dependency: [if], data = [none]
} else {
double rn = Math.pow(earth_radius * F / r, 1 / n);
toLat = Math.toDegrees(2.0 * Math.atan(rn) - Math.PI / 2);
// depends on control dependency: [if], data = [none]
}
toLatA[i] = (float) toLat;
// depends on control dependency: [for], data = [i]
toLonA[i] = (float) toLon;
// depends on control dependency: [for], data = [i]
}
return to;
} } |
public class class_name {
protected boolean match(final URI uri) {
final String methodName = "match";
final String uriStr = prepareUri(uri);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName, this, uriStr, ignoreCase, wildcard);
}
if (this.matcher == null) {
if (ignoreCase) {
if (pattern.equalsIgnoreCase(uriStr)) {
return true;
}
if (wildcard && uriStr.toLowerCase().startsWith(pattern)) {
return true;
}
} else {
if (pattern.equals(uriStr)) {
return true;
}
if (wildcard && uriStr.startsWith(pattern)) {
return true;
}
}
} else {
return this.matcher.matcher(uriStr).matches();
}
return false;
} } | public class class_name {
protected boolean match(final URI uri) {
final String methodName = "match";
final String uriStr = prepareUri(uri);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName, this, uriStr, ignoreCase, wildcard); // depends on control dependency: [if], data = [none]
}
if (this.matcher == null) {
if (ignoreCase) {
if (pattern.equalsIgnoreCase(uriStr)) {
return true; // depends on control dependency: [if], data = [none]
}
if (wildcard && uriStr.toLowerCase().startsWith(pattern)) {
return true; // depends on control dependency: [if], data = [none]
}
} else {
if (pattern.equals(uriStr)) {
return true; // depends on control dependency: [if], data = [none]
}
if (wildcard && uriStr.startsWith(pattern)) {
return true; // depends on control dependency: [if], data = [none]
}
}
} else {
return this.matcher.matcher(uriStr).matches(); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public FieldLocation getFieldLocation(FieldType type)
{
FieldLocation result = null;
FieldItem item = m_map.get(type);
if (item != null)
{
result = item.getFieldLocation();
}
return result;
} } | public class class_name {
public FieldLocation getFieldLocation(FieldType type)
{
FieldLocation result = null;
FieldItem item = m_map.get(type);
if (item != null)
{
result = item.getFieldLocation(); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private void checkItem(Element root, Deque<Element> parents) throws SAXException {
Deque<Element> pending = new ArrayDeque<Element>();
Set<Element> memory = new HashSet<Element>();
memory.add(root);
for (Element child : root.children) {
pending.push(child);
}
if (root.itemRef != null) {
for (String id : root.itemRef) {
Element refElm = idmap.get(id);
if (refElm != null) {
pending.push(refElm);
} else {
err("The \u201Citemref\u201D attribute referenced \u201C" + id + "\u201D, but there is no element with an \u201Cid\u201D attribute with that value.", root.locator);
}
}
}
boolean memoryError = false;
while (pending.size() > 0) {
Element current = pending.pop();
if (memory.contains(current)) {
memoryError = true;
continue;
}
memory.add(current);
if (!current.itemScope) {
for (Element child : current.children) {
pending.push(child);
}
}
if (current.itemProp != null) {
properties.remove(current);
if (current.itemScope) {
if (!parents.contains(current)) {
parents.push(root);
checkItem(current, parents);
parents.pop();
} else {
err("The \u201Citemref\u201D attribute created a circular reference with another item.", current.locator);
}
}
}
}
if (memoryError) {
err("The \u201Citemref\u201D attribute contained redundant references.", root.locator);
}
} } | public class class_name {
private void checkItem(Element root, Deque<Element> parents) throws SAXException {
Deque<Element> pending = new ArrayDeque<Element>();
Set<Element> memory = new HashSet<Element>();
memory.add(root);
for (Element child : root.children) {
pending.push(child);
}
if (root.itemRef != null) {
for (String id : root.itemRef) {
Element refElm = idmap.get(id);
if (refElm != null) {
pending.push(refElm); // depends on control dependency: [if], data = [(refElm]
} else {
err("The \u201Citemref\u201D attribute referenced \u201C" + id + "\u201D, but there is no element with an \u201Cid\u201D attribute with that value.", root.locator); // depends on control dependency: [if], data = [none]
}
}
}
boolean memoryError = false;
while (pending.size() > 0) {
Element current = pending.pop();
if (memory.contains(current)) {
memoryError = true;
continue;
}
memory.add(current);
if (!current.itemScope) {
for (Element child : current.children) {
pending.push(child);
}
}
if (current.itemProp != null) {
properties.remove(current);
if (current.itemScope) {
if (!parents.contains(current)) {
parents.push(root);
checkItem(current, parents);
parents.pop();
} else {
err("The \u201Citemref\u201D attribute created a circular reference with another item.", current.locator);
}
}
}
}
if (memoryError) {
err("The \u201Citemref\u201D attribute contained redundant references.", root.locator);
}
} } |
public class class_name {
public void marshall(DescribePipelinesRequest describePipelinesRequest, ProtocolMarshaller protocolMarshaller) {
if (describePipelinesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describePipelinesRequest.getPipelineIds(), PIPELINEIDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribePipelinesRequest describePipelinesRequest, ProtocolMarshaller protocolMarshaller) {
if (describePipelinesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describePipelinesRequest.getPipelineIds(), PIPELINEIDS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public File getAlternateContentDirectory(String userAgent) {
Configuration config = liveConfig;
for(AlternateContent configuration: config.configs) {
try {
if(configuration.compiledPattern.matcher(userAgent).matches()) {
return new File(config.metaDir, configuration.getContentDirectory());
}
} catch(Exception e) {
logger.warn("Failed to process config: "+ configuration.getPattern()+"->"+ configuration.getContentDirectory(), e);
}
}
return null;
} } | public class class_name {
public File getAlternateContentDirectory(String userAgent) {
Configuration config = liveConfig;
for(AlternateContent configuration: config.configs) {
try {
if(configuration.compiledPattern.matcher(userAgent).matches()) {
return new File(config.metaDir, configuration.getContentDirectory()); // depends on control dependency: [if], data = [none]
}
} catch(Exception e) {
logger.warn("Failed to process config: "+ configuration.getPattern()+"->"+ configuration.getContentDirectory(), e);
} // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
public synchronized List<GrammarError> grammarErrors(String text, String language) {
requireValidHandle();
List<GrammarError> errorList = new ArrayList<GrammarError>();
if (!isValidInput(text)) {
return errorList;
}
int offset = 0;
for (String paragraph : text.replace("\r", "\n").split("\\n")) {
appendErrorsFromParagraph(errorList, paragraph, offset, language);
offset += paragraph.length() + 1;
}
return errorList;
} } | public class class_name {
public synchronized List<GrammarError> grammarErrors(String text, String language) {
requireValidHandle();
List<GrammarError> errorList = new ArrayList<GrammarError>();
if (!isValidInput(text)) {
return errorList; // depends on control dependency: [if], data = [none]
}
int offset = 0;
for (String paragraph : text.replace("\r", "\n").split("\\n")) {
appendErrorsFromParagraph(errorList, paragraph, offset, language); // depends on control dependency: [for], data = [paragraph]
offset += paragraph.length() + 1; // depends on control dependency: [for], data = [paragraph]
}
return errorList;
} } |
public class class_name {
@SuppressWarnings({"ConstantConditions"})
@Override
public void load() {
Class<? extends RepositoryBrowser> rb = repositoryBrowser;
super.load();
if (repositoryBrowser!=rb) { // XStream may overwrite even the final field.
try {
Field f = SCMDescriptor.class.getDeclaredField("repositoryBrowser");
f.setAccessible(true);
f.set(this,rb);
} catch (NoSuchFieldException | IllegalAccessException e) {
LOGGER.log(WARNING, "Failed to overwrite the repositoryBrowser field",e);
}
}
} } | public class class_name {
@SuppressWarnings({"ConstantConditions"})
@Override
public void load() {
Class<? extends RepositoryBrowser> rb = repositoryBrowser;
super.load();
if (repositoryBrowser!=rb) { // XStream may overwrite even the final field.
try {
Field f = SCMDescriptor.class.getDeclaredField("repositoryBrowser");
f.setAccessible(true); // depends on control dependency: [try], data = [none]
f.set(this,rb); // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException | IllegalAccessException e) {
LOGGER.log(WARNING, "Failed to overwrite the repositoryBrowser field",e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public boolean checkPackageGroups(String groupname,
String pkgNameFormList) {
StringTokenizer strtok = new StringTokenizer(pkgNameFormList, ":");
if (groupList.contains(groupname)) {
configuration.message.warning("doclet.Groupname_already_used", groupname);
return false;
}
groupList.add(groupname);
while (strtok.hasMoreTokens()) {
String id = strtok.nextToken();
if (id.length() == 0) {
configuration.message.warning("doclet.Error_in_packagelist", groupname, pkgNameFormList);
return false;
}
if (id.endsWith("*")) {
id = id.substring(0, id.length() - 1);
if (foundGroupFormat(regExpGroupMap, id)) {
return false;
}
regExpGroupMap.put(id, groupname);
sortedRegExpList.add(id);
} else {
if (foundGroupFormat(pkgNameGroupMap, id)) {
return false;
}
pkgNameGroupMap.put(id, groupname);
}
}
Collections.sort(sortedRegExpList, new MapKeyComparator());
return true;
} } | public class class_name {
public boolean checkPackageGroups(String groupname,
String pkgNameFormList) {
StringTokenizer strtok = new StringTokenizer(pkgNameFormList, ":");
if (groupList.contains(groupname)) {
configuration.message.warning("doclet.Groupname_already_used", groupname); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
groupList.add(groupname);
while (strtok.hasMoreTokens()) {
String id = strtok.nextToken();
if (id.length() == 0) {
configuration.message.warning("doclet.Error_in_packagelist", groupname, pkgNameFormList); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (id.endsWith("*")) {
id = id.substring(0, id.length() - 1); // depends on control dependency: [if], data = [none]
if (foundGroupFormat(regExpGroupMap, id)) {
return false; // depends on control dependency: [if], data = [none]
}
regExpGroupMap.put(id, groupname); // depends on control dependency: [if], data = [none]
sortedRegExpList.add(id); // depends on control dependency: [if], data = [none]
} else {
if (foundGroupFormat(pkgNameGroupMap, id)) {
return false; // depends on control dependency: [if], data = [none]
}
pkgNameGroupMap.put(id, groupname); // depends on control dependency: [if], data = [none]
}
}
Collections.sort(sortedRegExpList, new MapKeyComparator());
return true;
} } |
public class class_name {
public ComputeNodeRebootHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new DateTimeRfc1123(lastModified);
}
return this;
} } | public class class_name {
public ComputeNodeRebootHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null; // depends on control dependency: [if], data = [none]
} else {
this.lastModified = new DateTimeRfc1123(lastModified); // depends on control dependency: [if], data = [(lastModified]
}
return this;
} } |
public class class_name {
private boolean newImage(String name, String filename) {
ImageDescriptor id;
boolean success;
try {
URL fileURL =
FileLocator.find(bundle, new Path(RESOURCE_DIR + filename), null);
id = ImageDescriptor.createFromURL(FileLocator.toFileURL(fileURL));
success = true;
} catch (Exception e) {
e.printStackTrace();
id = ImageDescriptor.getMissingImageDescriptor();
// id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK);
success = false;
}
descMap.put(name, id);
imageMap.put(name, id.createImage(true));
return success;
} } | public class class_name {
private boolean newImage(String name, String filename) {
ImageDescriptor id;
boolean success;
try {
URL fileURL =
FileLocator.find(bundle, new Path(RESOURCE_DIR + filename), null);
id = ImageDescriptor.createFromURL(FileLocator.toFileURL(fileURL)); // depends on control dependency: [try], data = [none]
success = true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
id = ImageDescriptor.getMissingImageDescriptor();
// id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK);
success = false;
} // depends on control dependency: [catch], data = [none]
descMap.put(name, id);
imageMap.put(name, id.createImage(true));
return success;
} } |
public class class_name {
public void logError(@Nullable final String text) {
if (text != null && this.preprocessorLogger != null) {
this.preprocessorLogger.error(text);
}
} } | public class class_name {
public void logError(@Nullable final String text) {
if (text != null && this.preprocessorLogger != null) {
this.preprocessorLogger.error(text); // depends on control dependency: [if], data = [(text]
}
} } |
public class class_name {
public static CompletionException asCompletionException( Throwable error )
{
if ( error instanceof CompletionException )
{
return ((CompletionException) error);
}
return new CompletionException( error );
} } | public class class_name {
public static CompletionException asCompletionException( Throwable error )
{
if ( error instanceof CompletionException )
{
return ((CompletionException) error); // depends on control dependency: [if], data = [none]
}
return new CompletionException( error );
} } |
public class class_name {
String getFormattedArray(Object attribute, String indent) {
int arrayLength = Array.getLength(attribute);
if (arrayLength == 0) {
return "[]";
}
Class<?> componentType = attribute.getClass().getComponentType();
// For the 8 primitive types, a cast is necessary when invoking
// Arrays.toString. The array data is then broken into separate
// lines
if (componentType.equals(boolean.class)) {
return formatPrimitiveArrayString(Arrays.toString((boolean[]) attribute), indent);
} else if (componentType.equals(byte.class)) {
return formatPrimitiveArrayString(Arrays.toString((byte[]) attribute), indent);
} else if (componentType.equals(char.class)) {
return formatPrimitiveArrayString(Arrays.toString((char[]) attribute), indent);
} else if (componentType.equals(double.class)) {
return formatPrimitiveArrayString(Arrays.toString((double[]) attribute), indent);
} else if (componentType.equals(float.class)) {
return formatPrimitiveArrayString(Arrays.toString((float[]) attribute), indent);
} else if (componentType.equals(int.class)) {
return formatPrimitiveArrayString(Arrays.toString((int[]) attribute), indent);
} else if (componentType.equals(long.class)) {
return formatPrimitiveArrayString(Arrays.toString((long[]) attribute), indent);
} else if (componentType.equals(short.class)) {
return formatPrimitiveArrayString(Arrays.toString((short[]) attribute), indent);
}
// Arbitrary strings can have ', ' in them so we iterate here
StringBuilder sb = new StringBuilder();
indent += INDENT;
Object[] array = (Object[]) attribute;
for (int i = 0; i < array.length; i++) {
sb.append("\n").append(indent).append("[").append(i).append("]: ");
sb.append(String.valueOf(array[i]));
}
return sb.toString();
} } | public class class_name {
String getFormattedArray(Object attribute, String indent) {
int arrayLength = Array.getLength(attribute);
if (arrayLength == 0) {
return "[]"; // depends on control dependency: [if], data = [none]
}
Class<?> componentType = attribute.getClass().getComponentType();
// For the 8 primitive types, a cast is necessary when invoking
// Arrays.toString. The array data is then broken into separate
// lines
if (componentType.equals(boolean.class)) {
return formatPrimitiveArrayString(Arrays.toString((boolean[]) attribute), indent); // depends on control dependency: [if], data = [none]
} else if (componentType.equals(byte.class)) {
return formatPrimitiveArrayString(Arrays.toString((byte[]) attribute), indent); // depends on control dependency: [if], data = [none]
} else if (componentType.equals(char.class)) {
return formatPrimitiveArrayString(Arrays.toString((char[]) attribute), indent); // depends on control dependency: [if], data = [none]
} else if (componentType.equals(double.class)) {
return formatPrimitiveArrayString(Arrays.toString((double[]) attribute), indent); // depends on control dependency: [if], data = [none]
} else if (componentType.equals(float.class)) {
return formatPrimitiveArrayString(Arrays.toString((float[]) attribute), indent); // depends on control dependency: [if], data = [none]
} else if (componentType.equals(int.class)) {
return formatPrimitiveArrayString(Arrays.toString((int[]) attribute), indent); // depends on control dependency: [if], data = [none]
} else if (componentType.equals(long.class)) {
return formatPrimitiveArrayString(Arrays.toString((long[]) attribute), indent); // depends on control dependency: [if], data = [none]
} else if (componentType.equals(short.class)) {
return formatPrimitiveArrayString(Arrays.toString((short[]) attribute), indent); // depends on control dependency: [if], data = [none]
}
// Arbitrary strings can have ', ' in them so we iterate here
StringBuilder sb = new StringBuilder();
indent += INDENT;
Object[] array = (Object[]) attribute;
for (int i = 0; i < array.length; i++) {
sb.append("\n").append(indent).append("[").append(i).append("]: "); // depends on control dependency: [for], data = [i]
sb.append(String.valueOf(array[i])); // depends on control dependency: [for], data = [i]
}
return sb.toString();
} } |
public class class_name {
public static Iterable<byte[]> iterateOnSplits(final byte[] a, final byte[]b, boolean inclusive, final int num) {
byte [] aPadded;
byte [] bPadded;
if (a.length < b.length) {
aPadded = padTail(a, b.length - a.length);
bPadded = b;
} else if (b.length < a.length) {
aPadded = a;
bPadded = padTail(b, a.length - b.length);
} else {
aPadded = a;
bPadded = b;
}
if (compareTo(aPadded, bPadded) >= 0) {
throw new IllegalArgumentException("b <= a");
}
if (num <= 0) {
throw new IllegalArgumentException("num cannot be < 0");
}
byte [] prependHeader = {1, 0};
final BigInteger startBI = new BigInteger(add(prependHeader, aPadded));
final BigInteger stopBI = new BigInteger(add(prependHeader, bPadded));
BigInteger diffBI = stopBI.subtract(startBI);
if (inclusive) {
diffBI = diffBI.add(BigInteger.ONE);
}
final BigInteger splitsBI = BigInteger.valueOf(num + 1);
if (diffBI.compareTo(splitsBI) < 0) {
return null;
}
final BigInteger intervalBI;
try {
intervalBI = diffBI.divide(splitsBI);
} catch (Exception e) {
return null;
}
final Iterator<byte[]> iterator = new Iterator<byte[]>() {
private int i = -1;
@Override
public boolean hasNext() {
return this.i < num + 1;
}
@Override
public byte[] next() {
this.i++;
if (this.i == 0) {
return a;
}
if (this.i == num + 1) {
return b;
}
BigInteger curBI = startBI.add(intervalBI.multiply(BigInteger.valueOf(this.i)));
byte [] padded = curBI.toByteArray();
if (padded[1] == 0) {
padded = tail(padded, padded.length - 2);
} else {
padded = tail(padded, padded.length - 1);
}
return padded;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
return new Iterable<byte[]>() {
@Override
public Iterator<byte[]> iterator() {
return iterator;
}
};
} } | public class class_name {
public static Iterable<byte[]> iterateOnSplits(final byte[] a, final byte[]b, boolean inclusive, final int num) {
byte [] aPadded;
byte [] bPadded;
if (a.length < b.length) {
aPadded = padTail(a, b.length - a.length); // depends on control dependency: [if], data = [none]
bPadded = b; // depends on control dependency: [if], data = [none]
} else if (b.length < a.length) {
aPadded = a; // depends on control dependency: [if], data = [none]
bPadded = padTail(b, a.length - b.length); // depends on control dependency: [if], data = [none]
} else {
aPadded = a; // depends on control dependency: [if], data = [none]
bPadded = b; // depends on control dependency: [if], data = [none]
}
if (compareTo(aPadded, bPadded) >= 0) {
throw new IllegalArgumentException("b <= a");
}
if (num <= 0) {
throw new IllegalArgumentException("num cannot be < 0");
}
byte [] prependHeader = {1, 0};
final BigInteger startBI = new BigInteger(add(prependHeader, aPadded));
final BigInteger stopBI = new BigInteger(add(prependHeader, bPadded));
BigInteger diffBI = stopBI.subtract(startBI);
if (inclusive) {
diffBI = diffBI.add(BigInteger.ONE); // depends on control dependency: [if], data = [none]
}
final BigInteger splitsBI = BigInteger.valueOf(num + 1);
if (diffBI.compareTo(splitsBI) < 0) {
return null; // depends on control dependency: [if], data = [none]
}
final BigInteger intervalBI;
try {
intervalBI = diffBI.divide(splitsBI); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
} // depends on control dependency: [catch], data = [none]
final Iterator<byte[]> iterator = new Iterator<byte[]>() {
private int i = -1;
@Override
public boolean hasNext() {
return this.i < num + 1;
}
@Override
public byte[] next() {
this.i++;
if (this.i == 0) {
return a; // depends on control dependency: [if], data = [none]
}
if (this.i == num + 1) {
return b; // depends on control dependency: [if], data = [none]
}
BigInteger curBI = startBI.add(intervalBI.multiply(BigInteger.valueOf(this.i)));
byte [] padded = curBI.toByteArray();
if (padded[1] == 0) {
padded = tail(padded, padded.length - 2); // depends on control dependency: [if], data = [none]
} else {
padded = tail(padded, padded.length - 1); // depends on control dependency: [if], data = [none]
}
return padded;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
return new Iterable<byte[]>() {
@Override
public Iterator<byte[]> iterator() {
return iterator;
}
};
} } |
public class class_name {
public JSONObject similarUpdateContSign(String contSign, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("cont_sign", contSign);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.SIMILAR_UPDATE);
postOperation(request);
return requestServer(request);
} } | public class class_name {
public JSONObject similarUpdateContSign(String contSign, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("cont_sign", contSign);
if (options != null) {
request.addBody(options); // depends on control dependency: [if], data = [(options]
}
request.setUri(ImageSearchConsts.SIMILAR_UPDATE);
postOperation(request);
return requestServer(request);
} } |
public class class_name {
private void processLinks(JsonParser jsonParser) throws IOException {
LOG.info("@odata.bind tag found - start parsing");
final String fullLinkFieldName = jsonParser.getText();
final String key = fullLinkFieldName.substring(0, fullLinkFieldName.indexOf(ODATA_BIND));
JsonToken token = jsonParser.nextToken();
if (token != JsonToken.START_ARRAY) {
// Single link
links.put(key, processLink(jsonParser));
} else {
// Array of links
final List<String> linksList = new ArrayList<>();
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
linksList.add(processLink(jsonParser));
}
this.links.put(key, linksList);
}
} } | public class class_name {
private void processLinks(JsonParser jsonParser) throws IOException {
LOG.info("@odata.bind tag found - start parsing");
final String fullLinkFieldName = jsonParser.getText();
final String key = fullLinkFieldName.substring(0, fullLinkFieldName.indexOf(ODATA_BIND));
JsonToken token = jsonParser.nextToken();
if (token != JsonToken.START_ARRAY) {
// Single link
links.put(key, processLink(jsonParser));
} else {
// Array of links
final List<String> linksList = new ArrayList<>();
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
linksList.add(processLink(jsonParser)); // depends on control dependency: [while], data = [none]
}
this.links.put(key, linksList);
}
} } |
public class class_name {
public MethodTypeSignature getTypeDescriptor() {
if (typeDescriptor == null) {
try {
typeDescriptor = MethodTypeSignature.parse(typeDescriptorStr, declaringClassName);
typeDescriptor.setScanResult(scanResult);
} catch (final ParseException e) {
throw new IllegalArgumentException(e);
}
}
return typeDescriptor;
} } | public class class_name {
public MethodTypeSignature getTypeDescriptor() {
if (typeDescriptor == null) {
try {
typeDescriptor = MethodTypeSignature.parse(typeDescriptorStr, declaringClassName); // depends on control dependency: [try], data = [none]
typeDescriptor.setScanResult(scanResult); // depends on control dependency: [try], data = [none]
} catch (final ParseException e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
}
return typeDescriptor;
} } |
public class class_name {
protected List<FileWrapper> handleGetAllFileContentWithMetaData(Class<? extends FileEntity> type, Integer entityId) {
List<FileMeta> metaDataList = this.handleGetEntityMetaFiles(type, entityId);
// Create an ExecutorService with the number of processors available to the Java virtual machine.
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
// First get all the FileContent
List<Future<FileContent>> futureList = new ArrayList<Future<FileContent>>();
for (FileMeta metaData : metaDataList) {
FileWorker fileWorker = new FileWorker(entityId, metaData.getId(), type, this);
Future<FileContent> fileContent = executor.submit(fileWorker);
futureList.add(fileContent);
}
Map<Integer, FileContent> fileContentMap = new HashMap<Integer, FileContent>();
for (Future<FileContent> future : futureList) {
try {
fileContentMap.put(future.get().getId(), future.get());
} catch (InterruptedException e) {
log.error("Error in bullhornapirest.getAllFileContentWithMetaData", e);
} catch (ExecutionException e) {
log.error("Error in bullhornapirest.getAllFileContentWithMetaData", e);
}
}
// shutdown pool, wait until it's done
executor.shutdown();
while (!executor.isTerminated()) {
}
// null it out
executor = null;
// Second create the FileWrapper list from the FileContent and FileMeta
List<FileWrapper> fileWrapperList = new ArrayList<FileWrapper>();
for (FileMeta metaData : metaDataList) {
FileContent fileContent = fileContentMap.get(metaData.getId());
FileWrapper fileWrapper = new StandardFileWrapper(fileContent, metaData);
fileWrapperList.add(fileWrapper);
}
return fileWrapperList;
} } | public class class_name {
protected List<FileWrapper> handleGetAllFileContentWithMetaData(Class<? extends FileEntity> type, Integer entityId) {
List<FileMeta> metaDataList = this.handleGetEntityMetaFiles(type, entityId);
// Create an ExecutorService with the number of processors available to the Java virtual machine.
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
// First get all the FileContent
List<Future<FileContent>> futureList = new ArrayList<Future<FileContent>>();
for (FileMeta metaData : metaDataList) {
FileWorker fileWorker = new FileWorker(entityId, metaData.getId(), type, this);
Future<FileContent> fileContent = executor.submit(fileWorker);
futureList.add(fileContent); // depends on control dependency: [for], data = [none]
}
Map<Integer, FileContent> fileContentMap = new HashMap<Integer, FileContent>();
for (Future<FileContent> future : futureList) {
try {
fileContentMap.put(future.get().getId(), future.get()); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
log.error("Error in bullhornapirest.getAllFileContentWithMetaData", e);
} catch (ExecutionException e) { // depends on control dependency: [catch], data = [none]
log.error("Error in bullhornapirest.getAllFileContentWithMetaData", e);
} // depends on control dependency: [catch], data = [none]
}
// shutdown pool, wait until it's done
executor.shutdown();
while (!executor.isTerminated()) {
}
// null it out
executor = null;
// Second create the FileWrapper list from the FileContent and FileMeta
List<FileWrapper> fileWrapperList = new ArrayList<FileWrapper>();
for (FileMeta metaData : metaDataList) {
FileContent fileContent = fileContentMap.get(metaData.getId());
FileWrapper fileWrapper = new StandardFileWrapper(fileContent, metaData);
fileWrapperList.add(fileWrapper); // depends on control dependency: [for], data = [none]
}
return fileWrapperList;
} } |
public class class_name {
public long getDurationMillis(Object object) {
// parse here because duration could be bigger than the int supported
// by the period parser
String original = (String) object;
String str = original;
int len = str.length();
if (len >= 4 &&
(str.charAt(0) == 'P' || str.charAt(0) == 'p') &&
(str.charAt(1) == 'T' || str.charAt(1) == 't') &&
(str.charAt(len - 1) == 'S' || str.charAt(len - 1) == 's')) {
// ok
} else {
throw new IllegalArgumentException("Invalid format: \"" + original + '"');
}
str = str.substring(2, len - 1);
int dot = -1;
boolean negative = false;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) >= '0' && str.charAt(i) <= '9') {
// ok
} else if (i == 0 && str.charAt(0) == '-') {
// ok
negative = true;
} else if (i > (negative ? 1 : 0) && str.charAt(i) == '.' && dot == -1) {
// ok
dot = i;
} else {
throw new IllegalArgumentException("Invalid format: \"" + original + '"');
}
}
long millis = 0, seconds = 0;
int firstDigit = negative ? 1 : 0;
if (dot > 0) {
seconds = Long.parseLong(str.substring(firstDigit, dot));
str = str.substring(dot + 1);
if (str.length() != 3) {
str = (str + "000").substring(0, 3);
}
millis = Integer.parseInt(str);
} else if (negative) {
seconds = Long.parseLong(str.substring(firstDigit, str.length()));
} else {
seconds = Long.parseLong(str);
}
if (negative) {
return FieldUtils.safeAdd(FieldUtils.safeMultiply(-seconds, 1000), -millis);
} else {
return FieldUtils.safeAdd(FieldUtils.safeMultiply(seconds, 1000), millis);
}
} } | public class class_name {
public long getDurationMillis(Object object) {
// parse here because duration could be bigger than the int supported
// by the period parser
String original = (String) object;
String str = original;
int len = str.length();
if (len >= 4 &&
(str.charAt(0) == 'P' || str.charAt(0) == 'p') &&
(str.charAt(1) == 'T' || str.charAt(1) == 't') &&
(str.charAt(len - 1) == 'S' || str.charAt(len - 1) == 's')) {
// ok
} else {
throw new IllegalArgumentException("Invalid format: \"" + original + '"');
}
str = str.substring(2, len - 1);
int dot = -1;
boolean negative = false;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) >= '0' && str.charAt(i) <= '9') {
// ok
} else if (i == 0 && str.charAt(0) == '-') {
// ok
negative = true; // depends on control dependency: [if], data = [none]
} else if (i > (negative ? 1 : 0) && str.charAt(i) == '.' && dot == -1) {
// ok
dot = i; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Invalid format: \"" + original + '"');
}
}
long millis = 0, seconds = 0;
int firstDigit = negative ? 1 : 0;
if (dot > 0) {
seconds = Long.parseLong(str.substring(firstDigit, dot)); // depends on control dependency: [if], data = [none]
str = str.substring(dot + 1); // depends on control dependency: [if], data = [(dot]
if (str.length() != 3) {
str = (str + "000").substring(0, 3); // depends on control dependency: [if], data = [3)]
}
millis = Integer.parseInt(str); // depends on control dependency: [if], data = [none]
} else if (negative) {
seconds = Long.parseLong(str.substring(firstDigit, str.length())); // depends on control dependency: [if], data = [none]
} else {
seconds = Long.parseLong(str); // depends on control dependency: [if], data = [none]
}
if (negative) {
return FieldUtils.safeAdd(FieldUtils.safeMultiply(-seconds, 1000), -millis); // depends on control dependency: [if], data = [none]
} else {
return FieldUtils.safeAdd(FieldUtils.safeMultiply(seconds, 1000), millis); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean isInFixedLengthPart(InternalType type) {
if (type instanceof DecimalType) {
return ((DecimalType) type).precision() <= DecimalType.MAX_COMPACT_PRECISION;
} else {
return MUTABLE_FIELD_TYPES.contains(type);
}
} } | public class class_name {
public static boolean isInFixedLengthPart(InternalType type) {
if (type instanceof DecimalType) {
return ((DecimalType) type).precision() <= DecimalType.MAX_COMPACT_PRECISION; // depends on control dependency: [if], data = [none]
} else {
return MUTABLE_FIELD_TYPES.contains(type); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void start() throws Exception
{
Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once");
client.createContainers(queuePath);
getInitialQueues();
leaderLatch.start();
service.submit
(
new Callable<Void>()
{
@Override
public Void call() throws Exception
{
while ( state.get() == State.STARTED )
{
try
{
Thread.sleep(policies.getThresholdCheckMs());
checkThreshold();
}
catch ( InterruptedException e )
{
// swallow the interrupt as it's only possible from either a background
// operation and, thus, doesn't apply to this loop or the instance
// is being closed in which case the while test will get it
}
}
return null;
}
}
);
} } | public class class_name {
public void start() throws Exception
{
Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once");
client.createContainers(queuePath);
getInitialQueues();
leaderLatch.start();
service.submit
(
new Callable<Void>()
{
@Override
public Void call() throws Exception
{
while ( state.get() == State.STARTED )
{
try
{
Thread.sleep(policies.getThresholdCheckMs()); // depends on control dependency: [try], data = [none]
checkThreshold(); // depends on control dependency: [try], data = [none]
}
catch ( InterruptedException e )
{
// swallow the interrupt as it's only possible from either a background
// operation and, thus, doesn't apply to this loop or the instance
// is being closed in which case the while test will get it
} // depends on control dependency: [catch], data = [none]
}
return null;
}
}
);
} } |
public class class_name {
@Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
Mat mat = (Mat) converter.convert(image.getFrame());
Mat result = new Mat();
try {
cvtColor(mat, result, conversionCode);
} catch (Exception e) {
throw new RuntimeException(e);
}
return new ImageWritable(converter.convert(result));
} } | public class class_name {
@Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null; // depends on control dependency: [if], data = [none]
}
Mat mat = (Mat) converter.convert(image.getFrame());
Mat result = new Mat();
try {
cvtColor(mat, result, conversionCode); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
return new ImageWritable(converter.convert(result));
} } |
public class class_name {
@Override
public void start() {
int port = getIntSetting(SETTING_PORT, DEFAULT_GRAPHITE_SERVER_PORT);
String host = getStringSetting(SETTING_HOST);
graphiteServerHostAndPort = new HostAndPort(host, port);
logger.info("Start Graphite Pickle writer connected to '{}'...", graphiteServerHostAndPort);
metricPathPrefix = getStringSetting(SETTING_NAME_PREFIX, DEFAULT_NAME_PREFIX);
metricPathPrefix = getStrategy().resolveExpression(metricPathPrefix);
if (!metricPathPrefix.isEmpty() && !metricPathPrefix.endsWith(".")) {
metricPathPrefix = metricPathPrefix + ".";
}
GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig();
config.setTestOnBorrow(getBooleanSetting("pool.testOnBorrow", true));
config.setTestWhileIdle(getBooleanSetting("pool.testWhileIdle", true));
config.setMaxTotal(getIntSetting("pool.maxActive", -1));
config.setMaxIdlePerKey(getIntSetting("pool.maxIdle", -1));
config.setMinEvictableIdleTimeMillis(getLongSetting("pool.minEvictableIdleTimeMillis", TimeUnit.MINUTES.toMillis(5)));
config.setTimeBetweenEvictionRunsMillis(getLongSetting("pool.timeBetweenEvictionRunsMillis", TimeUnit.MINUTES.toMillis(5)));
config.setJmxNameBase("org.jmxtrans.embedded:type=GenericKeyedObjectPool,writer=GraphitePickleWriter,name=");
config.setJmxNamePrefix(graphiteServerHostAndPort.getHost() + "_" + graphiteServerHostAndPort.getPort());
int socketConnectTimeoutInMillis = getIntSetting("graphite.socketConnectTimeoutInMillis", SocketOutputStreamPoolFactory.DEFAULT_SOCKET_CONNECT_TIMEOUT_IN_MILLIS);
socketOutputStreamPool = new GenericKeyedObjectPool<HostAndPort, SocketOutputStream>(new SocketOutputStreamPoolFactory(socketConnectTimeoutInMillis), config);
if (isEnabled()) {
try {
SocketOutputStream socketOutputStream = socketOutputStreamPool.borrowObject(graphiteServerHostAndPort);
socketOutputStreamPool.returnObject(graphiteServerHostAndPort, socketOutputStream);
} catch (Exception e) {
logger.warn("Test Connection: FAILURE to connect to Graphite server '{}'", graphiteServerHostAndPort, e);
}
}
try {
Class.forName("org.python.modules.cPickle");
} catch (ClassNotFoundException e) {
throw new EmbeddedJmxTransException("jython librarie is required by the " + getClass().getSimpleName() +
" but is not found in the classpath. Please add org.python:jython:2.5.3+ to the classpath.");
}
} } | public class class_name {
@Override
public void start() {
int port = getIntSetting(SETTING_PORT, DEFAULT_GRAPHITE_SERVER_PORT);
String host = getStringSetting(SETTING_HOST);
graphiteServerHostAndPort = new HostAndPort(host, port);
logger.info("Start Graphite Pickle writer connected to '{}'...", graphiteServerHostAndPort);
metricPathPrefix = getStringSetting(SETTING_NAME_PREFIX, DEFAULT_NAME_PREFIX);
metricPathPrefix = getStrategy().resolveExpression(metricPathPrefix);
if (!metricPathPrefix.isEmpty() && !metricPathPrefix.endsWith(".")) {
metricPathPrefix = metricPathPrefix + "."; // depends on control dependency: [if], data = [none]
}
GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig();
config.setTestOnBorrow(getBooleanSetting("pool.testOnBorrow", true));
config.setTestWhileIdle(getBooleanSetting("pool.testWhileIdle", true));
config.setMaxTotal(getIntSetting("pool.maxActive", -1));
config.setMaxIdlePerKey(getIntSetting("pool.maxIdle", -1));
config.setMinEvictableIdleTimeMillis(getLongSetting("pool.minEvictableIdleTimeMillis", TimeUnit.MINUTES.toMillis(5)));
config.setTimeBetweenEvictionRunsMillis(getLongSetting("pool.timeBetweenEvictionRunsMillis", TimeUnit.MINUTES.toMillis(5)));
config.setJmxNameBase("org.jmxtrans.embedded:type=GenericKeyedObjectPool,writer=GraphitePickleWriter,name=");
config.setJmxNamePrefix(graphiteServerHostAndPort.getHost() + "_" + graphiteServerHostAndPort.getPort());
int socketConnectTimeoutInMillis = getIntSetting("graphite.socketConnectTimeoutInMillis", SocketOutputStreamPoolFactory.DEFAULT_SOCKET_CONNECT_TIMEOUT_IN_MILLIS);
socketOutputStreamPool = new GenericKeyedObjectPool<HostAndPort, SocketOutputStream>(new SocketOutputStreamPoolFactory(socketConnectTimeoutInMillis), config);
if (isEnabled()) {
try {
SocketOutputStream socketOutputStream = socketOutputStreamPool.borrowObject(graphiteServerHostAndPort);
socketOutputStreamPool.returnObject(graphiteServerHostAndPort, socketOutputStream); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.warn("Test Connection: FAILURE to connect to Graphite server '{}'", graphiteServerHostAndPort, e);
} // depends on control dependency: [catch], data = [none]
}
try {
Class.forName("org.python.modules.cPickle");
} catch (ClassNotFoundException e) {
throw new EmbeddedJmxTransException("jython librarie is required by the " + getClass().getSimpleName() +
" but is not found in the classpath. Please add org.python:jython:2.5.3+ to the classpath.");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public AwsSecurityFindingFilters withProductArn(StringFilter... productArn) {
if (this.productArn == null) {
setProductArn(new java.util.ArrayList<StringFilter>(productArn.length));
}
for (StringFilter ele : productArn) {
this.productArn.add(ele);
}
return this;
} } | public class class_name {
public AwsSecurityFindingFilters withProductArn(StringFilter... productArn) {
if (this.productArn == null) {
setProductArn(new java.util.ArrayList<StringFilter>(productArn.length)); // depends on control dependency: [if], data = [none]
}
for (StringFilter ele : productArn) {
this.productArn.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void marshall(RestoreBackupRequest restoreBackupRequest, ProtocolMarshaller protocolMarshaller) {
if (restoreBackupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(restoreBackupRequest.getBackupId(), BACKUPID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RestoreBackupRequest restoreBackupRequest, ProtocolMarshaller protocolMarshaller) {
if (restoreBackupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(restoreBackupRequest.getBackupId(), BACKUPID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected final void insert_before_handle(
MethodGen mg,
InstructionHandle ih,
@Nullable InstructionList new_il,
boolean redirect_branches) {
if (new_il == null) {
return;
}
// Ignore methods with no instructions
InstructionList il = mg.getInstructionList();
if (il == null) {
return;
}
boolean at_start = (ih.getPrev() == null);
new_il.setPositions();
InstructionHandle new_end = new_il.getEnd();
int new_length = new_end.getPosition() + new_end.getInstruction().getLength();
print_stack_map_table("Before insert_inst");
debug_instrument.log(" insert_inst: %d%n%s%n", new_il.getLength(), new_il);
// Add the new code in front of the instruction handle.
InstructionHandle new_start = il.insert(ih, new_il);
il.setPositions();
if (redirect_branches) {
// Move all of the branches from the old instruction to the new start.
il.redirectBranches(ih, new_start);
}
// Move other targets to the new start.
if (ih.hasTargeters()) {
for (InstructionTargeter it : ih.getTargeters()) {
if ((it instanceof LineNumberGen) && redirect_branches) {
it.updateTarget(ih, new_start);
} else if (it instanceof LocalVariableGen) {
LocalVariableGen lvg = (LocalVariableGen) it;
// If ih is end of local variable range, leave as is.
// If ih is start of local variable range and we are
// at the begining of the method go ahead and change
// start to new_start. This is to preserve live range
// for variables that are live for entire method.
if ((lvg.getStart() == ih) && at_start) {
it.updateTarget(ih, new_start);
}
} else if ((it instanceof CodeExceptionGen) && redirect_branches) {
CodeExceptionGen exc = (CodeExceptionGen) it;
if (exc.getStartPC() == ih) exc.updateTarget(ih, new_start);
// else if (exc.getEndPC() == ih) leave as is
else if (exc.getHandlerPC() == ih) exc.setHandlerPC(new_start);
else System.out.printf("Malformed CodeException: %s%n", exc);
}
}
}
// Need to update stack map for change in length of instruction bytes.
// If redirect_branches is true then we don't want to change the
// offset of a stack map that was on the original ih, we want it
// to 'move' to the new_start. If we did not redirect the branches
// then we do want any stack map associated with the original ih
// to stay there. The routine update_stack_map starts looking for
// a stack map after the location given as its first argument.
// Thus we need to subtract one from this location if the
// redirect_branches flag is false.
il.setPositions();
update_stack_map_offset(new_start.getPosition() - (redirect_branches ? 0 : 1), new_length);
print_il(new_start, "After update_stack_map_offset");
// We need to see if inserting the additional instructions caused
// a change in the amount of switch instruction padding bytes.
modify_stack_maps_for_switches(new_start, il);
} } | public class class_name {
protected final void insert_before_handle(
MethodGen mg,
InstructionHandle ih,
@Nullable InstructionList new_il,
boolean redirect_branches) {
if (new_il == null) {
return; // depends on control dependency: [if], data = [none]
}
// Ignore methods with no instructions
InstructionList il = mg.getInstructionList();
if (il == null) {
return; // depends on control dependency: [if], data = [none]
}
boolean at_start = (ih.getPrev() == null);
new_il.setPositions();
InstructionHandle new_end = new_il.getEnd();
int new_length = new_end.getPosition() + new_end.getInstruction().getLength();
print_stack_map_table("Before insert_inst");
debug_instrument.log(" insert_inst: %d%n%s%n", new_il.getLength(), new_il);
// Add the new code in front of the instruction handle.
InstructionHandle new_start = il.insert(ih, new_il);
il.setPositions();
if (redirect_branches) {
// Move all of the branches from the old instruction to the new start.
il.redirectBranches(ih, new_start); // depends on control dependency: [if], data = [none]
}
// Move other targets to the new start.
if (ih.hasTargeters()) {
for (InstructionTargeter it : ih.getTargeters()) {
if ((it instanceof LineNumberGen) && redirect_branches) {
it.updateTarget(ih, new_start); // depends on control dependency: [if], data = [none]
} else if (it instanceof LocalVariableGen) {
LocalVariableGen lvg = (LocalVariableGen) it;
// If ih is end of local variable range, leave as is.
// If ih is start of local variable range and we are
// at the begining of the method go ahead and change
// start to new_start. This is to preserve live range
// for variables that are live for entire method.
if ((lvg.getStart() == ih) && at_start) {
it.updateTarget(ih, new_start); // depends on control dependency: [if], data = [none]
}
} else if ((it instanceof CodeExceptionGen) && redirect_branches) {
CodeExceptionGen exc = (CodeExceptionGen) it;
if (exc.getStartPC() == ih) exc.updateTarget(ih, new_start);
// else if (exc.getEndPC() == ih) leave as is
else if (exc.getHandlerPC() == ih) exc.setHandlerPC(new_start);
else System.out.printf("Malformed CodeException: %s%n", exc);
}
}
}
// Need to update stack map for change in length of instruction bytes.
// If redirect_branches is true then we don't want to change the
// offset of a stack map that was on the original ih, we want it
// to 'move' to the new_start. If we did not redirect the branches
// then we do want any stack map associated with the original ih
// to stay there. The routine update_stack_map starts looking for
// a stack map after the location given as its first argument.
// Thus we need to subtract one from this location if the
// redirect_branches flag is false.
il.setPositions();
update_stack_map_offset(new_start.getPosition() - (redirect_branches ? 0 : 1), new_length);
print_il(new_start, "After update_stack_map_offset");
// We need to see if inserting the additional instructions caused
// a change in the amount of switch instruction padding bytes.
modify_stack_maps_for_switches(new_start, il);
} } |
public class class_name {
public static void onStartup(String container, Object containerContext) {
try {
startedUp = false;
logger = LoggerUtil.getStandardLogger();
containerName = container;
// use reflection to avoid build-time dependencies
String pluginPackage = MdwDataSource.class.getPackage().getName() + "." + containerName.toLowerCase();
String namingProviderClass = pluginPackage + "." + containerName + "Naming";
namingProvider = Class.forName(namingProviderClass).asSubclass(NamingProvider.class).newInstance();
logger.info("Naming Provider: " + namingProvider.getClass().getName());
String ds = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_DATASOURCE_PROVIDER);
if (ds == null)
ds = PropertyManager.getProperty("mdw.container.datasource_provider"); // compatibility
if (StringHelper.isEmpty(ds) || ds.equals(DataSourceProvider.TOMCAT)) {
dataSourceProvider = new TomcatDataSource();
} else if (DataSourceProvider.MDW.equals(ds)){
dataSourceProvider = new MdwDataSource();
} else {
String dsProviderClass = pluginPackage + "." + ds + "DataSource";
dataSourceProvider = Class.forName(dsProviderClass).asSubclass(DataSourceProvider.class).newInstance();
}
logger.info("Data Source Provider: " + dataSourceProvider.getClass().getName());
String jms = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_JMS_PROVIDER);
if (jms == null)
jms = PropertyManager.getProperty("mdw.container.jms_provider"); // compatibility
if (StringHelper.isEmpty(jms))
jms = JmsProvider.ACTIVEMQ;
if (JmsProvider.ACTIVEMQ.equals(jms)) {
if (jmsProvider == null) {
// use below to avoid build time dependency
jmsProvider = Class.forName("com.centurylink.mdw.container.plugin.activemq.ActiveMqJms").asSubclass(JmsProvider.class).newInstance();
}
}
else {
String jmsProviderClass = pluginPackage + "." + jms + "Jms";
jmsProvider = Class.forName(jmsProviderClass).asSubclass(JmsProvider.class).newInstance();
}
logger.info("JMS Provider: " + (jmsProvider==null?"none":jmsProvider.getClass().getName()));
String tp = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_THREADPOOL_PROVIDER);
if (tp == null)
tp = PropertyManager.getProperty("mdw.container.threadpool_provider"); // compatibility
if (StringHelper.isEmpty(tp) || ThreadPoolProvider.MDW.equals(tp)) {
threadPoolProvider = new CommonThreadPool();
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName mbeanName = new ObjectName("com.centurylink.mdw.container.plugin:type=CommonThreadPool,name=MDW Thread Pool Info");
if (!mbs.isRegistered(mbeanName))
mbs.registerMBean(threadPoolProvider, mbeanName);
}
else {
String tpProviderClass = pluginPackage + "." + tp + "ThreadPool";
threadPoolProvider = Class.forName(tpProviderClass).asSubclass(ThreadPoolProvider.class).newInstance();
}
logger.info("Thread Pool Provider: " + threadPoolProvider.getClass().getName());
startedUp = true;
startupTime = new Date();
}
catch (Exception ex) {
throw new StartupException("Failed to initialize ApplicationContext", ex);
}
} } | public class class_name {
public static void onStartup(String container, Object containerContext) {
try {
startedUp = false; // depends on control dependency: [try], data = [none]
logger = LoggerUtil.getStandardLogger(); // depends on control dependency: [try], data = [none]
containerName = container; // depends on control dependency: [try], data = [none]
// use reflection to avoid build-time dependencies
String pluginPackage = MdwDataSource.class.getPackage().getName() + "." + containerName.toLowerCase();
String namingProviderClass = pluginPackage + "." + containerName + "Naming";
namingProvider = Class.forName(namingProviderClass).asSubclass(NamingProvider.class).newInstance(); // depends on control dependency: [try], data = [none]
logger.info("Naming Provider: " + namingProvider.getClass().getName()); // depends on control dependency: [try], data = [none]
String ds = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_DATASOURCE_PROVIDER);
if (ds == null)
ds = PropertyManager.getProperty("mdw.container.datasource_provider"); // compatibility
if (StringHelper.isEmpty(ds) || ds.equals(DataSourceProvider.TOMCAT)) {
dataSourceProvider = new TomcatDataSource(); // depends on control dependency: [if], data = [none]
} else if (DataSourceProvider.MDW.equals(ds)){
dataSourceProvider = new MdwDataSource(); // depends on control dependency: [if], data = [none]
} else {
String dsProviderClass = pluginPackage + "." + ds + "DataSource";
dataSourceProvider = Class.forName(dsProviderClass).asSubclass(DataSourceProvider.class).newInstance(); // depends on control dependency: [if], data = [none]
}
logger.info("Data Source Provider: " + dataSourceProvider.getClass().getName()); // depends on control dependency: [try], data = [none]
String jms = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_JMS_PROVIDER);
if (jms == null)
jms = PropertyManager.getProperty("mdw.container.jms_provider"); // compatibility
if (StringHelper.isEmpty(jms))
jms = JmsProvider.ACTIVEMQ;
if (JmsProvider.ACTIVEMQ.equals(jms)) {
if (jmsProvider == null) {
// use below to avoid build time dependency
jmsProvider = Class.forName("com.centurylink.mdw.container.plugin.activemq.ActiveMqJms").asSubclass(JmsProvider.class).newInstance(); // depends on control dependency: [if], data = [none]
}
}
else {
String jmsProviderClass = pluginPackage + "." + jms + "Jms";
jmsProvider = Class.forName(jmsProviderClass).asSubclass(JmsProvider.class).newInstance(); // depends on control dependency: [if], data = [none]
}
logger.info("JMS Provider: " + (jmsProvider==null?"none":jmsProvider.getClass().getName())); // depends on control dependency: [try], data = [none]
String tp = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_THREADPOOL_PROVIDER);
if (tp == null)
tp = PropertyManager.getProperty("mdw.container.threadpool_provider"); // compatibility
if (StringHelper.isEmpty(tp) || ThreadPoolProvider.MDW.equals(tp)) {
threadPoolProvider = new CommonThreadPool(); // depends on control dependency: [if], data = [none]
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName mbeanName = new ObjectName("com.centurylink.mdw.container.plugin:type=CommonThreadPool,name=MDW Thread Pool Info");
if (!mbs.isRegistered(mbeanName))
mbs.registerMBean(threadPoolProvider, mbeanName);
}
else {
String tpProviderClass = pluginPackage + "." + tp + "ThreadPool";
threadPoolProvider = Class.forName(tpProviderClass).asSubclass(ThreadPoolProvider.class).newInstance(); // depends on control dependency: [if], data = [none]
}
logger.info("Thread Pool Provider: " + threadPoolProvider.getClass().getName()); // depends on control dependency: [try], data = [none]
startedUp = true; // depends on control dependency: [try], data = [none]
startupTime = new Date(); // depends on control dependency: [try], data = [none]
}
catch (Exception ex) {
throw new StartupException("Failed to initialize ApplicationContext", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void log(String label, Class<?> klass, Map<String, Object> map)
{
if (LOG != null)
{
LOG.write(label);
LOG.write(": ");
LOG.println(klass.getSimpleName());
for (Map.Entry<String, Object> entry : map.entrySet())
{
LOG.println(entry.getKey() + ": " + entry.getValue());
}
LOG.println();
LOG.flush();
}
} } | public class class_name {
public static void log(String label, Class<?> klass, Map<String, Object> map)
{
if (LOG != null)
{
LOG.write(label); // depends on control dependency: [if], data = [none]
LOG.write(": "); // depends on control dependency: [if], data = [none]
LOG.println(klass.getSimpleName()); // depends on control dependency: [if], data = [none]
for (Map.Entry<String, Object> entry : map.entrySet())
{
LOG.println(entry.getKey() + ": " + entry.getValue()); // depends on control dependency: [for], data = [entry]
}
LOG.println(); // depends on control dependency: [if], data = [none]
LOG.flush(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected String escapeApostrophes(String text) {
String resultString;
if (text.contains("'")) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("concat('");
stringBuilder.append(text.replace("'", "',\"'\",'"));
stringBuilder.append("')");
resultString = stringBuilder.toString();
} else {
resultString = "'" + text + "'";
}
return resultString;
} } | public class class_name {
protected String escapeApostrophes(String text) {
String resultString;
if (text.contains("'")) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("concat('");
stringBuilder.append(text.replace("'", "',\"'\",'"));
stringBuilder.append("')");
// depends on control dependency: [if], data = [none]
resultString = stringBuilder.toString();
// depends on control dependency: [if], data = [none]
} else {
resultString = "'" + text + "'";
// depends on control dependency: [if], data = [none]
}
return resultString;
} } |
public class class_name {
public void setSuggestions(java.util.Collection<SuggestionMatch> suggestions) {
if (suggestions == null) {
this.suggestions = null;
return;
}
this.suggestions = new com.amazonaws.internal.SdkInternalList<SuggestionMatch>(suggestions);
} } | public class class_name {
public void setSuggestions(java.util.Collection<SuggestionMatch> suggestions) {
if (suggestions == null) {
this.suggestions = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.suggestions = new com.amazonaws.internal.SdkInternalList<SuggestionMatch>(suggestions);
} } |
public class class_name {
public void marshall(GetAttributeValuesRequest getAttributeValuesRequest, ProtocolMarshaller protocolMarshaller) {
if (getAttributeValuesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getAttributeValuesRequest.getServiceCode(), SERVICECODE_BINDING);
protocolMarshaller.marshall(getAttributeValuesRequest.getAttributeName(), ATTRIBUTENAME_BINDING);
protocolMarshaller.marshall(getAttributeValuesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(getAttributeValuesRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetAttributeValuesRequest getAttributeValuesRequest, ProtocolMarshaller protocolMarshaller) {
if (getAttributeValuesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getAttributeValuesRequest.getServiceCode(), SERVICECODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getAttributeValuesRequest.getAttributeName(), ATTRIBUTENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getAttributeValuesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getAttributeValuesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void addBefore(String relativePropertySourceName, PropertySource<?> propertySource) {
if (logger.isDebugEnabled()) {
logger.debug("Adding PropertySource '" + propertySource.getName()
+ "' with search precedence immediately higher than '" + relativePropertySourceName + "'");
}
assertLegalRelativeAddition(relativePropertySourceName, propertySource);
removeIfPresent(propertySource);
int index = assertPresentAndGetIndex(relativePropertySourceName);
addAtIndex(index, propertySource);
} } | public class class_name {
public void addBefore(String relativePropertySourceName, PropertySource<?> propertySource) {
if (logger.isDebugEnabled()) {
logger.debug("Adding PropertySource '" + propertySource.getName()
+ "' with search precedence immediately higher than '" + relativePropertySourceName + "'"); // depends on control dependency: [if], data = [none]
}
assertLegalRelativeAddition(relativePropertySourceName, propertySource);
removeIfPresent(propertySource);
int index = assertPresentAndGetIndex(relativePropertySourceName);
addAtIndex(index, propertySource);
} } |
public class class_name {
private void handleFileAnnotation(String featureName, String value) {
if (featureName.equals(GF_ACCESSION_NUMBER)) {
stockholmStructure.getFileAnnotation().setGFAccessionNumber(value);
} else if (featureName.equals(GF_IDENTIFICATION)) {
stockholmStructure.getFileAnnotation().setGFIdentification(value);
} else if (featureName.equals(GF_DB_REFERENCE)) {
stockholmStructure.getFileAnnotation().addDBReference(value);
} else if (featureName.equals(GF_DEFINITION)) {
stockholmStructure.getFileAnnotation().setGFDefinition(value);
} else if (featureName.equals(GF_AUTHOR)) {
stockholmStructure.getFileAnnotation().setGFAuthors(value);
} else if (featureName.equals(GF_ALIGNMENT_METHOD)) {
stockholmStructure.getFileAnnotation().setAlignmentMethod(value);
} else if (featureName.equals(GF_BUILD_METHOD)) {
stockholmStructure.getFileAnnotation().addGFBuildMethod(value);
} else if (featureName.equals(GF_SEARCH_METHOD)) {
stockholmStructure.getFileAnnotation().setGFSearchMethod(value);
} else if (featureName.equals(GF_SOURCE_SEED)) {
stockholmStructure.getFileAnnotation().setGFSourceSeed(value);
} else if (featureName.equals(GF_SOURCE_STRUCTURE)) {
stockholmStructure.getFileAnnotation().setGFSourceStructure(value);
} else if (featureName.equals(GF_GATHERING_THRESHOLD)) {
stockholmStructure.getFileAnnotation().setGFGatheringThreshs(value);
} else if (featureName.equals(GF_TRUSTED_CUTOFF)) {
stockholmStructure.getFileAnnotation().setGFTrustedCutoffs(value);
} else if (featureName.equals(GF_NOISE_CUTOFF)) {
stockholmStructure.getFileAnnotation().setGFNoiseCutoffs(value);
} else if (featureName.equals(GF_TYPE_FIELD)) {
stockholmStructure.getFileAnnotation().setGFTypeField(value);
} else if (featureName.equals(GF_PREVIOUS_IDS)) {
stockholmStructure.getFileAnnotation().setGFPreviousIDs(value);
} else if (featureName.equals(GF_SEQUENCE)) {
// status = STATUS_IN_SEQUENCE;
stockholmStructure.getFileAnnotation().setGFNumSequences(value);
} else if (featureName.equals(GF_DB_COMMENT)) {
stockholmStructure.getFileAnnotation().setGFDBComment(value);
// } else if (featureName.equals(GF_DB_REFERENCE)) {
// stockholmStructure.getFileAnnotation().addDBReference(value);
} else if (featureName.equals(GF_REFERENCE_COMMENT)) {
stockholmStructure.getFileAnnotation().setGFRefComment(value);
} else if (featureName.equals(GF_REFERENCE_NUMBER)) {
StockholmFileAnnotationReference reference = new StockholmFileAnnotationReference();
stockholmStructure.getFileAnnotation().getReferences().add(reference);
} else if (featureName.equals(GF_REFERENCE_MEDLINE)) {
stockholmStructure.getFileAnnotation().getReferences().lastElement().setRefMedline(value);
} else if (featureName.equals(GF_REFERENCE_TITLE)) {
stockholmStructure.getFileAnnotation().getReferences().lastElement().addToRefTitle(value);
} else if (featureName.equals(GF_REFERENCE_AUTHOR)) {
stockholmStructure.getFileAnnotation().getReferences().lastElement().addToRefAuthor(value);
} else if (featureName.equals(GF_REFERENCE_LOCALTION)) {
stockholmStructure.getFileAnnotation().getReferences().lastElement().setRefLocation(value);
} else if (featureName.equals(GF_KEYWORDS)) {
stockholmStructure.getFileAnnotation().setGFKeywords(value);
} else if (featureName.equals(GF_COMMENT)) {
stockholmStructure.getFileAnnotation().addToGFComment(value);
} else if (featureName.equals(GF_PFAM_ACCESSION)) {
stockholmStructure.getFileAnnotation().setGFPfamAccession(value);
} else if (featureName.equals(GF_LOCATION)) {
stockholmStructure.getFileAnnotation().setGFLocation(value);
} else if (featureName.equals(GF_WIKIPEDIA_LINK)) {
stockholmStructure.getFileAnnotation().setGFWikipediaLink(value);
} else if (featureName.equals(GF_CLAN)) {
stockholmStructure.getFileAnnotation().setGFClan(value);
} else if (featureName.equals(GF_MEMBERSHIP)) {
stockholmStructure.getFileAnnotation().setGFMembership(value);
} else if (featureName.equals(GF_NEW_HAMPSHIRE)) {
stockholmStructure.getFileAnnotation().addGFNewHampshire(value);
} else if (featureName.equals(GF_TREE_ID)) {
stockholmStructure.getFileAnnotation().addGFTreeID(value);
} else if (featureName.equals(GF_FALSE_DISCOVERY_RATE)) {
stockholmStructure.getFileAnnotation().addGFFalseDiscoveryRate(value);
} else {
// unknown feature
logger.warn("Unknown File Feature [{}].\nPlease contact the Biojava team.", featureName);
}
} } | public class class_name {
private void handleFileAnnotation(String featureName, String value) {
if (featureName.equals(GF_ACCESSION_NUMBER)) {
stockholmStructure.getFileAnnotation().setGFAccessionNumber(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_IDENTIFICATION)) {
stockholmStructure.getFileAnnotation().setGFIdentification(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_DB_REFERENCE)) {
stockholmStructure.getFileAnnotation().addDBReference(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_DEFINITION)) {
stockholmStructure.getFileAnnotation().setGFDefinition(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_AUTHOR)) {
stockholmStructure.getFileAnnotation().setGFAuthors(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_ALIGNMENT_METHOD)) {
stockholmStructure.getFileAnnotation().setAlignmentMethod(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_BUILD_METHOD)) {
stockholmStructure.getFileAnnotation().addGFBuildMethod(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_SEARCH_METHOD)) {
stockholmStructure.getFileAnnotation().setGFSearchMethod(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_SOURCE_SEED)) {
stockholmStructure.getFileAnnotation().setGFSourceSeed(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_SOURCE_STRUCTURE)) {
stockholmStructure.getFileAnnotation().setGFSourceStructure(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_GATHERING_THRESHOLD)) {
stockholmStructure.getFileAnnotation().setGFGatheringThreshs(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_TRUSTED_CUTOFF)) {
stockholmStructure.getFileAnnotation().setGFTrustedCutoffs(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_NOISE_CUTOFF)) {
stockholmStructure.getFileAnnotation().setGFNoiseCutoffs(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_TYPE_FIELD)) {
stockholmStructure.getFileAnnotation().setGFTypeField(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_PREVIOUS_IDS)) {
stockholmStructure.getFileAnnotation().setGFPreviousIDs(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_SEQUENCE)) {
// status = STATUS_IN_SEQUENCE;
stockholmStructure.getFileAnnotation().setGFNumSequences(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_DB_COMMENT)) {
stockholmStructure.getFileAnnotation().setGFDBComment(value); // depends on control dependency: [if], data = [none]
// } else if (featureName.equals(GF_DB_REFERENCE)) {
// stockholmStructure.getFileAnnotation().addDBReference(value);
} else if (featureName.equals(GF_REFERENCE_COMMENT)) {
stockholmStructure.getFileAnnotation().setGFRefComment(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_REFERENCE_NUMBER)) {
StockholmFileAnnotationReference reference = new StockholmFileAnnotationReference();
stockholmStructure.getFileAnnotation().getReferences().add(reference); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_REFERENCE_MEDLINE)) {
stockholmStructure.getFileAnnotation().getReferences().lastElement().setRefMedline(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_REFERENCE_TITLE)) {
stockholmStructure.getFileAnnotation().getReferences().lastElement().addToRefTitle(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_REFERENCE_AUTHOR)) {
stockholmStructure.getFileAnnotation().getReferences().lastElement().addToRefAuthor(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_REFERENCE_LOCALTION)) {
stockholmStructure.getFileAnnotation().getReferences().lastElement().setRefLocation(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_KEYWORDS)) {
stockholmStructure.getFileAnnotation().setGFKeywords(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_COMMENT)) {
stockholmStructure.getFileAnnotation().addToGFComment(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_PFAM_ACCESSION)) {
stockholmStructure.getFileAnnotation().setGFPfamAccession(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_LOCATION)) {
stockholmStructure.getFileAnnotation().setGFLocation(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_WIKIPEDIA_LINK)) {
stockholmStructure.getFileAnnotation().setGFWikipediaLink(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_CLAN)) {
stockholmStructure.getFileAnnotation().setGFClan(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_MEMBERSHIP)) {
stockholmStructure.getFileAnnotation().setGFMembership(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_NEW_HAMPSHIRE)) {
stockholmStructure.getFileAnnotation().addGFNewHampshire(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_TREE_ID)) {
stockholmStructure.getFileAnnotation().addGFTreeID(value); // depends on control dependency: [if], data = [none]
} else if (featureName.equals(GF_FALSE_DISCOVERY_RATE)) {
stockholmStructure.getFileAnnotation().addGFFalseDiscoveryRate(value); // depends on control dependency: [if], data = [none]
} else {
// unknown feature
logger.warn("Unknown File Feature [{}].\nPlease contact the Biojava team.", featureName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public P build() {
try {
return buildAsync().join();
} catch (Exception e) {
if (e instanceof CompletionException && e.getCause() instanceof RuntimeException) {
throw (RuntimeException) e.getCause();
} else {
throw e;
}
}
} } | public class class_name {
@Override
public P build() {
try {
return buildAsync().join(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (e instanceof CompletionException && e.getCause() instanceof RuntimeException) {
throw (RuntimeException) e.getCause();
} else {
throw e;
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void logp(Level level, String sourceClass, String sourceMethod, String msg) {
if (level.intValue() < levelValue || levelValue == offValue) {
return;
}
LogRecord lr = new LogRecord(level, msg);
lr.setSourceClassName(sourceClass);
lr.setSourceMethodName(sourceMethod);
doLog(lr);
} } | public class class_name {
public void logp(Level level, String sourceClass, String sourceMethod, String msg) {
if (level.intValue() < levelValue || levelValue == offValue) {
return; // depends on control dependency: [if], data = [none]
}
LogRecord lr = new LogRecord(level, msg);
lr.setSourceClassName(sourceClass);
lr.setSourceMethodName(sourceMethod);
doLog(lr);
} } |
public class class_name {
public static void closeWithWarning(Closeable c) {
if (c != null) {
try {
c.close();
} catch (IOException e) {
LOG.warning("Caught exception during close(): " + e);
}
}
} } | public class class_name {
public static void closeWithWarning(Closeable c) {
if (c != null) {
try {
c.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOG.warning("Caught exception during close(): " + e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private DNode calculateSourceNode() {
DNode result = DNode.NOT_FOUND;
for (DNode node : nodes) {
List<DLink> links = getLinksTo(node);
if (links.size() == 0) {
result = node;
break;
}
}
return result;
} } | public class class_name {
private DNode calculateSourceNode() {
DNode result = DNode.NOT_FOUND;
for (DNode node : nodes) {
List<DLink> links = getLinksTo(node);
if (links.size() == 0) {
result = node;
// depends on control dependency: [if], data = [none]
break;
}
}
return result;
} } |
public class class_name {
public void checkSemantics(boolean all)
throws BadSemanticsException {
super.checkSemantics(all);
Util.uniqueNames(varTemplate, getEncodedName(), getTypeName());
if (all) {
for (Enumeration e = varTemplate.elements(); e.hasMoreElements();) {
BaseType bt = (BaseType) e.nextElement();
bt.checkSemantics(true);
}
}
} } | public class class_name {
public void checkSemantics(boolean all)
throws BadSemanticsException {
super.checkSemantics(all);
Util.uniqueNames(varTemplate, getEncodedName(), getTypeName());
if (all) {
for (Enumeration e = varTemplate.elements(); e.hasMoreElements();) {
BaseType bt = (BaseType) e.nextElement();
bt.checkSemantics(true);
// depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
private void setup() {
try {
this.partBoundary = ("--" + boundary).getBytes("UTF-8");
this.trailingBoundary = ("--" + boundary + "--").getBytes("UTF-8");
this.contentType = "content-type: application/json".getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
attachments = new ArrayList<Attachment>();
// some preamble
contentLength += partBoundary.length;
contentLength += 6; // 3 * crlf
contentLength += contentType.length;
// although we haven't added it yet, account for the trailing boundary
contentLength += 2; // crlf
contentLength += trailingBoundary.length;
} } | public class class_name {
private void setup() {
try {
this.partBoundary = ("--" + boundary).getBytes("UTF-8"); // depends on control dependency: [try], data = [none]
this.trailingBoundary = ("--" + boundary + "--").getBytes("UTF-8");
this.contentType = "content-type: application/json".getBytes("UTF-8"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
attachments = new ArrayList<Attachment>();
// some preamble
contentLength += partBoundary.length;
contentLength += 6; // 3 * crlf
contentLength += contentType.length;
// although we haven't added it yet, account for the trailing boundary
contentLength += 2; // crlf
contentLength += trailingBoundary.length;
} } |
public class class_name {
private Object resolveLeadingContextObject(String name, ValueWrapper value,
AtomicReference<Hint> hintRef) {
Object leading = resolveContextObject(name, value, hintRef);
if (leading == null) {
// Leading context object not found - try to resolve context
// unrelated objects (JNDI lookup, CDI, etc.)
Hint hint = hintRef != null ? hintRef.get() : null;
if (hint != null) {
leading = hint.resolve(null, name, value);
}
if (leading == null) {
leading = resolve(null, name, value, hint == null
&& hintRef != null);
}
}
return leading;
} } | public class class_name {
private Object resolveLeadingContextObject(String name, ValueWrapper value,
AtomicReference<Hint> hintRef) {
Object leading = resolveContextObject(name, value, hintRef);
if (leading == null) {
// Leading context object not found - try to resolve context
// unrelated objects (JNDI lookup, CDI, etc.)
Hint hint = hintRef != null ? hintRef.get() : null;
if (hint != null) {
leading = hint.resolve(null, name, value); // depends on control dependency: [if], data = [none]
}
if (leading == null) {
leading = resolve(null, name, value, hint == null
&& hintRef != null); // depends on control dependency: [if], data = [none]
}
}
return leading;
} } |
public class class_name {
private Charset guessEncoding() {
// if the file has a Byte Order Marker, we can assume the file is in UTF-xx
// otherwise, the file would not be human readable
if (hasUTF8Bom())
return Charset.forName("UTF-8");
if (hasUTF16LEBom())
return Charset.forName("UTF-16LE");
if (hasUTF16BEBom())
return Charset.forName("UTF-16BE");
// if a byte has its most significant bit set, the file is in UTF-8 or in the default encoding
// otherwise, the file is in US-ASCII
boolean highOrderBit = false;
// if the file is in UTF-8, high order bytes must have a certain value, in order to be valid
// if it's not the case, we can assume the encoding is the default encoding of the system
boolean validU8Char = true;
// TODO the buffer is not read up to the end, but up to length - 6
int length = buffer.length;
int i = 0;
while (i < length - 6) {
byte b0 = buffer[i];
byte b1 = buffer[i + 1];
byte b2 = buffer[i + 2];
byte b3 = buffer[i + 3];
byte b4 = buffer[i + 4];
byte b5 = buffer[i + 5];
if (b0 < 0) {
// a high order bit was encountered, thus the encoding is not US-ASCII
// it may be either an 8-bit encoding or UTF-8
highOrderBit = true;
// a two-bytes sequence was encountered
if (isTwoBytesSequence(b0)) {
// there must be one continuation byte of the form 10xxxxxx,
// otherwise the following character is is not a valid UTF-8 construct
if (!isContinuationChar(b1))
validU8Char = false;
else
i++;
}
// a three-bytes sequence was encountered
else if (isThreeBytesSequence(b0)) {
// there must be two continuation bytes of the form 10xxxxxx,
// otherwise the following character is is not a valid UTF-8 construct
if (!(isContinuationChar(b1) && isContinuationChar(b2)))
validU8Char = false;
else
i += 2;
}
// a four-bytes sequence was encountered
else if (isFourBytesSequence(b0)) {
// there must be three continuation bytes of the form 10xxxxxx,
// otherwise the following character is is not a valid UTF-8 construct
if (!(isContinuationChar(b1) && isContinuationChar(b2) && isContinuationChar(b3)))
validU8Char = false;
else
i += 3;
}
// a five-bytes sequence was encountered
else if (isFiveBytesSequence(b0)) {
// there must be four continuation bytes of the form 10xxxxxx,
// otherwise the following character is is not a valid UTF-8 construct
if (!(isContinuationChar(b1)
&& isContinuationChar(b2)
&& isContinuationChar(b3)
&& isContinuationChar(b4)))
validU8Char = false;
else
i += 4;
}
// a six-bytes sequence was encountered
else if (isSixBytesSequence(b0)) {
// there must be five continuation bytes of the form 10xxxxxx,
// otherwise the following character is is not a valid UTF-8 construct
if (!(isContinuationChar(b1)
&& isContinuationChar(b2)
&& isContinuationChar(b3)
&& isContinuationChar(b4)
&& isContinuationChar(b5)))
validU8Char = false;
else
i += 5;
}
else
validU8Char = false;
}
if (!validU8Char)
break;
i++;
}
// if no byte with an high order bit set, the encoding is US-ASCII
// (it might have been UTF-7, but this encoding is usually internally used only by mail systems)
if (!highOrderBit) {
// returns the default charset rather than US-ASCII if the enforce8Bit flag is set.
if (this.enforce8Bit)
return this.defaultCharset;
else
return Charset.forName("US-ASCII");
}
// if no invalid UTF-8 were encountered, we can assume the encoding is UTF-8,
// otherwise the file would not be human readable
if (validU8Char)
return Charset.forName("UTF-8");
// finally, if it's not UTF-8 nor US-ASCII, let's assume the encoding is the default encoding
return this.defaultCharset;
} } | public class class_name {
private Charset guessEncoding() {
// if the file has a Byte Order Marker, we can assume the file is in UTF-xx
// otherwise, the file would not be human readable
if (hasUTF8Bom())
return Charset.forName("UTF-8");
if (hasUTF16LEBom())
return Charset.forName("UTF-16LE");
if (hasUTF16BEBom())
return Charset.forName("UTF-16BE");
// if a byte has its most significant bit set, the file is in UTF-8 or in the default encoding
// otherwise, the file is in US-ASCII
boolean highOrderBit = false;
// if the file is in UTF-8, high order bytes must have a certain value, in order to be valid
// if it's not the case, we can assume the encoding is the default encoding of the system
boolean validU8Char = true;
// TODO the buffer is not read up to the end, but up to length - 6
int length = buffer.length;
int i = 0;
while (i < length - 6) {
byte b0 = buffer[i];
byte b1 = buffer[i + 1];
byte b2 = buffer[i + 2];
byte b3 = buffer[i + 3];
byte b4 = buffer[i + 4];
byte b5 = buffer[i + 5];
if (b0 < 0) {
// a high order bit was encountered, thus the encoding is not US-ASCII
// it may be either an 8-bit encoding or UTF-8
highOrderBit = true; // depends on control dependency: [if], data = [none]
// a two-bytes sequence was encountered
if (isTwoBytesSequence(b0)) {
// there must be one continuation byte of the form 10xxxxxx,
// otherwise the following character is is not a valid UTF-8 construct
if (!isContinuationChar(b1))
validU8Char = false;
else
i++;
}
// a three-bytes sequence was encountered
else if (isThreeBytesSequence(b0)) {
// there must be two continuation bytes of the form 10xxxxxx,
// otherwise the following character is is not a valid UTF-8 construct
if (!(isContinuationChar(b1) && isContinuationChar(b2)))
validU8Char = false;
else
i += 2;
}
// a four-bytes sequence was encountered
else if (isFourBytesSequence(b0)) {
// there must be three continuation bytes of the form 10xxxxxx,
// otherwise the following character is is not a valid UTF-8 construct
if (!(isContinuationChar(b1) && isContinuationChar(b2) && isContinuationChar(b3)))
validU8Char = false;
else
i += 3;
}
// a five-bytes sequence was encountered
else if (isFiveBytesSequence(b0)) {
// there must be four continuation bytes of the form 10xxxxxx,
// otherwise the following character is is not a valid UTF-8 construct
if (!(isContinuationChar(b1)
&& isContinuationChar(b2)
&& isContinuationChar(b3)
&& isContinuationChar(b4)))
validU8Char = false;
else
i += 4;
}
// a six-bytes sequence was encountered
else if (isSixBytesSequence(b0)) {
// there must be five continuation bytes of the form 10xxxxxx,
// otherwise the following character is is not a valid UTF-8 construct
if (!(isContinuationChar(b1)
&& isContinuationChar(b2)
&& isContinuationChar(b3)
&& isContinuationChar(b4)
&& isContinuationChar(b5)))
validU8Char = false;
else
i += 5;
}
else
validU8Char = false;
}
if (!validU8Char)
break;
i++; // depends on control dependency: [while], data = [none]
}
// if no byte with an high order bit set, the encoding is US-ASCII
// (it might have been UTF-7, but this encoding is usually internally used only by mail systems)
if (!highOrderBit) {
// returns the default charset rather than US-ASCII if the enforce8Bit flag is set.
if (this.enforce8Bit)
return this.defaultCharset;
else
return Charset.forName("US-ASCII");
}
// if no invalid UTF-8 were encountered, we can assume the encoding is UTF-8,
// otherwise the file would not be human readable
if (validU8Char)
return Charset.forName("UTF-8");
// finally, if it's not UTF-8 nor US-ASCII, let's assume the encoding is the default encoding
return this.defaultCharset;
} } |
public class class_name {
@Nullable
public static char[] optCharArray(@Nullable Bundle bundle, @Nullable String key, @Nullable char[] fallback) {
if (bundle == null) {
return fallback;
}
return bundle.getCharArray(key);
} } | public class class_name {
@Nullable
public static char[] optCharArray(@Nullable Bundle bundle, @Nullable String key, @Nullable char[] fallback) {
if (bundle == null) {
return fallback; // depends on control dependency: [if], data = [none]
}
return bundle.getCharArray(key);
} } |
public class class_name {
public void marshall(DescribeConnectionsRequest describeConnectionsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeConnectionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeConnectionsRequest.getConnectionId(), CONNECTIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeConnectionsRequest describeConnectionsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeConnectionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeConnectionsRequest.getConnectionId(), CONNECTIONID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public ConvertManager converter()
{
if (_convertManager == null) {
_convertManager = provider(Key.of(ConvertManager.class));
}
return _convertManager.get();
} } | public class class_name {
@Override
public ConvertManager converter()
{
if (_convertManager == null) {
_convertManager = provider(Key.of(ConvertManager.class)); // depends on control dependency: [if], data = [none]
}
return _convertManager.get();
} } |
public class class_name {
protected Map<String, String> getElementAttributes() {
// Preserve order of attributes
Map<String, String> attrs = new HashMap<>();
if (this.getLoop() != null) {
attrs.put("loop", this.getLoop().toString());
}
if (this.getDigits() != null) {
attrs.put("digits", this.getDigits());
}
return attrs;
} } | public class class_name {
protected Map<String, String> getElementAttributes() {
// Preserve order of attributes
Map<String, String> attrs = new HashMap<>();
if (this.getLoop() != null) {
attrs.put("loop", this.getLoop().toString()); // depends on control dependency: [if], data = [none]
}
if (this.getDigits() != null) {
attrs.put("digits", this.getDigits()); // depends on control dependency: [if], data = [none]
}
return attrs;
} } |
public class class_name {
private boolean shouldSendIncrementalReport(long startTime){
boolean isPrimary = isPrimaryServiceCached() ||
donotDelayIncrementalBlockReports;
boolean deleteIntervalTrigger =
(startTime - lastDeletedReport > anode.deletedReportInterval);
// by default the report should be sent if there are any received
// acks, or the deleteInterval has passed
boolean sendReportDefault = pendingReceivedRequests > 0
|| deleteIntervalTrigger;
if(isPrimary){
// if talking to primary, send the report with the default
// conditions
return sendReportDefault;
} else {
// if talking to standby. send the report ONLY when the
// retry interval has passed in addition to the default
// condidtions
boolean sendIfStandby =
(lastBlockReceivedFailed + blockReceivedRetryInterval < startTime)
&& sendReportDefault;
return sendIfStandby;
}
} } | public class class_name {
private boolean shouldSendIncrementalReport(long startTime){
boolean isPrimary = isPrimaryServiceCached() ||
donotDelayIncrementalBlockReports;
boolean deleteIntervalTrigger =
(startTime - lastDeletedReport > anode.deletedReportInterval);
// by default the report should be sent if there are any received
// acks, or the deleteInterval has passed
boolean sendReportDefault = pendingReceivedRequests > 0
|| deleteIntervalTrigger;
if(isPrimary){
// if talking to primary, send the report with the default
// conditions
return sendReportDefault; // depends on control dependency: [if], data = [none]
} else {
// if talking to standby. send the report ONLY when the
// retry interval has passed in addition to the default
// condidtions
boolean sendIfStandby =
(lastBlockReceivedFailed + blockReceivedRetryInterval < startTime)
&& sendReportDefault;
return sendIfStandby; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean isIE(HttpServletRequest request) {
String userAgent = getHeaderIgnoreCase(request, "User-Agent");
if (StrUtil.isNotBlank(userAgent)) {
userAgent = userAgent.toUpperCase();
if (userAgent.contains("MSIE") || userAgent.contains("TRIDENT")) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean isIE(HttpServletRequest request) {
String userAgent = getHeaderIgnoreCase(request, "User-Agent");
if (StrUtil.isNotBlank(userAgent)) {
userAgent = userAgent.toUpperCase();
// depends on control dependency: [if], data = [none]
if (userAgent.contains("MSIE") || userAgent.contains("TRIDENT")) {
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private double handleCase3() {
double stpf;
// use cubic interpolation only if it is safe
double stpc = SearchInterpolate.cubicSafe(fp, gp, stp, fx, gx, stx, stmin, stmax);
double stpq = SearchInterpolate.quadratic2(gp,stp,gx,stx);
if( bracket ) {
// Use which ever step is closer to stp
if( Math.abs(stpc-stp) < Math.abs(stpq-stp)){
stpf = stpc;
} else {
stpf = stpq;
}
if( stp > stx ) {
stpf = Math.min(stp+p66*(sty-stp),stpf);
} else {
stpf = Math.max(stp+p66*(sty-stp),stpf);
}
} else {
// because a bracket has not been found, take whichever step is farther from stp
if( Math.abs(stpc-stp) > Math.abs(stpq-stp)) {
stpf = stpc;
} else {
stpf = stpq;
}
stpf = Math.min(stmax,stpf); // this really is stmax/stmin and not stpmax/stpmin
stpf = Math.max(stmin,stpf); // In the for tran can stmax and stmin is passed in for stpmax and stpmin
}
return stpf;
} } | public class class_name {
private double handleCase3() {
double stpf;
// use cubic interpolation only if it is safe
double stpc = SearchInterpolate.cubicSafe(fp, gp, stp, fx, gx, stx, stmin, stmax);
double stpq = SearchInterpolate.quadratic2(gp,stp,gx,stx);
if( bracket ) {
// Use which ever step is closer to stp
if( Math.abs(stpc-stp) < Math.abs(stpq-stp)){
stpf = stpc; // depends on control dependency: [if], data = [none]
} else {
stpf = stpq; // depends on control dependency: [if], data = [none]
}
if( stp > stx ) {
stpf = Math.min(stp+p66*(sty-stp),stpf); // depends on control dependency: [if], data = [none]
} else {
stpf = Math.max(stp+p66*(sty-stp),stpf); // depends on control dependency: [if], data = [none]
}
} else {
// because a bracket has not been found, take whichever step is farther from stp
if( Math.abs(stpc-stp) > Math.abs(stpq-stp)) {
stpf = stpc; // depends on control dependency: [if], data = [none]
} else {
stpf = stpq; // depends on control dependency: [if], data = [none]
}
stpf = Math.min(stmax,stpf); // this really is stmax/stmin and not stpmax/stpmin // depends on control dependency: [if], data = [none]
stpf = Math.max(stmin,stpf); // In the for tran can stmax and stmin is passed in for stpmax and stpmin // depends on control dependency: [if], data = [none]
}
return stpf;
} } |
public class class_name {
public static <T> void dumpUnchanged(Iterable<Difference<T>> diffs) {
for(Difference<T> diff: diffs) {
if(Difference.Type.UNCHANGED.equals(diff.getType())) {
System.out.println(diff);
}
}
} } | public class class_name {
public static <T> void dumpUnchanged(Iterable<Difference<T>> diffs) {
for(Difference<T> diff: diffs) {
if(Difference.Type.UNCHANGED.equals(diff.getType())) {
System.out.println(diff); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private Map<String, RoleSet> updateMapForSpecialSubject(String appName,
Map<String, RoleSet> specialSubjectToRolesMap,
String specialSubjectName) {
RoleSet computedRoles = RoleSet.EMPTY_ROLESET;
Set<String> rolesForSubject = new HashSet<String>();
//TODO what if the appName is not present in the map?
for (SecurityRole role : resourceToAuthzInfoMap.get(appName).securityRoles) {
String roleName = role.getName();
for (SpecialSubject specialSubject : role.getSpecialSubjects()) {
String specialSubjectNameFromRole = specialSubject.getType().toString();
if (specialSubjectName.equals(specialSubjectNameFromRole)) {
rolesForSubject.add(roleName);
}
}
}
if (!rolesForSubject.isEmpty()) {
computedRoles = new RoleSet(rolesForSubject);
}
specialSubjectToRolesMap.put(specialSubjectName, computedRoles);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Added the following subject to role mapping for application: " + appName + ".",
specialSubjectName, computedRoles);
}
return specialSubjectToRolesMap;
} } | public class class_name {
private Map<String, RoleSet> updateMapForSpecialSubject(String appName,
Map<String, RoleSet> specialSubjectToRolesMap,
String specialSubjectName) {
RoleSet computedRoles = RoleSet.EMPTY_ROLESET;
Set<String> rolesForSubject = new HashSet<String>();
//TODO what if the appName is not present in the map?
for (SecurityRole role : resourceToAuthzInfoMap.get(appName).securityRoles) {
String roleName = role.getName();
for (SpecialSubject specialSubject : role.getSpecialSubjects()) {
String specialSubjectNameFromRole = specialSubject.getType().toString();
if (specialSubjectName.equals(specialSubjectNameFromRole)) {
rolesForSubject.add(roleName); // depends on control dependency: [if], data = [none]
}
}
}
if (!rolesForSubject.isEmpty()) {
computedRoles = new RoleSet(rolesForSubject); // depends on control dependency: [if], data = [none]
}
specialSubjectToRolesMap.put(specialSubjectName, computedRoles);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Added the following subject to role mapping for application: " + appName + ".",
specialSubjectName, computedRoles); // depends on control dependency: [if], data = [none]
}
return specialSubjectToRolesMap;
} } |
public class class_name {
public static FlowSpec createFlowSpecForConfig(FlowConfig flowConfig) {
ConfigBuilder configBuilder = ConfigBuilder.create()
.addPrimitive(ConfigurationKeys.FLOW_GROUP_KEY, flowConfig.getId().getFlowGroup())
.addPrimitive(ConfigurationKeys.FLOW_NAME_KEY, flowConfig.getId().getFlowName());
if (flowConfig.hasSchedule()) {
Schedule schedule = flowConfig.getSchedule();
configBuilder.addPrimitive(ConfigurationKeys.JOB_SCHEDULE_KEY, schedule.getCronSchedule());
configBuilder.addPrimitive(ConfigurationKeys.FLOW_RUN_IMMEDIATELY, schedule.isRunImmediately());
} else {
// If the job does not have schedule, it is a run-once job.
// In this case, we add flow execution id to the flow spec now to be able to send this id back to the user for
// flow status tracking purpose.
// If it is not a run-once job, we should not add flow execution id here,
// because execution id is generated for every scheduled execution of the flow and cannot be materialized to
// the flow catalog. In this case, this id is added during flow compilation.
configBuilder.addPrimitive(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, String.valueOf(System.currentTimeMillis()));
}
if (flowConfig.hasExplain()) {
configBuilder.addPrimitive(ConfigurationKeys.FLOW_EXPLAIN_KEY, flowConfig.isExplain());
}
Config config = configBuilder.build();
Config configWithFallback;
//We first attempt to process the REST.li request as a HOCON string. If the request is not a valid HOCON string
// (e.g. when certain special characters such as ":" or "*" are not properly escaped), we catch the Typesafe ConfigException and
// fallback to assuming that values are literal strings.
try {
// We first convert the StringMap object to a String object and then use ConfigFactory#parseString() to parse the
// HOCON string.
configWithFallback = config.withFallback(ConfigFactory.parseString(flowConfig.getProperties().toString()).resolve());
} catch (Exception e) {
configWithFallback = config.withFallback(ConfigFactory.parseMap(flowConfig.getProperties()));
}
try {
URI templateURI = new URI(flowConfig.getTemplateUris());
return FlowSpec.builder().withConfig(configWithFallback).withTemplate(templateURI).build();
} catch (URISyntaxException e) {
throw new FlowConfigLoggedException(HttpStatus.S_400_BAD_REQUEST, "bad URI " + flowConfig.getTemplateUris(), e);
}
} } | public class class_name {
public static FlowSpec createFlowSpecForConfig(FlowConfig flowConfig) {
ConfigBuilder configBuilder = ConfigBuilder.create()
.addPrimitive(ConfigurationKeys.FLOW_GROUP_KEY, flowConfig.getId().getFlowGroup())
.addPrimitive(ConfigurationKeys.FLOW_NAME_KEY, flowConfig.getId().getFlowName());
if (flowConfig.hasSchedule()) {
Schedule schedule = flowConfig.getSchedule();
configBuilder.addPrimitive(ConfigurationKeys.JOB_SCHEDULE_KEY, schedule.getCronSchedule()); // depends on control dependency: [if], data = [none]
configBuilder.addPrimitive(ConfigurationKeys.FLOW_RUN_IMMEDIATELY, schedule.isRunImmediately()); // depends on control dependency: [if], data = [none]
} else {
// If the job does not have schedule, it is a run-once job.
// In this case, we add flow execution id to the flow spec now to be able to send this id back to the user for
// flow status tracking purpose.
// If it is not a run-once job, we should not add flow execution id here,
// because execution id is generated for every scheduled execution of the flow and cannot be materialized to
// the flow catalog. In this case, this id is added during flow compilation.
configBuilder.addPrimitive(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, String.valueOf(System.currentTimeMillis())); // depends on control dependency: [if], data = [none]
}
if (flowConfig.hasExplain()) {
configBuilder.addPrimitive(ConfigurationKeys.FLOW_EXPLAIN_KEY, flowConfig.isExplain()); // depends on control dependency: [if], data = [none]
}
Config config = configBuilder.build();
Config configWithFallback;
//We first attempt to process the REST.li request as a HOCON string. If the request is not a valid HOCON string
// (e.g. when certain special characters such as ":" or "*" are not properly escaped), we catch the Typesafe ConfigException and
// fallback to assuming that values are literal strings.
try {
// We first convert the StringMap object to a String object and then use ConfigFactory#parseString() to parse the
// HOCON string.
configWithFallback = config.withFallback(ConfigFactory.parseString(flowConfig.getProperties().toString()).resolve()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
configWithFallback = config.withFallback(ConfigFactory.parseMap(flowConfig.getProperties()));
} // depends on control dependency: [catch], data = [none]
try {
URI templateURI = new URI(flowConfig.getTemplateUris());
return FlowSpec.builder().withConfig(configWithFallback).withTemplate(templateURI).build(); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
throw new FlowConfigLoggedException(HttpStatus.S_400_BAD_REQUEST, "bad URI " + flowConfig.getTemplateUris(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void disable(ProxyTuple proxy) {
synchronized (this.proxys) {
logger.info("disable-" + proxy);
this.proxys.remove(proxy.ip());
if (this.isEmpty()) {
logger.info("代理全部失效");
}
}
} } | public class class_name {
@Override
public void disable(ProxyTuple proxy) {
synchronized (this.proxys) {
logger.info("disable-" + proxy);
this.proxys.remove(proxy.ip());
if (this.isEmpty()) {
logger.info("代理全部失效"); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public void setProperty(String propertyId, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException {
// see if the property is recognized
getProperty(propertyId);
// Properties with a defined value, we just change it if we can.
if ((PROPERTY + "declaration-handler").equals(propertyId)) {
if (value == null) {
declHandler = base;
} else if (!(value instanceof DeclHandler)) {
throw new SAXNotSupportedException(propertyId);
} else {
declHandler = (DeclHandler) value;
}
return;
}
if ((PROPERTY + "lexical-handler").equals(propertyId)) {
if (value == null) {
lexicalHandler = base;
} else if (!(value instanceof LexicalHandler)) {
throw new SAXNotSupportedException(propertyId);
} else {
lexicalHandler = (LexicalHandler) value;
}
return;
}
throw new SAXNotSupportedException(propertyId);
} } | public class class_name {
@Override
public void setProperty(String propertyId, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException {
// see if the property is recognized
getProperty(propertyId);
// Properties with a defined value, we just change it if we can.
if ((PROPERTY + "declaration-handler").equals(propertyId)) {
if (value == null) {
declHandler = base; // depends on control dependency: [if], data = [none]
} else if (!(value instanceof DeclHandler)) {
throw new SAXNotSupportedException(propertyId);
} else {
declHandler = (DeclHandler) value; // depends on control dependency: [if], data = [none]
}
return;
}
if ((PROPERTY + "lexical-handler").equals(propertyId)) {
if (value == null) {
lexicalHandler = base; // depends on control dependency: [if], data = [none]
} else if (!(value instanceof LexicalHandler)) {
throw new SAXNotSupportedException(propertyId);
} else {
lexicalHandler = (LexicalHandler) value; // depends on control dependency: [if], data = [none]
}
return;
}
throw new SAXNotSupportedException(propertyId);
} } |
public class class_name {
@VisibleForTesting
final synchronized ImmutableSet<String> getAttributeKeys() {
if (attributes == null) {
return ImmutableSet.of();
}
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
for (Table.Cell<String, String, Object> cell : attributes.cellSet()) {
builder.add(cell.getRowKey() + ':' + cell.getColumnKey());
}
return builder.build();
} } | public class class_name {
@VisibleForTesting
final synchronized ImmutableSet<String> getAttributeKeys() {
if (attributes == null) {
return ImmutableSet.of(); // depends on control dependency: [if], data = [none]
}
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
for (Table.Cell<String, String, Object> cell : attributes.cellSet()) {
builder.add(cell.getRowKey() + ':' + cell.getColumnKey()); // depends on control dependency: [for], data = [cell]
}
return builder.build();
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.