code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public final void putPrimitiveDefaultAtOffset(Object copy, Class<?> type, long offset) {
if (java.lang.Boolean.TYPE == type) {
THE_UNSAFE.putBoolean(copy, offset, false);
} else if (java.lang.Byte.TYPE == type) {
THE_UNSAFE.putByte(copy, offset, (byte) 0);
} else if (java.lang.Character.TYPE == type) {
THE_UNSAFE.putChar(copy, offset, '\u0000');
} else if (java.lang.Short.TYPE == type) {
THE_UNSAFE.putShort(copy, offset, (short) 0);
} else if (java.lang.Integer.TYPE == type) {
THE_UNSAFE.putInt(copy, offset, 0);
} else if (java.lang.Long.TYPE == type) {
THE_UNSAFE.putLong(copy, offset, 0L);
} else if (java.lang.Float.TYPE == type) {
THE_UNSAFE.putFloat(copy, offset, 0.0f);
} else if (java.lang.Double.TYPE == type) {
THE_UNSAFE.putDouble(copy, offset, 0.0d);
}
} } | public class class_name {
public final void putPrimitiveDefaultAtOffset(Object copy, Class<?> type, long offset) {
if (java.lang.Boolean.TYPE == type) {
THE_UNSAFE.putBoolean(copy, offset, false); // depends on control dependency: [if], data = [none]
} else if (java.lang.Byte.TYPE == type) {
THE_UNSAFE.putByte(copy, offset, (byte) 0); // depends on control dependency: [if], data = [none]
} else if (java.lang.Character.TYPE == type) {
THE_UNSAFE.putChar(copy, offset, '\u0000'); // depends on control dependency: [if], data = [none]
} else if (java.lang.Short.TYPE == type) {
THE_UNSAFE.putShort(copy, offset, (short) 0); // depends on control dependency: [if], data = [none]
} else if (java.lang.Integer.TYPE == type) {
THE_UNSAFE.putInt(copy, offset, 0); // depends on control dependency: [if], data = [none]
} else if (java.lang.Long.TYPE == type) {
THE_UNSAFE.putLong(copy, offset, 0L); // depends on control dependency: [if], data = [none]
} else if (java.lang.Float.TYPE == type) {
THE_UNSAFE.putFloat(copy, offset, 0.0f); // depends on control dependency: [if], data = [none]
} else if (java.lang.Double.TYPE == type) {
THE_UNSAFE.putDouble(copy, offset, 0.0d); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String getServerTlsFingerPrint() {
String fingerPrint = null;
Map<String, Object> serverConfig = Config.getInstance().getJsonMapConfigNoCache("server");
Map<String, Object> secretConfig = Config.getInstance().getJsonMapConfigNoCache("secret");
// load keystore here based on server config and secret config
String keystoreName = (String)serverConfig.get("keystoreName");
String serverKeystorePass = (String)secretConfig.get("serverKeystorePass");
if(keystoreName != null) {
try (InputStream stream = Config.getInstance().getInputStreamFromFile(keystoreName)) {
KeyStore loadedKeystore = KeyStore.getInstance("JKS");
loadedKeystore.load(stream, serverKeystorePass.toCharArray());
X509Certificate cert = (X509Certificate)loadedKeystore.getCertificate("server");
if(cert != null) {
fingerPrint = FingerPrintUtil.getCertFingerPrint(cert);
} else {
logger.error("Unable to find the certificate with alias name as server in the keystore");
}
} catch (Exception e) {
logger.error("Unable to load server keystore ", e);
}
}
return fingerPrint;
} } | public class class_name {
private String getServerTlsFingerPrint() {
String fingerPrint = null;
Map<String, Object> serverConfig = Config.getInstance().getJsonMapConfigNoCache("server");
Map<String, Object> secretConfig = Config.getInstance().getJsonMapConfigNoCache("secret");
// load keystore here based on server config and secret config
String keystoreName = (String)serverConfig.get("keystoreName");
String serverKeystorePass = (String)secretConfig.get("serverKeystorePass");
if(keystoreName != null) {
try (InputStream stream = Config.getInstance().getInputStreamFromFile(keystoreName)) {
KeyStore loadedKeystore = KeyStore.getInstance("JKS");
loadedKeystore.load(stream, serverKeystorePass.toCharArray()); // depends on control dependency: [if], data = [none]
X509Certificate cert = (X509Certificate)loadedKeystore.getCertificate("server");
if(cert != null) {
fingerPrint = FingerPrintUtil.getCertFingerPrint(cert); // depends on control dependency: [if], data = [(cert]
} else {
logger.error("Unable to find the certificate with alias name as server in the keystore"); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
logger.error("Unable to load server keystore ", e);
}
}
return fingerPrint;
} } |
public class class_name {
private void detachPlot(SVGPlot oldplot) {
if(oldplot == null) {
return;
}
this.plot = null;
oldplot.unsynchronizeWith(synchronizer);
} } | public class class_name {
private void detachPlot(SVGPlot oldplot) {
if(oldplot == null) {
return; // depends on control dependency: [if], data = [none]
}
this.plot = null;
oldplot.unsynchronizeWith(synchronizer);
} } |
public class class_name {
public static base_responses update(nitro_service client, autoscaleaction resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
autoscaleaction updateresources[] = new autoscaleaction[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new autoscaleaction();
updateresources[i].name = resources[i].name;
updateresources[i].profilename = resources[i].profilename;
updateresources[i].parameters = resources[i].parameters;
updateresources[i].vmdestroygraceperiod = resources[i].vmdestroygraceperiod;
updateresources[i].quiettime = resources[i].quiettime;
updateresources[i].vserver = resources[i].vserver;
}
result = update_bulk_request(client, updateresources);
}
return result;
} } | public class class_name {
public static base_responses update(nitro_service client, autoscaleaction resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
autoscaleaction updateresources[] = new autoscaleaction[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new autoscaleaction(); // depends on control dependency: [for], data = [i]
updateresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i]
updateresources[i].profilename = resources[i].profilename; // depends on control dependency: [for], data = [i]
updateresources[i].parameters = resources[i].parameters; // depends on control dependency: [for], data = [i]
updateresources[i].vmdestroygraceperiod = resources[i].vmdestroygraceperiod; // depends on control dependency: [for], data = [i]
updateresources[i].quiettime = resources[i].quiettime; // depends on control dependency: [for], data = [i]
updateresources[i].vserver = resources[i].vserver; // depends on control dependency: [for], data = [i]
}
result = update_bulk_request(client, updateresources);
}
return result;
} } |
public class class_name {
public void removeBinary( ByteSource key ) {
checkThread();
if ( key.length() != keyLen )
throw new RuntimeException("key must have length "+keyLen);
mutationCount++;
long rem = index.get(key);
if ( rem != 0 ) {
index.remove(key);
decElems();
removeEntry(rem);
}
} } | public class class_name {
public void removeBinary( ByteSource key ) {
checkThread();
if ( key.length() != keyLen )
throw new RuntimeException("key must have length "+keyLen);
mutationCount++;
long rem = index.get(key);
if ( rem != 0 ) {
index.remove(key); // depends on control dependency: [if], data = [none]
decElems(); // depends on control dependency: [if], data = [none]
removeEntry(rem); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public synchronized boolean markFailed(int id) {
boolean isSuccessful = false;
SQLiteDatabase db = null;
Cursor cursor = null;
try {
db = getWritableDatabase();
// Get number of times this record has already failed to process.
cursor = db.query(ShareRequestTable.NAME, new String[]{ShareRequestTable.COLUMN_FAILS},
WHERE_CLAUSE_BY_ID, new String[]{String.valueOf(id)}, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
int fails = cursor.getInt(cursor.getColumnIndex(ShareRequestTable.COLUMN_FAILS));
// Reset state back to pending and increment fails.
ContentValues values = new ContentValues();
values.put(ShareRequestTable.COLUMN_STATE, ShareRequest.STATE_PENDING);
values.put(ShareRequestTable.COLUMN_FAILS, fails + 1);
isSuccessful = db.update(ShareRequestTable.NAME, values, WHERE_CLAUSE_BY_ID,
new String[]{String.valueOf(id)}) > 0;
sLogger.log(WingsDbHelper.class, "markFailed", "isSuccessful=" + isSuccessful + " id=" + id);
}
} catch (SQLException e) {
// Do nothing.
} finally {
if (cursor != null) {
cursor.close();
}
db.close();
}
return isSuccessful;
} } | public class class_name {
public synchronized boolean markFailed(int id) {
boolean isSuccessful = false;
SQLiteDatabase db = null;
Cursor cursor = null;
try {
db = getWritableDatabase(); // depends on control dependency: [try], data = [none]
// Get number of times this record has already failed to process.
cursor = db.query(ShareRequestTable.NAME, new String[]{ShareRequestTable.COLUMN_FAILS},
WHERE_CLAUSE_BY_ID, new String[]{String.valueOf(id)}, null, null, null); // depends on control dependency: [try], data = [none]
if (cursor != null && cursor.moveToFirst()) {
int fails = cursor.getInt(cursor.getColumnIndex(ShareRequestTable.COLUMN_FAILS));
// Reset state back to pending and increment fails.
ContentValues values = new ContentValues();
values.put(ShareRequestTable.COLUMN_STATE, ShareRequest.STATE_PENDING); // depends on control dependency: [if], data = [none]
values.put(ShareRequestTable.COLUMN_FAILS, fails + 1); // depends on control dependency: [if], data = [none]
isSuccessful = db.update(ShareRequestTable.NAME, values, WHERE_CLAUSE_BY_ID,
new String[]{String.valueOf(id)}) > 0; // depends on control dependency: [if], data = [none]
sLogger.log(WingsDbHelper.class, "markFailed", "isSuccessful=" + isSuccessful + " id=" + id); // depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
// Do nothing.
} finally { // depends on control dependency: [catch], data = [none]
if (cursor != null) {
cursor.close(); // depends on control dependency: [if], data = [none]
}
db.close();
}
return isSuccessful;
} } |
public class class_name {
public java.util.List<Topic> getTopics() {
if (topics == null) {
topics = new com.amazonaws.internal.SdkInternalList<Topic>();
}
return topics;
} } | public class class_name {
public java.util.List<Topic> getTopics() {
if (topics == null) {
topics = new com.amazonaws.internal.SdkInternalList<Topic>(); // depends on control dependency: [if], data = [none]
}
return topics;
} } |
public class class_name {
public BlockProperty findPropertyBlockByName( String propertyName ) {
BlockProperty result = null;
for( AbstractBlock region : this.innerBlocks ) {
if( region.getInstructionType() == PROPERTY
&& propertyName.equals(((BlockProperty) region).getName())) {
result = (BlockProperty) region;
break;
}
}
return result;
} } | public class class_name {
public BlockProperty findPropertyBlockByName( String propertyName ) {
BlockProperty result = null;
for( AbstractBlock region : this.innerBlocks ) {
if( region.getInstructionType() == PROPERTY
&& propertyName.equals(((BlockProperty) region).getName())) {
result = (BlockProperty) region; // depends on control dependency: [if], data = [none]
break;
}
}
return result;
} } |
public class class_name {
private static String checkPayToPubKey(byte[] scriptPubKey) {
if ((scriptPubKey.length>0) && ((scriptPubKey[scriptPubKey.length-1] & 0xFF)==0xAC)) {
byte[] publicKey =Arrays.copyOfRange(scriptPubKey, 0, scriptPubKey.length-1);
return "bitcoinpubkey_"+BitcoinUtil.convertByteArrayToHexString(publicKey);
}
return null;
} } | public class class_name {
private static String checkPayToPubKey(byte[] scriptPubKey) {
if ((scriptPubKey.length>0) && ((scriptPubKey[scriptPubKey.length-1] & 0xFF)==0xAC)) {
byte[] publicKey =Arrays.copyOfRange(scriptPubKey, 0, scriptPubKey.length-1);
return "bitcoinpubkey_"+BitcoinUtil.convertByteArrayToHexString(publicKey); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public CyclicYear roll(int amount) {
if (amount == 0) {
return this;
}
return CyclicYear.of(MathUtils.floorModulo(MathUtils.safeAdd(this.year - 1, amount), 60) + 1);
} } | public class class_name {
public CyclicYear roll(int amount) {
if (amount == 0) {
return this; // depends on control dependency: [if], data = [none]
}
return CyclicYear.of(MathUtils.floorModulo(MathUtils.safeAdd(this.year - 1, amount), 60) + 1);
} } |
public class class_name {
protected boolean enoughRequiredAttributesAvailableToProcess(final Map<String, Object> principalAttributes, final Map<String, Set<String>> requiredAttributes) {
if (principalAttributes.isEmpty() && !requiredAttributes.isEmpty()) {
LOGGER.debug("No principal attributes are found to satisfy defined attribute requirements");
return false;
}
if (principalAttributes.size() < requiredAttributes.size()) {
LOGGER.debug("The size of the principal attributes that are [{}] does not match defined required attributes, "
+ "which indicates the principal is not carrying enough data to grant authorization", principalAttributes);
return false;
}
return true;
} } | public class class_name {
protected boolean enoughRequiredAttributesAvailableToProcess(final Map<String, Object> principalAttributes, final Map<String, Set<String>> requiredAttributes) {
if (principalAttributes.isEmpty() && !requiredAttributes.isEmpty()) {
LOGGER.debug("No principal attributes are found to satisfy defined attribute requirements"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (principalAttributes.size() < requiredAttributes.size()) {
LOGGER.debug("The size of the principal attributes that are [{}] does not match defined required attributes, "
+ "which indicates the principal is not carrying enough data to grant authorization", principalAttributes); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public String retrieveNonWildcardStem(String topic)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"retrieveNonWildcardStem",
new Object[] { topic});
String stem = null;
int wildMany = topic.indexOf(MatchSpace.SUBTOPIC_DOUBLE_SEPARATOR_STRING);
int wildOne = topic.indexOf(MatchSpace.SUBTOPIC_MATCHONE_CHAR);
if( wildOne > -1)
{
if(wildMany > wildOne)
stem = topic.substring(0, wildOne - 1); // Careful need to account for "/"
else
{
if(wildMany > -1)
stem = topic.substring(0,wildMany);
else
stem = topic.substring(0, wildOne - 1); // Careful need to account for "/"
}
}
else
{
if(wildMany > -1)
{
stem = topic.substring(0,wildMany);
}
else
{
// No wildcards
stem = topic;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveNonWildcardStem", stem);
return stem;
} } | public class class_name {
public String retrieveNonWildcardStem(String topic)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"retrieveNonWildcardStem",
new Object[] { topic});
String stem = null;
int wildMany = topic.indexOf(MatchSpace.SUBTOPIC_DOUBLE_SEPARATOR_STRING);
int wildOne = topic.indexOf(MatchSpace.SUBTOPIC_MATCHONE_CHAR);
if( wildOne > -1)
{
if(wildMany > wildOne)
stem = topic.substring(0, wildOne - 1); // Careful need to account for "/"
else
{
if(wildMany > -1)
stem = topic.substring(0,wildMany);
else
stem = topic.substring(0, wildOne - 1); // Careful need to account for "/"
}
}
else
{
if(wildMany > -1)
{
stem = topic.substring(0,wildMany); // depends on control dependency: [if], data = [none]
}
else
{
// No wildcards
stem = topic; // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveNonWildcardStem", stem);
return stem;
} } |
public class class_name {
public static void printMatrix(byte[][] matrix, int maxX, int maxY, PrintStream stream) {
for(int i = 0; i < maxX; i++) {
for(int j = 0; j < maxY; j++) {
stream.print(matrix[i][j] + " ");
}
stream.print("\n");
}
stream.println();
} } | public class class_name {
public static void printMatrix(byte[][] matrix, int maxX, int maxY, PrintStream stream) {
for(int i = 0; i < maxX; i++) {
for(int j = 0; j < maxY; j++) {
stream.print(matrix[i][j] + " "); // depends on control dependency: [for], data = [j]
}
stream.print("\n"); // depends on control dependency: [for], data = [none]
}
stream.println();
} } |
public class class_name {
public <T> T getPropertyValue(ElementDescriptor<T> descriptor)
{
PropStat propStat = mPropStatByProperty.get(descriptor);
if (propStat == null)
{
return null;
}
return propStat.getPropertyValue(descriptor);
} } | public class class_name {
public <T> T getPropertyValue(ElementDescriptor<T> descriptor)
{
PropStat propStat = mPropStatByProperty.get(descriptor);
if (propStat == null)
{
return null; // depends on control dependency: [if], data = [none]
}
return propStat.getPropertyValue(descriptor);
} } |
public class class_name {
public ReportInstanceStatusRequest withReasonCodes(String... reasonCodes) {
if (this.reasonCodes == null) {
setReasonCodes(new com.amazonaws.internal.SdkInternalList<String>(reasonCodes.length));
}
for (String ele : reasonCodes) {
this.reasonCodes.add(ele);
}
return this;
} } | public class class_name {
public ReportInstanceStatusRequest withReasonCodes(String... reasonCodes) {
if (this.reasonCodes == null) {
setReasonCodes(new com.amazonaws.internal.SdkInternalList<String>(reasonCodes.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : reasonCodes) {
this.reasonCodes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private static void printException(Exception e) {
if (e instanceof InstallationCancelledException) {
System.out.println("Installation cancelled.");
return;
}
boolean recognized = false;
String msg = "ERROR: ";
if (e instanceof InstallationFailedException) {
msg += "Installation failed: " + e.getMessage();
recognized = true;
} else if (e instanceof OptionValidationException) {
OptionValidationException ove = (OptionValidationException) e;
msg +=
"Bad value for '" + ove.getOptionId() + "': "
+ e.getMessage();
recognized = true;
}
if (recognized) {
System.err.println(msg);
if (e.getCause() != null) {
System.err.println("Caused by: ");
e.getCause().printStackTrace(System.err);
}
} else {
System.err.println(msg + "Unexpected error; installation aborted.");
e.printStackTrace();
}
} } | public class class_name {
private static void printException(Exception e) {
if (e instanceof InstallationCancelledException) {
System.out.println("Installation cancelled."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
boolean recognized = false;
String msg = "ERROR: ";
if (e instanceof InstallationFailedException) {
msg += "Installation failed: " + e.getMessage(); // depends on control dependency: [if], data = [none]
recognized = true; // depends on control dependency: [if], data = [none]
} else if (e instanceof OptionValidationException) {
OptionValidationException ove = (OptionValidationException) e;
msg +=
"Bad value for '" + ove.getOptionId() + "': " // depends on control dependency: [if], data = [none]
+ e.getMessage(); // depends on control dependency: [if], data = [none]
recognized = true; // depends on control dependency: [if], data = [none]
}
if (recognized) {
System.err.println(msg); // depends on control dependency: [if], data = [none]
if (e.getCause() != null) {
System.err.println("Caused by: "); // depends on control dependency: [if], data = [none]
e.getCause().printStackTrace(System.err); // depends on control dependency: [if], data = [none]
}
} else {
System.err.println(msg + "Unexpected error; installation aborted."); // depends on control dependency: [if], data = [none]
e.printStackTrace(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Timestamp parseTimestamp(final String date, final String format, final TimeZone timeZone) {
if (N.isNullOrEmpty(date) || (date.length() == 4 && "null".equalsIgnoreCase(date))) {
return null;
}
return createTimestamp(parse(date, format, timeZone));
} } | public class class_name {
public static Timestamp parseTimestamp(final String date, final String format, final TimeZone timeZone) {
if (N.isNullOrEmpty(date) || (date.length() == 4 && "null".equalsIgnoreCase(date))) {
return null;
// depends on control dependency: [if], data = [none]
}
return createTimestamp(parse(date, format, timeZone));
} } |
public class class_name {
private ArrayTypeReference doTryConvertToArray(ParameterizedTypeReference typeReference, RecursionGuard<JvmTypeParameter> recursionGuard) {
JvmType type = typeReference.getType();
if (recursionGuard.tryNext((JvmTypeParameter) type)) {
List<LightweightTypeReference> superTypes = typeReference.getSuperTypes();
for(int i = 0, size = superTypes.size(); i < size; i++) {
LightweightTypeReference superType = superTypes.get(i);
if (superType.isArray()) {
return (ArrayTypeReference) superType;
}
ArrayTypeReference result = doTryConvertToArray(typeReference);
if (result != null) {
return result;
} else {
JvmType rawSuperType = superType.getType();
if (rawSuperType != null && rawSuperType.eClass() == TypesPackage.Literals.JVM_TYPE_PARAMETER) {
result = doTryConvertToArray((ParameterizedTypeReference) superType, recursionGuard);
if (result != null)
return result;
}
}
}
}
return null;
} } | public class class_name {
private ArrayTypeReference doTryConvertToArray(ParameterizedTypeReference typeReference, RecursionGuard<JvmTypeParameter> recursionGuard) {
JvmType type = typeReference.getType();
if (recursionGuard.tryNext((JvmTypeParameter) type)) {
List<LightweightTypeReference> superTypes = typeReference.getSuperTypes();
for(int i = 0, size = superTypes.size(); i < size; i++) {
LightweightTypeReference superType = superTypes.get(i);
if (superType.isArray()) {
return (ArrayTypeReference) superType; // depends on control dependency: [if], data = [none]
}
ArrayTypeReference result = doTryConvertToArray(typeReference);
if (result != null) {
return result; // depends on control dependency: [if], data = [none]
} else {
JvmType rawSuperType = superType.getType();
if (rawSuperType != null && rawSuperType.eClass() == TypesPackage.Literals.JVM_TYPE_PARAMETER) {
result = doTryConvertToArray((ParameterizedTypeReference) superType, recursionGuard); // depends on control dependency: [if], data = [none]
if (result != null)
return result;
}
}
}
}
return null;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static Object getProxiedObject(Object proxy)
{
if(Proxy.isProxyClass(proxy.getClass()))
{
InvocationHandler invocationHandler = Proxy.getInvocationHandler(proxy);
if(invocationHandler instanceof ObjectProxy)
{
ObjectProxy objectProxy = (ObjectProxy) invocationHandler;
// recursively fetch the proxy
return getProxiedObject(objectProxy.getProxiedObject());
}
else
return proxy;
}
else
return proxy;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static Object getProxiedObject(Object proxy)
{
if(Proxy.isProxyClass(proxy.getClass()))
{
InvocationHandler invocationHandler = Proxy.getInvocationHandler(proxy);
if(invocationHandler instanceof ObjectProxy)
{
ObjectProxy objectProxy = (ObjectProxy) invocationHandler;
// recursively fetch the proxy
return getProxiedObject(objectProxy.getProxiedObject()); // depends on control dependency: [if], data = [none]
}
else
return proxy;
}
else
return proxy;
} } |
public class class_name {
private static String[] resolveProtocols(String csv) {
if (csv != null && !csv.equals("")) {
return csv.split(",");
} else {
return null;
}
} } | public class class_name {
private static String[] resolveProtocols(String csv) {
if (csv != null && !csv.equals("")) {
return csv.split(","); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static lbmetrictable[] get(nitro_service service, String metrictable[]) throws Exception{
if (metrictable !=null && metrictable.length>0) {
lbmetrictable response[] = new lbmetrictable[metrictable.length];
lbmetrictable obj[] = new lbmetrictable[metrictable.length];
for (int i=0;i<metrictable.length;i++) {
obj[i] = new lbmetrictable();
obj[i].set_metrictable(metrictable[i]);
response[i] = (lbmetrictable) obj[i].get_resource(service);
}
return response;
}
return null;
} } | public class class_name {
public static lbmetrictable[] get(nitro_service service, String metrictable[]) throws Exception{
if (metrictable !=null && metrictable.length>0) {
lbmetrictable response[] = new lbmetrictable[metrictable.length];
lbmetrictable obj[] = new lbmetrictable[metrictable.length];
for (int i=0;i<metrictable.length;i++) {
obj[i] = new lbmetrictable(); // depends on control dependency: [for], data = [i]
obj[i].set_metrictable(metrictable[i]); // depends on control dependency: [for], data = [i]
response[i] = (lbmetrictable) obj[i].get_resource(service); // depends on control dependency: [for], data = [i]
}
return response;
}
return null;
} } |
public class class_name {
public void marshall(InstanceInformationFilter instanceInformationFilter, ProtocolMarshaller protocolMarshaller) {
if (instanceInformationFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instanceInformationFilter.getKey(), KEY_BINDING);
protocolMarshaller.marshall(instanceInformationFilter.getValueSet(), VALUESET_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(InstanceInformationFilter instanceInformationFilter, ProtocolMarshaller protocolMarshaller) {
if (instanceInformationFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instanceInformationFilter.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceInformationFilter.getValueSet(), VALUESET_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void exceptionOccured( Throwable t )
{
if (t instanceof RuntimeException)
{
err.println( "An unexpected error occured" );
t.printStackTrace( err );
}
else
{
err.println( format("Error: %s %s", t.getClass().getName(), t.getMessage()) );
if (t.getCause() != null)
{
err.println( "Caused by:" );
t.getCause().printStackTrace( err );
}
}
} } | public class class_name {
public void exceptionOccured( Throwable t )
{
if (t instanceof RuntimeException)
{
err.println( "An unexpected error occured" ); // depends on control dependency: [if], data = [none]
t.printStackTrace( err ); // depends on control dependency: [if], data = [none]
}
else
{
err.println( format("Error: %s %s", t.getClass().getName(), t.getMessage()) ); // depends on control dependency: [if], data = [none]
if (t.getCause() != null)
{
err.println( "Caused by:" ); // depends on control dependency: [if], data = [none]
t.getCause().printStackTrace( err ); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static boolean setStringsWithGroup(String groupName,Map<String, Object> keyValueMap){
if(keyValueMap == null || keyValueMap.isEmpty())return false;
String[] keysValues = new String[keyValueMap.size() * 2];
int index = 0;
for (String key : keyValueMap.keySet()) {
if(keyValueMap.get(key) == null)continue;
keysValues[index++] = key;
keysValues[index++] = keyValueMap.get(key).toString();
}
try {
if(JedisProviderFactory.isCluster(groupName)){
return JedisProviderFactory.getMultiKeyJedisClusterCommands(groupName).mset(keysValues).equals(RESP_OK);
}else{
return JedisProviderFactory.getMultiKeyCommands(groupName).mset(keysValues).equals(RESP_OK);
}
} finally {
JedisProviderFactory.getJedisProvider(groupName).release();
}
} } | public class class_name {
public static boolean setStringsWithGroup(String groupName,Map<String, Object> keyValueMap){
if(keyValueMap == null || keyValueMap.isEmpty())return false;
String[] keysValues = new String[keyValueMap.size() * 2];
int index = 0;
for (String key : keyValueMap.keySet()) {
if(keyValueMap.get(key) == null)continue;
keysValues[index++] = key; // depends on control dependency: [for], data = [key]
keysValues[index++] = keyValueMap.get(key).toString(); // depends on control dependency: [for], data = [key]
}
try {
if(JedisProviderFactory.isCluster(groupName)){
return JedisProviderFactory.getMultiKeyJedisClusterCommands(groupName).mset(keysValues).equals(RESP_OK); // depends on control dependency: [if], data = [none]
}else{
return JedisProviderFactory.getMultiKeyCommands(groupName).mset(keysValues).equals(RESP_OK); // depends on control dependency: [if], data = [none]
}
} finally {
JedisProviderFactory.getJedisProvider(groupName).release();
}
} } |
public class class_name {
public static Configuration patchConfiguration(Configuration conf) {
//if the fallback option is NOT set, enable it.
//if it is explicitly set to anything -leave alone
if (conf.get(JstormXmlConfKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH) == null) {
conf.set(JstormXmlConfKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH, "true");
}
return conf;
} } | public class class_name {
public static Configuration patchConfiguration(Configuration conf) {
//if the fallback option is NOT set, enable it.
//if it is explicitly set to anything -leave alone
if (conf.get(JstormXmlConfKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH) == null) {
conf.set(JstormXmlConfKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH, "true"); // depends on control dependency: [if], data = [none]
}
return conf;
} } |
public class class_name {
private boolean removeUDFInSchema(String functionName) {
for (int idx = 0; idx < m_schema.children.size(); idx++) {
VoltXMLElement func = m_schema.children.get(idx);
if ("ud_function".equals(func.name)) {
String fnm = func.attributes.get("name");
if (fnm != null && functionName.equals(fnm)) {
m_schema.children.remove(idx);
m_tracker.addDroppedFunction(functionName);
m_logger.debug(String.format("Removed XML for"
+ " function named %s", functionName));
return true;
}
}
}
return false;
} } | public class class_name {
private boolean removeUDFInSchema(String functionName) {
for (int idx = 0; idx < m_schema.children.size(); idx++) {
VoltXMLElement func = m_schema.children.get(idx);
if ("ud_function".equals(func.name)) {
String fnm = func.attributes.get("name");
if (fnm != null && functionName.equals(fnm)) {
m_schema.children.remove(idx); // depends on control dependency: [if], data = [none]
m_tracker.addDroppedFunction(functionName); // depends on control dependency: [if], data = [none]
m_logger.debug(String.format("Removed XML for"
+ " function named %s", functionName)); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
public String remove(String name)
{
String old=null;
FieldInfo info=getFieldInfo(name);
Field field=getField(info,true);
if (field!=null)
{
old=field._value;
while(field!=null)
{
field.clear();
field=field._next;
}
}
return old;
} } | public class class_name {
public String remove(String name)
{
String old=null;
FieldInfo info=getFieldInfo(name);
Field field=getField(info,true);
if (field!=null)
{
old=field._value; // depends on control dependency: [if], data = [none]
while(field!=null)
{
field.clear(); // depends on control dependency: [while], data = [none]
field=field._next; // depends on control dependency: [while], data = [none]
}
}
return old;
} } |
public class class_name {
public int projectedComponents(boolean constrained) {
int comp;
if (constrained) {
comp = ((DArray)arrayVar).isProject() ? 1 : 0;
Enumeration e = mapVars.elements();
while (e.hasMoreElements()) {
if (((DArray) e.nextElement()).isProject())
comp++;
}
} else {
comp = 1 + mapVars.size();
}
return comp;
} } | public class class_name {
public int projectedComponents(boolean constrained) {
int comp;
if (constrained) {
comp = ((DArray)arrayVar).isProject() ? 1 : 0;
// depends on control dependency: [if], data = [none]
Enumeration e = mapVars.elements();
while (e.hasMoreElements()) {
if (((DArray) e.nextElement()).isProject())
comp++;
}
} else {
comp = 1 + mapVars.size();
// depends on control dependency: [if], data = [none]
}
return comp;
} } |
public class class_name {
public void deselectButton() {
if (m_selectedButton != null) {
if (m_selectedButton.isChecked()) {
m_selectedButton.setChecked(false);
}
m_selectedButton = null;
ValueChangeEvent.fire(this, null);
}
} } | public class class_name {
public void deselectButton() {
if (m_selectedButton != null) {
if (m_selectedButton.isChecked()) {
m_selectedButton.setChecked(false); // depends on control dependency: [if], data = [none]
}
m_selectedButton = null; // depends on control dependency: [if], data = [none]
ValueChangeEvent.fire(this, null); // depends on control dependency: [if], data = [null)]
}
} } |
public class class_name {
private int getCE(int sourcece) {
// note for tertiary we can't use the collator->tertiaryMask, that
// is a preprocessed mask that takes into account case options. since
// we are only concerned with exact matches, we don't need that.
sourcece &= ceMask_;
if (toShift_) {
// alternate handling here, since only the 16 most significant digits
// is only used, we can safely do a compare without masking
// if the ce is a variable, we mask and get only the primary values
// no shifting to quartenary is required since all primary values
// less than variabletop will need to be masked off anyway.
if (variableTop_ > sourcece) {
if (strength_ >= Collator.QUATERNARY) {
sourcece &= PRIMARYORDERMASK;
} else {
sourcece = CollationElementIterator.IGNORABLE;
}
}
} else if (strength_ >= Collator.QUATERNARY && sourcece == CollationElementIterator.IGNORABLE) {
sourcece = 0xFFFF;
}
return sourcece;
} } | public class class_name {
private int getCE(int sourcece) {
// note for tertiary we can't use the collator->tertiaryMask, that
// is a preprocessed mask that takes into account case options. since
// we are only concerned with exact matches, we don't need that.
sourcece &= ceMask_;
if (toShift_) {
// alternate handling here, since only the 16 most significant digits
// is only used, we can safely do a compare without masking
// if the ce is a variable, we mask and get only the primary values
// no shifting to quartenary is required since all primary values
// less than variabletop will need to be masked off anyway.
if (variableTop_ > sourcece) {
if (strength_ >= Collator.QUATERNARY) {
sourcece &= PRIMARYORDERMASK; // depends on control dependency: [if], data = [none]
} else {
sourcece = CollationElementIterator.IGNORABLE; // depends on control dependency: [if], data = [none]
}
}
} else if (strength_ >= Collator.QUATERNARY && sourcece == CollationElementIterator.IGNORABLE) {
sourcece = 0xFFFF; // depends on control dependency: [if], data = [none]
}
return sourcece;
} } |
public class class_name {
public void destroyIndexes() {
InternalIndex[] indexesSnapshot = getIndexes();
indexes = EMPTY_INDEXES;
compositeIndexes = EMPTY_INDEXES;
indexesByName.clear();
attributeIndexRegistry.clear();
converterCache.clear();
for (InternalIndex index : indexesSnapshot) {
index.destroy();
}
} } | public class class_name {
public void destroyIndexes() {
InternalIndex[] indexesSnapshot = getIndexes();
indexes = EMPTY_INDEXES;
compositeIndexes = EMPTY_INDEXES;
indexesByName.clear();
attributeIndexRegistry.clear();
converterCache.clear();
for (InternalIndex index : indexesSnapshot) {
index.destroy(); // depends on control dependency: [for], data = [index]
}
} } |
public class class_name {
public Set<IConnection> getConnections(IScope scope) {
if (scope == null) {
return getConnections();
}
Set<IClient> scopeClients = scope.getClients();
if (scopeClients.contains(this)) {
for (IClient cli : scopeClients) {
if (this.equals(cli)) {
return cli.getConnections();
}
}
}
return Collections.emptySet();
} } | public class class_name {
public Set<IConnection> getConnections(IScope scope) {
if (scope == null) {
return getConnections();
// depends on control dependency: [if], data = [none]
}
Set<IClient> scopeClients = scope.getClients();
if (scopeClients.contains(this)) {
for (IClient cli : scopeClients) {
if (this.equals(cli)) {
return cli.getConnections();
// depends on control dependency: [if], data = [none]
}
}
}
return Collections.emptySet();
} } |
public class class_name {
private static boolean isSerializable(JavaClass cls) throws ClassNotFoundException {
JavaClass[] infs = cls.getAllInterfaces();
for (JavaClass inf : infs) {
String clsName = inf.getClassName();
if ("java.io.Serializable".equals(clsName) || "java.io.Externalizable".equals(clsName)) {
return true;
}
}
return false;
} } | public class class_name {
private static boolean isSerializable(JavaClass cls) throws ClassNotFoundException {
JavaClass[] infs = cls.getAllInterfaces();
for (JavaClass inf : infs) {
String clsName = inf.getClassName();
if ("java.io.Serializable".equals(clsName) || "java.io.Externalizable".equals(clsName)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
@Override
protected UserDetails processAutoLoginCookie(String[] cookieTokens,
HttpServletRequest request, HttpServletResponse response) {
if (cookieTokens.length != 3) {
throw new InvalidCookieException("Cookie token did not contain 3"
+ " tokens, but contained '" + Arrays.asList(cookieTokens) + "'");
}
long tokenExpiryTime;
try {
tokenExpiryTime = new Long(cookieTokens[1]).longValue();
}
catch (NumberFormatException nfe) {
throw new InvalidCookieException(
"Cookie token[1] did not contain a valid number (contained '"
+ cookieTokens[1] + "')");
}
if (isTokenExpired(tokenExpiryTime)) {
throw new InvalidCookieException("Cookie token[1] has expired (expired on '"
+ new Date(tokenExpiryTime) + "'; current time is '" + new Date()
+ "')");
}
// Check the user exists.
// Defer lookup until after expiry time checked, to possibly avoid expensive
// database call.
UserDetails userDetails = getUserDetailsService().loadUserByUsername(
cookieTokens[0]);
// Check signature of token matches remaining details.
// Must do this after user lookup, as we need the DAO-derived password.
// If efficiency was a major issue, just add in a UserCache implementation,
// but recall that this method is usually only called once per HttpSession - if
// the token is valid,
// it will cause SecurityContextHolder population, whilst if invalid, will cause
// the cookie to be cancelled.
String expectedTokenSignature = makeTokenSignature(tokenExpiryTime,
userDetails.getUsername(), userDetails.getPassword());
if (!equals(expectedTokenSignature, cookieTokens[2])) {
throw new InvalidCookieException("Cookie token[2] contained signature '"
+ cookieTokens[2] + "' but expected '" + expectedTokenSignature + "'");
}
return userDetails;
} } | public class class_name {
@Override
protected UserDetails processAutoLoginCookie(String[] cookieTokens,
HttpServletRequest request, HttpServletResponse response) {
if (cookieTokens.length != 3) {
throw new InvalidCookieException("Cookie token did not contain 3"
+ " tokens, but contained '" + Arrays.asList(cookieTokens) + "'");
}
long tokenExpiryTime;
try {
tokenExpiryTime = new Long(cookieTokens[1]).longValue(); // depends on control dependency: [try], data = [none]
}
catch (NumberFormatException nfe) {
throw new InvalidCookieException(
"Cookie token[1] did not contain a valid number (contained '"
+ cookieTokens[1] + "')");
} // depends on control dependency: [catch], data = [none]
if (isTokenExpired(tokenExpiryTime)) {
throw new InvalidCookieException("Cookie token[1] has expired (expired on '"
+ new Date(tokenExpiryTime) + "'; current time is '" + new Date()
+ "')");
}
// Check the user exists.
// Defer lookup until after expiry time checked, to possibly avoid expensive
// database call.
UserDetails userDetails = getUserDetailsService().loadUserByUsername(
cookieTokens[0]);
// Check signature of token matches remaining details.
// Must do this after user lookup, as we need the DAO-derived password.
// If efficiency was a major issue, just add in a UserCache implementation,
// but recall that this method is usually only called once per HttpSession - if
// the token is valid,
// it will cause SecurityContextHolder population, whilst if invalid, will cause
// the cookie to be cancelled.
String expectedTokenSignature = makeTokenSignature(tokenExpiryTime,
userDetails.getUsername(), userDetails.getPassword());
if (!equals(expectedTokenSignature, cookieTokens[2])) {
throw new InvalidCookieException("Cookie token[2] contained signature '"
+ cookieTokens[2] + "' but expected '" + expectedTokenSignature + "'");
}
return userDetails;
} } |
public class class_name {
public void initConfiguration() {
// simple default configuration does not need to be initialized
if (LOG.isDebugEnabled()) {
LOG.debug(
org.opencms.configuration.Messages.get().getBundle().key(
org.opencms.configuration.Messages.LOG_INIT_CONFIGURATION_1,
this));
}
setFrozen(true);
} } | public class class_name {
public void initConfiguration() {
// simple default configuration does not need to be initialized
if (LOG.isDebugEnabled()) {
LOG.debug(
org.opencms.configuration.Messages.get().getBundle().key(
org.opencms.configuration.Messages.LOG_INIT_CONFIGURATION_1,
this)); // depends on control dependency: [if], data = [none]
}
setFrozen(true);
} } |
public class class_name {
private ZooKeeperClient setupZookeeperClient(final AgentConfig config, final String id,
final CountDownLatch zkRegistrationSignal) {
ACLProvider aclProvider = null;
List<AuthInfo> authorization = null;
final String agentUser = config.getZookeeperAclAgentUser();
final String agentPassword = config.getZooKeeperAclAgentPassword();
final String masterUser = config.getZookeeperAclMasterUser();
final String masterDigest = config.getZooKeeperAclMasterDigest();
if (!isNullOrEmpty(agentPassword)) {
if (isNullOrEmpty(agentUser)) {
throw new HeliosRuntimeException(
"Agent username must be set if a password is set");
}
authorization = Lists.newArrayList(new AuthInfo(
"digest", String.format("%s:%s", agentUser, agentPassword).getBytes()));
}
if (config.isZooKeeperEnableAcls()) {
if (isNullOrEmpty(agentUser) || isNullOrEmpty(agentPassword)) {
throw new HeliosRuntimeException(
"ZooKeeper ACLs enabled but agent username and/or password not set");
}
if (isNullOrEmpty(masterUser) || isNullOrEmpty(masterDigest)) {
throw new HeliosRuntimeException(
"ZooKeeper ACLs enabled but master username and/or digest not set");
}
aclProvider = heliosAclProvider(
masterUser, masterDigest,
agentUser, digest(agentUser, agentPassword));
}
final RetryPolicy zooKeeperRetryPolicy = new ExponentialBackoffRetry(1000, 3);
final CuratorFramework curator = new CuratorClientFactoryImpl().newClient(
config.getZooKeeperConnectionString(),
config.getZooKeeperSessionTimeoutMillis(),
config.getZooKeeperConnectionTimeoutMillis(),
zooKeeperRetryPolicy,
aclProvider,
authorization);
final ZooKeeperClient client = new DefaultZooKeeperClient(curator,
config.getZooKeeperClusterId());
client.start();
// Register the agent
final AgentZooKeeperRegistrar agentZooKeeperRegistrar = new AgentZooKeeperRegistrar(
config.getName(), id, config.getZooKeeperRegistrationTtlMinutes(), new SystemClock());
zkRegistrar = ZooKeeperRegistrarService.newBuilder()
.setZooKeeperClient(client)
.setZooKeeperRegistrar(agentZooKeeperRegistrar)
.setZkRegistrationSignal(zkRegistrationSignal)
.build();
return client;
} } | public class class_name {
private ZooKeeperClient setupZookeeperClient(final AgentConfig config, final String id,
final CountDownLatch zkRegistrationSignal) {
ACLProvider aclProvider = null;
List<AuthInfo> authorization = null;
final String agentUser = config.getZookeeperAclAgentUser();
final String agentPassword = config.getZooKeeperAclAgentPassword();
final String masterUser = config.getZookeeperAclMasterUser();
final String masterDigest = config.getZooKeeperAclMasterDigest();
if (!isNullOrEmpty(agentPassword)) {
if (isNullOrEmpty(agentUser)) {
throw new HeliosRuntimeException(
"Agent username must be set if a password is set");
}
authorization = Lists.newArrayList(new AuthInfo(
"digest", String.format("%s:%s", agentUser, agentPassword).getBytes())); // depends on control dependency: [if], data = [none]
}
if (config.isZooKeeperEnableAcls()) {
if (isNullOrEmpty(agentUser) || isNullOrEmpty(agentPassword)) {
throw new HeliosRuntimeException(
"ZooKeeper ACLs enabled but agent username and/or password not set");
}
if (isNullOrEmpty(masterUser) || isNullOrEmpty(masterDigest)) {
throw new HeliosRuntimeException(
"ZooKeeper ACLs enabled but master username and/or digest not set");
}
aclProvider = heliosAclProvider(
masterUser, masterDigest,
agentUser, digest(agentUser, agentPassword)); // depends on control dependency: [if], data = [none]
}
final RetryPolicy zooKeeperRetryPolicy = new ExponentialBackoffRetry(1000, 3);
final CuratorFramework curator = new CuratorClientFactoryImpl().newClient(
config.getZooKeeperConnectionString(),
config.getZooKeeperSessionTimeoutMillis(),
config.getZooKeeperConnectionTimeoutMillis(),
zooKeeperRetryPolicy,
aclProvider,
authorization);
final ZooKeeperClient client = new DefaultZooKeeperClient(curator,
config.getZooKeeperClusterId());
client.start();
// Register the agent
final AgentZooKeeperRegistrar agentZooKeeperRegistrar = new AgentZooKeeperRegistrar(
config.getName(), id, config.getZooKeeperRegistrationTtlMinutes(), new SystemClock());
zkRegistrar = ZooKeeperRegistrarService.newBuilder()
.setZooKeeperClient(client)
.setZooKeeperRegistrar(agentZooKeeperRegistrar)
.setZkRegistrationSignal(zkRegistrationSignal)
.build();
return client;
} } |
public class class_name {
public boolean hasProperty(String name) {
for (Property property : allProperties()) {
if (property.getName().equals(name)) {
return true;
}
}
return false;
} } | public class class_name {
public boolean hasProperty(String name) {
for (Property property : allProperties()) {
if (property.getName().equals(name)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
@Override
public List<TriggerFiredResult> triggersFired(List<OperableTrigger> triggers) {
synchronized (lock) {
List<TriggerFiredResult> results = new ArrayList<TriggerFiredResult>();
for (OperableTrigger trigger : triggers) {
TriggerWrapper tw = wrappedTriggersByKey.get(trigger.getName());
// was the trigger deleted since being acquired?
if (tw == null || tw.trigger == null) {
continue;
}
// was the trigger completed, paused, blocked, etc. since being acquired?
if (tw.state != TriggerWrapper.STATE_ACQUIRED) {
continue;
}
Calendar cal = null;
if (tw.trigger.getCalendarName() != null) {
cal = retrieveCalendar(tw.trigger.getCalendarName());
if (cal == null) {
continue;
}
}
Date prevFireTime = trigger.getPreviousFireTime();
// in case trigger was replaced between acquiring and firing
timeWrappedTriggers.remove(tw);
// call triggered on our copy, and the scheduler's copy
tw.trigger.triggered(cal);
trigger.triggered(cal);
// tw.state = TriggerWrapper.STATE_EXECUTING;
tw.state = TriggerWrapper.STATE_WAITING;
TriggerFiredBundle bndle =
new TriggerFiredBundle(
retrieveJob(tw.jobKey),
trigger,
cal,
false,
new Date(),
trigger.getPreviousFireTime(),
prevFireTime,
trigger.getNextFireTime());
JobDetail job = bndle.getJobDetail();
if (!job.isConcurrencyAllowed()) {
ArrayList<TriggerWrapper> trigs = getTriggerWrappersForJob(job.getName());
Iterator<TriggerWrapper> itr = trigs.iterator();
while (itr.hasNext()) {
TriggerWrapper ttw = itr.next();
if (ttw.state == TriggerWrapper.STATE_WAITING) {
ttw.state = TriggerWrapper.STATE_BLOCKED;
}
if (ttw.state == TriggerWrapper.STATE_PAUSED) {
ttw.state = TriggerWrapper.STATE_PAUSED_BLOCKED;
}
timeWrappedTriggers.remove(ttw);
}
blockedJobs.add(job.getName());
} else if (tw.trigger.getNextFireTime() != null) {
synchronized (lock) {
timeWrappedTriggers.add(tw);
}
}
results.add(new TriggerFiredResult(bndle));
}
return results;
}
} } | public class class_name {
@Override
public List<TriggerFiredResult> triggersFired(List<OperableTrigger> triggers) {
synchronized (lock) {
List<TriggerFiredResult> results = new ArrayList<TriggerFiredResult>();
for (OperableTrigger trigger : triggers) {
TriggerWrapper tw = wrappedTriggersByKey.get(trigger.getName());
// was the trigger deleted since being acquired?
if (tw == null || tw.trigger == null) {
continue;
}
// was the trigger completed, paused, blocked, etc. since being acquired?
if (tw.state != TriggerWrapper.STATE_ACQUIRED) {
continue;
}
Calendar cal = null;
if (tw.trigger.getCalendarName() != null) {
cal = retrieveCalendar(tw.trigger.getCalendarName()); // depends on control dependency: [if], data = [(tw.trigger.getCalendarName()]
if (cal == null) {
continue;
}
}
Date prevFireTime = trigger.getPreviousFireTime();
// in case trigger was replaced between acquiring and firing
timeWrappedTriggers.remove(tw); // depends on control dependency: [for], data = [none]
// call triggered on our copy, and the scheduler's copy
tw.trigger.triggered(cal); // depends on control dependency: [for], data = [trigger]
trigger.triggered(cal);
// tw.state = TriggerWrapper.STATE_EXECUTING;
tw.state = TriggerWrapper.STATE_WAITING;
TriggerFiredBundle bndle =
new TriggerFiredBundle(
retrieveJob(tw.jobKey),
trigger,
cal,
false,
new Date(),
trigger.getPreviousFireTime(),
prevFireTime,
trigger.getNextFireTime());
JobDetail job = bndle.getJobDetail();
if (!job.isConcurrencyAllowed()) {
ArrayList<TriggerWrapper> trigs = getTriggerWrappersForJob(job.getName());
Iterator<TriggerWrapper> itr = trigs.iterator();
while (itr.hasNext()) {
TriggerWrapper ttw = itr.next();
if (ttw.state == TriggerWrapper.STATE_WAITING) {
ttw.state = TriggerWrapper.STATE_BLOCKED;
}
if (ttw.state == TriggerWrapper.STATE_PAUSED) {
ttw.state = TriggerWrapper.STATE_PAUSED_BLOCKED;
}
timeWrappedTriggers.remove(ttw);
}
blockedJobs.add(job.getName());
} else if (tw.trigger.getNextFireTime() != null) {
synchronized (lock) {
timeWrappedTriggers.add(tw);
}
}
results.add(new TriggerFiredResult(bndle));
}
return results;
}
} } |
public class class_name {
void animateValue(float fraction) {
fraction = mInterpolator.getInterpolation(fraction);
mCurrentFraction = fraction;
int numValues = mValues.length;
for (int i = 0; i < numValues; ++i) {
mValues[i].calculateValue(fraction);
}
if (mUpdateListeners != null) {
int numListeners = mUpdateListeners.size();
for (int i = 0; i < numListeners; ++i) {
mUpdateListeners.get(i).onAnimationUpdate(this);
}
}
} } | public class class_name {
void animateValue(float fraction) {
fraction = mInterpolator.getInterpolation(fraction);
mCurrentFraction = fraction;
int numValues = mValues.length;
for (int i = 0; i < numValues; ++i) {
mValues[i].calculateValue(fraction); // depends on control dependency: [for], data = [i]
}
if (mUpdateListeners != null) {
int numListeners = mUpdateListeners.size();
for (int i = 0; i < numListeners; ++i) {
mUpdateListeners.get(i).onAnimationUpdate(this); // depends on control dependency: [for], data = [i]
}
}
} } |
public class class_name {
public Address currentAddress(KeyChain.KeyPurpose purpose) {
DeterministicKeyChain chain = getActiveKeyChain();
Script.ScriptType outputScriptType = chain.getOutputScriptType();
if (chain.isMarried()) {
Address current = currentAddresses.get(purpose);
if (current == null) {
current = freshAddress(purpose);
currentAddresses.put(purpose, current);
}
return current;
} else if (outputScriptType == Script.ScriptType.P2PKH || outputScriptType == Script.ScriptType.P2WPKH) {
return Address.fromKey(params, currentKey(purpose), outputScriptType);
} else {
throw new IllegalStateException(chain.getOutputScriptType().toString());
}
} } | public class class_name {
public Address currentAddress(KeyChain.KeyPurpose purpose) {
DeterministicKeyChain chain = getActiveKeyChain();
Script.ScriptType outputScriptType = chain.getOutputScriptType();
if (chain.isMarried()) {
Address current = currentAddresses.get(purpose);
if (current == null) {
current = freshAddress(purpose); // depends on control dependency: [if], data = [none]
currentAddresses.put(purpose, current); // depends on control dependency: [if], data = [none]
}
return current; // depends on control dependency: [if], data = [none]
} else if (outputScriptType == Script.ScriptType.P2PKH || outputScriptType == Script.ScriptType.P2WPKH) {
return Address.fromKey(params, currentKey(purpose), outputScriptType); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException(chain.getOutputScriptType().toString());
}
} } |
public class class_name {
void timeout() {
long time = System.currentTimeMillis();
Iterator<Map.Entry<Long, ContextualFuture>> iterator = responseFutures.entrySet().iterator();
while (iterator.hasNext()) {
ContextualFuture future = iterator.next().getValue();
if (future.time + requestTimeout < time) {
iterator.remove();
future.context.executor().execute(() -> future.completeExceptionally(new TimeoutException("request timed out")));
} else {
break;
}
}
} } | public class class_name {
void timeout() {
long time = System.currentTimeMillis();
Iterator<Map.Entry<Long, ContextualFuture>> iterator = responseFutures.entrySet().iterator();
while (iterator.hasNext()) {
ContextualFuture future = iterator.next().getValue();
if (future.time + requestTimeout < time) {
iterator.remove(); // depends on control dependency: [if], data = [none]
future.context.executor().execute(() -> future.completeExceptionally(new TimeoutException("request timed out"))); // depends on control dependency: [if], data = [none]
} else {
break;
}
}
} } |
public class class_name {
@Override
public boolean setProperties(Dictionary<String, String> properties) {
this.properties = properties;
if (this.properties != null)
{
if (properties.get("debug") != null)
debug = Integer.parseInt(properties.get("debug"));
if (properties.get("input") != null)
input = Integer.parseInt(properties.get("input"));
if (properties.get("output") != null)
output = Integer.parseInt(properties.get("output"));
listings = Boolean.parseBoolean(properties.get("listings"));
if (properties.get("readonly") != null)
readOnly = Boolean.parseBoolean(properties.get("readonly"));
if (properties.get("sendfileSize") != null)
sendfileSize =
Integer.parseInt(properties.get("sendfileSize")) * 1024;
fileEncoding = properties.get("fileEncoding");
globalXsltFile = properties.get("globalXsltFile");
contextXsltFile = properties.get("contextXsltFile");
localXsltFile = properties.get("localXsltFile");
readmeFile = properties.get("readmeFile");
if (properties.get("useAcceptRanges") != null)
useAcceptRanges = Boolean.parseBoolean(properties.get("useAcceptRanges"));
// Sanity check on the specified buffer sizes
if (input < 256)
input = 256;
if (output < 256)
output = 256;
if (debug > 0) {
log("DefaultServlet.init: input buffer size=" + input +
", output buffer size=" + output);
}
return this.setDocBase(this.properties.get(BASE_PATH));
}
else
{
return this.setDocBase(null);
}
} } | public class class_name {
@Override
public boolean setProperties(Dictionary<String, String> properties) {
this.properties = properties;
if (this.properties != null)
{
if (properties.get("debug") != null)
debug = Integer.parseInt(properties.get("debug"));
if (properties.get("input") != null)
input = Integer.parseInt(properties.get("input"));
if (properties.get("output") != null)
output = Integer.parseInt(properties.get("output"));
listings = Boolean.parseBoolean(properties.get("listings")); // depends on control dependency: [if], data = [none]
if (properties.get("readonly") != null)
readOnly = Boolean.parseBoolean(properties.get("readonly"));
if (properties.get("sendfileSize") != null)
sendfileSize =
Integer.parseInt(properties.get("sendfileSize")) * 1024;
fileEncoding = properties.get("fileEncoding"); // depends on control dependency: [if], data = [none]
globalXsltFile = properties.get("globalXsltFile"); // depends on control dependency: [if], data = [none]
contextXsltFile = properties.get("contextXsltFile"); // depends on control dependency: [if], data = [none]
localXsltFile = properties.get("localXsltFile"); // depends on control dependency: [if], data = [none]
readmeFile = properties.get("readmeFile"); // depends on control dependency: [if], data = [none]
if (properties.get("useAcceptRanges") != null)
useAcceptRanges = Boolean.parseBoolean(properties.get("useAcceptRanges"));
// Sanity check on the specified buffer sizes
if (input < 256)
input = 256;
if (output < 256)
output = 256;
if (debug > 0) {
log("DefaultServlet.init: input buffer size=" + input +
", output buffer size=" + output);
}
return this.setDocBase(this.properties.get(BASE_PATH)); // depends on control dependency: [if], data = [(this.properties]
}
else
{
return this.setDocBase(null); // depends on control dependency: [if], data = [null)]
}
} } |
public class class_name {
private static boolean checkCriticalValue(double score, boolean is_twoTailed, int n1, int n2, double aLevel) {
boolean rejected=false;
double criticalValue= calculateCriticalValue(is_twoTailed,n1,n2,aLevel);
if(score>criticalValue) {
rejected=true;
}
return rejected;
} } | public class class_name {
private static boolean checkCriticalValue(double score, boolean is_twoTailed, int n1, int n2, double aLevel) {
boolean rejected=false;
double criticalValue= calculateCriticalValue(is_twoTailed,n1,n2,aLevel);
if(score>criticalValue) {
rejected=true; // depends on control dependency: [if], data = [none]
}
return rejected;
} } |
public class class_name {
public void copyFileFrom(InputStream src, boolean append) throws CopyFileFromException {
ChannelSftp sftp;
try {
sftp = alloc();
try {
sftp.put(src, escape(slashPath), append ? ChannelSftp.APPEND : ChannelSftp.OVERWRITE);
} finally {
free(sftp);
}
} catch (SftpException | JSchException e) {
throw new CopyFileFromException(this, e);
}
} } | public class class_name {
public void copyFileFrom(InputStream src, boolean append) throws CopyFileFromException {
ChannelSftp sftp;
try {
sftp = alloc();
try {
sftp.put(src, escape(slashPath), append ? ChannelSftp.APPEND : ChannelSftp.OVERWRITE); // depends on control dependency: [try], data = [none]
} finally {
free(sftp);
}
} catch (SftpException | JSchException e) {
throw new CopyFileFromException(this, e);
}
} } |
public class class_name {
public String getOemName() {
StringBuilder b = new StringBuilder(8);
for (int i = 0; i < 8; i++) {
int v = get8(0x3 + i);
if (v == 0) break;
b.append((char) v);
}
return b.toString();
} } | public class class_name {
public String getOemName() {
StringBuilder b = new StringBuilder(8);
for (int i = 0; i < 8; i++) {
int v = get8(0x3 + i);
if (v == 0) break;
b.append((char) v); // depends on control dependency: [for], data = [none]
}
return b.toString();
} } |
public class class_name {
private ConversionService getConversionService() {
if (conversionService != null)
return conversionService;
try {
conversionService = (ConversionService) ctx.getBean("daoConversionService");
if (conversionService != null)
return conversionService;
} catch (Exception e) {
}
ConversionServiceFactoryBean factory = new ConversionServiceFactoryBean();
factory.afterPropertiesSet();
conversionService = factory.getObject();
return conversionService;
} } | public class class_name {
private ConversionService getConversionService() {
if (conversionService != null)
return conversionService;
try {
conversionService = (ConversionService) ctx.getBean("daoConversionService");
// depends on control dependency: [try], data = [none]
if (conversionService != null)
return conversionService;
} catch (Exception e) {
}
// depends on control dependency: [catch], data = [none]
ConversionServiceFactoryBean factory = new ConversionServiceFactoryBean();
factory.afterPropertiesSet();
conversionService = factory.getObject();
return conversionService;
} } |
public class class_name {
public List<Link> getStaticRoute(NodesMap nm) {
Map<Link, Boolean> route = routes.get(nm);
if (route == null) {
return null;
}
return new ArrayList<>(route.keySet());
} } | public class class_name {
public List<Link> getStaticRoute(NodesMap nm) {
Map<Link, Boolean> route = routes.get(nm);
if (route == null) {
return null; // depends on control dependency: [if], data = [none]
}
return new ArrayList<>(route.keySet());
} } |
public class class_name {
VirtualConnection parseResponseMessageAsync() {
VirtualConnection readVC = null;
try {
do {
if (parseMessage()) {
// finished parsing the message
return getVC();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Reading for more data to parse");
}
// configure the buffers for reading
setupReadBuffers(getHttpConfig().getIncomingHdrBufferSize(), false);
readVC = getTSC().getReadInterface().read(1, HttpOSCReadCallback.getRef(), false, getReadTimeout());
} while (null != readVC);
} catch (Exception e) {
// no FFDC required
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception while parsing response: " + e);
}
setPersistent(false);
// LI4335 - early reads also use read callback
if (this.bEarlyReads || this.bTempResponsesUsed) {
getAppReadCallback().error(getVC(), e);
} else {
getAppWriteCallback().error(getVC(), e);
}
return null;
}
// getting here means an async read is in-progress
return null;
} } | public class class_name {
VirtualConnection parseResponseMessageAsync() {
VirtualConnection readVC = null;
try {
do {
if (parseMessage()) {
// finished parsing the message
return getVC(); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Reading for more data to parse"); // depends on control dependency: [if], data = [none]
}
// configure the buffers for reading
setupReadBuffers(getHttpConfig().getIncomingHdrBufferSize(), false);
readVC = getTSC().getReadInterface().read(1, HttpOSCReadCallback.getRef(), false, getReadTimeout());
} while (null != readVC);
} catch (Exception e) {
// no FFDC required
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception while parsing response: " + e); // depends on control dependency: [if], data = [none]
}
setPersistent(false);
// LI4335 - early reads also use read callback
if (this.bEarlyReads || this.bTempResponsesUsed) {
getAppReadCallback().error(getVC(), e); // depends on control dependency: [if], data = [none]
} else {
getAppWriteCallback().error(getVC(), e); // depends on control dependency: [if], data = [none]
}
return null;
} // depends on control dependency: [catch], data = [none]
// getting here means an async read is in-progress
return null;
} } |
public class class_name {
public static Collection<? extends Artifact> filter(Collection<Artifact> artifacts) {
LinkedHashSet<Artifact> set = new LinkedHashSet<>();
for (Artifact artifact : artifacts) {
if (MavenArtifact.isValid(artifact)) {
set.add(artifact);
}
}
return set;
} } | public class class_name {
public static Collection<? extends Artifact> filter(Collection<Artifact> artifacts) {
LinkedHashSet<Artifact> set = new LinkedHashSet<>();
for (Artifact artifact : artifacts) {
if (MavenArtifact.isValid(artifact)) {
set.add(artifact); // depends on control dependency: [if], data = [none]
}
}
return set;
} } |
public class class_name {
private static <S, L> void updateBlockReferences(Block<S, L> block) {
UnorderedCollection<State<S, L>> states = block.getStates();
for (ElementReference ref : states.references()) {
State<S, L> state = states.get(ref);
state.setBlockReference(ref);
state.setBlock(block);
}
} } | public class class_name {
private static <S, L> void updateBlockReferences(Block<S, L> block) {
UnorderedCollection<State<S, L>> states = block.getStates();
for (ElementReference ref : states.references()) {
State<S, L> state = states.get(ref);
state.setBlockReference(ref); // depends on control dependency: [for], data = [ref]
state.setBlock(block); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private static IVarDef asVarDef( String varName, String varType, Annotated groupAnnotations, JsonObject json)
{
try
{
validIdentifier( varName);
AbstractVarDef varDef =
json.containsKey( MEMBERS_KEY)
? new VarSet( varName)
: new VarDef( varName);
varDef.setType( varType);
// Get annotations for this variable
Optional.ofNullable( json.getJsonObject( HAS_KEY))
.ifPresent( has -> has.keySet().stream().forEach( key -> varDef.setAnnotation( key, has.getString( key))));
// Get the condition for this variable
Optional.ofNullable( json.getJsonObject( WHEN_KEY))
.ifPresent( object -> varDef.setCondition( asValidCondition( object)));
if( json.containsKey( MEMBERS_KEY))
{
VarSet varSet = (VarSet) varDef;
getVarDefs( varType, json.getJsonObject( MEMBERS_KEY))
.forEach( member -> varSet.addMember( member));
if( !varSet.getMembers().hasNext())
{
throw new SystemInputException( String.format( "No members defined for VarSet=%s", varName));
}
}
else
{
VarDef var = (VarDef) varDef;
getValueDefs( json.getJsonObject( VALUES_KEY))
.forEach( valueDef -> var.addValue( valueDef));
if( !var.getValidValues().hasNext())
{
throw new SystemInputException( String.format( "No valid values defined for Var=%s", varName));
}
}
// Add any group annotations
varDef.addAnnotations( groupAnnotations);
return varDef;
}
catch( SystemInputException e)
{
throw new SystemInputException( String.format( "Error defining variable=%s", varName), e);
}
} } | public class class_name {
private static IVarDef asVarDef( String varName, String varType, Annotated groupAnnotations, JsonObject json)
{
try
{
validIdentifier( varName); // depends on control dependency: [try], data = [none]
AbstractVarDef varDef =
json.containsKey( MEMBERS_KEY)
? new VarSet( varName)
: new VarDef( varName);
varDef.setType( varType); // depends on control dependency: [try], data = [none]
// Get annotations for this variable
Optional.ofNullable( json.getJsonObject( HAS_KEY))
.ifPresent( has -> has.keySet().stream().forEach( key -> varDef.setAnnotation( key, has.getString( key)))); // depends on control dependency: [try], data = [none]
// Get the condition for this variable
Optional.ofNullable( json.getJsonObject( WHEN_KEY))
.ifPresent( object -> varDef.setCondition( asValidCondition( object))); // depends on control dependency: [try], data = [none]
if( json.containsKey( MEMBERS_KEY))
{
VarSet varSet = (VarSet) varDef;
getVarDefs( varType, json.getJsonObject( MEMBERS_KEY))
.forEach( member -> varSet.addMember( member)); // depends on control dependency: [if], data = [none]
if( !varSet.getMembers().hasNext())
{
throw new SystemInputException( String.format( "No members defined for VarSet=%s", varName));
}
}
else
{
VarDef var = (VarDef) varDef;
getValueDefs( json.getJsonObject( VALUES_KEY))
.forEach( valueDef -> var.addValue( valueDef)); // depends on control dependency: [if], data = [none]
if( !var.getValidValues().hasNext())
{
throw new SystemInputException( String.format( "No valid values defined for Var=%s", varName));
}
}
// Add any group annotations
varDef.addAnnotations( groupAnnotations); // depends on control dependency: [try], data = [none]
return varDef; // depends on control dependency: [try], data = [none]
}
catch( SystemInputException e)
{
throw new SystemInputException( String.format( "Error defining variable=%s", varName), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void populateLeaf(String parentName, Row row, Task task)
{
if (row.getInteger("TASKID") != null)
{
populateTask(row, task);
}
else
{
populateMilestone(row, task);
}
String name = task.getName();
if (name == null || name.isEmpty())
{
task.setName(parentName);
}
} } | public class class_name {
private void populateLeaf(String parentName, Row row, Task task)
{
if (row.getInteger("TASKID") != null)
{
populateTask(row, task); // depends on control dependency: [if], data = [none]
}
else
{
populateMilestone(row, task); // depends on control dependency: [if], data = [none]
}
String name = task.getName();
if (name == null || name.isEmpty())
{
task.setName(parentName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
Map<String, Object> serialize() {
final Map<String, Object> map = super.serialize();
if (datePattern != null) {
map.put(JsonSchema.KEY_DATE_PATTERN, datePattern);
}
return map;
} } | public class class_name {
@Override
Map<String, Object> serialize() {
final Map<String, Object> map = super.serialize();
if (datePattern != null) {
map.put(JsonSchema.KEY_DATE_PATTERN, datePattern); // depends on control dependency: [if], data = [none]
}
return map;
} } |
public class class_name {
public void setLanguages(java.util.Collection<DominantLanguage> languages) {
if (languages == null) {
this.languages = null;
return;
}
this.languages = new java.util.ArrayList<DominantLanguage>(languages);
} } | public class class_name {
public void setLanguages(java.util.Collection<DominantLanguage> languages) {
if (languages == null) {
this.languages = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.languages = new java.util.ArrayList<DominantLanguage>(languages);
} } |
public class class_name {
public static boolean inSubNetwork(RightInputAdapterNode riaNode, LeftTupleSource leftTupleSource) {
LeftTupleSource startTupleSource = riaNode.getStartTupleSource();
LeftTupleSource parent = riaNode.getLeftTupleSource();
while (parent != startTupleSource) {
if (parent == leftTupleSource) {
return true;
}
parent = parent.getLeftTupleSource();
}
return false;
} } | public class class_name {
public static boolean inSubNetwork(RightInputAdapterNode riaNode, LeftTupleSource leftTupleSource) {
LeftTupleSource startTupleSource = riaNode.getStartTupleSource();
LeftTupleSource parent = riaNode.getLeftTupleSource();
while (parent != startTupleSource) {
if (parent == leftTupleSource) {
return true; // depends on control dependency: [if], data = [none]
}
parent = parent.getLeftTupleSource(); // depends on control dependency: [while], data = [none]
}
return false;
} } |
public class class_name {
public WyalFile translate(WyilFile wyilFile) {
for (WyilFile.Decl.Unit unit : wyilFile.getModule().getUnits()) {
translate(unit);
}
for (WyilFile.Decl.Unit unit : wyilFile.getModule().getExterns()) {
translate(unit);
}
return wyalFile;
} } | public class class_name {
public WyalFile translate(WyilFile wyilFile) {
for (WyilFile.Decl.Unit unit : wyilFile.getModule().getUnits()) {
translate(unit); // depends on control dependency: [for], data = [unit]
}
for (WyilFile.Decl.Unit unit : wyilFile.getModule().getExterns()) {
translate(unit); // depends on control dependency: [for], data = [unit]
}
return wyalFile;
} } |
public class class_name {
public static byte[] getGlobalSegment(RandomAccessFileOrArray ra ) {
try {
JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);
sr.read();
return sr.getGlobal(true);
} catch (Exception e) {
return null;
}
} } | public class class_name {
public static byte[] getGlobalSegment(RandomAccessFileOrArray ra ) {
try {
JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);
sr.read();
// depends on control dependency: [try], data = [none]
return sr.getGlobal(true);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void writeEntry(JarEntry entry, EntryWriter entryWriter) throws IOException {
String parent = entry.getName();
if (parent.endsWith("/")) {
parent = parent.substring(0, parent.length() - 1);
}
if (parent.lastIndexOf("/") != -1) {
parent = parent.substring(0, parent.lastIndexOf("/") + 1);
if (parent.length() > 0) {
writeEntry(new JarEntry(parent), null);
}
}
if (this.writtenEntries.add(entry.getName())) {
this.jarOutput.putNextEntry(entry);
if (entryWriter != null) {
entryWriter.write(this.jarOutput);
}
this.jarOutput.closeEntry();
}
} } | public class class_name {
private void writeEntry(JarEntry entry, EntryWriter entryWriter) throws IOException {
String parent = entry.getName();
if (parent.endsWith("/")) {
parent = parent.substring(0, parent.length() - 1);
}
if (parent.lastIndexOf("/") != -1) {
parent = parent.substring(0, parent.lastIndexOf("/") + 1);
if (parent.length() > 0) {
writeEntry(new JarEntry(parent), null); // depends on control dependency: [if], data = [none]
}
}
if (this.writtenEntries.add(entry.getName())) {
this.jarOutput.putNextEntry(entry);
if (entryWriter != null) {
entryWriter.write(this.jarOutput); // depends on control dependency: [if], data = [none]
}
this.jarOutput.closeEntry();
}
} } |
public class class_name {
public void doMutation(PermutationSolution<T> solution) {
int permutationLength ;
permutationLength = solution.getNumberOfVariables() ;
if ((permutationLength != 0) && (permutationLength != 1)) {
if (mutationRandomGenerator.getRandomValue() < mutationProbability) {
int pos1 = positionRandomGenerator.getRandomValue(0, permutationLength - 1);
int pos2 = positionRandomGenerator.getRandomValue(0, permutationLength - 1);
while (pos1 == pos2) {
if (pos1 == (permutationLength - 1))
pos2 = positionRandomGenerator.getRandomValue(0, permutationLength - 2);
else
pos2 = positionRandomGenerator.getRandomValue(pos1, permutationLength - 1);
}
T temp = solution.getVariableValue(pos1);
solution.setVariableValue(pos1, solution.getVariableValue(pos2));
solution.setVariableValue(pos2, temp);
}
}
} } | public class class_name {
public void doMutation(PermutationSolution<T> solution) {
int permutationLength ;
permutationLength = solution.getNumberOfVariables() ;
if ((permutationLength != 0) && (permutationLength != 1)) {
if (mutationRandomGenerator.getRandomValue() < mutationProbability) {
int pos1 = positionRandomGenerator.getRandomValue(0, permutationLength - 1);
int pos2 = positionRandomGenerator.getRandomValue(0, permutationLength - 1);
while (pos1 == pos2) {
if (pos1 == (permutationLength - 1))
pos2 = positionRandomGenerator.getRandomValue(0, permutationLength - 2);
else
pos2 = positionRandomGenerator.getRandomValue(pos1, permutationLength - 1);
}
T temp = solution.getVariableValue(pos1);
solution.setVariableValue(pos1, solution.getVariableValue(pos2)); // depends on control dependency: [if], data = [none]
solution.setVariableValue(pos2, temp); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
InternalProvisionException addSource(Object source) {
if (source == SourceProvider.UNKNOWN_SOURCE) {
return this;
}
int sz = sourcesToPrepend.size();
if (sz > 0 && sourcesToPrepend.get(sz - 1) == source) {
// This is for when there are two identical sources added in a row. This behavior is copied
// from Errors.withSource where it can happen when an constructor/provider method throws an
// exception
return this;
}
sourcesToPrepend.add(source);
return this;
} } | public class class_name {
InternalProvisionException addSource(Object source) {
if (source == SourceProvider.UNKNOWN_SOURCE) {
return this; // depends on control dependency: [if], data = [none]
}
int sz = sourcesToPrepend.size();
if (sz > 0 && sourcesToPrepend.get(sz - 1) == source) {
// This is for when there are two identical sources added in a row. This behavior is copied
// from Errors.withSource where it can happen when an constructor/provider method throws an
// exception
return this; // depends on control dependency: [if], data = [none]
}
sourcesToPrepend.add(source);
return this;
} } |
public class class_name {
private CharSequence getCharSequenceFromIntent(@NonNull final Intent intent,
@NonNull final String name) {
CharSequence charSequence = intent.getCharSequenceExtra(name);
if (charSequence == null) {
int resourceId = intent.getIntExtra(name, 0);
if (resourceId != 0) {
charSequence = getText(resourceId);
}
}
return charSequence;
} } | public class class_name {
private CharSequence getCharSequenceFromIntent(@NonNull final Intent intent,
@NonNull final String name) {
CharSequence charSequence = intent.getCharSequenceExtra(name);
if (charSequence == null) {
int resourceId = intent.getIntExtra(name, 0);
if (resourceId != 0) {
charSequence = getText(resourceId); // depends on control dependency: [if], data = [(resourceId]
}
}
return charSequence;
} } |
public class class_name {
@NonNull
public List<Span> getSpans(int start, int end) {
final int length = length();
if (!isPositionValid(length, start, end)) {
// we might as well throw here
return Collections.emptyList();
}
// all requested
if (start == 0
&& length == end) {
// but also copy (do not allow external modification)
final List<Span> list = new ArrayList<>(spans);
Collections.reverse(list);
return Collections.unmodifiableList(list);
}
final List<Span> list = new ArrayList<>(0);
final Iterator<Span> iterator = spans.descendingIterator();
Span span;
while (iterator.hasNext()) {
span = iterator.next();
// we must execute 2 checks: if overlap with specified range or fully include it
// if span.start is >= range.start -> check if it's before range.end
// if span.end is <= end -> check if it's after range.start
if (
(span.start >= start && span.start < end)
|| (span.end <= end && span.end > start)
|| (span.start < start && span.end > end)) {
list.add(span);
}
}
return Collections.unmodifiableList(list);
} } | public class class_name {
@NonNull
public List<Span> getSpans(int start, int end) {
final int length = length();
if (!isPositionValid(length, start, end)) {
// we might as well throw here
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
// all requested
if (start == 0
&& length == end) {
// but also copy (do not allow external modification)
final List<Span> list = new ArrayList<>(spans);
Collections.reverse(list); // depends on control dependency: [if], data = [none]
return Collections.unmodifiableList(list); // depends on control dependency: [if], data = [none]
}
final List<Span> list = new ArrayList<>(0);
final Iterator<Span> iterator = spans.descendingIterator();
Span span;
while (iterator.hasNext()) {
span = iterator.next(); // depends on control dependency: [while], data = [none]
// we must execute 2 checks: if overlap with specified range or fully include it
// if span.start is >= range.start -> check if it's before range.end
// if span.end is <= end -> check if it's after range.start
if (
(span.start >= start && span.start < end)
|| (span.end <= end && span.end > start)
|| (span.start < start && span.end > end)) {
list.add(span); // depends on control dependency: [if], data = [(]
}
}
return Collections.unmodifiableList(list);
} } |
public class class_name {
public void wipeInMemorySettings() {
this.waitUntilInitialized();
syncLock.lock();
try {
this.instanceChangeStreamListener.stop();
if (instancesColl.find().first() == null) {
throw new IllegalStateException("expected to find instance configuration");
}
this.syncConfig = new InstanceSynchronizationConfig(configDb);
this.instanceChangeStreamListener = new InstanceChangeStreamListenerImpl(
syncConfig,
service,
networkMonitor,
authMonitor
);
this.isConfigured = false;
this.stop();
} finally {
syncLock.unlock();
}
} } | public class class_name {
public void wipeInMemorySettings() {
this.waitUntilInitialized();
syncLock.lock();
try {
this.instanceChangeStreamListener.stop(); // depends on control dependency: [try], data = [none]
if (instancesColl.find().first() == null) {
throw new IllegalStateException("expected to find instance configuration");
}
this.syncConfig = new InstanceSynchronizationConfig(configDb); // depends on control dependency: [try], data = [none]
this.instanceChangeStreamListener = new InstanceChangeStreamListenerImpl(
syncConfig,
service,
networkMonitor,
authMonitor
); // depends on control dependency: [try], data = [none]
this.isConfigured = false; // depends on control dependency: [try], data = [none]
this.stop(); // depends on control dependency: [try], data = [none]
} finally {
syncLock.unlock();
}
} } |
public class class_name {
public Message editMessageText(String chatId, Long messageId, String text, ParseMode parseMode, boolean disableWebPagePreview, InlineReplyMarkup inlineReplyMarkup) {
if(chatId != null && messageId != null && text != null) {
JSONObject jsonResponse = this.editMessageText(chatId, messageId, null, text, parseMode, disableWebPagePreview, inlineReplyMarkup);
if (jsonResponse != null) {
return MessageImpl.createMessage(jsonResponse.getJSONObject("result"), this);
}
}
return null;
} } | public class class_name {
public Message editMessageText(String chatId, Long messageId, String text, ParseMode parseMode, boolean disableWebPagePreview, InlineReplyMarkup inlineReplyMarkup) {
if(chatId != null && messageId != null && text != null) {
JSONObject jsonResponse = this.editMessageText(chatId, messageId, null, text, parseMode, disableWebPagePreview, inlineReplyMarkup);
if (jsonResponse != null) {
return MessageImpl.createMessage(jsonResponse.getJSONObject("result"), this); // depends on control dependency: [if], data = [(jsonResponse]
}
}
return null;
} } |
public class class_name {
public <T extends View> ArrayList<T> getFilteredViews(Class<T> classToFilterBy) {
ArrayList<T> filteredViews = new ArrayList<T>();
List<View> allViews = this.getViews();
for(View view : allViews){
if (view != null && classToFilterBy.isAssignableFrom(view.getClass())) {
filteredViews.add(classToFilterBy.cast(view));
}
}
return filteredViews;
} } | public class class_name {
public <T extends View> ArrayList<T> getFilteredViews(Class<T> classToFilterBy) {
ArrayList<T> filteredViews = new ArrayList<T>();
List<View> allViews = this.getViews();
for(View view : allViews){
if (view != null && classToFilterBy.isAssignableFrom(view.getClass())) {
filteredViews.add(classToFilterBy.cast(view)); // depends on control dependency: [if], data = [(view]
}
}
return filteredViews;
} } |
public class class_name {
public void printParts() {
if (parts == null) {
return;
}
for (int i = 0; i < parts.size(); i++) {
System.out.println("\nParts[" + i + "]:");
System.out.println(parts.get(i));
}
} } | public class class_name {
public void printParts() {
if (parts == null) {
return; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < parts.size(); i++) {
System.out.println("\nParts[" + i + "]:"); // depends on control dependency: [for], data = [i]
System.out.println(parts.get(i)); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
@Override
protected HashMap<String, String> childValue(
HashMap<String, String> parentValue) {
if (parentValue == null) {
return null;
} else {
return new HashMap<String, String>(parentValue);
}
} } | public class class_name {
@Override
protected HashMap<String, String> childValue(
HashMap<String, String> parentValue) {
if (parentValue == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
return new HashMap<String, String>(parentValue); // depends on control dependency: [if], data = [(parentValue]
}
} } |
public class class_name {
private void addQueryParams(final Request request) {
if (recurring != null) {
request.addQueryParam("Recurring", recurring.toString());
}
if (triggerBy != null) {
request.addQueryParam("TriggerBy", triggerBy.toString());
}
if (usageCategory != null) {
request.addQueryParam("UsageCategory", usageCategory.toString());
}
if (getPageSize() != null) {
request.addQueryParam("PageSize", Integer.toString(getPageSize()));
}
} } | public class class_name {
private void addQueryParams(final Request request) {
if (recurring != null) {
request.addQueryParam("Recurring", recurring.toString()); // depends on control dependency: [if], data = [none]
}
if (triggerBy != null) {
request.addQueryParam("TriggerBy", triggerBy.toString()); // depends on control dependency: [if], data = [none]
}
if (usageCategory != null) {
request.addQueryParam("UsageCategory", usageCategory.toString()); // depends on control dependency: [if], data = [none]
}
if (getPageSize() != null) {
request.addQueryParam("PageSize", Integer.toString(getPageSize())); // depends on control dependency: [if], data = [(getPageSize()]
}
} } |
public class class_name {
private void update() {
synchronized (lock) {
if (!observing) { return; }
try {
Log.i(DOMAIN, "%s: Querying...", this);
final ResultSet oldResultSet = resultSet;
final ResultSet newResultSet = (oldResultSet == null) ? query.execute() : oldResultSet.refresh();
willUpdate = false;
lastUpdatedAt = System.currentTimeMillis();
if (newResultSet != null) {
if (oldResultSet != null) { Log.i(DOMAIN, "%s: Changed!", this); }
resultSet = newResultSet;
changeNotifier.postChange(new QueryChange(this.query, resultSet, null));
}
else {
Log.i(DOMAIN, "%s: ...no change", this);
}
}
catch (CouchbaseLiteException e) {
changeNotifier.postChange(new QueryChange(this.query, null, e));
}
}
} } | public class class_name {
private void update() {
synchronized (lock) {
if (!observing) { return; } // depends on control dependency: [if], data = [none]
try {
Log.i(DOMAIN, "%s: Querying...", this); // depends on control dependency: [try], data = [none]
final ResultSet oldResultSet = resultSet;
final ResultSet newResultSet = (oldResultSet == null) ? query.execute() : oldResultSet.refresh();
willUpdate = false; // depends on control dependency: [try], data = [none]
lastUpdatedAt = System.currentTimeMillis(); // depends on control dependency: [try], data = [none]
if (newResultSet != null) {
if (oldResultSet != null) { Log.i(DOMAIN, "%s: Changed!", this); } // depends on control dependency: [if], data = [none]
resultSet = newResultSet; // depends on control dependency: [if], data = [none]
changeNotifier.postChange(new QueryChange(this.query, resultSet, null)); // depends on control dependency: [if], data = [null)]
}
else {
Log.i(DOMAIN, "%s: ...no change", this); // depends on control dependency: [if], data = [none]
}
}
catch (CouchbaseLiteException e) {
changeNotifier.postChange(new QueryChange(this.query, null, e));
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void marshall(AudioLanguageSelection audioLanguageSelection, ProtocolMarshaller protocolMarshaller) {
if (audioLanguageSelection == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(audioLanguageSelection.getLanguageCode(), LANGUAGECODE_BINDING);
protocolMarshaller.marshall(audioLanguageSelection.getLanguageSelectionPolicy(), LANGUAGESELECTIONPOLICY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AudioLanguageSelection audioLanguageSelection, ProtocolMarshaller protocolMarshaller) {
if (audioLanguageSelection == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(audioLanguageSelection.getLanguageCode(), LANGUAGECODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(audioLanguageSelection.getLanguageSelectionPolicy(), LANGUAGESELECTIONPOLICY_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 List<String> listFiles( final File dir, final String parentName )
{
final List<String> fileNames = new ArrayList<String>();
File[] files = null;
if( dir.canRead() )
{
files = dir.listFiles();
}
if( files != null )
{
for( File file : files )
{
if( file.isDirectory() )
{
fileNames.addAll( listFiles( file, parentName + file.getName() + "/" ) );
}
else
{
fileNames.add( parentName + file.getName() );
}
}
}
return fileNames;
} } | public class class_name {
private List<String> listFiles( final File dir, final String parentName )
{
final List<String> fileNames = new ArrayList<String>();
File[] files = null;
if( dir.canRead() )
{
files = dir.listFiles(); // depends on control dependency: [if], data = [none]
}
if( files != null )
{
for( File file : files )
{
if( file.isDirectory() )
{
fileNames.addAll( listFiles( file, parentName + file.getName() + "/" ) ); // depends on control dependency: [if], data = [none]
}
else
{
fileNames.add( parentName + file.getName() ); // depends on control dependency: [if], data = [none]
}
}
}
return fileNames;
} } |
public class class_name {
public void reloadCollection(String collectionName) {
CollectionMetaData cmd = cmdMap.get(collectionName);
cmd.getCollectionLock().writeLock().lock();
try {
File collectionFile = fileObjectsRef.get().get(collectionName);
if(null == collectionFile) {
// Lets create a file now
collectionFile = new File(dbConfig.getDbFilesLocation(), collectionName + ".json");
if(!collectionFile.exists()) {
throw new InvalidJsonDbApiUsageException("Collection by name '" + collectionName + "' cannot be found at " + collectionFile.getAbsolutePath());
}
Map<String, File> fileObjectMap = fileObjectsRef.get();
Map<String, File> newFileObjectmap = new ConcurrentHashMap<String, File>(fileObjectMap);
newFileObjectmap.put(collectionName, collectionFile);
fileObjectsRef.set(newFileObjectmap);
}
if (null != cmd && null != collectionFile) {
Map<Object, ?> collection = loadCollection(collectionFile, collectionName, cmd);
if (null != collection) {
JXPathContext newContext = JXPathContext.newContext(collection.values());
contextsRef.get().put(collectionName, newContext);
collectionsRef.get().put(collectionName, collection);
} else {
//Since this is a reload attempt its possible the .json files have disappeared in the interim a very rare thing
contextsRef.get().remove(collectionName);
collectionsRef.get().remove(collectionName);
}
}
} finally {
cmd.getCollectionLock().writeLock().unlock();
}
} } | public class class_name {
public void reloadCollection(String collectionName) {
CollectionMetaData cmd = cmdMap.get(collectionName);
cmd.getCollectionLock().writeLock().lock();
try {
File collectionFile = fileObjectsRef.get().get(collectionName);
if(null == collectionFile) {
// Lets create a file now
collectionFile = new File(dbConfig.getDbFilesLocation(), collectionName + ".json"); // depends on control dependency: [if], data = [none]
if(!collectionFile.exists()) {
throw new InvalidJsonDbApiUsageException("Collection by name '" + collectionName + "' cannot be found at " + collectionFile.getAbsolutePath());
}
Map<String, File> fileObjectMap = fileObjectsRef.get();
Map<String, File> newFileObjectmap = new ConcurrentHashMap<String, File>(fileObjectMap);
newFileObjectmap.put(collectionName, collectionFile); // depends on control dependency: [if], data = [collectionFile)]
fileObjectsRef.set(newFileObjectmap); // depends on control dependency: [if], data = [none]
}
if (null != cmd && null != collectionFile) {
Map<Object, ?> collection = loadCollection(collectionFile, collectionName, cmd);
if (null != collection) {
JXPathContext newContext = JXPathContext.newContext(collection.values());
contextsRef.get().put(collectionName, newContext); // depends on control dependency: [if], data = [none]
collectionsRef.get().put(collectionName, collection); // depends on control dependency: [if], data = [collection)]
} else {
//Since this is a reload attempt its possible the .json files have disappeared in the interim a very rare thing
contextsRef.get().remove(collectionName); // depends on control dependency: [if], data = [none]
collectionsRef.get().remove(collectionName); // depends on control dependency: [if], data = [none]
}
}
} finally {
cmd.getCollectionLock().writeLock().unlock();
}
} } |
public class class_name {
private void saveToSession(HttpServletRequest req, String reqURL, Map params) {
HttpSession postparamsession = req.getSession(true);
if (postparamsession != null && params != null && !params.isEmpty()) {
postparamsession.setAttribute(INITIAL_URL, reqURL);
postparamsession.setAttribute(PARAM_NAMES, null);
postparamsession.setAttribute(PARAM_VALUES, params);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "URL saved: " + reqURL.toString());
}
}
} } | public class class_name {
private void saveToSession(HttpServletRequest req, String reqURL, Map params) {
HttpSession postparamsession = req.getSession(true);
if (postparamsession != null && params != null && !params.isEmpty()) {
postparamsession.setAttribute(INITIAL_URL, reqURL); // depends on control dependency: [if], data = [none]
postparamsession.setAttribute(PARAM_NAMES, null); // depends on control dependency: [if], data = [none]
postparamsession.setAttribute(PARAM_VALUES, params); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "URL saved: " + reqURL.toString()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected void triggerSessionClosed(String reason) {
// for (ContentNegotiator contentNegotiator : contentNegotiators) {
//
// contentNegotiator.stopJingleMediaSession();
//
// for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
// candidate.removeCandidateEcho();
// }
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleSessionListener) {
JingleSessionListener sli = (JingleSessionListener) li;
sli.sessionClosed(reason, this);
}
}
close();
} } | public class class_name {
protected void triggerSessionClosed(String reason) {
// for (ContentNegotiator contentNegotiator : contentNegotiators) {
//
// contentNegotiator.stopJingleMediaSession();
//
// for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
// candidate.removeCandidateEcho();
// }
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleSessionListener) {
JingleSessionListener sli = (JingleSessionListener) li;
sli.sessionClosed(reason, this); // depends on control dependency: [if], data = [none]
}
}
close();
} } |
public class class_name {
public static Graph<String, String> loadUndirectedGraphEdgeListFile(String path, int numVertices, String delim,
boolean allowMultipleEdges) throws IOException {
Graph<String, String> graph = new Graph<>(numVertices, allowMultipleEdges, new StringVertexFactory());
EdgeLineProcessor<String> lineProcessor = new DelimitedEdgeLineProcessor(delim, false);
try (BufferedReader br = new BufferedReader(new FileReader(new File(path)))) {
String line;
while ((line = br.readLine()) != null) {
Edge<String> edge = lineProcessor.processLine(line);
if (edge != null) {
graph.addEdge(edge);
}
}
}
return graph;
} } | public class class_name {
public static Graph<String, String> loadUndirectedGraphEdgeListFile(String path, int numVertices, String delim,
boolean allowMultipleEdges) throws IOException {
Graph<String, String> graph = new Graph<>(numVertices, allowMultipleEdges, new StringVertexFactory());
EdgeLineProcessor<String> lineProcessor = new DelimitedEdgeLineProcessor(delim, false);
try (BufferedReader br = new BufferedReader(new FileReader(new File(path)))) {
String line;
while ((line = br.readLine()) != null) {
Edge<String> edge = lineProcessor.processLine(line);
if (edge != null) {
graph.addEdge(edge); // depends on control dependency: [if], data = [(edge]
}
}
}
return graph;
} } |
public class class_name {
@Override
public int spanQuickCheckYes(CharSequence s) {
UnicodeSet.SpanCondition spanCondition=UnicodeSet.SpanCondition.SIMPLE;
for(int prevSpanLimit=0; prevSpanLimit<s.length();) {
int spanLimit=set.span(s, prevSpanLimit, spanCondition);
if(spanCondition==UnicodeSet.SpanCondition.NOT_CONTAINED) {
spanCondition=UnicodeSet.SpanCondition.SIMPLE;
} else {
int yesLimit=
prevSpanLimit+
norm2.spanQuickCheckYes(s.subSequence(prevSpanLimit, spanLimit));
if(yesLimit<spanLimit) {
return yesLimit;
}
spanCondition=UnicodeSet.SpanCondition.NOT_CONTAINED;
}
prevSpanLimit=spanLimit;
}
return s.length();
} } | public class class_name {
@Override
public int spanQuickCheckYes(CharSequence s) {
UnicodeSet.SpanCondition spanCondition=UnicodeSet.SpanCondition.SIMPLE;
for(int prevSpanLimit=0; prevSpanLimit<s.length();) {
int spanLimit=set.span(s, prevSpanLimit, spanCondition);
if(spanCondition==UnicodeSet.SpanCondition.NOT_CONTAINED) {
spanCondition=UnicodeSet.SpanCondition.SIMPLE; // depends on control dependency: [if], data = [none]
} else {
int yesLimit=
prevSpanLimit+
norm2.spanQuickCheckYes(s.subSequence(prevSpanLimit, spanLimit));
if(yesLimit<spanLimit) {
return yesLimit; // depends on control dependency: [if], data = [none]
}
spanCondition=UnicodeSet.SpanCondition.NOT_CONTAINED; // depends on control dependency: [if], data = [none]
}
prevSpanLimit=spanLimit; // depends on control dependency: [for], data = [prevSpanLimit]
}
return s.length();
} } |
public class class_name {
public void marshall(EnabledServicePrincipal enabledServicePrincipal, ProtocolMarshaller protocolMarshaller) {
if (enabledServicePrincipal == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(enabledServicePrincipal.getServicePrincipal(), SERVICEPRINCIPAL_BINDING);
protocolMarshaller.marshall(enabledServicePrincipal.getDateEnabled(), DATEENABLED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(EnabledServicePrincipal enabledServicePrincipal, ProtocolMarshaller protocolMarshaller) {
if (enabledServicePrincipal == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(enabledServicePrincipal.getServicePrincipal(), SERVICEPRINCIPAL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(enabledServicePrincipal.getDateEnabled(), DATEENABLED_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean hasUnqualifiedStarSelectItem() {
for (SelectItem each : items) {
if (each instanceof StarSelectItem && !((StarSelectItem) each).getOwner().isPresent()) {
return true;
}
}
return false;
} } | public class class_name {
public boolean hasUnqualifiedStarSelectItem() {
for (SelectItem each : items) {
if (each instanceof StarSelectItem && !((StarSelectItem) each).getOwner().isPresent()) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static <T> FromStringBasedConverter<T> getIfEligible(Class<T> clazz) {
try {
final Method method = clazz.getMethod(FROM_STRING, String.class);
if (Modifier.isStatic(method.getModifiers())) {
if (!method.isAccessible()) {
method.setAccessible(true);
}
return new FromStringBasedConverter<>(clazz, method);
} else {
// The from method is present but it must be static.
return null;
}
} catch (NoSuchMethodException e) { //NOSONAR
// The class does not have the right method, return null.
return null;
}
} } | public class class_name {
public static <T> FromStringBasedConverter<T> getIfEligible(Class<T> clazz) {
try {
final Method method = clazz.getMethod(FROM_STRING, String.class);
if (Modifier.isStatic(method.getModifiers())) {
if (!method.isAccessible()) {
method.setAccessible(true); // depends on control dependency: [if], data = [none]
}
return new FromStringBasedConverter<>(clazz, method); // depends on control dependency: [if], data = [none]
} else {
// The from method is present but it must be static.
return null; // depends on control dependency: [if], data = [none]
}
} catch (NoSuchMethodException e) { //NOSONAR
// The class does not have the right method, return null.
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static final void setGroup(String name, Path... files) throws IOException
{
if (supports("posix"))
{
for (Path file : files)
{
FileSystem fs = file.getFileSystem();
UserPrincipalLookupService upls = fs.getUserPrincipalLookupService();
GroupPrincipal group = upls.lookupPrincipalByGroupName(name);
PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class);
view.setGroup(group);
}
}
else
{
JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setGroup(%s)", name);
}
} } | public class class_name {
public static final void setGroup(String name, Path... files) throws IOException
{
if (supports("posix"))
{
for (Path file : files)
{
FileSystem fs = file.getFileSystem();
UserPrincipalLookupService upls = fs.getUserPrincipalLookupService();
GroupPrincipal group = upls.lookupPrincipalByGroupName(name);
PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class);
view.setGroup(group);
// depends on control dependency: [for], data = [none]
}
}
else
{
JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setGroup(%s)", name);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean onTouchEvent(MotionEvent ev) {
try {
if (ev == null || getAdapter() == null || getAdapter().getCount() == 0) {
return false;
}
return super.onTouchEvent(ev);
} catch (RuntimeException e) {
Log.e(TAG, "Exception during WrapContentViewPager onTouchEvent: " +
"index out of bound, or nullpointer even if we check the adapter before " + e.toString());
return false;
}
} } | public class class_name {
@Override
public boolean onTouchEvent(MotionEvent ev) {
try {
if (ev == null || getAdapter() == null || getAdapter().getCount() == 0) {
return false; // depends on control dependency: [if], data = [none]
}
return super.onTouchEvent(ev); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
Log.e(TAG, "Exception during WrapContentViewPager onTouchEvent: " +
"index out of bound, or nullpointer even if we check the adapter before " + e.toString());
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public PrepareResult executeBatch() throws SQLException {
int paramCount = getParamCount();
if (binaryProtocol) {
if (readPrepareStmtResult) {
parameterTypeHeader = new ColumnType[paramCount];
if (prepareResult == null
&& protocol.getOptions().cachePrepStmts
&& protocol.getOptions().useServerPrepStmts) {
String key = protocol.getDatabase() + "-" + sql;
prepareResult = protocol.prepareStatementCache().get(key);
if (prepareResult != null && !((ServerPrepareResult) prepareResult)
.incrementShareCounter()) {
//in cache but been de-allocated
prepareResult = null;
}
}
statementId =
(prepareResult == null) ? -1 : ((ServerPrepareResult) prepareResult).getStatementId();
} else if (prepareResult != null) {
statementId = ((ServerPrepareResult) prepareResult).getStatementId();
}
}
return executeBatchStandard(paramCount);
} } | public class class_name {
public PrepareResult executeBatch() throws SQLException {
int paramCount = getParamCount();
if (binaryProtocol) {
if (readPrepareStmtResult) {
parameterTypeHeader = new ColumnType[paramCount]; // depends on control dependency: [if], data = [none]
if (prepareResult == null
&& protocol.getOptions().cachePrepStmts
&& protocol.getOptions().useServerPrepStmts) {
String key = protocol.getDatabase() + "-" + sql;
prepareResult = protocol.prepareStatementCache().get(key); // depends on control dependency: [if], data = [none]
if (prepareResult != null && !((ServerPrepareResult) prepareResult)
.incrementShareCounter()) {
//in cache but been de-allocated
prepareResult = null; // depends on control dependency: [if], data = [none]
}
}
statementId =
(prepareResult == null) ? -1 : ((ServerPrepareResult) prepareResult).getStatementId(); // depends on control dependency: [if], data = [none]
} else if (prepareResult != null) {
statementId = ((ServerPrepareResult) prepareResult).getStatementId(); // depends on control dependency: [if], data = [none]
}
}
return executeBatchStandard(paramCount);
} } |
public class class_name {
public static String encode(byte[] data) {
StringBuilder builder = new StringBuilder();
for (int position = 0; position < data.length; position += 3) {
builder.append(encodeGroup(data, position));
}
return builder.toString();
} } | public class class_name {
public static String encode(byte[] data) {
StringBuilder builder = new StringBuilder();
for (int position = 0; position < data.length; position += 3) {
builder.append(encodeGroup(data, position)); // depends on control dependency: [for], data = [position]
}
return builder.toString();
} } |
public class class_name {
public static String getMessage (Throwable ex)
{
String msg = DEFAULT_ERROR_MSG;
for (int i = 0; i < _keys.size(); i++) {
Class<?> cl = _keys.get(i);
if (cl.isInstance(ex)) {
msg = _values.get(i);
break;
}
}
return msg.replace(MESSAGE_MARKER, ex.getMessage());
} } | public class class_name {
public static String getMessage (Throwable ex)
{
String msg = DEFAULT_ERROR_MSG;
for (int i = 0; i < _keys.size(); i++) {
Class<?> cl = _keys.get(i);
if (cl.isInstance(ex)) {
msg = _values.get(i); // depends on control dependency: [if], data = [none]
break;
}
}
return msg.replace(MESSAGE_MARKER, ex.getMessage());
} } |
public class class_name {
private static DimFilter doSimplify(final List<DimFilter> children, boolean disjunction)
{
// Copy children list
final List<DimFilter> newChildren = Lists.newArrayList(children);
// Group Bound filters by dimension, extractionFn, and comparator and compute a RangeSet for each one.
final Map<BoundRefKey, List<BoundDimFilter>> bounds = new HashMap<>();
final Iterator<DimFilter> iterator = newChildren.iterator();
while (iterator.hasNext()) {
final DimFilter child = iterator.next();
if (child.equals(Filtration.matchNothing())) {
// Child matches nothing, equivalent to FALSE
// OR with FALSE => ignore
// AND with FALSE => always false, short circuit
if (disjunction) {
iterator.remove();
} else {
return Filtration.matchNothing();
}
} else if (child.equals(Filtration.matchEverything())) {
// Child matches everything, equivalent to TRUE
// OR with TRUE => always true, short circuit
// AND with TRUE => ignore
if (disjunction) {
return Filtration.matchEverything();
} else {
iterator.remove();
}
} else if (child instanceof BoundDimFilter) {
final BoundDimFilter bound = (BoundDimFilter) child;
final BoundRefKey boundRefKey = BoundRefKey.from(bound);
List<BoundDimFilter> filterList = bounds.get(boundRefKey);
if (filterList == null) {
filterList = new ArrayList<>();
bounds.put(boundRefKey, filterList);
}
filterList.add(bound);
}
}
// Try to simplify filters within each group.
for (Map.Entry<BoundRefKey, List<BoundDimFilter>> entry : bounds.entrySet()) {
final BoundRefKey boundRefKey = entry.getKey();
final List<BoundDimFilter> filterList = entry.getValue();
// Create a RangeSet for this group.
final RangeSet<BoundValue> rangeSet = disjunction
? RangeSets.unionRanges(Bounds.toRanges(filterList))
: RangeSets.intersectRanges(Bounds.toRanges(filterList));
if (rangeSet.asRanges().size() < filterList.size()) {
// We found a simplification. Remove the old filters and add new ones.
for (final BoundDimFilter bound : filterList) {
if (!newChildren.remove(bound)) {
throw new ISE("WTF?! Tried to remove bound but couldn't?");
}
}
if (rangeSet.asRanges().isEmpty()) {
// range set matches nothing, equivalent to FALSE
// OR with FALSE => ignore
// AND with FALSE => always false, short circuit
if (disjunction) {
newChildren.add(Filtration.matchNothing());
} else {
return Filtration.matchNothing();
}
}
for (final Range<BoundValue> range : rangeSet.asRanges()) {
if (!range.hasLowerBound() && !range.hasUpperBound()) {
// range matches all, equivalent to TRUE
// AND with TRUE => ignore
// OR with TRUE => always true; short circuit
if (disjunction) {
return Filtration.matchEverything();
} else {
newChildren.add(Filtration.matchEverything());
}
} else {
newChildren.add(Bounds.toFilter(boundRefKey, range));
}
}
}
}
Preconditions.checkState(newChildren.size() > 0, "newChildren.size > 0");
if (newChildren.size() == 1) {
return newChildren.get(0);
} else {
return disjunction ? new OrDimFilter(newChildren) : new AndDimFilter(newChildren);
}
} } | public class class_name {
private static DimFilter doSimplify(final List<DimFilter> children, boolean disjunction)
{
// Copy children list
final List<DimFilter> newChildren = Lists.newArrayList(children);
// Group Bound filters by dimension, extractionFn, and comparator and compute a RangeSet for each one.
final Map<BoundRefKey, List<BoundDimFilter>> bounds = new HashMap<>();
final Iterator<DimFilter> iterator = newChildren.iterator();
while (iterator.hasNext()) {
final DimFilter child = iterator.next();
if (child.equals(Filtration.matchNothing())) {
// Child matches nothing, equivalent to FALSE
// OR with FALSE => ignore
// AND with FALSE => always false, short circuit
if (disjunction) {
iterator.remove(); // depends on control dependency: [if], data = [none]
} else {
return Filtration.matchNothing(); // depends on control dependency: [if], data = [none]
}
} else if (child.equals(Filtration.matchEverything())) {
// Child matches everything, equivalent to TRUE
// OR with TRUE => always true, short circuit
// AND with TRUE => ignore
if (disjunction) {
return Filtration.matchEverything(); // depends on control dependency: [if], data = [none]
} else {
iterator.remove(); // depends on control dependency: [if], data = [none]
}
} else if (child instanceof BoundDimFilter) {
final BoundDimFilter bound = (BoundDimFilter) child;
final BoundRefKey boundRefKey = BoundRefKey.from(bound);
List<BoundDimFilter> filterList = bounds.get(boundRefKey);
if (filterList == null) {
filterList = new ArrayList<>(); // depends on control dependency: [if], data = [none]
bounds.put(boundRefKey, filterList); // depends on control dependency: [if], data = [none]
}
filterList.add(bound); // depends on control dependency: [if], data = [none]
}
}
// Try to simplify filters within each group.
for (Map.Entry<BoundRefKey, List<BoundDimFilter>> entry : bounds.entrySet()) {
final BoundRefKey boundRefKey = entry.getKey();
final List<BoundDimFilter> filterList = entry.getValue();
// Create a RangeSet for this group.
final RangeSet<BoundValue> rangeSet = disjunction
? RangeSets.unionRanges(Bounds.toRanges(filterList))
: RangeSets.intersectRanges(Bounds.toRanges(filterList));
if (rangeSet.asRanges().size() < filterList.size()) {
// We found a simplification. Remove the old filters and add new ones.
for (final BoundDimFilter bound : filterList) {
if (!newChildren.remove(bound)) {
throw new ISE("WTF?! Tried to remove bound but couldn't?");
}
}
if (rangeSet.asRanges().isEmpty()) {
// range set matches nothing, equivalent to FALSE
// OR with FALSE => ignore
// AND with FALSE => always false, short circuit
if (disjunction) {
newChildren.add(Filtration.matchNothing()); // depends on control dependency: [if], data = [none]
} else {
return Filtration.matchNothing(); // depends on control dependency: [if], data = [none]
}
}
for (final Range<BoundValue> range : rangeSet.asRanges()) {
if (!range.hasLowerBound() && !range.hasUpperBound()) {
// range matches all, equivalent to TRUE
// AND with TRUE => ignore
// OR with TRUE => always true; short circuit
if (disjunction) {
return Filtration.matchEverything(); // depends on control dependency: [if], data = [none]
} else {
newChildren.add(Filtration.matchEverything()); // depends on control dependency: [if], data = [none]
}
} else {
newChildren.add(Bounds.toFilter(boundRefKey, range)); // depends on control dependency: [if], data = [none]
}
}
}
}
Preconditions.checkState(newChildren.size() > 0, "newChildren.size > 0");
if (newChildren.size() == 1) {
return newChildren.get(0); // depends on control dependency: [if], data = [none]
} else {
return disjunction ? new OrDimFilter(newChildren) : new AndDimFilter(newChildren); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void commit(long index) {
if (event != null && event.eventIndex == index) {
events.add(event);
sendEvent(event);
}
} } | public class class_name {
void commit(long index) {
if (event != null && event.eventIndex == index) {
events.add(event); // depends on control dependency: [if], data = [none]
sendEvent(event); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void consumeStack(Instruction ins) {
ConstantPoolGen cpg = getCPG();
TypeFrame frame = getFrame();
int numWordsConsumed = ins.consumeStack(cpg);
if (numWordsConsumed == Const.UNPREDICTABLE) {
throw new InvalidBytecodeException("Unpredictable stack consumption for " + ins);
}
if (numWordsConsumed > frame.getStackDepth()) {
throw new InvalidBytecodeException("Stack underflow for " + ins + ", " + numWordsConsumed + " needed, " + frame.getStackDepth() + " avail, frame is " + frame);
}
try {
while (numWordsConsumed-- > 0) {
frame.popValue();
}
} catch (DataflowAnalysisException e) {
throw new InvalidBytecodeException("Stack underflow for " + ins + ": " + e.getMessage());
}
} } | public class class_name {
protected void consumeStack(Instruction ins) {
ConstantPoolGen cpg = getCPG();
TypeFrame frame = getFrame();
int numWordsConsumed = ins.consumeStack(cpg);
if (numWordsConsumed == Const.UNPREDICTABLE) {
throw new InvalidBytecodeException("Unpredictable stack consumption for " + ins);
}
if (numWordsConsumed > frame.getStackDepth()) {
throw new InvalidBytecodeException("Stack underflow for " + ins + ", " + numWordsConsumed + " needed, " + frame.getStackDepth() + " avail, frame is " + frame);
}
try {
while (numWordsConsumed-- > 0) {
frame.popValue(); // depends on control dependency: [while], data = [none]
}
} catch (DataflowAnalysisException e) {
throw new InvalidBytecodeException("Stack underflow for " + ins + ": " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Field updateFieldParagraphTextPlain(Field formFieldParam)
{
if(formFieldParam != null && this.serviceTicket != null)
{
formFieldParam.setServiceTicket(this.serviceTicket);
}
if(formFieldParam != null)
{
formFieldParam.setTypeAsEnum(Field.Type.ParagraphText);
formFieldParam.setTypeMetaData(FieldMetaData.ParagraphText.PLAIN);
}
return new Field(this.postJson(
formFieldParam, WS.Path.FormField.Version1.formFieldUpdate()));
} } | public class class_name {
public Field updateFieldParagraphTextPlain(Field formFieldParam)
{
if(formFieldParam != null && this.serviceTicket != null)
{
formFieldParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none]
}
if(formFieldParam != null)
{
formFieldParam.setTypeAsEnum(Field.Type.ParagraphText); // depends on control dependency: [if], data = [none]
formFieldParam.setTypeMetaData(FieldMetaData.ParagraphText.PLAIN); // depends on control dependency: [if], data = [none]
}
return new Field(this.postJson(
formFieldParam, WS.Path.FormField.Version1.formFieldUpdate()));
} } |
public class class_name {
private ValidationReport validateBondOrderSum(IAtom atom, IAtomContainer molecule) {
ValidationReport report = new ValidationReport();
ValidationTest checkBondSum = new ValidationTest(atom, "The atom's total bond order is too high.");
try {
AtomTypeFactory structgenATF = AtomTypeFactory.getInstance(
"org/openscience/cdk/dict/data/cdk-atom-types.owl", atom.getBuilder());
int bos = (int) molecule.getBondOrderSum(atom);
IAtomType[] atomTypes = structgenATF.getAtomTypes(atom.getSymbol());
if (atomTypes.length == 0) {
checkBondSum.setDetails("Cannot validate bond order sum for atom not in valency atom type list: "
+ atom.getSymbol());
report.addWarning(checkBondSum);
} else {
IAtomType failedOn = null;
boolean foundMatchingAtomType = false;
for (int j = 0; j < atomTypes.length; j++) {
IAtomType type = atomTypes[j];
if (Objects.equals(atom.getFormalCharge(), type.getFormalCharge())) {
foundMatchingAtomType = true;
if (bos == type.getBondOrderSum()) {
// skip this atom type
} else {
failedOn = atomTypes[j];
}
}
}
if (foundMatchingAtomType) {
report.addOK(checkBondSum);
} else {
if (failedOn != null) {
checkBondSum.setDetails("Bond order exceeds the one allowed for atom " + atom.getSymbol()
+ " for which the total bond order is " + failedOn.getBondOrderSum());
}
report.addError(checkBondSum);
}
}
} catch (Exception exception) {
logger.error("Error while performing atom bos validation: ", exception.getMessage());
logger.debug(exception);
}
return report;
} } | public class class_name {
private ValidationReport validateBondOrderSum(IAtom atom, IAtomContainer molecule) {
ValidationReport report = new ValidationReport();
ValidationTest checkBondSum = new ValidationTest(atom, "The atom's total bond order is too high.");
try {
AtomTypeFactory structgenATF = AtomTypeFactory.getInstance(
"org/openscience/cdk/dict/data/cdk-atom-types.owl", atom.getBuilder());
int bos = (int) molecule.getBondOrderSum(atom);
IAtomType[] atomTypes = structgenATF.getAtomTypes(atom.getSymbol());
if (atomTypes.length == 0) {
checkBondSum.setDetails("Cannot validate bond order sum for atom not in valency atom type list: "
+ atom.getSymbol()); // depends on control dependency: [if], data = [none]
report.addWarning(checkBondSum); // depends on control dependency: [if], data = [none]
} else {
IAtomType failedOn = null;
boolean foundMatchingAtomType = false;
for (int j = 0; j < atomTypes.length; j++) {
IAtomType type = atomTypes[j];
if (Objects.equals(atom.getFormalCharge(), type.getFormalCharge())) {
foundMatchingAtomType = true; // depends on control dependency: [if], data = [none]
if (bos == type.getBondOrderSum()) {
// skip this atom type
} else {
failedOn = atomTypes[j]; // depends on control dependency: [if], data = [none]
}
}
}
if (foundMatchingAtomType) {
report.addOK(checkBondSum); // depends on control dependency: [if], data = [none]
} else {
if (failedOn != null) {
checkBondSum.setDetails("Bond order exceeds the one allowed for atom " + atom.getSymbol()
+ " for which the total bond order is " + failedOn.getBondOrderSum()); // depends on control dependency: [if], data = [none]
}
report.addError(checkBondSum); // depends on control dependency: [if], data = [none]
}
}
} catch (Exception exception) {
logger.error("Error while performing atom bos validation: ", exception.getMessage());
logger.debug(exception);
} // depends on control dependency: [catch], data = [none]
return report;
} } |
public class class_name {
public void initAllLoadedPlugins() throws PluginException {
LOGGER.debug("Initializig all loaded plugins");
for (Class<? extends Plugin> pluginClass : implementations.keySet()) {
Set<PluginContext> set = implementations.get(pluginClass);
for (PluginContext pluginContext : set) {
try {
pluginContext.initialize(pluginContext.getSystemSettings());
} catch (Throwable e) {
LOGGER.error("", e);
pluginContext.setEnabled(false, false);
}
}
}
} } | public class class_name {
public void initAllLoadedPlugins() throws PluginException {
LOGGER.debug("Initializig all loaded plugins");
for (Class<? extends Plugin> pluginClass : implementations.keySet()) {
Set<PluginContext> set = implementations.get(pluginClass);
for (PluginContext pluginContext : set) {
try {
pluginContext.initialize(pluginContext.getSystemSettings()); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
LOGGER.error("", e);
pluginContext.setEnabled(false, false);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
@Override
protected void valueCreate(String[] strings, Value value) {
for (int i = 0; i < strings.length; i++) {
value.addPrimitiveValue(labels[i], strings[i]);
}
} } | public class class_name {
@Override
protected void valueCreate(String[] strings, Value value) {
for (int i = 0; i < strings.length; i++) {
value.addPrimitiveValue(labels[i], strings[i]); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public String resolve() {
notNull(buildDirectory, "Build directory cannot be null!");
notNull(log, "Logger cannot be null!");
String result = null;
final File cssTargetFolder = cssDestinationFolder == null ? destinationFolder : cssDestinationFolder;
File rootFolder = null;
notNull(cssTargetFolder, "cssTargetFolder cannot be null!");
if (buildFinalName != null && cssTargetFolder.getPath().startsWith(buildFinalName.getPath())) {
rootFolder = buildFinalName;
} else if (cssTargetFolder.getPath().startsWith(buildDirectory.getPath())) {
rootFolder = buildDirectory;
} else {
// find first best match
for (final String contextFolder : getContextFolders()) {
if (cssTargetFolder.getPath().startsWith(contextFolder)) {
rootFolder = new File(contextFolder);
break;
}
}
}
log.debug("buildDirectory: " + buildDirectory);
log.debug("contextFolders: " + contextFoldersAsCSV);
log.debug("cssTargetFolder: " + cssTargetFolder);
log.debug("rootFolder: " + rootFolder);
if (rootFolder != null) {
result = StringUtils.removeStart(cssTargetFolder.getPath(), rootFolder.getPath());
}
log.debug("computedAggregatedFolderPath: " + result);
return result;
} } | public class class_name {
public String resolve() {
notNull(buildDirectory, "Build directory cannot be null!");
notNull(log, "Logger cannot be null!");
String result = null;
final File cssTargetFolder = cssDestinationFolder == null ? destinationFolder : cssDestinationFolder;
File rootFolder = null;
notNull(cssTargetFolder, "cssTargetFolder cannot be null!");
if (buildFinalName != null && cssTargetFolder.getPath().startsWith(buildFinalName.getPath())) {
rootFolder = buildFinalName; // depends on control dependency: [if], data = [none]
} else if (cssTargetFolder.getPath().startsWith(buildDirectory.getPath())) {
rootFolder = buildDirectory; // depends on control dependency: [if], data = [none]
} else {
// find first best match
for (final String contextFolder : getContextFolders()) {
if (cssTargetFolder.getPath().startsWith(contextFolder)) {
rootFolder = new File(contextFolder); // depends on control dependency: [if], data = [none]
break;
}
}
}
log.debug("buildDirectory: " + buildDirectory);
log.debug("contextFolders: " + contextFoldersAsCSV);
log.debug("cssTargetFolder: " + cssTargetFolder);
log.debug("rootFolder: " + rootFolder);
if (rootFolder != null) {
result = StringUtils.removeStart(cssTargetFolder.getPath(), rootFolder.getPath()); // depends on control dependency: [if], data = [none]
}
log.debug("computedAggregatedFolderPath: " + result);
return result;
} } |
public class class_name {
protected Object convertUserDefinedValueType(Object object, Class<?> type) {
if (type.isAssignableFrom(object.getClass())) {
return object;
} else if (object instanceof String) {
try {
Constructor<?> constructor = type.getConstructor(String.class);
return constructor.newInstance(object);
} catch (Exception e) {
logger.debug("Cannot invoke [public " + type.getName()
+ "(String.class)] constrcutor on [" + type + "]", e);
}
try {
return type.getMethod("valueOf", String.class).invoke(null, object);
} catch (Exception e1) {
logger.debug("Cannot invoke [public static "
+ type.getName() + ".valueOf(String.class)]"
+ "method on [" + type + "]", e1);
}
} else {
logger.warn("Parameter [" + object
+ "] cannot be converted to [" + type + "]");
}
return null;
} } | public class class_name {
protected Object convertUserDefinedValueType(Object object, Class<?> type) {
if (type.isAssignableFrom(object.getClass())) {
return object; // depends on control dependency: [if], data = [none]
} else if (object instanceof String) {
try {
Constructor<?> constructor = type.getConstructor(String.class);
return constructor.newInstance(object); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.debug("Cannot invoke [public " + type.getName()
+ "(String.class)] constrcutor on [" + type + "]", e);
} // depends on control dependency: [catch], data = [none]
try {
return type.getMethod("valueOf", String.class).invoke(null, object); // depends on control dependency: [try], data = [none]
} catch (Exception e1) {
logger.debug("Cannot invoke [public static "
+ type.getName() + ".valueOf(String.class)]"
+ "method on [" + type + "]", e1);
} // depends on control dependency: [catch], data = [none]
} else {
logger.warn("Parameter [" + object
+ "] cannot be converted to [" + type + "]"); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public SqlInfo buildTextSqlParams(String valueText) {
// 获取value值,判断是否为空,若为空,则直接退出本方法
Object obj = ParseHelper.parseExpressWithException(valueText, context);
obj = obj == null ? new Object(){} : obj;
Object[] values = this.convertToArray(obj);
for (Object objVal: values) {
this.sqlInfo.getParams().add(objVal);
}
return sqlInfo;
} } | public class class_name {
public SqlInfo buildTextSqlParams(String valueText) {
// 获取value值,判断是否为空,若为空,则直接退出本方法
Object obj = ParseHelper.parseExpressWithException(valueText, context);
obj = obj == null ? new Object(){} : obj;
Object[] values = this.convertToArray(obj);
for (Object objVal: values) {
this.sqlInfo.getParams().add(objVal); // depends on control dependency: [for], data = [objVal]
}
return sqlInfo;
} } |
public class class_name {
public static Map<String, FieldAccess> getFieldsFromObject( Object object ) {
try {
Map<String, FieldAccess> fields;
if ( object instanceof Map ) {
fields = getFieldsFromMap( ( Map<String, Object> ) object );
} else {
fields = getPropertyFieldAccessMap( object.getClass() );
}
return fields;
} catch (Exception ex) {
requireNonNull(object, "Item cannot be null" );
return handle(Map.class, ex, "Unable to get fields from object", className(object));
}
} } | public class class_name {
public static Map<String, FieldAccess> getFieldsFromObject( Object object ) {
try {
Map<String, FieldAccess> fields;
if ( object instanceof Map ) {
fields = getFieldsFromMap( ( Map<String, Object> ) object ); // depends on control dependency: [if], data = [none]
} else {
fields = getPropertyFieldAccessMap( object.getClass() ); // depends on control dependency: [if], data = [none]
}
return fields; // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
requireNonNull(object, "Item cannot be null" );
return handle(Map.class, ex, "Unable to get fields from object", className(object));
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public EJSRemoteWrapper keyToObject(byte[] key)
throws RemoteException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "keyToObject");
EJSWrapperCommon wc = null;
EJSRemoteWrapper wrapper = null;
// -----------------------------------------------------------------------
// The key into the wrapper cache is the serialized beanId, and the
// serialized beanId either is the wrapper key, or at least part of
// the wrapper key. For the EJB Component interface (i.e. EJB 2.1),
// where there is only one remote interface, the wrapper key is the
// beanId. However, for EJB 3.0 Business interfaces, where there may
// be multiple remote interfaces, the wrapper key also contains the
// identity of the specific interface.
// -----------------------------------------------------------------------
try
{
// If this is a Business Wrapper Key, extract the serialized beanId
// from it, and use that to find the Common/Factory in the Wrapper
// Cache, then use the rest of the Wrapper Key information to get
// the specific remote interface wrapper. d419704
if (key[0] == (byte) 0xAD)
{
WrapperId wrapperId = new WrapperId(key);
ByteArray wrapperKey = wrapperId.getBeanIdArray();
wc = (EJSWrapperCommon) wrapperCache.findAndFault(wrapperKey);
if (wc != null)
{
wrapper = wc.getRemoteBusinessWrapper(wrapperId);
// At this point, all BeanIds are known to have the serialized
// byte array cached, so put Stateful and Entity BeanIds in the
// BeanId Cache. BeanIds for homes, stateless, and messagedriven
// are singletons and already cached on EJSHome. d154342.1
BeanId beanId = wrapper.beanId; // d464515
if (!beanId._isHome && beanId.pkey != null) // d464515
{
beanIdCache.add(beanId); // d464515
}
}
}
// If this is a Component Wrapper Key, then it already is the
// serialized beanId, so just use it to find the Common/Factory in
// the Wrapper Cache, then get the one remote wrapper. d419704
else
{
ByteArray wrapperKey = new ByteArray(key);
wc = (EJSWrapperCommon) wrapperCache.findAndFault(wrapperKey); // f111627
if (wc != null)
{
wrapper = wc.getRemoteObjectWrapper(); // d112375 d440604
// At this point, all BeanIds are known to have the serialized
// byte array cached, so put Stateful and Entity BeanIds in the
// BeanId Cache. BeanIds for homes, stateless, and messagedriven
// are singletons and already cached on EJSHome. d154342.1
BeanId beanId = wrapper.beanId; // d464515
if (!beanId._isHome && beanId.pkey != null) // d464515
{
beanIdCache.add(beanId); // d464515
}
}
}
} catch (FaultException ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".keyToObject", "501", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Unable to fault in wrapper", ex);
throw new RemoteException(ex.getMessage(), ex); // d356676.1
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "keyToObject", wrapper);
return wrapper;
} } | public class class_name {
public EJSRemoteWrapper keyToObject(byte[] key)
throws RemoteException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "keyToObject");
EJSWrapperCommon wc = null;
EJSRemoteWrapper wrapper = null;
// -----------------------------------------------------------------------
// The key into the wrapper cache is the serialized beanId, and the
// serialized beanId either is the wrapper key, or at least part of
// the wrapper key. For the EJB Component interface (i.e. EJB 2.1),
// where there is only one remote interface, the wrapper key is the
// beanId. However, for EJB 3.0 Business interfaces, where there may
// be multiple remote interfaces, the wrapper key also contains the
// identity of the specific interface.
// -----------------------------------------------------------------------
try
{
// If this is a Business Wrapper Key, extract the serialized beanId
// from it, and use that to find the Common/Factory in the Wrapper
// Cache, then use the rest of the Wrapper Key information to get
// the specific remote interface wrapper. d419704
if (key[0] == (byte) 0xAD)
{
WrapperId wrapperId = new WrapperId(key);
ByteArray wrapperKey = wrapperId.getBeanIdArray();
wc = (EJSWrapperCommon) wrapperCache.findAndFault(wrapperKey); // depends on control dependency: [if], data = [none]
if (wc != null)
{
wrapper = wc.getRemoteBusinessWrapper(wrapperId); // depends on control dependency: [if], data = [none]
// At this point, all BeanIds are known to have the serialized
// byte array cached, so put Stateful and Entity BeanIds in the
// BeanId Cache. BeanIds for homes, stateless, and messagedriven
// are singletons and already cached on EJSHome. d154342.1
BeanId beanId = wrapper.beanId; // d464515
if (!beanId._isHome && beanId.pkey != null) // d464515
{
beanIdCache.add(beanId); // d464515 // depends on control dependency: [if], data = [none]
}
}
}
// If this is a Component Wrapper Key, then it already is the
// serialized beanId, so just use it to find the Common/Factory in
// the Wrapper Cache, then get the one remote wrapper. d419704
else
{
ByteArray wrapperKey = new ByteArray(key);
wc = (EJSWrapperCommon) wrapperCache.findAndFault(wrapperKey); // f111627 // depends on control dependency: [if], data = [none]
if (wc != null)
{
wrapper = wc.getRemoteObjectWrapper(); // d112375 d440604 // depends on control dependency: [if], data = [none]
// At this point, all BeanIds are known to have the serialized
// byte array cached, so put Stateful and Entity BeanIds in the
// BeanId Cache. BeanIds for homes, stateless, and messagedriven
// are singletons and already cached on EJSHome. d154342.1
BeanId beanId = wrapper.beanId; // d464515
if (!beanId._isHome && beanId.pkey != null) // d464515
{
beanIdCache.add(beanId); // d464515 // depends on control dependency: [if], data = [none]
}
}
}
} catch (FaultException ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".keyToObject", "501", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Unable to fault in wrapper", ex);
throw new RemoteException(ex.getMessage(), ex); // d356676.1
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "keyToObject", wrapper);
return wrapper;
} } |
public class class_name {
public Observable<ServiceResponse<Void>> logTrackingEventsWithServiceResponseAsync(String resourceGroupName, String integrationAccountName, TrackingEventsDefinition logTrackingEvents) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (integrationAccountName == null) {
throw new IllegalArgumentException("Parameter integrationAccountName 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 (logTrackingEvents == null) {
throw new IllegalArgumentException("Parameter logTrackingEvents is required and cannot be null.");
}
Validator.validate(logTrackingEvents);
return service.logTrackingEvents(this.client.subscriptionId(), resourceGroupName, integrationAccountName, this.client.apiVersion(), logTrackingEvents, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = logTrackingEventsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Void>> logTrackingEventsWithServiceResponseAsync(String resourceGroupName, String integrationAccountName, TrackingEventsDefinition logTrackingEvents) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (integrationAccountName == null) {
throw new IllegalArgumentException("Parameter integrationAccountName 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 (logTrackingEvents == null) {
throw new IllegalArgumentException("Parameter logTrackingEvents is required and cannot be null.");
}
Validator.validate(logTrackingEvents);
return service.logTrackingEvents(this.client.subscriptionId(), resourceGroupName, integrationAccountName, this.client.apiVersion(), logTrackingEvents, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = logTrackingEventsDelegate(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 getName() {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_path)) {
return "";
}
String result = CmsResource.getName(m_path);
// remove trailing slash as categories are not displayed like folders
if (CmsResource.isFolder(result)) {
result = result.substring(0, result.length() - 1);
}
return result;
} } | public class class_name {
public String getName() {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_path)) {
return ""; // depends on control dependency: [if], data = [none]
}
String result = CmsResource.getName(m_path);
// remove trailing slash as categories are not displayed like folders
if (CmsResource.isFolder(result)) {
result = result.substring(0, result.length() - 1); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@Override
public void setErrorHandlerType(ErrorHandlerType type) {
if (errorHandler != null) {
errorHandler.cleanup();
}
errorHandlerType = type == null ? ErrorHandlerType.DEFAULT : type;
switch (errorHandlerType) {
case NONE:
errorHandler = null;
break;
case DEFAULT:
errorHandler = new DefaultErrorHandler(inputWidget);
}
} } | public class class_name {
@Override
public void setErrorHandlerType(ErrorHandlerType type) {
if (errorHandler != null) {
errorHandler.cleanup(); // depends on control dependency: [if], data = [none]
}
errorHandlerType = type == null ? ErrorHandlerType.DEFAULT : type;
switch (errorHandlerType) {
case NONE:
errorHandler = null;
break;
case DEFAULT:
errorHandler = new DefaultErrorHandler(inputWidget);
}
} } |
public class class_name {
public void notifyServiceToGui(@NonNull String notificationType, @Nullable WiFiP2pService service) {
Intent intent = new Intent();
if (service != null) {
intent.putExtra(SERVICE_NAME, service.getDevice().deviceName);
intent.putExtra(SERVICE_ADDRESS, service.getDevice().deviceAddress);
intent.putExtra(SERVICE_IDENTIFIER, service.getIdentifier());
}
intent.setAction(notificationType);
mContext.sendBroadcast(intent);
} } | public class class_name {
public void notifyServiceToGui(@NonNull String notificationType, @Nullable WiFiP2pService service) {
Intent intent = new Intent();
if (service != null) {
intent.putExtra(SERVICE_NAME, service.getDevice().deviceName); // depends on control dependency: [if], data = [none]
intent.putExtra(SERVICE_ADDRESS, service.getDevice().deviceAddress); // depends on control dependency: [if], data = [none]
intent.putExtra(SERVICE_IDENTIFIER, service.getIdentifier()); // depends on control dependency: [if], data = [none]
}
intent.setAction(notificationType);
mContext.sendBroadcast(intent);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.