code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private static byte[] createImageThumbnail(final InputStream is, final Dimension scaledSize) {
BufferedImage image;
MemoryCacheImageInputStream mciis;
try {
mciis = new MemoryCacheImageInputStream(is);
image = ImageIO.read(mciis);
} catch (Exception e) {
LOG.warn("Unable to read input image", e);
return null;
}
if (image == null) {
return null;
}
try {
byte[] jpeg = createScaledJPEG(image, scaledSize);
return jpeg;
} catch (Exception e) {
LOG.error("Error creating thumbnail from image", e);
} finally {
image.flush();
}
return null;
} } | public class class_name {
private static byte[] createImageThumbnail(final InputStream is, final Dimension scaledSize) {
BufferedImage image;
MemoryCacheImageInputStream mciis;
try {
mciis = new MemoryCacheImageInputStream(is); // depends on control dependency: [try], data = [none]
image = ImageIO.read(mciis); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.warn("Unable to read input image", e);
return null;
} // depends on control dependency: [catch], data = [none]
if (image == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
byte[] jpeg = createScaledJPEG(image, scaledSize);
return jpeg; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Error creating thumbnail from image", e);
} finally { // depends on control dependency: [catch], data = [none]
image.flush();
}
return null;
} } |
public class class_name {
public void writeCoverageResults() {
File coverageFile = new File(this.testSessionDir,
ICS_MAP.get(this.requestId));
if (coverageFile.exists()) {
return;
}
OutputStream fos = null;
try {
fos = new FileOutputStream(coverageFile, false);
writeDocument(fos, this.coverageDoc);
} catch (FileNotFoundException e) {
} finally {
try {
// Fortify Mod: If fos is null, then nothing was written
if( fos != null) {
fos.close();
LOGR.config("Wrote coverage results to "
+ coverageFile.getCanonicalPath());
}
else {
// If nothing was written, then there should be an exception message.
// If an additional message is desired, then add it here.
}
} catch (IOException ioe) {
LOGR.warning(ioe.getMessage());
}
}
} } | public class class_name {
public void writeCoverageResults() {
File coverageFile = new File(this.testSessionDir,
ICS_MAP.get(this.requestId));
if (coverageFile.exists()) {
return;
// depends on control dependency: [if], data = [none]
}
OutputStream fos = null;
try {
fos = new FileOutputStream(coverageFile, false);
// depends on control dependency: [try], data = [none]
writeDocument(fos, this.coverageDoc);
// depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
} finally {
// depends on control dependency: [catch], data = [none]
try {
// Fortify Mod: If fos is null, then nothing was written
if( fos != null) {
fos.close();
// depends on control dependency: [if], data = [none]
LOGR.config("Wrote coverage results to "
+ coverageFile.getCanonicalPath());
// depends on control dependency: [if], data = [none]
}
else {
// If nothing was written, then there should be an exception message.
// If an additional message is desired, then add it here.
}
} catch (IOException ioe) {
LOGR.warning(ioe.getMessage());
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private void tryUnlock(CmsResource resource) {
try {
m_cms.unlockResource(resource);
} catch (Exception unlockError) {
LOG.debug(unlockError.getLocalizedMessage(), unlockError);
}
} } | public class class_name {
private void tryUnlock(CmsResource resource) {
try {
m_cms.unlockResource(resource); // depends on control dependency: [try], data = [none]
} catch (Exception unlockError) {
LOG.debug(unlockError.getLocalizedMessage(), unlockError);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setResourceAwsIamAccessKeyCreatedAt(java.util.Collection<DateFilter> resourceAwsIamAccessKeyCreatedAt) {
if (resourceAwsIamAccessKeyCreatedAt == null) {
this.resourceAwsIamAccessKeyCreatedAt = null;
return;
}
this.resourceAwsIamAccessKeyCreatedAt = new java.util.ArrayList<DateFilter>(resourceAwsIamAccessKeyCreatedAt);
} } | public class class_name {
public void setResourceAwsIamAccessKeyCreatedAt(java.util.Collection<DateFilter> resourceAwsIamAccessKeyCreatedAt) {
if (resourceAwsIamAccessKeyCreatedAt == null) {
this.resourceAwsIamAccessKeyCreatedAt = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.resourceAwsIamAccessKeyCreatedAt = new java.util.ArrayList<DateFilter>(resourceAwsIamAccessKeyCreatedAt);
} } |
public class class_name {
private void lockAndRegisterReferences(ClassDescriptor cld, Object sourceObject, int lockMode, List registeredObjects) throws LockNotGrantedException
{
if (implicitLocking)
{
Iterator i = cld.getObjectReferenceDescriptors(true).iterator();
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
Object refObj = rds.getPersistentField().get(sourceObject);
if (refObj != null)
{
boolean isProxy = ProxyHelper.isProxy(refObj);
RuntimeObject rt = isProxy ? new RuntimeObject(refObj, this, false) : new RuntimeObject(refObj, this);
if (!registrationList.contains(rt.getIdentity()))
{
lockAndRegister(rt, lockMode, registeredObjects);
}
}
}
}
} } | public class class_name {
private void lockAndRegisterReferences(ClassDescriptor cld, Object sourceObject, int lockMode, List registeredObjects) throws LockNotGrantedException
{
if (implicitLocking)
{
Iterator i = cld.getObjectReferenceDescriptors(true).iterator();
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
Object refObj = rds.getPersistentField().get(sourceObject);
if (refObj != null)
{
boolean isProxy = ProxyHelper.isProxy(refObj);
RuntimeObject rt = isProxy ? new RuntimeObject(refObj, this, false) : new RuntimeObject(refObj, this);
if (!registrationList.contains(rt.getIdentity()))
{
lockAndRegister(rt, lockMode, registeredObjects);
// depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
@Override
public void commitTask(TaskAttemptContext context) throws IOException {
Path workPath = getWorkPath();
FileSystem fs = workPath.getFileSystem(context.getConfiguration());
if (fs.exists(workPath)) {
long recordCount = getRecordCountFromCounter(context, RecordKeyDedupReducerBase.EVENT_COUNTER.RECORD_COUNT);
String fileNamePrefix;
if (recordCount == 0) {
// recordCount == 0 indicates that it is a map-only, non-dedup job, and thus record count should
// be obtained from mapper counter.
fileNamePrefix = CompactionRecordCountProvider.M_OUTPUT_FILE_PREFIX;
recordCount = getRecordCountFromCounter(context, RecordKeyMapperBase.EVENT_COUNTER.RECORD_COUNT);
} else {
fileNamePrefix = CompactionRecordCountProvider.MR_OUTPUT_FILE_PREFIX;
}
String fileName = CompactionRecordCountProvider.constructFileName(fileNamePrefix,
"." + compactionFileExtension, recordCount);
for (FileStatus status : fs.listStatus(workPath, new PathFilter() {
@Override
public boolean accept(Path path) {
return FilenameUtils.isExtension(path.getName(), compactionFileExtension);
}
})) {
Path newPath = new Path(status.getPath().getParent(), fileName);
LOG.info(String.format("Renaming %s to %s", status.getPath(), newPath));
fs.rename(status.getPath(), newPath);
}
}
super.commitTask(context);
} } | public class class_name {
@Override
public void commitTask(TaskAttemptContext context) throws IOException {
Path workPath = getWorkPath();
FileSystem fs = workPath.getFileSystem(context.getConfiguration());
if (fs.exists(workPath)) {
long recordCount = getRecordCountFromCounter(context, RecordKeyDedupReducerBase.EVENT_COUNTER.RECORD_COUNT);
String fileNamePrefix;
if (recordCount == 0) {
// recordCount == 0 indicates that it is a map-only, non-dedup job, and thus record count should
// be obtained from mapper counter.
fileNamePrefix = CompactionRecordCountProvider.M_OUTPUT_FILE_PREFIX; // depends on control dependency: [if], data = [none]
recordCount = getRecordCountFromCounter(context, RecordKeyMapperBase.EVENT_COUNTER.RECORD_COUNT); // depends on control dependency: [if], data = [none]
} else {
fileNamePrefix = CompactionRecordCountProvider.MR_OUTPUT_FILE_PREFIX; // depends on control dependency: [if], data = [none]
}
String fileName = CompactionRecordCountProvider.constructFileName(fileNamePrefix,
"." + compactionFileExtension, recordCount);
for (FileStatus status : fs.listStatus(workPath, new PathFilter() {
@Override
public boolean accept(Path path) {
return FilenameUtils.isExtension(path.getName(), compactionFileExtension);
}
})) {
Path newPath = new Path(status.getPath().getParent(), fileName);
LOG.info(String.format("Renaming %s to %s", status.getPath(), newPath)); // depends on control dependency: [for], data = [status]
fs.rename(status.getPath(), newPath); // depends on control dependency: [for], data = [status]
}
}
super.commitTask(context);
} } |
public class class_name {
public static Map mapEntries(Mapper mapper, Map map, boolean includeNull){
HashMap h = new HashMap();
for (Object e : map.entrySet()) {
Map.Entry entry = (Map.Entry) e;
Object k = entry.getKey();
Object v = entry.getValue();
Object nk = mapper.map(k);
Object o = mapper.map(v);
if (includeNull || (o != null && nk != null)) {
h.put(nk, o);
}
}
return h;
} } | public class class_name {
public static Map mapEntries(Mapper mapper, Map map, boolean includeNull){
HashMap h = new HashMap();
for (Object e : map.entrySet()) {
Map.Entry entry = (Map.Entry) e;
Object k = entry.getKey();
Object v = entry.getValue();
Object nk = mapper.map(k);
Object o = mapper.map(v);
if (includeNull || (o != null && nk != null)) {
h.put(nk, o); // depends on control dependency: [if], data = [none]
}
}
return h;
} } |
public class class_name {
private boolean prepareAddActiveMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "prepareAddActiveMessage");
boolean messageAccepted = true;
// We can't even accept the next message if the consumer is already
// suspended
if (_consumerSuspended)
messageAccepted = false;
else
{
// If we're a member of a ConsumerSet then add this message to the
// set's quota - if there's space (returning 'false' indicates that
// the set is already full without this message)
if (!_consumerKey.prepareAddActiveMessage())
{
messageAccepted = false;
suspendConsumer(DispatchableConsumerPoint.SUSPEND_FLAG_SET_ACTIVE_MSGS);
}
}
// We can defer any local maxActiveMessage changes until the commit as there's
// no chance of another thread getting for this consumer getting in before then
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc,
"prepareAddActiveMessage",
new Object[] { Boolean.valueOf(messageAccepted) });
return messageAccepted;
} } | public class class_name {
private boolean prepareAddActiveMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "prepareAddActiveMessage");
boolean messageAccepted = true;
// We can't even accept the next message if the consumer is already
// suspended
if (_consumerSuspended)
messageAccepted = false;
else
{
// If we're a member of a ConsumerSet then add this message to the
// set's quota - if there's space (returning 'false' indicates that
// the set is already full without this message)
if (!_consumerKey.prepareAddActiveMessage())
{
messageAccepted = false; // depends on control dependency: [if], data = [none]
suspendConsumer(DispatchableConsumerPoint.SUSPEND_FLAG_SET_ACTIVE_MSGS); // depends on control dependency: [if], data = [none]
}
}
// We can defer any local maxActiveMessage changes until the commit as there's
// no chance of another thread getting for this consumer getting in before then
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc,
"prepareAddActiveMessage",
new Object[] { Boolean.valueOf(messageAccepted) });
return messageAccepted;
} } |
public class class_name {
@Override
public CallEvent next(long systemCurrentTimeMillis) {
// check for time passing
if (systemCurrentTimeMillis > currentSystemMilliTimestamp) {
// build a target for this 1ms window
long eventBacklog = targetEventsThisMillisecond - eventsSoFarThisMillisecond;
targetEventsThisMillisecond = (long) Math.floor(targetEventsPerMillisecond);
double targetFraction = targetEventsPerMillisecond - targetEventsThisMillisecond;
targetEventsThisMillisecond += (rand.nextDouble() <= targetFraction) ? 1 : 0;
targetEventsThisMillisecond += eventBacklog;
// reset counter for this 1ms window
eventsSoFarThisMillisecond = 0;
currentSystemMilliTimestamp = systemCurrentTimeMillis;
}
// drain scheduled events first
CallEvent callEvent = delayedEvents.nextReady(systemCurrentTimeMillis);
if (callEvent != null) {
// double check this is an end event
assert(callEvent.startTS == null);
assert(callEvent.endTS != null);
// return the agent/phone for this event to the available lists
agentsAvailable.add(callEvent.agentId);
phoneNumbersAvailable.add(callEvent.phoneNo);
validate();
return callEvent;
}
// check if we made all the target events for this 1ms window
if (targetEventsThisMillisecond == eventsSoFarThisMillisecond) {
validate();
return null;
}
// generate rando event (begin/end pair)
CallEvent[] event = makeRandomEvent();
// this means all agents are busy
if (event == null) {
validate();
return null;
}
// schedule the end event
long endTimeKey = event[1].endTS.getTime();
assert((endTimeKey - systemCurrentTimeMillis) < (config.maxcalldurationseconds * 1000));
delayedEvents.add(endTimeKey, event[1]);
eventsSoFarThisMillisecond++;
validate();
return event[0];
} } | public class class_name {
@Override
public CallEvent next(long systemCurrentTimeMillis) {
// check for time passing
if (systemCurrentTimeMillis > currentSystemMilliTimestamp) {
// build a target for this 1ms window
long eventBacklog = targetEventsThisMillisecond - eventsSoFarThisMillisecond;
targetEventsThisMillisecond = (long) Math.floor(targetEventsPerMillisecond); // depends on control dependency: [if], data = [none]
double targetFraction = targetEventsPerMillisecond - targetEventsThisMillisecond;
targetEventsThisMillisecond += (rand.nextDouble() <= targetFraction) ? 1 : 0; // depends on control dependency: [if], data = [none]
targetEventsThisMillisecond += eventBacklog; // depends on control dependency: [if], data = [none]
// reset counter for this 1ms window
eventsSoFarThisMillisecond = 0; // depends on control dependency: [if], data = [none]
currentSystemMilliTimestamp = systemCurrentTimeMillis; // depends on control dependency: [if], data = [none]
}
// drain scheduled events first
CallEvent callEvent = delayedEvents.nextReady(systemCurrentTimeMillis);
if (callEvent != null) {
// double check this is an end event
assert(callEvent.startTS == null); // depends on control dependency: [if], data = [(callEvent]
assert(callEvent.endTS != null); // depends on control dependency: [if], data = [(callEvent]
// return the agent/phone for this event to the available lists
agentsAvailable.add(callEvent.agentId); // depends on control dependency: [if], data = [(callEvent]
phoneNumbersAvailable.add(callEvent.phoneNo); // depends on control dependency: [if], data = [(callEvent]
validate(); // depends on control dependency: [if], data = [none]
return callEvent; // depends on control dependency: [if], data = [none]
}
// check if we made all the target events for this 1ms window
if (targetEventsThisMillisecond == eventsSoFarThisMillisecond) {
validate(); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// generate rando event (begin/end pair)
CallEvent[] event = makeRandomEvent();
// this means all agents are busy
if (event == null) {
validate(); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// schedule the end event
long endTimeKey = event[1].endTS.getTime();
assert((endTimeKey - systemCurrentTimeMillis) < (config.maxcalldurationseconds * 1000));
delayedEvents.add(endTimeKey, event[1]);
eventsSoFarThisMillisecond++;
validate();
return event[0];
} } |
public class class_name {
protected <S extends Serializable> void validateDomainObject(S domainObject, Set<ATError> errors) {
Set<ConstraintViolation<S>> constraintViolations = validator.validate( domainObject );
if (CollectionUtils.isEmpty(constraintViolations)) {
return;
}
for ( ConstraintViolation<S> violation : constraintViolations ) {
String type = violation.getConstraintDescriptor().getAnnotation().annotationType().getSimpleName();
String attrPath = violation.getPropertyPath().toString();
String msgKey = attrPath + "." + type;
if (null != violation.getMessage() && violation.getMessage().startsWith(MSG_KEY_PREFIX)) {
msgKey = violation.getMessage();
}
errors.add(new ATError((attrPath + "." + type), getMessage(msgKey, new Object[]{attrPath}, violation.getMessage()), attrPath));
}
} } | public class class_name {
protected <S extends Serializable> void validateDomainObject(S domainObject, Set<ATError> errors) {
Set<ConstraintViolation<S>> constraintViolations = validator.validate( domainObject );
if (CollectionUtils.isEmpty(constraintViolations)) {
return;
// depends on control dependency: [if], data = [none]
}
for ( ConstraintViolation<S> violation : constraintViolations ) {
String type = violation.getConstraintDescriptor().getAnnotation().annotationType().getSimpleName();
String attrPath = violation.getPropertyPath().toString();
String msgKey = attrPath + "." + type;
if (null != violation.getMessage() && violation.getMessage().startsWith(MSG_KEY_PREFIX)) {
msgKey = violation.getMessage();
// depends on control dependency: [if], data = [none]
}
errors.add(new ATError((attrPath + "." + type), getMessage(msgKey, new Object[]{attrPath}, violation.getMessage()), attrPath));
// depends on control dependency: [for], data = [violation]
}
} } |
public class class_name {
MetricFamilySamples fromGauge(String dropwizardName, Gauge gauge) {
Object obj = gauge.getValue();
double value;
if (obj instanceof Number) {
value = ((Number) obj).doubleValue();
} else if (obj instanceof Boolean) {
value = ((Boolean) obj) ? 1 : 0;
} else {
LOGGER.log(Level.FINE, String.format("Invalid type for Gauge %s: %s", sanitizeMetricName(dropwizardName),
obj == null ? "null" : obj.getClass().getName()));
return null;
}
MetricFamilySamples.Sample sample = sampleBuilder.createSample(dropwizardName, "",
new ArrayList<String>(), new ArrayList<String>(), value);
return new MetricFamilySamples(sample.name, Type.GAUGE, getHelpMessage(dropwizardName, gauge), Arrays.asList(sample));
} } | public class class_name {
MetricFamilySamples fromGauge(String dropwizardName, Gauge gauge) {
Object obj = gauge.getValue();
double value;
if (obj instanceof Number) {
value = ((Number) obj).doubleValue(); // depends on control dependency: [if], data = [none]
} else if (obj instanceof Boolean) {
value = ((Boolean) obj) ? 1 : 0; // depends on control dependency: [if], data = [none]
} else {
LOGGER.log(Level.FINE, String.format("Invalid type for Gauge %s: %s", sanitizeMetricName(dropwizardName),
obj == null ? "null" : obj.getClass().getName())); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
MetricFamilySamples.Sample sample = sampleBuilder.createSample(dropwizardName, "",
new ArrayList<String>(), new ArrayList<String>(), value);
return new MetricFamilySamples(sample.name, Type.GAUGE, getHelpMessage(dropwizardName, gauge), Arrays.asList(sample));
} } |
public class class_name {
@Override
public void format(final StringBuffer sbuf, final LoggingEvent event) {
for (int i = 0; i < patternConverters.length; i++) {
final int startField = sbuf.length();
patternConverters[i].format(event, sbuf);
patternFields[i].format(startField, sbuf);
}
} } | public class class_name {
@Override
public void format(final StringBuffer sbuf, final LoggingEvent event) {
for (int i = 0; i < patternConverters.length; i++) {
final int startField = sbuf.length();
patternConverters[i].format(event, sbuf); // depends on control dependency: [for], data = [i]
patternFields[i].format(startField, sbuf); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private static String getClassNames() {
StringBuilder result = new StringBuilder("\nMethod frame counter enter to the following classes:\n");
for (String className : classNames.get()) {
result.append(className).append("\n");
}
return result.toString();
} } | public class class_name {
private static String getClassNames() {
StringBuilder result = new StringBuilder("\nMethod frame counter enter to the following classes:\n");
for (String className : classNames.get()) {
result.append(className).append("\n"); // depends on control dependency: [for], data = [className]
}
return result.toString();
} } |
public class class_name {
private void handleMasterNodeChange() {
try {
synchronized (hasActiveServer) {
if (ZooKeeperUtil.watchAndCheckExists(this, masterZnode)) {
// A master node exists, there is an active master
if (LOG.isDebugEnabled()) {
LOG.debug("A master is now available");
}
hasActiveServer.set(true);
} else {
// Node is no longer there, cluster does not have an active master
if (LOG.isDebugEnabled()) {
LOG.debug("No master available. Notifying waiting threads");
}
hasActiveServer.set(false);
// Notify any thread waiting to become the active master
hasActiveServer.notifyAll();
}
}
} catch (KeeperException ke) {
LOG.error("Received an unexpected KeeperException, aborting", ke);
}
} } | public class class_name {
private void handleMasterNodeChange() {
try {
synchronized (hasActiveServer) { // depends on control dependency: [try], data = [none]
if (ZooKeeperUtil.watchAndCheckExists(this, masterZnode)) {
// A master node exists, there is an active master
if (LOG.isDebugEnabled()) {
LOG.debug("A master is now available"); // depends on control dependency: [if], data = [none]
}
hasActiveServer.set(true); // depends on control dependency: [if], data = [none]
} else {
// Node is no longer there, cluster does not have an active master
if (LOG.isDebugEnabled()) {
LOG.debug("No master available. Notifying waiting threads"); // depends on control dependency: [if], data = [none]
}
hasActiveServer.set(false); // depends on control dependency: [if], data = [none]
// Notify any thread waiting to become the active master
hasActiveServer.notifyAll(); // depends on control dependency: [if], data = [none]
}
}
} catch (KeeperException ke) {
LOG.error("Received an unexpected KeeperException, aborting", ke);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public View resolveViewName(String viewName, Locale locale) {
if (viewName == null) {
throw new IllegalArgumentException("Method argument viewName must not be null.");
}
if (viewName.startsWith(REDIRECT_URL_PREFIX)) {
String redirectUrl = viewName.substring(REDIRECT_URL_PREFIX.length());
return new SlingRedirectView(redirectUrl, true, true);
}
if (viewName.startsWith(FORWARD_URL_PREFIX)) {
String forwardUrl = viewName.substring(FORWARD_URL_PREFIX.length());
return new InternalResourceView(forwardUrl);
}
return resolveScriptingView(viewName);
} } | public class class_name {
@Override
public View resolveViewName(String viewName, Locale locale) {
if (viewName == null) {
throw new IllegalArgumentException("Method argument viewName must not be null.");
}
if (viewName.startsWith(REDIRECT_URL_PREFIX)) {
String redirectUrl = viewName.substring(REDIRECT_URL_PREFIX.length());
return new SlingRedirectView(redirectUrl, true, true); // depends on control dependency: [if], data = [none]
}
if (viewName.startsWith(FORWARD_URL_PREFIX)) {
String forwardUrl = viewName.substring(FORWARD_URL_PREFIX.length());
return new InternalResourceView(forwardUrl); // depends on control dependency: [if], data = [none]
}
return resolveScriptingView(viewName);
} } |
public class class_name {
public String getAdjustedSiteRoot(String siteRoot, String resourcename) {
if (resourcename.startsWith(VFS_PATH_SYSTEM)) {
return "";
} else {
return siteRoot;
}
} } | public class class_name {
public String getAdjustedSiteRoot(String siteRoot, String resourcename) {
if (resourcename.startsWith(VFS_PATH_SYSTEM)) {
return ""; // depends on control dependency: [if], data = [none]
} else {
return siteRoot; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static int[] getMeasurementsForShiftingMode(Context context, int screenWidth, int noOfTabs, boolean scrollable) {
int[] result = new int[2];
int minWidth = (int) context.getResources().getDimension(R.dimen.shifting_min_width_inactive);
int maxWidth = (int) context.getResources().getDimension(R.dimen.shifting_max_width_inactive);
double minPossibleWidth = minWidth * (noOfTabs + 0.5);
double maxPossibleWidth = maxWidth * (noOfTabs + 0.75);
int itemWidth;
int itemActiveWidth;
if (screenWidth < minPossibleWidth) {
if (scrollable) {
itemWidth = minWidth;
itemActiveWidth = (int) (minWidth * 1.5);
} else {
itemWidth = (int) (screenWidth / (noOfTabs + 0.5));
itemActiveWidth = (int) (itemWidth * 1.5);
}
} else if (screenWidth > maxPossibleWidth) {
itemWidth = maxWidth;
itemActiveWidth = (int) (itemWidth * 1.75);
} else {
double minPossibleWidth1 = minWidth * (noOfTabs + 0.625);
double minPossibleWidth2 = minWidth * (noOfTabs + 0.75);
itemWidth = (int) (screenWidth / (noOfTabs + 0.5));
itemActiveWidth = (int) (itemWidth * 1.5);
if (screenWidth > minPossibleWidth1) {
itemWidth = (int) (screenWidth / (noOfTabs + 0.625));
itemActiveWidth = (int) (itemWidth * 1.625);
if (screenWidth > minPossibleWidth2) {
itemWidth = (int) (screenWidth / (noOfTabs + 0.75));
itemActiveWidth = (int) (itemWidth * 1.75);
}
}
}
result[0] = itemWidth;
result[1] = itemActiveWidth;
return result;
} } | public class class_name {
static int[] getMeasurementsForShiftingMode(Context context, int screenWidth, int noOfTabs, boolean scrollable) {
int[] result = new int[2];
int minWidth = (int) context.getResources().getDimension(R.dimen.shifting_min_width_inactive);
int maxWidth = (int) context.getResources().getDimension(R.dimen.shifting_max_width_inactive);
double minPossibleWidth = minWidth * (noOfTabs + 0.5);
double maxPossibleWidth = maxWidth * (noOfTabs + 0.75);
int itemWidth;
int itemActiveWidth;
if (screenWidth < minPossibleWidth) {
if (scrollable) {
itemWidth = minWidth; // depends on control dependency: [if], data = [none]
itemActiveWidth = (int) (minWidth * 1.5); // depends on control dependency: [if], data = [none]
} else {
itemWidth = (int) (screenWidth / (noOfTabs + 0.5)); // depends on control dependency: [if], data = [none]
itemActiveWidth = (int) (itemWidth * 1.5); // depends on control dependency: [if], data = [none]
}
} else if (screenWidth > maxPossibleWidth) {
itemWidth = maxWidth; // depends on control dependency: [if], data = [none]
itemActiveWidth = (int) (itemWidth * 1.75); // depends on control dependency: [if], data = [none]
} else {
double minPossibleWidth1 = minWidth * (noOfTabs + 0.625);
double minPossibleWidth2 = minWidth * (noOfTabs + 0.75);
itemWidth = (int) (screenWidth / (noOfTabs + 0.5)); // depends on control dependency: [if], data = [(screenWidth]
itemActiveWidth = (int) (itemWidth * 1.5); // depends on control dependency: [if], data = [none]
if (screenWidth > minPossibleWidth1) {
itemWidth = (int) (screenWidth / (noOfTabs + 0.625)); // depends on control dependency: [if], data = [(screenWidth]
itemActiveWidth = (int) (itemWidth * 1.625); // depends on control dependency: [if], data = [none]
if (screenWidth > minPossibleWidth2) {
itemWidth = (int) (screenWidth / (noOfTabs + 0.75)); // depends on control dependency: [if], data = [(screenWidth]
itemActiveWidth = (int) (itemWidth * 1.75); // depends on control dependency: [if], data = [none]
}
}
}
result[0] = itemWidth;
result[1] = itemActiveWidth;
return result;
} } |
public class class_name {
public boolean isSun(ZonedDateTime currentDate) {
if (getSun().getNeverRise()) {
return false;
} else if (getSun().getNeverSet()) {
return true;
}
return timeWithinPeriod(currentDate);
} } | public class class_name {
public boolean isSun(ZonedDateTime currentDate) {
if (getSun().getNeverRise()) {
return false; // depends on control dependency: [if], data = [none]
} else if (getSun().getNeverSet()) {
return true; // depends on control dependency: [if], data = [none]
}
return timeWithinPeriod(currentDate);
} } |
public class class_name {
void sessionError(final SibRaMessagingEngineConnection connection,
final ConsumerSession session, final Throwable throwable) {
/*
* Output a message to the console if the exception is not an
* SINotPossibleInCurrentConfigurationException since this is thrown
* when destinations are deleted and we would then expect this
* exception to be thrown.
*
* d364674 - if a destination is deleted while we are listening then
* we will receive session dropped here. Use a warning message rather
* than an error (there may be other causes for session dropped that
* we still want to warn about).
*/
if (throwable instanceof SISessionDroppedException)
{
final SIDestinationAddress destination = session
.getDestinationAddress();
SibTr.warning(TRACE, "SESSION_DROPPED_CWSIV0808", new Object[] {
destination.getDestinationName(),
connection.getConnection().getMeName(),
destination.getBusName(),
throwable});
} else if (! (throwable instanceof SINotPossibleInCurrentConfigurationException))
{
final SIDestinationAddress destination = session
.getDestinationAddress();
SibTr.error(TRACE, "SESSION_ERROR_CWSIV0806", new Object[] { throwable,
destination.getDestinationName(),
connection.getConnection().getMeName(),
destination.getBusName(), this });
}
} } | public class class_name {
void sessionError(final SibRaMessagingEngineConnection connection,
final ConsumerSession session, final Throwable throwable) {
/*
* Output a message to the console if the exception is not an
* SINotPossibleInCurrentConfigurationException since this is thrown
* when destinations are deleted and we would then expect this
* exception to be thrown.
*
* d364674 - if a destination is deleted while we are listening then
* we will receive session dropped here. Use a warning message rather
* than an error (there may be other causes for session dropped that
* we still want to warn about).
*/
if (throwable instanceof SISessionDroppedException)
{
final SIDestinationAddress destination = session
.getDestinationAddress();
SibTr.warning(TRACE, "SESSION_DROPPED_CWSIV0808", new Object[] {
destination.getDestinationName(),
connection.getConnection().getMeName(),
destination.getBusName(),
throwable}); // depends on control dependency: [if], data = [none]
} else if (! (throwable instanceof SINotPossibleInCurrentConfigurationException))
{
final SIDestinationAddress destination = session
.getDestinationAddress();
SibTr.error(TRACE, "SESSION_ERROR_CWSIV0806", new Object[] { throwable,
destination.getDestinationName(),
connection.getConnection().getMeName(),
destination.getBusName(), this }); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void similarTransform( int k) {
double t[] = QT.data;
// find the largest value in this column
// this is used to normalize the column and mitigate overflow/underflow
double max = 0;
int rowU = (k-1)*N;
for( int i = k; i < N; i++ ) {
double val = Math.abs(t[rowU+i]);
if( val > max )
max = val;
}
if( max > 0 ) {
// -------- set up the reflector Q_k
double tau = QrHelperFunctions_DDRM.computeTauAndDivide(k, N, t, rowU, max);
// write the reflector into the lower left column of the matrix
double nu = t[rowU+k] + tau;
QrHelperFunctions_DDRM.divideElements(k + 1, N, t, rowU, nu);
t[rowU+k] = 1.0;
double gamma = nu/tau;
gammas[k] = gamma;
// ---------- Specialized householder that takes advantage of the symmetry
householderSymmetric(k,gamma);
// since the first element in the householder vector is known to be 1
// store the full upper hessenberg
t[rowU+k] = -tau*max;
} else {
gammas[k] = 0;
}
} } | public class class_name {
private void similarTransform( int k) {
double t[] = QT.data;
// find the largest value in this column
// this is used to normalize the column and mitigate overflow/underflow
double max = 0;
int rowU = (k-1)*N;
for( int i = k; i < N; i++ ) {
double val = Math.abs(t[rowU+i]);
if( val > max )
max = val;
}
if( max > 0 ) {
// -------- set up the reflector Q_k
double tau = QrHelperFunctions_DDRM.computeTauAndDivide(k, N, t, rowU, max);
// write the reflector into the lower left column of the matrix
double nu = t[rowU+k] + tau;
QrHelperFunctions_DDRM.divideElements(k + 1, N, t, rowU, nu); // depends on control dependency: [if], data = [none]
t[rowU+k] = 1.0; // depends on control dependency: [if], data = [none]
double gamma = nu/tau;
gammas[k] = gamma; // depends on control dependency: [if], data = [none]
// ---------- Specialized householder that takes advantage of the symmetry
householderSymmetric(k,gamma); // depends on control dependency: [if], data = [none]
// since the first element in the householder vector is known to be 1
// store the full upper hessenberg
t[rowU+k] = -tau*max; // depends on control dependency: [if], data = [none]
} else {
gammas[k] = 0; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(PutContainerPolicyRequest putContainerPolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (putContainerPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putContainerPolicyRequest.getContainerName(), CONTAINERNAME_BINDING);
protocolMarshaller.marshall(putContainerPolicyRequest.getPolicy(), POLICY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PutContainerPolicyRequest putContainerPolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (putContainerPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putContainerPolicyRequest.getContainerName(), CONTAINERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putContainerPolicyRequest.getPolicy(), POLICY_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 init(HttpServletRequest request) {
resetTimers();
if (request != null) {
String p = request.getPathInfo();
final int pathLength = (p == null ? 0 : p.length());
final StringBuffer urlSb = request.getRequestURL();
String simpleUrl = urlSb.toString(); // without qs
String qs = request.getQueryString();
if (qs != null) urlSb.append("?").append(qs);
final String fullUrl = urlSb.toString();
contextUrl.set(fullUrl);
requestCookies.remove();
responseCookies.remove();
StringBuilder cookiesDump = new StringBuilder();
Map<String, Cookie> cookiez = requestCookies.get();
for (javax.servlet.http.Cookie c : Check.ifNull(request.getCookies(), new javax.servlet.http.Cookie[0])) {
cookiez.put(c.getName(), new BasicClientCookie(c.getName(), c.getValue()));
cookiesDump.append(c.toString()).append(";");
}
String xForwardedFor = request.getHeader(HEADER_X_FORWARDED_FOR);
clientIp.set(xForwardedFor != null ? xForwardedFor : request.getRemoteAddr());
String xForwardedUrl = request.getHeader(HEADER_X_FORWARDED_URL);
if (xForwardedUrl != null) {
int i = xForwardedUrl.lastIndexOf("?");
simpleUrl = (i == -1 ? xForwardedUrl : xForwardedUrl.substring(0, i));
}
try {
simpleUrl = URLDecoder.decode(simpleUrl, "UTF-8"); // convert "%xx" stuff before working with lengths
} catch (UnsupportedEncodingException e) {
log.error(e.toString());
}
contextPath.set(simpleUrl.substring(0, simpleUrl.length() - pathLength));
if (verbose) log.info(">>> Time 0 [" + fullUrl + "]. cookies from client: " + cookiesDump.toString());
}
initialized.set(true);
} } | public class class_name {
public void init(HttpServletRequest request) {
resetTimers();
if (request != null) {
String p = request.getPathInfo();
final int pathLength = (p == null ? 0 : p.length());
final StringBuffer urlSb = request.getRequestURL();
String simpleUrl = urlSb.toString(); // without qs
String qs = request.getQueryString();
if (qs != null) urlSb.append("?").append(qs);
final String fullUrl = urlSb.toString();
contextUrl.set(fullUrl); // depends on control dependency: [if], data = [none]
requestCookies.remove(); // depends on control dependency: [if], data = [none]
responseCookies.remove(); // depends on control dependency: [if], data = [none]
StringBuilder cookiesDump = new StringBuilder();
Map<String, Cookie> cookiez = requestCookies.get();
for (javax.servlet.http.Cookie c : Check.ifNull(request.getCookies(), new javax.servlet.http.Cookie[0])) {
cookiez.put(c.getName(), new BasicClientCookie(c.getName(), c.getValue())); // depends on control dependency: [for], data = [c]
cookiesDump.append(c.toString()).append(";"); // depends on control dependency: [for], data = [c]
}
String xForwardedFor = request.getHeader(HEADER_X_FORWARDED_FOR);
clientIp.set(xForwardedFor != null ? xForwardedFor : request.getRemoteAddr()); // depends on control dependency: [if], data = [none]
String xForwardedUrl = request.getHeader(HEADER_X_FORWARDED_URL);
if (xForwardedUrl != null) {
int i = xForwardedUrl.lastIndexOf("?");
simpleUrl = (i == -1 ? xForwardedUrl : xForwardedUrl.substring(0, i)); // depends on control dependency: [if], data = [none]
}
try {
simpleUrl = URLDecoder.decode(simpleUrl, "UTF-8"); // convert "%xx" stuff before working with lengths // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
log.error(e.toString());
} // depends on control dependency: [catch], data = [none]
contextPath.set(simpleUrl.substring(0, simpleUrl.length() - pathLength)); // depends on control dependency: [if], data = [none]
if (verbose) log.info(">>> Time 0 [" + fullUrl + "]. cookies from client: " + cookiesDump.toString()); // depends on control dependency: [if], data = [none]
}
initialized.set(true);
} } |
public class class_name {
private void computeRemainingRows(GrayS16 left, GrayS16 right )
{
for( int row = regionHeight; row < left.height; row++ ) {
int oldRow = row%regionHeight;
// subtract first row from vertical score
int scores[] = horizontalScore[oldRow];
for( int i = 0; i < lengthHorizontal; i++ ) {
verticalScore[i] -= scores[i];
}
UtilDisparityScore.computeScoreRow(left, right, row, scores,
minDisparity,maxDisparity,regionWidth,elementScore);
// add the new score
for( int i = 0; i < lengthHorizontal; i++ ) {
verticalScore[i] += scores[i];
}
// compute disparity
computeDisparity.process(row - regionHeight + 1 + radiusY, verticalScore);
}
} } | public class class_name {
private void computeRemainingRows(GrayS16 left, GrayS16 right )
{
for( int row = regionHeight; row < left.height; row++ ) {
int oldRow = row%regionHeight;
// subtract first row from vertical score
int scores[] = horizontalScore[oldRow];
for( int i = 0; i < lengthHorizontal; i++ ) {
verticalScore[i] -= scores[i]; // depends on control dependency: [for], data = [i]
}
UtilDisparityScore.computeScoreRow(left, right, row, scores,
minDisparity,maxDisparity,regionWidth,elementScore); // depends on control dependency: [for], data = [row]
// add the new score
for( int i = 0; i < lengthHorizontal; i++ ) {
verticalScore[i] += scores[i]; // depends on control dependency: [for], data = [i]
}
// compute disparity
computeDisparity.process(row - regionHeight + 1 + radiusY, verticalScore); // depends on control dependency: [for], data = [row]
}
} } |
public class class_name {
@Override
public Class<?> compile(String className, String code, ClassLoader classLoader, OutputStream os, long timestamp) {
Class<?> cls = null;
try {
cls = ClassHelper.forName(className, classLoader);
} catch (ClassNotFoundException e) {
// ignore this exception
} catch (LinkageError e) {
// ignore this exception
}
if (cls != null) {
return cls;
}
// to check cache
byte[] bytes = cached(className, timestamp);
// if has cached and timestamp is not changed will return a not null byte array
if (bytes != null) {
LoadableClassLoader loadableClassLoader = new LoadableClassLoader(classLoader);
loadableClassLoader.defineNewClass(className, bytes, 0, bytes.length);
try {
return loadableClassLoader.loadClass(className);
} catch (ClassNotFoundException e) {
// ignore this exception
}
}
cls = compiler.compile(className, code, classLoader, os, timestamp);
cache(className, compiler.loadBytes(className), timestamp);
return cls;
} } | public class class_name {
@Override
public Class<?> compile(String className, String code, ClassLoader classLoader, OutputStream os, long timestamp) {
Class<?> cls = null;
try {
cls = ClassHelper.forName(className, classLoader);
} catch (ClassNotFoundException e) {
// ignore this exception
} catch (LinkageError e) {
// ignore this exception
}
if (cls != null) {
return cls;
}
// to check cache
byte[] bytes = cached(className, timestamp);
// if has cached and timestamp is not changed will return a not null byte array
if (bytes != null) {
LoadableClassLoader loadableClassLoader = new LoadableClassLoader(classLoader);
loadableClassLoader.defineNewClass(className, bytes, 0, bytes.length);
try {
return loadableClassLoader.loadClass(className); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
// ignore this exception
} // depends on control dependency: [catch], data = [none]
}
cls = compiler.compile(className, code, classLoader, os, timestamp);
cache(className, compiler.loadBytes(className), timestamp);
return cls;
} } |
public class class_name {
public static <E> SetFactory<E> mapBased(final MapFactory<E,Object> mapFact) {
return new SetFactory<E>() {
private static final long serialVersionUID = 2323753186840412499L;
public Set<E> create() { return new MapBasedSet<E>(mapFact); }
public Set<E> newColl(Collection<E> c) {
if(c instanceof MapBasedSet/*<E>*/) {
return ((MapBasedSet<E>) c).clone();
}
return super.newColl(c);
}
};
} } | public class class_name {
public static <E> SetFactory<E> mapBased(final MapFactory<E,Object> mapFact) {
return new SetFactory<E>() {
private static final long serialVersionUID = 2323753186840412499L;
public Set<E> create() { return new MapBasedSet<E>(mapFact); }
public Set<E> newColl(Collection<E> c) {
if(c instanceof MapBasedSet/*<E>*/) {
return ((MapBasedSet<E>) c).clone(); // depends on control dependency: [if], data = [none]
}
return super.newColl(c);
}
};
} } |
public class class_name {
protected Map<String, NameWithUpdate> initUpdatesFromCurrentValues(Collection<MonolingualTextValue> currentValues) {
Map<String, NameWithUpdate> updates = new HashMap<>();
for(MonolingualTextValue label: currentValues) {
updates.put(label.getLanguageCode(),
new NameWithUpdate(label, false));
}
return updates;
} } | public class class_name {
protected Map<String, NameWithUpdate> initUpdatesFromCurrentValues(Collection<MonolingualTextValue> currentValues) {
Map<String, NameWithUpdate> updates = new HashMap<>();
for(MonolingualTextValue label: currentValues) {
updates.put(label.getLanguageCode(),
new NameWithUpdate(label, false)); // depends on control dependency: [for], data = [label]
}
return updates;
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void saveToCookie(IExtendedRequest req, String reqURL, AuthenticationResult result, boolean keepInput) {
String strParam = null;
try {
strParam = serializePostParam(req, reqURL, keepInput);
} catch (Exception e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "IO Exception storing POST parameters onto a cookie: ", new Object[] { e });
}
}
if (strParam != null) {
Cookie paramCookie = new Cookie(POSTPARAM_COOKIE, strParam);
paramCookie.setMaxAge(-1);
paramCookie.setPath(reqURL);
if (webAppSecurityConfig.getHttpOnlyCookies()) {
paramCookie.setHttpOnly(true);
}
if (webAppSecurityConfig.getSSORequiresSSL()) {
paramCookie.setSecure(true);
}
result.setCookie(paramCookie);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "encoded POST parameters: " + strParam);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private void saveToCookie(IExtendedRequest req, String reqURL, AuthenticationResult result, boolean keepInput) {
String strParam = null;
try {
strParam = serializePostParam(req, reqURL, keepInput); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "IO Exception storing POST parameters onto a cookie: ", new Object[] { e }); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
if (strParam != null) {
Cookie paramCookie = new Cookie(POSTPARAM_COOKIE, strParam);
paramCookie.setMaxAge(-1); // depends on control dependency: [if], data = [none]
paramCookie.setPath(reqURL); // depends on control dependency: [if], data = [none]
if (webAppSecurityConfig.getHttpOnlyCookies()) {
paramCookie.setHttpOnly(true); // depends on control dependency: [if], data = [none]
}
if (webAppSecurityConfig.getSSORequiresSSL()) {
paramCookie.setSecure(true); // depends on control dependency: [if], data = [none]
}
result.setCookie(paramCookie); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "encoded POST parameters: " + strParam); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void fufillFuture(ReceiveMessageFuture future) {
ReceiveMessageBatchTask task = finishedTasks.getFirst();
ReceiveMessageResult result = new ReceiveMessageResult();
LinkedList<Message> messages = new LinkedList<Message>();
result.setMessages(messages);
Exception exception = task.getException();
int numRetrieved = 0;
boolean batchDone = false;
while (numRetrieved < future.getRequestedSize()) {
Message msg = task.removeMessage();
// a non-empty batch can still give back a null
// message if the message expired.
if (msg != null) {
messages.add(msg);
++numRetrieved;
} else {
batchDone = true;
break;
}
}
// we may have just drained the batch.
batchDone = batchDone || task.isEmpty() || (exception != null);
if (batchDone) {
finishedTasks.removeFirst();
}
result.setMessages(messages);
// if after the above runs the exception is not null,
// the finished batch has encountered an error, and we will
// report that in the Future. Otherwise, we will fill
// the future with the receive result
if (exception != null) {
future.setFailure(exception);
} else {
future.setSuccess(result);
}
} } | public class class_name {
private void fufillFuture(ReceiveMessageFuture future) {
ReceiveMessageBatchTask task = finishedTasks.getFirst();
ReceiveMessageResult result = new ReceiveMessageResult();
LinkedList<Message> messages = new LinkedList<Message>();
result.setMessages(messages);
Exception exception = task.getException();
int numRetrieved = 0;
boolean batchDone = false;
while (numRetrieved < future.getRequestedSize()) {
Message msg = task.removeMessage();
// a non-empty batch can still give back a null
// message if the message expired.
if (msg != null) {
messages.add(msg); // depends on control dependency: [if], data = [(msg]
++numRetrieved; // depends on control dependency: [if], data = [none]
} else {
batchDone = true; // depends on control dependency: [if], data = [none]
break;
}
}
// we may have just drained the batch.
batchDone = batchDone || task.isEmpty() || (exception != null);
if (batchDone) {
finishedTasks.removeFirst(); // depends on control dependency: [if], data = [none]
}
result.setMessages(messages);
// if after the above runs the exception is not null,
// the finished batch has encountered an error, and we will
// report that in the Future. Otherwise, we will fill
// the future with the receive result
if (exception != null) {
future.setFailure(exception); // depends on control dependency: [if], data = [(exception]
} else {
future.setSuccess(result); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void refresh() {
// do nothing
org.grails.io.support.Resource descriptor = getDescriptor();
if (grailsApplication == null || descriptor == null) {
return;
}
ClassLoader parent = grailsApplication.getClassLoader();
GroovyClassLoader gcl = new GroovyClassLoader(parent);
try {
initialisePlugin(gcl.parseClass(descriptor.getFile()));
} catch (Exception e) {
LOG.error("Error refreshing plugin: " + e.getMessage(), e);
}
} } | public class class_name {
@Override
public void refresh() {
// do nothing
org.grails.io.support.Resource descriptor = getDescriptor();
if (grailsApplication == null || descriptor == null) {
return; // depends on control dependency: [if], data = [none]
}
ClassLoader parent = grailsApplication.getClassLoader();
GroovyClassLoader gcl = new GroovyClassLoader(parent);
try {
initialisePlugin(gcl.parseClass(descriptor.getFile())); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Error refreshing plugin: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(Resource resource, ProtocolMarshaller protocolMarshaller) {
if (resource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(resource.getId(), ID_BINDING);
protocolMarshaller.marshall(resource.getParentId(), PARENTID_BINDING);
protocolMarshaller.marshall(resource.getPathPart(), PATHPART_BINDING);
protocolMarshaller.marshall(resource.getPath(), PATH_BINDING);
protocolMarshaller.marshall(resource.getResourceMethods(), RESOURCEMETHODS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Resource resource, ProtocolMarshaller protocolMarshaller) {
if (resource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(resource.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resource.getParentId(), PARENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resource.getPathPart(), PATHPART_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resource.getPath(), PATH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resource.getResourceMethods(), RESOURCEMETHODS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean validateAllRulesForSingleCell(final int formRow, final int formCol, final FacesCell cell,
final Cell poiCell, final String value, final SheetConfiguration sheetConfig,
final List<CellFormAttributes> cellAttributes, boolean updateGui) {
Sheet sheet1 = parent.getWb().getSheet(sheetConfig.getSheetName());
for (CellFormAttributes attr : cellAttributes) {
boolean pass = doValidation(value, attr, poiCell.getRowIndex(), poiCell.getColumnIndex(), sheet1);
if (!pass) {
String errmsg = attr.getMessage();
if (errmsg == null) {
errmsg = TieConstants.DEFALT_MSG_INVALID_INPUT;
}
cell.setErrormsg(errmsg);
LOG.log(Level.INFO, "Validation failed for sheet {0} row {1} column {2} : {3}", new Object[] {
poiCell.getSheet().getSheetName(), poiCell.getRowIndex(), poiCell.getColumnIndex(), errmsg });
refreshAfterStatusChanged(false, true, formRow, formCol, cell, updateGui);
return false;
}
}
return true;
} } | public class class_name {
private boolean validateAllRulesForSingleCell(final int formRow, final int formCol, final FacesCell cell,
final Cell poiCell, final String value, final SheetConfiguration sheetConfig,
final List<CellFormAttributes> cellAttributes, boolean updateGui) {
Sheet sheet1 = parent.getWb().getSheet(sheetConfig.getSheetName());
for (CellFormAttributes attr : cellAttributes) {
boolean pass = doValidation(value, attr, poiCell.getRowIndex(), poiCell.getColumnIndex(), sheet1);
if (!pass) {
String errmsg = attr.getMessage();
if (errmsg == null) {
errmsg = TieConstants.DEFALT_MSG_INVALID_INPUT;
// depends on control dependency: [if], data = [none]
}
cell.setErrormsg(errmsg);
// depends on control dependency: [if], data = [none]
LOG.log(Level.INFO, "Validation failed for sheet {0} row {1} column {2} : {3}", new Object[] {
poiCell.getSheet().getSheetName(), poiCell.getRowIndex(), poiCell.getColumnIndex(), errmsg });
// depends on control dependency: [if], data = [none]
refreshAfterStatusChanged(false, true, formRow, formCol, cell, updateGui);
// depends on control dependency: [if], data = [none]
return false;
// depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public void init(OutputStream out, int bufSize)
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"init", "init", out);
}
// make sure that we don't have anything hanging around between
// init()s -- this is the fix for the broken pipe error being
// returned to the browser
initNewBuffer(out, bufSize);
} } | public class class_name {
public void init(OutputStream out, int bufSize)
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"init", "init", out); // depends on control dependency: [if], data = [none]
}
// make sure that we don't have anything hanging around between
// init()s -- this is the fix for the broken pipe error being
// returned to the browser
initNewBuffer(out, bufSize);
} } |
public class class_name {
private String format(final long bytes) {
if (bytes > MB) {
return String.valueOf(bytes / MB) + " MB";
}
return String.valueOf(bytes / KB) + " KB";
} } | public class class_name {
private String format(final long bytes) {
if (bytes > MB) {
return String.valueOf(bytes / MB) + " MB"; // depends on control dependency: [if], data = [(bytes]
}
return String.valueOf(bytes / KB) + " KB";
} } |
public class class_name {
public java.lang.String getOwningGroup() {
java.lang.Object ref = owningGroup_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
owningGroup_ = s;
}
return s;
}
} } | public class class_name {
public java.lang.String getOwningGroup() {
java.lang.Object ref = owningGroup_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref; // depends on control dependency: [if], data = [none]
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
owningGroup_ = s; // depends on control dependency: [if], data = [none]
}
return s; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean isReactive(Type type) {
if (!ParameterizedType.class.isAssignableFrom(type.getClass())) {
return false;
}
ParameterizedType parameterizedType = (ParameterizedType) type;
Type raw = parameterizedType.getRawType();
return Arrays.asList(((Class) raw).getInterfaces())
.contains(Publisher.class);
} } | public class class_name {
private boolean isReactive(Type type) {
if (!ParameterizedType.class.isAssignableFrom(type.getClass())) {
return false; // depends on control dependency: [if], data = [none]
}
ParameterizedType parameterizedType = (ParameterizedType) type;
Type raw = parameterizedType.getRawType();
return Arrays.asList(((Class) raw).getInterfaces())
.contains(Publisher.class);
} } |
public class class_name {
public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) {
Class<?> currentClass = beanClass;
while (currentClass != null && currentClass != Object.class) {
if (currentClass.isAnnotationPresent(annotationClass)) {
return Optional.of(currentClass.getAnnotation(annotationClass));
}
currentClass = currentClass.getSuperclass();
}
return Optional.empty();
} } | public class class_name {
public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) {
Class<?> currentClass = beanClass;
while (currentClass != null && currentClass != Object.class) {
if (currentClass.isAnnotationPresent(annotationClass)) {
return Optional.of(currentClass.getAnnotation(annotationClass)); // depends on control dependency: [if], data = [none]
}
currentClass = currentClass.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return Optional.empty();
} } |
public class class_name {
public void set(CharSequence number) {
// reset the operands
negative = false;
decimal = false;
ni = 0;
nd = 0;
v = 0;
w = 0;
t = 0;
z = 0;
int length = number.length();
if (length < 1) {
return;
}
// index into the string
int i = 0;
if (number.charAt(0) == '-') {
negative = true;
i++;
}
// track number of trailing zeros in floating mode
long trail = 0;
// indicates a non-zero leading digit on the decimal part.
boolean leading = false;
// indicates an unexpected character was encountered.
boolean fail = false;
while (i < length) {
char ch = number.charAt(i);
switch (ch) {
case '0':
if (decimal) {
v++;
if (leading) {
trail++;
} else {
z++;
}
}
if (nd > 0) {
nd *= 10;
}
nd += (long)(ch - '0');
break;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (decimal) {
v++;
leading = true;
}
trail = 0;
if (nd > 0) {
nd *= 10;
}
nd += (long)(ch - '0');
break;
case '.':
if (decimal) {
fail = true;
} else {
decimal = true;
ni = nd;
nd = 0;
}
break;
default:
fail = true;
break;
}
if (fail) {
break;
}
// Check for imminent overflow and reduce or bail out.
if (decimal) {
if (nd >= LIMIT) {
break;
}
} else {
nd = integerReduce(nd);
}
i++;
}
// If no non-zero leading digit was detected, record the zeroes as trailing
// digits and reset the leading zero count.
if (!leading) {
trail = z;
z = 0;
}
// calculate the final values of operands tracking digit counts
if (decimal) {
w = v - trail;
} else {
// swap if we never saw a decimal point
ni = nd;
nd = 0;
}
t = nd;
for (int j = 0; j < trail; j++) {
t /= 10;
}
} } | public class class_name {
public void set(CharSequence number) {
// reset the operands
negative = false;
decimal = false;
ni = 0;
nd = 0;
v = 0;
w = 0;
t = 0;
z = 0;
int length = number.length();
if (length < 1) {
return; // depends on control dependency: [if], data = [none]
}
// index into the string
int i = 0;
if (number.charAt(0) == '-') {
negative = true; // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
}
// track number of trailing zeros in floating mode
long trail = 0;
// indicates a non-zero leading digit on the decimal part.
boolean leading = false;
// indicates an unexpected character was encountered.
boolean fail = false;
while (i < length) {
char ch = number.charAt(i);
switch (ch) {
case '0':
if (decimal) {
v++; // depends on control dependency: [if], data = [none]
if (leading) {
trail++; // depends on control dependency: [if], data = [none]
} else {
z++; // depends on control dependency: [if], data = [none]
}
}
if (nd > 0) {
nd *= 10; // depends on control dependency: [if], data = [none]
}
nd += (long)(ch - '0');
break;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (decimal) {
v++; // depends on control dependency: [if], data = [none]
leading = true; // depends on control dependency: [if], data = [none]
}
trail = 0;
if (nd > 0) {
nd *= 10; // depends on control dependency: [if], data = [none]
}
nd += (long)(ch - '0');
break;
case '.':
if (decimal) {
fail = true; // depends on control dependency: [if], data = [none]
} else {
decimal = true; // depends on control dependency: [if], data = [none]
ni = nd; // depends on control dependency: [if], data = [none]
nd = 0; // depends on control dependency: [if], data = [none]
}
break;
default:
fail = true;
break;
}
if (fail) {
break;
}
// Check for imminent overflow and reduce or bail out.
if (decimal) {
if (nd >= LIMIT) {
break;
}
} else {
nd = integerReduce(nd); // depends on control dependency: [if], data = [none]
}
i++; // depends on control dependency: [while], data = [none]
}
// If no non-zero leading digit was detected, record the zeroes as trailing
// digits and reset the leading zero count.
if (!leading) {
trail = z; // depends on control dependency: [if], data = [none]
z = 0; // depends on control dependency: [if], data = [none]
}
// calculate the final values of operands tracking digit counts
if (decimal) {
w = v - trail; // depends on control dependency: [if], data = [none]
} else {
// swap if we never saw a decimal point
ni = nd; // depends on control dependency: [if], data = [none]
nd = 0; // depends on control dependency: [if], data = [none]
}
t = nd;
for (int j = 0; j < trail; j++) {
t /= 10; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private FieldElement readField(String documentation, FieldElement.Label label) {
DataType type = readDataType();
String name = readName();
if (readChar() != '=') throw unexpected("expected '='");
int tag = readInt();
FieldElement.Builder builder = FieldElement.builder()
.label(label)
.type(type)
.name(name)
.tag(tag);
if (peekChar() == '[') {
pos++;
while (true) {
builder.addOption(readOption('='));
// Check for optional ',' or closing ']'
char c = peekChar();
if (c == ']') {
pos++;
break;
} else if (c == ',') {
pos++;
}
}
}
if (readChar() != ';') {
throw unexpected("expected ';'");
}
documentation = tryAppendTrailingDocumentation(documentation);
return builder.documentation(documentation).build();
} } | public class class_name {
private FieldElement readField(String documentation, FieldElement.Label label) {
DataType type = readDataType();
String name = readName();
if (readChar() != '=') throw unexpected("expected '='");
int tag = readInt();
FieldElement.Builder builder = FieldElement.builder()
.label(label)
.type(type)
.name(name)
.tag(tag);
if (peekChar() == '[') {
pos++; // depends on control dependency: [if], data = [none]
while (true) {
builder.addOption(readOption('=')); // depends on control dependency: [while], data = [none]
// Check for optional ',' or closing ']'
char c = peekChar();
if (c == ']') {
pos++; // depends on control dependency: [if], data = [none]
break;
} else if (c == ',') {
pos++; // depends on control dependency: [if], data = [none]
}
}
}
if (readChar() != ';') {
throw unexpected("expected ';'");
}
documentation = tryAppendTrailingDocumentation(documentation);
return builder.documentation(documentation).build();
} } |
public class class_name {
public static boolean isValidName( String name ) {
if (name == null || name.length() == 0) return false;
CharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
if (!isValidNameStart(c)) return false;
while (c != CharacterIterator.DONE) {
if (!isValidName(c)) return false;
c = iter.next();
}
return true;
} } | public class class_name {
public static boolean isValidName( String name ) {
if (name == null || name.length() == 0) return false;
CharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
if (!isValidNameStart(c)) return false;
while (c != CharacterIterator.DONE) {
if (!isValidName(c)) return false;
c = iter.next(); // depends on control dependency: [while], data = [none]
}
return true;
} } |
public class class_name {
private void pause() {
if (mHasAlreadyPlayed && !mIsPaused) {
mIsPaused = true;
if (!mIsPreparing) {
mMediaPlayer.pause();
}
// broadcast event
Intent intent = new Intent(PlaybackListener.ACTION_ON_PLAYER_PAUSED);
mLocalBroadcastManager.sendBroadcast(intent);
updateNotification();
mMediaSession.setPlaybackState(MediaSessionWrapper.PLAYBACK_STATE_PAUSED);
pauseTimer();
}
} } | public class class_name {
private void pause() {
if (mHasAlreadyPlayed && !mIsPaused) {
mIsPaused = true; // depends on control dependency: [if], data = [none]
if (!mIsPreparing) {
mMediaPlayer.pause(); // depends on control dependency: [if], data = [none]
}
// broadcast event
Intent intent = new Intent(PlaybackListener.ACTION_ON_PLAYER_PAUSED);
mLocalBroadcastManager.sendBroadcast(intent); // depends on control dependency: [if], data = [none]
updateNotification(); // depends on control dependency: [if], data = [none]
mMediaSession.setPlaybackState(MediaSessionWrapper.PLAYBACK_STATE_PAUSED); // depends on control dependency: [if], data = [none]
pauseTimer(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Message5WH_Builder addWhy(Object ...why){
if(this.why==null){
this.why = new StrBuilder(50);
}
this.why.appendAll(why);
return this;
} } | public class class_name {
public Message5WH_Builder addWhy(Object ...why){
if(this.why==null){
this.why = new StrBuilder(50); // depends on control dependency: [if], data = [none]
}
this.why.appendAll(why);
return this;
} } |
public class class_name {
@Override
public List<JsonEntityBean> getEntityBeans(List<String> params) {
// if no parameters have been supplied, just return an empty list
if (params == null || params.isEmpty()) {
return Collections.<JsonEntityBean>emptyList();
}
List<JsonEntityBean> beans = new ArrayList<JsonEntityBean>();
for (String param : params) {
String[] parts = param.split(":", 2);
JsonEntityBean member = getEntity(parts[0], parts[1], false);
beans.add(member);
}
return beans;
} } | public class class_name {
@Override
public List<JsonEntityBean> getEntityBeans(List<String> params) {
// if no parameters have been supplied, just return an empty list
if (params == null || params.isEmpty()) {
return Collections.<JsonEntityBean>emptyList(); // depends on control dependency: [if], data = [none]
}
List<JsonEntityBean> beans = new ArrayList<JsonEntityBean>();
for (String param : params) {
String[] parts = param.split(":", 2);
JsonEntityBean member = getEntity(parts[0], parts[1], false);
beans.add(member); // depends on control dependency: [for], data = [none]
}
return beans;
} } |
public class class_name {
private boolean redirectToHostedVoiceApp (final SipServletRequest request, final AccountsDao accounts,
final ApplicationsDao applications, String phone, Sid fromClientAccountSid,
IncomingPhoneNumber number) {
boolean isFoundHostedApp = false;
try {
if (number != null) {
ExtensionController ec = ExtensionController.getInstance();
IExtensionFeatureAccessRequest far = new FeatureAccessRequest(FeatureAccessRequest.Feature.INBOUND_VOICE, number.getAccountSid());
ExtensionResponse er = ec.executePreInboundAction(far, extensions);
if (er.isAllowed()) {
final VoiceInterpreterParams.Builder builder = new VoiceInterpreterParams.Builder();
builder.setConfiguration(configuration);
builder.setStorage(storage);
builder.setCallManager(self());
builder.setConferenceCenter(conferences);
builder.setBridgeManager(bridges);
builder.setSmsService(sms);
//https://github.com/RestComm/Restcomm-Connect/issues/1939
Sid accSid = fromClientAccountSid == null ? number.getAccountSid() : fromClientAccountSid;
builder.setAccount(accSid);
builder.setPhone(number.getAccountSid());
builder.setVersion(number.getApiVersion());
// notifications should go to fromClientAccountSid email if not present then to number account
// https://github.com/RestComm/Restcomm-Connect/issues/2011
final Account account = accounts.getAccount(accSid);
builder.setEmailAddress(account.getEmailAddress());
final Sid sid = number.getVoiceApplicationSid();
if (sid != null) {
final Application application = applications.getApplication(sid);
RcmlserverConfigurationSet rcmlserverConfig = RestcommConfiguration.getInstance().getRcmlserver();
RcmlserverResolver rcmlserverResolver = RcmlserverResolver.getInstance(rcmlserverConfig.getBaseUrl(), rcmlserverConfig.getApiPath());
builder.setUrl(uriUtils.resolve(rcmlserverResolver.resolveRelative(application.getRcmlUrl()), number.getAccountSid()));
} else {
builder.setUrl(uriUtils.resolve(number.getVoiceUrl(), number.getAccountSid()));
}
final String voiceMethod = number.getVoiceMethod();
if (voiceMethod == null || voiceMethod.isEmpty()) {
builder.setMethod("POST");
} else {
builder.setMethod(voiceMethod);
}
URI uri = number.getVoiceFallbackUrl();
if (uri != null)
builder.setFallbackUrl(uriUtils.resolve(uri, number.getAccountSid()));
else
builder.setFallbackUrl(null);
builder.setFallbackMethod(number.getVoiceFallbackMethod());
builder.setStatusCallback(number.getStatusCallback());
builder.setStatusCallbackMethod(number.getStatusCallbackMethod());
builder.setMonitoring(monitoring);
final Props props = VoiceInterpreter.props(builder.build());
final ActorRef interpreter = getContext().actorOf(props);
final ActorRef call = call(accSid, null);
final SipApplicationSession application = request.getApplicationSession();
application.setAttribute(Call.class.getName(), call);
call.tell(request, self());
interpreter.tell(new StartInterpreter(call), self());
isFoundHostedApp = true;
ec.executePostInboundAction(far, extensions);
} else {
//Extensions didn't allowed this call
String errMsg = "Inbound call to Number: " + number.getPhoneNumber()
+ " is not allowed";
if (logger.isDebugEnabled()) {
logger.debug(errMsg);
}
sendNotification(number.getAccountSid(), errMsg, 11001, "warning", true);
final SipServletResponse resp = request.createResponse(SC_FORBIDDEN, "Call not allowed");
resp.send();
ec.executePostInboundAction(far, extensions);
return false;
}
}
} catch (Exception notANumber) {
String errMsg;
if (number != null) {
errMsg = String.format("IncomingPhoneNumber %s does not have a Restcomm hosted application attached, exception %s", number.getPhoneNumber(), notANumber);
} else {
errMsg = String.format("IncomingPhoneNumber for %s, does not exist, exception %s", phone, notANumber);
}
sendNotification(fromClientAccountSid, errMsg, 11007, "error", false);
logger.warning(errMsg);
isFoundHostedApp = false;
}
return isFoundHostedApp;
} } | public class class_name {
private boolean redirectToHostedVoiceApp (final SipServletRequest request, final AccountsDao accounts,
final ApplicationsDao applications, String phone, Sid fromClientAccountSid,
IncomingPhoneNumber number) {
boolean isFoundHostedApp = false;
try {
if (number != null) {
ExtensionController ec = ExtensionController.getInstance();
IExtensionFeatureAccessRequest far = new FeatureAccessRequest(FeatureAccessRequest.Feature.INBOUND_VOICE, number.getAccountSid());
ExtensionResponse er = ec.executePreInboundAction(far, extensions);
if (er.isAllowed()) {
final VoiceInterpreterParams.Builder builder = new VoiceInterpreterParams.Builder();
builder.setConfiguration(configuration); // depends on control dependency: [if], data = [none]
builder.setStorage(storage); // depends on control dependency: [if], data = [none]
builder.setCallManager(self()); // depends on control dependency: [if], data = [none]
builder.setConferenceCenter(conferences); // depends on control dependency: [if], data = [none]
builder.setBridgeManager(bridges); // depends on control dependency: [if], data = [none]
builder.setSmsService(sms); // depends on control dependency: [if], data = [none]
//https://github.com/RestComm/Restcomm-Connect/issues/1939
Sid accSid = fromClientAccountSid == null ? number.getAccountSid() : fromClientAccountSid;
builder.setAccount(accSid); // depends on control dependency: [if], data = [none]
builder.setPhone(number.getAccountSid()); // depends on control dependency: [if], data = [none]
builder.setVersion(number.getApiVersion()); // depends on control dependency: [if], data = [none]
// notifications should go to fromClientAccountSid email if not present then to number account
// https://github.com/RestComm/Restcomm-Connect/issues/2011
final Account account = accounts.getAccount(accSid);
builder.setEmailAddress(account.getEmailAddress()); // depends on control dependency: [if], data = [none]
final Sid sid = number.getVoiceApplicationSid();
if (sid != null) {
final Application application = applications.getApplication(sid);
RcmlserverConfigurationSet rcmlserverConfig = RestcommConfiguration.getInstance().getRcmlserver();
RcmlserverResolver rcmlserverResolver = RcmlserverResolver.getInstance(rcmlserverConfig.getBaseUrl(), rcmlserverConfig.getApiPath());
builder.setUrl(uriUtils.resolve(rcmlserverResolver.resolveRelative(application.getRcmlUrl()), number.getAccountSid())); // depends on control dependency: [if], data = [none]
} else {
builder.setUrl(uriUtils.resolve(number.getVoiceUrl(), number.getAccountSid())); // depends on control dependency: [if], data = [none]
}
final String voiceMethod = number.getVoiceMethod();
if (voiceMethod == null || voiceMethod.isEmpty()) {
builder.setMethod("POST"); // depends on control dependency: [if], data = [none]
} else {
builder.setMethod(voiceMethod); // depends on control dependency: [if], data = [(voiceMethod]
}
URI uri = number.getVoiceFallbackUrl();
if (uri != null)
builder.setFallbackUrl(uriUtils.resolve(uri, number.getAccountSid()));
else
builder.setFallbackUrl(null);
builder.setFallbackMethod(number.getVoiceFallbackMethod()); // depends on control dependency: [if], data = [none]
builder.setStatusCallback(number.getStatusCallback()); // depends on control dependency: [if], data = [none]
builder.setStatusCallbackMethod(number.getStatusCallbackMethod()); // depends on control dependency: [if], data = [none]
builder.setMonitoring(monitoring); // depends on control dependency: [if], data = [none]
final Props props = VoiceInterpreter.props(builder.build());
final ActorRef interpreter = getContext().actorOf(props);
final ActorRef call = call(accSid, null);
final SipApplicationSession application = request.getApplicationSession();
application.setAttribute(Call.class.getName(), call); // depends on control dependency: [if], data = [none]
call.tell(request, self()); // depends on control dependency: [if], data = [none]
interpreter.tell(new StartInterpreter(call), self()); // depends on control dependency: [if], data = [none]
isFoundHostedApp = true; // depends on control dependency: [if], data = [none]
ec.executePostInboundAction(far, extensions); // depends on control dependency: [if], data = [none]
} else {
//Extensions didn't allowed this call
String errMsg = "Inbound call to Number: " + number.getPhoneNumber()
+ " is not allowed";
if (logger.isDebugEnabled()) {
logger.debug(errMsg); // depends on control dependency: [if], data = [none]
}
sendNotification(number.getAccountSid(), errMsg, 11001, "warning", true); // depends on control dependency: [if], data = [none]
final SipServletResponse resp = request.createResponse(SC_FORBIDDEN, "Call not allowed");
resp.send(); // depends on control dependency: [if], data = [none]
ec.executePostInboundAction(far, extensions); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
} catch (Exception notANumber) {
String errMsg;
if (number != null) {
errMsg = String.format("IncomingPhoneNumber %s does not have a Restcomm hosted application attached, exception %s", number.getPhoneNumber(), notANumber); // depends on control dependency: [if], data = [none]
} else {
errMsg = String.format("IncomingPhoneNumber for %s, does not exist, exception %s", phone, notANumber); // depends on control dependency: [if], data = [none]
}
sendNotification(fromClientAccountSid, errMsg, 11007, "error", false);
logger.warning(errMsg);
isFoundHostedApp = false;
} // depends on control dependency: [catch], data = [none]
return isFoundHostedApp;
} } |
public class class_name {
public static <T> Supplier<T> uncheckedSupplier(SupplierWithException<T, ?> supplierWithException) {
return () -> {
T result = null;
try {
result = supplierWithException.get();
} catch (Throwable t) {
ExceptionUtils.rethrow(t);
}
return result;
};
} } | public class class_name {
public static <T> Supplier<T> uncheckedSupplier(SupplierWithException<T, ?> supplierWithException) {
return () -> {
T result = null;
try {
result = supplierWithException.get(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
ExceptionUtils.rethrow(t);
} // depends on control dependency: [catch], data = [none]
return result;
};
} } |
public class class_name {
public int whichPath(DataPoint data)
{
int paths = getNumberOfPaths();
if(paths < 0)
return paths;//Not trained
else if(paths == 1)//ONLY one option, entropy was zero
return 0;
else if(splittingAttribute < catAttributes.length)//Same for classification and regression
return data.getCategoricalValue(splittingAttribute);
//else, is Numerical attribute - but regression or classification?
int numerAttribute = splittingAttribute - catAttributes.length;
double val = data.getNumericalValues().get(numerAttribute);
if(Double.isNaN(val))
return -1;//missing
if (results != null)//Categorical!
{
int pos = Collections.binarySearch(boundries, val);
pos = pos < 0 ? -pos-1 : pos;
return owners.get(pos);
}
else//Regression! It is trained, it would have been grabed at the top if not
{
if(regressionResults.length == 1)
return 0;
else if(val <= regressionResults[2])
return 0;
else
return 1;
}
} } | public class class_name {
public int whichPath(DataPoint data)
{
int paths = getNumberOfPaths();
if(paths < 0)
return paths;//Not trained
else if(paths == 1)//ONLY one option, entropy was zero
return 0;
else if(splittingAttribute < catAttributes.length)//Same for classification and regression
return data.getCategoricalValue(splittingAttribute);
//else, is Numerical attribute - but regression or classification?
int numerAttribute = splittingAttribute - catAttributes.length;
double val = data.getNumericalValues().get(numerAttribute);
if(Double.isNaN(val))
return -1;//missing
if (results != null)//Categorical!
{
int pos = Collections.binarySearch(boundries, val);
pos = pos < 0 ? -pos-1 : pos; // depends on control dependency: [if], data = [none]
return owners.get(pos); // depends on control dependency: [if], data = [none]
}
else//Regression! It is trained, it would have been grabed at the top if not
{
if(regressionResults.length == 1)
return 0;
else if(val <= regressionResults[2])
return 0;
else
return 1;
}
} } |
public class class_name {
protected int saveObject(int tid, String v) throws SQLException {
final String objectsIdColumn = (dbConnection.isPostgresql() ?
OBJECTS_ID_COLUMN_POSTGRESQL : OBJECTS_ID_COLUMN);
PreparedStatement ps = getPreparedStatement(OBJECTS_SQL,
new String[] { objectsIdColumn });
ResultSet rs = null;
if (v == null) {
throw new InvalidArgument("object value cannot be null");
}
try {
v = new String(v.getBytes(), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("utf-8 unsupported", e);
}
try {
// Insert into objects_text if we are over MAX_VARCHAR_LENGTH
Integer objectsTextId = null;
if (v.length() > MAX_VARCHAR_LENGTH) {
final String objectsTextColumn = (dbConnection.isPostgresql() ?
OBJECTS_TEXT_COLUMN_POSTGRESQL : OBJECTS_TEXT_COLUMN);
PreparedStatement otps = getPreparedStatement(OBJECTS_TEXT_SQL,
new String[] { objectsTextColumn });
ResultSet otrs = null;
StringReader sr = null;
try {
sr = new StringReader(v);
otps.setClob(1, sr, v.length());
otps.execute();
otrs = otps.getGeneratedKeys();
if (otrs.next()) {
objectsTextId = otrs.getInt(1);
}
} finally {
close(otrs);
if (sr != null) {
sr.close();
}
}
}
// FIXME Hardcoding objects_type to 1?
ps.setInt(1, 1);
if (objectsTextId == null) {
// insert value into objects table
ps.setString(2, v);
ps.setNull(3, Types.INTEGER);
} else {
ps.setNull(2, Types.VARCHAR);
ps.setInt(3, objectsTextId);
}
ps.execute();
rs = ps.getGeneratedKeys();
int oid;
if (rs.next()) {
oid = rs.getInt(1);
} else {
throw new IllegalStateException("object insert failed.");
}
return oid;
} finally {
close(rs);
}
} } | public class class_name {
protected int saveObject(int tid, String v) throws SQLException {
final String objectsIdColumn = (dbConnection.isPostgresql() ?
OBJECTS_ID_COLUMN_POSTGRESQL : OBJECTS_ID_COLUMN);
PreparedStatement ps = getPreparedStatement(OBJECTS_SQL,
new String[] { objectsIdColumn });
ResultSet rs = null;
if (v == null) {
throw new InvalidArgument("object value cannot be null");
}
try {
v = new String(v.getBytes(), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("utf-8 unsupported", e);
}
try {
// Insert into objects_text if we are over MAX_VARCHAR_LENGTH
Integer objectsTextId = null;
if (v.length() > MAX_VARCHAR_LENGTH) {
final String objectsTextColumn = (dbConnection.isPostgresql() ?
OBJECTS_TEXT_COLUMN_POSTGRESQL : OBJECTS_TEXT_COLUMN);
PreparedStatement otps = getPreparedStatement(OBJECTS_TEXT_SQL,
new String[] { objectsTextColumn });
ResultSet otrs = null;
StringReader sr = null;
try {
sr = new StringReader(v); // depends on control dependency: [try], data = [none]
otps.setClob(1, sr, v.length()); // depends on control dependency: [try], data = [none]
otps.execute(); // depends on control dependency: [try], data = [none]
otrs = otps.getGeneratedKeys(); // depends on control dependency: [try], data = [none]
if (otrs.next()) {
objectsTextId = otrs.getInt(1); // depends on control dependency: [if], data = [none]
}
} finally {
close(otrs);
if (sr != null) {
sr.close(); // depends on control dependency: [if], data = [none]
}
}
}
// FIXME Hardcoding objects_type to 1?
ps.setInt(1, 1);
if (objectsTextId == null) {
// insert value into objects table
ps.setString(2, v); // depends on control dependency: [if], data = [none]
ps.setNull(3, Types.INTEGER); // depends on control dependency: [if], data = [none]
} else {
ps.setNull(2, Types.VARCHAR); // depends on control dependency: [if], data = [none]
ps.setInt(3, objectsTextId); // depends on control dependency: [if], data = [none]
}
ps.execute();
rs = ps.getGeneratedKeys();
int oid;
if (rs.next()) {
oid = rs.getInt(1); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException("object insert failed.");
}
return oid;
} finally {
close(rs);
}
} } |
public class class_name {
public String getFrameDataString(String id)
{
try
{
if (frames.containsKey(id))
{
return ((ID3v2Frame) frames.get(id)).getDataString();
}
}
catch (ID3v2FormatException ex)
{
Log.error("ID3v2Tag:", ex);
}
return null;
} } | public class class_name {
public String getFrameDataString(String id)
{
try
{
if (frames.containsKey(id))
{
return ((ID3v2Frame) frames.get(id)).getDataString(); // depends on control dependency: [if], data = [none]
}
}
catch (ID3v2FormatException ex)
{
Log.error("ID3v2Tag:", ex);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public void initialize(CmsObject cms) {
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_NUM_SITE_ROOTS_CONFIGURED_1,
new Integer((m_siteMatcherSites.size() + ((m_defaultUri != null) ? 1 : 0)))));
}
try {
m_clone = OpenCms.initCmsObject(cms);
m_clone.getRequestContext().setSiteRoot("");
m_clone.getRequestContext().setCurrentProject(m_clone.readProject(CmsProject.ONLINE_PROJECT_NAME));
CmsObject cms_offline = OpenCms.initCmsObject(m_clone);
CmsProject tempProject = cms_offline.createProject(
"tempProjectSites",
"",
"/Users",
"/Users",
CmsProject.PROJECT_TYPE_TEMPORARY);
cms_offline.getRequestContext().setCurrentProject(tempProject);
m_siteUUIDs = new HashMap<CmsUUID, CmsSite>();
// check the presence of sites in VFS
m_onlyOfflineSites = new ArrayList<CmsSite>();
for (CmsSite site : m_siteMatcherSites.values()) {
checkUUIDOfSiteRoot(site, m_clone, cms_offline);
try {
CmsResource siteRes = m_clone.readResource(site.getSiteRoot());
site.setSiteRootUUID(siteRes.getStructureId());
m_siteUUIDs.put(siteRes.getStructureId(), site);
// during server startup the digester can not access properties, so set the title afterwards
if (CmsStringUtil.isEmptyOrWhitespaceOnly(site.getTitle())) {
String title = m_clone.readPropertyObject(
siteRes,
CmsPropertyDefinition.PROPERTY_TITLE,
false).getValue();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(title)) {
site.setTitle(title);
}
}
} catch (Throwable t) {
if (CmsLog.INIT.isWarnEnabled()) {
CmsLog.INIT.warn(Messages.get().getBundle().key(Messages.INIT_NO_ROOT_FOLDER_1, site));
}
}
}
cms_offline.deleteProject(tempProject.getUuid());
// check the presence of the default site in VFS
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_defaultUri)) {
m_defaultSite = null;
} else {
m_defaultSite = new CmsSite(m_defaultUri, CmsSiteMatcher.DEFAULT_MATCHER);
try {
m_clone.readResource(m_defaultSite.getSiteRoot());
} catch (Throwable t) {
if (CmsLog.INIT.isWarnEnabled()) {
CmsLog.INIT.warn(
Messages.get().getBundle().key(Messages.INIT_NO_ROOT_FOLDER_DEFAULT_SITE_1, m_defaultSite));
}
}
}
if (m_defaultSite == null) {
m_defaultSite = new CmsSite("/", CmsSiteMatcher.DEFAULT_MATCHER);
}
if (CmsLog.INIT.isInfoEnabled()) {
if (m_defaultSite != null) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DEFAULT_SITE_ROOT_1, m_defaultSite));
} else {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DEFAULT_SITE_ROOT_0));
}
}
initWorkplaceMatchers();
// set site lists to unmodifiable
setSiteMatcherSites(m_siteMatcherSites);
// store additional site roots to optimize lookups later
for (String root : m_siteRootSites.keySet()) {
if (!root.startsWith(SITES_FOLDER) || (root.split("/").length >= 4)) {
m_additionalSiteRoots.add(root);
}
}
if (m_sharedFolder == null) {
m_sharedFolder = DEFAULT_SHARED_FOLDER;
}
// initialization is done, set the frozen flag to true
m_frozen = true;
} catch (CmsException e) {
LOG.warn(e);
}
if (!m_isListenerSet) {
OpenCms.addCmsEventListener(this, new int[] {I_CmsEventListener.EVENT_PUBLISH_PROJECT});
m_isListenerSet = true;
}
} } | public class class_name {
public void initialize(CmsObject cms) {
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_NUM_SITE_ROOTS_CONFIGURED_1,
new Integer((m_siteMatcherSites.size() + ((m_defaultUri != null) ? 1 : 0))))); // depends on control dependency: [if], data = [none]
}
try {
m_clone = OpenCms.initCmsObject(cms); // depends on control dependency: [try], data = [none]
m_clone.getRequestContext().setSiteRoot(""); // depends on control dependency: [try], data = [none]
m_clone.getRequestContext().setCurrentProject(m_clone.readProject(CmsProject.ONLINE_PROJECT_NAME)); // depends on control dependency: [try], data = [none]
CmsObject cms_offline = OpenCms.initCmsObject(m_clone);
CmsProject tempProject = cms_offline.createProject(
"tempProjectSites",
"",
"/Users",
"/Users",
CmsProject.PROJECT_TYPE_TEMPORARY);
cms_offline.getRequestContext().setCurrentProject(tempProject); // depends on control dependency: [try], data = [none]
m_siteUUIDs = new HashMap<CmsUUID, CmsSite>(); // depends on control dependency: [try], data = [none]
// check the presence of sites in VFS
m_onlyOfflineSites = new ArrayList<CmsSite>(); // depends on control dependency: [try], data = [none]
for (CmsSite site : m_siteMatcherSites.values()) {
checkUUIDOfSiteRoot(site, m_clone, cms_offline); // depends on control dependency: [for], data = [site]
try {
CmsResource siteRes = m_clone.readResource(site.getSiteRoot());
site.setSiteRootUUID(siteRes.getStructureId()); // depends on control dependency: [try], data = [none]
m_siteUUIDs.put(siteRes.getStructureId(), site); // depends on control dependency: [try], data = [none]
// during server startup the digester can not access properties, so set the title afterwards
if (CmsStringUtil.isEmptyOrWhitespaceOnly(site.getTitle())) {
String title = m_clone.readPropertyObject(
siteRes,
CmsPropertyDefinition.PROPERTY_TITLE,
false).getValue();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(title)) {
site.setTitle(title); // depends on control dependency: [if], data = [none]
}
}
} catch (Throwable t) {
if (CmsLog.INIT.isWarnEnabled()) {
CmsLog.INIT.warn(Messages.get().getBundle().key(Messages.INIT_NO_ROOT_FOLDER_1, site)); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
cms_offline.deleteProject(tempProject.getUuid()); // depends on control dependency: [try], data = [none]
// check the presence of the default site in VFS
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_defaultUri)) {
m_defaultSite = null; // depends on control dependency: [if], data = [none]
} else {
m_defaultSite = new CmsSite(m_defaultUri, CmsSiteMatcher.DEFAULT_MATCHER); // depends on control dependency: [if], data = [none]
try {
m_clone.readResource(m_defaultSite.getSiteRoot()); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
if (CmsLog.INIT.isWarnEnabled()) {
CmsLog.INIT.warn(
Messages.get().getBundle().key(Messages.INIT_NO_ROOT_FOLDER_DEFAULT_SITE_1, m_defaultSite)); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
if (m_defaultSite == null) {
m_defaultSite = new CmsSite("/", CmsSiteMatcher.DEFAULT_MATCHER); // depends on control dependency: [if], data = [none]
}
if (CmsLog.INIT.isInfoEnabled()) {
if (m_defaultSite != null) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DEFAULT_SITE_ROOT_1, m_defaultSite)); // depends on control dependency: [if], data = [none]
} else {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DEFAULT_SITE_ROOT_0)); // depends on control dependency: [if], data = [none]
}
}
initWorkplaceMatchers(); // depends on control dependency: [try], data = [none]
// set site lists to unmodifiable
setSiteMatcherSites(m_siteMatcherSites); // depends on control dependency: [try], data = [none]
// store additional site roots to optimize lookups later
for (String root : m_siteRootSites.keySet()) {
if (!root.startsWith(SITES_FOLDER) || (root.split("/").length >= 4)) {
m_additionalSiteRoots.add(root); // depends on control dependency: [if], data = [none]
}
}
if (m_sharedFolder == null) {
m_sharedFolder = DEFAULT_SHARED_FOLDER; // depends on control dependency: [if], data = [none]
}
// initialization is done, set the frozen flag to true
m_frozen = true; // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.warn(e);
} // depends on control dependency: [catch], data = [none]
if (!m_isListenerSet) {
OpenCms.addCmsEventListener(this, new int[] {I_CmsEventListener.EVENT_PUBLISH_PROJECT}); // depends on control dependency: [if], data = [none]
m_isListenerSet = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
Evaluator parse() {
tq.consumeWhitespace();
if (tq.matchesAny(combinators)) { // if starts with a combinator, use root as elements
evals.add(new StructuralEvaluator.Root());
combinator(tq.consume());
} else {
findElements();
}
while (!tq.isEmpty()) {
// hierarchy and extras
boolean seenWhite = tq.consumeWhitespace();
if (tq.matchesAny(combinators)) {
combinator(tq.consume());
} else if (seenWhite) {
combinator(' ');
} else { // E.class, E#id, E[attr] etc. AND
findElements(); // take next el, #. etc off queue
}
}
if (evals.size() == 1)
return evals.get(0);
return new CombiningEvaluator.And(evals);
} } | public class class_name {
Evaluator parse() {
tq.consumeWhitespace();
if (tq.matchesAny(combinators)) { // if starts with a combinator, use root as elements
evals.add(new StructuralEvaluator.Root()); // depends on control dependency: [if], data = [none]
combinator(tq.consume()); // depends on control dependency: [if], data = [none]
} else {
findElements(); // depends on control dependency: [if], data = [none]
}
while (!tq.isEmpty()) {
// hierarchy and extras
boolean seenWhite = tq.consumeWhitespace();
if (tq.matchesAny(combinators)) {
combinator(tq.consume()); // depends on control dependency: [if], data = [none]
} else if (seenWhite) {
combinator(' '); // depends on control dependency: [if], data = [none]
} else { // E.class, E#id, E[attr] etc. AND
findElements(); // take next el, #. etc off queue // depends on control dependency: [if], data = [none]
}
}
if (evals.size() == 1)
return evals.get(0);
return new CombiningEvaluator.And(evals);
} } |
public class class_name {
public void addAppointments(Anniversary recAnniversary, Calendar calStart, Calendar calEnd)
{
try {
Converter.initGlobals();
Calendar calendar = Converter.gCalendar;
Record recRepeat = ((ReferenceField)this.getField(AnnivMaster.REPEAT_INTERVAL_ID)).getReference();
String strRepeat = null;
if (recRepeat != null)
strRepeat = recRepeat.getField(RepeatInterval.DESCRIPTION).toString();
char chRepeat;
if ((strRepeat == null) || (strRepeat.length() == 0))
chRepeat = 'Y';
else
chRepeat = strRepeat.toUpperCase().charAt(0);
int iRepeatCode;
if (chRepeat == 'D')
iRepeatCode = Calendar.DATE;
else if (chRepeat == 'W')
iRepeatCode = Calendar.WEEK_OF_YEAR;
else if (chRepeat == 'M')
iRepeatCode = Calendar.MONTH;
else
iRepeatCode = Calendar.YEAR;
short sRepeatCount = (short)this.getField(AnnivMaster.REPEAT_COUNT).getValue();
if (sRepeatCount == 0)
sRepeatCount = 1;
Date timeStart = ((DateTimeField)this.getField(AnnivMaster.START_DATE_TIME)).getDateTime();
Date timeEnd = ((DateTimeField)this.getField(AnnivMaster.END_DATE_TIME)).getDateTime();
long lTimeLength = -1;
if (timeEnd != null)
lTimeLength = timeEnd.getTime() - timeStart.getTime();
calendar.setTime(timeStart);
for (int i = 0; i < 100; i++)
{
if ((calendar.after(calStart))
&& (calendar.before(calEnd)))
{
timeStart = calendar.getTime();
timeEnd = null;
if (lTimeLength != -1)
timeEnd = new Date(timeStart.getTime() + lTimeLength);
recAnniversary.addNew();
((DateTimeField)recAnniversary.getField(Anniversary.START_DATE_TIME)).setDateTime(timeStart, false, DBConstants.SCREEN_MOVE);
if (timeEnd != null)
((DateTimeField)recAnniversary.getField(Anniversary.END_DATE_TIME)).setDateTime(timeEnd, false, DBConstants.SCREEN_MOVE);
recAnniversary.getField(Anniversary.DESCRIPTION).moveFieldToThis(this.getField(AnnivMaster.DESCRIPTION));
((ReferenceField)recAnniversary.getField(Anniversary.ANNIV_MASTER_ID)).setReference(this);
recAnniversary.getField(Anniversary.CALENDAR_CATEGORY_ID).moveFieldToThis(this.getField(AnnivMaster.CALENDAR_CATEGORY_ID));
recAnniversary.getField(Anniversary.HIDDEN).moveFieldToThis(this.getField(AnnivMaster.HIDDEN));
// Don't move properties (you will have to read the AnnivMaster to get the properties)
recAnniversary.add();
}
calendar.add(iRepeatCode, sRepeatCount);
}
} catch (DBException ex) {
ex.printStackTrace();
}
} } | public class class_name {
public void addAppointments(Anniversary recAnniversary, Calendar calStart, Calendar calEnd)
{
try {
Converter.initGlobals(); // depends on control dependency: [try], data = [none]
Calendar calendar = Converter.gCalendar;
Record recRepeat = ((ReferenceField)this.getField(AnnivMaster.REPEAT_INTERVAL_ID)).getReference();
String strRepeat = null;
if (recRepeat != null)
strRepeat = recRepeat.getField(RepeatInterval.DESCRIPTION).toString();
char chRepeat;
if ((strRepeat == null) || (strRepeat.length() == 0))
chRepeat = 'Y';
else
chRepeat = strRepeat.toUpperCase().charAt(0);
int iRepeatCode;
if (chRepeat == 'D')
iRepeatCode = Calendar.DATE;
else if (chRepeat == 'W')
iRepeatCode = Calendar.WEEK_OF_YEAR;
else if (chRepeat == 'M')
iRepeatCode = Calendar.MONTH;
else
iRepeatCode = Calendar.YEAR;
short sRepeatCount = (short)this.getField(AnnivMaster.REPEAT_COUNT).getValue();
if (sRepeatCount == 0)
sRepeatCount = 1;
Date timeStart = ((DateTimeField)this.getField(AnnivMaster.START_DATE_TIME)).getDateTime();
Date timeEnd = ((DateTimeField)this.getField(AnnivMaster.END_DATE_TIME)).getDateTime();
long lTimeLength = -1;
if (timeEnd != null)
lTimeLength = timeEnd.getTime() - timeStart.getTime();
calendar.setTime(timeStart); // depends on control dependency: [try], data = [none]
for (int i = 0; i < 100; i++)
{
if ((calendar.after(calStart))
&& (calendar.before(calEnd)))
{
timeStart = calendar.getTime(); // depends on control dependency: [if], data = [none]
timeEnd = null; // depends on control dependency: [if], data = [none]
if (lTimeLength != -1)
timeEnd = new Date(timeStart.getTime() + lTimeLength);
recAnniversary.addNew(); // depends on control dependency: [if], data = [none]
((DateTimeField)recAnniversary.getField(Anniversary.START_DATE_TIME)).setDateTime(timeStart, false, DBConstants.SCREEN_MOVE); // depends on control dependency: [if], data = [none]
if (timeEnd != null)
((DateTimeField)recAnniversary.getField(Anniversary.END_DATE_TIME)).setDateTime(timeEnd, false, DBConstants.SCREEN_MOVE);
recAnniversary.getField(Anniversary.DESCRIPTION).moveFieldToThis(this.getField(AnnivMaster.DESCRIPTION)); // depends on control dependency: [if], data = [none]
((ReferenceField)recAnniversary.getField(Anniversary.ANNIV_MASTER_ID)).setReference(this); // depends on control dependency: [if], data = [none]
recAnniversary.getField(Anniversary.CALENDAR_CATEGORY_ID).moveFieldToThis(this.getField(AnnivMaster.CALENDAR_CATEGORY_ID)); // depends on control dependency: [if], data = [none]
recAnniversary.getField(Anniversary.HIDDEN).moveFieldToThis(this.getField(AnnivMaster.HIDDEN)); // depends on control dependency: [if], data = [none]
// Don't move properties (you will have to read the AnnivMaster to get the properties)
recAnniversary.add(); // depends on control dependency: [if], data = [none]
}
calendar.add(iRepeatCode, sRepeatCount); // depends on control dependency: [for], data = [none]
}
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void configureServices(final T builder) {
// support health check
if (this.properties.isHealthServiceEnabled()) {
builder.addService(this.healthStatusManager.getHealthService());
}
if (this.properties.isReflectionServiceEnabled()) {
builder.addService(ProtoReflectionService.newInstance());
}
for (final GrpcServiceDefinition service : this.serviceList) {
final String serviceName = service.getDefinition().getServiceDescriptor().getName();
log.info("Registered gRPC service: " + serviceName + ", bean: " + service.getBeanName() + ", class: "
+ service.getBeanClazz().getName());
builder.addService(service.getDefinition());
this.healthStatusManager.setStatus(serviceName, HealthCheckResponse.ServingStatus.SERVING);
}
} } | public class class_name {
protected void configureServices(final T builder) {
// support health check
if (this.properties.isHealthServiceEnabled()) {
builder.addService(this.healthStatusManager.getHealthService()); // depends on control dependency: [if], data = [none]
}
if (this.properties.isReflectionServiceEnabled()) {
builder.addService(ProtoReflectionService.newInstance()); // depends on control dependency: [if], data = [none]
}
for (final GrpcServiceDefinition service : this.serviceList) {
final String serviceName = service.getDefinition().getServiceDescriptor().getName();
log.info("Registered gRPC service: " + serviceName + ", bean: " + service.getBeanName() + ", class: "
+ service.getBeanClazz().getName()); // depends on control dependency: [for], data = [service]
builder.addService(service.getDefinition()); // depends on control dependency: [for], data = [service]
this.healthStatusManager.setStatus(serviceName, HealthCheckResponse.ServingStatus.SERVING); // depends on control dependency: [for], data = [service]
}
} } |
public class class_name {
public DrawerItem findFixedItemById(long id) {
for (DrawerItem item : mAdapterFixed.getItems()) {
if (item.getId() == id) {
return item;
}
}
return null;
} } | public class class_name {
public DrawerItem findFixedItemById(long id) {
for (DrawerItem item : mAdapterFixed.getItems()) {
if (item.getId() == id) {
return item; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public void promptEquals(double seconds, String expectedPromptText) {
try {
double timeTook = popup(seconds);
timeTook = popupEquals(seconds - timeTook, expectedPromptText);
checkPromptEquals(expectedPromptText, seconds, timeTook);
} catch (TimeoutException e) {
checkPromptEquals(expectedPromptText, seconds, seconds);
}
} } | public class class_name {
public void promptEquals(double seconds, String expectedPromptText) {
try {
double timeTook = popup(seconds);
timeTook = popupEquals(seconds - timeTook, expectedPromptText); // depends on control dependency: [try], data = [none]
checkPromptEquals(expectedPromptText, seconds, timeTook); // depends on control dependency: [try], data = [none]
} catch (TimeoutException e) {
checkPromptEquals(expectedPromptText, seconds, seconds);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void abs(DMatrixD1 a ) {
final int length = a.getNumElements();
for ( int i = 0; i < length; i++ ) {
a.data[i] = Math.abs(a.data[i]);
}
} } | public class class_name {
public static void abs(DMatrixD1 a ) {
final int length = a.getNumElements();
for ( int i = 0; i < length; i++ ) {
a.data[i] = Math.abs(a.data[i]); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public static String generateMD5(String text) {
byte[] md5hash = null;
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
md5hash = new byte[8];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
} catch (Exception e) {
jlogger.log(Level.SEVERE,
"Error generating MD5: " + e.getMessage(), e);
System.out.println("Error generating MD5: " + e.getMessage());
return "";
}
return convertToHex(md5hash);
} } | public class class_name {
public static String generateMD5(String text) {
byte[] md5hash = null;
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
// depends on control dependency: [try], data = [none]
md5hash = new byte[8];
// depends on control dependency: [try], data = [none]
md.update(text.getBytes("iso-8859-1"), 0, text.length());
// depends on control dependency: [try], data = [none]
md5hash = md.digest();
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
jlogger.log(Level.SEVERE,
"Error generating MD5: " + e.getMessage(), e);
System.out.println("Error generating MD5: " + e.getMessage());
return "";
}
// depends on control dependency: [catch], data = [none]
return convertToHex(md5hash);
} } |
public class class_name {
private String lookupItemName(String itemName, boolean autoAdd) {
String indexedName = index.get(itemName.toLowerCase());
if (indexedName == null && autoAdd) {
index.put(itemName.toLowerCase(), itemName);
}
return indexedName == null ? itemName : indexedName;
} } | public class class_name {
private String lookupItemName(String itemName, boolean autoAdd) {
String indexedName = index.get(itemName.toLowerCase());
if (indexedName == null && autoAdd) {
index.put(itemName.toLowerCase(), itemName); // depends on control dependency: [if], data = [none]
}
return indexedName == null ? itemName : indexedName;
} } |
public class class_name {
public boolean isStruct() {
if (isObject()) {
ObjectType objType = toObjectType();
ObjectType iproto = objType.getImplicitPrototype();
// For the case when a @struct constructor is assigned to a function's
// prototype property
if (iproto != null && iproto.isStruct()) {
return true;
}
FunctionType ctor = objType.getConstructor();
// This test is true for object literals
if (ctor == null) {
JSDocInfo info = objType.getJSDocInfo();
return info != null && info.makesStructs();
} else {
return ctor.makesStructs();
}
}
return false;
} } | public class class_name {
public boolean isStruct() {
if (isObject()) {
ObjectType objType = toObjectType();
ObjectType iproto = objType.getImplicitPrototype();
// For the case when a @struct constructor is assigned to a function's
// prototype property
if (iproto != null && iproto.isStruct()) {
return true; // depends on control dependency: [if], data = [none]
}
FunctionType ctor = objType.getConstructor();
// This test is true for object literals
if (ctor == null) {
JSDocInfo info = objType.getJSDocInfo();
return info != null && info.makesStructs(); // depends on control dependency: [if], data = [none]
} else {
return ctor.makesStructs(); // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
StringBuilder cacheControl = new StringBuilder(cacheability.getValue()).append(", max-age=").append(expiration);
if (mustRevalidate) {
cacheControl.append(", must-revalidate");
}
// Set cache directives
httpServletResponse.setHeader(HTTPCacheHeader.CACHE_CONTROL.getName(), cacheControl.toString());
httpServletResponse.setDateHeader(HTTPCacheHeader.EXPIRES.getName(), System.currentTimeMillis() + expiration
* 1000L);
// Set Vary field
if (vary != null && !vary.isEmpty()) {
httpServletResponse.setHeader(HTTPCacheHeader.VARY.getName(), vary);
}
/*
* By default, some servers (e.g. Tomcat) will set headers on any SSL content to deny caching. Omitting the
* Pragma header takes care of user-agents implementing HTTP/1.0.
*/
filterChain.doFilter(servletRequest, new HttpServletResponseWrapper(httpServletResponse) {
@Override
public void addHeader(String name, String value) {
if (!HTTPCacheHeader.PRAGMA.getName().equalsIgnoreCase(name)) {
super.addHeader(name, value);
}
}
@Override
public void setHeader(String name, String value) {
if (!HTTPCacheHeader.PRAGMA.getName().equalsIgnoreCase(name)) {
super.setHeader(name, value);
}
}
});
} } | public class class_name {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
StringBuilder cacheControl = new StringBuilder(cacheability.getValue()).append(", max-age=").append(expiration);
if (mustRevalidate) {
cacheControl.append(", must-revalidate");
}
// Set cache directives
httpServletResponse.setHeader(HTTPCacheHeader.CACHE_CONTROL.getName(), cacheControl.toString());
httpServletResponse.setDateHeader(HTTPCacheHeader.EXPIRES.getName(), System.currentTimeMillis() + expiration
* 1000L);
// Set Vary field
if (vary != null && !vary.isEmpty()) {
httpServletResponse.setHeader(HTTPCacheHeader.VARY.getName(), vary);
}
/*
* By default, some servers (e.g. Tomcat) will set headers on any SSL content to deny caching. Omitting the
* Pragma header takes care of user-agents implementing HTTP/1.0.
*/
filterChain.doFilter(servletRequest, new HttpServletResponseWrapper(httpServletResponse) {
@Override
public void addHeader(String name, String value) {
if (!HTTPCacheHeader.PRAGMA.getName().equalsIgnoreCase(name)) {
super.addHeader(name, value);
}
}
@Override
public void setHeader(String name, String value) {
if (!HTTPCacheHeader.PRAGMA.getName().equalsIgnoreCase(name)) {
super.setHeader(name, value); // depends on control dependency: [if], data = [none]
}
}
});
} } |
public class class_name {
public void marshall(ListApplicationsRequest listApplicationsRequest, ProtocolMarshaller protocolMarshaller) {
if (listApplicationsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listApplicationsRequest.getMaxItems(), MAXITEMS_BINDING);
protocolMarshaller.marshall(listApplicationsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListApplicationsRequest listApplicationsRequest, ProtocolMarshaller protocolMarshaller) {
if (listApplicationsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listApplicationsRequest.getMaxItems(), MAXITEMS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listApplicationsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private synchronized void clearAccordingToSuffix(String suffix, boolean entriesOnly) {
Set<String> keys = synchronizedCopyKeys(m_keyCache);
Iterator<String> i = keys.iterator();
while (i.hasNext()) {
String s = i.next();
if (s.endsWith(suffix)) {
CmsFlexCacheVariation v = m_keyCache.get(s);
if (entriesOnly) {
// Clear only entry
m_size -= v.m_map.size();
Iterator<I_CmsLruCacheObject> allEntries = v.m_map.values().iterator();
while (allEntries.hasNext()) {
I_CmsLruCacheObject nextObject = allEntries.next();
allEntries.remove();
m_variationCache.remove(nextObject);
}
v.m_map = new Hashtable<String, I_CmsLruCacheObject>(INITIAL_CAPACITY_VARIATIONS);
} else {
// Clear key and entry
m_size -= v.m_map.size();
Iterator<I_CmsLruCacheObject> allEntries = v.m_map.values().iterator();
while (allEntries.hasNext()) {
I_CmsLruCacheObject nextObject = allEntries.next();
allEntries.remove();
m_variationCache.remove(nextObject);
}
v.m_map = null;
v.m_key = null;
m_keyCache.remove(s);
}
}
}
if (LOG.isInfoEnabled()) {
LOG.info(
Messages.get().getBundle().key(
Messages.LOG_FLEXCACHE_CLEAR_HALF_2,
suffix,
Boolean.valueOf(entriesOnly)));
}
} } | public class class_name {
private synchronized void clearAccordingToSuffix(String suffix, boolean entriesOnly) {
Set<String> keys = synchronizedCopyKeys(m_keyCache);
Iterator<String> i = keys.iterator();
while (i.hasNext()) {
String s = i.next();
if (s.endsWith(suffix)) {
CmsFlexCacheVariation v = m_keyCache.get(s);
if (entriesOnly) {
// Clear only entry
m_size -= v.m_map.size(); // depends on control dependency: [if], data = [none]
Iterator<I_CmsLruCacheObject> allEntries = v.m_map.values().iterator();
while (allEntries.hasNext()) {
I_CmsLruCacheObject nextObject = allEntries.next();
allEntries.remove(); // depends on control dependency: [while], data = [none]
m_variationCache.remove(nextObject); // depends on control dependency: [while], data = [none]
}
v.m_map = new Hashtable<String, I_CmsLruCacheObject>(INITIAL_CAPACITY_VARIATIONS); // depends on control dependency: [if], data = [none]
} else {
// Clear key and entry
m_size -= v.m_map.size(); // depends on control dependency: [if], data = [none]
Iterator<I_CmsLruCacheObject> allEntries = v.m_map.values().iterator();
while (allEntries.hasNext()) {
I_CmsLruCacheObject nextObject = allEntries.next();
allEntries.remove(); // depends on control dependency: [while], data = [none]
m_variationCache.remove(nextObject); // depends on control dependency: [while], data = [none]
}
v.m_map = null; // depends on control dependency: [if], data = [none]
v.m_key = null; // depends on control dependency: [if], data = [none]
m_keyCache.remove(s); // depends on control dependency: [if], data = [none]
}
}
}
if (LOG.isInfoEnabled()) {
LOG.info(
Messages.get().getBundle().key(
Messages.LOG_FLEXCACHE_CLEAR_HALF_2,
suffix,
Boolean.valueOf(entriesOnly))); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <T extends AbstractJaxb> boolean hasCssClass(String clazz) {
boolean result = false;
List<String> classList = this.getCssClass();
if (classList != null && classList.contains(clazz)) {
result = true;
}
return result;
} } | public class class_name {
public <T extends AbstractJaxb> boolean hasCssClass(String clazz) {
boolean result = false;
List<String> classList = this.getCssClass();
if (classList != null && classList.contains(clazz)) {
result = true; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
void dupnfa(State start, State stop, State from, State to) {
if (start == stop) {
newarc(Compiler.EMPTY, (short)0, from, to);
return;
}
stop.tmp = to;
duptraverse(start, from);
/* done, except for clearing out the tmp pointers */
stop.tmp = null;
cleartraverse(start);
} } | public class class_name {
void dupnfa(State start, State stop, State from, State to) {
if (start == stop) {
newarc(Compiler.EMPTY, (short)0, from, to); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
stop.tmp = to;
duptraverse(start, from);
/* done, except for clearing out the tmp pointers */
stop.tmp = null;
cleartraverse(start);
} } |
public class class_name {
public String stripID()
{
if (this.isEmpty || this.value.charAt(this.value.length() - this.trailing - 1) != '}')
{
return null;
}
int p = this.leading;
boolean found = false;
while (p < this.value.length() && !found)
{
switch (this.value.charAt(p))
{
case '\\':
if (p + 1 < this.value.length())
{
switch (this.value.charAt(p + 1))
{
case '{':
p++;
break;
}
}
p++;
break;
case '{':
found = true;
break;
default:
p++;
break;
}
}
if (found)
{
if (p + 1 < this.value.length() && this.value.charAt(p + 1) == '#')
{
final int start = p + 2;
p = start;
found = false;
while (p < this.value.length() && !found)
{
switch (this.value.charAt(p))
{
case '\\':
if (p + 1 < this.value.length())
{
switch (this.value.charAt(p + 1))
{
case '}':
p++;
break;
}
}
p++;
break;
case '}':
found = true;
break;
default:
p++;
break;
}
}
if (found)
{
final String id = this.value.substring(start, p).trim();
if (this.leading != 0)
{
this.value = this.value.substring(0, this.leading)
+ this.value.substring(this.leading, start - 2).trim();
}
else
{
this.value = this.value.substring(this.leading, start - 2).trim();
}
this.trailing = 0;
return id.length() > 0 ? id : null;
}
}
}
return null;
} } | public class class_name {
public String stripID()
{
if (this.isEmpty || this.value.charAt(this.value.length() - this.trailing - 1) != '}')
{
return null; // depends on control dependency: [if], data = [none]
}
int p = this.leading;
boolean found = false;
while (p < this.value.length() && !found)
{
switch (this.value.charAt(p))
{
case '\\':
if (p + 1 < this.value.length())
{
switch (this.value.charAt(p + 1))
{
case '{':
p++;
break;
}
}
p++;
break;
case '{':
found = true;
break;
default:
p++;
break;
}
}
if (found)
{
if (p + 1 < this.value.length() && this.value.charAt(p + 1) == '#')
{
final int start = p + 2;
p = start; // depends on control dependency: [if], data = [none]
found = false; // depends on control dependency: [if], data = [none]
while (p < this.value.length() && !found)
{
switch (this.value.charAt(p))
{
case '\\':
if (p + 1 < this.value.length())
{
switch (this.value.charAt(p + 1))
{
case '}':
p++;
break;
}
}
p++;
break;
case '}':
found = true;
break;
default:
p++;
break;
}
}
if (found)
{
final String id = this.value.substring(start, p).trim();
if (this.leading != 0)
{
this.value = this.value.substring(0, this.leading)
+ this.value.substring(this.leading, start - 2).trim(); // depends on control dependency: [if], data = [none]
}
else
{
this.value = this.value.substring(this.leading, start - 2).trim(); // depends on control dependency: [if], data = [(this.leading]
}
this.trailing = 0; // depends on control dependency: [if], data = [none]
return id.length() > 0 ? id : null; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public static List<Element> nodeListToList(NodeList<Element> nodelist) {
List<Element> result = Lists.newArrayList();
for (int i = 0; i < nodelist.getLength(); i++) {
result.add(nodelist.getItem(i));
}
return result;
} } | public class class_name {
public static List<Element> nodeListToList(NodeList<Element> nodelist) {
List<Element> result = Lists.newArrayList();
for (int i = 0; i < nodelist.getLength(); i++) {
result.add(nodelist.getItem(i)); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
public void writeToFile(File file) {
try {
try (OutputStream os = new FileOutputStream(file)) {
InputStreams.transferTo(body(), os);
}
} catch (IOException e) {
throw new RequestsException(e);
} finally {
close();
}
} } | public class class_name {
public void writeToFile(File file) {
try {
try (OutputStream os = new FileOutputStream(file)) {
InputStreams.transferTo(body(), os);
}
} catch (IOException e) {
throw new RequestsException(e);
} finally { // depends on control dependency: [catch], data = [none]
close();
}
} } |
public class class_name {
public JSONObject faceDelete(String userId, String groupId, String faceToken, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("user_id", userId);
request.addBody("group_id", groupId);
request.addBody("face_token", faceToken);
if (options != null) {
request.addBody(options);
}
request.setUri(FaceConsts.FACE_DELETE);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} } | public class class_name {
public JSONObject faceDelete(String userId, String groupId, String faceToken, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("user_id", userId);
request.addBody("group_id", groupId);
request.addBody("face_token", faceToken);
if (options != null) {
request.addBody(options); // depends on control dependency: [if], data = [(options]
}
request.setUri(FaceConsts.FACE_DELETE);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} } |
public class class_name {
public com.google.privacy.dlp.v2.UnwrappedCryptoKeyOrBuilder getUnwrappedOrBuilder() {
if (sourceCase_ == 2) {
return (com.google.privacy.dlp.v2.UnwrappedCryptoKey) source_;
}
return com.google.privacy.dlp.v2.UnwrappedCryptoKey.getDefaultInstance();
} } | public class class_name {
public com.google.privacy.dlp.v2.UnwrappedCryptoKeyOrBuilder getUnwrappedOrBuilder() {
if (sourceCase_ == 2) {
return (com.google.privacy.dlp.v2.UnwrappedCryptoKey) source_; // depends on control dependency: [if], data = [none]
}
return com.google.privacy.dlp.v2.UnwrappedCryptoKey.getDefaultInstance();
} } |
public class class_name {
private void fireTangoInterfaceChangeEvent(TangoInterfaceChange tangoChange, EventData eventData) {
TangoInterfaceChangeEvent event = new TangoInterfaceChangeEvent(tangoChange, eventData);
ArrayList<EventListener> listeners = event_listeners.getListeners(ITangoInterfaceChangeListener.class);
for (EventListener eventListener : listeners) {
((ITangoInterfaceChangeListener) eventListener).interface_change(event);
}
} } | public class class_name {
private void fireTangoInterfaceChangeEvent(TangoInterfaceChange tangoChange, EventData eventData) {
TangoInterfaceChangeEvent event = new TangoInterfaceChangeEvent(tangoChange, eventData);
ArrayList<EventListener> listeners = event_listeners.getListeners(ITangoInterfaceChangeListener.class);
for (EventListener eventListener : listeners) {
((ITangoInterfaceChangeListener) eventListener).interface_change(event); // depends on control dependency: [for], data = [eventListener]
}
} } |
public class class_name {
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{
if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
if (!this.getOwner().getField(MessageLog.TIMEOUT_TIME).isNull())
{
Date timeTimeout = ((DateTimeField)this.getOwner().getField(MessageLog.TIMEOUT_TIME)).getDateTime();
Date timeNow = new Date();
if (timeTimeout != null)
{
if ((m_lastTime == null)
|| (m_lastTime.getTime() <= timeNow.getTime() + EXTRA_TIME_MS))
{ // All the waiting tasks have been run, ping the process to start up again.
MessageManager messageManager = ((Application)this.getOwner().getTask().getApplication()).getMessageManager();
Map<String,Object> properties = new Hashtable<String,Object>();
properties.put(PrivateTaskScheduler.TIME_TO_RUN, timeTimeout);
properties.put(PrivateTaskScheduler.NO_DUPLICATE, Constants.TRUE);
properties.put(DBParams.PROCESS, MessageTimeoutProcess.class.getName());
if (messageManager != null)
messageManager.sendMessage(new MapMessage(new BaseMessageHeader(MessageTimeoutProcess.TIMEOUT_QUEUE_NAME, MessageConstants.INTRANET_QUEUE, this, null), properties));
}
}
m_lastTime = timeTimeout;
}
return super.doRecordChange(field, iChangeType, bDisplayOption);
} } | public class class_name {
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{
if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
if (!this.getOwner().getField(MessageLog.TIMEOUT_TIME).isNull())
{
Date timeTimeout = ((DateTimeField)this.getOwner().getField(MessageLog.TIMEOUT_TIME)).getDateTime();
Date timeNow = new Date();
if (timeTimeout != null)
{
if ((m_lastTime == null)
|| (m_lastTime.getTime() <= timeNow.getTime() + EXTRA_TIME_MS))
{ // All the waiting tasks have been run, ping the process to start up again.
MessageManager messageManager = ((Application)this.getOwner().getTask().getApplication()).getMessageManager();
Map<String,Object> properties = new Hashtable<String,Object>();
properties.put(PrivateTaskScheduler.TIME_TO_RUN, timeTimeout); // depends on control dependency: [if], data = [none]
properties.put(PrivateTaskScheduler.NO_DUPLICATE, Constants.TRUE); // depends on control dependency: [if], data = [none]
properties.put(DBParams.PROCESS, MessageTimeoutProcess.class.getName()); // depends on control dependency: [if], data = [none]
if (messageManager != null)
messageManager.sendMessage(new MapMessage(new BaseMessageHeader(MessageTimeoutProcess.TIMEOUT_QUEUE_NAME, MessageConstants.INTRANET_QUEUE, this, null), properties));
}
}
m_lastTime = timeTimeout; // depends on control dependency: [if], data = [none]
}
return super.doRecordChange(field, iChangeType, bDisplayOption);
} } |
public class class_name {
public static Protocol adaptiveProtocol(byte[] magicHeadBytes) {
for (Protocol protocol : TYPE_PROTOCOL_MAP.values()) {
if (protocol.protocolInfo().isMatchMagic(magicHeadBytes)) {
return protocol;
}
}
return null;
} } | public class class_name {
public static Protocol adaptiveProtocol(byte[] magicHeadBytes) {
for (Protocol protocol : TYPE_PROTOCOL_MAP.values()) {
if (protocol.protocolInfo().isMatchMagic(magicHeadBytes)) {
return protocol; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public void sendMessageToAllNeighbors(Message m) {
if (edgesUsed) {
throw new IllegalStateException("Can use either 'getOutgoingEdges()' or 'sendMessageToAllTargets()' exactly once.");
}
edgesUsed = true;
outValue.f1 = m;
while (edges.hasNext()) {
Tuple next = (Tuple) edges.next();
VertexKey k = next.getField(1);
outValue.f0 = k;
out.collect(outValue);
}
} } | public class class_name {
public void sendMessageToAllNeighbors(Message m) {
if (edgesUsed) {
throw new IllegalStateException("Can use either 'getOutgoingEdges()' or 'sendMessageToAllTargets()' exactly once.");
}
edgesUsed = true;
outValue.f1 = m;
while (edges.hasNext()) {
Tuple next = (Tuple) edges.next();
VertexKey k = next.getField(1);
outValue.f0 = k; // depends on control dependency: [while], data = [none]
out.collect(outValue); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public void setPostUninstallProgram( final String program) {
if ( null == program) {
format.getHeader().createEntry( POSTUNPROG, DEFAULTSCRIPTPROG);
} else if ( 0 == program.length()){
format.getHeader().createEntry( POSTUNPROG, DEFAULTSCRIPTPROG);
} else {
format.getHeader().createEntry( POSTUNPROG, program);
}
} } | public class class_name {
public void setPostUninstallProgram( final String program) {
if ( null == program) {
format.getHeader().createEntry( POSTUNPROG, DEFAULTSCRIPTPROG); // depends on control dependency: [if], data = [none]
} else if ( 0 == program.length()){
format.getHeader().createEntry( POSTUNPROG, DEFAULTSCRIPTPROG); // depends on control dependency: [if], data = [none]
} else {
format.getHeader().createEntry( POSTUNPROG, program); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static void labelClassNodeHTML(final ClassInfo ci, final String shape, final String boxBgColor,
final boolean showFields, final boolean showMethods, final boolean useSimpleNames,
final ScanSpec scanSpec, final StringBuilder buf) {
buf.append("[shape=").append(shape).append(",style=filled,fillcolor=\"#").append(boxBgColor)
.append("\",label=");
buf.append('<');
buf.append("<table border='0' cellborder='0' cellspacing='1'>");
// Class modifiers
buf.append("<tr><td><font point-size='12'>").append(ci.getModifiersStr()).append(' ')
.append(ci.isEnum() ? "enum"
: ci.isAnnotation() ? "@interface" : ci.isInterface() ? "interface" : "class")
.append("</font></td></tr>");
if (ci.getName().contains(".")) {
buf.append("<tr><td><font point-size='14'><b>");
htmlEncode(ci.getPackageName() + ".", buf);
buf.append("</b></font></td></tr>");
}
// Class name
buf.append("<tr><td><font point-size='20'><b>");
htmlEncode(ci.getSimpleName(), buf);
buf.append("</b></font></td></tr>");
// Create a color that matches the box background color, but is darker
final float darkness = 0.8f;
final int r = (int) (Integer.parseInt(boxBgColor.substring(0, 2), 16) * darkness);
final int g = (int) (Integer.parseInt(boxBgColor.substring(2, 4), 16) * darkness);
final int b = (int) (Integer.parseInt(boxBgColor.substring(4, 6), 16) * darkness);
final String darkerColor = String.format("#%s%s%s%s%s%s", Integer.toString(r >> 4, 16),
Integer.toString(r & 0xf, 16), Integer.toString(g >> 4, 16), Integer.toString(g & 0xf, 16),
Integer.toString(b >> 4, 16), Integer.toString(b & 0xf, 16));
// Class annotations
final AnnotationInfoList annotationInfo = ci.annotationInfo;
if (annotationInfo != null && !annotationInfo.isEmpty()) {
buf.append("<tr><td colspan='3' bgcolor='").append(darkerColor)
.append("'><font point-size='12'><b>ANNOTATIONS</b></font></td></tr>");
final AnnotationInfoList annotationInfoSorted = new AnnotationInfoList(annotationInfo);
CollectionUtils.sortIfNotEmpty(annotationInfoSorted);
for (final AnnotationInfo ai : annotationInfoSorted) {
final String annotationName = ai.getName();
if (!annotationName.startsWith("java.lang.annotation.")) {
buf.append("<tr>");
buf.append("<td align='center' valign='top'>");
htmlEncode(ai.toString(), buf);
buf.append("</td></tr>");
}
}
}
// Fields
final FieldInfoList fieldInfo = ci.fieldInfo;
if (showFields && fieldInfo != null && !fieldInfo.isEmpty()) {
final FieldInfoList fieldInfoSorted = new FieldInfoList(fieldInfo);
CollectionUtils.sortIfNotEmpty(fieldInfoSorted);
for (int i = fieldInfoSorted.size() - 1; i >= 0; --i) {
// Remove serialVersionUID field
if (fieldInfoSorted.get(i).getName().equals("serialVersionUID")) {
fieldInfoSorted.remove(i);
}
}
if (!fieldInfoSorted.isEmpty()) {
buf.append("<tr><td colspan='3' bgcolor='").append(darkerColor)
.append("'><font point-size='12'><b>")
.append(scanSpec.ignoreFieldVisibility ? "" : "PUBLIC ")
.append("FIELDS</b></font></td></tr>");
buf.append("<tr><td cellpadding='0'>");
buf.append("<table border='0' cellborder='0'>");
for (final FieldInfo fi : fieldInfoSorted) {
buf.append("<tr>");
buf.append("<td align='right' valign='top'>");
// Field Annotations
final AnnotationInfoList fieldAnnotationInfo = fi.annotationInfo;
if (fieldAnnotationInfo != null) {
for (final AnnotationInfo ai : fieldAnnotationInfo) {
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
htmlEncode(ai.toString(), buf);
}
}
// Field modifiers
if (scanSpec.ignoreFieldVisibility) {
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
buf.append(fi.getModifierStr());
}
// Field type
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
final TypeSignature typeSig = fi.getTypeSignatureOrTypeDescriptor();
htmlEncode(useSimpleNames ? typeSig.toStringWithSimpleNames() : typeSig.toString(), buf);
buf.append("</td>");
// Field name
buf.append("<td align='left' valign='top'><b>");
final String fieldName = fi.getName();
htmlEncode(fieldName, buf);
buf.append("</b></td></tr>");
}
buf.append("</table>");
buf.append("</td></tr>");
}
}
// Methods
final MethodInfoList methodInfo = ci.methodInfo;
if (showMethods && methodInfo != null) {
final MethodInfoList methodInfoSorted = new MethodInfoList(methodInfo);
CollectionUtils.sortIfNotEmpty(methodInfoSorted);
for (int i = methodInfoSorted.size() - 1; i >= 0; --i) {
// Don't list static initializer blocks or methods of Object
final MethodInfo mi = methodInfoSorted.get(i);
final String name = mi.getName();
final int numParam = mi.getParameterInfo().length;
if (name.equals("<clinit>") || name.equals("hashCode") && numParam == 0
|| name.equals("toString") && numParam == 0 || name.equals("equals") && numParam == 1
&& mi.getTypeDescriptor().toString().equals("boolean (java.lang.Object)")) {
methodInfoSorted.remove(i);
}
}
if (!methodInfoSorted.isEmpty()) {
buf.append("<tr><td cellpadding='0'>");
buf.append("<table border='0' cellborder='0'>");
buf.append("<tr><td colspan='3' bgcolor='").append(darkerColor)
.append("'><font point-size='12'><b>")
.append(scanSpec.ignoreMethodVisibility ? "" : "PUBLIC ")
.append("METHODS</b></font></td></tr>");
for (final MethodInfo mi : methodInfoSorted) {
buf.append("<tr>");
// Method annotations
// TODO: wrap this cell if the contents get too long
buf.append("<td align='right' valign='top'>");
final AnnotationInfoList methodAnnotationInfo = mi.annotationInfo;
if (methodAnnotationInfo != null) {
for (final AnnotationInfo ai : methodAnnotationInfo) {
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
htmlEncode(ai.toString(), buf);
}
}
// Method modifiers
if (scanSpec.ignoreMethodVisibility) {
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
buf.append(mi.getModifiersStr());
}
// Method return type
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
if (!mi.getName().equals("<init>")) {
// Don't list return type for constructors
final TypeSignature resultTypeSig = mi.getTypeSignatureOrTypeDescriptor().getResultType();
htmlEncode(
useSimpleNames ? resultTypeSig.toStringWithSimpleNames() : resultTypeSig.toString(),
buf);
} else {
buf.append("<b><constructor></b>");
}
buf.append("</td>");
// Method name
buf.append("<td align='left' valign='top'>");
buf.append("<b>");
if (mi.getName().equals("<init>")) {
// Show class name for constructors
htmlEncode(ci.getSimpleName(), buf);
} else {
htmlEncode(mi.getName(), buf);
}
buf.append("</b> ");
buf.append("</td>");
// Method parameters
buf.append("<td align='left' valign='top'>");
buf.append('(');
final MethodParameterInfo[] paramInfo = mi.getParameterInfo();
if (paramInfo.length != 0) {
for (int i = 0, wrapPos = 0; i < paramInfo.length; i++) {
if (i > 0) {
buf.append(", ");
wrapPos += 2;
}
if (wrapPos > PARAM_WRAP_WIDTH) {
buf.append("</td></tr><tr><td></td><td></td><td align='left' valign='top'>");
wrapPos = 0;
}
// Param annotation
final AnnotationInfo[] paramAnnotationInfo = paramInfo[i].annotationInfo;
if (paramAnnotationInfo != null) {
for (final AnnotationInfo ai : paramAnnotationInfo) {
final String ais = ai.toString();
if (!ais.isEmpty()) {
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
htmlEncode(ais, buf);
wrapPos += 1 + ais.length();
if (wrapPos > PARAM_WRAP_WIDTH) {
buf.append("</td></tr><tr><td></td><td></td>"
+ "<td align='left' valign='top'>");
wrapPos = 0;
}
}
}
}
// Param type
final TypeSignature paramTypeSig = paramInfo[i].getTypeSignatureOrTypeDescriptor();
final String paramTypeStr = useSimpleNames ? paramTypeSig.toStringWithSimpleNames()
: paramTypeSig.toString();
htmlEncode(paramTypeStr, buf);
wrapPos += paramTypeStr.length();
// Param name
final String paramName = paramInfo[i].getName();
if (paramName != null) {
buf.append(" <B>");
htmlEncode(paramName, buf);
wrapPos += 1 + paramName.length();
buf.append("</B>");
}
}
}
buf.append(')');
buf.append("</td></tr>");
}
buf.append("</table>");
buf.append("</td></tr>");
}
}
buf.append("</table>");
buf.append(">]");
} } | public class class_name {
private static void labelClassNodeHTML(final ClassInfo ci, final String shape, final String boxBgColor,
final boolean showFields, final boolean showMethods, final boolean useSimpleNames,
final ScanSpec scanSpec, final StringBuilder buf) {
buf.append("[shape=").append(shape).append(",style=filled,fillcolor=\"#").append(boxBgColor)
.append("\",label=");
buf.append('<');
buf.append("<table border='0' cellborder='0' cellspacing='1'>");
// Class modifiers
buf.append("<tr><td><font point-size='12'>").append(ci.getModifiersStr()).append(' ')
.append(ci.isEnum() ? "enum"
: ci.isAnnotation() ? "@interface" : ci.isInterface() ? "interface" : "class")
.append("</font></td></tr>");
if (ci.getName().contains(".")) {
buf.append("<tr><td><font point-size='14'><b>"); // depends on control dependency: [if], data = [none]
htmlEncode(ci.getPackageName() + ".", buf); // depends on control dependency: [if], data = [none]
buf.append("</b></font></td></tr>"); // depends on control dependency: [if], data = [none]
}
// Class name
buf.append("<tr><td><font point-size='20'><b>");
htmlEncode(ci.getSimpleName(), buf);
buf.append("</b></font></td></tr>");
// Create a color that matches the box background color, but is darker
final float darkness = 0.8f;
final int r = (int) (Integer.parseInt(boxBgColor.substring(0, 2), 16) * darkness);
final int g = (int) (Integer.parseInt(boxBgColor.substring(2, 4), 16) * darkness);
final int b = (int) (Integer.parseInt(boxBgColor.substring(4, 6), 16) * darkness);
final String darkerColor = String.format("#%s%s%s%s%s%s", Integer.toString(r >> 4, 16),
Integer.toString(r & 0xf, 16), Integer.toString(g >> 4, 16), Integer.toString(g & 0xf, 16),
Integer.toString(b >> 4, 16), Integer.toString(b & 0xf, 16));
// Class annotations
final AnnotationInfoList annotationInfo = ci.annotationInfo;
if (annotationInfo != null && !annotationInfo.isEmpty()) {
buf.append("<tr><td colspan='3' bgcolor='").append(darkerColor)
.append("'><font point-size='12'><b>ANNOTATIONS</b></font></td></tr>"); // depends on control dependency: [if], data = [none]
final AnnotationInfoList annotationInfoSorted = new AnnotationInfoList(annotationInfo);
CollectionUtils.sortIfNotEmpty(annotationInfoSorted); // depends on control dependency: [if], data = [(annotationInfo]
for (final AnnotationInfo ai : annotationInfoSorted) {
final String annotationName = ai.getName();
if (!annotationName.startsWith("java.lang.annotation.")) {
buf.append("<tr>");
buf.append("<td align='center' valign='top'>");
htmlEncode(ai.toString(), buf);
buf.append("</td></tr>"); // depends on control dependency: [for], data = [none]
}
}
}
// Fields
final FieldInfoList fieldInfo = ci.fieldInfo;
if (showFields && fieldInfo != null && !fieldInfo.isEmpty()) {
final FieldInfoList fieldInfoSorted = new FieldInfoList(fieldInfo);
CollectionUtils.sortIfNotEmpty(fieldInfoSorted);
for (int i = fieldInfoSorted.size() - 1; i >= 0; --i) {
// Remove serialVersionUID field
if (fieldInfoSorted.get(i).getName().equals("serialVersionUID")) {
fieldInfoSorted.remove(i); // depends on control dependency: [if], data = [none]
}
}
if (!fieldInfoSorted.isEmpty()) {
buf.append("<tr><td colspan='3' bgcolor='").append(darkerColor)
.append("'><font point-size='12'><b>")
.append(scanSpec.ignoreFieldVisibility ? "" : "PUBLIC ")
.append("FIELDS</b></font></td></tr>"); // depends on control dependency: [if], data = [none]
buf.append("<tr><td cellpadding='0'>"); // depends on control dependency: [if], data = [none]
buf.append("<table border='0' cellborder='0'>"); // depends on control dependency: [if], data = [none]
for (final FieldInfo fi : fieldInfoSorted) {
buf.append("<tr>"); // depends on control dependency: [for], data = [none]
buf.append("<td align='right' valign='top'>"); // depends on control dependency: [for], data = [none]
// Field Annotations
final AnnotationInfoList fieldAnnotationInfo = fi.annotationInfo;
if (fieldAnnotationInfo != null) {
for (final AnnotationInfo ai : fieldAnnotationInfo) {
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' '); // depends on control dependency: [if], data = [' ')]
}
htmlEncode(ai.toString(), buf); // depends on control dependency: [for], data = [ai]
}
}
// Field modifiers
if (scanSpec.ignoreFieldVisibility) {
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' '); // depends on control dependency: [if], data = [' ')]
}
buf.append(fi.getModifierStr()); // depends on control dependency: [if], data = [none]
}
// Field type
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' '); // depends on control dependency: [if], data = [' ')]
}
final TypeSignature typeSig = fi.getTypeSignatureOrTypeDescriptor();
htmlEncode(useSimpleNames ? typeSig.toStringWithSimpleNames() : typeSig.toString(), buf); // depends on control dependency: [for], data = [none]
buf.append("</td>"); // depends on control dependency: [for], data = [none]
// Field name
buf.append("<td align='left' valign='top'><b>"); // depends on control dependency: [for], data = [none]
final String fieldName = fi.getName();
htmlEncode(fieldName, buf); // depends on control dependency: [for], data = [fi]
buf.append("</b></td></tr>"); // depends on control dependency: [for], data = [none]
}
buf.append("</table>"); // depends on control dependency: [if], data = [none]
buf.append("</td></tr>"); // depends on control dependency: [if], data = [none]
}
}
// Methods
final MethodInfoList methodInfo = ci.methodInfo;
if (showMethods && methodInfo != null) {
final MethodInfoList methodInfoSorted = new MethodInfoList(methodInfo);
CollectionUtils.sortIfNotEmpty(methodInfoSorted);
for (int i = methodInfoSorted.size() - 1; i >= 0; --i) {
// Don't list static initializer blocks or methods of Object
final MethodInfo mi = methodInfoSorted.get(i);
final String name = mi.getName();
final int numParam = mi.getParameterInfo().length;
if (name.equals("<clinit>") || name.equals("hashCode") && numParam == 0
|| name.equals("toString") && numParam == 0 || name.equals("equals") && numParam == 1
&& mi.getTypeDescriptor().toString().equals("boolean (java.lang.Object)")) {
methodInfoSorted.remove(i);
}
}
if (!methodInfoSorted.isEmpty()) {
buf.append("<tr><td cellpadding='0'>");
buf.append("<table border='0' cellborder='0'>");
buf.append("<tr><td colspan='3' bgcolor='").append(darkerColor)
.append("'><font point-size='12'><b>")
.append(scanSpec.ignoreMethodVisibility ? "" : "PUBLIC ")
.append("METHODS</b></font></td></tr>");
for (final MethodInfo mi : methodInfoSorted) {
buf.append("<tr>");
// Method annotations
// TODO: wrap this cell if the contents get too long
buf.append("<td align='right' valign='top'>");
final AnnotationInfoList methodAnnotationInfo = mi.annotationInfo;
if (methodAnnotationInfo != null) {
for (final AnnotationInfo ai : methodAnnotationInfo) {
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
htmlEncode(ai.toString(), buf);
}
}
// Method modifiers
if (scanSpec.ignoreMethodVisibility) {
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
buf.append(mi.getModifiersStr());
}
// Method return type
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
if (!mi.getName().equals("<init>")) {
// Don't list return type for constructors
final TypeSignature resultTypeSig = mi.getTypeSignatureOrTypeDescriptor().getResultType();
htmlEncode(
useSimpleNames ? resultTypeSig.toStringWithSimpleNames() : resultTypeSig.toString(),
buf); // depends on control dependency: [for], data = [none]
} else {
buf.append("<b><constructor></b>");
}
buf.append("</td>");
// Method name
buf.append("<td align='left' valign='top'>");
buf.append("<b>");
if (mi.getName().equals("<init>")) {
// Show class name for constructors
htmlEncode(ci.getSimpleName(), buf); // depends on control dependency: [if], data = [none]
} else {
htmlEncode(mi.getName(), buf); // depends on control dependency: [if], data = [none]
}
buf.append("</b> ");
buf.append("</td>");
// Method parameters
buf.append("<td align='left' valign='top'>");
buf.append('(');
final MethodParameterInfo[] paramInfo = mi.getParameterInfo();
if (paramInfo.length != 0) {
for (int i = 0, wrapPos = 0; i < paramInfo.length; i++) {
if (i > 0) {
buf.append(", "); // depends on control dependency: [if], data = [none]
wrapPos += 2; // depends on control dependency: [if], data = [none]
}
if (wrapPos > PARAM_WRAP_WIDTH) {
buf.append("</td></tr><tr><td></td><td></td><td align='left' valign='top'>"); // depends on control dependency: [if], data = [none]
wrapPos = 0; // depends on control dependency: [if], data = [none]
}
// Param annotation
final AnnotationInfo[] paramAnnotationInfo = paramInfo[i].annotationInfo;
if (paramAnnotationInfo != null) {
for (final AnnotationInfo ai : paramAnnotationInfo) {
final String ais = ai.toString();
if (!ais.isEmpty()) {
if (buf.charAt(buf.length() - 1) != ' ') {
buf.append(' '); // depends on control dependency: [if], data = [' ')]
}
htmlEncode(ais, buf); // depends on control dependency: [if], data = [none]
wrapPos += 1 + ais.length(); // depends on control dependency: [if], data = [none]
if (wrapPos > PARAM_WRAP_WIDTH) {
buf.append("</td></tr><tr><td></td><td></td>"
+ "<td align='left' valign='top'>"); // depends on control dependency: [if], data = [none]
wrapPos = 0; // depends on control dependency: [if], data = [none]
}
}
}
}
// Param type
final TypeSignature paramTypeSig = paramInfo[i].getTypeSignatureOrTypeDescriptor();
final String paramTypeStr = useSimpleNames ? paramTypeSig.toStringWithSimpleNames()
: paramTypeSig.toString();
htmlEncode(paramTypeStr, buf); // depends on control dependency: [for], data = [none]
wrapPos += paramTypeStr.length(); // depends on control dependency: [for], data = [none]
// Param name
final String paramName = paramInfo[i].getName();
if (paramName != null) {
buf.append(" <B>"); // depends on control dependency: [if], data = [none]
htmlEncode(paramName, buf); // depends on control dependency: [if], data = [(paramName]
wrapPos += 1 + paramName.length(); // depends on control dependency: [if], data = [none]
buf.append("</B>"); // depends on control dependency: [if], data = [none]
}
}
}
buf.append(')');
buf.append("</td></tr>");
}
buf.append("</table>");
buf.append("</td></tr>");
}
}
buf.append("</table>");
buf.append(">]");
} } |
public class class_name {
public boolean acceptsURL(String url) {
try {
url = mangleURL(url);
} catch (SQLException e) {
return false;
}
return super.acceptsURL(url);
} } | public class class_name {
public boolean acceptsURL(String url) {
try {
url = mangleURL(url); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
return false;
} // depends on control dependency: [catch], data = [none]
return super.acceptsURL(url);
} } |
public class class_name {
public static String asUTF8String(InputStream in) {
// Precondition check
Validate.notNull(in, "Stream must be specified");
StringBuilder buffer = new StringBuilder();
String line;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, CHARSET_UTF8));
while ((line = reader.readLine()) != null) {
buffer.append(line).append(Character.LINE_SEPARATOR);
}
} catch (IOException ioe) {
throw new RuntimeException("Error in obtaining string from " + in, ioe);
} finally {
try {
in.close();
} catch (IOException ignore) {
if (log.isLoggable(Level.FINER)) {
log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring");
}
}
}
return buffer.toString();
} } | public class class_name {
public static String asUTF8String(InputStream in) {
// Precondition check
Validate.notNull(in, "Stream must be specified");
StringBuilder buffer = new StringBuilder();
String line;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, CHARSET_UTF8));
while ((line = reader.readLine()) != null) {
buffer.append(line).append(Character.LINE_SEPARATOR); // depends on control dependency: [while], data = [none]
}
} catch (IOException ioe) {
throw new RuntimeException("Error in obtaining string from " + in, ioe);
} finally { // depends on control dependency: [catch], data = [none]
try {
in.close(); // depends on control dependency: [try], data = [none]
} catch (IOException ignore) {
if (log.isLoggable(Level.FINER)) {
log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring"); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
return buffer.toString();
} } |
public class class_name {
public EClass getIfcObjective() {
if (ifcObjectiveEClass == null) {
ifcObjectiveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(330);
}
return ifcObjectiveEClass;
} } | public class class_name {
public EClass getIfcObjective() {
if (ifcObjectiveEClass == null) {
ifcObjectiveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(330);
// depends on control dependency: [if], data = [none]
}
return ifcObjectiveEClass;
} } |
public class class_name {
@Nullable
public static Resource mergeResources(List<Resource> resources) {
Resource currentResource = null;
for (Resource resource : resources) {
currentResource = merge(currentResource, resource);
}
return currentResource;
} } | public class class_name {
@Nullable
public static Resource mergeResources(List<Resource> resources) {
Resource currentResource = null;
for (Resource resource : resources) {
currentResource = merge(currentResource, resource); // depends on control dependency: [for], data = [resource]
}
return currentResource;
} } |
public class class_name {
private void checkFactoryClassAndMethod(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
String factoryClassName = classDef.getProperty(PropertyHelper.OJB_PROPERTY_FACTORY_CLASS);
String factoryMethodName = classDef.getProperty(PropertyHelper.OJB_PROPERTY_FACTORY_METHOD);
if ((factoryClassName == null) && (factoryMethodName == null))
{
return;
}
if ((factoryClassName != null) && (factoryMethodName == null))
{
throw new ConstraintException("Class "+classDef.getName()+" has a factory-class but no factory-method.");
}
if ((factoryClassName == null) && (factoryMethodName != null))
{
throw new ConstraintException("Class "+classDef.getName()+" has a factory-method but no factory-class.");
}
if (CHECKLEVEL_STRICT.equals(checkLevel))
{
Class factoryClass;
Method factoryMethod;
try
{
factoryClass = InheritanceHelper.getClass(factoryClassName);
}
catch (ClassNotFoundException ex)
{
throw new ConstraintException("The class "+factoryClassName+" specified as factory-class of class "+classDef.getName()+" was not found on the classpath");
}
try
{
factoryMethod = factoryClass.getDeclaredMethod(factoryMethodName, new Class[0]);
}
catch (NoSuchMethodException ex)
{
factoryMethod = null;
}
catch (Exception ex)
{
throw new ConstraintException("Exception while checking the factory-class "+factoryClassName+" of class "+classDef.getName()+": "+ex.getMessage());
}
if (factoryMethod == null)
{
try
{
factoryMethod = factoryClass.getMethod(factoryMethodName, new Class[0]);
}
catch (NoSuchMethodException ex)
{
throw new ConstraintException("No suitable factory-method "+factoryMethodName+" found in the factory-class "+factoryClassName+" of class "+classDef.getName());
}
catch (Exception ex)
{
throw new ConstraintException("Exception while checking the factory-class "+factoryClassName+" of class "+classDef.getName()+": "+ex.getMessage());
}
}
// checking return type and modifiers
Class returnType = factoryMethod.getReturnType();
InheritanceHelper helper = new InheritanceHelper();
if ("void".equals(returnType.getName()))
{
throw new ConstraintException("The factory-method "+factoryMethodName+" in factory-class "+factoryClassName+" of class "+classDef.getName()+" must return a value");
}
try
{
if (!helper.isSameOrSubTypeOf(returnType.getName(), classDef.getName()))
{
throw new ConstraintException("The method "+factoryMethodName+" in factory-class "+factoryClassName+" of class "+classDef.getName()+" must return the type "+classDef.getName()+" or a subtype of it");
}
}
catch (ClassNotFoundException ex)
{
throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the factory-method "+factoryMethodName+" in the factory-class "+factoryClassName+" of class "+classDef.getName());
}
if (!Modifier.isStatic(factoryMethod.getModifiers()))
{
throw new ConstraintException("The factory-method "+factoryMethodName+" in factory-class "+factoryClassName+" of class "+classDef.getName()+" must be static");
}
}
} } | public class class_name {
private void checkFactoryClassAndMethod(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
String factoryClassName = classDef.getProperty(PropertyHelper.OJB_PROPERTY_FACTORY_CLASS);
String factoryMethodName = classDef.getProperty(PropertyHelper.OJB_PROPERTY_FACTORY_METHOD);
if ((factoryClassName == null) && (factoryMethodName == null))
{
return;
}
if ((factoryClassName != null) && (factoryMethodName == null))
{
throw new ConstraintException("Class "+classDef.getName()+" has a factory-class but no factory-method.");
}
if ((factoryClassName == null) && (factoryMethodName != null))
{
throw new ConstraintException("Class "+classDef.getName()+" has a factory-method but no factory-class.");
}
if (CHECKLEVEL_STRICT.equals(checkLevel))
{
Class factoryClass;
Method factoryMethod;
try
{
factoryClass = InheritanceHelper.getClass(factoryClassName);
// depends on control dependency: [try], data = [none]
}
catch (ClassNotFoundException ex)
{
throw new ConstraintException("The class "+factoryClassName+" specified as factory-class of class "+classDef.getName()+" was not found on the classpath");
}
// depends on control dependency: [catch], data = [none]
try
{
factoryMethod = factoryClass.getDeclaredMethod(factoryMethodName, new Class[0]);
// depends on control dependency: [try], data = [none]
}
catch (NoSuchMethodException ex)
{
factoryMethod = null;
}
// depends on control dependency: [catch], data = [none]
catch (Exception ex)
{
throw new ConstraintException("Exception while checking the factory-class "+factoryClassName+" of class "+classDef.getName()+": "+ex.getMessage());
}
// depends on control dependency: [catch], data = [none]
if (factoryMethod == null)
{
try
{
factoryMethod = factoryClass.getMethod(factoryMethodName, new Class[0]);
// depends on control dependency: [try], data = [none]
}
catch (NoSuchMethodException ex)
{
throw new ConstraintException("No suitable factory-method "+factoryMethodName+" found in the factory-class "+factoryClassName+" of class "+classDef.getName());
}
// depends on control dependency: [catch], data = [none]
catch (Exception ex)
{
throw new ConstraintException("Exception while checking the factory-class "+factoryClassName+" of class "+classDef.getName()+": "+ex.getMessage());
}
// depends on control dependency: [catch], data = [none]
}
// checking return type and modifiers
Class returnType = factoryMethod.getReturnType();
InheritanceHelper helper = new InheritanceHelper();
if ("void".equals(returnType.getName()))
{
throw new ConstraintException("The factory-method "+factoryMethodName+" in factory-class "+factoryClassName+" of class "+classDef.getName()+" must return a value");
}
try
{
if (!helper.isSameOrSubTypeOf(returnType.getName(), classDef.getName()))
{
throw new ConstraintException("The method "+factoryMethodName+" in factory-class "+factoryClassName+" of class "+classDef.getName()+" must return the type "+classDef.getName()+" or a subtype of it");
}
}
catch (ClassNotFoundException ex)
{
throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the factory-method "+factoryMethodName+" in the factory-class "+factoryClassName+" of class "+classDef.getName());
}
// depends on control dependency: [catch], data = [none]
if (!Modifier.isStatic(factoryMethod.getModifiers()))
{
throw new ConstraintException("The factory-method "+factoryMethodName+" in factory-class "+factoryClassName+" of class "+classDef.getName()+" must be static");
}
}
} } |
public class class_name {
final boolean removeTreeNode(TreeNode<K,V> p) {
TreeNode<K,V> next = (TreeNode<K,V>)p.next;
TreeNode<K,V> pred = p.prev; // unlink traversal pointers
TreeNode<K,V> r, rl;
if (pred == null)
first = next;
else
pred.next = next;
if (next != null)
next.prev = pred;
if (first == null) {
root = null;
return true;
}
if ((r = root) == null || r.right == null || // too small
(rl = r.left) == null || rl.left == null)
return true;
lockRoot();
try {
TreeNode<K,V> replacement;
TreeNode<K,V> pl = p.left;
TreeNode<K,V> pr = p.right;
if (pl != null && pr != null) {
TreeNode<K,V> s = pr, sl;
while ((sl = s.left) != null) // find successor
s = sl;
boolean c = s.red; s.red = p.red; p.red = c; // swap colors
TreeNode<K,V> sr = s.right;
TreeNode<K,V> pp = p.parent;
if (s == pr) { // p was s's direct parent
p.parent = s;
s.right = p;
}
else {
TreeNode<K,V> sp = s.parent;
if ((p.parent = sp) != null) {
if (s == sp.left)
sp.left = p;
else
sp.right = p;
}
if ((s.right = pr) != null)
pr.parent = s;
}
p.left = null;
if ((p.right = sr) != null)
sr.parent = p;
if ((s.left = pl) != null)
pl.parent = s;
if ((s.parent = pp) == null)
r = s;
else if (p == pp.left)
pp.left = s;
else
pp.right = s;
if (sr != null)
replacement = sr;
else
replacement = p;
}
else if (pl != null)
replacement = pl;
else if (pr != null)
replacement = pr;
else
replacement = p;
if (replacement != p) {
TreeNode<K,V> pp = replacement.parent = p.parent;
if (pp == null)
r = replacement;
else if (p == pp.left)
pp.left = replacement;
else
pp.right = replacement;
p.left = p.right = p.parent = null;
}
root = (p.red) ? r : balanceDeletion(r, replacement);
if (p == replacement) { // detach pointers
TreeNode<K,V> pp;
if ((pp = p.parent) != null) {
if (p == pp.left)
pp.left = null;
else if (p == pp.right)
pp.right = null;
p.parent = null;
}
}
} finally {
unlockRoot();
}
assert checkInvariants(root);
return false;
} } | public class class_name {
final boolean removeTreeNode(TreeNode<K,V> p) {
TreeNode<K,V> next = (TreeNode<K,V>)p.next;
TreeNode<K,V> pred = p.prev; // unlink traversal pointers
TreeNode<K,V> r, rl;
if (pred == null)
first = next;
else
pred.next = next;
if (next != null)
next.prev = pred;
if (first == null) {
root = null; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
if ((r = root) == null || r.right == null || // too small
(rl = r.left) == null || rl.left == null)
return true;
lockRoot();
try {
TreeNode<K,V> replacement;
TreeNode<K,V> pl = p.left;
TreeNode<K,V> pr = p.right;
if (pl != null && pr != null) {
TreeNode<K,V> s = pr, sl;
while ((sl = s.left) != null) // find successor
s = sl;
boolean c = s.red; s.red = p.red; p.red = c; // swap colors // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
TreeNode<K,V> sr = s.right;
TreeNode<K,V> pp = p.parent;
if (s == pr) { // p was s's direct parent
p.parent = s; // depends on control dependency: [if], data = [none]
s.right = p; // depends on control dependency: [if], data = [none]
}
else {
TreeNode<K,V> sp = s.parent;
if ((p.parent = sp) != null) {
if (s == sp.left)
sp.left = p;
else
sp.right = p;
}
if ((s.right = pr) != null)
pr.parent = s;
}
p.left = null; // depends on control dependency: [if], data = [none]
if ((p.right = sr) != null)
sr.parent = p;
if ((s.left = pl) != null)
pl.parent = s;
if ((s.parent = pp) == null)
r = s;
else if (p == pp.left)
pp.left = s;
else
pp.right = s;
if (sr != null)
replacement = sr;
else
replacement = p;
}
else if (pl != null)
replacement = pl;
else if (pr != null)
replacement = pr;
else
replacement = p;
if (replacement != p) {
TreeNode<K,V> pp = replacement.parent = p.parent;
if (pp == null)
r = replacement;
else if (p == pp.left)
pp.left = replacement;
else
pp.right = replacement;
p.left = p.right = p.parent = null; // depends on control dependency: [if], data = [none]
}
root = (p.red) ? r : balanceDeletion(r, replacement); // depends on control dependency: [try], data = [none]
if (p == replacement) { // detach pointers
TreeNode<K,V> pp;
if ((pp = p.parent) != null) {
if (p == pp.left)
pp.left = null;
else if (p == pp.right)
pp.right = null;
p.parent = null; // depends on control dependency: [if], data = [none]
}
}
} finally {
unlockRoot();
}
assert checkInvariants(root);
return false;
} } |
public class class_name {
protected void delayed(final Runnable runnable, long millis) {
timer.schedule(new TimerTask() {
@Override
public void run() {
try {
myExec.execute(runnable);
} catch (Throwable t) {
log(t);
}
}
}, millis);
} } | public class class_name {
protected void delayed(final Runnable runnable, long millis) {
timer.schedule(new TimerTask() {
@Override
public void run() {
try {
myExec.execute(runnable); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
log(t);
} // depends on control dependency: [catch], data = [none]
}
}, millis);
} } |
public class class_name {
private void unqueueWaves() {
// Extract the next wave to run
final Wave waveToRun = this.waveList.get(this.index);
// The wave is null skip it and launch the next one
if (waveToRun == null) {
if (CoreParameters.DEVELOPER_MODE.get()) {
throw new CoreRuntimeException("ChainWaveCommand shouldn't be called with null wave");
}
this.index++;
// Run next command if any
if (this.waveList.size() > this.index) {
unqueueWaves();
} else {
// The null wave was the last so we can declare the command as fully handled
fireHandled(this.sourceWave);
}
} else {
LOGGER.trace("Unqueue wave N° " + this.index + " >> " + waveToRun.toString());
// Attach a listener to be informed when the wave will be consumed
waveToRun.addWaveListener(this);
// Send it to the queue in order to perform it
sendWave(waveToRun);
}
} } | public class class_name {
private void unqueueWaves() {
// Extract the next wave to run
final Wave waveToRun = this.waveList.get(this.index);
// The wave is null skip it and launch the next one
if (waveToRun == null) {
if (CoreParameters.DEVELOPER_MODE.get()) {
throw new CoreRuntimeException("ChainWaveCommand shouldn't be called with null wave");
}
this.index++; // depends on control dependency: [if], data = [none]
// Run next command if any
if (this.waveList.size() > this.index) {
unqueueWaves(); // depends on control dependency: [if], data = [none]
} else {
// The null wave was the last so we can declare the command as fully handled
fireHandled(this.sourceWave); // depends on control dependency: [if], data = [none]
}
} else {
LOGGER.trace("Unqueue wave N° " + this.index + " >> " + waveToRun.toString()); // depends on control dependency: [if], data = [none]
// Attach a listener to be informed when the wave will be consumed
waveToRun.addWaveListener(this); // depends on control dependency: [if], data = [none]
// Send it to the queue in order to perform it
sendWave(waveToRun); // depends on control dependency: [if], data = [(waveToRun]
}
} } |
public class class_name {
public void marshall(GroupInformation groupInformation, ProtocolMarshaller protocolMarshaller) {
if (groupInformation == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(groupInformation.getArn(), ARN_BINDING);
protocolMarshaller.marshall(groupInformation.getCreationTimestamp(), CREATIONTIMESTAMP_BINDING);
protocolMarshaller.marshall(groupInformation.getId(), ID_BINDING);
protocolMarshaller.marshall(groupInformation.getLastUpdatedTimestamp(), LASTUPDATEDTIMESTAMP_BINDING);
protocolMarshaller.marshall(groupInformation.getLatestVersion(), LATESTVERSION_BINDING);
protocolMarshaller.marshall(groupInformation.getLatestVersionArn(), LATESTVERSIONARN_BINDING);
protocolMarshaller.marshall(groupInformation.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GroupInformation groupInformation, ProtocolMarshaller protocolMarshaller) {
if (groupInformation == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(groupInformation.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(groupInformation.getCreationTimestamp(), CREATIONTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(groupInformation.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(groupInformation.getLastUpdatedTimestamp(), LASTUPDATEDTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(groupInformation.getLatestVersion(), LATESTVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(groupInformation.getLatestVersionArn(), LATESTVERSIONARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(groupInformation.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void printProgress(long read, long size) {
int progress = Math.min(100, (int) ((100 * read) / size));
if (progress > lastProgress) {
lastProgress = progress;
System.out.println("Completed " + lastProgress + " % ");
}
} } | public class class_name {
private void printProgress(long read, long size) {
int progress = Math.min(100, (int) ((100 * read) / size));
if (progress > lastProgress) {
lastProgress = progress; // depends on control dependency: [if], data = [none]
System.out.println("Completed " + lastProgress + " % "); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Trivial
@FFDCIgnore(NamingException.class)
private String getProviderURL(TimedDirContext ctx) {
try {
return (String) ctx.getEnvironment().get(Context.PROVIDER_URL);
} catch (NamingException e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getProviderURL", e.toString(true));
}
return "(null)";
}
} } | public class class_name {
@Trivial
@FFDCIgnore(NamingException.class)
private String getProviderURL(TimedDirContext ctx) {
try {
return (String) ctx.getEnvironment().get(Context.PROVIDER_URL); // depends on control dependency: [try], data = [none]
} catch (NamingException e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getProviderURL", e.toString(true)); // depends on control dependency: [if], data = [none]
}
return "(null)";
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(ParameterStringFilter parameterStringFilter, ProtocolMarshaller protocolMarshaller) {
if (parameterStringFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(parameterStringFilter.getKey(), KEY_BINDING);
protocolMarshaller.marshall(parameterStringFilter.getOption(), OPTION_BINDING);
protocolMarshaller.marshall(parameterStringFilter.getValues(), VALUES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ParameterStringFilter parameterStringFilter, ProtocolMarshaller protocolMarshaller) {
if (parameterStringFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(parameterStringFilter.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterStringFilter.getOption(), OPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterStringFilter.getValues(), VALUES_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 {
@Override
public void visitClassContext(ClassContext classContext) {
try {
if ((runtimeExceptionClass != null) && (exceptionClass != null)) {
stack = new OpcodeStack();
declaredCheckedExceptions = new HashSet<>(6);
JavaClass cls = classContext.getJavaClass();
classIsFinal = cls.isFinal();
classIsAnonymous = cls.isAnonymous();
super.visitClassContext(classContext);
}
} finally {
declaredCheckedExceptions = null;
stack = null;
}
} } | public class class_name {
@Override
public void visitClassContext(ClassContext classContext) {
try {
if ((runtimeExceptionClass != null) && (exceptionClass != null)) {
stack = new OpcodeStack(); // depends on control dependency: [if], data = [none]
declaredCheckedExceptions = new HashSet<>(6); // depends on control dependency: [if], data = [none]
JavaClass cls = classContext.getJavaClass();
classIsFinal = cls.isFinal(); // depends on control dependency: [if], data = [none]
classIsAnonymous = cls.isAnonymous(); // depends on control dependency: [if], data = [none]
super.visitClassContext(classContext); // depends on control dependency: [if], data = [none]
}
} finally {
declaredCheckedExceptions = null;
stack = null;
}
} } |
public class class_name {
public boolean isAnnotationPresent(Class<? extends Annotation> annTypeTest)
{
for (Class<?> annType : _annTypes) {
if (annType.equals(annTypeTest)) {
return true;
}
}
return false;
} } | public class class_name {
public boolean isAnnotationPresent(Class<? extends Annotation> annTypeTest)
{
for (Class<?> annType : _annTypes) {
if (annType.equals(annTypeTest)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
static public String createMonitor(String monitorUrl,
Node parserInstruction, String modifiesResponse, TECore core) {
MonitorCall mc = monitors.get(monitorUrl);
mc.setCore(core);
if (parserInstruction != null) {
mc.setParserInstruction(DomUtils.getElement(parserInstruction));
mc.setModifiesResponse(Boolean.parseBoolean(modifiesResponse));
}
LOGR.log(Level.CONFIG, "Configured monitor without test:\n {0}", mc);
return "";
} } | public class class_name {
static public String createMonitor(String monitorUrl,
Node parserInstruction, String modifiesResponse, TECore core) {
MonitorCall mc = monitors.get(monitorUrl);
mc.setCore(core);
if (parserInstruction != null) {
mc.setParserInstruction(DomUtils.getElement(parserInstruction));
// depends on control dependency: [if], data = [(parserInstruction]
mc.setModifiesResponse(Boolean.parseBoolean(modifiesResponse));
// depends on control dependency: [if], data = [none]
}
LOGR.log(Level.CONFIG, "Configured monitor without test:\n {0}", mc);
return "";
} } |
public class class_name {
public void sendAuditEvent(AuditEventMessage[] msgs, InetAddress destination, int port) throws Exception
{
if (!EventUtils.isEmptyOrNull(msgs)) {
Socket s = getTLSSocket(destination, port);
for (int i=0; i<msgs.length; i++) {
send(msgs[i], s);
}
//TODO: tear down the TLS transport socket, if needed
}
} } | public class class_name {
public void sendAuditEvent(AuditEventMessage[] msgs, InetAddress destination, int port) throws Exception
{
if (!EventUtils.isEmptyOrNull(msgs)) {
Socket s = getTLSSocket(destination, port);
for (int i=0; i<msgs.length; i++) {
send(msgs[i], s); // depends on control dependency: [for], data = [i]
}
//TODO: tear down the TLS transport socket, if needed
}
} } |
public class class_name {
public static void premain(String options, Instrumentation instrumentation) {
// Load options.
Config.loadConfig(options, false);
if (Config.X_ENABLED_V) {
// Initialize instrumentation instance according to the
// given mode.
initializeMode(instrumentation);
}
} } | public class class_name {
public static void premain(String options, Instrumentation instrumentation) {
// Load options.
Config.loadConfig(options, false);
if (Config.X_ENABLED_V) {
// Initialize instrumentation instance according to the
// given mode.
initializeMode(instrumentation); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void startSearch(SPFSearchDescriptor searchDescriptor, SPFSearchCallback callback) {
try {
SPFError err = new SPFError();
getService().startNewSearch(getAccessToken(), searchDescriptor, callback, err);
if (!err.isOk()) {
handleError(err);
}
} catch (RemoteException e) {
// TODO Error management
e.printStackTrace();
}
} } | public class class_name {
public void startSearch(SPFSearchDescriptor searchDescriptor, SPFSearchCallback callback) {
try {
SPFError err = new SPFError();
getService().startNewSearch(getAccessToken(), searchDescriptor, callback, err); // depends on control dependency: [try], data = [none]
if (!err.isOk()) {
handleError(err); // depends on control dependency: [if], data = [none]
}
} catch (RemoteException e) {
// TODO Error management
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int getFieldIndex(String name) {
Integer val = this.nameToIndex.get(name);
if (val == null) {
return -1;
}
return val;
} } | public class class_name {
public int getFieldIndex(String name) {
Integer val = this.nameToIndex.get(name);
if (val == null) {
return -1; // depends on control dependency: [if], data = [none]
}
return val;
} } |
public class class_name {
public VoltTable[] run(SystemProcedureExecutionContext ctx) {
// Choose the lowest site ID on this host to actually flip the bit
VoltDBInterface voltdb = VoltDB.instance();
OperationMode opMode = voltdb.getMode();
if (ctx.isLowestSiteId()) {
ZooKeeper zk = voltdb.getHostMessenger().getZK();
try {
Stat stat;
OperationMode zkMode = null;
Code code;
do {
stat = new Stat();
code = Code.BADVERSION;
try {
byte [] data = zk.getData(VoltZK.operationMode, false, stat);
zkMode = data == null ? opMode : OperationMode.valueOf(data);
if (zkMode == RUNNING) {
break;
}
stat = zk.setData(VoltZK.operationMode, RUNNING.getBytes(), stat.getVersion());
code = Code.OK;
zkMode = RUNNING;
break;
} catch (BadVersionException ex) {
code = ex.code();
}
} while (zkMode != RUNNING && code == Code.BADVERSION);
m_stat = stat;
voltdb.getHostMessenger().unpause();
voltdb.setMode(RUNNING);
// for snmp
SnmpTrapSender snmp = voltdb.getSnmpTrapSender();
if (snmp != null) {
snmp.resume("Cluster resumed.");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA);
t.addRow(VoltSystemProcedure.STATUS_OK);
return new VoltTable[] {t};
} } | public class class_name {
public VoltTable[] run(SystemProcedureExecutionContext ctx) {
// Choose the lowest site ID on this host to actually flip the bit
VoltDBInterface voltdb = VoltDB.instance();
OperationMode opMode = voltdb.getMode();
if (ctx.isLowestSiteId()) {
ZooKeeper zk = voltdb.getHostMessenger().getZK();
try {
Stat stat;
OperationMode zkMode = null;
Code code;
do {
stat = new Stat();
code = Code.BADVERSION;
try {
byte [] data = zk.getData(VoltZK.operationMode, false, stat);
zkMode = data == null ? opMode : OperationMode.valueOf(data); // depends on control dependency: [try], data = [none]
if (zkMode == RUNNING) {
break;
}
stat = zk.setData(VoltZK.operationMode, RUNNING.getBytes(), stat.getVersion()); // depends on control dependency: [try], data = [none]
code = Code.OK; // depends on control dependency: [try], data = [none]
zkMode = RUNNING; // depends on control dependency: [try], data = [none]
break;
} catch (BadVersionException ex) {
code = ex.code();
} // depends on control dependency: [catch], data = [none]
} while (zkMode != RUNNING && code == Code.BADVERSION);
m_stat = stat; // depends on control dependency: [try], data = [none]
voltdb.getHostMessenger().unpause(); // depends on control dependency: [try], data = [none]
voltdb.setMode(RUNNING); // depends on control dependency: [try], data = [none]
// for snmp
SnmpTrapSender snmp = voltdb.getSnmpTrapSender();
if (snmp != null) {
snmp.resume("Cluster resumed."); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA);
t.addRow(VoltSystemProcedure.STATUS_OK);
return new VoltTable[] {t};
} } |
public class class_name {
public boolean computeDiff(List<JsonDelta> delta, List<String> context, JsonNode node1, JsonNode node2) {
boolean ret = false;
if (context.size() == 0 || filter.includeField(context)) {
JsonComparator cmp = getComparator(context, node1, node2);
if (cmp != null) {
ret = cmp.compare(delta, context, node1, node2);
} else {
delta.add(new JsonDelta(toString(context), node1, node2));
ret = true;
}
}
return ret;
} } | public class class_name {
public boolean computeDiff(List<JsonDelta> delta, List<String> context, JsonNode node1, JsonNode node2) {
boolean ret = false;
if (context.size() == 0 || filter.includeField(context)) {
JsonComparator cmp = getComparator(context, node1, node2);
if (cmp != null) {
ret = cmp.compare(delta, context, node1, node2); // depends on control dependency: [if], data = [none]
} else {
delta.add(new JsonDelta(toString(context), node1, node2)); // depends on control dependency: [if], data = [none]
ret = true; // depends on control dependency: [if], data = [none]
}
}
return ret;
} } |
public class class_name {
@SuppressWarnings("unchecked")
@NotNull
public final Parser<Object> getParser() {
if (parser != null) {
return parser;
}
LOG.info("Creating parser: {}", className);
if (className == null) {
throw new IllegalStateException("Class name was not set: " + getName());
}
if (context == null) {
throw new IllegalStateException("Context class loader was not set: " + getName() + " / " + className);
}
final Object obj = Utils4J.createInstance(className, context.getClassLoader());
if (!(obj instanceof Parser<?>)) {
throw new IllegalStateException("Expected class to be of type '" + Parser.class.getName() + "', but was: " + className);
}
parser = (Parser<Object>) obj;
parser.initialize(context, this);
return parser;
} } | public class class_name {
@SuppressWarnings("unchecked")
@NotNull
public final Parser<Object> getParser() {
if (parser != null) {
return parser;
// depends on control dependency: [if], data = [none]
}
LOG.info("Creating parser: {}", className);
if (className == null) {
throw new IllegalStateException("Class name was not set: " + getName());
}
if (context == null) {
throw new IllegalStateException("Context class loader was not set: " + getName() + " / " + className);
}
final Object obj = Utils4J.createInstance(className, context.getClassLoader());
if (!(obj instanceof Parser<?>)) {
throw new IllegalStateException("Expected class to be of type '" + Parser.class.getName() + "', but was: " + className);
}
parser = (Parser<Object>) obj;
parser.initialize(context, this);
return parser;
} } |
public class class_name {
@Override
public void handle(Callback[] callbacks) throws UnsupportedCallbackException {
for (Callback callback : callbacks) {
if (callback instanceof WSManagedConnectionFactoryCallback) {
((WSManagedConnectionFactoryCallback) callback).setManagedConnectionFactory(managedConnectionFactory);
} else if (callback instanceof WSMappingPropertiesCallback) {
((WSMappingPropertiesCallback) callback).setProperties(properties);
} else {
// TODO: Issue a warning with translated message
// Use translated message for the the UnsupportedCallbackException
throw new UnsupportedCallbackException(callback, "Unrecognized Callback");
}
}
} } | public class class_name {
@Override
public void handle(Callback[] callbacks) throws UnsupportedCallbackException {
for (Callback callback : callbacks) {
if (callback instanceof WSManagedConnectionFactoryCallback) {
((WSManagedConnectionFactoryCallback) callback).setManagedConnectionFactory(managedConnectionFactory); // depends on control dependency: [if], data = [none]
} else if (callback instanceof WSMappingPropertiesCallback) {
((WSMappingPropertiesCallback) callback).setProperties(properties); // depends on control dependency: [if], data = [none]
} else {
// TODO: Issue a warning with translated message
// Use translated message for the the UnsupportedCallbackException
throw new UnsupportedCallbackException(callback, "Unrecognized Callback");
}
}
} } |
public class class_name {
public static long longValue(String key, long defaultValue) {
String value = System.getProperty(key);
long longValue = defaultValue;
if (value != null) {
try {
longValue = Long.parseLong(value);
} catch (NumberFormatException e) {
LOG.warning(e, "Ignoring invalid long system propert: ''{0}'' = ''{1}''", key, value);
}
}
return longValue;
} } | public class class_name {
public static long longValue(String key, long defaultValue) {
String value = System.getProperty(key);
long longValue = defaultValue;
if (value != null) {
try {
longValue = Long.parseLong(value); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
LOG.warning(e, "Ignoring invalid long system propert: ''{0}'' = ''{1}''", key, value);
} // depends on control dependency: [catch], data = [none]
}
return longValue;
} } |
public class class_name {
public long processCacheAnnotations(Method nonProxiedMethod, List<String> parameters) {
if (isJsCached(nonProxiedMethod)) {
return jsCacheAnnotationServices.getJsCacheResultDeadline(nonProxiedMethod.getAnnotation(JsCacheResult.class));
}
return 0L;
} } | public class class_name {
public long processCacheAnnotations(Method nonProxiedMethod, List<String> parameters) {
if (isJsCached(nonProxiedMethod)) {
return jsCacheAnnotationServices.getJsCacheResultDeadline(nonProxiedMethod.getAnnotation(JsCacheResult.class));
// depends on control dependency: [if], data = [none]
}
return 0L;
} } |
public class class_name {
public EClass getIfcBooleanResult() {
if (ifcBooleanResultEClass == null) {
ifcBooleanResultEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(44);
}
return ifcBooleanResultEClass;
} } | public class class_name {
public EClass getIfcBooleanResult() {
if (ifcBooleanResultEClass == null) {
ifcBooleanResultEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(44);
// depends on control dependency: [if], data = [none]
}
return ifcBooleanResultEClass;
} } |
public class class_name {
private void parseFaultDetail(BeanDefinitionBuilder builder, Element faultElement) {
List<Element> faultDetailElements = DomUtils.getChildElementsByTagName(faultElement, "fault-detail");
List<String> faultDetails = new ArrayList<String>();
List<String> faultDetailResourcePaths = new ArrayList<String>();
for (Element faultDetailElement : faultDetailElements) {
if (faultDetailElement.hasAttribute("file")) {
if (StringUtils.hasText(DomUtils.getTextValue(faultDetailElement).trim())) {
throw new BeanCreationException("You tried to set fault-detail by file resource attribute and inline text value at the same time! " +
"Please choose one of them.");
}
String charset = faultDetailElement.getAttribute("charset");
String filePath = faultDetailElement.getAttribute("file");
faultDetailResourcePaths.add(filePath + (StringUtils.hasText(charset) ? FileUtils.FILE_PATH_CHARSET_PARAMETER + charset : ""));
} else {
String faultDetailData = DomUtils.getTextValue(faultDetailElement).trim();
if (StringUtils.hasText(faultDetailData)) {
faultDetails.add(faultDetailData);
} else {
throw new BeanCreationException("Not content for fault-detail is set! Either use file attribute or inline text value for fault-detail element.");
}
}
}
builder.addPropertyValue("faultDetails", faultDetails);
builder.addPropertyValue("faultDetailResourcePaths", faultDetailResourcePaths);
} } | public class class_name {
private void parseFaultDetail(BeanDefinitionBuilder builder, Element faultElement) {
List<Element> faultDetailElements = DomUtils.getChildElementsByTagName(faultElement, "fault-detail");
List<String> faultDetails = new ArrayList<String>();
List<String> faultDetailResourcePaths = new ArrayList<String>();
for (Element faultDetailElement : faultDetailElements) {
if (faultDetailElement.hasAttribute("file")) {
if (StringUtils.hasText(DomUtils.getTextValue(faultDetailElement).trim())) {
throw new BeanCreationException("You tried to set fault-detail by file resource attribute and inline text value at the same time! " +
"Please choose one of them.");
}
String charset = faultDetailElement.getAttribute("charset");
String filePath = faultDetailElement.getAttribute("file");
faultDetailResourcePaths.add(filePath + (StringUtils.hasText(charset) ? FileUtils.FILE_PATH_CHARSET_PARAMETER + charset : "")); // depends on control dependency: [if], data = [none]
} else {
String faultDetailData = DomUtils.getTextValue(faultDetailElement).trim();
if (StringUtils.hasText(faultDetailData)) {
faultDetails.add(faultDetailData); // depends on control dependency: [if], data = [none]
} else {
throw new BeanCreationException("Not content for fault-detail is set! Either use file attribute or inline text value for fault-detail element.");
}
}
}
builder.addPropertyValue("faultDetails", faultDetails);
builder.addPropertyValue("faultDetailResourcePaths", faultDetailResourcePaths);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.