code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static ConcatVector readFromProto(ConcatVectorProto.ConcatVector m) {
int components = m.getComponentCount();
ConcatVector vec = new ConcatVector();
vec.pointers = new double[components][];
vec.sparse = new boolean[components];
vec.copyOnWrite = new boolean[components];
for (int i = 0; i < components; i++) {
ConcatVectorProto.ConcatVector.Component c = m.getComponent(i);
vec.sparse[i] = c.getSparse();
int dataSize = c.getDataCount();
vec.pointers[i] = new double[dataSize];
for (int j = 0; j < dataSize; j++) {
vec.pointers[i][j] = c.getData(j);
}
}
return vec;
} } | public class class_name {
public static ConcatVector readFromProto(ConcatVectorProto.ConcatVector m) {
int components = m.getComponentCount();
ConcatVector vec = new ConcatVector();
vec.pointers = new double[components][];
vec.sparse = new boolean[components];
vec.copyOnWrite = new boolean[components];
for (int i = 0; i < components; i++) {
ConcatVectorProto.ConcatVector.Component c = m.getComponent(i);
vec.sparse[i] = c.getSparse(); // depends on control dependency: [for], data = [i]
int dataSize = c.getDataCount();
vec.pointers[i] = new double[dataSize]; // depends on control dependency: [for], data = [i]
for (int j = 0; j < dataSize; j++) {
vec.pointers[i][j] = c.getData(j); // depends on control dependency: [for], data = [j]
}
}
return vec;
} } |
public class class_name {
void addToWaitList(final Reference ref) {
final URI file = ref.filename;
assert file.isAbsolute() && file.getFragment() == null;
if (doneList.contains(file) || waitList.contains(ref) || file.equals(currentFile)) {
return;
}
waitList.add(ref);
} } | public class class_name {
void addToWaitList(final Reference ref) {
final URI file = ref.filename;
assert file.isAbsolute() && file.getFragment() == null;
if (doneList.contains(file) || waitList.contains(ref) || file.equals(currentFile)) {
return; // depends on control dependency: [if], data = [none]
}
waitList.add(ref);
} } |
public class class_name {
public void setScheduledInstanceSet(java.util.Collection<ScheduledInstance> scheduledInstanceSet) {
if (scheduledInstanceSet == null) {
this.scheduledInstanceSet = null;
return;
}
this.scheduledInstanceSet = new com.amazonaws.internal.SdkInternalList<ScheduledInstance>(scheduledInstanceSet);
} } | public class class_name {
public void setScheduledInstanceSet(java.util.Collection<ScheduledInstance> scheduledInstanceSet) {
if (scheduledInstanceSet == null) {
this.scheduledInstanceSet = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.scheduledInstanceSet = new com.amazonaws.internal.SdkInternalList<ScheduledInstance>(scheduledInstanceSet);
} } |
public class class_name {
protected static ControlCreateDurable createDurableCreateDurable(
MessageProcessor MP,
ConsumerDispatcherState subState,
long reqID,
SIBUuid8 dme)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createDurableCreateDurable", new Object[] {MP, subState, new Long(reqID), dme});
ControlCreateDurable msg = null;
try
{
// Create and initialize the message
msg = MessageProcessor.getControlMessageFactory().createNewControlCreateDurable();
initializeControlMessage(MP.getMessagingEngineUuid(), msg, dme);
// Parameterize for CreateStream
msg.setRequestID(reqID);
msg.setDurableSubName(subState.getSubscriberID());
SelectionCriteria criteria = subState.getSelectionCriteria();
//check for null values for MFP - discriminator can be null
//the discriminator
if(criteria==null || criteria.getDiscriminator()==null)
{
msg.setDurableDiscriminator(null);
}
else
{
msg.setDurableDiscriminator(criteria.getDiscriminator());
}
//the selector
if(criteria==null || criteria.getSelectorString()==null)
{
msg.setDurableSelector(null);
}
else
{
msg.setDurableSelector(subState.getSelectionCriteria().getSelectorString());
}
//the selector domain
if(criteria==null || criteria.getSelectorDomain()==null)
{
msg.setDurableSelectorDomain(SelectorDomain.SIMESSAGE.toInt());
}
else
{
msg.setDurableSelectorDomain(criteria.getSelectorDomain().toInt());
}
// Check the selectorProperties Map to see if we need to convey any additional properties associated
// with the selector. At present (26/03/08) there is only one additional property
// which is itself a map (of name spaces). The name space map is used in the XPath10 selector domain
// to map URLs to prefixes. The use of a selectorProperties map keeps the Core SPI generic but
// when conveying information over JMF we need a simpler structure and so will need to
// break out individual properties for transportation.
if(criteria==null)
{
msg.setDurableSelectorNamespaceMap(null);
}
else
{
// See if these criteria have any selector properties. They might if they are MPSelectionCriteria
if(criteria instanceof MPSelectionCriteria)
{
MPSelectionCriteria mpCriteria = (MPSelectionCriteria)criteria;
Map<String, Object> selectorProperties = mpCriteria.getSelectorProperties();
if(selectorProperties != null)
{
Map<String, String> selectorNamespaceMap =
(Map<String, String>)selectorProperties.get("namespacePrefixMappings");
if(selectorNamespaceMap != null)
msg.setDurableSelectorNamespaceMap(selectorNamespaceMap);
else
msg.setDurableSelectorNamespaceMap(null);
}
else
{
msg.setDurableSelectorNamespaceMap(null);
}
}
else
{
msg.setDurableSelectorNamespaceMap(null);
} // eof instanceof MPSelectionCriteria
} // eof null criteria
//defect 259036
msg.setCloned(subState.isCloned());
msg.setNoLocal(subState.isNoLocal());
msg.setSecurityUserid(subState.getUser());
// Set the flag that signals whether this is
// the privileged SIBServerSubject.
msg.setSecurityUseridSentBySystem(subState.isSIBServerSubject());
}
catch (Exception e)
{
FFDCFilter.processException(e,
"com.ibm.ws.sib.processor.impl.DurableInputHandler.createDurableCreateDurable",
"1:495:1.52.1.1",
DurableInputHandler.class);
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createDurableCreateDurable", msg);
return msg;
} } | public class class_name {
protected static ControlCreateDurable createDurableCreateDurable(
MessageProcessor MP,
ConsumerDispatcherState subState,
long reqID,
SIBUuid8 dme)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createDurableCreateDurable", new Object[] {MP, subState, new Long(reqID), dme});
ControlCreateDurable msg = null;
try
{
// Create and initialize the message
msg = MessageProcessor.getControlMessageFactory().createNewControlCreateDurable(); // depends on control dependency: [try], data = [none]
initializeControlMessage(MP.getMessagingEngineUuid(), msg, dme); // depends on control dependency: [try], data = [none]
// Parameterize for CreateStream
msg.setRequestID(reqID); // depends on control dependency: [try], data = [none]
msg.setDurableSubName(subState.getSubscriberID()); // depends on control dependency: [try], data = [none]
SelectionCriteria criteria = subState.getSelectionCriteria();
//check for null values for MFP - discriminator can be null
//the discriminator
if(criteria==null || criteria.getDiscriminator()==null)
{
msg.setDurableDiscriminator(null); // depends on control dependency: [if], data = [none]
}
else
{
msg.setDurableDiscriminator(criteria.getDiscriminator()); // depends on control dependency: [if], data = [(criteria]
}
//the selector
if(criteria==null || criteria.getSelectorString()==null)
{
msg.setDurableSelector(null); // depends on control dependency: [if], data = [none]
}
else
{
msg.setDurableSelector(subState.getSelectionCriteria().getSelectorString()); // depends on control dependency: [if], data = [none]
}
//the selector domain
if(criteria==null || criteria.getSelectorDomain()==null)
{
msg.setDurableSelectorDomain(SelectorDomain.SIMESSAGE.toInt()); // depends on control dependency: [if], data = [none]
}
else
{
msg.setDurableSelectorDomain(criteria.getSelectorDomain().toInt()); // depends on control dependency: [if], data = [(criteria]
}
// Check the selectorProperties Map to see if we need to convey any additional properties associated
// with the selector. At present (26/03/08) there is only one additional property
// which is itself a map (of name spaces). The name space map is used in the XPath10 selector domain
// to map URLs to prefixes. The use of a selectorProperties map keeps the Core SPI generic but
// when conveying information over JMF we need a simpler structure and so will need to
// break out individual properties for transportation.
if(criteria==null)
{
msg.setDurableSelectorNamespaceMap(null); // depends on control dependency: [if], data = [null)]
}
else
{
// See if these criteria have any selector properties. They might if they are MPSelectionCriteria
if(criteria instanceof MPSelectionCriteria)
{
MPSelectionCriteria mpCriteria = (MPSelectionCriteria)criteria;
Map<String, Object> selectorProperties = mpCriteria.getSelectorProperties();
if(selectorProperties != null)
{
Map<String, String> selectorNamespaceMap =
(Map<String, String>)selectorProperties.get("namespacePrefixMappings");
if(selectorNamespaceMap != null)
msg.setDurableSelectorNamespaceMap(selectorNamespaceMap);
else
msg.setDurableSelectorNamespaceMap(null);
}
else
{
msg.setDurableSelectorNamespaceMap(null); // depends on control dependency: [if], data = [null)]
}
}
else
{
msg.setDurableSelectorNamespaceMap(null); // depends on control dependency: [if], data = [none]
} // eof instanceof MPSelectionCriteria
} // eof null criteria
//defect 259036
msg.setCloned(subState.isCloned()); // depends on control dependency: [try], data = [none]
msg.setNoLocal(subState.isNoLocal()); // depends on control dependency: [try], data = [none]
msg.setSecurityUserid(subState.getUser()); // depends on control dependency: [try], data = [none]
// Set the flag that signals whether this is
// the privileged SIBServerSubject.
msg.setSecurityUseridSentBySystem(subState.isSIBServerSubject()); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
FFDCFilter.processException(e,
"com.ibm.ws.sib.processor.impl.DurableInputHandler.createDurableCreateDurable",
"1:495:1.52.1.1",
DurableInputHandler.class);
SibTr.exception(tc, e);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createDurableCreateDurable", msg);
return msg;
} } |
public class class_name {
public static Expression asBoxedList(List<SoyExpression> items) {
List<Expression> childExprs = new ArrayList<>(items.size());
for (SoyExpression child : items) {
childExprs.add(child.box());
}
return BytecodeUtils.asList(childExprs);
} } | public class class_name {
public static Expression asBoxedList(List<SoyExpression> items) {
List<Expression> childExprs = new ArrayList<>(items.size());
for (SoyExpression child : items) {
childExprs.add(child.box()); // depends on control dependency: [for], data = [child]
}
return BytecodeUtils.asList(childExprs);
} } |
public class class_name {
private static Node getNthSibling(Node first, int index) {
Node sibling = first;
while (index != 0 && sibling != null) {
sibling = sibling.getNext();
index--;
}
return sibling;
} } | public class class_name {
private static Node getNthSibling(Node first, int index) {
Node sibling = first;
while (index != 0 && sibling != null) {
sibling = sibling.getNext(); // depends on control dependency: [while], data = [none]
index--; // depends on control dependency: [while], data = [none]
}
return sibling;
} } |
public class class_name {
public Iterator<SymbolTable> iterator()
{
ArrayList<SymbolTable> tables;
synchronized (myTablesByName)
{
tables = new ArrayList<SymbolTable>(myTablesByName.size());
// I don't think we can shorten the synchronization block
// because HashMap.values() result is a live view (not a copy) and
// thus needs to be synched too.
Collection<TreeMap<Integer, SymbolTable>> symtabNames =
myTablesByName.values();
for (TreeMap<Integer,SymbolTable> versions : symtabNames)
{
synchronized (versions)
{
tables.addAll(versions.values());
}
}
}
return tables.iterator();
} } | public class class_name {
public Iterator<SymbolTable> iterator()
{
ArrayList<SymbolTable> tables;
synchronized (myTablesByName)
{
tables = new ArrayList<SymbolTable>(myTablesByName.size());
// I don't think we can shorten the synchronization block
// because HashMap.values() result is a live view (not a copy) and
// thus needs to be synched too.
Collection<TreeMap<Integer, SymbolTable>> symtabNames =
myTablesByName.values();
for (TreeMap<Integer,SymbolTable> versions : symtabNames)
{
synchronized (versions) // depends on control dependency: [for], data = [versions]
{
tables.addAll(versions.values());
}
}
}
return tables.iterator();
} } |
public class class_name {
protected MESSAGES toUserMessages(Object form, Set<ConstraintViolation<Object>> vioSet) {
final TreeMap<String, Object> orderedMap = prepareOrderedMap(form, vioSet);
final MESSAGES messages = prepareActionMessages();
for (Entry<String, Object> entry : orderedMap.entrySet()) {
final Object holder = entry.getValue();
if (holder instanceof ConstraintViolation) {
@SuppressWarnings("unchecked")
final ConstraintViolation<Object> vio = (ConstraintViolation<Object>) holder;
registerActionMessage(messages, vio);
} else if (holder instanceof List<?>) {
@SuppressWarnings("unchecked")
final List<ConstraintViolation<Object>> vioList = ((List<ConstraintViolation<Object>>) holder);
for (ConstraintViolation<Object> vio : vioList) {
registerActionMessage(messages, vio);
}
} else {
throw new IllegalStateException("Unknown type of holder: " + holder);
}
}
return messages;
} } | public class class_name {
protected MESSAGES toUserMessages(Object form, Set<ConstraintViolation<Object>> vioSet) {
final TreeMap<String, Object> orderedMap = prepareOrderedMap(form, vioSet);
final MESSAGES messages = prepareActionMessages();
for (Entry<String, Object> entry : orderedMap.entrySet()) {
final Object holder = entry.getValue();
if (holder instanceof ConstraintViolation) {
@SuppressWarnings("unchecked")
final ConstraintViolation<Object> vio = (ConstraintViolation<Object>) holder;
registerActionMessage(messages, vio); // depends on control dependency: [if], data = [none]
} else if (holder instanceof List<?>) {
@SuppressWarnings("unchecked")
final List<ConstraintViolation<Object>> vioList = ((List<ConstraintViolation<Object>>) holder);
for (ConstraintViolation<Object> vio : vioList) {
registerActionMessage(messages, vio); // depends on control dependency: [for], data = [vio]
}
} else {
throw new IllegalStateException("Unknown type of holder: " + holder);
}
}
return messages;
} } |
public class class_name {
private void adaptItemTypeface() {
if (adapter != null && itemTypeface != null) {
RecyclerView.Adapter<?> wrappedAdapter = adapter.getWrappedAdapter();
if (wrappedAdapter instanceof ArrayRecyclerViewAdapter) {
((ArrayRecyclerViewAdapter) wrappedAdapter).setItemTypeface(itemTypeface);
}
}
} } | public class class_name {
private void adaptItemTypeface() {
if (adapter != null && itemTypeface != null) {
RecyclerView.Adapter<?> wrappedAdapter = adapter.getWrappedAdapter();
if (wrappedAdapter instanceof ArrayRecyclerViewAdapter) {
((ArrayRecyclerViewAdapter) wrappedAdapter).setItemTypeface(itemTypeface); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private byte[] getFileBytes(File file) throws CmsException {
byte[] buffer = null;
FileInputStream fileStream = null;
int charsRead;
int size;
try {
fileStream = new FileInputStream(file);
charsRead = 0;
size = new Long(file.length()).intValue();
buffer = new byte[size];
while (charsRead < size) {
charsRead += fileStream.read(buffer, charsRead, size - charsRead);
}
return buffer;
} catch (IOException e) {
throw new CmsDbIoException(
Messages.get().container(Messages.ERR_GET_FILE_BYTES_1, file.getAbsolutePath()),
e);
} finally {
closeStream(fileStream);
}
} } | public class class_name {
private byte[] getFileBytes(File file) throws CmsException {
byte[] buffer = null;
FileInputStream fileStream = null;
int charsRead;
int size;
try {
fileStream = new FileInputStream(file);
charsRead = 0;
size = new Long(file.length()).intValue();
buffer = new byte[size];
while (charsRead < size) {
charsRead += fileStream.read(buffer, charsRead, size - charsRead); // depends on control dependency: [while], data = [none]
}
return buffer;
} catch (IOException e) {
throw new CmsDbIoException(
Messages.get().container(Messages.ERR_GET_FILE_BYTES_1, file.getAbsolutePath()),
e);
} finally {
closeStream(fileStream);
}
} } |
public class class_name {
public PropertySourcePropertyResolver addPropertySource(@Nullable PropertySource propertySource) {
if (propertySource != null) {
propertySources.put(propertySource.getName(), propertySource);
processPropertySource(propertySource, propertySource.getConvention());
}
return this;
} } | public class class_name {
public PropertySourcePropertyResolver addPropertySource(@Nullable PropertySource propertySource) {
if (propertySource != null) {
propertySources.put(propertySource.getName(), propertySource); // depends on control dependency: [if], data = [(propertySource]
processPropertySource(propertySource, propertySource.getConvention()); // depends on control dependency: [if], data = [(propertySource]
}
return this;
} } |
public class class_name {
@CheckResult
@NonNull
public final PowerAdapter prepend(@NonNull PowerAdapter... adapters) {
checkNotNull(adapters, "adapters");
if (adapters.length == 0) {
return this;
}
return new ConcatAdapterBuilder().addAll(adapters).add(this).build();
} } | public class class_name {
@CheckResult
@NonNull
public final PowerAdapter prepend(@NonNull PowerAdapter... adapters) {
checkNotNull(adapters, "adapters");
if (adapters.length == 0) {
return this; // depends on control dependency: [if], data = [none]
}
return new ConcatAdapterBuilder().addAll(adapters).add(this).build();
} } |
public class class_name {
public static void prepareForLogging(String path, String query) {
MDC.put("request_id", UUID.randomUUID().toString()); // generate unique request id ...
try {
URI uri = new URI(path);
MDC.put("host", uri.getHost());
MDC.put("scheme", uri.getScheme());
MDC.put("domain", UrlUtils.resolveDomain(uri.getPath()));
MDC.put("port", uri.getPort() + "");
MDC.put("path", uri.getPath());
}
catch (URISyntaxException e) {
// fall back
MDC.put("path", path);
}
MDC.put("timestamp", System.currentTimeMillis() + "");
if (!StringUtils.isNullOrEmptyTrimmed(query)) {
MDC.put("query", query);
}
} } | public class class_name {
public static void prepareForLogging(String path, String query) {
MDC.put("request_id", UUID.randomUUID().toString()); // generate unique request id ...
try {
URI uri = new URI(path);
MDC.put("host", uri.getHost()); // depends on control dependency: [try], data = [none]
MDC.put("scheme", uri.getScheme()); // depends on control dependency: [try], data = [none]
MDC.put("domain", UrlUtils.resolveDomain(uri.getPath())); // depends on control dependency: [try], data = [none]
MDC.put("port", uri.getPort() + ""); // depends on control dependency: [try], data = [none]
MDC.put("path", uri.getPath()); // depends on control dependency: [try], data = [none]
}
catch (URISyntaxException e) {
// fall back
MDC.put("path", path);
} // depends on control dependency: [catch], data = [none]
MDC.put("timestamp", System.currentTimeMillis() + "");
if (!StringUtils.isNullOrEmptyTrimmed(query)) {
MDC.put("query", query); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static int[] evenlyLgSpaced(final int lgStart, final int lgEnd, final int points) {
if (points <= 0) {
throw new SketchesArgumentException("points must be > 0");
}
if ((lgEnd < 0) || (lgStart < 0)) {
throw new SketchesArgumentException("lgStart and lgEnd must be >= 0.");
}
final int[] out = new int[points];
out[0] = 1 << lgStart;
if (points == 1) { return out; }
final double delta = (lgEnd - lgStart) / (points - 1.0);
for (int i = 1; i < points; i++) {
final double mXpY = (delta * i) + lgStart;
out[i] = (int)round(pow(2, mXpY));
}
return out;
} } | public class class_name {
public static int[] evenlyLgSpaced(final int lgStart, final int lgEnd, final int points) {
if (points <= 0) {
throw new SketchesArgumentException("points must be > 0");
}
if ((lgEnd < 0) || (lgStart < 0)) {
throw new SketchesArgumentException("lgStart and lgEnd must be >= 0.");
}
final int[] out = new int[points];
out[0] = 1 << lgStart;
if (points == 1) { return out; } // depends on control dependency: [if], data = [none]
final double delta = (lgEnd - lgStart) / (points - 1.0);
for (int i = 1; i < points; i++) {
final double mXpY = (delta * i) + lgStart;
out[i] = (int)round(pow(2, mXpY)); // depends on control dependency: [for], data = [i]
}
return out;
} } |
public class class_name {
private void rollBlocksScheduled(long now) {
if ((now - lastBlocksScheduledRollTime) >
BLOCKS_SCHEDULED_ROLL_INTERVAL) {
prevApproxBlocksScheduled = currApproxBlocksScheduled;
currApproxBlocksScheduled = 0;
lastBlocksScheduledRollTime = now;
}
} } | public class class_name {
private void rollBlocksScheduled(long now) {
if ((now - lastBlocksScheduledRollTime) >
BLOCKS_SCHEDULED_ROLL_INTERVAL) {
prevApproxBlocksScheduled = currApproxBlocksScheduled; // depends on control dependency: [if], data = [none]
currApproxBlocksScheduled = 0; // depends on control dependency: [if], data = [none]
lastBlocksScheduledRollTime = now; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
Element<Corner> previous( Element<Corner> e ) {
if( e.previous == null ) {
return list.getTail();
} else {
return e.previous;
}
} } | public class class_name {
Element<Corner> previous( Element<Corner> e ) {
if( e.previous == null ) {
return list.getTail(); // depends on control dependency: [if], data = [none]
} else {
return e.previous; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static boolean hasConflictingClassName(FileDescriptorProto file, String name) {
for (EnumDescriptorProto enumDesc : file.getEnumTypeList()) {
if (name.equals(enumDesc.getName())) {
return true;
}
}
for (ServiceDescriptorProto serviceDesc : file.getServiceList()) {
if (name.equals(serviceDesc.getName())) {
return true;
}
}
for (DescriptorProto messageDesc : file.getMessageTypeList()) {
if (hasConflictingClassName(messageDesc, name)) {
return true;
}
}
return false;
} } | public class class_name {
private static boolean hasConflictingClassName(FileDescriptorProto file, String name) {
for (EnumDescriptorProto enumDesc : file.getEnumTypeList()) {
if (name.equals(enumDesc.getName())) {
return true; // depends on control dependency: [if], data = [none]
}
}
for (ServiceDescriptorProto serviceDesc : file.getServiceList()) {
if (name.equals(serviceDesc.getName())) {
return true; // depends on control dependency: [if], data = [none]
}
}
for (DescriptorProto messageDesc : file.getMessageTypeList()) {
if (hasConflictingClassName(messageDesc, name)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void setReadLimit(long readLimit) {
this.readLimit = readLimit;
if (trafficCounter != null) {
trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano());
}
} } | public class class_name {
public void setReadLimit(long readLimit) {
this.readLimit = readLimit;
if (trafficCounter != null) {
trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean isRunOnce(final ServletRequest pRequest) {
// If request already filtered, return true (skip)
if (pRequest.getAttribute(attribRunOnce) == ATTRIB_RUN_ONCE_VALUE) {
return true;
}
// Set attribute and return false (continue)
pRequest.setAttribute(attribRunOnce, ATTRIB_RUN_ONCE_VALUE);
return false;
} } | public class class_name {
private boolean isRunOnce(final ServletRequest pRequest) {
// If request already filtered, return true (skip)
if (pRequest.getAttribute(attribRunOnce) == ATTRIB_RUN_ONCE_VALUE) {
return true;
// depends on control dependency: [if], data = [none]
}
// Set attribute and return false (continue)
pRequest.setAttribute(attribRunOnce, ATTRIB_RUN_ONCE_VALUE);
return false;
} } |
public class class_name {
public static boolean hasDifferentValue(XsdStringRestrictions o1, XsdStringRestrictions o2) {
if (o1 == null && o2 == null) {
return false;
}
String o1Value = null;
String o2Value;
if (o1 != null) {
o1Value = o1.getValue();
}
if (o2 != null) {
o2Value = o2.getValue();
return o2Value.equals(o1Value);
}
return false;
} } | public class class_name {
public static boolean hasDifferentValue(XsdStringRestrictions o1, XsdStringRestrictions o2) {
if (o1 == null && o2 == null) {
return false; // depends on control dependency: [if], data = [none]
}
String o1Value = null;
String o2Value;
if (o1 != null) {
o1Value = o1.getValue(); // depends on control dependency: [if], data = [none]
}
if (o2 != null) {
o2Value = o2.getValue(); // depends on control dependency: [if], data = [none]
return o2Value.equals(o1Value); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static Object instantiate(MetadataBase metadata) {
try {
return metadata.getConstructorMetadata().getConstructorMethodHandle().invoke();
} catch (Throwable t) {
throw new EntityManagerException(t);
}
} } | public class class_name {
public static Object instantiate(MetadataBase metadata) {
try {
return metadata.getConstructorMetadata().getConstructorMethodHandle().invoke(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
throw new EntityManagerException(t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Connection getConnection(PooledConnection pconn, WSConnectionRequestInfoImpl cri, String userName) throws ResourceException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "getConnection", AdapterUtil.toString(pconn));
Connection conn = null;
boolean isConnectionSetupComplete = false;
try {
conn = pconn.getConnection();
postGetConnectionHandling(conn);
isConnectionSetupComplete = true;
} catch (SQLException se) {
FFDCFilter.processException(se, getClass().getName(), "260", this);
ResourceException x = AdapterUtil.translateSQLException(se, this, false, getClass());
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getConnection", se);
throw x;
} finally {
// Destroy the connection if we weren't able to successfully complete the setup.
if (!isConnectionSetupComplete) {
if (conn != null)
try {
conn.close();
} catch (Throwable x) {
}
if (pconn != null)
try {
pconn.close();
} catch (Throwable x) {
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getConnection", AdapterUtil.toString(conn));
return conn;
} } | public class class_name {
private Connection getConnection(PooledConnection pconn, WSConnectionRequestInfoImpl cri, String userName) throws ResourceException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "getConnection", AdapterUtil.toString(pconn));
Connection conn = null;
boolean isConnectionSetupComplete = false;
try {
conn = pconn.getConnection();
postGetConnectionHandling(conn);
isConnectionSetupComplete = true;
} catch (SQLException se) {
FFDCFilter.processException(se, getClass().getName(), "260", this);
ResourceException x = AdapterUtil.translateSQLException(se, this, false, getClass());
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getConnection", se);
throw x;
} finally {
// Destroy the connection if we weren't able to successfully complete the setup.
if (!isConnectionSetupComplete) {
if (conn != null)
try {
conn.close(); // depends on control dependency: [try], data = [none]
} catch (Throwable x) {
} // depends on control dependency: [catch], data = [none]
if (pconn != null)
try {
pconn.close(); // depends on control dependency: [try], data = [none]
} catch (Throwable x) {
} // depends on control dependency: [catch], data = [none]
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getConnection", AdapterUtil.toString(conn));
return conn;
} } |
public class class_name {
@Override
protected void onPersist(EntityMetadata metadata, Object entity, Object id, List<RelationHolder> rlHolders)
{
if (!isOpen())
{
throw new PersistenceException("PelopsClient is closed.");
}
// check for counter column
if (isUpdate && metadata.isCounterColumnType())
{
throw new UnsupportedOperationException("Invalid operation! Merge is not possible over counter column.");
}
String insert_Query = null;
if (isCql3Enabled(metadata))
{
Cassandra.Client client = getRawClient(metadata.getSchema());
try
{
cqlClient.persist(metadata, entity, client, rlHolders, getTtlValues().get(metadata.getTableName()));
}
catch (InvalidRequestException e)
{
log.error("Error during persist while executing query {}, Caused by: .", insert_Query, e);
throw new KunderaException(e);
}
catch (TException e)
{
log.error("Error during persist while executing query {}, Caused by: .", insert_Query, e);
throw new KunderaException(e);
}
catch (UnsupportedEncodingException e)
{
log.error("Error during persist while executing query {}, Caused by: .", insert_Query, e);
throw new KunderaException(e);
}
}
else
{
Collection<ThriftRow> tfRows = null;
try
{
String columnFamily = metadata.getTableName();
tfRows = dataHandler.toThriftRow(entity, id, metadata, columnFamily, getTtlValues().get(columnFamily));
}
catch (Exception e)
{
log.error("Error during persist, Caused by: .", e);
throw new KunderaException(e);
}
for (ThriftRow tf : tfRows)
{
if (tf.getColumnFamilyName().equals(metadata.getTableName()))
{
addRelationsToThriftRow(metadata, tf, rlHolders);
}
Mutator mutator = clientFactory.getMutator(pool);
if (metadata.isCounterColumnType())
{
if (log.isInfoEnabled())
{
log.info("Persisting counter column family record for row key {}", tf.getId());
}
List<CounterColumn> thriftCounterColumns = tf.getCounterColumns();
List<CounterSuperColumn> thriftCounterSuperColumns = tf.getCounterSuperColumns();
if (thriftCounterColumns != null && !thriftCounterColumns.isEmpty())
{
mutator.writeCounterColumns(tf.getColumnFamilyName(),
Bytes.fromByteBuffer(CassandraUtilities.toBytes(tf.getId(), tf.getId().getClass())),
Arrays.asList(tf.getCounterColumns().toArray(new CounterColumn[0])));
}
if (thriftCounterSuperColumns != null && !thriftCounterSuperColumns.isEmpty())
{
for (CounterSuperColumn sc : thriftCounterSuperColumns)
{
mutator.writeSubCounterColumns(
tf.getColumnFamilyName(),
Bytes.fromByteBuffer(CassandraUtilities.toBytes(tf.getId(), tf.getId().getClass())),
Bytes.fromByteArray(sc.getName()), sc.getColumns());
}
}
}
else
{
List<Column> thriftColumns = tf.getColumns();
List<SuperColumn> thriftSuperColumns = tf.getSuperColumns();
if (thriftColumns != null && !thriftColumns.isEmpty())
{
// Bytes.from
mutator.writeColumns(tf.getColumnFamilyName(),
Bytes.fromByteBuffer(CassandraUtilities.toBytes(tf.getId(), tf.getId().getClass())),
tf.getColumns());
}
if (thriftSuperColumns != null && !thriftSuperColumns.isEmpty())
{
for (SuperColumn sc : thriftSuperColumns)
{
if (log.isInfoEnabled())
{
log.info("Persisting super column family record for row key {}", tf.getId());
}
mutator.writeSubColumns(
tf.getColumnFamilyName(),
Bytes.fromByteBuffer(CassandraUtilities.toBytes(tf.getId(), tf.getId().getClass())),
Bytes.fromByteArray(sc.getName()), sc.getColumns());
}
}
}
mutator.execute(getConsistencyLevel());
}
tfRows = null;
if (isTtlPerRequest())
{
getTtlValues().clear();
}
}
} } | public class class_name {
@Override
protected void onPersist(EntityMetadata metadata, Object entity, Object id, List<RelationHolder> rlHolders)
{
if (!isOpen())
{
throw new PersistenceException("PelopsClient is closed.");
}
// check for counter column
if (isUpdate && metadata.isCounterColumnType())
{
throw new UnsupportedOperationException("Invalid operation! Merge is not possible over counter column.");
}
String insert_Query = null;
if (isCql3Enabled(metadata))
{
Cassandra.Client client = getRawClient(metadata.getSchema());
try
{
cqlClient.persist(metadata, entity, client, rlHolders, getTtlValues().get(metadata.getTableName())); // depends on control dependency: [try], data = [none]
}
catch (InvalidRequestException e)
{
log.error("Error during persist while executing query {}, Caused by: .", insert_Query, e);
throw new KunderaException(e);
} // depends on control dependency: [catch], data = [none]
catch (TException e)
{
log.error("Error during persist while executing query {}, Caused by: .", insert_Query, e);
throw new KunderaException(e);
} // depends on control dependency: [catch], data = [none]
catch (UnsupportedEncodingException e)
{
log.error("Error during persist while executing query {}, Caused by: .", insert_Query, e);
throw new KunderaException(e);
} // depends on control dependency: [catch], data = [none]
}
else
{
Collection<ThriftRow> tfRows = null;
try
{
String columnFamily = metadata.getTableName();
tfRows = dataHandler.toThriftRow(entity, id, metadata, columnFamily, getTtlValues().get(columnFamily)); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
log.error("Error during persist, Caused by: .", e);
throw new KunderaException(e);
} // depends on control dependency: [catch], data = [none]
for (ThriftRow tf : tfRows)
{
if (tf.getColumnFamilyName().equals(metadata.getTableName()))
{
addRelationsToThriftRow(metadata, tf, rlHolders); // depends on control dependency: [if], data = [none]
}
Mutator mutator = clientFactory.getMutator(pool);
if (metadata.isCounterColumnType())
{
if (log.isInfoEnabled())
{
log.info("Persisting counter column family record for row key {}", tf.getId());
}
List<CounterColumn> thriftCounterColumns = tf.getCounterColumns();
List<CounterSuperColumn> thriftCounterSuperColumns = tf.getCounterSuperColumns();
if (thriftCounterColumns != null && !thriftCounterColumns.isEmpty())
{
mutator.writeCounterColumns(tf.getColumnFamilyName(),
Bytes.fromByteBuffer(CassandraUtilities.toBytes(tf.getId(), tf.getId().getClass())),
Arrays.asList(tf.getCounterColumns().toArray(new CounterColumn[0])));
}
if (thriftCounterSuperColumns != null && !thriftCounterSuperColumns.isEmpty())
{
for (CounterSuperColumn sc : thriftCounterSuperColumns)
{
mutator.writeSubCounterColumns(
tf.getColumnFamilyName(),
Bytes.fromByteBuffer(CassandraUtilities.toBytes(tf.getId(), tf.getId().getClass())),
Bytes.fromByteArray(sc.getName()), sc.getColumns());
}
}
}
else
{
List<Column> thriftColumns = tf.getColumns();
List<SuperColumn> thriftSuperColumns = tf.getSuperColumns();
if (thriftColumns != null && !thriftColumns.isEmpty())
{
// Bytes.from
mutator.writeColumns(tf.getColumnFamilyName(),
Bytes.fromByteBuffer(CassandraUtilities.toBytes(tf.getId(), tf.getId().getClass())),
tf.getColumns());
}
if (thriftSuperColumns != null && !thriftSuperColumns.isEmpty())
{
for (SuperColumn sc : thriftSuperColumns)
{
if (log.isInfoEnabled())
{
log.info("Persisting super column family record for row key {}", tf.getId());
}
mutator.writeSubColumns(
tf.getColumnFamilyName(),
Bytes.fromByteBuffer(CassandraUtilities.toBytes(tf.getId(), tf.getId().getClass())),
Bytes.fromByteArray(sc.getName()), sc.getColumns());
}
}
}
mutator.execute(getConsistencyLevel());
}
tfRows = null;
if (isTtlPerRequest())
{
getTtlValues().clear();
}
}
} } |
public class class_name {
@Inject
public void setConverters(List<ValueConverter<?, ?>> converterList) {
getInitializationState().requireNotInitilized();
this.converters = new ArrayList<>(converterList.size());
for (ValueConverter<?, ?> converter : converterList) {
if (!(converter instanceof ComposedValueConverter)) {
this.converters.add(converter);
}
}
} } | public class class_name {
@Inject
public void setConverters(List<ValueConverter<?, ?>> converterList) {
getInitializationState().requireNotInitilized();
this.converters = new ArrayList<>(converterList.size());
for (ValueConverter<?, ?> converter : converterList) {
if (!(converter instanceof ComposedValueConverter)) {
this.converters.add(converter); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void log(final Metadata metadata) {
final StringBuilder sb = new StringBuilder();
for (final MetadataItem item : metadata.getGroupList()) {
sb.append(LINE);
sb.append(NEWLINE);
sb.append(LINE);
sb.append("Group: " + item.getName());
sb.append(NEWLINE);
for (MetadataElement element : item.getElements()) {
sb.append(" Element : " + element.getName());
sb.append(NEWLINE);
sb.append(" Type : " + element.getType());
sb.append(NEWLINE);
sb.append(" MinOccurs: " + element.getMinOccurs());
sb.append(NEWLINE);
sb.append(" MaxOccurs: " + element.getMaxOccurs());
sb.append(NEWLINE);
sb.append(" IsAttr : " + element.getIsAttribute());
sb.append(NEWLINE);
sb.append(NEWLINE);
}
for (MetadataElement element : item.getReferences()) {
sb.append(" Ref : " + element.getRef());
sb.append(NEWLINE);
}
sb.append(NEWLINE);
}
for (MetadataEnum enumItem : metadata.getEnumList()) {
sb.append(LINE);
sb.append(NEWLINE);
sb.append("Enum: " + enumItem.getName());
sb.append(NEWLINE);
for (String enumValue : enumItem.getValueList()) {
sb.append(" Value : " + enumValue);
sb.append(NEWLINE);
}
sb.append(NEWLINE);
}
for (MetadataItem item : metadata.getClassList()) {
sb.append(LINE);
sb.append(NEWLINE);
sb.append("Class: " + item.getName());
sb.append(NEWLINE);
for (MetadataElement element : item.getElements()) {
sb.append(" Element : " + element.getName());
sb.append(NEWLINE);
sb.append(" Type : " + element.getType());
sb.append(NEWLINE);
sb.append(" MinOccurs: " + element.getMinOccurs());
sb.append(NEWLINE);
sb.append(" MaxOccurs: " + element.getMaxOccurs());
sb.append(NEWLINE);
sb.append(" IsAttr : " + element.getIsAttribute());
sb.append(NEWLINE);
sb.append(NEWLINE);
}
for (MetadataElement element : item.getReferences()) {
sb.append(" Ref : " + element.getRef());
sb.append(NEWLINE);
}
sb.append(NEWLINE);
}
for (MetadataItem dataType : metadata.getDataTypeList()) {
sb.append(LINE);
sb.append(NEWLINE);
sb.append("Name : " + dataType.getName());
sb.append(NEWLINE);
sb.append("MappedTo: " + dataType.getMappedTo());
sb.append(NEWLINE);
}
// Log
log.info(sb.toString());
} } | public class class_name {
public void log(final Metadata metadata) {
final StringBuilder sb = new StringBuilder();
for (final MetadataItem item : metadata.getGroupList()) {
sb.append(LINE); // depends on control dependency: [for], data = [none]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(LINE); // depends on control dependency: [for], data = [none]
sb.append("Group: " + item.getName()); // depends on control dependency: [for], data = [item]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
for (MetadataElement element : item.getElements()) {
sb.append(" Element : " + element.getName()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(" Type : " + element.getType()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(" MinOccurs: " + element.getMinOccurs()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(" MaxOccurs: " + element.getMaxOccurs()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(" IsAttr : " + element.getIsAttribute()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
}
for (MetadataElement element : item.getReferences()) {
sb.append(" Ref : " + element.getRef()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
}
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
}
for (MetadataEnum enumItem : metadata.getEnumList()) {
sb.append(LINE); // depends on control dependency: [for], data = [none]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append("Enum: " + enumItem.getName()); // depends on control dependency: [for], data = [enumItem]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
for (String enumValue : enumItem.getValueList()) {
sb.append(" Value : " + enumValue); // depends on control dependency: [for], data = [enumValue]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
}
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
}
for (MetadataItem item : metadata.getClassList()) {
sb.append(LINE); // depends on control dependency: [for], data = [none]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append("Class: " + item.getName()); // depends on control dependency: [for], data = [item]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
for (MetadataElement element : item.getElements()) {
sb.append(" Element : " + element.getName()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(" Type : " + element.getType()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(" MinOccurs: " + element.getMinOccurs()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(" MaxOccurs: " + element.getMaxOccurs()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(" IsAttr : " + element.getIsAttribute()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
}
for (MetadataElement element : item.getReferences()) {
sb.append(" Ref : " + element.getRef()); // depends on control dependency: [for], data = [element]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
}
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
}
for (MetadataItem dataType : metadata.getDataTypeList()) {
sb.append(LINE); // depends on control dependency: [for], data = [none]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append("Name : " + dataType.getName()); // depends on control dependency: [for], data = [dataType]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
sb.append("MappedTo: " + dataType.getMappedTo()); // depends on control dependency: [for], data = [dataType]
sb.append(NEWLINE); // depends on control dependency: [for], data = [none]
}
// Log
log.info(sb.toString());
} } |
public class class_name {
public boolean isInBitmapMemoryCache(final ImageRequest imageRequest) {
if (imageRequest == null) {
return false;
}
final CacheKey cacheKey = mCacheKeyFactory.getBitmapCacheKey(imageRequest, null);
CloseableReference<CloseableImage> ref = mBitmapMemoryCache.get(cacheKey);
try {
return CloseableReference.isValid(ref);
} finally {
CloseableReference.closeSafely(ref);
}
} } | public class class_name {
public boolean isInBitmapMemoryCache(final ImageRequest imageRequest) {
if (imageRequest == null) {
return false; // depends on control dependency: [if], data = [none]
}
final CacheKey cacheKey = mCacheKeyFactory.getBitmapCacheKey(imageRequest, null);
CloseableReference<CloseableImage> ref = mBitmapMemoryCache.get(cacheKey);
try {
return CloseableReference.isValid(ref); // depends on control dependency: [try], data = [none]
} finally {
CloseableReference.closeSafely(ref);
}
} } |
public class class_name {
public final int getOffset(ReadableInstant instant) {
if (instant == null) {
return getOffset(DateTimeUtils.currentTimeMillis());
}
return getOffset(instant.getMillis());
} } | public class class_name {
public final int getOffset(ReadableInstant instant) {
if (instant == null) {
return getOffset(DateTimeUtils.currentTimeMillis()); // depends on control dependency: [if], data = [none]
}
return getOffset(instant.getMillis());
} } |
public class class_name {
private static int checkEdge(int width, int x, int col, int edge)
{
int ix = x + col;
if (ix < 0)
{
if (edge == CLAMP_EDGES)
{
ix = 0;
}
else
{
ix = (x + width) % width;
}
}
else if (ix >= width)
{
if (edge == CLAMP_EDGES)
{
ix = width - 1;
}
else
{
ix = (x + width) % width;
}
}
return ix;
} } | public class class_name {
private static int checkEdge(int width, int x, int col, int edge)
{
int ix = x + col;
if (ix < 0)
{
if (edge == CLAMP_EDGES)
{
ix = 0;
// depends on control dependency: [if], data = [none]
}
else
{
ix = (x + width) % width;
// depends on control dependency: [if], data = [none]
}
}
else if (ix >= width)
{
if (edge == CLAMP_EDGES)
{
ix = width - 1;
// depends on control dependency: [if], data = [none]
}
else
{
ix = (x + width) % width;
// depends on control dependency: [if], data = [none]
}
}
return ix;
} } |
public class class_name {
public Object removeAttribute(Object name) {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[REMOVE_ATTRIBUTE], "name= " + name);
}
_attributes.remove(name);
Object oldValue = removeValueGuts((String) name);
Boolean oldIsBindingListener = (Boolean) _attributeNames.get(name);
_attributeNames.remove(name);
_storeCallback.sessionAttributeRemoved(this, name, oldValue, oldIsBindingListener);
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
if (!SessionManagerConfig.isHideSessionValues()) {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[REMOVE_ATTRIBUTE], "oldAttributeValue = " + oldValue);
} else {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[REMOVE_ATTRIBUTE]);
}
}
return oldValue;
} } | public class class_name {
public Object removeAttribute(Object name) {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[REMOVE_ATTRIBUTE], "name= " + name); // depends on control dependency: [if], data = [none]
}
_attributes.remove(name);
Object oldValue = removeValueGuts((String) name);
Boolean oldIsBindingListener = (Boolean) _attributeNames.get(name);
_attributeNames.remove(name);
_storeCallback.sessionAttributeRemoved(this, name, oldValue, oldIsBindingListener);
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
if (!SessionManagerConfig.isHideSessionValues()) {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[REMOVE_ATTRIBUTE], "oldAttributeValue = " + oldValue); // depends on control dependency: [if], data = [none]
} else {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[REMOVE_ATTRIBUTE]); // depends on control dependency: [if], data = [none]
}
}
return oldValue;
} } |
public class class_name {
public void setAcePrincipalId(String acePrincipalId) {
try {
CmsUUID principalId = null;
String principal = acePrincipalId.substring(acePrincipalId.indexOf('.') + 1, acePrincipalId.length());
if (acePrincipalId.startsWith(I_CmsPrincipal.PRINCIPAL_GROUP)) {
principal = OpenCms.getImportExportManager().translateGroup(principal);
principalId = getCms().readGroup(principal).getId();
} else if (acePrincipalId.startsWith(I_CmsPrincipal.PRINCIPAL_USER)) {
principal = OpenCms.getImportExportManager().translateUser(principal);
principalId = getCms().readUser(principal).getId();
} else if (acePrincipalId.startsWith(CmsRole.PRINCIPAL_ROLE)) {
principalId = CmsRole.valueOfRoleName(principal).getId();
} else if (acePrincipalId.equalsIgnoreCase(CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME)) {
principalId = CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID;
} else if (acePrincipalId.equalsIgnoreCase(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME)) {
principalId = CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID;
} else {
if (LOG.isWarnEnabled()) {
LOG.warn(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_ACE_1,
acePrincipalId));
}
throw new CmsIllegalStateException(
Messages.get().container(Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_ACE_1, acePrincipalId));
}
m_acePrincipalId = principalId;
} catch (Throwable e) {
setThrowable(e);
}
} } | public class class_name {
public void setAcePrincipalId(String acePrincipalId) {
try {
CmsUUID principalId = null;
String principal = acePrincipalId.substring(acePrincipalId.indexOf('.') + 1, acePrincipalId.length());
if (acePrincipalId.startsWith(I_CmsPrincipal.PRINCIPAL_GROUP)) {
principal = OpenCms.getImportExportManager().translateGroup(principal); // depends on control dependency: [if], data = [none]
principalId = getCms().readGroup(principal).getId(); // depends on control dependency: [if], data = [none]
} else if (acePrincipalId.startsWith(I_CmsPrincipal.PRINCIPAL_USER)) {
principal = OpenCms.getImportExportManager().translateUser(principal); // depends on control dependency: [if], data = [none]
principalId = getCms().readUser(principal).getId(); // depends on control dependency: [if], data = [none]
} else if (acePrincipalId.startsWith(CmsRole.PRINCIPAL_ROLE)) {
principalId = CmsRole.valueOfRoleName(principal).getId(); // depends on control dependency: [if], data = [none]
} else if (acePrincipalId.equalsIgnoreCase(CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME)) {
principalId = CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID; // depends on control dependency: [if], data = [none]
} else if (acePrincipalId.equalsIgnoreCase(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME)) {
principalId = CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID; // depends on control dependency: [if], data = [none]
} else {
if (LOG.isWarnEnabled()) {
LOG.warn(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_ACE_1,
acePrincipalId)); // depends on control dependency: [if], data = [none]
}
throw new CmsIllegalStateException(
Messages.get().container(Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_ACE_1, acePrincipalId));
}
m_acePrincipalId = principalId; // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
setThrowable(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setViewHeight(int newHeight) {
if (newHeight > 0) {
originalHeight = newHeight;
RelativeLayout.LayoutParams layoutParams =
(RelativeLayout.LayoutParams) view.getLayoutParams();
layoutParams.height = newHeight;
view.setLayoutParams(layoutParams);
}
} } | public class class_name {
public void setViewHeight(int newHeight) {
if (newHeight > 0) {
originalHeight = newHeight; // depends on control dependency: [if], data = [none]
RelativeLayout.LayoutParams layoutParams =
(RelativeLayout.LayoutParams) view.getLayoutParams();
layoutParams.height = newHeight; // depends on control dependency: [if], data = [none]
view.setLayoutParams(layoutParams); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setBuffer(WsByteBuffer buf) {
if (buf != null) {
this.buffers = this.defaultBuffers;
this.buffers[0] = buf;
} else {
this.buffers = null;
}
} } | public class class_name {
public void setBuffer(WsByteBuffer buf) {
if (buf != null) {
this.buffers = this.defaultBuffers; // depends on control dependency: [if], data = [none]
this.buffers[0] = buf; // depends on control dependency: [if], data = [none]
} else {
this.buffers = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix) {
if (fileSuffix == null) {
throw new IllegalArgumentException("fileSuffix == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new ContainsFilter(writerFileSuffixesMethod, fileSuffix), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageWriterIterator(iter);
} } | public class class_name {
public static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix) {
if (fileSuffix == null) {
throw new IllegalArgumentException("fileSuffix == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new ContainsFilter(writerFileSuffixesMethod, fileSuffix), true);
// depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
// depends on control dependency: [catch], data = [none]
return new ImageWriterIterator(iter);
} } |
public class class_name {
private String getArchiveFileName(String archive) {
String fileExtension = getFilenameExtension();
if (archive.endsWith(fileExtension)) {
return archive;
} else if (archive.endsWith(archiver.getFilenameExtension())) {
return archive + compressor.getFilenameExtension();
} else {
return archive + fileExtension;
}
} } | public class class_name {
private String getArchiveFileName(String archive) {
String fileExtension = getFilenameExtension();
if (archive.endsWith(fileExtension)) {
return archive; // depends on control dependency: [if], data = [none]
} else if (archive.endsWith(archiver.getFilenameExtension())) {
return archive + compressor.getFilenameExtension(); // depends on control dependency: [if], data = [none]
} else {
return archive + fileExtension; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void validateRequiredProps(LocalComponent localComponent,
Set<LocalComponentProp> foundProps) {
String missingRequiredProps = localComponent
.getRequiredProps()
.stream()
.filter(prop -> !foundProps.contains(prop))
.map(prop -> "\"" + propNameToAttributeName(prop.getPropName()) + "\"")
.collect(Collectors.joining(","));
if (!missingRequiredProps.isEmpty()) {
logger.error("Missing required property: "
+ missingRequiredProps
+ " on child component \""
+ localComponent.getComponentTagName()
+ "\"");
}
} } | public class class_name {
private void validateRequiredProps(LocalComponent localComponent,
Set<LocalComponentProp> foundProps) {
String missingRequiredProps = localComponent
.getRequiredProps()
.stream()
.filter(prop -> !foundProps.contains(prop))
.map(prop -> "\"" + propNameToAttributeName(prop.getPropName()) + "\"")
.collect(Collectors.joining(","));
if (!missingRequiredProps.isEmpty()) {
logger.error("Missing required property: "
+ missingRequiredProps
+ " on child component \""
+ localComponent.getComponentTagName()
+ "\""); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Weeks weeksBetween(ReadablePartial start, ReadablePartial end) {
if (start instanceof LocalDate && end instanceof LocalDate) {
Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
int weeks = chrono.weeks().getDifference(
((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis());
return Weeks.weeks(weeks);
}
int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
return Weeks.weeks(amount);
} } | public class class_name {
public static Weeks weeksBetween(ReadablePartial start, ReadablePartial end) {
if (start instanceof LocalDate && end instanceof LocalDate) {
Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
int weeks = chrono.weeks().getDifference(
((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis());
return Weeks.weeks(weeks); // depends on control dependency: [if], data = [none]
}
int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
return Weeks.weeks(amount);
} } |
public class class_name {
private static List<CmsCategory> getCategories(CmsObject cms, CmsResource resource) {
if ((null != resource) && (null != cms)) {
try {
return CmsCategoryService.getInstance().readResourceCategories(cms, resource);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
return new ArrayList<CmsCategory>(0);
} } | public class class_name {
private static List<CmsCategory> getCategories(CmsObject cms, CmsResource resource) {
if ((null != resource) && (null != cms)) {
try {
return CmsCategoryService.getInstance().readResourceCategories(cms, resource); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
return new ArrayList<CmsCategory>(0);
} } |
public class class_name {
static String stripLeadingAndTrailingQuotes(String str)
{
int length = str.length();
if (length > 1 && str.startsWith("\"") && str.endsWith("\"") && str.substring(1, length - 1).indexOf('"') == -1)
{
str = str.substring(1, length - 1);
}
return str;
} } | public class class_name {
static String stripLeadingAndTrailingQuotes(String str)
{
int length = str.length();
if (length > 1 && str.startsWith("\"") && str.endsWith("\"") && str.substring(1, length - 1).indexOf('"') == -1)
{
str = str.substring(1, length - 1); // depends on control dependency: [if], data = [none]
}
return str;
} } |
public class class_name {
protected CharSequence getSubMenu(final AbstractMenu _menu,
final String _parent)
throws EFapsException
{
final String var = RandomUtil.randomAlphabetic(4);
final StringBuilder js = new StringBuilder();
js.append("var ").append(var).append(" = new DropDownMenu({});\n");
final UIGrid uiGrid = (UIGrid) getDefaultModelObject();
for (final AbstractCommand child : _menu.getCommands()) {
if (child.hasAccess(uiGrid.getCommand().getTargetMode(), uiGrid.getInstance())) {
if (child instanceof AbstractMenu) {
js.append(getSubMenu((AbstractMenu) child, var));
} else {
js.append(var).append(".addChild(")
.append(getMenuItem(child, false))
.append(");\n");
}
}
}
js.append(_parent).append(".addChild(new PopupMenuBarItem({\n")
.append("label: \"").append(StringEscapeUtils.escapeEcmaScript(_menu.getLabelProperty())).append("\",\n")
.append(" popup: ").append(var).append("\n")
.append(" }));\n");
return js;
} } | public class class_name {
protected CharSequence getSubMenu(final AbstractMenu _menu,
final String _parent)
throws EFapsException
{
final String var = RandomUtil.randomAlphabetic(4);
final StringBuilder js = new StringBuilder();
js.append("var ").append(var).append(" = new DropDownMenu({});\n");
final UIGrid uiGrid = (UIGrid) getDefaultModelObject();
for (final AbstractCommand child : _menu.getCommands()) {
if (child.hasAccess(uiGrid.getCommand().getTargetMode(), uiGrid.getInstance())) {
if (child instanceof AbstractMenu) {
js.append(getSubMenu((AbstractMenu) child, var)); // depends on control dependency: [if], data = [none]
} else {
js.append(var).append(".addChild(")
.append(getMenuItem(child, false))
.append(");\n"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
}
}
js.append(_parent).append(".addChild(new PopupMenuBarItem({\n")
.append("label: \"").append(StringEscapeUtils.escapeEcmaScript(_menu.getLabelProperty())).append("\",\n")
.append(" popup: ").append(var).append("\n")
.append(" }));\n");
return js;
} } |
public class class_name {
static <S extends Storable> Filter<S> build(ChainedProperty<S> property,
Filter<?> subFilter,
boolean not)
{
if (property == null) {
throw new IllegalArgumentException();
}
StorableProperty<?> joinProperty = property.getLastProperty();
if (subFilter == null) {
subFilter = Filter.getOpenFilter(joinProperty.getJoinedType());
} else if (joinProperty.getJoinedType() != subFilter.getStorableType()) {
throw new IllegalArgumentException
("Filter not compatible with join property type: " +
property + " joins to a " + joinProperty.getJoinedType().getName() +
", but filter is for a " + subFilter.getStorableType().getName());
}
if (subFilter.isClosed()) {
// Exists filter reduces to a closed (or open) filter.
Filter<S> f = Filter.getClosedFilter(property.getPrimeProperty().getEnclosingType());
return not ? f.not() : f;
} else if (joinProperty.isQuery() || subFilter.isOpen()) {
return getCanonical(property, subFilter, not);
} else {
// Convert to normal join filter.
return subFilter.asJoinedFrom(property);
}
} } | public class class_name {
static <S extends Storable> Filter<S> build(ChainedProperty<S> property,
Filter<?> subFilter,
boolean not)
{
if (property == null) {
throw new IllegalArgumentException();
}
StorableProperty<?> joinProperty = property.getLastProperty();
if (subFilter == null) {
subFilter = Filter.getOpenFilter(joinProperty.getJoinedType());
// depends on control dependency: [if], data = [none]
} else if (joinProperty.getJoinedType() != subFilter.getStorableType()) {
throw new IllegalArgumentException
("Filter not compatible with join property type: " +
property + " joins to a " + joinProperty.getJoinedType().getName() +
", but filter is for a " + subFilter.getStorableType().getName());
}
if (subFilter.isClosed()) {
// Exists filter reduces to a closed (or open) filter.
Filter<S> f = Filter.getClosedFilter(property.getPrimeProperty().getEnclosingType());
return not ? f.not() : f;
// depends on control dependency: [if], data = [none]
} else if (joinProperty.isQuery() || subFilter.isOpen()) {
return getCanonical(property, subFilter, not);
// depends on control dependency: [if], data = [none]
} else {
// Convert to normal join filter.
return subFilter.asJoinedFrom(property);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected final void copyNS(final int nodeID, SerializationHandler handler, boolean inScope)
throws SAXException
{
// %OPT% Optimization for documents which does not have any explicit
// namespace nodes. For these documents, there is an implicit
// namespace node (xmlns:xml="http://www.w3.org/XML/1998/namespace")
// declared on the root element node. In this case, there is no
// need to do namespace copying. We can safely return without
// doing anything.
if (m_namespaceDeclSetElements != null &&
m_namespaceDeclSetElements.size() == 1 &&
m_namespaceDeclSets != null &&
((SuballocatedIntVector)m_namespaceDeclSets.elementAt(0))
.size() == 1)
return;
SuballocatedIntVector nsContext = null;
int nextNSNode;
// Find the first namespace node
if (inScope) {
nsContext = findNamespaceContext(nodeID);
if (nsContext == null || nsContext.size() < 1)
return;
else
nextNSNode = makeNodeIdentity(nsContext.elementAt(0));
}
else
nextNSNode = getNextNamespaceNode2(nodeID);
int nsIndex = 1;
while (nextNSNode != DTM.NULL) {
// Retrieve the name of the namespace node
int eType = _exptype2(nextNSNode);
String nodeName = m_extendedTypes[eType].getLocalName();
// Retrieve the node value of the namespace node
int dataIndex = m_dataOrQName.elementAt(nextNSNode);
if (dataIndex < 0) {
dataIndex = -dataIndex;
dataIndex = m_data.elementAt(dataIndex + 1);
}
String nodeValue = (String)m_values.elementAt(dataIndex);
handler.namespaceAfterStartElement(nodeName, nodeValue);
if (inScope) {
if (nsIndex < nsContext.size()) {
nextNSNode = makeNodeIdentity(nsContext.elementAt(nsIndex));
nsIndex++;
}
else
return;
}
else
nextNSNode = getNextNamespaceNode2(nextNSNode);
}
} } | public class class_name {
protected final void copyNS(final int nodeID, SerializationHandler handler, boolean inScope)
throws SAXException
{
// %OPT% Optimization for documents which does not have any explicit
// namespace nodes. For these documents, there is an implicit
// namespace node (xmlns:xml="http://www.w3.org/XML/1998/namespace")
// declared on the root element node. In this case, there is no
// need to do namespace copying. We can safely return without
// doing anything.
if (m_namespaceDeclSetElements != null &&
m_namespaceDeclSetElements.size() == 1 &&
m_namespaceDeclSets != null &&
((SuballocatedIntVector)m_namespaceDeclSets.elementAt(0))
.size() == 1)
return;
SuballocatedIntVector nsContext = null;
int nextNSNode;
// Find the first namespace node
if (inScope) {
nsContext = findNamespaceContext(nodeID);
if (nsContext == null || nsContext.size() < 1)
return;
else
nextNSNode = makeNodeIdentity(nsContext.elementAt(0));
}
else
nextNSNode = getNextNamespaceNode2(nodeID);
int nsIndex = 1;
while (nextNSNode != DTM.NULL) {
// Retrieve the name of the namespace node
int eType = _exptype2(nextNSNode);
String nodeName = m_extendedTypes[eType].getLocalName();
// Retrieve the node value of the namespace node
int dataIndex = m_dataOrQName.elementAt(nextNSNode);
if (dataIndex < 0) {
dataIndex = -dataIndex; // depends on control dependency: [if], data = [none]
dataIndex = m_data.elementAt(dataIndex + 1); // depends on control dependency: [if], data = [(dataIndex]
}
String nodeValue = (String)m_values.elementAt(dataIndex);
handler.namespaceAfterStartElement(nodeName, nodeValue);
if (inScope) {
if (nsIndex < nsContext.size()) {
nextNSNode = makeNodeIdentity(nsContext.elementAt(nsIndex)); // depends on control dependency: [if], data = [(nsIndex]
nsIndex++; // depends on control dependency: [if], data = [none]
}
else
return;
}
else
nextNSNode = getNextNamespaceNode2(nextNSNode);
}
} } |
public class class_name {
public synchronized boolean removeInstance(T element) {
if (end == start) return false;
if (end == -1) {
for (int i = array.length - 1; i >= 0; --i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
}
if (end < start) {
for (int i = array.length - 1; i >= start; --i)
if (array[i] == element) {
removeAt(i);
return true;
}
for (int i = 0; i < end; ++i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
}
for (int i = start; i < end; ++i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
} } | public class class_name {
public synchronized boolean removeInstance(T element) {
if (end == start) return false;
if (end == -1) {
for (int i = array.length - 1; i >= 0; --i)
if (array[i] == element) {
removeAt(i);
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}
return false;
// depends on control dependency: [if], data = [none]
}
if (end < start) {
for (int i = array.length - 1; i >= start; --i)
if (array[i] == element) {
removeAt(i);
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}
for (int i = 0; i < end; ++i)
if (array[i] == element) {
removeAt(i);
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}
return false;
// depends on control dependency: [if], data = [none]
}
for (int i = start; i < end; ++i)
if (array[i] == element) {
removeAt(i);
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static Map<InetSocketAddress, InetSocketAddress> getAddressMap(String s) {
if (s == null) {
throw new NullPointerException("Null host list");
}
if (s.trim().equals("")) {
throw new IllegalArgumentException("No hosts in list: ``" + s + "''");
}
s = s.trim();
Map<InetSocketAddress, InetSocketAddress> result =
new LinkedHashMap<InetSocketAddress, InetSocketAddress>();
for (String hosts : s.split(" ")) {
String[] nodes = hosts.split(",");
if (nodes.length < 1) {
throw new IllegalArgumentException("Invalid server ``" + hosts + "'' in list: " + s);
}
String mainHost = nodes[0].trim();
InetSocketAddress mainAddress = getInetSocketAddress(s, mainHost);
if (nodes.length >= 2) {
InetSocketAddress standByAddress = getInetSocketAddress(s, nodes[1].trim());
result.put(mainAddress, standByAddress);
} else {
result.put(mainAddress, null);
}
}
assert !result.isEmpty() : "No addrs found";
return result;
} } | public class class_name {
public static Map<InetSocketAddress, InetSocketAddress> getAddressMap(String s) {
if (s == null) {
throw new NullPointerException("Null host list");
}
if (s.trim().equals("")) {
throw new IllegalArgumentException("No hosts in list: ``" + s + "''");
}
s = s.trim();
Map<InetSocketAddress, InetSocketAddress> result =
new LinkedHashMap<InetSocketAddress, InetSocketAddress>();
for (String hosts : s.split(" ")) {
String[] nodes = hosts.split(",");
if (nodes.length < 1) {
throw new IllegalArgumentException("Invalid server ``" + hosts + "'' in list: " + s);
}
String mainHost = nodes[0].trim();
InetSocketAddress mainAddress = getInetSocketAddress(s, mainHost);
if (nodes.length >= 2) {
InetSocketAddress standByAddress = getInetSocketAddress(s, nodes[1].trim());
result.put(mainAddress, standByAddress); // depends on control dependency: [if], data = [none]
} else {
result.put(mainAddress, null); // depends on control dependency: [if], data = [none]
}
}
assert !result.isEmpty() : "No addrs found";
return result;
} } |
public class class_name {
public JSONNavi<?> up(int level) {
while (level-- > 0) {
if (stack.size() > 0) {
current = stack.pop();
path.pop();
} else
break;
}
return this;
} } | public class class_name {
public JSONNavi<?> up(int level) {
while (level-- > 0) {
if (stack.size() > 0) {
current = stack.pop(); // depends on control dependency: [if], data = [none]
path.pop(); // depends on control dependency: [if], data = [none]
} else
break;
}
return this;
} } |
public class class_name {
@Override
public String getIssuer() {
if (issuer == null || issuer.length() == 0) {
// calculate it from the token endpoint, if we can.
if (tokenEndpoint != null && tokenEndpoint.length() > "http://".length()) {
String computedIssuer = null;
if (tokenEndpoint.toLowerCase().startsWith("http")) {
int lastpos = tokenEndpoint.lastIndexOf("/");
if (lastpos > "http://".length()) {
// if token endpoint is https://abc.com/123/token, issuer is https://abc.com/123
computedIssuer = tokenEndpoint.substring(0, lastpos);
} else {
// Token endpoint value has no other '/' characters after the URL scheme
computedIssuer = tokenEndpoint;
}
return computedIssuer;
} else {
// Token endpoint must not be a valid HTTP or HTTPS URL, so return whatever the issuer was set to originally
return issuer;
}
}
}
// couldn't compute it, or didn't need to.
return issuer;
} } | public class class_name {
@Override
public String getIssuer() {
if (issuer == null || issuer.length() == 0) {
// calculate it from the token endpoint, if we can.
if (tokenEndpoint != null && tokenEndpoint.length() > "http://".length()) {
String computedIssuer = null;
if (tokenEndpoint.toLowerCase().startsWith("http")) {
int lastpos = tokenEndpoint.lastIndexOf("/");
if (lastpos > "http://".length()) {
// if token endpoint is https://abc.com/123/token, issuer is https://abc.com/123
computedIssuer = tokenEndpoint.substring(0, lastpos);
} else {
// Token endpoint value has no other '/' characters after the URL scheme
computedIssuer = tokenEndpoint; // depends on control dependency: [if], data = [none]
}
return computedIssuer; // depends on control dependency: [if], data = [none]
} else {
// Token endpoint must not be a valid HTTP or HTTPS URL, so return whatever the issuer was set to originally
return issuer; // depends on control dependency: [if], data = [none]
}
}
}
// couldn't compute it, or didn't need to.
return issuer;
} } |
public class class_name {
public void put(E el, P pseudo, D data)
{
if (pseudo == null)
mainMap.put(el, data);
else
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
{
map = new HashMap<P, D>();
pseudoMaps.put(el, map);
}
map.put(pseudo, data);
}
} } | public class class_name {
public void put(E el, P pseudo, D data)
{
if (pseudo == null)
mainMap.put(el, data);
else
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
{
map = new HashMap<P, D>(); // depends on control dependency: [if], data = [none]
pseudoMaps.put(el, map); // depends on control dependency: [if], data = [none]
}
map.put(pseudo, data); // depends on control dependency: [if], data = [(pseudo]
}
} } |
public class class_name {
public java.util.List<DBClusterEndpoint> getDBClusterEndpoints() {
if (dBClusterEndpoints == null) {
dBClusterEndpoints = new com.amazonaws.internal.SdkInternalList<DBClusterEndpoint>();
}
return dBClusterEndpoints;
} } | public class class_name {
public java.util.List<DBClusterEndpoint> getDBClusterEndpoints() {
if (dBClusterEndpoints == null) {
dBClusterEndpoints = new com.amazonaws.internal.SdkInternalList<DBClusterEndpoint>(); // depends on control dependency: [if], data = [none]
}
return dBClusterEndpoints;
} } |
public class class_name {
protected Object execute(Invoker invoker) {
Jedis jedis = this.getResource();
try {
return invoker.execute(jedis);
}
catch (JedisConnectionException e) {
this.returnBrokenResource(jedis);
String message = this.getErrorMessage(e);
// message += " key:" + key;
throw new JedisConnectionException(message, e);
}
catch (RuntimeException e) {
this.returnBrokenResource(jedis);
throw e;
}
catch (Exception e) {
this.returnBrokenResource(jedis);
throw new RuntimeException(e.getMessage(), e);
}
finally {
// jedis.close();
this.returnResource(jedis);
}
} } | public class class_name {
protected Object execute(Invoker invoker) {
Jedis jedis = this.getResource();
try {
return invoker.execute(jedis);
// depends on control dependency: [try], data = [none]
}
catch (JedisConnectionException e) {
this.returnBrokenResource(jedis);
String message = this.getErrorMessage(e);
// message += " key:" + key;
throw new JedisConnectionException(message, e);
}
// depends on control dependency: [catch], data = [none]
catch (RuntimeException e) {
this.returnBrokenResource(jedis);
throw e;
}
// depends on control dependency: [catch], data = [none]
catch (Exception e) {
this.returnBrokenResource(jedis);
throw new RuntimeException(e.getMessage(), e);
}
// depends on control dependency: [catch], data = [none]
finally {
// jedis.close();
this.returnResource(jedis);
}
} } |
public class class_name {
public Branch addWhiteListedScheme(String urlWhiteListPattern) {
if (urlWhiteListPattern != null) {
UniversalResourceAnalyser.getInstance(context_).addToAcceptURLFormats(urlWhiteListPattern);
}
return this;
} } | public class class_name {
public Branch addWhiteListedScheme(String urlWhiteListPattern) {
if (urlWhiteListPattern != null) {
UniversalResourceAnalyser.getInstance(context_).addToAcceptURLFormats(urlWhiteListPattern); // depends on control dependency: [if], data = [(urlWhiteListPattern]
}
return this;
} } |
public class class_name {
protected void printStatus(PrintWriter os)
{
os.println("<h2>Server version = " + getServerVersion() + "</h2>");
os.println("<h2>Number of Requests Received = " + HitCounter + "</h2>");
if(track) {
int n = prArr.size();
int pending = 0;
StringBuilder preqs = new StringBuilder();
for(int i = 0; i < n; i++) {
ReqState rs = (ReqState) prArr.get(i);
RequestDebug reqD = (RequestDebug) rs.getUserObject();
if(!reqD.done) {
preqs.append("<pre>-----------------------\n");
preqs.append("Request[");
preqs.append(reqD.reqno);
preqs.append("](");
preqs.append(reqD.threadDesc);
preqs.append(") is pending.\n");
preqs.append(rs.toString());
preqs.append("</pre>");
pending++;
}
}
os.println("<h2>" + pending + " Pending Request(s)</h2>");
os.println(preqs.toString());
}
} } | public class class_name {
protected void printStatus(PrintWriter os)
{
os.println("<h2>Server version = " + getServerVersion() + "</h2>");
os.println("<h2>Number of Requests Received = " + HitCounter + "</h2>");
if(track) {
int n = prArr.size();
int pending = 0;
StringBuilder preqs = new StringBuilder();
for(int i = 0; i < n; i++) {
ReqState rs = (ReqState) prArr.get(i);
RequestDebug reqD = (RequestDebug) rs.getUserObject();
if(!reqD.done) {
preqs.append("<pre>-----------------------\n"); // depends on control dependency: [if], data = [none]
preqs.append("Request["); // depends on control dependency: [if], data = [none]
preqs.append(reqD.reqno); // depends on control dependency: [if], data = [none]
preqs.append("]("); // depends on control dependency: [if], data = [none]
preqs.append(reqD.threadDesc); // depends on control dependency: [if], data = [none]
preqs.append(") is pending.\n");
preqs.append(rs.toString()); // depends on control dependency: [if], data = [none]
preqs.append("</pre>"); // depends on control dependency: [if], data = [none]
pending++; // depends on control dependency: [if], data = [none]
}
}
os.println("<h2>" + pending + " Pending Request(s)</h2>"); // depends on control dependency: [if], data = [none]
os.println(preqs.toString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean printData(PrintWriter out, int iPrintOptions)
{
boolean bFieldsFound = false;
iPrintOptions = this.printStartGridScreenData(out, iPrintOptions);
Record record = this.getMainRecord();
if (record == null)
return bFieldsFound;
int iNumCols = this.getSFieldCount();
int iLimit = DEFAULT_LIMIT;
String strParamLimit = this.getProperty(LIMIT_PARAM); // Display screen
if ((strParamLimit != null) && (strParamLimit.length() > 0))
{
try {
iLimit = Integer.parseInt(strParamLimit);
} catch (NumberFormatException e) {
iLimit = DEFAULT_LIMIT;
}
}
int iFieldCount = 0;
for (int i = 0; i < iNumCols; i++)
{
if (!(this.getSField(i) instanceof BasePanel))
iFieldCount++;
}
if (iFieldCount > 0)
{
bFieldsFound = true;
BasePanel scrHeading = this.getReportHeading();
if (scrHeading != null)
scrHeading.printData(out, iPrintOptions | HtmlConstants.MAIN_HEADING_SCREEN);
BasePanel scrDetail = this.getReportDetail();
this.printStartRecordGridData(out, iPrintOptions);
this.printNavButtonControls(out, iPrintOptions);
// for entire data
try {
boolean bHeadingFootingExists = this.isAnyHeadingFooting();
record = this.getNextRecord(out, iPrintOptions, true, bHeadingFootingExists);
while (record != null)
{
this.printStartRecordData(record, out, iPrintOptions);
if (bHeadingFootingExists)
this.printHeadingFootingData(out, iPrintOptions | HtmlConstants.HEADING_SCREEN | HtmlConstants.DETAIL_SCREEN);
bFieldsFound = super.printData(out, (iPrintOptions & (~HtmlConstants.HTML_ADD_DESC_COLUMN)) | HtmlConstants.MAIN_SCREEN); // Don't add description
if (scrDetail != null)
scrDetail.printData(out, iPrintOptions | HtmlConstants.DETAIL_SCREEN);
Record recordNext = this.getNextRecord(out, iPrintOptions, false, bHeadingFootingExists);
this.printEndRecordData(record, out, iPrintOptions);
record = recordNext;
if (--iLimit == 0)
break; // Max rows displayed
}
} catch (DBException ex) {
ex.printStackTrace();
}
this.printEndRecordGridData(out, iPrintOptions);
BasePanel scrFooting = this.getReportFooting();
if (scrFooting != null)
scrFooting.printData(out, iPrintOptions | HtmlConstants.MAIN_FOOTING_SCREEN);
}
this.printEndGridScreenData(out, iPrintOptions);
return bFieldsFound;
} } | public class class_name {
public boolean printData(PrintWriter out, int iPrintOptions)
{
boolean bFieldsFound = false;
iPrintOptions = this.printStartGridScreenData(out, iPrintOptions);
Record record = this.getMainRecord();
if (record == null)
return bFieldsFound;
int iNumCols = this.getSFieldCount();
int iLimit = DEFAULT_LIMIT;
String strParamLimit = this.getProperty(LIMIT_PARAM); // Display screen
if ((strParamLimit != null) && (strParamLimit.length() > 0))
{
try {
iLimit = Integer.parseInt(strParamLimit); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
iLimit = DEFAULT_LIMIT;
} // depends on control dependency: [catch], data = [none]
}
int iFieldCount = 0;
for (int i = 0; i < iNumCols; i++)
{
if (!(this.getSField(i) instanceof BasePanel))
iFieldCount++;
}
if (iFieldCount > 0)
{
bFieldsFound = true; // depends on control dependency: [if], data = [none]
BasePanel scrHeading = this.getReportHeading();
if (scrHeading != null)
scrHeading.printData(out, iPrintOptions | HtmlConstants.MAIN_HEADING_SCREEN);
BasePanel scrDetail = this.getReportDetail();
this.printStartRecordGridData(out, iPrintOptions); // depends on control dependency: [if], data = [none]
this.printNavButtonControls(out, iPrintOptions); // depends on control dependency: [if], data = [none]
// for entire data
try {
boolean bHeadingFootingExists = this.isAnyHeadingFooting();
record = this.getNextRecord(out, iPrintOptions, true, bHeadingFootingExists); // depends on control dependency: [try], data = [none]
while (record != null)
{
this.printStartRecordData(record, out, iPrintOptions); // depends on control dependency: [while], data = [(record]
if (bHeadingFootingExists)
this.printHeadingFootingData(out, iPrintOptions | HtmlConstants.HEADING_SCREEN | HtmlConstants.DETAIL_SCREEN);
bFieldsFound = super.printData(out, (iPrintOptions & (~HtmlConstants.HTML_ADD_DESC_COLUMN)) | HtmlConstants.MAIN_SCREEN); // Don't add description // depends on control dependency: [while], data = [none]
if (scrDetail != null)
scrDetail.printData(out, iPrintOptions | HtmlConstants.DETAIL_SCREEN);
Record recordNext = this.getNextRecord(out, iPrintOptions, false, bHeadingFootingExists);
this.printEndRecordData(record, out, iPrintOptions); // depends on control dependency: [while], data = [(record]
record = recordNext; // depends on control dependency: [while], data = [none]
if (--iLimit == 0)
break; // Max rows displayed
}
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
this.printEndRecordGridData(out, iPrintOptions); // depends on control dependency: [if], data = [none]
BasePanel scrFooting = this.getReportFooting();
if (scrFooting != null)
scrFooting.printData(out, iPrintOptions | HtmlConstants.MAIN_FOOTING_SCREEN);
}
this.printEndGridScreenData(out, iPrintOptions);
return bFieldsFound;
} } |
public class class_name {
public ListenableFuture<Map<JobId, Job>> jobs(@Nullable final String jobQuery,
@Nullable final String hostNamePattern) {
final Map<String, String> params = new HashMap<>();
if (!Strings.isNullOrEmpty(jobQuery)) {
params.put("q", jobQuery);
}
if (!Strings.isNullOrEmpty(hostNamePattern)) {
params.put("hostPattern", hostNamePattern);
}
return get(uri("/jobs", params), jobIdMap);
} } | public class class_name {
public ListenableFuture<Map<JobId, Job>> jobs(@Nullable final String jobQuery,
@Nullable final String hostNamePattern) {
final Map<String, String> params = new HashMap<>();
if (!Strings.isNullOrEmpty(jobQuery)) {
params.put("q", jobQuery); // depends on control dependency: [if], data = [none]
}
if (!Strings.isNullOrEmpty(hostNamePattern)) {
params.put("hostPattern", hostNamePattern); // depends on control dependency: [if], data = [none]
}
return get(uri("/jobs", params), jobIdMap);
} } |
public class class_name {
public static void addParameter(Map<String, String[]> parameters, String name, String value, boolean overwrite) {
// No null values allowed in parameters
if ((parameters == null) || (name == null) || (value == null)) {
return;
}
// Check if the parameter name (key) exists
if (parameters.containsKey(name) && (!overwrite)) {
// Yes: Check name values if value exists, if so do nothing, else add new value
String[] values = parameters.get(name);
String[] newValues = new String[values.length + 1];
System.arraycopy(values, 0, newValues, 0, values.length);
newValues[values.length] = value;
parameters.put(name, newValues);
} else {
// No: Add new parameter name / value pair
String[] values = new String[] {value};
parameters.put(name, values);
}
} } | public class class_name {
public static void addParameter(Map<String, String[]> parameters, String name, String value, boolean overwrite) {
// No null values allowed in parameters
if ((parameters == null) || (name == null) || (value == null)) {
return; // depends on control dependency: [if], data = [none]
}
// Check if the parameter name (key) exists
if (parameters.containsKey(name) && (!overwrite)) {
// Yes: Check name values if value exists, if so do nothing, else add new value
String[] values = parameters.get(name);
String[] newValues = new String[values.length + 1];
System.arraycopy(values, 0, newValues, 0, values.length); // depends on control dependency: [if], data = [none]
newValues[values.length] = value; // depends on control dependency: [if], data = [none]
parameters.put(name, newValues); // depends on control dependency: [if], data = [none]
} else {
// No: Add new parameter name / value pair
String[] values = new String[] {value};
parameters.put(name, values); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public @Nonnull XQuery get(String xpath) {
NodeList nl = evaluate(xpath);
if (nl.getLength() == 1) {
return new XQuery(nl.item(0));
} else if (nl.getLength() == 0) {
throw new IllegalArgumentException("XPath '" + xpath
+ "' does not match any elements");
} else {
throw new IllegalArgumentException("XPath '" + xpath + "' matches "
+ nl.getLength() + " elements");
}
} } | public class class_name {
public @Nonnull XQuery get(String xpath) {
NodeList nl = evaluate(xpath);
if (nl.getLength() == 1) {
return new XQuery(nl.item(0)); // depends on control dependency: [if], data = [none]
} else if (nl.getLength() == 0) {
throw new IllegalArgumentException("XPath '" + xpath
+ "' does not match any elements");
} else {
throw new IllegalArgumentException("XPath '" + xpath + "' matches "
+ nl.getLength() + " elements");
}
} } |
public class class_name {
private List<String> buildLaunchTaskArgs(TaskControllerContext context) {
List<String> commandArgs = new ArrayList<String>(3);
String taskId = context.task.getTaskID().toString();
String jobId = getJobId(context);
LOG.debug("getting the task directory as: "
+ getTaskCacheDirectory(context));
commandArgs.add(getDirectoryChosenForTask(
new File(getTaskCacheDirectory(context)),
context));
commandArgs.add(jobId);
if(!context.task.isTaskCleanupTask()) {
commandArgs.add(taskId);
}else {
commandArgs.add(taskId + TaskTracker.TASK_CLEANUP_SUFFIX);
}
return commandArgs;
} } | public class class_name {
private List<String> buildLaunchTaskArgs(TaskControllerContext context) {
List<String> commandArgs = new ArrayList<String>(3);
String taskId = context.task.getTaskID().toString();
String jobId = getJobId(context);
LOG.debug("getting the task directory as: "
+ getTaskCacheDirectory(context));
commandArgs.add(getDirectoryChosenForTask(
new File(getTaskCacheDirectory(context)),
context));
commandArgs.add(jobId);
if(!context.task.isTaskCleanupTask()) {
commandArgs.add(taskId); // depends on control dependency: [if], data = [none]
}else {
commandArgs.add(taskId + TaskTracker.TASK_CLEANUP_SUFFIX); // depends on control dependency: [if], data = [none]
}
return commandArgs;
} } |
public class class_name {
public long getTotalCalls(IoEventType type) {
switch (type) {
case MESSAGE_RECEIVED :
if (profileMessageReceived) {
return messageReceivedTimerWorker.getCallsNumber();
}
break;
case MESSAGE_SENT :
if (profileMessageSent) {
return messageSentTimerWorker.getCallsNumber();
}
break;
case SESSION_CREATED :
if (profileSessionCreated) {
return sessionCreatedTimerWorker.getCallsNumber();
}
break;
case SESSION_OPENED :
if (profileSessionOpened) {
return sessionOpenedTimerWorker.getCallsNumber();
}
break;
case SESSION_IDLE :
if (profileSessionIdle) {
return sessionIdleTimerWorker.getCallsNumber();
}
break;
case SESSION_CLOSED :
if (profileSessionClosed) {
return sessionClosedTimerWorker.getCallsNumber();
}
break;
}
throw new IllegalArgumentException(
"You are not monitoring this event. Please add this event first.");
} } | public class class_name {
public long getTotalCalls(IoEventType type) {
switch (type) {
case MESSAGE_RECEIVED :
if (profileMessageReceived) {
return messageReceivedTimerWorker.getCallsNumber(); // depends on control dependency: [if], data = [none]
}
break;
case MESSAGE_SENT :
if (profileMessageSent) {
return messageSentTimerWorker.getCallsNumber(); // depends on control dependency: [if], data = [none]
}
break;
case SESSION_CREATED :
if (profileSessionCreated) {
return sessionCreatedTimerWorker.getCallsNumber(); // depends on control dependency: [if], data = [none]
}
break;
case SESSION_OPENED :
if (profileSessionOpened) {
return sessionOpenedTimerWorker.getCallsNumber(); // depends on control dependency: [if], data = [none]
}
break;
case SESSION_IDLE :
if (profileSessionIdle) {
return sessionIdleTimerWorker.getCallsNumber(); // depends on control dependency: [if], data = [none]
}
break;
case SESSION_CLOSED :
if (profileSessionClosed) {
return sessionClosedTimerWorker.getCallsNumber(); // depends on control dependency: [if], data = [none]
}
break;
}
throw new IllegalArgumentException(
"You are not monitoring this event. Please add this event first.");
} } |
public class class_name {
public void pushTransform() {
predraw();
FloatBuffer buffer;
if (stackIndex >= stack.size()) {
buffer = BufferUtils.createFloatBuffer(18);
stack.add(buffer);
} else {
buffer = (FloatBuffer) stack.get(stackIndex);
}
GL.glGetFloat(SGL.GL_MODELVIEW_MATRIX, buffer);
buffer.put(16, sx);
buffer.put(17, sy);
stackIndex++;
postdraw();
} } | public class class_name {
public void pushTransform() {
predraw();
FloatBuffer buffer;
if (stackIndex >= stack.size()) {
buffer = BufferUtils.createFloatBuffer(18);
// depends on control dependency: [if], data = [none]
stack.add(buffer);
// depends on control dependency: [if], data = [none]
} else {
buffer = (FloatBuffer) stack.get(stackIndex);
// depends on control dependency: [if], data = [(stackIndex]
}
GL.glGetFloat(SGL.GL_MODELVIEW_MATRIX, buffer);
buffer.put(16, sx);
buffer.put(17, sy);
stackIndex++;
postdraw();
} } |
public class class_name {
public Signature replaceArg(String oldName, String newName, Class<?> newType) {
int offset = argOffset(oldName);
String[] newArgNames = argNames;
if (!oldName.equals(newName)) {
newArgNames = Arrays.copyOf(argNames, argNames.length);
newArgNames[offset] = newName;
}
Class<?> oldType = methodType.parameterType(offset);
MethodType newMethodType = methodType;
if (!oldType.equals(newType)) newMethodType = methodType.changeParameterType(offset, newType);
return new Signature(newMethodType, newArgNames);
} } | public class class_name {
public Signature replaceArg(String oldName, String newName, Class<?> newType) {
int offset = argOffset(oldName);
String[] newArgNames = argNames;
if (!oldName.equals(newName)) {
newArgNames = Arrays.copyOf(argNames, argNames.length); // depends on control dependency: [if], data = [none]
newArgNames[offset] = newName; // depends on control dependency: [if], data = [none]
}
Class<?> oldType = methodType.parameterType(offset);
MethodType newMethodType = methodType;
if (!oldType.equals(newType)) newMethodType = methodType.changeParameterType(offset, newType);
return new Signature(newMethodType, newArgNames);
} } |
public class class_name {
public Integer remove(Object objectKey)
{
K key = (K) objectKey;
int keyHashCode = key.hashCode();
int hash1 = hash1(keyHashCode);
int index1 = indexFor(hash1);
Entry<K> entry = hashTable[index1];
if ((entry != null) && key.equals(entry.key))
{
hashTable[index1] = null;
return entry.seq;
}
int hash2 = hash2(hash1, keyHashCode);
int index2 = indexFor(hash2);
entry = hashTable[index2];
if ((entry != null) && key.equals(entry.key))
{
hashTable[index2] = null;
return entry.seq;
}
return null;
} } | public class class_name {
public Integer remove(Object objectKey)
{
K key = (K) objectKey;
int keyHashCode = key.hashCode();
int hash1 = hash1(keyHashCode);
int index1 = indexFor(hash1);
Entry<K> entry = hashTable[index1];
if ((entry != null) && key.equals(entry.key))
{
hashTable[index1] = null; // depends on control dependency: [if], data = [none]
return entry.seq; // depends on control dependency: [if], data = [none]
}
int hash2 = hash2(hash1, keyHashCode);
int index2 = indexFor(hash2);
entry = hashTable[index2];
if ((entry != null) && key.equals(entry.key))
{
hashTable[index2] = null; // depends on control dependency: [if], data = [none]
return entry.seq; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public String[] get_keyword_arguments(String keyword) {
if (keyword.equalsIgnoreCase("stop_remote_server")) {
return new String[0];
}
try {
String[] args = servlet.getLibrary().getKeywordArguments(keyword);
return args == null ? new String[0] : args;
} catch (Throwable e) {
log.warn("", e);
throw new RuntimeException(e);
}
} } | public class class_name {
public String[] get_keyword_arguments(String keyword) {
if (keyword.equalsIgnoreCase("stop_remote_server")) {
return new String[0]; // depends on control dependency: [if], data = [none]
}
try {
String[] args = servlet.getLibrary().getKeywordArguments(keyword);
return args == null ? new String[0] : args; // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
log.warn("", e);
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final String getClientUUID()
{
if (null == m_cliuuid)
{
if (LocalStorage.get().isSupported())
{
m_cliuuid = StringOps.toTrimOrNull(LocalStorage.get().getString(X_CLIENT_UUID_HEADER));
}
if (null == m_cliuuid)
{
m_cliuuid = StringOps.toTrimOrNull(ClientStorage.get().getString(X_CLIENT_UUID_HEADER));
}
if (null == m_cliuuid)
{
m_cliuuid = UUID.uuid();
if (LocalStorage.get().isSupported())
{
LocalStorage.get().putString(X_CLIENT_UUID_HEADER, m_cliuuid);
}
else
{
ClientStorage.get().putString(X_CLIENT_UUID_HEADER, m_cliuuid);
}
}
else
{
final String temp = XSS.get().clean(m_cliuuid);
if (false == temp.equals(m_cliuuid))
{
m_cliuuid = temp;
if (LocalStorage.get().isSupported())
{
LocalStorage.get().putString(X_CLIENT_UUID_HEADER, m_cliuuid);
}
else
{
ClientStorage.get().putString(X_CLIENT_UUID_HEADER, m_cliuuid);
}
}
}
}
return m_cliuuid;
} } | public class class_name {
public final String getClientUUID()
{
if (null == m_cliuuid)
{
if (LocalStorage.get().isSupported())
{
m_cliuuid = StringOps.toTrimOrNull(LocalStorage.get().getString(X_CLIENT_UUID_HEADER)); // depends on control dependency: [if], data = [none]
}
if (null == m_cliuuid)
{
m_cliuuid = StringOps.toTrimOrNull(ClientStorage.get().getString(X_CLIENT_UUID_HEADER)); // depends on control dependency: [if], data = [none]
}
if (null == m_cliuuid)
{
m_cliuuid = UUID.uuid(); // depends on control dependency: [if], data = [none]
if (LocalStorage.get().isSupported())
{
LocalStorage.get().putString(X_CLIENT_UUID_HEADER, m_cliuuid); // depends on control dependency: [if], data = [none]
}
else
{
ClientStorage.get().putString(X_CLIENT_UUID_HEADER, m_cliuuid); // depends on control dependency: [if], data = [none]
}
}
else
{
final String temp = XSS.get().clean(m_cliuuid);
if (false == temp.equals(m_cliuuid))
{
m_cliuuid = temp; // depends on control dependency: [if], data = [none]
if (LocalStorage.get().isSupported())
{
LocalStorage.get().putString(X_CLIENT_UUID_HEADER, m_cliuuid); // depends on control dependency: [if], data = [none]
}
else
{
ClientStorage.get().putString(X_CLIENT_UUID_HEADER, m_cliuuid); // depends on control dependency: [if], data = [none]
}
}
}
}
return m_cliuuid;
} } |
public class class_name {
private static List<TextBlock> extractAllDuplicatedTextBlocks(Iterable<Duplication> duplications) {
List<TextBlock> duplicatedBlock = new ArrayList<>(size(duplications));
for (Duplication duplication : duplications) {
duplicatedBlock.add(duplication.getOriginal());
for (InnerDuplicate duplicate : from(duplication.getDuplicates()).filter(InnerDuplicate.class)) {
duplicatedBlock.add(duplicate.getTextBlock());
}
}
return duplicatedBlock;
} } | public class class_name {
private static List<TextBlock> extractAllDuplicatedTextBlocks(Iterable<Duplication> duplications) {
List<TextBlock> duplicatedBlock = new ArrayList<>(size(duplications));
for (Duplication duplication : duplications) {
duplicatedBlock.add(duplication.getOriginal()); // depends on control dependency: [for], data = [duplication]
for (InnerDuplicate duplicate : from(duplication.getDuplicates()).filter(InnerDuplicate.class)) {
duplicatedBlock.add(duplicate.getTextBlock()); // depends on control dependency: [for], data = [duplicate]
}
}
return duplicatedBlock;
} } |
public class class_name {
private int[] readTypeAnnotations(
final MethodVisitor methodVisitor,
final Context context,
final int runtimeTypeAnnotationsOffset,
final boolean visible) {
char[] charBuffer = context.charBuffer;
int currentOffset = runtimeTypeAnnotationsOffset;
// Read the num_annotations field and create an array to store the type_annotation offsets.
int[] typeAnnotationsOffsets = new int[readUnsignedShort(currentOffset)];
currentOffset += 2;
// Parse the 'annotations' array field.
for (int i = 0; i < typeAnnotationsOffsets.length; ++i) {
typeAnnotationsOffsets[i] = currentOffset;
// Parse the type_annotation's target_type and the target_info fields. The size of the
// target_info field depends on the value of target_type.
int targetType = readInt(currentOffset);
switch (targetType >>> 24) {
case TypeReference.LOCAL_VARIABLE:
case TypeReference.RESOURCE_VARIABLE:
// A localvar_target has a variable size, which depends on the value of their table_length
// field. It also references bytecode offsets, for which we need labels.
int tableLength = readUnsignedShort(currentOffset + 1);
currentOffset += 3;
while (tableLength-- > 0) {
int startPc = readUnsignedShort(currentOffset);
int length = readUnsignedShort(currentOffset + 2);
// Skip the index field (2 bytes).
currentOffset += 6;
createLabel(startPc, context.currentMethodLabels);
createLabel(startPc + length, context.currentMethodLabels);
}
break;
case TypeReference.CAST:
case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT:
case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT:
currentOffset += 4;
break;
case TypeReference.CLASS_EXTENDS:
case TypeReference.CLASS_TYPE_PARAMETER_BOUND:
case TypeReference.METHOD_TYPE_PARAMETER_BOUND:
case TypeReference.THROWS:
case TypeReference.EXCEPTION_PARAMETER:
case TypeReference.INSTANCEOF:
case TypeReference.NEW:
case TypeReference.CONSTRUCTOR_REFERENCE:
case TypeReference.METHOD_REFERENCE:
currentOffset += 3;
break;
case TypeReference.CLASS_TYPE_PARAMETER:
case TypeReference.METHOD_TYPE_PARAMETER:
case TypeReference.METHOD_FORMAL_PARAMETER:
case TypeReference.FIELD:
case TypeReference.METHOD_RETURN:
case TypeReference.METHOD_RECEIVER:
default:
// TypeReference type which can't be used in Code attribute, or which is unknown.
throw new IllegalArgumentException();
}
// Parse the rest of the type_annotation structure, starting with the target_path structure
// (whose size depends on its path_length field).
int pathLength = readByte(currentOffset);
if ((targetType >>> 24) == TypeReference.EXCEPTION_PARAMETER) {
// Parse the target_path structure and create a corresponding TypePath.
TypePath path = pathLength == 0 ? null : new TypePath(b, currentOffset);
currentOffset += 1 + 2 * pathLength;
// Parse the type_index field.
String annotationDescriptor = readUTF8(currentOffset, charBuffer);
currentOffset += 2;
// Parse num_element_value_pairs and element_value_pairs and visit these values.
currentOffset =
readElementValues(
methodVisitor.visitTryCatchAnnotation(
targetType & 0xFFFFFF00, path, annotationDescriptor, visible),
currentOffset,
/* named = */ true,
charBuffer);
} else {
// We don't want to visit the other target_type annotations, so we just skip them (which
// requires some parsing because the element_value_pairs array has a variable size). First,
// skip the target_path structure:
currentOffset += 3 + 2 * pathLength;
// Then skip the num_element_value_pairs and element_value_pairs fields (by reading them
// with a null AnnotationVisitor).
currentOffset =
readElementValues(
/* annotationVisitor = */ null, currentOffset, /* named = */ true, charBuffer);
}
}
return typeAnnotationsOffsets;
} } | public class class_name {
private int[] readTypeAnnotations(
final MethodVisitor methodVisitor,
final Context context,
final int runtimeTypeAnnotationsOffset,
final boolean visible) {
char[] charBuffer = context.charBuffer;
int currentOffset = runtimeTypeAnnotationsOffset;
// Read the num_annotations field and create an array to store the type_annotation offsets.
int[] typeAnnotationsOffsets = new int[readUnsignedShort(currentOffset)];
currentOffset += 2;
// Parse the 'annotations' array field.
for (int i = 0; i < typeAnnotationsOffsets.length; ++i) {
typeAnnotationsOffsets[i] = currentOffset; // depends on control dependency: [for], data = [i]
// Parse the type_annotation's target_type and the target_info fields. The size of the
// target_info field depends on the value of target_type.
int targetType = readInt(currentOffset);
switch (targetType >>> 24) {
case TypeReference.LOCAL_VARIABLE:
case TypeReference.RESOURCE_VARIABLE:
// A localvar_target has a variable size, which depends on the value of their table_length
// field. It also references bytecode offsets, for which we need labels.
int tableLength = readUnsignedShort(currentOffset + 1);
currentOffset += 3; // depends on control dependency: [for], data = [none]
while (tableLength-- > 0) {
int startPc = readUnsignedShort(currentOffset);
int length = readUnsignedShort(currentOffset + 2);
// Skip the index field (2 bytes).
currentOffset += 6; // depends on control dependency: [while], data = [none]
createLabel(startPc, context.currentMethodLabels); // depends on control dependency: [while], data = [none]
createLabel(startPc + length, context.currentMethodLabels); // depends on control dependency: [while], data = [none]
}
break;
case TypeReference.CAST:
case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT:
case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT:
currentOffset += 4;
break;
case TypeReference.CLASS_EXTENDS:
case TypeReference.CLASS_TYPE_PARAMETER_BOUND:
case TypeReference.METHOD_TYPE_PARAMETER_BOUND:
case TypeReference.THROWS:
case TypeReference.EXCEPTION_PARAMETER:
case TypeReference.INSTANCEOF:
case TypeReference.NEW:
case TypeReference.CONSTRUCTOR_REFERENCE:
case TypeReference.METHOD_REFERENCE:
currentOffset += 3;
break;
case TypeReference.CLASS_TYPE_PARAMETER:
case TypeReference.METHOD_TYPE_PARAMETER:
case TypeReference.METHOD_FORMAL_PARAMETER:
case TypeReference.FIELD:
case TypeReference.METHOD_RETURN:
case TypeReference.METHOD_RECEIVER:
default:
// TypeReference type which can't be used in Code attribute, or which is unknown.
throw new IllegalArgumentException();
}
// Parse the rest of the type_annotation structure, starting with the target_path structure
// (whose size depends on its path_length field).
int pathLength = readByte(currentOffset);
if ((targetType >>> 24) == TypeReference.EXCEPTION_PARAMETER) {
// Parse the target_path structure and create a corresponding TypePath.
TypePath path = pathLength == 0 ? null : new TypePath(b, currentOffset);
currentOffset += 1 + 2 * pathLength; // depends on control dependency: [if], data = [none]
// Parse the type_index field.
String annotationDescriptor = readUTF8(currentOffset, charBuffer);
currentOffset += 2; // depends on control dependency: [if], data = [none]
// Parse num_element_value_pairs and element_value_pairs and visit these values.
currentOffset =
readElementValues(
methodVisitor.visitTryCatchAnnotation(
targetType & 0xFFFFFF00, path, annotationDescriptor, visible),
currentOffset,
/* named = */ true,
charBuffer); // depends on control dependency: [if], data = [none]
} else {
// We don't want to visit the other target_type annotations, so we just skip them (which
// requires some parsing because the element_value_pairs array has a variable size). First,
// skip the target_path structure:
currentOffset += 3 + 2 * pathLength; // depends on control dependency: [if], data = [none]
// Then skip the num_element_value_pairs and element_value_pairs fields (by reading them
// with a null AnnotationVisitor).
currentOffset =
readElementValues(
/* annotationVisitor = */ null, currentOffset, /* named = */ true, charBuffer); // depends on control dependency: [if], data = [none]
}
}
return typeAnnotationsOffsets;
} } |
public class class_name {
static public String actualTypeParametersString( TypeElement type )
{
List<? extends TypeParameterElement> typeParameters = type.getTypeParameters();
if( typeParameters.isEmpty() )
{
return "";
}
else
{
StringBuilder sb = new StringBuilder();
sb.append( "<" );
String sep = "";
for( TypeParameterElement typeP : typeParameters )
{
sb.append( sep );
sep = ", ";
sb.append( typeP.getSimpleName() );
}
sb.append( ">" );
return sb.toString();
}
} } | public class class_name {
static public String actualTypeParametersString( TypeElement type )
{
List<? extends TypeParameterElement> typeParameters = type.getTypeParameters();
if( typeParameters.isEmpty() )
{
return ""; // depends on control dependency: [if], data = [none]
}
else
{
StringBuilder sb = new StringBuilder();
sb.append( "<" ); // depends on control dependency: [if], data = [none]
String sep = "";
for( TypeParameterElement typeP : typeParameters )
{
sb.append( sep ); // depends on control dependency: [for], data = [none]
sep = ", "; // depends on control dependency: [for], data = [none]
sb.append( typeP.getSimpleName() ); // depends on control dependency: [for], data = [typeP]
}
sb.append( ">" ); // depends on control dependency: [if], data = [none]
return sb.toString(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<ResourceImpl> getMultiReference(String name) {
ReferenceModel reference = resourceModel.getReference(name);
if (reference == null) {
throw new IllegalArgumentException("No reference named " + name);
}
Map<String, Object> sharedIds = new HashMap<>();
if (reference.getIdentifierMappings() != null) {
for (FlatMapping mapping : reference.getIdentifierMappings()) {
Object value = identifiers.get(mapping.getSource());
if (value == null) {
throw new IllegalStateException(
"The " + name + " reference model has a mapping "
+ "for the " + mapping.getSource() + " identifier, "
+ "but this resource doesn't have an identifier of "
+ "that name!");
}
sharedIds.put(mapping.getTarget(), value);
}
}
Map<String, List<?>> ids = new HashMap<>();
int listSize = -1;
if (reference.getAttributeMappings() != null) {
for (PathSourceMapping mapping
: reference.getAttributeMappings()) {
if (mapping.isMultiValued()) {
List<?> value =
(List<?>) getAttributeDataByPath(mapping.getSource());
if (listSize < 0) {
listSize = value.size();
} else {
if (listSize != value.size()) {
throw new IllegalStateException(
"List size mismatch! " + listSize + " vs "
+ value.size());
}
}
ids.put(mapping.getTarget(), value);
} else {
Object value = getAttributeDataByPath(mapping.getSource());
sharedIds.put(mapping.getTarget(), value);
}
}
}
if (listSize == 0) {
return Collections.emptyList();
}
ResourceModel refTypeModel =
serviceModel.getResource(reference.getType());
List<ResourceImpl> rval = new ArrayList<>(listSize);
for (int i = 0; i < listSize; ++i) {
Map<String, Object> myIds = new HashMap<>(sharedIds);
for (Map.Entry<String, List<?>> entry : ids.entrySet()) {
myIds.put(entry.getKey(), entry.getValue().get(i));
}
rval.add(new ResourceImpl(
serviceModel, refTypeModel, client, myIds));
}
return Collections.unmodifiableList(rval);
} } | public class class_name {
public List<ResourceImpl> getMultiReference(String name) {
ReferenceModel reference = resourceModel.getReference(name);
if (reference == null) {
throw new IllegalArgumentException("No reference named " + name);
}
Map<String, Object> sharedIds = new HashMap<>();
if (reference.getIdentifierMappings() != null) {
for (FlatMapping mapping : reference.getIdentifierMappings()) {
Object value = identifiers.get(mapping.getSource());
if (value == null) {
throw new IllegalStateException(
"The " + name + " reference model has a mapping "
+ "for the " + mapping.getSource() + " identifier, "
+ "but this resource doesn't have an identifier of "
+ "that name!");
}
sharedIds.put(mapping.getTarget(), value); // depends on control dependency: [for], data = [mapping]
}
}
Map<String, List<?>> ids = new HashMap<>();
int listSize = -1;
if (reference.getAttributeMappings() != null) {
for (PathSourceMapping mapping
: reference.getAttributeMappings()) {
if (mapping.isMultiValued()) {
List<?> value =
(List<?>) getAttributeDataByPath(mapping.getSource());
if (listSize < 0) {
listSize = value.size(); // depends on control dependency: [if], data = [none]
} else {
if (listSize != value.size()) {
throw new IllegalStateException(
"List size mismatch! " + listSize + " vs "
+ value.size());
}
}
ids.put(mapping.getTarget(), value); // depends on control dependency: [if], data = [none]
} else {
Object value = getAttributeDataByPath(mapping.getSource());
sharedIds.put(mapping.getTarget(), value); // depends on control dependency: [if], data = [none]
}
}
}
if (listSize == 0) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
ResourceModel refTypeModel =
serviceModel.getResource(reference.getType());
List<ResourceImpl> rval = new ArrayList<>(listSize);
for (int i = 0; i < listSize; ++i) {
Map<String, Object> myIds = new HashMap<>(sharedIds);
for (Map.Entry<String, List<?>> entry : ids.entrySet()) {
myIds.put(entry.getKey(), entry.getValue().get(i));
}
rval.add(new ResourceImpl(
serviceModel, refTypeModel, client, myIds));
}
return Collections.unmodifiableList(rval);
} } |
public class class_name {
public static byte[] toArray(ByteBuffer bytebuffer) {
if (false == bytebuffer.hasArray()) {
int oldPosition = bytebuffer.position();
bytebuffer.position(0);
int size = bytebuffer.limit();
byte[] buffers = new byte[size];
bytebuffer.get(buffers);
bytebuffer.position(oldPosition);
return buffers;
} else {
return Arrays.copyOfRange(bytebuffer.array(), bytebuffer.position(), bytebuffer.limit());
}
} } | public class class_name {
public static byte[] toArray(ByteBuffer bytebuffer) {
if (false == bytebuffer.hasArray()) {
int oldPosition = bytebuffer.position();
bytebuffer.position(0);
// depends on control dependency: [if], data = [none]
int size = bytebuffer.limit();
byte[] buffers = new byte[size];
bytebuffer.get(buffers);
// depends on control dependency: [if], data = [none]
bytebuffer.position(oldPosition);
// depends on control dependency: [if], data = [none]
return buffers;
// depends on control dependency: [if], data = [none]
} else {
return Arrays.copyOfRange(bytebuffer.array(), bytebuffer.position(), bytebuffer.limit());
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private int readAhead(Map<String, Field> fieldsFromLogLine, StringBuilder stackTrace)
throws DataParserException, IOException {
StringBuilder multilineLog = new StringBuilder();
int read = readLine(multilineLog);
int numberOfLinesRead = 0;
while (read > -1) {
try {
Map<String, Field> stringFieldMap = parseLogLine(multilineLog);
fieldsFromLogLine.putAll(stringFieldMap);
currentLine.append(multilineLog);
//If the line can be parsed successfully, do not read further
//This line will be used in the current record if this is the first line being read
//or stored for the next round if there is a line from the previous round.
break;
} catch (DataParserException e) {
//is this the first line being read? Yes -> throw exception
if (previousLine.length() == 0 || maxStackTraceLines == -1) {
throw e;
}
//otherwise read until we get a line that matches pattern
if(numberOfLinesRead < maxStackTraceLines) {
if(numberOfLinesRead != 0) {
stackTrace.append("\n");
}
stackTrace.append(multilineLog.toString());
}
numberOfLinesRead++;
multilineLog.setLength(0);
read = readLine(multilineLog);
}
}
return read;
} } | public class class_name {
private int readAhead(Map<String, Field> fieldsFromLogLine, StringBuilder stackTrace)
throws DataParserException, IOException {
StringBuilder multilineLog = new StringBuilder();
int read = readLine(multilineLog);
int numberOfLinesRead = 0;
while (read > -1) {
try {
Map<String, Field> stringFieldMap = parseLogLine(multilineLog);
fieldsFromLogLine.putAll(stringFieldMap); // depends on control dependency: [try], data = [none]
currentLine.append(multilineLog); // depends on control dependency: [try], data = [none]
//If the line can be parsed successfully, do not read further
//This line will be used in the current record if this is the first line being read
//or stored for the next round if there is a line from the previous round.
break;
} catch (DataParserException e) {
//is this the first line being read? Yes -> throw exception
if (previousLine.length() == 0 || maxStackTraceLines == -1) {
throw e;
}
//otherwise read until we get a line that matches pattern
if(numberOfLinesRead < maxStackTraceLines) {
if(numberOfLinesRead != 0) {
stackTrace.append("\n"); // depends on control dependency: [if], data = [none]
}
stackTrace.append(multilineLog.toString()); // depends on control dependency: [if], data = [none]
}
numberOfLinesRead++;
multilineLog.setLength(0);
read = readLine(multilineLog);
} // depends on control dependency: [catch], data = [none]
}
return read;
} } |
public class class_name {
public static BigDecimal roundUpTo(double value, double steps) {
final BigDecimal bValue = BigDecimal.valueOf(value);
final BigDecimal bSteps = BigDecimal.valueOf(steps);
if (Objects.equals(bSteps, BigDecimal.ZERO)) {
return bValue;
} else {
return bValue.divide(bSteps, 0, RoundingMode.CEILING).multiply(bSteps);
}
} } | public class class_name {
public static BigDecimal roundUpTo(double value, double steps) {
final BigDecimal bValue = BigDecimal.valueOf(value);
final BigDecimal bSteps = BigDecimal.valueOf(steps);
if (Objects.equals(bSteps, BigDecimal.ZERO)) {
return bValue; // depends on control dependency: [if], data = [none]
} else {
return bValue.divide(bSteps, 0, RoundingMode.CEILING).multiply(bSteps); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public Geldbetrag stripTrailingZeros() {
if (isZero()) {
return valueOf(BigDecimal.ZERO, getCurrency());
}
return valueOf(betrag.stripTrailingZeros(), getCurrency(), context);
} } | public class class_name {
@Override
public Geldbetrag stripTrailingZeros() {
if (isZero()) {
return valueOf(BigDecimal.ZERO, getCurrency()); // depends on control dependency: [if], data = [none]
}
return valueOf(betrag.stripTrailingZeros(), getCurrency(), context);
} } |
public class class_name {
public static void copy( File fileOrDirectory, File toDir )
{
File copy = new File( toDir, fileOrDirectory.getName() );
if( fileOrDirectory.isDirectory() )
{
//noinspection ResultOfMethodCallIgnored
copy.mkdir();
for( File child : fileOrDirectory.listFiles() )
{
copy( child, copy );
}
}
else
{
//noinspection ResultOfMethodCallIgnored
try( InputStream is = new BufferedInputStream( new FileInputStream( fileOrDirectory ) );
OutputStream os = new BufferedOutputStream( new FileOutputStream( copy ) ) )
{
StreamUtil.copy( is, os );
}
catch( Exception e )
{
throw new RuntimeException( e );
}
}
} } | public class class_name {
public static void copy( File fileOrDirectory, File toDir )
{
File copy = new File( toDir, fileOrDirectory.getName() );
if( fileOrDirectory.isDirectory() )
{
//noinspection ResultOfMethodCallIgnored
copy.mkdir(); // depends on control dependency: [if], data = [none]
for( File child : fileOrDirectory.listFiles() )
{
copy( child, copy ); // depends on control dependency: [for], data = [child]
}
}
else
{
//noinspection ResultOfMethodCallIgnored
try( InputStream is = new BufferedInputStream( new FileInputStream( fileOrDirectory ) );
OutputStream os = new BufferedOutputStream( new FileOutputStream( copy ) ) )
{
StreamUtil.copy( is, os );
}
catch( Exception e )
{
throw new RuntimeException( e );
}
}
} } |
public class class_name {
@Override
public EClass getIfcDerivedMeasureValue() {
if (ifcDerivedMeasureValueEClass == null) {
ifcDerivedMeasureValueEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1131);
}
return ifcDerivedMeasureValueEClass;
} } | public class class_name {
@Override
public EClass getIfcDerivedMeasureValue() {
if (ifcDerivedMeasureValueEClass == null) {
ifcDerivedMeasureValueEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1131);
// depends on control dependency: [if], data = [none]
}
return ifcDerivedMeasureValueEClass;
} } |
public class class_name {
@Override
public synchronized boolean load() {
Either<Void, T> oldData = data;
String oldKey = versionedKey;
try {
if (isOutOfDate()) {
String newVersionedKey = (String) connection.get(key)
.get();
data = Either.right((T) nonAtomicload(newVersionedKey));
versionedKey = newVersionedKey;
} else {
return false;
}
} catch (Throwable e) {
data = oldData;
versionedKey = oldKey;
logger.debug(e.getMessage(), e);
throw ExceptionSoftener.throwSoftenedException(e);
}
return true;
} } | public class class_name {
@Override
public synchronized boolean load() {
Either<Void, T> oldData = data;
String oldKey = versionedKey;
try {
if (isOutOfDate()) {
String newVersionedKey = (String) connection.get(key)
.get();
data = Either.right((T) nonAtomicload(newVersionedKey)); // depends on control dependency: [if], data = [none]
versionedKey = newVersionedKey; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
data = oldData;
versionedKey = oldKey;
logger.debug(e.getMessage(), e);
throw ExceptionSoftener.throwSoftenedException(e);
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
private void resetDocs() {
changeMap.clear();
resumeToken = null;
for (DocumentSnapshot snapshot : documentSet) {
// Mark each document as deleted. If documents are not deleted, they will be send again by
// the server.
changeMap.put(snapshot.getReference().getResourcePath(), null);
}
current = false;
} } | public class class_name {
private void resetDocs() {
changeMap.clear();
resumeToken = null;
for (DocumentSnapshot snapshot : documentSet) {
// Mark each document as deleted. If documents are not deleted, they will be send again by
// the server.
changeMap.put(snapshot.getReference().getResourcePath(), null); // depends on control dependency: [for], data = [snapshot]
}
current = false;
} } |
public class class_name {
public void addHeader(String name, String value)
{
try{_httpResponse.addField(name,value);}
catch(IllegalStateException e){LogSupport.ignore(log,e);}
} } | public class class_name {
public void addHeader(String name, String value)
{
try{_httpResponse.addField(name,value);} // depends on control dependency: [try], data = [none]
catch(IllegalStateException e){LogSupport.ignore(log,e);} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@RestrictTo(RestrictTo.Scope.LIBRARY)
public int incrementDepthBy(String key, int depth) {
if (isContainer(key)) {
// If it's a container then we added programatically and it isn't a part of the keypath.
return 0;
}
if (!keys.get(depth).equals("**")) {
// If it's not a globstar then it is part of the keypath.
return 1;
}
if (depth == keys.size() - 1) {
// The last key is a globstar.
return 0;
}
if (keys.get(depth + 1).equals(key)) {
// We are a globstar and the next key is our current key so consume both.
return 2;
}
return 0;
} } | public class class_name {
@RestrictTo(RestrictTo.Scope.LIBRARY)
public int incrementDepthBy(String key, int depth) {
if (isContainer(key)) {
// If it's a container then we added programatically and it isn't a part of the keypath.
return 0; // depends on control dependency: [if], data = [none]
}
if (!keys.get(depth).equals("**")) {
// If it's not a globstar then it is part of the keypath.
return 1; // depends on control dependency: [if], data = [none]
}
if (depth == keys.size() - 1) {
// The last key is a globstar.
return 0; // depends on control dependency: [if], data = [none]
}
if (keys.get(depth + 1).equals(key)) {
// We are a globstar and the next key is our current key so consume both.
return 2; // depends on control dependency: [if], data = [none]
}
return 0;
} } |
public class class_name {
private void readPropertiesFile(final String custConfFileName) {
final Properties p = new Properties();
LOGGER.log(READ_CONF_FILE, custConfFileName);
try (InputStream is = ClasspathUtility.loadInputStream(custConfFileName)) {
// Read the properties file
p.load(is);
for (final Map.Entry<Object, Object> entry : p.entrySet()) {
if (this.propertiesParametersMap.containsKey(entry.getKey())) {
LOGGER.log(UPDATE_PARAMETER, entry.getKey(), entry.getValue());
} else {
LOGGER.log(STORE_PARAMETER, entry.getKey(), entry.getValue());
}
storePropertiesParameter(entry);
}
} catch (final IOException e) {
LOGGER.error(CONF_READING_ERROR, custConfFileName);
}
} } | public class class_name {
private void readPropertiesFile(final String custConfFileName) {
final Properties p = new Properties();
LOGGER.log(READ_CONF_FILE, custConfFileName);
try (InputStream is = ClasspathUtility.loadInputStream(custConfFileName)) {
// Read the properties file
p.load(is);
for (final Map.Entry<Object, Object> entry : p.entrySet()) {
if (this.propertiesParametersMap.containsKey(entry.getKey())) {
LOGGER.log(UPDATE_PARAMETER, entry.getKey(), entry.getValue());
// depends on control dependency: [if], data = [none]
} else {
LOGGER.log(STORE_PARAMETER, entry.getKey(), entry.getValue());
// depends on control dependency: [if], data = [none]
}
storePropertiesParameter(entry);
// depends on control dependency: [for], data = [entry]
}
} catch (final IOException e) {
LOGGER.error(CONF_READING_ERROR, custConfFileName);
}
} } |
public class class_name {
public Set<String> getArtifactIds( String groupId )
{
Set<String> result = new TreeSet<String>();
for ( int i = 0; i < stores.length; i++ )
{
Set<String> artifactIds = stores[i].getArtifactIds( groupId );
if ( artifactIds != null )
{
result.addAll( artifactIds );
}
}
return result;
} } | public class class_name {
public Set<String> getArtifactIds( String groupId )
{
Set<String> result = new TreeSet<String>();
for ( int i = 0; i < stores.length; i++ )
{
Set<String> artifactIds = stores[i].getArtifactIds( groupId );
if ( artifactIds != null )
{
result.addAll( artifactIds ); // depends on control dependency: [if], data = [( artifactIds]
}
}
return result;
} } |
public class class_name {
@JsonIgnore
public String getIdentifier() {
String tags = "";
Map<String, String> sortedTags = new TreeMap<>();
sortedTags.putAll(getTags());
if(!sortedTags.isEmpty()) {
StringBuilder tagListBuffer = new StringBuilder("{");
for (String tagKey : sortedTags.keySet()) {
tagListBuffer.append(tagKey).append('=').append(sortedTags.get(tagKey)).append(',');
}
tags = tagListBuffer.substring(0, tagListBuffer.length() - 1).concat("}");
}
String namespace = getNamespace();
Object[] params = { namespace == null ? "" : namespace + ":", getScope(), getMetric(), tags };
String format = "{0}{1}:{2}" + "{3}";
return MessageFormat.format(format, params);
} } | public class class_name {
@JsonIgnore
public String getIdentifier() {
String tags = "";
Map<String, String> sortedTags = new TreeMap<>();
sortedTags.putAll(getTags());
if(!sortedTags.isEmpty()) {
StringBuilder tagListBuffer = new StringBuilder("{");
for (String tagKey : sortedTags.keySet()) {
tagListBuffer.append(tagKey).append('=').append(sortedTags.get(tagKey)).append(','); // depends on control dependency: [for], data = [tagKey]
}
tags = tagListBuffer.substring(0, tagListBuffer.length() - 1).concat("}"); // depends on control dependency: [if], data = [none]
}
String namespace = getNamespace();
Object[] params = { namespace == null ? "" : namespace + ":", getScope(), getMetric(), tags };
String format = "{0}{1}:{2}" + "{3}";
return MessageFormat.format(format, params);
} } |
public class class_name {
public static String toNormalizedString(IPAddressValueProvider provider) {
IPVersion version = provider.getIPVersion();
if(version.isIPv4()) {
return IPv4Address.toNormalizedString(IPv4Address.defaultIpv4Network(), provider.getValues(), provider.getUpperValues(), provider.getPrefixLength());
} else if(version.isIPv6()) {
return IPv6Address.toNormalizedString(IPv6Address.defaultIpv6Network(), provider.getValues(), provider.getUpperValues(), provider.getPrefixLength(), provider.getZone());
}
throw new IllegalArgumentException();
} } | public class class_name {
public static String toNormalizedString(IPAddressValueProvider provider) {
IPVersion version = provider.getIPVersion();
if(version.isIPv4()) {
return IPv4Address.toNormalizedString(IPv4Address.defaultIpv4Network(), provider.getValues(), provider.getUpperValues(), provider.getPrefixLength()); // depends on control dependency: [if], data = [none]
} else if(version.isIPv6()) {
return IPv6Address.toNormalizedString(IPv6Address.defaultIpv6Network(), provider.getValues(), provider.getUpperValues(), provider.getPrefixLength(), provider.getZone()); // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException();
} } |
public class class_name {
private void addToolbarButtons() {
Button add = CmsToolBar.createButton(FontOpenCms.WAND, CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ADD_0));
add.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openEditDialog(null);
}
});
m_uiContext.addToolbarButton(add);
Button settings = CmsToolBar.createButton(
FontOpenCms.SETTINGS,
CmsVaadinUtils.getMessageText(Messages.GUI_SITE_GLOBAL_0));
settings.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openSettingsDailog();
}
});
m_uiContext.addToolbarButton(settings);
if (OpenCms.getSiteManager().isConfigurableWebServer() || isLetsEncryptConfiguredForWebserverThread()) {
Button webServer = CmsToolBar.createButton(
FontAwesome.SERVER,
CmsVaadinUtils.getMessageText(Messages.GUI_SITE_WEBSERVERCONFIG_0));
webServer.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openUpdateServerConfigDailog();
}
});
m_uiContext.addToolbarButton(webServer);
}
m_infoButton = new CmsInfoButton(getInfoMap());
m_infoButton.setWindowCaption(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_STATISTICS_CAPTION_0));
m_infoButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_STATISTICS_CAPTION_0));
m_uiContext.addToolbarButton(m_infoButton);
} } | public class class_name {
private void addToolbarButtons() {
Button add = CmsToolBar.createButton(FontOpenCms.WAND, CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ADD_0));
add.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openEditDialog(null);
}
});
m_uiContext.addToolbarButton(add);
Button settings = CmsToolBar.createButton(
FontOpenCms.SETTINGS,
CmsVaadinUtils.getMessageText(Messages.GUI_SITE_GLOBAL_0));
settings.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openSettingsDailog();
}
});
m_uiContext.addToolbarButton(settings);
if (OpenCms.getSiteManager().isConfigurableWebServer() || isLetsEncryptConfiguredForWebserverThread()) {
Button webServer = CmsToolBar.createButton(
FontAwesome.SERVER,
CmsVaadinUtils.getMessageText(Messages.GUI_SITE_WEBSERVERCONFIG_0));
webServer.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openUpdateServerConfigDailog();
}
}); // depends on control dependency: [if], data = [none]
m_uiContext.addToolbarButton(webServer); // depends on control dependency: [if], data = [none]
}
m_infoButton = new CmsInfoButton(getInfoMap());
m_infoButton.setWindowCaption(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_STATISTICS_CAPTION_0));
m_infoButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_STATISTICS_CAPTION_0));
m_uiContext.addToolbarButton(m_infoButton);
} } |
public class class_name {
static Runnable logFailure(final Runnable runnable, Logger logger) {
return () -> {
try {
runnable.run();
} catch (Throwable t) {
if (!(t instanceof RejectedExecutionException)) {
logger.error("An uncaught exception occurred", t);
}
throw t;
}
};
} } | public class class_name {
static Runnable logFailure(final Runnable runnable, Logger logger) {
return () -> {
try {
runnable.run(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
if (!(t instanceof RejectedExecutionException)) {
logger.error("An uncaught exception occurred", t); // depends on control dependency: [if], data = [none]
}
throw t;
} // depends on control dependency: [catch], data = [none]
};
} } |
public class class_name {
private void prepareCoords(Iterable<IAtomContainer> mols) throws CDKException {
for (IAtomContainer mol : mols) {
if (!ensure2dLayout(mol) && mol.getBondCount() > 0) {
final double factor = GeometryUtil.getScaleFactor(mol, 1.5);
GeometryUtil.scaleMolecule(mol, factor);
}
}
} } | public class class_name {
private void prepareCoords(Iterable<IAtomContainer> mols) throws CDKException {
for (IAtomContainer mol : mols) {
if (!ensure2dLayout(mol) && mol.getBondCount() > 0) {
final double factor = GeometryUtil.getScaleFactor(mol, 1.5);
GeometryUtil.scaleMolecule(mol, factor); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public DescribeGlobalTableSettingsResult withReplicaSettings(ReplicaSettingsDescription... replicaSettings) {
if (this.replicaSettings == null) {
setReplicaSettings(new java.util.ArrayList<ReplicaSettingsDescription>(replicaSettings.length));
}
for (ReplicaSettingsDescription ele : replicaSettings) {
this.replicaSettings.add(ele);
}
return this;
} } | public class class_name {
public DescribeGlobalTableSettingsResult withReplicaSettings(ReplicaSettingsDescription... replicaSettings) {
if (this.replicaSettings == null) {
setReplicaSettings(new java.util.ArrayList<ReplicaSettingsDescription>(replicaSettings.length)); // depends on control dependency: [if], data = [none]
}
for (ReplicaSettingsDescription ele : replicaSettings) {
this.replicaSettings.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public int compareTo(YearQuarter other) {
int cmp = (year - other.year);
if (cmp == 0) {
cmp = quarter.compareTo(other.quarter);
}
return cmp;
} } | public class class_name {
@Override
public int compareTo(YearQuarter other) {
int cmp = (year - other.year);
if (cmp == 0) {
cmp = quarter.compareTo(other.quarter); // depends on control dependency: [if], data = [none]
}
return cmp;
} } |
public class class_name {
char read() {
try {
if( cachePos < cache.length() ) {
return incLineColumn( cache.charAt( cachePos++ ) );
}
int ch = readCharBlockMarker();
if( ch == -1 ) {
throw createException( "Unexpected end of Less data" );
}
return incLineColumn( ch );
} catch( IOException ex ) {
throw new LessException( ex );
}
} } | public class class_name {
char read() {
try {
if( cachePos < cache.length() ) {
return incLineColumn( cache.charAt( cachePos++ ) ); // depends on control dependency: [if], data = [( cachePos]
}
int ch = readCharBlockMarker();
if( ch == -1 ) {
throw createException( "Unexpected end of Less data" );
}
return incLineColumn( ch ); // depends on control dependency: [try], data = [none]
} catch( IOException ex ) {
throw new LessException( ex );
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void onApplicationEvent(final ContextRefreshedEvent event) {
if (!hasStarted) {
hasStarted = true;
log.info(Markers.AUDIT, message);
}
} } | public class class_name {
@Override
public void onApplicationEvent(final ContextRefreshedEvent event) {
if (!hasStarted) {
hasStarted = true; // depends on control dependency: [if], data = [none]
log.info(Markers.AUDIT, message); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setLogDestinationConfigs(java.util.Collection<String> logDestinationConfigs) {
if (logDestinationConfigs == null) {
this.logDestinationConfigs = null;
return;
}
this.logDestinationConfigs = new java.util.ArrayList<String>(logDestinationConfigs);
} } | public class class_name {
public void setLogDestinationConfigs(java.util.Collection<String> logDestinationConfigs) {
if (logDestinationConfigs == null) {
this.logDestinationConfigs = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.logDestinationConfigs = new java.util.ArrayList<String>(logDestinationConfigs);
} } |
public class class_name {
public Writable call(Writable param, InetSocketAddress addr,
Class<?> protocol, UserGroupInformation ticket,
int rpcTimeout, boolean fastProtocol)
throws IOException {
Call call = new Call(param);
Connection connection = getConnection(addr, protocol, ticket,
rpcTimeout, call);
try {
connection.sendParam(call, fastProtocol); // send the parameter
} catch (RejectedExecutionException e) {
throw new ConnectionClosedException("connection has been closed", e);
} catch (InterruptedException e) {
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
}
synchronized (call) {
while (!call.done) {
try {
call.wait(); // wait for the result
} catch (InterruptedException ie) {
// Exit on interruption.
throw (InterruptedIOException) new InterruptedIOException()
.initCause(ie);
}
}
if (call.error != null) {
if (call.error instanceof RemoteException) {
call.error.fillInStackTrace();
throw call.error;
} else { // local exception
throw wrapException(addr, call.error);
}
} else {
return call.value;
}
}
} } | public class class_name {
public Writable call(Writable param, InetSocketAddress addr,
Class<?> protocol, UserGroupInformation ticket,
int rpcTimeout, boolean fastProtocol)
throws IOException {
Call call = new Call(param);
Connection connection = getConnection(addr, protocol, ticket,
rpcTimeout, call);
try {
connection.sendParam(call, fastProtocol); // send the parameter
} catch (RejectedExecutionException e) {
throw new ConnectionClosedException("connection has been closed", e);
} catch (InterruptedException e) {
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
}
synchronized (call) {
while (!call.done) {
try {
call.wait(); // wait for the result // depends on control dependency: [try], data = [none]
} catch (InterruptedException ie) {
// Exit on interruption.
throw (InterruptedIOException) new InterruptedIOException()
.initCause(ie);
} // depends on control dependency: [catch], data = [none]
}
if (call.error != null) {
if (call.error instanceof RemoteException) {
call.error.fillInStackTrace(); // depends on control dependency: [if], data = [none]
throw call.error;
} else { // local exception
throw wrapException(addr, call.error);
}
} else {
return call.value; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static String getCacheName(Method method, String methodCacheName, CacheDefaults cacheDefaultsAnnotation, boolean generate) {
assertNotNull(method, "method parameter must not be null");
assertNotNull(methodCacheName, "methodCacheName parameter must not be null");
String cacheName = methodCacheName.trim();
if (cacheName.isEmpty() && cacheDefaultsAnnotation != null) {
cacheName = cacheDefaultsAnnotation.cacheName().trim();
}
if (cacheName.isEmpty() && generate) {
cacheName = getDefaultMethodCacheName(method);
}
return cacheName;
} } | public class class_name {
public static String getCacheName(Method method, String methodCacheName, CacheDefaults cacheDefaultsAnnotation, boolean generate) {
assertNotNull(method, "method parameter must not be null");
assertNotNull(methodCacheName, "methodCacheName parameter must not be null");
String cacheName = methodCacheName.trim();
if (cacheName.isEmpty() && cacheDefaultsAnnotation != null) {
cacheName = cacheDefaultsAnnotation.cacheName().trim(); // depends on control dependency: [if], data = [none]
}
if (cacheName.isEmpty() && generate) {
cacheName = getDefaultMethodCacheName(method); // depends on control dependency: [if], data = [none]
}
return cacheName;
} } |
public class class_name {
public void gridToPmesh(String outPutFileName) {
try {
gridGenerator.writeGridInPmeshFormat(outPutFileName);
} catch (IOException e) {
logger.debug(e);
}
} } | public class class_name {
public void gridToPmesh(String outPutFileName) {
try {
gridGenerator.writeGridInPmeshFormat(outPutFileName); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.debug(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static StringBuilder escapeBytes(ByteBuffer input)
{
// input.flip();
int length = input.limit();
final StringBuilder builder = new StringBuilder(length);
for (int i = 0; i < length; i++)
{
final byte b = input.get(i);
switch (b)
{
// Java does not recognize \a or \v, apparently.
case 0x07:
builder.append("\\007");
break;
case '\b':
builder.append("\\b");
break;
case '\f':
builder.append("\\f");
break;
case '\n':
builder.append("\\n");
break;
case '\r':
builder.append("\\r");
break;
case '\t':
builder.append("\\t");
break;
case 0x0b:
builder.append("\\013");
break;
case '\\':
builder.append("\\\\");
break;
case '\'':
builder.append("\\\'");
break;
case '"':
builder.append("\\\"");
break;
default:
if (b >= 0x20)
{
builder.append((char) b);
}
else
{
builder.append('\\');
builder.append((char) ('0' + ((b >>> 6) & 3)));
builder.append((char) ('0' + ((b >>> 3) & 7)));
builder.append((char) ('0' + (b & 7)));
}
break;
}
}
return builder;
} } | public class class_name {
static StringBuilder escapeBytes(ByteBuffer input)
{
// input.flip();
int length = input.limit();
final StringBuilder builder = new StringBuilder(length);
for (int i = 0; i < length; i++)
{
final byte b = input.get(i);
switch (b)
{
// Java does not recognize \a or \v, apparently.
case 0x07:
builder.append("\\007");
break;
case '\b':
builder.append("\\b");
break;
case '\f':
builder.append("\\f");
break;
case '\n':
builder.append("\\n");
break;
case '\r':
builder.append("\\r");
break;
case '\t':
builder.append("\\t");
break;
case 0x0b:
builder.append("\\013");
break;
case '\\':
builder.append("\\\\");
break;
case '\'':
builder.append("\\\'");
break;
case '"':
builder.append("\\\"");
break;
default:
if (b >= 0x20)
{
builder.append((char) b); // depends on control dependency: [if], data = [none]
}
else
{
builder.append('\\'); // depends on control dependency: [if], data = [none]
builder.append((char) ('0' + ((b >>> 6) & 3))); // depends on control dependency: [if], data = [(b]
builder.append((char) ('0' + ((b >>> 3) & 7))); // depends on control dependency: [if], data = [(b]
builder.append((char) ('0' + (b & 7))); // depends on control dependency: [if], data = [(b]
}
break;
}
}
return builder;
} } |
public class class_name {
@Override
public EEnum getIfcTaskDurationEnum() {
if (ifcTaskDurationEnumEEnum == null) {
ifcTaskDurationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1083);
}
return ifcTaskDurationEnumEEnum;
} } | public class class_name {
@Override
public EEnum getIfcTaskDurationEnum() {
if (ifcTaskDurationEnumEEnum == null) {
ifcTaskDurationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1083);
// depends on control dependency: [if], data = [none]
}
return ifcTaskDurationEnumEEnum;
} } |
public class class_name {
public static String removeEnd(String str, String remove) {
if (isNullOrEmpty(str) || isNullOrEmpty(remove)) {
return str;
}
if (str.endsWith(remove)) {
return str.substring(0, str.length() - remove.length());
}
return str;
} } | public class class_name {
public static String removeEnd(String str, String remove) {
if (isNullOrEmpty(str) || isNullOrEmpty(remove)) {
return str; // depends on control dependency: [if], data = [none]
}
if (str.endsWith(remove)) {
return str.substring(0, str.length() - remove.length()); // depends on control dependency: [if], data = [none]
}
return str;
} } |
public class class_name {
private static void getRichText(Node node, StringBuilder builder) {
Node n = node.getFirstChild();
while (n != null) {
if (n.getNodeType() == Node.TEXT_NODE) {
builder.append(n.getNodeValue());
} else if (n.getNodeType() == Node.ELEMENT_NODE) {
builder.append('<');
builder.append(n.getNodeName());
builder.append('>');
getRichText(n, builder);
builder.append('<');
builder.append('/');
builder.append(n.getNodeName());
builder.append('>');
}
n = n.getNextSibling();
}
} } | public class class_name {
private static void getRichText(Node node, StringBuilder builder) {
Node n = node.getFirstChild();
while (n != null) {
if (n.getNodeType() == Node.TEXT_NODE) {
builder.append(n.getNodeValue());
// depends on control dependency: [if], data = [none]
} else if (n.getNodeType() == Node.ELEMENT_NODE) {
builder.append('<');
// depends on control dependency: [if], data = [none]
builder.append(n.getNodeName());
// depends on control dependency: [if], data = [none]
builder.append('>');
// depends on control dependency: [if], data = [none]
getRichText(n, builder);
// depends on control dependency: [if], data = [none]
builder.append('<');
// depends on control dependency: [if], data = [none]
builder.append('/');
// depends on control dependency: [if], data = [none]
builder.append(n.getNodeName());
// depends on control dependency: [if], data = [none]
builder.append('>');
// depends on control dependency: [if], data = [none]
}
n = n.getNextSibling();
// depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public static boolean seleniumEquals( String expectedPattern, String actual )
{
if ( actual.startsWith( "regexp:" ) || actual.startsWith( "regex:" ) || actual.startsWith( "regexpi:" )
|| actual.startsWith( "regexi:" ) )
{
// swap 'em
String tmp = actual;
actual = expectedPattern;
expectedPattern = tmp;
}
Boolean b;
b = equalsHandleRegex( "regexp:", expectedPattern, actual, 0 );
if ( b != null )
{
return b.booleanValue();
}
b = equalsHandleRegex( "regex:", expectedPattern, actual, 0 );
if ( b != null )
{
return b.booleanValue();
}
b = equalsHandleRegex( "regexpi:", expectedPattern, actual, Pattern.CASE_INSENSITIVE );
if ( b != null )
{
return b.booleanValue();
}
b = equalsHandleRegex( "regexi:", expectedPattern, actual, Pattern.CASE_INSENSITIVE );
if ( b != null )
{
return b.booleanValue();
}
if ( expectedPattern.startsWith( "exact:" ) )
{
String expectedExact = expectedPattern.replaceFirst( "exact:", "" );
if ( !expectedExact.equals( actual ) )
{
// System.out.println( "expected " + actual + " to not match " + expectedPattern );
return false;
}
return true;
}
String expectedGlob = expectedPattern.replaceFirst( "glob:", "" );
expectedGlob = expectedGlob.replaceAll( "([\\]\\[\\\\{\\}$\\(\\)\\|\\^\\+.])", "\\\\$1" );
expectedGlob = expectedGlob.replaceAll( "\\*", ".*" );
expectedGlob = expectedGlob.replaceAll( "\\?", "." );
if ( !Pattern.compile( expectedGlob, Pattern.DOTALL ).matcher( actual ).matches() )
{
// System.out.println( "expected \"" + actual + "\" to not match glob \"" + expectedPattern
// + "\" (had transformed the glob into regexp \"" + expectedGlob + "\"" );
return false;
}
return true;
} } | public class class_name {
public static boolean seleniumEquals( String expectedPattern, String actual )
{
if ( actual.startsWith( "regexp:" ) || actual.startsWith( "regex:" ) || actual.startsWith( "regexpi:" )
|| actual.startsWith( "regexi:" ) )
{
// swap 'em
String tmp = actual;
actual = expectedPattern; // depends on control dependency: [if], data = [none]
expectedPattern = tmp; // depends on control dependency: [if], data = [none]
}
Boolean b;
b = equalsHandleRegex( "regexp:", expectedPattern, actual, 0 );
if ( b != null )
{
return b.booleanValue(); // depends on control dependency: [if], data = [none]
}
b = equalsHandleRegex( "regex:", expectedPattern, actual, 0 );
if ( b != null )
{
return b.booleanValue(); // depends on control dependency: [if], data = [none]
}
b = equalsHandleRegex( "regexpi:", expectedPattern, actual, Pattern.CASE_INSENSITIVE );
if ( b != null )
{
return b.booleanValue(); // depends on control dependency: [if], data = [none]
}
b = equalsHandleRegex( "regexi:", expectedPattern, actual, Pattern.CASE_INSENSITIVE );
if ( b != null )
{
return b.booleanValue(); // depends on control dependency: [if], data = [none]
}
if ( expectedPattern.startsWith( "exact:" ) )
{
String expectedExact = expectedPattern.replaceFirst( "exact:", "" );
if ( !expectedExact.equals( actual ) )
{
// System.out.println( "expected " + actual + " to not match " + expectedPattern );
return false; // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
String expectedGlob = expectedPattern.replaceFirst( "glob:", "" );
expectedGlob = expectedGlob.replaceAll( "([\\]\\[\\\\{\\}$\\(\\)\\|\\^\\+.])", "\\\\$1" );
expectedGlob = expectedGlob.replaceAll( "\\*", ".*" );
expectedGlob = expectedGlob.replaceAll( "\\?", "." );
if ( !Pattern.compile( expectedGlob, Pattern.DOTALL ).matcher( actual ).matches() )
{
// System.out.println( "expected \"" + actual + "\" to not match glob \"" + expectedPattern
// + "\" (had transformed the glob into regexp \"" + expectedGlob + "\"" );
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
@Override
public RTMPConnection getConnectionBySessionId(String sessionId) {
log.debug("Getting connection by session id: {}", sessionId);
if (connMap.containsKey(sessionId)) {
return connMap.get(sessionId);
} else {
log.warn("Connection not found for {}", sessionId);
if (log.isTraceEnabled()) {
log.trace("Connections ({}) {}", connMap.size(), connMap.values());
}
}
return null;
} } | public class class_name {
@Override
public RTMPConnection getConnectionBySessionId(String sessionId) {
log.debug("Getting connection by session id: {}", sessionId);
if (connMap.containsKey(sessionId)) {
return connMap.get(sessionId); // depends on control dependency: [if], data = [none]
} else {
log.warn("Connection not found for {}", sessionId); // depends on control dependency: [if], data = [none]
if (log.isTraceEnabled()) {
log.trace("Connections ({}) {}", connMap.size(), connMap.values()); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMultiRolePoolInstanceMetricsNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listMultiRolePoolInstanceMetricsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<ResourceMetricInner>> result = listMultiRolePoolInstanceMetricsNextDelegate(response);
return Observable.just(new ServiceResponse<Page<ResourceMetricInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMultiRolePoolInstanceMetricsNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listMultiRolePoolInstanceMetricsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<ResourceMetricInner>> result = listMultiRolePoolInstanceMetricsNextDelegate(response);
return Observable.just(new ServiceResponse<Page<ResourceMetricInner>>(result.body(), result.response())); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public void writeThisMethod(CodeType codeType)
{
Record recClassInfo = this.getMainRecord();
LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE);
String strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();
MethodInfo methodInfo = new MethodInfo();
m_MethodHelper.getTheMethodInfo(recLogicFile, methodInfo); // Get the correct interface, etc..
String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).getString();
String strMethodDesc = recLogicFile.getField(LogicFile.LOGIC_DESCRIPTION).getString();
String strProtection = recLogicFile.getField(LogicFile.PROTECTION).getString();
if (m_MethodNameList.addName(strMethodName) == false)
return; // Don't write it, its already here
if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*')
strMethodName = strMethodName.substring(0, strMethodName.length() - 2);
if (strMethodName.equals(strClassName))
{
if (codeType == CodeType.THICK)
{
if ("".equalsIgnoreCase(methodInfo.strMethodInterface))
return; // Default constructor is already there
this.writeMethodInterface(strProtection, strMethodName, "", methodInfo.strMethodInterface, methodInfo.strMethodThrows, strMethodDesc, null);
this.writeDefaultMethodCode(strMethodName, methodInfo.strMethodReturns, methodInfo.strMethodInterface, strClassName);
}
}
else
{
if (methodInfo.strMethodReturns.length() >= 7) if (methodInfo.strMethodReturns.substring(methodInfo.strMethodReturns.length() - 7, methodInfo.strMethodReturns.length()).equalsIgnoreCase(" "))
methodInfo.strMethodReturns = methodInfo.strMethodReturns.substring(0, methodInfo.strMethodReturns.length() - 6);
String strCodeBody = null;
if ((codeType == CodeType.INTERFACE) || ("interface".equals(recClassInfo.getField(ClassInfo.CLASS_TYPE).toString())))
{
if (!((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(CodeType.INTERFACE, false))
return;
strCodeBody = ";\n";
}
else if (!((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(codeType, false))
{ // Special case - write a default impl.
if ((methodInfo.strMethodReturns == null) || ("void".equals(methodInfo.strMethodReturns)) || (DBConstants.BLANK.equals(methodInfo.strMethodReturns)))
strCodeBody = "{\n\t// Empty implementation\n}\n";
else if ("boolean".equals(methodInfo.strMethodReturns))
strCodeBody = "{\n\treturn false; // Empty implementation\n}\n";
else if (("int".equals(methodInfo.strMethodReturns)) || ("short".equals(methodInfo.strMethodReturns)) || ("long".equals(methodInfo.strMethodReturns)))
strCodeBody = "{\n\treturn -1; // Empty implementation\n}\n";
else
strCodeBody = "{\n\treturn null; // Empty implementation\n}\n";
}
this.writeMethodInterface(strProtection, strMethodName, methodInfo.strMethodReturns, methodInfo.strMethodInterface, methodInfo.strMethodThrows, strMethodDesc, strCodeBody);
}
if ((codeType == CodeType.INTERFACE) || ("interface".equals(recClassInfo.getField(ClassInfo.CLASS_TYPE).toString())))
return;
if (!((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(codeType, false))
return;
if (!strMethodName.equals(strClassName))
{
if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString().length() != 0)
{
String strBaseClass;
strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString();
m_StreamOut.setTabs(+1);
this.writeTextField(recLogicFile.getField(LogicFile.LOGIC_SOURCE), strBaseClass, strMethodName, methodInfo.strMethodInterface, strClassName);
m_StreamOut.setTabs(-1);
}
else
this.writeDefaultMethodCode(strMethodName, methodInfo.strMethodReturns, methodInfo.strMethodInterface, strClassName);
}
m_StreamOut.writeit("}\n");
} } | public class class_name {
public void writeThisMethod(CodeType codeType)
{
Record recClassInfo = this.getMainRecord();
LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE);
String strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();
MethodInfo methodInfo = new MethodInfo();
m_MethodHelper.getTheMethodInfo(recLogicFile, methodInfo); // Get the correct interface, etc..
String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).getString();
String strMethodDesc = recLogicFile.getField(LogicFile.LOGIC_DESCRIPTION).getString();
String strProtection = recLogicFile.getField(LogicFile.PROTECTION).getString();
if (m_MethodNameList.addName(strMethodName) == false)
return; // Don't write it, its already here
if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*')
strMethodName = strMethodName.substring(0, strMethodName.length() - 2);
if (strMethodName.equals(strClassName))
{
if (codeType == CodeType.THICK)
{
if ("".equalsIgnoreCase(methodInfo.strMethodInterface))
return; // Default constructor is already there
this.writeMethodInterface(strProtection, strMethodName, "", methodInfo.strMethodInterface, methodInfo.strMethodThrows, strMethodDesc, null); // depends on control dependency: [if], data = [none]
this.writeDefaultMethodCode(strMethodName, methodInfo.strMethodReturns, methodInfo.strMethodInterface, strClassName); // depends on control dependency: [if], data = [none]
}
}
else
{
if (methodInfo.strMethodReturns.length() >= 7) if (methodInfo.strMethodReturns.substring(methodInfo.strMethodReturns.length() - 7, methodInfo.strMethodReturns.length()).equalsIgnoreCase(" "))
methodInfo.strMethodReturns = methodInfo.strMethodReturns.substring(0, methodInfo.strMethodReturns.length() - 6);
String strCodeBody = null;
if ((codeType == CodeType.INTERFACE) || ("interface".equals(recClassInfo.getField(ClassInfo.CLASS_TYPE).toString())))
{
if (!((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(CodeType.INTERFACE, false))
return;
strCodeBody = ";\n"; // depends on control dependency: [if], data = [none]
}
else if (!((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(codeType, false))
{ // Special case - write a default impl.
if ((methodInfo.strMethodReturns == null) || ("void".equals(methodInfo.strMethodReturns)) || (DBConstants.BLANK.equals(methodInfo.strMethodReturns)))
strCodeBody = "{\n\t// Empty implementation\n}\n";
else if ("boolean".equals(methodInfo.strMethodReturns))
strCodeBody = "{\n\treturn false; // Empty implementation\n}\n";
else if (("int".equals(methodInfo.strMethodReturns)) || ("short".equals(methodInfo.strMethodReturns)) || ("long".equals(methodInfo.strMethodReturns)))
strCodeBody = "{\n\treturn -1; // Empty implementation\n}\n";
else
strCodeBody = "{\n\treturn null; // Empty implementation\n}\n";
}
this.writeMethodInterface(strProtection, strMethodName, methodInfo.strMethodReturns, methodInfo.strMethodInterface, methodInfo.strMethodThrows, strMethodDesc, strCodeBody); // depends on control dependency: [if], data = [none]
}
if ((codeType == CodeType.INTERFACE) || ("interface".equals(recClassInfo.getField(ClassInfo.CLASS_TYPE).toString())))
return;
if (!((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(codeType, false))
return;
if (!strMethodName.equals(strClassName))
{
if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString().length() != 0)
{
String strBaseClass;
strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString(); // depends on control dependency: [if], data = [none]
m_StreamOut.setTabs(+1); // depends on control dependency: [if], data = [none]
this.writeTextField(recLogicFile.getField(LogicFile.LOGIC_SOURCE), strBaseClass, strMethodName, methodInfo.strMethodInterface, strClassName); // depends on control dependency: [if], data = [none]
m_StreamOut.setTabs(-1); // depends on control dependency: [if], data = [none]
}
else
this.writeDefaultMethodCode(strMethodName, methodInfo.strMethodReturns, methodInfo.strMethodInterface, strClassName);
}
m_StreamOut.writeit("}\n");
} } |
public class class_name {
public void onXMLDeclaration (@Nullable final EXMLVersion eXMLVersion,
@Nullable final String sEncoding,
final boolean bStandalone,
final boolean bWithNewLine)
{
if (eXMLVersion != null)
{
// Maybe switch from 1.0 to 1.1 or vice versa at the very beginning of the
// document
m_eXMLVersion = EXMLSerializeVersion.getFromXMLVersionOrThrow (eXMLVersion);
}
_append (PI_START)._append ("xml version=")._appendAttrValue (m_eXMLVersion.getXMLVersionString ());
if (StringHelper.hasText (sEncoding))
_append (" encoding=")._appendAttrValue (sEncoding);
if (bStandalone)
_append (" standalone=")._appendAttrValue ("yes");
_append (PI_END);
if (bWithNewLine)
newLine ();
} } | public class class_name {
public void onXMLDeclaration (@Nullable final EXMLVersion eXMLVersion,
@Nullable final String sEncoding,
final boolean bStandalone,
final boolean bWithNewLine)
{
if (eXMLVersion != null)
{
// Maybe switch from 1.0 to 1.1 or vice versa at the very beginning of the
// document
m_eXMLVersion = EXMLSerializeVersion.getFromXMLVersionOrThrow (eXMLVersion); // depends on control dependency: [if], data = [(eXMLVersion]
}
_append (PI_START)._append ("xml version=")._appendAttrValue (m_eXMLVersion.getXMLVersionString ());
if (StringHelper.hasText (sEncoding))
_append (" encoding=")._appendAttrValue (sEncoding);
if (bStandalone)
_append (" standalone=")._appendAttrValue ("yes");
_append (PI_END);
if (bWithNewLine)
newLine ();
} } |
public class class_name {
protected void lifecycle(BindRegistry registry, BeanDefinitionRegistry definitionRegistry) {
for (String name : registry.getBeanNames()) {
Class<?> clazz = registry.getBeanType(name);
String springName = name;
if (springName.startsWith("&")) springName = springName.substring(1);
if (!definitionRegistry.containsBeanDefinition(springName)) continue;
AbstractBeanDefinition def = (AbstractBeanDefinition) definitionRegistry.getBeanDefinition(springName);
if (Initializing.class.isAssignableFrom(clazz) && null == def.getInitMethodName()
&& !def.getPropertyValues().contains("init-method")) {
def.setInitMethodName("init");
}
if (Disposable.class.isAssignableFrom(clazz) && null == def.getDestroyMethodName()
&& !def.getPropertyValues().contains("destroy-method")) {
def.setDestroyMethodName("destroy");
}
}
} } | public class class_name {
protected void lifecycle(BindRegistry registry, BeanDefinitionRegistry definitionRegistry) {
for (String name : registry.getBeanNames()) {
Class<?> clazz = registry.getBeanType(name); // depends on control dependency: [for], data = [name]
String springName = name;
if (springName.startsWith("&")) springName = springName.substring(1);
if (!definitionRegistry.containsBeanDefinition(springName)) continue;
AbstractBeanDefinition def = (AbstractBeanDefinition) definitionRegistry.getBeanDefinition(springName);
if (Initializing.class.isAssignableFrom(clazz) && null == def.getInitMethodName()
&& !def.getPropertyValues().contains("init-method")) {
def.setInitMethodName("init"); // depends on control dependency: [if], data = [none]
}
if (Disposable.class.isAssignableFrom(clazz) && null == def.getDestroyMethodName()
&& !def.getPropertyValues().contains("destroy-method")) {
def.setDestroyMethodName("destroy"); // depends on control dependency: [if], data = [def]
}
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.