code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public void onConnect(int rst, HuaweiApiClient client) {
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
onPushTokenResult(rst, null);
return;
}
PendingResult<TokenResult> tokenResult = HuaweiPush.HuaweiPushApi.getToken(client);
tokenResult.setResultCallback(new ResultCallback<TokenResult>() {
@Override
public void onResult(TokenResult result) {
if (result == null) {
HMSAgentLog.e("result is null");
onPushTokenResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
return;
}
Status status = result.getStatus();
if (status == null) {
HMSAgentLog.e("status is null");
onPushTokenResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
return;
}
int rstCode = status.getStatusCode();
HMSAgentLog.d("status=" + status);
// 需要重试的错误码,并且可以重试
if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
|| rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
retryTimes--;
connect();
} else {
onPushTokenResult(rstCode, result);
}
}
});
} } | public class class_name {
@Override
public void onConnect(int rst, HuaweiApiClient client) {
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
// depends on control dependency: [if], data = [none]
onPushTokenResult(rst, null);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
PendingResult<TokenResult> tokenResult = HuaweiPush.HuaweiPushApi.getToken(client);
tokenResult.setResultCallback(new ResultCallback<TokenResult>() {
@Override
public void onResult(TokenResult result) {
if (result == null) {
HMSAgentLog.e("result is null");
// depends on control dependency: [if], data = [none]
onPushTokenResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
// depends on control dependency: [if], data = [null)]
return;
// depends on control dependency: [if], data = [none]
}
Status status = result.getStatus();
if (status == null) {
HMSAgentLog.e("status is null");
// depends on control dependency: [if], data = [none]
onPushTokenResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
// depends on control dependency: [if], data = [null)]
return;
// depends on control dependency: [if], data = [none]
}
int rstCode = status.getStatusCode();
HMSAgentLog.d("status=" + status);
// 需要重试的错误码,并且可以重试
if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
|| rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
retryTimes--;
// depends on control dependency: [if], data = [none]
connect();
// depends on control dependency: [if], data = [none]
} else {
onPushTokenResult(rstCode, result);
// depends on control dependency: [if], data = [none]
}
}
});
} } |
public class class_name {
public static boolean isEmptyAnd(String... strings) {
if (isNotNull(strings)) {
for (String string : strings) {
if (isNotEmpty(string)) {
return false;
}
}
}
return true;
} } | public class class_name {
public static boolean isEmptyAnd(String... strings) {
if (isNotNull(strings)) {
for (String string : strings) {
if (isNotEmpty(string)) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
protected final QueryEngine queryEngine() {
if (queryEngine == null) {
try {
engineInitLock.lock();
if (queryEngine == null) {
QueryEngineBuilder builder = null;
if (!repoConfig.getIndexProviders().isEmpty()) {
// There is at least one index provider ...
builder = IndexQueryEngine.builder();
logger.debug("Queries with indexes are enabled for the '{0}' repository. Executing queries may require scanning the repository contents when the query cannot use the defined indexes.",
repoConfig.getName());
} else {
// There are no indexes ...
builder = ScanningQueryEngine.builder();
logger.debug("Queries with no indexes are enabled for the '{0}' repository. Executing queries will always scan the repository contents.",
repoConfig.getName());
}
queryEngine = builder.using(repoConfig, indexManager, runningState.context()).build();
}
} finally {
engineInitLock.unlock();
}
}
return queryEngine;
} } | public class class_name {
protected final QueryEngine queryEngine() {
if (queryEngine == null) {
try {
engineInitLock.lock(); // depends on control dependency: [try], data = [none]
if (queryEngine == null) {
QueryEngineBuilder builder = null;
if (!repoConfig.getIndexProviders().isEmpty()) {
// There is at least one index provider ...
builder = IndexQueryEngine.builder(); // depends on control dependency: [if], data = [none]
logger.debug("Queries with indexes are enabled for the '{0}' repository. Executing queries may require scanning the repository contents when the query cannot use the defined indexes.",
repoConfig.getName()); // depends on control dependency: [if], data = [none]
} else {
// There are no indexes ...
builder = ScanningQueryEngine.builder(); // depends on control dependency: [if], data = [none]
logger.debug("Queries with no indexes are enabled for the '{0}' repository. Executing queries will always scan the repository contents.",
repoConfig.getName()); // depends on control dependency: [if], data = [none]
}
queryEngine = builder.using(repoConfig, indexManager, runningState.context()).build(); // depends on control dependency: [if], data = [none]
}
} finally {
engineInitLock.unlock();
}
}
return queryEngine;
} } |
public class class_name {
public void sync(List<Dml> dmls, Function<Dml, Boolean> function) {
try {
boolean toExecute = false;
for (Dml dml : dmls) {
if (!toExecute) {
toExecute = function.apply(dml);
} else {
function.apply(dml);
}
}
if (toExecute) {
List<Future<Boolean>> futures = new ArrayList<>();
for (int i = 0; i < threads; i++) {
int j = i;
futures.add(executorThreads[i].submit(() -> {
try {
dmlsPartition[j].forEach(syncItem -> sync(batchExecutors[j],
syncItem.config,
syncItem.singleDml));
dmlsPartition[j].clear();
batchExecutors[j].commit();
return true;
} catch (Throwable e) {
batchExecutors[j].rollback();
throw new RuntimeException(e);
}
}));
}
futures.forEach(future -> {
try {
future.get();
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
});
}
} finally {
for (BatchExecutor batchExecutor : batchExecutors) {
if (batchExecutor != null) {
batchExecutor.close();
}
}
}
} } | public class class_name {
public void sync(List<Dml> dmls, Function<Dml, Boolean> function) {
try {
boolean toExecute = false;
for (Dml dml : dmls) {
if (!toExecute) {
toExecute = function.apply(dml); // depends on control dependency: [if], data = [none]
} else {
function.apply(dml); // depends on control dependency: [if], data = [none]
}
}
if (toExecute) {
List<Future<Boolean>> futures = new ArrayList<>();
for (int i = 0; i < threads; i++) {
int j = i;
futures.add(executorThreads[i].submit(() -> {
try {
dmlsPartition[j].forEach(syncItem -> sync(batchExecutors[j],
syncItem.config,
syncItem.singleDml)); // depends on control dependency: [for], data = [i]
dmlsPartition[j].clear(); // depends on control dependency: [for], data = [none]
batchExecutors[j].commit(); // depends on control dependency: [for], data = [none]
return true; // depends on control dependency: [for], data = [none]
} catch (Throwable e) { // depends on control dependency: [if], data = [none]
batchExecutors[j].rollback();
throw new RuntimeException(e);
}
}));
}
futures.forEach(future -> {
try {
future.get();
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
});
}
} finally {
for (BatchExecutor batchExecutor : batchExecutors) {
if (batchExecutor != null) {
batchExecutor.close();
}
}
}
} } |
public class class_name {
public static String getPrettyJsonString(Object object) {
ObjectMapper objectMapper = new ObjectMapper();
String json = null;
try {
json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(object);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return json;
} } | public class class_name {
public static String getPrettyJsonString(Object object) {
ObjectMapper objectMapper = new ObjectMapper();
String json = null;
try {
json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(object); // depends on control dependency: [try], data = [none]
} catch (JsonProcessingException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return json;
} } |
public class class_name {
private void serviceJspFile(HttpServletRequest request,
HttpServletResponse response, String jspUri,
Throwable exception, boolean precompile)
throws ServletException, IOException {
JspServletWrapper wrapper =
(JspServletWrapper) rctxt.getWrapper(jspUri);
if (wrapper == null) {
synchronized(this) {
wrapper = (JspServletWrapper) rctxt.getWrapper(jspUri);
if (wrapper == null) {
// Check if the requested JSP page exists, to avoid
// creating unnecessary directories and files.
if (null == context.getResource(jspUri)
&& !options.getUsePrecompiled()) {
String includeRequestUri = (String)
request.getAttribute("javax.servlet.include.request_uri");
if (includeRequestUri != null) {
// Missing JSP resource has been the target of a
// RequestDispatcher.include().
// Throw an exception (rather than returning a
// 404 response error code), because any call to
// response.sendError() must be ignored by the
// servlet engine when issued from within an
// included resource (as per the Servlet spec).
throw new FileNotFoundException(
JspUtil.escapeXml(jspUri));
}
response.sendError(HttpServletResponse.SC_NOT_FOUND);
log.severe(Localizer.getMessage(
"jsp.error.file.not.found",
context.getRealPath(jspUri)));
return;
}
boolean isErrorPage = exception != null;
wrapper = new JspServletWrapper(config, options, jspUri,
isErrorPage, rctxt);
rctxt.addWrapper(jspUri,wrapper);
}
}
}
wrapper.service(request, response, precompile);
} } | public class class_name {
private void serviceJspFile(HttpServletRequest request,
HttpServletResponse response, String jspUri,
Throwable exception, boolean precompile)
throws ServletException, IOException {
JspServletWrapper wrapper =
(JspServletWrapper) rctxt.getWrapper(jspUri);
if (wrapper == null) {
synchronized(this) {
wrapper = (JspServletWrapper) rctxt.getWrapper(jspUri);
if (wrapper == null) {
// Check if the requested JSP page exists, to avoid
// creating unnecessary directories and files.
if (null == context.getResource(jspUri)
&& !options.getUsePrecompiled()) {
String includeRequestUri = (String)
request.getAttribute("javax.servlet.include.request_uri");
if (includeRequestUri != null) {
// Missing JSP resource has been the target of a
// RequestDispatcher.include().
// Throw an exception (rather than returning a
// 404 response error code), because any call to
// response.sendError() must be ignored by the
// servlet engine when issued from within an
// included resource (as per the Servlet spec).
throw new FileNotFoundException(
JspUtil.escapeXml(jspUri));
}
response.sendError(HttpServletResponse.SC_NOT_FOUND); // depends on control dependency: [if], data = [none]
log.severe(Localizer.getMessage(
"jsp.error.file.not.found",
context.getRealPath(jspUri))); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
boolean isErrorPage = exception != null;
wrapper = new JspServletWrapper(config, options, jspUri,
isErrorPage, rctxt); // depends on control dependency: [if], data = [none]
rctxt.addWrapper(jspUri,wrapper); // depends on control dependency: [if], data = [none]
}
}
}
wrapper.service(request, response, precompile);
} } |
public class class_name {
@Override
public boolean isTimeIncluded (final long timeStamp)
{
if (m_aExcludeAll == true)
{
return false;
}
// Test the base calendar first. Only if the base calendar not already
// excludes the time/date, continue evaluating this calendar instance.
if (super.isTimeIncluded (timeStamp) == false)
{
return false;
}
final Calendar cl = createJavaCalendar (timeStamp);
final int day = cl.get (Calendar.DAY_OF_MONTH);
return !(isDayExcluded (day));
} } | public class class_name {
@Override
public boolean isTimeIncluded (final long timeStamp)
{
if (m_aExcludeAll == true)
{
return false; // depends on control dependency: [if], data = [none]
}
// Test the base calendar first. Only if the base calendar not already
// excludes the time/date, continue evaluating this calendar instance.
if (super.isTimeIncluded (timeStamp) == false)
{
return false; // depends on control dependency: [if], data = [none]
}
final Calendar cl = createJavaCalendar (timeStamp);
final int day = cl.get (Calendar.DAY_OF_MONTH);
return !(isDayExcluded (day));
} } |
public class class_name {
public void setObjects(Object object) {
if (Collection.class.isAssignableFrom(object.getClass())) {
this.objects = (Collection) object;
}
} } | public class class_name {
public void setObjects(Object object) {
if (Collection.class.isAssignableFrom(object.getClass())) {
this.objects = (Collection) object; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static List<Vertex> addVertices(Collection<X509Certificate> certs,
List<List<Vertex>> adjList)
{
List<Vertex> l = adjList.get(adjList.size() - 1);
for (X509Certificate cert : certs) {
Vertex v = new Vertex(cert);
l.add(v);
}
return l;
} } | public class class_name {
private static List<Vertex> addVertices(Collection<X509Certificate> certs,
List<List<Vertex>> adjList)
{
List<Vertex> l = adjList.get(adjList.size() - 1);
for (X509Certificate cert : certs) {
Vertex v = new Vertex(cert);
l.add(v); // depends on control dependency: [for], data = [none]
}
return l;
} } |
public class class_name {
private char getStringConcatenationTypeCharacter(Expression operand) {
TypeMirror operandType = operand.getTypeMirror();
if (operandType.getKind().isPrimitive()) {
return TypeUtil.getBinaryName(operandType).charAt(0);
} else if (typeUtil.isString(operandType)) {
return '$';
} else {
return '@';
}
} } | public class class_name {
private char getStringConcatenationTypeCharacter(Expression operand) {
TypeMirror operandType = operand.getTypeMirror();
if (operandType.getKind().isPrimitive()) {
return TypeUtil.getBinaryName(operandType).charAt(0); // depends on control dependency: [if], data = [none]
} else if (typeUtil.isString(operandType)) {
return '$'; // depends on control dependency: [if], data = [none]
} else {
return '@'; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void replaceAll(StringBuffer haystack, String needle, String newNeedle, int interval) {
if (needle == null) {
throw new IllegalArgumentException("string to replace can not be empty");
}
int idx = haystack.indexOf(needle);
int nextIdx = -1;
int processedChunkSize = idx;
int needleLength = needle.length();
int newNeedleLength = newNeedle.length();
while (idx != -1/* && idx < haystack.length()*/) {
if (processedChunkSize >= interval) {
haystack.replace(idx, idx + needleLength, newNeedle);
nextIdx = haystack.indexOf(needle, idx + newNeedleLength);
processedChunkSize = nextIdx - idx;//length of replacement is not included
idx = nextIdx;
}
else {
nextIdx = haystack.indexOf(needle, idx + newNeedleLength);
processedChunkSize += nextIdx - idx;
idx = nextIdx;
if (newNeedleLength == 0) {
return;
}
}
}
} } | public class class_name {
public static void replaceAll(StringBuffer haystack, String needle, String newNeedle, int interval) {
if (needle == null) {
throw new IllegalArgumentException("string to replace can not be empty");
}
int idx = haystack.indexOf(needle);
int nextIdx = -1;
int processedChunkSize = idx;
int needleLength = needle.length();
int newNeedleLength = newNeedle.length();
while (idx != -1/* && idx < haystack.length()*/) {
if (processedChunkSize >= interval) {
haystack.replace(idx, idx + needleLength, newNeedle); // depends on control dependency: [if], data = [none]
nextIdx = haystack.indexOf(needle, idx + newNeedleLength); // depends on control dependency: [if], data = [none]
processedChunkSize = nextIdx - idx;//length of replacement is not included // depends on control dependency: [if], data = [none]
idx = nextIdx; // depends on control dependency: [if], data = [none]
}
else {
nextIdx = haystack.indexOf(needle, idx + newNeedleLength); // depends on control dependency: [if], data = [none]
processedChunkSize += nextIdx - idx; // depends on control dependency: [if], data = [none]
idx = nextIdx; // depends on control dependency: [if], data = [none]
if (newNeedleLength == 0) {
return; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public void insertWith(int insertPosition, List<BaseCell> list) {
int newItemSize = list != null ? list.size() : 0;
if (newItemSize > 0 && mGroupBasicAdapter != null) {
if (insertPosition >= mGroupBasicAdapter.getItemCount()) {
insertPosition = mGroupBasicAdapter.getItemCount() - 1;
}
BaseCell insertCell = mGroupBasicAdapter.getItemByPosition(insertPosition);
int cardIdx = mGroupBasicAdapter.findCardIdxFor(insertPosition);
Card card = mGroupBasicAdapter.getCardRange(cardIdx).second;
card.addCells(card, card.getCells().indexOf(insertCell), list);
List<LayoutHelper> layoutHelpers = getLayoutManager().getLayoutHelpers();
if (layoutHelpers != null && cardIdx >= 0 && cardIdx < layoutHelpers.size()) {
for (int i = 0, size = layoutHelpers.size(); i < size; i++) {
LayoutHelper layoutHelper = layoutHelpers.get(i);
int start = layoutHelper.getRange().getLower();
int end = layoutHelper.getRange().getUpper();
if (end < insertPosition) {
//do nothing
} else if (start <= insertPosition && insertPosition <= end) {
layoutHelper.setItemCount(layoutHelper.getItemCount() + newItemSize);
layoutHelper.setRange(start, end + newItemSize);
} else if (insertPosition < start) {
layoutHelper.setRange(start + newItemSize, end + newItemSize);
}
}
mGroupBasicAdapter.insertComponents(insertPosition, list);
}
}
} } | public class class_name {
public void insertWith(int insertPosition, List<BaseCell> list) {
int newItemSize = list != null ? list.size() : 0;
if (newItemSize > 0 && mGroupBasicAdapter != null) {
if (insertPosition >= mGroupBasicAdapter.getItemCount()) {
insertPosition = mGroupBasicAdapter.getItemCount() - 1; // depends on control dependency: [if], data = [none]
}
BaseCell insertCell = mGroupBasicAdapter.getItemByPosition(insertPosition);
int cardIdx = mGroupBasicAdapter.findCardIdxFor(insertPosition);
Card card = mGroupBasicAdapter.getCardRange(cardIdx).second;
card.addCells(card, card.getCells().indexOf(insertCell), list); // depends on control dependency: [if], data = [none]
List<LayoutHelper> layoutHelpers = getLayoutManager().getLayoutHelpers();
if (layoutHelpers != null && cardIdx >= 0 && cardIdx < layoutHelpers.size()) {
for (int i = 0, size = layoutHelpers.size(); i < size; i++) {
LayoutHelper layoutHelper = layoutHelpers.get(i);
int start = layoutHelper.getRange().getLower();
int end = layoutHelper.getRange().getUpper();
if (end < insertPosition) {
//do nothing
} else if (start <= insertPosition && insertPosition <= end) {
layoutHelper.setItemCount(layoutHelper.getItemCount() + newItemSize); // depends on control dependency: [if], data = [none]
layoutHelper.setRange(start, end + newItemSize); // depends on control dependency: [if], data = [(start]
} else if (insertPosition < start) {
layoutHelper.setRange(start + newItemSize, end + newItemSize); // depends on control dependency: [if], data = [none]
}
}
mGroupBasicAdapter.insertComponents(insertPosition, list); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static void release(Statement statement, Connection connection) {
if (statement != null) {
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (connection != null) {
JDBCUtils.release(connection);
}
} } | public class class_name {
public static void release(Statement statement, Connection connection) {
if (statement != null) {
try {
statement.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
if (connection != null) {
JDBCUtils.release(connection); // depends on control dependency: [if], data = [(connection]
}
} } |
public class class_name {
public List<FacesConfigBehaviorType<FacesConfigType<T>>> getAllBehavior()
{
List<FacesConfigBehaviorType<FacesConfigType<T>>> list = new ArrayList<FacesConfigBehaviorType<FacesConfigType<T>>>();
List<Node> nodeList = childNode.get("behavior");
for(Node node: nodeList)
{
FacesConfigBehaviorType<FacesConfigType<T>> type = new FacesConfigBehaviorTypeImpl<FacesConfigType<T>>(this, "behavior", childNode, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<FacesConfigBehaviorType<FacesConfigType<T>>> getAllBehavior()
{
List<FacesConfigBehaviorType<FacesConfigType<T>>> list = new ArrayList<FacesConfigBehaviorType<FacesConfigType<T>>>();
List<Node> nodeList = childNode.get("behavior");
for(Node node: nodeList)
{
FacesConfigBehaviorType<FacesConfigType<T>> type = new FacesConfigBehaviorTypeImpl<FacesConfigType<T>>(this, "behavior", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
public void getWorldPosition(int boneindex, Vector3f pos)
{
Bone bone = mBones[boneindex];
int boneParent = mSkeleton.getParentBoneIndex(boneindex);
if ((boneParent >= 0) && ((bone.Changed & LOCAL_ROT) == LOCAL_ROT))
{
calcWorld(bone, boneParent);
}
pos.x = bone.WorldMatrix.m30();
pos.y = bone.WorldMatrix.m31();
pos.z = bone.WorldMatrix.m32();
} } | public class class_name {
public void getWorldPosition(int boneindex, Vector3f pos)
{
Bone bone = mBones[boneindex];
int boneParent = mSkeleton.getParentBoneIndex(boneindex);
if ((boneParent >= 0) && ((bone.Changed & LOCAL_ROT) == LOCAL_ROT))
{
calcWorld(bone, boneParent); // depends on control dependency: [if], data = [none]
}
pos.x = bone.WorldMatrix.m30();
pos.y = bone.WorldMatrix.m31();
pos.z = bone.WorldMatrix.m32();
} } |
public class class_name {
@Override
final protected long getLastModified(HttpServletRequest req) {
lastModifiedCount.incrementAndGet();
try {
return reportingGetLastModified(req);
} catch (ThreadDeath err) {
throw err;
} catch (RuntimeException err) {
getLogger().log(Level.SEVERE, null, err);
throw err;
} catch (IOException | SQLException err) {
getLogger().log(Level.SEVERE, null, err);
throw new RuntimeException(err);
}
} } | public class class_name {
@Override
final protected long getLastModified(HttpServletRequest req) {
lastModifiedCount.incrementAndGet();
try {
return reportingGetLastModified(req); // depends on control dependency: [try], data = [none]
} catch (ThreadDeath err) {
throw err;
} catch (RuntimeException err) { // depends on control dependency: [catch], data = [none]
getLogger().log(Level.SEVERE, null, err);
throw err;
} catch (IOException | SQLException err) { // depends on control dependency: [catch], data = [none]
getLogger().log(Level.SEVERE, null, err);
throw new RuntimeException(err);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setReferenceDataSourceDescriptions(java.util.Collection<ReferenceDataSourceDescription> referenceDataSourceDescriptions) {
if (referenceDataSourceDescriptions == null) {
this.referenceDataSourceDescriptions = null;
return;
}
this.referenceDataSourceDescriptions = new java.util.ArrayList<ReferenceDataSourceDescription>(referenceDataSourceDescriptions);
} } | public class class_name {
public void setReferenceDataSourceDescriptions(java.util.Collection<ReferenceDataSourceDescription> referenceDataSourceDescriptions) {
if (referenceDataSourceDescriptions == null) {
this.referenceDataSourceDescriptions = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.referenceDataSourceDescriptions = new java.util.ArrayList<ReferenceDataSourceDescription>(referenceDataSourceDescriptions);
} } |
public class class_name {
@Override
protected int writeBytesWireFormat ( byte[] dst, int dstIndex ) {
int start = dstIndex;
SMBUtil.writeInt2(48, dst, dstIndex);
SMBUtil.writeInt2(this.locks.length, dst, dstIndex + 2);
dstIndex += 4;
SMBUtil.writeInt4( ( ( this.lockSequenceNumber & 0xF ) << 28 ) | ( this.lockSequenceIndex & 0x0FFFFFFF ), dst, dstIndex);
dstIndex += 4;
System.arraycopy(this.fileId, 0, dst, dstIndex, 16);
dstIndex += 16;
for ( Smb2Lock l : this.locks ) {
dstIndex += l.encode(dst, dstIndex);
}
return dstIndex - start;
} } | public class class_name {
@Override
protected int writeBytesWireFormat ( byte[] dst, int dstIndex ) {
int start = dstIndex;
SMBUtil.writeInt2(48, dst, dstIndex);
SMBUtil.writeInt2(this.locks.length, dst, dstIndex + 2);
dstIndex += 4;
SMBUtil.writeInt4( ( ( this.lockSequenceNumber & 0xF ) << 28 ) | ( this.lockSequenceIndex & 0x0FFFFFFF ), dst, dstIndex);
dstIndex += 4;
System.arraycopy(this.fileId, 0, dst, dstIndex, 16);
dstIndex += 16;
for ( Smb2Lock l : this.locks ) {
dstIndex += l.encode(dst, dstIndex); // depends on control dependency: [for], data = [l]
}
return dstIndex - start;
} } |
public class class_name {
@Override
public final void initializeConsumers(final TaskListener finishedListener) {
final TaskRunner taskRunner = getTaskRunner();
final List<RowProcessingConsumer> configurableConsumers = getConsumers();
final int numConfigurableConsumers = configurableConsumers.size();
final JoinTaskListener initFinishedListener = new JoinTaskListener(numConfigurableConsumers, finishedListener);
for (final RowProcessingConsumer consumer : configurableConsumers) {
final TaskRunnable task = createInitTask(consumer, initFinishedListener);
taskRunner.run(task);
}
} } | public class class_name {
@Override
public final void initializeConsumers(final TaskListener finishedListener) {
final TaskRunner taskRunner = getTaskRunner();
final List<RowProcessingConsumer> configurableConsumers = getConsumers();
final int numConfigurableConsumers = configurableConsumers.size();
final JoinTaskListener initFinishedListener = new JoinTaskListener(numConfigurableConsumers, finishedListener);
for (final RowProcessingConsumer consumer : configurableConsumers) {
final TaskRunnable task = createInitTask(consumer, initFinishedListener);
taskRunner.run(task); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private static String checkDisplayName(final FormItemList formItemList,
final CreateUserResponse createUserResponse) {
final String displayName = formItemList
.getField(ProtocolConstants.Parameters.Create.User.DISPLAY_NAME);
if (displayName != null) {
return displayName;
} else {
createUserResponse.displayNameMissing();
}
return null;
} } | public class class_name {
private static String checkDisplayName(final FormItemList formItemList,
final CreateUserResponse createUserResponse) {
final String displayName = formItemList
.getField(ProtocolConstants.Parameters.Create.User.DISPLAY_NAME);
if (displayName != null) {
return displayName; // depends on control dependency: [if], data = [none]
} else {
createUserResponse.displayNameMissing(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@JsonIgnore
public ImmutableMap<String, ?> getEnvironment() {
if (getProtocolProviderPackages() != null && getProtocolProviderPackages().contains("weblogic")) {
ImmutableMap.Builder<String, String> environment = ImmutableMap.builder();
if ((username != null) && (password != null)) {
environment.put(PROTOCOL_PROVIDER_PACKAGES, getProtocolProviderPackages());
environment.put(SECURITY_PRINCIPAL, username);
environment.put(SECURITY_CREDENTIALS, password);
}
return environment.build();
}
ImmutableMap.Builder<String, Object> environment = ImmutableMap.builder();
if ((username != null) && (password != null)) {
String[] credentials = new String[] {
username,
password
};
environment.put(JMXConnector.CREDENTIALS, credentials);
}
JmxTransRMIClientSocketFactory rmiClientSocketFactory = new JmxTransRMIClientSocketFactory(DEFAULT_SOCKET_SO_TIMEOUT_MILLIS, ssl);
// The following is required when JMX is secured with SSL
// with com.sun.management.jmxremote.ssl=true
// as shown in http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html#gdfvq
environment.put(RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, rmiClientSocketFactory);
// The following is required when JNDI Registry is secured with SSL
// with com.sun.management.jmxremote.registry.ssl=true
// This property is defined in com.sun.jndi.rmi.registry.RegistryContext.SOCKET_FACTORY
environment.put("com.sun.jndi.rmi.factory.socket", rmiClientSocketFactory);
return environment.build();
} } | public class class_name {
@JsonIgnore
public ImmutableMap<String, ?> getEnvironment() {
if (getProtocolProviderPackages() != null && getProtocolProviderPackages().contains("weblogic")) {
ImmutableMap.Builder<String, String> environment = ImmutableMap.builder();
if ((username != null) && (password != null)) {
environment.put(PROTOCOL_PROVIDER_PACKAGES, getProtocolProviderPackages()); // depends on control dependency: [if], data = [none]
environment.put(SECURITY_PRINCIPAL, username); // depends on control dependency: [if], data = [none]
environment.put(SECURITY_CREDENTIALS, password); // depends on control dependency: [if], data = [none]
}
return environment.build(); // depends on control dependency: [if], data = [none]
}
ImmutableMap.Builder<String, Object> environment = ImmutableMap.builder();
if ((username != null) && (password != null)) {
String[] credentials = new String[] {
username,
password
};
environment.put(JMXConnector.CREDENTIALS, credentials); // depends on control dependency: [if], data = [none]
}
JmxTransRMIClientSocketFactory rmiClientSocketFactory = new JmxTransRMIClientSocketFactory(DEFAULT_SOCKET_SO_TIMEOUT_MILLIS, ssl);
// The following is required when JMX is secured with SSL
// with com.sun.management.jmxremote.ssl=true
// as shown in http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html#gdfvq
environment.put(RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, rmiClientSocketFactory);
// The following is required when JNDI Registry is secured with SSL
// with com.sun.management.jmxremote.registry.ssl=true
// This property is defined in com.sun.jndi.rmi.registry.RegistryContext.SOCKET_FACTORY
environment.put("com.sun.jndi.rmi.factory.socket", rmiClientSocketFactory);
return environment.build();
} } |
public class class_name {
private void highlightEntryParser(HighlightSearchEntry entry) {
String text;
int lastPos = 0;
text = this.getText();
Highlighter hilite = this.getHighlighter();
HighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(entry.getColor());
while ( (lastPos = text.indexOf(entry.getToken(), lastPos)) > -1) {
try {
hilite.addHighlight(lastPos, lastPos + entry.getToken().length(), painter);
lastPos += entry.getToken().length();
} catch (BadLocationException e) {
log.warn("Could not highlight entry", e);
}
}
} } | public class class_name {
private void highlightEntryParser(HighlightSearchEntry entry) {
String text;
int lastPos = 0;
text = this.getText();
Highlighter hilite = this.getHighlighter();
HighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(entry.getColor());
while ( (lastPos = text.indexOf(entry.getToken(), lastPos)) > -1) {
try {
hilite.addHighlight(lastPos, lastPos + entry.getToken().length(), painter);
// depends on control dependency: [try], data = [none]
lastPos += entry.getToken().length();
// depends on control dependency: [try], data = [none]
} catch (BadLocationException e) {
log.warn("Could not highlight entry", e);
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected void build(EObject object, ISourceAppender appender) throws IOException {
final IJvmTypeProvider provider = getTypeResolutionContext();
if (provider != null) {
final Map<Key<?>, Binding<?>> bindings = this.originalInjector.getBindings();
Injector localInjector = CodeBuilderFactory.createOverridingInjector(this.originalInjector, (binder) -> binder.bind(AbstractTypeScopeProvider.class).toInstance(AbstractSourceAppender.this.scopeProvider));
final IScopeProvider oldDelegate = this.typeScopes.getDelegate();
localInjector.injectMembers(this.typeScopes);
try {
final AppenderSerializer serializer = localInjector.getProvider(AppenderSerializer.class).get();
serializer.serialize(object, appender, isFormatting());
} finally {
try {
final Field f = DelegatingScopes.class.getDeclaredField("delegate");
if (!f.isAccessible()) {
f.setAccessible(true);
}
f.set(this.typeScopes, oldDelegate);
} catch (Exception exception) {
throw new Error(exception);
}
}
} else {
final AppenderSerializer serializer = this.originalInjector.getProvider(AppenderSerializer.class).get();
serializer.serialize(object, appender, isFormatting());
}
} } | public class class_name {
protected void build(EObject object, ISourceAppender appender) throws IOException {
final IJvmTypeProvider provider = getTypeResolutionContext();
if (provider != null) {
final Map<Key<?>, Binding<?>> bindings = this.originalInjector.getBindings();
Injector localInjector = CodeBuilderFactory.createOverridingInjector(this.originalInjector, (binder) -> binder.bind(AbstractTypeScopeProvider.class).toInstance(AbstractSourceAppender.this.scopeProvider));
final IScopeProvider oldDelegate = this.typeScopes.getDelegate();
localInjector.injectMembers(this.typeScopes);
try {
final AppenderSerializer serializer = localInjector.getProvider(AppenderSerializer.class).get();
serializer.serialize(object, appender, isFormatting());
} finally {
try {
final Field f = DelegatingScopes.class.getDeclaredField("delegate");
if (!f.isAccessible()) {
f.setAccessible(true); // depends on control dependency: [if], data = [none]
}
f.set(this.typeScopes, oldDelegate); // depends on control dependency: [try], data = [none]
} catch (Exception exception) {
throw new Error(exception);
} // depends on control dependency: [catch], data = [none]
}
} else {
final AppenderSerializer serializer = this.originalInjector.getProvider(AppenderSerializer.class).get();
serializer.serialize(object, appender, isFormatting());
}
} } |
public class class_name {
public Flux<ServiceMessage> requestBidirectional(
Publisher<ServiceMessage> publisher, Class<?> responseType) {
return Flux.from(publisher)
.switchOnFirst(
(first, messages) -> {
if (first.hasValue()) {
ServiceMessage request = first.get();
String qualifier = request.qualifier();
if (methodRegistry.containsInvoker(qualifier)) { // local service.
return methodRegistry
.getInvoker(qualifier)
.invokeBidirectional(messages, ServiceMessageCodec::decodeData)
.map(this::throwIfError);
} else {
// remote service
return addressLookup(request)
.flatMapMany(
address -> requestBidirectional(messages, responseType, address));
}
}
return messages;
});
} } | public class class_name {
public Flux<ServiceMessage> requestBidirectional(
Publisher<ServiceMessage> publisher, Class<?> responseType) {
return Flux.from(publisher)
.switchOnFirst(
(first, messages) -> {
if (first.hasValue()) {
ServiceMessage request = first.get();
String qualifier = request.qualifier();
if (methodRegistry.containsInvoker(qualifier)) { // local service.
return methodRegistry
.getInvoker(qualifier)
.invokeBidirectional(messages, ServiceMessageCodec::decodeData)
.map(this::throwIfError); // depends on control dependency: [if], data = [none]
} else {
// remote service
return addressLookup(request)
.flatMapMany(
address -> requestBidirectional(messages, responseType, address)); // depends on control dependency: [if], data = [none]
}
}
return messages;
});
} } |
public class class_name {
public Map<String, CmsContainerBean> getParentContainers() {
if (m_parentContainers == null) {
initPageData();
}
return Collections.unmodifiableMap(m_parentContainers);
} } | public class class_name {
public Map<String, CmsContainerBean> getParentContainers() {
if (m_parentContainers == null) {
initPageData(); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableMap(m_parentContainers);
} } |
public class class_name {
public Cursor rawQueryWithFactory(
CursorFactory cursorFactory, String sql, String[] selectionArgs,
String editTable, CancellationSignal cancellationSignal) {
acquireReference();
try {
com.couchbase.lite.internal.database.sqlite.SQLiteCursorDriver driver = new com.couchbase.lite.internal.database.sqlite.SQLiteDirectCursorDriver(this, sql, editTable,
cancellationSignal);
return driver.query(cursorFactory != null ? cursorFactory : mCursorFactory,
selectionArgs);
} finally {
releaseReference();
}
} } | public class class_name {
public Cursor rawQueryWithFactory(
CursorFactory cursorFactory, String sql, String[] selectionArgs,
String editTable, CancellationSignal cancellationSignal) {
acquireReference();
try {
com.couchbase.lite.internal.database.sqlite.SQLiteCursorDriver driver = new com.couchbase.lite.internal.database.sqlite.SQLiteDirectCursorDriver(this, sql, editTable,
cancellationSignal);
return driver.query(cursorFactory != null ? cursorFactory : mCursorFactory,
selectionArgs); // depends on control dependency: [try], data = [none]
} finally {
releaseReference();
}
} } |
public class class_name {
private Stream<Deque<Archive>> makePaths(Deque<Archive> path) {
Set<Archive> nodes = endPoints.get(path.peekFirst());
if (nodes == null || nodes.isEmpty()) {
return Stream.of(new LinkedList<>(path));
} else {
return nodes.stream().map(n -> {
Deque<Archive> newPath = new LinkedList<>();
newPath.addFirst(n);
newPath.addAll(path);
return newPath;
});
}
} } | public class class_name {
private Stream<Deque<Archive>> makePaths(Deque<Archive> path) {
Set<Archive> nodes = endPoints.get(path.peekFirst());
if (nodes == null || nodes.isEmpty()) {
return Stream.of(new LinkedList<>(path)); // depends on control dependency: [if], data = [none]
} else {
return nodes.stream().map(n -> {
Deque<Archive> newPath = new LinkedList<>(); // depends on control dependency: [if], data = [none]
newPath.addFirst(n); // depends on control dependency: [if], data = [none]
newPath.addAll(path); // depends on control dependency: [if], data = [none]
return newPath; // depends on control dependency: [if], data = [none]
});
}
} } |
public class class_name {
public Set<ResourceSelection> getSelections(final String catalog, final String name) {
Set<ResourceSelection> result = new HashSet<>();
for (ResourceSelection selection : selections) {
if (selection.getCatalog().equals(catalog) && selection.getName().equals(name)) {
result.add(selection);
}
}
return result;
} } | public class class_name {
public Set<ResourceSelection> getSelections(final String catalog, final String name) {
Set<ResourceSelection> result = new HashSet<>();
for (ResourceSelection selection : selections) {
if (selection.getCatalog().equals(catalog) && selection.getName().equals(name)) {
result.add(selection); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
@Override
public Map<K, V> clearAll() {
Map<K, V> result = new LinkedHashMap<K, V>(map.size());
for (Map.Entry<K, V> entry : map.entrySet()) {
K key = entry.getKey();
V value = entry.getValue();
boolean removed = map.remove(key, value);
if (removed) {
result.put(key, value);
}
}
return result;
} } | public class class_name {
@Override
public Map<K, V> clearAll() {
Map<K, V> result = new LinkedHashMap<K, V>(map.size());
for (Map.Entry<K, V> entry : map.entrySet()) {
K key = entry.getKey();
V value = entry.getValue();
boolean removed = map.remove(key, value);
if (removed) {
result.put(key, value); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public void updateGrid(List<S> solutionList) {
//Update lower and upper limits
updateLimits(solutionList);
//Calculate the division size
for (int obj = 0; obj < numberOfObjectives; obj++) {
divisionSize[obj] = gridUpperLimits[obj] - gridLowerLimits[obj];
}
//Clean the hypercubes
for (int i = 0; i < hypercubes.length; i++) {
hypercubes[i] = 0;
}
//Add the population
addSolutionSet(solutionList);
} } | public class class_name {
public void updateGrid(List<S> solutionList) {
//Update lower and upper limits
updateLimits(solutionList);
//Calculate the division size
for (int obj = 0; obj < numberOfObjectives; obj++) {
divisionSize[obj] = gridUpperLimits[obj] - gridLowerLimits[obj];
// depends on control dependency: [for], data = [obj]
}
//Clean the hypercubes
for (int i = 0; i < hypercubes.length; i++) {
hypercubes[i] = 0;
// depends on control dependency: [for], data = [i]
}
//Add the population
addSolutionSet(solutionList);
} } |
public class class_name {
@SuppressWarnings("unused")
public void shutWorker(Map conf,
String supervisorId,
Map<String, String> workerIdToTopology,
ConcurrentHashMap<String, String> workerThreadPids,
CgroupManager cgroupManager,
boolean block,
Map<String, Integer> killingWorkers,
Map<String, Integer> taskCleanupTimeoutMap) {
Map<String, List<String>> workerId2Pids = new HashMap<>();
boolean localMode = false;
int maxWaitTime = 0;
if (killingWorkers == null)
killingWorkers = new HashMap<>();
for (Entry<String, String> entry : workerIdToTopology.entrySet()) {
String workerId = entry.getKey();
String topologyId = entry.getValue();
List<String> pids;
try {
pids = getPid(conf, workerId);
} catch (IOException e1) {
pids = Lists.newArrayList();
LOG.error("Failed to get pid for " + workerId + " of " + topologyId);
}
workerId2Pids.put(workerId, pids);
if (killingWorkers.get(workerId) == null) {
killingWorkers.put(workerId, TimeUtils.current_time_secs());
LOG.info("Begin to shut down " + topologyId + ":" + workerId);
try {
String threadPid = workerThreadPids.get(workerId);
// local mode
if (threadPid != null) {
ProcessSimulator.killProcess(threadPid);
localMode = true;
continue;
}
for (String pid : pids) {
JStormUtils.process_killed(Integer.parseInt(pid));
}
if (taskCleanupTimeoutMap != null && taskCleanupTimeoutMap.get(topologyId) != null) {
maxWaitTime = Math.max(maxWaitTime, taskCleanupTimeoutMap.get(topologyId));
} else {
maxWaitTime = Math.max(maxWaitTime, ConfigExtension.getTaskCleanupTimeoutSec(conf));
}
} catch (Exception e) {
LOG.info("Failed to shutdown ", e);
}
}
}
if (block) {
JStormUtils.sleepMs(maxWaitTime);
}
for (Entry<String, String> entry : workerIdToTopology.entrySet()) {
String workerId = entry.getKey();
String topologyId = entry.getValue();
List<String> pids = workerId2Pids.get(workerId);
int cleanupTimeout;
if (taskCleanupTimeoutMap != null && taskCleanupTimeoutMap.get(topologyId) != null) {
cleanupTimeout = taskCleanupTimeoutMap.get(topologyId);
} else {
cleanupTimeout = ConfigExtension.getTaskCleanupTimeoutSec(conf);
}
int initCleanupTime = killingWorkers.get(workerId);
if (TimeUtils.current_time_secs() - initCleanupTime > cleanupTimeout) {
if (!localMode) {
for (String pid : pids) {
JStormUtils.ensure_process_killed(Integer.parseInt(pid));
if (cgroupManager != null) {
cgroupManager.shutDownWorker(workerId, true);
}
}
}
tryCleanupWorkerDir(conf, workerId);
LOG.info("Successfully shut down " + workerId);
killingWorkers.remove(workerId);
}
}
} } | public class class_name {
@SuppressWarnings("unused")
public void shutWorker(Map conf,
String supervisorId,
Map<String, String> workerIdToTopology,
ConcurrentHashMap<String, String> workerThreadPids,
CgroupManager cgroupManager,
boolean block,
Map<String, Integer> killingWorkers,
Map<String, Integer> taskCleanupTimeoutMap) {
Map<String, List<String>> workerId2Pids = new HashMap<>();
boolean localMode = false;
int maxWaitTime = 0;
if (killingWorkers == null)
killingWorkers = new HashMap<>();
for (Entry<String, String> entry : workerIdToTopology.entrySet()) {
String workerId = entry.getKey();
String topologyId = entry.getValue();
List<String> pids;
try {
pids = getPid(conf, workerId); // depends on control dependency: [try], data = [none]
} catch (IOException e1) {
pids = Lists.newArrayList();
LOG.error("Failed to get pid for " + workerId + " of " + topologyId);
} // depends on control dependency: [catch], data = [none]
workerId2Pids.put(workerId, pids); // depends on control dependency: [for], data = [none]
if (killingWorkers.get(workerId) == null) {
killingWorkers.put(workerId, TimeUtils.current_time_secs()); // depends on control dependency: [if], data = [none]
LOG.info("Begin to shut down " + topologyId + ":" + workerId); // depends on control dependency: [if], data = [none]
try {
String threadPid = workerThreadPids.get(workerId);
// local mode
if (threadPid != null) {
ProcessSimulator.killProcess(threadPid); // depends on control dependency: [if], data = [(threadPid]
localMode = true; // depends on control dependency: [if], data = [none]
continue;
}
for (String pid : pids) {
JStormUtils.process_killed(Integer.parseInt(pid)); // depends on control dependency: [for], data = [pid]
}
if (taskCleanupTimeoutMap != null && taskCleanupTimeoutMap.get(topologyId) != null) {
maxWaitTime = Math.max(maxWaitTime, taskCleanupTimeoutMap.get(topologyId)); // depends on control dependency: [if], data = [none]
} else {
maxWaitTime = Math.max(maxWaitTime, ConfigExtension.getTaskCleanupTimeoutSec(conf)); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LOG.info("Failed to shutdown ", e);
} // depends on control dependency: [catch], data = [none]
}
}
if (block) {
JStormUtils.sleepMs(maxWaitTime); // depends on control dependency: [if], data = [none]
}
for (Entry<String, String> entry : workerIdToTopology.entrySet()) {
String workerId = entry.getKey();
String topologyId = entry.getValue();
List<String> pids = workerId2Pids.get(workerId);
int cleanupTimeout;
if (taskCleanupTimeoutMap != null && taskCleanupTimeoutMap.get(topologyId) != null) {
cleanupTimeout = taskCleanupTimeoutMap.get(topologyId); // depends on control dependency: [if], data = [none]
} else {
cleanupTimeout = ConfigExtension.getTaskCleanupTimeoutSec(conf); // depends on control dependency: [if], data = [none]
}
int initCleanupTime = killingWorkers.get(workerId);
if (TimeUtils.current_time_secs() - initCleanupTime > cleanupTimeout) {
if (!localMode) {
for (String pid : pids) {
JStormUtils.ensure_process_killed(Integer.parseInt(pid)); // depends on control dependency: [for], data = [pid]
if (cgroupManager != null) {
cgroupManager.shutDownWorker(workerId, true); // depends on control dependency: [if], data = [none]
}
}
}
tryCleanupWorkerDir(conf, workerId); // depends on control dependency: [if], data = [none]
LOG.info("Successfully shut down " + workerId); // depends on control dependency: [if], data = [none]
killingWorkers.remove(workerId); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void load(XMLReader r) throws KNXMLException
{
if (r.getPosition() != XMLReader.START_TAG)
r.read();
final Element e = r.getCurrent();
if (r.getPosition() != XMLReader.START_TAG || !e.getName().equals(TAG_DATAPOINTS))
throw new KNXMLException(TAG_DATAPOINTS + " element not found", e != null ? e
.getName() : null, r.getLineNumber());
synchronized (points) {
while (r.read() == XMLReader.START_TAG) {
final Datapoint dp = Datapoint.create(r);
if (points.containsKey(dp.getMainAddress()))
throw new KNXMLException(TAG_DATAPOINTS + " element contains "
+ "duplicate datapoint", dp.getMainAddress().toString(), r
.getLineNumber());
points.put(dp.getMainAddress(), dp);
}
}
} } | public class class_name {
public void load(XMLReader r) throws KNXMLException
{
if (r.getPosition() != XMLReader.START_TAG)
r.read();
final Element e = r.getCurrent();
if (r.getPosition() != XMLReader.START_TAG || !e.getName().equals(TAG_DATAPOINTS))
throw new KNXMLException(TAG_DATAPOINTS + " element not found", e != null ? e
.getName() : null, r.getLineNumber());
synchronized (points) {
while (r.read() == XMLReader.START_TAG) {
final Datapoint dp = Datapoint.create(r);
if (points.containsKey(dp.getMainAddress()))
throw new KNXMLException(TAG_DATAPOINTS + " element contains "
+ "duplicate datapoint", dp.getMainAddress().toString(), r
.getLineNumber());
points.put(dp.getMainAddress(), dp);
// depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
public MetricDatum withDimensions(Dimension... dimensions) {
if (this.dimensions == null) {
setDimensions(new com.amazonaws.internal.SdkInternalList<Dimension>(dimensions.length));
}
for (Dimension ele : dimensions) {
this.dimensions.add(ele);
}
return this;
} } | public class class_name {
public MetricDatum withDimensions(Dimension... dimensions) {
if (this.dimensions == null) {
setDimensions(new com.amazonaws.internal.SdkInternalList<Dimension>(dimensions.length)); // depends on control dependency: [if], data = [none]
}
for (Dimension ele : dimensions) {
this.dimensions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private static Object add(ExecutionContext context, Object lhs, Object rhs) {
if (lhs instanceof String || rhs instanceof String) {
return(Types.toString(context, lhs) + Types.toString(context, rhs));
}
Number lhsNum = Types.toNumber(context, lhs);
Number rhsNum = Types.toNumber(context, rhs);
if (Double.isNaN(lhsNum.doubleValue()) || Double.isNaN(rhsNum.doubleValue())) {
return(Double.NaN);
}
if (lhsNum instanceof Double || rhsNum instanceof Double) {
if (lhsNum.doubleValue() == 0.0 && rhsNum.doubleValue() == 0.0) {
if (Double.compare(lhsNum.doubleValue(), 0.0) < 0 && Double.compare(rhsNum.doubleValue(), 0.0) < 0) {
return(-0.0);
} else {
return(0.0);
}
}
return(lhsNum.doubleValue() - rhsNum.doubleValue());
}
return(lhsNum.longValue() + rhsNum.longValue());
} } | public class class_name {
private static Object add(ExecutionContext context, Object lhs, Object rhs) {
if (lhs instanceof String || rhs instanceof String) {
return(Types.toString(context, lhs) + Types.toString(context, rhs)); // depends on control dependency: [if], data = [none]
}
Number lhsNum = Types.toNumber(context, lhs);
Number rhsNum = Types.toNumber(context, rhs);
if (Double.isNaN(lhsNum.doubleValue()) || Double.isNaN(rhsNum.doubleValue())) {
return(Double.NaN); // depends on control dependency: [if], data = [none]
}
if (lhsNum instanceof Double || rhsNum instanceof Double) {
if (lhsNum.doubleValue() == 0.0 && rhsNum.doubleValue() == 0.0) {
if (Double.compare(lhsNum.doubleValue(), 0.0) < 0 && Double.compare(rhsNum.doubleValue(), 0.0) < 0) {
return(-0.0); // depends on control dependency: [if], data = [none]
} else {
return(0.0); // depends on control dependency: [if], data = [none]
}
}
return(lhsNum.doubleValue() - rhsNum.doubleValue()); // depends on control dependency: [if], data = [none]
}
return(lhsNum.longValue() + rhsNum.longValue());
} } |
public class class_name {
static boolean isLatin(String s) {
int len = s.length();
for (int index = 0; index < len; index++) {
char c = s.charAt(index);
if (c > LARGEST_BASIC_LATIN) {
return false;
}
}
return true;
} } | public class class_name {
static boolean isLatin(String s) {
int len = s.length();
for (int index = 0; index < len; index++) {
char c = s.charAt(index);
if (c > LARGEST_BASIC_LATIN) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static List<GatewayAddress> asList(final List<String> addressList) {
if (addressList == null || addressList.size() == 0) {
throw new IllegalArgumentException("addresses must not be null");
}
List<GatewayAddress> list = new ArrayList<GatewayAddress>();
int id = 1;
for (String address : addressList) {
list.add(new GatewayAddress(id++, address));
}
return list;
} } | public class class_name {
public static List<GatewayAddress> asList(final List<String> addressList) {
if (addressList == null || addressList.size() == 0) {
throw new IllegalArgumentException("addresses must not be null");
}
List<GatewayAddress> list = new ArrayList<GatewayAddress>();
int id = 1;
for (String address : addressList) {
list.add(new GatewayAddress(id++, address)); // depends on control dependency: [for], data = [address]
}
return list;
} } |
public class class_name {
@ReadOperation
public Object invokeRouteDetails(@Selector String format) {
if (FORMAT_DETAILS.equalsIgnoreCase(format)) {
return invokeRouteDetails();
}
else {
return invoke();
}
} } | public class class_name {
@ReadOperation
public Object invokeRouteDetails(@Selector String format) {
if (FORMAT_DETAILS.equalsIgnoreCase(format)) {
return invokeRouteDetails(); // depends on control dependency: [if], data = [none]
}
else {
return invoke(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected NlsBundleOptions getBundleOptions(Class<? extends NlsBundle> bundleInterface) {
NlsBundleOptions options = bundleInterface.getAnnotation(NlsBundleOptions.class);
if (options == null) {
options = AbstractNlsBundleFactory.class.getAnnotation(NlsBundleOptions.class);
}
return options;
} } | public class class_name {
protected NlsBundleOptions getBundleOptions(Class<? extends NlsBundle> bundleInterface) {
NlsBundleOptions options = bundleInterface.getAnnotation(NlsBundleOptions.class);
if (options == null) {
options = AbstractNlsBundleFactory.class.getAnnotation(NlsBundleOptions.class); // depends on control dependency: [if], data = [none]
}
return options;
} } |
public class class_name {
private void readBioPolymer(String biopolymerFile) {
try {
// Read PDB file
FileReader fileReader = new FileReader(biopolymerFile);
ISimpleChemObjectReader reader = new ReaderFactory().createReader(fileReader);
IChemFile chemFile = (IChemFile) reader.read((IChemObject) new ChemFile());
// Get molecule from ChemFile
IChemSequence chemSequence = chemFile.getChemSequence(0);
IChemModel chemModel = chemSequence.getChemModel(0);
IAtomContainerSet setOfMolecules = chemModel.getMoleculeSet();
protein = (IBioPolymer) setOfMolecules.getAtomContainer(0);
} catch (IOException | CDKException exc) {
logger.error("Could not read BioPolymer from file>" + biopolymerFile + " due to: " + exc.getMessage());
logger.debug(exc);
}
} } | public class class_name {
private void readBioPolymer(String biopolymerFile) {
try {
// Read PDB file
FileReader fileReader = new FileReader(biopolymerFile);
ISimpleChemObjectReader reader = new ReaderFactory().createReader(fileReader);
IChemFile chemFile = (IChemFile) reader.read((IChemObject) new ChemFile());
// Get molecule from ChemFile
IChemSequence chemSequence = chemFile.getChemSequence(0);
IChemModel chemModel = chemSequence.getChemModel(0);
IAtomContainerSet setOfMolecules = chemModel.getMoleculeSet();
protein = (IBioPolymer) setOfMolecules.getAtomContainer(0); // depends on control dependency: [try], data = [none]
} catch (IOException | CDKException exc) {
logger.error("Could not read BioPolymer from file>" + biopolymerFile + " due to: " + exc.getMessage());
logger.debug(exc);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void writeObject (Output output, Object object) {
if (output == null) throw new IllegalArgumentException("output cannot be null.");
if (object == null) throw new IllegalArgumentException("object cannot be null.");
beginObject();
try {
if (references && writeReferenceOrNull(output, object, false)) return;
if (TRACE || (DEBUG && depth == 1)) log("Write", object, output.position());
getRegistration(object.getClass()).getSerializer().write(this, output, object);
} finally {
if (--depth == 0 && autoReset) reset();
}
} } | public class class_name {
public void writeObject (Output output, Object object) {
if (output == null) throw new IllegalArgumentException("output cannot be null.");
if (object == null) throw new IllegalArgumentException("object cannot be null.");
beginObject();
try {
if (references && writeReferenceOrNull(output, object, false)) return;
if (TRACE || (DEBUG && depth == 1)) log("Write", object, output.position());
getRegistration(object.getClass()).getSerializer().write(this, output, object);
// depends on control dependency: [try], data = [none]
} finally {
if (--depth == 0 && autoReset) reset();
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
synchronized <N extends Number> N parse(final Class<N> type, final String text) {
final Number result;
if(lenient) {
try {
result = formatter.parse(text);
} catch(ParseException e) {
throw new TextParseException(text, type, e);
}
} else {
ParsePosition position = new ParsePosition(0);
result = formatter.parse(text, position);
if(position.getIndex() != text.length()) {
throw new TextParseException(text, type, String.format("Cannot parse '%s' using fromat %s", text, getPattern()));
}
}
try {
if(result instanceof BigDecimal) {
// if set DecimalFormat#setParseBigDecimal(true)
return (N) convertWithBigDecimal(type, (BigDecimal) result, text);
} else {
return (N) convertWithNumber(type, result, text);
}
} catch(NumberFormatException | ArithmeticException e) {
throw new TextParseException(text, type, e);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
synchronized <N extends Number> N parse(final Class<N> type, final String text) {
final Number result;
if(lenient) {
try {
result = formatter.parse(text);
// depends on control dependency: [try], data = [none]
} catch(ParseException e) {
throw new TextParseException(text, type, e);
}
// depends on control dependency: [catch], data = [none]
} else {
ParsePosition position = new ParsePosition(0);
result = formatter.parse(text, position);
// depends on control dependency: [if], data = [none]
if(position.getIndex() != text.length()) {
throw new TextParseException(text, type, String.format("Cannot parse '%s' using fromat %s", text, getPattern()));
}
}
try {
if(result instanceof BigDecimal) {
// if set DecimalFormat#setParseBigDecimal(true)
return (N) convertWithBigDecimal(type, (BigDecimal) result, text);
// depends on control dependency: [if], data = [none]
} else {
return (N) convertWithNumber(type, result, text);
// depends on control dependency: [if], data = [none]
}
} catch(NumberFormatException | ArithmeticException e) {
throw new TextParseException(text, type, e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void visit(NodeVisitor v) {
if (v.visit(this) && returnValue != null) {
returnValue.visit(v);
}
} } | public class class_name {
@Override
public void visit(NodeVisitor v) {
if (v.visit(this) && returnValue != null) {
returnValue.visit(v); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List evaluate(Record record) {
// fast path (not functionally necessary):
if (fields.size() == 1) {
Object first = fields.get(0);
if (first instanceof String) {
return Collections.singletonList(first);
} else {
String ref = ((Field) first).getName();
if (ref.length() != 0) {
List resolvedValues = record.get(ref);
return resolvedValues;
}
}
}
// slow path:
ArrayList<Object> results = new ArrayList<Object>(1);
evaluate2(0, record, new StringBuilder(), results);
return results;
} } | public class class_name {
public List evaluate(Record record) {
// fast path (not functionally necessary):
if (fields.size() == 1) {
Object first = fields.get(0);
if (first instanceof String) {
return Collections.singletonList(first); // depends on control dependency: [if], data = [none]
} else {
String ref = ((Field) first).getName();
if (ref.length() != 0) {
List resolvedValues = record.get(ref);
return resolvedValues; // depends on control dependency: [if], data = [none]
}
}
}
// slow path:
ArrayList<Object> results = new ArrayList<Object>(1);
evaluate2(0, record, new StringBuilder(), results);
return results;
} } |
public class class_name {
public static Set<String> getCfNamesByKeySpace(KsDef keySpace)
{
Set<String> names = new LinkedHashSet<String>();
for (CfDef cfDef : keySpace.getCf_defs())
{
names.add(cfDef.getName());
}
return names;
} } | public class class_name {
public static Set<String> getCfNamesByKeySpace(KsDef keySpace)
{
Set<String> names = new LinkedHashSet<String>();
for (CfDef cfDef : keySpace.getCf_defs())
{
names.add(cfDef.getName()); // depends on control dependency: [for], data = [cfDef]
}
return names;
} } |
public class class_name {
public void setUnindexedFaces(java.util.Collection<UnindexedFace> unindexedFaces) {
if (unindexedFaces == null) {
this.unindexedFaces = null;
return;
}
this.unindexedFaces = new java.util.ArrayList<UnindexedFace>(unindexedFaces);
} } | public class class_name {
public void setUnindexedFaces(java.util.Collection<UnindexedFace> unindexedFaces) {
if (unindexedFaces == null) {
this.unindexedFaces = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.unindexedFaces = new java.util.ArrayList<UnindexedFace>(unindexedFaces);
} } |
public class class_name {
public JdbcTarget withExclusions(String... exclusions) {
if (this.exclusions == null) {
setExclusions(new java.util.ArrayList<String>(exclusions.length));
}
for (String ele : exclusions) {
this.exclusions.add(ele);
}
return this;
} } | public class class_name {
public JdbcTarget withExclusions(String... exclusions) {
if (this.exclusions == null) {
setExclusions(new java.util.ArrayList<String>(exclusions.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : exclusions) {
this.exclusions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public java.util.List<ProcessorFeature> getProcessorFeatures() {
if (processorFeatures == null) {
processorFeatures = new com.amazonaws.internal.SdkInternalList<ProcessorFeature>();
}
return processorFeatures;
} } | public class class_name {
public java.util.List<ProcessorFeature> getProcessorFeatures() {
if (processorFeatures == null) {
processorFeatures = new com.amazonaws.internal.SdkInternalList<ProcessorFeature>(); // depends on control dependency: [if], data = [none]
}
return processorFeatures;
} } |
public class class_name {
public static <V> Node<V> findNodeByPath(List<Node<V>> parents, String path) {
checkArgNotNull(path, "path");
if (parents != null && !parents.isEmpty()) {
int separatorIndex = path.indexOf('/');
String prefix = separatorIndex != -1 ? path.substring(0, separatorIndex) : path;
int start = 0, step = 1;
if (prefix.startsWith("last:")) {
prefix = prefix.substring(5);
start = parents.size() - 1;
step = -1;
}
for (int i = start; 0 <= i && i < parents.size(); i += step) {
Node<V> child = parents.get(i);
if (StringUtils.startsWith(child.getLabel(), prefix)) {
return separatorIndex == -1 ? child : findNodeByPath(child, path.substring(separatorIndex + 1));
}
}
}
return null;
} } | public class class_name {
public static <V> Node<V> findNodeByPath(List<Node<V>> parents, String path) {
checkArgNotNull(path, "path");
if (parents != null && !parents.isEmpty()) {
int separatorIndex = path.indexOf('/');
String prefix = separatorIndex != -1 ? path.substring(0, separatorIndex) : path;
int start = 0, step = 1;
if (prefix.startsWith("last:")) {
prefix = prefix.substring(5); // depends on control dependency: [if], data = [none]
start = parents.size() - 1; // depends on control dependency: [if], data = [none]
step = -1; // depends on control dependency: [if], data = [none]
}
for (int i = start; 0 <= i && i < parents.size(); i += step) {
Node<V> child = parents.get(i);
if (StringUtils.startsWith(child.getLabel(), prefix)) {
return separatorIndex == -1 ? child : findNodeByPath(child, path.substring(separatorIndex + 1)); // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
private void doPromoteByPath(PathsPromoteRequest req, boolean setReadonly) throws RepositoryManagerException {
IndyPromoteClientModule promoter;
try {
promoter = serviceAccountIndy.module(IndyPromoteClientModule.class);
} catch (IndyClientException e) {
throw new RepositoryManagerException("Failed to retrieve Indy promote client module. Reason: %s", e, e.getMessage());
}
try {
PathsPromoteResult result = promoter.promoteByPath(req);
if (result.getError() == null) {
if (setReadonly && !isTempBuild) {
HostedRepository hosted = serviceAccountIndy.stores().load(req.getTarget(), HostedRepository.class);
hosted.setReadonly(true);
try {
serviceAccountIndy.stores().update(hosted, "Setting readonly after successful build and promotion.");
} catch (IndyClientException ex) {
try {
promoter.rollbackPathPromote(result);
} catch (IndyClientException ex2) {
logger.error("Failed to set readonly flag on repo: %s. Reason given was: %s.", ex, req.getTarget(), ex.getMessage());
throw new RepositoryManagerException(
"Subsequently also failed to rollback the promotion of paths from %s to %s. Reason given was: %s",
ex2, req.getSource(), req.getTarget(), ex2.getMessage());
}
throw new RepositoryManagerException("Failed to set readonly flag on repo: %s. Reason given was: %s",
ex, req.getTarget(), ex.getMessage());
}
}
} else {
String addendum = "";
try {
PathsPromoteResult rollback = promoter.rollbackPathPromote(result);
if (rollback.getError() != null) {
addendum = "\nROLLBACK WARNING: Promotion rollback also failed! Reason given: " + result.getError();
}
} catch (IndyClientException e) {
throw new RepositoryManagerException("Rollback failed for promotion of: %s. Reason: %s", e, req,
e.getMessage());
}
throw new RepositoryManagerException("Failed to promote: %s. Reason given was: %s%s", req, result.getError(),
addendum);
}
} catch (IndyClientException e) {
throw new RepositoryManagerException("Failed to promote: %s. Reason: %s", e, req, e.getMessage());
}
} } | public class class_name {
private void doPromoteByPath(PathsPromoteRequest req, boolean setReadonly) throws RepositoryManagerException {
IndyPromoteClientModule promoter;
try {
promoter = serviceAccountIndy.module(IndyPromoteClientModule.class);
} catch (IndyClientException e) {
throw new RepositoryManagerException("Failed to retrieve Indy promote client module. Reason: %s", e, e.getMessage());
}
try {
PathsPromoteResult result = promoter.promoteByPath(req);
if (result.getError() == null) {
if (setReadonly && !isTempBuild) {
HostedRepository hosted = serviceAccountIndy.stores().load(req.getTarget(), HostedRepository.class);
hosted.setReadonly(true); // depends on control dependency: [if], data = [none]
try {
serviceAccountIndy.stores().update(hosted, "Setting readonly after successful build and promotion."); // depends on control dependency: [try], data = [none]
} catch (IndyClientException ex) {
try {
promoter.rollbackPathPromote(result); // depends on control dependency: [try], data = [none]
} catch (IndyClientException ex2) {
logger.error("Failed to set readonly flag on repo: %s. Reason given was: %s.", ex, req.getTarget(), ex.getMessage());
throw new RepositoryManagerException(
"Subsequently also failed to rollback the promotion of paths from %s to %s. Reason given was: %s",
ex2, req.getSource(), req.getTarget(), ex2.getMessage());
} // depends on control dependency: [catch], data = [none]
throw new RepositoryManagerException("Failed to set readonly flag on repo: %s. Reason given was: %s",
ex, req.getTarget(), ex.getMessage());
} // depends on control dependency: [catch], data = [none]
}
} else {
String addendum = "";
try {
PathsPromoteResult rollback = promoter.rollbackPathPromote(result);
if (rollback.getError() != null) {
addendum = "\nROLLBACK WARNING: Promotion rollback also failed! Reason given: " + result.getError(); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
} catch (IndyClientException e) {
throw new RepositoryManagerException("Rollback failed for promotion of: %s. Reason: %s", e, req,
e.getMessage());
} // depends on control dependency: [catch], data = [none]
throw new RepositoryManagerException("Failed to promote: %s. Reason given was: %s%s", req, result.getError(),
addendum);
}
} catch (IndyClientException e) {
throw new RepositoryManagerException("Failed to promote: %s. Reason: %s", e, req, e.getMessage());
}
} } |
public class class_name {
public Summary toSummary(List<Keyword> keywords) {
if (keywords == null) {
keywords = new ArrayList<>();
}
if (keywords.isEmpty()) {
KeyWordComputer kc = new KeyWordComputer(10);
keywords = kc.computeArticleTfidf(title, content);
}
return explan(keywords, content);
} } | public class class_name {
public Summary toSummary(List<Keyword> keywords) {
if (keywords == null) {
keywords = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
if (keywords.isEmpty()) {
KeyWordComputer kc = new KeyWordComputer(10);
keywords = kc.computeArticleTfidf(title, content); // depends on control dependency: [if], data = [none]
}
return explan(keywords, content);
} } |
public class class_name {
public void update(String subjectName, Object data)
{
Debugger.println(this,"Recieve subject="+subjectName);
if(isStart(subjectName))
{
this.startData = data;
this.startDate = LocalDateTime.now();
Debugger.printInfo(this,"TIMER START DATE ["+Text.formatDate(startDate)+"]\n "+Text.toString(startData));
}
else if(isEnd(subjectName))
{
this.endData = data;
this.endDate = LocalDateTime.now();
Debugger.printInfo(this,"TIMER END DATE ["+endDate+"]\n "+endData);
if(this.decorator != null)
decorator.decorator(this);
}
else
{
throw new SystemException("Unknown subject "+subjectName);
}
} } | public class class_name {
public void update(String subjectName, Object data)
{
Debugger.println(this,"Recieve subject="+subjectName);
if(isStart(subjectName))
{
this.startData = data;
// depends on control dependency: [if], data = [none]
this.startDate = LocalDateTime.now();
// depends on control dependency: [if], data = [none]
Debugger.printInfo(this,"TIMER START DATE ["+Text.formatDate(startDate)+"]\n "+Text.toString(startData));
// depends on control dependency: [if], data = [none]
}
else if(isEnd(subjectName))
{
this.endData = data;
// depends on control dependency: [if], data = [none]
this.endDate = LocalDateTime.now();
// depends on control dependency: [if], data = [none]
Debugger.printInfo(this,"TIMER END DATE ["+endDate+"]\n "+endData);
// depends on control dependency: [if], data = [none]
if(this.decorator != null)
decorator.decorator(this);
}
else
{
throw new SystemException("Unknown subject "+subjectName);
}
} } |
public class class_name {
private static void reverse(int[] array, int start, int end) {
for (int i = start, j = end; i < --j; ++i) {
int t = array[i];
array[i] = array[j];
array[j] = t;
}
} } | public class class_name {
private static void reverse(int[] array, int start, int end) {
for (int i = start, j = end; i < --j; ++i) {
int t = array[i];
array[i] = array[j]; // depends on control dependency: [for], data = [i]
array[j] = t; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public void mergeShard(ApplicationDefinition appDef, String shard, MergeOptions options) {
checkServiceState();
if (appDef.getOption("auto-merge") != null) {
TaskManagerService.instance().executeTask(appDef, new OLAPMerger(appDef, shard, options));
} else {
m_olap.merge(appDef, shard, options);
}
} } | public class class_name {
public void mergeShard(ApplicationDefinition appDef, String shard, MergeOptions options) {
checkServiceState();
if (appDef.getOption("auto-merge") != null) {
TaskManagerService.instance().executeTask(appDef, new OLAPMerger(appDef, shard, options));
// depends on control dependency: [if], data = [none]
} else {
m_olap.merge(appDef, shard, options);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void unmapByteBuffer(final MappedByteBuffer map) {
if(map == null) {
return;
}
map.force();
try {
if(Runtime.class.getDeclaredMethod("version") != null)
return; // At later Java, the hack below will not work anymore.
}
catch(NoSuchMethodException e) {
// This is an ugly hack, but all that Java <8 offers to help freeing
// memory allocated using such buffers.
// See also: http://bugs.sun.com/view_bug.do?bug_id=4724038
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
Method getCleanerMethod = map.getClass().getMethod("cleaner", new Class[0]);
if(getCleanerMethod == null) {
return null;
}
getCleanerMethod.setAccessible(true);
Object cleaner = getCleanerMethod.invoke(map, new Object[0]);
Method cleanMethod = cleaner.getClass().getMethod("clean");
if(cleanMethod == null) {
return null;
}
cleanMethod.invoke(cleaner);
}
catch(Exception e) {
LoggingUtil.exception(e);
}
return null;
}
});
}
catch(SecurityException e1) {
// Ignore.
}
} } | public class class_name {
public static void unmapByteBuffer(final MappedByteBuffer map) {
if(map == null) {
return; // depends on control dependency: [if], data = [none]
}
map.force();
try {
if(Runtime.class.getDeclaredMethod("version") != null)
return; // At later Java, the hack below will not work anymore.
}
catch(NoSuchMethodException e) {
// This is an ugly hack, but all that Java <8 offers to help freeing
// memory allocated using such buffers.
// See also: http://bugs.sun.com/view_bug.do?bug_id=4724038
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
Method getCleanerMethod = map.getClass().getMethod("cleaner", new Class[0]);
if(getCleanerMethod == null) {
return null; // depends on control dependency: [if], data = [none]
}
getCleanerMethod.setAccessible(true); // depends on control dependency: [try], data = [none]
Object cleaner = getCleanerMethod.invoke(map, new Object[0]);
Method cleanMethod = cleaner.getClass().getMethod("clean");
if(cleanMethod == null) {
return null; // depends on control dependency: [if], data = [none]
}
cleanMethod.invoke(cleaner); // depends on control dependency: [try], data = [none]
}
catch(Exception e) {
LoggingUtil.exception(e);
} // depends on control dependency: [catch], data = [none]
return null;
}
});
} // depends on control dependency: [catch], data = [none]
catch(SecurityException e1) {
// Ignore.
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public String getContentType() {
try {
collaborator.preInvoke(componentMetaData);
return request.getContentType();
} finally {
collaborator.postInvoke();
}
} } | public class class_name {
@Override
public String getContentType() {
try {
collaborator.preInvoke(componentMetaData); // depends on control dependency: [try], data = [none]
return request.getContentType(); // depends on control dependency: [try], data = [none]
} finally {
collaborator.postInvoke();
}
} } |
public class class_name {
@Override
public String update(Integer id, String json, boolean autoCommit) throws SQLException, IOException {
final boolean isCreating = id == null;
JsonNode jsonNode = getJsonNode(json);
try {
if (jsonNode.isArray()) {
// If an array of objects is passed in as the JSON input, update them all in a single transaction, only
// committing once all entities have been updated.
List<String> updatedObjects = new ArrayList<>();
for (JsonNode node : jsonNode) {
JsonNode idNode = node.get("id");
Integer nodeId = idNode == null || isCreating ? null : idNode.asInt();
String updatedObject = update(nodeId, node.toString(), false);
updatedObjects.add(updatedObject);
}
if (autoCommit) connection.commit();
return mapper.writeValueAsString(updatedObjects);
}
// Cast JsonNode to ObjectNode to allow mutations (e.g., updating the ID field).
ObjectNode jsonObject = (ObjectNode) jsonNode;
// Ensure that the key field is unique and that referencing tables are updated if the value is updated.
ensureReferentialIntegrity(jsonObject, tablePrefix, specTable, id);
// Parse the fields/values into a Field -> String map (drops ALL fields not explicitly listed in spec table's
// fields)
// Note, this must follow referential integrity check because some tables will modify the jsonObject (e.g.,
// adding trip ID if it is null).
// LOG.info("JSON to {} entity: {}", isCreating ? "create" : "update", jsonObject.toString());
PreparedStatement preparedStatement = createPreparedUpdate(id, isCreating, jsonObject, specTable, connection, false);
// ID from create/update result
long newId = handleStatementExecution(preparedStatement, isCreating);
// At this point, the transaction was successful (but not yet committed). Now we should handle any update
// logic that applies to child tables. For example, after saving a trip, we need to store its stop times.
Set<Table> referencingTables = getReferencingTables(specTable);
// FIXME: hacky hack hack to add shapes table if we're updating a pattern.
if (specTable.name.equals("patterns")) {
referencingTables.add(Table.SHAPES);
}
// Iterate over referencing (child) tables and update those rows that reference the parent entity with the
// JSON array for the key that matches the child table's name (e.g., trip.stop_times array will trigger
// update of stop_times with matching trip_id).
for (Table referencingTable : referencingTables) {
Table parentTable = referencingTable.getParentTable();
if (parentTable != null && parentTable.name.equals(specTable.name) || referencingTable.name.equals("shapes")) {
// If a referencing table has the current table as its parent, update child elements.
JsonNode childEntities = jsonObject.get(referencingTable.name);
if (childEntities == null || childEntities.isNull() || !childEntities.isArray()) {
throw new SQLException(String.format("Child entities %s must be an array and not null", referencingTable.name));
}
int entityId = isCreating ? (int) newId : id;
// Cast child entities to array node to iterate over.
ArrayNode childEntitiesArray = (ArrayNode)childEntities;
boolean referencedPatternUsesFrequencies = false;
// If an entity references a pattern (e.g., pattern stop or trip), determine whether the pattern uses
// frequencies because this impacts update behaviors, for example whether stop times are kept in
// sync with default travel times or whether frequencies are allowed to be nested with a JSON trip.
if (jsonObject.has("pattern_id") && !jsonObject.get("pattern_id").isNull()) {
PreparedStatement statement = connection.prepareStatement(String.format(
"select use_frequency from %s.%s where pattern_id = ?",
tablePrefix,
Table.PATTERNS.name
));
statement.setString(1, jsonObject.get("pattern_id").asText());
LOG.info(statement.toString());
ResultSet selectResults = statement.executeQuery();
while (selectResults.next()) {
referencedPatternUsesFrequencies = selectResults.getBoolean(1);
}
}
String keyValue = updateChildTable(
childEntitiesArray,
entityId,
referencedPatternUsesFrequencies,
isCreating,
referencingTable,
connection
);
// Ensure JSON return object is updated with referencing table's (potentially) new key value.
// Currently, the only case where an update occurs is when a referenced shape is referenced by other
// patterns.
jsonObject.put(referencingTable.getKeyFieldName(), keyValue);
}
}
// Iterate over table's fields and apply linked values to any tables. This is to account for "exemplar"
// fields that exist in one place in our tables, but are duplicated in GTFS. For example, we have a
// Route#wheelchair_accessible field, which is used to set the Trip#wheelchair_accessible values for all
// trips on a route.
// NOTE: pattern_stops linked fields are updated in the updateChildTable method.
switch (specTable.name) {
case "routes":
updateLinkedFields(
specTable,
jsonObject,
"trips",
"route_id",
"wheelchair_accessible"
);
break;
case "patterns":
updateLinkedFields(
specTable,
jsonObject,
"trips",
"pattern_id",
"direction_id", "shape_id"
);
break;
default:
LOG.debug("No linked fields to update.");
// Do nothing.
break;
}
if (autoCommit) {
// If nothing failed up to this point, it is safe to assume there were no problems updating/creating the
// main entity and any of its children, so we commit the transaction.
LOG.info("Committing transaction.");
connection.commit();
}
// Add new ID to JSON object.
jsonObject.put("id", newId);
// FIXME: Should this return the entity freshly queried from the database rather than just updating the ID?
return jsonObject.toString();
} catch (Exception e) {
LOG.error("Error {} {} entity", isCreating ? "creating" : "updating", specTable.name);
e.printStackTrace();
throw e;
} finally {
if (autoCommit) {
// Always rollback and close in finally in case of early returns or exceptions.
connection.rollback();
connection.close();
}
}
} } | public class class_name {
@Override
public String update(Integer id, String json, boolean autoCommit) throws SQLException, IOException {
final boolean isCreating = id == null;
JsonNode jsonNode = getJsonNode(json);
try {
if (jsonNode.isArray()) {
// If an array of objects is passed in as the JSON input, update them all in a single transaction, only
// committing once all entities have been updated.
List<String> updatedObjects = new ArrayList<>();
for (JsonNode node : jsonNode) {
JsonNode idNode = node.get("id");
Integer nodeId = idNode == null || isCreating ? null : idNode.asInt();
String updatedObject = update(nodeId, node.toString(), false);
updatedObjects.add(updatedObject); // depends on control dependency: [for], data = [none]
}
if (autoCommit) connection.commit();
return mapper.writeValueAsString(updatedObjects); // depends on control dependency: [if], data = [none]
}
// Cast JsonNode to ObjectNode to allow mutations (e.g., updating the ID field).
ObjectNode jsonObject = (ObjectNode) jsonNode;
// Ensure that the key field is unique and that referencing tables are updated if the value is updated.
ensureReferentialIntegrity(jsonObject, tablePrefix, specTable, id);
// Parse the fields/values into a Field -> String map (drops ALL fields not explicitly listed in spec table's
// fields)
// Note, this must follow referential integrity check because some tables will modify the jsonObject (e.g.,
// adding trip ID if it is null).
// LOG.info("JSON to {} entity: {}", isCreating ? "create" : "update", jsonObject.toString());
PreparedStatement preparedStatement = createPreparedUpdate(id, isCreating, jsonObject, specTable, connection, false);
// ID from create/update result
long newId = handleStatementExecution(preparedStatement, isCreating);
// At this point, the transaction was successful (but not yet committed). Now we should handle any update
// logic that applies to child tables. For example, after saving a trip, we need to store its stop times.
Set<Table> referencingTables = getReferencingTables(specTable);
// FIXME: hacky hack hack to add shapes table if we're updating a pattern.
if (specTable.name.equals("patterns")) {
referencingTables.add(Table.SHAPES); // depends on control dependency: [if], data = [none]
}
// Iterate over referencing (child) tables and update those rows that reference the parent entity with the
// JSON array for the key that matches the child table's name (e.g., trip.stop_times array will trigger
// update of stop_times with matching trip_id).
for (Table referencingTable : referencingTables) {
Table parentTable = referencingTable.getParentTable();
if (parentTable != null && parentTable.name.equals(specTable.name) || referencingTable.name.equals("shapes")) {
// If a referencing table has the current table as its parent, update child elements.
JsonNode childEntities = jsonObject.get(referencingTable.name);
if (childEntities == null || childEntities.isNull() || !childEntities.isArray()) {
throw new SQLException(String.format("Child entities %s must be an array and not null", referencingTable.name));
}
int entityId = isCreating ? (int) newId : id;
// Cast child entities to array node to iterate over.
ArrayNode childEntitiesArray = (ArrayNode)childEntities;
boolean referencedPatternUsesFrequencies = false;
// If an entity references a pattern (e.g., pattern stop or trip), determine whether the pattern uses
// frequencies because this impacts update behaviors, for example whether stop times are kept in
// sync with default travel times or whether frequencies are allowed to be nested with a JSON trip.
if (jsonObject.has("pattern_id") && !jsonObject.get("pattern_id").isNull()) {
PreparedStatement statement = connection.prepareStatement(String.format(
"select use_frequency from %s.%s where pattern_id = ?",
tablePrefix,
Table.PATTERNS.name
));
statement.setString(1, jsonObject.get("pattern_id").asText()); // depends on control dependency: [if], data = [none]
LOG.info(statement.toString()); // depends on control dependency: [if], data = [none]
ResultSet selectResults = statement.executeQuery();
while (selectResults.next()) {
referencedPatternUsesFrequencies = selectResults.getBoolean(1); // depends on control dependency: [while], data = [none]
}
}
String keyValue = updateChildTable(
childEntitiesArray,
entityId,
referencedPatternUsesFrequencies,
isCreating,
referencingTable,
connection
);
// Ensure JSON return object is updated with referencing table's (potentially) new key value.
// Currently, the only case where an update occurs is when a referenced shape is referenced by other
// patterns.
jsonObject.put(referencingTable.getKeyFieldName(), keyValue); // depends on control dependency: [if], data = [none]
}
}
// Iterate over table's fields and apply linked values to any tables. This is to account for "exemplar"
// fields that exist in one place in our tables, but are duplicated in GTFS. For example, we have a
// Route#wheelchair_accessible field, which is used to set the Trip#wheelchair_accessible values for all
// trips on a route.
// NOTE: pattern_stops linked fields are updated in the updateChildTable method.
switch (specTable.name) {
case "routes":
updateLinkedFields(
specTable,
jsonObject,
"trips",
"route_id",
"wheelchair_accessible"
);
break;
case "patterns":
updateLinkedFields(
specTable,
jsonObject,
"trips",
"pattern_id",
"direction_id", "shape_id"
);
break;
default:
LOG.debug("No linked fields to update.");
// Do nothing.
break;
}
if (autoCommit) {
// If nothing failed up to this point, it is safe to assume there were no problems updating/creating the
// main entity and any of its children, so we commit the transaction.
LOG.info("Committing transaction."); // depends on control dependency: [if], data = [none]
connection.commit(); // depends on control dependency: [if], data = [none]
}
// Add new ID to JSON object.
jsonObject.put("id", newId);
// FIXME: Should this return the entity freshly queried from the database rather than just updating the ID?
return jsonObject.toString();
} catch (Exception e) {
LOG.error("Error {} {} entity", isCreating ? "creating" : "updating", specTable.name);
e.printStackTrace();
throw e;
} finally {
if (autoCommit) {
// Always rollback and close in finally in case of early returns or exceptions.
connection.rollback(); // depends on control dependency: [if], data = [none]
connection.close(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void setPointerAlpha(int alpha) {
if (alpha >= 0 && alpha <= 255) {
mPointerAlpha = alpha;
mPointerHaloPaint.setAlpha(mPointerAlpha);
invalidate();
}
} } | public class class_name {
public void setPointerAlpha(int alpha) {
if (alpha >= 0 && alpha <= 255) {
mPointerAlpha = alpha; // depends on control dependency: [if], data = [none]
mPointerHaloPaint.setAlpha(mPointerAlpha); // depends on control dependency: [if], data = [none]
invalidate(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(UpgradePublishedSchemaRequest upgradePublishedSchemaRequest, ProtocolMarshaller protocolMarshaller) {
if (upgradePublishedSchemaRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(upgradePublishedSchemaRequest.getDevelopmentSchemaArn(), DEVELOPMENTSCHEMAARN_BINDING);
protocolMarshaller.marshall(upgradePublishedSchemaRequest.getPublishedSchemaArn(), PUBLISHEDSCHEMAARN_BINDING);
protocolMarshaller.marshall(upgradePublishedSchemaRequest.getMinorVersion(), MINORVERSION_BINDING);
protocolMarshaller.marshall(upgradePublishedSchemaRequest.getDryRun(), DRYRUN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpgradePublishedSchemaRequest upgradePublishedSchemaRequest, ProtocolMarshaller protocolMarshaller) {
if (upgradePublishedSchemaRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(upgradePublishedSchemaRequest.getDevelopmentSchemaArn(), DEVELOPMENTSCHEMAARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(upgradePublishedSchemaRequest.getPublishedSchemaArn(), PUBLISHEDSCHEMAARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(upgradePublishedSchemaRequest.getMinorVersion(), MINORVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(upgradePublishedSchemaRequest.getDryRun(), DRYRUN_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 {
CodeChunk generateMsgGroupCode(MsgFallbackGroupNode node) {
Preconditions.checkState(placeholderNames.isEmpty(), "This class is not reusable.");
// Non-HTML {msg}s should be extracted into LetContentNodes and handled by jssrc.
Preconditions.checkArgument(node.getHtmlContext() == HtmlContext.HTML_PCDATA,
"AssistantForHtmlMsgs is only for HTML {msg}s.");
// The raw translated text, with placeholder placeholders.
Expression translationVar = super.generateMsgGroupVariable(node);
// If there are no placeholders, we don't need anything special (but we still need to unescape).
if (placeholderNames.isEmpty()) {
Expression unescape = GOOG_STRING_UNESCAPE_ENTITIES.call(translationVar);
return INCREMENTAL_DOM_TEXT.call(unescape);
}
// The translationVar may be non-trivial if escaping directives are applied to it, if so bounce
// it into a fresh variable.
if (!translationVar.isCheap()) {
translationVar =
translationContext
.codeGenerator()
.declarationBuilder()
.setRhs(translationVar)
.build()
.ref();
}
// We assume at this point that the statics array has been populated with something like
// [['hi', '\\x01\foo'], ['ho', '\\x02\foo']]
// Consider this block the body of the for loop
ImmutableList.Builder<Statement> body = ImmutableList.builder();
String itemId = "i" + node.getId();
// Get a handle to the ith item of the static array
Expression item = Expression.id("i" + node.getId());
// The first element contains some text that we call using itext
body.add(
item.bracketAccess(Expression.number(0))
.and(
INCREMENTAL_DOM_TEXT.call(item.bracketAccess(Expression.number(0))),
translationContext.codeGenerator())
.asStatement());
// The second element contains a placeholder string. We then execute a switch statement
// to decide which branch to execute.
SwitchBuilder switchBuilder = Statement.switchValue(item.bracketAccess(Expression.number(1)));
for (Map.Entry<String, MsgPlaceholderNode> ph : placeholderNames.entrySet()) {
Statement value = idomMaster.visitForUseByAssistantsAsCodeChunk(ph.getValue());
MsgPlaceholderNode phNode = ph.getValue();
if (phNode.getParent() instanceof VeLogNode) {
VeLogNode parent = (VeLogNode) phNode.getParent();
if (parent.getChild(0) == phNode) {
GenIncrementalDomCodeVisitor.VeLogStateHolder state = idomMaster.openVeLogNode(parent);
// It is a compiler failure to have a logOnly in a message node.
Preconditions.checkState(state.logOnlyConditional == null);
value = Statement.of(state.enterStatement, value);
}
if (parent.getChild(parent.getChildren().size() - 1) == phNode) {
value = Statement.of(value, idomMaster.exitVeLogNode(parent, null));
}
}
switchBuilder.addCase(Expression.stringLiteral(ph.getKey()), value);
}
body.add(switchBuilder.build());
// End of for loop
Statement loop =
forOf(
itemId,
Expression.id(staticDecl).bracketAccess(translationVar),
Statement.of(body.build()));
return Statement.of(staticsInitializer(node, translationVar), loop);
} } | public class class_name {
CodeChunk generateMsgGroupCode(MsgFallbackGroupNode node) {
Preconditions.checkState(placeholderNames.isEmpty(), "This class is not reusable.");
// Non-HTML {msg}s should be extracted into LetContentNodes and handled by jssrc.
Preconditions.checkArgument(node.getHtmlContext() == HtmlContext.HTML_PCDATA,
"AssistantForHtmlMsgs is only for HTML {msg}s.");
// The raw translated text, with placeholder placeholders.
Expression translationVar = super.generateMsgGroupVariable(node);
// If there are no placeholders, we don't need anything special (but we still need to unescape).
if (placeholderNames.isEmpty()) {
Expression unescape = GOOG_STRING_UNESCAPE_ENTITIES.call(translationVar);
return INCREMENTAL_DOM_TEXT.call(unescape); // depends on control dependency: [if], data = [none]
}
// The translationVar may be non-trivial if escaping directives are applied to it, if so bounce
// it into a fresh variable.
if (!translationVar.isCheap()) {
translationVar =
translationContext
.codeGenerator()
.declarationBuilder()
.setRhs(translationVar)
.build()
.ref(); // depends on control dependency: [if], data = [none]
}
// We assume at this point that the statics array has been populated with something like
// [['hi', '\\x01\foo'], ['ho', '\\x02\foo']]
// Consider this block the body of the for loop
ImmutableList.Builder<Statement> body = ImmutableList.builder();
String itemId = "i" + node.getId();
// Get a handle to the ith item of the static array
Expression item = Expression.id("i" + node.getId());
// The first element contains some text that we call using itext
body.add(
item.bracketAccess(Expression.number(0))
.and(
INCREMENTAL_DOM_TEXT.call(item.bracketAccess(Expression.number(0))),
translationContext.codeGenerator())
.asStatement());
// The second element contains a placeholder string. We then execute a switch statement
// to decide which branch to execute.
SwitchBuilder switchBuilder = Statement.switchValue(item.bracketAccess(Expression.number(1)));
for (Map.Entry<String, MsgPlaceholderNode> ph : placeholderNames.entrySet()) {
Statement value = idomMaster.visitForUseByAssistantsAsCodeChunk(ph.getValue());
MsgPlaceholderNode phNode = ph.getValue();
if (phNode.getParent() instanceof VeLogNode) {
VeLogNode parent = (VeLogNode) phNode.getParent();
if (parent.getChild(0) == phNode) {
GenIncrementalDomCodeVisitor.VeLogStateHolder state = idomMaster.openVeLogNode(parent);
// It is a compiler failure to have a logOnly in a message node.
Preconditions.checkState(state.logOnlyConditional == null); // depends on control dependency: [if], data = [none]
value = Statement.of(state.enterStatement, value); // depends on control dependency: [if], data = [none]
}
if (parent.getChild(parent.getChildren().size() - 1) == phNode) {
value = Statement.of(value, idomMaster.exitVeLogNode(parent, null)); // depends on control dependency: [if], data = [none]
}
}
switchBuilder.addCase(Expression.stringLiteral(ph.getKey()), value); // depends on control dependency: [for], data = [ph]
}
body.add(switchBuilder.build());
// End of for loop
Statement loop =
forOf(
itemId,
Expression.id(staticDecl).bracketAccess(translationVar),
Statement.of(body.build()));
return Statement.of(staticsInitializer(node, translationVar), loop);
} } |
public class class_name {
private static Integer getLayer(Featurable featurable)
{
if (featurable.hasFeature(Layerable.class))
{
final Layerable layerable = featurable.getFeature(Layerable.class);
return layerable.getLayerDisplay();
}
return LAYER_DEFAULT;
} } | public class class_name {
private static Integer getLayer(Featurable featurable)
{
if (featurable.hasFeature(Layerable.class))
{
final Layerable layerable = featurable.getFeature(Layerable.class);
return layerable.getLayerDisplay();
// depends on control dependency: [if], data = [none]
}
return LAYER_DEFAULT;
} } |
public class class_name {
public void setSearchableInfo(SearchableInfo searchableInfo) {
if (searchView != null) {
searchView.setSearchableInfo(searchableInfo);
} else if (supportView != null) {
supportView.setSearchableInfo(searchableInfo);
} else {
throw new IllegalStateException(ERROR_NO_SEARCHVIEW);
}
} } | public class class_name {
public void setSearchableInfo(SearchableInfo searchableInfo) {
if (searchView != null) {
searchView.setSearchableInfo(searchableInfo); // depends on control dependency: [if], data = [none]
} else if (supportView != null) {
supportView.setSearchableInfo(searchableInfo); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException(ERROR_NO_SEARCHVIEW);
}
} } |
public class class_name {
public IsotopePattern getIsotopes(IMolecularFormula molFor) {
if (builder == null) {
try {
isoFactory = Isotopes.getInstance();
builder = molFor.getBuilder();
} catch (Exception e) {
e.printStackTrace();
}
}
String mf = MolecularFormulaManipulator.getString(molFor, true);
IMolecularFormula molecularFormula = MolecularFormulaManipulator.getMajorIsotopeMolecularFormula(mf, builder);
IsotopePattern abundance_Mass = null;
for (IIsotope isos : molecularFormula.isotopes()) {
String elementSymbol = isos.getSymbol();
int atomCount = molecularFormula.getIsotopeCount(isos);
// Generate possible isotope containers for the current atom's
// these will then me 'multiplied' with the existing patten
List<IsotopeContainer> additional = new ArrayList<>();
for (IIsotope isotope : isoFactory.getIsotopes(elementSymbol)) {
double mass = isotope.getExactMass();
double abundance = isotope.getNaturalAbundance();
if (abundance <= 0.000000001)
continue;
IsotopeContainer container = new IsotopeContainer(mass, abundance);
if (storeFormula)
container.setFormula(asFormula(isotope));
additional.add(container);
}
for (int i = 0; i < atomCount; i++)
abundance_Mass = calculateAbundanceAndMass(abundance_Mass, additional);
}
IsotopePattern isoP = IsotopePatternManipulator.sortAndNormalizedByIntensity(abundance_Mass);
isoP = cleanAbundance(isoP, minIntensity);
IsotopePattern isoPattern = IsotopePatternManipulator.sortByMass(isoP);
return isoPattern;
} } | public class class_name {
public IsotopePattern getIsotopes(IMolecularFormula molFor) {
if (builder == null) {
try {
isoFactory = Isotopes.getInstance(); // depends on control dependency: [try], data = [none]
builder = molFor.getBuilder(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
String mf = MolecularFormulaManipulator.getString(molFor, true);
IMolecularFormula molecularFormula = MolecularFormulaManipulator.getMajorIsotopeMolecularFormula(mf, builder);
IsotopePattern abundance_Mass = null;
for (IIsotope isos : molecularFormula.isotopes()) {
String elementSymbol = isos.getSymbol();
int atomCount = molecularFormula.getIsotopeCount(isos);
// Generate possible isotope containers for the current atom's
// these will then me 'multiplied' with the existing patten
List<IsotopeContainer> additional = new ArrayList<>();
for (IIsotope isotope : isoFactory.getIsotopes(elementSymbol)) {
double mass = isotope.getExactMass();
double abundance = isotope.getNaturalAbundance();
if (abundance <= 0.000000001)
continue;
IsotopeContainer container = new IsotopeContainer(mass, abundance);
if (storeFormula)
container.setFormula(asFormula(isotope));
additional.add(container); // depends on control dependency: [for], data = [none]
}
for (int i = 0; i < atomCount; i++)
abundance_Mass = calculateAbundanceAndMass(abundance_Mass, additional);
}
IsotopePattern isoP = IsotopePatternManipulator.sortAndNormalizedByIntensity(abundance_Mass);
isoP = cleanAbundance(isoP, minIntensity);
IsotopePattern isoPattern = IsotopePatternManipulator.sortByMass(isoP);
return isoPattern;
} } |
public class class_name {
@Override
public EEnum getIfcWindowStyleOperationEnum() {
if (ifcWindowStyleOperationEnumEEnum == null) {
ifcWindowStyleOperationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1105);
}
return ifcWindowStyleOperationEnumEEnum;
} } | public class class_name {
@Override
public EEnum getIfcWindowStyleOperationEnum() {
if (ifcWindowStyleOperationEnumEEnum == null) {
ifcWindowStyleOperationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1105);
// depends on control dependency: [if], data = [none]
}
return ifcWindowStyleOperationEnumEEnum;
} } |
public class class_name {
public MonthDay with(Month month) {
Jdk8Methods.requireNonNull(month, "month");
if (month.getValue() == this.month) {
return this;
}
int day = Math.min(this.day, month.maxLength());
return new MonthDay(month.getValue(), day);
} } | public class class_name {
public MonthDay with(Month month) {
Jdk8Methods.requireNonNull(month, "month");
if (month.getValue() == this.month) {
return this; // depends on control dependency: [if], data = [none]
}
int day = Math.min(this.day, month.maxLength());
return new MonthDay(month.getValue(), day);
} } |
public class class_name {
private void workflowCuration(JsonSimple response, JsonSimple message) {
String oid = message.getString(null, "oid");
if (!workflowCompleted(oid)) {
return;
}
// Resolve relationships before we continue
try {
JSONArray relations = mapRelations(oid);
// Unless there was an error, we should be good to go
if (relations != null) {
JsonObject request = createTask(response, oid,
"curation-request");
if (!relations.isEmpty()) {
request.put("relationships", relations);
}
}
} catch (Exception ex) {
log.error("Error processing relations: ", ex);
return;
}
} } | public class class_name {
private void workflowCuration(JsonSimple response, JsonSimple message) {
String oid = message.getString(null, "oid");
if (!workflowCompleted(oid)) {
return; // depends on control dependency: [if], data = [none]
}
// Resolve relationships before we continue
try {
JSONArray relations = mapRelations(oid);
// Unless there was an error, we should be good to go
if (relations != null) {
JsonObject request = createTask(response, oid,
"curation-request");
if (!relations.isEmpty()) {
request.put("relationships", relations); // depends on control dependency: [if], data = [none]
}
}
} catch (Exception ex) {
log.error("Error processing relations: ", ex);
return;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(TeletextDestinationSettings teletextDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (teletextDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(teletextDestinationSettings.getPageNumber(), PAGENUMBER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TeletextDestinationSettings teletextDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (teletextDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(teletextDestinationSettings.getPageNumber(), PAGENUMBER_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 boolean setEditMode(CmsMessageBundleEditorTypes.EditMode mode) {
try {
if ((mode == CmsMessageBundleEditorTypes.EditMode.MASTER) && (null == m_descFile)) {
m_descFile = LockedFile.lockResource(m_cms, m_desc);
}
m_editMode = mode;
} catch (CmsException e) {
return false;
}
return true;
} } | public class class_name {
public boolean setEditMode(CmsMessageBundleEditorTypes.EditMode mode) {
try {
if ((mode == CmsMessageBundleEditorTypes.EditMode.MASTER) && (null == m_descFile)) {
m_descFile = LockedFile.lockResource(m_cms, m_desc); // depends on control dependency: [if], data = [none]
}
m_editMode = mode; // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
@Override
public void stop() {
if(enabled) {
metricPublishing.stop();
}
if(startUpMetric != null) {
startUpMetric.stop();
}
super.stop();
} } | public class class_name {
@Override
public void stop() {
if(enabled) {
metricPublishing.stop(); // depends on control dependency: [if], data = [none]
}
if(startUpMetric != null) {
startUpMetric.stop(); // depends on control dependency: [if], data = [none]
}
super.stop();
} } |
public class class_name {
private void finishStatus(MtasSolrStatus status) {
if (!status.finished()) {
status.setFinished();
if (requestHandler != null) {
try {
requestHandler.finishStatus(status);
} catch (IOException e) {
log.error(e);
}
}
}
} } | public class class_name {
private void finishStatus(MtasSolrStatus status) {
if (!status.finished()) {
status.setFinished(); // depends on control dependency: [if], data = [none]
if (requestHandler != null) {
try {
requestHandler.finishStatus(status); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.error(e);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
private OutputStream getSyslogOutputStream() {
Field f;
try {
f = SyslogAppenderBase.class.getDeclaredField("sos");
f.setAccessible(true);
return (OutputStream) f.get(this);
} catch (ReflectiveOperationException e) {
throw Throwables.propagate(e);
}
} } | public class class_name {
private OutputStream getSyslogOutputStream() {
Field f;
try {
f = SyslogAppenderBase.class.getDeclaredField("sos"); // depends on control dependency: [try], data = [none]
f.setAccessible(true); // depends on control dependency: [try], data = [none]
return (OutputStream) f.get(this); // depends on control dependency: [try], data = [none]
} catch (ReflectiveOperationException e) {
throw Throwables.propagate(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public float[] getPixelValues(byte[] imageBytes) {
TIFFImage tiffImage = TiffReader.readTiff(imageBytes);
FileDirectory directory = tiffImage.getFileDirectory();
validateImageType(directory);
Rasters rasters = directory.readRasters();
float[] pixels = new float[rasters.getWidth() * rasters.getHeight()];
for (int y = 0; y < rasters.getHeight(); y++) {
for (int x = 0; x < rasters.getWidth(); x++) {
int index = rasters.getSampleIndex(x, y);
pixels[index] = rasters.getPixelSample(0, x, y).floatValue();
}
}
return pixels;
} } | public class class_name {
public float[] getPixelValues(byte[] imageBytes) {
TIFFImage tiffImage = TiffReader.readTiff(imageBytes);
FileDirectory directory = tiffImage.getFileDirectory();
validateImageType(directory);
Rasters rasters = directory.readRasters();
float[] pixels = new float[rasters.getWidth() * rasters.getHeight()];
for (int y = 0; y < rasters.getHeight(); y++) {
for (int x = 0; x < rasters.getWidth(); x++) {
int index = rasters.getSampleIndex(x, y);
pixels[index] = rasters.getPixelSample(0, x, y).floatValue(); // depends on control dependency: [for], data = [x]
}
}
return pixels;
} } |
public class class_name {
private static String tagify(Object thisObj, String tag,
String attribute, Object[] args)
{
String str = ScriptRuntime.toString(thisObj);
StringBuilder result = new StringBuilder();
result.append('<');
result.append(tag);
if (attribute != null) {
result.append(' ');
result.append(attribute);
result.append("=\"");
result.append(ScriptRuntime.toString(args, 0));
result.append('"');
}
result.append('>');
result.append(str);
result.append("</");
result.append(tag);
result.append('>');
return result.toString();
} } | public class class_name {
private static String tagify(Object thisObj, String tag,
String attribute, Object[] args)
{
String str = ScriptRuntime.toString(thisObj);
StringBuilder result = new StringBuilder();
result.append('<');
result.append(tag);
if (attribute != null) {
result.append(' '); // depends on control dependency: [if], data = [none]
result.append(attribute); // depends on control dependency: [if], data = [(attribute]
result.append("=\""); // depends on control dependency: [if], data = [none]
result.append(ScriptRuntime.toString(args, 0)); // depends on control dependency: [if], data = [none]
result.append('"'); // depends on control dependency: [if], data = [none]
}
result.append('>');
result.append(str);
result.append("</");
result.append(tag);
result.append('>');
return result.toString();
} } |
public class class_name {
void compareMapTypes(Schema oldSchema,
Schema newSchema,
List<Message> messages,
String name) {
if(oldSchema == null || newSchema == null || oldSchema.getType() != Schema.Type.MAP) {
throw new IllegalArgumentException("Old schema must be MAP type. Name=" + name
+ ". Type=" + oldSchema);
}
if(newSchema.getType() != Schema.Type.MAP) {
messages.add(new Message(Level.ERROR, "Illegal type change from " + oldSchema.getType()
+ " to " + newSchema.getType() + " for field "
+ name));
return;
}
// Compare the array element types
compareTypes(oldSchema.getValueType(),
newSchema.getValueType(),
messages,
name + ".<map element>");
} } | public class class_name {
void compareMapTypes(Schema oldSchema,
Schema newSchema,
List<Message> messages,
String name) {
if(oldSchema == null || newSchema == null || oldSchema.getType() != Schema.Type.MAP) {
throw new IllegalArgumentException("Old schema must be MAP type. Name=" + name
+ ". Type=" + oldSchema);
}
if(newSchema.getType() != Schema.Type.MAP) {
messages.add(new Message(Level.ERROR, "Illegal type change from " + oldSchema.getType()
+ " to " + newSchema.getType() + " for field "
+ name)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Compare the array element types
compareTypes(oldSchema.getValueType(),
newSchema.getValueType(),
messages,
name + ".<map element>");
} } |
public class class_name {
private StringBuffer format(Calendar cal, DisplayContext capitalizationContext,
StringBuffer toAppendTo, FieldPosition pos, List<FieldPosition> attributes) {
// Initialize
pos.setBeginIndex(0);
pos.setEndIndex(0);
// Careful: For best performance, minimize the number of calls
// to StringBuffer.append() by consolidating appends when
// possible.
Object[] items = getPatternItems();
for (int i = 0; i < items.length; i++) {
if (items[i] instanceof String) {
toAppendTo.append((String)items[i]);
} else {
PatternItem item = (PatternItem)items[i];
int start = 0;
if (attributes != null) {
// Save the current length
start = toAppendTo.length();
}
if (useFastFormat) {
subFormat(toAppendTo, item.type, item.length, toAppendTo.length(),
i, capitalizationContext, pos, cal);
} else {
toAppendTo.append(subFormat(item.type, item.length, toAppendTo.length(),
i, capitalizationContext, pos, cal));
}
if (attributes != null) {
// Check the sub format length
int end = toAppendTo.length();
if (end - start > 0) {
// Append the attribute to the list
DateFormat.Field attr = patternCharToDateFormatField(item.type);
FieldPosition fp = new FieldPosition(attr);
fp.setBeginIndex(start);
fp.setEndIndex(end);
attributes.add(fp);
}
}
}
}
return toAppendTo;
} } | public class class_name {
private StringBuffer format(Calendar cal, DisplayContext capitalizationContext,
StringBuffer toAppendTo, FieldPosition pos, List<FieldPosition> attributes) {
// Initialize
pos.setBeginIndex(0);
pos.setEndIndex(0);
// Careful: For best performance, minimize the number of calls
// to StringBuffer.append() by consolidating appends when
// possible.
Object[] items = getPatternItems();
for (int i = 0; i < items.length; i++) {
if (items[i] instanceof String) {
toAppendTo.append((String)items[i]); // depends on control dependency: [if], data = [none]
} else {
PatternItem item = (PatternItem)items[i];
int start = 0;
if (attributes != null) {
// Save the current length
start = toAppendTo.length(); // depends on control dependency: [if], data = [none]
}
if (useFastFormat) {
subFormat(toAppendTo, item.type, item.length, toAppendTo.length(),
i, capitalizationContext, pos, cal); // depends on control dependency: [if], data = [none]
} else {
toAppendTo.append(subFormat(item.type, item.length, toAppendTo.length(),
i, capitalizationContext, pos, cal)); // depends on control dependency: [if], data = [none]
}
if (attributes != null) {
// Check the sub format length
int end = toAppendTo.length();
if (end - start > 0) {
// Append the attribute to the list
DateFormat.Field attr = patternCharToDateFormatField(item.type);
FieldPosition fp = new FieldPosition(attr);
fp.setBeginIndex(start); // depends on control dependency: [if], data = [none]
fp.setEndIndex(end); // depends on control dependency: [if], data = [none]
attributes.add(fp); // depends on control dependency: [if], data = [none]
}
}
}
}
return toAppendTo;
} } |
public class class_name {
@Override
public void handle(String chargingStationId, JsonObject commandObject, IdentityContext identityContext) throws UserIdentityUnauthorizedException {
try {
ChargingStation chargingStation = repository.findOne(chargingStationId);
if (chargingStation != null && chargingStation.communicationAllowed()) {
ChargingStationId csId = new ChargingStationId(chargingStationId);
UserIdentity userIdentity = identityContext.getUserIdentity();
RequestResetChargingStationApiCommand command = gson.fromJson(commandObject, RequestResetChargingStationApiCommand.class);
if("hard".equalsIgnoreCase(command.getType())) {
checkAuthorization(csId, userIdentity, RequestHardResetChargingStationCommand.class);
commandGateway.send(new RequestHardResetChargingStationCommand(csId, identityContext), new CorrelationToken());
} else {
checkAuthorization(csId, userIdentity, RequestSoftResetChargingStationCommand.class);
commandGateway.send(new RequestSoftResetChargingStationCommand(csId, identityContext), new CorrelationToken());
}
}
} catch (JsonSyntaxException ex) {
throw new IllegalArgumentException("Configure command not able to parse the payload, is your json correctly formatted?", ex);
}
} } | public class class_name {
@Override
public void handle(String chargingStationId, JsonObject commandObject, IdentityContext identityContext) throws UserIdentityUnauthorizedException {
try {
ChargingStation chargingStation = repository.findOne(chargingStationId);
if (chargingStation != null && chargingStation.communicationAllowed()) {
ChargingStationId csId = new ChargingStationId(chargingStationId);
UserIdentity userIdentity = identityContext.getUserIdentity();
RequestResetChargingStationApiCommand command = gson.fromJson(commandObject, RequestResetChargingStationApiCommand.class);
if("hard".equalsIgnoreCase(command.getType())) {
checkAuthorization(csId, userIdentity, RequestHardResetChargingStationCommand.class); // depends on control dependency: [if], data = [none]
commandGateway.send(new RequestHardResetChargingStationCommand(csId, identityContext), new CorrelationToken()); // depends on control dependency: [if], data = [none]
} else {
checkAuthorization(csId, userIdentity, RequestSoftResetChargingStationCommand.class); // depends on control dependency: [if], data = [none]
commandGateway.send(new RequestSoftResetChargingStationCommand(csId, identityContext), new CorrelationToken()); // depends on control dependency: [if], data = [none]
}
}
} catch (JsonSyntaxException ex) {
throw new IllegalArgumentException("Configure command not able to parse the payload, is your json correctly formatted?", ex);
}
} } |
public class class_name {
public static boolean sameLiteral(Literal l1,
String l2,
URI type,
String lang) {
if (l1.getLexicalForm().equals(l2) && eq(l1.getLanguage(), lang)) {
if (l1.getDatatypeURI() == null) {
return type == null;
} else {
return type != null
&& type.equals(l1.getDatatypeURI());
}
} else {
return false;
}
} } | public class class_name {
public static boolean sameLiteral(Literal l1,
String l2,
URI type,
String lang) {
if (l1.getLexicalForm().equals(l2) && eq(l1.getLanguage(), lang)) {
if (l1.getDatatypeURI() == null) {
return type == null; // depends on control dependency: [if], data = [none]
} else {
return type != null
&& type.equals(l1.getDatatypeURI()); // depends on control dependency: [if], data = [none]
}
} else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean isJDBC3(Overrider overrider) {
boolean result = false;
if (overrider.hasOverride(MjdbcConstants.OVERRIDE_INT_JDBC3) == true) {
result = (Boolean) overrider.getOverride(MjdbcConstants.OVERRIDE_INT_JDBC3);
}
return result;
} } | public class class_name {
public static boolean isJDBC3(Overrider overrider) {
boolean result = false;
if (overrider.hasOverride(MjdbcConstants.OVERRIDE_INT_JDBC3) == true) {
result = (Boolean) overrider.getOverride(MjdbcConstants.OVERRIDE_INT_JDBC3); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static ByteBuf createDnsQueryPayload(DnsTransaction transaction) {
ByteBuf byteBuf = ByteBufPool.allocate(MAX_SIZE);
byteBuf.writeShort(transaction.getId());
// standard query flags, 1 question and 0 of other stuff
byteBuf.write(STANDARD_QUERY_HEADER);
// query domain name
byte componentSize = 0;
DnsQuery query = transaction.getQuery();
byte[] domainBytes = query.getDomainName().getBytes(US_ASCII);
int pos = -1;
while (++pos < domainBytes.length) {
if (domainBytes[pos] != '.') {
componentSize++;
continue;
}
byteBuf.writeByte(componentSize);
byteBuf.write(domainBytes, pos - componentSize, componentSize);
componentSize = 0;
}
byteBuf.writeByte(componentSize);
byteBuf.write(domainBytes, pos - componentSize, componentSize);
byteBuf.writeByte((byte) 0x0); // terminator byte
// query record type
byteBuf.writeShort(query.getRecordType().getCode());
// query class: IN
byteBuf.writeShort(QueryClass.INTERNET.getCode());
return byteBuf;
} } | public class class_name {
public static ByteBuf createDnsQueryPayload(DnsTransaction transaction) {
ByteBuf byteBuf = ByteBufPool.allocate(MAX_SIZE);
byteBuf.writeShort(transaction.getId());
// standard query flags, 1 question and 0 of other stuff
byteBuf.write(STANDARD_QUERY_HEADER);
// query domain name
byte componentSize = 0;
DnsQuery query = transaction.getQuery();
byte[] domainBytes = query.getDomainName().getBytes(US_ASCII);
int pos = -1;
while (++pos < domainBytes.length) {
if (domainBytes[pos] != '.') {
componentSize++; // depends on control dependency: [if], data = [none]
continue;
}
byteBuf.writeByte(componentSize); // depends on control dependency: [while], data = [none]
byteBuf.write(domainBytes, pos - componentSize, componentSize); // depends on control dependency: [while], data = [none]
componentSize = 0; // depends on control dependency: [while], data = [none]
}
byteBuf.writeByte(componentSize);
byteBuf.write(domainBytes, pos - componentSize, componentSize);
byteBuf.writeByte((byte) 0x0); // terminator byte
// query record type
byteBuf.writeShort(query.getRecordType().getCode());
// query class: IN
byteBuf.writeShort(QueryClass.INTERNET.getCode());
return byteBuf;
} } |
public class class_name {
@Override
public T getValue(int pollerIndex) {
try {
return function.call();
} catch (Exception e) {
throw Throwables.propagate(e);
}
} } | public class class_name {
@Override
public T getValue(int pollerIndex) {
try {
return function.call(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw Throwables.propagate(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void close(boolean cleanCache) {
if (!this.closed) {
this.closed = true;
// Close storage reader (and thus cancel those reads).
this.storageReadManager.close();
// Cancel registered future reads and any reads pertaining to incomplete mergers.
ArrayList<Iterator<FutureReadResultEntry>> futureReads = new ArrayList<>();
futureReads.add(this.futureReads.close().iterator());
synchronized (this.lock) {
this.pendingMergers.values().forEach(pm -> futureReads.add(pm.seal().iterator()));
}
cancelFutureReads(Iterators.concat(futureReads.iterator()));
if (cleanCache) {
this.executor.execute(() -> {
removeAllEntries();
log.info("{}: Closed.", this.traceObjectId);
});
} else {
log.info("{}: Closed (no cache cleanup).", this.traceObjectId);
}
}
} } | public class class_name {
void close(boolean cleanCache) {
if (!this.closed) {
this.closed = true; // depends on control dependency: [if], data = [none]
// Close storage reader (and thus cancel those reads).
this.storageReadManager.close(); // depends on control dependency: [if], data = [none]
// Cancel registered future reads and any reads pertaining to incomplete mergers.
ArrayList<Iterator<FutureReadResultEntry>> futureReads = new ArrayList<>();
futureReads.add(this.futureReads.close().iterator()); // depends on control dependency: [if], data = [none]
synchronized (this.lock) { // depends on control dependency: [if], data = [none]
this.pendingMergers.values().forEach(pm -> futureReads.add(pm.seal().iterator()));
}
cancelFutureReads(Iterators.concat(futureReads.iterator())); // depends on control dependency: [if], data = [none]
if (cleanCache) {
this.executor.execute(() -> {
removeAllEntries(); // depends on control dependency: [if], data = [none]
log.info("{}: Closed.", this.traceObjectId); // depends on control dependency: [if], data = [none]
});
} else {
log.info("{}: Closed (no cache cleanup).", this.traceObjectId); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private ClassData fetchBytecodeFromRemote(String className) {
ClusterService cluster = nodeEngine.getClusterService();
ClassData classData;
boolean interrupted = false;
for (Member member : cluster.getMembers()) {
if (isCandidateMember(member)) {
continue;
}
try {
classData = tryToFetchClassDataFromMember(className, member);
if (classData != null) {
if (logger.isFineEnabled()) {
logger.finest("Loaded class " + className + " from " + member);
}
return classData;
}
} catch (InterruptedException e) {
// question: should we give-up on loading at this point and simply throw ClassNotFoundException?
interrupted = true;
} catch (Exception e) {
if (logger.isFinestEnabled()) {
logger.finest("Unable to get class data for class " + className
+ " from member " + member, e);
}
}
}
if (interrupted) {
Thread.currentThread().interrupt();
}
return null;
} } | public class class_name {
private ClassData fetchBytecodeFromRemote(String className) {
ClusterService cluster = nodeEngine.getClusterService();
ClassData classData;
boolean interrupted = false;
for (Member member : cluster.getMembers()) {
if (isCandidateMember(member)) {
continue;
}
try {
classData = tryToFetchClassDataFromMember(className, member); // depends on control dependency: [try], data = [none]
if (classData != null) {
if (logger.isFineEnabled()) {
logger.finest("Loaded class " + className + " from " + member); // depends on control dependency: [if], data = [none]
}
return classData; // depends on control dependency: [if], data = [none]
}
} catch (InterruptedException e) {
// question: should we give-up on loading at this point and simply throw ClassNotFoundException?
interrupted = true;
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
if (logger.isFinestEnabled()) {
logger.finest("Unable to get class data for class " + className
+ " from member " + member, e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
if (interrupted) {
Thread.currentThread().interrupt(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public long add(long instant, long months) {
int i_months = (int)months;
if (i_months == months) {
return add(instant, i_months);
}
// Copied from add(long, int) and modified slightly:
long timePart = iChronology.getMillisOfDay(instant);
int thisYear = iChronology.getYear(instant);
int thisMonth = iChronology.getMonthOfYear(instant, thisYear);
long yearToUse;
long monthToUse = thisMonth - 1 + months;
if (monthToUse >= 0) {
yearToUse = thisYear + (monthToUse / iMax);
monthToUse = (monthToUse % iMax) + 1;
} else {
yearToUse = thisYear + (monthToUse / iMax) - 1;
monthToUse = Math.abs(monthToUse);
int remMonthToUse = (int)(monthToUse % iMax);
if (remMonthToUse == 0) {
remMonthToUse = iMax;
}
monthToUse = iMax - remMonthToUse + 1;
if (monthToUse == 1) {
yearToUse += 1;
}
}
if (yearToUse < iChronology.getMinYear() ||
yearToUse > iChronology.getMaxYear()) {
throw new IllegalArgumentException
("Magnitude of add amount is too large: " + months);
}
int i_yearToUse = (int)yearToUse;
int i_monthToUse = (int)monthToUse;
int dayToUse = iChronology.getDayOfMonth(instant, thisYear, thisMonth);
int maxDay = iChronology.getDaysInYearMonth(i_yearToUse, i_monthToUse);
if (dayToUse > maxDay) {
dayToUse = maxDay;
}
long datePart =
iChronology.getYearMonthDayMillis(i_yearToUse, i_monthToUse, dayToUse);
return datePart + timePart;
} } | public class class_name {
public long add(long instant, long months) {
int i_months = (int)months;
if (i_months == months) {
return add(instant, i_months); // depends on control dependency: [if], data = [months)]
}
// Copied from add(long, int) and modified slightly:
long timePart = iChronology.getMillisOfDay(instant);
int thisYear = iChronology.getYear(instant);
int thisMonth = iChronology.getMonthOfYear(instant, thisYear);
long yearToUse;
long monthToUse = thisMonth - 1 + months;
if (monthToUse >= 0) {
yearToUse = thisYear + (monthToUse / iMax); // depends on control dependency: [if], data = [(monthToUse]
monthToUse = (monthToUse % iMax) + 1; // depends on control dependency: [if], data = [(monthToUse]
} else {
yearToUse = thisYear + (monthToUse / iMax) - 1; // depends on control dependency: [if], data = [(monthToUse]
monthToUse = Math.abs(monthToUse); // depends on control dependency: [if], data = [(monthToUse]
int remMonthToUse = (int)(monthToUse % iMax);
if (remMonthToUse == 0) {
remMonthToUse = iMax; // depends on control dependency: [if], data = [none]
}
monthToUse = iMax - remMonthToUse + 1; // depends on control dependency: [if], data = [none]
if (monthToUse == 1) {
yearToUse += 1; // depends on control dependency: [if], data = [none]
}
}
if (yearToUse < iChronology.getMinYear() ||
yearToUse > iChronology.getMaxYear()) {
throw new IllegalArgumentException
("Magnitude of add amount is too large: " + months);
}
int i_yearToUse = (int)yearToUse;
int i_monthToUse = (int)monthToUse;
int dayToUse = iChronology.getDayOfMonth(instant, thisYear, thisMonth);
int maxDay = iChronology.getDaysInYearMonth(i_yearToUse, i_monthToUse);
if (dayToUse > maxDay) {
dayToUse = maxDay; // depends on control dependency: [if], data = [none]
}
long datePart =
iChronology.getYearMonthDayMillis(i_yearToUse, i_monthToUse, dayToUse);
return datePart + timePart;
} } |
public class class_name {
private void defineMenus(UIDefaults d) {
d.put("menuItemBackgroundBase", new Color(0x5b7ea4));
// Initialize Menu
String c = PAINTER_PREFIX + "MenuPainter";
String p = "Menu";
d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 5));
d.put(p + "[Disabled].textForeground", d.get("seaGlassDisabledText"));
d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[Enabled+Selected].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[Enabled+Selected].backgroundPainter", new LazyPainter(c, MenuPainter.Which.BACKGROUND_ENABLED_SELECTED));
d.put(p + "[Disabled].arrowIconPainter", new LazyPainter(c, MenuPainter.Which.ARROWICON_DISABLED));
d.put(p + "[Enabled].arrowIconPainter", new LazyPainter(c, MenuPainter.Which.ARROWICON_ENABLED));
d.put(p + "[Enabled+Selected].arrowIconPainter", new LazyPainter(c, MenuPainter.Which.ARROWICON_ENABLED_SELECTED));
d.put(p + ".arrowIcon", new SeaGlassIcon(p + "", "arrowIconPainter", 9, 10));
d.put(p + ".checkIcon", new SeaGlassIcon(p + "", "checkIconPainter", 6, 10));
p = "Menu:MenuItemAccelerator";
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
// We don't paint MenuBar backgrounds. Remove the painters.
c = PAINTER_PREFIX + "MenuBarPainter";
p = "MenuBar";
d.put(p + ".contentMargins", new InsetsUIResource(2, 6, 2, 6));
if (d.get(p + "[Enabled].backgroundPainter") != null) {
d.remove(p + "[Enabled].backgroundPainter");
}
if (d.get(p + "[Enabled].borderPainter") != null) {
d.remove(p + "[Enabled].borderPainter");
}
// Rossi: "Selected Menu" color changed to dark blue. Not tested with "unified" title/menu/toolbar
c = PAINTER_PREFIX + "MenuItemPainter";
p = "MenuBar:Menu";
d.put(p + ".States", "Enabled,Selected,Disabled,NotUnified");
d.put(p + ".NotUnified", new MenuNotUnified());
d.put(p + ".contentMargins", new InsetsUIResource(1, 4, 2, 4));
d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[Selected].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[Selected].backgroundPainter", new LazyPainter(c, MenuItemPainter.Which.BACKGROUND_MOUSEOVER_UNIFIED));
d.put(p + "[Enabled+NotUnified].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[Enabled+Selected+NotUnified].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[Enabled+Selected+NotUnified].backgroundPainter", new LazyPainter(c, MenuItemPainter.Which.BACKGROUND_MOUSEOVER));
p = "MenuBar:Menu:MenuItemAccelerator";
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
// Initialize MenuItem
c = PAINTER_PREFIX + "MenuItemPainter";
p = "MenuItem";
d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 13));
d.put(p + ".textIconGap", new Integer(5));
d.put(p + ".acceleratorFont", new DerivedFont("defaultFont", 1.0f, null, null));
d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, MenuItemPainter.Which.BACKGROUND_MOUSEOVER));
p = "MenuItem:MenuItemAccelerator";
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
// Initialize CheckBoxMenuItem
c = PAINTER_PREFIX + "CheckBoxMenuItemPainter";
p = "CheckBoxMenuItem";
d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 13));
d.put(p + ".textIconGap", new Integer(5));
d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, CheckBoxMenuItemPainter.Which.BACKGROUND_MOUSEOVER));
d.put(p + "[MouseOver+Selected].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[MouseOver+Selected].backgroundPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.BACKGROUND_SELECTED_MOUSEOVER));
d.put(p + "[Disabled+Selected].checkIconPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_DISABLED_SELECTED));
d.put(p + "[Enabled+Selected].checkIconPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_ENABLED_SELECTED));
// Rossi: Added painter that shows an "indicator" that menu item is a "selectable checkbox"
d.put(p + "[Enabled].checkIconPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_ENABLED));
d.put(p + "[MouseOver].checkIconPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_ENABLED_MOUSEOVER));
d.put(p + "[MouseOver+Selected].checkIconPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_SELECTED_MOUSEOVER));
d.put(p + ".checkIcon", new SeaGlassIcon(p, "checkIconPainter", 9, 10));
p = "CheckBoxMenuItem:MenuItemAccelerator";
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
// Initialize RadioButtonMenuItem
c = PAINTER_PREFIX + "RadioButtonMenuItemPainter";
p = "RadioButtonMenuItem";
d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 13));
d.put(p + ".textIconGap", new Integer(5));
d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, RadioButtonMenuItemPainter.Which.BACKGROUND_MOUSEOVER));
d.put(p + "[MouseOver+Selected].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[MouseOver+Selected].backgroundPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.BACKGROUND_SELECTED_MOUSEOVER));
d.put(p + "[Disabled+Selected].checkIconPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_DISABLED_SELECTED));
d.put(p + "[Enabled+Selected].checkIconPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_ENABLED_SELECTED));
// Rossi: Added painter that shows an "indicator" that menu item is a "selectable radio button"
d.put(p + "[Enabled].checkIconPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_ENABLED));
d.put(p + "[MouseOver].checkIconPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_ENABLED_MOUSEOVER));
d.put(p + "[MouseOver+Selected].checkIconPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_SELECTED_MOUSEOVER));
d.put(p + ".checkIcon", new SeaGlassIcon(p, "checkIconPainter", 9, 10));
p = "RadioButtonMenuItem:MenuItemAccelerator";
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
} } | public class class_name {
private void defineMenus(UIDefaults d) {
d.put("menuItemBackgroundBase", new Color(0x5b7ea4));
// Initialize Menu
String c = PAINTER_PREFIX + "MenuPainter";
String p = "Menu";
d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 5));
d.put(p + "[Disabled].textForeground", d.get("seaGlassDisabledText"));
d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[Enabled+Selected].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[Enabled+Selected].backgroundPainter", new LazyPainter(c, MenuPainter.Which.BACKGROUND_ENABLED_SELECTED));
d.put(p + "[Disabled].arrowIconPainter", new LazyPainter(c, MenuPainter.Which.ARROWICON_DISABLED));
d.put(p + "[Enabled].arrowIconPainter", new LazyPainter(c, MenuPainter.Which.ARROWICON_ENABLED));
d.put(p + "[Enabled+Selected].arrowIconPainter", new LazyPainter(c, MenuPainter.Which.ARROWICON_ENABLED_SELECTED));
d.put(p + ".arrowIcon", new SeaGlassIcon(p + "", "arrowIconPainter", 9, 10));
d.put(p + ".checkIcon", new SeaGlassIcon(p + "", "checkIconPainter", 6, 10));
p = "Menu:MenuItemAccelerator";
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
// We don't paint MenuBar backgrounds. Remove the painters.
c = PAINTER_PREFIX + "MenuBarPainter";
p = "MenuBar";
d.put(p + ".contentMargins", new InsetsUIResource(2, 6, 2, 6));
if (d.get(p + "[Enabled].backgroundPainter") != null) {
d.remove(p + "[Enabled].backgroundPainter"); // depends on control dependency: [if], data = [none]
}
if (d.get(p + "[Enabled].borderPainter") != null) {
d.remove(p + "[Enabled].borderPainter"); // depends on control dependency: [if], data = [none]
}
// Rossi: "Selected Menu" color changed to dark blue. Not tested with "unified" title/menu/toolbar
c = PAINTER_PREFIX + "MenuItemPainter";
p = "MenuBar:Menu";
d.put(p + ".States", "Enabled,Selected,Disabled,NotUnified");
d.put(p + ".NotUnified", new MenuNotUnified());
d.put(p + ".contentMargins", new InsetsUIResource(1, 4, 2, 4));
d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[Selected].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[Selected].backgroundPainter", new LazyPainter(c, MenuItemPainter.Which.BACKGROUND_MOUSEOVER_UNIFIED));
d.put(p + "[Enabled+NotUnified].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[Enabled+Selected+NotUnified].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[Enabled+Selected+NotUnified].backgroundPainter", new LazyPainter(c, MenuItemPainter.Which.BACKGROUND_MOUSEOVER));
p = "MenuBar:Menu:MenuItemAccelerator";
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
// Initialize MenuItem
c = PAINTER_PREFIX + "MenuItemPainter";
p = "MenuItem";
d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 13));
d.put(p + ".textIconGap", new Integer(5));
d.put(p + ".acceleratorFont", new DerivedFont("defaultFont", 1.0f, null, null));
d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, MenuItemPainter.Which.BACKGROUND_MOUSEOVER));
p = "MenuItem:MenuItemAccelerator";
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
// Initialize CheckBoxMenuItem
c = PAINTER_PREFIX + "CheckBoxMenuItemPainter";
p = "CheckBoxMenuItem";
d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 13));
d.put(p + ".textIconGap", new Integer(5));
d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, CheckBoxMenuItemPainter.Which.BACKGROUND_MOUSEOVER));
d.put(p + "[MouseOver+Selected].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[MouseOver+Selected].backgroundPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.BACKGROUND_SELECTED_MOUSEOVER));
d.put(p + "[Disabled+Selected].checkIconPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_DISABLED_SELECTED));
d.put(p + "[Enabled+Selected].checkIconPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_ENABLED_SELECTED));
// Rossi: Added painter that shows an "indicator" that menu item is a "selectable checkbox"
d.put(p + "[Enabled].checkIconPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_ENABLED));
d.put(p + "[MouseOver].checkIconPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_ENABLED_MOUSEOVER));
d.put(p + "[MouseOver+Selected].checkIconPainter",
new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_SELECTED_MOUSEOVER));
d.put(p + ".checkIcon", new SeaGlassIcon(p, "checkIconPainter", 9, 10));
p = "CheckBoxMenuItem:MenuItemAccelerator";
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
// Initialize RadioButtonMenuItem
c = PAINTER_PREFIX + "RadioButtonMenuItemPainter";
p = "RadioButtonMenuItem";
d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 13));
d.put(p + ".textIconGap", new Integer(5));
d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, RadioButtonMenuItemPainter.Which.BACKGROUND_MOUSEOVER));
d.put(p + "[MouseOver+Selected].textForeground", new ColorUIResource(Color.WHITE));
d.put(p + "[MouseOver+Selected].backgroundPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.BACKGROUND_SELECTED_MOUSEOVER));
d.put(p + "[Disabled+Selected].checkIconPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_DISABLED_SELECTED));
d.put(p + "[Enabled+Selected].checkIconPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_ENABLED_SELECTED));
// Rossi: Added painter that shows an "indicator" that menu item is a "selectable radio button"
d.put(p + "[Enabled].checkIconPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_ENABLED));
d.put(p + "[MouseOver].checkIconPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_ENABLED_MOUSEOVER));
d.put(p + "[MouseOver+Selected].checkIconPainter",
new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_SELECTED_MOUSEOVER));
d.put(p + ".checkIcon", new SeaGlassIcon(p, "checkIconPainter", 9, 10));
p = "RadioButtonMenuItem:MenuItemAccelerator";
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
} } |
public class class_name {
public Object processInvocation(final InterceptorContext context) throws Exception {
final ClassLoader old;
Thread thread = Thread.currentThread();
if (System.getSecurityManager() == null) {
old = thread.getContextClassLoader();
thread.setContextClassLoader(classLoader);
} else {
old = AccessController.doPrivileged(new SetContextClassLoader(classLoader));
}
try {
return context.proceed();
} finally {
if (System.getSecurityManager() == null) {
thread.setContextClassLoader(old);
} else {
AccessController.doPrivileged(new SetContextClassLoader(old));
}
}
} } | public class class_name {
public Object processInvocation(final InterceptorContext context) throws Exception {
final ClassLoader old;
Thread thread = Thread.currentThread();
if (System.getSecurityManager() == null) {
old = thread.getContextClassLoader();
thread.setContextClassLoader(classLoader);
} else {
old = AccessController.doPrivileged(new SetContextClassLoader(classLoader));
}
try {
return context.proceed();
} finally {
if (System.getSecurityManager() == null) {
thread.setContextClassLoader(old); // depends on control dependency: [if], data = [none]
} else {
AccessController.doPrivileged(new SetContextClassLoader(old)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void setMentionSpanFactory(@NonNull final MentionsEditText.MentionSpanFactory factory) {
if (mMentionsEditText != null) {
mMentionsEditText.setMentionSpanFactory(factory);
}
} } | public class class_name {
public void setMentionSpanFactory(@NonNull final MentionsEditText.MentionSpanFactory factory) {
if (mMentionsEditText != null) {
mMentionsEditText.setMentionSpanFactory(factory); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static StringBuilder dataDict(Dao dao, String... packages) {
StringBuilder sb = new StringBuilder();
List<Class<?>> ks = new ArrayList<Class<?>>();
for (String packageName : packages) {
ks.addAll(Scans.me().scanPackage(packageName));
}
Iterator<Class<?>> it = ks.iterator();
while (it.hasNext()) {
Class<?> klass = it.next();
if (Mirror.me(klass).getAnnotation(Table.class) == null)
it.remove();
}
// log.infof("Found %d table class", ks.size());
JdbcExpert exp = dao.getJdbcExpert();
Entity<?> entity = null;
String line = "-------------------------------------------------------------------\n";
sb.append("#title:数据字典\n");
sb.append("#author:wendal\n");
sb.append("#index:0,1\n").append(line);
for (Class<?> klass : ks) {
sb.append(line);
entity = dao.getEntity(klass);
sb.append("表名 ").append(entity.getTableName()).append("\n\n");
if (!Strings.isBlank(entity.getTableComment()))
sb.append("表注释: ").append(entity.getTableComment());
sb.append("\t").append("Java类名 ").append(klass.getName()).append("\n\n");
sb.append("\t||序号||列名||数据类型||主键||非空||默认值||java属性名||java类型||注释||\n");
int index = 1;
for (MappingField field : entity.getMappingFields()) {
String dataType = exp.evalFieldType(field);
sb.append("\t||")
.append(index++)
.append("||")
.append(field.getColumnName())
.append("||")
.append(dataType)
.append("||")
.append(field.isPk())
.append("||")
.append(field.isNotNull())
.append("||")
.append(field.getDefaultValue(null) == null ? " " : field.getDefaultValue(null))
.append("||")
.append(field.getName())
.append("||")
.append(field.getTypeClass().getName())
.append("||")
.append(field.getColumnComment() == null ? " " : field.getColumnComment())
.append("||\n");
}
}
return sb;
} } | public class class_name {
public static StringBuilder dataDict(Dao dao, String... packages) {
StringBuilder sb = new StringBuilder();
List<Class<?>> ks = new ArrayList<Class<?>>();
for (String packageName : packages) {
ks.addAll(Scans.me().scanPackage(packageName)); // depends on control dependency: [for], data = [packageName]
}
Iterator<Class<?>> it = ks.iterator();
while (it.hasNext()) {
Class<?> klass = it.next();
if (Mirror.me(klass).getAnnotation(Table.class) == null)
it.remove();
}
// log.infof("Found %d table class", ks.size());
JdbcExpert exp = dao.getJdbcExpert();
Entity<?> entity = null;
String line = "-------------------------------------------------------------------\n";
sb.append("#title:数据字典\n");
sb.append("#author:wendal\n");
sb.append("#index:0,1\n").append(line);
for (Class<?> klass : ks) {
sb.append(line); // depends on control dependency: [for], data = [none]
entity = dao.getEntity(klass); // depends on control dependency: [for], data = [klass]
sb.append("表名 ").append(entity.getTableName()).append("\n\n"); // depends on control dependency: [for], data = [none]
if (!Strings.isBlank(entity.getTableComment()))
sb.append("表注释: ").append(entity.getTableComment());
sb.append("\t").append("Java类名 ").append(klass.getName()).append("\n\n"); // depends on control dependency: [for], data = [klass]
sb.append("\t||序号||列名||数据类型||主键||非空||默认值||java属性名||java类型||注释||\n"); // depends on control dependency: [for], data = [none]
int index = 1;
for (MappingField field : entity.getMappingFields()) {
String dataType = exp.evalFieldType(field);
sb.append("\t||")
.append(index++)
.append("||")
.append(field.getColumnName())
.append("||")
.append(dataType)
.append("||")
.append(field.isPk())
.append("||")
.append(field.isNotNull())
.append("||")
.append(field.getDefaultValue(null) == null ? " " : field.getDefaultValue(null))
.append("||")
.append(field.getName())
.append("||")
.append(field.getTypeClass().getName())
.append("||")
.append(field.getColumnComment() == null ? " " : field.getColumnComment())
.append("||\n"); // depends on control dependency: [for], data = [none]
}
}
return sb;
} } |
public class class_name {
public boolean lock(KeyColumn kc, T requestor, Instant expires) {
assert null != kc;
assert null != requestor;
final StackTraceElement[] acquiredAt = log.isTraceEnabled() ?
new Throwable("Lock acquisition by " + requestor).getStackTrace() : null;
AuditRecord<T> audit = new AuditRecord<T>(requestor, expires, acquiredAt);
AuditRecord<T> inmap = locks.putIfAbsent(kc, audit);
boolean success = false;
if (null == inmap) {
// Uncontended lock succeeded
if (log.isTraceEnabled()) {
log.trace("New local lock created: {} namespace={} txn={}",
new Object[]{kc, name, requestor});
}
success = true;
} else if (inmap.equals(audit)) {
// requestor has already locked kc; update expiresAt
success = locks.replace(kc, inmap, audit);
if (log.isTraceEnabled()) {
if (success) {
log.trace(
"Updated local lock expiration: {} namespace={} txn={} oldexp={} newexp={}",
new Object[]{kc, name, requestor, inmap.expires,
audit.expires});
} else {
log.trace(
"Failed to update local lock expiration: {} namespace={} txn={} oldexp={} newexp={}",
new Object[]{kc, name, requestor, inmap.expires,
audit.expires});
}
}
} else if (0 > inmap.expires.compareTo(times.getTime())) {
// the recorded lock has expired; replace it
success = locks.replace(kc, inmap, audit);
if (log.isTraceEnabled()) {
log.trace(
"Discarding expired lock: {} namespace={} txn={} expired={}",
new Object[]{kc, name, inmap.holder, inmap.expires});
}
} else {
// we lost to a valid lock
if (log.isTraceEnabled()) {
log.trace(
"Local lock failed: {} namespace={} txn={} (already owned by {})",
new Object[]{kc, name, requestor, inmap});
log.trace("Owner stacktrace:\n {}", Joiner.on("\n ").join(inmap.acquiredAt));
}
}
return success;
} } | public class class_name {
public boolean lock(KeyColumn kc, T requestor, Instant expires) {
assert null != kc;
assert null != requestor;
final StackTraceElement[] acquiredAt = log.isTraceEnabled() ?
new Throwable("Lock acquisition by " + requestor).getStackTrace() : null;
AuditRecord<T> audit = new AuditRecord<T>(requestor, expires, acquiredAt);
AuditRecord<T> inmap = locks.putIfAbsent(kc, audit);
boolean success = false;
if (null == inmap) {
// Uncontended lock succeeded
if (log.isTraceEnabled()) {
log.trace("New local lock created: {} namespace={} txn={}",
new Object[]{kc, name, requestor}); // depends on control dependency: [if], data = [none]
}
success = true; // depends on control dependency: [if], data = [none]
} else if (inmap.equals(audit)) {
// requestor has already locked kc; update expiresAt
success = locks.replace(kc, inmap, audit); // depends on control dependency: [if], data = [none]
if (log.isTraceEnabled()) {
if (success) {
log.trace(
"Updated local lock expiration: {} namespace={} txn={} oldexp={} newexp={}",
new Object[]{kc, name, requestor, inmap.expires,
audit.expires}); // depends on control dependency: [if], data = [none]
} else {
log.trace(
"Failed to update local lock expiration: {} namespace={} txn={} oldexp={} newexp={}",
new Object[]{kc, name, requestor, inmap.expires,
audit.expires}); // depends on control dependency: [if], data = [none]
}
}
} else if (0 > inmap.expires.compareTo(times.getTime())) {
// the recorded lock has expired; replace it
success = locks.replace(kc, inmap, audit); // depends on control dependency: [if], data = [none]
if (log.isTraceEnabled()) {
log.trace(
"Discarding expired lock: {} namespace={} txn={} expired={}",
new Object[]{kc, name, inmap.holder, inmap.expires}); // depends on control dependency: [if], data = [none]
}
} else {
// we lost to a valid lock
if (log.isTraceEnabled()) {
log.trace(
"Local lock failed: {} namespace={} txn={} (already owned by {})",
new Object[]{kc, name, requestor, inmap}); // depends on control dependency: [if], data = [none]
log.trace("Owner stacktrace:\n {}", Joiner.on("\n ").join(inmap.acquiredAt)); // depends on control dependency: [if], data = [none]
}
}
return success;
} } |
public class class_name {
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (!skip) {
boolean ansiRestore = Ansi.isEnabled();
log = new AnsiLogger(getLog(), useColorForLogging(), verbose, !settings.getInteractiveMode(), getLogPrefix());
try {
authConfigFactory.setLog(log);
imageConfigResolver.setLog(log);
LogOutputSpecFactory logSpecFactory = new LogOutputSpecFactory(useColor, logStdout, logDate);
ConfigHelper.validateExternalPropertyActivation(project, images);
DockerAccess access = null;
try {
// The 'real' images configuration to use (configured images + externally resolved images)
this.minimalApiVersion = initImageConfiguration(getBuildTimestamp());
if (isDockerAccessRequired()) {
DockerAccessFactory.DockerAccessContext dockerAccessContext = getDockerAccessContext();
access = dockerAccessFactory.createDockerAccess(dockerAccessContext);
}
ServiceHub serviceHub = serviceHubFactory.createServiceHub(project, session, access, log, logSpecFactory);
executeInternal(serviceHub);
} catch (IOException | ExecException exp) {
logException(exp);
throw new MojoExecutionException(log.errorMessage(exp.getMessage()), exp);
} catch (MojoExecutionException exp) {
logException(exp);
throw exp;
} finally {
if (access != null) {
access.shutdown();
}
}
} finally {
Ansi.setEnabled(ansiRestore);
}
}
} } | public class class_name {
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (!skip) {
boolean ansiRestore = Ansi.isEnabled();
log = new AnsiLogger(getLog(), useColorForLogging(), verbose, !settings.getInteractiveMode(), getLogPrefix());
try {
authConfigFactory.setLog(log);
imageConfigResolver.setLog(log);
LogOutputSpecFactory logSpecFactory = new LogOutputSpecFactory(useColor, logStdout, logDate);
ConfigHelper.validateExternalPropertyActivation(project, images);
DockerAccess access = null;
try {
// The 'real' images configuration to use (configured images + externally resolved images)
this.minimalApiVersion = initImageConfiguration(getBuildTimestamp()); // depends on control dependency: [try], data = [none]
if (isDockerAccessRequired()) {
DockerAccessFactory.DockerAccessContext dockerAccessContext = getDockerAccessContext();
access = dockerAccessFactory.createDockerAccess(dockerAccessContext); // depends on control dependency: [if], data = [none]
}
ServiceHub serviceHub = serviceHubFactory.createServiceHub(project, session, access, log, logSpecFactory);
executeInternal(serviceHub); // depends on control dependency: [try], data = [none]
} catch (IOException | ExecException exp) {
logException(exp);
throw new MojoExecutionException(log.errorMessage(exp.getMessage()), exp);
} catch (MojoExecutionException exp) { // depends on control dependency: [catch], data = [none]
logException(exp);
throw exp;
} finally { // depends on control dependency: [catch], data = [none]
if (access != null) {
access.shutdown(); // depends on control dependency: [if], data = [none]
}
}
} finally {
Ansi.setEnabled(ansiRestore);
}
}
} } |
public class class_name {
public CompressionCodec getCodecByClassName(String classname) {
if (codecsByClassName == null) {
return null;
}
return codecsByClassName.get(classname);
} } | public class class_name {
public CompressionCodec getCodecByClassName(String classname) {
if (codecsByClassName == null) {
return null; // depends on control dependency: [if], data = [none]
}
return codecsByClassName.get(classname);
} } |
public class class_name {
public synchronized void close() {
for (PreparedStatement ps : threadedPsMap.get().values()) {
if (null != ps) {
try {
ps.close();
} catch (SQLException e) {
// swallowed
}
}
}
try {
if (null != connection) {
this.connection.close();
}
} catch (SQLException e) {
// swallowed
}
} } | public class class_name {
public synchronized void close() {
for (PreparedStatement ps : threadedPsMap.get().values()) {
if (null != ps) {
try {
ps.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
// swallowed
} // depends on control dependency: [catch], data = [none]
}
}
try {
if (null != connection) {
this.connection.close(); // depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
// swallowed
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static AVIMConversationsQuery or(List<AVIMConversationsQuery> queries) {
if (null == queries || 0 == queries.size()) {
throw new IllegalArgumentException("Queries cannot be empty");
}
AVIMClient client = queries.get(0).client;
AVIMConversationsQuery result = new AVIMConversationsQuery(client);
for (AVIMConversationsQuery query : queries) {
if (!client.getClientId().equals(query.client.getClientId())) {
throw new IllegalArgumentException("All queries must be for the same client");
}
result.conditions.addOrItems(new QueryOperation("$or", "$or", query.conditions
.compileWhereOperationMap()));
}
return result;
} } | public class class_name {
public static AVIMConversationsQuery or(List<AVIMConversationsQuery> queries) {
if (null == queries || 0 == queries.size()) {
throw new IllegalArgumentException("Queries cannot be empty");
}
AVIMClient client = queries.get(0).client;
AVIMConversationsQuery result = new AVIMConversationsQuery(client);
for (AVIMConversationsQuery query : queries) {
if (!client.getClientId().equals(query.client.getClientId())) {
throw new IllegalArgumentException("All queries must be for the same client");
}
result.conditions.addOrItems(new QueryOperation("$or", "$or", query.conditions
.compileWhereOperationMap())); // depends on control dependency: [for], data = [none]
}
return result;
} } |
public class class_name {
@Override
public int compareTo(Edge other) {
int cmp = super.compareTo(other);
if (cmp != 0) {
return cmp;
}
return type - other.type;
} } | public class class_name {
@Override
public int compareTo(Edge other) {
int cmp = super.compareTo(other);
if (cmp != 0) {
return cmp; // depends on control dependency: [if], data = [none]
}
return type - other.type;
} } |
public class class_name {
public final CheckedMemorySegment putChar(int index, char value) {
if (index >= 0 && index < this.size - 1) {
this.memory[this.offset + index + 0] = (byte) (value >> 8);
this.memory[this.offset + index + 1] = (byte) value;
return this;
} else {
throw new IndexOutOfBoundsException();
}
} } | public class class_name {
public final CheckedMemorySegment putChar(int index, char value) {
if (index >= 0 && index < this.size - 1) {
this.memory[this.offset + index + 0] = (byte) (value >> 8); // depends on control dependency: [if], data = [none]
this.memory[this.offset + index + 1] = (byte) value; // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
} else {
throw new IndexOutOfBoundsException();
}
} } |
public class class_name {
public void reset(Set<OWLEntity> toReturn) {
objects = toReturn;
if (anonymousIndividuals != null) {
verifyNotNull(anonymousIndividuals).clear();
}
} } | public class class_name {
public void reset(Set<OWLEntity> toReturn) {
objects = toReturn;
if (anonymousIndividuals != null) {
verifyNotNull(anonymousIndividuals).clear(); // depends on control dependency: [if], data = [(anonymousIndividuals]
}
} } |
public class class_name {
protected static void removeViewer(Page page, boolean close) {
IHelpViewer viewer = (IHelpViewer) page.removeAttribute(VIEWER_ATTRIB);
if (viewer != null && close) {
viewer.close();
}
} } | public class class_name {
protected static void removeViewer(Page page, boolean close) {
IHelpViewer viewer = (IHelpViewer) page.removeAttribute(VIEWER_ATTRIB);
if (viewer != null && close) {
viewer.close(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String getChildSuffix(StructuralNode node, boolean performRecursiveCheck) {
String resultSuffix = "";
String suffix = null;
StructuralNode child = null;
try {
for (int i = 0; i < staticSuffixList.length; i++) {
suffix = staticSuffixList[i];
Iterator<StructuralNode> iter = node.getChildIterator();
while (iter.hasNext()) {
child = iter.next();
try {
if (child.getURI().getPath().endsWith(suffix)) {
return suffix;
}
} catch (Exception e) {
}
}
}
if (performRecursiveCheck) {
Iterator<StructuralNode> iter = node.getChildIterator();
while (iter.hasNext()) {
child = iter.next();
resultSuffix = getChildSuffix(child, performRecursiveCheck);
if (!resultSuffix.equals("")) {
return resultSuffix;
}
}
}
} catch (Exception e) {
}
return resultSuffix;
} } | public class class_name {
private String getChildSuffix(StructuralNode node, boolean performRecursiveCheck) {
String resultSuffix = "";
String suffix = null;
StructuralNode child = null;
try {
for (int i = 0; i < staticSuffixList.length; i++) {
suffix = staticSuffixList[i];
// depends on control dependency: [for], data = [i]
Iterator<StructuralNode> iter = node.getChildIterator();
while (iter.hasNext()) {
child = iter.next();
// depends on control dependency: [while], data = [none]
try {
if (child.getURI().getPath().endsWith(suffix)) {
return suffix;
// depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
}
// depends on control dependency: [catch], data = [none]
}
}
if (performRecursiveCheck) {
Iterator<StructuralNode> iter = node.getChildIterator();
while (iter.hasNext()) {
child = iter.next();
// depends on control dependency: [while], data = [none]
resultSuffix = getChildSuffix(child, performRecursiveCheck);
// depends on control dependency: [while], data = [none]
if (!resultSuffix.equals("")) {
return resultSuffix;
// depends on control dependency: [if], data = [none]
}
}
}
} catch (Exception e) {
}
// depends on control dependency: [catch], data = [none]
return resultSuffix;
} } |
public class class_name {
private SubscriptionMessageHandler addSubscription(
String topicSpaceName,
SIBUuid12 topicSpaceUuid,
String topic,
SubscriptionMessageHandler messageHandler,
Hashtable subscriptionsTable,
boolean sendProxy)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"addSubscription",
new Object[] {
topicSpaceName,
topicSpaceUuid,
topic,
messageHandler,
subscriptionsTable,
new Boolean(sendProxy)});
// Get a key to find the Subscription with
final String key = subscriptionKey(topicSpaceUuid, topic);
synchronized( subscriptionLock )
{
// Find the subscription from this Buses list of subscriptions.
MESubscription subscription = (MESubscription) subscriptionsTable.get(key);
//defect 267686
//Lookup the local topic space name - the remote ME will need to know.
String localTSName = null;
try
{
DestinationHandler destHand = null;
if (sendProxy || topicSpaceName == null)
destHand = iProxyHandler.
getMessageProcessor().
getDestinationManager().
getDestination(topicSpaceUuid, false);
else
destHand = iProxyHandler.
getMessageProcessor().
getDestinationManager().getDestination(topicSpaceName, false);
if(destHand!=null)
{
localTSName = destHand.getName();
}
}
catch(SIException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.BusGroup.addSubscription",
"1:339:1.49",
this);
SIErrorException error = new SIErrorException(e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addSubscription", error);
throw error;
}
if(localTSName!=null)
{
// Lookup foreign topicspace mapping
String foreignTSName =
iProxyHandler.
getMessageProcessor().
getDestinationManager().
getTopicSpaceMapping(iBusName, topicSpaceUuid);
// If no topicspace mapping exists, we shouldn`t fwd to the other ME.
if (foreignTSName != null)
{
if (subscription == null)
{
subscription = new MESubscription(topicSpaceUuid,
localTSName,
topic,
foreignTSName);
subscriptionsTable.put(key, subscription);
}
// Perform the proxy subscription operation.
messageHandler = doProxySubscribeOp(subscription.addRef(),
subscription,
messageHandler,
subscriptionsTable,
sendProxy);
}
}//end if localTSName!=null
}//end sync
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addSubscription");
return messageHandler;
} } | public class class_name {
private SubscriptionMessageHandler addSubscription(
String topicSpaceName,
SIBUuid12 topicSpaceUuid,
String topic,
SubscriptionMessageHandler messageHandler,
Hashtable subscriptionsTable,
boolean sendProxy)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"addSubscription",
new Object[] {
topicSpaceName,
topicSpaceUuid,
topic,
messageHandler,
subscriptionsTable,
new Boolean(sendProxy)});
// Get a key to find the Subscription with
final String key = subscriptionKey(topicSpaceUuid, topic);
synchronized( subscriptionLock )
{
// Find the subscription from this Buses list of subscriptions.
MESubscription subscription = (MESubscription) subscriptionsTable.get(key);
//defect 267686
//Lookup the local topic space name - the remote ME will need to know.
String localTSName = null;
try
{
DestinationHandler destHand = null;
if (sendProxy || topicSpaceName == null)
destHand = iProxyHandler.
getMessageProcessor().
getDestinationManager().
getDestination(topicSpaceUuid, false);
else
destHand = iProxyHandler.
getMessageProcessor().
getDestinationManager().getDestination(topicSpaceName, false);
if(destHand!=null)
{
localTSName = destHand.getName(); // depends on control dependency: [if], data = [none]
}
}
catch(SIException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.BusGroup.addSubscription",
"1:339:1.49",
this);
SIErrorException error = new SIErrorException(e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addSubscription", error);
throw error;
} // depends on control dependency: [catch], data = [none]
if(localTSName!=null)
{
// Lookup foreign topicspace mapping
String foreignTSName =
iProxyHandler.
getMessageProcessor().
getDestinationManager().
getTopicSpaceMapping(iBusName, topicSpaceUuid);
// If no topicspace mapping exists, we shouldn`t fwd to the other ME.
if (foreignTSName != null)
{
if (subscription == null)
{
subscription = new MESubscription(topicSpaceUuid,
localTSName,
topic,
foreignTSName); // depends on control dependency: [if], data = [none]
subscriptionsTable.put(key, subscription); // depends on control dependency: [if], data = [none]
}
// Perform the proxy subscription operation.
messageHandler = doProxySubscribeOp(subscription.addRef(),
subscription,
messageHandler,
subscriptionsTable,
sendProxy); // depends on control dependency: [if], data = [none]
}
}//end if localTSName!=null
}//end sync
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addSubscription");
return messageHandler;
} } |
public class class_name {
public String getNextPageUrl(String domain, String region) {
if (nextPageUrl != null) {
return nextPageUrl;
}
return urlFromUri(domain, region, nextPageUri);
} } | public class class_name {
public String getNextPageUrl(String domain, String region) {
if (nextPageUrl != null) {
return nextPageUrl; // depends on control dependency: [if], data = [none]
}
return urlFromUri(domain, region, nextPageUri);
} } |
public class class_name {
public String sprintf(Object[] o) {
Enumeration e = vFmt.elements();
ConversionSpecification cs = null;
char c = 0;
int i=0;
StringBuffer sb=new StringBuffer();
while (e.hasMoreElements()) {
cs = (ConversionSpecification)
e.nextElement();
c = cs.getConversionCharacter();
if (c=='\0') sb.append(cs.getLiteral());
else if (c=='%') sb.append("%");
else {
if (cs.isPositionalSpecification()) {
i=cs.getArgumentPosition()-1;
if (cs.isPositionalFieldWidth()) {
int ifw=cs.getArgumentPositionForFieldWidth()-1;
cs.setFieldWidthWithArg(((Integer)o[ifw]).intValue());
}
if (cs.isPositionalPrecision()) {
int ipr=cs.getArgumentPositionForPrecision()-1;
cs.setPrecisionWithArg(((Integer)o[ipr]).intValue());
}
}
else {
if (cs.isVariableFieldWidth()) {
cs.setFieldWidthWithArg(((Integer)o[i]).intValue());
i++;
}
if (cs.isVariablePrecision()) {
cs.setPrecisionWithArg(((Integer)o[i]).intValue());
i++;
}
}
if (o[i] instanceof Byte)
sb.append(cs.internalsprintf(
((Byte)o[i]).byteValue()));
else if (o[i] instanceof Short)
sb.append(cs.internalsprintf(
((Short)o[i]).shortValue()));
else if (o[i] instanceof Integer)
sb.append(cs.internalsprintf(
((Integer)o[i]).intValue()));
else if (o[i] instanceof Long)
sb.append(cs.internalsprintf(
((Long)o[i]).longValue()));
else if (o[i] instanceof Float)
sb.append(cs.internalsprintf(
((Float)o[i]).floatValue()));
else if (o[i] instanceof Double)
sb.append(cs.internalsprintf(
((Double)o[i]).doubleValue()));
else if (o[i] instanceof Character)
sb.append(cs.internalsprintf(
((Character)o[i]).charValue()));
else if (o[i] instanceof String)
sb.append(cs.internalsprintf(
(String)o[i]));
else
sb.append(cs.internalsprintf(
o[i]));
if (!cs.isPositionalSpecification())
i++;
}
}
return sb.toString();
} } | public class class_name {
public String sprintf(Object[] o) {
Enumeration e = vFmt.elements();
ConversionSpecification cs = null;
char c = 0;
int i=0;
StringBuffer sb=new StringBuffer();
while (e.hasMoreElements()) {
cs = (ConversionSpecification)
e.nextElement(); // depends on control dependency: [while], data = [none]
c = cs.getConversionCharacter(); // depends on control dependency: [while], data = [none]
if (c=='\0') sb.append(cs.getLiteral());
else if (c=='%') sb.append("%");
else {
if (cs.isPositionalSpecification()) {
i=cs.getArgumentPosition()-1; // depends on control dependency: [if], data = [none]
if (cs.isPositionalFieldWidth()) {
int ifw=cs.getArgumentPositionForFieldWidth()-1;
cs.setFieldWidthWithArg(((Integer)o[ifw]).intValue()); // depends on control dependency: [if], data = [none]
}
if (cs.isPositionalPrecision()) {
int ipr=cs.getArgumentPositionForPrecision()-1;
cs.setPrecisionWithArg(((Integer)o[ipr]).intValue()); // depends on control dependency: [if], data = [none]
}
}
else {
if (cs.isVariableFieldWidth()) {
cs.setFieldWidthWithArg(((Integer)o[i]).intValue()); // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
}
if (cs.isVariablePrecision()) {
cs.setPrecisionWithArg(((Integer)o[i]).intValue()); // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
}
}
if (o[i] instanceof Byte)
sb.append(cs.internalsprintf(
((Byte)o[i]).byteValue()));
else if (o[i] instanceof Short)
sb.append(cs.internalsprintf(
((Short)o[i]).shortValue()));
else if (o[i] instanceof Integer)
sb.append(cs.internalsprintf(
((Integer)o[i]).intValue()));
else if (o[i] instanceof Long)
sb.append(cs.internalsprintf(
((Long)o[i]).longValue()));
else if (o[i] instanceof Float)
sb.append(cs.internalsprintf(
((Float)o[i]).floatValue()));
else if (o[i] instanceof Double)
sb.append(cs.internalsprintf(
((Double)o[i]).doubleValue()));
else if (o[i] instanceof Character)
sb.append(cs.internalsprintf(
((Character)o[i]).charValue()));
else if (o[i] instanceof String)
sb.append(cs.internalsprintf(
(String)o[i]));
else
sb.append(cs.internalsprintf(
o[i]));
if (!cs.isPositionalSpecification())
i++;
}
}
return sb.toString();
} } |
public class class_name {
public void setImageIds(java.util.Collection<String> imageIds) {
if (imageIds == null) {
this.imageIds = null;
return;
}
this.imageIds = new com.amazonaws.internal.SdkInternalList<String>(imageIds);
} } | public class class_name {
public void setImageIds(java.util.Collection<String> imageIds) {
if (imageIds == null) {
this.imageIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.imageIds = new com.amazonaws.internal.SdkInternalList<String>(imageIds);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.