code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public void configure(Configuration parameters) {
super.configure(parameters);
// the if() clauses are to prevent the configure() method from
// overwriting the values set by the setters
if (Arrays.equals(delimiter, new byte[] {'\n'})) {
String delimString = parameters.getString(RECORD_DELIMITER, null);
if (delimString != null) {
setDelimiter(delimString);
}
}
// set the number of samples
if (numLineSamples == NUM_SAMPLES_UNDEFINED) {
String samplesString = parameters.getString(NUM_STATISTICS_SAMPLES, null);
if (samplesString != null) {
try {
setNumLineSamples(Integer.parseInt(samplesString));
} catch (NumberFormatException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Invalid value for number of samples to take: " + samplesString + ". Skipping sampling.");
}
setNumLineSamples(0);
}
}
}
} } | public class class_name {
@Override
public void configure(Configuration parameters) {
super.configure(parameters);
// the if() clauses are to prevent the configure() method from
// overwriting the values set by the setters
if (Arrays.equals(delimiter, new byte[] {'\n'})) {
String delimString = parameters.getString(RECORD_DELIMITER, null);
if (delimString != null) {
setDelimiter(delimString); // depends on control dependency: [if], data = [(delimString]
}
}
// set the number of samples
if (numLineSamples == NUM_SAMPLES_UNDEFINED) {
String samplesString = parameters.getString(NUM_STATISTICS_SAMPLES, null);
if (samplesString != null) {
try {
setNumLineSamples(Integer.parseInt(samplesString)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Invalid value for number of samples to take: " + samplesString + ". Skipping sampling."); // depends on control dependency: [if], data = [none]
}
setNumLineSamples(0);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected void initExportObject() {
try {
if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) {
// create a new list
setGroups(new ArrayList<CmsGroup>());
setRoles(new ArrayList<CmsRole>());
} else {
// this is not the initial call, get the message info object from session
setGroups((List<CmsGroup>)((Map<?, ?>)getDialogObject()).get("groups"));
setRoles((List<CmsRole>)((Map<?, ?>)getDialogObject()).get("roles"));
}
} catch (Exception e) {
// create a new list
setGroups(new ArrayList<CmsGroup>());
setRoles(new ArrayList<CmsRole>());
}
} } | public class class_name {
@SuppressWarnings("unchecked")
protected void initExportObject() {
try {
if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) {
// create a new list
setGroups(new ArrayList<CmsGroup>()); // depends on control dependency: [if], data = [none]
setRoles(new ArrayList<CmsRole>()); // depends on control dependency: [if], data = [none]
} else {
// this is not the initial call, get the message info object from session
setGroups((List<CmsGroup>)((Map<?, ?>)getDialogObject()).get("groups")); // depends on control dependency: [if], data = [none]
setRoles((List<CmsRole>)((Map<?, ?>)getDialogObject()).get("roles")); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
// create a new list
setGroups(new ArrayList<CmsGroup>());
setRoles(new ArrayList<CmsRole>());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings("unchecked")
public HashMap<String, HashMap<String, String>> getMetaData() {
HashMap<String, HashMap<String, String>> result = new HashMap<String, HashMap<String, String>>();
for (MetaRecord mr : meta) {
result.put((String) mr.get(FieldName.META_FILENAME),
(HashMap<String, String>) mr.get(FieldName.META_PROPERTIES));
}
return result;
} } | public class class_name {
@SuppressWarnings("unchecked")
public HashMap<String, HashMap<String, String>> getMetaData() {
HashMap<String, HashMap<String, String>> result = new HashMap<String, HashMap<String, String>>();
for (MetaRecord mr : meta) {
result.put((String) mr.get(FieldName.META_FILENAME),
(HashMap<String, String>) mr.get(FieldName.META_PROPERTIES)); // depends on control dependency: [for], data = [mr]
}
return result;
} } |
public class class_name {
public Observable<ServiceResponse<CertificateWithNonceDescriptionInner>> generateVerificationCodeWithServiceResponseAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (certificateName == null) {
throw new IllegalArgumentException("Parameter certificateName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (ifMatch == null) {
throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null.");
}
return service.generateVerificationCode(this.client.subscriptionId(), resourceGroupName, resourceName, certificateName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CertificateWithNonceDescriptionInner>>>() {
@Override
public Observable<ServiceResponse<CertificateWithNonceDescriptionInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<CertificateWithNonceDescriptionInner> clientResponse = generateVerificationCodeDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<CertificateWithNonceDescriptionInner>> generateVerificationCodeWithServiceResponseAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (certificateName == null) {
throw new IllegalArgumentException("Parameter certificateName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (ifMatch == null) {
throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null.");
}
return service.generateVerificationCode(this.client.subscriptionId(), resourceGroupName, resourceName, certificateName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CertificateWithNonceDescriptionInner>>>() {
@Override
public Observable<ServiceResponse<CertificateWithNonceDescriptionInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<CertificateWithNonceDescriptionInner> clientResponse = generateVerificationCodeDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
@Override
public long getDateHeader(String hdr) {
try {
String value = this.request.getHeader(hdr);
if (null == value) {
return -1L;
}
Date rc = connection.getDateFormatter().parseTime(value);
if (null != rc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getDateHeader: " + hdr + " " + rc.getTime());
}
return rc.getTime();
}
return -1L;
} catch (ParseException e) {
throw new IllegalArgumentException(hdr, e);
}
} } | public class class_name {
@Override
public long getDateHeader(String hdr) {
try {
String value = this.request.getHeader(hdr);
if (null == value) {
return -1L; // depends on control dependency: [if], data = [none]
}
Date rc = connection.getDateFormatter().parseTime(value);
if (null != rc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getDateHeader: " + hdr + " " + rc.getTime()); // depends on control dependency: [if], data = [none]
}
return rc.getTime(); // depends on control dependency: [if], data = [none]
}
return -1L; // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
throw new IllegalArgumentException(hdr, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void drawLine(Object parent, String name, LineString line, ShapeStyle style) {
if (isAttached()) {
Element element = helper.createOrUpdateElement(parent, name, "shape", style);
if (line != null) {
Dom.setElementAttribute(element, "path", VmlPathDecoder.decode(line));
Dom.setStyleAttribute(element, "position", "absolute");
applyElementSize(element, width, height, false);
}
}
} } | public class class_name {
public void drawLine(Object parent, String name, LineString line, ShapeStyle style) {
if (isAttached()) {
Element element = helper.createOrUpdateElement(parent, name, "shape", style);
if (line != null) {
Dom.setElementAttribute(element, "path", VmlPathDecoder.decode(line)); // depends on control dependency: [if], data = [(line]
Dom.setStyleAttribute(element, "position", "absolute"); // depends on control dependency: [if], data = [none]
applyElementSize(element, width, height, false); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(UpdateBusinessReportScheduleRequest updateBusinessReportScheduleRequest, ProtocolMarshaller protocolMarshaller) {
if (updateBusinessReportScheduleRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getScheduleArn(), SCHEDULEARN_BINDING);
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getS3BucketName(), S3BUCKETNAME_BINDING);
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getS3KeyPrefix(), S3KEYPREFIX_BINDING);
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getFormat(), FORMAT_BINDING);
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getScheduleName(), SCHEDULENAME_BINDING);
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getRecurrence(), RECURRENCE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateBusinessReportScheduleRequest updateBusinessReportScheduleRequest, ProtocolMarshaller protocolMarshaller) {
if (updateBusinessReportScheduleRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getScheduleArn(), SCHEDULEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getS3BucketName(), S3BUCKETNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getS3KeyPrefix(), S3KEYPREFIX_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getFormat(), FORMAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getScheduleName(), SCHEDULENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateBusinessReportScheduleRequest.getRecurrence(), RECURRENCE_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 <T> List<Binding<T>> bindings(Key<T> key)
{
BindingSet<T> set = (BindingSet) _bindingSetMap.get(key.rawClass());
if (set != null) {
return set.bindings(key);
}
else {
return Collections.EMPTY_LIST;
}
} } | public class class_name {
@Override
public <T> List<Binding<T>> bindings(Key<T> key)
{
BindingSet<T> set = (BindingSet) _bindingSetMap.get(key.rawClass());
if (set != null) {
return set.bindings(key); // depends on control dependency: [if], data = [none]
}
else {
return Collections.EMPTY_LIST; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static boolean isValidJavaIdentifier(final String identifier) {
Contracts.assertNotNull(identifier, "identifier param cannot be null");
if (identifier.length() == 0 || !isJavaIdentifierStart(identifier.charAt(0))) {
return false;
}
for (int i = 1; i < identifier.length(); i++) {
if (!isJavaIdentifierPart(identifier.charAt(i))) {
return false;
}
}
return true;
} } | public class class_name {
private static boolean isValidJavaIdentifier(final String identifier) {
Contracts.assertNotNull(identifier, "identifier param cannot be null");
if (identifier.length() == 0 || !isJavaIdentifierStart(identifier.charAt(0))) {
return false; // depends on control dependency: [if], data = [none]
}
for (int i = 1; i < identifier.length(); i++) {
if (!isJavaIdentifierPart(identifier.charAt(i))) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public void handleInitiateResponseMessage(InitiateResponseMessage message)
{
final VoltTrace.TraceEventBatch traceLog = VoltTrace.log(VoltTrace.Category.MPI);
if (traceLog != null) {
traceLog.add(() -> VoltTrace.endAsync("initmp", message.getTxnId()));
}
DuplicateCounter counter = m_duplicateCounters.get(message.getTxnId());
// A transaction may be routed back here for EveryPartitionTask via leader migration
if (counter != null && message.isMisrouted()) {
tmLog.info("The message on the partition is misrouted. TxnID: " + TxnEgo.txnIdToString(message.getTxnId()));
Long newLeader = m_leaderMigrationMap.get(message.m_sourceHSId);
if (newLeader != null) {
// Update the DuplicateCounter with new replica
counter.updateReplica(message.m_sourceHSId, newLeader);
m_leaderMigrationMap.remove(message.m_sourceHSId);
// Leader migration has updated the leader, send the request to the new leader
m_mailbox.send(newLeader, counter.getOpenMessage());
} else {
// Leader migration not done yet.
m_mailbox.send(message.m_sourceHSId, counter.getOpenMessage());
}
return;
}
if (counter != null) {
int result = counter.offer(message);
if (result == DuplicateCounter.DONE) {
m_duplicateCounters.remove(message.getTxnId());
// Only advance the truncation point on committed transactions that sent fragments to SPIs.
// See ENG-4211 & ENG-14563
if (message.shouldCommit() && message.haveSentMpFragment()) {
m_repairLogTruncationHandle = m_repairLogAwaitingCommit;
m_repairLogAwaitingCommit = message.getTxnId();
}
m_outstandingTxns.remove(message.getTxnId());
m_mailbox.send(counter.m_destinationId, message);
}
else if (result == DuplicateCounter.MISMATCH) {
VoltDB.crashLocalVoltDB("HASH MISMATCH running every-site system procedure.", true, null);
} else if (result == DuplicateCounter.ABORT) {
VoltDB.crashLocalVoltDB("PARTIAL ROLLBACK/ABORT running every-site system procedure.", true, null);
}
// doing duplicate suppresion: all done.
}
else {
// Only advance the truncation point on committed transactions that sent fragments to SPIs.
if (message.shouldCommit() && message.haveSentMpFragment()) {
m_repairLogTruncationHandle = m_repairLogAwaitingCommit;
m_repairLogAwaitingCommit = message.getTxnId();
}
MpTransactionState txn = (MpTransactionState)m_outstandingTxns.remove(message.getTxnId());
assert(txn != null);
// the initiatorHSId is the ClientInterface mailbox. Yeah. I know.
m_mailbox.send(message.getInitiatorHSId(), message);
// We actually completed this MP transaction. Create a fake CompleteTransactionMessage
// to send to our local repair log so that the fate of this transaction is never forgotten
// even if all the masters somehow die before forwarding Complete on to their replicas.
CompleteTransactionMessage ctm = new CompleteTransactionMessage(m_mailbox.getHSId(),
message.m_sourceHSId, message.getTxnId(), message.isReadOnly(), 0,
!message.shouldCommit(), false, false, false, txn.isNPartTxn(),
message.m_isFromNonRestartableSysproc, false);
ctm.setTruncationHandle(m_repairLogTruncationHandle);
// dump it in the repair log
// hacky castage
((MpInitiatorMailbox)m_mailbox).deliverToRepairLog(ctm);
}
} } | public class class_name {
public void handleInitiateResponseMessage(InitiateResponseMessage message)
{
final VoltTrace.TraceEventBatch traceLog = VoltTrace.log(VoltTrace.Category.MPI);
if (traceLog != null) {
traceLog.add(() -> VoltTrace.endAsync("initmp", message.getTxnId())); // depends on control dependency: [if], data = [none]
}
DuplicateCounter counter = m_duplicateCounters.get(message.getTxnId());
// A transaction may be routed back here for EveryPartitionTask via leader migration
if (counter != null && message.isMisrouted()) {
tmLog.info("The message on the partition is misrouted. TxnID: " + TxnEgo.txnIdToString(message.getTxnId())); // depends on control dependency: [if], data = [none]
Long newLeader = m_leaderMigrationMap.get(message.m_sourceHSId);
if (newLeader != null) {
// Update the DuplicateCounter with new replica
counter.updateReplica(message.m_sourceHSId, newLeader); // depends on control dependency: [if], data = [none]
m_leaderMigrationMap.remove(message.m_sourceHSId); // depends on control dependency: [if], data = [none]
// Leader migration has updated the leader, send the request to the new leader
m_mailbox.send(newLeader, counter.getOpenMessage()); // depends on control dependency: [if], data = [(newLeader]
} else {
// Leader migration not done yet.
m_mailbox.send(message.m_sourceHSId, counter.getOpenMessage()); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if (counter != null) {
int result = counter.offer(message);
if (result == DuplicateCounter.DONE) {
m_duplicateCounters.remove(message.getTxnId()); // depends on control dependency: [if], data = [none]
// Only advance the truncation point on committed transactions that sent fragments to SPIs.
// See ENG-4211 & ENG-14563
if (message.shouldCommit() && message.haveSentMpFragment()) {
m_repairLogTruncationHandle = m_repairLogAwaitingCommit; // depends on control dependency: [if], data = [none]
m_repairLogAwaitingCommit = message.getTxnId(); // depends on control dependency: [if], data = [none]
}
m_outstandingTxns.remove(message.getTxnId()); // depends on control dependency: [if], data = [none]
m_mailbox.send(counter.m_destinationId, message); // depends on control dependency: [if], data = [none]
}
else if (result == DuplicateCounter.MISMATCH) {
VoltDB.crashLocalVoltDB("HASH MISMATCH running every-site system procedure.", true, null); // depends on control dependency: [if], data = [none]
} else if (result == DuplicateCounter.ABORT) {
VoltDB.crashLocalVoltDB("PARTIAL ROLLBACK/ABORT running every-site system procedure.", true, null); // depends on control dependency: [if], data = [none]
}
// doing duplicate suppresion: all done.
}
else {
// Only advance the truncation point on committed transactions that sent fragments to SPIs.
if (message.shouldCommit() && message.haveSentMpFragment()) {
m_repairLogTruncationHandle = m_repairLogAwaitingCommit; // depends on control dependency: [if], data = [none]
m_repairLogAwaitingCommit = message.getTxnId(); // depends on control dependency: [if], data = [none]
}
MpTransactionState txn = (MpTransactionState)m_outstandingTxns.remove(message.getTxnId());
assert(txn != null); // depends on control dependency: [if], data = [null)]
// the initiatorHSId is the ClientInterface mailbox. Yeah. I know.
m_mailbox.send(message.getInitiatorHSId(), message); // depends on control dependency: [if], data = [none]
// We actually completed this MP transaction. Create a fake CompleteTransactionMessage
// to send to our local repair log so that the fate of this transaction is never forgotten
// even if all the masters somehow die before forwarding Complete on to their replicas.
CompleteTransactionMessage ctm = new CompleteTransactionMessage(m_mailbox.getHSId(),
message.m_sourceHSId, message.getTxnId(), message.isReadOnly(), 0,
!message.shouldCommit(), false, false, false, txn.isNPartTxn(),
message.m_isFromNonRestartableSysproc, false);
ctm.setTruncationHandle(m_repairLogTruncationHandle); // depends on control dependency: [if], data = [none]
// dump it in the repair log
// hacky castage
((MpInitiatorMailbox)m_mailbox).deliverToRepairLog(ctm); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static UIComponent getCompositeComponentBasedOnLocation(final FacesContext facesContext,
final Location location, int ccLevel)
{
//1 Use getCurrentComponent and getCurrentCompositeComponent to look on the component stack
UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent(facesContext);
//1.1 Use getCurrentCompositeComponent first!
if (currentCompositeComponent != null)
{
Location componentLocation = (Location) currentCompositeComponent.getAttributes().get(LOCATION_KEY);
if (componentLocation != null
&& componentLocation.getPath().equals(location.getPath()) &&
(ccLevel == getCCLevel(currentCompositeComponent)) )
{
return currentCompositeComponent;
}
}
UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext);
if (currentComponent == null)
{
// Cannot found any component, because we don't have any reference!
return null;
}
//2. Look on the stack using a recursive algorithm.
UIComponent matchingCompositeComponent
= lookForCompositeComponentOnStack(facesContext, location, ccLevel, currentComponent);
if (matchingCompositeComponent != null)
{
return matchingCompositeComponent;
}
//2. Try to find it using UIComponent.getCurrentCompositeComponent().
// This one will look the direct parent hierarchy of the component,
// to see if the composite component can be found.
if (currentCompositeComponent != null)
{
currentComponent = currentCompositeComponent;
}
else
{
//Try to find the composite component looking directly the parent
//ancestor of the current component
//currentComponent = UIComponent.getCurrentComponent(facesContext);
boolean found = false;
while (currentComponent != null && !found)
{
String findComponentExpr = (String) currentComponent.getAttributes().get(CC_FIND_COMPONENT_EXPRESSION);
if (findComponentExpr != null)
{
UIComponent foundComponent = facesContext.getViewRoot().findComponent(findComponentExpr);
if (foundComponent != null)
{
Location foundComponentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
if (foundComponentLocation != null
&& foundComponentLocation.getPath().equals(location.getPath()) &&
ccLevel == getCCLevel(foundComponent))
{
return foundComponent;
}
else
{
while (foundComponent != null)
{
Location componentLocation
= (Location) foundComponent.getAttributes().get(LOCATION_KEY);
if (componentLocation != null
&& componentLocation.getPath().equals(location.getPath()) &&
ccLevel == getCCLevel(foundComponent))
{
return foundComponent;
}
// get the composite component's parent
foundComponent = UIComponent.getCompositeComponentParent(foundComponent);
}
}
}
}
if (UIComponent.isCompositeComponent(currentComponent))
{
found = true;
}
else
{
currentComponent = currentComponent.getParent();
}
}
}
//if currentComponent != null means we have a composite component that we can check
//Use UIComponent.getCompositeComponentParent() to traverse here.
while (currentComponent != null)
{
Location componentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
if (componentLocation != null
&& componentLocation.getPath().equals(location.getPath()) &&
ccLevel == getCCLevel(currentComponent))
{
return currentComponent;
}
// get the composite component's parent
currentComponent = UIComponent.getCompositeComponentParent(currentComponent);
}
// not found
return null;
} } | public class class_name {
public static UIComponent getCompositeComponentBasedOnLocation(final FacesContext facesContext,
final Location location, int ccLevel)
{
//1 Use getCurrentComponent and getCurrentCompositeComponent to look on the component stack
UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent(facesContext);
//1.1 Use getCurrentCompositeComponent first!
if (currentCompositeComponent != null)
{
Location componentLocation = (Location) currentCompositeComponent.getAttributes().get(LOCATION_KEY);
if (componentLocation != null
&& componentLocation.getPath().equals(location.getPath()) &&
(ccLevel == getCCLevel(currentCompositeComponent)) )
{
return currentCompositeComponent; // depends on control dependency: [if], data = [none]
}
}
UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext);
if (currentComponent == null)
{
// Cannot found any component, because we don't have any reference!
return null; // depends on control dependency: [if], data = [none]
}
//2. Look on the stack using a recursive algorithm.
UIComponent matchingCompositeComponent
= lookForCompositeComponentOnStack(facesContext, location, ccLevel, currentComponent);
if (matchingCompositeComponent != null)
{
return matchingCompositeComponent; // depends on control dependency: [if], data = [none]
}
//2. Try to find it using UIComponent.getCurrentCompositeComponent().
// This one will look the direct parent hierarchy of the component,
// to see if the composite component can be found.
if (currentCompositeComponent != null)
{
currentComponent = currentCompositeComponent; // depends on control dependency: [if], data = [none]
}
else
{
//Try to find the composite component looking directly the parent
//ancestor of the current component
//currentComponent = UIComponent.getCurrentComponent(facesContext);
boolean found = false;
while (currentComponent != null && !found)
{
String findComponentExpr = (String) currentComponent.getAttributes().get(CC_FIND_COMPONENT_EXPRESSION);
if (findComponentExpr != null)
{
UIComponent foundComponent = facesContext.getViewRoot().findComponent(findComponentExpr);
if (foundComponent != null)
{
Location foundComponentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
if (foundComponentLocation != null
&& foundComponentLocation.getPath().equals(location.getPath()) &&
ccLevel == getCCLevel(foundComponent))
{
return foundComponent; // depends on control dependency: [if], data = [none]
}
else
{
while (foundComponent != null)
{
Location componentLocation
= (Location) foundComponent.getAttributes().get(LOCATION_KEY);
if (componentLocation != null
&& componentLocation.getPath().equals(location.getPath()) &&
ccLevel == getCCLevel(foundComponent))
{
return foundComponent; // depends on control dependency: [if], data = [none]
}
// get the composite component's parent
foundComponent = UIComponent.getCompositeComponentParent(foundComponent); // depends on control dependency: [while], data = [(foundComponent]
}
}
}
}
if (UIComponent.isCompositeComponent(currentComponent))
{
found = true; // depends on control dependency: [if], data = [none]
}
else
{
currentComponent = currentComponent.getParent(); // depends on control dependency: [if], data = [none]
}
}
}
//if currentComponent != null means we have a composite component that we can check
//Use UIComponent.getCompositeComponentParent() to traverse here.
while (currentComponent != null)
{
Location componentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
if (componentLocation != null
&& componentLocation.getPath().equals(location.getPath()) &&
ccLevel == getCCLevel(currentComponent))
{
return currentComponent; // depends on control dependency: [if], data = [none]
}
// get the composite component's parent
currentComponent = UIComponent.getCompositeComponentParent(currentComponent); // depends on control dependency: [while], data = [(currentComponent]
}
// not found
return null;
} } |
public class class_name {
protected long showRunning(String keyword) {
if (logger.isDebugEnabled()) {
logger.debug("#flow #async ...Running asynchronous call as {}", keyword);
}
return System.currentTimeMillis();
} } | public class class_name {
protected long showRunning(String keyword) {
if (logger.isDebugEnabled()) {
logger.debug("#flow #async ...Running asynchronous call as {}", keyword); // depends on control dependency: [if], data = [none]
}
return System.currentTimeMillis();
} } |
public class class_name {
public FeatureCollectionConfig readConfigFromFile(String filename) {
org.jdom2.Document doc;
try {
SAXBuilder builder = new SAXBuilder();
doc = builder.build(filename);
} catch (Exception e) {
System.out.printf("Error parsing featureCollection %s err = %s", filename, e.getMessage());
return null;
}
return readConfig(doc.getRootElement());
} } | public class class_name {
public FeatureCollectionConfig readConfigFromFile(String filename) {
org.jdom2.Document doc;
try {
SAXBuilder builder = new SAXBuilder();
doc = builder.build(filename); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
System.out.printf("Error parsing featureCollection %s err = %s", filename, e.getMessage());
return null;
} // depends on control dependency: [catch], data = [none]
return readConfig(doc.getRootElement());
} } |
public class class_name {
@Override
public void setAsText(String text) {
if (BeanUtils.isNull(text)) {
setValue(null);
return;
}
setValue(getAsDocument(text).getDocumentElement());
} } | public class class_name {
@Override
public void setAsText(String text) {
if (BeanUtils.isNull(text)) {
setValue(null); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
setValue(getAsDocument(text).getDocumentElement());
} } |
public class class_name {
public static String readResource(Class<?> clazz, String path)
{
File targetFile = resolve(clazz, path);
if (targetFile == null)
{
return null;
}
String result;
try
{
result = FileUtils.readFileToString(targetFile, "UTF-8");
}
catch (IOException ex)
{
return null;
}
return result;
} } | public class class_name {
public static String readResource(Class<?> clazz, String path)
{
File targetFile = resolve(clazz, path);
if (targetFile == null)
{
return null; // depends on control dependency: [if], data = [none]
}
String result;
try
{
result = FileUtils.readFileToString(targetFile, "UTF-8"); // depends on control dependency: [try], data = [none]
}
catch (IOException ex)
{
return null;
} // depends on control dependency: [catch], data = [none]
return result;
} } |
public class class_name {
private void removeDataNode(DiffEntry change) {
if (checkFilePath(change.getOldPath(), NODE_FILE_DEPTH)) {
Path nodeFilePath = new Path(this.repositoryDir, change.getOldPath());
Config config = getNodeConfigWithOverrides(ConfigFactory.empty(), nodeFilePath);
String nodeId = config.getString(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY);
if (!this.flowGraph.deleteDataNode(nodeId)) {
log.warn("Could not remove DataNode {} from FlowGraph; skipping", nodeId);
} else {
log.info("Removed DataNode {} from FlowGraph", nodeId);
}
}
} } | public class class_name {
private void removeDataNode(DiffEntry change) {
if (checkFilePath(change.getOldPath(), NODE_FILE_DEPTH)) {
Path nodeFilePath = new Path(this.repositoryDir, change.getOldPath());
Config config = getNodeConfigWithOverrides(ConfigFactory.empty(), nodeFilePath);
String nodeId = config.getString(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY);
if (!this.flowGraph.deleteDataNode(nodeId)) {
log.warn("Could not remove DataNode {} from FlowGraph; skipping", nodeId); // depends on control dependency: [if], data = [none]
} else {
log.info("Removed DataNode {} from FlowGraph", nodeId); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static Shell createConsoleShell(String prompt, String appName, Object mainHandler,
BufferedReader in, PrintStream out, PrintStream err,
ConsoleIO.PromptListener promptListener) {
ConsoleIO io = new ConsoleIO(in, out, err);
if (promptListener != null) {
io.setPromptListener(promptListener);
}
List<String> path = new ArrayList<String>(1);
path.add(prompt);
MultiMap<String, Object> modifAuxHandlers = new ArrayHashMultiMap<String, Object>();
modifAuxHandlers.put("!", io);
Shell theShell = new Shell(new Shell.Settings(io, io, modifAuxHandlers, false),
new CommandTable(new DashJoinedNamer(true)), path);
theShell.setAppName(appName);
theShell.addMainHandler(theShell, "!");
theShell.addMainHandler(new HelpCommandHandler(), "?");
theShell.addMainHandler(mainHandler, "");
return theShell;
} } | public class class_name {
public static Shell createConsoleShell(String prompt, String appName, Object mainHandler,
BufferedReader in, PrintStream out, PrintStream err,
ConsoleIO.PromptListener promptListener) {
ConsoleIO io = new ConsoleIO(in, out, err);
if (promptListener != null) {
io.setPromptListener(promptListener); // depends on control dependency: [if], data = [(promptListener]
}
List<String> path = new ArrayList<String>(1);
path.add(prompt);
MultiMap<String, Object> modifAuxHandlers = new ArrayHashMultiMap<String, Object>();
modifAuxHandlers.put("!", io);
Shell theShell = new Shell(new Shell.Settings(io, io, modifAuxHandlers, false),
new CommandTable(new DashJoinedNamer(true)), path);
theShell.setAppName(appName);
theShell.addMainHandler(theShell, "!");
theShell.addMainHandler(new HelpCommandHandler(), "?");
theShell.addMainHandler(mainHandler, "");
return theShell;
} } |
public class class_name {
public String get(String key)
{
String urlKey = urlEncode(key);
ApiResponseReader<String> reader = new ApiResponseReader<String>()
{
public String parse(InputStream in) throws Exception
{
InputStreamReader isr = new InputStreamReader(in, OsmConnection.CHARSET);
BufferedReader reader = new BufferedReader(isr, BUFFER_SIZE_PREFS);
return reader.readLine();
}
};
try
{
return osm.makeAuthenticatedRequest(USERPREFS + urlKey, "GET", reader);
}
catch(OsmNotFoundException e)
{
return null;
}
} } | public class class_name {
public String get(String key)
{
String urlKey = urlEncode(key);
ApiResponseReader<String> reader = new ApiResponseReader<String>()
{
public String parse(InputStream in) throws Exception
{
InputStreamReader isr = new InputStreamReader(in, OsmConnection.CHARSET);
BufferedReader reader = new BufferedReader(isr, BUFFER_SIZE_PREFS);
return reader.readLine();
}
};
try
{
return osm.makeAuthenticatedRequest(USERPREFS + urlKey, "GET", reader); // depends on control dependency: [try], data = [none]
}
catch(OsmNotFoundException e)
{
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(UpdateServerEngineAttributesRequest updateServerEngineAttributesRequest, ProtocolMarshaller protocolMarshaller) {
if (updateServerEngineAttributesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateServerEngineAttributesRequest.getServerName(), SERVERNAME_BINDING);
protocolMarshaller.marshall(updateServerEngineAttributesRequest.getAttributeName(), ATTRIBUTENAME_BINDING);
protocolMarshaller.marshall(updateServerEngineAttributesRequest.getAttributeValue(), ATTRIBUTEVALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateServerEngineAttributesRequest updateServerEngineAttributesRequest, ProtocolMarshaller protocolMarshaller) {
if (updateServerEngineAttributesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateServerEngineAttributesRequest.getServerName(), SERVERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateServerEngineAttributesRequest.getAttributeName(), ATTRIBUTENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateServerEngineAttributesRequest.getAttributeValue(), ATTRIBUTEVALUE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected List<Principal> createRolePrincipals(UnixUser username) {
ArrayList<Principal> principals = new ArrayList<Principal>();
if (null != supplementalRoles) {
for (String supplementalRole : supplementalRoles) {
Principal rolePrincipal = createRolePrincipal(supplementalRole);
if (null != rolePrincipal) {
principals.add(rolePrincipal);
}
}
}
if (useUnixGroups) {
for (String s : username.getGroups()) {
Principal rolePrincipal = createRolePrincipal(s);
if (null != rolePrincipal) {
principals.add(rolePrincipal);
}
}
}
return principals;
} } | public class class_name {
protected List<Principal> createRolePrincipals(UnixUser username) {
ArrayList<Principal> principals = new ArrayList<Principal>();
if (null != supplementalRoles) {
for (String supplementalRole : supplementalRoles) {
Principal rolePrincipal = createRolePrincipal(supplementalRole);
if (null != rolePrincipal) {
principals.add(rolePrincipal); // depends on control dependency: [if], data = [rolePrincipal)]
}
}
}
if (useUnixGroups) {
for (String s : username.getGroups()) {
Principal rolePrincipal = createRolePrincipal(s);
if (null != rolePrincipal) {
principals.add(rolePrincipal); // depends on control dependency: [if], data = [rolePrincipal)]
}
}
}
return principals;
} } |
public class class_name {
public Set<Explanation<OWLAxiom>> getExplanations(OWLAxiom entailment, int limit) throws ExplanationException {
final Set<OWLEntity> signature = new HashSet<OWLEntity>();
for(OWLAxiom ax : inputAxioms) {
signature.addAll(ax.getSignature());
}
final OWLDataFactory dataFactory = new OWLDataFactoryImpl();
AxiomTransformation transformation = new DeltaPlusTransformation(dataFactory);
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
SyntacticLocalityModuleExtractor extractor = new SyntacticLocalityModuleExtractor(man, (OWLOntology) null, inputAxioms, ModuleType.STAR);
Set<OWLAxiom> moduleAxioms = extractor.extract(entailment.getSignature());
//
// ExplanationGenerator<OWLAxiom> regGen = delegateFactory.createExplanationGenerator(inputAxioms, new NullExplanationProgressMonitor<OWLAxiom>());
// Set<Explanation<OWLAxiom>> regexpls = regGen.getExplanations(entailment);
// System.out.println(".........................................................");
Set<OWLAxiom> flattenedAxioms = transformation.transform(moduleAxioms);
ExplanationGenerator<OWLAxiom> gen = delegateFactory.createExplanationGenerator(flattenedAxioms);
Set<Explanation<OWLAxiom>> expls = gen.getExplanations(entailment);
// System.out.println("Found " + expls.size() + " regular expls");
// for(Explanation<OWLAxiom> expl : expls) {
// System.out.println(expl);
// }
// if(expls.isEmpty()) {
// {
// System.out.println("Not found any delta plus justifications!");
// for(OWLAxiom ax : flattenedAxioms) {
// System.out.println(ax);
// }
// System.out.println("........................................................");
// DeltaTransformationUnfolder unfolder = new DeltaTransformationUnfolder(dataFactory);
// Set<OWLAxiom> unfoldedAxioms = unfolder.getUnfolded(flattenedAxioms, signature);
// for(OWLAxiom ax : unfoldedAxioms) {
// System.out.println(ax);
// }
// }
IsLaconicChecker checker = new IsLaconicChecker(dataFactory, entailmentCheckerFactory, LaconicCheckerMode.EARLY_TERMINATING);
Set<Explanation<OWLAxiom>> laconicExplanations = new HashSet<Explanation<OWLAxiom>>();
Set<Explanation<OWLAxiom>> nonLaconicExplanations = new HashSet<Explanation<OWLAxiom>>();
for(Explanation<OWLAxiom> expl : expls) {
DeltaTransformationUnfolder unfolder = new DeltaTransformationUnfolder(dataFactory);
Set<OWLAxiom> unfoldedAxioms = unfolder.getUnfolded(expl.getAxioms(), signature);
Explanation<OWLAxiom> unfoldedExpl = new Explanation<OWLAxiom>(entailment, unfoldedAxioms);
if(checker.isLaconic(unfoldedExpl)) {
boolean added = laconicExplanations.add(unfoldedExpl);
if (added) {
progressMonitor.foundExplanation(this, unfoldedExpl, new HashSet<Explanation<OWLAxiom>>(laconicExplanations));
}
}
else {
nonLaconicExplanations.add(unfoldedExpl);
}
}
if(laconicExplanations.isEmpty()) {
System.out.println("NOT-FOUND-ANY!");
for(Explanation<OWLAxiom> nonLaconic : nonLaconicExplanations) {
System.out.println("NON-LACONIC:");
System.out.println(nonLaconic);
}
}
return laconicExplanations;
} } | public class class_name {
public Set<Explanation<OWLAxiom>> getExplanations(OWLAxiom entailment, int limit) throws ExplanationException {
final Set<OWLEntity> signature = new HashSet<OWLEntity>();
for(OWLAxiom ax : inputAxioms) {
signature.addAll(ax.getSignature());
}
final OWLDataFactory dataFactory = new OWLDataFactoryImpl();
AxiomTransformation transformation = new DeltaPlusTransformation(dataFactory);
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
SyntacticLocalityModuleExtractor extractor = new SyntacticLocalityModuleExtractor(man, (OWLOntology) null, inputAxioms, ModuleType.STAR);
Set<OWLAxiom> moduleAxioms = extractor.extract(entailment.getSignature());
//
// ExplanationGenerator<OWLAxiom> regGen = delegateFactory.createExplanationGenerator(inputAxioms, new NullExplanationProgressMonitor<OWLAxiom>());
// Set<Explanation<OWLAxiom>> regexpls = regGen.getExplanations(entailment);
// System.out.println(".........................................................");
Set<OWLAxiom> flattenedAxioms = transformation.transform(moduleAxioms);
ExplanationGenerator<OWLAxiom> gen = delegateFactory.createExplanationGenerator(flattenedAxioms);
Set<Explanation<OWLAxiom>> expls = gen.getExplanations(entailment);
// System.out.println("Found " + expls.size() + " regular expls");
// for(Explanation<OWLAxiom> expl : expls) {
// System.out.println(expl);
// }
// if(expls.isEmpty()) {
// {
// System.out.println("Not found any delta plus justifications!");
// for(OWLAxiom ax : flattenedAxioms) {
// System.out.println(ax);
// }
// System.out.println("........................................................");
// DeltaTransformationUnfolder unfolder = new DeltaTransformationUnfolder(dataFactory);
// Set<OWLAxiom> unfoldedAxioms = unfolder.getUnfolded(flattenedAxioms, signature);
// for(OWLAxiom ax : unfoldedAxioms) {
// System.out.println(ax);
// }
// }
IsLaconicChecker checker = new IsLaconicChecker(dataFactory, entailmentCheckerFactory, LaconicCheckerMode.EARLY_TERMINATING);
Set<Explanation<OWLAxiom>> laconicExplanations = new HashSet<Explanation<OWLAxiom>>();
Set<Explanation<OWLAxiom>> nonLaconicExplanations = new HashSet<Explanation<OWLAxiom>>();
for(Explanation<OWLAxiom> expl : expls) {
DeltaTransformationUnfolder unfolder = new DeltaTransformationUnfolder(dataFactory);
Set<OWLAxiom> unfoldedAxioms = unfolder.getUnfolded(expl.getAxioms(), signature);
Explanation<OWLAxiom> unfoldedExpl = new Explanation<OWLAxiom>(entailment, unfoldedAxioms);
if(checker.isLaconic(unfoldedExpl)) {
boolean added = laconicExplanations.add(unfoldedExpl);
if (added) {
progressMonitor.foundExplanation(this, unfoldedExpl, new HashSet<Explanation<OWLAxiom>>(laconicExplanations)); // depends on control dependency: [if], data = [none]
}
}
else {
nonLaconicExplanations.add(unfoldedExpl); // depends on control dependency: [if], data = [none]
}
}
if(laconicExplanations.isEmpty()) {
System.out.println("NOT-FOUND-ANY!");
for(Explanation<OWLAxiom> nonLaconic : nonLaconicExplanations) {
System.out.println("NON-LACONIC:");
System.out.println(nonLaconic);
}
}
return laconicExplanations;
} } |
public class class_name {
@Override
public EClass getIfcMappedItem() {
if (ifcMappedItemEClass == null) {
ifcMappedItemEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(355);
}
return ifcMappedItemEClass;
} } | public class class_name {
@Override
public EClass getIfcMappedItem() {
if (ifcMappedItemEClass == null) {
ifcMappedItemEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(355);
// depends on control dependency: [if], data = [none]
}
return ifcMappedItemEClass;
} } |
public class class_name {
private void freeCompactedSegments() {
SegmentManager segManager = _dataArray.getSegmentManager();
if(segManager == null) return;
while(!_freeQueue.isEmpty()) {
Segment seg = _freeQueue.remove();
try {
segManager.freeSegment(seg);
} catch(Exception e) {
_log.error("failed to free Segment " + seg.getSegmentId() + ": " + seg.getStatus(), e);
}
}
} } | public class class_name {
private void freeCompactedSegments() {
SegmentManager segManager = _dataArray.getSegmentManager();
if(segManager == null) return;
while(!_freeQueue.isEmpty()) {
Segment seg = _freeQueue.remove();
try {
segManager.freeSegment(seg); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
_log.error("failed to free Segment " + seg.getSegmentId() + ": " + seg.getStatus(), e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public SwaptionDataLattice append(SwaptionDataLattice other, AnalyticModel model) {
SwaptionDataLattice combined = new SwaptionDataLattice(referenceDate, quotingConvention, displacement,
forwardCurveName, discountCurveName, floatMetaSchedule, fixMetaSchedule);
combined.entryMap.putAll(entryMap);
if(quotingConvention == other.quotingConvention && displacement == other.displacement) {
combined.entryMap.putAll(other.entryMap);
} else {
SwaptionDataLattice converted = other.convertLattice(quotingConvention, displacement, model);
combined.entryMap.putAll(converted.entryMap);
}
return combined;
} } | public class class_name {
public SwaptionDataLattice append(SwaptionDataLattice other, AnalyticModel model) {
SwaptionDataLattice combined = new SwaptionDataLattice(referenceDate, quotingConvention, displacement,
forwardCurveName, discountCurveName, floatMetaSchedule, fixMetaSchedule);
combined.entryMap.putAll(entryMap);
if(quotingConvention == other.quotingConvention && displacement == other.displacement) {
combined.entryMap.putAll(other.entryMap);
// depends on control dependency: [if], data = [none]
} else {
SwaptionDataLattice converted = other.convertLattice(quotingConvention, displacement, model);
combined.entryMap.putAll(converted.entryMap);
// depends on control dependency: [if], data = [none]
}
return combined;
} } |
public class class_name {
public final void cleanup() throws ResourceException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "cleanup");
// Save the first exception to occur, continue processing, and throw it later.
// This allows us to ensure all handles are dissociated and transactions are
// rolled back, even if something fails early on in the cleanup processing.
ResourceException firstX = null;
if (inRequest && !isAborted())
try {
inRequest = false;
mcf.jdbcRuntime.endRequest(sqlConn);
} catch (SQLException x) {
if (!isAborted()) {
FFDCFilter.processException(x, getClass().getName(), "2682", this);
firstX = new DataStoreAdapterException("DSA_ERROR", x, getClass());
}
Tr.debug(tc, "Error during end request in cleanup.", x);
}
// According to the JCA 1.5 spec, all remaining handles must be invalidated on
// cleanup. This is achieved by closing the handles. Dissociating the handles would
// not be adequate because dissociated handles may be used again.
// Skip the closeHandles processing if there are no handles.
ResourceException handleX = numHandlesInUse < 1 ? null : closeHandles();
if (handleX != null && firstX == null)
firstX = handleX;
try {
cleanupTransactions(true);
} catch (ResourceException resX) {
// No FFDC code needed; already done in cleanupTransactions method.
if (firstX == null)
firstX = resX;
}
// Reset the thread id we are tracking for multithreaded access detection. When the
// ManagedConnection is handed out of the pool, it may be given to a different thread.
threadID = null;
// At this point, all of the most important stuff has been cleaned up. Handles are
// dissociated and transactions are rolled back. Now we may throw any exceptions
// which previously occurred.
if (firstX != null) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "cleanup", firstX);
throw firstX;
}
// Cleanup ManagedConnection and Connection states in a separate method.
cleanupStates();
// Throw an exception if finalize is invoked and this ManagedConnection was never
// destroyed.
if (fatalErrorCount == -1)
{
ResourceException x = new DataStoreAdapterException("CONN_NEVER_CLOSED", null, getClass());
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "cleanup", "Exception");
throw x;
}
inCleanup = false;
// Reset to null so that it gets refreshed on next use.
transactional = null;
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "cleanup");
} } | public class class_name {
public final void cleanup() throws ResourceException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "cleanup");
// Save the first exception to occur, continue processing, and throw it later.
// This allows us to ensure all handles are dissociated and transactions are
// rolled back, even if something fails early on in the cleanup processing.
ResourceException firstX = null;
if (inRequest && !isAborted())
try {
inRequest = false;
mcf.jdbcRuntime.endRequest(sqlConn);
} catch (SQLException x) {
if (!isAborted()) {
FFDCFilter.processException(x, getClass().getName(), "2682", this); // depends on control dependency: [if], data = [none]
firstX = new DataStoreAdapterException("DSA_ERROR", x, getClass()); // depends on control dependency: [if], data = [none]
}
Tr.debug(tc, "Error during end request in cleanup.", x);
}
// According to the JCA 1.5 spec, all remaining handles must be invalidated on
// cleanup. This is achieved by closing the handles. Dissociating the handles would
// not be adequate because dissociated handles may be used again.
// Skip the closeHandles processing if there are no handles.
ResourceException handleX = numHandlesInUse < 1 ? null : closeHandles();
if (handleX != null && firstX == null)
firstX = handleX;
try {
cleanupTransactions(true);
} catch (ResourceException resX) {
// No FFDC code needed; already done in cleanupTransactions method.
if (firstX == null)
firstX = resX;
}
// Reset the thread id we are tracking for multithreaded access detection. When the
// ManagedConnection is handed out of the pool, it may be given to a different thread.
threadID = null;
// At this point, all of the most important stuff has been cleaned up. Handles are
// dissociated and transactions are rolled back. Now we may throw any exceptions
// which previously occurred.
if (firstX != null) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "cleanup", firstX);
throw firstX;
}
// Cleanup ManagedConnection and Connection states in a separate method.
cleanupStates();
// Throw an exception if finalize is invoked and this ManagedConnection was never
// destroyed.
if (fatalErrorCount == -1)
{
ResourceException x = new DataStoreAdapterException("CONN_NEVER_CLOSED", null, getClass());
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "cleanup", "Exception");
throw x;
}
inCleanup = false;
// Reset to null so that it gets refreshed on next use.
transactional = null;
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "cleanup");
} } |
public class class_name {
public void init(String chainId, ChannelFramework cfw) {
tcpName = "TCP-" + chainId;
sslName = "SSL-" + chainId;
httpName = "HTTP-" + chainId;
chainName = chainId;
this.cfw = cfw;
// If there is a chain that is in the CFW with this name, it was potentially
// left over from a previous instance of the endpoint. There is no way to get
// the state of the existing (old) CFW chain to set our chainState accordingly...
// (in addition to the old chain pointing to old services and things.. )
// *IF* there is an old chain, stop, destroy, and remove it.
try {
ChainData cd = cfw.getChain(chainName);
if (cd != null) {
cfw.removeChain(cd);
}
} catch (ChainException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Error stopping chain " + chainName, this, e);
}
}
} } | public class class_name {
public void init(String chainId, ChannelFramework cfw) {
tcpName = "TCP-" + chainId;
sslName = "SSL-" + chainId;
httpName = "HTTP-" + chainId;
chainName = chainId;
this.cfw = cfw;
// If there is a chain that is in the CFW with this name, it was potentially
// left over from a previous instance of the endpoint. There is no way to get
// the state of the existing (old) CFW chain to set our chainState accordingly...
// (in addition to the old chain pointing to old services and things.. )
// *IF* there is an old chain, stop, destroy, and remove it.
try {
ChainData cd = cfw.getChain(chainName);
if (cd != null) {
cfw.removeChain(cd); // depends on control dependency: [if], data = [(cd]
}
} catch (ChainException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Error stopping chain " + chainName, this, e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private <T> void registerProcessor(T processor, String model,
boolean onlyCurrentRevisions,
Map<ListenerRegistration, List<T>> processors) {
this.preferCurrent = this.preferCurrent && onlyCurrentRevisions;
ListenerRegistration listenerRegistration = new ListenerRegistration(
model, onlyCurrentRevisions);
if (!processors.containsKey(listenerRegistration)) {
processors.put(listenerRegistration, new ArrayList<>());
}
processors.get(listenerRegistration).add(processor);
} } | public class class_name {
private <T> void registerProcessor(T processor, String model,
boolean onlyCurrentRevisions,
Map<ListenerRegistration, List<T>> processors) {
this.preferCurrent = this.preferCurrent && onlyCurrentRevisions;
ListenerRegistration listenerRegistration = new ListenerRegistration(
model, onlyCurrentRevisions);
if (!processors.containsKey(listenerRegistration)) {
processors.put(listenerRegistration, new ArrayList<>()); // depends on control dependency: [if], data = [none]
}
processors.get(listenerRegistration).add(processor);
} } |
public class class_name {
protected List<String> translateSarlFormalParametersForSyntheticOperation(JvmExecutable owner, JvmGenericType actionContainer,
boolean varargs, List<InferredStandardParameter> signature) {
final List<String> arguments = CollectionLiterals.newArrayList();
for (final InferredStandardParameter parameterSpec : signature) {
final JvmTypeReference paramType = parameterSpec.getType();
if (parameterSpec instanceof InferredValuedParameter) {
final StringBuilder argumentValue = new StringBuilder();
if (paramType.getType() instanceof JvmTypeParameter) {
argumentValue.append("("); //$NON-NLS-1$
argumentValue.append(paramType.getSimpleName());
argumentValue.append(") "); //$NON-NLS-1$
}
argumentValue.append(this.sarlSignatureProvider.toJavaArgument(
actionContainer.getIdentifier(),
((InferredValuedParameter) parameterSpec).getCallingArgument()));
arguments.add(argumentValue.toString());
} else {
final EObject param = parameterSpec.getParameter();
final String paramName = parameterSpec.getName();
if (!Strings.isNullOrEmpty(paramName) && paramType != null) {
final JvmFormalParameter lastParam = this.typesFactory.createJvmFormalParameter();
owner.getParameters().add(lastParam);
lastParam.setName(paramName);
if (owner instanceof JvmOperation) {
lastParam.setParameterType(cloneWithTypeParametersAndProxies(paramType, owner));
} else {
lastParam.setParameterType(this.typeBuilder.cloneWithProxies(paramType));
}
this.associator.associate(param, lastParam);
arguments.add(paramName);
}
}
}
return arguments;
} } | public class class_name {
protected List<String> translateSarlFormalParametersForSyntheticOperation(JvmExecutable owner, JvmGenericType actionContainer,
boolean varargs, List<InferredStandardParameter> signature) {
final List<String> arguments = CollectionLiterals.newArrayList();
for (final InferredStandardParameter parameterSpec : signature) {
final JvmTypeReference paramType = parameterSpec.getType();
if (parameterSpec instanceof InferredValuedParameter) {
final StringBuilder argumentValue = new StringBuilder();
if (paramType.getType() instanceof JvmTypeParameter) {
argumentValue.append("("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
argumentValue.append(paramType.getSimpleName()); // depends on control dependency: [if], data = [none]
argumentValue.append(") "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
argumentValue.append(this.sarlSignatureProvider.toJavaArgument(
actionContainer.getIdentifier(),
((InferredValuedParameter) parameterSpec).getCallingArgument())); // depends on control dependency: [if], data = [none]
arguments.add(argumentValue.toString()); // depends on control dependency: [if], data = [none]
} else {
final EObject param = parameterSpec.getParameter();
final String paramName = parameterSpec.getName();
if (!Strings.isNullOrEmpty(paramName) && paramType != null) {
final JvmFormalParameter lastParam = this.typesFactory.createJvmFormalParameter();
owner.getParameters().add(lastParam); // depends on control dependency: [if], data = [none]
lastParam.setName(paramName); // depends on control dependency: [if], data = [none]
if (owner instanceof JvmOperation) {
lastParam.setParameterType(cloneWithTypeParametersAndProxies(paramType, owner)); // depends on control dependency: [if], data = [none]
} else {
lastParam.setParameterType(this.typeBuilder.cloneWithProxies(paramType)); // depends on control dependency: [if], data = [none]
}
this.associator.associate(param, lastParam); // depends on control dependency: [if], data = [none]
arguments.add(paramName); // depends on control dependency: [if], data = [none]
}
}
}
return arguments;
} } |
public class class_name {
public void incrementRemoved() {
if (removed == false && rctxt != null) {
rctxt.removeWrapper(jspUri);
}
removed = true;
} } | public class class_name {
public void incrementRemoved() {
if (removed == false && rctxt != null) {
rctxt.removeWrapper(jspUri);
// depends on control dependency: [if], data = [none]
}
removed = true;
} } |
public class class_name {
public RecordedQuery fromJSON(String json) {
RecordedQuery ret = new RecordedQuery(false);
StringReader sr = new StringReader(json);
JsonReader reader = Json.createReader(sr);
JsonObject jsonResult = reader.readObject();
ret.setGeneric(jsonResult.getBoolean(GENERIC));
JsonArray augmentations = jsonResult.getJsonArray(AUGMENTATIONS);
if (augmentations != null) {
Map<String, String> augs = new HashMap<String, String>();
Iterator<JsonValue> ait = augmentations.iterator();
while(ait.hasNext()) {
JsonObject a = (JsonObject) ait.next();
augs.put(a.getString(KEY), a.getString(VALUE));
}
ret.setAugmentations(augs);
}
JsonArray statements = jsonResult.getJsonArray(STATEMENTS);
Iterator<JsonValue> it = statements.iterator();
while(it.hasNext()) {
JsonValue s = it.next();
readStatement(s, ret.getStatements(), ret);
}
return ret;
} } | public class class_name {
public RecordedQuery fromJSON(String json) {
RecordedQuery ret = new RecordedQuery(false);
StringReader sr = new StringReader(json);
JsonReader reader = Json.createReader(sr);
JsonObject jsonResult = reader.readObject();
ret.setGeneric(jsonResult.getBoolean(GENERIC));
JsonArray augmentations = jsonResult.getJsonArray(AUGMENTATIONS);
if (augmentations != null) {
Map<String, String> augs = new HashMap<String, String>();
Iterator<JsonValue> ait = augmentations.iterator();
while(ait.hasNext()) {
JsonObject a = (JsonObject) ait.next();
augs.put(a.getString(KEY), a.getString(VALUE)); // depends on control dependency: [while], data = [none]
}
ret.setAugmentations(augs); // depends on control dependency: [if], data = [none]
}
JsonArray statements = jsonResult.getJsonArray(STATEMENTS);
Iterator<JsonValue> it = statements.iterator();
while(it.hasNext()) {
JsonValue s = it.next();
readStatement(s, ret.getStatements(), ret); // depends on control dependency: [while], data = [none]
}
return ret;
} } |
public class class_name {
public Collection<String> getAvailablePriorities() {
// FIXME: l10n
ArrayList<String> priorities = new ArrayList<String>();
if (StringUtils.isNotEmpty(high)) {
priorities.add(StringUtils.capitalize(StringUtils.lowerCase(Priority.HIGH.name())));
}
if (StringUtils.isNotEmpty(normal)) {
priorities.add(StringUtils.capitalize(StringUtils.lowerCase(Priority.NORMAL.name())));
}
if (StringUtils.isNotEmpty(low)) {
priorities.add(StringUtils.capitalize(StringUtils.lowerCase(Priority.LOW.name())));
}
return priorities;
} } | public class class_name {
public Collection<String> getAvailablePriorities() {
// FIXME: l10n
ArrayList<String> priorities = new ArrayList<String>();
if (StringUtils.isNotEmpty(high)) {
priorities.add(StringUtils.capitalize(StringUtils.lowerCase(Priority.HIGH.name()))); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotEmpty(normal)) {
priorities.add(StringUtils.capitalize(StringUtils.lowerCase(Priority.NORMAL.name()))); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotEmpty(low)) {
priorities.add(StringUtils.capitalize(StringUtils.lowerCase(Priority.LOW.name()))); // depends on control dependency: [if], data = [none]
}
return priorities;
} } |
public class class_name {
protected List<MethodHelpDto> describeMethods() {
List<MethodHelpDto> result = new LinkedList<>();
Path endpointPath = getClass().getAnnotation(Path.class);
for (Method method : getClass().getDeclaredMethods()) {
String parentPath = endpointPath == null ? null : endpointPath.value();
MethodHelpDto methodHelpDto = MethodHelpDto.fromMethodClass(parentPath, method);
if (methodHelpDto != null) {
result.add(methodHelpDto);
}
}
Collections.sort(result);
return result;
} } | public class class_name {
protected List<MethodHelpDto> describeMethods() {
List<MethodHelpDto> result = new LinkedList<>();
Path endpointPath = getClass().getAnnotation(Path.class);
for (Method method : getClass().getDeclaredMethods()) {
String parentPath = endpointPath == null ? null : endpointPath.value();
MethodHelpDto methodHelpDto = MethodHelpDto.fromMethodClass(parentPath, method);
if (methodHelpDto != null) {
result.add(methodHelpDto); // depends on control dependency: [if], data = [(methodHelpDto]
}
}
Collections.sort(result);
return result;
} } |
public class class_name {
@Override
public boolean validate(IAcceptor<? super AbstractDiagnostic> result) {
XAbstractFeatureCall featureCall = getFeatureCall();
if (isReassignFirstArgument(featureCall)) {
XBinaryOperation binaryOperation = (XBinaryOperation) featureCall;
LightweightTypeReference actualType = getDeclaredType(featureCall.getFeature());
LightweightTypeReference expectedType = getActualType(binaryOperation.getLeftOperand());
if (!expectedType.getIdentifier().equals(actualType.getIdentifier())) {
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR, IssueCodes.INCOMPATIBLE_TYPES, String.format(
"Type mismatch: cannot convert from %s to %s", actualType.getHumanReadableName(), expectedType.getHumanReadableName()),
getExpression(), XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
}
if (isInvalidStaticSyntax()) {
Severity severity = getSeverity(IssueCodes.INSTANCE_ACCESS_TO_STATIC_MEMBER);
if (severity != Severity.IGNORE) {
String message = String.format("The static %1$s %2$s%3$s should be accessed in a static way",
getFeatureTypeName(),
getFeature().getSimpleName(),
getFeatureParameterTypesAsString());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(severity,
IssueCodes.INSTANCE_ACCESS_TO_STATIC_MEMBER, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
} else {
return true;
}
} else if (!isStatic() && isStaticAccessSyntax()) {
EObject featureOwner = getFeature().eContainer();
String message = String.format("Cannot make a static reference to the non-static %1$s %2$s%3$s",
getFeatureTypeName(),
getFeature().getSimpleName(),
getFeatureParameterTypesAsString());
if(featureOwner instanceof JvmDeclaredType)
message += " from the type " + ((JvmDeclaredType) featureOwner).getSimpleName();
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.STATIC_ACCESS_TO_INSTANCE_MEMBER, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
} else if (super.validate(result)) {
if (isOperationCallSyntax() && !(getFeature() instanceof JvmExecutable)) {
String typeName = getFeatureTypeName();
String code = IssueCodes.FIELD_ACCESS_WITH_PARENTHESES;
if (!(getFeature() instanceof JvmField)) {
code = IssueCodes.LOCAL_VAR_ACCESS_WITH_PARENTHESES;
}
String message = "Cannot access the " + typeName + " " + getFeature().getSimpleName() + " with parentheses";
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR, code, message,
getExpression(), XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
JvmIdentifiableElement feature = getFeature();
if (feature instanceof JvmType) {
QualifiedName featureName = description.getName();
if (!getState().isInstanceContext()) {
if (!(SELF.equals(featureName))) {
String message = String.format("Cannot use %s in a static context", featureName);
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.STATIC_ACCESS_TO_INSTANCE_MEMBER, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
} else if (getExpression() instanceof XMemberFeatureCall && !(SELF.equals(featureName))) {
XMemberFeatureCall memberFeatureCall = (XMemberFeatureCall) getExpression();
XAbstractFeatureCall target = (XAbstractFeatureCall) memberFeatureCall.getMemberCallTarget();
final JvmType referencedType = (JvmType) target.getFeature();
List<JvmDeclaredType> enclosingTypes = getState().getFeatureScopeSession().getEnclosingTypes();
if (SUPER.equals(featureName) && referencedType instanceof JvmGenericType
&& ((JvmGenericType) referencedType).isInterface() && !enclosingTypes.isEmpty()) {
if (!Iterables.any(enclosingTypes.get(0).getSuperTypes(), new Predicate<JvmTypeReference>() {
@Override
public boolean apply(JvmTypeReference input) {
return input.getType() == referencedType;
}
})) {
String message = String.format("The enclosing type does not extend or implement the interface %s", referencedType.getSimpleName());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.NO_ENCLOSING_INSTANCE_AVAILABLE, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
} else if (!enclosingTypes.contains(referencedType)) {
String message = String.format("No enclosing instance of the type %s is accessible in scope", referencedType.getSimpleName());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.NO_ENCLOSING_INSTANCE_AVAILABLE, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
} else if (getExpression() instanceof XFeatureCall && SUPER.equals(featureName)) {
List<JvmDeclaredType> enclosingTypes = getState().getFeatureScopeSession().getEnclosingTypes();
JvmDeclaredType declaringType = null;
if (!enclosingTypes.isEmpty())
declaringType = enclosingTypes.get(0);
if (declaringType instanceof JvmGenericType && ((JvmGenericType) declaringType).isInterface()) {
if (!getState().isIgnored(IssueCodes.UNQUALIFIED_SUPER_CALL)) {
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(getSeverity(IssueCodes.UNQUALIFIED_SUPER_CALL),
IssueCodes.UNQUALIFIED_SUPER_CALL,
"Unqualified super reference is not allowed in interface context", getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
} else if (declaringType != null && declaringType != feature && declaringType.isLocal()) {
XClosure closure = EcoreUtil2.getContainerOfType(featureCall, XClosure.class);
if (closure != null) {
EObject typeSource = getState().getReferenceOwner().getServices().getJvmModelAssociations().getPrimarySourceElement(declaringType);
if (typeSource != null && EcoreUtil.isAncestor(typeSource, closure)) {
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.INVALID_SUPER_CALL,
"Cannot call super of an anonymous class from a lambda expression", getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
}
}
}
}
if (feature instanceof XVariableDeclaration) {
XVariableDeclaration casted = (XVariableDeclaration) feature;
if (casted.isWriteable()) {
String message = getState().getResolver().getInvalidWritableVariableAccessMessage(casted, getFeatureCall(), getState().getResolvedTypes());
if (message != null) {
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.INVALID_MUTABLE_VARIABLE_ACCESS, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
}
if (EcoreUtil.isAncestor(casted, getFeatureCall())) {
String message = String.format("The local variable %s may not have been initialized", feature.getSimpleName());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.ILLEGAL_FORWARD_REFERENCE, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
}
if (feature instanceof JvmOperation) {
JvmOperation operation = (JvmOperation) feature;
if (operation.isAbstract() && featureCall instanceof XMemberFeatureCall) {
Severity severity = getSeverity(IssueCodes.ABSTRACT_METHOD_INVOCATION);
if (severity != Severity.IGNORE) {
XMemberFeatureCall memberFeatureCall = (XMemberFeatureCall) featureCall;
XExpression target = memberFeatureCall.getMemberCallTarget();
if (target instanceof XAbstractFeatureCall
&& SUPER.getFirstSegment().equals(((XAbstractFeatureCall) target).getConcreteSyntaxFeatureName())) {
JvmIdentifiableElement targetFeature = ((XAbstractFeatureCall) target).getFeature();
String message = String.format("Cannot directly invoke the abstract method %s%s of the type %s",
operation.getSimpleName(), getFeatureParameterTypesAsString(operation), targetFeature.getSimpleName());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(severity,
IssueCodes.ABSTRACT_METHOD_INVOCATION, message, memberFeatureCall,
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
}
}
}
if (feature instanceof JvmMember) {
JvmMember member = (JvmMember) feature;
if (member.getVisibility() == JvmVisibility.PRIVATE) {
LightweightTypeReference receiverType = getReceiverType();
if (receiverType != null) {
if (receiverType.getType() != member.getDeclaringType()) {
List<JvmDeclaredType> enclosingTypes = getState().getFeatureScopeSession().getEnclosingTypes();
if (enclosingTypes.contains(member.getDeclaringType())) {
String message = String.format("Cannot access the private %s %s%s in a subclass context",
getFeatureTypeName(), member.getSimpleName(), getFeatureParameterTypesAsString());
String[] issueData = null;
// We can fix the issue by adding a type cast to the declaring type of the feature
issueData = new String[] { "subclass-context", member.getDeclaringType().getSimpleName() };
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.FEATURE_NOT_VISIBLE, message, featureCall,
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, issueData);
result.accept(diagnostic);
return false;
}
}
}
}
}
}
if (isGetClassOnTypeLiteral()) {
if ("class".equals(description.getName().getFirstSegment())) {
LightweightTypeReference receiverType = getSyntacticReceiverType();
if (receiverType == null) {
throw new IllegalStateException();
}
receiverType = receiverType.getTypeArguments().get(0);
String message = String.format("The syntax for type literals is typeof(%s) or %s.", receiverType.getHumanReadableName(), receiverType.getHumanReadableName());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(
Severity.ERROR,
IssueCodes.UNEXPECTED_INVOCATION_ON_TYPE_LITERAL,
message,
getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE,
-1,
null);
result.accept(diagnostic);
return false;
}
}
return true;
} } | public class class_name {
@Override
public boolean validate(IAcceptor<? super AbstractDiagnostic> result) {
XAbstractFeatureCall featureCall = getFeatureCall();
if (isReassignFirstArgument(featureCall)) {
XBinaryOperation binaryOperation = (XBinaryOperation) featureCall;
LightweightTypeReference actualType = getDeclaredType(featureCall.getFeature());
LightweightTypeReference expectedType = getActualType(binaryOperation.getLeftOperand());
if (!expectedType.getIdentifier().equals(actualType.getIdentifier())) {
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR, IssueCodes.INCOMPATIBLE_TYPES, String.format(
"Type mismatch: cannot convert from %s to %s", actualType.getHumanReadableName(), expectedType.getHumanReadableName()),
getExpression(), XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
if (isInvalidStaticSyntax()) {
Severity severity = getSeverity(IssueCodes.INSTANCE_ACCESS_TO_STATIC_MEMBER);
if (severity != Severity.IGNORE) {
String message = String.format("The static %1$s %2$s%3$s should be accessed in a static way",
getFeatureTypeName(),
getFeature().getSimpleName(),
getFeatureParameterTypesAsString());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(severity,
IssueCodes.INSTANCE_ACCESS_TO_STATIC_MEMBER, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else {
return true; // depends on control dependency: [if], data = [none]
}
} else if (!isStatic() && isStaticAccessSyntax()) {
EObject featureOwner = getFeature().eContainer();
String message = String.format("Cannot make a static reference to the non-static %1$s %2$s%3$s",
getFeatureTypeName(),
getFeature().getSimpleName(),
getFeatureParameterTypesAsString());
if(featureOwner instanceof JvmDeclaredType)
message += " from the type " + ((JvmDeclaredType) featureOwner).getSimpleName();
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.STATIC_ACCESS_TO_INSTANCE_MEMBER, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else if (super.validate(result)) {
if (isOperationCallSyntax() && !(getFeature() instanceof JvmExecutable)) {
String typeName = getFeatureTypeName();
String code = IssueCodes.FIELD_ACCESS_WITH_PARENTHESES;
if (!(getFeature() instanceof JvmField)) {
code = IssueCodes.LOCAL_VAR_ACCESS_WITH_PARENTHESES; // depends on control dependency: [if], data = [none]
}
String message = "Cannot access the " + typeName + " " + getFeature().getSimpleName() + " with parentheses";
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR, code, message,
getExpression(), XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
JvmIdentifiableElement feature = getFeature();
if (feature instanceof JvmType) {
QualifiedName featureName = description.getName();
if (!getState().isInstanceContext()) {
if (!(SELF.equals(featureName))) {
String message = String.format("Cannot use %s in a static context", featureName);
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.STATIC_ACCESS_TO_INSTANCE_MEMBER, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
} else if (getExpression() instanceof XMemberFeatureCall && !(SELF.equals(featureName))) {
XMemberFeatureCall memberFeatureCall = (XMemberFeatureCall) getExpression();
XAbstractFeatureCall target = (XAbstractFeatureCall) memberFeatureCall.getMemberCallTarget();
final JvmType referencedType = (JvmType) target.getFeature();
List<JvmDeclaredType> enclosingTypes = getState().getFeatureScopeSession().getEnclosingTypes();
if (SUPER.equals(featureName) && referencedType instanceof JvmGenericType
&& ((JvmGenericType) referencedType).isInterface() && !enclosingTypes.isEmpty()) {
if (!Iterables.any(enclosingTypes.get(0).getSuperTypes(), new Predicate<JvmTypeReference>() {
@Override
public boolean apply(JvmTypeReference input) {
return input.getType() == referencedType;
}
})) {
String message = String.format("The enclosing type does not extend or implement the interface %s", referencedType.getSimpleName());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.NO_ENCLOSING_INSTANCE_AVAILABLE, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = []
return false; // depends on control dependency: [if], data = []
}
} else if (!enclosingTypes.contains(referencedType)) {
String message = String.format("No enclosing instance of the type %s is accessible in scope", referencedType.getSimpleName());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.NO_ENCLOSING_INSTANCE_AVAILABLE, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
} else if (getExpression() instanceof XFeatureCall && SUPER.equals(featureName)) {
List<JvmDeclaredType> enclosingTypes = getState().getFeatureScopeSession().getEnclosingTypes();
JvmDeclaredType declaringType = null;
if (!enclosingTypes.isEmpty())
declaringType = enclosingTypes.get(0);
if (declaringType instanceof JvmGenericType && ((JvmGenericType) declaringType).isInterface()) {
if (!getState().isIgnored(IssueCodes.UNQUALIFIED_SUPER_CALL)) {
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(getSeverity(IssueCodes.UNQUALIFIED_SUPER_CALL),
IssueCodes.UNQUALIFIED_SUPER_CALL,
"Unqualified super reference is not allowed in interface context", getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
} else if (declaringType != null && declaringType != feature && declaringType.isLocal()) {
XClosure closure = EcoreUtil2.getContainerOfType(featureCall, XClosure.class);
if (closure != null) {
EObject typeSource = getState().getReferenceOwner().getServices().getJvmModelAssociations().getPrimarySourceElement(declaringType);
if (typeSource != null && EcoreUtil.isAncestor(typeSource, closure)) {
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.INVALID_SUPER_CALL,
"Cannot call super of an anonymous class from a lambda expression", getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
}
}
}
if (feature instanceof XVariableDeclaration) {
XVariableDeclaration casted = (XVariableDeclaration) feature;
if (casted.isWriteable()) {
String message = getState().getResolver().getInvalidWritableVariableAccessMessage(casted, getFeatureCall(), getState().getResolvedTypes());
if (message != null) {
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.INVALID_MUTABLE_VARIABLE_ACCESS, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
if (EcoreUtil.isAncestor(casted, getFeatureCall())) {
String message = String.format("The local variable %s may not have been initialized", feature.getSimpleName());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.ILLEGAL_FORWARD_REFERENCE, message, getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
if (feature instanceof JvmOperation) {
JvmOperation operation = (JvmOperation) feature;
if (operation.isAbstract() && featureCall instanceof XMemberFeatureCall) {
Severity severity = getSeverity(IssueCodes.ABSTRACT_METHOD_INVOCATION);
if (severity != Severity.IGNORE) {
XMemberFeatureCall memberFeatureCall = (XMemberFeatureCall) featureCall;
XExpression target = memberFeatureCall.getMemberCallTarget();
if (target instanceof XAbstractFeatureCall
&& SUPER.getFirstSegment().equals(((XAbstractFeatureCall) target).getConcreteSyntaxFeatureName())) {
JvmIdentifiableElement targetFeature = ((XAbstractFeatureCall) target).getFeature();
String message = String.format("Cannot directly invoke the abstract method %s%s of the type %s",
operation.getSimpleName(), getFeatureParameterTypesAsString(operation), targetFeature.getSimpleName());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(severity,
IssueCodes.ABSTRACT_METHOD_INVOCATION, message, memberFeatureCall,
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
}
}
if (feature instanceof JvmMember) {
JvmMember member = (JvmMember) feature;
if (member.getVisibility() == JvmVisibility.PRIVATE) {
LightweightTypeReference receiverType = getReceiverType();
if (receiverType != null) {
if (receiverType.getType() != member.getDeclaringType()) {
List<JvmDeclaredType> enclosingTypes = getState().getFeatureScopeSession().getEnclosingTypes();
if (enclosingTypes.contains(member.getDeclaringType())) {
String message = String.format("Cannot access the private %s %s%s in a subclass context",
getFeatureTypeName(), member.getSimpleName(), getFeatureParameterTypesAsString());
String[] issueData = null;
// We can fix the issue by adding a type cast to the declaring type of the feature
issueData = new String[] { "subclass-context", member.getDeclaringType().getSimpleName() }; // depends on control dependency: [if], data = [none]
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.FEATURE_NOT_VISIBLE, message, featureCall,
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, issueData);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
if (isGetClassOnTypeLiteral()) {
if ("class".equals(description.getName().getFirstSegment())) {
LightweightTypeReference receiverType = getSyntacticReceiverType();
if (receiverType == null) {
throw new IllegalStateException();
}
receiverType = receiverType.getTypeArguments().get(0); // depends on control dependency: [if], data = [none]
String message = String.format("The syntax for type literals is typeof(%s) or %s.", receiverType.getHumanReadableName(), receiverType.getHumanReadableName());
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(
Severity.ERROR,
IssueCodes.UNEXPECTED_INVOCATION_ON_TYPE_LITERAL,
message,
getExpression(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE,
-1,
null);
result.accept(diagnostic); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
static GVRPickedObject makeHitMesh(long colliderPointer, float distance, float hitx, float hity, float hitz,
int faceIndex, float barycentricx, float barycentricy, float barycentricz,
float texu, float texv, float normalx, float normaly, float normalz)
{
GVRCollider collider = GVRCollider.lookup(colliderPointer);
if (collider == null)
{
Log.d(TAG, "makeHit: cannot find collider for %x", colliderPointer);
return null;
}
return new GVRPicker.GVRPickedObject(collider, new float[] { hitx, hity, hitz }, distance, faceIndex,
new float[] {barycentricx, barycentricy, barycentricz},
new float[]{ texu, texv },
new float[]{normalx, normaly, normalz});
} } | public class class_name {
static GVRPickedObject makeHitMesh(long colliderPointer, float distance, float hitx, float hity, float hitz,
int faceIndex, float barycentricx, float barycentricy, float barycentricz,
float texu, float texv, float normalx, float normaly, float normalz)
{
GVRCollider collider = GVRCollider.lookup(colliderPointer);
if (collider == null)
{
Log.d(TAG, "makeHit: cannot find collider for %x", colliderPointer); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return new GVRPicker.GVRPickedObject(collider, new float[] { hitx, hity, hitz }, distance, faceIndex,
new float[] {barycentricx, barycentricy, barycentricz},
new float[]{ texu, texv },
new float[]{normalx, normaly, normalz});
} } |
public class class_name {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
String target=null;
Log l = LogFactory.getLog(Debug.class);
if (!(l instanceof LogImpl))
return;
LogImpl log = (LogImpl) l;
String action=request.getParameter("Action");
if ("Set Options".equals(action))
{
log.setDebug("on".equals(request.getParameter("D")));
log.setSuppressWarnings("on".equals(request.getParameter("W")));
String v=request.getParameter("V");
if (v!=null && v.length()>0)
log.setVerbose(Integer.parseInt(v));
else
log.setVerbose(0);
log.setDebugPatterns(request.getParameter("P"));
LogSink[] sinks = log.getLogSinks();
for (int s=0;sinks!=null && s<sinks.length;s++)
{
if (sinks[s]==null)
continue;
if ("on".equals(request.getParameter("LSS"+s)))
{
if(!sinks[s].isStarted())
try{sinks[s].start();}catch(Exception e){log.warn(e);}
}
else
{
if(sinks[s].isStarted())
try{sinks[s].stop();}catch(InterruptedException e){}
}
String options=request.getParameter("LO"+s);
if (options==null)
options="";
if (sinks[s] instanceof OutputStreamLogSink)
{
OutputStreamLogSink sink=(OutputStreamLogSink)sinks[s];
sink.setLogTags("on".equals(request.getParameter("LT"+s)));
sink.setLogLabels ("on".equals(request.getParameter("LL"+s)));
sink.setLogStackSize("on".equals(request.getParameter("Ls"+s)));
sink.setLogStackTrace("on".equals(request.getParameter("LS"+s)));
sink.setSuppressStack("on".equals(request.getParameter("SS"+s)));
sink.setLogOneLine("on".equals(request.getParameter("SL"+s)));
sink.setFilename(request.getParameter("LF"+s));
}
}
}
else if ("Add LogSink".equals(action))
{
System.err.println("add log sink "+request.getParameter("LSC"));
try
{
log.add(request.getParameter("LSC"));
}
catch(Exception e)
{
log.warn(e);
}
}
else if ("Delete Stopped Sinks".equals(action))
{
log.deleteStoppedLogSinks();
}
response.sendRedirect(request.getContextPath()+
request.getServletPath()+"/"+
Long.toString(System.currentTimeMillis(),36)+
(target!=null?("#"+target):""));
} } | public class class_name {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
String target=null;
Log l = LogFactory.getLog(Debug.class);
if (!(l instanceof LogImpl))
return;
LogImpl log = (LogImpl) l;
String action=request.getParameter("Action");
if ("Set Options".equals(action))
{
log.setDebug("on".equals(request.getParameter("D")));
log.setSuppressWarnings("on".equals(request.getParameter("W")));
String v=request.getParameter("V");
if (v!=null && v.length()>0)
log.setVerbose(Integer.parseInt(v));
else
log.setVerbose(0);
log.setDebugPatterns(request.getParameter("P"));
LogSink[] sinks = log.getLogSinks();
for (int s=0;sinks!=null && s<sinks.length;s++)
{
if (sinks[s]==null)
continue;
if ("on".equals(request.getParameter("LSS"+s)))
{
if(!sinks[s].isStarted())
try{sinks[s].start();}catch(Exception e){log.warn(e);} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
}
else
{
if(sinks[s].isStarted())
try{sinks[s].stop();}catch(InterruptedException e){} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
}
String options=request.getParameter("LO"+s);
if (options==null)
options="";
if (sinks[s] instanceof OutputStreamLogSink)
{
OutputStreamLogSink sink=(OutputStreamLogSink)sinks[s];
sink.setLogTags("on".equals(request.getParameter("LT"+s))); // depends on control dependency: [if], data = [none]
sink.setLogLabels ("on".equals(request.getParameter("LL"+s))); // depends on control dependency: [if], data = [none]
sink.setLogStackSize("on".equals(request.getParameter("Ls"+s))); // depends on control dependency: [if], data = [none]
sink.setLogStackTrace("on".equals(request.getParameter("LS"+s))); // depends on control dependency: [if], data = [none]
sink.setSuppressStack("on".equals(request.getParameter("SS"+s))); // depends on control dependency: [if], data = [none]
sink.setLogOneLine("on".equals(request.getParameter("SL"+s))); // depends on control dependency: [if], data = [none]
sink.setFilename(request.getParameter("LF"+s)); // depends on control dependency: [if], data = [none]
}
}
}
else if ("Add LogSink".equals(action))
{
System.err.println("add log sink "+request.getParameter("LSC"));
try
{
log.add(request.getParameter("LSC")); // depends on control dependency: [try], data = [none]
}
catch(Exception e)
{
log.warn(e);
} // depends on control dependency: [catch], data = [none]
}
else if ("Delete Stopped Sinks".equals(action))
{
log.deleteStoppedLogSinks();
}
response.sendRedirect(request.getContextPath()+
request.getServletPath()+"/"+
Long.toString(System.currentTimeMillis(),36)+
(target!=null?("#"+target):""));
} } |
public class class_name {
@Deprecated
public List<Map<String, Object>> getQueryArgsList() {
// simulate old implementation behavior
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
for (List<ParameterSetOperation> paramsList : this.parametersList) {
Map<String, Object> map = new HashMap<String, Object>();
for (ParameterSetOperation param : paramsList) {
Object[] args = param.getArgs();
map.put(args[0].toString(), args[1]);
}
result.add(map);
}
return result;
} } | public class class_name {
@Deprecated
public List<Map<String, Object>> getQueryArgsList() {
// simulate old implementation behavior
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
for (List<ParameterSetOperation> paramsList : this.parametersList) {
Map<String, Object> map = new HashMap<String, Object>();
for (ParameterSetOperation param : paramsList) {
Object[] args = param.getArgs();
map.put(args[0].toString(), args[1]); // depends on control dependency: [for], data = [none]
}
result.add(map); // depends on control dependency: [for], data = [none]
}
return result;
} } |
public class class_name {
public void changeSite(String siteRoot, String path, boolean force) {
CmsObject cms = A_CmsUI.getCmsObject();
String currentSiteRoot = cms.getRequestContext().getSiteRoot();
if (force || !currentSiteRoot.equals(siteRoot)) {
CmsAppWorkplaceUi.get().changeSite(siteRoot);
if (path == null) {
path = m_locationCache.getFileExplorerLocation(siteRoot);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(siteRoot)
&& ((path == null) || !path.startsWith("/system"))) {
// switching to the root site and previous root site folder is not below /system
// -> stay in the current folder
path = m_locationCache.getFileExplorerLocation(currentSiteRoot);
if (path != null) {
path = CmsStringUtil.joinPaths(currentSiteRoot, path);
}
}
}
openPath(path, true);
Container container = m_siteSelector.getContainerDataSource();
for (Object id : container.getItemIds()) {
String key = (String)id;
if (CmsStringUtil.comparePaths(key, siteRoot)) {
siteRoot = key;
break;
}
}
m_siteSelector.select(siteRoot);
}
} } | public class class_name {
public void changeSite(String siteRoot, String path, boolean force) {
CmsObject cms = A_CmsUI.getCmsObject();
String currentSiteRoot = cms.getRequestContext().getSiteRoot();
if (force || !currentSiteRoot.equals(siteRoot)) {
CmsAppWorkplaceUi.get().changeSite(siteRoot); // depends on control dependency: [if], data = [none]
if (path == null) {
path = m_locationCache.getFileExplorerLocation(siteRoot); // depends on control dependency: [if], data = [none]
if (CmsStringUtil.isEmptyOrWhitespaceOnly(siteRoot)
&& ((path == null) || !path.startsWith("/system"))) {
// switching to the root site and previous root site folder is not below /system
// -> stay in the current folder
path = m_locationCache.getFileExplorerLocation(currentSiteRoot); // depends on control dependency: [if], data = [none]
if (path != null) {
path = CmsStringUtil.joinPaths(currentSiteRoot, path); // depends on control dependency: [if], data = [none]
}
}
}
openPath(path, true); // depends on control dependency: [if], data = [none]
Container container = m_siteSelector.getContainerDataSource();
for (Object id : container.getItemIds()) {
String key = (String)id;
if (CmsStringUtil.comparePaths(key, siteRoot)) {
siteRoot = key; // depends on control dependency: [if], data = [none]
break;
}
}
m_siteSelector.select(siteRoot); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(PullRequestMergedStateChangedEventMetadata pullRequestMergedStateChangedEventMetadata, ProtocolMarshaller protocolMarshaller) {
if (pullRequestMergedStateChangedEventMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pullRequestMergedStateChangedEventMetadata.getRepositoryName(), REPOSITORYNAME_BINDING);
protocolMarshaller.marshall(pullRequestMergedStateChangedEventMetadata.getDestinationReference(), DESTINATIONREFERENCE_BINDING);
protocolMarshaller.marshall(pullRequestMergedStateChangedEventMetadata.getMergeMetadata(), MERGEMETADATA_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PullRequestMergedStateChangedEventMetadata pullRequestMergedStateChangedEventMetadata, ProtocolMarshaller protocolMarshaller) {
if (pullRequestMergedStateChangedEventMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pullRequestMergedStateChangedEventMetadata.getRepositoryName(), REPOSITORYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pullRequestMergedStateChangedEventMetadata.getDestinationReference(), DESTINATIONREFERENCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pullRequestMergedStateChangedEventMetadata.getMergeMetadata(), MERGEMETADATA_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 boolean contains(ChronoInterval<T> interval) {
// trivial case
if (interval.isEmpty()) {
return false;
}
T low = interval.getStart().getTemporal();
if ((low != null) && interval.getStart().isOpen()) {
low = this.timeLine.stepForward(low);
}
List<ChronoInterval<T>> found = new ArrayList<>();
this.findByEquals(interval, low, found, this.root);
return !found.isEmpty();
} } | public class class_name {
public boolean contains(ChronoInterval<T> interval) {
// trivial case
if (interval.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
T low = interval.getStart().getTemporal();
if ((low != null) && interval.getStart().isOpen()) {
low = this.timeLine.stepForward(low); // depends on control dependency: [if], data = [none]
}
List<ChronoInterval<T>> found = new ArrayList<>();
this.findByEquals(interval, low, found, this.root);
return !found.isEmpty();
} } |
public class class_name {
public void changeParameters()
{
//Get the session object
String string = null;
String strPreferences = this.getProperty(DBParams.PREFERENCES); // Changing parameters
boolean bSetDefault = true;
if ((strPreferences == null) || (strPreferences.length() == 0))
bSetDefault = false; // Set using a URL (vs set using a form)
Application application = (BaseApplication)this.getTask().getApplication();
string = this.getProperty(DBParams.FRAMES);
if (bSetDefault)
if (string == null)
string = DBConstants.NO;
if (string != null)
application.setProperty(DBParams.FRAMES, string);
string = this.getProperty(DBParams.MENUBARS);
if (bSetDefault)
if (string == null)
string = UserInfoModel.YES;
if (string != null)
application.setProperty(DBParams.MENUBARS, string);
string = this.getProperty(DBParams.NAVMENUS);
if (bSetDefault)
if (string == null)
string = UserInfoModel.NO_ICONS;
if (string != null)
application.setProperty(DBParams.NAVMENUS, string);
string = this.getProperty(DBParams.JAVA);
if (bSetDefault)
if (string == null)
string = UserInfoModel.DEFAULT; // Changing parameters
if (string != null)
application.setProperty(DBParams.JAVA, string);
string = this.getProperty(DBParams.BANNERS);
if (bSetDefault)
if (string == null)
string = DBConstants.NO;
if (string != null)
application.setProperty(DBParams.BANNERS, string);
string = this.getProperty(DBParams.LOGOS);
if (bSetDefault)
if (string == null)
string = UserInfoModel.HOME_PAGE_ONLY;
if (string != null)
application.setProperty(DBParams.LOGOS, string);
string = this.getProperty(DBParams.TRAILERS);
if (bSetDefault)
if (string == null)
string = UserInfoModel.HOME_PAGE_ONLY;
if (string != null)
application.setProperty(DBParams.TRAILERS, string);
string = this.getProperty(DBConstants.SYSTEM_NAME);
if (string != null)
application.setProperty(DBConstants.SYSTEM_NAME, string);
string = this.getProperty(DBConstants.MODE);
if (string != null)
application.setProperty(DBConstants.MODE, string);
string = this.getProperty(DBParams.LANGUAGE);
if (bSetDefault)
if (string == null)
string = UserInfoModel.DEFAULT; /** en (english)*/;
if (string != null)
application.setLanguage(string);
if (application instanceof MainApplication)
{ // Always
((MainApplication)application).readUserInfo(true, true); // Flush the new properties
}
} } | public class class_name {
public void changeParameters()
{
//Get the session object
String string = null;
String strPreferences = this.getProperty(DBParams.PREFERENCES); // Changing parameters
boolean bSetDefault = true;
if ((strPreferences == null) || (strPreferences.length() == 0))
bSetDefault = false; // Set using a URL (vs set using a form)
Application application = (BaseApplication)this.getTask().getApplication();
string = this.getProperty(DBParams.FRAMES);
if (bSetDefault)
if (string == null)
string = DBConstants.NO;
if (string != null)
application.setProperty(DBParams.FRAMES, string);
string = this.getProperty(DBParams.MENUBARS);
if (bSetDefault)
if (string == null)
string = UserInfoModel.YES;
if (string != null)
application.setProperty(DBParams.MENUBARS, string);
string = this.getProperty(DBParams.NAVMENUS);
if (bSetDefault)
if (string == null)
string = UserInfoModel.NO_ICONS;
if (string != null)
application.setProperty(DBParams.NAVMENUS, string);
string = this.getProperty(DBParams.JAVA);
if (bSetDefault)
if (string == null)
string = UserInfoModel.DEFAULT; // Changing parameters
if (string != null)
application.setProperty(DBParams.JAVA, string);
string = this.getProperty(DBParams.BANNERS);
if (bSetDefault)
if (string == null)
string = DBConstants.NO;
if (string != null)
application.setProperty(DBParams.BANNERS, string);
string = this.getProperty(DBParams.LOGOS);
if (bSetDefault)
if (string == null)
string = UserInfoModel.HOME_PAGE_ONLY;
if (string != null)
application.setProperty(DBParams.LOGOS, string);
string = this.getProperty(DBParams.TRAILERS);
if (bSetDefault)
if (string == null)
string = UserInfoModel.HOME_PAGE_ONLY;
if (string != null)
application.setProperty(DBParams.TRAILERS, string);
string = this.getProperty(DBConstants.SYSTEM_NAME);
if (string != null)
application.setProperty(DBConstants.SYSTEM_NAME, string);
string = this.getProperty(DBConstants.MODE);
if (string != null)
application.setProperty(DBConstants.MODE, string);
string = this.getProperty(DBParams.LANGUAGE);
if (bSetDefault)
if (string == null)
string = UserInfoModel.DEFAULT; /** en (english)*/;
if (string != null)
application.setLanguage(string);
if (application instanceof MainApplication)
{ // Always
((MainApplication)application).readUserInfo(true, true); // Flush the new properties // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public X509CertChainValidatorExt build() {
RevocationParametersExt revocationParameters = new RevocationParametersExt(
crlChecks, new CRLParameters(), new OCSPParametes(ocspChecks));
ValidatorParamsExt validationParams = new ValidatorParamsExt(
revocationParameters, ProxySupport.ALLOW);
if (storeUpdateListener != null){
validationParams.setInitialListeners(Arrays.asList(storeUpdateListener));
}
boolean openssl1xMode = false;
if (opensslHashFunction == OpensslHashFunction.SHA1){
openssl1xMode = true;
}
OpensslCertChainValidator validator = new OpensslCertChainValidator(
trustAnchorsDir, openssl1xMode, namespaceChecks, trustAnchorsUpdateInterval,
validationParams, lazyAnchorsLoading);
if (validationErrorListener != null){
validator.addValidationListener(validationErrorListener);
}
return validator;
} } | public class class_name {
public X509CertChainValidatorExt build() {
RevocationParametersExt revocationParameters = new RevocationParametersExt(
crlChecks, new CRLParameters(), new OCSPParametes(ocspChecks));
ValidatorParamsExt validationParams = new ValidatorParamsExt(
revocationParameters, ProxySupport.ALLOW);
if (storeUpdateListener != null){
validationParams.setInitialListeners(Arrays.asList(storeUpdateListener)); // depends on control dependency: [if], data = [(storeUpdateListener]
}
boolean openssl1xMode = false;
if (opensslHashFunction == OpensslHashFunction.SHA1){
openssl1xMode = true; // depends on control dependency: [if], data = [none]
}
OpensslCertChainValidator validator = new OpensslCertChainValidator(
trustAnchorsDir, openssl1xMode, namespaceChecks, trustAnchorsUpdateInterval,
validationParams, lazyAnchorsLoading);
if (validationErrorListener != null){
validator.addValidationListener(validationErrorListener); // depends on control dependency: [if], data = [(validationErrorListener]
}
return validator;
} } |
public class class_name {
public OperaOptions addExtensions(List<File> paths) {
for (File path : paths) {
checkNotNull(path);
checkArgument(path.exists(), "%s does not exist", path.getAbsolutePath());
checkArgument(!path.isDirectory(), "%s is a directory",
path.getAbsolutePath());
}
extensionFiles.addAll(paths);
return this;
} } | public class class_name {
public OperaOptions addExtensions(List<File> paths) {
for (File path : paths) {
checkNotNull(path); // depends on control dependency: [for], data = [path]
checkArgument(path.exists(), "%s does not exist", path.getAbsolutePath()); // depends on control dependency: [for], data = [path]
checkArgument(!path.isDirectory(), "%s is a directory",
path.getAbsolutePath()); // depends on control dependency: [for], data = [path]
}
extensionFiles.addAll(paths);
return this;
} } |
public class class_name {
public AttributeStatement newAttributeStatement(final Map<String, Object> attributes,
final Map<String, String> attributeFriendlyNames,
final Map<String, String> attributeValueTypes,
final Map<String, String> configuredNameFormats,
final String defaultNameFormat,
final Saml20AttributeBuilder builder) {
val attrStatement = newSamlObject(AttributeStatement.class);
for (val e : attributes.entrySet()) {
if (e.getValue() instanceof Collection<?> && ((Collection<?>) e.getValue()).isEmpty()) {
LOGGER.info("Skipping attribute [{}] because it does not have any values.", e.getKey());
continue;
}
val friendlyName = attributeFriendlyNames.getOrDefault(e.getKey(), null);
val attribute = newAttribute(friendlyName, e.getKey(), e.getValue(),
configuredNameFormats, defaultNameFormat, attributeValueTypes);
builder.build(attrStatement, attribute);
}
return attrStatement;
} } | public class class_name {
public AttributeStatement newAttributeStatement(final Map<String, Object> attributes,
final Map<String, String> attributeFriendlyNames,
final Map<String, String> attributeValueTypes,
final Map<String, String> configuredNameFormats,
final String defaultNameFormat,
final Saml20AttributeBuilder builder) {
val attrStatement = newSamlObject(AttributeStatement.class);
for (val e : attributes.entrySet()) {
if (e.getValue() instanceof Collection<?> && ((Collection<?>) e.getValue()).isEmpty()) {
LOGGER.info("Skipping attribute [{}] because it does not have any values.", e.getKey()); // depends on control dependency: [if], data = [none]
continue;
}
val friendlyName = attributeFriendlyNames.getOrDefault(e.getKey(), null);
val attribute = newAttribute(friendlyName, e.getKey(), e.getValue(),
configuredNameFormats, defaultNameFormat, attributeValueTypes);
builder.build(attrStatement, attribute); // depends on control dependency: [for], data = [e]
}
return attrStatement;
} } |
public class class_name {
private double slotsUsedWithWeightToSlotRatio(double w2sRatio, TaskType type) {
double slotsTaken = 0;
for (JobInfo info : infos.values()) {
slotsTaken += computeShare(info, w2sRatio, type);
}
return slotsTaken;
} } | public class class_name {
private double slotsUsedWithWeightToSlotRatio(double w2sRatio, TaskType type) {
double slotsTaken = 0;
for (JobInfo info : infos.values()) {
slotsTaken += computeShare(info, w2sRatio, type); // depends on control dependency: [for], data = [info]
}
return slotsTaken;
} } |
public class class_name {
public static void __gmpz_import(mpz_t rop, int count, int order, int size, int endian, int nails,
Pointer buffer) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_import(rop, count, order, size, endian, nails, buffer);
} else {
SizeT8.__gmpz_import(rop, count, order, size, endian, nails, buffer);
}
} } | public class class_name {
public static void __gmpz_import(mpz_t rop, int count, int order, int size, int endian, int nails,
Pointer buffer) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_import(rop, count, order, size, endian, nails, buffer); // depends on control dependency: [if], data = [none]
} else {
SizeT8.__gmpz_import(rop, count, order, size, endian, nails, buffer); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void sendAsync(SendCallback callback) {
List<ImportService.Submit> reqs;
try {
reqs = prepareDataRequests();
} catch (ApiException e) {
IobeamException ie = new IobeamException(e);
if (callback == null) {
throw ie;
} else {
callback.innerCallback.failed(ie, null);
return;
}
}
for (ImportService.Submit req : reqs) {
if (callback == null && !autoRetry) {
req.executeAsync();
} else if (callback != null && !autoRetry) {
req.executeAsync(callback.innerCallback);
} else {
req.executeAsync(new ReinsertSendCallback(this, callback).innerCallback);
}
}
} } | public class class_name {
public void sendAsync(SendCallback callback) {
List<ImportService.Submit> reqs;
try {
reqs = prepareDataRequests(); // depends on control dependency: [try], data = [none]
} catch (ApiException e) {
IobeamException ie = new IobeamException(e);
if (callback == null) {
throw ie;
} else {
callback.innerCallback.failed(ie, null); // depends on control dependency: [if], data = [null)]
return; // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
for (ImportService.Submit req : reqs) {
if (callback == null && !autoRetry) {
req.executeAsync(); // depends on control dependency: [if], data = [none]
} else if (callback != null && !autoRetry) {
req.executeAsync(callback.innerCallback); // depends on control dependency: [if], data = [(callback]
} else {
req.executeAsync(new ReinsertSendCallback(this, callback).innerCallback); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public ListClustersResult withClusters(String... clusters) {
if (this.clusters == null) {
setClusters(new java.util.ArrayList<String>(clusters.length));
}
for (String ele : clusters) {
this.clusters.add(ele);
}
return this;
} } | public class class_name {
public ListClustersResult withClusters(String... clusters) {
if (this.clusters == null) {
setClusters(new java.util.ArrayList<String>(clusters.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : clusters) {
this.clusters.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected boolean internalEquals(ValueData another)
{
if (another instanceof ByteArrayValueData)
{
return Arrays.equals(((ByteArrayValueData)another).value, value);
}
return false;
} } | public class class_name {
protected boolean internalEquals(ValueData another)
{
if (another instanceof ByteArrayValueData)
{
return Arrays.equals(((ByteArrayValueData)another).value, value); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void highlightElement() {
if (m_highlighting == null) {
m_highlighting = new CmsHighlightingBorder(m_position, CmsHighlightingBorder.BorderColor.red);
RootPanel.get().add(m_highlighting);
} else {
m_highlighting.setPosition(CmsPositionBean.getBoundingClientRect(getElement()));
}
} } | public class class_name {
public void highlightElement() {
if (m_highlighting == null) {
m_highlighting = new CmsHighlightingBorder(m_position, CmsHighlightingBorder.BorderColor.red); // depends on control dependency: [if], data = [none]
RootPanel.get().add(m_highlighting); // depends on control dependency: [if], data = [(m_highlighting]
} else {
m_highlighting.setPosition(CmsPositionBean.getBoundingClientRect(getElement())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void initEmbeddedServices(String[] requestedServices) {
Set<String> serviceSet = new LinkedHashSet<>();
if (requestedServices != null) {
serviceSet.addAll(Arrays.asList(requestedServices));
}
addRequiredServices(serviceSet);
initServices(serviceSet);
} } | public class class_name {
private void initEmbeddedServices(String[] requestedServices) {
Set<String> serviceSet = new LinkedHashSet<>();
if (requestedServices != null) {
serviceSet.addAll(Arrays.asList(requestedServices));
// depends on control dependency: [if], data = [(requestedServices]
}
addRequiredServices(serviceSet);
initServices(serviceSet);
} } |
public class class_name {
public static boolean specificToDay(String eventDate) {
boolean result = false;
if (!isEmpty(eventDate)) {
Interval eventDateInterval = extractInterval(eventDate);
logger.debug(eventDateInterval);
logger.debug(eventDateInterval.toDuration());
if (eventDateInterval.toDuration().getStandardDays()<1l) {
result = true;
} else if (eventDateInterval.toDuration().getStandardDays()==1l && eventDateInterval.getStart().getDayOfYear()==eventDateInterval.getEnd().getDayOfYear()) {
result = true;
}
}
return result;
} } | public class class_name {
public static boolean specificToDay(String eventDate) {
boolean result = false;
if (!isEmpty(eventDate)) {
Interval eventDateInterval = extractInterval(eventDate);
logger.debug(eventDateInterval); // depends on control dependency: [if], data = [none]
logger.debug(eventDateInterval.toDuration()); // depends on control dependency: [if], data = [none]
if (eventDateInterval.toDuration().getStandardDays()<1l) {
result = true; // depends on control dependency: [if], data = [none]
} else if (eventDateInterval.toDuration().getStandardDays()==1l && eventDateInterval.getStart().getDayOfYear()==eventDateInterval.getEnd().getDayOfYear()) {
result = true; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public static String[] split(CharSequence self) {
StringTokenizer st = new StringTokenizer(self.toString());
String[] strings = new String[st.countTokens()];
for (int i = 0; i < strings.length; i++) {
strings[i] = st.nextToken();
}
return strings;
} } | public class class_name {
public static String[] split(CharSequence self) {
StringTokenizer st = new StringTokenizer(self.toString());
String[] strings = new String[st.countTokens()];
for (int i = 0; i < strings.length; i++) {
strings[i] = st.nextToken(); // depends on control dependency: [for], data = [i]
}
return strings;
} } |
public class class_name {
public Optional<MediaType> match(MediaType range) {
requireNonNull(range, "range");
for (MediaType candidate : mediaTypes) {
if (candidate.belongsTo(range)) {
// With only one specified range, there is no way for candidates to have priority over each
// other, we just return the first match.
return Optional.of(candidate);
}
}
return Optional.empty();
} } | public class class_name {
public Optional<MediaType> match(MediaType range) {
requireNonNull(range, "range");
for (MediaType candidate : mediaTypes) {
if (candidate.belongsTo(range)) {
// With only one specified range, there is no way for candidates to have priority over each
// other, we just return the first match.
return Optional.of(candidate); // depends on control dependency: [if], data = [none]
}
}
return Optional.empty();
} } |
public class class_name {
public SearchCriteria setProjections(
final List<? extends Projection> projections
)
{
if (projections == null || projections.size() == 0) {
clearProjections();
return this;
}
synchronized (projections) {
for (Projection proj : projections) {
if (proj == null) {
throw new IllegalArgumentException( "null element" );
}
}
clearProjections();
for (Projection proj : projections) {
addProjection( proj );
}
}
return this;
} } | public class class_name {
public SearchCriteria setProjections(
final List<? extends Projection> projections
)
{
if (projections == null || projections.size() == 0) {
clearProjections(); // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
}
synchronized (projections) {
for (Projection proj : projections) {
if (proj == null) {
throw new IllegalArgumentException( "null element" );
}
}
clearProjections();
for (Projection proj : projections) {
addProjection( proj ); // depends on control dependency: [for], data = [proj]
}
}
return this;
} } |
public class class_name {
public void remove()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "remove");
}
if (msgIterator.hasNext())
{
msgIterator.remove();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exit(tc, "remove");
}
} } | public class class_name {
public void remove()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "remove"); // depends on control dependency: [if], data = [none]
}
if (msgIterator.hasNext())
{
msgIterator.remove(); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exit(tc, "remove"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void warn( String msg, Throwable t )
{
if( m_delegate.isWarnEnabled() )
{
m_delegate.warn( msg, t );
}
} } | public class class_name {
public void warn( String msg, Throwable t )
{
if( m_delegate.isWarnEnabled() )
{
m_delegate.warn( msg, t ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
CipherLite createCipherLite(SecretKey cek, byte[] iv, int cipherMode,
Provider provider, boolean alwaysUseProvider) {
try {
Cipher cipher = createCipher(provider, alwaysUseProvider);
cipher.init(cipherMode, cek, new IvParameterSpec(iv));
return newCipherLite(cipher, cek, cipherMode);
} catch (Exception e) {
throw e instanceof RuntimeException
? (RuntimeException) e
: new SdkClientException(
"Unable to build cipher: "
+ e.getMessage()
+ "\nMake sure you have the JCE unlimited strength policy files installed and "
+ "configured for your JVM",
e);
}
} } | public class class_name {
CipherLite createCipherLite(SecretKey cek, byte[] iv, int cipherMode,
Provider provider, boolean alwaysUseProvider) {
try {
Cipher cipher = createCipher(provider, alwaysUseProvider);
cipher.init(cipherMode, cek, new IvParameterSpec(iv)); // depends on control dependency: [try], data = [none]
return newCipherLite(cipher, cek, cipherMode); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw e instanceof RuntimeException
? (RuntimeException) e
: new SdkClientException(
"Unable to build cipher: "
+ e.getMessage()
+ "\nMake sure you have the JCE unlimited strength policy files installed and "
+ "configured for your JVM",
e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private KNNHeap linearScan(Relation<? extends O> relation, DBIDIter iter, final O obj, KNNHeap heap) {
final PrimitiveDistanceFunction<? super O> rawdist = this.rawdist;
double max = Double.POSITIVE_INFINITY;
while(iter.valid()) {
final double dist = rawdist.distance(obj, relation.get(iter));
if(dist <= max) {
max = heap.insert(dist, iter);
}
iter.advance();
}
return heap;
} } | public class class_name {
private KNNHeap linearScan(Relation<? extends O> relation, DBIDIter iter, final O obj, KNNHeap heap) {
final PrimitiveDistanceFunction<? super O> rawdist = this.rawdist;
double max = Double.POSITIVE_INFINITY;
while(iter.valid()) {
final double dist = rawdist.distance(obj, relation.get(iter));
if(dist <= max) {
max = heap.insert(dist, iter); // depends on control dependency: [if], data = [(dist]
}
iter.advance(); // depends on control dependency: [while], data = [none]
}
return heap;
} } |
public class class_name {
private Node<E> _get_or_create_root_set(E e) {
Node<E> node = elmap.get(e);
if(node == null) {
// no node yet; create one now
node = new Node<E>(e);
elmap.put(e, node);
return node;
}
return _find_root(node);
} } | public class class_name {
private Node<E> _get_or_create_root_set(E e) {
Node<E> node = elmap.get(e);
if(node == null) {
// no node yet; create one now
node = new Node<E>(e); // depends on control dependency: [if], data = [none]
elmap.put(e, node); // depends on control dependency: [if], data = [none]
return node; // depends on control dependency: [if], data = [none]
}
return _find_root(node);
} } |
public class class_name {
@Override
public int mkdir(String path, @mode_t long mode) {
final AlluxioURI turi = mPathResolverCache.getUnchecked(path);
LOG.trace("mkdir({}) [Alluxio: {}]", path, turi);
try {
mFileSystem.createDirectory(turi);
} catch (FileAlreadyExistsException e) {
LOG.debug("Failed to create directory {}, directory already exists", path);
return -ErrorCodes.EEXIST();
} catch (InvalidPathException e) {
LOG.debug("Failed to create directory {}, path is invalid", path);
return -ErrorCodes.ENOENT();
} catch (Throwable t) {
LOG.error("Failed to create directory {}", path, t);
return AlluxioFuseUtils.getErrorCode(t);
}
return 0;
} } | public class class_name {
@Override
public int mkdir(String path, @mode_t long mode) {
final AlluxioURI turi = mPathResolverCache.getUnchecked(path);
LOG.trace("mkdir({}) [Alluxio: {}]", path, turi);
try {
mFileSystem.createDirectory(turi); // depends on control dependency: [try], data = [none]
} catch (FileAlreadyExistsException e) {
LOG.debug("Failed to create directory {}, directory already exists", path);
return -ErrorCodes.EEXIST();
} catch (InvalidPathException e) { // depends on control dependency: [catch], data = [none]
LOG.debug("Failed to create directory {}, path is invalid", path);
return -ErrorCodes.ENOENT();
} catch (Throwable t) { // depends on control dependency: [catch], data = [none]
LOG.error("Failed to create directory {}", path, t);
return AlluxioFuseUtils.getErrorCode(t);
} // depends on control dependency: [catch], data = [none]
return 0;
} } |
public class class_name {
public void closeLater(ErrorCode errorCode) {
if (!closeInternal(errorCode, null)) {
return; // Already closed.
}
connection.writeSynResetLater(id, errorCode);
} } | public class class_name {
public void closeLater(ErrorCode errorCode) {
if (!closeInternal(errorCode, null)) {
return; // Already closed. // depends on control dependency: [if], data = [none]
}
connection.writeSynResetLater(id, errorCode);
} } |
public class class_name {
public void intercept(Execution execution) {
if(log.isInfoEnabled()) {
for(Task task : execution.getTasks()) {
StringBuffer buffer = new StringBuffer(100);
buffer.append("创建任务[标识=").append(task.getId());
buffer.append(",名称=").append(task.getDisplayName());
buffer.append(",创建时间=").append(task.getCreateTime());
buffer.append(",参与者={");
if(task.getActorIds() != null) {
for(String actor : task.getActorIds()) {
buffer.append(actor).append(";");
}
}
buffer.append("}]");
log.info(buffer.toString());
}
}
} } | public class class_name {
public void intercept(Execution execution) {
if(log.isInfoEnabled()) {
for(Task task : execution.getTasks()) {
StringBuffer buffer = new StringBuffer(100);
buffer.append("创建任务[标识=").append(task.getId()); // depends on control dependency: [for], data = [task]
buffer.append(",名称=").append(task.getDisplayName()); // depends on control dependency: [for], data = [task]
buffer.append(",创建时间=").append(task.getCreateTime()); // depends on control dependency: [for], data = [task]
buffer.append(",参与者={"); // depends on control dependency: [for], data = [none]
if(task.getActorIds() != null) {
for(String actor : task.getActorIds()) {
buffer.append(actor).append(";"); // depends on control dependency: [for], data = [actor]
}
}
buffer.append("}]"); // depends on control dependency: [for], data = [none]
log.info(buffer.toString()); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public int precision(int recall) {
int optimum = 0;
for (int right = 0; right <= recall; right++) {
int candidate = numpositive[right] + numnegative[recall - right];
if (candidate > optimum) {
optimum = candidate;
}
}
return optimum;
} } | public class class_name {
public int precision(int recall) {
int optimum = 0;
for (int right = 0; right <= recall; right++) {
int candidate = numpositive[right] + numnegative[recall - right];
if (candidate > optimum) {
optimum = candidate;
// depends on control dependency: [if], data = [none]
}
}
return optimum;
} } |
public class class_name {
@Override
public synchronized void removeChainEventListener(ChainEventListener cel, String chainName) throws InvalidChainNameException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "removeChainEventListener: chainName=" + chainName + " listener=" + cel);
}
ChainDataImpl chainData = null;
if (null == chainName) {
InvalidChainNameException e = new InvalidChainNameException("Unregister listener for null chain name");
//Race condition can occur where chain is stopped before we register the listener, no need to FFDC
//FFDCFilter.processException(e, getClass().getName() + ".addChainEventListener", "2910", this, new Object[] { chainName, this });
throw e;
}
// Handle a listener unregistering for events from all chains.
if (chainName.equals(ChainEventListener.ALL_CHAINS)) {
for (ChainData chain : this.chainDataMap.values()) {
((ChainDataImpl) chain).removeChainEventListener(cel);
}
this.globalChainEventListeners.remove(cel);
} else {
// Extract the chain config from the framework.
chainData = this.chainDataMap.get(chainName);
// Verify the chain config is in the framework.
if (null == chainData) {
InvalidChainNameException e = new InvalidChainNameException("Unable to unregister listener for unknown chain config, " + chainName);
FFDCFilter.processException(e, getClass().getName() + ".removeChainEventListener", "2948", this, new Object[] { chainName, this });
throw e;
} else if (globalChainEventListeners.contains(cel)) {
// Can't remove a global listener from individual chains
InvalidChainNameException e = new InvalidChainNameException("Can't remove a global listener from individual chains, " + chainName);
FFDCFilter.processException(e, getClass().getName() + ".removeChainEventListener", "2953", this, new Object[] { chainName, this });
throw e;
}
chainData.removeChainEventListener(cel);
}
} } | public class class_name {
@Override
public synchronized void removeChainEventListener(ChainEventListener cel, String chainName) throws InvalidChainNameException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "removeChainEventListener: chainName=" + chainName + " listener=" + cel);
}
ChainDataImpl chainData = null;
if (null == chainName) {
InvalidChainNameException e = new InvalidChainNameException("Unregister listener for null chain name");
//Race condition can occur where chain is stopped before we register the listener, no need to FFDC
//FFDCFilter.processException(e, getClass().getName() + ".addChainEventListener", "2910", this, new Object[] { chainName, this });
throw e;
}
// Handle a listener unregistering for events from all chains.
if (chainName.equals(ChainEventListener.ALL_CHAINS)) {
for (ChainData chain : this.chainDataMap.values()) {
((ChainDataImpl) chain).removeChainEventListener(cel); // depends on control dependency: [for], data = [chain]
}
this.globalChainEventListeners.remove(cel);
} else {
// Extract the chain config from the framework.
chainData = this.chainDataMap.get(chainName);
// Verify the chain config is in the framework.
if (null == chainData) {
InvalidChainNameException e = new InvalidChainNameException("Unable to unregister listener for unknown chain config, " + chainName);
FFDCFilter.processException(e, getClass().getName() + ".removeChainEventListener", "2948", this, new Object[] { chainName, this }); // depends on control dependency: [if], data = [none]
throw e;
} else if (globalChainEventListeners.contains(cel)) {
// Can't remove a global listener from individual chains
InvalidChainNameException e = new InvalidChainNameException("Can't remove a global listener from individual chains, " + chainName);
FFDCFilter.processException(e, getClass().getName() + ".removeChainEventListener", "2953", this, new Object[] { chainName, this }); // depends on control dependency: [if], data = [none]
throw e;
}
chainData.removeChainEventListener(cel);
}
} } |
public class class_name {
public RequestContext renderFalseResult() {
if (renderer instanceof JsonRenderer) {
final JsonRenderer r = (JsonRenderer) renderer;
final JSONObject ret = r.getJSONObject();
ret.put(Keys.STATUS_CODE, false);
}
return this;
} } | public class class_name {
public RequestContext renderFalseResult() {
if (renderer instanceof JsonRenderer) {
final JsonRenderer r = (JsonRenderer) renderer;
final JSONObject ret = r.getJSONObject();
ret.put(Keys.STATUS_CODE, false); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
private CachingPojoPath getPath(Object pojo, String pojoPath, PojoPathMode mode, PojoPathContext context) {
if (pojo == null) {
if (mode == PojoPathMode.RETURN_IF_NULL) {
return null;
} else if (mode == PojoPathMode.RETURN_IF_NULL) {
throw new PojoPathCreationException(null, pojoPath);
} else {
throw new PojoPathSegmentIsNullException(null, pojoPath);
}
}
PojoPathState state = createState(pojo, pojoPath, mode, context);
return getRecursive(pojoPath, context, state);
} } | public class class_name {
private CachingPojoPath getPath(Object pojo, String pojoPath, PojoPathMode mode, PojoPathContext context) {
if (pojo == null) {
if (mode == PojoPathMode.RETURN_IF_NULL) {
return null; // depends on control dependency: [if], data = [none]
} else if (mode == PojoPathMode.RETURN_IF_NULL) {
throw new PojoPathCreationException(null, pojoPath);
} else {
throw new PojoPathSegmentIsNullException(null, pojoPath);
}
}
PojoPathState state = createState(pojo, pojoPath, mode, context);
return getRecursive(pojoPath, context, state);
} } |
public class class_name {
private void updateGlue(final CLClause c) {
if (!this.config.glueupdate) { return; }
if (!this.config.gluered) {
assert c.glue() == 0;
return;
}
assert this.frames.empty();
for (int i = 0; i < c.lits().size(); i++) { markFrame(c.lits().get(i)); }
final int newGlue = unmarkFrames();
if (newGlue >= c.glue()) { return; }
c.setGlue(newGlue);
this.stats.gluesSum += newGlue;
this.stats.gluesCount++;
this.stats.gluesUpdates++;
} } | public class class_name {
private void updateGlue(final CLClause c) {
if (!this.config.glueupdate) { return; } // depends on control dependency: [if], data = [none]
if (!this.config.gluered) {
assert c.glue() == 0;
return; // depends on control dependency: [if], data = [none]
}
assert this.frames.empty();
for (int i = 0; i < c.lits().size(); i++) { markFrame(c.lits().get(i)); } // depends on control dependency: [for], data = [i]
final int newGlue = unmarkFrames();
if (newGlue >= c.glue()) { return; } // depends on control dependency: [if], data = [none]
c.setGlue(newGlue);
this.stats.gluesSum += newGlue;
this.stats.gluesCount++;
this.stats.gluesUpdates++;
} } |
public class class_name {
public boolean hasModelGroupParent() {
boolean result = false;
Element parent = getElement().getParentElement();
while (parent != null) {
if (parent.getPropertyBoolean(PROP_IS_MODEL_GROUP)) {
result = true;
break;
}
parent = parent.getParentElement();
}
return result;
} } | public class class_name {
public boolean hasModelGroupParent() {
boolean result = false;
Element parent = getElement().getParentElement();
while (parent != null) {
if (parent.getPropertyBoolean(PROP_IS_MODEL_GROUP)) {
result = true; // depends on control dependency: [if], data = [none]
break;
}
parent = parent.getParentElement(); // depends on control dependency: [while], data = [none]
}
return result;
} } |
public class class_name {
public ColumnSpec getLastSpec() {
if (this.joinSpec == null) {
return this;
} else {
List<ColumnSpec> l = asList();
return l.get(l.size() - 1);
}
} } | public class class_name {
public ColumnSpec getLastSpec() {
if (this.joinSpec == null) {
return this; // depends on control dependency: [if], data = [none]
} else {
List<ColumnSpec> l = asList();
return l.get(l.size() - 1); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void initializeShowWizardDialogPreference() {
Preference preference =
findPreference(getString(R.string.show_wizard_dialog_preference_key));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
WizardDialog.Builder builder = new WizardDialog.Builder(getActivity(),
shouldUseFullscreen() ? R.style.DarkFullscreenDialogTheme : 0);
configureHeaderDialogBuilder(builder);
builder.enableTabLayout(!shouldHeaderBeShown());
if (shouldButtonBarDividerBeShown()) {
builder.showButtonBarDivider(true);
}
addFragment(builder, 1);
addFragment(builder, 2);
addFragment(builder, 3);
WizardDialog wizardDialog = builder.create();
if (shouldUseAnimations()) {
builder.setBackgroundColor(
getResources().getIntArray(R.array.wizard_dialog_background_colors)[0]);
builder.addOnPageChangeListener(
createWizardDialogPageChangeListener(wizardDialog));
}
wizardDialog.show(getActivity().getSupportFragmentManager(), null);
return true;
}
});
} } | public class class_name {
private void initializeShowWizardDialogPreference() {
Preference preference =
findPreference(getString(R.string.show_wizard_dialog_preference_key));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
WizardDialog.Builder builder = new WizardDialog.Builder(getActivity(),
shouldUseFullscreen() ? R.style.DarkFullscreenDialogTheme : 0);
configureHeaderDialogBuilder(builder);
builder.enableTabLayout(!shouldHeaderBeShown());
if (shouldButtonBarDividerBeShown()) {
builder.showButtonBarDivider(true); // depends on control dependency: [if], data = [none]
}
addFragment(builder, 1);
addFragment(builder, 2);
addFragment(builder, 3);
WizardDialog wizardDialog = builder.create();
if (shouldUseAnimations()) {
builder.setBackgroundColor(
getResources().getIntArray(R.array.wizard_dialog_background_colors)[0]); // depends on control dependency: [if], data = [none]
builder.addOnPageChangeListener(
createWizardDialogPageChangeListener(wizardDialog)); // depends on control dependency: [if], data = [none]
}
wizardDialog.show(getActivity().getSupportFragmentManager(), null);
return true;
}
});
} } |
public class class_name {
@Override
public String buildDialogForm() {
StringBuffer result = new StringBuffer(1024);
try {
// create the dialog HTML
result.append(createDialogHtml(getParamPage()));
} catch (Throwable t) {
// TODO: Error handling
}
return result.toString();
} } | public class class_name {
@Override
public String buildDialogForm() {
StringBuffer result = new StringBuffer(1024);
try {
// create the dialog HTML
result.append(createDialogHtml(getParamPage())); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// TODO: Error handling
} // depends on control dependency: [catch], data = [none]
return result.toString();
} } |
public class class_name {
public void marshall(BatchDetachObject batchDetachObject, ProtocolMarshaller protocolMarshaller) {
if (batchDetachObject == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchDetachObject.getParentReference(), PARENTREFERENCE_BINDING);
protocolMarshaller.marshall(batchDetachObject.getLinkName(), LINKNAME_BINDING);
protocolMarshaller.marshall(batchDetachObject.getBatchReferenceName(), BATCHREFERENCENAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(BatchDetachObject batchDetachObject, ProtocolMarshaller protocolMarshaller) {
if (batchDetachObject == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchDetachObject.getParentReference(), PARENTREFERENCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(batchDetachObject.getLinkName(), LINKNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(batchDetachObject.getBatchReferenceName(), BATCHREFERENCENAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean isOfClass(Type type, Class<?> clazz) {
if(isSimple(type)) {
logger.trace("simple: {}", ((Class<?>)type));
return ((Class<?>)type) == clazz;
} else if(isGeneric(type)) {
logger.trace("generic: {}", (((ParameterizedType)type).getRawType()));
return (((ParameterizedType)type).getRawType()) == clazz;
}
return false;
} } | public class class_name {
public static boolean isOfClass(Type type, Class<?> clazz) {
if(isSimple(type)) {
logger.trace("simple: {}", ((Class<?>)type)); // depends on control dependency: [if], data = [none]
return ((Class<?>)type) == clazz; // depends on control dependency: [if], data = [none]
} else if(isGeneric(type)) {
logger.trace("generic: {}", (((ParameterizedType)type).getRawType())); // depends on control dependency: [if], data = [none]
return (((ParameterizedType)type).getRawType()) == clazz; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
@Override
public Predicate or(Expression<Boolean> arg0, Expression<Boolean> arg1)
{
// TODO Auto-generated method stub
if (arg0 != null && arg1 != null)
{
if (arg0.getClass().isAssignableFrom(ComparisonPredicate.class) && arg1.getClass().isAssignableFrom(ComparisonPredicate.class))
{
return new DisjunctionPredicate((Predicate)arg0, (Predicate)arg1);
}
}
return null;
} } | public class class_name {
@Override
public Predicate or(Expression<Boolean> arg0, Expression<Boolean> arg1)
{
// TODO Auto-generated method stub
if (arg0 != null && arg1 != null)
{
if (arg0.getClass().isAssignableFrom(ComparisonPredicate.class) && arg1.getClass().isAssignableFrom(ComparisonPredicate.class))
{
return new DisjunctionPredicate((Predicate)arg0, (Predicate)arg1); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static void fixDisplayedText(final RESTTextContentSpecV1 source) {
if (source.getFailedContentSpec() != null) {
source.setText(source.getFailedContentSpec());
}
} } | public class class_name {
public static void fixDisplayedText(final RESTTextContentSpecV1 source) {
if (source.getFailedContentSpec() != null) {
source.setText(source.getFailedContentSpec()); // depends on control dependency: [if], data = [(source.getFailedContentSpec()]
}
} } |
public class class_name {
private void addJobJarToClassPath(String localJarFile, StringBuffer classPath) {
File jobCacheDir = new File
(new Path(localJarFile).getParent().toString());
File[] libs = new File(jobCacheDir, "lib").listFiles();
String sep = System.getProperty("path.separator");
if (libs != null) {
for (int i = 0; i < libs.length; i++) {
classPath.append(sep); // add libs from jar to classpath
classPath.append(libs[i]);
}
}
classPath.append(sep);
classPath.append(new File(jobCacheDir, "classes"));
classPath.append(sep);
classPath.append(jobCacheDir);
} } | public class class_name {
private void addJobJarToClassPath(String localJarFile, StringBuffer classPath) {
File jobCacheDir = new File
(new Path(localJarFile).getParent().toString());
File[] libs = new File(jobCacheDir, "lib").listFiles();
String sep = System.getProperty("path.separator");
if (libs != null) {
for (int i = 0; i < libs.length; i++) {
classPath.append(sep); // add libs from jar to classpath // depends on control dependency: [for], data = [none]
classPath.append(libs[i]); // depends on control dependency: [for], data = [i]
}
}
classPath.append(sep);
classPath.append(new File(jobCacheDir, "classes"));
classPath.append(sep);
classPath.append(jobCacheDir);
} } |
public class class_name {
public static boolean[] updateRanges(boolean[] range, GrammarRules grammar) {
boolean[] res = Arrays.copyOf(range, range.length);
for (GrammarRuleRecord r : grammar) {
if (0 == r.getRuleNumber()) {
continue;
}
res = updateRanges(res, r.getRuleIntervals());
}
return res;
} } | public class class_name {
public static boolean[] updateRanges(boolean[] range, GrammarRules grammar) {
boolean[] res = Arrays.copyOf(range, range.length);
for (GrammarRuleRecord r : grammar) {
if (0 == r.getRuleNumber()) {
continue;
}
res = updateRanges(res, r.getRuleIntervals()); // depends on control dependency: [for], data = [r]
}
return res;
} } |
public class class_name {
public boolean assertValidPkForDelete(ClassDescriptor cld, Object obj)
{
if(!ProxyHelper.isProxy(obj))
{
FieldDescriptor fieldDescriptors[] = cld.getPkFields();
int fieldDescriptorSize = fieldDescriptors.length;
for(int i = 0; i < fieldDescriptorSize; i++)
{
FieldDescriptor fd = fieldDescriptors[i];
Object pkValue = fd.getPersistentField().get(obj);
if (representsNull(fd, pkValue))
{
return false;
}
}
}
return true;
} } | public class class_name {
public boolean assertValidPkForDelete(ClassDescriptor cld, Object obj)
{
if(!ProxyHelper.isProxy(obj))
{
FieldDescriptor fieldDescriptors[] = cld.getPkFields();
int fieldDescriptorSize = fieldDescriptors.length;
for(int i = 0; i < fieldDescriptorSize; i++)
{
FieldDescriptor fd = fieldDescriptors[i];
Object pkValue = fd.getPersistentField().get(obj);
if (representsNull(fd, pkValue))
{
return false;
// depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
public Instant minusMillis(long millisToSubtract) {
if (millisToSubtract == Long.MIN_VALUE) {
return plusMillis(Long.MAX_VALUE).plusMillis(1);
}
return plusMillis(-millisToSubtract);
} } | public class class_name {
public Instant minusMillis(long millisToSubtract) {
if (millisToSubtract == Long.MIN_VALUE) {
return plusMillis(Long.MAX_VALUE).plusMillis(1); // depends on control dependency: [if], data = [none]
}
return plusMillis(-millisToSubtract);
} } |
public class class_name {
private void setSystemProperties()
{
if ( systemProperties != null )
{
originalSystemProperties = System.getProperties();
for ( Property systemProperty : systemProperties )
{
String value = systemProperty.getValue();
System.setProperty( systemProperty.getKey(), value == null ? "" : value );
}
}
} } | public class class_name {
private void setSystemProperties()
{
if ( systemProperties != null )
{
originalSystemProperties = System.getProperties(); // depends on control dependency: [if], data = [none]
for ( Property systemProperty : systemProperties )
{
String value = systemProperty.getValue();
System.setProperty( systemProperty.getKey(), value == null ? "" : value ); // depends on control dependency: [for], data = [systemProperty]
}
}
} } |
public class class_name {
private void inflateContentView() {
contentContainer = rootView.findViewById(R.id.content_container);
contentContainer.removeAllViews();
if (customView != null) {
contentContainer.setVisibility(View.VISIBLE);
contentContainer.addView(customView);
} else if (customViewId != -1) {
contentContainer.setVisibility(View.VISIBLE);
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
View view = layoutInflater.inflate(customViewId, contentContainer, false);
contentContainer.addView(view);
} else {
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
View view = layoutInflater
.inflate(R.layout.bottom_sheet_grid_view, contentContainer, false);
contentContainer.addView(view);
}
showGridView();
} } | public class class_name {
private void inflateContentView() {
contentContainer = rootView.findViewById(R.id.content_container);
contentContainer.removeAllViews();
if (customView != null) {
contentContainer.setVisibility(View.VISIBLE); // depends on control dependency: [if], data = [none]
contentContainer.addView(customView); // depends on control dependency: [if], data = [(customView]
} else if (customViewId != -1) {
contentContainer.setVisibility(View.VISIBLE); // depends on control dependency: [if], data = [none]
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
View view = layoutInflater.inflate(customViewId, contentContainer, false);
contentContainer.addView(view); // depends on control dependency: [if], data = [none]
} else {
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
View view = layoutInflater
.inflate(R.layout.bottom_sheet_grid_view, contentContainer, false);
contentContainer.addView(view); // depends on control dependency: [if], data = [none]
}
showGridView();
} } |
public class class_name {
private ConciseSet convert(IntSet c)
{
if (c instanceof ConciseSet && simulateWAH == ((ConciseSet) c).simulateWAH) {
return (ConciseSet) c;
}
if (c == null) {
return empty();
}
ConciseSet res = empty();
IntIterator itr = c.iterator();
while (itr.hasNext()) {
res.add(itr.next());
}
return res;
} } | public class class_name {
private ConciseSet convert(IntSet c)
{
if (c instanceof ConciseSet && simulateWAH == ((ConciseSet) c).simulateWAH) {
return (ConciseSet) c;
// depends on control dependency: [if], data = [none]
}
if (c == null) {
return empty();
// depends on control dependency: [if], data = [none]
}
ConciseSet res = empty();
IntIterator itr = c.iterator();
while (itr.hasNext()) {
res.add(itr.next());
// depends on control dependency: [while], data = [none]
}
return res;
} } |
public class class_name {
public boolean keyspaceExists(DBConn dbConn, String keyspace) {
try {
dbConn.getClientSession().describe_keyspace(keyspace);
return true;
} catch (Exception e) {
return false; // Notfound
}
} } | public class class_name {
public boolean keyspaceExists(DBConn dbConn, String keyspace) {
try {
dbConn.getClientSession().describe_keyspace(keyspace);
// depends on control dependency: [try], data = [none]
return true;
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
return false; // Notfound
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@GET
@Path("{uuid}/repair")
@Produces("text/html")
public String repairView(@PathParam("uuid") String uuid) {
MigrationFeature.checkMigrationId(uuid);
if (failMigrations.isEmpty()) {
throw new NotFoundException();
}
//REPAIR
Map<String, String> model = buildPageModel(MigrationType.REPAIR, uuid);
StrSubstitutor sub = new StrSubstitutor(model);
model.put("migrationUri", model.get("migrationUri") + "/repair");
StringBuilder tabs = new StringBuilder();
StringBuilder diffs = new StringBuilder();
int i = 0;
for (Map.Entry<String, MigrationFail> failEntry : failMigrations.entrySet()) {
String dbName = failEntry.getKey();
MigrationFail fail = failEntry.getValue();
Migration migration = fail.migration;
ScriptInfo info = migration.generate();
tabs.append("<li i=\"").append(i).append("\" class=\"db-name\">").append(dbName).append("</li>");
diffs.append("<div class=\"diff\"><h2>");
diffs.append(Messages.get("view.app.database.repair.subTitle", fail.throwable.getLocalizedMessage()));
diffs.append("</h2><pre>")
.append(info.getApplyDdl())
.append("</pre></div>");
i++;
}
model.put("dbNames", tabs.toString());
model.put("diffs", diffs.toString());
return sub.replace(MIGRATION_HTML);
} } | public class class_name {
@GET
@Path("{uuid}/repair")
@Produces("text/html")
public String repairView(@PathParam("uuid") String uuid) {
MigrationFeature.checkMigrationId(uuid);
if (failMigrations.isEmpty()) {
throw new NotFoundException();
}
//REPAIR
Map<String, String> model = buildPageModel(MigrationType.REPAIR, uuid);
StrSubstitutor sub = new StrSubstitutor(model);
model.put("migrationUri", model.get("migrationUri") + "/repair");
StringBuilder tabs = new StringBuilder();
StringBuilder diffs = new StringBuilder();
int i = 0;
for (Map.Entry<String, MigrationFail> failEntry : failMigrations.entrySet()) {
String dbName = failEntry.getKey();
MigrationFail fail = failEntry.getValue();
Migration migration = fail.migration;
ScriptInfo info = migration.generate();
tabs.append("<li i=\"").append(i).append("\" class=\"db-name\">").append(dbName).append("</li>"); // depends on control dependency: [for], data = [none]
diffs.append("<div class=\"diff\"><h2>"); // depends on control dependency: [for], data = [none]
diffs.append(Messages.get("view.app.database.repair.subTitle", fail.throwable.getLocalizedMessage())); // depends on control dependency: [for], data = [none]
diffs.append("</h2><pre>")
.append(info.getApplyDdl())
.append("</pre></div>"); // depends on control dependency: [for], data = [none]
i++; // depends on control dependency: [for], data = [none]
}
model.put("dbNames", tabs.toString());
model.put("diffs", diffs.toString());
return sub.replace(MIGRATION_HTML);
} } |
public class class_name {
@Override
@SuppressWarnings({ "unchecked" })
public synchronized Enumeration<Object> keys() {
Enumeration<Object> keysEnum = super.keys();
@SuppressWarnings("rawtypes")
Vector keyList = new Vector<>(); // NOPMD - vector used on purpose here...
while (keysEnum.hasMoreElements()) {
keyList.add(keysEnum.nextElement());
}
Collections.sort(keyList);
// reverse this list to have the newest items on top
Collections.reverse(keyList);
return keyList.elements();
} } | public class class_name {
@Override
@SuppressWarnings({ "unchecked" })
public synchronized Enumeration<Object> keys() {
Enumeration<Object> keysEnum = super.keys();
@SuppressWarnings("rawtypes")
Vector keyList = new Vector<>(); // NOPMD - vector used on purpose here...
while (keysEnum.hasMoreElements()) {
keyList.add(keysEnum.nextElement()); // depends on control dependency: [while], data = [none]
}
Collections.sort(keyList);
// reverse this list to have the newest items on top
Collections.reverse(keyList);
return keyList.elements();
} } |
public class class_name {
private static boolean isConjWithNoPrep(TreeGraphNode node, Collection<TypedDependency> list) {
for (TypedDependency td : list) {
if (td.gov() == node && td.reln() == CONJUNCT) {
// we have a conjunct
// check the POS of the dependent
String tdDepPOS = td.dep().parent().value();
if (!(tdDepPOS.equals("IN") || tdDepPOS.equals("TO"))) {
return true;
}
}
}
return false;
} } | public class class_name {
private static boolean isConjWithNoPrep(TreeGraphNode node, Collection<TypedDependency> list) {
for (TypedDependency td : list) {
if (td.gov() == node && td.reln() == CONJUNCT) {
// we have a conjunct
// check the POS of the dependent
String tdDepPOS = td.dep().parent().value();
if (!(tdDepPOS.equals("IN") || tdDepPOS.equals("TO"))) {
return true;
// depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
public static NotificationDto transformToDto(Notification notification) {
if (notification == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
NotificationDto result = createDtoObject(NotificationDto.class, notification);
result.setAlertId(notification.getAlert().getId());
for (Trigger trigger : notification.getTriggers()) {
result.addTriggersIds(trigger);
}
return result;
} } | public class class_name {
public static NotificationDto transformToDto(Notification notification) {
if (notification == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
NotificationDto result = createDtoObject(NotificationDto.class, notification);
result.setAlertId(notification.getAlert().getId());
for (Trigger trigger : notification.getTriggers()) {
result.addTriggersIds(trigger); // depends on control dependency: [for], data = [trigger]
}
return result;
} } |
public class class_name {
protected boolean isSarlResource(Object resource) {
if (resource instanceof IFile) {
final IFile file = (IFile) resource;
return getFileExtensions().contains(file.getFileExtension());
}
return false;
} } | public class class_name {
protected boolean isSarlResource(Object resource) {
if (resource instanceof IFile) {
final IFile file = (IFile) resource;
return getFileExtensions().contains(file.getFileExtension()); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public String hashSystemEnv() {
List<String> system = new ArrayList<String>();
for (Entry<Object, Object> el : System.getProperties().entrySet()) {
system.add(el.getKey() + " " + el.getValue());
}
Map<String, String> env = System.getenv();
for (Entry<String, String> el : env.entrySet()) {
system.add(el.getKey() + " " + el.getValue());
}
Collections.sort(system);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
DataOutputStream dos = new DataOutputStream(baos);
for (String s : system) {
dos.write(s.getBytes());
}
} catch (IOException ex) {
// never
}
return hashByteArray(baos.toByteArray());
} } | public class class_name {
public String hashSystemEnv() {
List<String> system = new ArrayList<String>();
for (Entry<Object, Object> el : System.getProperties().entrySet()) {
system.add(el.getKey() + " " + el.getValue()); // depends on control dependency: [for], data = [el]
}
Map<String, String> env = System.getenv();
for (Entry<String, String> el : env.entrySet()) {
system.add(el.getKey() + " " + el.getValue()); // depends on control dependency: [for], data = [el]
}
Collections.sort(system);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
DataOutputStream dos = new DataOutputStream(baos);
for (String s : system) {
dos.write(s.getBytes()); // depends on control dependency: [for], data = [s]
}
} catch (IOException ex) {
// never
} // depends on control dependency: [catch], data = [none]
return hashByteArray(baos.toByteArray());
} } |
public class class_name {
private void addPortIfValid(Map<String, Integer> map, String key, String port) {
if (StringUtils.isNotBlank(port)) {
String t = port.trim();
if (t.matches(NUMBER_REGEX)) {
map.put(key, Integer.parseInt(t));
}
}
} } | public class class_name {
private void addPortIfValid(Map<String, Integer> map, String key, String port) {
if (StringUtils.isNotBlank(port)) {
String t = port.trim();
if (t.matches(NUMBER_REGEX)) {
map.put(key, Integer.parseInt(t)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public String getConditionalUrl(RestOperationTypeEnum theOperationType) {
if (theOperationType == RestOperationTypeEnum.CREATE) {
String retVal = this.getHeader(Constants.HEADER_IF_NONE_EXIST);
if (isBlank(retVal)) {
return null;
}
if (retVal.startsWith(this.getFhirServerBase())) {
retVal = retVal.substring(this.getFhirServerBase().length());
}
return retVal;
} else if (theOperationType != RestOperationTypeEnum.DELETE && theOperationType != RestOperationTypeEnum.UPDATE) {
return null;
}
if (this.getId() != null && this.getId().hasIdPart()) {
return null;
}
int questionMarkIndex = this.getCompleteUrl().indexOf('?');
if (questionMarkIndex == -1) {
return null;
}
return this.getResourceName() + this.getCompleteUrl().substring(questionMarkIndex);
} } | public class class_name {
public String getConditionalUrl(RestOperationTypeEnum theOperationType) {
if (theOperationType == RestOperationTypeEnum.CREATE) {
String retVal = this.getHeader(Constants.HEADER_IF_NONE_EXIST);
if (isBlank(retVal)) {
return null; // depends on control dependency: [if], data = [none]
}
if (retVal.startsWith(this.getFhirServerBase())) {
retVal = retVal.substring(this.getFhirServerBase().length()); // depends on control dependency: [if], data = [none]
}
return retVal; // depends on control dependency: [if], data = [none]
} else if (theOperationType != RestOperationTypeEnum.DELETE && theOperationType != RestOperationTypeEnum.UPDATE) {
return null; // depends on control dependency: [if], data = [none]
}
if (this.getId() != null && this.getId().hasIdPart()) {
return null; // depends on control dependency: [if], data = [none]
}
int questionMarkIndex = this.getCompleteUrl().indexOf('?');
if (questionMarkIndex == -1) {
return null; // depends on control dependency: [if], data = [none]
}
return this.getResourceName() + this.getCompleteUrl().substring(questionMarkIndex);
} } |
public class class_name {
private void prepareNext()
{
hasNext = false;
while (delegate.hasNext())
{
next = delegate.next();
if (predicate.test(next))
{
hasNext = true;
break;
}
}
} } | public class class_name {
private void prepareNext()
{
hasNext = false;
while (delegate.hasNext())
{
next = delegate.next();
// depends on control dependency: [while], data = [none]
if (predicate.test(next))
{
hasNext = true;
// depends on control dependency: [if], data = [none]
break;
}
}
} } |
public class class_name {
private HashMap<DensityGrid, CharacteristicVector> recluster (GridCluster gc)
{
HashMap<DensityGrid, CharacteristicVector> glNew = new HashMap<DensityGrid, CharacteristicVector>();
Iterator<Map.Entry<DensityGrid,Boolean>> gcIter = gc.getGrids().entrySet().iterator();
newClusterList = new ArrayList<GridCluster>();
//System.out.println("Recluster called for cluster "+gc.getClusterLabel());
// Assign every dense grid in gc to its own cluster, assign all other grids to NO_CLASS
while (gcIter.hasNext())
{
Map.Entry<DensityGrid,Boolean> grid = gcIter.next();
DensityGrid dg = grid.getKey();
CharacteristicVector cvOfG = this.grid_list.get(dg);
if(cvOfG.getAttribute() == DENSE)
{
int gridClass = newClusterList.size();
cvOfG.setLabel(gridClass);
GridCluster newClus = new GridCluster ((CFCluster)dg, new ArrayList<CFCluster>(), gridClass);
newClus.addGrid(dg);
newClusterList.add(newClus);
}
else
cvOfG.setLabel(NO_CLASS);
glNew.put(dg, cvOfG);
}
boolean changesMade;
// While changes can be made...
do
{
changesMade = false;
HashMap<DensityGrid, CharacteristicVector> glAdjusted = adjustNewLabels(glNew);
if(!glAdjusted.isEmpty())
{
glNew.putAll(glAdjusted);
changesMade = true;
}
}while(changesMade);
// Update the cluster list with the newly formed clusters
gc.getGrids().clear();
this.cluster_list.set(gc.getClusterLabel(), gc);
this.cluster_list.addAll(newClusterList);
return glNew;
} } | public class class_name {
private HashMap<DensityGrid, CharacteristicVector> recluster (GridCluster gc)
{
HashMap<DensityGrid, CharacteristicVector> glNew = new HashMap<DensityGrid, CharacteristicVector>();
Iterator<Map.Entry<DensityGrid,Boolean>> gcIter = gc.getGrids().entrySet().iterator();
newClusterList = new ArrayList<GridCluster>();
//System.out.println("Recluster called for cluster "+gc.getClusterLabel());
// Assign every dense grid in gc to its own cluster, assign all other grids to NO_CLASS
while (gcIter.hasNext())
{
Map.Entry<DensityGrid,Boolean> grid = gcIter.next();
DensityGrid dg = grid.getKey();
CharacteristicVector cvOfG = this.grid_list.get(dg);
if(cvOfG.getAttribute() == DENSE)
{
int gridClass = newClusterList.size();
cvOfG.setLabel(gridClass); // depends on control dependency: [if], data = [none]
GridCluster newClus = new GridCluster ((CFCluster)dg, new ArrayList<CFCluster>(), gridClass);
newClus.addGrid(dg); // depends on control dependency: [if], data = [none]
newClusterList.add(newClus); // depends on control dependency: [if], data = [none]
}
else
cvOfG.setLabel(NO_CLASS);
glNew.put(dg, cvOfG); // depends on control dependency: [while], data = [none]
}
boolean changesMade;
// While changes can be made...
do
{
changesMade = false;
HashMap<DensityGrid, CharacteristicVector> glAdjusted = adjustNewLabels(glNew);
if(!glAdjusted.isEmpty())
{
glNew.putAll(glAdjusted); // depends on control dependency: [if], data = [none]
changesMade = true; // depends on control dependency: [if], data = [none]
}
}while(changesMade);
// Update the cluster list with the newly formed clusters
gc.getGrids().clear();
this.cluster_list.set(gc.getClusterLabel(), gc);
this.cluster_list.addAll(newClusterList);
return glNew;
} } |
public class class_name {
public Field createFieldDateTimeDate(Field routeFieldParam) {
if(routeFieldParam != null && this.serviceTicket != null) {
routeFieldParam.setServiceTicket(this.serviceTicket);
}
if(routeFieldParam != null) {
routeFieldParam.setTypeAsEnum(Field.Type.DateTime);
routeFieldParam.setTypeMetaData(FieldMetaData.DateTime.DATE);
}
return new Field(this.putJson(
routeFieldParam, Version1.routeFieldCreate()));
} } | public class class_name {
public Field createFieldDateTimeDate(Field routeFieldParam) {
if(routeFieldParam != null && this.serviceTicket != null) {
routeFieldParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none]
}
if(routeFieldParam != null) {
routeFieldParam.setTypeAsEnum(Field.Type.DateTime); // depends on control dependency: [if], data = [none]
routeFieldParam.setTypeMetaData(FieldMetaData.DateTime.DATE); // depends on control dependency: [if], data = [none]
}
return new Field(this.putJson(
routeFieldParam, Version1.routeFieldCreate()));
} } |
public class class_name {
@SuppressWarnings("rawtypes")
public ManagedConnection matchManagedConnections(Set connectionSet,
Subject subject, ConnectionRequestInfo cxRequestInfo)
throws ResourceException {
for(Object result : connectionSet){
if (result instanceof VertxManagedConnection) {
VertxManagedConnection vertMC = (VertxManagedConnection) result;
if (this.equals(vertMC.getManagementConnectionFactory())) {
return vertMC;
}
}
}
return null;
} } | public class class_name {
@SuppressWarnings("rawtypes")
public ManagedConnection matchManagedConnections(Set connectionSet,
Subject subject, ConnectionRequestInfo cxRequestInfo)
throws ResourceException {
for(Object result : connectionSet){
if (result instanceof VertxManagedConnection) {
VertxManagedConnection vertMC = (VertxManagedConnection) result;
if (this.equals(vertMC.getManagementConnectionFactory())) {
return vertMC; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public void showStatus(String strMessage, ImageIcon icon, int iWarningLevel)
{
if (strMessage == null)
strMessage = Constants.BLANK;
if (m_textArea != null)
m_textArea.setText(strMessage);
if (iWarningLevel == Constants.WARNING)
{
m_textArea.setForeground(Color.RED);
m_textArea.setBackground(Color.PINK);
m_textArea.setOpaque(true);
}
else if (iWarningLevel == Constants.WAIT)
{
m_textArea.setForeground(Color.BLUE);
m_textArea.setBackground(Color.CYAN);
m_textArea.setOpaque(true);
}
else
{
m_textArea.setForeground(Color.BLACK);
m_textArea.setOpaque(false);
}
if (icon != null)
m_textArea.setIcon(icon);
else
m_textArea.setIcon(null);
} } | public class class_name {
public void showStatus(String strMessage, ImageIcon icon, int iWarningLevel)
{
if (strMessage == null)
strMessage = Constants.BLANK;
if (m_textArea != null)
m_textArea.setText(strMessage);
if (iWarningLevel == Constants.WARNING)
{
m_textArea.setForeground(Color.RED); // depends on control dependency: [if], data = [none]
m_textArea.setBackground(Color.PINK); // depends on control dependency: [if], data = [none]
m_textArea.setOpaque(true); // depends on control dependency: [if], data = [none]
}
else if (iWarningLevel == Constants.WAIT)
{
m_textArea.setForeground(Color.BLUE); // depends on control dependency: [if], data = [none]
m_textArea.setBackground(Color.CYAN); // depends on control dependency: [if], data = [none]
m_textArea.setOpaque(true); // depends on control dependency: [if], data = [none]
}
else
{
m_textArea.setForeground(Color.BLACK); // depends on control dependency: [if], data = [none]
m_textArea.setOpaque(false); // depends on control dependency: [if], data = [none]
}
if (icon != null)
m_textArea.setIcon(icon);
else
m_textArea.setIcon(null);
} } |
public class class_name {
protected void validateJsonBeanIfNeeds(Object jsonBean, JsonResponse<?> response) {
if (response.isValidatorSuppressed()) { // by individual requirement
logger.debug("...Suppressing JSON bean validator by response option: {}", response);
return;
}
final ResponseReflectingOption option = adjustResponseReflecting();
if (option.isJsonBeanValidatorSuppressed()) { // by project policy
return;
}
// cannot-be-validatable skip is embedded in the response validator
doValidateJsonBean(jsonBean, response, option);
} } | public class class_name {
protected void validateJsonBeanIfNeeds(Object jsonBean, JsonResponse<?> response) {
if (response.isValidatorSuppressed()) { // by individual requirement
logger.debug("...Suppressing JSON bean validator by response option: {}", response); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final ResponseReflectingOption option = adjustResponseReflecting();
if (option.isJsonBeanValidatorSuppressed()) { // by project policy
return; // depends on control dependency: [if], data = [none]
}
// cannot-be-validatable skip is embedded in the response validator
doValidateJsonBean(jsonBean, response, option);
} } |
public class class_name {
private void handleApplicationCommandRequest(SerialMessage incomingMessage) {
logger.trace("Handle Message Application Command Request");
int nodeId = incomingMessage.getMessagePayloadByte(1);
logger.debug("Application Command Request from Node " + nodeId);
ZWaveNode node = getNode(nodeId);
if (node == null) {
logger.warn("Node {} not initialized yet, ignoring message.", nodeId);
return;
}
node.resetResendCount();
int commandClassCode = incomingMessage.getMessagePayloadByte(3);
ZWaveCommandClass.CommandClass commandClass = ZWaveCommandClass.CommandClass.getCommandClass(commandClassCode);
if (commandClass == null) {
logger.error(String.format("Unsupported command class 0x%02x", commandClassCode));
return;
}
logger.debug(String.format("Incoming command class %s (0x%02x)", commandClass.getLabel(), commandClass.getKey()));
ZWaveCommandClass zwaveCommandClass = node.getCommandClass(commandClass);
// We got an unsupported command class, return.
if (zwaveCommandClass == null) {
logger.error(String.format("Unsupported command class %s (0x%02x)", commandClass.getLabel(), commandClassCode));
return;
}
logger.trace("Found Command Class {}, passing to handleApplicationCommandRequest", zwaveCommandClass.getCommandClass().getLabel());
zwaveCommandClass.handleApplicationCommandRequest(incomingMessage, 4, 1);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && nodeId == this.lastSentMessage.getMessageNode() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
} } | public class class_name {
private void handleApplicationCommandRequest(SerialMessage incomingMessage) {
logger.trace("Handle Message Application Command Request");
int nodeId = incomingMessage.getMessagePayloadByte(1);
logger.debug("Application Command Request from Node " + nodeId);
ZWaveNode node = getNode(nodeId);
if (node == null) {
logger.warn("Node {} not initialized yet, ignoring message.", nodeId); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
node.resetResendCount();
int commandClassCode = incomingMessage.getMessagePayloadByte(3);
ZWaveCommandClass.CommandClass commandClass = ZWaveCommandClass.CommandClass.getCommandClass(commandClassCode);
if (commandClass == null) {
logger.error(String.format("Unsupported command class 0x%02x", commandClassCode)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
logger.debug(String.format("Incoming command class %s (0x%02x)", commandClass.getLabel(), commandClass.getKey()));
ZWaveCommandClass zwaveCommandClass = node.getCommandClass(commandClass);
// We got an unsupported command class, return.
if (zwaveCommandClass == null) {
logger.error(String.format("Unsupported command class %s (0x%02x)", commandClass.getLabel(), commandClassCode)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
logger.trace("Found Command Class {}, passing to handleApplicationCommandRequest", zwaveCommandClass.getCommandClass().getLabel());
zwaveCommandClass.handleApplicationCommandRequest(incomingMessage, 4, 1);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && nodeId == this.lastSentMessage.getMessageNode() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage)); // depends on control dependency: [if], data = [none]
transactionCompleted.release(); // depends on control dependency: [if], data = [none]
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String fromDuration(Duration duration) {
if (duration == null) {
return null;
}
return humanize(duration.get(ChronoUnit.MILLIS));
} } | public class class_name {
public static String fromDuration(Duration duration) {
if (duration == null) {
return null; // depends on control dependency: [if], data = [none]
}
return humanize(duration.get(ChronoUnit.MILLIS));
} } |
public class class_name {
protected boolean fail(List<ValidationMessage> errors, IssueType type, int line, int col, String path, boolean thePass, String msg) {
if (!thePass) {
addValidationMessage(errors, type, line, col, path, msg, IssueSeverity.FATAL);
}
return thePass;
} } | public class class_name {
protected boolean fail(List<ValidationMessage> errors, IssueType type, int line, int col, String path, boolean thePass, String msg) {
if (!thePass) {
addValidationMessage(errors, type, line, col, path, msg, IssueSeverity.FATAL); // depends on control dependency: [if], data = [none]
}
return thePass;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.