code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
static DBIDs randomSample(DBIDs ids, int samplesize, Random rnd, DBIDs previous) {
if(previous == null) {
return DBIDUtil.randomSample(ids, samplesize, rnd);
}
ModifiableDBIDs sample = DBIDUtil.newHashSet(samplesize);
sample.addDBIDs(previous);
sample.addDBIDs(DBIDUtil.randomSample(ids, samplesize - previous.size(), rnd));
// If these two were not disjoint, we can be short of the desired size!
if(sample.size() < samplesize) {
// Draw a large enough sample to make sure to be able to fill it now.
// This can be less random though, because the iterator may impose an
// order; but this is a rare code path.
for(DBIDIter it = DBIDUtil.randomSample(ids, samplesize, rnd).iter(); sample.size() < samplesize && it.valid(); it.advance()) {
sample.add(it);
}
}
return sample;
} } | public class class_name {
static DBIDs randomSample(DBIDs ids, int samplesize, Random rnd, DBIDs previous) {
if(previous == null) {
return DBIDUtil.randomSample(ids, samplesize, rnd); // depends on control dependency: [if], data = [none]
}
ModifiableDBIDs sample = DBIDUtil.newHashSet(samplesize);
sample.addDBIDs(previous);
sample.addDBIDs(DBIDUtil.randomSample(ids, samplesize - previous.size(), rnd));
// If these two were not disjoint, we can be short of the desired size!
if(sample.size() < samplesize) {
// Draw a large enough sample to make sure to be able to fill it now.
// This can be less random though, because the iterator may impose an
// order; but this is a rare code path.
for(DBIDIter it = DBIDUtil.randomSample(ids, samplesize, rnd).iter(); sample.size() < samplesize && it.valid(); it.advance()) {
sample.add(it); // depends on control dependency: [for], data = [it]
}
}
return sample;
} } |
public class class_name {
public Promise transferFrom(File source) {
try {
return transferFrom(new FileInputStream(source));
} catch (Throwable cause) {
return Promise.reject(cause);
}
} } | public class class_name {
public Promise transferFrom(File source) {
try {
return transferFrom(new FileInputStream(source));
// depends on control dependency: [try], data = [none]
} catch (Throwable cause) {
return Promise.reject(cause);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean checkStorageAccessPermissions(Context context)
{ //Only for Android M and above.
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
String permission = "android.permission.READ_EXTERNAL_STORAGE";
int res = context.checkCallingOrSelfPermission(permission);
return (res == PackageManager.PERMISSION_GRANTED);
}
else
{ //Pre Marshmallow can rely on Manifest defined permissions.
return true;
}
} } | public class class_name {
public static boolean checkStorageAccessPermissions(Context context)
{ //Only for Android M and above.
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
String permission = "android.permission.READ_EXTERNAL_STORAGE";
int res = context.checkCallingOrSelfPermission(permission);
return (res == PackageManager.PERMISSION_GRANTED); // depends on control dependency: [if], data = [none]
}
else
{ //Pre Marshmallow can rely on Manifest defined permissions.
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <S, T> FromUnmarshaller<S, T> findUnmarshaller(ConverterKey<S,T> key) {
Converter<T,S> converter = findConverter(key.invert());
if (converter == null) {
return null;
}
if (FromUnmarshallerConverter.class.isAssignableFrom(converter.getClass())) {
return ((FromUnmarshallerConverter<S, T>)converter).getUnmarshaller();
} else {
return new ConverterFromUnmarshaller<S, T>(converter);
}
} } | public class class_name {
public <S, T> FromUnmarshaller<S, T> findUnmarshaller(ConverterKey<S,T> key) {
Converter<T,S> converter = findConverter(key.invert());
if (converter == null) {
return null;
// depends on control dependency: [if], data = [none]
}
if (FromUnmarshallerConverter.class.isAssignableFrom(converter.getClass())) {
return ((FromUnmarshallerConverter<S, T>)converter).getUnmarshaller();
// depends on control dependency: [if], data = [none]
} else {
return new ConverterFromUnmarshaller<S, T>(converter);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public XmlSchemaAnnotation createLegStarAnnotation(
final XsdDataItem xsdDataItem) {
Document doc = _docBuilder.newDocument();
Element el = doc.createElementNS(getCOXBNamespace(), getCOXBElements());
Element elc = doc.createElementNS(getCOXBNamespace(), getCOXBElement());
elc.setAttribute(CobolMarkup.LEVEL_NUMBER,
Integer.toString(xsdDataItem.getLevelNumber()));
elc.setAttribute(CobolMarkup.COBOL_NAME, xsdDataItem.getCobolName());
elc.setAttribute(CobolMarkup.TYPE, xsdDataItem.getCobolType()
.toString());
if (xsdDataItem.getCobolType() != CobolTypes.GROUP_ITEM) {
if (xsdDataItem.getPicture() != null) {
elc.setAttribute(CobolMarkup.PICTURE, xsdDataItem.getPicture());
}
if (xsdDataItem.getUsage() != null) {
elc.setAttribute(CobolMarkup.USAGE,
xsdDataItem.getUsageForCobol());
}
if (xsdDataItem.isJustifiedRight()) {
elc.setAttribute(CobolMarkup.IS_JUSTIFIED_RIGHT, "true");
}
if (xsdDataItem.getTotalDigits() > 0) {
elc.setAttribute(CobolMarkup.IS_SIGNED,
(xsdDataItem.isSigned()) ? "true" : "false");
elc.setAttribute(CobolMarkup.TOTAL_DIGITS,
Integer.toString(xsdDataItem.getTotalDigits()));
if (xsdDataItem.getFractionDigits() > 0) {
elc.setAttribute(CobolMarkup.FRACTION_DIGITS,
Integer.toString(xsdDataItem.getFractionDigits()));
}
if (xsdDataItem.isSignLeading()) {
elc.setAttribute(CobolMarkup.IS_SIGN_LEADING, "true");
}
if (xsdDataItem.isSignSeparate()) {
elc.setAttribute(CobolMarkup.IS_SIGN_SEPARATE, "true");
}
}
}
/*
* Annotations transfer the COBOL occurs semantic (as opposed to the XSD
* semantic). No depending on => fixed size array
*/
if (xsdDataItem.getCobolMaxOccurs() > 0) {
elc.setAttribute(CobolMarkup.MAX_OCCURS,
Integer.toString(xsdDataItem.getCobolMaxOccurs()));
if (xsdDataItem.getDependingOn() == null) {
elc.setAttribute(CobolMarkup.MIN_OCCURS,
Integer.toString(xsdDataItem.getCobolMaxOccurs()));
} else {
elc.setAttribute(CobolMarkup.DEPENDING_ON,
xsdDataItem.getDependingOn());
elc.setAttribute(CobolMarkup.MIN_OCCURS,
Integer.toString(xsdDataItem.getCobolMinOccurs()));
}
}
if (xsdDataItem.isODOObject()) {
elc.setAttribute(CobolMarkup.IS_ODO_OBJECT, "true");
}
if (xsdDataItem.getRedefines() != null) {
elc.setAttribute(CobolMarkup.REDEFINES, xsdDataItem.getRedefines());
}
if (xsdDataItem.isRedefined()) {
elc.setAttribute(CobolMarkup.IS_REDEFINED, "true");
elc.setAttribute(CobolMarkup.UNMARSHAL_CHOICE_STRATEGY, "");
}
if (xsdDataItem.getValue() != null
&& xsdDataItem.getValue().length() > 0) {
elc.setAttribute(CobolMarkup.VALUE, ValueUtil.resolveFigurative(
xsdDataItem.getValue(), xsdDataItem.getMaxStorageLength(),
getConfig().quoteIsQuote()));
}
if (xsdDataItem.getSrceLine() > 0) {
elc.setAttribute(CobolMarkup.SRCE_LINE,
Integer.toString(xsdDataItem.getSrceLine()));
}
el.appendChild(elc);
XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo();
appInfo.setMarkup(el.getChildNodes());
/* Create annotation */
XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
annotation.getItems().add(appInfo);
return annotation;
} } | public class class_name {
public XmlSchemaAnnotation createLegStarAnnotation(
final XsdDataItem xsdDataItem) {
Document doc = _docBuilder.newDocument();
Element el = doc.createElementNS(getCOXBNamespace(), getCOXBElements());
Element elc = doc.createElementNS(getCOXBNamespace(), getCOXBElement());
elc.setAttribute(CobolMarkup.LEVEL_NUMBER,
Integer.toString(xsdDataItem.getLevelNumber()));
elc.setAttribute(CobolMarkup.COBOL_NAME, xsdDataItem.getCobolName());
elc.setAttribute(CobolMarkup.TYPE, xsdDataItem.getCobolType()
.toString());
if (xsdDataItem.getCobolType() != CobolTypes.GROUP_ITEM) {
if (xsdDataItem.getPicture() != null) {
elc.setAttribute(CobolMarkup.PICTURE, xsdDataItem.getPicture()); // depends on control dependency: [if], data = [none]
}
if (xsdDataItem.getUsage() != null) {
elc.setAttribute(CobolMarkup.USAGE,
xsdDataItem.getUsageForCobol()); // depends on control dependency: [if], data = [none]
}
if (xsdDataItem.isJustifiedRight()) {
elc.setAttribute(CobolMarkup.IS_JUSTIFIED_RIGHT, "true"); // depends on control dependency: [if], data = [none]
}
if (xsdDataItem.getTotalDigits() > 0) {
elc.setAttribute(CobolMarkup.IS_SIGNED,
(xsdDataItem.isSigned()) ? "true" : "false"); // depends on control dependency: [if], data = [none]
elc.setAttribute(CobolMarkup.TOTAL_DIGITS,
Integer.toString(xsdDataItem.getTotalDigits())); // depends on control dependency: [if], data = [none]
if (xsdDataItem.getFractionDigits() > 0) {
elc.setAttribute(CobolMarkup.FRACTION_DIGITS,
Integer.toString(xsdDataItem.getFractionDigits())); // depends on control dependency: [if], data = [none]
}
if (xsdDataItem.isSignLeading()) {
elc.setAttribute(CobolMarkup.IS_SIGN_LEADING, "true"); // depends on control dependency: [if], data = [none]
}
if (xsdDataItem.isSignSeparate()) {
elc.setAttribute(CobolMarkup.IS_SIGN_SEPARATE, "true"); // depends on control dependency: [if], data = [none]
}
}
}
/*
* Annotations transfer the COBOL occurs semantic (as opposed to the XSD
* semantic). No depending on => fixed size array
*/
if (xsdDataItem.getCobolMaxOccurs() > 0) {
elc.setAttribute(CobolMarkup.MAX_OCCURS,
Integer.toString(xsdDataItem.getCobolMaxOccurs())); // depends on control dependency: [if], data = [none]
if (xsdDataItem.getDependingOn() == null) {
elc.setAttribute(CobolMarkup.MIN_OCCURS,
Integer.toString(xsdDataItem.getCobolMaxOccurs())); // depends on control dependency: [if], data = [none]
} else {
elc.setAttribute(CobolMarkup.DEPENDING_ON,
xsdDataItem.getDependingOn()); // depends on control dependency: [if], data = [none]
elc.setAttribute(CobolMarkup.MIN_OCCURS,
Integer.toString(xsdDataItem.getCobolMinOccurs())); // depends on control dependency: [if], data = [none]
}
}
if (xsdDataItem.isODOObject()) {
elc.setAttribute(CobolMarkup.IS_ODO_OBJECT, "true"); // depends on control dependency: [if], data = [none]
}
if (xsdDataItem.getRedefines() != null) {
elc.setAttribute(CobolMarkup.REDEFINES, xsdDataItem.getRedefines()); // depends on control dependency: [if], data = [none]
}
if (xsdDataItem.isRedefined()) {
elc.setAttribute(CobolMarkup.IS_REDEFINED, "true"); // depends on control dependency: [if], data = [none]
elc.setAttribute(CobolMarkup.UNMARSHAL_CHOICE_STRATEGY, ""); // depends on control dependency: [if], data = [none]
}
if (xsdDataItem.getValue() != null
&& xsdDataItem.getValue().length() > 0) {
elc.setAttribute(CobolMarkup.VALUE, ValueUtil.resolveFigurative(
xsdDataItem.getValue(), xsdDataItem.getMaxStorageLength(),
getConfig().quoteIsQuote())); // depends on control dependency: [if], data = [none]
}
if (xsdDataItem.getSrceLine() > 0) {
elc.setAttribute(CobolMarkup.SRCE_LINE,
Integer.toString(xsdDataItem.getSrceLine())); // depends on control dependency: [if], data = [none]
}
el.appendChild(elc);
XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo();
appInfo.setMarkup(el.getChildNodes());
/* Create annotation */
XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
annotation.getItems().add(appInfo);
return annotation;
} } |
public class class_name {
@Programmatic
public List<CommunicationChannelOwnerLink> findByOwner(final Object owner) {
if(owner == null) {
return null;
}
final Bookmark bookmark = bookmarkService.bookmarkFor(owner);
if(bookmark == null) {
return null;
}
final String ownerStr = bookmark.toString();
return repositoryService.allMatches(
new QueryDefault<>(CommunicationChannelOwnerLink.class,
"findByOwner",
"ownerStr", ownerStr));
} } | public class class_name {
@Programmatic
public List<CommunicationChannelOwnerLink> findByOwner(final Object owner) {
if(owner == null) {
return null; // depends on control dependency: [if], data = [none]
}
final Bookmark bookmark = bookmarkService.bookmarkFor(owner);
if(bookmark == null) {
return null; // depends on control dependency: [if], data = [none]
}
final String ownerStr = bookmark.toString();
return repositoryService.allMatches(
new QueryDefault<>(CommunicationChannelOwnerLink.class,
"findByOwner",
"ownerStr", ownerStr));
} } |
public class class_name {
public static int schemeToDefaultPort(final String scheme) {
if(scheme.equals(HTTP_SCHEME)) {
return 80;
}
if(scheme.equals(HTTPS_SCHEME)) {
return 443;
}
if(scheme.equals(FTP_SCHEME)) {
return 21;
}
if(scheme.equals(RTSP_SCHEME)) {
return 554;
}
if(scheme.equals(MMS_SCHEME)) {
return 1755;
}
return -1;
} } | public class class_name {
public static int schemeToDefaultPort(final String scheme) {
if(scheme.equals(HTTP_SCHEME)) {
return 80; // depends on control dependency: [if], data = [none]
}
if(scheme.equals(HTTPS_SCHEME)) {
return 443; // depends on control dependency: [if], data = [none]
}
if(scheme.equals(FTP_SCHEME)) {
return 21; // depends on control dependency: [if], data = [none]
}
if(scheme.equals(RTSP_SCHEME)) {
return 554; // depends on control dependency: [if], data = [none]
}
if(scheme.equals(MMS_SCHEME)) {
return 1755; // depends on control dependency: [if], data = [none]
}
return -1;
} } |
public class class_name {
public static DiscountCurve createDiscountFactorsFromForwardRates(String name, TimeDiscretization tenor, double[] forwardRates) {
DiscountCurveInterpolation discountFactors = new DiscountCurveInterpolation(name);
double df = 1.0;
for(int timeIndex=0; timeIndex<tenor.getNumberOfTimeSteps();timeIndex++) {
df /= 1.0 + forwardRates[timeIndex] * tenor.getTimeStep(timeIndex);
discountFactors.addDiscountFactor(tenor.getTime(timeIndex+1), df, tenor.getTime(timeIndex+1) > 0);
}
return discountFactors;
} } | public class class_name {
public static DiscountCurve createDiscountFactorsFromForwardRates(String name, TimeDiscretization tenor, double[] forwardRates) {
DiscountCurveInterpolation discountFactors = new DiscountCurveInterpolation(name);
double df = 1.0;
for(int timeIndex=0; timeIndex<tenor.getNumberOfTimeSteps();timeIndex++) {
df /= 1.0 + forwardRates[timeIndex] * tenor.getTimeStep(timeIndex); // depends on control dependency: [for], data = [timeIndex]
discountFactors.addDiscountFactor(tenor.getTime(timeIndex+1), df, tenor.getTime(timeIndex+1) > 0); // depends on control dependency: [for], data = [timeIndex]
}
return discountFactors;
} } |
public class class_name {
private List<String> getCollection(String value) {
String arrayString = value;
if (arrayString.startsWith("[") && arrayString.endsWith("]")) {
arrayString = arrayString.substring(1, arrayString.length()-1);
}
return Arrays.stream(StringUtils.commaDelimitedListToStringArray(arrayString))
.map(String::trim)
.map(VariableUtils::cutOffDoubleQuotes)
.collect(Collectors.toList());
} } | public class class_name {
private List<String> getCollection(String value) {
String arrayString = value;
if (arrayString.startsWith("[") && arrayString.endsWith("]")) {
arrayString = arrayString.substring(1, arrayString.length()-1); // depends on control dependency: [if], data = [none]
}
return Arrays.stream(StringUtils.commaDelimitedListToStringArray(arrayString))
.map(String::trim)
.map(VariableUtils::cutOffDoubleQuotes)
.collect(Collectors.toList());
} } |
public class class_name {
public void shutdown() {
if (clientList == null) {
return;
}
cancelEvictor();
for (RedisClient connection : clientList) {
try {
connection.shutdown();
} catch (Exception e) {
logger.debug(e.getMessage(), e);
}
}
} } | public class class_name {
public void shutdown() {
if (clientList == null) {
return; // depends on control dependency: [if], data = [none]
}
cancelEvictor();
for (RedisClient connection : clientList) {
try {
connection.shutdown(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.debug(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected LogEvent createLogEntry(
LogLevelType logLevel,
MuleMessage message,
String logMessage,
String argIntegrationScenario, String argContractId, Map<String, String> businessContextId,
Map<String, String> extraInfo,
Object payload,
Throwable exception) {
// --------------------------
//
// 1. Process input variables
//
// --------------------------
// TODO: Will event-context always be null when an error is reported?
// If so then its probably better to move this code to the info-logger method.
String serviceImplementation = "";
MuleEventContext event = RequestContext.getEventContext();
if (event != null) {
serviceImplementation = MuleUtil.getServiceName(event);
}
String endpoint = getEndpoint(message, event);
String messageId = "";
String integrationScenarioId = "";
String contractId = "";
String businessCorrelationId = "";
String propertyBusinessContextId = null;
if (message != null) {
if (log.isDebugEnabled()) {
@SuppressWarnings("rawtypes")
Set names = message.getPropertyNames(PropertyScope.INBOUND);
for (Object object : names) {
Object value = message.getInboundProperty(object.toString());
log.debug(object + " = " + value + " (" + object.getClass().getName() + ")");
}
}
messageId = message.getUniqueId();
contractId = message.getInboundProperty(SOITOOLKIT_CONTRACT_ID, "");
businessCorrelationId = message.getSessionProperty(SOITOOLKIT_CORRELATION_ID, "");
// Required to propagate correlation id (jms->http)
if ("".equals(businessCorrelationId)) {
businessCorrelationId = message.getInboundProperty(SOITOOLKIT_CORRELATION_ID, "");
}
integrationScenarioId = message.getInboundProperty(SOITOOLKIT_INTEGRATION_SCENARIO, "");
propertyBusinessContextId = message.getInboundProperty(SOITOOLKIT_BUSINESS_CONTEXT_ID, null);
// Override contract id from the message properties with the supplied one from the log-call, if any
if (argContractId != null && argContractId.length() > 0) {
contractId = argContractId;
}
// Override contract id from the message properties with the supplied one from the log-call, if any
if (argIntegrationScenario != null && argIntegrationScenario.length() > 0) {
integrationScenarioId = argIntegrationScenario;
}
}
String componentId = getServerId();
// Only extract payload if debug is enabled!
String payloadASstring = (messageLogger.isDebugEnabled())? getPayloadAsString(payload) : "";
// -------------------------
//
// 2. Create LogEvent object
//
// -------------------------
// Setup basic runtime information for the log entry
LogRuntimeInfoType lri = new LogRuntimeInfoType();
lri.setTimestamp(XmlUtil.convertDateToXmlDate(null));
lri.setHostName(HOST_NAME);
lri.setHostIp(HOST_IP);
lri.setProcessId(PROCESS_ID);
lri.setThreadId(Thread.currentThread().getName());
lri.setComponentId(componentId);
lri.setMessageId(messageId);
lri.setBusinessCorrelationId(businessCorrelationId);
// Add any business contexts
if (businessContextId != null) {
Set<Entry<String, String>> entries = businessContextId.entrySet();
for (Entry<String, String> entry : entries) {
BusinessContextId bxid = new BusinessContextId();
bxid.setName(entry.getKey());
bxid.setValue(entry.getValue());
lri.getBusinessContextId().add(bxid);
}
}
// Also add any business contexts from message properties
if (propertyBusinessContextId != null) {
String[] propertyArr = propertyBusinessContextId.split(",");
for (String property : propertyArr) {
String[] nameValueArr = property.split("=");
String name = nameValueArr[0];
String value = (nameValueArr.length > 1) ? nameValueArr[1] : "";
BusinessContextId bxid = new BusinessContextId();
bxid.setName(name);
bxid.setValue(value);
lri.getBusinessContextId().add(bxid);
}
}
// Setup basic metadata information for the log entry
LogMetadataInfoType lmi = new LogMetadataInfoType();
lmi.setLoggerName(messageLogger.getName());
lmi.setIntegrationScenarioId(integrationScenarioId);
lmi.setContractId(contractId);
lmi.setServiceImplementation(serviceImplementation);
lmi.setEndpoint(endpoint);
// Setup basic information of the log message for the log entry
LogMessageType lm = new LogMessageType();
lm.setLevel(logLevel);
lm.setMessage(logMessage);
// Setup exception information if present
if (exception != null) {
exception = (DefaultMuleConfiguration.verboseExceptions) ? exception : ExceptionHelper.summarise(exception, 5);
LogMessageExceptionType lme = new LogMessageExceptionType();
lme.setExceptionClass(exception.getClass().getName());
lme.setExceptionMessage(exception.getMessage());
StackTraceElement[] stArr = exception.getStackTrace();
List<String> stList = new ArrayList<String>();
for (int i = 0; i < stArr.length; i++) {
stList.add(stArr[i].toString());
}
if (exception.getCause() != null) {
Throwable ce = exception.getCause();
ce = (DefaultMuleConfiguration.verboseExceptions) ? ce : ExceptionHelper.summarise(ce, 5);
stList.add(CAUSE_EXCEPTION_HEADER + ": " + ce.getMessage());
StackTraceElement[] ceStArr = ce.getStackTrace();
for (int i = 0; i < ceStArr.length; i++) {
stList.add(ceStArr[i].toString());
}
}
if (!DefaultMuleConfiguration.verboseExceptions) {
stList.add("*** set debug level logging or '-Dmule.verbose.exceptions=true' for full stacktrace ***");
}
lme.getStackTrace().addAll(stList);
// if (exception instanceof MuleException) {
// MuleException de = (MuleException)exception;
// System.err.println("Cause: " + de.getCause());
// StackTraceElement[] st = de.getCause().getStackTrace();
// for (int i = 0; i < st.length; i++) {
//// stList.add(st[i].toString());
// System.err.println(st[i].toString());
// }
//// System.err.println("Detailed: " + de.getDetailedMessage());
//// System.err.println("Summary: " + de.getSummaryMessage());
//// System.err.println("Verbose: " + de.getVerboseMessage());
// }
lm.setException(lme);
}
// Create the log entry object
LogEntryType logEntry = new LogEntryType();
logEntry.setMetadataInfo(lmi);
logEntry.setRuntimeInfo(lri);
logEntry.setMessageInfo(lm);
logEntry.setPayload(payloadASstring);
// Add any extra info
if (extraInfo != null) {
Set<Entry<String, String>> entries = extraInfo.entrySet();
for (Entry<String, String> entry : entries) {
ExtraInfo ei = new ExtraInfo();
ei.setName(entry.getKey());
ei.setValue(entry.getValue());
logEntry.getExtraInfo().add(ei);
}
}
// Create the final log event object
LogEvent logEvent = new LogEvent();
logEvent.setLogEntry(logEntry);
// We are actually done :-)
return logEvent;
} } | public class class_name {
protected LogEvent createLogEntry(
LogLevelType logLevel,
MuleMessage message,
String logMessage,
String argIntegrationScenario, String argContractId, Map<String, String> businessContextId,
Map<String, String> extraInfo,
Object payload,
Throwable exception) {
// --------------------------
//
// 1. Process input variables
//
// --------------------------
// TODO: Will event-context always be null when an error is reported?
// If so then its probably better to move this code to the info-logger method.
String serviceImplementation = "";
MuleEventContext event = RequestContext.getEventContext();
if (event != null) {
serviceImplementation = MuleUtil.getServiceName(event); // depends on control dependency: [if], data = [(event]
}
String endpoint = getEndpoint(message, event);
String messageId = "";
String integrationScenarioId = "";
String contractId = "";
String businessCorrelationId = "";
String propertyBusinessContextId = null;
if (message != null) {
if (log.isDebugEnabled()) {
@SuppressWarnings("rawtypes")
Set names = message.getPropertyNames(PropertyScope.INBOUND);
for (Object object : names) {
Object value = message.getInboundProperty(object.toString());
log.debug(object + " = " + value + " (" + object.getClass().getName() + ")");
}
}
messageId = message.getUniqueId();
contractId = message.getInboundProperty(SOITOOLKIT_CONTRACT_ID, "");
businessCorrelationId = message.getSessionProperty(SOITOOLKIT_CORRELATION_ID, "");
// Required to propagate correlation id (jms->http)
if ("".equals(businessCorrelationId)) {
businessCorrelationId = message.getInboundProperty(SOITOOLKIT_CORRELATION_ID, "");
}
integrationScenarioId = message.getInboundProperty(SOITOOLKIT_INTEGRATION_SCENARIO, "");
propertyBusinessContextId = message.getInboundProperty(SOITOOLKIT_BUSINESS_CONTEXT_ID, null);
// Override contract id from the message properties with the supplied one from the log-call, if any
if (argContractId != null && argContractId.length() > 0) {
contractId = argContractId;
}
// Override contract id from the message properties with the supplied one from the log-call, if any
if (argIntegrationScenario != null && argIntegrationScenario.length() > 0) {
integrationScenarioId = argIntegrationScenario;
}
}
String componentId = getServerId();
// Only extract payload if debug is enabled!
String payloadASstring = (messageLogger.isDebugEnabled())? getPayloadAsString(payload) : "";
// -------------------------
//
// 2. Create LogEvent object
//
// -------------------------
// Setup basic runtime information for the log entry
LogRuntimeInfoType lri = new LogRuntimeInfoType();
lri.setTimestamp(XmlUtil.convertDateToXmlDate(null));
lri.setHostName(HOST_NAME);
lri.setHostIp(HOST_IP);
lri.setProcessId(PROCESS_ID);
lri.setThreadId(Thread.currentThread().getName());
lri.setComponentId(componentId);
lri.setMessageId(messageId);
lri.setBusinessCorrelationId(businessCorrelationId);
// Add any business contexts
if (businessContextId != null) {
Set<Entry<String, String>> entries = businessContextId.entrySet();
for (Entry<String, String> entry : entries) {
BusinessContextId bxid = new BusinessContextId();
bxid.setName(entry.getKey());
bxid.setValue(entry.getValue());
lri.getBusinessContextId().add(bxid);
}
}
// Also add any business contexts from message properties
if (propertyBusinessContextId != null) {
String[] propertyArr = propertyBusinessContextId.split(",");
for (String property : propertyArr) {
String[] nameValueArr = property.split("=");
String name = nameValueArr[0];
String value = (nameValueArr.length > 1) ? nameValueArr[1] : "";
BusinessContextId bxid = new BusinessContextId();
bxid.setName(name); // depends on control dependency: [for], data = [object]
bxid.setValue(value); // depends on control dependency: [for], data = [none]
lri.getBusinessContextId().add(bxid); // depends on control dependency: [for], data = [none]
}
}
// Setup basic metadata information for the log entry
LogMetadataInfoType lmi = new LogMetadataInfoType();
lmi.setLoggerName(messageLogger.getName()); // depends on control dependency: [if], data = [(message]
lmi.setIntegrationScenarioId(integrationScenarioId); // depends on control dependency: [if], data = [none]
lmi.setContractId(contractId); // depends on control dependency: [if], data = [none]
lmi.setServiceImplementation(serviceImplementation); // depends on control dependency: [if], data = [none]
lmi.setEndpoint(endpoint); // depends on control dependency: [if], data = [none]
// Setup basic information of the log message for the log entry
LogMessageType lm = new LogMessageType();
lm.setLevel(logLevel); // depends on control dependency: [if], data = [none]
lm.setMessage(logMessage); // depends on control dependency: [if], data = [none]
// Setup exception information if present
if (exception != null) {
exception = (DefaultMuleConfiguration.verboseExceptions) ? exception : ExceptionHelper.summarise(exception, 5); // depends on control dependency: [if], data = [(exception]
LogMessageExceptionType lme = new LogMessageExceptionType();
lme.setExceptionClass(exception.getClass().getName()); // depends on control dependency: [if], data = [(exception]
lme.setExceptionMessage(exception.getMessage()); // depends on control dependency: [if], data = [(exception]
StackTraceElement[] stArr = exception.getStackTrace();
List<String> stList = new ArrayList<String>();
for (int i = 0; i < stArr.length; i++) {
stList.add(stArr[i].toString()); // depends on control dependency: [for], data = [i]
}
if (exception.getCause() != null) {
Throwable ce = exception.getCause();
ce = (DefaultMuleConfiguration.verboseExceptions) ? ce : ExceptionHelper.summarise(ce, 5); // depends on control dependency: [if], data = [none]
stList.add(CAUSE_EXCEPTION_HEADER + ": " + ce.getMessage()); // depends on control dependency: [if], data = [none]
StackTraceElement[] ceStArr = ce.getStackTrace();
for (int i = 0; i < ceStArr.length; i++) {
stList.add(ceStArr[i].toString()); // depends on control dependency: [for], data = [i]
}
}
if (!DefaultMuleConfiguration.verboseExceptions) {
stList.add("*** set debug level logging or '-Dmule.verbose.exceptions=true' for full stacktrace ***"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
lme.getStackTrace().addAll(stList); // depends on control dependency: [if], data = [none]
// if (exception instanceof MuleException) {
// MuleException de = (MuleException)exception;
// System.err.println("Cause: " + de.getCause());
// StackTraceElement[] st = de.getCause().getStackTrace();
// for (int i = 0; i < st.length; i++) {
//// stList.add(st[i].toString());
// System.err.println(st[i].toString());
// }
//// System.err.println("Detailed: " + de.getDetailedMessage());
//// System.err.println("Summary: " + de.getSummaryMessage());
//// System.err.println("Verbose: " + de.getVerboseMessage());
// }
lm.setException(lme); // depends on control dependency: [if], data = [none]
}
// Create the log entry object
LogEntryType logEntry = new LogEntryType();
logEntry.setMetadataInfo(lmi); // depends on control dependency: [if], data = [none]
logEntry.setRuntimeInfo(lri); // depends on control dependency: [if], data = [none]
logEntry.setMessageInfo(lm); // depends on control dependency: [if], data = [none]
logEntry.setPayload(payloadASstring); // depends on control dependency: [if], data = [none]
// Add any extra info
if (extraInfo != null) {
Set<Entry<String, String>> entries = extraInfo.entrySet();
for (Entry<String, String> entry : entries) {
ExtraInfo ei = new ExtraInfo();
ei.setName(entry.getKey()); // depends on control dependency: [for], data = [entry]
ei.setValue(entry.getValue()); // depends on control dependency: [for], data = [entry]
logEntry.getExtraInfo().add(ei); // depends on control dependency: [for], data = [none]
}
}
// Create the final log event object
LogEvent logEvent = new LogEvent();
logEvent.setLogEntry(logEntry); // depends on control dependency: [if], data = [none]
// We are actually done :-)
return logEvent; // depends on control dependency: [if], data = [none]
} } |
public class class_name {
public static boolean shouldFocusNode(Context context, AccessibilityNodeInfoCompat node) {
if (node == null) {
return false;
}
if (!isVisibleOrLegacy(node)) {
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Don't focus, node is not visible");
return false;
}
if (FILTER_ACCESSIBILITY_FOCUSABLE.accept(context, node)) {
// TODO: This may still result in focusing non-speaking nodes, but it
// won't prevent unlabeled buttons from receiving focus.
if (node.getChildCount() <= 0) {
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Focus, node is focusable and has no children");
return true;
} else if (isSpeakingNode(context, node)) {
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Focus, node is focusable and has something to speak");
return true;
} else {
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Don't focus, node is focusable but has nothing to speak");
return false;
}
}
// If this node has no focusable ancestors, but it still has text,
// then it should receive focus from navigation and be read aloud.
if (!hasMatchingAncestor(context, node, FILTER_ACCESSIBILITY_FOCUSABLE)
&& hasText(node)) {
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Focus, node has text and no focusable ancestors");
return true;
}
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Don't focus, failed all focusability tests");
return false;
} } | public class class_name {
public static boolean shouldFocusNode(Context context, AccessibilityNodeInfoCompat node) {
if (node == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (!isVisibleOrLegacy(node)) {
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Don't focus, node is not visible");
return false;
}
if (FILTER_ACCESSIBILITY_FOCUSABLE.accept(context, node)) {
// TODO: This may still result in focusing non-speaking nodes, but it
// won't prevent unlabeled buttons from receiving focus.
if (node.getChildCount() <= 0) {
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Focus, node is focusable and has no children"); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (isSpeakingNode(context, node)) {
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Focus, node is focusable and has something to speak"); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Don't focus, node is focusable but has nothing to speak");
return false;
}
}
// If this node has no focusable ancestors, but it still has text,
// then it should receive focus from navigation and be read aloud.
if (!hasMatchingAncestor(context, node, FILTER_ACCESSIBILITY_FOCUSABLE)
&& hasText(node)) {
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Focus, node has text and no focusable ancestors");
return true;
}
LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
"Don't focus, failed all focusability tests"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} } |
public class class_name {
private static boolean isCritical(final X509Certificate certificate, final String extensionOid) {
val criticalOids = certificate.getCriticalExtensionOIDs();
if (criticalOids == null || criticalOids.isEmpty()) {
return false;
}
return criticalOids.contains(extensionOid);
} } | public class class_name {
private static boolean isCritical(final X509Certificate certificate, final String extensionOid) {
val criticalOids = certificate.getCriticalExtensionOIDs();
if (criticalOids == null || criticalOids.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
return criticalOids.contains(extensionOid);
} } |
public class class_name {
private static String transform(String constantNameString)
{
StringBuilder sb = new StringBuilder();
String tokens[] = constantNameString.split("_");
List<String> list = new ArrayList<String>();
for (String token : tokens)
{
String t = token.trim();
if (!t.isEmpty())
{
list.add(t);
}
}
for (int i=0; i<list.size(); i++)
{
if (i > 0)
{
sb.append(" ");
}
String t = list.get(i);
sb.append(Character.toUpperCase(t.charAt(0)));
sb.append(t.substring(1).toLowerCase());
}
return sb.toString();
} } | public class class_name {
private static String transform(String constantNameString)
{
StringBuilder sb = new StringBuilder();
String tokens[] = constantNameString.split("_");
List<String> list = new ArrayList<String>();
for (String token : tokens)
{
String t = token.trim();
if (!t.isEmpty())
{
list.add(t);
// depends on control dependency: [if], data = [none]
}
}
for (int i=0; i<list.size(); i++)
{
if (i > 0)
{
sb.append(" ");
// depends on control dependency: [if], data = [none]
}
String t = list.get(i);
sb.append(Character.toUpperCase(t.charAt(0)));
// depends on control dependency: [for], data = [none]
sb.append(t.substring(1).toLowerCase());
// depends on control dependency: [for], data = [none]
}
return sb.toString();
} } |
public class class_name {
public RobotsDirectives getDirectivesFor(String ua, boolean useFallbacks) {
// find matching ua
for(String uaListed : namedUserAgents) {
if(ua.indexOf(uaListed)>-1) {
return agentsToDirectives.get(uaListed);
}
}
if(useFallbacks==false) {
return null;
}
if (wildcardDirectives!=null) {
return wildcardDirectives;
}
// no applicable user-agents, so empty directives
return NO_DIRECTIVES;
} } | public class class_name {
public RobotsDirectives getDirectivesFor(String ua, boolean useFallbacks) {
// find matching ua
for(String uaListed : namedUserAgents) {
if(ua.indexOf(uaListed)>-1) {
return agentsToDirectives.get(uaListed); // depends on control dependency: [if], data = [none]
}
}
if(useFallbacks==false) {
return null; // depends on control dependency: [if], data = [none]
}
if (wildcardDirectives!=null) {
return wildcardDirectives; // depends on control dependency: [if], data = [none]
}
// no applicable user-agents, so empty directives
return NO_DIRECTIVES;
} } |
public class class_name {
public static ScoringInfo[] prependScoringInfo(ScoringInfo scoringInfo, ScoringInfo[] scoringInfos) {
if (scoringInfos == null) {
return new ScoringInfo[]{ scoringInfo };
} else {
ScoringInfo[] bigger = new ScoringInfo[scoringInfos.length + 1];
System.arraycopy(scoringInfos, 0, bigger, 0, scoringInfos.length);
bigger[bigger.length - 1] = scoringInfo;
return bigger;
}
} } | public class class_name {
public static ScoringInfo[] prependScoringInfo(ScoringInfo scoringInfo, ScoringInfo[] scoringInfos) {
if (scoringInfos == null) {
return new ScoringInfo[]{ scoringInfo }; // depends on control dependency: [if], data = [none]
} else {
ScoringInfo[] bigger = new ScoringInfo[scoringInfos.length + 1];
System.arraycopy(scoringInfos, 0, bigger, 0, scoringInfos.length); // depends on control dependency: [if], data = [(scoringInfos]
bigger[bigger.length - 1] = scoringInfo; // depends on control dependency: [if], data = [none]
return bigger; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private int[] computeFirstStates(IntIntHashMap inlinkCount, int maxStates, int minInlinkCount) {
Comparator<IntIntHolder> comparator = new Comparator<FSAUtils.IntIntHolder>() {
public int compare(IntIntHolder o1, IntIntHolder o2) {
int v = o1.a - o2.a;
return v == 0 ? (o1.b - o2.b) : v;
}
};
PriorityQueue<IntIntHolder> stateInlink = new PriorityQueue<IntIntHolder>(1, comparator);
IntIntHolder scratch = new IntIntHolder();
for (IntIntCursor c : inlinkCount) {
if (c.value > minInlinkCount) {
scratch.a = c.value;
scratch.b = c.key;
if (stateInlink.size() < maxStates || comparator.compare(scratch, stateInlink.peek()) > 0) {
stateInlink.add(new IntIntHolder(c.value, c.key));
if (stateInlink.size() > maxStates) {
stateInlink.remove();
}
}
}
}
int [] states = new int [stateInlink.size()];
for (int position = states.length; !stateInlink.isEmpty();) {
IntIntHolder i = stateInlink.remove();
states[--position] = i.b;
}
return states;
} } | public class class_name {
private int[] computeFirstStates(IntIntHashMap inlinkCount, int maxStates, int minInlinkCount) {
Comparator<IntIntHolder> comparator = new Comparator<FSAUtils.IntIntHolder>() {
public int compare(IntIntHolder o1, IntIntHolder o2) {
int v = o1.a - o2.a;
return v == 0 ? (o1.b - o2.b) : v;
}
};
PriorityQueue<IntIntHolder> stateInlink = new PriorityQueue<IntIntHolder>(1, comparator);
IntIntHolder scratch = new IntIntHolder();
for (IntIntCursor c : inlinkCount) {
if (c.value > minInlinkCount) {
scratch.a = c.value;
// depends on control dependency: [if], data = [none]
scratch.b = c.key;
// depends on control dependency: [if], data = [none]
if (stateInlink.size() < maxStates || comparator.compare(scratch, stateInlink.peek()) > 0) {
stateInlink.add(new IntIntHolder(c.value, c.key));
// depends on control dependency: [if], data = [none]
if (stateInlink.size() > maxStates) {
stateInlink.remove();
// depends on control dependency: [if], data = [none]
}
}
}
}
int [] states = new int [stateInlink.size()];
for (int position = states.length; !stateInlink.isEmpty();) {
IntIntHolder i = stateInlink.remove();
states[--position] = i.b;
// depends on control dependency: [for], data = [position]
}
return states;
} } |
public class class_name {
String convertSoapMessageAsString(SOAPMessage soapMessage) {
if (soapMessage == null) {
return "null";
}
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
soapMessage.writeTo(os);
return new String(os.toByteArray(), determineMessageEncoding(soapMessage));
} catch (Exception e) {
logger.error("Couldn't create string representation of soapMessage: " + soapMessage.toString());
return "ERROR";
}
} } | public class class_name {
String convertSoapMessageAsString(SOAPMessage soapMessage) {
if (soapMessage == null) {
return "null"; // depends on control dependency: [if], data = [none]
}
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
soapMessage.writeTo(os); // depends on control dependency: [try], data = [none]
return new String(os.toByteArray(), determineMessageEncoding(soapMessage)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("Couldn't create string representation of soapMessage: " + soapMessage.toString());
return "ERROR";
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void setEmbeddableWebSphereTransactionManager(ServiceReference<EmbeddableWebSphereTransactionManager> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setEmbeddableWebSphereTransactionManager", "setting " + ref);
}
embeddableWebSphereTransactionManagerRef.setReference(ref);
} } | public class class_name {
protected void setEmbeddableWebSphereTransactionManager(ServiceReference<EmbeddableWebSphereTransactionManager> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setEmbeddableWebSphereTransactionManager", "setting " + ref); // depends on control dependency: [if], data = [none]
}
embeddableWebSphereTransactionManagerRef.setReference(ref);
} } |
public class class_name {
public void marshall(AdminGetUserRequest adminGetUserRequest, ProtocolMarshaller protocolMarshaller) {
if (adminGetUserRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(adminGetUserRequest.getUserPoolId(), USERPOOLID_BINDING);
protocolMarshaller.marshall(adminGetUserRequest.getUsername(), USERNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AdminGetUserRequest adminGetUserRequest, ProtocolMarshaller protocolMarshaller) {
if (adminGetUserRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(adminGetUserRequest.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(adminGetUserRequest.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Pair<MethodSymbol, Attribute> attributeAnnotationNameValuePair(JCExpression nameValuePair,
Type thisAnnotationType, boolean badAnnotation, Env<AttrContext> env, boolean elidedValue)
{
if (!nameValuePair.hasTag(ASSIGN)) {
log.error(nameValuePair.pos(), "annotation.value.must.be.name.value");
attributeAnnotationValue(nameValuePair.type = syms.errType, nameValuePair, env);
return null;
}
JCAssign assign = (JCAssign)nameValuePair;
if (!assign.lhs.hasTag(IDENT)) {
log.error(nameValuePair.pos(), "annotation.value.must.be.name.value");
attributeAnnotationValue(nameValuePair.type = syms.errType, nameValuePair, env);
return null;
}
// Resolve element to MethodSym
JCIdent left = (JCIdent)assign.lhs;
Symbol method = resolve.resolveQualifiedMethod(elidedValue ? assign.rhs.pos() : left.pos(),
env, thisAnnotationType,
left.name, List.nil(), null);
left.sym = method;
left.type = method.type;
if (method.owner != thisAnnotationType.tsym && !badAnnotation)
log.error(left.pos(), "no.annotation.member", left.name, thisAnnotationType);
Type resultType = method.type.getReturnType();
// Compute value part
Attribute value = attributeAnnotationValue(resultType, assign.rhs, env);
nameValuePair.type = resultType;
return method.type.isErroneous() ? null : new Pair<>((MethodSymbol)method, value);
} } | public class class_name {
private Pair<MethodSymbol, Attribute> attributeAnnotationNameValuePair(JCExpression nameValuePair,
Type thisAnnotationType, boolean badAnnotation, Env<AttrContext> env, boolean elidedValue)
{
if (!nameValuePair.hasTag(ASSIGN)) {
log.error(nameValuePair.pos(), "annotation.value.must.be.name.value"); // depends on control dependency: [if], data = [none]
attributeAnnotationValue(nameValuePair.type = syms.errType, nameValuePair, env); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
JCAssign assign = (JCAssign)nameValuePair;
if (!assign.lhs.hasTag(IDENT)) {
log.error(nameValuePair.pos(), "annotation.value.must.be.name.value"); // depends on control dependency: [if], data = [none]
attributeAnnotationValue(nameValuePair.type = syms.errType, nameValuePair, env); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// Resolve element to MethodSym
JCIdent left = (JCIdent)assign.lhs;
Symbol method = resolve.resolveQualifiedMethod(elidedValue ? assign.rhs.pos() : left.pos(),
env, thisAnnotationType,
left.name, List.nil(), null);
left.sym = method;
left.type = method.type;
if (method.owner != thisAnnotationType.tsym && !badAnnotation)
log.error(left.pos(), "no.annotation.member", left.name, thisAnnotationType);
Type resultType = method.type.getReturnType();
// Compute value part
Attribute value = attributeAnnotationValue(resultType, assign.rhs, env);
nameValuePair.type = resultType;
return method.type.isErroneous() ? null : new Pair<>((MethodSymbol)method, value);
} } |
public class class_name {
public Set<String> getIdAttributes(final BuildData buildData) {
final Set<String> ids = new HashSet<String>();
// Add all the level id attributes
for (final Level level : levels) {
ids.add(level.getUniqueLinkId(buildData.isUseFixedUrls()));
}
// Add all the topic id attributes
for (final Entry<Integer, List<ITopicNode>> topicEntry : topics.entrySet()) {
final List<ITopicNode> topics = topicEntry.getValue();
for (final ITopicNode topic : topics) {
if (topic instanceof SpecTopic) {
final SpecTopic specTopic = (SpecTopic) topic;
ids.add(specTopic.getUniqueLinkId(buildData.isUseFixedUrls()));
}
}
}
return ids;
} } | public class class_name {
public Set<String> getIdAttributes(final BuildData buildData) {
final Set<String> ids = new HashSet<String>();
// Add all the level id attributes
for (final Level level : levels) {
ids.add(level.getUniqueLinkId(buildData.isUseFixedUrls())); // depends on control dependency: [for], data = [level]
}
// Add all the topic id attributes
for (final Entry<Integer, List<ITopicNode>> topicEntry : topics.entrySet()) {
final List<ITopicNode> topics = topicEntry.getValue();
for (final ITopicNode topic : topics) {
if (topic instanceof SpecTopic) {
final SpecTopic specTopic = (SpecTopic) topic;
ids.add(specTopic.getUniqueLinkId(buildData.isUseFixedUrls())); // depends on control dependency: [if], data = [none]
}
}
}
return ids;
} } |
public class class_name {
@Override
public String render(final JavaDocData nonNullData, final SortableLocation location) {
// Compile the XSD documentation string for this Node.
final StringBuilder builder = new StringBuilder();
// First, render the JavaDoc comment.
builder.append(renderJavaDocComment(nonNullData.getComment(), location)).append("\n");
// Then, render each JavaDoc tag.
for (Map.Entry<String, String> current : nonNullData.getTag2ValueMap().entrySet()) {
final String tagXsdDoc = renderJavaDocTag(current.getKey(), current.getValue(), location);
if (tagXsdDoc != null && !tagXsdDoc.isEmpty()) {
builder.append(tagXsdDoc);
}
}
// All done.
return builder.toString();
} } | public class class_name {
@Override
public String render(final JavaDocData nonNullData, final SortableLocation location) {
// Compile the XSD documentation string for this Node.
final StringBuilder builder = new StringBuilder();
// First, render the JavaDoc comment.
builder.append(renderJavaDocComment(nonNullData.getComment(), location)).append("\n");
// Then, render each JavaDoc tag.
for (Map.Entry<String, String> current : nonNullData.getTag2ValueMap().entrySet()) {
final String tagXsdDoc = renderJavaDocTag(current.getKey(), current.getValue(), location);
if (tagXsdDoc != null && !tagXsdDoc.isEmpty()) {
builder.append(tagXsdDoc); // depends on control dependency: [if], data = [(tagXsdDoc]
}
}
// All done.
return builder.toString();
} } |
public class class_name {
private void validateRequiredParams() {
String[] uriStrings = getURI().split("\\?");
if (uriStrings.length > 0) {
List<String> requiredParms = extractRequiredParamsInURI(uriStrings[0]);
for (String param: requiredParms) {
Utils.require(commandParams.containsKey(param), "missing param: " + param);
}
}
if (metadataJson.containsKey(INPUT_ENTITY)) {
String paramValue = metadataJson.getString(INPUT_ENTITY);
if (paramValue != null) {
JsonObject parametersNode = metadataJson.getJsonObject(PARAMETERS);
if (parametersNode != null) {
if (parametersNode.keySet().size() == 1) {//parent node usually "params"
JsonObject params = parametersNode.getJsonObject(parametersNode.keySet().iterator().next());
for (String param: params.keySet()) {
JsonObject paramNode = params.getJsonObject(param);
if (paramNode.keySet().contains(_REQUIRED)) {
setCompound(true);
Utils.require(commandParams.containsKey(param), "missing param: " + param);
}
}
}
}
else {
Utils.require(commandParams.containsKey(paramValue), "missing param: " + paramValue);
}
}
}
} } | public class class_name {
private void validateRequiredParams() {
String[] uriStrings = getURI().split("\\?");
if (uriStrings.length > 0) {
List<String> requiredParms = extractRequiredParamsInURI(uriStrings[0]);
for (String param: requiredParms) {
Utils.require(commandParams.containsKey(param), "missing param: " + param); // depends on control dependency: [for], data = [param]
}
}
if (metadataJson.containsKey(INPUT_ENTITY)) {
String paramValue = metadataJson.getString(INPUT_ENTITY);
if (paramValue != null) {
JsonObject parametersNode = metadataJson.getJsonObject(PARAMETERS);
if (parametersNode != null) {
if (parametersNode.keySet().size() == 1) {//parent node usually "params"
JsonObject params = parametersNode.getJsonObject(parametersNode.keySet().iterator().next());
for (String param: params.keySet()) {
JsonObject paramNode = params.getJsonObject(param);
if (paramNode.keySet().contains(_REQUIRED)) {
setCompound(true); // depends on control dependency: [if], data = [none]
Utils.require(commandParams.containsKey(param), "missing param: " + param); // depends on control dependency: [if], data = [none]
}
}
}
}
else {
Utils.require(commandParams.containsKey(paramValue), "missing param: " + paramValue); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
private static int computeKey(Collection array) {
int intKey = 0;
for (Object s : array) {
intKey += s.hashCode();
}
return intKey;
} } | public class class_name {
private static int computeKey(Collection array) {
int intKey = 0;
for (Object s : array) {
intKey += s.hashCode(); // depends on control dependency: [for], data = [s]
}
return intKey;
} } |
public class class_name {
private void cboDataSetActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_cboDataSetActionPerformed
txtQueryEditor.setText(EMPTY_TEXT); // clear the text editor
JComboBox cb = (JComboBox) evt.getSource();
if (cb.getSelectedIndex() != -1) {
RelationDefinition dd = (RelationDefinition) cb.getSelectedItem();
if (dd != null) {
String sql = generateSQLString(dd);
txtQueryEditor.setText(sql);
}
executeQuery();
txtClassUriTemplate.requestFocus();
}
} } | public class class_name {
private void cboDataSetActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_cboDataSetActionPerformed
txtQueryEditor.setText(EMPTY_TEXT); // clear the text editor
JComboBox cb = (JComboBox) evt.getSource();
if (cb.getSelectedIndex() != -1) {
RelationDefinition dd = (RelationDefinition) cb.getSelectedItem();
if (dd != null) {
String sql = generateSQLString(dd);
txtQueryEditor.setText(sql); // depends on control dependency: [if], data = [none]
}
executeQuery(); // depends on control dependency: [if], data = [none]
txtClassUriTemplate.requestFocus(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void serializeUpdateWithExplicitVersion(@NonNull Collection<TableEntry> entries, byte[] target) {
int offset = 0;
for (TableEntry e : entries) {
offset = serializeUpdate(e, target, offset, e.getKey().getVersion());
}
} } | public class class_name {
void serializeUpdateWithExplicitVersion(@NonNull Collection<TableEntry> entries, byte[] target) {
int offset = 0;
for (TableEntry e : entries) {
offset = serializeUpdate(e, target, offset, e.getKey().getVersion()); // depends on control dependency: [for], data = [e]
}
} } |
public class class_name {
public Throwable blockingGetError() {
if (getCount() != 0) {
try {
BlockingHelper.verifyNonBlocking();
await();
} catch (InterruptedException ex) {
dispose();
return ex;
}
}
return error;
} } | public class class_name {
public Throwable blockingGetError() {
if (getCount() != 0) {
try {
BlockingHelper.verifyNonBlocking(); // depends on control dependency: [try], data = [none]
await(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ex) {
dispose();
return ex;
} // depends on control dependency: [catch], data = [none]
}
return error;
} } |
public class class_name {
protected boolean compareValues(Object previous, Object value) {
if (previous instanceof String && value instanceof Double) {
previous = Double.valueOf((String) previous);
}
return super.compareValues(previous, value);
} } | public class class_name {
protected boolean compareValues(Object previous, Object value) {
if (previous instanceof String && value instanceof Double) {
previous = Double.valueOf((String) previous); // depends on control dependency: [if], data = [none]
}
return super.compareValues(previous, value);
} } |
public class class_name {
public Authentication authenticate(Authentication authentication)
throws AuthenticationException {
Class<? extends Authentication> toTest = authentication.getClass();
AuthenticationException lastException = null;
AuthenticationException parentException = null;
Authentication result = null;
Authentication parentResult = null;
boolean debug = logger.isDebugEnabled();
for (AuthenticationProvider provider : getProviders()) {
if (!provider.supports(toTest)) {
continue;
}
if (debug) {
logger.debug("Authentication attempt using "
+ provider.getClass().getName());
}
try {
result = provider.authenticate(authentication);
if (result != null) {
copyDetails(authentication, result);
break;
}
}
catch (AccountStatusException e) {
prepareException(e, authentication);
// SEC-546: Avoid polling additional providers if auth failure is due to
// invalid account status
throw e;
}
catch (InternalAuthenticationServiceException e) {
prepareException(e, authentication);
throw e;
}
catch (AuthenticationException e) {
lastException = e;
}
}
if (result == null && parent != null) {
// Allow the parent to try.
try {
result = parentResult = parent.authenticate(authentication);
}
catch (ProviderNotFoundException e) {
// ignore as we will throw below if no other exception occurred prior to
// calling parent and the parent
// may throw ProviderNotFound even though a provider in the child already
// handled the request
}
catch (AuthenticationException e) {
lastException = parentException = e;
}
}
if (result != null) {
if (eraseCredentialsAfterAuthentication
&& (result instanceof CredentialsContainer)) {
// Authentication is complete. Remove credentials and other secret data
// from authentication
((CredentialsContainer) result).eraseCredentials();
}
// If the parent AuthenticationManager was attempted and successful than it will publish an AuthenticationSuccessEvent
// This check prevents a duplicate AuthenticationSuccessEvent if the parent AuthenticationManager already published it
if (parentResult == null) {
eventPublisher.publishAuthenticationSuccess(result);
}
return result;
}
// Parent was null, or didn't authenticate (or throw an exception).
if (lastException == null) {
lastException = new ProviderNotFoundException(messages.getMessage(
"ProviderManager.providerNotFound",
new Object[] { toTest.getName() },
"No AuthenticationProvider found for {0}"));
}
// If the parent AuthenticationManager was attempted and failed than it will publish an AbstractAuthenticationFailureEvent
// This check prevents a duplicate AbstractAuthenticationFailureEvent if the parent AuthenticationManager already published it
if (parentException == null) {
prepareException(lastException, authentication);
}
throw lastException;
} } | public class class_name {
public Authentication authenticate(Authentication authentication)
throws AuthenticationException {
Class<? extends Authentication> toTest = authentication.getClass();
AuthenticationException lastException = null;
AuthenticationException parentException = null;
Authentication result = null;
Authentication parentResult = null;
boolean debug = logger.isDebugEnabled();
for (AuthenticationProvider provider : getProviders()) {
if (!provider.supports(toTest)) {
continue;
}
if (debug) {
logger.debug("Authentication attempt using "
+ provider.getClass().getName()); // depends on control dependency: [if], data = [none]
}
try {
result = provider.authenticate(authentication); // depends on control dependency: [try], data = [none]
if (result != null) {
copyDetails(authentication, result); // depends on control dependency: [if], data = [none]
break;
}
}
catch (AccountStatusException e) {
prepareException(e, authentication);
// SEC-546: Avoid polling additional providers if auth failure is due to
// invalid account status
throw e;
} // depends on control dependency: [catch], data = [none]
catch (InternalAuthenticationServiceException e) {
prepareException(e, authentication);
throw e;
} // depends on control dependency: [catch], data = [none]
catch (AuthenticationException e) {
lastException = e;
} // depends on control dependency: [catch], data = [none]
}
if (result == null && parent != null) {
// Allow the parent to try.
try {
result = parentResult = parent.authenticate(authentication); // depends on control dependency: [try], data = [none]
}
catch (ProviderNotFoundException e) {
// ignore as we will throw below if no other exception occurred prior to
// calling parent and the parent
// may throw ProviderNotFound even though a provider in the child already
// handled the request
} // depends on control dependency: [catch], data = [none]
catch (AuthenticationException e) {
lastException = parentException = e;
} // depends on control dependency: [catch], data = [none]
}
if (result != null) {
if (eraseCredentialsAfterAuthentication
&& (result instanceof CredentialsContainer)) {
// Authentication is complete. Remove credentials and other secret data
// from authentication
((CredentialsContainer) result).eraseCredentials();
}
// If the parent AuthenticationManager was attempted and successful than it will publish an AuthenticationSuccessEvent
// This check prevents a duplicate AuthenticationSuccessEvent if the parent AuthenticationManager already published it
if (parentResult == null) {
eventPublisher.publishAuthenticationSuccess(result);
}
return result;
}
// Parent was null, or didn't authenticate (or throw an exception).
if (lastException == null) {
lastException = new ProviderNotFoundException(messages.getMessage(
"ProviderManager.providerNotFound",
new Object[] { toTest.getName() },
"No AuthenticationProvider found for {0}"));
}
// If the parent AuthenticationManager was attempted and failed than it will publish an AbstractAuthenticationFailureEvent
// This check prevents a duplicate AbstractAuthenticationFailureEvent if the parent AuthenticationManager already published it
if (parentException == null) {
prepareException(lastException, authentication);
}
throw lastException;
} } |
public class class_name {
public EClass getIfcPreDefinedPointMarkerSymbol() {
if (ifcPreDefinedPointMarkerSymbolEClass == null) {
ifcPreDefinedPointMarkerSymbolEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(376);
}
return ifcPreDefinedPointMarkerSymbolEClass;
} } | public class class_name {
public EClass getIfcPreDefinedPointMarkerSymbol() {
if (ifcPreDefinedPointMarkerSymbolEClass == null) {
ifcPreDefinedPointMarkerSymbolEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(376);
// depends on control dependency: [if], data = [none]
}
return ifcPreDefinedPointMarkerSymbolEClass;
} } |
public class class_name {
public void marshall(CreateAppRequest createAppRequest, ProtocolMarshaller protocolMarshaller) {
if (createAppRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createAppRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createAppRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(createAppRequest.getRoleName(), ROLENAME_BINDING);
protocolMarshaller.marshall(createAppRequest.getClientToken(), CLIENTTOKEN_BINDING);
protocolMarshaller.marshall(createAppRequest.getServerGroups(), SERVERGROUPS_BINDING);
protocolMarshaller.marshall(createAppRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateAppRequest createAppRequest, ProtocolMarshaller protocolMarshaller) {
if (createAppRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createAppRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAppRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAppRequest.getRoleName(), ROLENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAppRequest.getClientToken(), CLIENTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAppRequest.getServerGroups(), SERVERGROUPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAppRequest.getTags(), TAGS_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 static void writeRow(Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader) {
int i = 0;
Cell cell;
for (Object value : rowData) {
cell = row.createCell(i);
CellUtil.setCellValue(cell, value, styleSet, isHeader);
i++;
}
} } | public class class_name {
public static void writeRow(Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader) {
int i = 0;
Cell cell;
for (Object value : rowData) {
cell = row.createCell(i);
// depends on control dependency: [for], data = [none]
CellUtil.setCellValue(cell, value, styleSet, isHeader);
// depends on control dependency: [for], data = [value]
i++;
// depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static DataSet<Edge<Long, String>> getEdges(ExecutionEnvironment env) {
List<Edge<Long, String>> edges = new ArrayList<>(INPUT_EDGES.length);
for (String edge : INPUT_EDGES) {
String[] tokens = edge.split(";");
edges.add(new Edge<>(Long.parseLong(tokens[0]), Long.parseLong(tokens[1]), tokens[2]));
}
return env.fromCollection(edges);
} } | public class class_name {
public static DataSet<Edge<Long, String>> getEdges(ExecutionEnvironment env) {
List<Edge<Long, String>> edges = new ArrayList<>(INPUT_EDGES.length);
for (String edge : INPUT_EDGES) {
String[] tokens = edge.split(";");
edges.add(new Edge<>(Long.parseLong(tokens[0]), Long.parseLong(tokens[1]), tokens[2])); // depends on control dependency: [for], data = [edge]
}
return env.fromCollection(edges);
} } |
public class class_name {
private int findNextTypeId() {
int result = (int)(20000 + Math.round(Math.random() * 1000));
for (I_CmsResourceType type : OpenCms.getResourceManager().getResourceTypes()) {
if (type.getTypeId() >= result) {
result = type.getTypeId() + 1;
}
}
return result;
} } | public class class_name {
private int findNextTypeId() {
int result = (int)(20000 + Math.round(Math.random() * 1000));
for (I_CmsResourceType type : OpenCms.getResourceManager().getResourceTypes()) {
if (type.getTypeId() >= result) {
result = type.getTypeId() + 1; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
private List<SyndPerson> parsePersons(final String baseURI, final List<Element> ePersons, final Locale locale) {
final List<SyndPerson> persons = new ArrayList<SyndPerson>();
for (final Element ePerson : ePersons) {
persons.add(parsePerson(baseURI, ePerson, locale));
}
return Lists.emptyToNull(persons);
} } | public class class_name {
private List<SyndPerson> parsePersons(final String baseURI, final List<Element> ePersons, final Locale locale) {
final List<SyndPerson> persons = new ArrayList<SyndPerson>();
for (final Element ePerson : ePersons) {
persons.add(parsePerson(baseURI, ePerson, locale)); // depends on control dependency: [for], data = [ePerson]
}
return Lists.emptyToNull(persons);
} } |
public class class_name {
public BaseMessage sendMessageRequest(BaseMessage messageOut)
{
if (m_con == null)
{
try {
m_con = SOAPConnectionFactory.newInstance().createConnection();
} catch(Exception e) {
Utility.getLogger().warning("Unable to open a SOAPConnection");
e.printStackTrace();
}
}
String strTrxID = null;
try {
// Create a message from the message factory.
SOAPMessage msg = null; //mf.createMessage();
msg = this.setSOAPBody(msg, messageOut);
// Create an endpoint for the recipient of the message.
TrxMessageHeader trxMessageHeader = (TrxMessageHeader)messageOut.getMessageHeader();
String strDest = (String)trxMessageHeader.get(TrxMessageHeader.DESTINATION_PARAM);
String strMsgDest = (String)trxMessageHeader.get(TrxMessageHeader.DESTINATION_MESSAGE_PARAM);
if (strMsgDest != null)
strDest = strDest + strMsgDest;
strTrxID = (String)trxMessageHeader.get(TrxMessageHeader.LOG_TRX_ID);
URL urlEndpoint = new URL(strDest);
// Send the message to the provider using the connection.
// Create a message from the message factory.
if (trxMessageHeader.get(SOAPMessage.WRITE_XML_DECLARATION) != null)
msg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, (String)trxMessageHeader.get(SOAPMessage.WRITE_XML_DECLARATION)); // true or [false]
if (trxMessageHeader.get(SOAPMessage.CHARACTER_SET_ENCODING) != null)
msg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, (String)trxMessageHeader.get(SOAPMessage.WRITE_XML_DECLARATION)); // [utf-8] or utf-16
if (trxMessageHeader.get(CONTENT_TYPE) != null)
msg.getMimeHeaders().setHeader(CONTENT_TYPE, (String)trxMessageHeader.get(CONTENT_TYPE)); // "text/xml"
if (trxMessageHeader.get(SOAP_ACTION) != null)
msg.getMimeHeaders().setHeader(SOAP_ACTION, (String)trxMessageHeader.get(SOAP_ACTION)); // Not recommended
//OutputStream out = new ByteArrayOutputStream();
//msg.writeTo(out);
//out.flush();
//Utility.getLogger().info(out.toString());
strTrxID = this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.SENT, null, null);
SOAPMessage reply = m_con.call(msg, urlEndpoint);
// To test this locally, use the next two lines.
// MessageReceivingServlet servlet = new MessageReceivingServlet();
// SOAPMessage reply = servlet.onMessage(msg);
if (reply != null)
{
BaseMessage messageReply = new TreeMessage(null, null);
new SoapTrxMessageIn(messageReply, reply);
return messageReply;
} else {
System.err.println("No reply");
}
} catch(Throwable ex) {
ex.printStackTrace();
String strErrorMessage = ex.getMessage();
this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.ERROR, strErrorMessage, null);
return BaseMessageProcessor.processErrorMessage(this, messageOut, strErrorMessage);
}
return null;
} } | public class class_name {
public BaseMessage sendMessageRequest(BaseMessage messageOut)
{
if (m_con == null)
{
try {
m_con = SOAPConnectionFactory.newInstance().createConnection(); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
Utility.getLogger().warning("Unable to open a SOAPConnection");
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
String strTrxID = null;
try {
// Create a message from the message factory.
SOAPMessage msg = null; //mf.createMessage();
msg = this.setSOAPBody(msg, messageOut); // depends on control dependency: [try], data = [none]
// Create an endpoint for the recipient of the message.
TrxMessageHeader trxMessageHeader = (TrxMessageHeader)messageOut.getMessageHeader();
String strDest = (String)trxMessageHeader.get(TrxMessageHeader.DESTINATION_PARAM);
String strMsgDest = (String)trxMessageHeader.get(TrxMessageHeader.DESTINATION_MESSAGE_PARAM);
if (strMsgDest != null)
strDest = strDest + strMsgDest;
strTrxID = (String)trxMessageHeader.get(TrxMessageHeader.LOG_TRX_ID); // depends on control dependency: [try], data = [none]
URL urlEndpoint = new URL(strDest);
// Send the message to the provider using the connection.
// Create a message from the message factory.
if (trxMessageHeader.get(SOAPMessage.WRITE_XML_DECLARATION) != null)
msg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, (String)trxMessageHeader.get(SOAPMessage.WRITE_XML_DECLARATION)); // true or [false]
if (trxMessageHeader.get(SOAPMessage.CHARACTER_SET_ENCODING) != null)
msg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, (String)trxMessageHeader.get(SOAPMessage.WRITE_XML_DECLARATION)); // [utf-8] or utf-16
if (trxMessageHeader.get(CONTENT_TYPE) != null)
msg.getMimeHeaders().setHeader(CONTENT_TYPE, (String)trxMessageHeader.get(CONTENT_TYPE)); // "text/xml"
if (trxMessageHeader.get(SOAP_ACTION) != null)
msg.getMimeHeaders().setHeader(SOAP_ACTION, (String)trxMessageHeader.get(SOAP_ACTION)); // Not recommended
//OutputStream out = new ByteArrayOutputStream();
//msg.writeTo(out);
//out.flush();
//Utility.getLogger().info(out.toString());
strTrxID = this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.SENT, null, null); // depends on control dependency: [try], data = [none]
SOAPMessage reply = m_con.call(msg, urlEndpoint);
// To test this locally, use the next two lines.
// MessageReceivingServlet servlet = new MessageReceivingServlet();
// SOAPMessage reply = servlet.onMessage(msg);
if (reply != null)
{
BaseMessage messageReply = new TreeMessage(null, null);
new SoapTrxMessageIn(messageReply, reply); // depends on control dependency: [if], data = [none]
return messageReply; // depends on control dependency: [if], data = [none]
} else {
System.err.println("No reply"); // depends on control dependency: [if], data = [none]
}
} catch(Throwable ex) {
ex.printStackTrace();
String strErrorMessage = ex.getMessage();
this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.ERROR, strErrorMessage, null);
return BaseMessageProcessor.processErrorMessage(this, messageOut, strErrorMessage);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public void handle(Collection<Data> keys, Collection<String> sourceUuids,
Collection<UUID> partitionUuids, Collection<Long> sequences) {
Iterator<Data> keyIterator = keys.iterator();
Iterator<Long> sequenceIterator = sequences.iterator();
Iterator<UUID> partitionUuidIterator = partitionUuids.iterator();
Iterator<String> sourceUuidsIterator = sourceUuids.iterator();
while (keyIterator.hasNext() && sourceUuidsIterator.hasNext()
&& partitionUuidIterator.hasNext() && sequenceIterator.hasNext()) {
handle(keyIterator.next(), sourceUuidsIterator.next(), partitionUuidIterator.next(), sequenceIterator.next());
}
} } | public class class_name {
public void handle(Collection<Data> keys, Collection<String> sourceUuids,
Collection<UUID> partitionUuids, Collection<Long> sequences) {
Iterator<Data> keyIterator = keys.iterator();
Iterator<Long> sequenceIterator = sequences.iterator();
Iterator<UUID> partitionUuidIterator = partitionUuids.iterator();
Iterator<String> sourceUuidsIterator = sourceUuids.iterator();
while (keyIterator.hasNext() && sourceUuidsIterator.hasNext()
&& partitionUuidIterator.hasNext() && sequenceIterator.hasNext()) {
handle(keyIterator.next(), sourceUuidsIterator.next(), partitionUuidIterator.next(), sequenceIterator.next()); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public synchronized boolean hasService(Class serviceClass) {
// todo: for multithreaded usage this block needs to be synchronized
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (sp != null && !sp.isRevoked()) {
return true;
}
// if service not found locally check in nested context
BeanContext bc = getBeanContext();
if (bc instanceof BeanContextServices) {
return ((BeanContextServices) bc).hasService(serviceClass);
}
return false;
// end synchronized
} } | public class class_name {
public synchronized boolean hasService(Class serviceClass) {
// todo: for multithreaded usage this block needs to be synchronized
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (sp != null && !sp.isRevoked()) {
return true; // depends on control dependency: [if], data = [none]
}
// if service not found locally check in nested context
BeanContext bc = getBeanContext();
if (bc instanceof BeanContextServices) {
return ((BeanContextServices) bc).hasService(serviceClass); // depends on control dependency: [if], data = [none]
}
return false;
// end synchronized
} } |
public class class_name {
public EClass getIfcPresentationLayerWithStyle() {
if (ifcPresentationLayerWithStyleEClass == null) {
ifcPresentationLayerWithStyleEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(381);
}
return ifcPresentationLayerWithStyleEClass;
} } | public class class_name {
public EClass getIfcPresentationLayerWithStyle() {
if (ifcPresentationLayerWithStyleEClass == null) {
ifcPresentationLayerWithStyleEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(381);
// depends on control dependency: [if], data = [none]
}
return ifcPresentationLayerWithStyleEClass;
} } |
public class class_name {
public ModelNode getNoTextDescription(boolean forOperation) {
final ModelNode result = new ModelNode();
result.get(ModelDescriptionConstants.TYPE).set(type);
result.get(ModelDescriptionConstants.DESCRIPTION); // placeholder
if (attributeGroup != null && !forOperation) {
result.get(ModelDescriptionConstants.ATTRIBUTE_GROUP).set(attributeGroup);
}
result.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).set(isAllowExpression());
result.get(ModelDescriptionConstants.REQUIRED).set(isRequired());
result.get(ModelDescriptionConstants.NILLABLE).set(isNillable());
if (!forOperation && nilSignificant != null) {
if (nilSignificant) {
result.get(ModelDescriptionConstants.NIL_SIGNIFICANT).set(true);
}
}
if (defaultValue != null && defaultValue.isDefined()) {
result.get(ModelDescriptionConstants.DEFAULT).set(defaultValue);
}
if (measurementUnit != null && measurementUnit != MeasurementUnit.NONE) {
result.get(ModelDescriptionConstants.UNIT).set(measurementUnit.getName());
}
if (alternatives != null) {
for(final String alternative : alternatives) {
result.get(ModelDescriptionConstants.ALTERNATIVES).add(alternative);
}
}
if (requires != null) {
for(final String required : requires) {
result.get(ModelDescriptionConstants.REQUIRES).add(required);
}
}
if (getReferenceRecorder() != null) {
String[] capabilityPatternElements = getReferenceRecorder().getRequirementPatternSegments(name, PathAddress.EMPTY_ADDRESS);
result.get(ModelDescriptionConstants.CAPABILITY_REFERENCE).set(getReferenceRecorder().getBaseRequirementName());
if(capabilityPatternElements.length > 0 && (capabilityPatternElements.length > 1 || !name.equals(capabilityPatternElements[0]))) {
for(String patternElement : capabilityPatternElements) {
result.get(ModelDescriptionConstants.CAPABILITY_REFERENCE_PATTERN_ELEMENTS).add(patternElement);
}
}
}
if (validator instanceof MinMaxValidator) {
MinMaxValidator minMax = (MinMaxValidator) validator;
Long min = minMax.getMin();
if (min != null) {
switch (this.type) {
case STRING:
case LIST:
case OBJECT:
case BYTES:
result.get(ModelDescriptionConstants.MIN_LENGTH).set(min);
break;
default:
result.get(ModelDescriptionConstants.MIN).set(min);
}
}
Long max = minMax.getMax();
if (max != null) {
switch (this.type) {
case STRING:
case LIST:
case OBJECT:
case BYTES:
result.get(ModelDescriptionConstants.MAX_LENGTH).set(max);
break;
default:
result.get(ModelDescriptionConstants.MAX).set(max);
}
}
}
addAllowedValuesToDescription(result, validator);
arbitraryDescriptors.forEach((key, value) -> {
assert !result.hasDefined(key); //You can't override an arbitrary descriptor set through other properties.
result.get(key).set(value);
});
return result;
} } | public class class_name {
public ModelNode getNoTextDescription(boolean forOperation) {
final ModelNode result = new ModelNode();
result.get(ModelDescriptionConstants.TYPE).set(type);
result.get(ModelDescriptionConstants.DESCRIPTION); // placeholder
if (attributeGroup != null && !forOperation) {
result.get(ModelDescriptionConstants.ATTRIBUTE_GROUP).set(attributeGroup); // depends on control dependency: [if], data = [(attributeGroup]
}
result.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).set(isAllowExpression());
result.get(ModelDescriptionConstants.REQUIRED).set(isRequired());
result.get(ModelDescriptionConstants.NILLABLE).set(isNillable());
if (!forOperation && nilSignificant != null) {
if (nilSignificant) {
result.get(ModelDescriptionConstants.NIL_SIGNIFICANT).set(true); // depends on control dependency: [if], data = [none]
}
}
if (defaultValue != null && defaultValue.isDefined()) {
result.get(ModelDescriptionConstants.DEFAULT).set(defaultValue); // depends on control dependency: [if], data = [(defaultValue]
}
if (measurementUnit != null && measurementUnit != MeasurementUnit.NONE) {
result.get(ModelDescriptionConstants.UNIT).set(measurementUnit.getName()); // depends on control dependency: [if], data = [(measurementUnit]
}
if (alternatives != null) {
for(final String alternative : alternatives) {
result.get(ModelDescriptionConstants.ALTERNATIVES).add(alternative); // depends on control dependency: [for], data = [alternative]
}
}
if (requires != null) {
for(final String required : requires) {
result.get(ModelDescriptionConstants.REQUIRES).add(required); // depends on control dependency: [for], data = [required]
}
}
if (getReferenceRecorder() != null) {
String[] capabilityPatternElements = getReferenceRecorder().getRequirementPatternSegments(name, PathAddress.EMPTY_ADDRESS);
result.get(ModelDescriptionConstants.CAPABILITY_REFERENCE).set(getReferenceRecorder().getBaseRequirementName()); // depends on control dependency: [if], data = [(getReferenceRecorder()]
if(capabilityPatternElements.length > 0 && (capabilityPatternElements.length > 1 || !name.equals(capabilityPatternElements[0]))) {
for(String patternElement : capabilityPatternElements) {
result.get(ModelDescriptionConstants.CAPABILITY_REFERENCE_PATTERN_ELEMENTS).add(patternElement); // depends on control dependency: [for], data = [patternElement]
}
}
}
if (validator instanceof MinMaxValidator) {
MinMaxValidator minMax = (MinMaxValidator) validator;
Long min = minMax.getMin();
if (min != null) {
switch (this.type) {
case STRING:
case LIST:
case OBJECT:
case BYTES:
result.get(ModelDescriptionConstants.MIN_LENGTH).set(min);
break;
default:
result.get(ModelDescriptionConstants.MIN).set(min);
}
}
Long max = minMax.getMax();
if (max != null) {
switch (this.type) {
case STRING:
case LIST:
case OBJECT:
case BYTES:
result.get(ModelDescriptionConstants.MAX_LENGTH).set(max);
break;
default:
result.get(ModelDescriptionConstants.MAX).set(max);
}
}
}
addAllowedValuesToDescription(result, validator);
arbitraryDescriptors.forEach((key, value) -> {
assert !result.hasDefined(key); //You can't override an arbitrary descriptor set through other properties.
result.get(key).set(value);
});
return result;
} } |
public class class_name {
private static void getChroma00(byte[] pic, int picW, int picH, byte[] blk, int blkOff, int blkStride, int x, int y,
int blkW, int blkH) {
int off = y * picW + x;
for (int j = 0; j < blkH; j++) {
arraycopy(pic, off, blk, blkOff, blkW);
off += picW;
blkOff += blkStride;
}
} } | public class class_name {
private static void getChroma00(byte[] pic, int picW, int picH, byte[] blk, int blkOff, int blkStride, int x, int y,
int blkW, int blkH) {
int off = y * picW + x;
for (int j = 0; j < blkH; j++) {
arraycopy(pic, off, blk, blkOff, blkW); // depends on control dependency: [for], data = [none]
off += picW; // depends on control dependency: [for], data = [none]
blkOff += blkStride; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public String nextVASPToken(boolean newLine) throws IOException {
String line;
if (newLine) { // We ignore the end of the line and go to the following line
if (inputBuffer.ready()) {
line = inputBuffer.readLine();
st = new StringTokenizer(line, " =\t");
}
}
while (!st.hasMoreTokens() && inputBuffer.ready()) {
line = inputBuffer.readLine();
st = new StringTokenizer(line, " =\t");
}
if (st.hasMoreTokens()) {
fieldVal = st.nextToken();
if (fieldVal.startsWith("#")) {
nextVASPToken(true);
}
} else {
fieldVal = null;
}
return this.fieldVal;
} } | public class class_name {
public String nextVASPToken(boolean newLine) throws IOException {
String line;
if (newLine) { // We ignore the end of the line and go to the following line
if (inputBuffer.ready()) {
line = inputBuffer.readLine(); // depends on control dependency: [if], data = [none]
st = new StringTokenizer(line, " =\t"); // depends on control dependency: [if], data = [none]
}
}
while (!st.hasMoreTokens() && inputBuffer.ready()) {
line = inputBuffer.readLine();
st = new StringTokenizer(line, " =\t");
}
if (st.hasMoreTokens()) {
fieldVal = st.nextToken();
if (fieldVal.startsWith("#")) {
nextVASPToken(true);
}
} else {
fieldVal = null;
}
return this.fieldVal;
} } |
public class class_name {
public static void removeDuplicatesFromOutputDirectory(File outputDirectory,
File originDirectory) {
if (originDirectory.isDirectory()) {
for (String name : originDirectory.list()) {
File targetFile = new File(outputDirectory, name);
if (targetFile.exists() && targetFile.canWrite()) {
if (!targetFile.isDirectory()) {
targetFile.delete();
}
else {
FileUtils.removeDuplicatesFromOutputDirectory(targetFile,
new File(originDirectory, name));
}
}
}
}
} } | public class class_name {
public static void removeDuplicatesFromOutputDirectory(File outputDirectory,
File originDirectory) {
if (originDirectory.isDirectory()) {
for (String name : originDirectory.list()) {
File targetFile = new File(outputDirectory, name);
if (targetFile.exists() && targetFile.canWrite()) {
if (!targetFile.isDirectory()) {
targetFile.delete(); // depends on control dependency: [if], data = [none]
}
else {
FileUtils.removeDuplicatesFromOutputDirectory(targetFile,
new File(originDirectory, name)); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public double getFitness(String candidate,
List<? extends String> population)
{
int errors = 0;
for (int i = 0; i < candidate.length(); i++)
{
if (candidate.charAt(i) != targetString.charAt(i))
{
++errors;
}
}
return errors;
} } | public class class_name {
public double getFitness(String candidate,
List<? extends String> population)
{
int errors = 0;
for (int i = 0; i < candidate.length(); i++)
{
if (candidate.charAt(i) != targetString.charAt(i))
{
++errors; // depends on control dependency: [if], data = [none]
}
}
return errors;
} } |
public class class_name {
public static TreePath createTreePathToRoot(
TreeModel treeModel, Object node)
{
List<Object> nodes = new ArrayList<Object>();
nodes.add(node);
Object current = node;
while (true)
{
Object parent = getParent(treeModel, current);
if (parent == null)
{
break;
}
nodes.add(0, parent);
current = parent;
}
TreePath treePath = new TreePath(nodes.toArray());
return treePath;
} } | public class class_name {
public static TreePath createTreePathToRoot(
TreeModel treeModel, Object node)
{
List<Object> nodes = new ArrayList<Object>();
nodes.add(node);
Object current = node;
while (true)
{
Object parent = getParent(treeModel, current);
if (parent == null)
{
break;
}
nodes.add(0, parent);
// depends on control dependency: [while], data = [none]
current = parent;
// depends on control dependency: [while], data = [none]
}
TreePath treePath = new TreePath(nodes.toArray());
return treePath;
} } |
public class class_name {
public void unregisterPushServices(TaskCompletionListener completionListener) {
RespokeClient activeInstance = null;
// If there are already client instances running, check if any of them have already connected
for (RespokeClient eachInstance : instances) {
if (eachInstance.isConnected()) {
// The push service only supports one endpoint per device, so the token only needs to be registered for the first active client (if there is more than one)
activeInstance = eachInstance;
break;
}
}
if (null != activeInstance) {
activeInstance.unregisterFromPushServices(completionListener);
} else {
postTaskError(completionListener, "There is no active client to unregister");
}
} } | public class class_name {
public void unregisterPushServices(TaskCompletionListener completionListener) {
RespokeClient activeInstance = null;
// If there are already client instances running, check if any of them have already connected
for (RespokeClient eachInstance : instances) {
if (eachInstance.isConnected()) {
// The push service only supports one endpoint per device, so the token only needs to be registered for the first active client (if there is more than one)
activeInstance = eachInstance; // depends on control dependency: [if], data = [none]
break;
}
}
if (null != activeInstance) {
activeInstance.unregisterFromPushServices(completionListener); // depends on control dependency: [if], data = [none]
} else {
postTaskError(completionListener, "There is no active client to unregister"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setPartitions(java.util.Collection<Partition> partitions) {
if (partitions == null) {
this.partitions = null;
return;
}
this.partitions = new java.util.ArrayList<Partition>(partitions);
} } | public class class_name {
public void setPartitions(java.util.Collection<Partition> partitions) {
if (partitions == null) {
this.partitions = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.partitions = new java.util.ArrayList<Partition>(partitions);
} } |
public class class_name {
public static void shutdown() {
if (applicationContextCreator.isCreated()) {
final ConfigurableApplicationContext applicationContext =
applicationContextCreator.get();
applicationContext.close();
} else {
final IllegalStateException createException =
new IllegalStateException(
"No portal managed ApplicationContext has been created, there is nothing to shutdown.");
getLogger().error(createException, createException);
}
} } | public class class_name {
public static void shutdown() {
if (applicationContextCreator.isCreated()) {
final ConfigurableApplicationContext applicationContext =
applicationContextCreator.get();
applicationContext.close(); // depends on control dependency: [if], data = [none]
} else {
final IllegalStateException createException =
new IllegalStateException(
"No portal managed ApplicationContext has been created, there is nothing to shutdown.");
getLogger().error(createException, createException); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setKeepAliveTime(long keepAliveTime) {
this.keepAliveTime = keepAliveTime;
if(this.timerKey != null) {
this.timerKey.remove();
}
this.timerKey = sink.getIoThread().executeAtInterval(new Runnable() {
@Override
public void run() {
if(shutdown || open == 0) {
if(timerKey != null) {
timerKey.remove();
}
return;
}
if(pooled == null) {
pooled = exchange.getConnection().getByteBufferPool().allocate();
pooled.getBuffer().put(":\n".getBytes(StandardCharsets.UTF_8));
pooled.getBuffer().flip();
writeListener.handleEvent(sink);
}
}
}, keepAliveTime, TimeUnit.MILLISECONDS);
} } | public class class_name {
public void setKeepAliveTime(long keepAliveTime) {
this.keepAliveTime = keepAliveTime;
if(this.timerKey != null) {
this.timerKey.remove(); // depends on control dependency: [if], data = [none]
}
this.timerKey = sink.getIoThread().executeAtInterval(new Runnable() {
@Override
public void run() {
if(shutdown || open == 0) {
if(timerKey != null) {
timerKey.remove(); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if(pooled == null) {
pooled = exchange.getConnection().getByteBufferPool().allocate(); // depends on control dependency: [if], data = [none]
pooled.getBuffer().put(":\n".getBytes(StandardCharsets.UTF_8)); // depends on control dependency: [if], data = [none]
pooled.getBuffer().flip(); // depends on control dependency: [if], data = [none]
writeListener.handleEvent(sink); // depends on control dependency: [if], data = [none]
}
}
}, keepAliveTime, TimeUnit.MILLISECONDS);
} } |
public class class_name {
public static final <T> void offer(T[] heapKeys, double[] heapValues, int heapSize,
T newKey, double newValue) {
heapKeys[heapSize] = newKey;
heapValues[heapSize] = newValue;
int curIndex = heapSize;
int parentIndex = (curIndex - 1) / 2;
while (heapValues[curIndex] < heapValues[parentIndex]) {
swap(heapKeys, heapValues, curIndex, parentIndex);
curIndex = parentIndex;
// Note that if curIndex = 0, parentIndex = curIndex so the loop test
// will become false.
parentIndex = (curIndex - 1) / 2;
}
} } | public class class_name {
public static final <T> void offer(T[] heapKeys, double[] heapValues, int heapSize,
T newKey, double newValue) {
heapKeys[heapSize] = newKey;
heapValues[heapSize] = newValue;
int curIndex = heapSize;
int parentIndex = (curIndex - 1) / 2;
while (heapValues[curIndex] < heapValues[parentIndex]) {
swap(heapKeys, heapValues, curIndex, parentIndex); // depends on control dependency: [while], data = [none]
curIndex = parentIndex; // depends on control dependency: [while], data = [none]
// Note that if curIndex = 0, parentIndex = curIndex so the loop test
// will become false.
parentIndex = (curIndex - 1) / 2; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public void onResume() {
Session session = Session.getActiveSession();
if (session != null) {
if (callback != null) {
session.addCallback(callback);
}
if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState())) {
session.openForRead(null);
}
}
// add the broadcast receiver
IntentFilter filter = new IntentFilter();
filter.addAction(Session.ACTION_ACTIVE_SESSION_SET);
filter.addAction(Session.ACTION_ACTIVE_SESSION_UNSET);
// Add a broadcast receiver to listen to when the active Session
// is set or unset, and add/remove our callback as appropriate
broadcastManager.registerReceiver(receiver, filter);
} } | public class class_name {
public void onResume() {
Session session = Session.getActiveSession();
if (session != null) {
if (callback != null) {
session.addCallback(callback); // depends on control dependency: [if], data = [(callback]
}
if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState())) {
session.openForRead(null); // depends on control dependency: [if], data = [none]
}
}
// add the broadcast receiver
IntentFilter filter = new IntentFilter();
filter.addAction(Session.ACTION_ACTIVE_SESSION_SET);
filter.addAction(Session.ACTION_ACTIVE_SESSION_UNSET);
// Add a broadcast receiver to listen to when the active Session
// is set or unset, and add/remove our callback as appropriate
broadcastManager.registerReceiver(receiver, filter);
} } |
public class class_name {
public PropsEntry getProfileProperty(final String profile, final String key) {
final Map<String, PropsEntry> profileMap = profileProperties.get(profile);
if (profileMap == null) {
return null;
}
return profileMap.get(key);
} } | public class class_name {
public PropsEntry getProfileProperty(final String profile, final String key) {
final Map<String, PropsEntry> profileMap = profileProperties.get(profile);
if (profileMap == null) {
return null; // depends on control dependency: [if], data = [none]
}
return profileMap.get(key);
} } |
public class class_name {
protected void writeRequest(final NextFilter nextFilter,
final SocksProxyRequest request) {
try {
boolean isV4ARequest = request.getHost() != null;
byte[] userID = request.getUserName().getBytes("ASCII");
byte[] host = isV4ARequest ? request.getHost().getBytes("ASCII")
: null;
int len = 9 + userID.length;
if (isV4ARequest) {
len += host.length + 1;
}
IoBuffer buf = IoBuffer.allocate(len);
buf.put(request.getProtocolVersion());
buf.put(request.getCommandCode());
buf.put(request.getPort());
buf.put(request.getIpAddress());
buf.put(userID);
buf.put(SocksProxyConstants.TERMINATOR);
if (isV4ARequest) {
buf.put(host);
buf.put(SocksProxyConstants.TERMINATOR);
}
if (isV4ARequest) {
logger.debug(" sending SOCKS4a request");
} else {
logger.debug(" sending SOCKS4 request");
}
buf.flip();
writeData(nextFilter, buf);
} catch (Exception ex) {
closeSession("Unable to send Socks request: ", ex);
}
} } | public class class_name {
protected void writeRequest(final NextFilter nextFilter,
final SocksProxyRequest request) {
try {
boolean isV4ARequest = request.getHost() != null;
byte[] userID = request.getUserName().getBytes("ASCII");
byte[] host = isV4ARequest ? request.getHost().getBytes("ASCII")
: null;
int len = 9 + userID.length;
if (isV4ARequest) {
len += host.length + 1; // depends on control dependency: [if], data = [none]
}
IoBuffer buf = IoBuffer.allocate(len);
buf.put(request.getProtocolVersion()); // depends on control dependency: [try], data = [none]
buf.put(request.getCommandCode()); // depends on control dependency: [try], data = [none]
buf.put(request.getPort()); // depends on control dependency: [try], data = [none]
buf.put(request.getIpAddress()); // depends on control dependency: [try], data = [none]
buf.put(userID); // depends on control dependency: [try], data = [none]
buf.put(SocksProxyConstants.TERMINATOR); // depends on control dependency: [try], data = [none]
if (isV4ARequest) {
buf.put(host); // depends on control dependency: [if], data = [none]
buf.put(SocksProxyConstants.TERMINATOR); // depends on control dependency: [if], data = [none]
}
if (isV4ARequest) {
logger.debug(" sending SOCKS4a request"); // depends on control dependency: [if], data = [none]
} else {
logger.debug(" sending SOCKS4 request"); // depends on control dependency: [if], data = [none]
}
buf.flip(); // depends on control dependency: [try], data = [none]
writeData(nextFilter, buf); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
closeSession("Unable to send Socks request: ", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(ListDevicesRequest listDevicesRequest, ProtocolMarshaller protocolMarshaller) {
if (listDevicesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listDevicesRequest.getAccessToken(), ACCESSTOKEN_BINDING);
protocolMarshaller.marshall(listDevicesRequest.getLimit(), LIMIT_BINDING);
protocolMarshaller.marshall(listDevicesRequest.getPaginationToken(), PAGINATIONTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListDevicesRequest listDevicesRequest, ProtocolMarshaller protocolMarshaller) {
if (listDevicesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listDevicesRequest.getAccessToken(), ACCESSTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDevicesRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDevicesRequest.getPaginationToken(), PAGINATIONTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void addOrUpdateUsbDevice(UsbDevice usbDevice, boolean hasPermission) {
Preconditions.checkNotNull(usbDevice);
Preconditions.checkNotNull(usbDevice.getDeviceName());
usbDevices.put(usbDevice.getDeviceName(), usbDevice);
if (hasPermission) {
grantPermission(usbDevice);
} else {
revokePermission(usbDevice, RuntimeEnvironment.application.getPackageName());
}
} } | public class class_name {
public void addOrUpdateUsbDevice(UsbDevice usbDevice, boolean hasPermission) {
Preconditions.checkNotNull(usbDevice);
Preconditions.checkNotNull(usbDevice.getDeviceName());
usbDevices.put(usbDevice.getDeviceName(), usbDevice);
if (hasPermission) {
grantPermission(usbDevice); // depends on control dependency: [if], data = [none]
} else {
revokePermission(usbDevice, RuntimeEnvironment.application.getPackageName()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void write(ByteBuffer buffer, int len) {
if (len < 1) return;
if (count >= content.length - len) {
byte[] ns = new byte[content.length + len];
System.arraycopy(content, 0, ns, 0, count);
this.content = ns;
}
buffer.get(content, count, len);
count += len;
} } | public class class_name {
public void write(ByteBuffer buffer, int len) {
if (len < 1) return;
if (count >= content.length - len) {
byte[] ns = new byte[content.length + len];
System.arraycopy(content, 0, ns, 0, count);
// depends on control dependency: [if], data = [none]
this.content = ns;
// depends on control dependency: [if], data = [none]
}
buffer.get(content, count, len);
count += len;
} } |
public class class_name {
private void buildupPropertiesBundles(final File file) throws IOException {
File[] files = file.listFiles();
for (File f : files) {
if (f.getName().endsWith("properties")) {
String bundleName = f.getName().substring(0,
f.getName().indexOf("properties") - 1);
LOG.info("Loading: " + bundleName);
ResourceBundle bundle = new PropertyResourceBundle(
new FileInputStream(f));
bundles.put(bundleName, bundle);
}
}
} } | public class class_name {
private void buildupPropertiesBundles(final File file) throws IOException {
File[] files = file.listFiles();
for (File f : files) {
if (f.getName().endsWith("properties")) {
String bundleName = f.getName().substring(0,
f.getName().indexOf("properties") - 1);
LOG.info("Loading: " + bundleName); // depends on control dependency: [if], data = [none]
ResourceBundle bundle = new PropertyResourceBundle(
new FileInputStream(f));
bundles.put(bundleName, bundle); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void processNotContainsException(Map<String, String> parameters) {
LoggingEvent match = getMessageWithException(parameters);
if (match == null) {
cell.right();
} else {
cell.wrong(match.getThrowableInformation().getThrowableStrRep()[0]);
}
} } | public class class_name {
public void processNotContainsException(Map<String, String> parameters) {
LoggingEvent match = getMessageWithException(parameters);
if (match == null) {
cell.right(); // depends on control dependency: [if], data = [none]
} else {
cell.wrong(match.getThrowableInformation().getThrowableStrRep()[0]); // depends on control dependency: [if], data = [(match]
}
} } |
public class class_name {
public void addUndoableMove(int moveThreadIndex, int stepIndex, int moveIndex, Move<Solution_> move) {
MoveResult<Solution_> result = new MoveResult<>(moveThreadIndex, stepIndex, moveIndex, move, false, null);
synchronized (this) {
if (result.getStepIndex() != filterStepIndex) {
// Discard element from previous step
return;
}
innerQueue.add(result);
}
} } | public class class_name {
public void addUndoableMove(int moveThreadIndex, int stepIndex, int moveIndex, Move<Solution_> move) {
MoveResult<Solution_> result = new MoveResult<>(moveThreadIndex, stepIndex, moveIndex, move, false, null);
synchronized (this) {
if (result.getStepIndex() != filterStepIndex) {
// Discard element from previous step
return; // depends on control dependency: [if], data = [none]
}
innerQueue.add(result);
}
} } |
public class class_name {
private void pruneStatement(final Statement stmt, final Document doc) {
final List<StatementGroup> stmtgroups = doc.getAllStatementGroups();
for (final StatementGroup stmtgroup : stmtgroups) {
final Iterator<Statement> sgi = stmtgroup.getStatements()
.iterator();
while (sgi.hasNext()) {
final Statement sgs = sgi.next();
if (stmt.equals(sgs)) {
// prune
sgi.remove();
return;
}
}
}
} } | public class class_name {
private void pruneStatement(final Statement stmt, final Document doc) {
final List<StatementGroup> stmtgroups = doc.getAllStatementGroups();
for (final StatementGroup stmtgroup : stmtgroups) {
final Iterator<Statement> sgi = stmtgroup.getStatements()
.iterator();
while (sgi.hasNext()) {
final Statement sgs = sgi.next();
if (stmt.equals(sgs)) {
// prune
sgi.remove(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public Content getClassLinkLabel(Configuration configuration) {
if (label != null && !label.isEmpty()) {
return label;
} else if (isLinkable()) {
Content tlabel = newContent();
tlabel.addContent(configuration.utils.getSimpleName(typeElement));
return tlabel;
} else {
Content tlabel = newContent();
tlabel.addContent(configuration.getClassName(typeElement));
return tlabel;
}
} } | public class class_name {
public Content getClassLinkLabel(Configuration configuration) {
if (label != null && !label.isEmpty()) {
return label; // depends on control dependency: [if], data = [none]
} else if (isLinkable()) {
Content tlabel = newContent();
tlabel.addContent(configuration.utils.getSimpleName(typeElement)); // depends on control dependency: [if], data = [none]
return tlabel; // depends on control dependency: [if], data = [none]
} else {
Content tlabel = newContent();
tlabel.addContent(configuration.getClassName(typeElement)); // depends on control dependency: [if], data = [none]
return tlabel; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public BoundCodeDt<NarrativeStatusEnum> getStatus() {
if (myStatus == null) {
myStatus = new BoundCodeDt<NarrativeStatusEnum>(NarrativeStatusEnum.VALUESET_BINDER);
}
return myStatus;
} } | public class class_name {
public BoundCodeDt<NarrativeStatusEnum> getStatus() {
if (myStatus == null) {
myStatus = new BoundCodeDt<NarrativeStatusEnum>(NarrativeStatusEnum.VALUESET_BINDER); // depends on control dependency: [if], data = [none]
}
return myStatus;
} } |
public class class_name {
static ConfigurationPropertyName adapt(CharSequence name, char separator,
Function<CharSequence, CharSequence> elementValueProcessor) {
Assert.notNull(name, "Name must not be null");
if (name.length() == 0) {
return EMPTY;
}
Elements elements = new ElementsParser(name, separator)
.parse(elementValueProcessor);
if (elements.getSize() == 0) {
return EMPTY;
}
return new ConfigurationPropertyName(elements);
} } | public class class_name {
static ConfigurationPropertyName adapt(CharSequence name, char separator,
Function<CharSequence, CharSequence> elementValueProcessor) {
Assert.notNull(name, "Name must not be null");
if (name.length() == 0) {
return EMPTY; // depends on control dependency: [if], data = [none]
}
Elements elements = new ElementsParser(name, separator)
.parse(elementValueProcessor);
if (elements.getSize() == 0) {
return EMPTY; // depends on control dependency: [if], data = [none]
}
return new ConfigurationPropertyName(elements);
} } |
public class class_name {
private PeriodFormatterBuilder appendSuffix(PeriodFieldAffix suffix) {
final Object originalPrinter;
final Object originalParser;
if (iElementPairs.size() > 0) {
originalPrinter = iElementPairs.get(iElementPairs.size() - 2);
originalParser = iElementPairs.get(iElementPairs.size() - 1);
} else {
originalPrinter = null;
originalParser = null;
}
if (originalPrinter == null || originalParser == null ||
originalPrinter != originalParser ||
!(originalPrinter instanceof FieldFormatter)) {
throw new IllegalStateException("No field to apply suffix to");
}
clearPrefix();
FieldFormatter newField = new FieldFormatter((FieldFormatter) originalPrinter, suffix);
iElementPairs.set(iElementPairs.size() - 2, newField);
iElementPairs.set(iElementPairs.size() - 1, newField);
iFieldFormatters[newField.getFieldType()] = newField;
return this;
} } | public class class_name {
private PeriodFormatterBuilder appendSuffix(PeriodFieldAffix suffix) {
final Object originalPrinter;
final Object originalParser;
if (iElementPairs.size() > 0) {
originalPrinter = iElementPairs.get(iElementPairs.size() - 2); // depends on control dependency: [if], data = [(iElementPairs.size()]
originalParser = iElementPairs.get(iElementPairs.size() - 1); // depends on control dependency: [if], data = [(iElementPairs.size()]
} else {
originalPrinter = null; // depends on control dependency: [if], data = [none]
originalParser = null; // depends on control dependency: [if], data = [none]
}
if (originalPrinter == null || originalParser == null ||
originalPrinter != originalParser ||
!(originalPrinter instanceof FieldFormatter)) {
throw new IllegalStateException("No field to apply suffix to");
}
clearPrefix();
FieldFormatter newField = new FieldFormatter((FieldFormatter) originalPrinter, suffix);
iElementPairs.set(iElementPairs.size() - 2, newField);
iElementPairs.set(iElementPairs.size() - 1, newField);
iFieldFormatters[newField.getFieldType()] = newField;
return this;
} } |
public class class_name {
public void marshall(ClientProperties clientProperties, ProtocolMarshaller protocolMarshaller) {
if (clientProperties == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(clientProperties.getReconnectEnabled(), RECONNECTENABLED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ClientProperties clientProperties, ProtocolMarshaller protocolMarshaller) {
if (clientProperties == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(clientProperties.getReconnectEnabled(), RECONNECTENABLED_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void add(HeaderField header) {
int headerSize = header.size();
if (headerSize > capacity) {
clear();
return;
}
while (size + headerSize > capacity) {
remove();
}
headerFields[head++] = header;
size += header.size();
if (head == headerFields.length) {
head = 0;
}
} } | public class class_name {
public void add(HeaderField header) {
int headerSize = header.size();
if (headerSize > capacity) {
clear(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
while (size + headerSize > capacity) {
remove(); // depends on control dependency: [while], data = [none]
}
headerFields[head++] = header;
size += header.size();
if (head == headerFields.length) {
head = 0; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void readStreamLines (@WillClose @Nullable final InputStream aIS,
@Nonnull @Nonempty final Charset aCharset,
@Nonnegative final int nLinesToSkip,
final int nLinesToRead,
@Nonnull final Consumer <? super String> aLineCallback)
{
try
{
ValueEnforcer.notNull (aCharset, "Charset");
ValueEnforcer.isGE0 (nLinesToSkip, "LinesToSkip");
final boolean bReadAllLines = nLinesToRead == CGlobal.ILLEGAL_UINT;
ValueEnforcer.isTrue (bReadAllLines || nLinesToRead >= 0,
() -> "Line count may not be that negative: " + nLinesToRead);
ValueEnforcer.notNull (aLineCallback, "LineCallback");
// Start the action only if there is something to read
if (aIS != null)
if (bReadAllLines || nLinesToRead > 0)
{
try (final NonBlockingBufferedReader aBR = new NonBlockingBufferedReader (createReader (aIS, aCharset)))
{
// read with the passed charset
_readFromReader (nLinesToSkip, nLinesToRead, aLineCallback, bReadAllLines, aBR);
}
catch (final IOException ex)
{
LOGGER.error ("Failed to read from input stream", ex instanceof IMockException ? null : ex);
}
}
}
finally
{
// Close input stream in case something went wrong with the buffered
// reader.
close (aIS);
}
} } | public class class_name {
public static void readStreamLines (@WillClose @Nullable final InputStream aIS,
@Nonnull @Nonempty final Charset aCharset,
@Nonnegative final int nLinesToSkip,
final int nLinesToRead,
@Nonnull final Consumer <? super String> aLineCallback)
{
try
{
ValueEnforcer.notNull (aCharset, "Charset"); // depends on control dependency: [try], data = [none]
ValueEnforcer.isGE0 (nLinesToSkip, "LinesToSkip"); // depends on control dependency: [try], data = [none]
final boolean bReadAllLines = nLinesToRead == CGlobal.ILLEGAL_UINT;
ValueEnforcer.isTrue (bReadAllLines || nLinesToRead >= 0,
() -> "Line count may not be that negative: " + nLinesToRead); // depends on control dependency: [try], data = [none]
ValueEnforcer.notNull (aLineCallback, "LineCallback"); // depends on control dependency: [try], data = [none]
// Start the action only if there is something to read
if (aIS != null)
if (bReadAllLines || nLinesToRead > 0)
{
try (final NonBlockingBufferedReader aBR = new NonBlockingBufferedReader (createReader (aIS, aCharset)))
{
// read with the passed charset
_readFromReader (nLinesToSkip, nLinesToRead, aLineCallback, bReadAllLines, aBR);
}
catch (final IOException ex) // depends on control dependency: [try], data = [none]
{
LOGGER.error ("Failed to read from input stream", ex instanceof IMockException ? null : ex);
}
}
}
finally
{
// Close input stream in case something went wrong with the buffered
// reader.
close (aIS);
}
} } |
public class class_name {
@Override
public void errormsg(String key, Object... args) {
if (isRunningInteractive()) {
rawout(prefixError(messageFormat(key, args)));
} else {
startmsg(key, args);
}
} } | public class class_name {
@Override
public void errormsg(String key, Object... args) {
if (isRunningInteractive()) {
rawout(prefixError(messageFormat(key, args))); // depends on control dependency: [if], data = [none]
} else {
startmsg(key, args); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String toHeaderValue(List<ExtensionConfig> configs) {
if ((configs == null) || (configs.isEmpty())) {
return null;
}
StringBuilder parameters = new StringBuilder();
boolean needsDelim = false;
for (ExtensionConfig ext : configs) {
if (needsDelim) {
parameters.append(", ");
}
parameters.append(ext.getParameterizedName());
needsDelim = true;
}
return parameters.toString();
} } | public class class_name {
public static String toHeaderValue(List<ExtensionConfig> configs) {
if ((configs == null) || (configs.isEmpty())) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuilder parameters = new StringBuilder();
boolean needsDelim = false;
for (ExtensionConfig ext : configs) {
if (needsDelim) {
parameters.append(", "); // depends on control dependency: [if], data = [none]
}
parameters.append(ext.getParameterizedName()); // depends on control dependency: [for], data = [ext]
needsDelim = true; // depends on control dependency: [for], data = [none]
}
return parameters.toString();
} } |
public class class_name {
@Override
public void run() {
if (executorService == null)
executorService = Executors.newSingleThreadExecutor();
if (!isServing()) {
beforeStart(getServerConfiguration().getServerAspect());
executorService.execute(() -> {
try {
start();
} catch (IkasoaException e) {
throw new RuntimeException(e);
}
});
Runtime.getRuntime().addShutdownHook(new Thread(() -> stop()));
afterStart(getServerConfiguration().getServerAspect());
}
} } | public class class_name {
@Override
public void run() {
if (executorService == null)
executorService = Executors.newSingleThreadExecutor();
if (!isServing()) {
beforeStart(getServerConfiguration().getServerAspect()); // depends on control dependency: [if], data = [none]
executorService.execute(() -> {
try {
start(); // depends on control dependency: [try], data = [none]
} catch (IkasoaException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
});
Runtime.getRuntime().addShutdownHook(new Thread(() -> stop())); // depends on control dependency: [if], data = [none]
afterStart(getServerConfiguration().getServerAspect()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
protected List<ChecksumFile> getFilesToProcess()
{
List<ChecksumFile> files = new LinkedList<ChecksumFile>();
@SuppressWarnings("unchecked")
Set<Artifact> artifacts = transitive ? project.getArtifacts() : project.getDependencyArtifacts();
for ( Artifact artifact : artifacts )
{
if ( ( scopes == null || scopes.contains( artifact.getScope() ) ) && ( types == null || types.contains(
artifact.getType() ) ) )
{
files.add( new ChecksumFile( "", artifact.getFile(), artifact.getType(), artifact.getClassifier() ) );
}
}
return files;
} } | public class class_name {
@Override
protected List<ChecksumFile> getFilesToProcess()
{
List<ChecksumFile> files = new LinkedList<ChecksumFile>();
@SuppressWarnings("unchecked")
Set<Artifact> artifacts = transitive ? project.getArtifacts() : project.getDependencyArtifacts();
for ( Artifact artifact : artifacts )
{
if ( ( scopes == null || scopes.contains( artifact.getScope() ) ) && ( types == null || types.contains(
artifact.getType() ) ) )
{
files.add( new ChecksumFile( "", artifact.getFile(), artifact.getType(), artifact.getClassifier() ) ); // depends on control dependency: [if], data = [none]
}
}
return files;
} } |
public class class_name {
public void registerMonitor(final Graph.Monitor monitor) {
if (uiThreadRunner.isOnUiThread()) {
graph.registerMonitor(monitor);
} else {
uiThreadRunner.post(new Runnable() {
@Override
public void run() {
graph.registerMonitor(monitor);
}
});
}
} } | public class class_name {
public void registerMonitor(final Graph.Monitor monitor) {
if (uiThreadRunner.isOnUiThread()) {
graph.registerMonitor(monitor); // depends on control dependency: [if], data = [none]
} else {
uiThreadRunner.post(new Runnable() {
@Override
public void run() {
graph.registerMonitor(monitor);
}
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private JCheckBox getChkParseSVNEntries() {
if (parseSVNEntries == null) {
parseSVNEntries = new JCheckBox();
parseSVNEntries.setText(Constant.messages.getString("spider.options.label.svnentries"));
}
return parseSVNEntries;
} } | public class class_name {
private JCheckBox getChkParseSVNEntries() {
if (parseSVNEntries == null) {
parseSVNEntries = new JCheckBox();
// depends on control dependency: [if], data = [none]
parseSVNEntries.setText(Constant.messages.getString("spider.options.label.svnentries"));
}
return parseSVNEntries;
// depends on control dependency: [if], data = [none]
} } |
public class class_name {
@Override
public Set<KamNode> findNode(Pattern labelPattern, NodeFilter filter) {
Set<KamNode> results = new LinkedHashSet<KamNode>();
for (KamNode node : getNodes()) {
boolean passedFilter = (filter == null || filter.accept(node));
if (passedFilter && labelPattern.matcher(node.getLabel()).matches()) {
results.add(node);
}
}
return results;
} } | public class class_name {
@Override
public Set<KamNode> findNode(Pattern labelPattern, NodeFilter filter) {
Set<KamNode> results = new LinkedHashSet<KamNode>();
for (KamNode node : getNodes()) {
boolean passedFilter = (filter == null || filter.accept(node));
if (passedFilter && labelPattern.matcher(node.getLabel()).matches()) {
results.add(node); // depends on control dependency: [if], data = [none]
}
}
return results;
} } |
public class class_name {
public static synchronized void removeChannelGroup(String groupId) {
try {
if (_removeChannelGroup(groupId)) {
save();
}
} catch (Exception ex) {
Log.e(WonderPush.TAG, "Unexpected error while removing channel group " + groupId, ex);
}
} } | public class class_name {
public static synchronized void removeChannelGroup(String groupId) {
try {
if (_removeChannelGroup(groupId)) {
save(); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
Log.e(WonderPush.TAG, "Unexpected error while removing channel group " + groupId, ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void merge(GridHubConfiguration other) {
if (other == null) {
return;
}
super.merge(other);
if (isMergeAble(CapabilityMatcher.class, other.capabilityMatcher, capabilityMatcher)) {
capabilityMatcher = other.capabilityMatcher;
}
if (isMergeAble(Integer.class, other.newSessionWaitTimeout, newSessionWaitTimeout)) {
newSessionWaitTimeout = other.newSessionWaitTimeout;
}
if (isMergeAble(Prioritizer.class, other.prioritizer, prioritizer)) {
prioritizer = other.prioritizer;
}
if (isMergeAble(Boolean.class, other.throwOnCapabilityNotPresent, throwOnCapabilityNotPresent)) {
throwOnCapabilityNotPresent = other.throwOnCapabilityNotPresent;
}
if (isMergeAble(String.class, other.registry, registry)) {
registry = other.registry;
}
} } | public class class_name {
public void merge(GridHubConfiguration other) {
if (other == null) {
return; // depends on control dependency: [if], data = [none]
}
super.merge(other);
if (isMergeAble(CapabilityMatcher.class, other.capabilityMatcher, capabilityMatcher)) {
capabilityMatcher = other.capabilityMatcher; // depends on control dependency: [if], data = [none]
}
if (isMergeAble(Integer.class, other.newSessionWaitTimeout, newSessionWaitTimeout)) {
newSessionWaitTimeout = other.newSessionWaitTimeout; // depends on control dependency: [if], data = [none]
}
if (isMergeAble(Prioritizer.class, other.prioritizer, prioritizer)) {
prioritizer = other.prioritizer; // depends on control dependency: [if], data = [none]
}
if (isMergeAble(Boolean.class, other.throwOnCapabilityNotPresent, throwOnCapabilityNotPresent)) {
throwOnCapabilityNotPresent = other.throwOnCapabilityNotPresent; // depends on control dependency: [if], data = [none]
}
if (isMergeAble(String.class, other.registry, registry)) {
registry = other.registry; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setUserList(java.util.Collection<User> userList) {
if (userList == null) {
this.userList = null;
return;
}
this.userList = new java.util.ArrayList<User>(userList);
} } | public class class_name {
public void setUserList(java.util.Collection<User> userList) {
if (userList == null) {
this.userList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.userList = new java.util.ArrayList<User>(userList);
} } |
public class class_name {
public static Object fromPersistenceType(Object value, Class<?> parameterType) {
if (!isTypeConversionRequired(parameterType)) {
return value;
}
if (Map.class.isAssignableFrom(parameterType) && (value instanceof String[])) {
String[] rows = (String[])value;
Map<String, String> map = new LinkedHashMap<>();
for (int i = 0; i < rows.length; i++) {
String[] keyValue = ConversionStringUtils.splitPreserveAllTokens(rows[i], KEY_VALUE_DELIMITER.charAt(0));
if (keyValue.length == 2 && StringUtils.isNotEmpty(keyValue[0])) {
String entryKey = keyValue[0];
String entryValue = StringUtils.isEmpty(keyValue[1]) ? null : keyValue[1];
map.put(ConversionStringUtils.decodeString(entryKey), ConversionStringUtils.decodeString(entryValue));
}
}
return map;
}
throw new IllegalArgumentException("Type conversion not supported: " + parameterType.getName());
} } | public class class_name {
public static Object fromPersistenceType(Object value, Class<?> parameterType) {
if (!isTypeConversionRequired(parameterType)) {
return value; // depends on control dependency: [if], data = [none]
}
if (Map.class.isAssignableFrom(parameterType) && (value instanceof String[])) {
String[] rows = (String[])value;
Map<String, String> map = new LinkedHashMap<>();
for (int i = 0; i < rows.length; i++) {
String[] keyValue = ConversionStringUtils.splitPreserveAllTokens(rows[i], KEY_VALUE_DELIMITER.charAt(0));
if (keyValue.length == 2 && StringUtils.isNotEmpty(keyValue[0])) {
String entryKey = keyValue[0];
String entryValue = StringUtils.isEmpty(keyValue[1]) ? null : keyValue[1];
map.put(ConversionStringUtils.decodeString(entryKey), ConversionStringUtils.decodeString(entryValue)); // depends on control dependency: [if], data = [none]
}
}
return map; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("Type conversion not supported: " + parameterType.getName());
} } |
public class class_name {
public Computer withComputerAttributes(Attribute... computerAttributes) {
if (this.computerAttributes == null) {
setComputerAttributes(new com.amazonaws.internal.SdkInternalList<Attribute>(computerAttributes.length));
}
for (Attribute ele : computerAttributes) {
this.computerAttributes.add(ele);
}
return this;
} } | public class class_name {
public Computer withComputerAttributes(Attribute... computerAttributes) {
if (this.computerAttributes == null) {
setComputerAttributes(new com.amazonaws.internal.SdkInternalList<Attribute>(computerAttributes.length)); // depends on control dependency: [if], data = [none]
}
for (Attribute ele : computerAttributes) {
this.computerAttributes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public ScheduledFuture<?> schedule() {
synchronized (this.triggerContextMonitor) {
this.scheduledExecutionTime = this.trigger.nextExecutionTime(this.triggerContext);
if (this.scheduledExecutionTime == null) {
return null;
}
long initialDelay = this.scheduledExecutionTime.getTime() - System.currentTimeMillis();
this.currentFuture = this.executor.schedule(this, initialDelay, TimeUnit.MILLISECONDS);
return this;
}
} } | public class class_name {
public ScheduledFuture<?> schedule() {
synchronized (this.triggerContextMonitor) {
this.scheduledExecutionTime = this.trigger.nextExecutionTime(this.triggerContext);
if (this.scheduledExecutionTime == null) {
return null; // depends on control dependency: [if], data = [none]
}
long initialDelay = this.scheduledExecutionTime.getTime() - System.currentTimeMillis();
this.currentFuture = this.executor.schedule(this, initialDelay, TimeUnit.MILLISECONDS);
return this;
}
} } |
public class class_name {
@Override
public void processIOSettingQuestion(IOSetting setting) {
// post the question
if (setting.getLevel().ordinal() <= this.level.ordinal()) {
String answer = setting.getSetting();
if (setting instanceof BooleanIOSetting) {
int n = JOptionPane.showConfirmDialog(frame, setting.getQuestion(), setting.getName(),
JOptionPane.YES_NO_OPTION);
if (n == JOptionPane.YES_OPTION) {
answer = "true";
} else if (n == JOptionPane.NO_OPTION) {
answer = "false";
} else {
// default of setting
}
} else if (setting instanceof OptionIOSetting) {
OptionIOSetting optionSetting = (OptionIOSetting) setting;
List<String> settings = optionSetting.getOptions();
Iterator<String> elements = settings.iterator();
Object[] options = new Object[settings.size()];
for (int i = 0; i < options.length; i++) {
options[i] = elements.next();
}
int n = JOptionPane.showOptionDialog(frame, setting.getQuestion(), setting.getName(),
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, setting.getSetting());
answer = (String) options[n];
} else if (setting instanceof StringIOSetting) {
answer = JOptionPane.showInputDialog(frame, setting.getQuestion(), setting.getName(),
JOptionPane.QUESTION_MESSAGE, null, null, setting.getSetting()).toString();
} else {
answer = JOptionPane.showInputDialog(frame, setting.getQuestion(), setting.getName(),
JOptionPane.QUESTION_MESSAGE, null, null, setting.getSetting()).toString();
}
try {
setting.setSetting(answer);
} catch (CDKException exception) {
}
} // else skip question
} } | public class class_name {
@Override
public void processIOSettingQuestion(IOSetting setting) {
// post the question
if (setting.getLevel().ordinal() <= this.level.ordinal()) {
String answer = setting.getSetting();
if (setting instanceof BooleanIOSetting) {
int n = JOptionPane.showConfirmDialog(frame, setting.getQuestion(), setting.getName(),
JOptionPane.YES_NO_OPTION);
if (n == JOptionPane.YES_OPTION) {
answer = "true"; // depends on control dependency: [if], data = [none]
} else if (n == JOptionPane.NO_OPTION) {
answer = "false"; // depends on control dependency: [if], data = [none]
} else {
// default of setting
}
} else if (setting instanceof OptionIOSetting) {
OptionIOSetting optionSetting = (OptionIOSetting) setting;
List<String> settings = optionSetting.getOptions();
Iterator<String> elements = settings.iterator();
Object[] options = new Object[settings.size()];
for (int i = 0; i < options.length; i++) {
options[i] = elements.next(); // depends on control dependency: [for], data = [i]
}
int n = JOptionPane.showOptionDialog(frame, setting.getQuestion(), setting.getName(),
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, setting.getSetting());
answer = (String) options[n]; // depends on control dependency: [if], data = [none]
} else if (setting instanceof StringIOSetting) {
answer = JOptionPane.showInputDialog(frame, setting.getQuestion(), setting.getName(),
JOptionPane.QUESTION_MESSAGE, null, null, setting.getSetting()).toString(); // depends on control dependency: [if], data = [none]
} else {
answer = JOptionPane.showInputDialog(frame, setting.getQuestion(), setting.getName(),
JOptionPane.QUESTION_MESSAGE, null, null, setting.getSetting()).toString(); // depends on control dependency: [if], data = [none]
}
try {
setting.setSetting(answer); // depends on control dependency: [try], data = [none]
} catch (CDKException exception) {
} // depends on control dependency: [catch], data = [none]
} // else skip question
} } |
public class class_name {
public void reconstitute(
MessageProcessor processor,
HashMap durableSubscriptionsTable,
int startMode) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reconstitute",
new Object[] { processor, durableSubscriptionsTable, Integer.valueOf(startMode) });
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Reconstituting MQLink " + getName());
try
{
super.reconstitute(processor, durableSubscriptionsTable, startMode);
// Check Removed.
// if(!isToBeDeleted())
// {
// There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.
if (_mqLinkStateItemStreamId != 0)
{
_mqLinkStateItemStream
= (ItemStream) findById(_mqLinkStateItemStreamId);
// A MQLinkHandler must have a MQLinkStateItemStream as long as the destination
// is not in delete state. The ME may have restarted and the item stream already
// deleted
if (_mqLinkStateItemStream == null && !isToBeDeleted())
{
SIResourceException e =
new SIResourceException(
nls.getFormattedMessage(
"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049",
new Object[] { getName() },
null));
SibTr.error(tc, "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049", new Object[] { getName() });
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:270:1.71",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw e;
}
}
// There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.
NonLockingCursor cursor = newNonLockingItemStreamCursor(
new ClassEqualsFilter(MQLinkPubSubBridgeItemStream.class));
_mqLinkPubSubBridgeItemStream = (MQLinkPubSubBridgeItemStream)cursor.next();
// A MQLinkLocalizationItemStream should not be in the DestinationManager
// without a MQLinkStateItemStream as long as the destination
// is not in delete state. The ME may have restarted and the item stream already
// deleted
if (_mqLinkPubSubBridgeItemStream == null && !isToBeDeleted())
{
SIResourceException e =
new SIResourceException(
nls.getFormattedMessage(
"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049",
new Object[] { getName() },
null));
SibTr.error(tc, "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049", new Object[] { getName() });
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:303:1.71",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw e;
}
cursor.finished();
/* }
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "MQLink marked to be deleted, bypass state stream integrity checks");
}*/
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:325:1.71",
this);
SibTr.exception(tc, e);
// At the moment, any exception we get while reconstituting means that we
// want to mark the destination as corrupt.
_isCorruptOrIndoubt = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw new SIResourceException(e);
}
/*
* We should have completed all restart message store operations for this
* link by this point.
*/
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute");
} } | public class class_name {
public void reconstitute(
MessageProcessor processor,
HashMap durableSubscriptionsTable,
int startMode) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reconstitute",
new Object[] { processor, durableSubscriptionsTable, Integer.valueOf(startMode) });
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Reconstituting MQLink " + getName());
try
{
super.reconstitute(processor, durableSubscriptionsTable, startMode); // depends on control dependency: [try], data = [none]
// Check Removed.
// if(!isToBeDeleted())
// {
// There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.
if (_mqLinkStateItemStreamId != 0)
{
_mqLinkStateItemStream
= (ItemStream) findById(_mqLinkStateItemStreamId); // depends on control dependency: [if], data = [none]
// A MQLinkHandler must have a MQLinkStateItemStream as long as the destination
// is not in delete state. The ME may have restarted and the item stream already
// deleted
if (_mqLinkStateItemStream == null && !isToBeDeleted())
{
SIResourceException e =
new SIResourceException(
nls.getFormattedMessage(
"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049",
new Object[] { getName() },
null));
SibTr.error(tc, "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049", new Object[] { getName() }); // depends on control dependency: [if], data = [none]
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:270:1.71",
this); // depends on control dependency: [if], data = [none]
SibTr.exception(tc, e); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw e;
}
}
// There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.
NonLockingCursor cursor = newNonLockingItemStreamCursor(
new ClassEqualsFilter(MQLinkPubSubBridgeItemStream.class));
_mqLinkPubSubBridgeItemStream = (MQLinkPubSubBridgeItemStream)cursor.next(); // depends on control dependency: [try], data = [none]
// A MQLinkLocalizationItemStream should not be in the DestinationManager
// without a MQLinkStateItemStream as long as the destination
// is not in delete state. The ME may have restarted and the item stream already
// deleted
if (_mqLinkPubSubBridgeItemStream == null && !isToBeDeleted())
{
SIResourceException e =
new SIResourceException(
nls.getFormattedMessage(
"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049",
new Object[] { getName() },
null));
SibTr.error(tc, "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049", new Object[] { getName() }); // depends on control dependency: [if], data = [none]
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:303:1.71",
this); // depends on control dependency: [if], data = [none]
SibTr.exception(tc, e); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw e;
}
cursor.finished(); // depends on control dependency: [try], data = [none]
/* }
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "MQLink marked to be deleted, bypass state stream integrity checks");
}*/
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:325:1.71",
this);
SibTr.exception(tc, e);
// At the moment, any exception we get while reconstituting means that we
// want to mark the destination as corrupt.
_isCorruptOrIndoubt = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw new SIResourceException(e);
} // depends on control dependency: [catch], data = [none]
/*
* We should have completed all restart message store operations for this
* link by this point.
*/
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute");
} } |
public class class_name {
public IRObject getReference() {
if (ref == null) {
ref = org.omg.CORBA.ValueDefHelper.narrow(
servantToReference(new ValueDefPOATie(this)));
}
return ref;
} } | public class class_name {
public IRObject getReference() {
if (ref == null) {
ref = org.omg.CORBA.ValueDefHelper.narrow(
servantToReference(new ValueDefPOATie(this))); // depends on control dependency: [if], data = [none]
}
return ref;
} } |
public class class_name {
public Future<?> asynchronouslyDetermineLocalReplicas() {
return VoltDB.instance().getSES(false).submit(new Runnable() {
@Override
public void run() {
/*
* Assemble a map of all local replicas that will be used to determine
* if single part reads can be delivered and executed at local replicas
*/
final int thisHostId = CoreUtils.getHostIdFromHSId(m_mailbox.getHSId());
ImmutableMap.Builder<Integer, Long> localReplicas = ImmutableMap.builder();
for (int partition : m_cartographer.getPartitions()) {
for (Long replica : m_cartographer.getReplicasForPartition(partition)) {
if (CoreUtils.getHostIdFromHSId(replica) == thisHostId) {
localReplicas.put(partition, replica);
}
}
}
m_localReplicas.set(localReplicas.build());
}
});
} } | public class class_name {
public Future<?> asynchronouslyDetermineLocalReplicas() {
return VoltDB.instance().getSES(false).submit(new Runnable() {
@Override
public void run() {
/*
* Assemble a map of all local replicas that will be used to determine
* if single part reads can be delivered and executed at local replicas
*/
final int thisHostId = CoreUtils.getHostIdFromHSId(m_mailbox.getHSId());
ImmutableMap.Builder<Integer, Long> localReplicas = ImmutableMap.builder();
for (int partition : m_cartographer.getPartitions()) {
for (Long replica : m_cartographer.getReplicasForPartition(partition)) {
if (CoreUtils.getHostIdFromHSId(replica) == thisHostId) {
localReplicas.put(partition, replica); // depends on control dependency: [if], data = [none]
}
}
}
m_localReplicas.set(localReplicas.build());
}
});
} } |
public class class_name {
public void marshall(GetCertificateAuthorityCertificateRequest getCertificateAuthorityCertificateRequest, ProtocolMarshaller protocolMarshaller) {
if (getCertificateAuthorityCertificateRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getCertificateAuthorityCertificateRequest.getCertificateAuthorityArn(), CERTIFICATEAUTHORITYARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetCertificateAuthorityCertificateRequest getCertificateAuthorityCertificateRequest, ProtocolMarshaller protocolMarshaller) {
if (getCertificateAuthorityCertificateRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getCertificateAuthorityCertificateRequest.getCertificateAuthorityArn(), CERTIFICATEAUTHORITYARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(StartPipelineExecutionRequest startPipelineExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (startPipelineExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startPipelineExecutionRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(startPipelineExecutionRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StartPipelineExecutionRequest startPipelineExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (startPipelineExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startPipelineExecutionRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startPipelineExecutionRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_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 getFieldName(int i) {
if (i >= nfields || i < 0) {
return null;
}
return (FieldDesc[i].Name);
} } | public class class_name {
public String getFieldName(int i) {
if (i >= nfields || i < 0) {
return null;
// depends on control dependency: [if], data = [none]
}
return (FieldDesc[i].Name);
} } |
public class class_name {
@Override
public int getCurrentBytes(final boolean compact) {
if (!compact) {
final byte lgArrLongs = mem_.getByte(LG_ARR_LONGS_BYTE);
final int preambleLongs = mem_.getByte(PREAMBLE_LONGS_BYTE) & 0X3F;
final int lengthBytes = (preambleLongs + (1 << lgArrLongs)) << 3;
return lengthBytes;
}
final int preLongs = getCurrentPreambleLongs(true);
final int curCount = getRetainedEntries(true);
return (preLongs + curCount) << 3;
} } | public class class_name {
@Override
public int getCurrentBytes(final boolean compact) {
if (!compact) {
final byte lgArrLongs = mem_.getByte(LG_ARR_LONGS_BYTE);
final int preambleLongs = mem_.getByte(PREAMBLE_LONGS_BYTE) & 0X3F;
final int lengthBytes = (preambleLongs + (1 << lgArrLongs)) << 3;
return lengthBytes; // depends on control dependency: [if], data = [none]
}
final int preLongs = getCurrentPreambleLongs(true);
final int curCount = getRetainedEntries(true);
return (preLongs + curCount) << 3;
} } |
public class class_name {
public void marshall(Patch patch, ProtocolMarshaller protocolMarshaller) {
if (patch == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(patch.getId(), ID_BINDING);
protocolMarshaller.marshall(patch.getReleaseDate(), RELEASEDATE_BINDING);
protocolMarshaller.marshall(patch.getTitle(), TITLE_BINDING);
protocolMarshaller.marshall(patch.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(patch.getContentUrl(), CONTENTURL_BINDING);
protocolMarshaller.marshall(patch.getVendor(), VENDOR_BINDING);
protocolMarshaller.marshall(patch.getProductFamily(), PRODUCTFAMILY_BINDING);
protocolMarshaller.marshall(patch.getProduct(), PRODUCT_BINDING);
protocolMarshaller.marshall(patch.getClassification(), CLASSIFICATION_BINDING);
protocolMarshaller.marshall(patch.getMsrcSeverity(), MSRCSEVERITY_BINDING);
protocolMarshaller.marshall(patch.getKbNumber(), KBNUMBER_BINDING);
protocolMarshaller.marshall(patch.getMsrcNumber(), MSRCNUMBER_BINDING);
protocolMarshaller.marshall(patch.getLanguage(), LANGUAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Patch patch, ProtocolMarshaller protocolMarshaller) {
if (patch == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(patch.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getReleaseDate(), RELEASEDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getTitle(), TITLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getContentUrl(), CONTENTURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getVendor(), VENDOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getProductFamily(), PRODUCTFAMILY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getProduct(), PRODUCT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getClassification(), CLASSIFICATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getMsrcSeverity(), MSRCSEVERITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getKbNumber(), KBNUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getMsrcNumber(), MSRCNUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patch.getLanguage(), LANGUAGE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Logger internalGetLogger(String name) {
assert name != null : "Name was null";
Logger rv = instances.get(name);
if (rv == null) {
Logger newLogger = null;
try {
newLogger = getNewInstance(name);
} catch (Exception e) {
throw new RuntimeException("Problem getting logger", e);
}
Logger tmp = instances.putIfAbsent(name, newLogger);
// Return either the new logger we've just made, or one that was
// created while we were waiting
rv = tmp == null ? newLogger : tmp;
}
return (rv);
} } | public class class_name {
private Logger internalGetLogger(String name) {
assert name != null : "Name was null";
Logger rv = instances.get(name);
if (rv == null) {
Logger newLogger = null;
try {
newLogger = getNewInstance(name); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Problem getting logger", e);
} // depends on control dependency: [catch], data = [none]
Logger tmp = instances.putIfAbsent(name, newLogger);
// Return either the new logger we've just made, or one that was
// created while we were waiting
rv = tmp == null ? newLogger : tmp; // depends on control dependency: [if], data = [none]
}
return (rv);
} } |
public class class_name {
@Override
protected boolean initiateClient()
{
try
{
SchemeSocketFactory ssf = null;
ssf = PlainSocketFactory.getSocketFactory();
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http", Integer.parseInt(port), ssf));
PoolingClientConnectionManager ccm = new PoolingClientConnectionManager(schemeRegistry);
httpClient = new DefaultHttpClient(ccm);
httpHost = new HttpHost(hosts[0], Integer.parseInt(port), "http");
// Http params
httpClient.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, "UTF-8");
// basic authentication
if (userName != null && password != null)
{
((AbstractHttpClient) httpClient).getCredentialsProvider().setCredentials(
new AuthScope(hosts[0], Integer.parseInt(port)),
new UsernamePasswordCredentials(userName, password));
}
// request interceptor
((DefaultHttpClient) httpClient).addRequestInterceptor(new HttpRequestInterceptor()
{
public void process(final HttpRequest request, final HttpContext context) throws IOException
{
if (logger.isInfoEnabled())
{
RequestLine requestLine = request.getRequestLine();
logger.info(">> " + requestLine.getMethod() + " " + URI.create(requestLine.getUri()).getPath());
}
}
});
// response interceptor
((DefaultHttpClient) httpClient).addResponseInterceptor(new HttpResponseInterceptor()
{
public void process(final HttpResponse response, final HttpContext context) throws IOException
{
if (logger.isInfoEnabled())
logger.info("<< Status: " + response.getStatusLine().getStatusCode());
}
});
}
catch (Exception e)
{
logger.error("Error Creating HTTP client {}. ", e);
throw new IllegalStateException(e);
}
return true;
} } | public class class_name {
@Override
protected boolean initiateClient()
{
try
{
SchemeSocketFactory ssf = null;
ssf = PlainSocketFactory.getSocketFactory(); // depends on control dependency: [try], data = [none]
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http", Integer.parseInt(port), ssf)); // depends on control dependency: [try], data = [none]
PoolingClientConnectionManager ccm = new PoolingClientConnectionManager(schemeRegistry);
httpClient = new DefaultHttpClient(ccm); // depends on control dependency: [try], data = [none]
httpHost = new HttpHost(hosts[0], Integer.parseInt(port), "http"); // depends on control dependency: [try], data = [none]
// Http params
httpClient.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, "UTF-8"); // depends on control dependency: [try], data = [none]
// basic authentication
if (userName != null && password != null)
{
((AbstractHttpClient) httpClient).getCredentialsProvider().setCredentials(
new AuthScope(hosts[0], Integer.parseInt(port)),
new UsernamePasswordCredentials(userName, password)); // depends on control dependency: [if], data = [none]
}
// request interceptor
((DefaultHttpClient) httpClient).addRequestInterceptor(new HttpRequestInterceptor()
{
public void process(final HttpRequest request, final HttpContext context) throws IOException
{
if (logger.isInfoEnabled())
{
RequestLine requestLine = request.getRequestLine();
logger.info(">> " + requestLine.getMethod() + " " + URI.create(requestLine.getUri()).getPath());
}
}
}); // depends on control dependency: [try], data = [none]
// response interceptor
((DefaultHttpClient) httpClient).addResponseInterceptor(new HttpResponseInterceptor()
{
public void process(final HttpResponse response, final HttpContext context) throws IOException
{
if (logger.isInfoEnabled())
logger.info("<< Status: " + response.getStatusLine().getStatusCode());
}
}); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
logger.error("Error Creating HTTP client {}. ", e);
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
public void update(final Sketch<S> sketchIn) {
if (sketchIn == null || sketchIn.isEmpty()) { return; }
if (sketchIn.theta_ < theta_) { theta_ = sketchIn.theta_; }
final SketchIterator<S> it = sketchIn.iterator();
while (it.next()) {
sketch_.merge(it.getKey(), it.getSummary(), summarySetOps_);
}
} } | public class class_name {
public void update(final Sketch<S> sketchIn) {
if (sketchIn == null || sketchIn.isEmpty()) { return; } // depends on control dependency: [if], data = [none]
if (sketchIn.theta_ < theta_) { theta_ = sketchIn.theta_; } // depends on control dependency: [if], data = [none]
final SketchIterator<S> it = sketchIn.iterator();
while (it.next()) {
sketch_.merge(it.getKey(), it.getSummary(), summarySetOps_); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public void stop()
{
if (!mIsRunning || (mAnimations.size() == 0))
{
return;
}
GVRAnimation anim = mAnimations.get(0);
mIsRunning = false;
anim.setOnFinish(null);
for (int i = 0; i < mAnimations.size(); ++i)
{
anim = mAnimations.get(i);
getGVRContext().getAnimationEngine().stop(anim);
}
} } | public class class_name {
public void stop()
{
if (!mIsRunning || (mAnimations.size() == 0))
{
return; // depends on control dependency: [if], data = [none]
}
GVRAnimation anim = mAnimations.get(0);
mIsRunning = false;
anim.setOnFinish(null);
for (int i = 0; i < mAnimations.size(); ++i)
{
anim = mAnimations.get(i); // depends on control dependency: [for], data = [i]
getGVRContext().getAnimationEngine().stop(anim); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static void doLogicalDetachFromHtmlPanel(Widget w) {
Widget parent = w.getParent();
if (parent instanceof HTMLPanel) {
complexPanelGetChildren((HTMLPanel) parent).remove(w);
widgetSetParent(w, null);
} else {
throw new IllegalStateException(
"You can only use this method to detach a child from an HTMLPanel");
}
} } | public class class_name {
public static void doLogicalDetachFromHtmlPanel(Widget w) {
Widget parent = w.getParent();
if (parent instanceof HTMLPanel) {
complexPanelGetChildren((HTMLPanel) parent).remove(w); // depends on control dependency: [if], data = [none]
widgetSetParent(w, null); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException(
"You can only use this method to detach a child from an HTMLPanel");
}
} } |
public class class_name {
public Object getContent() throws IOException, UnsupportedEncodingException {
ContentTypeHeader contentTypeHeader = (ContentTypeHeader)
this.message.getHeader(ContentTypeHeader.NAME);
if(contentTypeHeader != null && logger.isDebugEnabled()) {
logger.debug("Content type " + contentTypeHeader.getContentType());
logger.debug("Content sub type " + contentTypeHeader.getContentSubType());
}
if(contentTypeHeader!= null && CONTENT_TYPE_TEXT.equals(contentTypeHeader.getContentType())) {
String content = null;
if(message.getRawContent() != null) {
String charset = this.getCharacterEncoding();
if(charset == null) {
content = new String(message.getRawContent());
} else {
content = new String(message.getRawContent(), charset);
}
} else {
content = "";
}
return content;
} else if(contentTypeHeader!= null && CONTENT_TYPE_MULTIPART.equals(contentTypeHeader.getContentType())) {
try {
return new MimeMultipart(new ByteArrayDataSource(message.getRawContent(),
contentTypeHeader.toString().replaceAll(ContentTypeHeader.NAME+": ", "")));
} catch (MessagingException e) {
logger.warn("Problem with multipart message.", e);
return this.message.getRawContent();
}
} else {
return this.message.getRawContent();
}
} } | public class class_name {
public Object getContent() throws IOException, UnsupportedEncodingException {
ContentTypeHeader contentTypeHeader = (ContentTypeHeader)
this.message.getHeader(ContentTypeHeader.NAME);
if(contentTypeHeader != null && logger.isDebugEnabled()) {
logger.debug("Content type " + contentTypeHeader.getContentType());
logger.debug("Content sub type " + contentTypeHeader.getContentSubType());
}
if(contentTypeHeader!= null && CONTENT_TYPE_TEXT.equals(contentTypeHeader.getContentType())) {
String content = null;
if(message.getRawContent() != null) {
String charset = this.getCharacterEncoding();
if(charset == null) {
content = new String(message.getRawContent()); // depends on control dependency: [if], data = [none]
} else {
content = new String(message.getRawContent(), charset); // depends on control dependency: [if], data = [none]
}
} else {
content = ""; // depends on control dependency: [if], data = [none]
}
return content;
} else if(contentTypeHeader!= null && CONTENT_TYPE_MULTIPART.equals(contentTypeHeader.getContentType())) {
try {
return new MimeMultipart(new ByteArrayDataSource(message.getRawContent(),
contentTypeHeader.toString().replaceAll(ContentTypeHeader.NAME+": ", ""))); // depends on control dependency: [try], data = [none]
} catch (MessagingException e) {
logger.warn("Problem with multipart message.", e);
return this.message.getRawContent();
} // depends on control dependency: [catch], data = [none]
} else {
return this.message.getRawContent();
}
} } |
public class class_name {
@Override
protected void doStart() {
log.info("{}: Starting.", this.traceObjectId);
this.delayedStartRetry
.runAsync(() -> tryStartOnce()
.whenComplete((v, ex) -> {
if (ex == null) {
// We are done.
notifyDelayedStartComplete(null);
} else {
if (Exceptions.unwrap(ex) instanceof DataLogDisabledException) {
// Place the DurableLog in a Started State, but keep trying to restart.
notifyStartComplete(null);
}
throw new CompletionException(ex);
}
}), this.executor)
.exceptionally(this::notifyDelayedStartComplete);
} } | public class class_name {
@Override
protected void doStart() {
log.info("{}: Starting.", this.traceObjectId);
this.delayedStartRetry
.runAsync(() -> tryStartOnce()
.whenComplete((v, ex) -> {
if (ex == null) {
// We are done.
notifyDelayedStartComplete(null);
} else {
if (Exceptions.unwrap(ex) instanceof DataLogDisabledException) {
// Place the DurableLog in a Started State, but keep trying to restart.
notifyStartComplete(null); // depends on control dependency: [if], data = [none]
}
throw new CompletionException(ex);
}
}), this.executor)
.exceptionally(this::notifyDelayedStartComplete);
} } |
public class class_name {
public boolean recordNgInject(boolean ngInject) {
if (!isNgInjectRecorded()) {
currentInfo.setNgInject(ngInject);
populated = true;
return true;
} else {
return false;
}
} } | public class class_name {
public boolean recordNgInject(boolean ngInject) {
if (!isNgInjectRecorded()) {
currentInfo.setNgInject(ngInject); // depends on control dependency: [if], data = [none]
populated = true; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
protected void implementInterface(InterfaceCapableSource<?> source, Iterable<String> value, JavaSourceFacet facet)
{
for (String type : value)
{
source.addInterface(type);
}
} } | public class class_name {
@Override
protected void implementInterface(InterfaceCapableSource<?> source, Iterable<String> value, JavaSourceFacet facet)
{
for (String type : value)
{
source.addInterface(type); // depends on control dependency: [for], data = [type]
}
} } |
public class class_name {
@Override
public void add(Difference difference) {
if(ignorePaths == null) {
list.add(difference);
} else {
String pathA = trimNonXmlElements(difference.getPathA());
String pathB = trimNonXmlElements(difference.getPathB());
if (ignorePaths.contains(pathA) || ignorePaths.contains(pathB)) {
// ignorable matched
if(ignorePaths.contains(pathA) && ignorePaths.contains(pathB)) {
// both sides contains an ignorable difference
return;
} else if(pathA.length() > 0 && ignorePaths.contains(pathB)) {
// B contains ignorable
difference = new Difference(difference.getPathA(), null, "Only in: " + getNameA());
list.add(difference);
} else if(ignorePaths.contains(pathA) && pathB.length() > 0) {
// A contains ignorable
difference = new Difference(null, difference.getPathB(), "Only in: " + getNameB());
list.add(difference);
}
} else {
// no ignorable matched
list.add(difference);
}
}
} } | public class class_name {
@Override
public void add(Difference difference) {
if(ignorePaths == null) {
list.add(difference); // depends on control dependency: [if], data = [none]
} else {
String pathA = trimNonXmlElements(difference.getPathA());
String pathB = trimNonXmlElements(difference.getPathB());
if (ignorePaths.contains(pathA) || ignorePaths.contains(pathB)) {
// ignorable matched
if(ignorePaths.contains(pathA) && ignorePaths.contains(pathB)) {
// both sides contains an ignorable difference
return; // depends on control dependency: [if], data = [none]
} else if(pathA.length() > 0 && ignorePaths.contains(pathB)) {
// B contains ignorable
difference = new Difference(difference.getPathA(), null, "Only in: " + getNameA()); // depends on control dependency: [if], data = [none]
list.add(difference); // depends on control dependency: [if], data = [none]
} else if(ignorePaths.contains(pathA) && pathB.length() > 0) {
// A contains ignorable
difference = new Difference(null, difference.getPathB(), "Only in: " + getNameB()); // depends on control dependency: [if], data = [none]
list.add(difference); // depends on control dependency: [if], data = [none]
}
} else {
// no ignorable matched
list.add(difference); // depends on control dependency: [if], data = [none]
}
}
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.