code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Path("/cookies")
@GET
public Response getCookies(@QueryParam("token") String token) {
try {
StringDataStore dataStore = this.stringDataStoreFactory.create(Constants.HIDDEN_COOKIE_SPACE);
String cookiesData = dataStore.retrieveData(token);
if (null == cookiesData) {
return responseNotFound("Token not found");
}
SignedCookieData cookieData = SignedCookieData.deserialize(cookiesData);
String streamingHost = cookieData.getStreamingHost();
// Build set of cookies
Map<String, String> cookies = cookieData.getSignedCookies();
ArrayList<NewCookie> responseCookies = new ArrayList<>();
for (String cookieKey : cookies.keySet()) {
responseCookies.add(new NewCookie(cookieKey,
cookies.get(cookieKey),
"/",
streamingHost,
"Supports HLS",
-1,
true));
}
// Build redirect HTML
String redirectUrl = cookieData.getRedirectUrl();
String html = "<html><head><meta http-equiv='refresh' content='0;URL=\"" +
redirectUrl + "\"' /></head></html>";
return Response.ok(html, MediaType.TEXT_HTML_TYPE)
.cookie(responseCookies.toArray(new NewCookie[responseCookies.size()])).build();
} catch (Exception e) {
return responseBad(e);
}
} } | public class class_name {
@Path("/cookies")
@GET
public Response getCookies(@QueryParam("token") String token) {
try {
StringDataStore dataStore = this.stringDataStoreFactory.create(Constants.HIDDEN_COOKIE_SPACE);
String cookiesData = dataStore.retrieveData(token);
if (null == cookiesData) {
return responseNotFound("Token not found"); // depends on control dependency: [if], data = [none]
}
SignedCookieData cookieData = SignedCookieData.deserialize(cookiesData);
String streamingHost = cookieData.getStreamingHost();
// Build set of cookies
Map<String, String> cookies = cookieData.getSignedCookies();
ArrayList<NewCookie> responseCookies = new ArrayList<>();
for (String cookieKey : cookies.keySet()) {
responseCookies.add(new NewCookie(cookieKey,
cookies.get(cookieKey),
"/",
streamingHost,
"Supports HLS",
-1,
true)); // depends on control dependency: [for], data = [none]
}
// Build redirect HTML
String redirectUrl = cookieData.getRedirectUrl();
String html = "<html><head><meta http-equiv='refresh' content='0;URL=\"" +
redirectUrl + "\"' /></head></html>";
return Response.ok(html, MediaType.TEXT_HTML_TYPE)
.cookie(responseCookies.toArray(new NewCookie[responseCookies.size()])).build(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return responseBad(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void expectIndexMatch(Node n, JSType objType, JSType indexType) {
checkState(n.isGetElem() || n.isComputedProp(), n);
Node indexNode = n.isGetElem() ? n.getLastChild() : n.getFirstChild();
if (indexType.isSymbolValueType()) {
// For now, allow symbols definitions/access on any type. In the future only allow them
// on the subtypes for which they are defined.
return;
}
if (objType.isStruct()) {
report(JSError.make(indexNode,
ILLEGAL_PROPERTY_ACCESS, "'[]'", "struct"));
}
if (objType.isUnknownType()) {
expectStringOrNumberOrSymbol(indexNode, indexType, "property access");
} else {
ObjectType dereferenced = objType.dereference();
if (dereferenced != null && dereferenced
.getTemplateTypeMap()
.hasTemplateKey(typeRegistry.getObjectIndexKey())) {
expectCanAssignTo(
indexNode,
indexType,
dereferenced
.getTemplateTypeMap()
.getResolvedTemplateType(typeRegistry.getObjectIndexKey()),
"restricted index type");
} else if (dereferenced != null && dereferenced.isArrayType()) {
expectNumberOrSymbol(indexNode, indexType, "array access");
} else if (objType.matchesObjectContext()) {
expectStringOrSymbol(indexNode, indexType, "property access");
} else {
mismatch(
n,
"only arrays or objects can be accessed",
objType,
typeRegistry.createUnionType(ARRAY_TYPE, OBJECT_TYPE));
}
}
} } | public class class_name {
void expectIndexMatch(Node n, JSType objType, JSType indexType) {
checkState(n.isGetElem() || n.isComputedProp(), n);
Node indexNode = n.isGetElem() ? n.getLastChild() : n.getFirstChild();
if (indexType.isSymbolValueType()) {
// For now, allow symbols definitions/access on any type. In the future only allow them
// on the subtypes for which they are defined.
return; // depends on control dependency: [if], data = [none]
}
if (objType.isStruct()) {
report(JSError.make(indexNode,
ILLEGAL_PROPERTY_ACCESS, "'[]'", "struct")); // depends on control dependency: [if], data = [none]
}
if (objType.isUnknownType()) {
expectStringOrNumberOrSymbol(indexNode, indexType, "property access"); // depends on control dependency: [if], data = [none]
} else {
ObjectType dereferenced = objType.dereference();
if (dereferenced != null && dereferenced
.getTemplateTypeMap()
.hasTemplateKey(typeRegistry.getObjectIndexKey())) {
expectCanAssignTo(
indexNode,
indexType,
dereferenced
.getTemplateTypeMap()
.getResolvedTemplateType(typeRegistry.getObjectIndexKey()),
"restricted index type"); // depends on control dependency: [if], data = [none]
} else if (dereferenced != null && dereferenced.isArrayType()) {
expectNumberOrSymbol(indexNode, indexType, "array access"); // depends on control dependency: [if], data = [none]
} else if (objType.matchesObjectContext()) {
expectStringOrSymbol(indexNode, indexType, "property access"); // depends on control dependency: [if], data = [none]
} else {
mismatch(
n,
"only arrays or objects can be accessed",
objType,
typeRegistry.createUnionType(ARRAY_TYPE, OBJECT_TYPE)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
static SingleOffsetTimezone of(ZonalOffset offset) {
if (
(offset.getIntegralAmount() == 0)
&& (offset.getFractionalAmount() == 0)
) {
return UTC;
} else {
return new SingleOffsetTimezone(offset);
}
} } | public class class_name {
static SingleOffsetTimezone of(ZonalOffset offset) {
if (
(offset.getIntegralAmount() == 0)
&& (offset.getFractionalAmount() == 0)
) {
return UTC; // depends on control dependency: [if], data = []
} else {
return new SingleOffsetTimezone(offset); // depends on control dependency: [if], data = []
}
} } |
public class class_name {
@Override
public void visit(final String name, final Object value) {
// Case of an element_value with a const_value_index, class_info_index or array_index field.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.1.
++numElementValuePairs;
if (useNamedValues) {
annotation.putShort(symbolTable.addConstantUtf8(name));
}
if (value instanceof String) {
annotation.put12('s', symbolTable.addConstantUtf8((String) value));
} else if (value instanceof Byte) {
annotation.put12('B', symbolTable.addConstantInteger(((Byte) value).byteValue()).index);
} else if (value instanceof Boolean) {
int booleanValue = ((Boolean) value).booleanValue() ? 1 : 0;
annotation.put12('Z', symbolTable.addConstantInteger(booleanValue).index);
} else if (value instanceof Character) {
annotation.put12('C', symbolTable.addConstantInteger(((Character) value).charValue()).index);
} else if (value instanceof Short) {
annotation.put12('S', symbolTable.addConstantInteger(((Short) value).shortValue()).index);
} else if (value instanceof Type) {
annotation.put12('c', symbolTable.addConstantUtf8(((Type) value).getDescriptor()));
} else if (value instanceof byte[]) {
byte[] byteArray = (byte[]) value;
annotation.put12('[', byteArray.length);
for (byte byteValue : byteArray) {
annotation.put12('B', symbolTable.addConstantInteger(byteValue).index);
}
} else if (value instanceof boolean[]) {
boolean[] booleanArray = (boolean[]) value;
annotation.put12('[', booleanArray.length);
for (boolean booleanValue : booleanArray) {
annotation.put12('Z', symbolTable.addConstantInteger(booleanValue ? 1 : 0).index);
}
} else if (value instanceof short[]) {
short[] shortArray = (short[]) value;
annotation.put12('[', shortArray.length);
for (short shortValue : shortArray) {
annotation.put12('S', symbolTable.addConstantInteger(shortValue).index);
}
} else if (value instanceof char[]) {
char[] charArray = (char[]) value;
annotation.put12('[', charArray.length);
for (char charValue : charArray) {
annotation.put12('C', symbolTable.addConstantInteger(charValue).index);
}
} else if (value instanceof int[]) {
int[] intArray = (int[]) value;
annotation.put12('[', intArray.length);
for (int intValue : intArray) {
annotation.put12('I', symbolTable.addConstantInteger(intValue).index);
}
} else if (value instanceof long[]) {
long[] longArray = (long[]) value;
annotation.put12('[', longArray.length);
for (long longValue : longArray) {
annotation.put12('J', symbolTable.addConstantLong(longValue).index);
}
} else if (value instanceof float[]) {
float[] floatArray = (float[]) value;
annotation.put12('[', floatArray.length);
for (float floatValue : floatArray) {
annotation.put12('F', symbolTable.addConstantFloat(floatValue).index);
}
} else if (value instanceof double[]) {
double[] doubleArray = (double[]) value;
annotation.put12('[', doubleArray.length);
for (double doubleValue : doubleArray) {
annotation.put12('D', symbolTable.addConstantDouble(doubleValue).index);
}
} else {
Symbol symbol = symbolTable.addConstant(value);
annotation.put12(".s.IFJDCS".charAt(symbol.tag), symbol.index);
}
}
@Override
public void visitEnum(final String name, final String descriptor, final String value) {
// Case of an element_value with an enum_const_value field.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.1.
++numElementValuePairs;
if (useNamedValues) {
annotation.putShort(symbolTable.addConstantUtf8(name));
}
annotation
.put12('e', symbolTable.addConstantUtf8(descriptor))
.putShort(symbolTable.addConstantUtf8(value));
}
@Override
public AnnotationVisitor visitAnnotation(final String name, final String descriptor) {
// Case of an element_value with an annotation_value field.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.1.
++numElementValuePairs;
if (useNamedValues) {
annotation.putShort(symbolTable.addConstantUtf8(name));
}
// Write tag and type_index, and reserve 2 bytes for num_element_value_pairs.
annotation.put12('@', symbolTable.addConstantUtf8(descriptor)).putShort(0);
return new AnnotationWriter(symbolTable, annotation, null);
} } | public class class_name {
@Override
public void visit(final String name, final Object value) {
// Case of an element_value with a const_value_index, class_info_index or array_index field.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.1.
++numElementValuePairs;
if (useNamedValues) {
annotation.putShort(symbolTable.addConstantUtf8(name)); // depends on control dependency: [if], data = [none]
}
if (value instanceof String) {
annotation.put12('s', symbolTable.addConstantUtf8((String) value)); // depends on control dependency: [if], data = [none]
} else if (value instanceof Byte) {
annotation.put12('B', symbolTable.addConstantInteger(((Byte) value).byteValue()).index); // depends on control dependency: [if], data = [none]
} else if (value instanceof Boolean) {
int booleanValue = ((Boolean) value).booleanValue() ? 1 : 0;
annotation.put12('Z', symbolTable.addConstantInteger(booleanValue).index); // depends on control dependency: [if], data = [none]
} else if (value instanceof Character) {
annotation.put12('C', symbolTable.addConstantInteger(((Character) value).charValue()).index); // depends on control dependency: [if], data = [none]
} else if (value instanceof Short) {
annotation.put12('S', symbolTable.addConstantInteger(((Short) value).shortValue()).index); // depends on control dependency: [if], data = [none]
} else if (value instanceof Type) {
annotation.put12('c', symbolTable.addConstantUtf8(((Type) value).getDescriptor())); // depends on control dependency: [if], data = [none]
} else if (value instanceof byte[]) {
byte[] byteArray = (byte[]) value;
annotation.put12('[', byteArray.length); // depends on control dependency: [if], data = [none]
for (byte byteValue : byteArray) {
annotation.put12('B', symbolTable.addConstantInteger(byteValue).index); // depends on control dependency: [for], data = [byteValue]
}
} else if (value instanceof boolean[]) {
boolean[] booleanArray = (boolean[]) value;
annotation.put12('[', booleanArray.length); // depends on control dependency: [if], data = [none]
for (boolean booleanValue : booleanArray) {
annotation.put12('Z', symbolTable.addConstantInteger(booleanValue ? 1 : 0).index); // depends on control dependency: [for], data = [booleanValue]
}
} else if (value instanceof short[]) {
short[] shortArray = (short[]) value;
annotation.put12('[', shortArray.length); // depends on control dependency: [if], data = [none]
for (short shortValue : shortArray) {
annotation.put12('S', symbolTable.addConstantInteger(shortValue).index); // depends on control dependency: [for], data = [shortValue]
}
} else if (value instanceof char[]) {
char[] charArray = (char[]) value;
annotation.put12('[', charArray.length); // depends on control dependency: [if], data = [none]
for (char charValue : charArray) {
annotation.put12('C', symbolTable.addConstantInteger(charValue).index); // depends on control dependency: [for], data = [charValue]
}
} else if (value instanceof int[]) {
int[] intArray = (int[]) value;
annotation.put12('[', intArray.length); // depends on control dependency: [if], data = [none]
for (int intValue : intArray) {
annotation.put12('I', symbolTable.addConstantInteger(intValue).index); // depends on control dependency: [for], data = [intValue]
}
} else if (value instanceof long[]) {
long[] longArray = (long[]) value;
annotation.put12('[', longArray.length); // depends on control dependency: [if], data = [none]
for (long longValue : longArray) {
annotation.put12('J', symbolTable.addConstantLong(longValue).index); // depends on control dependency: [for], data = [longValue]
}
} else if (value instanceof float[]) {
float[] floatArray = (float[]) value;
annotation.put12('[', floatArray.length); // depends on control dependency: [if], data = [none]
for (float floatValue : floatArray) {
annotation.put12('F', symbolTable.addConstantFloat(floatValue).index); // depends on control dependency: [for], data = [floatValue]
}
} else if (value instanceof double[]) {
double[] doubleArray = (double[]) value;
annotation.put12('[', doubleArray.length); // depends on control dependency: [if], data = [none]
for (double doubleValue : doubleArray) {
annotation.put12('D', symbolTable.addConstantDouble(doubleValue).index); // depends on control dependency: [for], data = [doubleValue]
}
} else {
Symbol symbol = symbolTable.addConstant(value);
annotation.put12(".s.IFJDCS".charAt(symbol.tag), symbol.index); // depends on control dependency: [if], data = [none]
}
}
@Override
public void visitEnum(final String name, final String descriptor, final String value) {
// Case of an element_value with an enum_const_value field.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.1.
++numElementValuePairs;
if (useNamedValues) {
annotation.putShort(symbolTable.addConstantUtf8(name)); // depends on control dependency: [if], data = [none]
}
annotation
.put12('e', symbolTable.addConstantUtf8(descriptor))
.putShort(symbolTable.addConstantUtf8(value));
}
@Override
public AnnotationVisitor visitAnnotation(final String name, final String descriptor) {
// Case of an element_value with an annotation_value field.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.1.
++numElementValuePairs;
if (useNamedValues) {
annotation.putShort(symbolTable.addConstantUtf8(name)); // depends on control dependency: [if], data = [none]
}
// Write tag and type_index, and reserve 2 bytes for num_element_value_pairs.
annotation.put12('@', symbolTable.addConstantUtf8(descriptor)).putShort(0);
return new AnnotationWriter(symbolTable, annotation, null);
} } |
public class class_name {
private void restoreFieldsFromUserInfo() {
String savedEmail = (String)(m_user.getAdditionalInfo().get(ADDINFO_EMAIL));
String savedName = (String)(m_user.getAdditionalInfo().get(ADDINFO_USER));
String savedMessage = (String)(m_user.getAdditionalInfo().get(ADDINFO_MESSAGE));
if (savedEmail != null) {
m_emailField.setValue(savedEmail);
}
if (savedName != null) {
m_userField.setValue(savedName);
}
if (savedMessage != null) {
m_commitMessage.setValue(savedMessage);
}
} } | public class class_name {
private void restoreFieldsFromUserInfo() {
String savedEmail = (String)(m_user.getAdditionalInfo().get(ADDINFO_EMAIL));
String savedName = (String)(m_user.getAdditionalInfo().get(ADDINFO_USER));
String savedMessage = (String)(m_user.getAdditionalInfo().get(ADDINFO_MESSAGE));
if (savedEmail != null) {
m_emailField.setValue(savedEmail); // depends on control dependency: [if], data = [(savedEmail]
}
if (savedName != null) {
m_userField.setValue(savedName); // depends on control dependency: [if], data = [(savedName]
}
if (savedMessage != null) {
m_commitMessage.setValue(savedMessage); // depends on control dependency: [if], data = [(savedMessage]
}
} } |
public class class_name {
public Object superPut(Object key, Object value) {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUPER_PUT], "" + key);
}
BackedSession sess = (BackedSession) super.put(key, value);
//The LRU HashMap handles the PMI counters for CacheDiscards and MemoryCount
return sess;
} } | public class class_name {
public Object superPut(Object key, Object value) {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUPER_PUT], "" + key); // depends on control dependency: [if], data = [none]
}
BackedSession sess = (BackedSession) super.put(key, value);
//The LRU HashMap handles the PMI counters for CacheDiscards and MemoryCount
return sess;
} } |
public class class_name {
public java.util.List<VolumeRecoveryPointInfo> getVolumeRecoveryPointInfos() {
if (volumeRecoveryPointInfos == null) {
volumeRecoveryPointInfos = new com.amazonaws.internal.SdkInternalList<VolumeRecoveryPointInfo>();
}
return volumeRecoveryPointInfos;
} } | public class class_name {
public java.util.List<VolumeRecoveryPointInfo> getVolumeRecoveryPointInfos() {
if (volumeRecoveryPointInfos == null) {
volumeRecoveryPointInfos = new com.amazonaws.internal.SdkInternalList<VolumeRecoveryPointInfo>(); // depends on control dependency: [if], data = [none]
}
return volumeRecoveryPointInfos;
} } |
public class class_name {
public static String getPackageResource(Class<?> type, String resourceName)
{
StringBuilder builder = new StringBuilder();
builder.append(type.getPackage().getName().replace('.', '/'));
if(resourceName.charAt(0) != '/') {
builder.append('/');
}
builder.append(resourceName);
return builder.toString();
} } | public class class_name {
public static String getPackageResource(Class<?> type, String resourceName)
{
StringBuilder builder = new StringBuilder();
builder.append(type.getPackage().getName().replace('.', '/'));
if(resourceName.charAt(0) != '/') {
builder.append('/');
// depends on control dependency: [if], data = ['/')]
}
builder.append(resourceName);
return builder.toString();
} } |
public class class_name {
Entry forceRemove()
{
Entry removedEntry = null;
checkEntryParent();
if(atTop)
{
//if we are at the top of the list and we are the first top cursor
if(parentList.firstTopCursor == this)
{
//set the first top cursor to be the next one in the list
parentList.firstTopCursor = (Cursor) next;
}
//mark us as not at the top
atTop = false;
}
else if(atBottom)
{
//if we are at the bottom of the list and we are the first bottom cursor
if(parentList.firstBottomCursor == this)
{
//set the first bottom cursor to be the next one in the list
parentList.firstBottomCursor = (Cursor) next;
}
//mark us as not at the bottom
atBottom = false;
}
else
{
//if we are pointing to an actual entry in the list
if(current.firstCursor == this)
{
//and we are the first cursor on that entry
//set the first cursor to be the next one in the list
current.firstCursor = (Cursor) next;
}
//set the current entry to null
current = null;
}
//actually remove this cursor from the list
removedEntry = super.forceRemove();
return removedEntry;
} } | public class class_name {
Entry forceRemove()
{
Entry removedEntry = null;
checkEntryParent();
if(atTop)
{
//if we are at the top of the list and we are the first top cursor
if(parentList.firstTopCursor == this)
{
//set the first top cursor to be the next one in the list
parentList.firstTopCursor = (Cursor) next; // depends on control dependency: [if], data = [none]
}
//mark us as not at the top
atTop = false; // depends on control dependency: [if], data = [none]
}
else if(atBottom)
{
//if we are at the bottom of the list and we are the first bottom cursor
if(parentList.firstBottomCursor == this)
{
//set the first bottom cursor to be the next one in the list
parentList.firstBottomCursor = (Cursor) next; // depends on control dependency: [if], data = [none]
}
//mark us as not at the bottom
atBottom = false; // depends on control dependency: [if], data = [none]
}
else
{
//if we are pointing to an actual entry in the list
if(current.firstCursor == this)
{
//and we are the first cursor on that entry
//set the first cursor to be the next one in the list
current.firstCursor = (Cursor) next; // depends on control dependency: [if], data = [none]
}
//set the current entry to null
current = null; // depends on control dependency: [if], data = [none]
}
//actually remove this cursor from the list
removedEntry = super.forceRemove();
return removedEntry;
} } |
public class class_name {
public static double combination(int n, int k) {
if(n<k) {
throw new IllegalArgumentException("The n can't be smaller than k.");
}
double combinations=1.0;
double lowerBound = n-k;
for(int i=n;i>lowerBound;i--) {
combinations *= i/(i-lowerBound);
}
return combinations;
} } | public class class_name {
public static double combination(int n, int k) {
if(n<k) {
throw new IllegalArgumentException("The n can't be smaller than k.");
}
double combinations=1.0;
double lowerBound = n-k;
for(int i=n;i>lowerBound;i--) {
combinations *= i/(i-lowerBound); // depends on control dependency: [for], data = [i]
}
return combinations;
} } |
public class class_name {
@Override
public String encode() throws IOException {
FastStringWriter fsw = new FastStringWriter();
try {
fsw.write(super.encode());
if (this.type != null) {
fsw.write(",\"type\":\"" + this.type + "\"");
}
if (this.ticks != null) {
fsw.write(",\"ticks\":{");
fsw.write(this.ticks.encode());
fsw.write("}");
}
}
finally {
fsw.close();
}
return fsw.toString();
} } | public class class_name {
@Override
public String encode() throws IOException {
FastStringWriter fsw = new FastStringWriter();
try {
fsw.write(super.encode());
if (this.type != null) {
fsw.write(",\"type\":\"" + this.type + "\""); // depends on control dependency: [if], data = [none]
}
if (this.ticks != null) {
fsw.write(",\"ticks\":{"); // depends on control dependency: [if], data = [none]
fsw.write(this.ticks.encode()); // depends on control dependency: [if], data = [(this.ticks]
fsw.write("}"); // depends on control dependency: [if], data = [none]
}
}
finally {
fsw.close();
}
return fsw.toString();
} } |
public class class_name {
public void enableConnHeartbeat(Url url) {
if (null != url) {
this.connectionManager.enableHeartbeat(this.connectionManager.get(url.getUniqueKey()));
}
} } | public class class_name {
public void enableConnHeartbeat(Url url) {
if (null != url) {
this.connectionManager.enableHeartbeat(this.connectionManager.get(url.getUniqueKey())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected boolean setForwardProxyBuffers(Map<Object, Object> config) {
byte[] target = (byte[]) config.get(PROXY_TARGET_HOST_PORT);
if (null == target) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Proxy tunnel attempt missing target host");
}
connLink.connectFailed(new IOException("Missing forward proxy target host"));
return false;
}
byte[] authInfo = (byte[]) config.get(PROXY_TARGET_USER_PASS);
// we're always going to have about 20 to 50 bytes of information, plus
// the target host:port, plus the option authorization info data
int size = 100 + target.length + ((null != authInfo) ? authInfo.length : 0);
WsByteBuffer buffer = ChannelFrameworkFactory.getBufferManager().allocate(size);
buffer.put(PROXY_CONNECT);
buffer.put(target);
buffer.put(PROXY_HTTPVERSION);
// Has authentication info. been provided
if (null != authInfo) {
buffer.put(PROXY_AUTHORIZATION);
buffer.put(authInfo);
buffer.put(PROXY_CRLF);
}
buffer.put(PROXY_CRLF);
buffer.flip();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
byte[] output = new byte[buffer.limit()];
buffer.get(output);
Tr.debug(tc, "ForwardProxyBuffers[" + new String(output) + "]");
buffer.position(0);
}
connLink.getWriteInterface().setBuffer(buffer);
return true;
} } | public class class_name {
protected boolean setForwardProxyBuffers(Map<Object, Object> config) {
byte[] target = (byte[]) config.get(PROXY_TARGET_HOST_PORT);
if (null == target) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Proxy tunnel attempt missing target host"); // depends on control dependency: [if], data = [none]
}
connLink.connectFailed(new IOException("Missing forward proxy target host")); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
byte[] authInfo = (byte[]) config.get(PROXY_TARGET_USER_PASS);
// we're always going to have about 20 to 50 bytes of information, plus
// the target host:port, plus the option authorization info data
int size = 100 + target.length + ((null != authInfo) ? authInfo.length : 0);
WsByteBuffer buffer = ChannelFrameworkFactory.getBufferManager().allocate(size);
buffer.put(PROXY_CONNECT);
buffer.put(target);
buffer.put(PROXY_HTTPVERSION);
// Has authentication info. been provided
if (null != authInfo) {
buffer.put(PROXY_AUTHORIZATION); // depends on control dependency: [if], data = [none]
buffer.put(authInfo); // depends on control dependency: [if], data = [authInfo)]
buffer.put(PROXY_CRLF); // depends on control dependency: [if], data = [none]
}
buffer.put(PROXY_CRLF);
buffer.flip();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
byte[] output = new byte[buffer.limit()];
buffer.get(output); // depends on control dependency: [if], data = [none]
Tr.debug(tc, "ForwardProxyBuffers[" + new String(output) + "]"); // depends on control dependency: [if], data = [none]
buffer.position(0); // depends on control dependency: [if], data = [none]
}
connLink.getWriteInterface().setBuffer(buffer);
return true;
} } |
public class class_name {
public void addPlugin(final Plugin plugin) {
// put plugin into the repository's reciever map
synchronized (pluginMap) {
String name = plugin.getName();
// make sure the plugin has reference to repository
plugin.setLoggerRepository(getLoggerRepository());
Plugin existingPlugin = (Plugin) pluginMap.get(name);
if (existingPlugin != null) {
existingPlugin.shutdown();
}
// put the new plugin into the map
pluginMap.put(name, plugin);
firePluginStarted(plugin);
}
} } | public class class_name {
public void addPlugin(final Plugin plugin) {
// put plugin into the repository's reciever map
synchronized (pluginMap) {
String name = plugin.getName();
// make sure the plugin has reference to repository
plugin.setLoggerRepository(getLoggerRepository());
Plugin existingPlugin = (Plugin) pluginMap.get(name);
if (existingPlugin != null) {
existingPlugin.shutdown(); // depends on control dependency: [if], data = [none]
}
// put the new plugin into the map
pluginMap.put(name, plugin);
firePluginStarted(plugin);
}
} } |
public class class_name {
public DepTreeRoot mapDependencies(DepTreeRoot root, Map<String, URI> map, boolean failIfNoExist) {
// For each config path entry...
for (Entry<String, URI> configPathEntry : map.entrySet()) {
String name = configPathEntry.getKey();
// make sure name is valid
if (name.startsWith("/")) { //$NON-NLS-1$
log.severe(
MessageFormat.format(
Messages.DepTree_8,
new Object[]{name}
)
);
throw new IllegalArgumentException(name);
}
// make sure no relative path components (./ ore ../).
for (String part : name.split("/")) { //$NON-NLS-1$
if (part.startsWith(".")) { //$NON-NLS-1$
log.severe(
MessageFormat.format(
Messages.DepTree_9,
new Object[]{name}
)
);
throw new IllegalArgumentException(name);
}
}
URI filePath = configPathEntry.getValue();
/*
* Get the root node corresponding to the entry's file path from the
* map. This node does not have any resolved references and the
* module names in the dependency lists may contain relative paths.
* Note that the node may be null if the config specifies a path
* that is not found.
*/
DepTreeNode source = DepUtils.getNodeForResource(filePath, depMap);
if (source != null) {
// Create the child node for this entry's package/path name
DepTreeNode target = root.createOrGet(name, filePath);
/*
* Clone the tree and copy the cloned node's children to the
* target node.
*/
DepTreeNode temp = null;
try {
temp = source.clone();
} catch (CloneNotSupportedException e) {
// won't happen, but the language requires us to handle it.
e.printStackTrace();
}
target.overlay(temp);
} else if (failIfNoExist) {
throw new IllegalStateException("Missing required resource: " + filePath); //$NON-NLS-1$
}
}
return root;
} } | public class class_name {
public DepTreeRoot mapDependencies(DepTreeRoot root, Map<String, URI> map, boolean failIfNoExist) {
// For each config path entry...
for (Entry<String, URI> configPathEntry : map.entrySet()) {
String name = configPathEntry.getKey();
// make sure name is valid
if (name.startsWith("/")) { //$NON-NLS-1$
log.severe(
MessageFormat.format(
Messages.DepTree_8,
new Object[]{name}
)
);
// depends on control dependency: [if], data = [none]
throw new IllegalArgumentException(name);
}
// make sure no relative path components (./ ore ../).
for (String part : name.split("/")) { //$NON-NLS-1$
if (part.startsWith(".")) { //$NON-NLS-1$
log.severe(
MessageFormat.format(
Messages.DepTree_9,
new Object[]{name}
)
);
// depends on control dependency: [if], data = [none]
throw new IllegalArgumentException(name);
}
}
URI filePath = configPathEntry.getValue();
/*
* Get the root node corresponding to the entry's file path from the
* map. This node does not have any resolved references and the
* module names in the dependency lists may contain relative paths.
* Note that the node may be null if the config specifies a path
* that is not found.
*/
DepTreeNode source = DepUtils.getNodeForResource(filePath, depMap);
if (source != null) {
// Create the child node for this entry's package/path name
DepTreeNode target = root.createOrGet(name, filePath);
/*
* Clone the tree and copy the cloned node's children to the
* target node.
*/
DepTreeNode temp = null;
try {
temp = source.clone();
// depends on control dependency: [try], data = [none]
} catch (CloneNotSupportedException e) {
// won't happen, but the language requires us to handle it.
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
target.overlay(temp);
// depends on control dependency: [if], data = [none]
} else if (failIfNoExist) {
throw new IllegalStateException("Missing required resource: " + filePath); //$NON-NLS-1$
}
}
return root;
} } |
public class class_name {
static TaskInstance createTaskInstance(Long taskId, String masterRequestId, Long processInstanceId,
String secondaryOwner, Long secondaryOwnerId, String title, String comments,
int dueInSeconds, Map<String,String> indexes, String assignee)
throws ServiceException, DataAccessException {
TaskTemplate task = TaskTemplateCache.getTaskTemplate(taskId);
String label = task.getLabel();
Package taskPkg = PackageCache.getTaskTemplatePackage(taskId);
if (taskPkg != null && !taskPkg.isDefaultPackage())
label = taskPkg.getLabel() + "/" + label;
Instant due = null;
dueInSeconds = dueInSeconds > 0 ? dueInSeconds : task.getSlaSeconds();
if (dueInSeconds > 0)
due = Instant.now().plusSeconds(dueInSeconds);
int pri = 0;
// use the prioritization strategy if one is defined for the task
try {
PrioritizationStrategy prioritizationStrategy = getPrioritizationStrategy(task, processInstanceId, indexes);
if (prioritizationStrategy != null) {
Date calcDueDate = prioritizationStrategy.determineDueDate(task);
if (calcDueDate != null)
due = calcDueDate.toInstant();
pri = prioritizationStrategy.determinePriority(task, due == null ? null : Date.from(due));
}
}
catch (Exception ex) {
throw new ServiceException(ex.getMessage(), ex);
}
TaskInstance ti = createTaskInstance(taskId, masterRequestId, OwnerType.PROCESS_INSTANCE,
processInstanceId, secondaryOwner, secondaryOwnerId, label, title, comments, due, pri);
ti.setTaskName(task.getTaskName()); // Reset task name back (without package name pre-pended)
TaskWorkflowHelper helper = new TaskWorkflowHelper(ti);
if (due != null) {
int alertInterval = 0; //initialize
String alertIntervalString = ""; //initialize
alertIntervalString = task.getAttribute(TaskAttributeConstant.ALERT_INTERVAL);
alertInterval = StringHelper.isEmpty(alertIntervalString)?0:Integer.parseInt(alertIntervalString);
helper.scheduleTaskSlaEvent(Date.from(due), alertInterval, false);
}
// create instance indices for template based general tasks (MDW 5.1) and all template based tasks (MDW 5.2)
if (indexes!=null && !indexes.isEmpty()) {
new TaskDataAccess().setTaskInstanceIndices(helper.getTaskInstance().getTaskInstanceId(), indexes);
}
// create instance groups for template based tasks
List<String> groups = helper.determineWorkgroups(indexes);
if (groups != null && groups.size() >0) {
new TaskDataAccess().setTaskInstanceGroups(ti.getTaskInstanceId(), StringHelper.toStringArray(groups));
helper.getTaskInstance().setWorkgroups(groups);
}
if (assignee != null) {
try
{
User user = UserGroupCache.getUser(assignee);
if(user == null)
throw new ServiceException("Assignee user not found to perform auto-assign : " + assignee);
helper.assign(user.getId()); // Performing auto assign on summary
}
catch (CachingException e)
{
logger.severeException(e.getMessage(), e);
}
}
helper.getTaskInstance().setTaskInstanceUrl(helper.getTaskInstanceUrl());
helper.notifyTaskAction(TaskAction.CREATE, null, null); // notification/observer/auto-assign
helper.auditLog("Create", "MDW");
TaskRuntimeContext runtimeContext = helper.getContext();
helper.setIndexes(runtimeContext);
List<SubTask> subtasks = helper.getSubtaskList(runtimeContext);
if (subtasks != null && !subtasks.isEmpty())
helper.createSubtasks(subtasks, runtimeContext);
return ti;
} } | public class class_name {
static TaskInstance createTaskInstance(Long taskId, String masterRequestId, Long processInstanceId,
String secondaryOwner, Long secondaryOwnerId, String title, String comments,
int dueInSeconds, Map<String,String> indexes, String assignee)
throws ServiceException, DataAccessException {
TaskTemplate task = TaskTemplateCache.getTaskTemplate(taskId);
String label = task.getLabel();
Package taskPkg = PackageCache.getTaskTemplatePackage(taskId);
if (taskPkg != null && !taskPkg.isDefaultPackage())
label = taskPkg.getLabel() + "/" + label;
Instant due = null;
dueInSeconds = dueInSeconds > 0 ? dueInSeconds : task.getSlaSeconds();
if (dueInSeconds > 0)
due = Instant.now().plusSeconds(dueInSeconds);
int pri = 0;
// use the prioritization strategy if one is defined for the task
try {
PrioritizationStrategy prioritizationStrategy = getPrioritizationStrategy(task, processInstanceId, indexes);
if (prioritizationStrategy != null) {
Date calcDueDate = prioritizationStrategy.determineDueDate(task);
if (calcDueDate != null)
due = calcDueDate.toInstant();
pri = prioritizationStrategy.determinePriority(task, due == null ? null : Date.from(due)); // depends on control dependency: [if], data = [none]
}
}
catch (Exception ex) {
throw new ServiceException(ex.getMessage(), ex);
}
TaskInstance ti = createTaskInstance(taskId, masterRequestId, OwnerType.PROCESS_INSTANCE,
processInstanceId, secondaryOwner, secondaryOwnerId, label, title, comments, due, pri);
ti.setTaskName(task.getTaskName()); // Reset task name back (without package name pre-pended)
TaskWorkflowHelper helper = new TaskWorkflowHelper(ti);
if (due != null) {
int alertInterval = 0; //initialize
String alertIntervalString = ""; //initialize
alertIntervalString = task.getAttribute(TaskAttributeConstant.ALERT_INTERVAL);
alertInterval = StringHelper.isEmpty(alertIntervalString)?0:Integer.parseInt(alertIntervalString);
helper.scheduleTaskSlaEvent(Date.from(due), alertInterval, false);
}
// create instance indices for template based general tasks (MDW 5.1) and all template based tasks (MDW 5.2)
if (indexes!=null && !indexes.isEmpty()) {
new TaskDataAccess().setTaskInstanceIndices(helper.getTaskInstance().getTaskInstanceId(), indexes);
}
// create instance groups for template based tasks
List<String> groups = helper.determineWorkgroups(indexes);
if (groups != null && groups.size() >0) {
new TaskDataAccess().setTaskInstanceGroups(ti.getTaskInstanceId(), StringHelper.toStringArray(groups));
helper.getTaskInstance().setWorkgroups(groups);
}
if (assignee != null) {
try
{
User user = UserGroupCache.getUser(assignee);
if(user == null)
throw new ServiceException("Assignee user not found to perform auto-assign : " + assignee);
helper.assign(user.getId()); // Performing auto assign on summary
}
catch (CachingException e)
{
logger.severeException(e.getMessage(), e);
}
}
helper.getTaskInstance().setTaskInstanceUrl(helper.getTaskInstanceUrl());
helper.notifyTaskAction(TaskAction.CREATE, null, null); // notification/observer/auto-assign
helper.auditLog("Create", "MDW");
TaskRuntimeContext runtimeContext = helper.getContext();
helper.setIndexes(runtimeContext);
List<SubTask> subtasks = helper.getSubtaskList(runtimeContext);
if (subtasks != null && !subtasks.isEmpty())
helper.createSubtasks(subtasks, runtimeContext);
return ti;
} } |
public class class_name {
@Override
public boolean validateAction(String action) {
boolean result = false;
if (action.equals(MessagingSecurityConstants.OPERATION_TYPE_SEND) ||
action.equals(MessagingSecurityConstants.OPERATION_TYPE_RECEIVE)) {
result = true;
}
return result;
} } | public class class_name {
@Override
public boolean validateAction(String action) {
boolean result = false;
if (action.equals(MessagingSecurityConstants.OPERATION_TYPE_SEND) ||
action.equals(MessagingSecurityConstants.OPERATION_TYPE_RECEIVE)) {
result = true; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public BufferedImage createImage() {
BufferedImage image = null;
Graphics2D graphics = null;
for (int layer = 0; layer < 4; layer++) {
BufferedImage layerImage = layeredImage[layer];
if (layerImage != null) {
if (image == null) {
image = layerImage;
graphics = layeredGraphics[layer];
} else {
graphics.drawImage(layerImage, 0, 0, null);
layeredGraphics[layer].dispose();
layerImage.flush();
}
layeredImage[layer] = null;
layeredGraphics[layer] = null;
}
}
if (graphics != null) {
graphics.dispose();
}
return image;
} } | public class class_name {
public BufferedImage createImage() {
BufferedImage image = null;
Graphics2D graphics = null;
for (int layer = 0; layer < 4; layer++) {
BufferedImage layerImage = layeredImage[layer];
if (layerImage != null) {
if (image == null) {
image = layerImage; // depends on control dependency: [if], data = [none]
graphics = layeredGraphics[layer]; // depends on control dependency: [if], data = [none]
} else {
graphics.drawImage(layerImage, 0, 0, null); // depends on control dependency: [if], data = [null)]
layeredGraphics[layer].dispose(); // depends on control dependency: [if], data = [none]
layerImage.flush(); // depends on control dependency: [if], data = [none]
}
layeredImage[layer] = null; // depends on control dependency: [if], data = [none]
layeredGraphics[layer] = null; // depends on control dependency: [if], data = [none]
}
}
if (graphics != null) {
graphics.dispose(); // depends on control dependency: [if], data = [none]
}
return image;
} } |
public class class_name {
@Override
public Menu getContextMenu() {
if (menu == null) {
menu = new Menu();
menu.addItem(new NewFeatureAction(mapWidget, this));
menu.addItem(new EditFeatureAction(mapWidget, this));
menu.addItem(new DeleteFeatureAction(mapWidget, this));
menu.addItem(new MenuItemSeparator());
menu.addItem(new DeselectAllAction(mapWidget.getMapModel()));
}
return menu;
} } | public class class_name {
@Override
public Menu getContextMenu() {
if (menu == null) {
menu = new Menu(); // depends on control dependency: [if], data = [none]
menu.addItem(new NewFeatureAction(mapWidget, this)); // depends on control dependency: [if], data = [none]
menu.addItem(new EditFeatureAction(mapWidget, this)); // depends on control dependency: [if], data = [none]
menu.addItem(new DeleteFeatureAction(mapWidget, this)); // depends on control dependency: [if], data = [none]
menu.addItem(new MenuItemSeparator()); // depends on control dependency: [if], data = [none]
menu.addItem(new DeselectAllAction(mapWidget.getMapModel())); // depends on control dependency: [if], data = [none]
}
return menu;
} } |
public class class_name {
public static <T> T[] sub(T[] array, int start, int end) {
int length = length(array);
if (start < 0) {
start += length;
}
if (end < 0) {
end += length;
}
if (start == length) {
return newArray(array.getClass().getComponentType(), 0);
}
if (start > end) {
int tmp = start;
start = end;
end = tmp;
}
if (end > length) {
if (start >= length) {
return newArray(array.getClass().getComponentType(), 0);
}
end = length;
}
return Arrays.copyOfRange(array, start, end);
} } | public class class_name {
public static <T> T[] sub(T[] array, int start, int end) {
int length = length(array);
if (start < 0) {
start += length;
// depends on control dependency: [if], data = [none]
}
if (end < 0) {
end += length;
// depends on control dependency: [if], data = [none]
}
if (start == length) {
return newArray(array.getClass().getComponentType(), 0);
// depends on control dependency: [if], data = [none]
}
if (start > end) {
int tmp = start;
start = end;
// depends on control dependency: [if], data = [none]
end = tmp;
// depends on control dependency: [if], data = [none]
}
if (end > length) {
if (start >= length) {
return newArray(array.getClass().getComponentType(), 0);
// depends on control dependency: [if], data = [none]
}
end = length;
// depends on control dependency: [if], data = [none]
}
return Arrays.copyOfRange(array, start, end);
} } |
public class class_name {
public void setColumnCellStyles (int column, String... styles)
{
int rowCount = getRowCount();
for (int row = 0; row < rowCount; ++row) {
setStyleNames(row, column, styles);
}
} } | public class class_name {
public void setColumnCellStyles (int column, String... styles)
{
int rowCount = getRowCount();
for (int row = 0; row < rowCount; ++row) {
setStyleNames(row, column, styles); // depends on control dependency: [for], data = [row]
}
} } |
public class class_name {
public boolean isEdge(GeometryIndex index) {
if (index.hasChild()) {
return isEdge(index.getChild());
}
return index.getType() == GeometryIndexType.TYPE_EDGE;
} } | public class class_name {
public boolean isEdge(GeometryIndex index) {
if (index.hasChild()) {
return isEdge(index.getChild()); // depends on control dependency: [if], data = [none]
}
return index.getType() == GeometryIndexType.TYPE_EDGE;
} } |
public class class_name {
void realloc(boolean throwIfFail) {
// Double the capacity while it is "sufficiently small", and otherwise increase by 50%.
int newLength = capacity <= 65536 ? capacity << 1 : capacity + capacity >> 1;
try {
ByteBuffer buffer = Buffer.allocateDirectWithNativeOrder(calculateBufferCapacity(newLength));
// Copy over the old content of the memory and reset the position as we always act on the buffer as if
// the position was never increased.
memory.position(0).limit(size);
buffer.put(memory);
buffer.position(0);
Buffer.free(memory);
memory = buffer;
memoryAddress = Buffer.memoryAddress(buffer);
} catch (OutOfMemoryError e) {
if (throwIfFail) {
OutOfMemoryError error = new OutOfMemoryError(
"unable to allocate " + newLength + " new bytes! Existing capacity is: " + capacity);
error.initCause(e);
throw error;
}
}
} } | public class class_name {
void realloc(boolean throwIfFail) {
// Double the capacity while it is "sufficiently small", and otherwise increase by 50%.
int newLength = capacity <= 65536 ? capacity << 1 : capacity + capacity >> 1;
try {
ByteBuffer buffer = Buffer.allocateDirectWithNativeOrder(calculateBufferCapacity(newLength));
// Copy over the old content of the memory and reset the position as we always act on the buffer as if
// the position was never increased.
memory.position(0).limit(size); // depends on control dependency: [try], data = [none]
buffer.put(memory); // depends on control dependency: [try], data = [none]
buffer.position(0); // depends on control dependency: [try], data = [none]
Buffer.free(memory); // depends on control dependency: [try], data = [none]
memory = buffer; // depends on control dependency: [try], data = [none]
memoryAddress = Buffer.memoryAddress(buffer); // depends on control dependency: [try], data = [none]
} catch (OutOfMemoryError e) {
if (throwIfFail) {
OutOfMemoryError error = new OutOfMemoryError(
"unable to allocate " + newLength + " new bytes! Existing capacity is: " + capacity);
error.initCause(e); // depends on control dependency: [if], data = [none]
throw error;
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public boolean removeFirstOccurrence(DelayedEntry incoming) {
Data incomingKey = (Data) incoming.getKey();
Object incomingValue = incoming.getValue();
DelayedEntry current = map.get(incomingKey);
if (current == null) {
return false;
}
Object currentValue = current.getValue();
if (incomingValue == null && currentValue == null
|| incomingValue != null && currentValue != null && incomingValue.equals(currentValue)) {
map.remove(incomingKey);
return true;
}
return false;
} } | public class class_name {
@Override
public boolean removeFirstOccurrence(DelayedEntry incoming) {
Data incomingKey = (Data) incoming.getKey();
Object incomingValue = incoming.getValue();
DelayedEntry current = map.get(incomingKey);
if (current == null) {
return false; // depends on control dependency: [if], data = [none]
}
Object currentValue = current.getValue();
if (incomingValue == null && currentValue == null
|| incomingValue != null && currentValue != null && incomingValue.equals(currentValue)) {
map.remove(incomingKey); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void setParent(Model parent) {
if (parent == this) {
throw new IllegalArgumentException("The model can't be its own parent");
}
if (parent == null) {
this.parent.children.remove(this);
} else {
parent.children.add(this);
}
this.parent = parent;
} } | public class class_name {
public void setParent(Model parent) {
if (parent == this) {
throw new IllegalArgumentException("The model can't be its own parent");
}
if (parent == null) {
this.parent.children.remove(this); // depends on control dependency: [if], data = [none]
} else {
parent.children.add(this); // depends on control dependency: [if], data = [none]
}
this.parent = parent;
} } |
public class class_name {
public final ProtoParser.rpc_body_block_return rpc_body_block(Proto proto, Service.RpcMethod rm) throws RecognitionException {
ProtoParser.rpc_body_block_return retval = new ProtoParser.rpc_body_block_return();
retval.start = input.LT(1);
Object root_0 = null;
Token LEFTCURLY154=null;
Token RIGHTCURLY156=null;
ProtoParser.option_entry_return option_entry155 = null;
Object LEFTCURLY154_tree=null;
Object RIGHTCURLY156_tree=null;
try {
// com/dyuproject/protostuff/parser/ProtoParser.g:604:5: ( LEFTCURLY ( option_entry[proto, rm] )* RIGHTCURLY )
// com/dyuproject/protostuff/parser/ProtoParser.g:604:9: LEFTCURLY ( option_entry[proto, rm] )* RIGHTCURLY
{
root_0 = (Object)adaptor.nil();
LEFTCURLY154=(Token)match(input,LEFTCURLY,FOLLOW_LEFTCURLY_in_rpc_body_block2475); if (state.failed) return retval;
if ( state.backtracking==0 ) {
LEFTCURLY154_tree = (Object)adaptor.create(LEFTCURLY154);
adaptor.addChild(root_0, LEFTCURLY154_tree);
}
// com/dyuproject/protostuff/parser/ProtoParser.g:604:19: ( option_entry[proto, rm] )*
loop33:
do {
int alt33=2;
switch ( input.LA(1) ) {
case OPTION:
{
alt33=1;
}
break;
}
switch (alt33) {
case 1 :
// com/dyuproject/protostuff/parser/ProtoParser.g:604:19: option_entry[proto, rm]
{
pushFollow(FOLLOW_option_entry_in_rpc_body_block2477);
option_entry155=option_entry(proto, rm);
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) adaptor.addChild(root_0, option_entry155.getTree());
}
break;
default :
break loop33;
}
} while (true);
RIGHTCURLY156=(Token)match(input,RIGHTCURLY,FOLLOW_RIGHTCURLY_in_rpc_body_block2481); if (state.failed) return retval;
if ( state.backtracking==0 ) {
RIGHTCURLY156_tree = (Object)adaptor.create(RIGHTCURLY156);
adaptor.addChild(root_0, RIGHTCURLY156_tree);
}
if ( state.backtracking==0 ) {
if(!proto.annotations.isEmpty())
throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
}
}
retval.stop = input.LT(-1);
if ( state.backtracking==0 ) {
retval.tree = (Object)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
}
return retval;
} } | public class class_name {
public final ProtoParser.rpc_body_block_return rpc_body_block(Proto proto, Service.RpcMethod rm) throws RecognitionException {
ProtoParser.rpc_body_block_return retval = new ProtoParser.rpc_body_block_return();
retval.start = input.LT(1);
Object root_0 = null;
Token LEFTCURLY154=null;
Token RIGHTCURLY156=null;
ProtoParser.option_entry_return option_entry155 = null;
Object LEFTCURLY154_tree=null;
Object RIGHTCURLY156_tree=null;
try {
// com/dyuproject/protostuff/parser/ProtoParser.g:604:5: ( LEFTCURLY ( option_entry[proto, rm] )* RIGHTCURLY )
// com/dyuproject/protostuff/parser/ProtoParser.g:604:9: LEFTCURLY ( option_entry[proto, rm] )* RIGHTCURLY
{
root_0 = (Object)adaptor.nil();
LEFTCURLY154=(Token)match(input,LEFTCURLY,FOLLOW_LEFTCURLY_in_rpc_body_block2475); if (state.failed) return retval;
if ( state.backtracking==0 ) {
LEFTCURLY154_tree = (Object)adaptor.create(LEFTCURLY154); // depends on control dependency: [if], data = [none]
adaptor.addChild(root_0, LEFTCURLY154_tree); // depends on control dependency: [if], data = [none]
}
// com/dyuproject/protostuff/parser/ProtoParser.g:604:19: ( option_entry[proto, rm] )*
loop33:
do {
int alt33=2;
switch ( input.LA(1) ) {
case OPTION:
{
alt33=1;
}
break;
}
switch (alt33) {
case 1 :
// com/dyuproject/protostuff/parser/ProtoParser.g:604:19: option_entry[proto, rm]
{
pushFollow(FOLLOW_option_entry_in_rpc_body_block2477);
option_entry155=option_entry(proto, rm);
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) adaptor.addChild(root_0, option_entry155.getTree());
}
break;
default :
break loop33;
}
} while (true);
RIGHTCURLY156=(Token)match(input,RIGHTCURLY,FOLLOW_RIGHTCURLY_in_rpc_body_block2481); if (state.failed) return retval;
if ( state.backtracking==0 ) {
RIGHTCURLY156_tree = (Object)adaptor.create(RIGHTCURLY156);
adaptor.addChild(root_0, RIGHTCURLY156_tree);
}
if ( state.backtracking==0 ) {
if(!proto.annotations.isEmpty())
throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
}
}
retval.stop = input.LT(-1);
if ( state.backtracking==0 ) {
retval.tree = (Object)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
}
return retval;
} } |
public class class_name {
public static PrivateKey readPasswordProtectedPrivateKey(final File encryptedPrivateKeyFile,
final String password, final String algorithm)
throws IOException, NoSuchAlgorithmException, NoSuchPaddingException,
InvalidKeySpecException, InvalidKeyException, InvalidAlgorithmParameterException
{
byte[] encryptedPrivateKeyBytes = null;
boolean pemFormat = PrivateKeyReader.isPemFormat(encryptedPrivateKeyFile);
if (pemFormat)
{
KeyPair keyPair = getKeyPair(encryptedPrivateKeyFile, password);
if (keyPair != null)
{
return keyPair.getPrivate();
}
}
else
{
encryptedPrivateKeyBytes = Files.readAllBytes(encryptedPrivateKeyFile.toPath());
return readPasswordProtectedPrivateKey(encryptedPrivateKeyBytes, password, algorithm);
}
return null;
} } | public class class_name {
public static PrivateKey readPasswordProtectedPrivateKey(final File encryptedPrivateKeyFile,
final String password, final String algorithm)
throws IOException, NoSuchAlgorithmException, NoSuchPaddingException,
InvalidKeySpecException, InvalidKeyException, InvalidAlgorithmParameterException
{
byte[] encryptedPrivateKeyBytes = null;
boolean pemFormat = PrivateKeyReader.isPemFormat(encryptedPrivateKeyFile);
if (pemFormat)
{
KeyPair keyPair = getKeyPair(encryptedPrivateKeyFile, password);
if (keyPair != null)
{
return keyPair.getPrivate(); // depends on control dependency: [if], data = [none]
}
}
else
{
encryptedPrivateKeyBytes = Files.readAllBytes(encryptedPrivateKeyFile.toPath());
return readPasswordProtectedPrivateKey(encryptedPrivateKeyBytes, password, algorithm);
}
return null;
} } |
public class class_name {
public static void newRecord(HashMap m, String path) {
if( path != null ) {
String[] paths = path.split(",");
int l = paths.length;
for(int i=0; i < l; i++) {
if( paths[i].contains("@") ) {
String temp[] = paths[i].split("[@!]");
buildPath(m, paths[i]);
HashMap pointer = traverseToPoint(m, temp[0]);
ArrayList a = (ArrayList) pointer.get(temp[1]);
a.add(new HashMap());
}
}
}
} } | public class class_name {
public static void newRecord(HashMap m, String path) {
if( path != null ) {
String[] paths = path.split(",");
int l = paths.length;
for(int i=0; i < l; i++) {
if( paths[i].contains("@") ) {
String temp[] = paths[i].split("[@!]");
buildPath(m, paths[i]); // depends on control dependency: [if], data = [none]
HashMap pointer = traverseToPoint(m, temp[0]);
ArrayList a = (ArrayList) pointer.get(temp[1]);
a.add(new HashMap()); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public RValue[] execute(QualifiedName name, Type.Callable signature, CallStack frame, RValue... args) {
Decl.Callable lambda = frame.getCallable(name, signature);
if (lambda == null) {
throw new IllegalArgumentException("no function or method found: " + name + ", " + signature);
} else if (lambda.getParameters().size() != args.length) {
throw new IllegalArgumentException(
"incorrect number of arguments: " + lambda.getName() + ", " + lambda.getType());
}
// Fourth, construct the stack frame for execution
frame = frame.enter(lambda);
extractParameters(frame,args,lambda);
// Check the precondition
if(lambda instanceof Decl.FunctionOrMethod) {
Decl.FunctionOrMethod fm = (Decl.FunctionOrMethod) lambda;
checkInvariants(frame,fm.getRequires());
// check function or method body exists
if (fm.getBody() == null) {
// FIXME: Add support for native functions or methods. That is,
// allow native functions to be implemented and called from the
// interpreter.
throw new IllegalArgumentException("no function or method body found: " + name + ", " + signature);
}
// Execute the method or function body
executeBlock(fm.getBody(), frame, new FunctionOrMethodScope(fm));
// Extra the return values
RValue[] returns = packReturns(frame,lambda);
// Restore original parameter values
extractParameters(frame,args,lambda);
// Check the postcondition holds
checkInvariants(frame, fm.getEnsures());
return returns;
} else {
// Properties always return true (provided their preconditions hold)
return new RValue[]{RValue.True};
}
//
} } | public class class_name {
public RValue[] execute(QualifiedName name, Type.Callable signature, CallStack frame, RValue... args) {
Decl.Callable lambda = frame.getCallable(name, signature);
if (lambda == null) {
throw new IllegalArgumentException("no function or method found: " + name + ", " + signature);
} else if (lambda.getParameters().size() != args.length) {
throw new IllegalArgumentException(
"incorrect number of arguments: " + lambda.getName() + ", " + lambda.getType());
}
// Fourth, construct the stack frame for execution
frame = frame.enter(lambda);
extractParameters(frame,args,lambda);
// Check the precondition
if(lambda instanceof Decl.FunctionOrMethod) {
Decl.FunctionOrMethod fm = (Decl.FunctionOrMethod) lambda;
checkInvariants(frame,fm.getRequires()); // depends on control dependency: [if], data = [none]
// check function or method body exists
if (fm.getBody() == null) {
// FIXME: Add support for native functions or methods. That is,
// allow native functions to be implemented and called from the
// interpreter.
throw new IllegalArgumentException("no function or method body found: " + name + ", " + signature);
}
// Execute the method or function body
executeBlock(fm.getBody(), frame, new FunctionOrMethodScope(fm)); // depends on control dependency: [if], data = [none]
// Extra the return values
RValue[] returns = packReturns(frame,lambda);
// Restore original parameter values
extractParameters(frame,args,lambda); // depends on control dependency: [if], data = [none]
// Check the postcondition holds
checkInvariants(frame, fm.getEnsures()); // depends on control dependency: [if], data = [none]
return returns; // depends on control dependency: [if], data = [none]
} else {
// Properties always return true (provided their preconditions hold)
return new RValue[]{RValue.True}; // depends on control dependency: [if], data = [none]
}
//
} } |
public class class_name {
@Override
public String getQName(int index) {
if (index < 0 || index >= attributesList.size()) {
return null;
}
Attribute attr = attributesList.get(index);
return (attr.name == null) ? "" : attr.name;
} } | public class class_name {
@Override
public String getQName(int index) {
if (index < 0 || index >= attributesList.size()) {
return null; // depends on control dependency: [if], data = [none]
}
Attribute attr = attributesList.get(index);
return (attr.name == null) ? "" : attr.name;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public <T extends Annotation> T getSetterAnnotation(Method method, Class<T> annotationType) {
T annotation = method.getAnnotation(annotationType);
if (annotation != null) {
return annotation;
}
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
if (parameterAnnotations.length > 0 ) {
for (Annotation anno : parameterAnnotations[0]) {
if (annotationType.isInstance(anno)) {
return (T)anno;
}
}
}
return null;
} } | public class class_name {
@SuppressWarnings("unchecked")
public <T extends Annotation> T getSetterAnnotation(Method method, Class<T> annotationType) {
T annotation = method.getAnnotation(annotationType);
if (annotation != null) {
return annotation; // depends on control dependency: [if], data = [none]
}
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
if (parameterAnnotations.length > 0 ) {
for (Annotation anno : parameterAnnotations[0]) {
if (annotationType.isInstance(anno)) {
return (T)anno; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
private String getCropName(Map result) {
String ret;
String crid;
// Get crop id
crid = getCrid(result);
// Get crop name string
ret = LookupCodes.lookupCode("CRID", crid, "common", "DSSAT");
if (ret.equals(crid)) {
ret = "Unkown";
sbError.append("! Warning: Undefined crop id: [").append(crid).append("]\r\n");
}
// // Get crop name string
// if ("BH".equals(crid)) {
// ret = "Bahia";
// } else if ("BA".equals(crid)) {
// ret = "Barley";
// } else if ("BR".equals(crid)) {
// ret = "Brachiaria";
// } else if ("CB".equals(crid)) {
// ret = "Cabbage";
// } else if ("CS".equals(crid)) {
// ret = "Cassava";
// } else if ("CH".equals(crid)) {
// ret = "Chickpea";
// } else if ("CO".equals(crid)) {
// ret = "Cotton";
// } else if ("CP".equals(crid)) {
// ret = "Cowpea";
// } else if ("BN".equals(crid)) {
// ret = "Drybean";
// } else if ("FB".equals(crid)) {
// ret = "FabaBean";
// } else if ("FA".equals(crid)) {
// ret = "Fallow";
// } else if ("GB".equals(crid)) {
// ret = "GreenBean";
// } else if ("MZ".equals(crid)) {
// ret = "Maize";
// } else if ("ML".equals(crid)) {
// ret = "Millet";
// } else if ("PN".equals(crid)) {
// ret = "Peanut";
// } else if ("PR".equals(crid)) {
// ret = "Pepper";
// } else if ("PI".equals(crid)) {
// ret = "PineApple";
// } else if ("PT".equals(crid)) {
// ret = "Potato";
// } else if ("RI".equals(crid)) {
// ret = "Rice";
// } else if ("SG".equals(crid)) {
// ret = "Sorghum";
// } else if ("SB".equals(crid)) {
// ret = "Soybean";
// } else if ("SC".equals(crid)) {
// ret = "Sugarcane";
// } else if ("SU".equals(crid)) {
// ret = "Sunflower";
// } else if ("SW".equals(crid)) {
// ret = "SweetCorn";
// } else if ("TN".equals(crid)) {
// ret = "Tanier";
// } else if ("TR".equals(crid)) {
// ret = "Taro";
// } else if ("TM".equals(crid)) {
// ret = "Tomato";
// } else if ("VB".equals(crid)) {
// ret = "Velvetbean";
// } else if ("WH".equals(crid)) {
// ret = "Wheat";
// } else if ("SQ".equals(crid)) {
// ret = "Sequence";
// } else {
// ret = "Unkown";
// sbError.append("! Warning: Undefined crop id: [").append(crid).append("]\r\n");
// }
return ret;
} } | public class class_name {
private String getCropName(Map result) {
String ret;
String crid;
// Get crop id
crid = getCrid(result);
// Get crop name string
ret = LookupCodes.lookupCode("CRID", crid, "common", "DSSAT");
if (ret.equals(crid)) {
ret = "Unkown"; // depends on control dependency: [if], data = [none]
sbError.append("! Warning: Undefined crop id: [").append(crid).append("]\r\n"); // depends on control dependency: [if], data = [none]
}
// // Get crop name string
// if ("BH".equals(crid)) {
// ret = "Bahia";
// } else if ("BA".equals(crid)) {
// ret = "Barley";
// } else if ("BR".equals(crid)) {
// ret = "Brachiaria";
// } else if ("CB".equals(crid)) {
// ret = "Cabbage";
// } else if ("CS".equals(crid)) {
// ret = "Cassava";
// } else if ("CH".equals(crid)) {
// ret = "Chickpea";
// } else if ("CO".equals(crid)) {
// ret = "Cotton";
// } else if ("CP".equals(crid)) {
// ret = "Cowpea";
// } else if ("BN".equals(crid)) {
// ret = "Drybean";
// } else if ("FB".equals(crid)) {
// ret = "FabaBean";
// } else if ("FA".equals(crid)) {
// ret = "Fallow";
// } else if ("GB".equals(crid)) {
// ret = "GreenBean";
// } else if ("MZ".equals(crid)) {
// ret = "Maize";
// } else if ("ML".equals(crid)) {
// ret = "Millet";
// } else if ("PN".equals(crid)) {
// ret = "Peanut";
// } else if ("PR".equals(crid)) {
// ret = "Pepper";
// } else if ("PI".equals(crid)) {
// ret = "PineApple";
// } else if ("PT".equals(crid)) {
// ret = "Potato";
// } else if ("RI".equals(crid)) {
// ret = "Rice";
// } else if ("SG".equals(crid)) {
// ret = "Sorghum";
// } else if ("SB".equals(crid)) {
// ret = "Soybean";
// } else if ("SC".equals(crid)) {
// ret = "Sugarcane";
// } else if ("SU".equals(crid)) {
// ret = "Sunflower";
// } else if ("SW".equals(crid)) {
// ret = "SweetCorn";
// } else if ("TN".equals(crid)) {
// ret = "Tanier";
// } else if ("TR".equals(crid)) {
// ret = "Taro";
// } else if ("TM".equals(crid)) {
// ret = "Tomato";
// } else if ("VB".equals(crid)) {
// ret = "Velvetbean";
// } else if ("WH".equals(crid)) {
// ret = "Wheat";
// } else if ("SQ".equals(crid)) {
// ret = "Sequence";
// } else {
// ret = "Unkown";
// sbError.append("! Warning: Undefined crop id: [").append(crid).append("]\r\n");
// }
return ret;
} } |
public class class_name {
public void warn( String format, Object arg )
{
if( m_delegate.isWarnEnabled() )
{
FormattingTuple tuple = MessageFormatter.format( format, arg );
m_delegate.warn( tuple.getMessage(), tuple.getThrowable() );
}
} } | public class class_name {
public void warn( String format, Object arg )
{
if( m_delegate.isWarnEnabled() )
{
FormattingTuple tuple = MessageFormatter.format( format, arg );
m_delegate.warn( tuple.getMessage(), tuple.getThrowable() ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Namer getInverseOneToOneNamer(Attribute fromAttribute, Namer fromEntityNamer) {
Namer result = getInverseOneToOneNamerFromConf(fromAttribute.getColumnConfig(), fromEntityNamer);
if (result == null) {
result = fromEntityNamer;
}
return result;
} } | public class class_name {
public Namer getInverseOneToOneNamer(Attribute fromAttribute, Namer fromEntityNamer) {
Namer result = getInverseOneToOneNamerFromConf(fromAttribute.getColumnConfig(), fromEntityNamer);
if (result == null) {
result = fromEntityNamer; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@Override
public WsByteBuffer[] marshallLine() {
WsByteBuffer[] firstLine = new WsByteBuffer[1];
firstLine[0] = allocateBuffer(getOutgoingBufferSize());
firstLine = putBytes(getVersionValue().getByteArray(), firstLine);
firstLine = putByte(SPACE, firstLine);
if (null == this.myReasonBytes) {
// use the default value
firstLine = putBytes(this.myStatusCode.getStatusWithPhrase(), firstLine);
} else {
// put the status code then the phrase
firstLine = putBytes(this.myStatusCode.getByteArray(), firstLine);
firstLine = putByte(SPACE, firstLine);
firstLine = putBytes(getReasonPhraseBytes(), firstLine);
}
firstLine = putBytes(BNFHeaders.EOL, firstLine);
// don't flip the last buffer as headers get tacked on the end
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Marshalling first line: " + getVersion() + " " + getStatusCodeAsInt() + " " + getReasonPhrase());
}
return firstLine;
} } | public class class_name {
@Override
public WsByteBuffer[] marshallLine() {
WsByteBuffer[] firstLine = new WsByteBuffer[1];
firstLine[0] = allocateBuffer(getOutgoingBufferSize());
firstLine = putBytes(getVersionValue().getByteArray(), firstLine);
firstLine = putByte(SPACE, firstLine);
if (null == this.myReasonBytes) {
// use the default value
firstLine = putBytes(this.myStatusCode.getStatusWithPhrase(), firstLine); // depends on control dependency: [if], data = [none]
} else {
// put the status code then the phrase
firstLine = putBytes(this.myStatusCode.getByteArray(), firstLine); // depends on control dependency: [if], data = [none]
firstLine = putByte(SPACE, firstLine); // depends on control dependency: [if], data = [none]
firstLine = putBytes(getReasonPhraseBytes(), firstLine); // depends on control dependency: [if], data = [none]
}
firstLine = putBytes(BNFHeaders.EOL, firstLine);
// don't flip the last buffer as headers get tacked on the end
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Marshalling first line: " + getVersion() + " " + getStatusCodeAsInt() + " " + getReasonPhrase()); // depends on control dependency: [if], data = [none]
}
return firstLine;
} } |
public class class_name {
private JLabel getAddedCountValueLabel() {
if (addedCountValueLabel == null) {
addedCountValueLabel = new JLabel();
addedCountValueLabel.setText(ZERO_REQUESTS_LABEL_TEXT);
}
return addedCountValueLabel;
} } | public class class_name {
private JLabel getAddedCountValueLabel() {
if (addedCountValueLabel == null) {
addedCountValueLabel = new JLabel();
// depends on control dependency: [if], data = [none]
addedCountValueLabel.setText(ZERO_REQUESTS_LABEL_TEXT);
// depends on control dependency: [if], data = [none]
}
return addedCountValueLabel;
} } |
public class class_name {
@JsonIgnore
protected Map<String, List<Object>> getCachedPrincipalAttributes(final Principal principal, final RegisteredService registeredService) {
try {
val cache = getCacheInstanceFromApplicationContext();
return cache.getCachedAttributesFor(registeredService, this, principal);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
return new HashMap<>(0);
} } | public class class_name {
@JsonIgnore
protected Map<String, List<Object>> getCachedPrincipalAttributes(final Principal principal, final RegisteredService registeredService) {
try {
val cache = getCacheInstanceFromApplicationContext();
return cache.getCachedAttributesFor(registeredService, this, principal); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
return new HashMap<>(0);
} } |
public class class_name {
@Override
public Downloader build() {
Downloader underlying = null;
CacheProvider<URI, byte[]> cache = null;
try {
underlying = Objects.requireNonNull(this.underlying.build(), "Underlying downloader builder returns null");
cache = buildCacheProvider();
LOGGER.fine("Using cache provider: " + cache);
return new CachedDownloader(underlying, cache);
} catch (Throwable e) {
if (underlying != null) {
try {
underlying.shutdown();
} catch (Throwable e1) {
e.addSuppressed(e1);
}
}
if (cache != null) {
try {
cache.close();
} catch (Throwable e1) {
e.addSuppressed(e1);
}
}
throw e;
}
} } | public class class_name {
@Override
public Downloader build() {
Downloader underlying = null;
CacheProvider<URI, byte[]> cache = null;
try {
underlying = Objects.requireNonNull(this.underlying.build(), "Underlying downloader builder returns null"); // depends on control dependency: [try], data = [none]
cache = buildCacheProvider(); // depends on control dependency: [try], data = [none]
LOGGER.fine("Using cache provider: " + cache); // depends on control dependency: [try], data = [none]
return new CachedDownloader(underlying, cache); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
if (underlying != null) {
try {
underlying.shutdown(); // depends on control dependency: [try], data = [none]
} catch (Throwable e1) {
e.addSuppressed(e1);
} // depends on control dependency: [catch], data = [none]
}
if (cache != null) {
try {
cache.close(); // depends on control dependency: [try], data = [none]
} catch (Throwable e1) {
e.addSuppressed(e1);
} // depends on control dependency: [catch], data = [none]
}
throw e;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public JaversType getJaversType(Type javaType) {
argumentIsNotNull(javaType);
if (javaType == Object.class) {
return OBJECT_TYPE;
}
return engine.computeIfAbsent(javaType, j -> typeFactory.infer(j, findPrototype(j)));
} } | public class class_name {
public JaversType getJaversType(Type javaType) {
argumentIsNotNull(javaType);
if (javaType == Object.class) {
return OBJECT_TYPE; // depends on control dependency: [if], data = [none]
}
return engine.computeIfAbsent(javaType, j -> typeFactory.infer(j, findPrototype(j)));
} } |
public class class_name {
public long getWaitIndex() {
if (id == null || id.length() != 36) {
return 0;
}
long lower = 0, upper = 0;
for (int i = 0; i < 18; i++) {
if (i != 8 && i != 13) {
lower = lower * 16 + Character.digit(id.charAt(i), 16);
}
}
for (int i = 19; i < 36; i++) {
if (i != 23) {
upper = upper * 16 + Character.digit(id.charAt(i), 16);
}
}
return lower ^ upper;
} } | public class class_name {
public long getWaitIndex() {
if (id == null || id.length() != 36) {
return 0; // depends on control dependency: [if], data = [none]
}
long lower = 0, upper = 0;
for (int i = 0; i < 18; i++) {
if (i != 8 && i != 13) {
lower = lower * 16 + Character.digit(id.charAt(i), 16); // depends on control dependency: [if], data = [(i]
}
}
for (int i = 19; i < 36; i++) {
if (i != 23) {
upper = upper * 16 + Character.digit(id.charAt(i), 16); // depends on control dependency: [if], data = [(i]
}
}
return lower ^ upper;
} } |
public class class_name {
public void setDeferredMaintenanceWindows(java.util.Collection<DeferredMaintenanceWindow> deferredMaintenanceWindows) {
if (deferredMaintenanceWindows == null) {
this.deferredMaintenanceWindows = null;
return;
}
this.deferredMaintenanceWindows = new com.amazonaws.internal.SdkInternalList<DeferredMaintenanceWindow>(deferredMaintenanceWindows);
} } | public class class_name {
public void setDeferredMaintenanceWindows(java.util.Collection<DeferredMaintenanceWindow> deferredMaintenanceWindows) {
if (deferredMaintenanceWindows == null) {
this.deferredMaintenanceWindows = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.deferredMaintenanceWindows = new com.amazonaws.internal.SdkInternalList<DeferredMaintenanceWindow>(deferredMaintenanceWindows);
} } |
public class class_name {
public static void colorizeSign( GrayF32 input , float maxAbsValue , Bitmap output , byte[] storage ) {
shapeShape(input, output);
if( storage == null )
storage = declareStorage(output,null);
if( maxAbsValue < 0 )
maxAbsValue = ImageStatistics.maxAbs(input);
int indexDst = 0;
for( int y = 0; y < input.height; y++ ) {
int indexSrc = input.startIndex + y*input.stride;
for( int x = 0; x < input.width; x++ ) {
float value = input.data[ indexSrc++ ];
if( value > 0 ) {
storage[indexDst++] = (byte) (255f*value/maxAbsValue);
storage[indexDst++] = 0;
storage[indexDst++] = 0;
} else {
storage[indexDst++] = 0;
storage[indexDst++] = (byte) (-255f*value/maxAbsValue);
storage[indexDst++] = 0;
}
storage[indexDst++] = (byte) 0xFF;
}
}
output.copyPixelsFromBuffer(ByteBuffer.wrap(storage));
} } | public class class_name {
public static void colorizeSign( GrayF32 input , float maxAbsValue , Bitmap output , byte[] storage ) {
shapeShape(input, output);
if( storage == null )
storage = declareStorage(output,null);
if( maxAbsValue < 0 )
maxAbsValue = ImageStatistics.maxAbs(input);
int indexDst = 0;
for( int y = 0; y < input.height; y++ ) {
int indexSrc = input.startIndex + y*input.stride;
for( int x = 0; x < input.width; x++ ) {
float value = input.data[ indexSrc++ ];
if( value > 0 ) {
storage[indexDst++] = (byte) (255f*value/maxAbsValue); // depends on control dependency: [if], data = [none]
storage[indexDst++] = 0; // depends on control dependency: [if], data = [none]
storage[indexDst++] = 0; // depends on control dependency: [if], data = [none]
} else {
storage[indexDst++] = 0; // depends on control dependency: [if], data = [none]
storage[indexDst++] = (byte) (-255f*value/maxAbsValue); // depends on control dependency: [if], data = [none]
storage[indexDst++] = 0; // depends on control dependency: [if], data = [none]
}
storage[indexDst++] = (byte) 0xFF; // depends on control dependency: [for], data = [none]
}
}
output.copyPixelsFromBuffer(ByteBuffer.wrap(storage));
} } |
public class class_name {
@SuppressWarnings("static-method")
public List<Boolean> findBooleanValues(JvmAnnotationReference reference) {
assert reference != null;
final List<Boolean> values = new ArrayList<>();
for (final JvmAnnotationValue value : reference.getValues()) {
if (value instanceof JvmBooleanAnnotationValue) {
for (final Boolean boolValue : ((JvmBooleanAnnotationValue) value).getValues()) {
if (boolValue != null) {
values.add(boolValue);
}
}
}
}
return values;
} } | public class class_name {
@SuppressWarnings("static-method")
public List<Boolean> findBooleanValues(JvmAnnotationReference reference) {
assert reference != null;
final List<Boolean> values = new ArrayList<>();
for (final JvmAnnotationValue value : reference.getValues()) {
if (value instanceof JvmBooleanAnnotationValue) {
for (final Boolean boolValue : ((JvmBooleanAnnotationValue) value).getValues()) {
if (boolValue != null) {
values.add(boolValue); // depends on control dependency: [if], data = [(boolValue]
}
}
}
}
return values;
} } |
public class class_name {
@Override
protected void perform(final Wave wave) {
// Avoid to continue launching next command if cancellation has been requested
if (!this.cancelRequested.get()) {
if (isSequential()) {
// Store the wave when we are running the first command
synchronized (this) {
if (this.commandRunIndex == 0) {
this.waveSource = wave;
fireConsumed(this.waveSource);
}
if (this.subCommandList.size() > this.commandRunIndex) {
final Wave subCommandWave = WBuilder.callCommand(this.subCommandList.get(this.commandRunIndex).classField())
// FIXME UNIQUE KEY of sub command
// Recopy all WaveBeans
.waveBeanList(wave.waveBeanList())
// Recopy the WaveData from the previous wave
.addDatas(wave.waveDatas().toArray(new WaveDataBase[0]))
.addWaveListener(this);
beforeEach(wave, subCommandWave);
sendWave(subCommandWave);
}
}
} else {
// Store the original wave to be able to mark it as consumed when all of these sub commands are achieved
this.waveSource = wave;
synchronized (this) {
// Launch all sub command in parallel
for (final UniqueKey<? extends Command> commandKey : this.subCommandList) {
beforeEach(wave, null);
final Wave commandWave = localFacade().retrieve(commandKey).run();
// register to Wave status of all command triggered
commandWave.addWaveListener(this);
// Store the pending command to know when all command are achieved
this.pendingWaves.add(commandWave);
}
}
}
}
} } | public class class_name {
@Override
protected void perform(final Wave wave) {
// Avoid to continue launching next command if cancellation has been requested
if (!this.cancelRequested.get()) {
if (isSequential()) {
// Store the wave when we are running the first command
synchronized (this) { // depends on control dependency: [if], data = [none]
if (this.commandRunIndex == 0) {
this.waveSource = wave; // depends on control dependency: [if], data = [none]
fireConsumed(this.waveSource); // depends on control dependency: [if], data = [none]
}
if (this.subCommandList.size() > this.commandRunIndex) {
final Wave subCommandWave = WBuilder.callCommand(this.subCommandList.get(this.commandRunIndex).classField())
// FIXME UNIQUE KEY of sub command
// Recopy all WaveBeans
.waveBeanList(wave.waveBeanList())
// Recopy the WaveData from the previous wave
.addDatas(wave.waveDatas().toArray(new WaveDataBase[0]))
.addWaveListener(this);
beforeEach(wave, subCommandWave); // depends on control dependency: [if], data = [none]
sendWave(subCommandWave); // depends on control dependency: [if], data = [none]
}
}
} else {
// Store the original wave to be able to mark it as consumed when all of these sub commands are achieved
this.waveSource = wave; // depends on control dependency: [if], data = [none]
synchronized (this) { // depends on control dependency: [if], data = [none]
// Launch all sub command in parallel
for (final UniqueKey<? extends Command> commandKey : this.subCommandList) {
beforeEach(wave, null); // depends on control dependency: [for], data = [none]
final Wave commandWave = localFacade().retrieve(commandKey).run();
// register to Wave status of all command triggered
commandWave.addWaveListener(this); // depends on control dependency: [for], data = [none]
// Store the pending command to know when all command are achieved
this.pendingWaves.add(commandWave); // depends on control dependency: [for], data = [none]
}
}
}
}
} } |
public class class_name {
public Association getAssociation(String collectionRole) {
if ( associations == null ) {
return null;
}
return associations.get( collectionRole );
} } | public class class_name {
public Association getAssociation(String collectionRole) {
if ( associations == null ) {
return null; // depends on control dependency: [if], data = [none]
}
return associations.get( collectionRole );
} } |
public class class_name {
private void reconnect(final ArrayList<Long> tokens) {
nonUserDisconnect();
try {
ws = new WebSocketFactory().createSocket(wsuri);
} catch (IOException e) {
if(onErrorListener != null) {
onErrorListener.onError(e);
}
return;
}
ws.addListener(getWebsocketAdapter());
connect();
final OnConnect onUsersConnectedListener = this.onConnectedListener;
setOnConnectedListener(new OnConnect() {
@Override
public void onConnected() {
if(subscribedTokens.size() > 0) {
//take a backup of mode map as it will be overriden to modeQuote after subscribe
Map<Long, String> backupModeMap = new HashMap<>();
backupModeMap.putAll(modeMap);
ArrayList<Long> tokens = new ArrayList<>();
tokens.addAll(subscribedTokens);
subscribe(tokens);
Map<String, ArrayList<Long>> modes = new HashMap<>();
for (Map.Entry<Long, String> item: backupModeMap.entrySet()){
if(!modes.containsKey(item.getValue())){
modes.put(item.getValue(), new ArrayList<Long>());
}
modes.get(item.getValue()).add(item.getKey());
}
for(Map.Entry<String, ArrayList<Long>> modeArrayItem: modes.entrySet()){
setMode(modeArrayItem.getValue(), modeArrayItem.getKey());
}
}
lastPongAt = 0;
count = 0;
nextReconnectInterval = 0;
onConnectedListener = onUsersConnectedListener;
}
});
} } | public class class_name {
private void reconnect(final ArrayList<Long> tokens) {
nonUserDisconnect();
try {
ws = new WebSocketFactory().createSocket(wsuri); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
if(onErrorListener != null) {
onErrorListener.onError(e); // depends on control dependency: [if], data = [none]
}
return;
} // depends on control dependency: [catch], data = [none]
ws.addListener(getWebsocketAdapter());
connect();
final OnConnect onUsersConnectedListener = this.onConnectedListener;
setOnConnectedListener(new OnConnect() {
@Override
public void onConnected() {
if(subscribedTokens.size() > 0) {
//take a backup of mode map as it will be overriden to modeQuote after subscribe
Map<Long, String> backupModeMap = new HashMap<>();
backupModeMap.putAll(modeMap); // depends on control dependency: [if], data = [none]
ArrayList<Long> tokens = new ArrayList<>();
tokens.addAll(subscribedTokens); // depends on control dependency: [if], data = [none]
subscribe(tokens); // depends on control dependency: [if], data = [none]
Map<String, ArrayList<Long>> modes = new HashMap<>();
for (Map.Entry<Long, String> item: backupModeMap.entrySet()){
if(!modes.containsKey(item.getValue())){
modes.put(item.getValue(), new ArrayList<Long>()); // depends on control dependency: [if], data = [none]
}
modes.get(item.getValue()).add(item.getKey()); // depends on control dependency: [for], data = [item]
}
for(Map.Entry<String, ArrayList<Long>> modeArrayItem: modes.entrySet()){
setMode(modeArrayItem.getValue(), modeArrayItem.getKey()); // depends on control dependency: [for], data = [modeArrayItem]
}
}
lastPongAt = 0;
count = 0;
nextReconnectInterval = 0;
onConnectedListener = onUsersConnectedListener;
}
});
} } |
public class class_name {
public static boolean hasTranslator(final int mainNumber, final String dptId)
{
try {
final MainType t = getMainType(getMainNumber(mainNumber, dptId));
if (t != null)
return t.getSubTypes().get(dptId) != null;
}
catch (final NumberFormatException e) {}
catch (final KNXException e) {}
return false;
} } | public class class_name {
public static boolean hasTranslator(final int mainNumber, final String dptId)
{
try {
final MainType t = getMainType(getMainNumber(mainNumber, dptId));
if (t != null)
return t.getSubTypes().get(dptId) != null;
}
catch (final NumberFormatException e) {} // depends on control dependency: [catch], data = [none]
catch (final KNXException e) {} // depends on control dependency: [catch], data = [none]
return false;
} } |
public class class_name {
private void addComposites(MBeanAttributeConfig config,
CompositeData compositeData) {
CompositeType compositeType = compositeData.getCompositeType();
for (String key : compositeType.keySet()) {
config.addChild(makeComposite(compositeType, key));
}
} } | public class class_name {
private void addComposites(MBeanAttributeConfig config,
CompositeData compositeData) {
CompositeType compositeType = compositeData.getCompositeType();
for (String key : compositeType.keySet()) {
config.addChild(makeComposite(compositeType, key)); // depends on control dependency: [for], data = [key]
}
} } |
public class class_name {
public synchronized void add(T actual, T predicted, int count) {
if (matrix.containsKey(actual)) {
matrix.get(actual).add(predicted, count);
} else {
Multiset<T> counts = HashMultiset.create();
counts.add(predicted, count);
matrix.put(actual, counts);
}
} } | public class class_name {
public synchronized void add(T actual, T predicted, int count) {
if (matrix.containsKey(actual)) {
matrix.get(actual).add(predicted, count); // depends on control dependency: [if], data = [none]
} else {
Multiset<T> counts = HashMultiset.create();
counts.add(predicted, count); // depends on control dependency: [if], data = [none]
matrix.put(actual, counts); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static int[] ConcatenateInt(List<int[]> arrays) {
int size = 0;
for (int i = 0; i < arrays.size(); i++) {
size += arrays.get(i).length;
}
int[] all = new int[size];
int idx = 0;
for (int i = 0; i < arrays.size(); i++) {
int[] v = arrays.get(i);
for (int j = 0; j < v.length; j++) {
all[idx++] = v[i];
}
}
return all;
} } | public class class_name {
public static int[] ConcatenateInt(List<int[]> arrays) {
int size = 0;
for (int i = 0; i < arrays.size(); i++) {
size += arrays.get(i).length; // depends on control dependency: [for], data = [i]
}
int[] all = new int[size];
int idx = 0;
for (int i = 0; i < arrays.size(); i++) {
int[] v = arrays.get(i);
for (int j = 0; j < v.length; j++) {
all[idx++] = v[i]; // depends on control dependency: [for], data = [none]
}
}
return all;
} } |
public class class_name {
protected <T> Optional<T> getUserData(Optional<? extends Node> node, Class<T> type) {
if (node.isPresent()) {
final Node n = node.get();
return getValue(n, n::getUserData, type);
}
return Optional.empty();
} } | public class class_name {
protected <T> Optional<T> getUserData(Optional<? extends Node> node, Class<T> type) {
if (node.isPresent()) {
final Node n = node.get();
return getValue(n, n::getUserData, type); // depends on control dependency: [if], data = [none]
}
return Optional.empty();
} } |
public class class_name {
public boolean deleteProfile() {
String[] profileDirs = {smallPrefsFolder, largePrefsFolder, cachePrefsFolder};
// Assuming if any of those are main profile, skip the whole delete
for (String profileDir : profileDirs) {
if (isMainProfile(profileDir)) {
logger.finer("Skipping profile deletion since '" + profileDir + "' is the main profile.");
return false;
}
}
for (String profileDir : profileDirs) {
File currentDirHandle = new File(profileDir);
if (!currentDirHandle.exists()) {
logger.finer("Skipping profile deletion for '" + profileDir + "' since it doesn't exist.");
continue;
}
boolean deleted = deleteFolder(profileDir);
if (!deleted) {
final int retryIntervalMs = 500;
final int retryMaxCount = 10;
int retryCount = 0;
boolean ok = false;
logger.warning("Profile could not be deleted, retrying...");
do {
try {
Thread.sleep(retryIntervalMs);
} catch (InterruptedException e) {
// fall through
}
ok = deleteFolder(profileDir);
retryCount++;
if (retryCount > retryMaxCount) {
break;
}
} while (!ok);
if (!ok) {
logger.severe(
"Could not delete profile in '" + profileDir + "'. Skipping further deletion.");
return false;
} else {
logger.warning("Deleted profile, retry count = " + retryCount);
}
} else {
logger.finer("Deleted profile in '" + profileDir + "'");
}
}
return true;
} } | public class class_name {
public boolean deleteProfile() {
String[] profileDirs = {smallPrefsFolder, largePrefsFolder, cachePrefsFolder};
// Assuming if any of those are main profile, skip the whole delete
for (String profileDir : profileDirs) {
if (isMainProfile(profileDir)) {
logger.finer("Skipping profile deletion since '" + profileDir + "' is the main profile."); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
for (String profileDir : profileDirs) {
File currentDirHandle = new File(profileDir);
if (!currentDirHandle.exists()) {
logger.finer("Skipping profile deletion for '" + profileDir + "' since it doesn't exist."); // depends on control dependency: [if], data = [none]
continue;
}
boolean deleted = deleteFolder(profileDir);
if (!deleted) {
final int retryIntervalMs = 500;
final int retryMaxCount = 10;
int retryCount = 0;
boolean ok = false;
logger.warning("Profile could not be deleted, retrying..."); // depends on control dependency: [if], data = [none]
do {
try {
Thread.sleep(retryIntervalMs); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
// fall through
} // depends on control dependency: [catch], data = [none]
ok = deleteFolder(profileDir);
retryCount++;
if (retryCount > retryMaxCount) {
break;
}
} while (!ok);
if (!ok) {
logger.severe(
"Could not delete profile in '" + profileDir + "'. Skipping further deletion."); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else {
logger.warning("Deleted profile, retry count = " + retryCount); // depends on control dependency: [if], data = [none]
}
} else {
logger.finer("Deleted profile in '" + profileDir + "'"); // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
static Set<ArchiveEventCode> getEnabledArchiveEventCodes(final String enabledArchiveEventCodes)
{
if (null == enabledArchiveEventCodes || "".equals(enabledArchiveEventCodes))
{
return EnumSet.noneOf(ArchiveEventCode.class);
}
final Function<Integer, ArchiveEventCode> eventCodeById = ArchiveEventCode::get;
final Function<String, ArchiveEventCode> eventCodeByName = ArchiveEventCode::valueOf;
final EnumSet<ArchiveEventCode> allEventsSet = EnumSet.allOf(ArchiveEventCode.class);
return parseEventCodes(enabledArchiveEventCodes, eventCodeById, eventCodeByName, allEventsSet);
} } | public class class_name {
static Set<ArchiveEventCode> getEnabledArchiveEventCodes(final String enabledArchiveEventCodes)
{
if (null == enabledArchiveEventCodes || "".equals(enabledArchiveEventCodes))
{
return EnumSet.noneOf(ArchiveEventCode.class); // depends on control dependency: [if], data = [none]
}
final Function<Integer, ArchiveEventCode> eventCodeById = ArchiveEventCode::get;
final Function<String, ArchiveEventCode> eventCodeByName = ArchiveEventCode::valueOf;
final EnumSet<ArchiveEventCode> allEventsSet = EnumSet.allOf(ArchiveEventCode.class);
return parseEventCodes(enabledArchiveEventCodes, eventCodeById, eventCodeByName, allEventsSet);
} } |
public class class_name {
@SuppressWarnings({"fallthrough"})
@Override
public int startScan(String displayName, Target target, User user, Object[] customConfigurations) {
switch (Control.getSingleton().getMode()) {
case safe:
throw new IllegalStateException("Scans are not allowed in Safe mode");
case protect:
String uri = getTargetUriOutOfScope(target, customConfigurations);
if (uri != null) {
throw new IllegalStateException("Scans are not allowed on targets not in scope when in Protected mode: " + uri);
}
//$FALL-THROUGH$
case standard:
case attack:
// No problem
break;
}
int id = this.scanController.startScan(displayName, target, user, customConfigurations);
if (View.isInitialised()) {
addScanToUi(this.scanController.getScan(id));
}
return id;
} } | public class class_name {
@SuppressWarnings({"fallthrough"})
@Override
public int startScan(String displayName, Target target, User user, Object[] customConfigurations) {
switch (Control.getSingleton().getMode()) {
case safe:
throw new IllegalStateException("Scans are not allowed in Safe mode");
case protect:
String uri = getTargetUriOutOfScope(target, customConfigurations);
if (uri != null) {
throw new IllegalStateException("Scans are not allowed on targets not in scope when in Protected mode: " + uri); // depends on control dependency: [if], data = [none]
}
//$FALL-THROUGH$
case standard:
case attack:
// No problem
break;
}
int id = this.scanController.startScan(displayName, target, user, customConfigurations);
if (View.isInitialised()) {
addScanToUi(this.scanController.getScan(id)); // depends on control dependency: [if], data = [none]
}
return id;
} } |
public class class_name {
public void setEmail(String email) {
checkEmail(email);
if (email != null) {
email = email.trim();
}
m_email = email;
} } | public class class_name {
public void setEmail(String email) {
checkEmail(email);
if (email != null) {
email = email.trim(); // depends on control dependency: [if], data = [none]
}
m_email = email;
} } |
public class class_name {
public void visitComplexType(CobolComplexType type,
ComplexTypeChildHandler callback) {
cobolNamesStack.push(type.getCobolName());
int index = 0;
for (Entry < String, CobolType > child : type.getFields().entrySet()) {
CobolType childType = child.getValue();
String childName = child.getKey();
curFieldName = childName;
if (childType instanceof CobolOptionalType
&& !isPresent((CobolOptionalType) childType)) {
index++;
continue;
}
if (!callback.preVisit(childName, index, childType)) {
break;
}
childType.accept(this);
if (!callback.postVisit(childName, index, childType)) {
break;
}
index++;
}
cobolNamesStack.pop();
} } | public class class_name {
public void visitComplexType(CobolComplexType type,
ComplexTypeChildHandler callback) {
cobolNamesStack.push(type.getCobolName());
int index = 0;
for (Entry < String, CobolType > child : type.getFields().entrySet()) {
CobolType childType = child.getValue();
String childName = child.getKey();
curFieldName = childName; // depends on control dependency: [for], data = [child]
if (childType instanceof CobolOptionalType
&& !isPresent((CobolOptionalType) childType)) {
index++; // depends on control dependency: [if], data = [none]
continue;
}
if (!callback.preVisit(childName, index, childType)) {
break;
}
childType.accept(this); // depends on control dependency: [for], data = [child]
if (!callback.postVisit(childName, index, childType)) {
break;
}
index++; // depends on control dependency: [for], data = [none]
}
cobolNamesStack.pop();
} } |
public class class_name {
public static ThreadFactory newThreadFactory(final String format, final boolean daemon) {
final String nameFormat;
if (!format.contains("%d")) {
nameFormat = format + "-%d";
} else {
nameFormat = format;
}
return new ThreadFactoryBuilder() //
.setNameFormat(nameFormat) //
.setDaemon(daemon) //
.build();
} } | public class class_name {
public static ThreadFactory newThreadFactory(final String format, final boolean daemon) {
final String nameFormat;
if (!format.contains("%d")) {
nameFormat = format + "-%d"; // depends on control dependency: [if], data = [none]
} else {
nameFormat = format; // depends on control dependency: [if], data = [none]
}
return new ThreadFactoryBuilder() //
.setNameFormat(nameFormat) //
.setDaemon(daemon) //
.build();
} } |
public class class_name {
private Node tryMinimizeExprResult(Node n) {
Node originalExpr = n.getFirstChild();
MinimizedCondition minCond = MinimizedCondition.fromConditionNode(originalExpr);
MeasuredNode mNode =
minCond.getMinimized(MinimizationStyle.ALLOW_LEADING_NOT);
if (mNode.isNot()) {
// Remove the leading NOT in the EXPR_RESULT.
replaceNode(originalExpr, mNode.withoutNot());
} else {
replaceNode(originalExpr, mNode);
}
return n;
} } | public class class_name {
private Node tryMinimizeExprResult(Node n) {
Node originalExpr = n.getFirstChild();
MinimizedCondition minCond = MinimizedCondition.fromConditionNode(originalExpr);
MeasuredNode mNode =
minCond.getMinimized(MinimizationStyle.ALLOW_LEADING_NOT);
if (mNode.isNot()) {
// Remove the leading NOT in the EXPR_RESULT.
replaceNode(originalExpr, mNode.withoutNot()); // depends on control dependency: [if], data = [none]
} else {
replaceNode(originalExpr, mNode); // depends on control dependency: [if], data = [none]
}
return n;
} } |
public class class_name {
public boolean hasNext() {
if(_rs == null)
return false;
if(_primed)
return true;
try {
_primed = _rs.next();
return _primed;
}
catch(SQLException sql) {
String msg = "An exception occurred reading from the Iterator. Cause: " + sql;
LOGGER.error(msg, sql);
throw new IllegalStateException(msg, sql);
}
} } | public class class_name {
public boolean hasNext() {
if(_rs == null)
return false;
if(_primed)
return true;
try {
_primed = _rs.next(); // depends on control dependency: [try], data = [none]
return _primed; // depends on control dependency: [try], data = [none]
}
catch(SQLException sql) {
String msg = "An exception occurred reading from the Iterator. Cause: " + sql;
LOGGER.error(msg, sql);
throw new IllegalStateException(msg, sql);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public EEnum getIfcLightEmissionSourceEnum() {
if (ifcLightEmissionSourceEnumEEnum == null) {
ifcLightEmissionSourceEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(854);
}
return ifcLightEmissionSourceEnumEEnum;
} } | public class class_name {
public EEnum getIfcLightEmissionSourceEnum() {
if (ifcLightEmissionSourceEnumEEnum == null) {
ifcLightEmissionSourceEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(854);
// depends on control dependency: [if], data = [none]
}
return ifcLightEmissionSourceEnumEEnum;
} } |
public class class_name {
public static double[] colSums(double[][] data) {
double[] x = data[0].clone();
for (int i = 1; i < data.length; i++) {
for (int j = 0; j < x.length; j++) {
x[j] += data[i][j];
}
}
return x;
} } | public class class_name {
public static double[] colSums(double[][] data) {
double[] x = data[0].clone();
for (int i = 1; i < data.length; i++) {
for (int j = 0; j < x.length; j++) {
x[j] += data[i][j]; // depends on control dependency: [for], data = [j]
}
}
return x;
} } |
public class class_name {
@Override
public Collection<BioPAXElement> generate(Match match, int... ind)
{
Collection<BioPAXElement> gen = new HashSet<BioPAXElement> (
con[0].generate(match, ind));
for (int i = 1; i < con.length; i++)
{
if (gen.isEmpty()) break;
Collection<BioPAXElement> subset = con[i].generate(match, ind);
Set<BioPAXElement> copy = new HashSet<BioPAXElement>(subset);
copy.removeAll(gen);
gen.removeAll(subset);
gen.addAll(copy);
}
return gen;
} } | public class class_name {
@Override
public Collection<BioPAXElement> generate(Match match, int... ind)
{
Collection<BioPAXElement> gen = new HashSet<BioPAXElement> (
con[0].generate(match, ind));
for (int i = 1; i < con.length; i++)
{
if (gen.isEmpty()) break;
Collection<BioPAXElement> subset = con[i].generate(match, ind);
Set<BioPAXElement> copy = new HashSet<BioPAXElement>(subset);
copy.removeAll(gen); // depends on control dependency: [for], data = [none]
gen.removeAll(subset); // depends on control dependency: [for], data = [none]
gen.addAll(copy); // depends on control dependency: [for], data = [none]
}
return gen;
} } |
public class class_name {
public static Map<JComponent, List<JComponent>> getComponentMap(
JComponent container, boolean nested) {
HashMap<JComponent, List<JComponent>> retVal =
new HashMap<JComponent, List<JComponent>>();
for (JComponent component : getDescendantsOfType(JComponent.class,
container, false)) {
if (!retVal.containsKey(container)) {
retVal.put(container,
new ArrayList<JComponent>());
}
retVal.get(container).add(component);
if (nested) {
retVal.putAll(getComponentMap(component, nested));
}
}
return retVal;
} } | public class class_name {
public static Map<JComponent, List<JComponent>> getComponentMap(
JComponent container, boolean nested) {
HashMap<JComponent, List<JComponent>> retVal =
new HashMap<JComponent, List<JComponent>>();
for (JComponent component : getDescendantsOfType(JComponent.class,
container, false)) {
if (!retVal.containsKey(container)) {
retVal.put(container,
new ArrayList<JComponent>()); // depends on control dependency: [if], data = [none]
}
retVal.get(container).add(component); // depends on control dependency: [for], data = [component]
if (nested) {
retVal.putAll(getComponentMap(component, nested)); // depends on control dependency: [if], data = [none]
}
}
return retVal;
} } |
public class class_name {
public synchronized Set<Vulnerability> getVulnerabilities(boolean sorted) {
final Set<Vulnerability> vulnerabilitySet;
if (sorted) {
vulnerabilitySet = new TreeSet<>(vulnerabilities);
} else {
vulnerabilitySet = vulnerabilities;
}
return Collections.unmodifiableSet(vulnerabilitySet);
} } | public class class_name {
public synchronized Set<Vulnerability> getVulnerabilities(boolean sorted) {
final Set<Vulnerability> vulnerabilitySet;
if (sorted) {
vulnerabilitySet = new TreeSet<>(vulnerabilities); // depends on control dependency: [if], data = [none]
} else {
vulnerabilitySet = vulnerabilities; // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableSet(vulnerabilitySet);
} } |
public class class_name {
public void marshall(ElasticsearchDomainConfig elasticsearchDomainConfig, ProtocolMarshaller protocolMarshaller) {
if (elasticsearchDomainConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(elasticsearchDomainConfig.getElasticsearchVersion(), ELASTICSEARCHVERSION_BINDING);
protocolMarshaller.marshall(elasticsearchDomainConfig.getElasticsearchClusterConfig(), ELASTICSEARCHCLUSTERCONFIG_BINDING);
protocolMarshaller.marshall(elasticsearchDomainConfig.getEBSOptions(), EBSOPTIONS_BINDING);
protocolMarshaller.marshall(elasticsearchDomainConfig.getAccessPolicies(), ACCESSPOLICIES_BINDING);
protocolMarshaller.marshall(elasticsearchDomainConfig.getSnapshotOptions(), SNAPSHOTOPTIONS_BINDING);
protocolMarshaller.marshall(elasticsearchDomainConfig.getVPCOptions(), VPCOPTIONS_BINDING);
protocolMarshaller.marshall(elasticsearchDomainConfig.getCognitoOptions(), COGNITOOPTIONS_BINDING);
protocolMarshaller.marshall(elasticsearchDomainConfig.getEncryptionAtRestOptions(), ENCRYPTIONATRESTOPTIONS_BINDING);
protocolMarshaller.marshall(elasticsearchDomainConfig.getNodeToNodeEncryptionOptions(), NODETONODEENCRYPTIONOPTIONS_BINDING);
protocolMarshaller.marshall(elasticsearchDomainConfig.getAdvancedOptions(), ADVANCEDOPTIONS_BINDING);
protocolMarshaller.marshall(elasticsearchDomainConfig.getLogPublishingOptions(), LOGPUBLISHINGOPTIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ElasticsearchDomainConfig elasticsearchDomainConfig, ProtocolMarshaller protocolMarshaller) {
if (elasticsearchDomainConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(elasticsearchDomainConfig.getElasticsearchVersion(), ELASTICSEARCHVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticsearchDomainConfig.getElasticsearchClusterConfig(), ELASTICSEARCHCLUSTERCONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticsearchDomainConfig.getEBSOptions(), EBSOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticsearchDomainConfig.getAccessPolicies(), ACCESSPOLICIES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticsearchDomainConfig.getSnapshotOptions(), SNAPSHOTOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticsearchDomainConfig.getVPCOptions(), VPCOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticsearchDomainConfig.getCognitoOptions(), COGNITOOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticsearchDomainConfig.getEncryptionAtRestOptions(), ENCRYPTIONATRESTOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticsearchDomainConfig.getNodeToNodeEncryptionOptions(), NODETONODEENCRYPTIONOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticsearchDomainConfig.getAdvancedOptions(), ADVANCEDOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticsearchDomainConfig.getLogPublishingOptions(), LOGPUBLISHINGOPTIONS_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 {
void fetchRouteTileVersions(String accessToken, final OnTileVersionsFoundCallback callback) {
MapboxRouteTileVersions mapboxRouteTileVersions = buildTileVersionsWith(accessToken);
mapboxRouteTileVersions.enqueueCall(new Callback<RouteTileVersionsResponse>() {
@Override
public void onResponse(@NonNull Call<RouteTileVersionsResponse> call,
@NonNull Response<RouteTileVersionsResponse> response) {
if (response.isSuccessful() && response.body() != null) {
callback.onVersionsFound(response.body().availableVersions());
} else {
callback.onError(new OfflineError("Tile version response was unsuccessful"));
}
}
@Override
public void onFailure(@NonNull Call<RouteTileVersionsResponse> call, @NonNull Throwable throwable) {
OfflineError error = new OfflineError(throwable.getMessage());
callback.onError(error);
}
});
} } | public class class_name {
void fetchRouteTileVersions(String accessToken, final OnTileVersionsFoundCallback callback) {
MapboxRouteTileVersions mapboxRouteTileVersions = buildTileVersionsWith(accessToken);
mapboxRouteTileVersions.enqueueCall(new Callback<RouteTileVersionsResponse>() {
@Override
public void onResponse(@NonNull Call<RouteTileVersionsResponse> call,
@NonNull Response<RouteTileVersionsResponse> response) {
if (response.isSuccessful() && response.body() != null) {
callback.onVersionsFound(response.body().availableVersions()); // depends on control dependency: [if], data = [none]
} else {
callback.onError(new OfflineError("Tile version response was unsuccessful")); // depends on control dependency: [if], data = [none]
}
}
@Override
public void onFailure(@NonNull Call<RouteTileVersionsResponse> call, @NonNull Throwable throwable) {
OfflineError error = new OfflineError(throwable.getMessage());
callback.onError(error);
}
});
} } |
public class class_name {
public void marshall(WeightedTarget weightedTarget, ProtocolMarshaller protocolMarshaller) {
if (weightedTarget == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(weightedTarget.getVirtualNode(), VIRTUALNODE_BINDING);
protocolMarshaller.marshall(weightedTarget.getWeight(), WEIGHT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(WeightedTarget weightedTarget, ProtocolMarshaller protocolMarshaller) {
if (weightedTarget == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(weightedTarget.getVirtualNode(), VIRTUALNODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(weightedTarget.getWeight(), WEIGHT_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 String[] getIdentifiers()
{
final PerSessionInfo[] infos;
synchronized (sessions)
{
infos = (PerSessionInfo[]) sessions.values().toArray(new PerSessionInfo[sessions.size()]);
}
int count = 0;
for (int i = 0; i < infos.length; ++i)
{
if (infos[i] != null && infos[i].identifier != null)
{
++count;
}
}
if (count > 0)
{
final String[] result = new String[count];
int index = 0;
for (int i = 0; i < infos.length; ++i)
{
if (infos[i] != null && infos[i].identifier != null)
{
result[index++] = infos[i].identifier;
}
}
return result;
} else
{
return null;
}
} } | public class class_name {
public String[] getIdentifiers()
{
final PerSessionInfo[] infos;
synchronized (sessions)
{
infos = (PerSessionInfo[]) sessions.values().toArray(new PerSessionInfo[sessions.size()]);
}
int count = 0;
for (int i = 0; i < infos.length; ++i)
{
if (infos[i] != null && infos[i].identifier != null)
{
++count; // depends on control dependency: [if], data = [none]
}
}
if (count > 0)
{
final String[] result = new String[count];
int index = 0;
for (int i = 0; i < infos.length; ++i)
{
if (infos[i] != null && infos[i].identifier != null)
{
result[index++] = infos[i].identifier; // depends on control dependency: [if], data = [none]
}
}
return result; // depends on control dependency: [if], data = [none]
} else
{
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Query groupby(final Collection<? extends Expression> groupbyColumns) {
if (groupbyColumns == null) {
return this;
}
this.groupbyColumns.addAll(groupbyColumns);
return this;
} } | public class class_name {
public Query groupby(final Collection<? extends Expression> groupbyColumns) {
if (groupbyColumns == null) {
return this; // depends on control dependency: [if], data = [none]
}
this.groupbyColumns.addAll(groupbyColumns);
return this;
} } |
public class class_name {
public DOMSource createDOMSource(DocumentSource src)
{
try
{
Constructor<? extends DOMSource> constr = getDOMSourceClass().getConstructor(DocumentSource.class);
return constr.newInstance(src);
} catch (Exception e) {
log.warn("BoxFactory: Warning: could not create the DOMSource instance: " + e.getMessage());
return null;
}
} } | public class class_name {
public DOMSource createDOMSource(DocumentSource src)
{
try
{
Constructor<? extends DOMSource> constr = getDOMSourceClass().getConstructor(DocumentSource.class); // depends on control dependency: [try], data = [none]
return constr.newInstance(src); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.warn("BoxFactory: Warning: could not create the DOMSource instance: " + e.getMessage());
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private String format(String message, Object[] params) {
if (params.length == 0) {
return message;
} else if (params.length == 1 && params[0] instanceof Throwable) {
// We print only the message here since breaking exception will bubble up
// anyway
return message + ": " + params[0].toString();
} else {
return String.format(message, params);
}
} } | public class class_name {
private String format(String message, Object[] params) {
if (params.length == 0) {
return message; // depends on control dependency: [if], data = [none]
} else if (params.length == 1 && params[0] instanceof Throwable) {
// We print only the message here since breaking exception will bubble up
// anyway
return message + ": " + params[0].toString(); // depends on control dependency: [if], data = [none]
} else {
return String.format(message, params); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static GrayU8 removePointNoise(GrayU8 input, GrayU8 output) {
output = InputSanityCheck.checkDeclare(input, output);
if( BoofConcurrency.USE_CONCURRENT ) {
ImplBinaryInnerOps_MT.removePointNoise(input, output);
} else {
ImplBinaryInnerOps.removePointNoise(input, output);
}
ImplBinaryBorderOps.removePointNoise(input, output);
return output;
} } | public class class_name {
public static GrayU8 removePointNoise(GrayU8 input, GrayU8 output) {
output = InputSanityCheck.checkDeclare(input, output);
if( BoofConcurrency.USE_CONCURRENT ) {
ImplBinaryInnerOps_MT.removePointNoise(input, output); // depends on control dependency: [if], data = [none]
} else {
ImplBinaryInnerOps.removePointNoise(input, output); // depends on control dependency: [if], data = [none]
}
ImplBinaryBorderOps.removePointNoise(input, output);
return output;
} } |
public class class_name {
public static void main(String[] args) throws Exception {
boolean valid = true;
boolean requiredArguments = false;
String imageFormat = null;
boolean rawImage = false;
File inputDirectory = null;
TileFormatType tileType = null;
File geoPackageFile = null;
String tileTable = null;
for (int i = 0; valid && i < args.length; i++) {
String arg = args[i];
// Handle optional arguments
if (arg.startsWith(ARGUMENT_PREFIX)) {
String argument = arg.substring(ARGUMENT_PREFIX.length());
switch (argument) {
case ARGUMENT_IMAGE_FORMAT:
if (i < args.length) {
imageFormat = args[++i];
} else {
valid = false;
System.out.println("Error: Image Format argument '"
+ arg + "' must be followed by a image format");
}
break;
case ARGUMENT_RAW_IMAGE:
rawImage = true;
break;
default:
valid = false;
System.out.println("Error: Unsupported arg: '" + arg + "'");
}
} else {
// Set required arguments in order
if (inputDirectory == null) {
inputDirectory = new File(arg);
} else if (tileType == null) {
tileType = TileFormatType.valueOf(arg.toUpperCase());
} else if (geoPackageFile == null) {
geoPackageFile = new File(arg);
} else if (tileTable == null) {
tileTable = arg;
requiredArguments = true;
} else {
valid = false;
System.out.println("Error: Unsupported extra argument: "
+ arg);
}
}
}
if (!valid || !requiredArguments) {
printUsage();
} else {
// Read the tiles
try {
readTiles(geoPackageFile, tileTable, inputDirectory,
imageFormat, tileType, rawImage);
} catch (Exception e) {
printUsage();
throw e;
}
}
} } | public class class_name {
public static void main(String[] args) throws Exception {
boolean valid = true;
boolean requiredArguments = false;
String imageFormat = null;
boolean rawImage = false;
File inputDirectory = null;
TileFormatType tileType = null;
File geoPackageFile = null;
String tileTable = null;
for (int i = 0; valid && i < args.length; i++) {
String arg = args[i];
// Handle optional arguments
if (arg.startsWith(ARGUMENT_PREFIX)) {
String argument = arg.substring(ARGUMENT_PREFIX.length());
switch (argument) {
case ARGUMENT_IMAGE_FORMAT:
if (i < args.length) {
imageFormat = args[++i]; // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Image Format argument '"
+ arg + "' must be followed by a image format"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_RAW_IMAGE:
rawImage = true;
break;
default:
valid = false;
System.out.println("Error: Unsupported arg: '" + arg + "'");
}
} else {
// Set required arguments in order
if (inputDirectory == null) {
inputDirectory = new File(arg); // depends on control dependency: [if], data = [none]
} else if (tileType == null) {
tileType = TileFormatType.valueOf(arg.toUpperCase()); // depends on control dependency: [if], data = [none]
} else if (geoPackageFile == null) {
geoPackageFile = new File(arg); // depends on control dependency: [if], data = [none]
} else if (tileTable == null) {
tileTable = arg; // depends on control dependency: [if], data = [none]
requiredArguments = true; // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Unsupported extra argument: "
+ arg); // depends on control dependency: [if], data = [none]
}
}
}
if (!valid || !requiredArguments) {
printUsage();
} else {
// Read the tiles
try {
readTiles(geoPackageFile, tileTable, inputDirectory,
imageFormat, tileType, rawImage);
} catch (Exception e) {
printUsage();
throw e;
}
}
} } |
public class class_name {
public float nextPolar() {
// If there's a saved value, return it.
if (haveNextPolar) {
haveNextPolar = false;
return nextPolar;
}
float u1, u2, r; // point coordinates and their radius
do {
// u1 and u2 will be uniformly-distributed
// random values in [-1, +1).
u1 = 2*gen.nextFloat() - 1;
u2 = 2*gen.nextFloat() - 1;
// Want radius r inside the unit circle.
r = u1*u1 + u2*u2;
} while (r >= 1);
// Factor incorporates the standard deviation.
float factor = (float) (stddev*Math.sqrt(-2*Math.log(r)/r));
// v1 and v2 are normally-distributed random values.
float v1 = factor*u1 + mean;
float v2 = factor*u2 + mean;
// Save v1 for next time.
nextPolar = v1;
haveNextPolar = true;
return v2;
} } | public class class_name {
public float nextPolar() {
// If there's a saved value, return it.
if (haveNextPolar) {
haveNextPolar = false; // depends on control dependency: [if], data = [none]
return nextPolar; // depends on control dependency: [if], data = [none]
}
float u1, u2, r; // point coordinates and their radius
do {
// u1 and u2 will be uniformly-distributed
// random values in [-1, +1).
u1 = 2*gen.nextFloat() - 1;
u2 = 2*gen.nextFloat() - 1;
// Want radius r inside the unit circle.
r = u1*u1 + u2*u2;
} while (r >= 1);
// Factor incorporates the standard deviation.
float factor = (float) (stddev*Math.sqrt(-2*Math.log(r)/r));
// v1 and v2 are normally-distributed random values.
float v1 = factor*u1 + mean;
float v2 = factor*u2 + mean;
// Save v1 for next time.
nextPolar = v1;
haveNextPolar = true;
return v2;
} } |
public class class_name {
ArrayTagSet addAll(Tag[] ts, int tsLength) {
if (tsLength == 0) {
return this;
} else if (length == 0) {
Arrays.sort(ts, 0, tsLength, TAG_COMPARATOR);
int len = dedup(ts, 0, ts, 0, tsLength);
return new ArrayTagSet(toStringArray(ts, len));
} else {
String[] newTags = new String[(length + tsLength) * 2];
Arrays.sort(ts, 0, tsLength, TAG_COMPARATOR);
int newLength = merge(newTags, tags, length, ts, tsLength);
return new ArrayTagSet(newTags, newLength);
}
} } | public class class_name {
ArrayTagSet addAll(Tag[] ts, int tsLength) {
if (tsLength == 0) {
return this; // depends on control dependency: [if], data = [none]
} else if (length == 0) {
Arrays.sort(ts, 0, tsLength, TAG_COMPARATOR); // depends on control dependency: [if], data = [none]
int len = dedup(ts, 0, ts, 0, tsLength);
return new ArrayTagSet(toStringArray(ts, len)); // depends on control dependency: [if], data = [none]
} else {
String[] newTags = new String[(length + tsLength) * 2];
Arrays.sort(ts, 0, tsLength, TAG_COMPARATOR); // depends on control dependency: [if], data = [none]
int newLength = merge(newTags, tags, length, ts, tsLength);
return new ArrayTagSet(newTags, newLength); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public CommerceShippingMethod fetchByPrimaryKey(Serializable primaryKey) {
Serializable serializable = entityCache.getResult(CommerceShippingMethodModelImpl.ENTITY_CACHE_ENABLED,
CommerceShippingMethodImpl.class, primaryKey);
if (serializable == nullModel) {
return null;
}
CommerceShippingMethod commerceShippingMethod = (CommerceShippingMethod)serializable;
if (commerceShippingMethod == null) {
Session session = null;
try {
session = openSession();
commerceShippingMethod = (CommerceShippingMethod)session.get(CommerceShippingMethodImpl.class,
primaryKey);
if (commerceShippingMethod != null) {
cacheResult(commerceShippingMethod);
}
else {
entityCache.putResult(CommerceShippingMethodModelImpl.ENTITY_CACHE_ENABLED,
CommerceShippingMethodImpl.class, primaryKey, nullModel);
}
}
catch (Exception e) {
entityCache.removeResult(CommerceShippingMethodModelImpl.ENTITY_CACHE_ENABLED,
CommerceShippingMethodImpl.class, primaryKey);
throw processException(e);
}
finally {
closeSession(session);
}
}
return commerceShippingMethod;
} } | public class class_name {
@Override
public CommerceShippingMethod fetchByPrimaryKey(Serializable primaryKey) {
Serializable serializable = entityCache.getResult(CommerceShippingMethodModelImpl.ENTITY_CACHE_ENABLED,
CommerceShippingMethodImpl.class, primaryKey);
if (serializable == nullModel) {
return null; // depends on control dependency: [if], data = [none]
}
CommerceShippingMethod commerceShippingMethod = (CommerceShippingMethod)serializable;
if (commerceShippingMethod == null) {
Session session = null;
try {
session = openSession(); // depends on control dependency: [try], data = [none]
commerceShippingMethod = (CommerceShippingMethod)session.get(CommerceShippingMethodImpl.class,
primaryKey); // depends on control dependency: [try], data = [none]
if (commerceShippingMethod != null) {
cacheResult(commerceShippingMethod); // depends on control dependency: [if], data = [(commerceShippingMethod]
}
else {
entityCache.putResult(CommerceShippingMethodModelImpl.ENTITY_CACHE_ENABLED,
CommerceShippingMethodImpl.class, primaryKey, nullModel); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e) {
entityCache.removeResult(CommerceShippingMethodModelImpl.ENTITY_CACHE_ENABLED,
CommerceShippingMethodImpl.class, primaryKey);
throw processException(e);
} // depends on control dependency: [catch], data = [none]
finally {
closeSession(session);
}
}
return commerceShippingMethod;
} } |
public class class_name {
public EntityMetadata buildEntityMetadata(Class<?> clazz)
{
EntityMetadata metadata = new EntityMetadata(clazz);
// validate(clazz);
if (log.isDebugEnabled())
log.debug("Processing @Entity >> " + clazz);
for (MetadataProcessor processor : metadataProcessors)
{
// // in case it is not intend for current persistence unit.
// checkForRDBMS(metadata);
// checkForNeo4J(metadata);
setSchemaAndPU(clazz, metadata);
processor.process(clazz, metadata);
metadata = belongsToPersistenceUnit(metadata);
if (metadata == null)
{
break;
}
// Check for schema attribute of Table annotation.
if (MetadataUtils.isSchemaAttributeRequired(metadata.getPersistenceUnit(), kunderaMetadata)
&& StringUtils.isBlank(metadata.getSchema()))
{
if (log.isErrorEnabled())
{
log.error("It is mandatory to specify Schema alongwith Table name:" + metadata.getTableName()
+ ". This entity won't be persisted");
}
throw new InvalidEntityDefinitionException("It is mandatory to specify Schema alongwith Table name:"
+ metadata.getTableName() + ". This entity won't be persisted");
}
}
return metadata;
} } | public class class_name {
public EntityMetadata buildEntityMetadata(Class<?> clazz)
{
EntityMetadata metadata = new EntityMetadata(clazz);
// validate(clazz);
if (log.isDebugEnabled())
log.debug("Processing @Entity >> " + clazz);
for (MetadataProcessor processor : metadataProcessors)
{
// // in case it is not intend for current persistence unit.
// checkForRDBMS(metadata);
// checkForNeo4J(metadata);
setSchemaAndPU(clazz, metadata);
// depends on control dependency: [for], data = [none]
processor.process(clazz, metadata);
// depends on control dependency: [for], data = [processor]
metadata = belongsToPersistenceUnit(metadata);
// depends on control dependency: [for], data = [none]
if (metadata == null)
{
break;
}
// Check for schema attribute of Table annotation.
if (MetadataUtils.isSchemaAttributeRequired(metadata.getPersistenceUnit(), kunderaMetadata)
&& StringUtils.isBlank(metadata.getSchema()))
{
if (log.isErrorEnabled())
{
log.error("It is mandatory to specify Schema alongwith Table name:" + metadata.getTableName()
+ ". This entity won't be persisted");
}
throw new InvalidEntityDefinitionException("It is mandatory to specify Schema alongwith Table name:"
+ metadata.getTableName() + ". This entity won't be persisted");
// depends on control dependency: [if], data = [none]
}
}
return metadata;
// depends on control dependency: [for], data = [none]
} } |
public class class_name {
public static systembackup[] get(nitro_service service, String filename[]) throws Exception{
if (filename !=null && filename.length>0) {
systembackup response[] = new systembackup[filename.length];
systembackup obj[] = new systembackup[filename.length];
for (int i=0;i<filename.length;i++) {
obj[i] = new systembackup();
obj[i].set_filename(filename[i]);
response[i] = (systembackup) obj[i].get_resource(service);
}
return response;
}
return null;
} } | public class class_name {
public static systembackup[] get(nitro_service service, String filename[]) throws Exception{
if (filename !=null && filename.length>0) {
systembackup response[] = new systembackup[filename.length];
systembackup obj[] = new systembackup[filename.length];
for (int i=0;i<filename.length;i++) {
obj[i] = new systembackup(); // depends on control dependency: [for], data = [i]
obj[i].set_filename(filename[i]); // depends on control dependency: [for], data = [i]
response[i] = (systembackup) obj[i].get_resource(service); // depends on control dependency: [for], data = [i]
}
return response;
}
return null;
} } |
public class class_name {
@SuppressWarnings("rawtypes")
public static int prepareCollectionDataInContext(
final String[] varparts, final Collection collection,
final Map<String, Object> dataContext) {
if (varparts.length == TieConstants.DEFAULT_COMMAND_PART_LENGTH) {
int collectionIndex = Integer.parseInt(varparts[2]);
Object obj = ConfigurationUtility
.findItemInCollection(collection, collectionIndex);
if (obj != null) {
dataContext.put(varparts[1], obj);
return collectionIndex;
}
}
return -1;
} } | public class class_name {
@SuppressWarnings("rawtypes")
public static int prepareCollectionDataInContext(
final String[] varparts, final Collection collection,
final Map<String, Object> dataContext) {
if (varparts.length == TieConstants.DEFAULT_COMMAND_PART_LENGTH) {
int collectionIndex = Integer.parseInt(varparts[2]);
Object obj = ConfigurationUtility
.findItemInCollection(collection, collectionIndex);
if (obj != null) {
dataContext.put(varparts[1], obj);
// depends on control dependency: [if], data = [none]
return collectionIndex;
// depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
public AttributeDataset columns(String... cols) {
Attribute[] attrs = new Attribute[cols.length];
int[] index = new int[cols.length];
for (int k = 0; k < cols.length; k++) {
for (int j = 0; j < attributes.length; j++) {
if (attributes[j].getName().equals(cols[k])) {
index[k] = j;
attrs[k] = attributes[j];
break;
}
}
if (attrs[k] == null) {
throw new IllegalArgumentException("Unknown column: " + cols[k]);
}
}
AttributeDataset sub = new AttributeDataset(name, attrs, response);
for (Datum<double[]> datum : data) {
double[] x = new double[index.length];
for (int i = 0; i < x.length; i++) {
x[i] = datum.x[index[i]];
}
Row row = response == null ? sub.add(x) : sub.add(x, datum.y);
row.name = datum.name;
row.weight = datum.weight;
row.description = datum.description;
row.timestamp = datum.timestamp;
}
return sub;
} } | public class class_name {
public AttributeDataset columns(String... cols) {
Attribute[] attrs = new Attribute[cols.length];
int[] index = new int[cols.length];
for (int k = 0; k < cols.length; k++) {
for (int j = 0; j < attributes.length; j++) {
if (attributes[j].getName().equals(cols[k])) {
index[k] = j; // depends on control dependency: [if], data = [none]
attrs[k] = attributes[j]; // depends on control dependency: [if], data = [none]
break;
}
}
if (attrs[k] == null) {
throw new IllegalArgumentException("Unknown column: " + cols[k]);
}
}
AttributeDataset sub = new AttributeDataset(name, attrs, response);
for (Datum<double[]> datum : data) {
double[] x = new double[index.length];
for (int i = 0; i < x.length; i++) {
x[i] = datum.x[index[i]]; // depends on control dependency: [for], data = [i]
}
Row row = response == null ? sub.add(x) : sub.add(x, datum.y);
row.name = datum.name; // depends on control dependency: [for], data = [datum]
row.weight = datum.weight; // depends on control dependency: [for], data = [datum]
row.description = datum.description; // depends on control dependency: [for], data = [datum]
row.timestamp = datum.timestamp; // depends on control dependency: [for], data = [datum]
}
return sub;
} } |
public class class_name {
public static <T extends XMLObject> T createAttributeValueObject(Class<T> clazz) {
try {
QName schemaType = (QName) clazz.getDeclaredField("TYPE_NAME").get(null);
return createAttributeValueObject(schemaType, clazz);
}
catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static <T extends XMLObject> T createAttributeValueObject(Class<T> clazz) {
try {
QName schemaType = (QName) clazz.getDeclaredField("TYPE_NAME").get(null);
return createAttributeValueObject(schemaType, clazz); // depends on control dependency: [try], data = [none]
}
catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static char[] toChars(int codePoint) {
if (isBmpCodePoint(codePoint)) {
return new char[] { (char) codePoint };
} else if (isValidCodePoint(codePoint)) {
char[] result = new char[2];
toSurrogates(codePoint, result, 0);
return result;
} else {
throw new IllegalArgumentException();
}
} } | public class class_name {
public static char[] toChars(int codePoint) {
if (isBmpCodePoint(codePoint)) {
return new char[] { (char) codePoint }; // depends on control dependency: [if], data = [none]
} else if (isValidCodePoint(codePoint)) {
char[] result = new char[2];
toSurrogates(codePoint, result, 0); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException();
}
} } |
public class class_name {
private void processViewAnnotations(final DeploymentUnit deploymentUnit, final Class<?> sessionBeanClass, final SessionBeanComponentDescription sessionBeanComponentDescription) throws DeploymentUnitProcessingException {
final Collection<Class<?>> remoteBusinessInterfaces = this.getRemoteBusinessInterfaces(deploymentUnit, sessionBeanClass);
if (remoteBusinessInterfaces != null && !remoteBusinessInterfaces.isEmpty()) {
sessionBeanComponentDescription.addRemoteBusinessInterfaceViews(this.toString(remoteBusinessInterfaces));
}
// fetch the local business interfaces of the bean
Collection<Class<?>> localBusinessInterfaces = this.getLocalBusinessInterfaces(deploymentUnit, sessionBeanClass);
if (localBusinessInterfaces != null && !localBusinessInterfaces.isEmpty()) {
sessionBeanComponentDescription.addLocalBusinessInterfaceViews(this.toString(localBusinessInterfaces));
}
if (hasNoInterfaceView(sessionBeanClass)) {
sessionBeanComponentDescription.addNoInterfaceView();
}
// EJB 3.1 FR 4.9.7 & 4.9.8, if the bean exposes no views
if (hasNoViews(sessionBeanComponentDescription)) {
final Set<Class<?>> potentialBusinessInterfaces = getPotentialBusinessInterfaces(sessionBeanClass);
if (potentialBusinessInterfaces.isEmpty()) {
sessionBeanComponentDescription.addNoInterfaceView();
} else if (potentialBusinessInterfaces.size() == 1) {
sessionBeanComponentDescription.addLocalBusinessInterfaceViews(potentialBusinessInterfaces.iterator().next().getName());
} else if (isEjbVersionGreaterThanOrEqualTo32(deploymentUnit)) {
// EJB 3.2 spec states (section 4.9.7):
// ... or if the bean class is annotated with neither the Local nor the Remote annotation, all implemented interfaces (excluding the interfaces listed above)
// are assumed to be local business interfaces of the bean
sessionBeanComponentDescription.addLocalBusinessInterfaceViews(toString(potentialBusinessInterfaces));
}
}
} } | public class class_name {
private void processViewAnnotations(final DeploymentUnit deploymentUnit, final Class<?> sessionBeanClass, final SessionBeanComponentDescription sessionBeanComponentDescription) throws DeploymentUnitProcessingException {
final Collection<Class<?>> remoteBusinessInterfaces = this.getRemoteBusinessInterfaces(deploymentUnit, sessionBeanClass);
if (remoteBusinessInterfaces != null && !remoteBusinessInterfaces.isEmpty()) {
sessionBeanComponentDescription.addRemoteBusinessInterfaceViews(this.toString(remoteBusinessInterfaces));
}
// fetch the local business interfaces of the bean
Collection<Class<?>> localBusinessInterfaces = this.getLocalBusinessInterfaces(deploymentUnit, sessionBeanClass);
if (localBusinessInterfaces != null && !localBusinessInterfaces.isEmpty()) {
sessionBeanComponentDescription.addLocalBusinessInterfaceViews(this.toString(localBusinessInterfaces));
}
if (hasNoInterfaceView(sessionBeanClass)) {
sessionBeanComponentDescription.addNoInterfaceView();
}
// EJB 3.1 FR 4.9.7 & 4.9.8, if the bean exposes no views
if (hasNoViews(sessionBeanComponentDescription)) {
final Set<Class<?>> potentialBusinessInterfaces = getPotentialBusinessInterfaces(sessionBeanClass);
if (potentialBusinessInterfaces.isEmpty()) {
sessionBeanComponentDescription.addNoInterfaceView(); // depends on control dependency: [if], data = [none]
} else if (potentialBusinessInterfaces.size() == 1) {
sessionBeanComponentDescription.addLocalBusinessInterfaceViews(potentialBusinessInterfaces.iterator().next().getName()); // depends on control dependency: [if], data = [none]
} else if (isEjbVersionGreaterThanOrEqualTo32(deploymentUnit)) {
// EJB 3.2 spec states (section 4.9.7):
// ... or if the bean class is annotated with neither the Local nor the Remote annotation, all implemented interfaces (excluding the interfaces listed above)
// are assumed to be local business interfaces of the bean
sessionBeanComponentDescription.addLocalBusinessInterfaceViews(toString(potentialBusinessInterfaces)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public boolean
verify(byte [] signature, boolean truncation_ok) {
byte [] expected = sign();
if (truncation_ok && signature.length < expected.length) {
byte [] truncated = new byte[signature.length];
System.arraycopy(expected, 0, truncated, 0, truncated.length);
expected = truncated;
}
return Arrays.equals(signature, expected);
} } | public class class_name {
public boolean
verify(byte [] signature, boolean truncation_ok) {
byte [] expected = sign();
if (truncation_ok && signature.length < expected.length) {
byte [] truncated = new byte[signature.length];
System.arraycopy(expected, 0, truncated, 0, truncated.length); // depends on control dependency: [if], data = [none]
expected = truncated; // depends on control dependency: [if], data = [none]
}
return Arrays.equals(signature, expected);
} } |
public class class_name {
public void println(int tempIndent, String x) {
if (startOfLine) {
doIndent(tempIndent);
}
if (noNl) {
super.print(x);
} else {
super.println(x);
if (oNlCr) { super.write('\r'); }
}
startOfLine = true;
} } | public class class_name {
public void println(int tempIndent, String x) {
if (startOfLine) {
doIndent(tempIndent); // depends on control dependency: [if], data = [none]
}
if (noNl) {
super.print(x); // depends on control dependency: [if], data = [none]
} else {
super.println(x); // depends on control dependency: [if], data = [none]
if (oNlCr) { super.write('\r'); } // depends on control dependency: [if], data = [none]
}
startOfLine = true;
} } |
public class class_name {
private Node tryFoldStringCharAt(Node n, Node stringNode, Node arg1) {
checkArgument(n.isCall());
checkArgument(stringNode.isString());
int index;
String stringAsString = stringNode.getString();
if (arg1 != null && arg1.isNumber()
&& arg1.getNext() == null) {
index = (int) arg1.getDouble();
} else {
return n;
}
if (index < 0 || stringAsString.length() <= index) {
// http://es5.github.com/#x15.5.4.4 says "" is returned when index is
// out of bounds but we bail.
return n;
}
Node resultNode = IR.string(
stringAsString.substring(index, index + 1));
Node parent = n.getParent();
parent.replaceChild(n, resultNode);
reportChangeToEnclosingScope(parent);
return resultNode;
} } | public class class_name {
private Node tryFoldStringCharAt(Node n, Node stringNode, Node arg1) {
checkArgument(n.isCall());
checkArgument(stringNode.isString());
int index;
String stringAsString = stringNode.getString();
if (arg1 != null && arg1.isNumber()
&& arg1.getNext() == null) {
index = (int) arg1.getDouble(); // depends on control dependency: [if], data = [none]
} else {
return n; // depends on control dependency: [if], data = [none]
}
if (index < 0 || stringAsString.length() <= index) {
// http://es5.github.com/#x15.5.4.4 says "" is returned when index is
// out of bounds but we bail.
return n; // depends on control dependency: [if], data = [none]
}
Node resultNode = IR.string(
stringAsString.substring(index, index + 1));
Node parent = n.getParent();
parent.replaceChild(n, resultNode);
reportChangeToEnclosingScope(parent);
return resultNode;
} } |
public class class_name {
public void flushChildScopes(QName unitId) {
Set<Integer> childScopes = findChildScopes(unitId);
for(Integer scopeId : childScopes)
{
MutableContext mutableContext = statementContexts.get(scopeId);
mutableContext.clearStatements();
}
} } | public class class_name {
public void flushChildScopes(QName unitId) {
Set<Integer> childScopes = findChildScopes(unitId);
for(Integer scopeId : childScopes)
{
MutableContext mutableContext = statementContexts.get(scopeId);
mutableContext.clearStatements(); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public Movie setLoop(final boolean loop)
{
getAttributes().setLoop(loop);
if (null != m_video)
{
m_video.setLoop(loop);
}
return this;
} } | public class class_name {
public Movie setLoop(final boolean loop)
{
getAttributes().setLoop(loop);
if (null != m_video)
{
m_video.setLoop(loop); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
protected void setByteArrayValue(byte[] input) {
this.sValue = null;
this.bValue = input;
this.offset = 0;
this.valueLength = input.length;
if (ELEM_ADDED != this.status) {
this.status = ELEM_CHANGED;
}
} } | public class class_name {
protected void setByteArrayValue(byte[] input) {
this.sValue = null;
this.bValue = input;
this.offset = 0;
this.valueLength = input.length;
if (ELEM_ADDED != this.status) {
this.status = ELEM_CHANGED; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(ListResourceDataSyncRequest listResourceDataSyncRequest, ProtocolMarshaller protocolMarshaller) {
if (listResourceDataSyncRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listResourceDataSyncRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listResourceDataSyncRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListResourceDataSyncRequest listResourceDataSyncRequest, ProtocolMarshaller protocolMarshaller) {
if (listResourceDataSyncRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listResourceDataSyncRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listResourceDataSyncRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected String getParameterString(Map<String, String> parameters,
Class<? extends EndpointConfiguration> endpointConfigurationType) {
StringBuilder paramString = new StringBuilder();
for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) {
Field field = ReflectionUtils.findField(endpointConfigurationType, parameterEntry.getKey());
if (field == null) {
if (paramString.length() == 0) {
paramString.append("?").append(parameterEntry.getKey());
if (parameterEntry.getValue() != null) {
paramString.append("=").append(parameterEntry.getValue());
}
} else {
paramString.append("&").append(parameterEntry.getKey());
if (parameterEntry.getValue() != null) {
paramString.append("=").append(parameterEntry.getValue());
}
}
}
}
return paramString.toString();
} } | public class class_name {
protected String getParameterString(Map<String, String> parameters,
Class<? extends EndpointConfiguration> endpointConfigurationType) {
StringBuilder paramString = new StringBuilder();
for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) {
Field field = ReflectionUtils.findField(endpointConfigurationType, parameterEntry.getKey());
if (field == null) {
if (paramString.length() == 0) {
paramString.append("?").append(parameterEntry.getKey()); // depends on control dependency: [if], data = [none]
if (parameterEntry.getValue() != null) {
paramString.append("=").append(parameterEntry.getValue()); // depends on control dependency: [if], data = [(parameterEntry.getValue()]
}
} else {
paramString.append("&").append(parameterEntry.getKey()); // depends on control dependency: [if], data = [none]
if (parameterEntry.getValue() != null) {
paramString.append("=").append(parameterEntry.getValue()); // depends on control dependency: [if], data = [(parameterEntry.getValue()]
}
}
}
}
return paramString.toString();
} } |
public class class_name {
public Map<String, List<String>> getModuleDependencies() {
if ((m_moduleDependencies == null) || m_moduleDependencies.isEmpty()) {
try {
// open the folder "/WEB-INF/packages/modules/"
m_moduleDependencies = CmsModuleManager.buildDepsForAllModules(getModuleFolder(), true);
} catch (CmsConfigurationException e) {
throw new CmsRuntimeException(e.getMessageContainer());
}
}
return m_moduleDependencies;
} } | public class class_name {
public Map<String, List<String>> getModuleDependencies() {
if ((m_moduleDependencies == null) || m_moduleDependencies.isEmpty()) {
try {
// open the folder "/WEB-INF/packages/modules/"
m_moduleDependencies = CmsModuleManager.buildDepsForAllModules(getModuleFolder(), true); // depends on control dependency: [try], data = [none]
} catch (CmsConfigurationException e) {
throw new CmsRuntimeException(e.getMessageContainer());
} // depends on control dependency: [catch], data = [none]
}
return m_moduleDependencies;
} } |
public class class_name {
@Override
public void process(WatchedEvent event) {
logger.debug("recived event "+ event);
if (event.getState() == KeeperState.Expired || event.getState() == KeeperState.Disconnected){
driver.setGoOn(false);
shutdown();
}
if (event.getType() == EventType.NodeDataChanged || event.getType() == EventType.NodeDeleted ) {
driver.setGoOn(false);
shutdown();
}
} } | public class class_name {
@Override
public void process(WatchedEvent event) {
logger.debug("recived event "+ event);
if (event.getState() == KeeperState.Expired || event.getState() == KeeperState.Disconnected){
driver.setGoOn(false); // depends on control dependency: [if], data = [none]
shutdown(); // depends on control dependency: [if], data = [none]
}
if (event.getType() == EventType.NodeDataChanged || event.getType() == EventType.NodeDeleted ) {
driver.setGoOn(false); // depends on control dependency: [if], data = [none]
shutdown(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<$.T2<String, String>> options(CommanderClassMetaInfo classMetaInfo, AppClassLoader classLoader) {
List<$.T2<String, String>> retVal = new ArrayList<>();
for (CommandParamMetaInfo param : params) {
OptionAnnoInfoBase opt = param.optionInfo();
if (null != opt) {
retVal.add($.T2(opt.leads(), opt.help()));
}
}
for (OptionAnnoInfoBase opt : classMetaInfo.fieldOptionAnnoInfoList(classLoader)) {
retVal.add($.T2(opt.leads(), opt.help()));
}
return retVal;
} } | public class class_name {
public List<$.T2<String, String>> options(CommanderClassMetaInfo classMetaInfo, AppClassLoader classLoader) {
List<$.T2<String, String>> retVal = new ArrayList<>();
for (CommandParamMetaInfo param : params) {
OptionAnnoInfoBase opt = param.optionInfo();
if (null != opt) {
retVal.add($.T2(opt.leads(), opt.help())); // depends on control dependency: [if], data = [none]
}
}
for (OptionAnnoInfoBase opt : classMetaInfo.fieldOptionAnnoInfoList(classLoader)) {
retVal.add($.T2(opt.leads(), opt.help())); // depends on control dependency: [for], data = [opt]
}
return retVal;
} } |
public class class_name {
public void updatePoi(final String BLIP_NAME, final Point2D LOCATION) {
if (pois.keySet().contains(BLIP_NAME)) {
pois.get(BLIP_NAME).setLocation(LOCATION);
checkForBlips();
}
} } | public class class_name {
public void updatePoi(final String BLIP_NAME, final Point2D LOCATION) {
if (pois.keySet().contains(BLIP_NAME)) {
pois.get(BLIP_NAME).setLocation(LOCATION); // depends on control dependency: [if], data = [none]
checkForBlips(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<ListenerType<TldTaglibType<T>>> getAllListener()
{
List<ListenerType<TldTaglibType<T>>> list = new ArrayList<ListenerType<TldTaglibType<T>>>();
List<Node> nodeList = childNode.get("listener");
for(Node node: nodeList)
{
ListenerType<TldTaglibType<T>> type = new ListenerTypeImpl<TldTaglibType<T>>(this, "listener", childNode, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<ListenerType<TldTaglibType<T>>> getAllListener()
{
List<ListenerType<TldTaglibType<T>>> list = new ArrayList<ListenerType<TldTaglibType<T>>>();
List<Node> nodeList = childNode.get("listener");
for(Node node: nodeList)
{
ListenerType<TldTaglibType<T>> type = new ListenerTypeImpl<TldTaglibType<T>>(this, "listener", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
IPortletDefinition unmarshall(ExternalPortletDefinition epd) {
final PortletDescriptor portletDescriptor = epd.getPortletDescriptor();
final Boolean isFramework = portletDescriptor.isIsFramework();
if (isFramework != null
&& isFramework
&& "UPGRADED_CHANNEL_IS_NOT_A_PORTLET".equals(portletDescriptor.getPortletName())) {
if (errorOnChannel) {
throw new IllegalArgumentException(
epd.getFname()
+ " is not a portlet. It was likely an IChannel from a previous version of uPortal and cannot be imported.");
}
logger.warn(
epd.getFname()
+ " is not a portlet. It was likely an IChannel from a previous version of uPortal and will not be imported.");
return null;
}
// get the portlet type
final IPortletType portletType = portletTypeRegistry.getPortletType(epd.getType());
if (portletType == null) {
throw new IllegalArgumentException("No portlet type registered for: " + epd.getType());
}
final String fname = epd.getFname();
IPortletDefinition rslt = portletDefinitionDao.getPortletDefinitionByFname(fname);
if (rslt == null) {
rslt =
new PortletDefinitionImpl(
portletType,
fname,
epd.getName(),
epd.getTitle(),
portletDescriptor.getWebAppName(),
portletDescriptor.getPortletName(),
isFramework != null ? isFramework : false);
} else {
final IPortletDescriptorKey portletDescriptorKey = rslt.getPortletDescriptorKey();
portletDescriptorKey.setPortletName(portletDescriptor.getPortletName());
if (isFramework != null && isFramework) {
portletDescriptorKey.setFrameworkPortlet(true);
portletDescriptorKey.setWebAppName(null);
} else {
portletDescriptorKey.setFrameworkPortlet(false);
portletDescriptorKey.setWebAppName(portletDescriptor.getWebAppName());
}
rslt.setName(epd.getName());
rslt.setTitle(epd.getTitle());
rslt.setType(portletType);
}
rslt.setDescription(epd.getDesc());
final BigInteger timeout = epd.getTimeout();
if (timeout != null) {
rslt.setTimeout(timeout.intValue());
}
final BigInteger actionTimeout = epd.getActionTimeout();
if (actionTimeout != null) {
rslt.setActionTimeout(actionTimeout.intValue());
}
final BigInteger eventTimeout = epd.getEventTimeout();
if (eventTimeout != null) {
rslt.setEventTimeout(eventTimeout.intValue());
}
final BigInteger renderTimeout = epd.getRenderTimeout();
if (renderTimeout != null) {
rslt.setRenderTimeout(renderTimeout.intValue());
}
final BigInteger resourceTimeout = epd.getResourceTimeout();
if (resourceTimeout != null) {
rslt.setResourceTimeout(resourceTimeout.intValue());
}
unmarshallLifecycle(epd.getLifecycle(), rslt);
final Set<IPortletDefinitionParameter> parameters = new LinkedHashSet<>();
for (ExternalPortletParameter param : epd.getParameters()) {
parameters.add(new PortletDefinitionParameterImpl(param.getName(), param.getValue()));
}
rslt.setParameters(parameters);
final ArrayList<IPortletPreference> preferenceList = new ArrayList<>();
for (ExternalPortletPreference pref : epd.getPortletPreferences()) {
final List<String> valueList = pref.getValues();
final String[] values = valueList.toArray(new String[valueList.size()]);
final Boolean readOnly = pref.isReadOnly();
preferenceList.add(
new PortletPreferenceImpl(
pref.getName(), readOnly != null ? readOnly : false, values));
}
rslt.setPortletPreferences(preferenceList);
return rslt;
} } | public class class_name {
IPortletDefinition unmarshall(ExternalPortletDefinition epd) {
final PortletDescriptor portletDescriptor = epd.getPortletDescriptor();
final Boolean isFramework = portletDescriptor.isIsFramework();
if (isFramework != null
&& isFramework
&& "UPGRADED_CHANNEL_IS_NOT_A_PORTLET".equals(portletDescriptor.getPortletName())) {
if (errorOnChannel) {
throw new IllegalArgumentException(
epd.getFname()
+ " is not a portlet. It was likely an IChannel from a previous version of uPortal and cannot be imported.");
}
logger.warn(
epd.getFname()
+ " is not a portlet. It was likely an IChannel from a previous version of uPortal and will not be imported."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [null]
}
// get the portlet type
final IPortletType portletType = portletTypeRegistry.getPortletType(epd.getType());
if (portletType == null) {
throw new IllegalArgumentException("No portlet type registered for: " + epd.getType());
}
final String fname = epd.getFname();
IPortletDefinition rslt = portletDefinitionDao.getPortletDefinitionByFname(fname);
if (rslt == null) {
rslt =
new PortletDefinitionImpl(
portletType,
fname,
epd.getName(),
epd.getTitle(),
portletDescriptor.getWebAppName(),
portletDescriptor.getPortletName(),
isFramework != null ? isFramework : false); // depends on control dependency: [if], data = [none]
} else {
final IPortletDescriptorKey portletDescriptorKey = rslt.getPortletDescriptorKey();
portletDescriptorKey.setPortletName(portletDescriptor.getPortletName()); // depends on control dependency: [if], data = [none]
if (isFramework != null && isFramework) {
portletDescriptorKey.setFrameworkPortlet(true); // depends on control dependency: [if], data = [none]
portletDescriptorKey.setWebAppName(null); // depends on control dependency: [if], data = [none]
} else {
portletDescriptorKey.setFrameworkPortlet(false); // depends on control dependency: [if], data = [none]
portletDescriptorKey.setWebAppName(portletDescriptor.getWebAppName()); // depends on control dependency: [if], data = [none]
}
rslt.setName(epd.getName()); // depends on control dependency: [if], data = [none]
rslt.setTitle(epd.getTitle()); // depends on control dependency: [if], data = [none]
rslt.setType(portletType); // depends on control dependency: [if], data = [none]
}
rslt.setDescription(epd.getDesc());
final BigInteger timeout = epd.getTimeout();
if (timeout != null) {
rslt.setTimeout(timeout.intValue()); // depends on control dependency: [if], data = [(timeout]
}
final BigInteger actionTimeout = epd.getActionTimeout();
if (actionTimeout != null) {
rslt.setActionTimeout(actionTimeout.intValue()); // depends on control dependency: [if], data = [(actionTimeout]
}
final BigInteger eventTimeout = epd.getEventTimeout();
if (eventTimeout != null) {
rslt.setEventTimeout(eventTimeout.intValue()); // depends on control dependency: [if], data = [(eventTimeout]
}
final BigInteger renderTimeout = epd.getRenderTimeout();
if (renderTimeout != null) {
rslt.setRenderTimeout(renderTimeout.intValue()); // depends on control dependency: [if], data = [(renderTimeout]
}
final BigInteger resourceTimeout = epd.getResourceTimeout();
if (resourceTimeout != null) {
rslt.setResourceTimeout(resourceTimeout.intValue()); // depends on control dependency: [if], data = [(resourceTimeout]
}
unmarshallLifecycle(epd.getLifecycle(), rslt);
final Set<IPortletDefinitionParameter> parameters = new LinkedHashSet<>();
for (ExternalPortletParameter param : epd.getParameters()) {
parameters.add(new PortletDefinitionParameterImpl(param.getName(), param.getValue())); // depends on control dependency: [for], data = [param]
}
rslt.setParameters(parameters);
final ArrayList<IPortletPreference> preferenceList = new ArrayList<>();
for (ExternalPortletPreference pref : epd.getPortletPreferences()) {
final List<String> valueList = pref.getValues();
final String[] values = valueList.toArray(new String[valueList.size()]);
final Boolean readOnly = pref.isReadOnly();
preferenceList.add(
new PortletPreferenceImpl(
pref.getName(), readOnly != null ? readOnly : false, values)); // depends on control dependency: [for], data = [pref]
}
rslt.setPortletPreferences(preferenceList);
return rslt;
} } |
public class class_name {
public static BuildDocHandler fromDirectoryAndJar(
File directory, JarFile jarFile, String base, boolean fallbackToJar) {
FileRepository fileRepo = new FilesystemRepository(directory);
FileRepository jarRepo = new JarRepository(jarFile, Option.apply(base));
FileRepository manualRepo;
if (fallbackToJar) {
manualRepo = new AggregateFileRepository(new FileRepository[] {fileRepo, jarRepo});
} else {
manualRepo = fileRepo;
}
return new DocumentationHandler(manualRepo, jarRepo);
} } | public class class_name {
public static BuildDocHandler fromDirectoryAndJar(
File directory, JarFile jarFile, String base, boolean fallbackToJar) {
FileRepository fileRepo = new FilesystemRepository(directory);
FileRepository jarRepo = new JarRepository(jarFile, Option.apply(base));
FileRepository manualRepo;
if (fallbackToJar) {
manualRepo = new AggregateFileRepository(new FileRepository[] {fileRepo, jarRepo}); // depends on control dependency: [if], data = [none]
} else {
manualRepo = fileRepo; // depends on control dependency: [if], data = [none]
}
return new DocumentationHandler(manualRepo, jarRepo);
} } |
public class class_name {
public void addHeader(String name, String value) {
if(logger.isDebugEnabled()) {
logger.debug("addHeader - name=" + name + ", value=" + value);
}
checkCommitted();
addHeaderInternal(name, value, false);
} } | public class class_name {
public void addHeader(String name, String value) {
if(logger.isDebugEnabled()) {
logger.debug("addHeader - name=" + name + ", value=" + value); // depends on control dependency: [if], data = [none]
}
checkCommitted();
addHeaderInternal(name, value, false);
} } |
public class class_name {
public static Object getAggAttribute(Map<String,?> map ,String metrics,String attribute){
if(map != null) {
Map<String, Object> metrics_ = (Map<String, Object>) map.get(metrics);
if (metrics_ != null) {
return metrics_.get(attribute);
}
}
return null;
} } | public class class_name {
public static Object getAggAttribute(Map<String,?> map ,String metrics,String attribute){
if(map != null) {
Map<String, Object> metrics_ = (Map<String, Object>) map.get(metrics);
if (metrics_ != null) {
return metrics_.get(attribute); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.