code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public long getNextCluster(long cluster) {
testCluster(cluster);
long entry = entries[(int) cluster];
if (isEofCluster(entry)) {
return -1;
} else {
return entry;
}
} } | public class class_name {
public long getNextCluster(long cluster) {
testCluster(cluster);
long entry = entries[(int) cluster];
if (isEofCluster(entry)) {
return -1; // depends on control dependency: [if], data = [none]
} else {
return entry; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean isObjectModelSupported(String objectModel) {
if (objectModel == null) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_OBJECT_MODEL_NULL,
new Object[] { this.getClass().getName() } );
throw new NullPointerException( fmsg );
}
if (objectModel.length() == 0) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_OBJECT_MODEL_EMPTY,
new Object[] { this.getClass().getName() } );
throw new IllegalArgumentException( fmsg );
}
// know how to support default object model, W3C DOM
if (objectModel.equals(XPathFactory.DEFAULT_OBJECT_MODEL_URI)) {
return true;
}
// don't know how to support anything else
return false;
} } | public class class_name {
public boolean isObjectModelSupported(String objectModel) {
if (objectModel == null) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_OBJECT_MODEL_NULL,
new Object[] { this.getClass().getName() } );
throw new NullPointerException( fmsg );
}
if (objectModel.length() == 0) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_OBJECT_MODEL_EMPTY,
new Object[] { this.getClass().getName() } );
throw new IllegalArgumentException( fmsg );
}
// know how to support default object model, W3C DOM
if (objectModel.equals(XPathFactory.DEFAULT_OBJECT_MODEL_URI)) {
return true; // depends on control dependency: [if], data = [none]
}
// don't know how to support anything else
return false;
} } |
public class class_name {
public static HtmlPage toHtmlPage(Reader reader) {
try {
return toHtmlPage(IOUtils.toString(reader));
} catch (IOException e) {
throw new RuntimeException("Error creating HtmlPage from Reader.", e);
}
} } | public class class_name {
public static HtmlPage toHtmlPage(Reader reader) {
try {
return toHtmlPage(IOUtils.toString(reader)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException("Error creating HtmlPage from Reader.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void initDispatcherThreads(Feature.AsynchronousMessageDispatch configuration) {
for (int i = 0; i < configuration.getNumberOfMessageDispatchers(); i++) {
// each thread will run forever and process incoming
// message publication requests
Thread dispatcher = configuration.getDispatcherThreadFactory().newThread(new Runnable() {
public void run() {
while (true) {
IMessagePublication publication = null;
try {
publication = pendingMessages.take();
publication.execute();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
} catch(Throwable t){
handlePublicationError(new InternalPublicationError(t, "Error in asynchronous dispatch",publication));
}
}
}
});
dispatcher.setName("MsgDispatcher-"+i);
dispatchers.add(dispatcher);
dispatcher.start();
}
} } | public class class_name {
private void initDispatcherThreads(Feature.AsynchronousMessageDispatch configuration) {
for (int i = 0; i < configuration.getNumberOfMessageDispatchers(); i++) {
// each thread will run forever and process incoming
// message publication requests
Thread dispatcher = configuration.getDispatcherThreadFactory().newThread(new Runnable() {
public void run() {
while (true) {
IMessagePublication publication = null;
try {
publication = pendingMessages.take(); // depends on control dependency: [try], data = [none]
publication.execute(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
} catch(Throwable t){ // depends on control dependency: [catch], data = [none]
handlePublicationError(new InternalPublicationError(t, "Error in asynchronous dispatch",publication));
} // depends on control dependency: [catch], data = [none]
}
}
});
dispatcher.setName("MsgDispatcher-"+i); // depends on control dependency: [for], data = [i]
dispatchers.add(dispatcher); // depends on control dependency: [for], data = [none]
dispatcher.start(); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@Override
public void start(PrintStream writer, String[] params) {
parse(params);
out = writer;
if (getId() == 0) {
Log.debug("round 1");
send(1, new Token2(1, 1));
}
} } | public class class_name {
@Override
public void start(PrintStream writer, String[] params) {
parse(params);
out = writer;
if (getId() == 0) {
Log.debug("round 1"); // depends on control dependency: [if], data = [none]
send(1, new Token2(1, 1)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void setField(Field field, String parameterName, Object instance) {
final Object value = context.getProperty(parameterName, field.getType());
try {
field.set(instance, value);
} catch (Exception e) {
throw new BugError(e);
}
} } | public class class_name {
private void setField(Field field, String parameterName, Object instance) {
final Object value = context.getProperty(parameterName, field.getType());
try {
field.set(instance, value);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new BugError(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private synchronized void setService( final T newService )
{
if( m_service != newService )
{
LOG.debug( "Service changed [" + m_service + "] -> [" + newService + "]" );
final T oldService = m_service;
m_service = newService;
if( m_serviceListener != null )
{
m_serviceListener.serviceChanged( oldService, m_service );
}
}
} } | public class class_name {
private synchronized void setService( final T newService )
{
if( m_service != newService )
{
LOG.debug( "Service changed [" + m_service + "] -> [" + newService + "]" ); // depends on control dependency: [if], data = [none]
final T oldService = m_service;
m_service = newService; // depends on control dependency: [if], data = [none]
if( m_serviceListener != null )
{
m_serviceListener.serviceChanged( oldService, m_service ); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void addVectorInPlace(ConcatVector other, double multiple) {
// Resize if necessary
if (pointers == null) {
pointers = new double[other.pointers.length][];
sparse = new boolean[other.pointers.length];
copyOnWrite = new boolean[other.pointers.length];
} else if (pointers.length < other.pointers.length) {
increaseSizeTo(other.pointers.length);
}
// Do the addition piece by piece
for (int i = 0; i < other.pointers.length; i++) {
// If the other vector has no segment here, then skip
if (other.pointers[i] == null) continue;
// If we previously had no element here, fill it in accordingly
if (pointers[i] == null || pointers[i].length == 0) {
sparse[i] = other.sparse[i];
// If the multiple is one, just follow the copying procedure
if (multiple == 1.0) {
pointers[i] = other.pointers[i];
copyOnWrite[i] = true;
other.copyOnWrite[i] = true;
}
// Otherwise do the standard thing
else {
if (other.sparse[i]) {
pointers[i] = new double[other.pointers[i].length];
copyOnWrite[i] = false;
for (int j = 0; j < other.pointers[i].length / 2; j++) {
pointers[i][j * 2] = other.pointers[i][j * 2];
pointers[i][(j * 2) + 1] = other.pointers[i][(j * 2) + 1] * multiple;
}
} else {
pointers[i] = new double[other.pointers[i].length];
copyOnWrite[i] = false;
for (int j = 0; j < other.pointers[i].length; j++) {
pointers[i][j] = other.pointers[i][j] * multiple;
}
}
}
}
// Handle rescaling on a component-by-component basis
else if (sparse[i] && !other.sparse[i]) {
int maxSparseIndex = -1;
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
if (sparseIndex > maxSparseIndex) maxSparseIndex = sparseIndex;
}
// Convert to a dense vector
double[] newPointers = new double[Math.max(maxSparseIndex + 1, other.pointers[i].length)];
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
if (sparseIndex >= 0) newPointers[sparseIndex] = pointers[i][(j * 2) + 1];
}
// Add the other vector's dense values, multiplied by the scalar
for (int j = 0; j < other.pointers[i].length; j++) {
newPointers[j] += other.pointers[i][j] * multiple;
}
// Update
sparse[i] = false;
copyOnWrite[i] = false;
pointers[i] = newPointers;
} else if (sparse[i] && other.sparse[i]) {
// Figure out how big the vector would be if it were dense
int maxSparseIndex = 0;
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
if (sparseIndex > maxSparseIndex) maxSparseIndex = sparseIndex;
}
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int sparseIndex = (int) other.pointers[i][j * 2];
if (sparseIndex > maxSparseIndex) maxSparseIndex = sparseIndex;
}
// Figure out (an upper bound on) how big the vector would be if it remained sparse
int numEntries = pointers[i].length / 2 + other.pointers[i].length / 2;
// Only switch over to dense if the physical double array will be smaller
if (numEntries * 2 > maxSparseIndex) {
sparse[i] = false;
double[] newPointers = new double[maxSparseIndex + 1];
copyOnWrite[i] = false;
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
if (sparseIndex >= 0) newPointers[sparseIndex] = pointers[i][(j * 2) + 1];
}
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int sparseIndex = (int) other.pointers[i][j * 2];
if (sparseIndex >= 0) newPointers[sparseIndex] += other.pointers[i][(j * 2) + 1] * multiple;
}
pointers[i] = newPointers;
}
// Otherwise compose a joint sparse array
else {
int duplicates = 0;
outer:
for (int j = 0; j < pointers[i].length / 2; j++) {
for (int k = 0; k < other.pointers[i].length / 2; k++) {
if (pointers[i][j * 2] == other.pointers[i][k * 2]) {
duplicates++;
continue outer;
}
}
}
double[] newPointers = new double[(numEntries - duplicates) * 2];
int usedNewPointers = 0;
for (int j = 0; j < pointers[i].length / 2; j++) {
newPointers[j * 2] = pointers[i][j * 2];
newPointers[(j * 2) + 1] = pointers[i][(j * 2) + 1];
usedNewPointers = j + 1;
}
outer:
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int otherSparseIndex = (int) other.pointers[i][j * 2];
for (int k = 0; k < usedNewPointers; k++) {
int sparseIndex = (int) newPointers[k * 2];
if (otherSparseIndex == sparseIndex) {
newPointers[(k * 2) + 1] += other.pointers[i][(j * 2) + 1] * multiple;
continue outer;
}
}
// If this isn't true we somehow messed up calculating the number of sparse entries needed
assert (usedNewPointers < newPointers.length);
newPointers[(usedNewPointers * 2)] = other.pointers[i][j * 2];
newPointers[(usedNewPointers * 2) + 1] = other.pointers[i][(j * 2) + 1] * multiple;
usedNewPointers++;
}
copyOnWrite[i] = false;
sparse[i] = true;
pointers[i] = newPointers;
}
} else if (!sparse[i] && other.sparse[i]) {
int maxSparseIndex = 0;
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int sparseIndex = (int) other.pointers[i][j * 2];
if (sparseIndex > maxSparseIndex) maxSparseIndex = sparseIndex;
}
if (maxSparseIndex >= pointers[i].length) {
int newSize = pointers[i].length;
while (newSize <= maxSparseIndex) newSize *= 2;
double[] denseBuf = new double[newSize];
System.arraycopy(pointers[i], 0, denseBuf, 0, pointers[i].length);
copyOnWrite[i] = false;
pointers[i] = denseBuf;
}
if (copyOnWrite[i]) {
pointers[i] = pointers[i].clone();
copyOnWrite[i] = false;
}
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int sparseIndex = (int) other.pointers[i][j * 2];
if (sparseIndex >= 0) pointers[i][sparseIndex] += other.pointers[i][(j * 2) + 1] * multiple;
}
} else {
assert (!sparse[i] && !other.sparse[i]);
if (pointers[i].length < other.pointers[i].length) {
double[] denseBuf = new double[other.pointers[i].length];
System.arraycopy(pointers[i], 0, denseBuf, 0, pointers[i].length);
copyOnWrite[i] = false;
pointers[i] = denseBuf;
}
if (copyOnWrite[i]) {
pointers[i] = pointers[i].clone();
copyOnWrite[i] = false;
}
for (int j = 0; j < other.pointers[i].length; j++) {
pointers[i][j] += other.pointers[i][j] * multiple;
}
}
}
} } | public class class_name {
public void addVectorInPlace(ConcatVector other, double multiple) {
// Resize if necessary
if (pointers == null) {
pointers = new double[other.pointers.length][]; // depends on control dependency: [if], data = [none]
sparse = new boolean[other.pointers.length]; // depends on control dependency: [if], data = [none]
copyOnWrite = new boolean[other.pointers.length]; // depends on control dependency: [if], data = [none]
} else if (pointers.length < other.pointers.length) {
increaseSizeTo(other.pointers.length); // depends on control dependency: [if], data = [other.pointers.length)]
}
// Do the addition piece by piece
for (int i = 0; i < other.pointers.length; i++) {
// If the other vector has no segment here, then skip
if (other.pointers[i] == null) continue;
// If we previously had no element here, fill it in accordingly
if (pointers[i] == null || pointers[i].length == 0) {
sparse[i] = other.sparse[i]; // depends on control dependency: [if], data = [none]
// If the multiple is one, just follow the copying procedure
if (multiple == 1.0) {
pointers[i] = other.pointers[i]; // depends on control dependency: [if], data = [none]
copyOnWrite[i] = true; // depends on control dependency: [if], data = [none]
other.copyOnWrite[i] = true; // depends on control dependency: [if], data = [none]
}
// Otherwise do the standard thing
else {
if (other.sparse[i]) {
pointers[i] = new double[other.pointers[i].length]; // depends on control dependency: [if], data = [none]
copyOnWrite[i] = false; // depends on control dependency: [if], data = [none]
for (int j = 0; j < other.pointers[i].length / 2; j++) {
pointers[i][j * 2] = other.pointers[i][j * 2]; // depends on control dependency: [for], data = [j]
pointers[i][(j * 2) + 1] = other.pointers[i][(j * 2) + 1] * multiple; // depends on control dependency: [for], data = [j]
}
} else {
pointers[i] = new double[other.pointers[i].length]; // depends on control dependency: [if], data = [none]
copyOnWrite[i] = false; // depends on control dependency: [if], data = [none]
for (int j = 0; j < other.pointers[i].length; j++) {
pointers[i][j] = other.pointers[i][j] * multiple; // depends on control dependency: [for], data = [j]
}
}
}
}
// Handle rescaling on a component-by-component basis
else if (sparse[i] && !other.sparse[i]) {
int maxSparseIndex = -1;
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
if (sparseIndex > maxSparseIndex) maxSparseIndex = sparseIndex;
}
// Convert to a dense vector
double[] newPointers = new double[Math.max(maxSparseIndex + 1, other.pointers[i].length)];
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
if (sparseIndex >= 0) newPointers[sparseIndex] = pointers[i][(j * 2) + 1];
}
// Add the other vector's dense values, multiplied by the scalar
for (int j = 0; j < other.pointers[i].length; j++) {
newPointers[j] += other.pointers[i][j] * multiple; // depends on control dependency: [for], data = [j]
}
// Update
sparse[i] = false; // depends on control dependency: [if], data = [none]
copyOnWrite[i] = false; // depends on control dependency: [if], data = [none]
pointers[i] = newPointers; // depends on control dependency: [if], data = [none]
} else if (sparse[i] && other.sparse[i]) {
// Figure out how big the vector would be if it were dense
int maxSparseIndex = 0;
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
if (sparseIndex > maxSparseIndex) maxSparseIndex = sparseIndex;
}
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int sparseIndex = (int) other.pointers[i][j * 2];
if (sparseIndex > maxSparseIndex) maxSparseIndex = sparseIndex;
}
// Figure out (an upper bound on) how big the vector would be if it remained sparse
int numEntries = pointers[i].length / 2 + other.pointers[i].length / 2;
// Only switch over to dense if the physical double array will be smaller
if (numEntries * 2 > maxSparseIndex) {
sparse[i] = false; // depends on control dependency: [if], data = [none]
double[] newPointers = new double[maxSparseIndex + 1];
copyOnWrite[i] = false; // depends on control dependency: [if], data = [none]
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
if (sparseIndex >= 0) newPointers[sparseIndex] = pointers[i][(j * 2) + 1];
}
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int sparseIndex = (int) other.pointers[i][j * 2];
if (sparseIndex >= 0) newPointers[sparseIndex] += other.pointers[i][(j * 2) + 1] * multiple;
}
pointers[i] = newPointers; // depends on control dependency: [if], data = [none]
}
// Otherwise compose a joint sparse array
else {
int duplicates = 0;
outer:
for (int j = 0; j < pointers[i].length / 2; j++) {
for (int k = 0; k < other.pointers[i].length / 2; k++) {
if (pointers[i][j * 2] == other.pointers[i][k * 2]) {
duplicates++; // depends on control dependency: [if], data = [none]
continue outer;
}
}
}
double[] newPointers = new double[(numEntries - duplicates) * 2];
int usedNewPointers = 0;
for (int j = 0; j < pointers[i].length / 2; j++) {
newPointers[j * 2] = pointers[i][j * 2]; // depends on control dependency: [for], data = [j]
newPointers[(j * 2) + 1] = pointers[i][(j * 2) + 1]; // depends on control dependency: [for], data = [j]
usedNewPointers = j + 1; // depends on control dependency: [for], data = [j]
}
outer:
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int otherSparseIndex = (int) other.pointers[i][j * 2];
for (int k = 0; k < usedNewPointers; k++) {
int sparseIndex = (int) newPointers[k * 2];
if (otherSparseIndex == sparseIndex) {
newPointers[(k * 2) + 1] += other.pointers[i][(j * 2) + 1] * multiple; // depends on control dependency: [if], data = [none]
continue outer;
}
}
// If this isn't true we somehow messed up calculating the number of sparse entries needed
assert (usedNewPointers < newPointers.length); // depends on control dependency: [for], data = [none]
newPointers[(usedNewPointers * 2)] = other.pointers[i][j * 2]; // depends on control dependency: [for], data = [j]
newPointers[(usedNewPointers * 2) + 1] = other.pointers[i][(j * 2) + 1] * multiple; // depends on control dependency: [for], data = [j]
usedNewPointers++; // depends on control dependency: [for], data = [none]
}
copyOnWrite[i] = false; // depends on control dependency: [if], data = [none]
sparse[i] = true; // depends on control dependency: [if], data = [none]
pointers[i] = newPointers; // depends on control dependency: [if], data = [none]
}
} else if (!sparse[i] && other.sparse[i]) {
int maxSparseIndex = 0;
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int sparseIndex = (int) other.pointers[i][j * 2];
if (sparseIndex > maxSparseIndex) maxSparseIndex = sparseIndex;
}
if (maxSparseIndex >= pointers[i].length) {
int newSize = pointers[i].length;
while (newSize <= maxSparseIndex) newSize *= 2;
double[] denseBuf = new double[newSize];
System.arraycopy(pointers[i], 0, denseBuf, 0, pointers[i].length); // depends on control dependency: [if], data = [none]
copyOnWrite[i] = false; // depends on control dependency: [if], data = [none]
pointers[i] = denseBuf; // depends on control dependency: [if], data = [none]
}
if (copyOnWrite[i]) {
pointers[i] = pointers[i].clone(); // depends on control dependency: [if], data = [none]
copyOnWrite[i] = false; // depends on control dependency: [if], data = [none]
}
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int sparseIndex = (int) other.pointers[i][j * 2];
if (sparseIndex >= 0) pointers[i][sparseIndex] += other.pointers[i][(j * 2) + 1] * multiple;
}
} else {
assert (!sparse[i] && !other.sparse[i]); // depends on control dependency: [if], data = [(!sparse[i]]
if (pointers[i].length < other.pointers[i].length) {
double[] denseBuf = new double[other.pointers[i].length];
System.arraycopy(pointers[i], 0, denseBuf, 0, pointers[i].length); // depends on control dependency: [if], data = [none]
copyOnWrite[i] = false; // depends on control dependency: [if], data = [none]
pointers[i] = denseBuf; // depends on control dependency: [if], data = [none]
}
if (copyOnWrite[i]) {
pointers[i] = pointers[i].clone(); // depends on control dependency: [if], data = [none]
copyOnWrite[i] = false; // depends on control dependency: [if], data = [none]
}
for (int j = 0; j < other.pointers[i].length; j++) {
pointers[i][j] += other.pointers[i][j] * multiple; // depends on control dependency: [for], data = [j]
}
}
}
} } |
public class class_name {
public void scheduleIndexManagement(String indexPrefix, int optimizeAndMoveIndicesToColdNodesOlderThanDays, int deleteIndicesOlderThanDays) {
if (deleteIndicesOlderThanDays > 0) {
final TimerTask deleteIndicesTask = new DeleteIndicesTask(corePlugin.getIndexSelector(), indexPrefix,
deleteIndicesOlderThanDays, this);
timer.schedule(deleteIndicesTask, TimeUnit.SECONDS.toMillis(5), DateUtils.getDayInMillis());
}
if (optimizeAndMoveIndicesToColdNodesOlderThanDays > 0) {
final TimerTask shardAllocationTask = new ShardAllocationTask(corePlugin.getIndexSelector(), indexPrefix,
optimizeAndMoveIndicesToColdNodesOlderThanDays, this, "cold");
timer.schedule(shardAllocationTask, TimeUnit.SECONDS.toMillis(5), DateUtils.getDayInMillis());
}
if (optimizeAndMoveIndicesToColdNodesOlderThanDays > 0) {
final TimerTask optimizeIndicesTask = new ForceMergeIndicesTask(corePlugin.getIndexSelector(), indexPrefix,
optimizeAndMoveIndicesToColdNodesOlderThanDays, this);
timer.schedule(optimizeIndicesTask, DateUtils.getNextDateAtHour(3), DateUtils.getDayInMillis());
}
} } | public class class_name {
public void scheduleIndexManagement(String indexPrefix, int optimizeAndMoveIndicesToColdNodesOlderThanDays, int deleteIndicesOlderThanDays) {
if (deleteIndicesOlderThanDays > 0) {
final TimerTask deleteIndicesTask = new DeleteIndicesTask(corePlugin.getIndexSelector(), indexPrefix,
deleteIndicesOlderThanDays, this);
timer.schedule(deleteIndicesTask, TimeUnit.SECONDS.toMillis(5), DateUtils.getDayInMillis()); // depends on control dependency: [if], data = [none]
}
if (optimizeAndMoveIndicesToColdNodesOlderThanDays > 0) {
final TimerTask shardAllocationTask = new ShardAllocationTask(corePlugin.getIndexSelector(), indexPrefix,
optimizeAndMoveIndicesToColdNodesOlderThanDays, this, "cold");
timer.schedule(shardAllocationTask, TimeUnit.SECONDS.toMillis(5), DateUtils.getDayInMillis()); // depends on control dependency: [if], data = [none]
}
if (optimizeAndMoveIndicesToColdNodesOlderThanDays > 0) {
final TimerTask optimizeIndicesTask = new ForceMergeIndicesTask(corePlugin.getIndexSelector(), indexPrefix,
optimizeAndMoveIndicesToColdNodesOlderThanDays, this);
timer.schedule(optimizeIndicesTask, DateUtils.getNextDateAtHour(3), DateUtils.getDayInMillis()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DailyVolume dailyVolume, ProtocolMarshaller protocolMarshaller) {
if (dailyVolume == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dailyVolume.getStartDate(), STARTDATE_BINDING);
protocolMarshaller.marshall(dailyVolume.getVolumeStatistics(), VOLUMESTATISTICS_BINDING);
protocolMarshaller.marshall(dailyVolume.getDomainIspPlacements(), DOMAINISPPLACEMENTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DailyVolume dailyVolume, ProtocolMarshaller protocolMarshaller) {
if (dailyVolume == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dailyVolume.getStartDate(), STARTDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dailyVolume.getVolumeStatistics(), VOLUMESTATISTICS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dailyVolume.getDomainIspPlacements(), DOMAINISPPLACEMENTS_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 RequestLaunchTemplateData withNetworkInterfaces(LaunchTemplateInstanceNetworkInterfaceSpecificationRequest... networkInterfaces) {
if (this.networkInterfaces == null) {
setNetworkInterfaces(new com.amazonaws.internal.SdkInternalList<LaunchTemplateInstanceNetworkInterfaceSpecificationRequest>(
networkInterfaces.length));
}
for (LaunchTemplateInstanceNetworkInterfaceSpecificationRequest ele : networkInterfaces) {
this.networkInterfaces.add(ele);
}
return this;
} } | public class class_name {
public RequestLaunchTemplateData withNetworkInterfaces(LaunchTemplateInstanceNetworkInterfaceSpecificationRequest... networkInterfaces) {
if (this.networkInterfaces == null) {
setNetworkInterfaces(new com.amazonaws.internal.SdkInternalList<LaunchTemplateInstanceNetworkInterfaceSpecificationRequest>(
networkInterfaces.length)); // depends on control dependency: [if], data = [none]
}
for (LaunchTemplateInstanceNetworkInterfaceSpecificationRequest ele : networkInterfaces) {
this.networkInterfaces.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private void updateFile() {
@SuppressWarnings("unchecked")
List<Logger> logger = (List<Logger>)m_container.getItemIds();
for (Logger item : logger) {
m_container.getItem(item).getItemProperty(TableColumn.File).setValue(getLogFiles(item));
}
resetPageBuffer();
refreshRenderedCells();
refreshRowCache();
} } | public class class_name {
private void updateFile() {
@SuppressWarnings("unchecked")
List<Logger> logger = (List<Logger>)m_container.getItemIds();
for (Logger item : logger) {
m_container.getItem(item).getItemProperty(TableColumn.File).setValue(getLogFiles(item)); // depends on control dependency: [for], data = [item]
}
resetPageBuffer();
refreshRenderedCells();
refreshRowCache();
} } |
public class class_name {
public synchronized void initRunning() {
if (!isStart()) {
return;
}
String path = ZookeeperPathUtils.getDestinationClientRunning(this.destination, clientData.getClientId());
// 序列化
byte[] bytes = JsonUtils.marshalToByte(clientData);
try {
mutex.set(false);
zkClient.create(path, bytes, CreateMode.EPHEMERAL);
processActiveEnter();// 触发一下事件
activeData = clientData;
mutex.set(true);
} catch (ZkNodeExistsException e) {
bytes = zkClient.readData(path, true);
if (bytes == null) {// 如果不存在节点,立即尝试一次
initRunning();
} else {
activeData = JsonUtils.unmarshalFromByte(bytes, ClientRunningData.class);
// 如果发现已经存在,判断一下是否自己,避免活锁
if (activeData.getAddress().contains(":") && isMine(activeData.getAddress())) {
mutex.set(true);
}
}
} catch (ZkNoNodeException e) {
zkClient.createPersistent(ZookeeperPathUtils.getClientIdNodePath(this.destination, clientData.getClientId()),
true); // 尝试创建父节点
initRunning();
} catch (Throwable t) {
logger.error(MessageFormat.format("There is an error when execute initRunning method, with destination [{0}].",
destination),
t);
// fixed issue 1220, 针对server节点不工作避免死循环
if (t instanceof ServerNotFoundException) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
// 出现任何异常尝试release
releaseRunning();
throw new CanalClientException("something goes wrong in initRunning method. ", t);
}
} } | public class class_name {
public synchronized void initRunning() {
if (!isStart()) {
return; // depends on control dependency: [if], data = [none]
}
String path = ZookeeperPathUtils.getDestinationClientRunning(this.destination, clientData.getClientId());
// 序列化
byte[] bytes = JsonUtils.marshalToByte(clientData);
try {
mutex.set(false); // depends on control dependency: [try], data = [none]
zkClient.create(path, bytes, CreateMode.EPHEMERAL); // depends on control dependency: [try], data = [none]
processActiveEnter();// 触发一下事件 // depends on control dependency: [try], data = [none]
activeData = clientData; // depends on control dependency: [try], data = [none]
mutex.set(true); // depends on control dependency: [try], data = [none]
} catch (ZkNodeExistsException e) {
bytes = zkClient.readData(path, true);
if (bytes == null) {// 如果不存在节点,立即尝试一次
initRunning(); // depends on control dependency: [if], data = [none]
} else {
activeData = JsonUtils.unmarshalFromByte(bytes, ClientRunningData.class); // depends on control dependency: [if], data = [(bytes]
// 如果发现已经存在,判断一下是否自己,避免活锁
if (activeData.getAddress().contains(":") && isMine(activeData.getAddress())) {
mutex.set(true); // depends on control dependency: [if], data = [none]
}
}
} catch (ZkNoNodeException e) { // depends on control dependency: [catch], data = [none]
zkClient.createPersistent(ZookeeperPathUtils.getClientIdNodePath(this.destination, clientData.getClientId()),
true); // 尝试创建父节点
initRunning();
} catch (Throwable t) { // depends on control dependency: [catch], data = [none]
logger.error(MessageFormat.format("There is an error when execute initRunning method, with destination [{0}].",
destination),
t);
// fixed issue 1220, 针对server节点不工作避免死循环
if (t instanceof ServerNotFoundException) {
try {
Thread.sleep(1000); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
} // depends on control dependency: [catch], data = [none]
}
// 出现任何异常尝试release
releaseRunning();
throw new CanalClientException("something goes wrong in initRunning method. ", t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void unregisterActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) {
if (PRE_ICS) {
preIcsUnregisterActivityLifecycleCallbacks(callback);
} else {
postIcsUnregisterActivityLifecycleCallbacks(application, callback);
}
} } | public class class_name {
public static void unregisterActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) {
if (PRE_ICS) {
preIcsUnregisterActivityLifecycleCallbacks(callback); // depends on control dependency: [if], data = [none]
} else {
postIcsUnregisterActivityLifecycleCallbacks(application, callback); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Set<Dependency> asSet(boolean withChildren) {
if (withChildren) {
Set<Dependency> dependencySet = new HashSet<>();
List<Dependency> dependencyList = asList(false);
dependencySet.addAll(dependencyList);
for (Dependency dependency : dependencyList) {
if (dependency.isInternal()) {
dependencySet.addAll(dependency.getDependencies().asSet());
}
}
return dependencySet;
} else {
return new HashSet<>(list);
}
} } | public class class_name {
public Set<Dependency> asSet(boolean withChildren) {
if (withChildren) {
Set<Dependency> dependencySet = new HashSet<>();
List<Dependency> dependencyList = asList(false);
dependencySet.addAll(dependencyList); // depends on control dependency: [if], data = [none]
for (Dependency dependency : dependencyList) {
if (dependency.isInternal()) {
dependencySet.addAll(dependency.getDependencies().asSet()); // depends on control dependency: [if], data = [none]
}
}
return dependencySet; // depends on control dependency: [if], data = [none]
} else {
return new HashSet<>(list); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void addContents(Character uc, List<? extends Doc> memberlist,
Content contentTree) {
addHeading(uc, contentTree);
int memberListSize = memberlist.size();
// Display the list only if there are elements to be displayed.
if (memberListSize > 0) {
Content dl = new HtmlTree(HtmlTag.DL);
for (Doc element : memberlist) {
addDescription(dl, element);
}
contentTree.addContent(dl);
}
} } | public class class_name {
protected void addContents(Character uc, List<? extends Doc> memberlist,
Content contentTree) {
addHeading(uc, contentTree);
int memberListSize = memberlist.size();
// Display the list only if there are elements to be displayed.
if (memberListSize > 0) {
Content dl = new HtmlTree(HtmlTag.DL);
for (Doc element : memberlist) {
addDescription(dl, element); // depends on control dependency: [for], data = [element]
}
contentTree.addContent(dl); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean validate(boolean show) {
fireEvents = false;
for (HasValidators<?> field : fields.keySet()) {
field.validate(show);
}
fireEvents = true;
updateStateAndNotify();
return groupValid;
} } | public class class_name {
public boolean validate(boolean show) {
fireEvents = false;
for (HasValidators<?> field : fields.keySet()) {
field.validate(show); // depends on control dependency: [for], data = [field]
}
fireEvents = true;
updateStateAndNotify();
return groupValid;
} } |
public class class_name {
public void characters(char ch[], int start, int length)
throws org.xml.sax.SAXException
{
flushPending();
try
{
if (inTemporaryOutputState()) {
/* leave characters un-processed as we are
* creating temporary output, the output generated by
* this serializer will be input to a final serializer
* later on and it will do the processing in final
* output state (not temporary output state).
*
* A "temporary" ToTextStream serializer is used to
* evaluate attribute value templates (for example),
* and the result of evaluating such a thing
* is fed into a final serializer later on.
*/
m_writer.write(ch, start, length);
}
else {
// In final output state we do process the characters!
writeNormalizedChars(ch, start, length, m_lineSepUse);
}
if (m_tracer != null)
super.fireCharEvent(ch, start, length);
}
catch(IOException ioe)
{
throw new SAXException(ioe);
}
} } | public class class_name {
public void characters(char ch[], int start, int length)
throws org.xml.sax.SAXException
{
flushPending();
try
{
if (inTemporaryOutputState()) {
/* leave characters un-processed as we are
* creating temporary output, the output generated by
* this serializer will be input to a final serializer
* later on and it will do the processing in final
* output state (not temporary output state).
*
* A "temporary" ToTextStream serializer is used to
* evaluate attribute value templates (for example),
* and the result of evaluating such a thing
* is fed into a final serializer later on.
*/
m_writer.write(ch, start, length); // depends on control dependency: [if], data = [none]
}
else {
// In final output state we do process the characters!
writeNormalizedChars(ch, start, length, m_lineSepUse); // depends on control dependency: [if], data = [none]
}
if (m_tracer != null)
super.fireCharEvent(ch, start, length);
}
catch(IOException ioe)
{
throw new SAXException(ioe);
}
} } |
public class class_name {
private void executeWithRetry(final HttpMethod method)
throws IOException, HttpException {
/** How many times did this transparently handle a recoverable exception? */
int execCount = 0;
// loop until the method is successfully processed, the retryHandler
// returns false or a non-recoverable exception is thrown
try {
while (true) {
execCount++;
try {
if (LOG.isTraceEnabled()) {
LOG.trace("Attempt number " + execCount + " to process request");
}
if (this.conn.getParams().isStaleCheckingEnabled()) {
this.conn.closeIfStale();
}
if (!this.conn.isOpen()) {
// this connection must be opened before it can be used
// This has nothing to do with opening a secure tunnel
this.conn.open();
boolean upgrade = isConnectionUpgrade(method);
if ((this.conn.isProxied() && (this.conn.isSecure() || upgrade))
&& !(method instanceof ConnectMethod)) {
this.conn.setTunnelRequested(upgrade);
// we need to create a tunnel before we can execute the real method
if (!executeConnect()) {
// abort, the connect method failed
return;
}
}
}
applyConnectionParams(method);
method.execute(state, this.conn);
break;
} catch (HttpException e) {
// filter out protocol exceptions which cannot be recovered from
throw e;
} catch (IOException e) {
LOG.debug("Closing the connection.");
this.conn.close();
// test if this method should be retried
// ========================================
// this code is provided for backward compatibility with 2.0
// will be removed in the next major release
if (method instanceof HttpMethodBase) {
MethodRetryHandler handler =
((HttpMethodBase)method).getMethodRetryHandler();
if (handler != null) {
if (!handler.retryMethod(
method,
this.conn,
new HttpRecoverableException(e.getMessage()),
execCount,
method.isRequestSent())) {
LOG.debug("Method retry handler returned false. "
+ "Automatic recovery will not be attempted");
throw e;
}
}
}
// ========================================
HttpMethodRetryHandler handler =
(HttpMethodRetryHandler)method.getParams().getParameter(
HttpMethodParams.RETRY_HANDLER);
if (handler == null) {
handler = new DefaultHttpMethodRetryHandler();
}
if (!handler.retryMethod(method, e, execCount)) {
LOG.debug("Method retry handler returned false. "
+ "Automatic recovery will not be attempted");
throw e;
}
if (LOG.isInfoEnabled()) {
LOG.info("I/O exception ("+ e.getClass().getName() +") caught when processing request: "
+ e.getMessage());
}
if (LOG.isDebugEnabled()) {
LOG.debug(e.getMessage(), e);
}
LOG.info("Retrying request");
}
}
} catch (IOException e) {
if (this.conn.isOpen()) {
LOG.debug("Closing the connection.");
this.conn.close();
}
releaseConnection = true;
throw e;
} catch (RuntimeException e) {
if (this.conn.isOpen()) {
LOG.debug("Closing the connection.");
this.conn.close();
}
releaseConnection = true;
throw e;
}
} } | public class class_name {
private void executeWithRetry(final HttpMethod method)
throws IOException, HttpException {
/** How many times did this transparently handle a recoverable exception? */
int execCount = 0;
// loop until the method is successfully processed, the retryHandler
// returns false or a non-recoverable exception is thrown
try {
while (true) {
execCount++;
try {
if (LOG.isTraceEnabled()) {
LOG.trace("Attempt number " + execCount + " to process request"); // depends on control dependency: [if], data = [none]
}
if (this.conn.getParams().isStaleCheckingEnabled()) {
this.conn.closeIfStale(); // depends on control dependency: [if], data = [none]
}
if (!this.conn.isOpen()) {
// this connection must be opened before it can be used
// This has nothing to do with opening a secure tunnel
this.conn.open(); // depends on control dependency: [if], data = [none]
boolean upgrade = isConnectionUpgrade(method);
if ((this.conn.isProxied() && (this.conn.isSecure() || upgrade))
&& !(method instanceof ConnectMethod)) {
this.conn.setTunnelRequested(upgrade); // depends on control dependency: [if], data = [none]
// we need to create a tunnel before we can execute the real method
if (!executeConnect()) {
// abort, the connect method failed
return; // depends on control dependency: [if], data = [none]
}
}
}
applyConnectionParams(method);
method.execute(state, this.conn);
break;
} catch (HttpException e) {
// filter out protocol exceptions which cannot be recovered from
throw e;
} catch (IOException e) {
LOG.debug("Closing the connection.");
this.conn.close();
// test if this method should be retried
// ========================================
// this code is provided for backward compatibility with 2.0
// will be removed in the next major release
if (method instanceof HttpMethodBase) {
MethodRetryHandler handler =
((HttpMethodBase)method).getMethodRetryHandler();
if (handler != null) {
if (!handler.retryMethod(
method,
this.conn,
new HttpRecoverableException(e.getMessage()),
execCount,
method.isRequestSent())) {
LOG.debug("Method retry handler returned false. "
+ "Automatic recovery will not be attempted");
throw e;
}
}
}
// ========================================
HttpMethodRetryHandler handler =
(HttpMethodRetryHandler)method.getParams().getParameter(
HttpMethodParams.RETRY_HANDLER);
if (handler == null) {
handler = new DefaultHttpMethodRetryHandler(); // depends on control dependency: [if], data = [none]
}
if (!handler.retryMethod(method, e, execCount)) {
LOG.debug("Method retry handler returned false. "
+ "Automatic recovery will not be attempted");
throw e;
}
if (LOG.isInfoEnabled()) {
LOG.info("I/O exception ("+ e.getClass().getName() +") caught when processing request: "
+ e.getMessage());
}
if (LOG.isDebugEnabled()) {
LOG.debug(e.getMessage(), e);
}
LOG.info("Retrying request");
}
}
} catch (IOException e) {
if (this.conn.isOpen()) {
LOG.debug("Closing the connection.");
this.conn.close();
}
releaseConnection = true;
throw e;
} catch (RuntimeException e) {
if (this.conn.isOpen()) {
LOG.debug("Closing the connection.");
this.conn.close();
}
releaseConnection = true;
throw e;
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public void runDeadlockFuture(Runnable deadlockGuardTask) {
if (deadlockFuture == null) {
ThreadPoolTaskScheduler deadlockGuard = conn.getDeadlockGuardScheduler();
if (deadlockGuard != null) {
try {
deadlockFuture = (ScheduledFuture<Runnable>) deadlockGuard.schedule(deadlockGuardTask, new Date(packet.getExpirationTime()));
} catch (TaskRejectedException e) {
log.warn("DeadlockGuard task is rejected for {}", sessionId, e);
}
} else {
log.debug("Deadlock guard is null for {}", sessionId);
}
} else {
log.warn("Deadlock future is already create for {}", sessionId);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public void runDeadlockFuture(Runnable deadlockGuardTask) {
if (deadlockFuture == null) {
ThreadPoolTaskScheduler deadlockGuard = conn.getDeadlockGuardScheduler();
if (deadlockGuard != null) {
try {
deadlockFuture = (ScheduledFuture<Runnable>) deadlockGuard.schedule(deadlockGuardTask, new Date(packet.getExpirationTime()));
// depends on control dependency: [try], data = [none]
} catch (TaskRejectedException e) {
log.warn("DeadlockGuard task is rejected for {}", sessionId, e);
}
// depends on control dependency: [catch], data = [none]
} else {
log.debug("Deadlock guard is null for {}", sessionId);
// depends on control dependency: [if], data = [none]
}
} else {
log.warn("Deadlock future is already create for {}", sessionId);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Matrix times(final Matrix B)
{
final Matrix A = this;
if (A.m_columns != B.m_rows)
{
throw new GeometryException("Illegal matrix dimensions");
}
final Matrix C = new Matrix(A.m_rows, B.m_columns);
for (int i = 0; i < C.m_rows; i++)
{
for (int j = 0; j < C.m_columns; j++)
{
for (int k = 0; k < A.m_columns; k++)
{
C.m_data[i][j] += (A.m_data[i][k] * B.m_data[k][j]);
}
}
}
return C;
} } | public class class_name {
public Matrix times(final Matrix B)
{
final Matrix A = this;
if (A.m_columns != B.m_rows)
{
throw new GeometryException("Illegal matrix dimensions");
}
final Matrix C = new Matrix(A.m_rows, B.m_columns);
for (int i = 0; i < C.m_rows; i++)
{
for (int j = 0; j < C.m_columns; j++)
{
for (int k = 0; k < A.m_columns; k++)
{
C.m_data[i][j] += (A.m_data[i][k] * B.m_data[k][j]);
// depends on control dependency: [for], data = [k]
}
}
}
return C;
} } |
public class class_name {
protected void compareNode(Node control, Node test,
DifferenceListener listener, ElementQualifier elementQualifier)
throws DifferenceFoundException {
boolean comparable = compareNodeBasics(control, test, listener);
boolean isDocumentNode = false;
if (comparable) {
switch (control.getNodeType()) {
case Node.ELEMENT_NODE:
compareElement((Element)control, (Element)test, listener);
break;
case Node.CDATA_SECTION_NODE:
case Node.TEXT_NODE:
compareText((CharacterData) control,
(CharacterData) test, listener);
break;
case Node.COMMENT_NODE:
compareComment((Comment)control, (Comment)test, listener);
break;
case Node.DOCUMENT_TYPE_NODE:
compareDocumentType((DocumentType)control,
(DocumentType)test, listener);
break;
case Node.PROCESSING_INSTRUCTION_NODE:
compareProcessingInstruction((ProcessingInstruction)control,
(ProcessingInstruction)test, listener);
break;
case Node.DOCUMENT_NODE:
isDocumentNode = true;
compareDocument((Document)control, (Document) test,
listener, elementQualifier);
break;
default:
listener.skippedComparison(control, test);
}
}
compareHasChildNodes(control, test, listener);
if (isDocumentNode) {
Element controlElement = ((Document)control).getDocumentElement();
Element testElement = ((Document)test).getDocumentElement();
if (controlElement!=null && testElement!=null) {
compareNode(controlElement, testElement, listener, elementQualifier);
}
} else {
controlTracker.indent();
testTracker.indent();
compareNodeChildren(control, test, listener, elementQualifier);
controlTracker.outdent();
testTracker.outdent();
}
} } | public class class_name {
protected void compareNode(Node control, Node test,
DifferenceListener listener, ElementQualifier elementQualifier)
throws DifferenceFoundException {
boolean comparable = compareNodeBasics(control, test, listener);
boolean isDocumentNode = false;
if (comparable) {
switch (control.getNodeType()) {
case Node.ELEMENT_NODE:
compareElement((Element)control, (Element)test, listener);
break;
case Node.CDATA_SECTION_NODE:
case Node.TEXT_NODE:
compareText((CharacterData) control,
(CharacterData) test, listener);
break;
case Node.COMMENT_NODE:
compareComment((Comment)control, (Comment)test, listener);
break;
case Node.DOCUMENT_TYPE_NODE:
compareDocumentType((DocumentType)control,
(DocumentType)test, listener);
break;
case Node.PROCESSING_INSTRUCTION_NODE:
compareProcessingInstruction((ProcessingInstruction)control,
(ProcessingInstruction)test, listener);
break;
case Node.DOCUMENT_NODE:
isDocumentNode = true;
compareDocument((Document)control, (Document) test,
listener, elementQualifier);
break;
default:
listener.skippedComparison(control, test);
}
}
compareHasChildNodes(control, test, listener);
if (isDocumentNode) {
Element controlElement = ((Document)control).getDocumentElement();
Element testElement = ((Document)test).getDocumentElement();
if (controlElement!=null && testElement!=null) {
compareNode(controlElement, testElement, listener, elementQualifier); // depends on control dependency: [if], data = [(controlElement]
}
} else {
controlTracker.indent();
testTracker.indent();
compareNodeChildren(control, test, listener, elementQualifier);
controlTracker.outdent();
testTracker.outdent();
}
} } |
public class class_name {
public final void error(Throwable t) {
int state = get();
if ((state & (FUSED_READY | FUSED_CONSUMED | TERMINATED | DISPOSED)) != 0) {
RxJavaPlugins.onError(t);
return;
}
lazySet(TERMINATED);
downstream.onError(t);
} } | public class class_name {
public final void error(Throwable t) {
int state = get();
if ((state & (FUSED_READY | FUSED_CONSUMED | TERMINATED | DISPOSED)) != 0) {
RxJavaPlugins.onError(t); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
lazySet(TERMINATED);
downstream.onError(t);
} } |
public class class_name {
@Override
public Type<?> getIdType()
{
if (idAttribute != null && !isIdClass)
{
return idAttribute.getType();
}
return getSupertype().getIdType();
} } | public class class_name {
@Override
public Type<?> getIdType()
{
if (idAttribute != null && !isIdClass)
{
return idAttribute.getType(); // depends on control dependency: [if], data = [none]
}
return getSupertype().getIdType();
} } |
public class class_name {
@Override
public int compareTo(ObserverMethod o) {
if (o == null) {
return 1;
}
Integer a = getPresedence(getMethod());
Integer b = getPresedence(o.getMethod());
return b.compareTo(a);
} } | public class class_name {
@Override
public int compareTo(ObserverMethod o) {
if (o == null) {
return 1; // depends on control dependency: [if], data = [none]
}
Integer a = getPresedence(getMethod());
Integer b = getPresedence(o.getMethod());
return b.compareTo(a);
} } |
public class class_name {
protected boolean collectionsEqual(Collection a1, Collection a2) {
if (a1 != null && a2 != null && a1.size() == a2.size()) {
// Loop over each element and compare them using our comparator
Iterator iterA1 = a1.iterator();
Iterator iterA2 = a2.iterator();
while (iterA1.hasNext()) {
if (!equalByComparator(iterA1.next(), iterA2.next())) {
return false;
}
}
}
else if (a1 == null && a2 == null) {
return true;
}
return false;
} } | public class class_name {
protected boolean collectionsEqual(Collection a1, Collection a2) {
if (a1 != null && a2 != null && a1.size() == a2.size()) {
// Loop over each element and compare them using our comparator
Iterator iterA1 = a1.iterator();
Iterator iterA2 = a2.iterator();
while (iterA1.hasNext()) {
if (!equalByComparator(iterA1.next(), iterA2.next())) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
else if (a1 == null && a2 == null) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
private Integer getLargestValidPoolSize(Integer poolSize, Double forecast) {
Integer largestPoolSize = -1;
// find largest poolSize with valid data
boolean validLargeData = false;
while (!validLargeData) {
largestPoolSize = threadStats.lastKey();
ThroughputDistribution largestPoolSizeStats = getThroughputDistribution(largestPoolSize, false);;
// prune any data that is too old or outside believable range
if (pruneData(largestPoolSizeStats, forecast)) {
threadStats.remove(largestPoolSize);
} else {
validLargeData = true;
}
}
return largestPoolSize;
} } | public class class_name {
private Integer getLargestValidPoolSize(Integer poolSize, Double forecast) {
Integer largestPoolSize = -1;
// find largest poolSize with valid data
boolean validLargeData = false;
while (!validLargeData) {
largestPoolSize = threadStats.lastKey(); // depends on control dependency: [while], data = [none]
ThroughputDistribution largestPoolSizeStats = getThroughputDistribution(largestPoolSize, false);;
// prune any data that is too old or outside believable range
if (pruneData(largestPoolSizeStats, forecast)) {
threadStats.remove(largestPoolSize); // depends on control dependency: [if], data = [none]
} else {
validLargeData = true; // depends on control dependency: [if], data = [none]
}
}
return largestPoolSize;
} } |
public class class_name {
public final void ruleXFunctionTypeRef() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXbase.g:1654:2: ( ( ( rule__XFunctionTypeRef__Group__0 ) ) )
// InternalXbase.g:1655:2: ( ( rule__XFunctionTypeRef__Group__0 ) )
{
// InternalXbase.g:1655:2: ( ( rule__XFunctionTypeRef__Group__0 ) )
// InternalXbase.g:1656:3: ( rule__XFunctionTypeRef__Group__0 )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getXFunctionTypeRefAccess().getGroup());
}
// InternalXbase.g:1657:3: ( rule__XFunctionTypeRef__Group__0 )
// InternalXbase.g:1657:4: rule__XFunctionTypeRef__Group__0
{
pushFollow(FOLLOW_2);
rule__XFunctionTypeRef__Group__0();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getXFunctionTypeRefAccess().getGroup());
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} } | public class class_name {
public final void ruleXFunctionTypeRef() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXbase.g:1654:2: ( ( ( rule__XFunctionTypeRef__Group__0 ) ) )
// InternalXbase.g:1655:2: ( ( rule__XFunctionTypeRef__Group__0 ) )
{
// InternalXbase.g:1655:2: ( ( rule__XFunctionTypeRef__Group__0 ) )
// InternalXbase.g:1656:3: ( rule__XFunctionTypeRef__Group__0 )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getXFunctionTypeRefAccess().getGroup()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:1657:3: ( rule__XFunctionTypeRef__Group__0 )
// InternalXbase.g:1657:4: rule__XFunctionTypeRef__Group__0
{
pushFollow(FOLLOW_2);
rule__XFunctionTypeRef__Group__0();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getXFunctionTypeRefAccess().getGroup()); // depends on control dependency: [if], data = [none]
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} } |
public class class_name {
public static Graph filterTriples (
final Iterator<Triple> triples,
final Node... properties) {
final Graph filteredGraph = new RandomOrderGraph(RandomOrderGraph.createDefaultGraph());
final Sink<Triple> graphOutput = new SinkTriplesToGraph(true, filteredGraph);
final RDFSinkFilter rdfFilter = new RDFSinkFilter(graphOutput, properties);
rdfFilter.start();
while (triples.hasNext()) {
final Triple triple = triples.next();
rdfFilter.triple(triple);
}
rdfFilter.finish();
return filteredGraph;
} } | public class class_name {
public static Graph filterTriples (
final Iterator<Triple> triples,
final Node... properties) {
final Graph filteredGraph = new RandomOrderGraph(RandomOrderGraph.createDefaultGraph());
final Sink<Triple> graphOutput = new SinkTriplesToGraph(true, filteredGraph);
final RDFSinkFilter rdfFilter = new RDFSinkFilter(graphOutput, properties);
rdfFilter.start();
while (triples.hasNext()) {
final Triple triple = triples.next();
rdfFilter.triple(triple); // depends on control dependency: [while], data = [none]
}
rdfFilter.finish();
return filteredGraph;
} } |
public class class_name {
public long getTimeEntry(String name)
{
ZipEntry entry = zip.getEntry(name);
if (entry == null)
{
return 0L;
}
return entry.getTime();
} } | public class class_name {
public long getTimeEntry(String name)
{
ZipEntry entry = zip.getEntry(name);
if (entry == null)
{
return 0L; // depends on control dependency: [if], data = [none]
}
return entry.getTime();
} } |
public class class_name {
private void submitTaskStateEvents(JobState jobState) {
// Build Job Metadata applicable for TaskStates
ImmutableMap.Builder<String, String> jobMetadataBuilder = new ImmutableMap.Builder<>();
jobMetadataBuilder.put(METADATA_JOB_ID, jobState.getJobId());
jobMetadataBuilder.put(METADATA_JOB_NAME, jobState.getJobName());
jobMetadataBuilder.put(METADATA_JOB_TRACKING_URL, jobState.getTrackingURL().or(UNKNOWN_VALUE));
Map<String, String> jobMetadata = jobMetadataBuilder.build();
// Submit event for each TaskState
for (TaskState taskState : jobState.getTaskStates()) {
submitTaskStateEvent(taskState, jobMetadata);
}
} } | public class class_name {
private void submitTaskStateEvents(JobState jobState) {
// Build Job Metadata applicable for TaskStates
ImmutableMap.Builder<String, String> jobMetadataBuilder = new ImmutableMap.Builder<>();
jobMetadataBuilder.put(METADATA_JOB_ID, jobState.getJobId());
jobMetadataBuilder.put(METADATA_JOB_NAME, jobState.getJobName());
jobMetadataBuilder.put(METADATA_JOB_TRACKING_URL, jobState.getTrackingURL().or(UNKNOWN_VALUE));
Map<String, String> jobMetadata = jobMetadataBuilder.build();
// Submit event for each TaskState
for (TaskState taskState : jobState.getTaskStates()) {
submitTaskStateEvent(taskState, jobMetadata); // depends on control dependency: [for], data = [taskState]
}
} } |
public class class_name {
public void calculateOccupied() {
int total = 0;
for (int hypercube : hypercubes) {
if (hypercube > 0) {
total++;
}
}
occupied = new int[total];
int base = 0;
for (int i = 0; i < hypercubes.length; i++) {
if (hypercubes[i] > 0) {
occupied[base] = i;
base++;
}
}
} } | public class class_name {
public void calculateOccupied() {
int total = 0;
for (int hypercube : hypercubes) {
if (hypercube > 0) {
total++;
// depends on control dependency: [if], data = [none]
}
}
occupied = new int[total];
int base = 0;
for (int i = 0; i < hypercubes.length; i++) {
if (hypercubes[i] > 0) {
occupied[base] = i;
// depends on control dependency: [if], data = [none]
base++;
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public Credential getPrefillCredential()
{
if (this.prefillCredential == null)
{
if (cm.getSubjectFactory() == null || cm.getConnectionManagerConfiguration().getSecurityDomain() == null)
{
prefillCredential = new Credential(null, null);
}
else
{
prefillCredential =
new Credential(SecurityActions.createSubject(cm.getSubjectFactory(),
cm.getConnectionManagerConfiguration().getSecurityDomain(),
cm.getManagedConnectionFactory()),
null);
}
}
return this.prefillCredential;
} } | public class class_name {
@Override
public Credential getPrefillCredential()
{
if (this.prefillCredential == null)
{
if (cm.getSubjectFactory() == null || cm.getConnectionManagerConfiguration().getSecurityDomain() == null)
{
prefillCredential = new Credential(null, null); // depends on control dependency: [if], data = [none]
}
else
{
prefillCredential =
new Credential(SecurityActions.createSubject(cm.getSubjectFactory(),
cm.getConnectionManagerConfiguration().getSecurityDomain(),
cm.getManagedConnectionFactory()),
null); // depends on control dependency: [if], data = [none]
}
}
return this.prefillCredential;
} } |
public class class_name {
@Override
public <T> T create(final Class<T> objectType, final Class[] parameterTypes, final Object... args) {
try {
Constructor constructor = resolveConstructor(objectType, parameterTypes);
T object;
if (!ArrayUtils.isEmpty(constructor.getParameterTypes())) {
Assert.equals(ArrayUtils.nullSafeLength(constructor.getParameterTypes()), ArrayUtils.nullSafeLength(args),
"The number of arguments ({0,number,integer}) does not match the number of parameters ({1,number,integer}) for constructor ({2}) in Class ({3})!",
ArrayUtils.nullSafeLength(args), ArrayUtils.nullSafeLength(constructor.getParameterTypes()), constructor, objectType);
object = postConstruct(objectType.cast(constructor.newInstance(args)));
}
else {
object = postConstruct(objectType.cast(constructor.newInstance()), args);
}
return object;
}
catch (Exception e) {
throw new ObjectInstantiationException(String.format(
"Failed to instantiate and instance of class (%1$s) with constructor having signature (%2$s) using arguments (%3$s)!",
ClassUtils.getName(objectType), from(parameterTypes).toString(), from(args).toString()), e);
}
} } | public class class_name {
@Override
public <T> T create(final Class<T> objectType, final Class[] parameterTypes, final Object... args) {
try {
Constructor constructor = resolveConstructor(objectType, parameterTypes);
T object;
if (!ArrayUtils.isEmpty(constructor.getParameterTypes())) {
Assert.equals(ArrayUtils.nullSafeLength(constructor.getParameterTypes()), ArrayUtils.nullSafeLength(args),
"The number of arguments ({0,number,integer}) does not match the number of parameters ({1,number,integer}) for constructor ({2}) in Class ({3})!",
ArrayUtils.nullSafeLength(args), ArrayUtils.nullSafeLength(constructor.getParameterTypes()), constructor, objectType); // depends on control dependency: [if], data = [none]
object = postConstruct(objectType.cast(constructor.newInstance(args))); // depends on control dependency: [if], data = [none]
}
else {
object = postConstruct(objectType.cast(constructor.newInstance()), args); // depends on control dependency: [if], data = [none]
}
return object; // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new ObjectInstantiationException(String.format(
"Failed to instantiate and instance of class (%1$s) with constructor having signature (%2$s) using arguments (%3$s)!",
ClassUtils.getName(objectType), from(parameterTypes).toString(), from(args).toString()), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public double setWorkUnitEstSizes(Map<String, List<WorkUnit>> workUnitsByTopic) {
double totalEstDataSize = 0;
for (List<WorkUnit> workUnitsForTopic : workUnitsByTopic.values()) {
for (WorkUnit workUnit : workUnitsForTopic) {
setWorkUnitEstSize(workUnit);
totalEstDataSize += getWorkUnitEstSize(workUnit);
}
}
return totalEstDataSize;
} } | public class class_name {
public double setWorkUnitEstSizes(Map<String, List<WorkUnit>> workUnitsByTopic) {
double totalEstDataSize = 0;
for (List<WorkUnit> workUnitsForTopic : workUnitsByTopic.values()) {
for (WorkUnit workUnit : workUnitsForTopic) {
setWorkUnitEstSize(workUnit); // depends on control dependency: [for], data = [workUnit]
totalEstDataSize += getWorkUnitEstSize(workUnit); // depends on control dependency: [for], data = [workUnit]
}
}
return totalEstDataSize;
} } |
public class class_name {
public static OutputStream checkAndWrap(HttpServletRequest httpRequest,
HttpServletResponse httpResponse,
boolean requireWantsHeader) throws
IOException {
OutputStream responseStream = httpResponse.getOutputStream();
// GZIP Support handled here. First we must ensure that we want to use gzip, and that the client supports gzip
boolean acceptsGzip = Collections.list(httpRequest.getHeaders(ACCEPT_ENCODING)).stream().anyMatch(STRING_MATCH);
boolean wantGzip = httpResponse.getHeaders(CONTENT_ENCODING).contains(GZIP);
if (acceptsGzip) {
if (!requireWantsHeader || wantGzip) {
responseStream = new GZIPOutputStream(responseStream, true);
addContentEncodingHeaderIfMissing(httpResponse, wantGzip);
}
}
return responseStream;
} } | public class class_name {
public static OutputStream checkAndWrap(HttpServletRequest httpRequest,
HttpServletResponse httpResponse,
boolean requireWantsHeader) throws
IOException {
OutputStream responseStream = httpResponse.getOutputStream();
// GZIP Support handled here. First we must ensure that we want to use gzip, and that the client supports gzip
boolean acceptsGzip = Collections.list(httpRequest.getHeaders(ACCEPT_ENCODING)).stream().anyMatch(STRING_MATCH);
boolean wantGzip = httpResponse.getHeaders(CONTENT_ENCODING).contains(GZIP);
if (acceptsGzip) {
if (!requireWantsHeader || wantGzip) {
responseStream = new GZIPOutputStream(responseStream, true); // depends on control dependency: [if], data = [none]
addContentEncodingHeaderIfMissing(httpResponse, wantGzip); // depends on control dependency: [if], data = [wantGzip)]
}
}
return responseStream;
} } |
public class class_name {
synchronized void scheduleRetry(long retryInterval)
{
// Synchronized to insure a destroyed or cancelled (ivTaskHanler=null)
// timer is not re-scheduled. If the timer is in the cancelled state
// but not yet destroyed, then reset the expiration back to the last
// expiration since it was never completed successfully. If the cancel
// does rollback then schedule will be called again and re-create the
// task handler. The only side effect of this is that the retry count
// is reset; so the timer may experience more retries than configured. RTC107334
if (!ivDestroyed)
{
if (ivTaskHandler != null)
{
ivTaskHandler.scheduleRetry(retryInterval);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "scheduleRetry: not scheduled, timer in cancelled state : " + ivTaskId);
ivExpiration = ivLastExpiration;
}
}
} } | public class class_name {
synchronized void scheduleRetry(long retryInterval)
{
// Synchronized to insure a destroyed or cancelled (ivTaskHanler=null)
// timer is not re-scheduled. If the timer is in the cancelled state
// but not yet destroyed, then reset the expiration back to the last
// expiration since it was never completed successfully. If the cancel
// does rollback then schedule will be called again and re-create the
// task handler. The only side effect of this is that the retry count
// is reset; so the timer may experience more retries than configured. RTC107334
if (!ivDestroyed)
{
if (ivTaskHandler != null)
{
ivTaskHandler.scheduleRetry(retryInterval); // depends on control dependency: [if], data = [none]
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "scheduleRetry: not scheduled, timer in cancelled state : " + ivTaskId);
ivExpiration = ivLastExpiration; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
State endBinaryShift(int index) {
if (binaryShiftByteCount == 0) {
return this;
}
Token token = this.token;
token = token.addBinaryShift(index - binaryShiftByteCount, binaryShiftByteCount);
//assert token.getTotalBitCount() == this.bitCount;
return new State(token, mode, 0, this.bitCount);
} } | public class class_name {
State endBinaryShift(int index) {
if (binaryShiftByteCount == 0) {
return this; // depends on control dependency: [if], data = [none]
}
Token token = this.token;
token = token.addBinaryShift(index - binaryShiftByteCount, binaryShiftByteCount);
//assert token.getTotalBitCount() == this.bitCount;
return new State(token, mode, 0, this.bitCount);
} } |
public class class_name {
public ResultSetAndStatement performQuery(JdbcAccess jdbcAccess)
{
if (isSQLBased())
{
return jdbcAccess.executeSQL(((QueryBySQL) query).getSql(), cld, Query.SCROLLABLE);
}
else
{
return jdbcAccess.executeQuery(query, cld);
}
} } | public class class_name {
public ResultSetAndStatement performQuery(JdbcAccess jdbcAccess)
{
if (isSQLBased())
{
return jdbcAccess.executeSQL(((QueryBySQL) query).getSql(), cld, Query.SCROLLABLE);
// depends on control dependency: [if], data = [none]
}
else
{
return jdbcAccess.executeQuery(query, cld);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public int position() {
// if we are in transferTo mode, then this is the FileChannel position
if (isFCEnabled()) {
try {
return (int) fc.position();
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception in position(): " + e);
}
FFDCFilter.processException(e, CLASS_NAME + ".position", "656", this);
throw new RuntimeException(e);
}
}
return super.position();
} } | public class class_name {
@Override
public int position() {
// if we are in transferTo mode, then this is the FileChannel position
if (isFCEnabled()) {
try {
return (int) fc.position(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception in position(): " + e); // depends on control dependency: [if], data = [none]
}
FFDCFilter.processException(e, CLASS_NAME + ".position", "656", this);
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
return super.position();
} } |
public class class_name {
private void notifyRecordingStop() {
IStreamAwareScopeHandler handler = getStreamAwareHandler();
if (handler != null) {
try {
handler.streamRecordStop(this);
} catch (Throwable t) {
log.error("Error in notifyRecordingStop", t);
}
}
} } | public class class_name {
private void notifyRecordingStop() {
IStreamAwareScopeHandler handler = getStreamAwareHandler();
if (handler != null) {
try {
handler.streamRecordStop(this);
// depends on control dependency: [try], data = [none]
} catch (Throwable t) {
log.error("Error in notifyRecordingStop", t);
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public CompoundCurve toCompoundCurveFromList(
List<List<LatLng>> polylineList, boolean hasZ, boolean hasM) {
CompoundCurve compoundCurve = new CompoundCurve(hasZ, hasM);
for (List<LatLng> polyline : polylineList) {
LineString lineString = toLineString(polyline);
compoundCurve.addLineString(lineString);
}
return compoundCurve;
} } | public class class_name {
public CompoundCurve toCompoundCurveFromList(
List<List<LatLng>> polylineList, boolean hasZ, boolean hasM) {
CompoundCurve compoundCurve = new CompoundCurve(hasZ, hasM);
for (List<LatLng> polyline : polylineList) {
LineString lineString = toLineString(polyline);
compoundCurve.addLineString(lineString); // depends on control dependency: [for], data = [none]
}
return compoundCurve;
} } |
public class class_name {
SocketIOChannel getConnection(TCPConnectRequestContext connectContext, TCPConnLink tcpConnLink, SimpleSync blocking) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc,
"getConnection for local: " + connectContext.getLocalAddress() + ", remote: " + connectContext.getRemoteAddress() + ", timeout: "
+ connectContext.getConnectTimeout());
}
// create will throw an IOException or return a non-null value
SocketIOChannel ioSocket = create(connectContext.getLocalAddress(), tcpConnLink);
// set ioSocket in TCPConnLink
tcpConnLink.setSocketIOChannel(ioSocket);
boolean isConnected = ioSocket.connect(connectContext.getRemoteAddress());
// if isConnected is true, then connect happened immediately.
// This could happen even for non-blocking
if (isConnected) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "obtained connection without queuing to selector");
}
tcpConnLink.setCallCompleteLocal(true);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getConnection");
}
return ioSocket;
}
// Create new work for the nonblocking connect selector - register for
// finishConnect.
ConnectInfo ci = new ConnectInfo(connectContext, tcpConnLink, ioSocket);
ci.timeout = connectContext.getConnectTimeout();
if (blocking != null) {
// synchronous connect, so we want to do the connect work on this thread
ci.setSyncObject(blocking);
}
ci.setFinish();
workQueueMgr.queueConnectForSelector(ci);
if (blocking != null) {
// synchronous blocking call
boolean connectDone = false;
while (!connectDone) {
blocking.simpleWait();
connectDone = workQueueMgr.attemptConnectWork(ci);
}
if (ci.getAction() == ConnectInfo.FINISH_COMPLETE) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getConnection");
}
return ioSocket;
}
if (ci.getError() == null) {
// Add local and remote address information
InetSocketAddress iaRemote = ci.remoteAddress;
InetSocketAddress iaLocal = ci.localAddress;
ci.setError(new IOException("Connection could not be established. local=" + iaLocal + " remote=" + iaRemote));
}
throw ci.getError();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getConnection");
}
// Return a null to the (async) caller to indicate the connect is still in
// progress.
return null;
} } | public class class_name {
SocketIOChannel getConnection(TCPConnectRequestContext connectContext, TCPConnLink tcpConnLink, SimpleSync blocking) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc,
"getConnection for local: " + connectContext.getLocalAddress() + ", remote: " + connectContext.getRemoteAddress() + ", timeout: "
+ connectContext.getConnectTimeout());
}
// create will throw an IOException or return a non-null value
SocketIOChannel ioSocket = create(connectContext.getLocalAddress(), tcpConnLink);
// set ioSocket in TCPConnLink
tcpConnLink.setSocketIOChannel(ioSocket);
boolean isConnected = ioSocket.connect(connectContext.getRemoteAddress());
// if isConnected is true, then connect happened immediately.
// This could happen even for non-blocking
if (isConnected) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "obtained connection without queuing to selector"); // depends on control dependency: [if], data = [none]
}
tcpConnLink.setCallCompleteLocal(true);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getConnection"); // depends on control dependency: [if], data = [none]
}
return ioSocket;
}
// Create new work for the nonblocking connect selector - register for
// finishConnect.
ConnectInfo ci = new ConnectInfo(connectContext, tcpConnLink, ioSocket);
ci.timeout = connectContext.getConnectTimeout();
if (blocking != null) {
// synchronous connect, so we want to do the connect work on this thread
ci.setSyncObject(blocking);
}
ci.setFinish();
workQueueMgr.queueConnectForSelector(ci);
if (blocking != null) {
// synchronous blocking call
boolean connectDone = false;
while (!connectDone) {
blocking.simpleWait();
connectDone = workQueueMgr.attemptConnectWork(ci);
}
if (ci.getAction() == ConnectInfo.FINISH_COMPLETE) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getConnection"); // depends on control dependency: [if], data = [none]
}
return ioSocket;
}
if (ci.getError() == null) {
// Add local and remote address information
InetSocketAddress iaRemote = ci.remoteAddress;
InetSocketAddress iaLocal = ci.localAddress;
ci.setError(new IOException("Connection could not be established. local=" + iaLocal + " remote=" + iaRemote));
}
throw ci.getError();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getConnection");
}
// Return a null to the (async) caller to indicate the connect is still in
// progress.
return null;
} } |
public class class_name {
public Object newDriverInstance(
CmsDbContext dbc,
CmsConfigurationManager configurationManager,
String driverName,
List<String> successiveDrivers)
throws CmsInitException {
Class<?> driverClass = null;
I_CmsDriver driver = null;
try {
// try to get the class
driverClass = Class.forName(driverName);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_START_1, driverName));
}
// try to create a instance
driver = (I_CmsDriver)driverClass.newInstance();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_INITIALIZING_1, driverName));
}
// invoke the init-method of this access class
driver.init(dbc, configurationManager, successiveDrivers, this);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_INIT_FINISHED_0));
}
} catch (Throwable t) {
CmsMessageContainer message = Messages.get().container(
Messages.ERR_ERROR_INITIALIZING_DRIVER_1,
driverName);
if (LOG.isErrorEnabled()) {
LOG.error(message.key(), t);
}
throw new CmsInitException(message, t);
}
return driver;
} } | public class class_name {
public Object newDriverInstance(
CmsDbContext dbc,
CmsConfigurationManager configurationManager,
String driverName,
List<String> successiveDrivers)
throws CmsInitException {
Class<?> driverClass = null;
I_CmsDriver driver = null;
try {
// try to get the class
driverClass = Class.forName(driverName);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_START_1, driverName)); // depends on control dependency: [if], data = [none]
}
// try to create a instance
driver = (I_CmsDriver)driverClass.newInstance();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_INITIALIZING_1, driverName)); // depends on control dependency: [if], data = [none]
}
// invoke the init-method of this access class
driver.init(dbc, configurationManager, successiveDrivers, this);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_INIT_FINISHED_0)); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
CmsMessageContainer message = Messages.get().container(
Messages.ERR_ERROR_INITIALIZING_DRIVER_1,
driverName);
if (LOG.isErrorEnabled()) {
LOG.error(message.key(), t); // depends on control dependency: [if], data = [none]
}
throw new CmsInitException(message, t);
}
return driver;
} } |
public class class_name {
protected RecoverableUnitImpl removeRecoverableUnitMapEntries(long identity)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "removeRecoverableUnitMapEntries", new Object[] { identity, this });
final RecoverableUnitImpl recoverableUnit = (RecoverableUnitImpl) _recoverableUnits.remove(identity);
if (recoverableUnit != null)
{
_recUnitIdTable.removeId(identity);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "removeRecoverableUnitMapEntries", recoverableUnit);
return recoverableUnit;
} } | public class class_name {
protected RecoverableUnitImpl removeRecoverableUnitMapEntries(long identity)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "removeRecoverableUnitMapEntries", new Object[] { identity, this });
final RecoverableUnitImpl recoverableUnit = (RecoverableUnitImpl) _recoverableUnits.remove(identity);
if (recoverableUnit != null)
{
_recUnitIdTable.removeId(identity); // depends on control dependency: [if], data = [none]
}
if (tc.isEntryEnabled())
Tr.exit(tc, "removeRecoverableUnitMapEntries", recoverableUnit);
return recoverableUnit;
} } |
public class class_name {
public static <K, V> void unregisterCacheObject(AbstractJCache<K, V> cache, ObjectNameType objectNameType) {
Set<ObjectName> registeredObjectNames;
MBeanServer mBeanServer = cache.getMBeanServer();
if (mBeanServer != null) {
ObjectName objectName = calculateObjectName(cache, objectNameType);
registeredObjectNames = SecurityActions.queryNames(objectName, null, mBeanServer);
//should just be one
for (ObjectName registeredObjectName : registeredObjectNames) {
try {
SecurityActions.unregisterMBean(registeredObjectName, mBeanServer);
} catch (Exception e) {
throw new CacheException("Error unregistering object instance "
+ registeredObjectName + " . Error was " + e.getMessage(), e);
}
}
}
} } | public class class_name {
public static <K, V> void unregisterCacheObject(AbstractJCache<K, V> cache, ObjectNameType objectNameType) {
Set<ObjectName> registeredObjectNames;
MBeanServer mBeanServer = cache.getMBeanServer();
if (mBeanServer != null) {
ObjectName objectName = calculateObjectName(cache, objectNameType);
registeredObjectNames = SecurityActions.queryNames(objectName, null, mBeanServer); // depends on control dependency: [if], data = [none]
//should just be one
for (ObjectName registeredObjectName : registeredObjectNames) {
try {
SecurityActions.unregisterMBean(registeredObjectName, mBeanServer); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new CacheException("Error unregistering object instance "
+ registeredObjectName + " . Error was " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public URLConnection asURLConnection() {
URLConnection uc = getURLConnection();
if (uc != null) return uc;
try {
return new InputStreamURLConnection(
getResourceURLOrSystemId(),
this,
getDefaultUrlConnectionHeader());
} catch (Exception e) {
throw resolvingException(e);
}
} } | public class class_name {
public URLConnection asURLConnection() {
URLConnection uc = getURLConnection();
if (uc != null) return uc;
try {
return new InputStreamURLConnection(
getResourceURLOrSystemId(),
this,
getDefaultUrlConnectionHeader());
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw resolvingException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <S extends HttpServlet> void doOptions(
HttpServletResponse response,
Class<S> stopClass,
Class<? extends S> thisClass,
String doGet,
String doPost,
String doPut,
String doDelete,
Class<?>[] paramTypes
) {
boolean ALLOW_GET = false;
boolean ALLOW_HEAD = false;
boolean ALLOW_POST = false;
boolean ALLOW_PUT = false;
boolean ALLOW_DELETE = false;
boolean ALLOW_TRACE = true;
boolean ALLOW_OPTIONS = true;
for (
Method method
: getAllDeclaredMethods(stopClass, thisClass)
) {
if(Arrays.equals(paramTypes, method.getParameterTypes())) {
String methodName = method.getName();
if (doGet.equals(methodName)) {
ALLOW_GET = true;
ALLOW_HEAD = true;
} else if (doPost.equals(methodName)) {
ALLOW_POST = true;
} else if (doPut.equals(methodName)) {
ALLOW_PUT = true;
} else if (doDelete.equals(methodName)) {
ALLOW_DELETE = true;
}
}
}
StringBuilder allow = new StringBuilder();
if (ALLOW_GET) {
// if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_GET);
}
if (ALLOW_HEAD) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_HEAD);
}
if (ALLOW_POST) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_POST);
}
if (ALLOW_PUT) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_PUT);
}
if (ALLOW_DELETE) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_DELETE);
}
if (ALLOW_TRACE) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_TRACE);
}
if (ALLOW_OPTIONS) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_OPTIONS);
}
response.setHeader("Allow", allow.toString());
} } | public class class_name {
public static <S extends HttpServlet> void doOptions(
HttpServletResponse response,
Class<S> stopClass,
Class<? extends S> thisClass,
String doGet,
String doPost,
String doPut,
String doDelete,
Class<?>[] paramTypes
) {
boolean ALLOW_GET = false;
boolean ALLOW_HEAD = false;
boolean ALLOW_POST = false;
boolean ALLOW_PUT = false;
boolean ALLOW_DELETE = false;
boolean ALLOW_TRACE = true;
boolean ALLOW_OPTIONS = true;
for (
Method method
: getAllDeclaredMethods(stopClass, thisClass)
) {
if(Arrays.equals(paramTypes, method.getParameterTypes())) {
String methodName = method.getName();
if (doGet.equals(methodName)) {
ALLOW_GET = true; // depends on control dependency: [if], data = [none]
ALLOW_HEAD = true; // depends on control dependency: [if], data = [none]
} else if (doPost.equals(methodName)) {
ALLOW_POST = true; // depends on control dependency: [if], data = [none]
} else if (doPut.equals(methodName)) {
ALLOW_PUT = true; // depends on control dependency: [if], data = [none]
} else if (doDelete.equals(methodName)) {
ALLOW_DELETE = true; // depends on control dependency: [if], data = [none]
}
}
}
StringBuilder allow = new StringBuilder();
if (ALLOW_GET) {
// if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_GET); // depends on control dependency: [if], data = [none]
}
if (ALLOW_HEAD) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_HEAD); // depends on control dependency: [if], data = [none]
}
if (ALLOW_POST) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_POST); // depends on control dependency: [if], data = [none]
}
if (ALLOW_PUT) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_PUT); // depends on control dependency: [if], data = [none]
}
if (ALLOW_DELETE) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_DELETE); // depends on control dependency: [if], data = [none]
}
if (ALLOW_TRACE) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_TRACE); // depends on control dependency: [if], data = [none]
}
if (ALLOW_OPTIONS) {
if(allow.length() != 0) allow.append(", ");
allow.append(METHOD_OPTIONS); // depends on control dependency: [if], data = [none]
}
response.setHeader("Allow", allow.toString());
} } |
public class class_name {
@RequestMapping(value = "/gettoken", method = {RequestMethod.POST})
@ResponseBody
public ResponseMessage getToken(HttpServletRequest request, HttpServletResponse response) {
String username = StringUtil.EMPTY_STRING;
String password = StringUtil.EMPTY_STRING;
ResponseMessage result = new ResponseMessage();
try {
JSONObject json = tgtools.web.util.RequestHelper.parseRequest(request);
if (json.has("username")) {
username = json.getString("username");
}
if (json.has("password")) {
password = json.getString("password");
}
mUserService.validLoginUser(username, password);
String token = mUserService.createToken(username, request.getRemoteAddr());
result.setStatus(true);
result.setData(token);
} catch (Exception e) {
result.setStatus(false);
result.setData(e.getMessage());
}
return result;
} } | public class class_name {
@RequestMapping(value = "/gettoken", method = {RequestMethod.POST})
@ResponseBody
public ResponseMessage getToken(HttpServletRequest request, HttpServletResponse response) {
String username = StringUtil.EMPTY_STRING;
String password = StringUtil.EMPTY_STRING;
ResponseMessage result = new ResponseMessage();
try {
JSONObject json = tgtools.web.util.RequestHelper.parseRequest(request);
if (json.has("username")) {
username = json.getString("username"); // depends on control dependency: [if], data = [none]
}
if (json.has("password")) {
password = json.getString("password"); // depends on control dependency: [if], data = [none]
}
mUserService.validLoginUser(username, password); // depends on control dependency: [try], data = [none]
String token = mUserService.createToken(username, request.getRemoteAddr());
result.setStatus(true); // depends on control dependency: [try], data = [none]
result.setData(token); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
result.setStatus(false);
result.setData(e.getMessage());
} // depends on control dependency: [catch], data = [none]
return result;
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
public double getDelta(DATA oldDataPoint, DATA newDataPoint) {
if (converter == null) {
// In case no conversion/extraction is required, we can cast DATA to
// TO
// => Therefore, "unchecked" warning is suppressed for this method.
return getNestedDelta((TO) oldDataPoint, (TO) newDataPoint);
} else {
return getNestedDelta(converter.extract(oldDataPoint), converter.extract(newDataPoint));
}
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
public double getDelta(DATA oldDataPoint, DATA newDataPoint) {
if (converter == null) {
// In case no conversion/extraction is required, we can cast DATA to
// TO
// => Therefore, "unchecked" warning is suppressed for this method.
return getNestedDelta((TO) oldDataPoint, (TO) newDataPoint); // depends on control dependency: [if], data = [none]
} else {
return getNestedDelta(converter.extract(oldDataPoint), converter.extract(newDataPoint)); // depends on control dependency: [if], data = [(converter]
}
} } |
public class class_name {
@Override
public boolean shutdown(long timeout, TimeUnit unit) {
// Guard against double shutdowns (bug 8).
if (shuttingDown) {
getLogger().info("Suppressing duplicate attempt to shut down");
return false;
}
shuttingDown = true;
String baseName = mconn.getName();
mconn.setName(baseName + " - SHUTTING DOWN");
boolean rv = true;
if (connFactory.isDefaultExecutorService()) {
try {
executorService.shutdown();
} catch (Exception ex) {
getLogger().warn("Failed shutting down the ExecutorService: ", ex);
}
}
try {
// Conditionally wait
if (timeout > 0) {
mconn.setName(baseName + " - SHUTTING DOWN (waiting)");
rv = waitForQueues(timeout, unit);
}
} finally {
// But always begin the shutdown sequence
try {
mconn.setName(baseName + " - SHUTTING DOWN (telling client)");
mconn.shutdown();
mconn.setName(baseName + " - SHUTTING DOWN (informed client)");
tcService.shutdown();
//terminate all pending Auth Threads
authMonitor.interruptAllPendingAuth();
} catch (IOException e) {
getLogger().warn("exception while shutting down", e);
}
}
return rv;
} } | public class class_name {
@Override
public boolean shutdown(long timeout, TimeUnit unit) {
// Guard against double shutdowns (bug 8).
if (shuttingDown) {
getLogger().info("Suppressing duplicate attempt to shut down"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
shuttingDown = true;
String baseName = mconn.getName();
mconn.setName(baseName + " - SHUTTING DOWN");
boolean rv = true;
if (connFactory.isDefaultExecutorService()) {
try {
executorService.shutdown(); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
getLogger().warn("Failed shutting down the ExecutorService: ", ex);
} // depends on control dependency: [catch], data = [none]
}
try {
// Conditionally wait
if (timeout > 0) {
mconn.setName(baseName + " - SHUTTING DOWN (waiting)"); // depends on control dependency: [if], data = [none]
rv = waitForQueues(timeout, unit); // depends on control dependency: [if], data = [(timeout]
}
} finally {
// But always begin the shutdown sequence
try {
mconn.setName(baseName + " - SHUTTING DOWN (telling client)"); // depends on control dependency: [try], data = [none]
mconn.shutdown(); // depends on control dependency: [try], data = [none]
mconn.setName(baseName + " - SHUTTING DOWN (informed client)"); // depends on control dependency: [try], data = [none]
tcService.shutdown(); // depends on control dependency: [try], data = [none]
//terminate all pending Auth Threads
authMonitor.interruptAllPendingAuth(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
getLogger().warn("exception while shutting down", e);
} // depends on control dependency: [catch], data = [none]
}
return rv;
} } |
public class class_name {
public static List<Range<Long>> mismatches(final AlignmentPair alignmentPair) {
checkNotNull(alignmentPair);
List<Range<Long>> mismatches = new ArrayList<Range<Long>>();
int mismatchStart = -1;
for (int i = 1, length = alignmentPair.length() + 1; i < length; i++) {
if (isMismatchSymbol(alignmentPair.symbolAt(i))) {
if (mismatchStart < 0) {
mismatchStart = i;
}
}
else {
if (mismatchStart > 0) {
// biojava coordinates are 1-based
mismatches.add(Range.closedOpen(Long.valueOf(mismatchStart - 1L), Long.valueOf(i - 1L)));
mismatchStart = -1;
}
}
}
if (mismatchStart > 0) {
mismatches.add(Range.closedOpen(Long.valueOf(mismatchStart - 1L), Long.valueOf(alignmentPair.length())));
}
return mismatches;
} } | public class class_name {
public static List<Range<Long>> mismatches(final AlignmentPair alignmentPair) {
checkNotNull(alignmentPair);
List<Range<Long>> mismatches = new ArrayList<Range<Long>>();
int mismatchStart = -1;
for (int i = 1, length = alignmentPair.length() + 1; i < length; i++) {
if (isMismatchSymbol(alignmentPair.symbolAt(i))) {
if (mismatchStart < 0) {
mismatchStart = i; // depends on control dependency: [if], data = [none]
}
}
else {
if (mismatchStart > 0) {
// biojava coordinates are 1-based
mismatches.add(Range.closedOpen(Long.valueOf(mismatchStart - 1L), Long.valueOf(i - 1L))); // depends on control dependency: [if], data = [(mismatchStart]
mismatchStart = -1; // depends on control dependency: [if], data = [none]
}
}
}
if (mismatchStart > 0) {
mismatches.add(Range.closedOpen(Long.valueOf(mismatchStart - 1L), Long.valueOf(alignmentPair.length()))); // depends on control dependency: [if], data = [(mismatchStart]
}
return mismatches;
} } |
public class class_name {
@Override
public int getIntHeader(String name) {
int rc = -1;
String value = this.request.getHeader(name);
if (null != value) {
rc = Integer.parseInt(value);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getIntHeader: " + name + " " + rc);
}
return rc;
} } | public class class_name {
@Override
public int getIntHeader(String name) {
int rc = -1;
String value = this.request.getHeader(name);
if (null != value) {
rc = Integer.parseInt(value); // depends on control dependency: [if], data = [value)]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getIntHeader: " + name + " " + rc); // depends on control dependency: [if], data = [none]
}
return rc;
} } |
public class class_name {
public Content getAnnotationDetails(Content annotationDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(annotationDetailsTree));
return htmlTree;
}
return getMemberTree(annotationDetailsTree);
} } | public class class_name {
public Content getAnnotationDetails(Content annotationDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(annotationDetailsTree));
return htmlTree; // depends on control dependency: [if], data = [none]
}
return getMemberTree(annotationDetailsTree);
} } |
public class class_name {
private void checkIfQuotaExceeded(Long diskQuotaSizeInKB,
String storeName,
File dest,
Long expectedDiskSize) {
if(diskQuotaSizeInKB != null
&& diskQuotaSizeInKB != VoldemortConfig.DEFAULT_DEFAULT_STORAGE_SPACE_QUOTA_IN_KB) {
String logMessage = "Store: " + storeName + ", Destination: " + dest.getAbsolutePath()
+ ", Expected disk size in KB: "
+ (expectedDiskSize / ByteUtils.BYTES_PER_KB)
+ ", Disk quota size in KB: " + diskQuotaSizeInKB;
logger.debug(logMessage);
if(diskQuotaSizeInKB == 0L) {
String errorMessage = "Not able to find store (" + storeName +
") in this cluster according to the push URL. BnP job is not able to create new stores now." +
"Please reach out to a Voldemort admin if you think this is the correct cluster you want to push.";
logger.error(errorMessage);
throw new UnauthorizedStoreException(errorMessage);
}
// check if there is still sufficient quota left for this push
Long estimatedDiskSizeNeeded = (expectedDiskSize / ByteUtils.BYTES_PER_KB);
if(estimatedDiskSizeNeeded >= diskQuotaSizeInKB) {
String errorMessage = "Quota Exceeded for " + logMessage;
logger.error(errorMessage);
throw new QuotaExceededException(errorMessage);
}
} else {
logger.debug("store: " + storeName + " is a Non Quota type store.");
}
} } | public class class_name {
private void checkIfQuotaExceeded(Long diskQuotaSizeInKB,
String storeName,
File dest,
Long expectedDiskSize) {
if(diskQuotaSizeInKB != null
&& diskQuotaSizeInKB != VoldemortConfig.DEFAULT_DEFAULT_STORAGE_SPACE_QUOTA_IN_KB) {
String logMessage = "Store: " + storeName + ", Destination: " + dest.getAbsolutePath()
+ ", Expected disk size in KB: "
+ (expectedDiskSize / ByteUtils.BYTES_PER_KB)
+ ", Disk quota size in KB: " + diskQuotaSizeInKB; // depends on control dependency: [if], data = [none]
logger.debug(logMessage); // depends on control dependency: [if], data = [none]
if(diskQuotaSizeInKB == 0L) {
String errorMessage = "Not able to find store (" + storeName +
") in this cluster according to the push URL. BnP job is not able to create new stores now." +
"Please reach out to a Voldemort admin if you think this is the correct cluster you want to push.";
logger.error(errorMessage);
throw new UnauthorizedStoreException(errorMessage); // depends on control dependency: [if], data = [none]
}
// check if there is still sufficient quota left for this push
Long estimatedDiskSizeNeeded = (expectedDiskSize / ByteUtils.BYTES_PER_KB);
if(estimatedDiskSizeNeeded >= diskQuotaSizeInKB) {
String errorMessage = "Quota Exceeded for " + logMessage;
logger.error(errorMessage); // depends on control dependency: [if], data = [none]
throw new QuotaExceededException(errorMessage);
}
} else {
logger.debug("store: " + storeName + " is a Non Quota type store."); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected static int countMatchingFields(Tuple<? extends SemanticType.Field> lhsFields,
Tuple<? extends SemanticType.Field> rhsFields) {
int count = 0;
for (int i = 0; i != lhsFields.size(); ++i) {
for (int j = 0; j != rhsFields.size(); ++j) {
SemanticType.Field lhsField = lhsFields.get(i);
SemanticType.Field rhsField = rhsFields.get(j);
Identifier lhsFieldName = lhsField.getName();
Identifier rhsFieldName = rhsField.getName();
if (lhsFieldName.equals(rhsFieldName)) {
count = count + 1;
}
}
}
return count;
} } | public class class_name {
protected static int countMatchingFields(Tuple<? extends SemanticType.Field> lhsFields,
Tuple<? extends SemanticType.Field> rhsFields) {
int count = 0;
for (int i = 0; i != lhsFields.size(); ++i) {
for (int j = 0; j != rhsFields.size(); ++j) {
SemanticType.Field lhsField = lhsFields.get(i);
SemanticType.Field rhsField = rhsFields.get(j);
Identifier lhsFieldName = lhsField.getName();
Identifier rhsFieldName = rhsField.getName();
if (lhsFieldName.equals(rhsFieldName)) {
count = count + 1; // depends on control dependency: [if], data = [none]
}
}
}
return count;
} } |
public class class_name {
private static DoubleArrayTire loadDAT() {
long start = System.currentTimeMillis();
try {
DoubleArrayTire dat = DoubleArrayTire.loadText(DicReader.getInputStream("core.dic"), AnsjItem.class);
for (char c : NumRecognition.f_NUM) {
NumNatureAttr numAttr = ((AnsjItem) dat.getDAT()[c]).termNatures.numAttr;
if (numAttr == null || numAttr == NumNatureAttr.NULL) {
((AnsjItem) dat.getDAT()[c]).termNatures.numAttr = NumNatureAttr.NUM;
} else {
numAttr.setNum(true);
}
}
for (char c : NumRecognition.j_NUM) {
NumNatureAttr numAttr = ((AnsjItem) dat.getDAT()[c]).termNatures.numAttr;
if (numAttr == null || numAttr == NumNatureAttr.NULL) {
((AnsjItem) dat.getDAT()[c]).termNatures.numAttr = NumNatureAttr.NUM;
} else {
numAttr.setNum(true);
}
}
// 人名识别必备的
personNameFull(dat);
// 记录词典中的词语,并且清除部分数据
for (Item item : dat.getDAT()) {
if (item == null || item.getName() == null) {
continue;
}
if (item.getStatus() < 2) {
item.setName(null);
continue;
}
}
LOG.info("init core library ok use time : " + (System.currentTimeMillis() - start));
return dat;
} catch (InstantiationException e) {
LOG.warn("无法实例化", e);
} catch (IllegalAccessException e) {
LOG.warn("非法访问", e);
} catch (NumberFormatException e) {
LOG.warn("数字格式异常", e);
} catch (IOException e) {
LOG.warn("IO异常", e);
}
return null;
} } | public class class_name {
private static DoubleArrayTire loadDAT() {
long start = System.currentTimeMillis();
try {
DoubleArrayTire dat = DoubleArrayTire.loadText(DicReader.getInputStream("core.dic"), AnsjItem.class);
for (char c : NumRecognition.f_NUM) {
NumNatureAttr numAttr = ((AnsjItem) dat.getDAT()[c]).termNatures.numAttr;
if (numAttr == null || numAttr == NumNatureAttr.NULL) {
((AnsjItem) dat.getDAT()[c]).termNatures.numAttr = NumNatureAttr.NUM;
// depends on control dependency: [if], data = [none]
} else {
numAttr.setNum(true);
// depends on control dependency: [if], data = [none]
}
}
for (char c : NumRecognition.j_NUM) {
NumNatureAttr numAttr = ((AnsjItem) dat.getDAT()[c]).termNatures.numAttr;
if (numAttr == null || numAttr == NumNatureAttr.NULL) {
((AnsjItem) dat.getDAT()[c]).termNatures.numAttr = NumNatureAttr.NUM;
// depends on control dependency: [if], data = [none]
} else {
numAttr.setNum(true);
// depends on control dependency: [if], data = [none]
}
}
// 人名识别必备的
personNameFull(dat);
// depends on control dependency: [try], data = [none]
// 记录词典中的词语,并且清除部分数据
for (Item item : dat.getDAT()) {
if (item == null || item.getName() == null) {
continue;
}
if (item.getStatus() < 2) {
item.setName(null);
// depends on control dependency: [if], data = [none]
continue;
}
}
LOG.info("init core library ok use time : " + (System.currentTimeMillis() - start));
// depends on control dependency: [try], data = [none]
return dat;
// depends on control dependency: [try], data = [none]
} catch (InstantiationException e) {
LOG.warn("无法实例化", e);
} catch (IllegalAccessException e) {
// depends on control dependency: [catch], data = [none]
LOG.warn("非法访问", e);
} catch (NumberFormatException e) {
// depends on control dependency: [catch], data = [none]
LOG.warn("数字格式异常", e);
} catch (IOException e) {
// depends on control dependency: [catch], data = [none]
LOG.warn("IO异常", e);
}
// depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static RxLoaderManager get(Fragment fragment) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
throw new UnsupportedOperationException("Method only valid in api 17 and above, use RxLoaderManagerCompat to support older versions (requires support library)");
}
RxLoaderBackendNestedFragment manager = (RxLoaderBackendNestedFragment) fragment.getChildFragmentManager().findFragmentByTag(FRAGMENT_TAG);
if (manager == null) {
manager = new RxLoaderBackendNestedFragment();
fragment.getChildFragmentManager().beginTransaction().add(manager, FRAGMENT_TAG).commit();
}
return new RxLoaderManager(manager);
} } | public class class_name {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static RxLoaderManager get(Fragment fragment) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
throw new UnsupportedOperationException("Method only valid in api 17 and above, use RxLoaderManagerCompat to support older versions (requires support library)");
}
RxLoaderBackendNestedFragment manager = (RxLoaderBackendNestedFragment) fragment.getChildFragmentManager().findFragmentByTag(FRAGMENT_TAG);
if (manager == null) {
manager = new RxLoaderBackendNestedFragment(); // depends on control dependency: [if], data = [none]
fragment.getChildFragmentManager().beginTransaction().add(manager, FRAGMENT_TAG).commit(); // depends on control dependency: [if], data = [(manager]
}
return new RxLoaderManager(manager);
} } |
public class class_name {
public java.util.List<NetworkAcl> getNetworkAcls() {
if (networkAcls == null) {
networkAcls = new com.amazonaws.internal.SdkInternalList<NetworkAcl>();
}
return networkAcls;
} } | public class class_name {
public java.util.List<NetworkAcl> getNetworkAcls() {
if (networkAcls == null) {
networkAcls = new com.amazonaws.internal.SdkInternalList<NetworkAcl>(); // depends on control dependency: [if], data = [none]
}
return networkAcls;
} } |
public class class_name {
static public void configHttpFileSystemProxy(FileSystemOptions fsOptions,
String webProxyHost, Integer webProxyPort, String webProxyUserName, String webProxyPassword){
if (webProxyHost != null && webProxyPort != null){
HttpFileSystemConfigBuilder.getInstance().setProxyHost(fsOptions, webProxyHost);
HttpFileSystemConfigBuilder.getInstance().setProxyPort(fsOptions, webProxyPort);
if (webProxyUserName != null){
StaticUserAuthenticator auth = new StaticUserAuthenticator(webProxyUserName, webProxyPassword, null);
HttpFileSystemConfigBuilder.getInstance().setProxyAuthenticator(fsOptions, auth);
}
}
} } | public class class_name {
static public void configHttpFileSystemProxy(FileSystemOptions fsOptions,
String webProxyHost, Integer webProxyPort, String webProxyUserName, String webProxyPassword){
if (webProxyHost != null && webProxyPort != null){
HttpFileSystemConfigBuilder.getInstance().setProxyHost(fsOptions, webProxyHost);
// depends on control dependency: [if], data = [none]
HttpFileSystemConfigBuilder.getInstance().setProxyPort(fsOptions, webProxyPort);
// depends on control dependency: [if], data = [none]
if (webProxyUserName != null){
StaticUserAuthenticator auth = new StaticUserAuthenticator(webProxyUserName, webProxyPassword, null);
HttpFileSystemConfigBuilder.getInstance().setProxyAuthenticator(fsOptions, auth);
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public List<Object> setAttributeValues(final String name, final List<Object> values) {
List<Object> replacedValues = null;
for (final IAdditionalDescriptors additionalDescriptors : delegateDescriptors) {
final List<Object> oldValues = additionalDescriptors.setAttributeValues(name, values);
if (oldValues != null) {
if (replacedValues == null) {
replacedValues = new ArrayList<>(oldValues);
} else {
replacedValues.addAll(oldValues);
}
}
}
return replacedValues;
} } | public class class_name {
@Override
public List<Object> setAttributeValues(final String name, final List<Object> values) {
List<Object> replacedValues = null;
for (final IAdditionalDescriptors additionalDescriptors : delegateDescriptors) {
final List<Object> oldValues = additionalDescriptors.setAttributeValues(name, values);
if (oldValues != null) {
if (replacedValues == null) {
replacedValues = new ArrayList<>(oldValues); // depends on control dependency: [if], data = [none]
} else {
replacedValues.addAll(oldValues); // depends on control dependency: [if], data = [none]
}
}
}
return replacedValues;
} } |
public class class_name {
@SuppressWarnings("static-method")
protected StringConcatenationClient generateCommentFunction(
boolean forInterface, boolean forAppender,
String elementAccessor, String functionName, String comment,
TypeReference documentationAdapterType) {
return new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
it.append("\t/** Change the documentation of the element."); //$NON-NLS-1$
it.newLine();
it.append("\t *"); //$NON-NLS-1$
it.newLine();
it.append("\t * <p>"); //$NON-NLS-1$
it.append(comment);
it.newLine();
it.append("\t *"); //$NON-NLS-1$
it.newLine();
it.append("\t * @param doc the documentation."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append("void "); //$NON-NLS-1$
it.append(functionName);
it.append("(String doc)"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
if (forAppender) {
it.append("\t\tthis.builder.setDocumentation(doc);"); //$NON-NLS-1$
} else {
it.append("\t\tif ("); //$NON-NLS-1$
it.append(Strings.class);
it.append(".isEmpty(doc)) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t"); //$NON-NLS-1$
it.append(elementAccessor);
it.append(".eAdapters().removeIf(new "); //$NON-NLS-1$
it.append(Predicate.class);
it.append("<"); //$NON-NLS-1$
it.append(Adapter.class);
it.append(">() {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\tpublic boolean test("); //$NON-NLS-1$
it.append(Adapter.class);
it.append(" adapter) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\treturn adapter.isAdapterForType("); //$NON-NLS-1$
it.append(documentationAdapterType);
it.append(".class);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t}"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t});"); //$NON-NLS-1$
it.newLine();
it.append("\t\t} else {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t"); //$NON-NLS-1$
it.append(documentationAdapterType);
it.append(" adapter = ("); //$NON-NLS-1$
it.append(documentationAdapterType);
it.append(") "); //$NON-NLS-1$
it.append(EcoreUtil.class);
it.append(".getExistingAdapter("); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t"); //$NON-NLS-1$
it.append(elementAccessor);
it.append(", "); //$NON-NLS-1$
it.append(documentationAdapterType);
it.append(".class);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\tif (adapter == null) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\tadapter = new "); //$NON-NLS-1$
it.append(documentationAdapterType);
it.append("();"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t"); //$NON-NLS-1$
it.append(elementAccessor);
it.append(".eAdapters().add(adapter);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t}"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\tadapter.setDocumentation(doc);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t}"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
}
};
} } | public class class_name {
@SuppressWarnings("static-method")
protected StringConcatenationClient generateCommentFunction(
boolean forInterface, boolean forAppender,
String elementAccessor, String functionName, String comment,
TypeReference documentationAdapterType) {
return new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
it.append("\t/** Change the documentation of the element."); //$NON-NLS-1$
it.newLine();
it.append("\t *"); //$NON-NLS-1$
it.newLine();
it.append("\t * <p>"); //$NON-NLS-1$
it.append(comment);
it.newLine();
it.append("\t *"); //$NON-NLS-1$
it.newLine();
it.append("\t * @param doc the documentation."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.append("void "); //$NON-NLS-1$
it.append(functionName);
it.append("(String doc)"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append(" {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
if (forAppender) {
it.append("\t\tthis.builder.setDocumentation(doc);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append("\t\tif ("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(Strings.class); // depends on control dependency: [if], data = [none]
it.append(".isEmpty(doc)) {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\t"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(elementAccessor); // depends on control dependency: [if], data = [none]
it.append(".eAdapters().removeIf(new "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(Predicate.class); // depends on control dependency: [if], data = [none]
it.append("<"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(Adapter.class); // depends on control dependency: [if], data = [none]
it.append(">() {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\t\tpublic boolean test("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(Adapter.class); // depends on control dependency: [if], data = [none]
it.append(" adapter) {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\t\t\treturn adapter.isAdapterForType("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(documentationAdapterType); // depends on control dependency: [if], data = [none]
it.append(".class);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\t\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\t});"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t} else {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\t"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(documentationAdapterType); // depends on control dependency: [if], data = [none]
it.append(" adapter = ("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(documentationAdapterType); // depends on control dependency: [if], data = [none]
it.append(") "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(EcoreUtil.class); // depends on control dependency: [if], data = [none]
it.append(".getExistingAdapter("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\t\t\t"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(elementAccessor); // depends on control dependency: [if], data = [none]
it.append(", "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(documentationAdapterType); // depends on control dependency: [if], data = [none]
it.append(".class);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\tif (adapter == null) {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\t\tadapter = new "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(documentationAdapterType); // depends on control dependency: [if], data = [none]
it.append("();"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\t\t"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(elementAccessor); // depends on control dependency: [if], data = [none]
it.append(".eAdapters().add(adapter);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\tadapter.setDocumentation(doc);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLineIfNotEmpty();
it.newLine();
}
};
} } |
public class class_name {
public void printUserProfileActionsForLastName(String lastName) {
// Create a partial key that will allow us to start the scanner from the
// first user record that has last name equal to the one provided.
PartitionKey startKey = new PartitionKey("lastName");
// Get the scanner with the start key. Null for stopKey in the getScanner
// method indicates that the scanner will scan to the end of the table. Our
// loop will break out when it encounters a record without the last name.
EntityScanner<UserProfileActionsModel> scanner = userProfileActionsDao
.getScanner(startKey, null);
scanner.initialize();
try {
// scan until we find a last name not equal to the one provided
for (UserProfileActionsModel entity : scanner) {
if (!entity.getUserProfileModel().getLastName().equals(lastName)) {
// last name of row different, break out of the scan.
break;
}
System.out.println(entity.toString());
}
} finally {
// scanners need to be closed.
scanner.close();
}
} } | public class class_name {
public void printUserProfileActionsForLastName(String lastName) {
// Create a partial key that will allow us to start the scanner from the
// first user record that has last name equal to the one provided.
PartitionKey startKey = new PartitionKey("lastName");
// Get the scanner with the start key. Null for stopKey in the getScanner
// method indicates that the scanner will scan to the end of the table. Our
// loop will break out when it encounters a record without the last name.
EntityScanner<UserProfileActionsModel> scanner = userProfileActionsDao
.getScanner(startKey, null);
scanner.initialize();
try {
// scan until we find a last name not equal to the one provided
for (UserProfileActionsModel entity : scanner) {
if (!entity.getUserProfileModel().getLastName().equals(lastName)) {
// last name of row different, break out of the scan.
break;
}
System.out.println(entity.toString()); // depends on control dependency: [for], data = [entity]
}
} finally {
// scanners need to be closed.
scanner.close();
}
} } |
public class class_name {
Item newStringishItem(final int type, final String value) {
key2.set(type, value, null, null);
Item result = get(key2);
if (result == null) {
pool.put12(type, newUTF8(value));
result = new Item(index++, key2);
put(result);
}
return result;
} } | public class class_name {
Item newStringishItem(final int type, final String value) {
key2.set(type, value, null, null);
Item result = get(key2);
if (result == null) {
pool.put12(type, newUTF8(value)); // depends on control dependency: [if], data = [none]
result = new Item(index++, key2); // depends on control dependency: [if], data = [none]
put(result); // depends on control dependency: [if], data = [(result]
}
return result;
} } |
public class class_name {
public static Collection<LineageEventBuilder> load(Collection<? extends State> states) {
Preconditions.checkArgument(states != null && !states.isEmpty());
Set<LineageEventBuilder> allEvents = Sets.newHashSet();
for (State state : states) {
Map<String, Set<LineageEventBuilder>> branchedEvents = load(state);
branchedEvents.values().forEach(allEvents::addAll);
}
return allEvents;
} } | public class class_name {
public static Collection<LineageEventBuilder> load(Collection<? extends State> states) {
Preconditions.checkArgument(states != null && !states.isEmpty());
Set<LineageEventBuilder> allEvents = Sets.newHashSet();
for (State state : states) {
Map<String, Set<LineageEventBuilder>> branchedEvents = load(state);
branchedEvents.values().forEach(allEvents::addAll); // depends on control dependency: [for], data = [none]
}
return allEvents;
} } |
public class class_name {
protected final void setArguments(ByteBuffer bb, Object... args) {
boolean wasFirst = true;
for (Object o : args) {
if (wasFirst) {
wasFirst = false;
} else {
bb.put((byte) ' ');
}
bb.put(KeyUtil.getKeyBytes(String.valueOf(o)));
}
bb.put(CRLF);
} } | public class class_name {
protected final void setArguments(ByteBuffer bb, Object... args) {
boolean wasFirst = true;
for (Object o : args) {
if (wasFirst) {
wasFirst = false; // depends on control dependency: [if], data = [none]
} else {
bb.put((byte) ' '); // depends on control dependency: [if], data = [none]
}
bb.put(KeyUtil.getKeyBytes(String.valueOf(o))); // depends on control dependency: [for], data = [o]
}
bb.put(CRLF);
} } |
public class class_name {
public BitcoinURI processWalletNameUrl(URL url, boolean verifyTLSA) throws WalletNameLookupException {
HttpsURLConnection conn = null;
InputStream ins;
InputStreamReader isr;
BufferedReader in = null;
Certificate possibleRootCert = null;
if (verifyTLSA) {
try {
if (!this.tlsaValidator.validateTLSA(url)) {
throw new WalletNameTlsaValidationException("TLSA Validation Failed");
}
} catch (ValidSelfSignedCertException ve) {
// TLSA Uses a Self-Signed Root Cert, We Need to Add to CACerts
possibleRootCert = ve.getRootCert();
} catch (Exception e) {
throw new WalletNameTlsaValidationException("TLSA Validation Failed", e);
}
}
try {
conn = (HttpsURLConnection) url.openConnection();
// If we have a self-signed cert returned during TLSA Validation, add it to the SSLContext for the HTTPS Connection
if (possibleRootCert != null) {
try {
KeyStore ssKeystore = KeyStore.getInstance(KeyStore.getDefaultType());
ssKeystore.load(null, null);
ssKeystore.setCertificateEntry(((X509Certificate) possibleRootCert).getSubjectDN().toString(), possibleRootCert);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ssKeystore);
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, tmf.getTrustManagers(), null);
conn.setSSLSocketFactory(ctx.getSocketFactory());
} catch (Exception e) {
throw new WalletNameTlsaValidationException("Failed to Add TLSA Self Signed Certificate to HttpsURLConnection", e);
}
}
ins = conn.getInputStream();
isr = new InputStreamReader(ins);
in = new BufferedReader(isr);
String inputLine;
String data = "";
while ((inputLine = in.readLine()) != null) {
data += inputLine;
}
try {
return new BitcoinURI(data);
} catch (BitcoinURIParseException e) {
throw new WalletNameLookupException("Unable to create BitcoinURI", e);
}
} catch (IOException e) {
throw new WalletNameURLFailedException("WalletName URL Connection Failed", e);
} finally {
if (conn != null && in != null) {
try {
in.close();
} catch (IOException e) {
// Do Nothing
}
conn.disconnect();
}
}
} } | public class class_name {
public BitcoinURI processWalletNameUrl(URL url, boolean verifyTLSA) throws WalletNameLookupException {
HttpsURLConnection conn = null;
InputStream ins;
InputStreamReader isr;
BufferedReader in = null;
Certificate possibleRootCert = null;
if (verifyTLSA) {
try {
if (!this.tlsaValidator.validateTLSA(url)) {
throw new WalletNameTlsaValidationException("TLSA Validation Failed");
}
} catch (ValidSelfSignedCertException ve) {
// TLSA Uses a Self-Signed Root Cert, We Need to Add to CACerts
possibleRootCert = ve.getRootCert();
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new WalletNameTlsaValidationException("TLSA Validation Failed", e);
} // depends on control dependency: [catch], data = [none]
}
try {
conn = (HttpsURLConnection) url.openConnection();
// If we have a self-signed cert returned during TLSA Validation, add it to the SSLContext for the HTTPS Connection
if (possibleRootCert != null) {
try {
KeyStore ssKeystore = KeyStore.getInstance(KeyStore.getDefaultType());
ssKeystore.load(null, null); // depends on control dependency: [try], data = [none]
ssKeystore.setCertificateEntry(((X509Certificate) possibleRootCert).getSubjectDN().toString(), possibleRootCert); // depends on control dependency: [try], data = [none]
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ssKeystore); // depends on control dependency: [try], data = [none]
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, tmf.getTrustManagers(), null); // depends on control dependency: [try], data = [none]
conn.setSSLSocketFactory(ctx.getSocketFactory()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new WalletNameTlsaValidationException("Failed to Add TLSA Self Signed Certificate to HttpsURLConnection", e);
} // depends on control dependency: [catch], data = [none]
}
ins = conn.getInputStream();
isr = new InputStreamReader(ins);
in = new BufferedReader(isr);
String inputLine;
String data = "";
while ((inputLine = in.readLine()) != null) {
data += inputLine; // depends on control dependency: [while], data = [none]
}
try {
return new BitcoinURI(data); // depends on control dependency: [try], data = [none]
} catch (BitcoinURIParseException e) {
throw new WalletNameLookupException("Unable to create BitcoinURI", e);
} // depends on control dependency: [catch], data = [none]
} catch (IOException e) {
throw new WalletNameURLFailedException("WalletName URL Connection Failed", e);
} finally {
if (conn != null && in != null) {
try {
in.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// Do Nothing
} // depends on control dependency: [catch], data = [none]
conn.disconnect(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static String quote(String s) {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
buf.append(quote(s.charAt(i)));
}
return buf.toString();
} } | public class class_name {
public static String quote(String s) {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
buf.append(quote(s.charAt(i))); // depends on control dependency: [for], data = [i]
}
return buf.toString();
} } |
public class class_name {
public Date get(String name) throws IOException {
if (name.equalsIgnoreCase(DATE)) {
if (date == null) {
return null;
} else {
return (new Date(date.getTime())); // clone
}
} else {
throw new IOException
("Name not supported by InvalidityDateExtension");
}
} } | public class class_name {
public Date get(String name) throws IOException {
if (name.equalsIgnoreCase(DATE)) {
if (date == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
return (new Date(date.getTime())); // clone // depends on control dependency: [if], data = [(date]
}
} else {
throw new IOException
("Name not supported by InvalidityDateExtension");
}
} } |
public class class_name {
public HttpCookie getCookie(String name) {
List<HttpCookie> cookie = getCookies();
if (null != cookie) {
for (HttpCookie httpCookie : cookie) {
if (httpCookie.getName().equals(name)) {
return httpCookie;
}
}
}
return null;
} } | public class class_name {
public HttpCookie getCookie(String name) {
List<HttpCookie> cookie = getCookies();
if (null != cookie) {
for (HttpCookie httpCookie : cookie) {
if (httpCookie.getName().equals(name)) {
return httpCookie;
// depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public static Set<String> getResourceWords(String resourceFile, Class clazz) {
Assert.notNullOrEmptyTrimmed(resourceFile, "Missing resource file!");
Scanner scanner = null;
try {
InputStream resource = clazz.getResourceAsStream(resourceFile);
scanner = new Scanner(resource, UTF_8);
Set<String> list = new LinkedHashSet<>();
while (scanner.hasNext()) {
String next = scanner.next();
if (next != null && next.trim().length() > 0) {
list.add(next);
}
}
return list;
}
catch (Exception e) {
return null;
}
finally {
if (scanner != null) {
scanner.close();
}
}
} } | public class class_name {
public static Set<String> getResourceWords(String resourceFile, Class clazz) {
Assert.notNullOrEmptyTrimmed(resourceFile, "Missing resource file!");
Scanner scanner = null;
try {
InputStream resource = clazz.getResourceAsStream(resourceFile);
scanner = new Scanner(resource, UTF_8); // depends on control dependency: [try], data = [none]
Set<String> list = new LinkedHashSet<>();
while (scanner.hasNext()) {
String next = scanner.next();
if (next != null && next.trim().length() > 0) {
list.add(next); // depends on control dependency: [if], data = [(next]
}
}
return list; // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
return null;
} // depends on control dependency: [catch], data = [none]
finally {
if (scanner != null) {
scanner.close(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private HashMap duplicate(HashMap funcs, boolean deepCopy) {
if (deepCopy) throw new PageRuntimeException(new ExpressionException("deep copy not supported"));
Iterator it = funcs.entrySet().iterator();
Map.Entry entry;
HashMap cm = new HashMap();
while (it.hasNext()) {
entry = (Entry) it.next();
cm.put(entry.getKey(), deepCopy ? entry.getValue() : // TODO add support for deepcopy ((FunctionLibFunction)entry.getValue()).duplicate(deepCopy):
entry.getValue());
}
return cm;
} } | public class class_name {
private HashMap duplicate(HashMap funcs, boolean deepCopy) {
if (deepCopy) throw new PageRuntimeException(new ExpressionException("deep copy not supported"));
Iterator it = funcs.entrySet().iterator();
Map.Entry entry;
HashMap cm = new HashMap();
while (it.hasNext()) {
entry = (Entry) it.next(); // depends on control dependency: [while], data = [none]
cm.put(entry.getKey(), deepCopy ? entry.getValue() : // TODO add support for deepcopy ((FunctionLibFunction)entry.getValue()).duplicate(deepCopy):
entry.getValue()); // depends on control dependency: [while], data = [none]
}
return cm;
} } |
public class class_name {
@Override
public void setNumberFormat(NumberFormat newNumberFormat) {
// Override this method to update local zero padding number formatter
super.setNumberFormat(newNumberFormat);
initLocalZeroPaddingNumberFormat();
initializeTimeZoneFormat(true);
if (numberFormatters != null) {
numberFormatters = null;
}
if (overrideMap != null) {
overrideMap = null;
}
} } | public class class_name {
@Override
public void setNumberFormat(NumberFormat newNumberFormat) {
// Override this method to update local zero padding number formatter
super.setNumberFormat(newNumberFormat);
initLocalZeroPaddingNumberFormat();
initializeTimeZoneFormat(true);
if (numberFormatters != null) {
numberFormatters = null; // depends on control dependency: [if], data = [none]
}
if (overrideMap != null) {
overrideMap = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Map<String, Object> getBeanProperties(Object bean) {
Map<String, Object> props = new HashMap<>();
if (bean == null) {
return props;
}
Class<?> clazz = bean.getClass();
try {
//Public fields:
Field[] fields = clazz.getFields();
for (Field field : fields) {
String name = field.getName();
if (!name.equals("class")) {
props.put(field.getName(), field.get(bean));
}
}
//Getters:
BeanInfo info = Introspector.getBeanInfo(clazz);
for (PropertyDescriptor desc : info.getPropertyDescriptors()) {
Method readMethod = desc.getReadMethod();
String name = desc.getName();
if (readMethod != null && !name.equals("class")) {
props.put(desc.getName(), readMethod.invoke(bean));
}
}
return props;
} catch (IntrospectionException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
throw new UniformException("Error while getting bean object properties of class" + clazz.getName(), ex);
}
} } | public class class_name {
public static Map<String, Object> getBeanProperties(Object bean) {
Map<String, Object> props = new HashMap<>();
if (bean == null) {
return props;
// depends on control dependency: [if], data = [none]
}
Class<?> clazz = bean.getClass();
try {
//Public fields:
Field[] fields = clazz.getFields();
for (Field field : fields) {
String name = field.getName();
if (!name.equals("class")) {
props.put(field.getName(), field.get(bean));
// depends on control dependency: [if], data = [none]
}
}
//Getters:
BeanInfo info = Introspector.getBeanInfo(clazz);
for (PropertyDescriptor desc : info.getPropertyDescriptors()) {
Method readMethod = desc.getReadMethod();
String name = desc.getName();
if (readMethod != null && !name.equals("class")) {
props.put(desc.getName(), readMethod.invoke(bean));
// depends on control dependency: [if], data = [none]
}
}
return props;
// depends on control dependency: [try], data = [none]
} catch (IntrospectionException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
throw new UniformException("Error while getting bean object properties of class" + clazz.getName(), ex);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected double[] firstHitNB(Instance inst) {
int countFired = 0;
boolean fired = false;
double[] votes = new double[this.numClass];
for (int j = 0; j < this.ruleSet.size(); j++) {
if (this.ruleSet.get(j).ruleEvaluate(inst) == true) {
countFired = countFired + 1;
if (this.ruleSet.get(j).obserClassDistrib.sumOfValues() >= this.nbThresholdOption.getValue()) {
votes = NaiveBayes.doNaiveBayesPredictionLog(inst, this.ruleSet.get(j).obserClassDistrib, this.ruleSet.get(j).observers, this.ruleSet.get(j).observersGauss);
votes = exponential(votes);
votes = normalize(votes);
} else {
for (int z = 0; z < this.numClass; z++) {
votes[z] = this.ruleSet.get(j).obserClassDistrib.getValue(z)
/ this.ruleSet.get(j).obserClassDistrib.sumOfValues();
}
}
break;
}
}
if (countFired > 0) {
fired = true;
} else {
fired = false;
}
if (fired == false) {
if (super.getWeightSeen() >= this.nbThresholdOption.getValue()) {
votes = NaiveBayes.doNaiveBayesPredictionLog(inst, this.observedClassDistribution, this.attributeObservers, this.attributeObserversGauss);
votes = exponential(votes);
votes = normalize(votes);
} else {
votes = super.oberversDistribProb(inst, this.observedClassDistribution);
}
}
return votes;
} } | public class class_name {
protected double[] firstHitNB(Instance inst) {
int countFired = 0;
boolean fired = false;
double[] votes = new double[this.numClass];
for (int j = 0; j < this.ruleSet.size(); j++) {
if (this.ruleSet.get(j).ruleEvaluate(inst) == true) {
countFired = countFired + 1; // depends on control dependency: [if], data = [none]
if (this.ruleSet.get(j).obserClassDistrib.sumOfValues() >= this.nbThresholdOption.getValue()) {
votes = NaiveBayes.doNaiveBayesPredictionLog(inst, this.ruleSet.get(j).obserClassDistrib, this.ruleSet.get(j).observers, this.ruleSet.get(j).observersGauss); // depends on control dependency: [if], data = [none]
votes = exponential(votes); // depends on control dependency: [if], data = [none]
votes = normalize(votes); // depends on control dependency: [if], data = [none]
} else {
for (int z = 0; z < this.numClass; z++) {
votes[z] = this.ruleSet.get(j).obserClassDistrib.getValue(z)
/ this.ruleSet.get(j).obserClassDistrib.sumOfValues(); // depends on control dependency: [for], data = [z]
}
}
break;
}
}
if (countFired > 0) {
fired = true; // depends on control dependency: [if], data = [none]
} else {
fired = false; // depends on control dependency: [if], data = [none]
}
if (fired == false) {
if (super.getWeightSeen() >= this.nbThresholdOption.getValue()) {
votes = NaiveBayes.doNaiveBayesPredictionLog(inst, this.observedClassDistribution, this.attributeObservers, this.attributeObserversGauss); // depends on control dependency: [if], data = [none]
votes = exponential(votes); // depends on control dependency: [if], data = [none]
votes = normalize(votes); // depends on control dependency: [if], data = [none]
} else {
votes = super.oberversDistribProb(inst, this.observedClassDistribution); // depends on control dependency: [if], data = [none]
}
}
return votes;
} } |
public class class_name {
@Override
public JsonError resolveError(Throwable t, Method method, List<JsonNode> arguments) {
JsonError resolvedError;
for (ErrorResolver resolver : resolvers) {
resolvedError = resolver.resolveError(t, method, arguments);
if (resolvedError != null) {
return resolvedError;
}
}
return null;
} } | public class class_name {
@Override
public JsonError resolveError(Throwable t, Method method, List<JsonNode> arguments) {
JsonError resolvedError;
for (ErrorResolver resolver : resolvers) {
resolvedError = resolver.resolveError(t, method, arguments); // depends on control dependency: [for], data = [resolver]
if (resolvedError != null) {
return resolvedError; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override
public final String initValues(final FieldCase c) {
if (valueCallback != null) {
String v = valueCallback.getImmutableValue();
if (v != null) {
return v;
}
}
if (!init) {
if (c == FieldCase.BLANK) {
String v;
try {
v = initValuesImpl(FieldCase.AVG);
} catch (Exception e) {
throw new IllegalStateException(this + " could not generate value", e);
}
if (v != null) {
StringBuffer b = new StringBuffer(v.length());
for (int i = 0; i < v.length(); i++) {
b.append(' ');
}
value = b.toString();
}
} else {
try {
long newToken = generator.getCurrentToken();
if (token != -1 && token < newToken) {
throw new IllegalStateException(this + " is called for the second time within its initialization");
}
token = newToken;
value = initValuesImpl(c);
} catch (Exception e) {
throw new IllegalStateException(this + " could not generate value", e);
} finally {
token = -1;
}
if (c == FieldCase.NULL) {
value = null;
}
}
}
init = true;
return value;
} } | public class class_name {
@Override
public final String initValues(final FieldCase c) {
if (valueCallback != null) {
String v = valueCallback.getImmutableValue();
if (v != null) {
return v;
// depends on control dependency: [if], data = [none]
}
}
if (!init) {
if (c == FieldCase.BLANK) {
String v;
try {
v = initValuesImpl(FieldCase.AVG);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalStateException(this + " could not generate value", e);
}
// depends on control dependency: [catch], data = [none]
if (v != null) {
StringBuffer b = new StringBuffer(v.length());
for (int i = 0; i < v.length(); i++) {
b.append(' ');
// depends on control dependency: [for], data = [none]
}
value = b.toString();
// depends on control dependency: [if], data = [none]
}
} else {
try {
long newToken = generator.getCurrentToken();
if (token != -1 && token < newToken) {
throw new IllegalStateException(this + " is called for the second time within its initialization");
}
token = newToken;
// depends on control dependency: [try], data = [none]
value = initValuesImpl(c);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalStateException(this + " could not generate value", e);
} finally {
// depends on control dependency: [catch], data = [none]
token = -1;
}
if (c == FieldCase.NULL) {
value = null;
// depends on control dependency: [if], data = [none]
}
}
}
init = true;
return value;
} } |
public class class_name {
@Override
public Object put(String key, Object value) {
DeserializationState deserializationState = _deserState.get();
if (deserializationState.isDeserialized()) {
return deserializationState.deserialized.put(key, value);
}
return deserializationState.overrides.put(key, value);
} } | public class class_name {
@Override
public Object put(String key, Object value) {
DeserializationState deserializationState = _deserState.get();
if (deserializationState.isDeserialized()) {
return deserializationState.deserialized.put(key, value); // depends on control dependency: [if], data = [none]
}
return deserializationState.overrides.put(key, value);
} } |
public class class_name {
static Integer validateNonNegativeInteger(String elementName, String attributeName, String value){
try {
int intValue = Integer.parseInt(value);
if (intValue < 0){
throw new ParsingException("The " + elementName + " " + attributeName + " attribute should be a non negative integer. (greater or equal than 0)");
}
return intValue;
} catch (NumberFormatException e){
throw new ParsingException("The " + elementName + " " + attributeName + " attribute should be a non negative integer.");
}
} } | public class class_name {
static Integer validateNonNegativeInteger(String elementName, String attributeName, String value){
try {
int intValue = Integer.parseInt(value);
if (intValue < 0){
throw new ParsingException("The " + elementName + " " + attributeName + " attribute should be a non negative integer. (greater or equal than 0)");
}
return intValue; // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e){
throw new ParsingException("The " + elementName + " " + attributeName + " attribute should be a non negative integer.");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Observable<ServiceResponse<ManagementPolicyInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, ManagementPolicySchema policy) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (policy == null) {
throw new IllegalArgumentException("Parameter policy is required and cannot be null.");
}
Validator.validate(policy);
final String managementPolicyName = "default";
ManagementPolicyInner properties = new ManagementPolicyInner();
properties.withPolicy(policy);
return service.createOrUpdate(resourceGroupName, accountName, this.client.subscriptionId(), managementPolicyName, this.client.apiVersion(), this.client.acceptLanguage(), properties, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagementPolicyInner>>>() {
@Override
public Observable<ServiceResponse<ManagementPolicyInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ManagementPolicyInner> clientResponse = createOrUpdateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<ManagementPolicyInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, ManagementPolicySchema policy) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (policy == null) {
throw new IllegalArgumentException("Parameter policy is required and cannot be null.");
}
Validator.validate(policy);
final String managementPolicyName = "default";
ManagementPolicyInner properties = new ManagementPolicyInner();
properties.withPolicy(policy);
return service.createOrUpdate(resourceGroupName, accountName, this.client.subscriptionId(), managementPolicyName, this.client.apiVersion(), this.client.acceptLanguage(), properties, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagementPolicyInner>>>() {
@Override
public Observable<ServiceResponse<ManagementPolicyInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ManagementPolicyInner> clientResponse = createOrUpdateDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public String toJson(Object object) {
try {
return mapper.writeValueAsString(object);
} catch (IOException e) {
logger.warn("write to json string error:" + object, e);
return null;
}
} } | public class class_name {
public String toJson(Object object) {
try {
return mapper.writeValueAsString(object); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.warn("write to json string error:" + object, e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(DescribeSchemasRequest describeSchemasRequest, ProtocolMarshaller protocolMarshaller) {
if (describeSchemasRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeSchemasRequest.getEndpointArn(), ENDPOINTARN_BINDING);
protocolMarshaller.marshall(describeSchemasRequest.getMaxRecords(), MAXRECORDS_BINDING);
protocolMarshaller.marshall(describeSchemasRequest.getMarker(), MARKER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeSchemasRequest describeSchemasRequest, ProtocolMarshaller protocolMarshaller) {
if (describeSchemasRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeSchemasRequest.getEndpointArn(), ENDPOINTARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeSchemasRequest.getMaxRecords(), MAXRECORDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeSchemasRequest.getMarker(), MARKER_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void writeAssignments(Project project)
{
Project.Assignments assignments = m_factory.createProjectAssignments();
project.setAssignments(assignments);
List<Project.Assignments.Assignment> list = assignments.getAssignment();
for (ResourceAssignment assignment : m_projectFile.getResourceAssignments())
{
list.add(writeAssignment(assignment));
}
//
// Check to see if we have any tasks that have a percent complete value
// but do not have resource assignments. If any exist, then we must
// write a dummy resource assignment record to ensure that the MSPDI
// file shows the correct percent complete amount for the task.
//
ProjectConfig config = m_projectFile.getProjectConfig();
boolean autoUniqueID = config.getAutoAssignmentUniqueID();
if (!autoUniqueID)
{
config.setAutoAssignmentUniqueID(true);
}
for (Task task : m_projectFile.getTasks())
{
double percentComplete = NumberHelper.getDouble(task.getPercentageComplete());
if (percentComplete != 0 && task.getResourceAssignments().isEmpty() == true)
{
ResourceAssignment dummy = new ResourceAssignment(m_projectFile, task);
Duration duration = task.getDuration();
if (duration == null)
{
duration = Duration.getInstance(0, TimeUnit.HOURS);
}
double durationValue = duration.getDuration();
TimeUnit durationUnits = duration.getUnits();
double actualWork = (durationValue * percentComplete) / 100;
double remainingWork = durationValue - actualWork;
dummy.setResourceUniqueID(NULL_RESOURCE_ID);
dummy.setWork(duration);
dummy.setActualWork(Duration.getInstance(actualWork, durationUnits));
dummy.setRemainingWork(Duration.getInstance(remainingWork, durationUnits));
// Without this, MS Project will mark a 100% complete milestone as 99% complete
if (percentComplete == 100 && duration.getDuration() == 0)
{
dummy.setActualFinish(task.getActualStart());
}
list.add(writeAssignment(dummy));
}
}
config.setAutoAssignmentUniqueID(autoUniqueID);
} } | public class class_name {
private void writeAssignments(Project project)
{
Project.Assignments assignments = m_factory.createProjectAssignments();
project.setAssignments(assignments);
List<Project.Assignments.Assignment> list = assignments.getAssignment();
for (ResourceAssignment assignment : m_projectFile.getResourceAssignments())
{
list.add(writeAssignment(assignment)); // depends on control dependency: [for], data = [assignment]
}
//
// Check to see if we have any tasks that have a percent complete value
// but do not have resource assignments. If any exist, then we must
// write a dummy resource assignment record to ensure that the MSPDI
// file shows the correct percent complete amount for the task.
//
ProjectConfig config = m_projectFile.getProjectConfig();
boolean autoUniqueID = config.getAutoAssignmentUniqueID();
if (!autoUniqueID)
{
config.setAutoAssignmentUniqueID(true); // depends on control dependency: [if], data = [none]
}
for (Task task : m_projectFile.getTasks())
{
double percentComplete = NumberHelper.getDouble(task.getPercentageComplete());
if (percentComplete != 0 && task.getResourceAssignments().isEmpty() == true)
{
ResourceAssignment dummy = new ResourceAssignment(m_projectFile, task);
Duration duration = task.getDuration();
if (duration == null)
{
duration = Duration.getInstance(0, TimeUnit.HOURS); // depends on control dependency: [if], data = [none]
}
double durationValue = duration.getDuration();
TimeUnit durationUnits = duration.getUnits();
double actualWork = (durationValue * percentComplete) / 100;
double remainingWork = durationValue - actualWork;
dummy.setResourceUniqueID(NULL_RESOURCE_ID); // depends on control dependency: [if], data = [none]
dummy.setWork(duration); // depends on control dependency: [if], data = [none]
dummy.setActualWork(Duration.getInstance(actualWork, durationUnits)); // depends on control dependency: [if], data = [none]
dummy.setRemainingWork(Duration.getInstance(remainingWork, durationUnits)); // depends on control dependency: [if], data = [none]
// Without this, MS Project will mark a 100% complete milestone as 99% complete
if (percentComplete == 100 && duration.getDuration() == 0)
{
dummy.setActualFinish(task.getActualStart()); // depends on control dependency: [if], data = [none]
}
list.add(writeAssignment(dummy)); // depends on control dependency: [if], data = [none]
}
}
config.setAutoAssignmentUniqueID(autoUniqueID);
} } |
public class class_name {
public void marshall(DescribeVirtualNodeRequest describeVirtualNodeRequest, ProtocolMarshaller protocolMarshaller) {
if (describeVirtualNodeRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeVirtualNodeRequest.getMeshName(), MESHNAME_BINDING);
protocolMarshaller.marshall(describeVirtualNodeRequest.getVirtualNodeName(), VIRTUALNODENAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeVirtualNodeRequest describeVirtualNodeRequest, ProtocolMarshaller protocolMarshaller) {
if (describeVirtualNodeRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeVirtualNodeRequest.getMeshName(), MESHNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeVirtualNodeRequest.getVirtualNodeName(), VIRTUALNODENAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static Object[] paramsForStatement(AdHocPlannedStatement statement, Object[] userparams) {
// When there are no user-provided parameters, statements may have parameterized constants.
if (userparams.length > 0) {
return userparams;
} else {
return statement.extractedParamArray();
}
} } | public class class_name {
static Object[] paramsForStatement(AdHocPlannedStatement statement, Object[] userparams) {
// When there are no user-provided parameters, statements may have parameterized constants.
if (userparams.length > 0) {
return userparams; // depends on control dependency: [if], data = [none]
} else {
return statement.extractedParamArray(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getDefaultApp(Set<String> supportedApps) {
String defaultApp = getAut();
// if the launch activity is specified, just return.
if (getLaunchActivity() != null) {
return defaultApp;
}
// App version is not specified. Get the latest version from the apps store.
if (!defaultApp.contains(":")) {
return getDefaultVersion(supportedApps, defaultApp);
}
return supportedApps.contains(defaultApp) ? defaultApp : null;
} } | public class class_name {
public String getDefaultApp(Set<String> supportedApps) {
String defaultApp = getAut();
// if the launch activity is specified, just return.
if (getLaunchActivity() != null) {
return defaultApp; // depends on control dependency: [if], data = [none]
}
// App version is not specified. Get the latest version from the apps store.
if (!defaultApp.contains(":")) {
return getDefaultVersion(supportedApps, defaultApp); // depends on control dependency: [if], data = [none]
}
return supportedApps.contains(defaultApp) ? defaultApp : null;
} } |
public class class_name {
protected Node<V> cleanNodePath(int number,int layout,Node<V> currentNode)
{
if(layout<0)
{//超出范围
return null;
}
layout--;
int p=getMaskValue(number,layout);
Node<V>[] sub=currentNode.getSub();
Node<V> node=sub[p];
if(node==null)
{//不可达
return null;
}
if(layout==0)
{//到达终点
sub[p]=null;
return node;
}
Node<V> next=cleanNodePath(number, layout,node);
return next;
} } | public class class_name {
protected Node<V> cleanNodePath(int number,int layout,Node<V> currentNode)
{
if(layout<0)
{//超出范围
return null;
// depends on control dependency: [if], data = [none]
}
layout--;
int p=getMaskValue(number,layout);
Node<V>[] sub=currentNode.getSub();
Node<V> node=sub[p];
if(node==null)
{//不可达
return null;
// depends on control dependency: [if], data = [none]
}
if(layout==0)
{//到达终点
sub[p]=null;
// depends on control dependency: [if], data = [none]
return node;
// depends on control dependency: [if], data = [none]
}
Node<V> next=cleanNodePath(number, layout,node);
return next;
} } |
public class class_name {
public static String defaultButtonHtml(
CmsHtmlIconButtonStyleEnum style,
String id,
String helpId,
String name,
String helpText,
boolean enabled,
String iconPath,
String confirmationMessage,
String onClick,
boolean singleHelp,
String rightHtml) {
StringBuffer html = new StringBuffer(1024);
if (style == CmsHtmlIconButtonStyleEnum.BIG_ICON_TEXT) {
html.append("<div class='bigLink' id='img");
html.append(id);
html.append("'>\n");
}
html.append("\t<span class=\"link");
if (enabled) {
html.append("\"");
} else {
html.append(" linkdisabled\"");
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(helpText)) {
if (!singleHelp) {
html.append(" onMouseOver=\"sMH('");
html.append(id);
html.append("');\" onMouseOut=\"hMH('");
html.append(id);
html.append("');\"");
} else {
html.append(" onMouseOver=\"sMHS('");
html.append(id);
html.append("', '");
html.append(helpId);
html.append("');\" onMouseOut=\"hMH('");
html.append(id);
html.append("', '");
html.append(helpId);
html.append("');\"");
}
}
if (enabled && CmsStringUtil.isNotEmptyOrWhitespaceOnly(onClick)) {
html.append(" onClick=\"");
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(confirmationMessage)) {
html.append("if (confirm('" + CmsStringUtil.escapeJavaScript(confirmationMessage) + "')) {");
}
html.append(onClick);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(confirmationMessage)) {
html.append(" }");
}
html.append("\"");
}
if (style == CmsHtmlIconButtonStyleEnum.SMALL_ICON_ONLY) {
html.append(" title='");
html.append(name);
html.append("'");
}
html.append(">");
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(iconPath)) {
html.append("<img src='");
html.append(CmsWorkplace.getSkinUri());
if (!enabled) {
StringBuffer icon = new StringBuffer(128);
icon.append(iconPath.substring(0, iconPath.lastIndexOf('.')));
icon.append("_disabled");
icon.append(iconPath.substring(iconPath.lastIndexOf('.')));
String resourcesRoot = OpenCms.getSystemInfo().getWebApplicationRfsPath() + "resources/";
File test = new File(resourcesRoot + icon.toString());
if (test.exists()) {
html.append(icon);
} else {
html.append(iconPath);
}
} else {
html.append(iconPath);
}
html.append("'");
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(helpText)) {
html.append(" alt='");
html.append(helpText);
html.append("'");
html.append(" title='");
html.append(helpText);
html.append("'");
}
html.append(">");
if (style == CmsHtmlIconButtonStyleEnum.BIG_ICON_TEXT) {
html.append("<br>");
}
}
if ((style != CmsHtmlIconButtonStyleEnum.SMALL_ICON_ONLY) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(name)) {
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(iconPath)
&& (style != CmsHtmlIconButtonStyleEnum.BIG_ICON_TEXT)) {
html.append(" ");
}
if (enabled) {
if (style != CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT) {
html.append("<a href='#'>");
} else {
html.append("<a href='#' style='white-space: nowrap;'>");
}
}
html.append(name);
if (enabled) {
html.append("</a>");
}
// doesn't work in new dialog for the radio button cols
// couldn't find a place where this is needed
// if (style != CmsHtmlIconButtonStyleEnum.BIG_ICON_TEXT && name.length() > 1) {
// html.append(" ");
// }
}
html.append("</span>");
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(rightHtml)) {
html.append(rightHtml);
}
if (style == CmsHtmlIconButtonStyleEnum.BIG_ICON_TEXT) {
html.append("</div>\n");
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(helpText) && !singleHelp) {
html.append("<div class='help' id='help");
html.append(helpId);
html.append("' onMouseOver=\"sMH('");
html.append(id);
html.append("');\" onMouseOut=\"hMH('");
html.append(id);
html.append("');\">");
html.append(helpText);
html.append("</div>\n");
}
return html.toString();
} } | public class class_name {
public static String defaultButtonHtml(
CmsHtmlIconButtonStyleEnum style,
String id,
String helpId,
String name,
String helpText,
boolean enabled,
String iconPath,
String confirmationMessage,
String onClick,
boolean singleHelp,
String rightHtml) {
StringBuffer html = new StringBuffer(1024);
if (style == CmsHtmlIconButtonStyleEnum.BIG_ICON_TEXT) {
html.append("<div class='bigLink' id='img");
html.append(id);
html.append("'>\n"); // depends on control dependency: [if], data = [none]
}
html.append("\t<span class=\"link");
if (enabled) {
html.append("\""); // depends on control dependency: [if], data = [none]
} else {
html.append(" linkdisabled\""); // depends on control dependency: [if], data = [none]
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(helpText)) {
if (!singleHelp) {
html.append(" onMouseOver=\"sMH('");
html.append(id);
html.append("');\" onMouseOut=\"hMH('");
html.append(id);
html.append("');\""); // depends on control dependency: [if], data = [none]
} else {
html.append(" onMouseOver=\"sMHS('");
html.append(id);
html.append("', '");
html.append(helpId);
html.append("');\" onMouseOut=\"hMH('");
html.append(id);
html.append("', '");
html.append(helpId);
html.append("');\""); // depends on control dependency: [if], data = [none]
}
}
if (enabled && CmsStringUtil.isNotEmptyOrWhitespaceOnly(onClick)) {
html.append(" onClick=\""); // depends on control dependency: [if], data = [none]
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(confirmationMessage)) {
html.append("if (confirm('" + CmsStringUtil.escapeJavaScript(confirmationMessage) + "')) {"); // depends on control dependency: [if], data = [none]
}
html.append(onClick); // depends on control dependency: [if], data = [none]
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(confirmationMessage)) {
html.append(" }"); // depends on control dependency: [if], data = [none]
}
html.append("\""); // depends on control dependency: [if], data = [none]
}
if (style == CmsHtmlIconButtonStyleEnum.SMALL_ICON_ONLY) {
html.append(" title='");
html.append(name);
html.append("'"); // depends on control dependency: [if], data = [none]
}
html.append(">");
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(iconPath)) {
html.append("<img src='");
html.append(CmsWorkplace.getSkinUri());
if (!enabled) {
StringBuffer icon = new StringBuffer(128);
icon.append(iconPath.substring(0, iconPath.lastIndexOf('.'))); // depends on control dependency: [if], data = [none]
icon.append("_disabled"); // depends on control dependency: [if], data = [none]
icon.append(iconPath.substring(iconPath.lastIndexOf('.'))); // depends on control dependency: [if], data = [none]
String resourcesRoot = OpenCms.getSystemInfo().getWebApplicationRfsPath() + "resources/";
File test = new File(resourcesRoot + icon.toString());
if (test.exists()) {
html.append(icon); // depends on control dependency: [if], data = [none]
} else {
html.append(iconPath); // depends on control dependency: [if], data = [none]
}
} else {
html.append(iconPath); // depends on control dependency: [if], data = [none]
}
html.append("'");
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(helpText)) {
html.append(" alt='");
html.append(helpText);
html.append("'"); // depends on control dependency: [if], data = [none]
html.append(" title='");
html.append(helpText);
html.append("'"); // depends on control dependency: [if], data = [none]
}
html.append(">");
if (style == CmsHtmlIconButtonStyleEnum.BIG_ICON_TEXT) {
html.append("<br>"); // depends on control dependency: [if], data = [none]
}
}
if ((style != CmsHtmlIconButtonStyleEnum.SMALL_ICON_ONLY) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(name)) {
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(iconPath)
&& (style != CmsHtmlIconButtonStyleEnum.BIG_ICON_TEXT)) {
html.append(" "); // depends on control dependency: [if], data = [none]
}
if (enabled) {
if (style != CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT) {
html.append("<a href='#'>"); // depends on control dependency: [if], data = [none]
} else {
html.append("<a href='#' style='white-space: nowrap;'>"); // depends on control dependency: [if], data = [none]
}
}
html.append(name);
if (enabled) {
html.append("</a>"); // depends on control dependency: [if], data = [none]
}
// doesn't work in new dialog for the radio button cols
// couldn't find a place where this is needed
// if (style != CmsHtmlIconButtonStyleEnum.BIG_ICON_TEXT && name.length() > 1) {
// html.append(" ");
// }
}
html.append("</span>");
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(rightHtml)) {
html.append(rightHtml);
}
if (style == CmsHtmlIconButtonStyleEnum.BIG_ICON_TEXT) {
html.append("</div>\n");
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(helpText) && !singleHelp) {
html.append("<div class='help' id='help");
html.append(helpId);
html.append("' onMouseOver=\"sMH('");
html.append(id);
html.append("');\" onMouseOut=\"hMH('");
html.append(id);
html.append("');\">");
html.append(helpText);
html.append("</div>\n");
}
return html.toString();
} } |
public class class_name {
public void add(Status newStatus) {
// LBCORE-72: fire event before the count check
fireStatusAddEvent(newStatus);
count++;
if (newStatus.getLevel() > level) {
level = newStatus.getLevel();
}
synchronized (statusListLock) {
if (statusList.size() < MAX_HEADER_COUNT) {
statusList.add(newStatus);
} else {
tailBuffer.add(newStatus);
}
}
} } | public class class_name {
public void add(Status newStatus) {
// LBCORE-72: fire event before the count check
fireStatusAddEvent(newStatus);
count++;
if (newStatus.getLevel() > level) {
level = newStatus.getLevel(); // depends on control dependency: [if], data = [none]
}
synchronized (statusListLock) {
if (statusList.size() < MAX_HEADER_COUNT) {
statusList.add(newStatus); // depends on control dependency: [if], data = [none]
} else {
tailBuffer.add(newStatus); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public BaseDestinationHandler getDestination()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getDestination");
SibTr.exit(tc, "getDestination", _baseDestHandler);
}
return _baseDestHandler;
} } | public class class_name {
public BaseDestinationHandler getDestination()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getDestination"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "getDestination", _baseDestHandler); // depends on control dependency: [if], data = [none]
}
return _baseDestHandler;
} } |
public class class_name {
@Override
public void notifyClients()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "notifyClients");
long totalItems = getTotalMsgCount();
synchronized (this)
{
if (wlmRemoved && ((_destLowMsgs == -1) || (totalItems <= _destLowMsgs)))
{
wlmRemoved = false;
// re-advertise destination PUT on WLM
if (!destinationHandler.isTemporary())
{
updatePutRegistration(true);
destinationHandler.requestReallocation();
}
// Fire event if event notification is enabled
// Also check for logging of events (510343)
if (_isEventNotificationEnabled ||
(mp.getCustomProperties().getOutputLinkThresholdEventsToLog() && destinationHandler.isLink()) ||
(mp.getCustomProperties().getOutputDestinationThresholdEventsToLog() && !destinationHandler.isLink()))
{
fireDepthThresholdReachedEvent(getControlAdapter(),
false,
totalItems, _destLowMsgs); // Reached low
}
}
else if (!wlmRemoved
&& (_destHighMsgs != -1)
&& (_destLowMsgs != -1)
&& (totalItems >= _destHighMsgs))
{
wlmRemoved = true;
// remove destination PUT advertisement on WLM
if (!destinationHandler.isTemporary())
{
updatePutRegistration(false);
wlmRemoved = true;
}
// Fire event if event notification is enabled
// Also check for logging of events (510343)
if (_isEventNotificationEnabled ||
(mp.getCustomProperties().getOutputLinkThresholdEventsToLog() && destinationHandler.isLink()) ||
(mp.getCustomProperties().getOutputDestinationThresholdEventsToLog() && !destinationHandler.isLink()))
{
fireDepthThresholdReachedEvent(getControlAdapter(),
true,
totalItems, _destHighMsgs); // Reached High
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "notifyClients", new Boolean(!wlmRemoved));
} } | public class class_name {
@Override
public void notifyClients()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "notifyClients");
long totalItems = getTotalMsgCount();
synchronized (this)
{
if (wlmRemoved && ((_destLowMsgs == -1) || (totalItems <= _destLowMsgs)))
{
wlmRemoved = false; // depends on control dependency: [if], data = [none]
// re-advertise destination PUT on WLM
if (!destinationHandler.isTemporary())
{
updatePutRegistration(true); // depends on control dependency: [if], data = [none]
destinationHandler.requestReallocation(); // depends on control dependency: [if], data = [none]
}
// Fire event if event notification is enabled
// Also check for logging of events (510343)
if (_isEventNotificationEnabled ||
(mp.getCustomProperties().getOutputLinkThresholdEventsToLog() && destinationHandler.isLink()) ||
(mp.getCustomProperties().getOutputDestinationThresholdEventsToLog() && !destinationHandler.isLink()))
{
fireDepthThresholdReachedEvent(getControlAdapter(),
false,
totalItems, _destLowMsgs); // Reached low // depends on control dependency: [if], data = [none]
}
}
else if (!wlmRemoved
&& (_destHighMsgs != -1)
&& (_destLowMsgs != -1)
&& (totalItems >= _destHighMsgs))
{
wlmRemoved = true; // depends on control dependency: [if], data = [none]
// remove destination PUT advertisement on WLM
if (!destinationHandler.isTemporary())
{
updatePutRegistration(false); // depends on control dependency: [if], data = [none]
wlmRemoved = true; // depends on control dependency: [if], data = [none]
}
// Fire event if event notification is enabled
// Also check for logging of events (510343)
if (_isEventNotificationEnabled ||
(mp.getCustomProperties().getOutputLinkThresholdEventsToLog() && destinationHandler.isLink()) ||
(mp.getCustomProperties().getOutputDestinationThresholdEventsToLog() && !destinationHandler.isLink()))
{
fireDepthThresholdReachedEvent(getControlAdapter(),
true,
totalItems, _destHighMsgs); // Reached High // depends on control dependency: [if], data = [none]
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "notifyClients", new Boolean(!wlmRemoved));
} } |
public class class_name {
public SpotFleetLaunchSpecification withTagSpecifications(SpotFleetTagSpecification... tagSpecifications) {
if (this.tagSpecifications == null) {
setTagSpecifications(new com.amazonaws.internal.SdkInternalList<SpotFleetTagSpecification>(tagSpecifications.length));
}
for (SpotFleetTagSpecification ele : tagSpecifications) {
this.tagSpecifications.add(ele);
}
return this;
} } | public class class_name {
public SpotFleetLaunchSpecification withTagSpecifications(SpotFleetTagSpecification... tagSpecifications) {
if (this.tagSpecifications == null) {
setTagSpecifications(new com.amazonaws.internal.SdkInternalList<SpotFleetTagSpecification>(tagSpecifications.length)); // depends on control dependency: [if], data = [none]
}
for (SpotFleetTagSpecification ele : tagSpecifications) {
this.tagSpecifications.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public List<?> getRequestValue(final Request request) {
if (isPresent(request)) {
return getNewOptions(request.getParameterValues(getId()));
} else {
return getOptions();
}
} } | public class class_name {
@Override
public List<?> getRequestValue(final Request request) {
if (isPresent(request)) {
return getNewOptions(request.getParameterValues(getId())); // depends on control dependency: [if], data = [none]
} else {
return getOptions(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean classifyMethodNoArgs(ExecutableElement method) {
String methodName = method.getSimpleName().toString();
TypeMirror returnType = builderMethodReturnType(method);
ExecutableElement getter = getterNameToGetter.get(methodName);
if (getter != null) {
return classifyGetter(method, getter);
}
if (methodName.endsWith("Builder")) {
String property = methodName.substring(0, methodName.length() - "Builder".length());
if (getterToPropertyName.containsValue(property)) {
PropertyBuilderClassifier propertyBuilderClassifier =
new PropertyBuilderClassifier(
errorReporter, typeUtils, elementUtils, this, getterToPropertyName, eclipseHack);
Optional<PropertyBuilder> propertyBuilder =
propertyBuilderClassifier.makePropertyBuilder(method, property);
if (propertyBuilder.isPresent()) {
propertyNameToPropertyBuilder.put(property, propertyBuilder.get());
return true;
} else {
return false;
}
}
}
if (TYPE_EQUIVALENCE.equivalent(returnType, autoValueClass.asType())) {
buildMethods.add(method);
return true;
}
String error =
String.format(
"Method without arguments should be a build method returning %1$s%2$s"
+ " or a getter method with the same name and type as a getter method of %1$s",
autoValueClass, typeParamsString());
errorReporter.reportError(error, method);
return false;
} } | public class class_name {
private boolean classifyMethodNoArgs(ExecutableElement method) {
String methodName = method.getSimpleName().toString();
TypeMirror returnType = builderMethodReturnType(method);
ExecutableElement getter = getterNameToGetter.get(methodName);
if (getter != null) {
return classifyGetter(method, getter); // depends on control dependency: [if], data = [none]
}
if (methodName.endsWith("Builder")) {
String property = methodName.substring(0, methodName.length() - "Builder".length());
if (getterToPropertyName.containsValue(property)) {
PropertyBuilderClassifier propertyBuilderClassifier =
new PropertyBuilderClassifier(
errorReporter, typeUtils, elementUtils, this, getterToPropertyName, eclipseHack);
Optional<PropertyBuilder> propertyBuilder =
propertyBuilderClassifier.makePropertyBuilder(method, property);
if (propertyBuilder.isPresent()) {
propertyNameToPropertyBuilder.put(property, propertyBuilder.get()); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
}
}
if (TYPE_EQUIVALENCE.equivalent(returnType, autoValueClass.asType())) {
buildMethods.add(method); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
String error =
String.format(
"Method without arguments should be a build method returning %1$s%2$s"
+ " or a getter method with the same name and type as a getter method of %1$s",
autoValueClass, typeParamsString());
errorReporter.reportError(error, method);
return false;
} } |
public class class_name {
public void setLocation(float x, float y) {
if (area != null) {
area.setX(x);
area.setY(y);
}
} } | public class class_name {
public void setLocation(float x, float y) {
if (area != null) {
area.setX(x);
// depends on control dependency: [if], data = [none]
area.setY(y);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected BeanOCallDispatchToken callDispatchEventListeners
(int dispatchEventCode,
BeanOCallDispatchToken token)
{
DispatchEventListenerManager dispatchEventListenerManager = container.ivDispatchEventListenerManager; // d646413.2
DispatchEventListenerCookie[] dispatchEventListenerCookies = null;
EJBMethodMetaData methodMetaData = null;
BeanOCallDispatchToken retToken = null;
boolean doBeforeDispatch = false;
boolean doAfterDispatch = false;
// first check if listeners are active, if not skip everything else ...
if (dispatchEventListenerManager != null &&
dispatchEventListenerManager.dispatchEventListenersAreActive()) // @539186C, d646413.2
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "callDispatchEventListeners: " + dispatchEventCode + ", " + this);
// if one of the "before" callbacks
//
// Build temporary EJBMethodInfo object to represent this callback method.
// If no dispatch cookies assigned to this bean, create new cookie array.
// If no dispatch context on thread, this is not method dispatch, but rather
// is end of tran processing.
//
if (dispatchEventCode == DispatchEventListener.BEFORE_EJBACTIVATE ||
dispatchEventCode == DispatchEventListener.BEFORE_EJBLOAD ||
dispatchEventCode == DispatchEventListener.BEFORE_EJBSTORE ||
dispatchEventCode == DispatchEventListener.BEFORE_EJBPASSIVATE) {
methodMetaData = buildTempEJBMethodMetaData(dispatchEventCode, home.getBeanMetaData());
retToken = new BeanOCallDispatchToken(); // return value to communicate between "before" and "after" call
retToken.setMethodMetaData(methodMetaData); // save away methodMetaData object for "after" call
// d646413.2 - Check if a dispatch context was already created
// for this bean by EJSContainer.preInvoke.
EJSDeployedSupport s = EJSContainer.getMethodContext();
if (s != null && s.beanO == this) // d646413.2
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "using dispatch context from method context");
// use cookie array already assigned to bean for "after" callback
dispatchEventListenerCookies = s.ivDispatchEventListenerCookies; // @MD11200.6A
}
if (dispatchEventListenerCookies == null)
{
// create new cookie array - @MD11200.6A
dispatchEventListenerCookies = dispatchEventListenerManager.getNewDispatchEventListenerCookieArray(); // @MD11200.6A
doBeforeDispatch = true; // must drive beforeDispatch to collect cookies from event listeners - // @MD11200.6A
retToken.setDoAfterDispatch(true); /*
* since doing beforeDispatch on "before" callback, must issue afterDispatch
* during "after" callback
*/
}
// save cookie array in token for "after" call
retToken.setDispatchEventListenerCookies(dispatchEventListenerCookies); // @MD11200.6A
}
// else if one of the "after" callbacks
//
// get methodInfo and dispatch cookies from input token
// plus check "afterDispatch" flag to see if beforeDispatch was issued
// when "before" callback was done and if we now have to do afterDispatch
// call to finish up
else if (dispatchEventCode == DispatchEventListener.AFTER_EJBACTIVATE ||
dispatchEventCode == DispatchEventListener.AFTER_EJBLOAD ||
dispatchEventCode == DispatchEventListener.AFTER_EJBSTORE ||
dispatchEventCode == DispatchEventListener.AFTER_EJBPASSIVATE) {
methodMetaData = token.getMethodMetaData(); // @MD11200.6A
doAfterDispatch = token.getDoAfterDispatch(); // @MD11200.6A d621610
dispatchEventListenerCookies = token.getDispatchEventListenerCookies(); // @MD11200.6A
}
if (doBeforeDispatch) { // @MD11200.6A
dispatchEventListenerManager.callDispatchEventListeners(DispatchEventListener.BEGIN_DISPATCH, dispatchEventListenerCookies, methodMetaData); // @MD11200.6A
} // @MD11200.6A
dispatchEventListenerManager.callDispatchEventListeners(dispatchEventCode, dispatchEventListenerCookies, methodMetaData); // @MD11200.6A
if (doAfterDispatch) { // @MD11200.6A
dispatchEventListenerManager.callDispatchEventListeners(DispatchEventListener.END_DISPATCH, dispatchEventListenerCookies, methodMetaData); // @MD11200.6A
} // @MD11200.6A
if (isTraceOn && tc.isEntryEnabled()) { // @MD11200.6A
Tr.exit(tc, "callDispatchEventListeners", retToken); // @MD11200.6A
} // @MD11200.6A
} // if listeners are active
return retToken;
} } | public class class_name {
protected BeanOCallDispatchToken callDispatchEventListeners
(int dispatchEventCode,
BeanOCallDispatchToken token)
{
DispatchEventListenerManager dispatchEventListenerManager = container.ivDispatchEventListenerManager; // d646413.2
DispatchEventListenerCookie[] dispatchEventListenerCookies = null;
EJBMethodMetaData methodMetaData = null;
BeanOCallDispatchToken retToken = null;
boolean doBeforeDispatch = false;
boolean doAfterDispatch = false;
// first check if listeners are active, if not skip everything else ...
if (dispatchEventListenerManager != null &&
dispatchEventListenerManager.dispatchEventListenersAreActive()) // @539186C, d646413.2
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "callDispatchEventListeners: " + dispatchEventCode + ", " + this);
// if one of the "before" callbacks
//
// Build temporary EJBMethodInfo object to represent this callback method.
// If no dispatch cookies assigned to this bean, create new cookie array.
// If no dispatch context on thread, this is not method dispatch, but rather
// is end of tran processing.
//
if (dispatchEventCode == DispatchEventListener.BEFORE_EJBACTIVATE ||
dispatchEventCode == DispatchEventListener.BEFORE_EJBLOAD ||
dispatchEventCode == DispatchEventListener.BEFORE_EJBSTORE ||
dispatchEventCode == DispatchEventListener.BEFORE_EJBPASSIVATE) {
methodMetaData = buildTempEJBMethodMetaData(dispatchEventCode, home.getBeanMetaData()); // depends on control dependency: [if], data = [(dispatchEventCode]
retToken = new BeanOCallDispatchToken(); // return value to communicate between "before" and "after" call // depends on control dependency: [if], data = [none]
retToken.setMethodMetaData(methodMetaData); // save away methodMetaData object for "after" call // depends on control dependency: [if], data = [none]
// d646413.2 - Check if a dispatch context was already created
// for this bean by EJSContainer.preInvoke.
EJSDeployedSupport s = EJSContainer.getMethodContext();
if (s != null && s.beanO == this) // d646413.2
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "using dispatch context from method context");
// use cookie array already assigned to bean for "after" callback
dispatchEventListenerCookies = s.ivDispatchEventListenerCookies; // @MD11200.6A // depends on control dependency: [if], data = [none]
}
if (dispatchEventListenerCookies == null)
{
// create new cookie array - @MD11200.6A
dispatchEventListenerCookies = dispatchEventListenerManager.getNewDispatchEventListenerCookieArray(); // @MD11200.6A // depends on control dependency: [if], data = [none]
doBeforeDispatch = true; // must drive beforeDispatch to collect cookies from event listeners - // @MD11200.6A // depends on control dependency: [if], data = [none]
retToken.setDoAfterDispatch(true); /* // depends on control dependency: [if], data = [none]
* since doing beforeDispatch on "before" callback, must issue afterDispatch
* during "after" callback
*/
}
// save cookie array in token for "after" call
retToken.setDispatchEventListenerCookies(dispatchEventListenerCookies); // @MD11200.6A // depends on control dependency: [if], data = [none]
}
// else if one of the "after" callbacks
//
// get methodInfo and dispatch cookies from input token
// plus check "afterDispatch" flag to see if beforeDispatch was issued
// when "before" callback was done and if we now have to do afterDispatch
// call to finish up
else if (dispatchEventCode == DispatchEventListener.AFTER_EJBACTIVATE ||
dispatchEventCode == DispatchEventListener.AFTER_EJBLOAD ||
dispatchEventCode == DispatchEventListener.AFTER_EJBSTORE ||
dispatchEventCode == DispatchEventListener.AFTER_EJBPASSIVATE) {
methodMetaData = token.getMethodMetaData(); // @MD11200.6A // depends on control dependency: [if], data = [none]
doAfterDispatch = token.getDoAfterDispatch(); // @MD11200.6A d621610 // depends on control dependency: [if], data = [none]
dispatchEventListenerCookies = token.getDispatchEventListenerCookies(); // @MD11200.6A // depends on control dependency: [if], data = [none]
}
if (doBeforeDispatch) { // @MD11200.6A
dispatchEventListenerManager.callDispatchEventListeners(DispatchEventListener.BEGIN_DISPATCH, dispatchEventListenerCookies, methodMetaData); // @MD11200.6A // depends on control dependency: [if], data = [none]
} // @MD11200.6A
dispatchEventListenerManager.callDispatchEventListeners(dispatchEventCode, dispatchEventListenerCookies, methodMetaData); // @MD11200.6A // depends on control dependency: [if], data = [none]
if (doAfterDispatch) { // @MD11200.6A
dispatchEventListenerManager.callDispatchEventListeners(DispatchEventListener.END_DISPATCH, dispatchEventListenerCookies, methodMetaData); // @MD11200.6A // depends on control dependency: [if], data = [none]
} // @MD11200.6A
if (isTraceOn && tc.isEntryEnabled()) { // @MD11200.6A
Tr.exit(tc, "callDispatchEventListeners", retToken); // @MD11200.6A // depends on control dependency: [if], data = [none]
} // @MD11200.6A
} // if listeners are active
return retToken;
} } |
public class class_name {
public Observable<ServiceResponse<Page<PremierAddOnOfferInner>>> listPremierAddOnOffersNextWithServiceResponseAsync(final String nextPageLink) {
return listPremierAddOnOffersNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<PremierAddOnOfferInner>>, Observable<ServiceResponse<Page<PremierAddOnOfferInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PremierAddOnOfferInner>>> call(ServiceResponse<Page<PremierAddOnOfferInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listPremierAddOnOffersNextWithServiceResponseAsync(nextPageLink));
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<PremierAddOnOfferInner>>> listPremierAddOnOffersNextWithServiceResponseAsync(final String nextPageLink) {
return listPremierAddOnOffersNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<PremierAddOnOfferInner>>, Observable<ServiceResponse<Page<PremierAddOnOfferInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PremierAddOnOfferInner>>> call(ServiceResponse<Page<PremierAddOnOfferInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(listPremierAddOnOffersNextWithServiceResponseAsync(nextPageLink));
}
});
} } |
public class class_name {
public AwsSecurityFindingFilters withResourceId(StringFilter... resourceId) {
if (this.resourceId == null) {
setResourceId(new java.util.ArrayList<StringFilter>(resourceId.length));
}
for (StringFilter ele : resourceId) {
this.resourceId.add(ele);
}
return this;
} } | public class class_name {
public AwsSecurityFindingFilters withResourceId(StringFilter... resourceId) {
if (this.resourceId == null) {
setResourceId(new java.util.ArrayList<StringFilter>(resourceId.length)); // depends on control dependency: [if], data = [none]
}
for (StringFilter ele : resourceId) {
this.resourceId.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static void w(String tag, String msg, Throwable throwable) {
if (sLevel > LEVEL_WARNING) {
return;
}
Log.w(tag, msg, throwable);
} } | public class class_name {
public static void w(String tag, String msg, Throwable throwable) {
if (sLevel > LEVEL_WARNING) {
return; // depends on control dependency: [if], data = [none]
}
Log.w(tag, msg, throwable);
} } |
public class class_name {
public void marshall(MetricDefinition metricDefinition, ProtocolMarshaller protocolMarshaller) {
if (metricDefinition == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(metricDefinition.getName(), NAME_BINDING);
protocolMarshaller.marshall(metricDefinition.getRegex(), REGEX_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(MetricDefinition metricDefinition, ProtocolMarshaller protocolMarshaller) {
if (metricDefinition == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(metricDefinition.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(metricDefinition.getRegex(), REGEX_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]
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.