code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private boolean isAggregate(String thriftColumnName)
{
if (thriftColumnName.startsWith(SYS_COUNT) || thriftColumnName.startsWith(SYS_MIN)
|| thriftColumnName.startsWith(SYS_MAX) || thriftColumnName.startsWith(SYS_AVG)
|| thriftColumnName.startsWith(SYS_SUM))
{
return true;
}
else if (thriftColumnName.startsWith(COUNT) || thriftColumnName.startsWith(MIN)
|| thriftColumnName.startsWith(MAX) || thriftColumnName.startsWith(AVG)
|| thriftColumnName.startsWith(SUM))
{
return true;
}
return false;
} } | public class class_name {
private boolean isAggregate(String thriftColumnName)
{
if (thriftColumnName.startsWith(SYS_COUNT) || thriftColumnName.startsWith(SYS_MIN)
|| thriftColumnName.startsWith(SYS_MAX) || thriftColumnName.startsWith(SYS_AVG)
|| thriftColumnName.startsWith(SYS_SUM))
{
return true; // depends on control dependency: [if], data = [none]
}
else if (thriftColumnName.startsWith(COUNT) || thriftColumnName.startsWith(MIN)
|| thriftColumnName.startsWith(MAX) || thriftColumnName.startsWith(AVG)
|| thriftColumnName.startsWith(SUM))
{
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void setMeshCreatorInputNormals(float[] values) {
meshCreatorInputNormals = new float[ values.length ];
for (int i = 0; i < values.length; i++) {
meshCreatorInputNormals[i] = values[i];
}
} } | public class class_name {
public void setMeshCreatorInputNormals(float[] values) {
meshCreatorInputNormals = new float[ values.length ];
for (int i = 0; i < values.length; i++) {
meshCreatorInputNormals[i] = values[i]; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public String getNameAndAttributes() {
StringBuilder sbuff = new StringBuilder();
sbuff.append("Group ");
sbuff.append(getShortName());
sbuff.append("\n");
for (Attribute att : attributes.getAttributes()) {
sbuff.append(" ").append(getShortName()).append(":");
sbuff.append(att.toString());
sbuff.append(";");
sbuff.append("\n");
}
return sbuff.toString();
} } | public class class_name {
public String getNameAndAttributes() {
StringBuilder sbuff = new StringBuilder();
sbuff.append("Group ");
sbuff.append(getShortName());
sbuff.append("\n");
for (Attribute att : attributes.getAttributes()) {
sbuff.append(" ").append(getShortName()).append(":"); // depends on control dependency: [for], data = [none]
sbuff.append(att.toString()); // depends on control dependency: [for], data = [att]
sbuff.append(";"); // depends on control dependency: [for], data = [none]
sbuff.append("\n"); // depends on control dependency: [for], data = [none]
}
return sbuff.toString();
} } |
public class class_name {
public RegionInfo queryRegionInfo(RegionReqInfo regionReqInfo) {
try {
return queryRegionInfo(regionReqInfo.getAccessKey(), regionReqInfo.getBucket());
} catch (Exception e) {
e.printStackTrace();
}
return null;
} } | public class class_name {
public RegionInfo queryRegionInfo(RegionReqInfo regionReqInfo) {
try {
return queryRegionInfo(regionReqInfo.getAccessKey(), regionReqInfo.getBucket()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
private IBond getNextBondWithUnplacedRingAtom() {
for (IBond bond : molecule.bonds()) {
IAtom beg = bond.getBegin();
IAtom end = bond.getEnd();
if (beg.getPoint2d() != null && end.getPoint2d() != null) {
if (end.getFlag(CDKConstants.ISPLACED) && !beg.getFlag(CDKConstants.ISPLACED) && beg.isInRing()) {
return bond;
}
if (beg.getFlag(CDKConstants.ISPLACED) && !end.getFlag(CDKConstants.ISPLACED) && end.isInRing()) {
return bond;
}
}
}
return null;
} } | public class class_name {
private IBond getNextBondWithUnplacedRingAtom() {
for (IBond bond : molecule.bonds()) {
IAtom beg = bond.getBegin();
IAtom end = bond.getEnd();
if (beg.getPoint2d() != null && end.getPoint2d() != null) {
if (end.getFlag(CDKConstants.ISPLACED) && !beg.getFlag(CDKConstants.ISPLACED) && beg.isInRing()) {
return bond; // depends on control dependency: [if], data = [none]
}
if (beg.getFlag(CDKConstants.ISPLACED) && !end.getFlag(CDKConstants.ISPLACED) && end.isInRing()) {
return bond; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
protected LightweightTypeReference createCollectionTypeReference(JvmGenericType collectionType, LightweightTypeReference elementType, LightweightTypeReference expectedType, ITypeReferenceOwner owner) {
ParameterizedTypeReference result = new ParameterizedTypeReference(owner, collectionType);
result.addTypeArgument(elementType);
if (isIterableExpectation(expectedType) && !expectedType.isAssignableFrom(result)) {
// avoid to assign a set literal to a list and viceversa:
// at least the raw types must be assignable
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=498779
if (expectedType.getRawTypeReference().isAssignableFrom(result.getRawTypeReference())) {
LightweightTypeReference expectedElementType = getElementOrComponentType(expectedType, owner);
if (matchesExpectation(elementType, expectedElementType)) {
return expectedType;
}
}
}
return result;
} } | public class class_name {
protected LightweightTypeReference createCollectionTypeReference(JvmGenericType collectionType, LightweightTypeReference elementType, LightweightTypeReference expectedType, ITypeReferenceOwner owner) {
ParameterizedTypeReference result = new ParameterizedTypeReference(owner, collectionType);
result.addTypeArgument(elementType);
if (isIterableExpectation(expectedType) && !expectedType.isAssignableFrom(result)) {
// avoid to assign a set literal to a list and viceversa:
// at least the raw types must be assignable
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=498779
if (expectedType.getRawTypeReference().isAssignableFrom(result.getRawTypeReference())) {
LightweightTypeReference expectedElementType = getElementOrComponentType(expectedType, owner);
if (matchesExpectation(elementType, expectedElementType)) {
return expectedType; // depends on control dependency: [if], data = [none]
}
}
}
return result;
} } |
public class class_name {
public static File file(String... names) {
if (ArrayUtil.isEmpty(names)) {
return null;
}
File file = null;
for (String name : names) {
if (file == null) {
file = file(name);
} else {
file = file(file, name);
}
}
return file;
} } | public class class_name {
public static File file(String... names) {
if (ArrayUtil.isEmpty(names)) {
return null;
// depends on control dependency: [if], data = [none]
}
File file = null;
for (String name : names) {
if (file == null) {
file = file(name);
// depends on control dependency: [if], data = [none]
} else {
file = file(file, name);
// depends on control dependency: [if], data = [(file]
}
}
return file;
} } |
public class class_name {
public static void equalsOrDie(String a, String b) {
if (a == null && b == null) {
return;
}
if (a == null || b == null) {
die("Values not equal value a=", a, "value b=", b);
}
char[] ac = FastStringUtils.toCharArray(a);
char[] bc = FastStringUtils.toCharArray(b);
Chr.equalsOrDie(ac, bc);
} } | public class class_name {
public static void equalsOrDie(String a, String b) {
if (a == null && b == null) {
return; // depends on control dependency: [if], data = [none]
}
if (a == null || b == null) {
die("Values not equal value a=", a, "value b=", b); // depends on control dependency: [if], data = [none]
}
char[] ac = FastStringUtils.toCharArray(a);
char[] bc = FastStringUtils.toCharArray(b);
Chr.equalsOrDie(ac, bc);
} } |
public class class_name {
public void setWidgetToggleDisplayAllowed(Widget child, boolean allowed) {
assertIsChild(child);
Splitter splitter = getAssociatedSplitter(child);
// The splitter is null for the center element.
if (splitter != null) {
splitter.setToggleDisplayAllowed(allowed);
}
} } | public class class_name {
public void setWidgetToggleDisplayAllowed(Widget child, boolean allowed) {
assertIsChild(child);
Splitter splitter = getAssociatedSplitter(child);
// The splitter is null for the center element.
if (splitter != null) {
splitter.setToggleDisplayAllowed(allowed); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Object get(final Supplier<?> supplier) {
if (supplier == null) {
return null;
}
final Object result = supplier.get();
return result instanceof Message ? ((Message) result).getFormattedMessage() : result;
} } | public class class_name {
public static Object get(final Supplier<?> supplier) {
if (supplier == null) {
return null; // depends on control dependency: [if], data = [none]
}
final Object result = supplier.get();
return result instanceof Message ? ((Message) result).getFormattedMessage() : result;
} } |
public class class_name {
private static double coverRadius(double[][] matrix, int[] idx, int i) {
final int idx_i = idx[i];
final double[] row_i = matrix[i];
double m = 0;
for(int j = 0; j < row_i.length; j++) {
if(i != j && idx_i == idx[j]) {
final double d = row_i[j];
m = d > m ? d : m;
}
}
return m;
} } | public class class_name {
private static double coverRadius(double[][] matrix, int[] idx, int i) {
final int idx_i = idx[i];
final double[] row_i = matrix[i];
double m = 0;
for(int j = 0; j < row_i.length; j++) {
if(i != j && idx_i == idx[j]) {
final double d = row_i[j];
m = d > m ? d : m; // depends on control dependency: [if], data = [none]
}
}
return m;
} } |
public class class_name {
private int computeAverageWidth(){
int count = 0;
int total = 0;
for(int i = 0; i < super.widths.length; i++){
if(super.widths[i] != 0){
total += super.widths[i];
count++;
}
}
return count != 0 ? total/count : 0;
} } | public class class_name {
private int computeAverageWidth(){
int count = 0;
int total = 0;
for(int i = 0; i < super.widths.length; i++){
if(super.widths[i] != 0){
total += super.widths[i];
// depends on control dependency: [if], data = [none]
count++;
// depends on control dependency: [if], data = [none]
}
}
return count != 0 ? total/count : 0;
} } |
public class class_name {
public void marshall(ImportDocumentationPartsRequest importDocumentationPartsRequest, ProtocolMarshaller protocolMarshaller) {
if (importDocumentationPartsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(importDocumentationPartsRequest.getRestApiId(), RESTAPIID_BINDING);
protocolMarshaller.marshall(importDocumentationPartsRequest.getMode(), MODE_BINDING);
protocolMarshaller.marshall(importDocumentationPartsRequest.getFailOnWarnings(), FAILONWARNINGS_BINDING);
protocolMarshaller.marshall(importDocumentationPartsRequest.getBody(), BODY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ImportDocumentationPartsRequest importDocumentationPartsRequest, ProtocolMarshaller protocolMarshaller) {
if (importDocumentationPartsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(importDocumentationPartsRequest.getRestApiId(), RESTAPIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(importDocumentationPartsRequest.getMode(), MODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(importDocumentationPartsRequest.getFailOnWarnings(), FAILONWARNINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(importDocumentationPartsRequest.getBody(), BODY_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 int areConfusable(String s1, String s2) {
//
// See section 4 of UAX 39 for the algorithm for checking whether two strings are confusable,
// and for definitions of the types (single, whole, mixed-script) of confusables.
// We only care about a few of the check flags. Ignore the others.
// If no tests relevant to this function have been specified, signal an error.
// TODO: is this really the right thing to do? It's probably an error on
// the caller's part, but logically we would just return 0 (no error).
if ((this.fChecks & CONFUSABLE) == 0) {
throw new IllegalArgumentException("No confusable checks are enabled.");
}
// Compute the skeletons and check for confusability.
String s1Skeleton = getSkeleton(s1);
String s2Skeleton = getSkeleton(s2);
if (!s1Skeleton.equals(s2Skeleton)) {
return 0;
}
// If we get here, the strings are confusable. Now we just need to set the flags for the appropriate classes
// of confusables according to UTS 39 section 4.
// Start by computing the resolved script sets of s1 and s2.
ScriptSet s1RSS = new ScriptSet();
getResolvedScriptSet(s1, s1RSS);
ScriptSet s2RSS = new ScriptSet();
getResolvedScriptSet(s2, s2RSS);
// Turn on all applicable flags
int result = 0;
if (s1RSS.intersects(s2RSS)) {
result |= SINGLE_SCRIPT_CONFUSABLE;
} else {
result |= MIXED_SCRIPT_CONFUSABLE;
if (!s1RSS.isEmpty() && !s2RSS.isEmpty()) {
result |= WHOLE_SCRIPT_CONFUSABLE;
}
}
// Turn off flags that the user doesn't want
result &= fChecks;
return result;
} } | public class class_name {
public int areConfusable(String s1, String s2) {
//
// See section 4 of UAX 39 for the algorithm for checking whether two strings are confusable,
// and for definitions of the types (single, whole, mixed-script) of confusables.
// We only care about a few of the check flags. Ignore the others.
// If no tests relevant to this function have been specified, signal an error.
// TODO: is this really the right thing to do? It's probably an error on
// the caller's part, but logically we would just return 0 (no error).
if ((this.fChecks & CONFUSABLE) == 0) {
throw new IllegalArgumentException("No confusable checks are enabled.");
}
// Compute the skeletons and check for confusability.
String s1Skeleton = getSkeleton(s1);
String s2Skeleton = getSkeleton(s2);
if (!s1Skeleton.equals(s2Skeleton)) {
return 0; // depends on control dependency: [if], data = [none]
}
// If we get here, the strings are confusable. Now we just need to set the flags for the appropriate classes
// of confusables according to UTS 39 section 4.
// Start by computing the resolved script sets of s1 and s2.
ScriptSet s1RSS = new ScriptSet();
getResolvedScriptSet(s1, s1RSS);
ScriptSet s2RSS = new ScriptSet();
getResolvedScriptSet(s2, s2RSS);
// Turn on all applicable flags
int result = 0;
if (s1RSS.intersects(s2RSS)) {
result |= SINGLE_SCRIPT_CONFUSABLE; // depends on control dependency: [if], data = [none]
} else {
result |= MIXED_SCRIPT_CONFUSABLE; // depends on control dependency: [if], data = [none]
if (!s1RSS.isEmpty() && !s2RSS.isEmpty()) {
result |= WHOLE_SCRIPT_CONFUSABLE; // depends on control dependency: [if], data = [none]
}
}
// Turn off flags that the user doesn't want
result &= fChecks;
return result;
} } |
public class class_name {
public Optional<RepositoryFile> getOptionalFile(Object projectIdOrPath, String filePath, String ref) {
try {
return (Optional.ofNullable(getFile(projectIdOrPath, filePath, ref, true)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
} } | public class class_name {
public Optional<RepositoryFile> getOptionalFile(Object projectIdOrPath, String filePath, String ref) {
try {
return (Optional.ofNullable(getFile(projectIdOrPath, filePath, ref, true))); // depends on control dependency: [try], data = [none]
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static JSPCache getJspCache(String cacheName) {
final String methodName = "getJspCache()";
JSPCache cacheOut = null;
if (servletCacheEnabled == false) {
// DYNA1059W=DYNA1059W: WebSphere Dynamic Cache instance named {0} cannot be used because of Dynamic Servlet
// cache service has not be started.
Tr.error(tc, "DYNA1059W", new Object[] { cacheName });
} else {
if (cacheName != null) {
try {
cacheOut = cacheUnit.getJSPCache(cacheName);
} catch (Exception e) {
// DYNA1003E=DYNA1003E: WebSphere Dynamic Cache instance named {0} can not be initialized because of
// error {1}.
Tr.error(tc, "DYNA1003E", new Object[] { cacheName, e });
}
} else {
cacheOut = ServerCache.jspCache;
}
}
if (cacheOut == null && TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " could not find JSPCache for cacheName=" + cacheName);
}
return cacheOut;
} } | public class class_name {
public static JSPCache getJspCache(String cacheName) {
final String methodName = "getJspCache()";
JSPCache cacheOut = null;
if (servletCacheEnabled == false) {
// DYNA1059W=DYNA1059W: WebSphere Dynamic Cache instance named {0} cannot be used because of Dynamic Servlet
// cache service has not be started.
Tr.error(tc, "DYNA1059W", new Object[] { cacheName }); // depends on control dependency: [if], data = [none]
} else {
if (cacheName != null) {
try {
cacheOut = cacheUnit.getJSPCache(cacheName); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// DYNA1003E=DYNA1003E: WebSphere Dynamic Cache instance named {0} can not be initialized because of
// error {1}.
Tr.error(tc, "DYNA1003E", new Object[] { cacheName, e });
} // depends on control dependency: [catch], data = [none]
} else {
cacheOut = ServerCache.jspCache; // depends on control dependency: [if], data = [none]
}
}
if (cacheOut == null && TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " could not find JSPCache for cacheName=" + cacheName); // depends on control dependency: [if], data = [none]
}
return cacheOut;
} } |
public class class_name {
public EClass getIfcSimpleProperty() {
if (ifcSimplePropertyEClass == null) {
ifcSimplePropertyEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(514);
}
return ifcSimplePropertyEClass;
} } | public class class_name {
public EClass getIfcSimpleProperty() {
if (ifcSimplePropertyEClass == null) {
ifcSimplePropertyEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(514);
// depends on control dependency: [if], data = [none]
}
return ifcSimplePropertyEClass;
} } |
public class class_name {
public static void checkProxyPackageAccess(Class<?> clazz) {
SecurityManager s = System.getSecurityManager();
if (s != null) {
// check proxy interfaces if the given class is a proxy class
if (Proxy.isProxyClass(clazz)) {
for (Class<?> intf : clazz.getInterfaces()) {
checkPackageAccess(intf);
}
}
}
} } | public class class_name {
public static void checkProxyPackageAccess(Class<?> clazz) {
SecurityManager s = System.getSecurityManager();
if (s != null) {
// check proxy interfaces if the given class is a proxy class
if (Proxy.isProxyClass(clazz)) {
for (Class<?> intf : clazz.getInterfaces()) {
checkPackageAccess(intf); // depends on control dependency: [for], data = [intf]
}
}
}
} } |
public class class_name {
@Deprecated
public void pushNotificationClickedEvent(final Bundle extras) {
CleverTapAPI cleverTapAPI = weakReference.get();
if(cleverTapAPI == null){
Logger.d("CleverTap Instance is null.");
} else {
cleverTapAPI.pushNotificationClickedEvent(extras);
}
} } | public class class_name {
@Deprecated
public void pushNotificationClickedEvent(final Bundle extras) {
CleverTapAPI cleverTapAPI = weakReference.get();
if(cleverTapAPI == null){
Logger.d("CleverTap Instance is null."); // depends on control dependency: [if], data = [none]
} else {
cleverTapAPI.pushNotificationClickedEvent(extras); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
synchronized public V get(Object key) {
if(!this.containsKey(key)) {
super.put((K) key, readBack((K) key));
}
return super.get(key);
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
synchronized public V get(Object key) {
if(!this.containsKey(key)) {
super.put((K) key, readBack((K) key)); // depends on control dependency: [if], data = [none]
}
return super.get(key);
} } |
public class class_name {
private String cleanRoute(final String route) {
String routeToClean = MULTIPLE_SLASH_PATTERN.matcher(route).replaceAll("/");
if (routeToClean.startsWith("/")) {
routeToClean = routeToClean.substring(1);
}
if (routeToClean.endsWith("/")) {
routeToClean = routeToClean.substring(0, routeToClean.length() - 1);
}
return routeToClean;
} } | public class class_name {
private String cleanRoute(final String route) {
String routeToClean = MULTIPLE_SLASH_PATTERN.matcher(route).replaceAll("/");
if (routeToClean.startsWith("/")) {
routeToClean = routeToClean.substring(1); // depends on control dependency: [if], data = [none]
}
if (routeToClean.endsWith("/")) {
routeToClean = routeToClean.substring(0, routeToClean.length() - 1); // depends on control dependency: [if], data = [none]
}
return routeToClean;
} } |
public class class_name {
protected long computeSVUID() throws IOException {
ByteArrayOutputStream bos;
DataOutputStream dos = null;
long svuid = 0;
try {
bos = new ByteArrayOutputStream();
dos = new DataOutputStream(bos);
/*
* 1. The class name written using UTF encoding.
*/
dos.writeUTF(name.replace('/', '.'));
/*
* 2. The class modifiers written as a 32-bit integer.
*/
dos.writeInt(access
& (Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL
| Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT));
/*
* 3. The name of each interface sorted by name written using UTF
* encoding.
*/
Arrays.sort(interfaces);
for (int i = 0; i < interfaces.length; i++) {
dos.writeUTF(interfaces[i].replace('/', '.'));
}
/*
* 4. For each field of the class sorted by field name (except
* private static and private transient fields):
*
* 1. The name of the field in UTF encoding. 2. The modifiers of the
* field written as a 32-bit integer. 3. The descriptor of the field
* in UTF encoding
*
* Note that field signatures are not dot separated. Method and
* constructor signatures are dot separated. Go figure...
*/
writeItems(svuidFields, dos, false);
/*
* 5. If a class initializer exists, write out the following: 1. The
* name of the method, <clinit>, in UTF encoding. 2. The modifier of
* the method, java.lang.reflect.Modifier.STATIC, written as a
* 32-bit integer. 3. The descriptor of the method, ()V, in UTF
* encoding.
*/
if (hasStaticInitializer) {
dos.writeUTF("<clinit>");
dos.writeInt(Opcodes.ACC_STATIC);
dos.writeUTF("()V");
} // if..
/*
* 6. For each non-private constructor sorted by method name and
* signature: 1. The name of the method, <init>, in UTF encoding. 2.
* The modifiers of the method written as a 32-bit integer. 3. The
* descriptor of the method in UTF encoding.
*/
writeItems(svuidConstructors, dos, true);
/*
* 7. For each non-private method sorted by method name and
* signature: 1. The name of the method in UTF encoding. 2. The
* modifiers of the method written as a 32-bit integer. 3. The
* descriptor of the method in UTF encoding.
*/
writeItems(svuidMethods, dos, true);
dos.flush();
/*
* 8. The SHA-1 algorithm is executed on the stream of bytes
* produced by DataOutputStream and produces five 32-bit values
* sha[0..4].
*/
byte[] hashBytes = computeSHAdigest(bos.toByteArray());
/*
* 9. The hash value is assembled from the first and second 32-bit
* values of the SHA-1 message digest. If the result of the message
* digest, the five 32-bit words H0 H1 H2 H3 H4, is in an array of
* five int values named sha, the hash value would be computed as
* follows:
*
* long hash = ((sha[0] >>> 24) & 0xFF) | ((sha[0] >>> 16) & 0xFF)
* << 8 | ((sha[0] >>> 8) & 0xFF) << 16 | ((sha[0] >>> 0) & 0xFF) <<
* 24 | ((sha[1] >>> 24) & 0xFF) << 32 | ((sha[1] >>> 16) & 0xFF) <<
* 40 | ((sha[1] >>> 8) & 0xFF) << 48 | ((sha[1] >>> 0) & 0xFF) <<
* 56;
*/
for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) {
svuid = (svuid << 8) | (hashBytes[i] & 0xFF);
}
} finally {
// close the stream (if open)
if (dos != null) {
dos.close();
}
}
return svuid;
} } | public class class_name {
protected long computeSVUID() throws IOException {
ByteArrayOutputStream bos;
DataOutputStream dos = null;
long svuid = 0;
try {
bos = new ByteArrayOutputStream();
dos = new DataOutputStream(bos);
/*
* 1. The class name written using UTF encoding.
*/
dos.writeUTF(name.replace('/', '.'));
/*
* 2. The class modifiers written as a 32-bit integer.
*/
dos.writeInt(access
& (Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL
| Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT));
/*
* 3. The name of each interface sorted by name written using UTF
* encoding.
*/
Arrays.sort(interfaces);
for (int i = 0; i < interfaces.length; i++) {
dos.writeUTF(interfaces[i].replace('/', '.')); // depends on control dependency: [for], data = [i]
}
/*
* 4. For each field of the class sorted by field name (except
* private static and private transient fields):
*
* 1. The name of the field in UTF encoding. 2. The modifiers of the
* field written as a 32-bit integer. 3. The descriptor of the field
* in UTF encoding
*
* Note that field signatures are not dot separated. Method and
* constructor signatures are dot separated. Go figure...
*/
writeItems(svuidFields, dos, false);
/*
* 5. If a class initializer exists, write out the following: 1. The
* name of the method, <clinit>, in UTF encoding. 2. The modifier of
* the method, java.lang.reflect.Modifier.STATIC, written as a
* 32-bit integer. 3. The descriptor of the method, ()V, in UTF
* encoding.
*/
if (hasStaticInitializer) {
dos.writeUTF("<clinit>"); // depends on control dependency: [if], data = [none]
dos.writeInt(Opcodes.ACC_STATIC); // depends on control dependency: [if], data = [none]
dos.writeUTF("()V"); // depends on control dependency: [if], data = [none]
} // if..
/*
* 6. For each non-private constructor sorted by method name and
* signature: 1. The name of the method, <init>, in UTF encoding. 2.
* The modifiers of the method written as a 32-bit integer. 3. The
* descriptor of the method in UTF encoding.
*/
writeItems(svuidConstructors, dos, true);
/*
* 7. For each non-private method sorted by method name and
* signature: 1. The name of the method in UTF encoding. 2. The
* modifiers of the method written as a 32-bit integer. 3. The
* descriptor of the method in UTF encoding.
*/
writeItems(svuidMethods, dos, true);
dos.flush();
/*
* 8. The SHA-1 algorithm is executed on the stream of bytes
* produced by DataOutputStream and produces five 32-bit values
* sha[0..4].
*/
byte[] hashBytes = computeSHAdigest(bos.toByteArray());
/*
* 9. The hash value is assembled from the first and second 32-bit
* values of the SHA-1 message digest. If the result of the message
* digest, the five 32-bit words H0 H1 H2 H3 H4, is in an array of
* five int values named sha, the hash value would be computed as
* follows:
*
* long hash = ((sha[0] >>> 24) & 0xFF) | ((sha[0] >>> 16) & 0xFF)
* << 8 | ((sha[0] >>> 8) & 0xFF) << 16 | ((sha[0] >>> 0) & 0xFF) <<
* 24 | ((sha[1] >>> 24) & 0xFF) << 32 | ((sha[1] >>> 16) & 0xFF) <<
* 40 | ((sha[1] >>> 8) & 0xFF) << 48 | ((sha[1] >>> 0) & 0xFF) <<
* 56;
*/
for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) {
svuid = (svuid << 8) | (hashBytes[i] & 0xFF); // depends on control dependency: [for], data = [i]
}
} finally {
// close the stream (if open)
if (dos != null) {
dos.close(); // depends on control dependency: [if], data = [none]
}
}
return svuid;
} } |
public class class_name {
@Override
public String next() throws NoSuchElementException
{
String ret;
if(previousException != null)
throw new NoSuchElementException("Previous IOException reading from stream");
if(line == null)
{
try
{
if((line = in.readLine()) == null)
throw new NoSuchElementException("No more lines available");
}
catch(IOException e)
{
previousException = e;
throw new NoSuchElementException("IOException reading next line.");
}
}
ret = line;
line = null;
return ret;
} } | public class class_name {
@Override
public String next() throws NoSuchElementException
{
String ret;
if(previousException != null)
throw new NoSuchElementException("Previous IOException reading from stream");
if(line == null)
{
try
{
if((line = in.readLine()) == null)
throw new NoSuchElementException("No more lines available");
}
catch(IOException e)
{
previousException = e;
throw new NoSuchElementException("IOException reading next line.");
} // depends on control dependency: [catch], data = [none]
}
ret = line;
line = null;
return ret;
} } |
public class class_name {
public DaemonStatus checkStatus()
{
if (this.pidfile == null) {
throw new IllegalStateException("No pidfile specified, cannot check status!");
}
if (!pidfile.exists()) {
return DaemonStatus.STATUS_NOT_RUNNING;
}
final int pid;
try
{
byte[] content = Files.readAllBytes(pidfile.toPath());
String s = new String(content, StandardCharsets.UTF_8).trim();
pid = Integer.parseInt(s);
}
catch (Exception e)
{
System.err.println(e.getMessage());
return DaemonStatus.STATUS_UNKNOWN;
}
int rs = posix.kill(pid, 0);
if (rs == 0) {
return DaemonStatus.STATUS_RUNNING;
}
else
{
return DaemonStatus.STATUS_DEAD;
}
} } | public class class_name {
public DaemonStatus checkStatus()
{
if (this.pidfile == null) {
throw new IllegalStateException("No pidfile specified, cannot check status!");
}
if (!pidfile.exists()) {
return DaemonStatus.STATUS_NOT_RUNNING; // depends on control dependency: [if], data = [none]
}
final int pid;
try
{
byte[] content = Files.readAllBytes(pidfile.toPath());
String s = new String(content, StandardCharsets.UTF_8).trim();
pid = Integer.parseInt(s); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
System.err.println(e.getMessage());
return DaemonStatus.STATUS_UNKNOWN;
} // depends on control dependency: [catch], data = [none]
int rs = posix.kill(pid, 0);
if (rs == 0) {
return DaemonStatus.STATUS_RUNNING; // depends on control dependency: [if], data = [none]
}
else
{
return DaemonStatus.STATUS_DEAD; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static Response make(final Response res, final CharSequence type,
final Opt<Charset> charset) {
final Response response;
if (charset.has()) {
response = new RsWithHeader(
new RsWithoutHeader(res, RsWithType.HEADER),
RsWithType.HEADER,
String.format(
"%s; %s=%s",
type,
RsWithType.CHARSET,
charset.get().name()
)
);
} else {
response = new RsWithHeader(
new RsWithoutHeader(res, RsWithType.HEADER),
RsWithType.HEADER,
type
);
}
return response;
} } | public class class_name {
private static Response make(final Response res, final CharSequence type,
final Opt<Charset> charset) {
final Response response;
if (charset.has()) {
response = new RsWithHeader(
new RsWithoutHeader(res, RsWithType.HEADER),
RsWithType.HEADER,
String.format(
"%s; %s=%s",
type,
RsWithType.CHARSET,
charset.get().name()
)
); // depends on control dependency: [if], data = [none]
} else {
response = new RsWithHeader(
new RsWithoutHeader(res, RsWithType.HEADER),
RsWithType.HEADER,
type
); // depends on control dependency: [if], data = [none]
}
return response;
} } |
public class class_name {
@Override
public Change decodeChange(UUID changeId, ByteBuffer buf) {
int sep = getSeparatorIndex(buf);
Encoding encoding = getEncoding(buf, sep);
String body = getBody(buf, sep);
JsonTokener tokener;
Set<String> tags;
ChangeBuilder builder = new ChangeBuilder(changeId);
switch (encoding) {
case D1:
builder.with(Deltas.fromString(body));
break;
case D2:
// Spec for D2 is as follows:
// D2:<tags>:<Delta>
tokener = new JsonTokener(body);
tags = FluentIterable.from(tokener.nextArray()).transform(Functions.toStringFunction()).toSet();
tokener.next(':');
builder.with(Deltas.fromString(tokener)).with(tags);
break;
case D3:
// Spec for D3 is as follows:
// D3:<tags>:<change flags>:<Delta>
tokener = new JsonTokener(body);
tags = FluentIterable.from(tokener.nextArray()).transform(Functions.toStringFunction()).toSet();
tokener.next(':');
boolean isConstant = false;
boolean isMapDelta = false;
char changeFlag = tokener.next();
while (changeFlag != ':' && changeFlag != 0) {
// In the future there may be more change flags, though for now we're only interested in
// those provided below
switch (ChangeFlag.deserialize(changeFlag)) {
case CONSTANT_DELTA:
isConstant = true;
break;
case MAP_DELTA:
isMapDelta = true;
break;
}
changeFlag = tokener.next();
}
// There are numerous circumstances where the expense of parsing a literal map delta is wasted. For
// example, with two consecutive literal deltas for the same record the elder is immediately replaced
// by the latter, so resources spent parsing and instantiating the elder are unnecessary. Return a lazy
// map literal instead to defer instantiation until necessary.
if (isConstant && isMapDelta) {
builder.with(Deltas.literal(new LazyJsonMap(body.substring(tokener.pos())))).with(tags);
} else {
// Even if the delta is not a literal map delta there are still benefits to evaluating it lazily.
// For example, if a delta is behind a compaction record but has not yet been deleted it won't
// be used.
builder.with(new LazyDelta(tokener, isConstant)).with(tags);
}
break;
case C1:
builder.with(JsonHelper.fromJson(body, Compaction.class));
break;
case H1:
builder.with(JsonHelper.fromJson(body, History.class));
break;
default:
throw new UnsupportedOperationException(encoding.name());
}
return builder.build();
} } | public class class_name {
@Override
public Change decodeChange(UUID changeId, ByteBuffer buf) {
int sep = getSeparatorIndex(buf);
Encoding encoding = getEncoding(buf, sep);
String body = getBody(buf, sep);
JsonTokener tokener;
Set<String> tags;
ChangeBuilder builder = new ChangeBuilder(changeId);
switch (encoding) {
case D1:
builder.with(Deltas.fromString(body));
break;
case D2:
// Spec for D2 is as follows:
// D2:<tags>:<Delta>
tokener = new JsonTokener(body);
tags = FluentIterable.from(tokener.nextArray()).transform(Functions.toStringFunction()).toSet();
tokener.next(':');
builder.with(Deltas.fromString(tokener)).with(tags);
break;
case D3:
// Spec for D3 is as follows:
// D3:<tags>:<change flags>:<Delta>
tokener = new JsonTokener(body);
tags = FluentIterable.from(tokener.nextArray()).transform(Functions.toStringFunction()).toSet();
tokener.next(':');
boolean isConstant = false;
boolean isMapDelta = false;
char changeFlag = tokener.next();
while (changeFlag != ':' && changeFlag != 0) {
// In the future there may be more change flags, though for now we're only interested in
// those provided below
switch (ChangeFlag.deserialize(changeFlag)) {
case CONSTANT_DELTA:
isConstant = true;
break;
case MAP_DELTA:
isMapDelta = true;
break;
}
changeFlag = tokener.next(); // depends on control dependency: [while], data = [none]
}
// There are numerous circumstances where the expense of parsing a literal map delta is wasted. For
// example, with two consecutive literal deltas for the same record the elder is immediately replaced
// by the latter, so resources spent parsing and instantiating the elder are unnecessary. Return a lazy
// map literal instead to defer instantiation until necessary.
if (isConstant && isMapDelta) {
builder.with(Deltas.literal(new LazyJsonMap(body.substring(tokener.pos())))).with(tags); // depends on control dependency: [if], data = [none]
} else {
// Even if the delta is not a literal map delta there are still benefits to evaluating it lazily.
// For example, if a delta is behind a compaction record but has not yet been deleted it won't
// be used.
builder.with(new LazyDelta(tokener, isConstant)).with(tags); // depends on control dependency: [if], data = [none]
}
break;
case C1:
builder.with(JsonHelper.fromJson(body, Compaction.class));
break;
case H1:
builder.with(JsonHelper.fromJson(body, History.class));
break;
default:
throw new UnsupportedOperationException(encoding.name());
}
return builder.build();
} } |
public class class_name {
public void appendNsName(final StringBuilder sb,
final QName nm) {
String uri = nm.getNamespaceURI();
String abbr;
if ((defaultNS != null) && uri.equals(defaultNS)) {
abbr = null;
} else {
abbr = keyUri.get(uri);
if (abbr == null) {
abbr = uri;
}
}
if (abbr != null) {
sb.append(abbr);
sb.append(":");
}
sb.append(nm.getLocalPart());
} } | public class class_name {
public void appendNsName(final StringBuilder sb,
final QName nm) {
String uri = nm.getNamespaceURI();
String abbr;
if ((defaultNS != null) && uri.equals(defaultNS)) {
abbr = null; // depends on control dependency: [if], data = [none]
} else {
abbr = keyUri.get(uri); // depends on control dependency: [if], data = [none]
if (abbr == null) {
abbr = uri; // depends on control dependency: [if], data = [none]
}
}
if (abbr != null) {
sb.append(abbr); // depends on control dependency: [if], data = [(abbr]
sb.append(":"); // depends on control dependency: [if], data = [none]
}
sb.append(nm.getLocalPart());
} } |
public class class_name {
public InstanceList[] nextSplit(int numTrainFolds) {
InstanceList[] ret = new InstanceList[2];
ret[0] = new InstanceList(pipe);
ret[1] = new InstanceList(pipe);
// train on folds [index, index+numTrainFolds), test on rest
for (int i = 0; i < folds.length; i++) {
int foldno = (index + i) % folds.length;
InstanceList addTo;
if (i < numTrainFolds) {
addTo = ret[0];
} else {
addTo = ret[1];
}
Iterator<Instance> iter = folds[foldno].iterator();
while (iter.hasNext())
addTo.add(iter.next());
}
index++;
return ret;
} } | public class class_name {
public InstanceList[] nextSplit(int numTrainFolds) {
InstanceList[] ret = new InstanceList[2];
ret[0] = new InstanceList(pipe);
ret[1] = new InstanceList(pipe);
// train on folds [index, index+numTrainFolds), test on rest
for (int i = 0; i < folds.length; i++) {
int foldno = (index + i) % folds.length;
InstanceList addTo;
if (i < numTrainFolds) {
addTo = ret[0]; // depends on control dependency: [if], data = [none]
} else {
addTo = ret[1]; // depends on control dependency: [if], data = [none]
}
Iterator<Instance> iter = folds[foldno].iterator();
while (iter.hasNext())
addTo.add(iter.next());
}
index++;
return ret;
} } |
public class class_name {
public boolean receiveAcknowledgeMessage(AcknowledgeCheckpoint message) throws CheckpointException {
if (shutdown || message == null) {
return false;
}
if (!job.equals(message.getJob())) {
LOG.error("Received wrong AcknowledgeCheckpoint message for job {}: {}", job, message);
return false;
}
final long checkpointId = message.getCheckpointId();
synchronized (lock) {
// we need to check inside the lock for being shutdown as well, otherwise we
// get races and invalid error log messages
if (shutdown) {
return false;
}
final PendingCheckpoint checkpoint = pendingCheckpoints.get(checkpointId);
if (checkpoint != null && !checkpoint.isDiscarded()) {
switch (checkpoint.acknowledgeTask(message.getTaskExecutionId(), message.getSubtaskState(), message.getCheckpointMetrics())) {
case SUCCESS:
LOG.debug("Received acknowledge message for checkpoint {} from task {} of job {}.",
checkpointId, message.getTaskExecutionId(), message.getJob());
if (checkpoint.isFullyAcknowledged()) {
completePendingCheckpoint(checkpoint);
}
break;
case DUPLICATE:
LOG.debug("Received a duplicate acknowledge message for checkpoint {}, task {}, job {}.",
message.getCheckpointId(), message.getTaskExecutionId(), message.getJob());
break;
case UNKNOWN:
LOG.warn("Could not acknowledge the checkpoint {} for task {} of job {}, " +
"because the task's execution attempt id was unknown. Discarding " +
"the state handle to avoid lingering state.", message.getCheckpointId(),
message.getTaskExecutionId(), message.getJob());
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
break;
case DISCARDED:
LOG.warn("Could not acknowledge the checkpoint {} for task {} of job {}, " +
"because the pending checkpoint had been discarded. Discarding the " +
"state handle tp avoid lingering state.",
message.getCheckpointId(), message.getTaskExecutionId(), message.getJob());
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
}
return true;
}
else if (checkpoint != null) {
// this should not happen
throw new IllegalStateException(
"Received message for discarded but non-removed checkpoint " + checkpointId);
}
else {
boolean wasPendingCheckpoint;
// message is for an unknown checkpoint, or comes too late (checkpoint disposed)
if (recentPendingCheckpoints.contains(checkpointId)) {
wasPendingCheckpoint = true;
LOG.warn("Received late message for now expired checkpoint attempt {} from " +
"{} of job {}.", checkpointId, message.getTaskExecutionId(), message.getJob());
}
else {
LOG.debug("Received message for an unknown checkpoint {} from {} of job {}.",
checkpointId, message.getTaskExecutionId(), message.getJob());
wasPendingCheckpoint = false;
}
// try to discard the state so that we don't have lingering state lying around
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
return wasPendingCheckpoint;
}
}
} } | public class class_name {
public boolean receiveAcknowledgeMessage(AcknowledgeCheckpoint message) throws CheckpointException {
if (shutdown || message == null) {
return false;
}
if (!job.equals(message.getJob())) {
LOG.error("Received wrong AcknowledgeCheckpoint message for job {}: {}", job, message);
return false;
}
final long checkpointId = message.getCheckpointId();
synchronized (lock) {
// we need to check inside the lock for being shutdown as well, otherwise we
// get races and invalid error log messages
if (shutdown) {
return false; // depends on control dependency: [if], data = [none]
}
final PendingCheckpoint checkpoint = pendingCheckpoints.get(checkpointId);
if (checkpoint != null && !checkpoint.isDiscarded()) {
switch (checkpoint.acknowledgeTask(message.getTaskExecutionId(), message.getSubtaskState(), message.getCheckpointMetrics())) {
case SUCCESS:
LOG.debug("Received acknowledge message for checkpoint {} from task {} of job {}.",
checkpointId, message.getTaskExecutionId(), message.getJob());
if (checkpoint.isFullyAcknowledged()) {
completePendingCheckpoint(checkpoint); // depends on control dependency: [if], data = [none]
}
break;
case DUPLICATE:
LOG.debug("Received a duplicate acknowledge message for checkpoint {}, task {}, job {}.",
message.getCheckpointId(), message.getTaskExecutionId(), message.getJob());
break;
case UNKNOWN:
LOG.warn("Could not acknowledge the checkpoint {} for task {} of job {}, " +
"because the task's execution attempt id was unknown. Discarding " +
"the state handle to avoid lingering state.", message.getCheckpointId(),
message.getTaskExecutionId(), message.getJob());
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
break;
case DISCARDED:
LOG.warn("Could not acknowledge the checkpoint {} for task {} of job {}, " +
"because the pending checkpoint had been discarded. Discarding the " +
"state handle tp avoid lingering state.",
message.getCheckpointId(), message.getTaskExecutionId(), message.getJob());
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
}
return true; // depends on control dependency: [if], data = [none]
}
else if (checkpoint != null) {
// this should not happen
throw new IllegalStateException(
"Received message for discarded but non-removed checkpoint " + checkpointId);
}
else {
boolean wasPendingCheckpoint;
// message is for an unknown checkpoint, or comes too late (checkpoint disposed)
if (recentPendingCheckpoints.contains(checkpointId)) {
wasPendingCheckpoint = true; // depends on control dependency: [if], data = [none]
LOG.warn("Received late message for now expired checkpoint attempt {} from " +
"{} of job {}.", checkpointId, message.getTaskExecutionId(), message.getJob()); // depends on control dependency: [if], data = [none]
}
else {
LOG.debug("Received message for an unknown checkpoint {} from {} of job {}.",
checkpointId, message.getTaskExecutionId(), message.getJob()); // depends on control dependency: [if], data = [none]
wasPendingCheckpoint = false; // depends on control dependency: [if], data = [none]
}
// try to discard the state so that we don't have lingering state lying around
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState()); // depends on control dependency: [if], data = [none]
return wasPendingCheckpoint; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static FieldInfo of(Enum<?> enumValue) {
try {
FieldInfo result = FieldInfo.of(enumValue.getClass().getField(enumValue.name()));
Preconditions.checkArgument(
result != null, "enum constant missing @Value or @NullValue annotation: %s", enumValue);
return result;
} catch (NoSuchFieldException e) {
// not possible
throw new RuntimeException(e);
}
} } | public class class_name {
public static FieldInfo of(Enum<?> enumValue) {
try {
FieldInfo result = FieldInfo.of(enumValue.getClass().getField(enumValue.name()));
Preconditions.checkArgument(
result != null, "enum constant missing @Value or @NullValue annotation: %s", enumValue);
return result; // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException e) {
// not possible
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void memberRemoved(final MembershipEvent iEvent) {
try {
updateLastClusterChange();
if (iEvent.getMember() == null)
return;
final String nodeLeftName = getNodeName(iEvent.getMember());
if (nodeLeftName == null)
return;
removeServer(nodeLeftName, true);
} catch (HazelcastInstanceNotActiveException | RetryableHazelcastException e) {
OLogManager.instance().error(this, "Hazelcast is not running", e);
} catch (Exception e) {
OLogManager.instance().error(this, "Error on removing the server '%s'", e, getNodeName(iEvent.getMember()));
}
} } | public class class_name {
@Override
public void memberRemoved(final MembershipEvent iEvent) {
try {
updateLastClusterChange(); // depends on control dependency: [try], data = [none]
if (iEvent.getMember() == null)
return;
final String nodeLeftName = getNodeName(iEvent.getMember());
if (nodeLeftName == null)
return;
removeServer(nodeLeftName, true); // depends on control dependency: [try], data = [none]
} catch (HazelcastInstanceNotActiveException | RetryableHazelcastException e) {
OLogManager.instance().error(this, "Hazelcast is not running", e);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
OLogManager.instance().error(this, "Error on removing the server '%s'", e, getNodeName(iEvent.getMember()));
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void submit() {
try {
saveData();
m_context.finish(null);
} catch (Exception e) {
m_context.error(e);
}
} } | public class class_name {
void submit() {
try {
saveData(); // depends on control dependency: [try], data = [none]
m_context.finish(null); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
m_context.error(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private int lowestNonNullIndex(int iTargetPosition)
{
Object bookmark = null;
int iBookmarkIndex = iTargetPosition;
while (bookmark == null)
{
int iArrayIndex = m_gridList.listToArrayIndex(iBookmarkIndex);
iBookmarkIndex = m_gridList.arrayToListIndex(iArrayIndex); // Lowest valid bookmark
bookmark = m_gridList.elementAt(iBookmarkIndex);
if (bookmark == null)
{
if (iBookmarkIndex == 0)
return -1; // None found
iBookmarkIndex--;
if (m_gridBuffer != null)
bookmark = m_gridBuffer.elementAt(iBookmarkIndex); // Check to see if it's in this list
}
}
return iBookmarkIndex; // Valid bookmark, return it.
} } | public class class_name {
private int lowestNonNullIndex(int iTargetPosition)
{
Object bookmark = null;
int iBookmarkIndex = iTargetPosition;
while (bookmark == null)
{
int iArrayIndex = m_gridList.listToArrayIndex(iBookmarkIndex);
iBookmarkIndex = m_gridList.arrayToListIndex(iArrayIndex); // Lowest valid bookmark // depends on control dependency: [while], data = [none]
bookmark = m_gridList.elementAt(iBookmarkIndex); // depends on control dependency: [while], data = [none]
if (bookmark == null)
{
if (iBookmarkIndex == 0)
return -1; // None found
iBookmarkIndex--; // depends on control dependency: [if], data = [none]
if (m_gridBuffer != null)
bookmark = m_gridBuffer.elementAt(iBookmarkIndex); // Check to see if it's in this list
}
}
return iBookmarkIndex; // Valid bookmark, return it.
} } |
public class class_name {
public static boolean isMobile() {
if (GWT.isClient()) {
String userAgent = Navigator.getUserAgent();
for (String platform : MOBILE_PLATFORMS) {
if (userAgent.toLowerCase().indexOf(platform) != -1) {
return true;
}
}
}
return false;
} } | public class class_name {
public static boolean isMobile() {
if (GWT.isClient()) {
String userAgent = Navigator.getUserAgent();
for (String platform : MOBILE_PLATFORMS) {
if (userAgent.toLowerCase().indexOf(platform) != -1) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
@Override
public int removeAll(KType e1) {
int to = 0;
for (int from = 0; from < elementsCount; from++) {
if (Intrinsics.equals(this, e1, buffer[from])) {
buffer[from] = Intrinsics.empty();
continue;
}
if (to != from) {
buffer[to] = buffer[from];
buffer[from] = Intrinsics.empty();
}
to++;
}
final int deleted = elementsCount - to;
this.elementsCount = to;
return deleted;
} } | public class class_name {
@Override
public int removeAll(KType e1) {
int to = 0;
for (int from = 0; from < elementsCount; from++) {
if (Intrinsics.equals(this, e1, buffer[from])) {
buffer[from] = Intrinsics.empty(); // depends on control dependency: [if], data = [none]
continue;
}
if (to != from) {
buffer[to] = buffer[from]; // depends on control dependency: [if], data = [none]
buffer[from] = Intrinsics.empty(); // depends on control dependency: [if], data = [none]
}
to++; // depends on control dependency: [for], data = [none]
}
final int deleted = elementsCount - to;
this.elementsCount = to;
return deleted;
} } |
public class class_name {
String buildIdentitySQL(String[] pKeys) {
mTables = new Hashtable();
mColumns = new Vector();
// Get columns to select
mColumns.addElement(getPrimaryKey());
// Get tables to select (and join) from and their joins
tableJoins(null, false);
for (int i = 0; i < pKeys.length; i++) {
tableJoins(getColumn(pKeys[i]), true);
}
// All data read, build SQL query string
return "SELECT " + getPrimaryKey() + " " + buildFromClause()
+ buildWhereClause();
} } | public class class_name {
String buildIdentitySQL(String[] pKeys) {
mTables = new Hashtable();
mColumns = new Vector();
// Get columns to select
mColumns.addElement(getPrimaryKey());
// Get tables to select (and join) from and their joins
tableJoins(null, false);
for (int i = 0; i < pKeys.length; i++) {
tableJoins(getColumn(pKeys[i]), true);
// depends on control dependency: [for], data = [i]
}
// All data read, build SQL query string
return "SELECT " + getPrimaryKey() + " " + buildFromClause()
+ buildWhereClause();
} } |
public class class_name {
private void initResetCheckbox(CheckBox box, final CmsDateField field) {
box.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
Boolean value = (Boolean)(event.getProperty().getValue());
if (value.booleanValue()) {
field.clear();
field.setEnabled(false);
} else {
field.setEnabled(true);
}
}
});
} } | public class class_name {
private void initResetCheckbox(CheckBox box, final CmsDateField field) {
box.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
Boolean value = (Boolean)(event.getProperty().getValue());
if (value.booleanValue()) {
field.clear(); // depends on control dependency: [if], data = [none]
field.setEnabled(false); // depends on control dependency: [if], data = [none]
} else {
field.setEnabled(true); // depends on control dependency: [if], data = [none]
}
}
});
} } |
public class class_name {
public static BoundingBox getProjectedBoundingBox(Projection projection,
long x, long y, int zoom) {
BoundingBox boundingBox = getWebMercatorBoundingBox(x, y, zoom);
if (projection != null) {
ProjectionTransform transform = webMercator
.getTransformation(projection);
boundingBox = boundingBox.transform(transform);
}
return boundingBox;
} } | public class class_name {
public static BoundingBox getProjectedBoundingBox(Projection projection,
long x, long y, int zoom) {
BoundingBox boundingBox = getWebMercatorBoundingBox(x, y, zoom);
if (projection != null) {
ProjectionTransform transform = webMercator
.getTransformation(projection);
boundingBox = boundingBox.transform(transform); // depends on control dependency: [if], data = [none]
}
return boundingBox;
} } |
public class class_name {
protected void setJsonValue(JsonObjectBuilder builder, T value) {
// I don't like this - there should really be a way to construct a disconnected JSONValue...
if (value instanceof Boolean) {
builder.add("value", (Boolean) value);
} else if (value instanceof Double) {
builder.add("value", (Double) value);
} else if (value instanceof Integer) {
builder.add("value", (Integer) value);
} else if (value instanceof Long) {
builder.add("value", (Long) value);
} else if (value instanceof BigInteger) {
builder.add("value", (BigInteger) value);
} else if (value instanceof BigDecimal) {
builder.add("value", (BigDecimal) value);
} else if (value == null) {
builder.addNull("value");
} else {
builder.add("value", value.toString());
}
} } | public class class_name {
protected void setJsonValue(JsonObjectBuilder builder, T value) {
// I don't like this - there should really be a way to construct a disconnected JSONValue...
if (value instanceof Boolean) {
builder.add("value", (Boolean) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Double) {
builder.add("value", (Double) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Integer) {
builder.add("value", (Integer) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Long) {
builder.add("value", (Long) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof BigInteger) {
builder.add("value", (BigInteger) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof BigDecimal) {
builder.add("value", (BigDecimal) value); // depends on control dependency: [if], data = [none]
} else if (value == null) {
builder.addNull("value"); // depends on control dependency: [if], data = [none]
} else {
builder.add("value", value.toString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void startUsingModel () {
if (replacementThread != null) {
try { replacementThread.join(); }
catch (InterruptedException e) {}
}
replacementCanProceed = false;
users++;
} } | public class class_name {
public void startUsingModel () {
if (replacementThread != null) {
try { replacementThread.join(); } // depends on control dependency: [try], data = [none]
catch (InterruptedException e) {} // depends on control dependency: [catch], data = [none]
}
replacementCanProceed = false;
users++;
} } |
public class class_name {
public void setAddressHeader(String name, Address addr) {
if(logger.isDebugEnabled()) {
logger.debug("setAddressHeader - name=" + name + ", addr=" + addr);
}
checkCommitted();
String hName = getFullHeaderName(name);
if (logger.isDebugEnabled())
logger.debug("Setting address header [" + name + "] to value ["
+ addr + "]");
if (isSystemHeaderAndNotGruu(getModifiableRule(hName), (Parameterable)addr.getURI())) {
logger.error("Error, can't set system header [" + hName + "]");
throw new IllegalArgumentException(
"Cant set system header, it is maintained by container!!");
}
if (hName.equalsIgnoreCase("From") || hName.equalsIgnoreCase("To")) {
logger.error("Error, can't set From or To header [" + hName + "]");
throw new IllegalArgumentException(
"Cant set From or To header, see JSR 289 Section 4.1.2");
}
// if (!isAddressTypeHeader(hName)) {
// logger.error("Error, set header, its not address type header ["
// + hName + "]!!");
// throw new IllegalArgumentException(
// "This header is not address type header");
// }
Header h;
String headerNameToAdd = getCorrectHeaderName(hName);
try {
h = SipFactoryImpl.headerFactory.createHeader(headerNameToAdd, addr
.toString());
this.message.setHeader(h);
} catch (ParseException e) {
logger.error("Parsing problem while setting address header with name "
+ name + " and address "+ addr, e);
}
} } | public class class_name {
public void setAddressHeader(String name, Address addr) {
if(logger.isDebugEnabled()) {
logger.debug("setAddressHeader - name=" + name + ", addr=" + addr); // depends on control dependency: [if], data = [none]
}
checkCommitted();
String hName = getFullHeaderName(name);
if (logger.isDebugEnabled())
logger.debug("Setting address header [" + name + "] to value ["
+ addr + "]");
if (isSystemHeaderAndNotGruu(getModifiableRule(hName), (Parameterable)addr.getURI())) {
logger.error("Error, can't set system header [" + hName + "]");
throw new IllegalArgumentException(
"Cant set system header, it is maintained by container!!");
}
if (hName.equalsIgnoreCase("From") || hName.equalsIgnoreCase("To")) {
logger.error("Error, can't set From or To header [" + hName + "]"); // depends on control dependency: [if], data = [none]
throw new IllegalArgumentException(
"Cant set From or To header, see JSR 289 Section 4.1.2");
}
// if (!isAddressTypeHeader(hName)) {
// logger.error("Error, set header, its not address type header ["
// + hName + "]!!");
// throw new IllegalArgumentException(
// "This header is not address type header");
// }
Header h;
String headerNameToAdd = getCorrectHeaderName(hName);
try {
h = SipFactoryImpl.headerFactory.createHeader(headerNameToAdd, addr
.toString()); // depends on control dependency: [try], data = [none]
this.message.setHeader(h); // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
logger.error("Parsing problem while setting address header with name "
+ name + " and address "+ addr, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected boolean isCoordinateAxisForVariable(Variable axis, VariableEnhanced v) {
List<Dimension> varDims = v.getDimensionsAll();
List<Dimension> axisDims = axis.getDimensionsAll();
// a CHAR variable must really be a STRING, so leave out the last (string length) dimension
int checkDims = axisDims.size();
if (axis.getDataType() == DataType.CHAR)
checkDims--;
for (int i = 0; i < checkDims; i++) {
Dimension axisDim = axisDims.get(i);
if (!varDims.contains(axisDim)) {
return false;
}
}
return true;
} } | public class class_name {
protected boolean isCoordinateAxisForVariable(Variable axis, VariableEnhanced v) {
List<Dimension> varDims = v.getDimensionsAll();
List<Dimension> axisDims = axis.getDimensionsAll();
// a CHAR variable must really be a STRING, so leave out the last (string length) dimension
int checkDims = axisDims.size();
if (axis.getDataType() == DataType.CHAR)
checkDims--;
for (int i = 0; i < checkDims; i++) {
Dimension axisDim = axisDims.get(i);
if (!varDims.contains(axisDim)) {
return false;
// depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
private double computeAngle(RoadPolyline segment, boolean fromStartPoint) {
double angle = Double.NaN;
Point2d p1 = null;
Point2d p2 = null;
if (segment.getPointCount() > 1) {
if (fromStartPoint) {
final RoadConnection startPoint = segment.getBeginPoint(StandardRoadConnection.class);
if (startPoint == this) {
p1 = startPoint.getPoint();
p2 = segment.getPointAt(1);
// Because the Y axis is directly to the bottom of the screen
// it is necessary to invert it to reply an counterclockwise angle
angle = MathUtil.clampCyclic(
Vector2D.signedAngle(
1, 0, p2.getX() - p1.getX(), p1.getY() - p2.getY()),
0, MathConstants.TWO_PI);
} else {
throw new IllegalArgumentException(
Locale.getString("ERROR_ALREADY_CONNECTED_START", //$NON-NLS-1$
segment,
p1,
p2,
startPoint));
}
} else {
final RoadConnection endPoint = segment.getEndPoint(StandardRoadConnection.class);
if (endPoint == this) {
p1 = endPoint.getPoint();
p2 = segment.getAntepenulvianPoint();
// Because the Y axis is directly to the bottom of the screen
// it is necessary to invert it to reply an counterclockwise angle
angle = MathUtil.clampCyclic(
Vector2D.signedAngle(
1, 0, p2.getX() - p1.getX(), p1.getY() - p2.getY()),
0, MathConstants.TWO_PI);
} else {
throw new IllegalArgumentException(
Locale.getString("ERROR_ALREADY_CONNECTED_END", //$NON-NLS-1$
segment,
p1,
p2,
endPoint));
}
}
if (Double.isNaN(angle) || Double.isInfinite(angle)) {
throw new IllegalArgumentException(
Locale.getString("ERROR_SAME_POINTS", //$NON-NLS-1$
segment, p1, p2));
}
} else {
throw new IllegalArgumentException(
Locale.getString("ERROR_NOT_ENOUGH_POINTS", //$NON-NLS-1$
segment));
}
return angle;
} } | public class class_name {
private double computeAngle(RoadPolyline segment, boolean fromStartPoint) {
double angle = Double.NaN;
Point2d p1 = null;
Point2d p2 = null;
if (segment.getPointCount() > 1) {
if (fromStartPoint) {
final RoadConnection startPoint = segment.getBeginPoint(StandardRoadConnection.class);
if (startPoint == this) {
p1 = startPoint.getPoint(); // depends on control dependency: [if], data = [none]
p2 = segment.getPointAt(1); // depends on control dependency: [if], data = [none]
// Because the Y axis is directly to the bottom of the screen
// it is necessary to invert it to reply an counterclockwise angle
angle = MathUtil.clampCyclic(
Vector2D.signedAngle(
1, 0, p2.getX() - p1.getX(), p1.getY() - p2.getY()),
0, MathConstants.TWO_PI); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException(
Locale.getString("ERROR_ALREADY_CONNECTED_START", //$NON-NLS-1$
segment,
p1,
p2,
startPoint));
}
} else {
final RoadConnection endPoint = segment.getEndPoint(StandardRoadConnection.class);
if (endPoint == this) {
p1 = endPoint.getPoint(); // depends on control dependency: [if], data = [none]
p2 = segment.getAntepenulvianPoint(); // depends on control dependency: [if], data = [none]
// Because the Y axis is directly to the bottom of the screen
// it is necessary to invert it to reply an counterclockwise angle
angle = MathUtil.clampCyclic(
Vector2D.signedAngle(
1, 0, p2.getX() - p1.getX(), p1.getY() - p2.getY()),
0, MathConstants.TWO_PI); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException(
Locale.getString("ERROR_ALREADY_CONNECTED_END", //$NON-NLS-1$
segment,
p1,
p2,
endPoint));
}
}
if (Double.isNaN(angle) || Double.isInfinite(angle)) {
throw new IllegalArgumentException(
Locale.getString("ERROR_SAME_POINTS", //$NON-NLS-1$
segment, p1, p2));
}
} else {
throw new IllegalArgumentException(
Locale.getString("ERROR_NOT_ENOUGH_POINTS", //$NON-NLS-1$
segment));
}
return angle;
} } |
public class class_name {
@Override
public final boolean propertyExists(String name) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "propertyExists", name);
boolean result = false;
/* Got to check Maelstrom's transportVersion first as performance for it */
/* is critical. */
if (name.equals(MfpConstants.PRP_TRANSVER) && isTransportVersionSet()) {
result = true;
}
/* Next try the user property map as the most likely */
else if ((mayHaveJmsUserProperties()) && (getJmsUserPropertyMap().containsKey(name))) {
result = true;
}
/* If name starts with JMS it may be a smoke-and-mirrors property */
else if (name.startsWith(JMS_PREFIX)) {
/* If it is a JMSX property.... */
if (name.charAt(JMS_LENGTH) == JMSX_EXTRA_PREFIX) {
int count = name.length() - JMSX_LENGTH;
if (name.regionMatches(JMSX_LENGTH, SIProperties.JMSXDeliveryCount, JMSX_LENGTH, count)) {
if (isSent())
result = true;
}
else if (name.regionMatches(JMSX_LENGTH, SIProperties.JMSXAppID, JMSX_LENGTH, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.XAPPID) != JsHdr2Access.IS_XAPPID_EMPTY)
result = true;
}
else if (name.regionMatches(JMSX_LENGTH, SIProperties.JMSXUserID, JMSX_LENGTH, count)) {
if (getUserid() != null)
result = true;
}
/* The other supported JMSX properties just live in the system map */
else if (mayHaveMappedJmsSystemProperties()) {
result = getJmsSystemPropertyMap().containsKey(name);
}
}
/* All the remaining header properties start with JMS_IBM_ */
else if (name.startsWith(JMS_IBM_EXTRA_PREFIX, JMS_LENGTH)) {
int count;
/* First check for the Report ones */
if (name.regionMatches(JMS_IBM_LENGTH, REPORT, 0, REPORT_LENGTH)) {
count = name.length() - REPORT_OFFSET;
if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_Expiration, REPORT_OFFSET, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.REPORTEXPIRY) != JsHdr2Access.IS_REPORTEXPIRY_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_COA, REPORT_OFFSET, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.REPORTCOA) != JsHdr2Access.IS_REPORTCOA_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_COD, REPORT_OFFSET, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.REPORTCOD) != JsHdr2Access.IS_REPORTCOD_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_Exception, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTEXCEPTION) != JsApiAccess.IS_REPORTEXCEPTION_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_PAN, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTPAN) != JsApiAccess.IS_REPORTPAN_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_NAN, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTNAN) != JsApiAccess.IS_REPORTNAN_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_Pass_Msg_ID, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTPASSMSGID) != JsApiAccess.IS_REPORTPASSMSGID_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_Pass_Correl_ID, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTPASSCORRELID) != JsApiAccess.IS_REPORTPASSCORRELID_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_Discard_Msg, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTDISCARDMSG) != JsApiAccess.IS_REPORTDISCARDMSG_UNSET)
result = true;
}
}
else {
/* Then try the other smoke-and-mirrors ones */
count = name.length() - JMS_IBM_LENGTH;
if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ExceptionReason, JMS_IBM_LENGTH, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) != JsHdr2Access.IS_EXCEPTION_EMPTY)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ExceptionTimestamp, JMS_IBM_LENGTH, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) != JsHdr2Access.IS_EXCEPTION_EMPTY)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ExceptionMessage, JMS_IBM_LENGTH, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) != JsHdr2Access.IS_EXCEPTION_EMPTY)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ExceptionProblemDestination, JMS_IBM_LENGTH, count)) {
if (getExceptionProblemDestination() != null)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ExceptionProblemSubscription, JMS_IBM_LENGTH, count)) {
if (getExceptionProblemSubscription() != null)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_Feedback, JMS_IBM_LENGTH, count)) {
if ((getApi().getChoiceField(JsApiAccess.REPORTFEEDBACK) != JsApiAccess.IS_REPORTFEEDBACK_UNSET) ||
(getApi().getChoiceField(JsApiAccess.REPORTFEEDBACKINT) != JsApiAccess.IS_REPORTFEEDBACKINT_UNSET))
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_System_MessageID, JMS_IBM_LENGTH, count)) {
if (getSystemMessageId() != null)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ArmCorrelator, JMS_IBM_LENGTH, count)) {
if (getARMCorrelator() != null)
result = true;
}
/* The other supported JMS_IBM_ properties just live in one (or both) of the maps */
else {
if (mayHaveMappedJmsSystemProperties()) {
result = getJmsSystemPropertyMap().containsKey(name);
}
if (result == false) {
result = getMQMDSetPropertiesMap().containsKey(name);
}
}
} // end of else of if Report
} // end of if JMS_IBM_
// JMS_TOG_ARM_Correlator
else if (name.equals(SIProperties.JMS_TOG_ARM_Correlator)) {
if (getARMCorrelator() != null)
result = true;
}
} // end of if JMS
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "propertyExists", Boolean.valueOf(result));
return result;
} } | public class class_name {
@Override
public final boolean propertyExists(String name) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "propertyExists", name);
boolean result = false;
/* Got to check Maelstrom's transportVersion first as performance for it */
/* is critical. */
if (name.equals(MfpConstants.PRP_TRANSVER) && isTransportVersionSet()) {
result = true; // depends on control dependency: [if], data = [none]
}
/* Next try the user property map as the most likely */
else if ((mayHaveJmsUserProperties()) && (getJmsUserPropertyMap().containsKey(name))) {
result = true; // depends on control dependency: [if], data = [none]
}
/* If name starts with JMS it may be a smoke-and-mirrors property */
else if (name.startsWith(JMS_PREFIX)) {
/* If it is a JMSX property.... */
if (name.charAt(JMS_LENGTH) == JMSX_EXTRA_PREFIX) {
int count = name.length() - JMSX_LENGTH;
if (name.regionMatches(JMSX_LENGTH, SIProperties.JMSXDeliveryCount, JMSX_LENGTH, count)) {
if (isSent())
result = true;
}
else if (name.regionMatches(JMSX_LENGTH, SIProperties.JMSXAppID, JMSX_LENGTH, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.XAPPID) != JsHdr2Access.IS_XAPPID_EMPTY)
result = true;
}
else if (name.regionMatches(JMSX_LENGTH, SIProperties.JMSXUserID, JMSX_LENGTH, count)) {
if (getUserid() != null)
result = true;
}
/* The other supported JMSX properties just live in the system map */
else if (mayHaveMappedJmsSystemProperties()) {
result = getJmsSystemPropertyMap().containsKey(name); // depends on control dependency: [if], data = [none]
}
}
/* All the remaining header properties start with JMS_IBM_ */
else if (name.startsWith(JMS_IBM_EXTRA_PREFIX, JMS_LENGTH)) {
int count;
/* First check for the Report ones */
if (name.regionMatches(JMS_IBM_LENGTH, REPORT, 0, REPORT_LENGTH)) {
count = name.length() - REPORT_OFFSET; // depends on control dependency: [if], data = [none]
if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_Expiration, REPORT_OFFSET, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.REPORTEXPIRY) != JsHdr2Access.IS_REPORTEXPIRY_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_COA, REPORT_OFFSET, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.REPORTCOA) != JsHdr2Access.IS_REPORTCOA_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_COD, REPORT_OFFSET, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.REPORTCOD) != JsHdr2Access.IS_REPORTCOD_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_Exception, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTEXCEPTION) != JsApiAccess.IS_REPORTEXCEPTION_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_PAN, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTPAN) != JsApiAccess.IS_REPORTPAN_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_NAN, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTNAN) != JsApiAccess.IS_REPORTNAN_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_Pass_Msg_ID, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTPASSMSGID) != JsApiAccess.IS_REPORTPASSMSGID_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_Pass_Correl_ID, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTPASSCORRELID) != JsApiAccess.IS_REPORTPASSCORRELID_UNSET)
result = true;
}
else if (name.regionMatches(REPORT_OFFSET, SIProperties.JMS_IBM_Report_Discard_Msg, REPORT_OFFSET, count)) {
if (getApi().getChoiceField(JsApiAccess.REPORTDISCARDMSG) != JsApiAccess.IS_REPORTDISCARDMSG_UNSET)
result = true;
}
}
else {
/* Then try the other smoke-and-mirrors ones */
count = name.length() - JMS_IBM_LENGTH; // depends on control dependency: [if], data = [none]
if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ExceptionReason, JMS_IBM_LENGTH, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) != JsHdr2Access.IS_EXCEPTION_EMPTY)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ExceptionTimestamp, JMS_IBM_LENGTH, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) != JsHdr2Access.IS_EXCEPTION_EMPTY)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ExceptionMessage, JMS_IBM_LENGTH, count)) {
if (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) != JsHdr2Access.IS_EXCEPTION_EMPTY)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ExceptionProblemDestination, JMS_IBM_LENGTH, count)) {
if (getExceptionProblemDestination() != null)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ExceptionProblemSubscription, JMS_IBM_LENGTH, count)) {
if (getExceptionProblemSubscription() != null)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_Feedback, JMS_IBM_LENGTH, count)) {
if ((getApi().getChoiceField(JsApiAccess.REPORTFEEDBACK) != JsApiAccess.IS_REPORTFEEDBACK_UNSET) ||
(getApi().getChoiceField(JsApiAccess.REPORTFEEDBACKINT) != JsApiAccess.IS_REPORTFEEDBACKINT_UNSET))
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_System_MessageID, JMS_IBM_LENGTH, count)) {
if (getSystemMessageId() != null)
result = true;
}
else if (name.regionMatches(JMS_IBM_LENGTH, SIProperties.JMS_IBM_ArmCorrelator, JMS_IBM_LENGTH, count)) {
if (getARMCorrelator() != null)
result = true;
}
/* The other supported JMS_IBM_ properties just live in one (or both) of the maps */
else {
if (mayHaveMappedJmsSystemProperties()) {
result = getJmsSystemPropertyMap().containsKey(name); // depends on control dependency: [if], data = [none]
}
if (result == false) {
result = getMQMDSetPropertiesMap().containsKey(name); // depends on control dependency: [if], data = [none]
}
}
} // end of else of if Report
} // end of if JMS_IBM_
// JMS_TOG_ARM_Correlator
else if (name.equals(SIProperties.JMS_TOG_ARM_Correlator)) {
if (getARMCorrelator() != null)
result = true;
}
} // end of if JMS
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "propertyExists", Boolean.valueOf(result));
return result;
} } |
public class class_name {
private WebElement createWebElementAndSetLocation(String information, WebView webView){
String[] data = information.split(";,");
String[] elements = null;
int x = 0;
int y = 0;
int width = 0;
int height = 0;
Hashtable<String, String> attributes = new Hashtable<String, String>();
try{
x = Math.round(Float.valueOf(data[5]));
y = Math.round(Float.valueOf(data[6]));
width = Math.round(Float.valueOf(data[7]));
height = Math.round(Float.valueOf(data[8]));
elements = data[9].split("\\#\\$");
}catch(Exception ignored){}
if(elements != null) {
for (int index = 0; index < elements.length; index++){
String[] element = elements[index].split("::");
if (element.length > 1) {
attributes.put(element[0], element[1]);
} else {
attributes.put(element[0], element[0]);
}
}
}
WebElement webElement = null;
try{
webElement = new WebElement(data[0], data[1], data[2], data[3], data[4], attributes);
setLocation(webElement, webView, x, y, width, height);
}catch(Exception ignored) {}
return webElement;
} } | public class class_name {
private WebElement createWebElementAndSetLocation(String information, WebView webView){
String[] data = information.split(";,");
String[] elements = null;
int x = 0;
int y = 0;
int width = 0;
int height = 0;
Hashtable<String, String> attributes = new Hashtable<String, String>();
try{
x = Math.round(Float.valueOf(data[5])); // depends on control dependency: [try], data = [none]
y = Math.round(Float.valueOf(data[6])); // depends on control dependency: [try], data = [none]
width = Math.round(Float.valueOf(data[7])); // depends on control dependency: [try], data = [none]
height = Math.round(Float.valueOf(data[8])); // depends on control dependency: [try], data = [none]
elements = data[9].split("\\#\\$"); // depends on control dependency: [try], data = [none]
}catch(Exception ignored){} // depends on control dependency: [catch], data = [none]
if(elements != null) {
for (int index = 0; index < elements.length; index++){
String[] element = elements[index].split("::");
if (element.length > 1) {
attributes.put(element[0], element[1]); // depends on control dependency: [if], data = [none]
} else {
attributes.put(element[0], element[0]); // depends on control dependency: [if], data = [none]
}
}
}
WebElement webElement = null;
try{
webElement = new WebElement(data[0], data[1], data[2], data[3], data[4], attributes); // depends on control dependency: [try], data = [none]
setLocation(webElement, webView, x, y, width, height); // depends on control dependency: [try], data = [none]
}catch(Exception ignored) {} // depends on control dependency: [catch], data = [none]
return webElement;
} } |
public class class_name {
private void scanUserPaths(PackageSymbol p, boolean includeSourcePath) throws IOException {
Set<JavaFileObject.Kind> kinds = getPackageFileKinds();
Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds);
classKinds.remove(JavaFileObject.Kind.SOURCE);
boolean wantClassFiles = !classKinds.isEmpty();
Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds);
sourceKinds.remove(JavaFileObject.Kind.CLASS);
boolean wantSourceFiles = !sourceKinds.isEmpty();
boolean haveSourcePath = includeSourcePath && fileManager.hasLocation(SOURCE_PATH);
if (verbose && verbosePath) {
if (fileManager instanceof StandardJavaFileManager) {
StandardJavaFileManager fm = (StandardJavaFileManager)fileManager;
if (haveSourcePath && wantSourceFiles) {
List<Path> path = List.nil();
for (Path sourcePath : fm.getLocationAsPaths(SOURCE_PATH)) {
path = path.prepend(sourcePath);
}
log.printVerbose("sourcepath", path.reverse().toString());
} else if (wantSourceFiles) {
List<Path> path = List.nil();
for (Path classPath : fm.getLocationAsPaths(CLASS_PATH)) {
path = path.prepend(classPath);
}
log.printVerbose("sourcepath", path.reverse().toString());
}
if (wantClassFiles) {
List<Path> path = List.nil();
for (Path platformPath : fm.getLocationAsPaths(PLATFORM_CLASS_PATH)) {
path = path.prepend(platformPath);
}
for (Path classPath : fm.getLocationAsPaths(CLASS_PATH)) {
path = path.prepend(classPath);
}
log.printVerbose("classpath", path.reverse().toString());
}
}
}
String packageName = p.fullname.toString();
if (wantSourceFiles && !haveSourcePath) {
fillIn(p, CLASS_PATH,
list(CLASS_PATH,
p,
packageName,
kinds));
} else {
if (wantClassFiles)
fillIn(p, CLASS_PATH,
list(CLASS_PATH,
p,
packageName,
classKinds));
if (wantSourceFiles)
fillIn(p, SOURCE_PATH,
list(SOURCE_PATH,
p,
packageName,
sourceKinds));
}
} } | public class class_name {
private void scanUserPaths(PackageSymbol p, boolean includeSourcePath) throws IOException {
Set<JavaFileObject.Kind> kinds = getPackageFileKinds();
Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds);
classKinds.remove(JavaFileObject.Kind.SOURCE);
boolean wantClassFiles = !classKinds.isEmpty();
Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds);
sourceKinds.remove(JavaFileObject.Kind.CLASS);
boolean wantSourceFiles = !sourceKinds.isEmpty();
boolean haveSourcePath = includeSourcePath && fileManager.hasLocation(SOURCE_PATH);
if (verbose && verbosePath) {
if (fileManager instanceof StandardJavaFileManager) {
StandardJavaFileManager fm = (StandardJavaFileManager)fileManager;
if (haveSourcePath && wantSourceFiles) {
List<Path> path = List.nil();
for (Path sourcePath : fm.getLocationAsPaths(SOURCE_PATH)) {
path = path.prepend(sourcePath); // depends on control dependency: [for], data = [sourcePath]
}
log.printVerbose("sourcepath", path.reverse().toString()); // depends on control dependency: [if], data = [none]
} else if (wantSourceFiles) {
List<Path> path = List.nil();
for (Path classPath : fm.getLocationAsPaths(CLASS_PATH)) {
path = path.prepend(classPath); // depends on control dependency: [for], data = [classPath]
}
log.printVerbose("sourcepath", path.reverse().toString()); // depends on control dependency: [if], data = [none]
}
if (wantClassFiles) {
List<Path> path = List.nil();
for (Path platformPath : fm.getLocationAsPaths(PLATFORM_CLASS_PATH)) {
path = path.prepend(platformPath); // depends on control dependency: [for], data = [platformPath]
}
for (Path classPath : fm.getLocationAsPaths(CLASS_PATH)) {
path = path.prepend(classPath); // depends on control dependency: [for], data = [classPath]
}
log.printVerbose("classpath", path.reverse().toString()); // depends on control dependency: [if], data = [none]
}
}
}
String packageName = p.fullname.toString();
if (wantSourceFiles && !haveSourcePath) {
fillIn(p, CLASS_PATH,
list(CLASS_PATH,
p,
packageName,
kinds));
} else {
if (wantClassFiles)
fillIn(p, CLASS_PATH,
list(CLASS_PATH,
p,
packageName,
classKinds));
if (wantSourceFiles)
fillIn(p, SOURCE_PATH,
list(SOURCE_PATH,
p,
packageName,
sourceKinds));
}
} } |
public class class_name {
private void sendEvents(final List<Event> events) {
if (null != handlers) {
for (EventHandler current : handlers) {
for (Event event : events) {
current.handleEvent(event);
}
}
}
LOG.info("Put events(" + events.size() + ") to Monitoring Server.");
try {
if (sendToEventadmin) {
EventAdminPublisher.publish(events);
} else {
monitoringServiceClient.putEvents(events);
}
} catch (MonitoringException e) {
throw e;
} catch (Exception e) {
throw new MonitoringException("002",
"Unknown error while execute put events to Monitoring Server", e);
}
} } | public class class_name {
private void sendEvents(final List<Event> events) {
if (null != handlers) {
for (EventHandler current : handlers) {
for (Event event : events) {
current.handleEvent(event); // depends on control dependency: [for], data = [event]
}
}
}
LOG.info("Put events(" + events.size() + ") to Monitoring Server.");
try {
if (sendToEventadmin) {
EventAdminPublisher.publish(events);
} else {
monitoringServiceClient.putEvents(events);
}
} catch (MonitoringException e) {
throw e;
} catch (Exception e) {
throw new MonitoringException("002",
"Unknown error while execute put events to Monitoring Server", e);
}
} } |
public class class_name {
public final Membership join(Supplier<byte[]> memberData, @Nullable Runnable onLoseMembership)
throws JoinException, InterruptedException {
Objects.requireNonNull(memberData);
ensurePersistentGroupPath();
final ActiveMembership groupJoiner = new ActiveMembership(memberData, onLoseMembership);
return backoffHelper.doUntilResult(new ExceptionalSupplier<Membership, JoinException>() {
@Override public Membership get() throws JoinException {
try {
return groupJoiner.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new JoinException("Interrupted trying to join group at path: " + path, e);
} catch (ZooKeeperConnectionException e) {
LOG.log(Level.WARNING, "Temporary error trying to join group at path: " + path, e);
return null;
} catch (KeeperException e) {
if (zkClient.shouldRetry(e)) {
LOG.log(Level.WARNING, "Temporary error trying to join group at path: " + path, e);
return null;
} else {
throw new JoinException("Problem joining partition group at path: " + path, e);
}
}
}
});
} } | public class class_name {
public final Membership join(Supplier<byte[]> memberData, @Nullable Runnable onLoseMembership)
throws JoinException, InterruptedException {
Objects.requireNonNull(memberData);
ensurePersistentGroupPath();
final ActiveMembership groupJoiner = new ActiveMembership(memberData, onLoseMembership);
return backoffHelper.doUntilResult(new ExceptionalSupplier<Membership, JoinException>() {
@Override public Membership get() throws JoinException {
try {
return groupJoiner.join(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new JoinException("Interrupted trying to join group at path: " + path, e);
} catch (ZooKeeperConnectionException e) { // depends on control dependency: [catch], data = [none]
LOG.log(Level.WARNING, "Temporary error trying to join group at path: " + path, e);
return null;
} catch (KeeperException e) { // depends on control dependency: [catch], data = [none]
if (zkClient.shouldRetry(e)) {
LOG.log(Level.WARNING, "Temporary error trying to join group at path: " + path, e); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
} else {
throw new JoinException("Problem joining partition group at path: " + path, e);
}
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public int getInt(String key) {
String value = get(key);
Utils.require(value != null, key + " parameter is not set");
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(key + " parameter should be a number");
}
} } | public class class_name {
public int getInt(String key) {
String value = get(key);
Utils.require(value != null, key + " parameter is not set");
try {
return Integer.parseInt(value);
// depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new IllegalArgumentException(key + " parameter should be a number");
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean createMQLinkMPResources(
MQLinkHandler mqLinkHandler,
MQLinkDefinition mqld,
LocalizationDefinition linkLocalizationDefinition,
VirtualLinkDefinition virtualLinkDefinition,
Set<String> linkLocalizingMEs,
LocalTransaction transaction,
boolean linkCreated) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"createMQLinkMPResources",
new Object[] { mqLinkHandler,
mqld,
linkLocalizationDefinition,
virtualLinkDefinition,
linkLocalizingMEs,
transaction,
new Boolean(linkCreated) });
boolean engineResourcesRequired = false;
//For MQLinks, we want the QueueHigh messages to be the same as for
//transmit queues.
linkLocalizationDefinition.setDestinationHighMsgs(messageProcessor.getHighMessageThreshold());
linkLocalizationDefinition.setDestinationLowMsgs((messageProcessor.getHighMessageThreshold() * 8) / 10);
//If we didnt just create the linkHandler and the one that already
//existed is for a different UUID, or there is already a localisation for
//the linkHandler on this ME, then this could be a problem and further
//tests are required.
if (!linkCreated)
{
/*
* 182456.6
* For the move to WCCM, createDestination can be called for
* destinations in WCCM that the message processor already
* holds state about. This is ok as long as the destination has
* not already been reconciled.
*/
// if (mqLinkHandler.isReconciled())
// {
// if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
// SibTr.exit(
// tc,
// "createMQLinkMPResources",
// "Link already exists");
//
// throw new SIMPDestinationAlreadyExistsException(
// nls.getFormattedMessage(
// "LINK_ALREADY_EXISTS_ERROR_CWSIP0043",
// new Object[] { virtualLinkDefinition.getName(),
// messageProcessor.getMessagingEngineName()},
// null));
// }
// Handle uuid changes
if (!(mqld.getUuid().equals(mqLinkHandler.getMqLinkUuid())))
{
// Need to set the toBeDeleted flag in the "old" handler
// and set up a new handler
deleteRecreateMQLinkHandler(
mqld,
mqLinkHandler,
virtualLinkDefinition,
linkLocalizationDefinition,
transaction);
}
else
{
/*
* Link already exists. In the new WCCM world, the
* create should complete succesfully, with the new link
* definition replacing the existing one.
*/
mqLinkHandler.updateLinkDefinition(virtualLinkDefinition, transaction);
// Flag that we need to tell the MQLink component to create its MQLink infrastructure.
engineResourcesRequired = true;
if (linkLocalizingMEs == null)
{
linkLocalizingMEs = new HashSet<String>();
linkLocalizingMEs.add(messageProcessor.getMessagingEngineUuid().toString());
}
// Alert the lookups object to handle the re-definition
linkIndex.setLocalizationFlags(mqLinkHandler, true, false);
//MQLinks have a real localisation associated with them, so it can
//be updated here
mqLinkHandler.updateLocalizationDefinition(linkLocalizationDefinition, transaction);
// Alert the lookups object to handle the re-definition
linkIndex.create(mqLinkHandler);
}
}
else // we did just create the linkHandler.
{
//First add the localization for the MQlink
mqLinkHandler.addNewMQLinkLocalisation(
transaction,
messageProcessor.getMessagingEngineUuid(),
linkLocalizationDefinition);
// Flag that we need to tell the MQLink component to create its MQLink infrastructure.
engineResourcesRequired = true;
} // eof we did just create the linkHandler
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createMQLinkMPResources", new Boolean(engineResourcesRequired));
return engineResourcesRequired;
} } | public class class_name {
private boolean createMQLinkMPResources(
MQLinkHandler mqLinkHandler,
MQLinkDefinition mqld,
LocalizationDefinition linkLocalizationDefinition,
VirtualLinkDefinition virtualLinkDefinition,
Set<String> linkLocalizingMEs,
LocalTransaction transaction,
boolean linkCreated) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"createMQLinkMPResources",
new Object[] { mqLinkHandler,
mqld,
linkLocalizationDefinition,
virtualLinkDefinition,
linkLocalizingMEs,
transaction,
new Boolean(linkCreated) });
boolean engineResourcesRequired = false;
//For MQLinks, we want the QueueHigh messages to be the same as for
//transmit queues.
linkLocalizationDefinition.setDestinationHighMsgs(messageProcessor.getHighMessageThreshold());
linkLocalizationDefinition.setDestinationLowMsgs((messageProcessor.getHighMessageThreshold() * 8) / 10);
//If we didnt just create the linkHandler and the one that already
//existed is for a different UUID, or there is already a localisation for
//the linkHandler on this ME, then this could be a problem and further
//tests are required.
if (!linkCreated)
{
/*
* 182456.6
* For the move to WCCM, createDestination can be called for
* destinations in WCCM that the message processor already
* holds state about. This is ok as long as the destination has
* not already been reconciled.
*/
// if (mqLinkHandler.isReconciled())
// {
// if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
// SibTr.exit(
// tc,
// "createMQLinkMPResources",
// "Link already exists");
//
// throw new SIMPDestinationAlreadyExistsException(
// nls.getFormattedMessage(
// "LINK_ALREADY_EXISTS_ERROR_CWSIP0043",
// new Object[] { virtualLinkDefinition.getName(),
// messageProcessor.getMessagingEngineName()},
// null));
// }
// Handle uuid changes
if (!(mqld.getUuid().equals(mqLinkHandler.getMqLinkUuid())))
{
// Need to set the toBeDeleted flag in the "old" handler
// and set up a new handler
deleteRecreateMQLinkHandler(
mqld,
mqLinkHandler,
virtualLinkDefinition,
linkLocalizationDefinition,
transaction); // depends on control dependency: [if], data = [none]
}
else
{
/*
* Link already exists. In the new WCCM world, the
* create should complete succesfully, with the new link
* definition replacing the existing one.
*/
mqLinkHandler.updateLinkDefinition(virtualLinkDefinition, transaction); // depends on control dependency: [if], data = [none]
// Flag that we need to tell the MQLink component to create its MQLink infrastructure.
engineResourcesRequired = true; // depends on control dependency: [if], data = [none]
if (linkLocalizingMEs == null)
{
linkLocalizingMEs = new HashSet<String>(); // depends on control dependency: [if], data = [none]
linkLocalizingMEs.add(messageProcessor.getMessagingEngineUuid().toString()); // depends on control dependency: [if], data = [none]
}
// Alert the lookups object to handle the re-definition
linkIndex.setLocalizationFlags(mqLinkHandler, true, false); // depends on control dependency: [if], data = [none]
//MQLinks have a real localisation associated with them, so it can
//be updated here
mqLinkHandler.updateLocalizationDefinition(linkLocalizationDefinition, transaction); // depends on control dependency: [if], data = [none]
// Alert the lookups object to handle the re-definition
linkIndex.create(mqLinkHandler); // depends on control dependency: [if], data = [none]
}
}
else // we did just create the linkHandler.
{
//First add the localization for the MQlink
mqLinkHandler.addNewMQLinkLocalisation(
transaction,
messageProcessor.getMessagingEngineUuid(),
linkLocalizationDefinition); // depends on control dependency: [if], data = [none]
// Flag that we need to tell the MQLink component to create its MQLink infrastructure.
engineResourcesRequired = true; // depends on control dependency: [if], data = [none]
} // eof we did just create the linkHandler
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createMQLinkMPResources", new Boolean(engineResourcesRequired));
return engineResourcesRequired;
} } |
public class class_name {
public static List<IntDependency> treeToDependencyList(Tree tree, Index<String> wordIndex, Index<String> tagIndex) {
List<IntDependency> depList = new ArrayList<IntDependency>();
treeToDependencyHelper(tree, depList, 0, wordIndex, tagIndex);
if (DEBUG) {
System.out.println("----------------------------");
tree.pennPrint();
System.out.println(depList);
}
return depList;
} } | public class class_name {
public static List<IntDependency> treeToDependencyList(Tree tree, Index<String> wordIndex, Index<String> tagIndex) {
List<IntDependency> depList = new ArrayList<IntDependency>();
treeToDependencyHelper(tree, depList, 0, wordIndex, tagIndex);
if (DEBUG) {
System.out.println("----------------------------");
tree.pennPrint();
System.out.println(depList);
// depends on control dependency: [if], data = [none]
}
return depList;
} } |
public class class_name {
@Override
public void analyze(Response response) {
if(response == null) {
return;
}
if (ResponseHandler.LOG.equals(response.getAction())) {
logger.info("Handling <log> response for user <{}>", response.getUser().getUsername());
} else {
logger.info("Delegating response for user <{}> to configured response handler <{}>",
response.getUser().getUsername(), responseHandler.getClass().getName());
responseHandler.handle(response);
}
} } | public class class_name {
@Override
public void analyze(Response response) {
if(response == null) {
return; // depends on control dependency: [if], data = [none]
}
if (ResponseHandler.LOG.equals(response.getAction())) {
logger.info("Handling <log> response for user <{}>", response.getUser().getUsername()); // depends on control dependency: [if], data = [none]
} else {
logger.info("Delegating response for user <{}> to configured response handler <{}>",
response.getUser().getUsername(), responseHandler.getClass().getName()); // depends on control dependency: [if], data = [none]
responseHandler.handle(response); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getRealm() {
if (UNDEFINED.equals(realm)) {
Principal principal = securityIdentity.getPrincipal();
String realm = null;
if (principal instanceof RealmPrincipal) {
realm = ((RealmPrincipal)principal).getRealm();
}
this.realm = realm;
}
return this.realm;
} } | public class class_name {
public String getRealm() {
if (UNDEFINED.equals(realm)) {
Principal principal = securityIdentity.getPrincipal();
String realm = null;
if (principal instanceof RealmPrincipal) {
realm = ((RealmPrincipal)principal).getRealm(); // depends on control dependency: [if], data = [none]
}
this.realm = realm; // depends on control dependency: [if], data = [none]
}
return this.realm;
} } |
public class class_name {
@Override
public void execute(final Runnable task) {
checkNotNull(task);
final Runnable submittedTask;
final long oldRunCount;
synchronized (queue) {
// If the worker is already running (or execute() on the delegate returned successfully, and
// the worker has yet to start) then we don't need to start the worker.
if (workerRunningState == RUNNING || workerRunningState == QUEUED) {
queue.add(task);
return;
}
oldRunCount = workerRunCount;
// If the worker is not yet running, the delegate Executor might reject our attempt to start
// it. To preserve FIFO order and failure atomicity of rejected execution when the same
// Runnable is executed more than once, allocate a wrapper that we know is safe to remove by
// object identity.
// A data structure that returned a removal handle from add() would allow eliminating this
// allocation.
submittedTask =
new Runnable() {
@Override
public void run() {
task.run();
}
};
queue.add(submittedTask);
workerRunningState = QUEUING;
}
try {
executor.execute(worker);
} catch (RuntimeException | Error t) {
synchronized (queue) {
boolean removed =
(workerRunningState == IDLE || workerRunningState == QUEUING)
&& queue.removeLastOccurrence(submittedTask);
// If the delegate is directExecutor(), the submitted runnable could have thrown a REE. But
// that's handled by the log check that catches RuntimeExceptions in the queue worker.
if (!(t instanceof RejectedExecutionException) || removed) {
throw t;
}
}
return;
}
/*
* This is an unsynchronized read! After the read, the function returns immediately or acquires
* the lock to check again. Since an IDLE state was observed inside the preceding synchronized
* block, and reference field assignment is atomic, this may save reacquiring the lock when
* another thread or the worker task has cleared the count and set the state.
*
* <p>When {@link #executor} is a directExecutor(), the value written to
* {@code workerRunningState} will be available synchronously, and behaviour will be
* deterministic.
*/
@SuppressWarnings("GuardedBy")
boolean alreadyMarkedQueued = workerRunningState != QUEUING;
if (alreadyMarkedQueued) {
return;
}
synchronized (queue) {
if (workerRunCount == oldRunCount && workerRunningState == QUEUING) {
workerRunningState = QUEUED;
}
}
} } | public class class_name {
@Override
public void execute(final Runnable task) {
checkNotNull(task);
final Runnable submittedTask;
final long oldRunCount;
synchronized (queue) {
// If the worker is already running (or execute() on the delegate returned successfully, and
// the worker has yet to start) then we don't need to start the worker.
if (workerRunningState == RUNNING || workerRunningState == QUEUED) {
queue.add(task); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
oldRunCount = workerRunCount;
// If the worker is not yet running, the delegate Executor might reject our attempt to start
// it. To preserve FIFO order and failure atomicity of rejected execution when the same
// Runnable is executed more than once, allocate a wrapper that we know is safe to remove by
// object identity.
// A data structure that returned a removal handle from add() would allow eliminating this
// allocation.
submittedTask =
new Runnable() {
@Override
public void run() {
task.run();
}
};
queue.add(submittedTask);
workerRunningState = QUEUING;
}
try {
executor.execute(worker); // depends on control dependency: [try], data = [none]
} catch (RuntimeException | Error t) {
synchronized (queue) {
boolean removed =
(workerRunningState == IDLE || workerRunningState == QUEUING)
&& queue.removeLastOccurrence(submittedTask);
// If the delegate is directExecutor(), the submitted runnable could have thrown a REE. But
// that's handled by the log check that catches RuntimeExceptions in the queue worker.
if (!(t instanceof RejectedExecutionException) || removed) {
throw t;
}
}
return;
} // depends on control dependency: [catch], data = [none]
/*
* This is an unsynchronized read! After the read, the function returns immediately or acquires
* the lock to check again. Since an IDLE state was observed inside the preceding synchronized
* block, and reference field assignment is atomic, this may save reacquiring the lock when
* another thread or the worker task has cleared the count and set the state.
*
* <p>When {@link #executor} is a directExecutor(), the value written to
* {@code workerRunningState} will be available synchronously, and behaviour will be
* deterministic.
*/
@SuppressWarnings("GuardedBy")
boolean alreadyMarkedQueued = workerRunningState != QUEUING;
if (alreadyMarkedQueued) {
return; // depends on control dependency: [if], data = [none]
}
synchronized (queue) {
if (workerRunCount == oldRunCount && workerRunningState == QUEUING) {
workerRunningState = QUEUED; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private boolean isReadable(String namespace, String name) {
Table table = getMetaStoreUtil().getTable(namespace, name);
if (isManaged(table) || isExternal(table)) { // readable table types
try {
// get a descriptor for the table. if this succeeds, it is readable
HiveUtils.descriptorForTable(conf, table);
return true;
} catch (DatasetException e) {
// not a readable table
} catch (IllegalStateException e) {
// not a readable table
} catch (IllegalArgumentException e) {
// not a readable table
} catch (UnsupportedOperationException e) {
// not a readable table
}
}
return false;
} } | public class class_name {
private boolean isReadable(String namespace, String name) {
Table table = getMetaStoreUtil().getTable(namespace, name);
if (isManaged(table) || isExternal(table)) { // readable table types
try {
// get a descriptor for the table. if this succeeds, it is readable
HiveUtils.descriptorForTable(conf, table); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (DatasetException e) {
// not a readable table
} catch (IllegalStateException e) { // depends on control dependency: [catch], data = [none]
// not a readable table
} catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none]
// not a readable table
} catch (UnsupportedOperationException e) { // depends on control dependency: [catch], data = [none]
// not a readable table
} // depends on control dependency: [catch], data = [none]
}
return false;
} } |
public class class_name {
public static void deleteAll(final EntityManager entityManager, Iterable<Class> entityClasses) {
for (Class entityType : entityClasses) {
EntityClass entityClass = EntityClass.from(entityType);
// delete many to many and element collection tables
Iterable<String> associationTables = getAssociationTables(entityClass);
for (String table : associationTables) {
deleteTable(entityManager, table);
}
deleteEntity(entityManager, ClassUtil.getEntityName(entityType));
}
} } | public class class_name {
public static void deleteAll(final EntityManager entityManager, Iterable<Class> entityClasses) {
for (Class entityType : entityClasses) {
EntityClass entityClass = EntityClass.from(entityType);
// delete many to many and element collection tables
Iterable<String> associationTables = getAssociationTables(entityClass);
for (String table : associationTables) {
deleteTable(entityManager, table); // depends on control dependency: [for], data = [table]
}
deleteEntity(entityManager, ClassUtil.getEntityName(entityType)); // depends on control dependency: [for], data = [entityType]
}
} } |
public class class_name {
public void setError(
int errorIndex,
String errorMessage
) {
if (errorIndex >= 0) {
this.errorMessage = (
((errorMessage == null) || errorMessage.isEmpty())
? ("Error occurred at position: " + errorIndex)
: errorMessage);
} else {
throw new IllegalArgumentException("Undefined error index: " + errorIndex);
}
this.pp.setErrorIndex(errorIndex);
} } | public class class_name {
public void setError(
int errorIndex,
String errorMessage
) {
if (errorIndex >= 0) {
this.errorMessage = (
((errorMessage == null) || errorMessage.isEmpty())
? ("Error occurred at position: " + errorIndex)
: errorMessage); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Undefined error index: " + errorIndex);
}
this.pp.setErrorIndex(errorIndex);
} } |
public class class_name {
protected void processCell() {
final ObjectMap<String, String> attributes = getNamedAttributes();
if (GdxMaps.isEmpty(attributes)) {
processCellWithNoAttributes(getTable());
return;
}
final LmlActorBuilder builder = new LmlActorBuilder(); // Used to determine table.
final ObjectSet<String> processedAttributes = GdxSets.newSet();
processBuildingAttributeToDetermineTable(attributes, processedAttributes, builder);
final Table targetTable = getTarget(builder).extract(getTable());
final Cell<?> cell = extractCell(targetTable);
processCellAttributes(attributes, processedAttributes, targetTable, cell);
} } | public class class_name {
protected void processCell() {
final ObjectMap<String, String> attributes = getNamedAttributes();
if (GdxMaps.isEmpty(attributes)) {
processCellWithNoAttributes(getTable()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final LmlActorBuilder builder = new LmlActorBuilder(); // Used to determine table.
final ObjectSet<String> processedAttributes = GdxSets.newSet();
processBuildingAttributeToDetermineTable(attributes, processedAttributes, builder);
final Table targetTable = getTarget(builder).extract(getTable());
final Cell<?> cell = extractCell(targetTable);
processCellAttributes(attributes, processedAttributes, targetTable, cell);
} } |
public class class_name {
protected static String generateRequestLine(HttpConnection connection,
String name, String requestPath, String query, String version) {
LOG.trace("enter HttpMethodBase.generateRequestLine(HttpConnection, "
+ "String, String, String, String)");
StringBuffer buf = new StringBuffer();
// Append method name
buf.append(name);
buf.append(" ");
// Absolute or relative URL?
if (!connection.isTransparent()) {
Protocol protocol = connection.getProtocol();
buf.append(protocol.getScheme().toLowerCase(Locale.ENGLISH));
buf.append("://");
buf.append(connection.getHost());
if ((connection.getPort() != -1)
&& (connection.getPort() != protocol.getDefaultPort())
) {
buf.append(":");
buf.append(connection.getPort());
}
}
// Append path, if any
if (requestPath == null) {
buf.append("/");
} else {
if (!connection.isTransparent() && !requestPath.startsWith("/")) {
buf.append("/");
}
buf.append(requestPath);
}
// Append query, if any
if (query != null) {
// ZAP: If commented out to not change the intended request URI (i.e. if the query component starts with a "?" char)
//if (query.indexOf("?") != 0) {
buf.append("?");
//}
buf.append(query);
}
// Append protocol
buf.append(" ");
buf.append(version);
buf.append("\r\n");
return buf.toString();
} } | public class class_name {
protected static String generateRequestLine(HttpConnection connection,
String name, String requestPath, String query, String version) {
LOG.trace("enter HttpMethodBase.generateRequestLine(HttpConnection, "
+ "String, String, String, String)");
StringBuffer buf = new StringBuffer();
// Append method name
buf.append(name);
buf.append(" ");
// Absolute or relative URL?
if (!connection.isTransparent()) {
Protocol protocol = connection.getProtocol();
buf.append(protocol.getScheme().toLowerCase(Locale.ENGLISH)); // depends on control dependency: [if], data = [none]
buf.append("://");
buf.append(connection.getHost()); // depends on control dependency: [if], data = [none]
if ((connection.getPort() != -1)
&& (connection.getPort() != protocol.getDefaultPort())
) {
buf.append(":"); // depends on control dependency: [if], data = []
buf.append(connection.getPort()); // depends on control dependency: [if], data = []
}
}
// Append path, if any
if (requestPath == null) {
buf.append("/"); // depends on control dependency: [if], data = [none]
} else {
if (!connection.isTransparent() && !requestPath.startsWith("/")) {
buf.append("/"); // depends on control dependency: [if], data = [none]
}
buf.append(requestPath); // depends on control dependency: [if], data = [(requestPath]
}
// Append query, if any
if (query != null) {
// ZAP: If commented out to not change the intended request URI (i.e. if the query component starts with a "?" char)
//if (query.indexOf("?") != 0) {
buf.append("?"); // depends on control dependency: [if], data = [none]
//}
buf.append(query); // depends on control dependency: [if], data = [(query]
}
// Append protocol
buf.append(" ");
buf.append(version);
buf.append("\r\n");
return buf.toString();
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T extends Class> Map<Key<T>, ? extends T> associateInterfacesToImplementations(
InitContext initContext, Collection<T> interfaces, Map<T, Specification<? extends T>> specsByInterface,
boolean overridingMode) {
Map<Key<T>, ? extends T> keyMap = new HashMap<>();
for (T anInterface : interfaces) {
keyMap.putAll(associateInterfaceToImplementations(anInterface, initContext.scannedTypesBySpecification()
.get(specsByInterface.get(anInterface)), overridingMode));
}
return keyMap;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T extends Class> Map<Key<T>, ? extends T> associateInterfacesToImplementations(
InitContext initContext, Collection<T> interfaces, Map<T, Specification<? extends T>> specsByInterface,
boolean overridingMode) {
Map<Key<T>, ? extends T> keyMap = new HashMap<>();
for (T anInterface : interfaces) {
keyMap.putAll(associateInterfaceToImplementations(anInterface, initContext.scannedTypesBySpecification()
.get(specsByInterface.get(anInterface)), overridingMode)); // depends on control dependency: [for], data = [anInterface]
}
return keyMap;
} } |
public class class_name {
public void waitForUninterruptibly(Guard guard) {
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
throw new IllegalMonitorStateException();
}
if (!guard.isSatisfied()) {
awaitUninterruptibly(guard, true);
}
} } | public class class_name {
public void waitForUninterruptibly(Guard guard) {
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
throw new IllegalMonitorStateException();
}
if (!guard.isSatisfied()) {
awaitUninterruptibly(guard, true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean verify(KeyStoreChooser keyStoreChooser, PublicKeyChooserByAlias publicKeyChooserByAlias, String message,
String signature) {
Base64EncodedVerifier verifier = cache.get(cacheKey(keyStoreChooser, publicKeyChooserByAlias));
if (verifier != null) {
return verifier.verify(message, signature);
}
Base64EncodedVerifierImpl verifierImpl = new Base64EncodedVerifierImpl();
verifierImpl.setAlgorithm(algorithm);
verifierImpl.setCharsetName(charsetName);
verifierImpl.setProvider(provider);
PublicKey publicKey = publicKeyRegistryByAlias.get(keyStoreChooser, publicKeyChooserByAlias);
if (publicKey == null) {
throw new SignatureException("public key not found: keyStoreName=" + keyStoreChooser.getKeyStoreName()
+ ", alias=" + publicKeyChooserByAlias.getAlias());
}
verifierImpl.setPublicKey(publicKey);
cache.put(cacheKey(keyStoreChooser, publicKeyChooserByAlias), verifierImpl);
return verifierImpl.verify(message, signature);
} } | public class class_name {
public boolean verify(KeyStoreChooser keyStoreChooser, PublicKeyChooserByAlias publicKeyChooserByAlias, String message,
String signature) {
Base64EncodedVerifier verifier = cache.get(cacheKey(keyStoreChooser, publicKeyChooserByAlias));
if (verifier != null) {
return verifier.verify(message, signature); // depends on control dependency: [if], data = [none]
}
Base64EncodedVerifierImpl verifierImpl = new Base64EncodedVerifierImpl();
verifierImpl.setAlgorithm(algorithm);
verifierImpl.setCharsetName(charsetName);
verifierImpl.setProvider(provider);
PublicKey publicKey = publicKeyRegistryByAlias.get(keyStoreChooser, publicKeyChooserByAlias);
if (publicKey == null) {
throw new SignatureException("public key not found: keyStoreName=" + keyStoreChooser.getKeyStoreName()
+ ", alias=" + publicKeyChooserByAlias.getAlias());
}
verifierImpl.setPublicKey(publicKey);
cache.put(cacheKey(keyStoreChooser, publicKeyChooserByAlias), verifierImpl);
return verifierImpl.verify(message, signature);
} } |
public class class_name {
public static Optional<Class> forName(String name, @Nullable ClassLoader classLoader) {
try {
if (classLoader == null) {
classLoader = Thread.currentThread().getContextClassLoader();
}
if (classLoader == null) {
classLoader = ClassLoader.getSystemClassLoader();
}
Optional<Class> commonType = Optional.ofNullable(COMMON_CLASS_MAP.get(name));
if (commonType.isPresent()) {
return commonType;
} else {
if (REFLECTION_LOGGER.isDebugEnabled()) {
REFLECTION_LOGGER.debug("Attempting to dynamically load class {}", name);
}
Class<?> type = Class.forName(name, true, classLoader);
ClassLoadingReporter.reportPresent(type);
if (REFLECTION_LOGGER.isDebugEnabled()) {
REFLECTION_LOGGER.debug("Successfully loaded class {}", name);
}
return Optional.of(type);
}
} catch (ClassNotFoundException | NoClassDefFoundError e) {
ClassLoadingReporter.reportMissing(name);
if (REFLECTION_LOGGER.isDebugEnabled()) {
REFLECTION_LOGGER.debug("Class {} is not present", name);
}
return Optional.empty();
}
} } | public class class_name {
public static Optional<Class> forName(String name, @Nullable ClassLoader classLoader) {
try {
if (classLoader == null) {
classLoader = Thread.currentThread().getContextClassLoader(); // depends on control dependency: [if], data = [none]
}
if (classLoader == null) {
classLoader = ClassLoader.getSystemClassLoader(); // depends on control dependency: [if], data = [none]
}
Optional<Class> commonType = Optional.ofNullable(COMMON_CLASS_MAP.get(name));
if (commonType.isPresent()) {
return commonType; // depends on control dependency: [if], data = [none]
} else {
if (REFLECTION_LOGGER.isDebugEnabled()) {
REFLECTION_LOGGER.debug("Attempting to dynamically load class {}", name); // depends on control dependency: [if], data = [none]
}
Class<?> type = Class.forName(name, true, classLoader);
ClassLoadingReporter.reportPresent(type);
if (REFLECTION_LOGGER.isDebugEnabled()) {
REFLECTION_LOGGER.debug("Successfully loaded class {}", name); // depends on control dependency: [if], data = [none]
}
return Optional.of(type); // depends on control dependency: [if], data = [none]
}
} catch (ClassNotFoundException | NoClassDefFoundError e) {
ClassLoadingReporter.reportMissing(name);
if (REFLECTION_LOGGER.isDebugEnabled()) {
REFLECTION_LOGGER.debug("Class {} is not present", name); // depends on control dependency: [if], data = [none]
}
return Optional.empty();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void addPropertyInjectionPoint(final PropertyInjectionPoint pip) {
if (properties == null) {
properties = new PropertyInjectionPoint[1];
properties[0] = pip;
} else {
properties = ArraysUtil.append(properties, pip);
}
} } | public class class_name {
protected void addPropertyInjectionPoint(final PropertyInjectionPoint pip) {
if (properties == null) {
properties = new PropertyInjectionPoint[1]; // depends on control dependency: [if], data = [none]
properties[0] = pip; // depends on control dependency: [if], data = [none]
} else {
properties = ArraysUtil.append(properties, pip); // depends on control dependency: [if], data = [(properties]
}
} } |
public class class_name {
public void marshall(ListAgentsRequest listAgentsRequest, ProtocolMarshaller protocolMarshaller) {
if (listAgentsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listAgentsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listAgentsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListAgentsRequest listAgentsRequest, ProtocolMarshaller protocolMarshaller) {
if (listAgentsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listAgentsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAgentsRequest.getNextToken(), NEXTTOKEN_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 doPost(AtmosphereResource ar) {
Object msg = ar.getRequest().getAttribute(Constants.MESSAGE_OBJECT);
if (msg != null) {
logger.info("received RPC post: " + msg.toString());
// for demonstration purposes we will broadcast the message to all connections
ar.getAtmosphereConfig().getBroadcasterFactory().lookup("MyBroadcaster").broadcast(msg);
}
} } | public class class_name {
public void doPost(AtmosphereResource ar) {
Object msg = ar.getRequest().getAttribute(Constants.MESSAGE_OBJECT);
if (msg != null) {
logger.info("received RPC post: " + msg.toString()); // depends on control dependency: [if], data = [none]
// for demonstration purposes we will broadcast the message to all connections
ar.getAtmosphereConfig().getBroadcasterFactory().lookup("MyBroadcaster").broadcast(msg); // depends on control dependency: [if], data = [(msg]
}
} } |
public class class_name {
public void run()
{
if ((m_url == null) && (m_strHtmlText == null))
{ // restore the original cursor
if (m_bChangeCursor)
{
if (m_applet != null)
m_applet.setStatus(0, m_editorPane, m_oldCursor);
else
{
Component component = m_editorPane;
while (component.getParent() != null)
{
component = component.getParent();
}
component.setCursor((Cursor)m_oldCursor);
}
Container parent = m_editorPane.getParent();
parent.repaint();
}
}
else
{
if (m_bChangeCursor)
{
if (m_applet != null)
m_oldCursor = m_applet.setStatus(Cursor.WAIT_CURSOR, m_editorPane, null);
else
{
Component component = m_editorPane;
boolean bIsVisible = true;
while (component.getParent() != null)
{
component = component.getParent();
if (!component.isVisible())
bIsVisible = false;
}
m_oldCursor = component.getCursor();
Cursor cursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
if (bIsVisible)
component.setCursor(cursor);
}
}
synchronized (m_editorPane)
{
Document doc = m_editorPane.getDocument();
try {
if (m_url != null) {
m_editorPane.setPage(m_url);
} else {
this.setText(doc, m_strHtmlText);
}
} catch (IOException ioe) {
String error = ioe.getLocalizedMessage();
if ((error != null)
&& (error.length() > 0))
{
String errorText = m_strHtmlErrorText;
if (errorText == null)
errorText = DEFAULT_ERROR_TEXT;
errorText = MessageFormat.format(errorText, m_url.toString(), error);
this.setText(doc, errorText);
}
else
m_editorPane.setDocument(doc);
// getToolkit().beep();
} finally {
// schedule the cursor to revert after
// the paint has happened.
m_url = null;
m_strHtmlText = null;
if (m_bChangeCursor)
SwingUtilities.invokeLater(this);
}
}
}
} } | public class class_name {
public void run()
{
if ((m_url == null) && (m_strHtmlText == null))
{ // restore the original cursor
if (m_bChangeCursor)
{
if (m_applet != null)
m_applet.setStatus(0, m_editorPane, m_oldCursor);
else
{
Component component = m_editorPane;
while (component.getParent() != null)
{
component = component.getParent(); // depends on control dependency: [while], data = [none]
}
component.setCursor((Cursor)m_oldCursor); // depends on control dependency: [if], data = [none]
}
Container parent = m_editorPane.getParent();
parent.repaint(); // depends on control dependency: [if], data = [none]
}
}
else
{
if (m_bChangeCursor)
{
if (m_applet != null)
m_oldCursor = m_applet.setStatus(Cursor.WAIT_CURSOR, m_editorPane, null);
else
{
Component component = m_editorPane;
boolean bIsVisible = true;
while (component.getParent() != null)
{
component = component.getParent(); // depends on control dependency: [while], data = [none]
if (!component.isVisible())
bIsVisible = false;
}
m_oldCursor = component.getCursor(); // depends on control dependency: [if], data = [none]
Cursor cursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
if (bIsVisible)
component.setCursor(cursor);
}
}
synchronized (m_editorPane) // depends on control dependency: [if], data = [none]
{
Document doc = m_editorPane.getDocument();
try {
if (m_url != null) {
m_editorPane.setPage(m_url); // depends on control dependency: [if], data = [(m_url]
} else {
this.setText(doc, m_strHtmlText); // depends on control dependency: [if], data = [none]
}
} catch (IOException ioe) {
String error = ioe.getLocalizedMessage();
if ((error != null)
&& (error.length() > 0))
{
String errorText = m_strHtmlErrorText;
if (errorText == null)
errorText = DEFAULT_ERROR_TEXT;
errorText = MessageFormat.format(errorText, m_url.toString(), error); // depends on control dependency: [if], data = [none]
this.setText(doc, errorText); // depends on control dependency: [if], data = [none]
}
else
m_editorPane.setDocument(doc);
// getToolkit().beep();
} finally { // depends on control dependency: [catch], data = [none]
// schedule the cursor to revert after
// the paint has happened.
m_url = null;
m_strHtmlText = null;
if (m_bChangeCursor)
SwingUtilities.invokeLater(this);
}
}
}
} } |
public class class_name {
@Override
public FieldTextBuilder WHEN(final FieldText fieldText) {
Validate.notNull(fieldText, "FieldText should not be null");
Validate.isTrue(fieldText.size() >= 1, "FieldText must have a size greater or equal to 1");
if(size() < 1) {
throw new IllegalStateException("Size must be greater than or equal to 1");
}
// Here we assume that A WHEN A => A but is there an edge case where this doesn't work?
if(fieldText == this || toString().equals(fieldText.toString())) {
return this;
}
if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) {
return setFieldText(MATCHNOTHING);
}
return binaryOperation("WHEN", fieldText);
} } | public class class_name {
@Override
public FieldTextBuilder WHEN(final FieldText fieldText) {
Validate.notNull(fieldText, "FieldText should not be null");
Validate.isTrue(fieldText.size() >= 1, "FieldText must have a size greater or equal to 1");
if(size() < 1) {
throw new IllegalStateException("Size must be greater than or equal to 1");
}
// Here we assume that A WHEN A => A but is there an edge case where this doesn't work?
if(fieldText == this || toString().equals(fieldText.toString())) {
return this; // depends on control dependency: [if], data = [none]
}
if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) {
return setFieldText(MATCHNOTHING); // depends on control dependency: [if], data = [none]
}
return binaryOperation("WHEN", fieldText);
} } |
public class class_name {
protected static void registerAlpnSupport(SSLConnectionLink connLink, SSLEngine engine) {
ThirdPartyAlpnNegotiator negotiator = null;
boolean useAlpn = isH2Active(connLink);
// try to register with one of the alpn providers. If useAlpn is false, tell the active ALPN handler to skip negotiation
if (tc.isDebugEnabled()) {
Tr.debug(tc, "registerAlpnSupportDuringHandshake, h2 protocol enabled: " + useAlpn);
}
negotiator = alpnNegotiator.tryToRegisterAlpnNegotiator(engine, connLink, useAlpn);
connLink.setAlpnNegotiator(negotiator);
} } | public class class_name {
protected static void registerAlpnSupport(SSLConnectionLink connLink, SSLEngine engine) {
ThirdPartyAlpnNegotiator negotiator = null;
boolean useAlpn = isH2Active(connLink);
// try to register with one of the alpn providers. If useAlpn is false, tell the active ALPN handler to skip negotiation
if (tc.isDebugEnabled()) {
Tr.debug(tc, "registerAlpnSupportDuringHandshake, h2 protocol enabled: " + useAlpn); // depends on control dependency: [if], data = [none]
}
negotiator = alpnNegotiator.tryToRegisterAlpnNegotiator(engine, connLink, useAlpn);
connLink.setAlpnNegotiator(negotiator);
} } |
public class class_name {
private void saveFavIcon(String siteRoot) {
if (m_os == null) {
return;
}
if (m_os.size() == 0) {
return;
}
getReport().println(Messages.get().container(Messages.RPT_SITE_SET_FAVICON_0), I_CmsReport.FORMAT_DEFAULT);
CmsResource favicon = null;
try {
favicon = m_cms.createResource(
siteRoot + CmsSiteManager.FAVICON,
OpenCms.getResourceManager().getResourceType(CmsResourceTypeImage.getStaticTypeName()));
} catch (CmsVfsResourceAlreadyExistsException e) {
//OK, Resource already there
try {
favicon = m_cms.readResource(siteRoot + CmsSiteManager.FAVICON);
} catch (CmsException e2) {
//no, it wasn't..
getReport().println(
Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0),
I_CmsReport.FORMAT_ERROR);
getReport().println(e);
getReport().println(e2);
return;
}
} catch (CmsIllegalArgumentException | CmsException e) {
getReport().println(Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0), I_CmsReport.FORMAT_ERROR);
getReport().println(e);
return;
}
try {
m_cms.lockResource(siteRoot + CmsSiteManager.FAVICON);
CmsFile faviconFile = new CmsFile(favicon);
faviconFile.setContents(m_os.toByteArray());
m_cms.writeFile(faviconFile);
m_cms.unlockResource(siteRoot + CmsSiteManager.FAVICON);
} catch (CmsException e) {
getReport().println(Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0), I_CmsReport.FORMAT_ERROR);
getReport().println(e);
return;
}
} } | public class class_name {
private void saveFavIcon(String siteRoot) {
if (m_os == null) {
return; // depends on control dependency: [if], data = [none]
}
if (m_os.size() == 0) {
return; // depends on control dependency: [if], data = [none]
}
getReport().println(Messages.get().container(Messages.RPT_SITE_SET_FAVICON_0), I_CmsReport.FORMAT_DEFAULT);
CmsResource favicon = null;
try {
favicon = m_cms.createResource(
siteRoot + CmsSiteManager.FAVICON,
OpenCms.getResourceManager().getResourceType(CmsResourceTypeImage.getStaticTypeName())); // depends on control dependency: [try], data = [none]
} catch (CmsVfsResourceAlreadyExistsException e) {
//OK, Resource already there
try {
favicon = m_cms.readResource(siteRoot + CmsSiteManager.FAVICON); // depends on control dependency: [try], data = [none]
} catch (CmsException e2) {
//no, it wasn't..
getReport().println(
Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0),
I_CmsReport.FORMAT_ERROR);
getReport().println(e);
getReport().println(e2);
return;
} // depends on control dependency: [catch], data = [none]
} catch (CmsIllegalArgumentException | CmsException e) { // depends on control dependency: [catch], data = [none]
getReport().println(Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0), I_CmsReport.FORMAT_ERROR);
getReport().println(e);
return;
} // depends on control dependency: [catch], data = [none]
try {
m_cms.lockResource(siteRoot + CmsSiteManager.FAVICON); // depends on control dependency: [try], data = [none]
CmsFile faviconFile = new CmsFile(favicon);
faviconFile.setContents(m_os.toByteArray()); // depends on control dependency: [try], data = [none]
m_cms.writeFile(faviconFile); // depends on control dependency: [try], data = [none]
m_cms.unlockResource(siteRoot + CmsSiteManager.FAVICON); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
getReport().println(Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0), I_CmsReport.FORMAT_ERROR);
getReport().println(e);
return;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Annotation[] getAnnotations(AnnotatedElement annotatedElement) {
try {
return annotatedElement.getAnnotations();
}
catch (Exception ex) {
// Assuming nested Class values not resolvable within annotation attributes...
logIntrospectionFailure(annotatedElement, ex);
return null;
}
} } | public class class_name {
public static Annotation[] getAnnotations(AnnotatedElement annotatedElement) {
try {
return annotatedElement.getAnnotations(); // depends on control dependency: [try], data = [none]
}
catch (Exception ex) {
// Assuming nested Class values not resolvable within annotation attributes...
logIntrospectionFailure(annotatedElement, ex);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected static void printErrorMessage(Exception e) {
if(e instanceof AbortException) {
// ensure we actually show the message:
LoggingConfiguration.setVerbose(Level.VERBOSE);
LOG.verbose(e.getMessage());
}
else if(e instanceof UnspecifiedParameterException) {
LOG.error(e.getMessage());
}
else if(e instanceof ParameterException) {
LOG.error(e.getMessage());
}
else {
LOG.exception(e);
}
} } | public class class_name {
protected static void printErrorMessage(Exception e) {
if(e instanceof AbortException) {
// ensure we actually show the message:
LoggingConfiguration.setVerbose(Level.VERBOSE); // depends on control dependency: [if], data = [none]
LOG.verbose(e.getMessage()); // depends on control dependency: [if], data = [none]
}
else if(e instanceof UnspecifiedParameterException) {
LOG.error(e.getMessage()); // depends on control dependency: [if], data = [none]
}
else if(e instanceof ParameterException) {
LOG.error(e.getMessage()); // depends on control dependency: [if], data = [none]
}
else {
LOG.exception(e); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void fixdownMin(int k) {
int c = 2 * k;
while (c <= size) {
int m = minChildOrGrandchild(k);
if (m > c + 1) { // grandchild
if (((Comparable<? super K>) array[m]).compareTo(array[k]) >= 0) {
break;
}
K tmp = array[k];
array[k] = array[m];
array[m] = tmp;
if (((Comparable<? super K>) array[m]).compareTo(array[m / 2]) > 0) {
tmp = array[m];
array[m] = array[m / 2];
array[m / 2] = tmp;
}
// go down
k = m;
c = 2 * k;
} else { // child
if (((Comparable<? super K>) array[m]).compareTo(array[k]) < 0) {
K tmp = array[k];
array[k] = array[m];
array[m] = tmp;
}
break;
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private void fixdownMin(int k) {
int c = 2 * k;
while (c <= size) {
int m = minChildOrGrandchild(k);
if (m > c + 1) { // grandchild
if (((Comparable<? super K>) array[m]).compareTo(array[k]) >= 0) {
break;
}
K tmp = array[k];
array[k] = array[m]; // depends on control dependency: [if], data = [none]
array[m] = tmp; // depends on control dependency: [if], data = [none]
if (((Comparable<? super K>) array[m]).compareTo(array[m / 2]) > 0) {
tmp = array[m]; // depends on control dependency: [if], data = [none]
array[m] = array[m / 2]; // depends on control dependency: [if], data = [none]
array[m / 2] = tmp; // depends on control dependency: [if], data = [none]
}
// go down
k = m; // depends on control dependency: [if], data = [none]
c = 2 * k; // depends on control dependency: [if], data = [none]
} else { // child
if (((Comparable<? super K>) array[m]).compareTo(array[k]) < 0) {
K tmp = array[k];
array[k] = array[m]; // depends on control dependency: [if], data = [none]
array[m] = tmp; // depends on control dependency: [if], data = [none]
}
break;
}
}
} } |
public class class_name {
public static String padTo(int columns, String text, String ellipsis) {
if (text.length() < columns) {
return text;
}
text = ellipsis + text.substring(text.length() - (columns - ellipsis.length()));
return text;
} } | public class class_name {
public static String padTo(int columns, String text, String ellipsis) {
if (text.length() < columns) {
return text; // depends on control dependency: [if], data = [none]
}
text = ellipsis + text.substring(text.length() - (columns - ellipsis.length()));
return text;
} } |
public class class_name {
public void classAvailable(Class<?> clazz) {
if (!isMonitorable(clazz)) {
return;
}
listenersLock.readLock().lock();
try {
for (ProbeListener listener : allRegisteredListeners) {
ProbeFilter filter = listener.getProbeFilter();
if (filter.matches(clazz)) {
addInterestedByClass(clazz, Collections.singleton(listener));
}
}
} finally {
listenersLock.readLock().unlock();
}
// Update the new class with the configured probes
if (!getInterestedByClass(clazz).isEmpty()) {
this.transformer.instrumentWithProbes(Collections.<Class<?>> singleton(clazz));
}
} } | public class class_name {
public void classAvailable(Class<?> clazz) {
if (!isMonitorable(clazz)) {
return; // depends on control dependency: [if], data = [none]
}
listenersLock.readLock().lock();
try {
for (ProbeListener listener : allRegisteredListeners) {
ProbeFilter filter = listener.getProbeFilter();
if (filter.matches(clazz)) {
addInterestedByClass(clazz, Collections.singleton(listener)); // depends on control dependency: [if], data = [none]
}
}
} finally {
listenersLock.readLock().unlock();
}
// Update the new class with the configured probes
if (!getInterestedByClass(clazz).isEmpty()) {
this.transformer.instrumentWithProbes(Collections.<Class<?>> singleton(clazz)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Object put(Serializable key, Object value) {
if(component.initialStateMarked() || value instanceof PartialStateHolder) {
Object retVal = deltaMap.put(key, value);
if(retVal==null) {
return defaultMap.put(key,value);
}
else {
defaultMap.put(key,value);
return retVal;
}
}
else {
return defaultMap.put(key,value);
}
} } | public class class_name {
public Object put(Serializable key, Object value) {
if(component.initialStateMarked() || value instanceof PartialStateHolder) {
Object retVal = deltaMap.put(key, value);
if(retVal==null) {
return defaultMap.put(key,value); // depends on control dependency: [if], data = [none]
}
else {
defaultMap.put(key,value); // depends on control dependency: [if], data = [none]
return retVal; // depends on control dependency: [if], data = [none]
}
}
else {
return defaultMap.put(key,value); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void set(int i) {
int offset = i - this.sizeinwords * WORDSIZE;
if (offset + WORDSIZE < 0) {
throw new IllegalArgumentException("unsupported write back");
} else if ((offset + WORDSIZE >= 0) && (offset < 0)) {
final int before = this.buffer.get(this.buffer.size() - 1);
this.buffer.set(this.buffer.size() - 1, before
| (1 << (offset + WORDSIZE)));
// if(before != buffer.get(buffer.size()-1)) ++ cardinality;
} else {
final int numberofemptywords = offset / WORDSIZE;
offset -= numberofemptywords * WORDSIZE;
fastadd(1 << offset, this.sizeinwords + numberofemptywords);
// ++cardinality;
}
} } | public class class_name {
public void set(int i) {
int offset = i - this.sizeinwords * WORDSIZE;
if (offset + WORDSIZE < 0) {
throw new IllegalArgumentException("unsupported write back");
} else if ((offset + WORDSIZE >= 0) && (offset < 0)) {
final int before = this.buffer.get(this.buffer.size() - 1);
this.buffer.set(this.buffer.size() - 1, before
| (1 << (offset + WORDSIZE))); // depends on control dependency: [if], data = [none]
// if(before != buffer.get(buffer.size()-1)) ++ cardinality;
} else {
final int numberofemptywords = offset / WORDSIZE;
offset -= numberofemptywords * WORDSIZE; // depends on control dependency: [if], data = [none]
fastadd(1 << offset, this.sizeinwords + numberofemptywords); // depends on control dependency: [if], data = [none]
// ++cardinality;
}
} } |
public class class_name {
public void setBody(CharSequence body) {
String bodyString;
if (body != null) {
bodyString = body.toString();
} else {
bodyString = null;
}
setBody(bodyString);
} } | public class class_name {
public void setBody(CharSequence body) {
String bodyString;
if (body != null) {
bodyString = body.toString(); // depends on control dependency: [if], data = [none]
} else {
bodyString = null; // depends on control dependency: [if], data = [none]
}
setBody(bodyString);
} } |
public class class_name {
@Override
public RandomVariable getProcessValue(int timeIndex, int componentIndex) {
// Thread safe lazy initialization
synchronized(this) {
if (discreteProcess == null || discreteProcess.length == 0) {
doPrecalculateProcess();
}
}
if(discreteProcess[timeIndex][componentIndex] == null) {
throw new NullPointerException("Generation of process component " + componentIndex + " at time index " + timeIndex + " failed. Likely due to out of memory");
}
// Return value of process
return discreteProcess[timeIndex][componentIndex];
} } | public class class_name {
@Override
public RandomVariable getProcessValue(int timeIndex, int componentIndex) {
// Thread safe lazy initialization
synchronized(this) {
if (discreteProcess == null || discreteProcess.length == 0) {
doPrecalculateProcess(); // depends on control dependency: [if], data = [none]
}
}
if(discreteProcess[timeIndex][componentIndex] == null) {
throw new NullPointerException("Generation of process component " + componentIndex + " at time index " + timeIndex + " failed. Likely due to out of memory");
}
// Return value of process
return discreteProcess[timeIndex][componentIndex];
} } |
public class class_name {
public ImmutableSet<ClassInfo> getTopLevelClasses(String packageName) {
checkNotNull(packageName);
ImmutableSet.Builder<ClassInfo> builder = ImmutableSet.builder();
for (ClassInfo classInfo : getTopLevelClasses()) {
if (classInfo.getPackageName().equals(packageName)) {
builder.add(classInfo);
}
}
return builder.build();
} } | public class class_name {
public ImmutableSet<ClassInfo> getTopLevelClasses(String packageName) {
checkNotNull(packageName);
ImmutableSet.Builder<ClassInfo> builder = ImmutableSet.builder();
for (ClassInfo classInfo : getTopLevelClasses()) {
if (classInfo.getPackageName().equals(packageName)) {
builder.add(classInfo); // depends on control dependency: [if], data = [none]
}
}
return builder.build();
} } |
public class class_name {
private Properties loadProperties(File baseDir, Properties currentProperties, String key, boolean override) throws IOException {
Properties loadedProperties = new Properties();
String include = (String) currentProperties.remove(key);
if (!StringUtils.isNullOrEmpty(include)) {
// allow for multiples
List<String> names = StringUtils.getList(include, DEFAULT_LIST_DELIMITER);
for (String name : names) {
if (StringUtils.isNullOrEmpty(name)) {
continue;
}
// interpolate any variables
final String fileName = interpolateString(name);
// try co-located
File file = new File(baseDir, fileName);
if (!file.exists()) {
// try absolute path
file = new File(fileName);
}
if (!file.exists()) {
log.warn("failed to locate {}", file);
continue;
}
// load properties
log.debug("loading {} settings from {}", key, file);
try (FileInputStream iis = new FileInputStream(file)) {
loadedProperties.load(iis);
}
// read nested properties
loadedProperties = loadProperties(file.getParentFile(), loadedProperties, key, override);
}
}
Properties merged = new Properties();
if (override) {
// "override" settings overwrite the current properties
merged.putAll(currentProperties);
merged.putAll(loadedProperties);
} else {
// "include" settings are overwritten by the current properties
merged.putAll(loadedProperties);
merged.putAll(currentProperties);
}
return merged;
} } | public class class_name {
private Properties loadProperties(File baseDir, Properties currentProperties, String key, boolean override) throws IOException {
Properties loadedProperties = new Properties();
String include = (String) currentProperties.remove(key);
if (!StringUtils.isNullOrEmpty(include)) {
// allow for multiples
List<String> names = StringUtils.getList(include, DEFAULT_LIST_DELIMITER);
for (String name : names) {
if (StringUtils.isNullOrEmpty(name)) {
continue;
}
// interpolate any variables
final String fileName = interpolateString(name);
// try co-located
File file = new File(baseDir, fileName);
if (!file.exists()) {
// try absolute path
file = new File(fileName); // depends on control dependency: [if], data = [none]
}
if (!file.exists()) {
log.warn("failed to locate {}", file); // depends on control dependency: [if], data = [none]
continue;
}
// load properties
log.debug("loading {} settings from {}", key, file); // depends on control dependency: [for], data = [none]
try (FileInputStream iis = new FileInputStream(file)) {
loadedProperties.load(iis);
}
// read nested properties
loadedProperties = loadProperties(file.getParentFile(), loadedProperties, key, override);
}
}
Properties merged = new Properties();
if (override) {
// "override" settings overwrite the current properties
merged.putAll(currentProperties);
merged.putAll(loadedProperties);
} else {
// "include" settings are overwritten by the current properties
merged.putAll(loadedProperties);
merged.putAll(currentProperties);
}
return merged;
} } |
public class class_name {
public void readRecordClass(String strRecordClass)
{
String strBaseClass;
Record recClassInfo = this.getMainRecord();
if (!this.readThisClass(strRecordClass))
strBaseClass = "Record";
else
{
strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString();
if (strBaseClass.equalsIgnoreCase("Record"))
strBaseClass = "Record";
if (strBaseClass.length() == 0)
strBaseClass = "Record";
}
recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).setString(strBaseClass);
} } | public class class_name {
public void readRecordClass(String strRecordClass)
{
String strBaseClass;
Record recClassInfo = this.getMainRecord();
if (!this.readThisClass(strRecordClass))
strBaseClass = "Record";
else
{
strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString(); // depends on control dependency: [if], data = [none]
if (strBaseClass.equalsIgnoreCase("Record"))
strBaseClass = "Record";
if (strBaseClass.length() == 0)
strBaseClass = "Record";
}
recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).setString(strBaseClass);
} } |
public class class_name {
public boolean add(E key, double priority) {
if (size == capacity) {
grow(2 * capacity + 1);
}
elements.add(key);
priorities[size] = priority;
heapifyUp(size);
size++;
return true;
} } | public class class_name {
public boolean add(E key, double priority) {
if (size == capacity) {
grow(2 * capacity + 1);
// depends on control dependency: [if], data = [none]
}
elements.add(key);
priorities[size] = priority;
heapifyUp(size);
size++;
return true;
} } |
public class class_name {
float refreshAndGetAvg() {
long total = 0;
ResultSubpartition[] allPartitions = partition.getAllPartitions();
for (ResultSubpartition part : allPartitions) {
int size = part.unsynchronizedGetNumberOfQueuedBuffers();
total += size;
}
return total / (float) allPartitions.length;
} } | public class class_name {
float refreshAndGetAvg() {
long total = 0;
ResultSubpartition[] allPartitions = partition.getAllPartitions();
for (ResultSubpartition part : allPartitions) {
int size = part.unsynchronizedGetNumberOfQueuedBuffers();
total += size; // depends on control dependency: [for], data = [none]
}
return total / (float) allPartitions.length;
} } |
public class class_name {
public void setPhoneNumberOrders(java.util.Collection<PhoneNumberOrder> phoneNumberOrders) {
if (phoneNumberOrders == null) {
this.phoneNumberOrders = null;
return;
}
this.phoneNumberOrders = new java.util.ArrayList<PhoneNumberOrder>(phoneNumberOrders);
} } | public class class_name {
public void setPhoneNumberOrders(java.util.Collection<PhoneNumberOrder> phoneNumberOrders) {
if (phoneNumberOrders == null) {
this.phoneNumberOrders = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.phoneNumberOrders = new java.util.ArrayList<PhoneNumberOrder>(phoneNumberOrders);
} } |
public class class_name {
@Override
public void openConditionalComment(String expression) {
StringBuilder sb = new StringBuilder(PRE_TAG);
sb.append(expression).append(POST_TAG);
try {
out.write(sb.toString());
} catch (IOException e) {
throw new JawrLinkRenderingException(e);
}
} } | public class class_name {
@Override
public void openConditionalComment(String expression) {
StringBuilder sb = new StringBuilder(PRE_TAG);
sb.append(expression).append(POST_TAG);
try {
out.write(sb.toString()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new JawrLinkRenderingException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean isPrimitive(Object value) {
if (value == null) {
return true;
} else if (value.getClass().isPrimitive() == true) {
return true;
} else if (Integer.class.isInstance(value)) {
return true;
} else if (Long.class.isInstance(value)) {
return true;
} else if (Double.class.isInstance(value)) {
return true;
} else if (Float.class.isInstance(value)) {
return true;
} else if (Short.class.isInstance(value)) {
return true;
} else if (Byte.class.isInstance(value)) {
return true;
} else if (Character.class.isInstance(value)) {
return true;
} else if (Boolean.class.isInstance(value)) {
return true;
} else if (BigDecimal.class.isInstance(value)) {
return true;
} else if (BigInteger.class.isInstance(value)) {
return true;
}
return false;
} } | public class class_name {
public static boolean isPrimitive(Object value) {
if (value == null) {
return true;
// depends on control dependency: [if], data = [none]
} else if (value.getClass().isPrimitive() == true) {
return true;
// depends on control dependency: [if], data = [none]
} else if (Integer.class.isInstance(value)) {
return true;
// depends on control dependency: [if], data = [none]
} else if (Long.class.isInstance(value)) {
return true;
// depends on control dependency: [if], data = [none]
} else if (Double.class.isInstance(value)) {
return true;
// depends on control dependency: [if], data = [none]
} else if (Float.class.isInstance(value)) {
return true;
// depends on control dependency: [if], data = [none]
} else if (Short.class.isInstance(value)) {
return true;
// depends on control dependency: [if], data = [none]
} else if (Byte.class.isInstance(value)) {
return true;
// depends on control dependency: [if], data = [none]
} else if (Character.class.isInstance(value)) {
return true;
// depends on control dependency: [if], data = [none]
} else if (Boolean.class.isInstance(value)) {
return true;
// depends on control dependency: [if], data = [none]
} else if (BigDecimal.class.isInstance(value)) {
return true;
// depends on control dependency: [if], data = [none]
} else if (BigInteger.class.isInstance(value)) {
return true;
// depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
@Override
public void send(final File file, final CallbackHandler handler)
{
log.info("Sending local file to collector: {}", file.getAbsolutePath());
final long startTime = System.nanoTime();
final AsyncCompletionHandler<Response> asyncCompletionHandler = new AsyncCompletionHandler<Response>()
{
@Override
public Response onCompleted(final Response response)
{
activeRequests.decrementAndGet();
if (response.getStatusCode() == 202) {
handler.onSuccess(file);
}
else {
handler.onError(new IOException(String.format("Received response %d: %s",
response.getStatusCode(), response.getStatusText())), file);
}
sendTimer.update(System.nanoTime() - startTime, TimeUnit.NANOSECONDS);
return response; // never read
}
@Override
public void onThrowable(final Throwable t)
{
activeRequests.decrementAndGet();
handler.onError(t, file);
}
};
final HttpJob job = new HttpJob(client, file, asyncCompletionHandler);
workers.offer(job);
} } | public class class_name {
@Override
public void send(final File file, final CallbackHandler handler)
{
log.info("Sending local file to collector: {}", file.getAbsolutePath());
final long startTime = System.nanoTime();
final AsyncCompletionHandler<Response> asyncCompletionHandler = new AsyncCompletionHandler<Response>()
{
@Override
public Response onCompleted(final Response response)
{
activeRequests.decrementAndGet();
if (response.getStatusCode() == 202) {
handler.onSuccess(file); // depends on control dependency: [if], data = [none]
}
else {
handler.onError(new IOException(String.format("Received response %d: %s",
response.getStatusCode(), response.getStatusText())), file); // depends on control dependency: [if], data = [none]
}
sendTimer.update(System.nanoTime() - startTime, TimeUnit.NANOSECONDS);
return response; // never read
}
@Override
public void onThrowable(final Throwable t)
{
activeRequests.decrementAndGet();
handler.onError(t, file);
}
};
final HttpJob job = new HttpJob(client, file, asyncCompletionHandler);
workers.offer(job);
} } |
public class class_name {
public void setInputSecurityGroups(java.util.Collection<InputSecurityGroup> inputSecurityGroups) {
if (inputSecurityGroups == null) {
this.inputSecurityGroups = null;
return;
}
this.inputSecurityGroups = new java.util.ArrayList<InputSecurityGroup>(inputSecurityGroups);
} } | public class class_name {
public void setInputSecurityGroups(java.util.Collection<InputSecurityGroup> inputSecurityGroups) {
if (inputSecurityGroups == null) {
this.inputSecurityGroups = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.inputSecurityGroups = new java.util.ArrayList<InputSecurityGroup>(inputSecurityGroups);
} } |
public class class_name {
public void reattachConsumer(SIBUuid8 uuid, ConsumableKey ck)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "reattachConsumer", new Object[] {uuid, ck});
long timeout = LocalConsumerPoint.NO_WAIT;
synchronized(this)
{
if (!closed)
{
// Set the new consumer key to be the same ready state as the rest
// of the gathering consumer
if (isKeyReady())
{
//get the readyConsumer list lock
synchronized (dispatcher.getDestination().getReadyConsumerPointLock())
{
ck.ready(unrecoverable);
}
}
consumerKeys.put(uuid, ck);
// Work out the expiry time if any of the outstanding requests
if (outstandingRequestExpiryTime != LocalConsumerPoint.NO_WAIT)
{
timeout = outstandingRequestExpiryTime;
if (timeout != LocalConsumerPoint.INFINITE_WAIT)
timeout = outstandingRequestExpiryTime - System.currentTimeMillis();
}
}
}
// outside of the lock - reissue the request
if (timeout == LocalConsumerPoint.INFINITE_WAIT || timeout > 0)
{
((LocalQPConsumerKey)ck).initiateRefill();
ck.waiting(timeout, true);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "reattachConsumer");
} } | public class class_name {
public void reattachConsumer(SIBUuid8 uuid, ConsumableKey ck)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "reattachConsumer", new Object[] {uuid, ck});
long timeout = LocalConsumerPoint.NO_WAIT;
synchronized(this)
{
if (!closed)
{
// Set the new consumer key to be the same ready state as the rest
// of the gathering consumer
if (isKeyReady())
{
//get the readyConsumer list lock
synchronized (dispatcher.getDestination().getReadyConsumerPointLock()) // depends on control dependency: [if], data = [none]
{
ck.ready(unrecoverable);
}
}
consumerKeys.put(uuid, ck); // depends on control dependency: [if], data = [none]
// Work out the expiry time if any of the outstanding requests
if (outstandingRequestExpiryTime != LocalConsumerPoint.NO_WAIT)
{
timeout = outstandingRequestExpiryTime; // depends on control dependency: [if], data = [none]
if (timeout != LocalConsumerPoint.INFINITE_WAIT)
timeout = outstandingRequestExpiryTime - System.currentTimeMillis();
}
}
}
// outside of the lock - reissue the request
if (timeout == LocalConsumerPoint.INFINITE_WAIT || timeout > 0)
{
((LocalQPConsumerKey)ck).initiateRefill();
ck.waiting(timeout, true);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "reattachConsumer");
} } |
public class class_name {
private static String getServiceIdIfNotProvided(ServiceMetadata metadata, String interfaceName) {
if (INTERFACE_NAME_TO_SERVICE_ID.containsKey(interfaceName)) {
return INTERFACE_NAME_TO_SERVICE_ID.get(interfaceName);
}
String serviceId = metadata.getServiceId();
if (serviceId != null) {
return serviceId;
}
return Utils.deriveServiceId(interfaceName);
} } | public class class_name {
private static String getServiceIdIfNotProvided(ServiceMetadata metadata, String interfaceName) {
if (INTERFACE_NAME_TO_SERVICE_ID.containsKey(interfaceName)) {
return INTERFACE_NAME_TO_SERVICE_ID.get(interfaceName); // depends on control dependency: [if], data = [none]
}
String serviceId = metadata.getServiceId();
if (serviceId != null) {
return serviceId; // depends on control dependency: [if], data = [none]
}
return Utils.deriveServiceId(interfaceName);
} } |
public class class_name {
private boolean isActivityMatching(Class<? extends Activity> activityClass, Activity currentActivity){
if(currentActivity != null && currentActivity.getClass().equals(activityClass)) {
return true;
}
return false;
} } | public class class_name {
private boolean isActivityMatching(Class<? extends Activity> activityClass, Activity currentActivity){
if(currentActivity != null && currentActivity.getClass().equals(activityClass)) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static CertStore fromSignedData(final CMSSignedData signedData) {
CertificateFactory factory;
try {
factory = CertificateFactory.getInstance("X509");
} catch (CertificateException e) {
throw new RuntimeException(e);
}
Store certStore = signedData.getCertificates();
Store crlStore = signedData.getCRLs();
@SuppressWarnings("unchecked")
Collection<X509CertificateHolder> certs = certStore.getMatches(null);
@SuppressWarnings("unchecked")
Collection<X509CRLHolder> crls = crlStore.getMatches(null);
Collection<Object> certsAndCrls = new ArrayList<Object>();
for (X509CertificateHolder cert : certs) {
ByteArrayInputStream byteIn;
try {
byteIn = new ByteArrayInputStream(cert.getEncoded());
} catch (IOException e) {
LOGGER.error("Error encoding certificate", e);
continue;
}
try {
certsAndCrls.add(factory.generateCertificate(byteIn));
} catch (CertificateException e) {
LOGGER.error("Error generating certificate", e);
}
}
for (X509CRLHolder crl : crls) {
ByteArrayInputStream byteIn;
try {
byteIn = new ByteArrayInputStream(crl.getEncoded());
} catch (IOException e) {
LOGGER.error("Error encoding crl", e);
continue;
}
try {
certsAndCrls.add(factory.generateCRL(byteIn));
} catch (CRLException e) {
LOGGER.error("Error generating certificate", e);
}
}
try {
return CertStore.getInstance("Collection",
new CollectionCertStoreParameters(certsAndCrls));
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static CertStore fromSignedData(final CMSSignedData signedData) {
CertificateFactory factory;
try {
factory = CertificateFactory.getInstance("X509"); // depends on control dependency: [try], data = [none]
} catch (CertificateException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
Store certStore = signedData.getCertificates();
Store crlStore = signedData.getCRLs();
@SuppressWarnings("unchecked")
Collection<X509CertificateHolder> certs = certStore.getMatches(null);
@SuppressWarnings("unchecked")
Collection<X509CRLHolder> crls = crlStore.getMatches(null);
Collection<Object> certsAndCrls = new ArrayList<Object>();
for (X509CertificateHolder cert : certs) {
ByteArrayInputStream byteIn;
try {
byteIn = new ByteArrayInputStream(cert.getEncoded()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOGGER.error("Error encoding certificate", e);
continue;
} // depends on control dependency: [catch], data = [none]
try {
certsAndCrls.add(factory.generateCertificate(byteIn)); // depends on control dependency: [try], data = [none]
} catch (CertificateException e) {
LOGGER.error("Error generating certificate", e);
} // depends on control dependency: [catch], data = [none]
}
for (X509CRLHolder crl : crls) {
ByteArrayInputStream byteIn;
try {
byteIn = new ByteArrayInputStream(crl.getEncoded()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOGGER.error("Error encoding crl", e);
continue;
} // depends on control dependency: [catch], data = [none]
try {
certsAndCrls.add(factory.generateCRL(byteIn)); // depends on control dependency: [try], data = [none]
} catch (CRLException e) {
LOGGER.error("Error generating certificate", e);
} // depends on control dependency: [catch], data = [none]
}
try {
return CertStore.getInstance("Collection",
new CollectionCertStoreParameters(certsAndCrls)); // depends on control dependency: [try], data = [none]
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(RefreshSchemasStatus refreshSchemasStatus, ProtocolMarshaller protocolMarshaller) {
if (refreshSchemasStatus == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(refreshSchemasStatus.getEndpointArn(), ENDPOINTARN_BINDING);
protocolMarshaller.marshall(refreshSchemasStatus.getReplicationInstanceArn(), REPLICATIONINSTANCEARN_BINDING);
protocolMarshaller.marshall(refreshSchemasStatus.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(refreshSchemasStatus.getLastRefreshDate(), LASTREFRESHDATE_BINDING);
protocolMarshaller.marshall(refreshSchemasStatus.getLastFailureMessage(), LASTFAILUREMESSAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RefreshSchemasStatus refreshSchemasStatus, ProtocolMarshaller protocolMarshaller) {
if (refreshSchemasStatus == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(refreshSchemasStatus.getEndpointArn(), ENDPOINTARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(refreshSchemasStatus.getReplicationInstanceArn(), REPLICATIONINSTANCEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(refreshSchemasStatus.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(refreshSchemasStatus.getLastRefreshDate(), LASTREFRESHDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(refreshSchemasStatus.getLastFailureMessage(), LASTFAILUREMESSAGE_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 setRange(String range) {
String single = range.trim();
int hyphenIndex = range.indexOf('-');
if (hyphenIndex > 0) {
this.start = rangeSingle(range.substring(0, hyphenIndex));
this.end = rangeSingle(range.substring(hyphenIndex + 1));
} else {
int number = rangeSingle(range);
if (number >= 0) { // first n attributes
this.start = 0;
this.end = number;
} else { // last n attributes
this.start = this.upperLimit + number > 0 ? this.upperLimit + number : 0;
this.end = this.upperLimit - 1;
}
}
} } | public class class_name {
public void setRange(String range) {
String single = range.trim();
int hyphenIndex = range.indexOf('-');
if (hyphenIndex > 0) {
this.start = rangeSingle(range.substring(0, hyphenIndex)); // depends on control dependency: [if], data = [none]
this.end = rangeSingle(range.substring(hyphenIndex + 1)); // depends on control dependency: [if], data = [(hyphenIndex]
} else {
int number = rangeSingle(range);
if (number >= 0) { // first n attributes
this.start = 0; // depends on control dependency: [if], data = [none]
this.end = number; // depends on control dependency: [if], data = [none]
} else { // last n attributes
this.start = this.upperLimit + number > 0 ? this.upperLimit + number : 0; // depends on control dependency: [if], data = [none]
this.end = this.upperLimit - 1; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public List<Descriptor<ViewJobFilter>> getJobFiltersDescriptors() {
StaplerRequest request = Stapler.getCurrentRequest();
if (request != null) {
View view = request.findAncestorObject(clazz);
return view == null ? DescriptorVisibilityFilter.applyType(clazz, ViewJobFilter.all())
: DescriptorVisibilityFilter.apply(view, ViewJobFilter.all());
}
return ViewJobFilter.all();
} } | public class class_name {
public List<Descriptor<ViewJobFilter>> getJobFiltersDescriptors() {
StaplerRequest request = Stapler.getCurrentRequest();
if (request != null) {
View view = request.findAncestorObject(clazz);
return view == null ? DescriptorVisibilityFilter.applyType(clazz, ViewJobFilter.all())
: DescriptorVisibilityFilter.apply(view, ViewJobFilter.all()); // depends on control dependency: [if], data = [none]
}
return ViewJobFilter.all();
} } |
public class class_name {
public SimpleDialog itemTextAppearance(int resId){
if(mItemTextAppearance != resId){
mItemTextAppearance = resId;
if(mAdapter != null)
mAdapter.notifyDataSetChanged();
}
return this;
} } | public class class_name {
public SimpleDialog itemTextAppearance(int resId){
if(mItemTextAppearance != resId){
mItemTextAppearance = resId; // depends on control dependency: [if], data = [none]
if(mAdapter != null)
mAdapter.notifyDataSetChanged();
}
return this;
} } |
public class class_name {
protected void configureOrcidClient(final Collection<BaseClient> properties) {
val db = pac4jProperties.getOrcid();
if (StringUtils.isNotBlank(db.getId()) && StringUtils.isNotBlank(db.getSecret())) {
val client = new OrcidClient(db.getId(), db.getSecret());
configureClient(client, db);
LOGGER.debug("Created client [{}] with identifier [{}]", client.getName(), client.getKey());
properties.add(client);
}
} } | public class class_name {
protected void configureOrcidClient(final Collection<BaseClient> properties) {
val db = pac4jProperties.getOrcid();
if (StringUtils.isNotBlank(db.getId()) && StringUtils.isNotBlank(db.getSecret())) {
val client = new OrcidClient(db.getId(), db.getSecret());
configureClient(client, db); // depends on control dependency: [if], data = [none]
LOGGER.debug("Created client [{}] with identifier [{}]", client.getName(), client.getKey()); // depends on control dependency: [if], data = [none]
properties.add(client); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected Map<String, Object> findAccountViaRestApi(final Map<String, Object> headers) {
HttpResponse response = null;
try {
response = HttpUtils.execute(properties.getUrl(), properties.getMethod(),
properties.getBasicAuthUsername(), properties.getBasicAuthPassword(),
new HashMap<>(), headers);
if (response != null && response.getEntity() != null && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
return MAPPER.readValue(response.getEntity().getContent(), Map.class);
}
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
} finally {
HttpUtils.close(response);
}
return new HashMap<>();
} } | public class class_name {
protected Map<String, Object> findAccountViaRestApi(final Map<String, Object> headers) {
HttpResponse response = null;
try {
response = HttpUtils.execute(properties.getUrl(), properties.getMethod(),
properties.getBasicAuthUsername(), properties.getBasicAuthPassword(),
new HashMap<>(), headers); // depends on control dependency: [try], data = [none]
if (response != null && response.getEntity() != null && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
return MAPPER.readValue(response.getEntity().getContent(), Map.class); // depends on control dependency: [if], data = [none]
}
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
} finally { // depends on control dependency: [catch], data = [none]
HttpUtils.close(response);
}
return new HashMap<>();
} } |
public class class_name {
private void checkForEmptyBuildSetTask(BuildSetTask buildSetTask) {
if (buildSetTask.getBuildTasks() == null || buildSetTask.getBuildTasks().isEmpty()) {
updateBuildSetTaskStatus(buildSetTask, BuildSetStatus.REJECTED, "Build config set is empty");
}
} } | public class class_name {
private void checkForEmptyBuildSetTask(BuildSetTask buildSetTask) {
if (buildSetTask.getBuildTasks() == null || buildSetTask.getBuildTasks().isEmpty()) {
updateBuildSetTaskStatus(buildSetTask, BuildSetStatus.REJECTED, "Build config set is empty"); // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.