code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
@RequestCache
public boolean canPrincipalSubscribe(
IAuthorizationPrincipal principal, String portletDefinitionId) {
String owner = IPermission.PORTAL_SUBSCRIBE;
// retrieve the indicated channel from the channel registry store and
// determine its current lifecycle state
IPortletDefinition portlet =
this.portletDefinitionRegistry.getPortletDefinition(portletDefinitionId);
if (portlet == null) {
return false;
}
String target = PermissionHelper.permissionTargetIdForPortletDefinition(portlet);
PortletLifecycleState state = portlet.getLifecycleState();
/*
* Each channel lifecycle state now has its own subscribe permission. The
* following logic checks the appropriate permission for the lifecycle.
*/
String permission;
if (state.equals(PortletLifecycleState.PUBLISHED)
|| state.equals(PortletLifecycleState.MAINTENANCE)) {
// NB: There is no separate SUBSCRIBE permission for MAINTENANCE
// mode; everyone simply sees the 'out of service' message
permission = IPermission.PORTLET_SUBSCRIBER_ACTIVITY;
} else if (state.equals(PortletLifecycleState.APPROVED)) {
permission = IPermission.PORTLET_SUBSCRIBER_APPROVED_ACTIVITY;
} else if (state.equals(PortletLifecycleState.CREATED)) {
permission = IPermission.PORTLET_SUBSCRIBER_CREATED_ACTIVITY;
} else if (state.equals(PortletLifecycleState.EXPIRED)) {
permission = IPermission.PORTLET_SUBSCRIBER_EXPIRED_ACTIVITY;
} else {
throw new AuthorizationException(
"Unrecognized lifecycle state for channel " + portletDefinitionId);
}
// Test the appropriate permission.
return doesPrincipalHavePermission(principal, owner, permission, target);
} } | public class class_name {
@Override
@RequestCache
public boolean canPrincipalSubscribe(
IAuthorizationPrincipal principal, String portletDefinitionId) {
String owner = IPermission.PORTAL_SUBSCRIBE;
// retrieve the indicated channel from the channel registry store and
// determine its current lifecycle state
IPortletDefinition portlet =
this.portletDefinitionRegistry.getPortletDefinition(portletDefinitionId);
if (portlet == null) {
return false; // depends on control dependency: [if], data = [none]
}
String target = PermissionHelper.permissionTargetIdForPortletDefinition(portlet);
PortletLifecycleState state = portlet.getLifecycleState();
/*
* Each channel lifecycle state now has its own subscribe permission. The
* following logic checks the appropriate permission for the lifecycle.
*/
String permission;
if (state.equals(PortletLifecycleState.PUBLISHED)
|| state.equals(PortletLifecycleState.MAINTENANCE)) {
// NB: There is no separate SUBSCRIBE permission for MAINTENANCE
// mode; everyone simply sees the 'out of service' message
permission = IPermission.PORTLET_SUBSCRIBER_ACTIVITY; // depends on control dependency: [if], data = [none]
} else if (state.equals(PortletLifecycleState.APPROVED)) {
permission = IPermission.PORTLET_SUBSCRIBER_APPROVED_ACTIVITY; // depends on control dependency: [if], data = [none]
} else if (state.equals(PortletLifecycleState.CREATED)) {
permission = IPermission.PORTLET_SUBSCRIBER_CREATED_ACTIVITY; // depends on control dependency: [if], data = [none]
} else if (state.equals(PortletLifecycleState.EXPIRED)) {
permission = IPermission.PORTLET_SUBSCRIBER_EXPIRED_ACTIVITY; // depends on control dependency: [if], data = [none]
} else {
throw new AuthorizationException(
"Unrecognized lifecycle state for channel " + portletDefinitionId);
}
// Test the appropriate permission.
return doesPrincipalHavePermission(principal, owner, permission, target);
} } |
public class class_name {
public EClass getIfcDynamicViscosityMeasure() {
if (ifcDynamicViscosityMeasureEClass == null) {
ifcDynamicViscosityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(668);
}
return ifcDynamicViscosityMeasureEClass;
} } | public class class_name {
public EClass getIfcDynamicViscosityMeasure() {
if (ifcDynamicViscosityMeasureEClass == null) {
ifcDynamicViscosityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(668);
// depends on control dependency: [if], data = [none]
}
return ifcDynamicViscosityMeasureEClass;
} } |
public class class_name {
private static GVRWorld getWorldFromAscendant(GVRSceneObject worldOwner) {
GVRComponent world = null;
while (worldOwner != null && world == null) {
world = worldOwner.getComponent(GVRWorld.getComponentType());
worldOwner = worldOwner.getParent();
}
return (GVRWorld) world;
} } | public class class_name {
private static GVRWorld getWorldFromAscendant(GVRSceneObject worldOwner) {
GVRComponent world = null;
while (worldOwner != null && world == null) {
world = worldOwner.getComponent(GVRWorld.getComponentType()); // depends on control dependency: [while], data = [none]
worldOwner = worldOwner.getParent(); // depends on control dependency: [while], data = [none]
}
return (GVRWorld) world;
} } |
public class class_name {
public static XMLBuilder2 parse(File xmlFile, boolean enableExternalEntities,
boolean isNamespaceAware)
{
try {
return XMLBuilder2.parse(
new InputSource(new FileReader(xmlFile)),
enableExternalEntities,
isNamespaceAware);
} catch (FileNotFoundException e) {
throw wrapExceptionAsRuntimeException(e);
}
} } | public class class_name {
public static XMLBuilder2 parse(File xmlFile, boolean enableExternalEntities,
boolean isNamespaceAware)
{
try {
return XMLBuilder2.parse(
new InputSource(new FileReader(xmlFile)),
enableExternalEntities,
isNamespaceAware); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
throw wrapExceptionAsRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public ContainerDetail withNetworkInterfaces(NetworkInterface... networkInterfaces) {
if (this.networkInterfaces == null) {
setNetworkInterfaces(new java.util.ArrayList<NetworkInterface>(networkInterfaces.length));
}
for (NetworkInterface ele : networkInterfaces) {
this.networkInterfaces.add(ele);
}
return this;
} } | public class class_name {
public ContainerDetail withNetworkInterfaces(NetworkInterface... networkInterfaces) {
if (this.networkInterfaces == null) {
setNetworkInterfaces(new java.util.ArrayList<NetworkInterface>(networkInterfaces.length)); // depends on control dependency: [if], data = [none]
}
for (NetworkInterface ele : networkInterfaces) {
this.networkInterfaces.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
void scanIdentifier() {
if (!eof) {
StringBuilder identBuf = new StringBuilder(32);
if (!isStopSymbol(symbol)) {
identBuf.append(symbol);
do {
char ch = buffer[pos];
if ((ch >= 'a') && (ch <= 'z') || (ch >= 'A') && (ch <= 'Z')
|| !isStopSymbol(ch)) {
identBuf.append(ch);
pos++;
} else {
identifier = identBuf.toString();
scanSymbol();
return;
}
} while (pos != buffer.length);
identifier = identBuf.toString();
symbol = 0;
eof = true;
} else {
// Ident starts with incorrect char.
symbol = 0;
eof = true;
throw new GenericSignatureFormatError();
}
} else {
throw new GenericSignatureFormatError();
}
} } | public class class_name {
void scanIdentifier() {
if (!eof) {
StringBuilder identBuf = new StringBuilder(32);
if (!isStopSymbol(symbol)) {
identBuf.append(symbol); // depends on control dependency: [if], data = [none]
do {
char ch = buffer[pos];
if ((ch >= 'a') && (ch <= 'z') || (ch >= 'A') && (ch <= 'Z')
|| !isStopSymbol(ch)) {
identBuf.append(ch); // depends on control dependency: [if], data = [none]
pos++; // depends on control dependency: [if], data = [none]
} else {
identifier = identBuf.toString(); // depends on control dependency: [if], data = [none]
scanSymbol(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
} while (pos != buffer.length);
identifier = identBuf.toString(); // depends on control dependency: [if], data = [none]
symbol = 0; // depends on control dependency: [if], data = [none]
eof = true; // depends on control dependency: [if], data = [none]
} else {
// Ident starts with incorrect char.
symbol = 0; // depends on control dependency: [if], data = [none]
eof = true; // depends on control dependency: [if], data = [none]
throw new GenericSignatureFormatError();
}
} else {
throw new GenericSignatureFormatError();
}
} } |
public class class_name {
public static Status formattedString(String value) {
boolean result = true;
try {
Cpe23PartIterator instance;
try {
instance = new Cpe23PartIterator(value);
} catch (CpeParsingException ex) {
LOG.warn("The CPE (" + value + ") is invalid as it is not in the formatted string format");
return Status.INVALID;
}
try {
//part
Part.getEnum(instance.next());
} catch (CpeParsingException ex) {
LOG.warn("The CPE (" + value + ") is invalid as it has an invalid part attribute");
return Status.INVALID_PART;
}
Status status;
//vendor
status = Validate.component(instance.next());
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid vendor - " + status.getMessage());
return status;
}
//product
status = Validate.component(instance.next());
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid product - " + status.getMessage());
return status;
}
//version
status = Validate.component(instance.next());
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an version version - " + status.getMessage());
return status;
}
//update
status = Validate.component(instance.next());
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid update - " + status.getMessage());
return status;
}
//edition
status = Validate.component(instance.next());
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid edition - " + status.getMessage());
return status;
}
//language
status = Validate.component(instance.next());
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid language - " + status.getMessage());
return status;
}
//swEdition
status = Validate.component(instance.next());
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid swEdition - " + status.getMessage());
return status;
}
//targetSw
status = Validate.component(instance.next());
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid targetSw - " + status.getMessage());
return status;
}
//targetHw
status = Validate.component(instance.next());
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid targetHw - " + status.getMessage());
return status;
}
//other
status = Validate.component(instance.next());
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid other attribute - " + status.getMessage());
return status;
}
if (instance.hasNext()) {
LOG.warn(Status.TOO_MANY_ELEMENTS.getMessage());
return Status.TOO_MANY_ELEMENTS;
}
} catch (NoSuchElementException ex) {
LOG.warn(Status.TOO_FEW_ELEMENTS.getMessage());
return Status.TOO_FEW_ELEMENTS;
}
return Status.VALID;
} } | public class class_name {
public static Status formattedString(String value) {
boolean result = true;
try {
Cpe23PartIterator instance;
try {
instance = new Cpe23PartIterator(value); // depends on control dependency: [try], data = [none]
} catch (CpeParsingException ex) {
LOG.warn("The CPE (" + value + ") is invalid as it is not in the formatted string format");
return Status.INVALID;
} // depends on control dependency: [catch], data = [none]
try {
//part
Part.getEnum(instance.next()); // depends on control dependency: [try], data = [none]
} catch (CpeParsingException ex) {
LOG.warn("The CPE (" + value + ") is invalid as it has an invalid part attribute");
return Status.INVALID_PART;
} // depends on control dependency: [catch], data = [none]
Status status;
//vendor
status = Validate.component(instance.next()); // depends on control dependency: [try], data = [none]
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid vendor - " + status.getMessage()); // depends on control dependency: [if], data = [none]
return status; // depends on control dependency: [if], data = [none]
}
//product
status = Validate.component(instance.next()); // depends on control dependency: [try], data = [none]
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid product - " + status.getMessage()); // depends on control dependency: [if], data = [none]
return status; // depends on control dependency: [if], data = [none]
}
//version
status = Validate.component(instance.next()); // depends on control dependency: [try], data = [none]
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an version version - " + status.getMessage()); // depends on control dependency: [if], data = [none]
return status; // depends on control dependency: [if], data = [none]
}
//update
status = Validate.component(instance.next()); // depends on control dependency: [try], data = [none]
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid update - " + status.getMessage()); // depends on control dependency: [if], data = [none]
return status; // depends on control dependency: [if], data = [none]
}
//edition
status = Validate.component(instance.next()); // depends on control dependency: [try], data = [none]
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid edition - " + status.getMessage()); // depends on control dependency: [if], data = [none]
return status; // depends on control dependency: [if], data = [none]
}
//language
status = Validate.component(instance.next()); // depends on control dependency: [try], data = [none]
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid language - " + status.getMessage()); // depends on control dependency: [if], data = [none]
return status; // depends on control dependency: [if], data = [none]
}
//swEdition
status = Validate.component(instance.next()); // depends on control dependency: [try], data = [none]
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid swEdition - " + status.getMessage()); // depends on control dependency: [if], data = [none]
return status; // depends on control dependency: [if], data = [none]
}
//targetSw
status = Validate.component(instance.next()); // depends on control dependency: [try], data = [none]
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid targetSw - " + status.getMessage()); // depends on control dependency: [if], data = [none]
return status; // depends on control dependency: [if], data = [none]
}
//targetHw
status = Validate.component(instance.next()); // depends on control dependency: [try], data = [none]
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid targetHw - " + status.getMessage()); // depends on control dependency: [if], data = [none]
return status; // depends on control dependency: [if], data = [none]
}
//other
status = Validate.component(instance.next()); // depends on control dependency: [try], data = [none]
if (!status.isValid()) {
LOG.warn("The CPE (" + value + ") has an invalid other attribute - " + status.getMessage()); // depends on control dependency: [if], data = [none]
return status; // depends on control dependency: [if], data = [none]
}
if (instance.hasNext()) {
LOG.warn(Status.TOO_MANY_ELEMENTS.getMessage()); // depends on control dependency: [if], data = [none]
return Status.TOO_MANY_ELEMENTS; // depends on control dependency: [if], data = [none]
}
} catch (NoSuchElementException ex) {
LOG.warn(Status.TOO_FEW_ELEMENTS.getMessage());
return Status.TOO_FEW_ELEMENTS;
} // depends on control dependency: [catch], data = [none]
return Status.VALID;
} } |
public class class_name {
public void stop(){
// acquire status lock
synchronized(statusLock){
// check current status
if(status == SearchStatus.INITIALIZING || status == SearchStatus.RUNNING){
// log
LOGGER.debug("Search {} changed status: {} --> {}", this, status, SearchStatus.TERMINATING);
// update status
status = SearchStatus.TERMINATING;
// fire status update
fireStatusChanged(status);
}
}
} } | public class class_name {
public void stop(){
// acquire status lock
synchronized(statusLock){
// check current status
if(status == SearchStatus.INITIALIZING || status == SearchStatus.RUNNING){
// log
LOGGER.debug("Search {} changed status: {} --> {}", this, status, SearchStatus.TERMINATING); // depends on control dependency: [if], data = [none]
// update status
status = SearchStatus.TERMINATING; // depends on control dependency: [if], data = [none]
// fire status update
fireStatusChanged(status); // depends on control dependency: [if], data = [(status]
}
}
} } |
public class class_name {
public String resolve(String key) {
if (key.equals("HTTP_USER_AGENT")) {
return request.getHeader("user-agent");
} else if (key.equals("HTTP_REFERER")) {
return request.getHeader("referer");
} else if (key.equals("HTTP_COOKIE")) {
return request.getHeader("cookie");
} else if (key.equals("HTTP_FORWARDED")) {
return request.getHeader("forwarded");
} else if (key.equals("HTTP_HOST")) {
String host = request.getHeader("host");
int index = (host != null) ? host.indexOf(':') : -1;
if (index != -1)
host = host.substring(0, index);
return host;
} else if (key.equals("HTTP_PROXY_CONNECTION")) {
return request.getHeader("proxy-connection");
} else if (key.equals("HTTP_ACCEPT")) {
return request.getHeader("accept");
} else if (key.equals("REMOTE_ADDR")) {
return request.getRemoteAddr();
} else if (key.equals("REMOTE_HOST")) {
return request.getRemoteHost();
} else if (key.equals("REMOTE_PORT")) {
return String.valueOf(request.getRemotePort());
} else if (key.equals("REMOTE_USER")) {
return request.getRemoteUser();
} else if (key.equals("REMOTE_IDENT")) {
return request.getRemoteUser();
} else if (key.equals("REQUEST_METHOD")) {
return request.getMethod();
} else if (key.equals("SCRIPT_FILENAME")) {
return request.getRealPath(request.getServletPath());
} else if (key.equals("REQUEST_PATH")) {
return servletRequestContext.getExchange().getRelativePath();
} else if (key.equals("CONTEXT_PATH")) {
return request.getContextPath();
} else if (key.equals("SERVLET_PATH")) {
return emptyStringIfNull(request.getServletPath());
} else if (key.equals("PATH_INFO")) {
return emptyStringIfNull(request.getPathInfo());
} else if (key.equals("QUERY_STRING")) {
return emptyStringIfNull(request.getQueryString());
} else if (key.equals("AUTH_TYPE")) {
return request.getAuthType();
} else if (key.equals("DOCUMENT_ROOT")) {
return request.getRealPath("/");
} else if (key.equals("SERVER_NAME")) {
return request.getLocalName();
} else if (key.equals("SERVER_ADDR")) {
return request.getLocalAddr();
} else if (key.equals("SERVER_PORT")) {
return String.valueOf(request.getLocalPort());
} else if (key.equals("SERVER_PROTOCOL")) {
return request.getProtocol();
} else if (key.equals("SERVER_SOFTWARE")) {
return "tomcat";
} else if (key.equals("THE_REQUEST")) {
return request.getMethod() + " " + request.getRequestURI()
+ " " + request.getProtocol();
} else if (key.equals("REQUEST_URI")) {
return request.getRequestURI();
} else if (key.equals("REQUEST_FILENAME")) {
return request.getPathTranslated();
} else if (key.equals("HTTPS")) {
return request.isSecure() ? "on" : "off";
} else if (key.equals("TIME_YEAR")) {
return String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
} else if (key.equals("TIME_MON")) {
return String.valueOf(Calendar.getInstance().get(Calendar.MONTH));
} else if (key.equals("TIME_DAY")) {
return String.valueOf(Calendar.getInstance().get(Calendar.DAY_OF_MONTH));
} else if (key.equals("TIME_HOUR")) {
return String.valueOf(Calendar.getInstance().get(Calendar.HOUR_OF_DAY));
} else if (key.equals("TIME_MIN")) {
return String.valueOf(Calendar.getInstance().get(Calendar.MINUTE));
} else if (key.equals("TIME_SEC")) {
return String.valueOf(Calendar.getInstance().get(Calendar.SECOND));
} else if (key.equals("TIME_WDAY")) {
return String.valueOf(Calendar.getInstance().get(Calendar.DAY_OF_WEEK));
} else if (key.equals("TIME")) {
return DateUtils.getCurrentDateTime(servletRequestContext.getExchange());
}
return null;
} } | public class class_name {
public String resolve(String key) {
if (key.equals("HTTP_USER_AGENT")) {
return request.getHeader("user-agent"); // depends on control dependency: [if], data = [none]
} else if (key.equals("HTTP_REFERER")) {
return request.getHeader("referer"); // depends on control dependency: [if], data = [none]
} else if (key.equals("HTTP_COOKIE")) {
return request.getHeader("cookie"); // depends on control dependency: [if], data = [none]
} else if (key.equals("HTTP_FORWARDED")) {
return request.getHeader("forwarded"); // depends on control dependency: [if], data = [none]
} else if (key.equals("HTTP_HOST")) {
String host = request.getHeader("host");
int index = (host != null) ? host.indexOf(':') : -1;
if (index != -1)
host = host.substring(0, index);
return host; // depends on control dependency: [if], data = [none]
} else if (key.equals("HTTP_PROXY_CONNECTION")) {
return request.getHeader("proxy-connection"); // depends on control dependency: [if], data = [none]
} else if (key.equals("HTTP_ACCEPT")) {
return request.getHeader("accept"); // depends on control dependency: [if], data = [none]
} else if (key.equals("REMOTE_ADDR")) {
return request.getRemoteAddr(); // depends on control dependency: [if], data = [none]
} else if (key.equals("REMOTE_HOST")) {
return request.getRemoteHost(); // depends on control dependency: [if], data = [none]
} else if (key.equals("REMOTE_PORT")) {
return String.valueOf(request.getRemotePort()); // depends on control dependency: [if], data = [none]
} else if (key.equals("REMOTE_USER")) {
return request.getRemoteUser(); // depends on control dependency: [if], data = [none]
} else if (key.equals("REMOTE_IDENT")) {
return request.getRemoteUser(); // depends on control dependency: [if], data = [none]
} else if (key.equals("REQUEST_METHOD")) {
return request.getMethod(); // depends on control dependency: [if], data = [none]
} else if (key.equals("SCRIPT_FILENAME")) {
return request.getRealPath(request.getServletPath()); // depends on control dependency: [if], data = [none]
} else if (key.equals("REQUEST_PATH")) {
return servletRequestContext.getExchange().getRelativePath(); // depends on control dependency: [if], data = [none]
} else if (key.equals("CONTEXT_PATH")) {
return request.getContextPath(); // depends on control dependency: [if], data = [none]
} else if (key.equals("SERVLET_PATH")) {
return emptyStringIfNull(request.getServletPath()); // depends on control dependency: [if], data = [none]
} else if (key.equals("PATH_INFO")) {
return emptyStringIfNull(request.getPathInfo()); // depends on control dependency: [if], data = [none]
} else if (key.equals("QUERY_STRING")) {
return emptyStringIfNull(request.getQueryString()); // depends on control dependency: [if], data = [none]
} else if (key.equals("AUTH_TYPE")) {
return request.getAuthType(); // depends on control dependency: [if], data = [none]
} else if (key.equals("DOCUMENT_ROOT")) {
return request.getRealPath("/"); // depends on control dependency: [if], data = [none]
} else if (key.equals("SERVER_NAME")) {
return request.getLocalName(); // depends on control dependency: [if], data = [none]
} else if (key.equals("SERVER_ADDR")) {
return request.getLocalAddr(); // depends on control dependency: [if], data = [none]
} else if (key.equals("SERVER_PORT")) {
return String.valueOf(request.getLocalPort()); // depends on control dependency: [if], data = [none]
} else if (key.equals("SERVER_PROTOCOL")) {
return request.getProtocol(); // depends on control dependency: [if], data = [none]
} else if (key.equals("SERVER_SOFTWARE")) {
return "tomcat"; // depends on control dependency: [if], data = [none]
} else if (key.equals("THE_REQUEST")) {
return request.getMethod() + " " + request.getRequestURI()
+ " " + request.getProtocol(); // depends on control dependency: [if], data = [none]
} else if (key.equals("REQUEST_URI")) {
return request.getRequestURI(); // depends on control dependency: [if], data = [none]
} else if (key.equals("REQUEST_FILENAME")) {
return request.getPathTranslated(); // depends on control dependency: [if], data = [none]
} else if (key.equals("HTTPS")) {
return request.isSecure() ? "on" : "off"; // depends on control dependency: [if], data = [none]
} else if (key.equals("TIME_YEAR")) {
return String.valueOf(Calendar.getInstance().get(Calendar.YEAR)); // depends on control dependency: [if], data = [none]
} else if (key.equals("TIME_MON")) {
return String.valueOf(Calendar.getInstance().get(Calendar.MONTH)); // depends on control dependency: [if], data = [none]
} else if (key.equals("TIME_DAY")) {
return String.valueOf(Calendar.getInstance().get(Calendar.DAY_OF_MONTH)); // depends on control dependency: [if], data = [none]
} else if (key.equals("TIME_HOUR")) {
return String.valueOf(Calendar.getInstance().get(Calendar.HOUR_OF_DAY)); // depends on control dependency: [if], data = [none]
} else if (key.equals("TIME_MIN")) {
return String.valueOf(Calendar.getInstance().get(Calendar.MINUTE)); // depends on control dependency: [if], data = [none]
} else if (key.equals("TIME_SEC")) {
return String.valueOf(Calendar.getInstance().get(Calendar.SECOND)); // depends on control dependency: [if], data = [none]
} else if (key.equals("TIME_WDAY")) {
return String.valueOf(Calendar.getInstance().get(Calendar.DAY_OF_WEEK)); // depends on control dependency: [if], data = [none]
} else if (key.equals("TIME")) {
return DateUtils.getCurrentDateTime(servletRequestContext.getExchange()); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
public boolean startOrientationProvider(IOrientationConsumer orientationConsumer)
{
mOrientationConsumer = orientationConsumer;
boolean result = false;
final Sensor sensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
if (sensor != null) {
result = mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_UI);
}
return result;
} } | public class class_name {
@Override
public boolean startOrientationProvider(IOrientationConsumer orientationConsumer)
{
mOrientationConsumer = orientationConsumer;
boolean result = false;
final Sensor sensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
if (sensor != null) {
result = mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_UI); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static Object fromJson(String json) {
try {
JSONObject jsonObject = new JSONObject(json);
if (jsonObject.has("JSON")) {
return convert(jsonObject.get("JSON"));
} else {
return convert(jsonObject);
}
} catch (Exception e) {
throw new RuntimeException("json=" + json, e);
}
} } | public class class_name {
public static Object fromJson(String json) {
try {
JSONObject jsonObject = new JSONObject(json);
if (jsonObject.has("JSON")) {
return convert(jsonObject.get("JSON")); // depends on control dependency: [if], data = [none]
} else {
return convert(jsonObject); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
throw new RuntimeException("json=" + json, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@NonNull
public Transition excludeTarget(int targetId, boolean exclude) {
if (targetId >= 0) {
mTargetIdExcludes = excludeObject(mTargetIdExcludes, targetId, exclude);
}
return this;
} } | public class class_name {
@NonNull
public Transition excludeTarget(int targetId, boolean exclude) {
if (targetId >= 0) {
mTargetIdExcludes = excludeObject(mTargetIdExcludes, targetId, exclude); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public String toJsonString() {
JSONArray dataArray = new JSONArray();
JSONArray jsonArray = new JSONArray();
for (Collection<LabeledItem<T>> col : data) {
JSONArray itemArray = null;
for (LabeledItem<T> item : col) {
itemArray = new JSONArray();
itemArray.put(item.getLabel());
itemArray.put(item.getValue());
jsonArray.put(itemArray);
}
if (itemArray != null) {
dataArray.put(jsonArray);
jsonArray = new JSONArray();
}
}
return dataArray.toString();
} } | public class class_name {
public String toJsonString() {
JSONArray dataArray = new JSONArray();
JSONArray jsonArray = new JSONArray();
for (Collection<LabeledItem<T>> col : data) {
JSONArray itemArray = null;
for (LabeledItem<T> item : col) {
itemArray = new JSONArray(); // depends on control dependency: [for], data = [item]
itemArray.put(item.getLabel()); // depends on control dependency: [for], data = [item]
itemArray.put(item.getValue()); // depends on control dependency: [for], data = [item]
jsonArray.put(itemArray); // depends on control dependency: [for], data = [item]
}
if (itemArray != null) {
dataArray.put(jsonArray); // depends on control dependency: [if], data = [none]
jsonArray = new JSONArray(); // depends on control dependency: [if], data = [none]
}
}
return dataArray.toString();
} } |
public class class_name {
private void initialize() {
historyListFiltersButtonGroup = new DeselectableButtonGroup();
this.setLayout(new BorderLayout());
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
this.setSize(600, 200);
}
this.add(getHistoryPanel(), java.awt.BorderLayout.CENTER);
this.setDefaultAccelerator(view.getMenuShortcutKeyStroke(KeyEvent.VK_H, KeyEvent.SHIFT_DOWN_MASK, false));
this.setMnemonic(Constant.messages.getChar("history.panel.mnemonic"));
} } | public class class_name {
private void initialize() {
historyListFiltersButtonGroup = new DeselectableButtonGroup();
this.setLayout(new BorderLayout());
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
this.setSize(600, 200);
// depends on control dependency: [if], data = [0)]
}
this.add(getHistoryPanel(), java.awt.BorderLayout.CENTER);
this.setDefaultAccelerator(view.getMenuShortcutKeyStroke(KeyEvent.VK_H, KeyEvent.SHIFT_DOWN_MASK, false));
this.setMnemonic(Constant.messages.getChar("history.panel.mnemonic"));
} } |
public class class_name {
@Override
public void setProperties(Property[] newProperties) {
// unregister the listeners from previous properties
for (Property prop : properties) {
prop.removePropertyChangeListener(this);
}
// replace the current properties
properties.clear();
properties.addAll(Arrays.asList(newProperties));
// add listeners
for (Property prop : properties) {
prop.addPropertyChangeListener(this);
}
buildModel();
} } | public class class_name {
@Override
public void setProperties(Property[] newProperties) {
// unregister the listeners from previous properties
for (Property prop : properties) {
prop.removePropertyChangeListener(this); // depends on control dependency: [for], data = [prop]
}
// replace the current properties
properties.clear();
properties.addAll(Arrays.asList(newProperties));
// add listeners
for (Property prop : properties) {
prop.addPropertyChangeListener(this); // depends on control dependency: [for], data = [prop]
}
buildModel();
} } |
public class class_name {
protected String findInSourceFolders(File baseDir, String fileName) {
String answer = findInFolder(baseDir, fileName);
if (answer == null && baseDir.exists()) {
answer = findInChildFolders(new File(baseDir, "src/main"), fileName);
if (answer == null) {
answer = findInChildFolders(new File(baseDir, "src/test"), fileName);
}
}
return answer;
} } | public class class_name {
protected String findInSourceFolders(File baseDir, String fileName) {
String answer = findInFolder(baseDir, fileName);
if (answer == null && baseDir.exists()) {
answer = findInChildFolders(new File(baseDir, "src/main"), fileName); // depends on control dependency: [if], data = [none]
if (answer == null) {
answer = findInChildFolders(new File(baseDir, "src/test"), fileName); // depends on control dependency: [if], data = [none]
}
}
return answer;
} } |
public class class_name {
public static <T> T blobToObject(byte[] blob, Class<T> type) {
try {
return SerializerContext.getInstance().deSerialize(blob, type);
} catch (SerializerException e) {
throw new IllegalStateException(e);
}
} } | public class class_name {
public static <T> T blobToObject(byte[] blob, Class<T> type) {
try {
return SerializerContext.getInstance().deSerialize(blob, type); // depends on control dependency: [try], data = [none]
} catch (SerializerException e) {
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(Attributes attributes, ProtocolMarshaller protocolMarshaller) {
if (attributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Attributes attributes, ProtocolMarshaller protocolMarshaller) {
if (attributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void implementInterfaceMethods(ClassSymbol c, ClassSymbol site) {
for (List<Type> l = types.interfaces(c.type); l.nonEmpty(); l = l.tail) {
ClassSymbol i = (ClassSymbol)l.head.tsym;
for (Scope.Entry e = i.members().elems;
e != null;
e = e.sibling)
{
if (e.sym.kind == MTH && (e.sym.flags() & STATIC) == 0)
{
MethodSymbol absMeth = (MethodSymbol)e.sym;
MethodSymbol implMeth = absMeth.binaryImplementation(site, types);
if (implMeth == null)
addAbstractMethod(site, absMeth);
else if ((implMeth.flags() & IPROXY) != 0)
adjustAbstractMethod(site, implMeth, absMeth);
}
}
implementInterfaceMethods(i, site);
}
} } | public class class_name {
void implementInterfaceMethods(ClassSymbol c, ClassSymbol site) {
for (List<Type> l = types.interfaces(c.type); l.nonEmpty(); l = l.tail) {
ClassSymbol i = (ClassSymbol)l.head.tsym;
for (Scope.Entry e = i.members().elems;
e != null;
e = e.sibling)
{
if (e.sym.kind == MTH && (e.sym.flags() & STATIC) == 0)
{
MethodSymbol absMeth = (MethodSymbol)e.sym;
MethodSymbol implMeth = absMeth.binaryImplementation(site, types);
if (implMeth == null)
addAbstractMethod(site, absMeth);
else if ((implMeth.flags() & IPROXY) != 0)
adjustAbstractMethod(site, implMeth, absMeth);
}
}
implementInterfaceMethods(i, site); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public void normalizeDepths( DMatrixRMaj depths ) {
// normalize rows first
for (int row = 0; row < depths.numRows; row++) {
int idx = row*depths.numCols;
double sum = 0;
for (int col = 0; col < depths.numCols; col++) {
double v = depths.data[idx++];
sum += v*v;
}
double norm = Math.sqrt(sum)/depths.numCols;
idx = row*depths.numCols;
for (int j = 0; j < depths.numCols; j++) {
depths.data[idx++] /= norm;
}
}
// normalize columns
for (int col = 0; col < depths.numCols; col++) {
double norm = 0;
for (int row = 0; row < depths.numRows; row++) {
double v = depths.get(row,col);
norm += v*v;
}
norm = Math.sqrt(norm);
for (int row = 0; row < depths.numRows; row++) {
depths.data[depths.getIndex(row,col)] /= norm;
}
}
} } | public class class_name {
public void normalizeDepths( DMatrixRMaj depths ) {
// normalize rows first
for (int row = 0; row < depths.numRows; row++) {
int idx = row*depths.numCols;
double sum = 0;
for (int col = 0; col < depths.numCols; col++) {
double v = depths.data[idx++];
sum += v*v; // depends on control dependency: [for], data = [none]
}
double norm = Math.sqrt(sum)/depths.numCols;
idx = row*depths.numCols; // depends on control dependency: [for], data = [row]
for (int j = 0; j < depths.numCols; j++) {
depths.data[idx++] /= norm; // depends on control dependency: [for], data = [none]
}
}
// normalize columns
for (int col = 0; col < depths.numCols; col++) {
double norm = 0;
for (int row = 0; row < depths.numRows; row++) {
double v = depths.get(row,col);
norm += v*v; // depends on control dependency: [for], data = [none]
}
norm = Math.sqrt(norm); // depends on control dependency: [for], data = [none]
for (int row = 0; row < depths.numRows; row++) {
depths.data[depths.getIndex(row,col)] /= norm; // depends on control dependency: [for], data = [row]
}
}
} } |
public class class_name {
public <T> T getClone( String key, Class<T> c )
{
IPrototype prototype = prototypes.get(new PrototypeKey(key, c));
if (prototype != null) {
return (T) prototype.clone();
}
else
return null;
} } | public class class_name {
public <T> T getClone( String key, Class<T> c )
{
IPrototype prototype = prototypes.get(new PrototypeKey(key, c));
if (prototype != null) {
return (T) prototype.clone(); // depends on control dependency: [if], data = [none]
}
else
return null;
} } |
public class class_name {
private void setClickListener() {
m_ok.addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 6621475980210242125L;
public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
try {
CmsResourceFilter filter = getType() == null
? CmsResourceFilter.ALL
: CmsResourceFilter.requireType(getType());
results.addResult(
new CmsResourceTypeStatResult(
getType(),
(String)m_siteSelect.getValue(),
getCmsObject().readResources("/", filter, true).size()));
m_results.setVisible(true);
results.setVerticalLayout(m_resLayout, false);
} catch (CmsException e) {
LOG.error("Unable to read resource tree", e);
}
}
});
} } | public class class_name {
private void setClickListener() {
m_ok.addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 6621475980210242125L;
public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
try {
CmsResourceFilter filter = getType() == null
? CmsResourceFilter.ALL
: CmsResourceFilter.requireType(getType());
results.addResult(
new CmsResourceTypeStatResult(
getType(),
(String)m_siteSelect.getValue(),
getCmsObject().readResources("/", filter, true).size())); // depends on control dependency: [try], data = [none]
m_results.setVisible(true); // depends on control dependency: [try], data = [none]
results.setVerticalLayout(m_resLayout, false); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error("Unable to read resource tree", e);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
protected void save(final String fileName, final SessionListener callback) {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
Exception thrownException = null;
try {
save(fileName);
} catch (Exception e) {
// ZAP: Log exceptions
log.warn(e.getMessage(), e);
thrownException = e;
}
if (callback != null) {
callback.sessionSaved(thrownException);
}
}
});
t.setPriority(Thread.NORM_PRIORITY-2);
t.start();
} } | public class class_name {
protected void save(final String fileName, final SessionListener callback) {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
Exception thrownException = null;
try {
save(fileName);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
// ZAP: Log exceptions
log.warn(e.getMessage(), e);
thrownException = e;
}
// depends on control dependency: [catch], data = [none]
if (callback != null) {
callback.sessionSaved(thrownException);
// depends on control dependency: [if], data = [none]
}
}
});
t.setPriority(Thread.NORM_PRIORITY-2);
t.start();
} } |
public class class_name {
protected void notifyListener(final ExecutorService executor,
final Future<?> future, final GenericCompletionListener listener) {
executor.submit(new Runnable() {
@Override
public void run() {
try {
listener.onComplete(future);
} catch(Throwable t) {
getLogger().warn(
"Exception thrown wile executing " + listener.getClass().getName()
+ ".operationComplete()", t);
}
}
});
} } | public class class_name {
protected void notifyListener(final ExecutorService executor,
final Future<?> future, final GenericCompletionListener listener) {
executor.submit(new Runnable() {
@Override
public void run() {
try {
listener.onComplete(future); // depends on control dependency: [try], data = [none]
} catch(Throwable t) {
getLogger().warn(
"Exception thrown wile executing " + listener.getClass().getName()
+ ".operationComplete()", t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public synchronized static Random getSecureRandom() {
if (cachedSecureRandom != null)
return cachedSecureRandom;
try {
return SecureRandom.getInstance("SHA1PRNG");
} catch (NoSuchAlgorithmException e) {
return R;
}
} } | public class class_name {
public synchronized static Random getSecureRandom() {
if (cachedSecureRandom != null)
return cachedSecureRandom;
try {
return SecureRandom.getInstance("SHA1PRNG"); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
return R;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public DataPoints[] evaluate(final List<DataPoints[]> query_results) {
// TODO - size the array
final List<DataPoints[]> materialized = Lists.newArrayList();
List<Integer> metric_query_keys = null;
if (sub_metric_queries != null && sub_metric_queries.size() > 0) {
metric_query_keys = Lists.newArrayList(sub_metric_queries.keySet());
Collections.sort(metric_query_keys);
}
int metric_pointer = 0;
int sub_expression_pointer = 0;
for (int i = 0; i < parameter_index.size(); i++) {
final Parameter param = parameter_index.get(i);
if (param == Parameter.METRIC_QUERY) {
if (metric_query_keys == null) {
throw new RuntimeException("Attempt to read metric " +
"results when none exist");
}
final int ix = metric_query_keys.get(metric_pointer++);
materialized.add(query_results.get(ix));
} else if (param == Parameter.SUB_EXPRESSION) {
final ExpressionTree st = sub_expressions.get(sub_expression_pointer++);
materialized.add(st.evaluate(query_results));
} else {
throw new IllegalDataException("Unknown parameter type: " + param
+ " in tree: " + this);
}
}
return expression.evaluate(data_query, materialized, func_params);
} } | public class class_name {
public DataPoints[] evaluate(final List<DataPoints[]> query_results) {
// TODO - size the array
final List<DataPoints[]> materialized = Lists.newArrayList();
List<Integer> metric_query_keys = null;
if (sub_metric_queries != null && sub_metric_queries.size() > 0) {
metric_query_keys = Lists.newArrayList(sub_metric_queries.keySet()); // depends on control dependency: [if], data = [(sub_metric_queries]
Collections.sort(metric_query_keys); // depends on control dependency: [if], data = [none]
}
int metric_pointer = 0;
int sub_expression_pointer = 0;
for (int i = 0; i < parameter_index.size(); i++) {
final Parameter param = parameter_index.get(i);
if (param == Parameter.METRIC_QUERY) {
if (metric_query_keys == null) {
throw new RuntimeException("Attempt to read metric " +
"results when none exist");
}
final int ix = metric_query_keys.get(metric_pointer++);
materialized.add(query_results.get(ix)); // depends on control dependency: [if], data = [none]
} else if (param == Parameter.SUB_EXPRESSION) {
final ExpressionTree st = sub_expressions.get(sub_expression_pointer++);
materialized.add(st.evaluate(query_results)); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalDataException("Unknown parameter type: " + param
+ " in tree: " + this);
}
}
return expression.evaluate(data_query, materialized, func_params);
} } |
public class class_name {
private String initConsoleAndGetAnswer() {
ConsoleReaderWrapper consoleReaderWrapper = initConsole();
String input = "";
boolean valid = false;
while (!valid) {
input = consoleReaderWrapper.getInput();
valid = validate(consoleReaderWrapper, input);
if (!valid) {
consoleReaderWrapper.print("");
consoleReaderWrapper.print(question);
}
}
consoleReaderWrapper.close();
return input;
} } | public class class_name {
private String initConsoleAndGetAnswer() {
ConsoleReaderWrapper consoleReaderWrapper = initConsole();
String input = "";
boolean valid = false;
while (!valid) {
input = consoleReaderWrapper.getInput(); // depends on control dependency: [while], data = [none]
valid = validate(consoleReaderWrapper, input); // depends on control dependency: [while], data = [none]
if (!valid) {
consoleReaderWrapper.print(""); // depends on control dependency: [if], data = [none]
consoleReaderWrapper.print(question); // depends on control dependency: [if], data = [none]
}
}
consoleReaderWrapper.close();
return input;
} } |
public class class_name {
public String findWithinHorizon(Pattern pattern, int horizon) {
ensureOpen();
if (pattern == null)
throw new NullPointerException();
if (horizon < 0)
throw new IllegalArgumentException("horizon < 0");
clearCaches();
// Search for the pattern
while (true) {
String token = findPatternInBuffer(pattern, horizon);
if (token != null) {
matchValid = true;
return token;
}
if (needInput)
readInput();
else
break; // up to end of input
}
return null;
} } | public class class_name {
public String findWithinHorizon(Pattern pattern, int horizon) {
ensureOpen();
if (pattern == null)
throw new NullPointerException();
if (horizon < 0)
throw new IllegalArgumentException("horizon < 0");
clearCaches();
// Search for the pattern
while (true) {
String token = findPatternInBuffer(pattern, horizon);
if (token != null) {
matchValid = true; // depends on control dependency: [if], data = [none]
return token; // depends on control dependency: [if], data = [none]
}
if (needInput)
readInput();
else
break; // up to end of input
}
return null;
} } |
public class class_name {
private void removeNode(Node<K, V> node) {
if (node.previous != null) {
node.previous.next = node.next;
} else { // node was head
head = node.next;
}
if (node.next != null) {
node.next.previous = node.previous;
} else { // node was tail
tail = node.previous;
}
if (node.previousSibling == null && node.nextSibling == null) {
KeyList<K, V> keyList = keyToKeyList.remove(node.key);
keyList.count = 0;
modCount++;
} else {
KeyList<K, V> keyList = keyToKeyList.get(node.key);
keyList.count--;
if (node.previousSibling == null) {
keyList.head = node.nextSibling;
} else {
node.previousSibling.nextSibling = node.nextSibling;
}
if (node.nextSibling == null) {
keyList.tail = node.previousSibling;
} else {
node.nextSibling.previousSibling = node.previousSibling;
}
}
size--;
} } | public class class_name {
private void removeNode(Node<K, V> node) {
if (node.previous != null) {
node.previous.next = node.next; // depends on control dependency: [if], data = [none]
} else { // node was head
head = node.next; // depends on control dependency: [if], data = [none]
}
if (node.next != null) {
node.next.previous = node.previous; // depends on control dependency: [if], data = [none]
} else { // node was tail
tail = node.previous; // depends on control dependency: [if], data = [none]
}
if (node.previousSibling == null && node.nextSibling == null) {
KeyList<K, V> keyList = keyToKeyList.remove(node.key);
keyList.count = 0; // depends on control dependency: [if], data = [none]
modCount++; // depends on control dependency: [if], data = [none]
} else {
KeyList<K, V> keyList = keyToKeyList.get(node.key);
keyList.count--; // depends on control dependency: [if], data = [none]
if (node.previousSibling == null) {
keyList.head = node.nextSibling; // depends on control dependency: [if], data = [none]
} else {
node.previousSibling.nextSibling = node.nextSibling; // depends on control dependency: [if], data = [none]
}
if (node.nextSibling == null) {
keyList.tail = node.previousSibling; // depends on control dependency: [if], data = [none]
} else {
node.nextSibling.previousSibling = node.previousSibling; // depends on control dependency: [if], data = [none]
}
}
size--;
} } |
public class class_name {
public static String escapeStringLiteral(String s) {
StringBuilder sb = null;
int len = s.length();
int lastIndex = 0;
for (int i = 0; i < len; i++) {
String replacement = escapeCharacterForStringLiteral(s.charAt(i), s, i);
if (replacement == null) {
continue;
}
if (sb == null) {
sb = new StringBuilder();
}
if (lastIndex < i) {
sb.append(s.substring(lastIndex, i));
}
lastIndex = i + 1;
sb.append(replacement);
}
if (sb != null) {
sb.append(s.substring(lastIndex, len));
return sb.toString();
} else {
return s;
}
} } | public class class_name {
public static String escapeStringLiteral(String s) {
StringBuilder sb = null;
int len = s.length();
int lastIndex = 0;
for (int i = 0; i < len; i++) {
String replacement = escapeCharacterForStringLiteral(s.charAt(i), s, i);
if (replacement == null) {
continue;
}
if (sb == null) {
sb = new StringBuilder(); // depends on control dependency: [if], data = [none]
}
if (lastIndex < i) {
sb.append(s.substring(lastIndex, i)); // depends on control dependency: [if], data = [(lastIndex]
}
lastIndex = i + 1; // depends on control dependency: [for], data = [i]
sb.append(replacement); // depends on control dependency: [for], data = [none]
}
if (sb != null) {
sb.append(s.substring(lastIndex, len)); // depends on control dependency: [if], data = [none]
return sb.toString(); // depends on control dependency: [if], data = [none]
} else {
return s; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected T getContext() {
Chronology<T> c = this.getChronology();
Class<T> type = c.getChronoType();
if (type.isInstance(this)) {
return type.cast(this);
} else {
for (ChronoElement<?> element : c.getRegisteredElements()) {
if (type == element.getType()) {
return type.cast(this.get(element));
}
}
}
throw new IllegalStateException(
"Implementation error: Cannot find entity context.");
} } | public class class_name {
protected T getContext() {
Chronology<T> c = this.getChronology();
Class<T> type = c.getChronoType();
if (type.isInstance(this)) {
return type.cast(this); // depends on control dependency: [if], data = [none]
} else {
for (ChronoElement<?> element : c.getRegisteredElements()) {
if (type == element.getType()) {
return type.cast(this.get(element)); // depends on control dependency: [if], data = [none]
}
}
}
throw new IllegalStateException(
"Implementation error: Cannot find entity context.");
} } |
public class class_name {
protected void processClientErrorCallback(HttpServletRequest request, HttpServletResponse response, RequestClientErrorException cause) {
final RequestClientErrorHandler clientErrorHandler = clientErrorHandlerLocal.get();
if (clientErrorHandler == null) {
return;
}
try {
clientErrorHandler.handle(request, response, cause);
} catch (Throwable handlingEx) {
final String msg = "Failed to handle 'Client Error' by the handler: " + clientErrorHandler;
if (errorLogging) {
logger.error(msg, handlingEx);
} else {
logger.debug(msg, handlingEx);
}
}
} } | public class class_name {
protected void processClientErrorCallback(HttpServletRequest request, HttpServletResponse response, RequestClientErrorException cause) {
final RequestClientErrorHandler clientErrorHandler = clientErrorHandlerLocal.get();
if (clientErrorHandler == null) {
return; // depends on control dependency: [if], data = [none]
}
try {
clientErrorHandler.handle(request, response, cause); // depends on control dependency: [try], data = [none]
} catch (Throwable handlingEx) {
final String msg = "Failed to handle 'Client Error' by the handler: " + clientErrorHandler;
if (errorLogging) {
logger.error(msg, handlingEx); // depends on control dependency: [if], data = [none]
} else {
logger.debug(msg, handlingEx); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public <E> SetAttribute<X, E> getDeclaredSet(String paramName, Class<E> paramClass)
{
PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName);
if (onCheckSetAttribute(declaredAttrib, paramClass))
{
return (SetAttribute<X, E>) declaredAttrib;
}
throw new IllegalArgumentException(
"attribute of the given name and type is not present in the managed type, for name:" + paramName
+ " , type:" + paramClass);
} } | public class class_name {
@Override
public <E> SetAttribute<X, E> getDeclaredSet(String paramName, Class<E> paramClass)
{
PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName);
if (onCheckSetAttribute(declaredAttrib, paramClass))
{
return (SetAttribute<X, E>) declaredAttrib; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException(
"attribute of the given name and type is not present in the managed type, for name:" + paramName
+ " , type:" + paramClass);
} } |
public class class_name {
public final void push(String s)
{
if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize;
String newMap[] = new String[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
m_map = newMap;
}
m_map[m_firstFree] = s;
m_firstFree++;
} } | public class class_name {
public final void push(String s)
{
if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize; // depends on control dependency: [if], data = [none]
String newMap[] = new String[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); // depends on control dependency: [if], data = [none]
m_map = newMap; // depends on control dependency: [if], data = [none]
}
m_map[m_firstFree] = s;
m_firstFree++;
} } |
public class class_name {
public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(final SaltClient client, Target<?> target,
AuthMethod auth, Optional<Batch> batch) {
Map<String, Object> customArgs = new HashMap<>();
batch.ifPresent(v -> customArgs.putAll(v.getParams()));
return client.call(
this, Client.LOCAL_ASYNC, Optional.of(target), customArgs,
new TypeToken<Return<List<LocalAsyncResult<R>>>>(){}, auth)
.thenApply(wrapper -> {
LocalAsyncResult<R> result = wrapper.getResult().get(0);
result.setType(getReturnType());
if (result.getJid() == null) {
return Optional.empty();
} else {
return Optional.of(result);
}
});
} } | public class class_name {
public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(final SaltClient client, Target<?> target,
AuthMethod auth, Optional<Batch> batch) {
Map<String, Object> customArgs = new HashMap<>();
batch.ifPresent(v -> customArgs.putAll(v.getParams()));
return client.call(
this, Client.LOCAL_ASYNC, Optional.of(target), customArgs,
new TypeToken<Return<List<LocalAsyncResult<R>>>>(){}, auth)
.thenApply(wrapper -> {
LocalAsyncResult<R> result = wrapper.getResult().get(0);
result.setType(getReturnType());
if (result.getJid() == null) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
} else {
return Optional.of(result); // depends on control dependency: [if], data = [none]
}
});
} } |
public class class_name {
public ContentProviderController<T> create() {
Context baseContext = RuntimeEnvironment.application.getBaseContext();
ComponentName componentName = createRelative(baseContext.getPackageName(), contentProvider.getClass().getName());
ProviderInfo providerInfo = null;
try {
providerInfo =
baseContext
.getPackageManager()
.getProviderInfo(componentName, PackageManager.MATCH_DISABLED_COMPONENTS);
} catch (PackageManager.NameNotFoundException e) {
Logger.strict("Unable to find provider info for " + componentName, e);
}
return create(providerInfo);
} } | public class class_name {
public ContentProviderController<T> create() {
Context baseContext = RuntimeEnvironment.application.getBaseContext();
ComponentName componentName = createRelative(baseContext.getPackageName(), contentProvider.getClass().getName());
ProviderInfo providerInfo = null;
try {
providerInfo =
baseContext
.getPackageManager()
.getProviderInfo(componentName, PackageManager.MATCH_DISABLED_COMPONENTS); // depends on control dependency: [try], data = [none]
} catch (PackageManager.NameNotFoundException e) {
Logger.strict("Unable to find provider info for " + componentName, e);
} // depends on control dependency: [catch], data = [none]
return create(providerInfo);
} } |
public class class_name {
@Override
public void generateSerializeOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) {
// TODO QUA
// TypeName typeName = resolveTypeName(property.getParent(),
// property.getPropertyType().getTypeName());
TypeName typeName = property.getPropertyType().getTypeName();
String bindName = context.getBindMapperName(context, typeName);
// @formatter:off
if (property.isNullable() && !property.isInCollection()) {
methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property));
}
methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property));
methodBuilder.addStatement("$L.serializeOnXml($L, xmlSerializer, $L)", bindName, getter(beanName, beanClass, property), XmlPullParser.START_TAG);
methodBuilder.addStatement("$L.writeEndElement()", serializerName);
if (property.isNullable() && !property.isInCollection()) {
methodBuilder.endControlFlow();
}
// @formatter:on
} } | public class class_name {
@Override
public void generateSerializeOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) {
// TODO QUA
// TypeName typeName = resolveTypeName(property.getParent(),
// property.getPropertyType().getTypeName());
TypeName typeName = property.getPropertyType().getTypeName();
String bindName = context.getBindMapperName(context, typeName);
// @formatter:off
if (property.isNullable() && !property.isInCollection()) {
methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property)); // depends on control dependency: [if], data = [none]
}
methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property));
methodBuilder.addStatement("$L.serializeOnXml($L, xmlSerializer, $L)", bindName, getter(beanName, beanClass, property), XmlPullParser.START_TAG);
methodBuilder.addStatement("$L.writeEndElement()", serializerName);
if (property.isNullable() && !property.isInCollection()) {
methodBuilder.endControlFlow(); // depends on control dependency: [if], data = [none]
}
// @formatter:on
} } |
public class class_name {
private static Bitmap fractionalDecode(FractionalDecodeShim shim,
Options options, int requestedWidth, int requestedHeight) {
final int rawWidth = options.outWidth;
final int rawHeight = options.outHeight;
final float sampledWidth = (float) rawWidth / options.inSampleSize;
final float sampledHeight = (float) rawHeight / options.inSampleSize;
// Use the simple path, if we can/must
if (requestedWidth == 0
|| requestedHeight == 0 //
|| sampledWidth <= Math.abs(requestedWidth)
|| sampledHeight <= Math.abs(requestedHeight)) {
if (VERBOSE_DECODE) {
Log.d(TAG,
"Can't use slice decoder: sampledWidth = %.0f, requestedWidth = %d; sampledHeight = %.0f, requestedHeight = %d",
sampledWidth, requestedWidth, sampledHeight,
requestedHeight);
}
return shim.decode(options);
}
// We must use a BitmapRegionDecoder to read and resize 'slices' of the
// input
BitmapRegionDecoder decoder = shim.newRegionDecoder();
try {
float scale = Math.max(scale(requestedWidth, sampledWidth),
scale(requestedHeight, sampledHeight));
int scaledSliceWidth = roundUp(sampledWidth * scale);
int slices = (decoder == null) ? 1 : roundUp(sampledHeight
/ (SLICE_SIZE / sampledWidth));
int sliceRows = (int) (rawHeight / slices);
float scaledSliceRows = sliceRows / options.inSampleSize * scale;
Bitmap result = Bitmap.createBitmap((int) (sampledWidth * scale),
(int) (sampledHeight * scale), Config.ARGB_8888);
Canvas canvas = new Canvas(result);
Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG);
// Rect decode, uses 'raw' coordinates
Rect decode = new Rect(0, 0, rawWidth, sliceRows);
// RectF target, uses scaled coordinates
RectF target = new RectF(0, 0, scaledSliceWidth, scaledSliceRows);
Bitmap slice = options.inBitmap = null;
boolean hasAlpha = false;
for (int index = 0; index < slices; ++index) {
slice = options.inBitmap = //
(decoder == null) ? shim.decode(options) : //
decoder.decodeRegion(decode, options);
hasAlpha |= slice.hasAlpha();
canvas.drawBitmap(slice, null, target, paint);
decode.offset(0, sliceRows);
target.offset(0, scaledSliceRows);
}
slice.recycle();
// log(TAG,
// "fractionalDecode: result.hasAlpha() == %b, slices' hasAlpha == %b",
// result.hasAlpha(), hasAlpha);
result.setHasAlpha(hasAlpha);
return result;
} finally {
if (decoder != null) {
decoder.recycle();
}
}
} } | public class class_name {
private static Bitmap fractionalDecode(FractionalDecodeShim shim,
Options options, int requestedWidth, int requestedHeight) {
final int rawWidth = options.outWidth;
final int rawHeight = options.outHeight;
final float sampledWidth = (float) rawWidth / options.inSampleSize;
final float sampledHeight = (float) rawHeight / options.inSampleSize;
// Use the simple path, if we can/must
if (requestedWidth == 0
|| requestedHeight == 0 //
|| sampledWidth <= Math.abs(requestedWidth)
|| sampledHeight <= Math.abs(requestedHeight)) {
if (VERBOSE_DECODE) {
Log.d(TAG,
"Can't use slice decoder: sampledWidth = %.0f, requestedWidth = %d; sampledHeight = %.0f, requestedHeight = %d",
sampledWidth, requestedWidth, sampledHeight,
requestedHeight);
}
return shim.decode(options);
}
// We must use a BitmapRegionDecoder to read and resize 'slices' of the
// input
BitmapRegionDecoder decoder = shim.newRegionDecoder(); // depends on control dependency: [if], data = [none]
try {
float scale = Math.max(scale(requestedWidth, sampledWidth),
scale(requestedHeight, sampledHeight));
int scaledSliceWidth = roundUp(sampledWidth * scale);
int slices = (decoder == null) ? 1 : roundUp(sampledHeight
/ (SLICE_SIZE / sampledWidth));
int sliceRows = (int) (rawHeight / slices);
float scaledSliceRows = sliceRows / options.inSampleSize * scale;
Bitmap result = Bitmap.createBitmap((int) (sampledWidth * scale),
(int) (sampledHeight * scale), Config.ARGB_8888);
Canvas canvas = new Canvas(result);
Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG);
// Rect decode, uses 'raw' coordinates
Rect decode = new Rect(0, 0, rawWidth, sliceRows);
// RectF target, uses scaled coordinates
RectF target = new RectF(0, 0, scaledSliceWidth, scaledSliceRows);
Bitmap slice = options.inBitmap = null;
boolean hasAlpha = false;
for (int index = 0; index < slices; ++index) {
slice = options.inBitmap = //
(decoder == null) ? shim.decode(options) : //
decoder.decodeRegion(decode, options); // depends on control dependency: [for], data = [none]
hasAlpha |= slice.hasAlpha(); // depends on control dependency: [for], data = [none]
canvas.drawBitmap(slice, null, target, paint); // depends on control dependency: [for], data = [none]
decode.offset(0, sliceRows); // depends on control dependency: [for], data = [none]
target.offset(0, scaledSliceRows); // depends on control dependency: [for], data = [none]
}
slice.recycle(); // depends on control dependency: [try], data = [none]
// log(TAG,
// "fractionalDecode: result.hasAlpha() == %b, slices' hasAlpha == %b",
// result.hasAlpha(), hasAlpha);
result.setHasAlpha(hasAlpha); // depends on control dependency: [try], data = [none]
return result; // depends on control dependency: [try], data = [none]
} finally {
if (decoder != null) {
decoder.recycle(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static <T, S extends BaseConfig> IExtractor<T, S> getExtractorInstance(S config) {
try {
Class<T> rdd = (Class<T>) config.getExtractorImplClass();
if (rdd == null) {
rdd = (Class<T>) Class.forName(config.getExtractorImplClassName());
}
Constructor<T> c;
if (config.getEntityClass().isAssignableFrom(Cells.class)) {
c = rdd.getConstructor();
return (IExtractor<T, S>) c.newInstance();
} else {
c = rdd.getConstructor(Class.class);
return (IExtractor<T, S>) c.newInstance(config.getEntityClass());
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
String message = "A exception happens and we wrap with DeepExtractorInitializationException" + e.getMessage();
LOG.error(message);
throw new DeepExtractorInitializationException(message,e);
}
} } | public class class_name {
public static <T, S extends BaseConfig> IExtractor<T, S> getExtractorInstance(S config) {
try {
Class<T> rdd = (Class<T>) config.getExtractorImplClass(); // depends on control dependency: [try], data = [none]
if (rdd == null) {
rdd = (Class<T>) Class.forName(config.getExtractorImplClassName()); // depends on control dependency: [if], data = [none]
}
Constructor<T> c;
if (config.getEntityClass().isAssignableFrom(Cells.class)) {
c = rdd.getConstructor(); // depends on control dependency: [if], data = [none]
return (IExtractor<T, S>) c.newInstance(); // depends on control dependency: [if], data = [none]
} else {
c = rdd.getConstructor(Class.class); // depends on control dependency: [if], data = [none]
return (IExtractor<T, S>) c.newInstance(config.getEntityClass()); // depends on control dependency: [if], data = [none]
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
String message = "A exception happens and we wrap with DeepExtractorInitializationException" + e.getMessage();
LOG.error(message);
throw new DeepExtractorInitializationException(message,e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void clean(Node node) {
NodeList childNodes = node.getChildNodes();
for (int n = childNodes.getLength() - 1; n >= 0; n--) {
Node child = childNodes.item(n);
short nodeType = child.getNodeType();
if (nodeType == Node.ELEMENT_NODE) {
XmlUtils.clean(child);
} else if (nodeType == Node.COMMENT_NODE) {
node.removeChild(child);
} else if (nodeType == Node.TEXT_NODE) {
String value = StringUtils.trimToNull(child.getNodeValue());
if (value == null)
node.removeChild(child);
else
child.setNodeValue(value);
}
}
} } | public class class_name {
public static void clean(Node node) {
NodeList childNodes = node.getChildNodes();
for (int n = childNodes.getLength() - 1; n >= 0; n--) {
Node child = childNodes.item(n);
short nodeType = child.getNodeType();
if (nodeType == Node.ELEMENT_NODE) {
XmlUtils.clean(child); // depends on control dependency: [if], data = [none]
} else if (nodeType == Node.COMMENT_NODE) {
node.removeChild(child); // depends on control dependency: [if], data = [none]
} else if (nodeType == Node.TEXT_NODE) {
String value = StringUtils.trimToNull(child.getNodeValue());
if (value == null)
node.removeChild(child);
else
child.setNodeValue(value);
}
}
} } |
public class class_name {
public void done() {
engine.execute();
while (deferred != null) {
final List<Runnable> runme = deferred;
deferred = null; // reset this because it might get filled with more
for (final Runnable run: runme) {
log.trace("Executing {}", run);
run.run();
}
}
} } | public class class_name {
public void done() {
engine.execute();
while (deferred != null) {
final List<Runnable> runme = deferred;
deferred = null; // reset this because it might get filled with more // depends on control dependency: [while], data = [none]
for (final Runnable run: runme) {
log.trace("Executing {}", run); // depends on control dependency: [for], data = [run]
run.run(); // depends on control dependency: [for], data = [run]
}
}
} } |
public class class_name {
public static Method getSetter(Class<?> clazz, Field f) {
Method setter = null;
for (Method m : clazz.getMethods()) {
if (ReflectionUtils.isSetter(m) &&
m.getName().equals(SETTER_PREFIX + StringUtils.capitalize(f.getName()))) {
setter = m;
break;
}
}
return setter;
} } | public class class_name {
public static Method getSetter(Class<?> clazz, Field f) {
Method setter = null;
for (Method m : clazz.getMethods()) {
if (ReflectionUtils.isSetter(m) &&
m.getName().equals(SETTER_PREFIX + StringUtils.capitalize(f.getName()))) {
setter = m;
// depends on control dependency: [if], data = [none]
break;
}
}
return setter;
} } |
public class class_name {
public static Rectangle2D shiftReactionVertical(IReaction reaction, Rectangle2D bounds, Rectangle2D last, double gap) {
// determine if the reactions are overlapping
if (last.getMaxY() + gap >= bounds.getMinY()) {
double yShift = bounds.getHeight() + last.getHeight() + gap;
Vector2d shift = new Vector2d(0, yShift);
List<IAtomContainer> containers = ReactionManipulator.getAllAtomContainers(reaction);
for (IAtomContainer container : containers) {
translate2D(container, shift);
}
return new Rectangle2D.Double(bounds.getX(), bounds.getY() + yShift, bounds.getWidth(), bounds.getHeight());
} else {
// the reactions were not overlapping
return bounds;
}
} } | public class class_name {
public static Rectangle2D shiftReactionVertical(IReaction reaction, Rectangle2D bounds, Rectangle2D last, double gap) {
// determine if the reactions are overlapping
if (last.getMaxY() + gap >= bounds.getMinY()) {
double yShift = bounds.getHeight() + last.getHeight() + gap;
Vector2d shift = new Vector2d(0, yShift);
List<IAtomContainer> containers = ReactionManipulator.getAllAtomContainers(reaction);
for (IAtomContainer container : containers) {
translate2D(container, shift); // depends on control dependency: [for], data = [container]
}
return new Rectangle2D.Double(bounds.getX(), bounds.getY() + yShift, bounds.getWidth(), bounds.getHeight()); // depends on control dependency: [if], data = [none]
} else {
// the reactions were not overlapping
return bounds; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(ListAlgorithmsRequest listAlgorithmsRequest, ProtocolMarshaller protocolMarshaller) {
if (listAlgorithmsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listAlgorithmsRequest.getCreationTimeAfter(), CREATIONTIMEAFTER_BINDING);
protocolMarshaller.marshall(listAlgorithmsRequest.getCreationTimeBefore(), CREATIONTIMEBEFORE_BINDING);
protocolMarshaller.marshall(listAlgorithmsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listAlgorithmsRequest.getNameContains(), NAMECONTAINS_BINDING);
protocolMarshaller.marshall(listAlgorithmsRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listAlgorithmsRequest.getSortBy(), SORTBY_BINDING);
protocolMarshaller.marshall(listAlgorithmsRequest.getSortOrder(), SORTORDER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListAlgorithmsRequest listAlgorithmsRequest, ProtocolMarshaller protocolMarshaller) {
if (listAlgorithmsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listAlgorithmsRequest.getCreationTimeAfter(), CREATIONTIMEAFTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAlgorithmsRequest.getCreationTimeBefore(), CREATIONTIMEBEFORE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAlgorithmsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAlgorithmsRequest.getNameContains(), NAMECONTAINS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAlgorithmsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAlgorithmsRequest.getSortBy(), SORTBY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAlgorithmsRequest.getSortOrder(), SORTORDER_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 {
@MainThread
private void handleEventFailure(Event event, EventFailure failure) {
if (!activeEvents.contains(event)) {
Utils.logE(event.getKey(), "Cannot send failure callback of finished event");
return;
}
scheduleFailureCallbacks(event, failure);
executeTasks(false);
} } | public class class_name {
@MainThread
private void handleEventFailure(Event event, EventFailure failure) {
if (!activeEvents.contains(event)) {
Utils.logE(event.getKey(), "Cannot send failure callback of finished event"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
scheduleFailureCallbacks(event, failure);
executeTasks(false);
} } |
public class class_name {
@Sensitive
public Map<String, Object> evaluateRequestResponse(@Sensitive String responseBody, int statusLine, String endpointPath) {
Map<String, Object> response = null;
if (responseBody == null) {
return createErrorResponse("TWITTER_EMPTY_RESPONSE_BODY", new Object[] { endpointPath });
}
// Error status
if (HttpServletResponse.SC_OK != statusLine) {
return createErrorResponse("TWITTER_ENDPOINT_REQUEST_FAILED", new Object[] { endpointPath, statusLine, responseBody });
}
if (endpointPath == null) {
endpointPath = TwitterConstants.TWITTER_ENDPOINT_REQUEST_TOKEN;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "A Twitter endpoint path was not found; defaulting to using " + endpointPath + " as the Twitter endpoint path.");
}
}
if (endpointPath.equals(TwitterConstants.TWITTER_ENDPOINT_REQUEST_TOKEN)) {
response = evaluateRequestTokenResponse(responseBody);
} else if (endpointPath.equals(TwitterConstants.TWITTER_ENDPOINT_ACCESS_TOKEN)) {
response = evaluateAccessTokenResponse(responseBody);
} else if (endpointPath.equals(TwitterConstants.TWITTER_ENDPOINT_VERIFY_CREDENTIALS)) {
response = evaluateVerifyCredentialsResponse(responseBody);
}
return response;
} } | public class class_name {
@Sensitive
public Map<String, Object> evaluateRequestResponse(@Sensitive String responseBody, int statusLine, String endpointPath) {
Map<String, Object> response = null;
if (responseBody == null) {
return createErrorResponse("TWITTER_EMPTY_RESPONSE_BODY", new Object[] { endpointPath }); // depends on control dependency: [if], data = [none]
}
// Error status
if (HttpServletResponse.SC_OK != statusLine) {
return createErrorResponse("TWITTER_ENDPOINT_REQUEST_FAILED", new Object[] { endpointPath, statusLine, responseBody }); // depends on control dependency: [if], data = [none]
}
if (endpointPath == null) {
endpointPath = TwitterConstants.TWITTER_ENDPOINT_REQUEST_TOKEN; // depends on control dependency: [if], data = [none]
if (tc.isDebugEnabled()) {
Tr.debug(tc, "A Twitter endpoint path was not found; defaulting to using " + endpointPath + " as the Twitter endpoint path."); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
}
if (endpointPath.equals(TwitterConstants.TWITTER_ENDPOINT_REQUEST_TOKEN)) {
response = evaluateRequestTokenResponse(responseBody); // depends on control dependency: [if], data = [none]
} else if (endpointPath.equals(TwitterConstants.TWITTER_ENDPOINT_ACCESS_TOKEN)) {
response = evaluateAccessTokenResponse(responseBody); // depends on control dependency: [if], data = [none]
} else if (endpointPath.equals(TwitterConstants.TWITTER_ENDPOINT_VERIFY_CREDENTIALS)) {
response = evaluateVerifyCredentialsResponse(responseBody); // depends on control dependency: [if], data = [none]
}
return response;
} } |
public class class_name {
public static String escape(String str) {
if (StrUtil.isEmpty(str)) {
return str;
}
final int len = str.length();
final StringBuilder builder = new StringBuilder(len);
char c;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
builder.append(escape(c));
}
return builder.toString();
} } | public class class_name {
public static String escape(String str) {
if (StrUtil.isEmpty(str)) {
return str;
// depends on control dependency: [if], data = [none]
}
final int len = str.length();
final StringBuilder builder = new StringBuilder(len);
char c;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
// depends on control dependency: [for], data = [i]
builder.append(escape(c));
// depends on control dependency: [for], data = [none]
}
return builder.toString();
} } |
public class class_name {
public static Object getSpringBean(ApplicationContext appContext, String id) {
try {
Object bean = appContext.getBean(id);
return bean;
} catch (BeansException e) {
return null;
}
} } | public class class_name {
public static Object getSpringBean(ApplicationContext appContext, String id) {
try {
Object bean = appContext.getBean(id);
return bean; // depends on control dependency: [try], data = [none]
} catch (BeansException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public final Object getAsObject(final FacesContext context,
final UIComponent component, final String value) {
if (value == null) {
return null;
}
String pattern = (String) component.getAttributes().get("pattern");
SimpleDateFormat formatter = new SimpleDateFormat(pattern,
getLocale(context, component));
try {
return formatter.parse(value);
} catch (Exception e) {
throw new ConverterException(
"ConverterException = " + e.getLocalizedMessage(), e);
}
} } | public class class_name {
@Override
public final Object getAsObject(final FacesContext context,
final UIComponent component, final String value) {
if (value == null) {
return null;
// depends on control dependency: [if], data = [none]
}
String pattern = (String) component.getAttributes().get("pattern");
SimpleDateFormat formatter = new SimpleDateFormat(pattern,
getLocale(context, component));
try {
return formatter.parse(value);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new ConverterException(
"ConverterException = " + e.getLocalizedMessage(), e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue"}) // For library users
public Searcher clearFacetRefinements(@NonNull String attribute) {
final List<String> stringList = refinementMap.get(attribute);
if (stringList != null) {
stringList.clear();
}
rebuildQueryFacetFilters();
return this;
} } | public class class_name {
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue"}) // For library users
public Searcher clearFacetRefinements(@NonNull String attribute) {
final List<String> stringList = refinementMap.get(attribute);
if (stringList != null) {
stringList.clear(); // depends on control dependency: [if], data = [none]
}
rebuildQueryFacetFilters();
return this;
} } |
public class class_name {
public static Scope openScopes(Object... names) {
if (names == null) {
throw new IllegalArgumentException("null scope names are not allowed.");
}
if (names.length == 0) {
throw new IllegalArgumentException("Minimally, one scope name is required.");
}
ScopeNode lastScope = null;
ScopeNode previousScope = (ScopeNode) openScope(names[0], true);
for (int i = 1; i < names.length; i++) {
lastScope = (ScopeNode) openScope(names[i], false);
lastScope = previousScope.addChild(lastScope);
previousScope = lastScope;
}
return previousScope;
} } | public class class_name {
public static Scope openScopes(Object... names) {
if (names == null) {
throw new IllegalArgumentException("null scope names are not allowed.");
}
if (names.length == 0) {
throw new IllegalArgumentException("Minimally, one scope name is required.");
}
ScopeNode lastScope = null;
ScopeNode previousScope = (ScopeNode) openScope(names[0], true);
for (int i = 1; i < names.length; i++) {
lastScope = (ScopeNode) openScope(names[i], false); // depends on control dependency: [for], data = [i]
lastScope = previousScope.addChild(lastScope); // depends on control dependency: [for], data = [none]
previousScope = lastScope; // depends on control dependency: [for], data = [none]
}
return previousScope;
} } |
public class class_name {
@Override
public DurationFormatterFactory setLocale(String localeName) {
if (!localeName.equals(this.localeName)) {
this.localeName = localeName;
if (builder != null) {
builder = builder.withLocale(localeName);
}
if (formatter != null) {
formatter = formatter.withLocale(localeName);
}
reset();
}
return this;
} } | public class class_name {
@Override
public DurationFormatterFactory setLocale(String localeName) {
if (!localeName.equals(this.localeName)) {
this.localeName = localeName; // depends on control dependency: [if], data = [none]
if (builder != null) {
builder = builder.withLocale(localeName); // depends on control dependency: [if], data = [none]
}
if (formatter != null) {
formatter = formatter.withLocale(localeName); // depends on control dependency: [if], data = [none]
}
reset(); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
protected void drawWithoutTransforms(final Context2D context, double alpha, final BoundingBox bounds)
{
final Attributes attr = getAttributes();
alpha = alpha * attr.getAlpha();
if (alpha <= 0)
{
return;
}
if (context.isSelection())
{
if (dofillBoundsForSelection(context, attr, alpha))
{
return;
}
}
else
{
setAppliedShadow(false);
}
if (prepare(context, attr, alpha))
{
final boolean fill = fill(context, attr, alpha);
stroke(context, attr, alpha, fill);
}
} } | public class class_name {
@Override
protected void drawWithoutTransforms(final Context2D context, double alpha, final BoundingBox bounds)
{
final Attributes attr = getAttributes();
alpha = alpha * attr.getAlpha();
if (alpha <= 0)
{
return; // depends on control dependency: [if], data = [none]
}
if (context.isSelection())
{
if (dofillBoundsForSelection(context, attr, alpha))
{
return; // depends on control dependency: [if], data = [none]
}
}
else
{
setAppliedShadow(false); // depends on control dependency: [if], data = [none]
}
if (prepare(context, attr, alpha))
{
final boolean fill = fill(context, attr, alpha);
stroke(context, attr, alpha, fill); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private <X> X executeLockingMethod(Supplier<X> method) {
try {
return method.get();
} catch (JanusGraphException e) {
if (e.isCausedBy(TemporaryLockingException.class) || e.isCausedBy(PermanentLockingException.class)) {
throw TemporaryWriteException.temporaryLock(e);
} else {
throw GraknServerException.unknown(e);
}
}
} } | public class class_name {
private <X> X executeLockingMethod(Supplier<X> method) {
try {
return method.get(); // depends on control dependency: [try], data = [none]
} catch (JanusGraphException e) {
if (e.isCausedBy(TemporaryLockingException.class) || e.isCausedBy(PermanentLockingException.class)) {
throw TemporaryWriteException.temporaryLock(e);
} else {
throw GraknServerException.unknown(e);
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static AlluxioStatusException fromAlluxioException(AlluxioException ae) {
try {
throw ae;
} catch (AccessControlException e) {
return new PermissionDeniedException(e);
} catch (BlockAlreadyExistsException | FileAlreadyCompletedException
| FileAlreadyExistsException e) {
return new AlreadyExistsException(e);
} catch (BlockDoesNotExistException | FileDoesNotExistException e) {
return new NotFoundException(e);
} catch (BlockInfoException | InvalidFileSizeException | InvalidPathException e) {
return new InvalidArgumentException(e);
} catch (ConnectionFailedException | FailedToCheckpointException
| UfsBlockAccessTokenUnavailableException e) {
return new UnavailableException(e);
} catch (DependencyDoesNotExistException | DirectoryNotEmptyException
| InvalidWorkerStateException e) {
return new FailedPreconditionException(e);
} catch (WorkerOutOfSpaceException e) {
return new ResourceExhaustedException(e);
} catch (AlluxioException e) {
return new UnknownException(e);
}
} } | public class class_name {
public static AlluxioStatusException fromAlluxioException(AlluxioException ae) {
try {
throw ae;
} catch (AccessControlException e) {
return new PermissionDeniedException(e);
} catch (BlockAlreadyExistsException | FileAlreadyCompletedException // depends on control dependency: [catch], data = [none]
| FileAlreadyExistsException e) {
return new AlreadyExistsException(e);
} catch (BlockDoesNotExistException | FileDoesNotExistException e) { // depends on control dependency: [catch], data = [none]
return new NotFoundException(e);
} catch (BlockInfoException | InvalidFileSizeException | InvalidPathException e) { // depends on control dependency: [catch], data = [none]
return new InvalidArgumentException(e);
} catch (ConnectionFailedException | FailedToCheckpointException // depends on control dependency: [catch], data = [none]
| UfsBlockAccessTokenUnavailableException e) {
return new UnavailableException(e);
} catch (DependencyDoesNotExistException | DirectoryNotEmptyException // depends on control dependency: [catch], data = [none]
| InvalidWorkerStateException e) {
return new FailedPreconditionException(e);
} catch (WorkerOutOfSpaceException e) { // depends on control dependency: [catch], data = [none]
return new ResourceExhaustedException(e);
} catch (AlluxioException e) { // depends on control dependency: [catch], data = [none]
return new UnknownException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void shutdown() {
synchronized (configCache) {
Set<ClassLoader> allClassLoaders = new HashSet<>();
allClassLoaders.addAll(configCache.keySet()); //create a copy of the keys so that we avoid a ConcurrentModificationException
for (ClassLoader classLoader : allClassLoaders) {
close(classLoader);
}
//caches should be empty now but clear them anyway
configCache.clear();
appClassLoaderMap.clear();
}
} } | public class class_name {
public void shutdown() {
synchronized (configCache) {
Set<ClassLoader> allClassLoaders = new HashSet<>();
allClassLoaders.addAll(configCache.keySet()); //create a copy of the keys so that we avoid a ConcurrentModificationException
for (ClassLoader classLoader : allClassLoaders) {
close(classLoader); // depends on control dependency: [for], data = [classLoader]
}
//caches should be empty now but clear them anyway
configCache.clear();
appClassLoaderMap.clear();
}
} } |
public class class_name {
private void getEncryptedAppBuffer(int requested_size) throws IOException {
final int size = Math.max(getConnLink().getPacketBufferSize(), requested_size);
synchronized (closeSync) {
if (closeCalled) {
IOException up = new IOException("Operation failed due to connection close detected");
throw up;
}
if (null != this.encryptedAppBuffer) {
if (size <= this.encryptedAppBuffer.capacity()) {
// current buffer exists and is big enough
this.encryptedAppBuffer.clear();
return;
}
// exists but is too small
this.encryptedAppBuffer.release();
this.encryptedAppBuffer = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Allocating encryptedAppBuffer, size=" + size);
}
// Allocate the encrypted data buffer
this.encryptedAppBuffer = SSLUtils.allocateByteBuffer(
size, getConfig().getEncryptBuffersDirect());
}
} } | public class class_name {
private void getEncryptedAppBuffer(int requested_size) throws IOException {
final int size = Math.max(getConnLink().getPacketBufferSize(), requested_size);
synchronized (closeSync) {
if (closeCalled) {
IOException up = new IOException("Operation failed due to connection close detected");
throw up;
}
if (null != this.encryptedAppBuffer) {
if (size <= this.encryptedAppBuffer.capacity()) {
// current buffer exists and is big enough
this.encryptedAppBuffer.clear(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// exists but is too small
this.encryptedAppBuffer.release(); // depends on control dependency: [if], data = [none]
this.encryptedAppBuffer = null; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Allocating encryptedAppBuffer, size=" + size); // depends on control dependency: [if], data = [none]
}
// Allocate the encrypted data buffer
this.encryptedAppBuffer = SSLUtils.allocateByteBuffer(
size, getConfig().getEncryptBuffersDirect());
}
} } |
public class class_name {
public static Weeks weeksIn(ReadableInterval interval) {
if (interval == null) {
return Weeks.ZERO;
}
int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.weeks());
return Weeks.weeks(amount);
} } | public class class_name {
public static Weeks weeksIn(ReadableInterval interval) {
if (interval == null) {
return Weeks.ZERO; // depends on control dependency: [if], data = [none]
}
int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.weeks());
return Weeks.weeks(amount);
} } |
public class class_name {
@SneakyThrows
protected SignatureSigningParameters buildSignatureSigningParameters(final RoleDescriptor descriptor,
final SamlRegisteredService service) {
val criteria = new CriteriaSet();
val signatureSigningConfiguration = getSignatureSigningConfiguration(descriptor, service);
criteria.add(new SignatureSigningConfigurationCriterion(signatureSigningConfiguration));
criteria.add(new RoleDescriptorCriterion(descriptor));
val resolver = new SAMLMetadataSignatureSigningParametersResolver();
LOGGER.trace("Resolving signature signing parameters for [{}]", descriptor.getElementQName().getLocalPart());
val params = resolver.resolveSingle(criteria);
if (params != null) {
LOGGER.trace("Created signature signing parameters."
+ "\nSignature algorithm: [{}]"
+ "\nSignature canonicalization algorithm: [{}]"
+ "\nSignature reference digest methods: [{}]",
params.getSignatureAlgorithm(),
params.getSignatureCanonicalizationAlgorithm(),
params.getSignatureReferenceDigestMethod());
} else {
LOGGER.warn("Unable to resolve SignatureSigningParameters, response signing will fail."
+ " Make sure domain names in IDP metadata URLs and certificates match CAS domain name");
}
return params;
} } | public class class_name {
@SneakyThrows
protected SignatureSigningParameters buildSignatureSigningParameters(final RoleDescriptor descriptor,
final SamlRegisteredService service) {
val criteria = new CriteriaSet();
val signatureSigningConfiguration = getSignatureSigningConfiguration(descriptor, service);
criteria.add(new SignatureSigningConfigurationCriterion(signatureSigningConfiguration));
criteria.add(new RoleDescriptorCriterion(descriptor));
val resolver = new SAMLMetadataSignatureSigningParametersResolver();
LOGGER.trace("Resolving signature signing parameters for [{}]", descriptor.getElementQName().getLocalPart());
val params = resolver.resolveSingle(criteria);
if (params != null) {
LOGGER.trace("Created signature signing parameters."
+ "\nSignature algorithm: [{}]"
+ "\nSignature canonicalization algorithm: [{}]"
+ "\nSignature reference digest methods: [{}]",
params.getSignatureAlgorithm(),
params.getSignatureCanonicalizationAlgorithm(),
params.getSignatureReferenceDigestMethod()); // depends on control dependency: [if], data = [none]
} else {
LOGGER.warn("Unable to resolve SignatureSigningParameters, response signing will fail."
+ " Make sure domain names in IDP metadata URLs and certificates match CAS domain name"); // depends on control dependency: [if], data = [none]
}
return params;
} } |
public class class_name {
public void marshall(PolicyTypeSummary policyTypeSummary, ProtocolMarshaller protocolMarshaller) {
if (policyTypeSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(policyTypeSummary.getType(), TYPE_BINDING);
protocolMarshaller.marshall(policyTypeSummary.getStatus(), STATUS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PolicyTypeSummary policyTypeSummary, ProtocolMarshaller protocolMarshaller) {
if (policyTypeSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(policyTypeSummary.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policyTypeSummary.getStatus(), STATUS_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(CreatePolicyVersionRequest createPolicyVersionRequest, ProtocolMarshaller protocolMarshaller) {
if (createPolicyVersionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createPolicyVersionRequest.getPolicyName(), POLICYNAME_BINDING);
protocolMarshaller.marshall(createPolicyVersionRequest.getPolicyDocument(), POLICYDOCUMENT_BINDING);
protocolMarshaller.marshall(createPolicyVersionRequest.getSetAsDefault(), SETASDEFAULT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreatePolicyVersionRequest createPolicyVersionRequest, ProtocolMarshaller protocolMarshaller) {
if (createPolicyVersionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createPolicyVersionRequest.getPolicyName(), POLICYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createPolicyVersionRequest.getPolicyDocument(), POLICYDOCUMENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createPolicyVersionRequest.getSetAsDefault(), SETASDEFAULT_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 SIMPIterator getRemoteBrowserReceiverIterator()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getRemoteBrowserReceiverIterator");
AnycastOutputHandler aoh = destinationHandler.getAnycastOutputHandler();
// Get the hashtable of all the browserSessions that are currently active
Hashtable tableOfBrowserSessions = aoh.getBrowserSessions();
// Get all the keys (AOBrowserSessionKey) that are contained in the table
Set keySet = tableOfBrowserSessions.keySet();
// Create our new list which we will passed to the RemoteBrowserIterator
List<AOBrowserSession> listOfBrowserSessions = new ArrayList<AOBrowserSession>();
// For all the keys in the table
for (Iterator iter = keySet.iterator(); iter.hasNext();)
{
// Get the first key
AOBrowserSessionKey browserSessionKey = (AOBrowserSessionKey) iter.next();
// Get the AOBrowserSession for this key
AOBrowserSession aoBrowserSession = (AOBrowserSession) tableOfBrowserSessions.get(browserSessionKey);
// Add the session to our new list
listOfBrowserSessions.add(aoBrowserSession);
}
RemoteBrowserIterator remoteBrowserIterator = new RemoteBrowserIterator(listOfBrowserSessions.iterator());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getRemoteBrowserReceiverIterator", remoteBrowserIterator);
return remoteBrowserIterator;
} } | public class class_name {
public SIMPIterator getRemoteBrowserReceiverIterator()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getRemoteBrowserReceiverIterator");
AnycastOutputHandler aoh = destinationHandler.getAnycastOutputHandler();
// Get the hashtable of all the browserSessions that are currently active
Hashtable tableOfBrowserSessions = aoh.getBrowserSessions();
// Get all the keys (AOBrowserSessionKey) that are contained in the table
Set keySet = tableOfBrowserSessions.keySet();
// Create our new list which we will passed to the RemoteBrowserIterator
List<AOBrowserSession> listOfBrowserSessions = new ArrayList<AOBrowserSession>();
// For all the keys in the table
for (Iterator iter = keySet.iterator(); iter.hasNext();)
{
// Get the first key
AOBrowserSessionKey browserSessionKey = (AOBrowserSessionKey) iter.next();
// Get the AOBrowserSession for this key
AOBrowserSession aoBrowserSession = (AOBrowserSession) tableOfBrowserSessions.get(browserSessionKey);
// Add the session to our new list
listOfBrowserSessions.add(aoBrowserSession); // depends on control dependency: [for], data = [none]
}
RemoteBrowserIterator remoteBrowserIterator = new RemoteBrowserIterator(listOfBrowserSessions.iterator());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getRemoteBrowserReceiverIterator", remoteBrowserIterator);
return remoteBrowserIterator;
} } |
public class class_name {
private void replaceStringsWithAliases() {
for (Entry<String, StringInfo> entry : stringInfoMap.entrySet()) {
String literal = entry.getKey();
StringInfo info = entry.getValue();
if (shouldReplaceWithAlias(literal, info)) {
for (StringOccurrence occurrence : info.occurrences) {
replaceStringWithAliasName(
occurrence, info.getVariableName(literal), info);
}
}
}
} } | public class class_name {
private void replaceStringsWithAliases() {
for (Entry<String, StringInfo> entry : stringInfoMap.entrySet()) {
String literal = entry.getKey();
StringInfo info = entry.getValue();
if (shouldReplaceWithAlias(literal, info)) {
for (StringOccurrence occurrence : info.occurrences) {
replaceStringWithAliasName(
occurrence, info.getVariableName(literal), info); // depends on control dependency: [for], data = [none]
}
}
}
} } |
public class class_name {
public static void closeEL(Reader r) {
try {
if (r != null) r.close();
}
// catch (AlwaysThrow at) {throw at;}
catch (Throwable e) {
ExceptionUtil.rethrowIfNecessary(e);
}
} } | public class class_name {
public static void closeEL(Reader r) {
try {
if (r != null) r.close();
}
// catch (AlwaysThrow at) {throw at;}
catch (Throwable e) {
ExceptionUtil.rethrowIfNecessary(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void configureHandlerAdapters() {
Map<String, HandlerAdapter> handlerAdapters = this.factory.getBeansOfType(HandlerAdapter.class);
if (handlerAdapters.isEmpty()) {
defineBean(HttpRequestHandlerAdapter.class);
defineBean(RequestMappingHandlerAdapter.class);
}
} } | public class class_name {
private void configureHandlerAdapters() {
Map<String, HandlerAdapter> handlerAdapters = this.factory.getBeansOfType(HandlerAdapter.class);
if (handlerAdapters.isEmpty()) {
defineBean(HttpRequestHandlerAdapter.class); // depends on control dependency: [if], data = [none]
defineBean(RequestMappingHandlerAdapter.class); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void inflate(int menuRes, Menu menu) {
// If we're not dealing with a SupportMenu instance, let super handle
if (!(menu instanceof SupportMenu)) {
super.inflate(menuRes, menu);
return;
}
XmlResourceParser parser = null;
try {
parser = mContext.getResources().getLayout(menuRes);
AttributeSet attrs = Xml.asAttributeSet(parser);
parseMenu(parser, attrs, menu);
} catch (XmlPullParserException e) {
throw new InflateException("Error inflating menu XML", e);
} catch (IOException e) {
throw new InflateException("Error inflating menu XML", e);
} finally {
if (parser != null) parser.close();
}
} } | public class class_name {
@Override
public void inflate(int menuRes, Menu menu) {
// If we're not dealing with a SupportMenu instance, let super handle
if (!(menu instanceof SupportMenu)) {
super.inflate(menuRes, menu); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
XmlResourceParser parser = null;
try {
parser = mContext.getResources().getLayout(menuRes); // depends on control dependency: [try], data = [none]
AttributeSet attrs = Xml.asAttributeSet(parser);
parseMenu(parser, attrs, menu); // depends on control dependency: [try], data = [none]
} catch (XmlPullParserException e) {
throw new InflateException("Error inflating menu XML", e);
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
throw new InflateException("Error inflating menu XML", e);
} finally { // depends on control dependency: [catch], data = [none]
if (parser != null) parser.close();
}
} } |
public class class_name {
public Observable<ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders>> deleteFromTaskWithServiceResponseAsync(String jobId, String taskId, String filePath, Boolean recursive, FileDeleteFromTaskOptions fileDeleteFromTaskOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (jobId == null) {
throw new IllegalArgumentException("Parameter jobId is required and cannot be null.");
}
if (taskId == null) {
throw new IllegalArgumentException("Parameter taskId is required and cannot be null.");
}
if (filePath == null) {
throw new IllegalArgumentException("Parameter filePath is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(fileDeleteFromTaskOptions);
Integer timeout = null;
if (fileDeleteFromTaskOptions != null) {
timeout = fileDeleteFromTaskOptions.timeout();
}
UUID clientRequestId = null;
if (fileDeleteFromTaskOptions != null) {
clientRequestId = fileDeleteFromTaskOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (fileDeleteFromTaskOptions != null) {
returnClientRequestId = fileDeleteFromTaskOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (fileDeleteFromTaskOptions != null) {
ocpDate = fileDeleteFromTaskOptions.ocpDate();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.deleteFromTask(jobId, taskId, filePath, recursive, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders> clientResponse = deleteFromTaskDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders>> deleteFromTaskWithServiceResponseAsync(String jobId, String taskId, String filePath, Boolean recursive, FileDeleteFromTaskOptions fileDeleteFromTaskOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (jobId == null) {
throw new IllegalArgumentException("Parameter jobId is required and cannot be null.");
}
if (taskId == null) {
throw new IllegalArgumentException("Parameter taskId is required and cannot be null.");
}
if (filePath == null) {
throw new IllegalArgumentException("Parameter filePath is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(fileDeleteFromTaskOptions);
Integer timeout = null;
if (fileDeleteFromTaskOptions != null) {
timeout = fileDeleteFromTaskOptions.timeout(); // depends on control dependency: [if], data = [none]
}
UUID clientRequestId = null;
if (fileDeleteFromTaskOptions != null) {
clientRequestId = fileDeleteFromTaskOptions.clientRequestId(); // depends on control dependency: [if], data = [none]
}
Boolean returnClientRequestId = null;
if (fileDeleteFromTaskOptions != null) {
returnClientRequestId = fileDeleteFromTaskOptions.returnClientRequestId(); // depends on control dependency: [if], data = [none]
}
DateTime ocpDate = null;
if (fileDeleteFromTaskOptions != null) {
ocpDate = fileDeleteFromTaskOptions.ocpDate(); // depends on control dependency: [if], data = [none]
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
return service.deleteFromTask(jobId, taskId, filePath, recursive, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders> clientResponse = deleteFromTaskDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public Object negate(Object val) {
if (val instanceof Integer) {
int valueAsInt = ((Integer) val).intValue();
return Integer.valueOf(-valueAsInt);
}
else if (val instanceof Double) {
double valueAsDouble = ((Double) val).doubleValue();
return new Double(-valueAsDouble);
}
else if (val instanceof Long) {
long valueAsLong = -((Long) val).longValue();
return Long.valueOf(valueAsLong);
}
else if (val instanceof BigDecimal) {
BigDecimal valueAsBigD = (BigDecimal) val;
return valueAsBigD.negate();
}
else if (val instanceof BigInteger) {
BigInteger valueAsBigI = (BigInteger) val;
return valueAsBigI.negate();
}
else if (val instanceof Float) {
float valueAsFloat = ((Float) val).floatValue();
return new Float(-valueAsFloat);
}
else if (val instanceof Short) {
short valueAsShort = ((Short) val).shortValue();
return Short.valueOf((short) -valueAsShort);
}
else if (val instanceof Byte) {
byte valueAsByte = ((Byte) val).byteValue();
return Byte.valueOf((byte) -valueAsByte);
}
else if (val instanceof Boolean) {
return ((Boolean) val).booleanValue() ? Boolean.FALSE : Boolean.TRUE;
}
throw new ArithmeticException("Object negation:(" + val + ")");
} } | public class class_name {
public Object negate(Object val) {
if (val instanceof Integer) {
int valueAsInt = ((Integer) val).intValue();
return Integer.valueOf(-valueAsInt); // depends on control dependency: [if], data = [none]
}
else if (val instanceof Double) {
double valueAsDouble = ((Double) val).doubleValue();
return new Double(-valueAsDouble); // depends on control dependency: [if], data = [none]
}
else if (val instanceof Long) {
long valueAsLong = -((Long) val).longValue();
return Long.valueOf(valueAsLong); // depends on control dependency: [if], data = [none]
}
else if (val instanceof BigDecimal) {
BigDecimal valueAsBigD = (BigDecimal) val;
return valueAsBigD.negate(); // depends on control dependency: [if], data = [none]
}
else if (val instanceof BigInteger) {
BigInteger valueAsBigI = (BigInteger) val;
return valueAsBigI.negate(); // depends on control dependency: [if], data = [none]
}
else if (val instanceof Float) {
float valueAsFloat = ((Float) val).floatValue();
return new Float(-valueAsFloat); // depends on control dependency: [if], data = [none]
}
else if (val instanceof Short) {
short valueAsShort = ((Short) val).shortValue();
return Short.valueOf((short) -valueAsShort); // depends on control dependency: [if], data = [none]
}
else if (val instanceof Byte) {
byte valueAsByte = ((Byte) val).byteValue();
return Byte.valueOf((byte) -valueAsByte); // depends on control dependency: [if], data = [none]
}
else if (val instanceof Boolean) {
return ((Boolean) val).booleanValue() ? Boolean.FALSE : Boolean.TRUE; // depends on control dependency: [if], data = [none]
}
throw new ArithmeticException("Object negation:(" + val + ")");
} } |
public class class_name {
public Collection<Token> tokenize(String text)
{
Collection<Token> tokens = new ArrayList<Token>();
Collection<Emit> collectedEmits = parseText(text);
// 下面是最长分词的关键
IntervalTree intervalTree = new IntervalTree((List<Intervalable>) (List<?>) collectedEmits);
intervalTree.removeOverlaps((List<Intervalable>) (List<?>) collectedEmits);
// 移除结束
int lastCollectedPosition = -1;
for (Emit emit : collectedEmits)
{
if (emit.getStart() - lastCollectedPosition > 1)
{
tokens.add(createFragment(emit, text, lastCollectedPosition));
}
tokens.add(createMatch(emit, text));
lastCollectedPosition = emit.getEnd();
}
if (text.length() - lastCollectedPosition > 1)
{
tokens.add(createFragment(null, text, lastCollectedPosition));
}
return tokens;
} } | public class class_name {
public Collection<Token> tokenize(String text)
{
Collection<Token> tokens = new ArrayList<Token>();
Collection<Emit> collectedEmits = parseText(text);
// 下面是最长分词的关键
IntervalTree intervalTree = new IntervalTree((List<Intervalable>) (List<?>) collectedEmits);
intervalTree.removeOverlaps((List<Intervalable>) (List<?>) collectedEmits);
// 移除结束
int lastCollectedPosition = -1;
for (Emit emit : collectedEmits)
{
if (emit.getStart() - lastCollectedPosition > 1)
{
tokens.add(createFragment(emit, text, lastCollectedPosition)); // depends on control dependency: [if], data = [none]
}
tokens.add(createMatch(emit, text)); // depends on control dependency: [for], data = [emit]
lastCollectedPosition = emit.getEnd(); // depends on control dependency: [for], data = [emit]
}
if (text.length() - lastCollectedPosition > 1)
{
tokens.add(createFragment(null, text, lastCollectedPosition)); // depends on control dependency: [if], data = [none]
}
return tokens;
} } |
public class class_name {
public IPv6AddressPool deAllocate(final IPv6Network toDeAllocate)
{
if (!contains(toDeAllocate))
{
throw new IllegalArgumentException(
"Network to de-allocate[" + toDeAllocate + "] is not contained in this allocatable range [" + this + "]");
}
// find ranges just in front or after the network to deallocate. These are the ranges to merge with to prevent fragmentation.
final IPv6AddressRange freeRangeBeforeNetwork = findFreeRangeBefore(toDeAllocate);
final IPv6AddressRange freeRangeAfterNetwork = findFreeRangeAfter(toDeAllocate);
final TreeSet<IPv6AddressRange> newFreeRanges = new TreeSet<IPv6AddressRange>(this.freeRanges);
if ((freeRangeBeforeNetwork == null) && (freeRangeAfterNetwork == null))
{
// nothing to "defragment"
newFreeRanges.add(toDeAllocate);
}
else
{
if ((freeRangeBeforeNetwork != null) && (freeRangeAfterNetwork != null))
{
// merge two existing ranges
newFreeRanges.remove(freeRangeBeforeNetwork);
newFreeRanges.remove(freeRangeAfterNetwork);
newFreeRanges.add(IPv6AddressRange
.fromFirstAndLast(freeRangeBeforeNetwork.getFirst(), freeRangeAfterNetwork.getLast()));
}
else if (freeRangeBeforeNetwork != null)
{
// append
newFreeRanges.remove(freeRangeBeforeNetwork);
newFreeRanges.add(IPv6AddressRange.fromFirstAndLast(freeRangeBeforeNetwork.getFirst(), toDeAllocate.getLast()));
}
else /*if (freeRangeAfterNetwork != null)*/
{
// prepend
newFreeRanges.remove(freeRangeAfterNetwork);
newFreeRanges.add(IPv6AddressRange.fromFirstAndLast(toDeAllocate.getFirst(), freeRangeAfterNetwork.getLast()));
}
}
return new IPv6AddressPool(underlyingRange, allocationSubnetSize, newFreeRanges, getLastAllocated());
} } | public class class_name {
public IPv6AddressPool deAllocate(final IPv6Network toDeAllocate)
{
if (!contains(toDeAllocate))
{
throw new IllegalArgumentException(
"Network to de-allocate[" + toDeAllocate + "] is not contained in this allocatable range [" + this + "]");
}
// find ranges just in front or after the network to deallocate. These are the ranges to merge with to prevent fragmentation.
final IPv6AddressRange freeRangeBeforeNetwork = findFreeRangeBefore(toDeAllocate);
final IPv6AddressRange freeRangeAfterNetwork = findFreeRangeAfter(toDeAllocate);
final TreeSet<IPv6AddressRange> newFreeRanges = new TreeSet<IPv6AddressRange>(this.freeRanges);
if ((freeRangeBeforeNetwork == null) && (freeRangeAfterNetwork == null))
{
// nothing to "defragment"
newFreeRanges.add(toDeAllocate); // depends on control dependency: [if], data = [none]
}
else
{
if ((freeRangeBeforeNetwork != null) && (freeRangeAfterNetwork != null))
{
// merge two existing ranges
newFreeRanges.remove(freeRangeBeforeNetwork); // depends on control dependency: [if], data = [none]
newFreeRanges.remove(freeRangeAfterNetwork); // depends on control dependency: [if], data = [none]
newFreeRanges.add(IPv6AddressRange
.fromFirstAndLast(freeRangeBeforeNetwork.getFirst(), freeRangeAfterNetwork.getLast())); // depends on control dependency: [if], data = [none]
}
else if (freeRangeBeforeNetwork != null)
{
// append
newFreeRanges.remove(freeRangeBeforeNetwork); // depends on control dependency: [if], data = [(freeRangeBeforeNetwork]
newFreeRanges.add(IPv6AddressRange.fromFirstAndLast(freeRangeBeforeNetwork.getFirst(), toDeAllocate.getLast())); // depends on control dependency: [if], data = [(freeRangeBeforeNetwork]
}
else /*if (freeRangeAfterNetwork != null)*/
{
// prepend
newFreeRanges.remove(freeRangeAfterNetwork); // depends on control dependency: [if], data = [none]
newFreeRanges.add(IPv6AddressRange.fromFirstAndLast(toDeAllocate.getFirst(), freeRangeAfterNetwork.getLast())); // depends on control dependency: [if], data = [none]
}
}
return new IPv6AddressPool(underlyingRange, allocationSubnetSize, newFreeRanges, getLastAllocated());
} } |
public class class_name {
public static base_responses unset(nitro_service client, String keyname[], String args[]) throws Exception {
base_responses result = null;
if (keyname != null && keyname.length > 0) {
dnskey unsetresources[] = new dnskey[keyname.length];
for (int i=0;i<keyname.length;i++){
unsetresources[i] = new dnskey();
unsetresources[i].keyname = keyname[i];
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} } | public class class_name {
public static base_responses unset(nitro_service client, String keyname[], String args[]) throws Exception {
base_responses result = null;
if (keyname != null && keyname.length > 0) {
dnskey unsetresources[] = new dnskey[keyname.length];
for (int i=0;i<keyname.length;i++){
unsetresources[i] = new dnskey(); // depends on control dependency: [for], data = [i]
unsetresources[i].keyname = keyname[i]; // depends on control dependency: [for], data = [i]
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} } |
public class class_name {
public static String fieldNodeFormat(Collection<FieldNode> fieldNodes) {
StringBuilder s = new StringBuilder();
int n = 0;
for (FieldNode fieldNode : fieldNodes) {
if (n > 0) {
s.append(" ");
}
s.append("'").append(fieldNodeFormat(fieldNode)).append("'");
n++;
}
return s.toString();
} } | public class class_name {
public static String fieldNodeFormat(Collection<FieldNode> fieldNodes) {
StringBuilder s = new StringBuilder();
int n = 0;
for (FieldNode fieldNode : fieldNodes) {
if (n > 0) {
s.append(" "); // depends on control dependency: [if], data = [none]
}
s.append("'").append(fieldNodeFormat(fieldNode)).append("'"); // depends on control dependency: [for], data = [fieldNode]
n++; // depends on control dependency: [for], data = [none]
}
return s.toString();
} } |
public class class_name {
public IonType next()
{
if (has_next_helper() == false) {
return null;
}
int new_state;
switch (_current_state)
{
case S_BOF:
new_state = S_STRUCT;
break;
case S_STRUCT:
new_state = S_EOF;
break;
case S_IN_STRUCT:
new_state = stateFirstInStruct();
loadStateData(new_state);
break;
case S_NAME:
assert(hasVersion());
new_state = S_VERSION;
loadStateData(new_state);
break;
case S_VERSION:
if (hasMaxId()) {
new_state = S_MAX_ID;
loadStateData(new_state);
}
else {
new_state = stateFollowingMaxId();
}
break;
case S_MAX_ID:
new_state = stateFollowingMaxId();
break;
case S_IMPORT_LIST:
new_state = this.stateFollowingImportList(Op.NEXT);
break;
case S_IN_IMPORTS:
case S_IMPORT_STRUCT:
// we only need to get the import list once, which we
// do as we step into the import list, so it should
// be waiting for us here.
assert(_import_iterator != null);
new_state = nextImport();
break;
case S_IN_IMPORT_STRUCT:
// shared tables have to have a name
new_state = S_IMPORT_NAME;
loadStateData(new_state);
break;
case S_IMPORT_NAME:
// shared tables have to have a version
new_state = S_IMPORT_VERSION;
loadStateData(new_state);
break;
case S_IMPORT_VERSION:
// and they also always have a max id - so we set up
// for it
new_state = S_IMPORT_MAX_ID;
loadStateData(new_state);
break;
case S_IMPORT_MAX_ID:
new_state = S_IMPORT_STRUCT_CLOSE;
break;
case S_IMPORT_STRUCT_CLOSE:
// no change here - we just bump up against this local eof
new_state = S_IMPORT_STRUCT_CLOSE;
break;
case S_IMPORT_LIST_CLOSE:
// no change here - we just bump up against this local eof
new_state = S_IMPORT_LIST_CLOSE;
break;
case S_AFTER_IMPORT_LIST:
assert(_symbol_table.getImportedMaxId() < _maxId);
new_state = S_SYMBOL_LIST;
break;
case S_SYMBOL_LIST:
assert(_symbol_table.getImportedMaxId() < _maxId);
new_state = stateFollowingLocalSymbols();
break;
case S_IN_SYMBOLS:
// we have some symbols - so we'll set up to read them,
// which we *have* to do once and *need* to do only once.
assert(_local_symbols != null);
// since we only get into the symbol list if
// there are some symbols - our next state
// is at the first symbol
assert(_local_symbols.hasNext() == true);
// so we just fall through to and let the S_SYMBOL
// state do it's thing (which it will do every time
// we move to the next symbol)
case S_SYMBOL:
if (_local_symbols.hasNext())
{
_string_value = _local_symbols.next();
// null means this symbol isn't defined
new_state = S_SYMBOL;
}
else {
new_state = S_SYMBOL_LIST_CLOSE;
}
break;
case S_SYMBOL_LIST_CLOSE:
// no change here - we just bump up against this local eof
new_state = S_SYMBOL_LIST_CLOSE;
break;
case S_STRUCT_CLOSE:
// no change here - we just bump up against this local eof
new_state = S_STRUCT_CLOSE;
break;
case S_EOF:
new_state = S_EOF;
break;
default:
throwUnrecognizedState(_current_state);
new_state = -1;
break;
}
_current_state = new_state;
return stateType(_current_state);
} } | public class class_name {
public IonType next()
{
if (has_next_helper() == false) {
return null; // depends on control dependency: [if], data = [none]
}
int new_state;
switch (_current_state)
{
case S_BOF:
new_state = S_STRUCT;
break;
case S_STRUCT:
new_state = S_EOF;
break;
case S_IN_STRUCT:
new_state = stateFirstInStruct();
loadStateData(new_state);
break;
case S_NAME:
assert(hasVersion());
new_state = S_VERSION;
loadStateData(new_state);
break;
case S_VERSION:
if (hasMaxId()) {
new_state = S_MAX_ID; // depends on control dependency: [if], data = [none]
loadStateData(new_state); // depends on control dependency: [if], data = [none]
}
else {
new_state = stateFollowingMaxId(); // depends on control dependency: [if], data = [none]
}
break;
case S_MAX_ID:
new_state = stateFollowingMaxId();
break;
case S_IMPORT_LIST:
new_state = this.stateFollowingImportList(Op.NEXT);
break;
case S_IN_IMPORTS:
case S_IMPORT_STRUCT:
// we only need to get the import list once, which we
// do as we step into the import list, so it should
// be waiting for us here.
assert(_import_iterator != null);
new_state = nextImport();
break;
case S_IN_IMPORT_STRUCT:
// shared tables have to have a name
new_state = S_IMPORT_NAME;
loadStateData(new_state);
break;
case S_IMPORT_NAME:
// shared tables have to have a version
new_state = S_IMPORT_VERSION;
loadStateData(new_state);
break;
case S_IMPORT_VERSION:
// and they also always have a max id - so we set up
// for it
new_state = S_IMPORT_MAX_ID;
loadStateData(new_state);
break;
case S_IMPORT_MAX_ID:
new_state = S_IMPORT_STRUCT_CLOSE;
break;
case S_IMPORT_STRUCT_CLOSE:
// no change here - we just bump up against this local eof
new_state = S_IMPORT_STRUCT_CLOSE;
break;
case S_IMPORT_LIST_CLOSE:
// no change here - we just bump up against this local eof
new_state = S_IMPORT_LIST_CLOSE;
break;
case S_AFTER_IMPORT_LIST:
assert(_symbol_table.getImportedMaxId() < _maxId);
new_state = S_SYMBOL_LIST;
break;
case S_SYMBOL_LIST:
assert(_symbol_table.getImportedMaxId() < _maxId);
new_state = stateFollowingLocalSymbols();
break;
case S_IN_SYMBOLS:
// we have some symbols - so we'll set up to read them,
// which we *have* to do once and *need* to do only once.
assert(_local_symbols != null);
// since we only get into the symbol list if
// there are some symbols - our next state
// is at the first symbol
assert(_local_symbols.hasNext() == true);
// so we just fall through to and let the S_SYMBOL
// state do it's thing (which it will do every time
// we move to the next symbol)
case S_SYMBOL:
if (_local_symbols.hasNext())
{
_string_value = _local_symbols.next(); // depends on control dependency: [if], data = [none]
// null means this symbol isn't defined
new_state = S_SYMBOL; // depends on control dependency: [if], data = [none]
}
else {
new_state = S_SYMBOL_LIST_CLOSE; // depends on control dependency: [if], data = [none]
}
break;
case S_SYMBOL_LIST_CLOSE:
// no change here - we just bump up against this local eof
new_state = S_SYMBOL_LIST_CLOSE;
break;
case S_STRUCT_CLOSE:
// no change here - we just bump up against this local eof
new_state = S_STRUCT_CLOSE;
break;
case S_EOF:
new_state = S_EOF;
break;
default:
throwUnrecognizedState(_current_state);
new_state = -1;
break;
}
_current_state = new_state;
return stateType(_current_state);
} } |
public class class_name {
@Override
protected ChangeSet getFilteredChangeSet(ChangeSet changeSet) {
changeSet = super.getFilteredChangeSet(changeSet);
if (changeSet != null && !changeSet.isEmpty() && xmlFlatteningEnabled && reindexItemsOnComponentUpdates) {
List<String> createdFiles = changeSet.getCreatedFiles();
List<String> updatedFiles = changeSet.getUpdatedFiles();
List<String> deletedFiles = changeSet.getDeletedFiles();
List<String> newUpdatedFiles = new ArrayList<>(updatedFiles);
if (CollectionUtils.isNotEmpty(createdFiles)) {
for (String path : createdFiles) {
if (isComponent(path)) {
addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles);
}
}
}
if (CollectionUtils.isNotEmpty(updatedFiles)) {
for (String path : updatedFiles) {
if (isComponent(path)) {
addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles);
}
}
}
if (CollectionUtils.isNotEmpty(deletedFiles)) {
for (String path : deletedFiles) {
if (isComponent(path)) {
addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles);
}
}
}
return new ChangeSet(createdFiles, newUpdatedFiles, deletedFiles);
} else {
return changeSet;
}
} } | public class class_name {
@Override
protected ChangeSet getFilteredChangeSet(ChangeSet changeSet) {
changeSet = super.getFilteredChangeSet(changeSet);
if (changeSet != null && !changeSet.isEmpty() && xmlFlatteningEnabled && reindexItemsOnComponentUpdates) {
List<String> createdFiles = changeSet.getCreatedFiles();
List<String> updatedFiles = changeSet.getUpdatedFiles();
List<String> deletedFiles = changeSet.getDeletedFiles();
List<String> newUpdatedFiles = new ArrayList<>(updatedFiles);
if (CollectionUtils.isNotEmpty(createdFiles)) {
for (String path : createdFiles) {
if (isComponent(path)) {
addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles); // depends on control dependency: [if], data = [none]
}
}
}
if (CollectionUtils.isNotEmpty(updatedFiles)) {
for (String path : updatedFiles) {
if (isComponent(path)) {
addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles); // depends on control dependency: [if], data = [none]
}
}
}
if (CollectionUtils.isNotEmpty(deletedFiles)) {
for (String path : deletedFiles) {
if (isComponent(path)) {
addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles); // depends on control dependency: [if], data = [none]
}
}
}
return new ChangeSet(createdFiles, newUpdatedFiles, deletedFiles); // depends on control dependency: [if], data = [none]
} else {
return changeSet; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static
private <E> List<E> toJavaList(List<E> values, int rows, int columns){
List<E> result = new ArrayList<>(values.size());
for(int i = 0; i < values.size(); i++){
int row = i / columns;
int column = i % columns;
E value = values.get((column * rows) + row);
result.add(value);
}
return result;
} } | public class class_name {
static
private <E> List<E> toJavaList(List<E> values, int rows, int columns){
List<E> result = new ArrayList<>(values.size());
for(int i = 0; i < values.size(); i++){
int row = i / columns;
int column = i % columns;
E value = values.get((column * rows) + row);
result.add(value); // depends on control dependency: [for], data = [none]
}
return result;
} } |
public class class_name {
public RowView getRowView(View child) {
ViewParent parent = child.getParent();
if (parent instanceof RowView) {
return (RowView) parent;
}
return null;
} } | public class class_name {
public RowView getRowView(View child) {
ViewParent parent = child.getParent();
if (parent instanceof RowView) {
return (RowView) parent; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public Boolean isEventNotificationPropertySet() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isEventNotificationPropertySet", this);
Boolean enabled = null; // enabled can be null/TRUE/FALSE, ie three-way
// Test whether custom properties contain a notification prop
if (customProperties
.containsKey(JsConstants.SIB_EVENT_NOTIFICATION_KEY)) {
String value = customProperties
.getProperty(JsConstants.SIB_EVENT_NOTIFICATION_KEY);
if (value != null) {
if (value
.equals(JsConstants.SIB_EVENT_NOTIFICATION_VALUE_ENABLED)) {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isDebugEnabled())
SibTr.debug(tc,
"Event Notification is enabled at the Bus");
enabled = Boolean.TRUE;
} else if (value
.equals(JsConstants.SIB_EVENT_NOTIFICATION_VALUE_DISABLED)) {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isDebugEnabled())
SibTr.debug(tc,
"Event Notification is disabled at the Bus");
enabled = Boolean.FALSE;
} else {
// Value MIS set, treat as NOT set
if (TraceComponent.isAnyTracingEnabled()
&& tc.isDebugEnabled())
SibTr.debug(tc,
"Event Notification Bus property set to: "
+ value);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isEventNotificationPropertySet", enabled);
return enabled;
} } | public class class_name {
public Boolean isEventNotificationPropertySet() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isEventNotificationPropertySet", this);
Boolean enabled = null; // enabled can be null/TRUE/FALSE, ie three-way
// Test whether custom properties contain a notification prop
if (customProperties
.containsKey(JsConstants.SIB_EVENT_NOTIFICATION_KEY)) {
String value = customProperties
.getProperty(JsConstants.SIB_EVENT_NOTIFICATION_KEY);
if (value != null) {
if (value
.equals(JsConstants.SIB_EVENT_NOTIFICATION_VALUE_ENABLED)) {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isDebugEnabled())
SibTr.debug(tc,
"Event Notification is enabled at the Bus");
enabled = Boolean.TRUE; // depends on control dependency: [if], data = [none]
} else if (value
.equals(JsConstants.SIB_EVENT_NOTIFICATION_VALUE_DISABLED)) {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isDebugEnabled())
SibTr.debug(tc,
"Event Notification is disabled at the Bus");
enabled = Boolean.FALSE; // depends on control dependency: [if], data = [none]
} else {
// Value MIS set, treat as NOT set
if (TraceComponent.isAnyTracingEnabled()
&& tc.isDebugEnabled())
SibTr.debug(tc,
"Event Notification Bus property set to: "
+ value);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isEventNotificationPropertySet", enabled);
return enabled;
} } |
public class class_name {
public static Annotation getAnnotation(Properties attributes) {
float llx = 0, lly = 0, urx = 0, ury = 0;
String value;
value = attributes.getProperty(ElementTags.LLX);
if (value != null) {
llx = Float.parseFloat(value + "f");
}
value = attributes.getProperty(ElementTags.LLY);
if (value != null) {
lly = Float.parseFloat(value + "f");
}
value = attributes.getProperty(ElementTags.URX);
if (value != null) {
urx = Float.parseFloat(value + "f");
}
value = attributes.getProperty(ElementTags.URY);
if (value != null) {
ury = Float.parseFloat(value + "f");
}
String title = attributes.getProperty(ElementTags.TITLE);
String text = attributes.getProperty(ElementTags.CONTENT);
if (title != null || text != null) {
return new Annotation(title, text, llx, lly, urx, ury);
}
value = attributes.getProperty(ElementTags.URL);
if (value != null) {
return new Annotation(llx, lly, urx, ury, value);
}
value = attributes.getProperty(ElementTags.NAMED);
if (value != null) {
return new Annotation(llx, lly, urx, ury, Integer.parseInt(value));
}
String file = attributes.getProperty(ElementTags.FILE);
String destination = attributes.getProperty(ElementTags.DESTINATION);
String page = (String) attributes.remove(ElementTags.PAGE);
if (file != null) {
if (destination != null) {
return new Annotation(llx, lly, urx, ury, file, destination);
}
if (page != null) {
return new Annotation(llx, lly, urx, ury, file, Integer
.parseInt(page));
}
}
return new Annotation("", "", llx, lly, urx, ury);
} } | public class class_name {
public static Annotation getAnnotation(Properties attributes) {
float llx = 0, lly = 0, urx = 0, ury = 0;
String value;
value = attributes.getProperty(ElementTags.LLX);
if (value != null) {
llx = Float.parseFloat(value + "f"); // depends on control dependency: [if], data = [(value]
}
value = attributes.getProperty(ElementTags.LLY);
if (value != null) {
lly = Float.parseFloat(value + "f"); // depends on control dependency: [if], data = [(value]
}
value = attributes.getProperty(ElementTags.URX);
if (value != null) {
urx = Float.parseFloat(value + "f"); // depends on control dependency: [if], data = [(value]
}
value = attributes.getProperty(ElementTags.URY);
if (value != null) {
ury = Float.parseFloat(value + "f"); // depends on control dependency: [if], data = [(value]
}
String title = attributes.getProperty(ElementTags.TITLE);
String text = attributes.getProperty(ElementTags.CONTENT);
if (title != null || text != null) {
return new Annotation(title, text, llx, lly, urx, ury); // depends on control dependency: [if], data = [(title]
}
value = attributes.getProperty(ElementTags.URL);
if (value != null) {
return new Annotation(llx, lly, urx, ury, value); // depends on control dependency: [if], data = [none]
}
value = attributes.getProperty(ElementTags.NAMED);
if (value != null) {
return new Annotation(llx, lly, urx, ury, Integer.parseInt(value)); // depends on control dependency: [if], data = [(value]
}
String file = attributes.getProperty(ElementTags.FILE);
String destination = attributes.getProperty(ElementTags.DESTINATION);
String page = (String) attributes.remove(ElementTags.PAGE);
if (file != null) {
if (destination != null) {
return new Annotation(llx, lly, urx, ury, file, destination); // depends on control dependency: [if], data = [none]
}
if (page != null) {
return new Annotation(llx, lly, urx, ury, file, Integer
.parseInt(page)); // depends on control dependency: [if], data = [none]
}
}
return new Annotation("", "", llx, lly, urx, ury);
} } |
public class class_name {
private void waitUntilPodIsReady(String podName, int nAwaitTimeout, final Logger log) throws InterruptedException {
final CountDownLatch readyLatch = new CountDownLatch(1);
try (Watch watch = client.pods().withName(podName).watch(new Watcher<Pod>() {
@Override
public void eventReceived(Action action, Pod aPod) {
if(KubernetesHelper.isPodReady(aPod)) {
readyLatch.countDown();
}
}
@Override
public void onClose(KubernetesClientException e) {
// Ignore
}
})) {
readyLatch.await(nAwaitTimeout, TimeUnit.SECONDS);
} catch (KubernetesClientException | InterruptedException e) {
log.error("Could not watch pod", e);
}
} } | public class class_name {
private void waitUntilPodIsReady(String podName, int nAwaitTimeout, final Logger log) throws InterruptedException {
final CountDownLatch readyLatch = new CountDownLatch(1);
try (Watch watch = client.pods().withName(podName).watch(new Watcher<Pod>() {
@Override
public void eventReceived(Action action, Pod aPod) {
if(KubernetesHelper.isPodReady(aPod)) {
readyLatch.countDown(); // depends on control dependency: [if], data = [none]
}
}
@Override
public void onClose(KubernetesClientException e) {
// Ignore
}
})) {
readyLatch.await(nAwaitTimeout, TimeUnit.SECONDS);
} catch (KubernetesClientException | InterruptedException e) {
log.error("Could not watch pod", e);
}
} } |
public class class_name {
private static String byteToHexString(byte[] bytes)
{
final char[] hexArray = "0123456789ABCDEF".toCharArray();
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++)
{
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = hexArray[v & 0x0F];
}
return new String(hexChars);
} } | public class class_name {
private static String byteToHexString(byte[] bytes)
{
final char[] hexArray = "0123456789ABCDEF".toCharArray();
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++)
{
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4]; // depends on control dependency: [for], data = [j]
hexChars[j * 2 + 1] = hexArray[v & 0x0F]; // depends on control dependency: [for], data = [j]
}
return new String(hexChars);
} } |
public class class_name {
public static int ConstraintCompare(Solution solution1, Solution solution2)
{
double constraints1 = 0;
int constraint_count = solution1.getConstraints().size();
for (int i = 0; i < constraint_count; i++)
{
constraints1 += Math.abs(solution1.getConstraint(i));
}
double constraints2 = 0;
for (int i = 0; i < constraint_count; i++)
{
constraints2 += Math.abs(solution2.getConstraint(i));
}
if ((constraints1 != 0.0) || (constraints2 != 0.0))
{
if (constraints1 == 0.0)
{
return -1;
}
else if (constraints2 == 0.0)
{
return 1;
}
else
{
return Double.compare(constraints1, constraints2);
}
}
else
{
return 0;
}
} } | public class class_name {
public static int ConstraintCompare(Solution solution1, Solution solution2)
{
double constraints1 = 0;
int constraint_count = solution1.getConstraints().size();
for (int i = 0; i < constraint_count; i++)
{
constraints1 += Math.abs(solution1.getConstraint(i)); // depends on control dependency: [for], data = [i]
}
double constraints2 = 0;
for (int i = 0; i < constraint_count; i++)
{
constraints2 += Math.abs(solution2.getConstraint(i)); // depends on control dependency: [for], data = [i]
}
if ((constraints1 != 0.0) || (constraints2 != 0.0))
{
if (constraints1 == 0.0)
{
return -1; // depends on control dependency: [if], data = [none]
}
else if (constraints2 == 0.0)
{
return 1; // depends on control dependency: [if], data = [none]
}
else
{
return Double.compare(constraints1, constraints2); // depends on control dependency: [if], data = [none]
}
}
else
{
return 0; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static boolean isEmptyBlock(Node block) {
if (!block.isBlock()) {
return false;
}
for (Node n = block.getFirstChild(); n != null; n = n.getNext()) {
if (!n.isEmpty()) {
return false;
}
}
return true;
} } | public class class_name {
static boolean isEmptyBlock(Node block) {
if (!block.isBlock()) {
return false; // depends on control dependency: [if], data = [none]
}
for (Node n = block.getFirstChild(); n != null; n = n.getNext()) {
if (!n.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public void onClickDir(@NonNull View view, @NonNull DirViewHolder viewHolder) {
if (isDir(viewHolder.file)) {
goToDir(viewHolder.file);
}
} } | public class class_name {
public void onClickDir(@NonNull View view, @NonNull DirViewHolder viewHolder) {
if (isDir(viewHolder.file)) {
goToDir(viewHolder.file); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void configure() {
LogManager manager = LogManager.getLogManager();
String cname = getClass().getName();
setLevel(manager.getLevelProperty(cname +".level", Level.INFO));
setFilter(manager.getFilterProperty(cname +".filter", null));
setFormatter(manager.getFormatterProperty(cname +".formatter", new SimpleFormatter()));
try {
setEncoding(manager.getStringProperty(cname +".encoding", null));
} catch (Exception ex) {
try {
setEncoding(null);
} catch (Exception ex2) {
// doing a setEncoding with null should always work.
// assert false;
}
}
} } | public class class_name {
private void configure() {
LogManager manager = LogManager.getLogManager();
String cname = getClass().getName();
setLevel(manager.getLevelProperty(cname +".level", Level.INFO));
setFilter(manager.getFilterProperty(cname +".filter", null));
setFormatter(manager.getFormatterProperty(cname +".formatter", new SimpleFormatter()));
try {
setEncoding(manager.getStringProperty(cname +".encoding", null)); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
try {
setEncoding(null); // depends on control dependency: [try], data = [none]
} catch (Exception ex2) {
// doing a setEncoding with null should always work.
// assert false;
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@NonNull
public static View copyViewImage(@NonNull ViewGroup sceneRoot, @NonNull View view, @NonNull View parent) {
Matrix matrix = new Matrix();
matrix.setTranslate(-parent.getScrollX(), -parent.getScrollY());
ViewUtils.transformMatrixToGlobal(view, matrix);
ViewUtils.transformMatrixToLocal(sceneRoot, matrix);
RectF bounds = new RectF(0, 0, view.getWidth(), view.getHeight());
matrix.mapRect(bounds);
int left = Math.round(bounds.left);
int top = Math.round(bounds.top);
int right = Math.round(bounds.right);
int bottom = Math.round(bounds.bottom);
ImageView copy = new ImageView(view.getContext());
copy.setScaleType(ImageView.ScaleType.CENTER_CROP);
Bitmap bitmap = createViewBitmap(view, matrix, bounds);
if (bitmap != null) {
copy.setImageBitmap(bitmap);
}
int widthSpec = View.MeasureSpec.makeMeasureSpec(right - left, View.MeasureSpec.EXACTLY);
int heightSpec = View.MeasureSpec.makeMeasureSpec(bottom - top, View.MeasureSpec.EXACTLY);
copy.measure(widthSpec, heightSpec);
copy.layout(left, top, right, bottom);
return copy;
} } | public class class_name {
@NonNull
public static View copyViewImage(@NonNull ViewGroup sceneRoot, @NonNull View view, @NonNull View parent) {
Matrix matrix = new Matrix();
matrix.setTranslate(-parent.getScrollX(), -parent.getScrollY());
ViewUtils.transformMatrixToGlobal(view, matrix);
ViewUtils.transformMatrixToLocal(sceneRoot, matrix);
RectF bounds = new RectF(0, 0, view.getWidth(), view.getHeight());
matrix.mapRect(bounds);
int left = Math.round(bounds.left);
int top = Math.round(bounds.top);
int right = Math.round(bounds.right);
int bottom = Math.round(bounds.bottom);
ImageView copy = new ImageView(view.getContext());
copy.setScaleType(ImageView.ScaleType.CENTER_CROP);
Bitmap bitmap = createViewBitmap(view, matrix, bounds);
if (bitmap != null) {
copy.setImageBitmap(bitmap); // depends on control dependency: [if], data = [(bitmap]
}
int widthSpec = View.MeasureSpec.makeMeasureSpec(right - left, View.MeasureSpec.EXACTLY);
int heightSpec = View.MeasureSpec.makeMeasureSpec(bottom - top, View.MeasureSpec.EXACTLY);
copy.measure(widthSpec, heightSpec);
copy.layout(left, top, right, bottom);
return copy;
} } |
public class class_name {
protected final void initDstBuffer(int sizeBytes, byte[] bytes) {
if (bytes != null && bytes.length > sizeBytes) {
throw new IllegalArgumentException("Buffer overflow. Can't initialize dstBuffer for "
+ this + " and channel" + channel + " because too many bytes, sizeBytes " + sizeBytes
+ ". bytes.length " + bytes.length);
}
ChannelOptions config = channel.options();
ByteBuffer buffer = newByteBuffer(sizeBytes, config.getOption(DIRECT_BUF));
if (bytes != null) {
buffer.put(bytes);
}
buffer.flip();
dst = (D) buffer;
} } | public class class_name {
protected final void initDstBuffer(int sizeBytes, byte[] bytes) {
if (bytes != null && bytes.length > sizeBytes) {
throw new IllegalArgumentException("Buffer overflow. Can't initialize dstBuffer for "
+ this + " and channel" + channel + " because too many bytes, sizeBytes " + sizeBytes
+ ". bytes.length " + bytes.length);
}
ChannelOptions config = channel.options();
ByteBuffer buffer = newByteBuffer(sizeBytes, config.getOption(DIRECT_BUF));
if (bytes != null) {
buffer.put(bytes); // depends on control dependency: [if], data = [(bytes]
}
buffer.flip();
dst = (D) buffer;
} } |
public class class_name {
@Override
public EClass getIfcLightSourceAmbient() {
if (ifcLightSourceAmbientEClass == null) {
ifcLightSourceAmbientEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(345);
}
return ifcLightSourceAmbientEClass;
} } | public class class_name {
@Override
public EClass getIfcLightSourceAmbient() {
if (ifcLightSourceAmbientEClass == null) {
ifcLightSourceAmbientEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(345);
// depends on control dependency: [if], data = [none]
}
return ifcLightSourceAmbientEClass;
} } |
public class class_name {
void addProviderInfoListener(String dataId, ConsumerConfig consumerConfig,
ProviderInfoListener listener) {
providerInfoListeners.put(consumerConfig, listener);
// 同一个key重复订阅多次,提醒用户需要检查一下是否是代码问题
if (LOGGER.isWarnEnabled(consumerConfig.getAppName()) && providerInfoListeners.size() > 5) {
LOGGER.warnWithApp(consumerConfig.getAppName(),
"Duplicate to add provider listener of {} " +
"more than 5 times, now is {}, please check it",
dataId, providerInfoListeners.size());
}
} } | public class class_name {
void addProviderInfoListener(String dataId, ConsumerConfig consumerConfig,
ProviderInfoListener listener) {
providerInfoListeners.put(consumerConfig, listener);
// 同一个key重复订阅多次,提醒用户需要检查一下是否是代码问题
if (LOGGER.isWarnEnabled(consumerConfig.getAppName()) && providerInfoListeners.size() > 5) {
LOGGER.warnWithApp(consumerConfig.getAppName(),
"Duplicate to add provider listener of {} " +
"more than 5 times, now is {}, please check it",
dataId, providerInfoListeners.size()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(ProvisionedProductPlanSummary provisionedProductPlanSummary, ProtocolMarshaller protocolMarshaller) {
if (provisionedProductPlanSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(provisionedProductPlanSummary.getPlanName(), PLANNAME_BINDING);
protocolMarshaller.marshall(provisionedProductPlanSummary.getPlanId(), PLANID_BINDING);
protocolMarshaller.marshall(provisionedProductPlanSummary.getProvisionProductId(), PROVISIONPRODUCTID_BINDING);
protocolMarshaller.marshall(provisionedProductPlanSummary.getProvisionProductName(), PROVISIONPRODUCTNAME_BINDING);
protocolMarshaller.marshall(provisionedProductPlanSummary.getPlanType(), PLANTYPE_BINDING);
protocolMarshaller.marshall(provisionedProductPlanSummary.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ProvisionedProductPlanSummary provisionedProductPlanSummary, ProtocolMarshaller protocolMarshaller) {
if (provisionedProductPlanSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(provisionedProductPlanSummary.getPlanName(), PLANNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductPlanSummary.getPlanId(), PLANID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductPlanSummary.getProvisionProductId(), PROVISIONPRODUCTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductPlanSummary.getProvisionProductName(), PROVISIONPRODUCTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductPlanSummary.getPlanType(), PLANTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductPlanSummary.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int compareTo(Object obj) {
// can't compare with null
if (obj == null) throw new NullPointerException("obj is null");
if (obj == this) return 0;
if (obj instanceof ProfileTableNotification) {
// compare the profile table name
ProfileTableNotification that = (ProfileTableNotification)obj;
return this.profileTableName.compareTo(that.profileTableName);
}
else {
return super.compareTo(TYPE, obj);
}
} } | public class class_name {
public int compareTo(Object obj) {
// can't compare with null
if (obj == null) throw new NullPointerException("obj is null");
if (obj == this) return 0;
if (obj instanceof ProfileTableNotification) {
// compare the profile table name
ProfileTableNotification that = (ProfileTableNotification)obj;
return this.profileTableName.compareTo(that.profileTableName); // depends on control dependency: [if], data = [none]
}
else {
return super.compareTo(TYPE, obj); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static void tryLayout(
final Graphics2D graphics2D, final DistanceUnit scaleUnit, final double scaleDenominator,
final double intervalLengthInWorldUnits, final ScaleBarRenderSettings settings,
final int tryNumber) {
if (tryNumber > MAX_NUMBER_LAYOUTING_TRIES) {
// if no good layout can be found, stop. an empty scalebar graphic will be shown.
LOGGER.error("layouting the scalebar failed (unit: {}, scale: {})", scaleUnit, scaleDenominator);
return;
}
final ScalebarAttributeValues scalebarParams = settings.getParams();
final DistanceUnit intervalUnit =
bestUnit(scaleUnit, intervalLengthInWorldUnits, scalebarParams.lockUnits);
final float intervalLengthInPixels = (float) scaleUnit.convertTo(
intervalLengthInWorldUnits / scaleDenominator, DistanceUnit.PX);
//compute the label positions
final List<Label> labels = new ArrayList<>(scalebarParams.intervals + 1);
final float leftLabelMargin;
final float rightLabelMargin;
final float topLabelMargin;
final float bottomLabelMargin;
final Font font = new Font(scalebarParams.font, Font.PLAIN, getFontSize(settings));
final FontRenderContext frc = new FontRenderContext(null, true, true);
if (scalebarParams.intervals > 1 || scalebarParams.subIntervals) {
//the label will be centered under each tick mark
for (int i = 0; i <= scalebarParams.intervals; i++) {
String labelText = createLabelText(scaleUnit, intervalLengthInWorldUnits * i, intervalUnit);
if (i == scalebarParams.intervals) {
// only show unit for the last label
labelText += intervalUnit;
}
TextLayout labelLayout = new TextLayout(labelText, font, frc);
labels.add(new Label(intervalLengthInPixels * i, labelLayout, graphics2D));
}
leftLabelMargin = labels.get(0).getRotatedWidth(scalebarParams.getLabelRotation()) / 2.0f;
rightLabelMargin =
labels.get(labels.size() - 1).getRotatedWidth(scalebarParams.getLabelRotation()) / 2.0f;
topLabelMargin = labels.get(0).getRotatedHeight(scalebarParams.getLabelRotation()) / 2.0f;
bottomLabelMargin =
labels.get(labels.size() - 1).getRotatedHeight(scalebarParams.getLabelRotation()) / 2.0f;
} else {
//if there is only one interval, place the label centered between the two tick marks
String labelText =
createLabelText(scaleUnit, intervalLengthInWorldUnits, intervalUnit) + intervalUnit;
TextLayout labelLayout = new TextLayout(labelText, font, frc);
final Label label = new Label(intervalLengthInPixels / 2.0f, labelLayout, graphics2D);
labels.add(label);
rightLabelMargin = 0;
leftLabelMargin = 0;
topLabelMargin = 0;
bottomLabelMargin = 0;
}
if (fitsAvailableSpace(scalebarParams, intervalLengthInPixels,
leftLabelMargin, rightLabelMargin, topLabelMargin, bottomLabelMargin,
settings)) {
//the layout fits the maxSize
settings.setLabels(labels);
settings.setScaleUnit(scaleUnit);
settings.setIntervalLengthInPixels(intervalLengthInPixels);
settings.setIntervalLengthInWorldUnits(intervalLengthInWorldUnits);
settings.setIntervalUnit(intervalUnit);
settings.setLeftLabelMargin(leftLabelMargin);
settings.setRightLabelMargin(rightLabelMargin);
settings.setTopLabelMargin(topLabelMargin);
settings.setBottomLabelMargin(bottomLabelMargin);
doLayout(graphics2D, scalebarParams, settings);
} else {
//not enough room because of the labels, try a smaller bar
double nextIntervalDistance = getNearestNiceValue(
intervalLengthInWorldUnits * 0.9, scaleUnit, scalebarParams.lockUnits);
tryLayout(graphics2D, scaleUnit, scaleDenominator, nextIntervalDistance, settings,
tryNumber + 1);
}
} } | public class class_name {
private static void tryLayout(
final Graphics2D graphics2D, final DistanceUnit scaleUnit, final double scaleDenominator,
final double intervalLengthInWorldUnits, final ScaleBarRenderSettings settings,
final int tryNumber) {
if (tryNumber > MAX_NUMBER_LAYOUTING_TRIES) {
// if no good layout can be found, stop. an empty scalebar graphic will be shown.
LOGGER.error("layouting the scalebar failed (unit: {}, scale: {})", scaleUnit, scaleDenominator); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final ScalebarAttributeValues scalebarParams = settings.getParams();
final DistanceUnit intervalUnit =
bestUnit(scaleUnit, intervalLengthInWorldUnits, scalebarParams.lockUnits);
final float intervalLengthInPixels = (float) scaleUnit.convertTo(
intervalLengthInWorldUnits / scaleDenominator, DistanceUnit.PX);
//compute the label positions
final List<Label> labels = new ArrayList<>(scalebarParams.intervals + 1);
final float leftLabelMargin;
final float rightLabelMargin;
final float topLabelMargin;
final float bottomLabelMargin;
final Font font = new Font(scalebarParams.font, Font.PLAIN, getFontSize(settings));
final FontRenderContext frc = new FontRenderContext(null, true, true);
if (scalebarParams.intervals > 1 || scalebarParams.subIntervals) {
//the label will be centered under each tick mark
for (int i = 0; i <= scalebarParams.intervals; i++) {
String labelText = createLabelText(scaleUnit, intervalLengthInWorldUnits * i, intervalUnit);
if (i == scalebarParams.intervals) {
// only show unit for the last label
labelText += intervalUnit; // depends on control dependency: [if], data = [none]
}
TextLayout labelLayout = new TextLayout(labelText, font, frc);
labels.add(new Label(intervalLengthInPixels * i, labelLayout, graphics2D)); // depends on control dependency: [for], data = [i]
}
leftLabelMargin = labels.get(0).getRotatedWidth(scalebarParams.getLabelRotation()) / 2.0f; // depends on control dependency: [if], data = [none]
rightLabelMargin =
labels.get(labels.size() - 1).getRotatedWidth(scalebarParams.getLabelRotation()) / 2.0f; // depends on control dependency: [if], data = [none]
topLabelMargin = labels.get(0).getRotatedHeight(scalebarParams.getLabelRotation()) / 2.0f; // depends on control dependency: [if], data = [none]
bottomLabelMargin =
labels.get(labels.size() - 1).getRotatedHeight(scalebarParams.getLabelRotation()) / 2.0f; // depends on control dependency: [if], data = [none]
} else {
//if there is only one interval, place the label centered between the two tick marks
String labelText =
createLabelText(scaleUnit, intervalLengthInWorldUnits, intervalUnit) + intervalUnit;
TextLayout labelLayout = new TextLayout(labelText, font, frc);
final Label label = new Label(intervalLengthInPixels / 2.0f, labelLayout, graphics2D);
labels.add(label); // depends on control dependency: [if], data = [none]
rightLabelMargin = 0; // depends on control dependency: [if], data = [none]
leftLabelMargin = 0; // depends on control dependency: [if], data = [none]
topLabelMargin = 0; // depends on control dependency: [if], data = [none]
bottomLabelMargin = 0; // depends on control dependency: [if], data = [none]
}
if (fitsAvailableSpace(scalebarParams, intervalLengthInPixels,
leftLabelMargin, rightLabelMargin, topLabelMargin, bottomLabelMargin,
settings)) {
//the layout fits the maxSize
settings.setLabels(labels); // depends on control dependency: [if], data = [none]
settings.setScaleUnit(scaleUnit); // depends on control dependency: [if], data = [none]
settings.setIntervalLengthInPixels(intervalLengthInPixels); // depends on control dependency: [if], data = [none]
settings.setIntervalLengthInWorldUnits(intervalLengthInWorldUnits); // depends on control dependency: [if], data = [none]
settings.setIntervalUnit(intervalUnit); // depends on control dependency: [if], data = [none]
settings.setLeftLabelMargin(leftLabelMargin); // depends on control dependency: [if], data = [none]
settings.setRightLabelMargin(rightLabelMargin); // depends on control dependency: [if], data = [none]
settings.setTopLabelMargin(topLabelMargin); // depends on control dependency: [if], data = [none]
settings.setBottomLabelMargin(bottomLabelMargin); // depends on control dependency: [if], data = [none]
doLayout(graphics2D, scalebarParams, settings); // depends on control dependency: [if], data = [none]
} else {
//not enough room because of the labels, try a smaller bar
double nextIntervalDistance = getNearestNiceValue(
intervalLengthInWorldUnits * 0.9, scaleUnit, scalebarParams.lockUnits);
tryLayout(graphics2D, scaleUnit, scaleDenominator, nextIntervalDistance, settings,
tryNumber + 1); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static void addEntry(final ArrayList<String> aStringArray) {
try {
final MagicMimeEntry magicEntry = new MagicMimeEntry(aStringArray);
mMagicMimeEntries.add(magicEntry);
} catch (final InvalidMagicMimeEntryException e) {
}
} } | public class class_name {
private static void addEntry(final ArrayList<String> aStringArray) {
try {
final MagicMimeEntry magicEntry = new MagicMimeEntry(aStringArray);
mMagicMimeEntries.add(magicEntry); // depends on control dependency: [try], data = [none]
} catch (final InvalidMagicMimeEntryException e) {
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String binaryToString(Object tempBinary, int sDateFormat)
{
String aStr = Constants.BLANK;
if (!(tempBinary instanceof Date))
return aStr;
Date date = new Date(((Date)tempBinary).getTime());
if (date.getTime() == 0)
return aStr;
if (gDateFormat == null)
initGlobals();
synchronized (gCalendar)
{
if ((sDateFormat == DBConstants.DATE_ONLY_FORMAT) || (sDateFormat == DBConstants.DATE_FORMAT))
aStr = gDateFormat.format(date);
else if ((sDateFormat == DBConstants.SHORT_DATE_ONLY_FORMAT) || (sDateFormat == DBConstants.SHORT_DATE_FORMAT))
aStr = gDateShortFormat.format(date);
else if ((sDateFormat == DBConstants.TIME_ONLY_FORMAT) || (sDateFormat == DBConstants.TIME_FORMAT))
aStr = gTimeFormat.format(date);
else if ((sDateFormat == DBConstants.SHORT_TIME_ONLY_FORMAT) || (sDateFormat == DBConstants.SHORT_TIME_FORMAT))
aStr = gDateShortTimeFormat.format(date);
else if (sDateFormat == DBConstants.SQL_DATE_FORMAT)
aStr = gDateSqlFormat.format(date);
else if (sDateFormat == DBConstants.SQL_TIME_FORMAT)
aStr = gTimeSqlFormat.format(date);
else if (sDateFormat == DBConstants.SQL_DATE_TIME_FORMAT)
aStr = gDateTimeSqlFormat.format(date);
else if (sDateFormat == DBConstants.LONG_TIME_ONLY_FORMAT)
aStr = gLongTimeFormat.format(date);
else if (sDateFormat == DBConstants.LONG_DATE_TIME_FORMAT)
aStr = gLongDateTimeFormat.format(date);
else if (sDateFormat == DBConstants.HYBRID_TIME_ONLY_FORMAT)
{
{
gCalendar.setTime(date);
if (gCalendar.get(Calendar.SECOND) > 0)
aStr = gLongTimeFormat.format(date);
else
aStr = gTimeFormat.format(date);
}
}
else if (sDateFormat == DBConstants.HYBRID_DATE_TIME_FORMAT)
{
gCalendar.setTime(date);
if (gCalendar.get(Calendar.SECOND) > 0)
aStr = gLongDateTimeFormat.format(date);
else
aStr = gDateTimeFormat.format(date);
}
else
aStr = gDateTimeFormat.format(date);
}
return aStr;
} } | public class class_name {
public static String binaryToString(Object tempBinary, int sDateFormat)
{
String aStr = Constants.BLANK;
if (!(tempBinary instanceof Date))
return aStr;
Date date = new Date(((Date)tempBinary).getTime());
if (date.getTime() == 0)
return aStr;
if (gDateFormat == null)
initGlobals();
synchronized (gCalendar)
{
if ((sDateFormat == DBConstants.DATE_ONLY_FORMAT) || (sDateFormat == DBConstants.DATE_FORMAT))
aStr = gDateFormat.format(date);
else if ((sDateFormat == DBConstants.SHORT_DATE_ONLY_FORMAT) || (sDateFormat == DBConstants.SHORT_DATE_FORMAT))
aStr = gDateShortFormat.format(date);
else if ((sDateFormat == DBConstants.TIME_ONLY_FORMAT) || (sDateFormat == DBConstants.TIME_FORMAT))
aStr = gTimeFormat.format(date);
else if ((sDateFormat == DBConstants.SHORT_TIME_ONLY_FORMAT) || (sDateFormat == DBConstants.SHORT_TIME_FORMAT))
aStr = gDateShortTimeFormat.format(date);
else if (sDateFormat == DBConstants.SQL_DATE_FORMAT)
aStr = gDateSqlFormat.format(date);
else if (sDateFormat == DBConstants.SQL_TIME_FORMAT)
aStr = gTimeSqlFormat.format(date);
else if (sDateFormat == DBConstants.SQL_DATE_TIME_FORMAT)
aStr = gDateTimeSqlFormat.format(date);
else if (sDateFormat == DBConstants.LONG_TIME_ONLY_FORMAT)
aStr = gLongTimeFormat.format(date);
else if (sDateFormat == DBConstants.LONG_DATE_TIME_FORMAT)
aStr = gLongDateTimeFormat.format(date);
else if (sDateFormat == DBConstants.HYBRID_TIME_ONLY_FORMAT)
{
{
gCalendar.setTime(date);
if (gCalendar.get(Calendar.SECOND) > 0)
aStr = gLongTimeFormat.format(date);
else
aStr = gTimeFormat.format(date);
}
}
else if (sDateFormat == DBConstants.HYBRID_DATE_TIME_FORMAT)
{
gCalendar.setTime(date); // depends on control dependency: [if], data = [none]
if (gCalendar.get(Calendar.SECOND) > 0)
aStr = gLongDateTimeFormat.format(date);
else
aStr = gDateTimeFormat.format(date);
}
else
aStr = gDateTimeFormat.format(date);
}
return aStr;
} } |
public class class_name {
@Override
public boolean stop() {
synchronized(MetricCollectorSupport.class) {
if (uploaderThread != null) {
uploaderThread.cancel();
uploaderThread.interrupt();
uploaderThread = null;
if (singleton == this) { // defensive check
singleton = null;
}
return true;
}
}
return false;
} } | public class class_name {
@Override
public boolean stop() {
synchronized(MetricCollectorSupport.class) {
if (uploaderThread != null) {
uploaderThread.cancel(); // depends on control dependency: [if], data = [none]
uploaderThread.interrupt(); // depends on control dependency: [if], data = [none]
uploaderThread = null; // depends on control dependency: [if], data = [none]
if (singleton == this) { // defensive check
singleton = null; // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
@SuppressWarnings("unused")
public void showBaseView() {
if ((mForwardAnimatorSet != null && mForwardAnimatorSet.isRunning())
|| (mAnimationView != null && mAnimationView.isPlaying())
|| (mReverseAnimatorSet != null && mReverseAnimatorSet.isRunning())) {
return;
}
if (mBaseContainer != null) {
mBaseContainer.setVisibility(VISIBLE);
}
if (mAnimationView != null) {
mAnimationView.setAnimated(false);
}
if (mContextView != null) {
mContextView.setVisibility(GONE);
}
} } | public class class_name {
@SuppressWarnings("unused")
public void showBaseView() {
if ((mForwardAnimatorSet != null && mForwardAnimatorSet.isRunning())
|| (mAnimationView != null && mAnimationView.isPlaying())
|| (mReverseAnimatorSet != null && mReverseAnimatorSet.isRunning())) {
return; // depends on control dependency: [if], data = [none]
}
if (mBaseContainer != null) {
mBaseContainer.setVisibility(VISIBLE); // depends on control dependency: [if], data = [none]
}
if (mAnimationView != null) {
mAnimationView.setAnimated(false); // depends on control dependency: [if], data = [none]
}
if (mContextView != null) {
mContextView.setVisibility(GONE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public EClass getIfcSpecularRoughness() {
if (ifcSpecularRoughnessEClass == null) {
ifcSpecularRoughnessEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(871);
}
return ifcSpecularRoughnessEClass;
} } | public class class_name {
@Override
public EClass getIfcSpecularRoughness() {
if (ifcSpecularRoughnessEClass == null) {
ifcSpecularRoughnessEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(871);
// depends on control dependency: [if], data = [none]
}
return ifcSpecularRoughnessEClass;
} } |
public class class_name {
public static boolean contains(Object[] arr, Object obj) {
if (arr != null) {
for (int i = 0; i < arr.length; i++) {
Object arri = arr[i];
if (arri == obj || (arri != null && arri.equals(obj))) {
return true;
}
}
}
return false;
} } | public class class_name {
public static boolean contains(Object[] arr, Object obj) {
if (arr != null) {
for (int i = 0; i < arr.length; i++) {
Object arri = arr[i];
if (arri == obj || (arri != null && arri.equals(obj))) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
public Map<String, Object> doRequest(final RequestProperties requestProps) {
try {
URL url = new URL(moipEnvironment + requestProps.endpoint);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("User-Agent", getUserAgent());
connection.setRequestProperty("Content-type", requestProps.getContentType().getMimeType());
if (requestProps.hasAccept()) connection.setRequestProperty("Accept", requestProps.accept);
connection.setRequestMethod(requestProps.method);
// This validation disable the TLS 1.0
if (connection instanceof HttpsURLConnection) {
((HttpsURLConnection) connection).setSSLSocketFactory(new SSLSupport());
}
if (this.authentication != null) authentication.authenticate(connection);
LOGGER.debug("---> {} {}", requestProps.method, connection.getURL().toString());
logHeaders(connection.getRequestProperties().entrySet());
if (requestProps.body != null) {
connection.setDoOutput(true);
String body = tools.getBody(requestProps.body, requestProps.contentType);
LOGGER.debug("{}", body);
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(wr, "UTF-8"));
writer.write(body);
writer.close();
wr.flush();
wr.close();
}
LOGGER.debug("---> END HTTP");
int responseCode = connection.getResponseCode();
LOGGER.debug("<--- {} {}", responseCode, connection.getResponseMessage());
logHeaders(connection.getHeaderFields().entrySet());
StringBuilder responseBody = new StringBuilder();
responseBody = responseBodyTreatment(responseBody, responseCode, connection);
LOGGER.debug("{}", responseBody.toString());
LOGGER.debug("<-- END HTTP ({}-byte body)", connection.getContentLength());
// Return the parsed response from JSON to Map.
return this.response.jsonToMap(responseBody.toString());
} catch(IOException | KeyManagementException | NoSuchAlgorithmException e){
throw new MoipAPIException("Error occurred connecting to Moip API: " + e.getMessage(), e);
}
} } | public class class_name {
public Map<String, Object> doRequest(final RequestProperties requestProps) {
try {
URL url = new URL(moipEnvironment + requestProps.endpoint);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("User-Agent", getUserAgent()); // depends on control dependency: [try], data = [none]
connection.setRequestProperty("Content-type", requestProps.getContentType().getMimeType()); // depends on control dependency: [try], data = [none]
if (requestProps.hasAccept()) connection.setRequestProperty("Accept", requestProps.accept);
connection.setRequestMethod(requestProps.method); // depends on control dependency: [try], data = [none]
// This validation disable the TLS 1.0
if (connection instanceof HttpsURLConnection) {
((HttpsURLConnection) connection).setSSLSocketFactory(new SSLSupport()); // depends on control dependency: [if], data = [none]
}
if (this.authentication != null) authentication.authenticate(connection);
LOGGER.debug("---> {} {}", requestProps.method, connection.getURL().toString()); // depends on control dependency: [try], data = [none]
logHeaders(connection.getRequestProperties().entrySet()); // depends on control dependency: [try], data = [none]
if (requestProps.body != null) {
connection.setDoOutput(true); // depends on control dependency: [if], data = [none]
String body = tools.getBody(requestProps.body, requestProps.contentType);
LOGGER.debug("{}", body); // depends on control dependency: [if], data = [none]
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(wr, "UTF-8"));
writer.write(body); // depends on control dependency: [if], data = [none]
writer.close(); // depends on control dependency: [if], data = [none]
wr.flush(); // depends on control dependency: [if], data = [none]
wr.close(); // depends on control dependency: [if], data = [none]
}
LOGGER.debug("---> END HTTP"); // depends on control dependency: [try], data = [none]
int responseCode = connection.getResponseCode();
LOGGER.debug("<--- {} {}", responseCode, connection.getResponseMessage()); // depends on control dependency: [try], data = [none]
logHeaders(connection.getHeaderFields().entrySet()); // depends on control dependency: [try], data = [none]
StringBuilder responseBody = new StringBuilder();
responseBody = responseBodyTreatment(responseBody, responseCode, connection); // depends on control dependency: [try], data = [none]
LOGGER.debug("{}", responseBody.toString()); // depends on control dependency: [try], data = [none]
LOGGER.debug("<-- END HTTP ({}-byte body)", connection.getContentLength()); // depends on control dependency: [try], data = [none]
// Return the parsed response from JSON to Map.
return this.response.jsonToMap(responseBody.toString()); // depends on control dependency: [try], data = [none]
} catch(IOException | KeyManagementException | NoSuchAlgorithmException e){
throw new MoipAPIException("Error occurred connecting to Moip API: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static void addEntry(Reference<?> ref, ReleaseListener entry) {
synchronized (WeakReferenceMonitor.class) {
// Add entry, the key is given reference.
trackedEntries.put(ref, entry);
// Start monitoring thread lazily.
if (monitoringThread == null) {
monitoringThread = new Thread(new MonitoringProcess(), WeakReferenceMonitor.class.getName());
monitoringThread.setDaemon(true);
monitoringThread.start();
}
}
} } | public class class_name {
private static void addEntry(Reference<?> ref, ReleaseListener entry) {
synchronized (WeakReferenceMonitor.class) {
// Add entry, the key is given reference.
trackedEntries.put(ref, entry);
// Start monitoring thread lazily.
if (monitoringThread == null) {
monitoringThread = new Thread(new MonitoringProcess(), WeakReferenceMonitor.class.getName()); // depends on control dependency: [if], data = [none]
monitoringThread.setDaemon(true); // depends on control dependency: [if], data = [none]
monitoringThread.start(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
final Set<String> getPrimaryColumnNames() {
final List<DBColumn> primaryKeyColumnList = getPrimaryKeyColumnList();
final Set<String> primaryKeyColumnNameSet = new LinkedHashSet<String>();
for (DBColumn col : primaryKeyColumnList) {
primaryKeyColumnNameSet.add(col.columnName());
}
return primaryKeyColumnNameSet;
} } | public class class_name {
final Set<String> getPrimaryColumnNames() {
final List<DBColumn> primaryKeyColumnList = getPrimaryKeyColumnList();
final Set<String> primaryKeyColumnNameSet = new LinkedHashSet<String>();
for (DBColumn col : primaryKeyColumnList) {
primaryKeyColumnNameSet.add(col.columnName()); // depends on control dependency: [for], data = [col]
}
return primaryKeyColumnNameSet;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.