code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public ParameterBinding getBindingFor(int position) {
for (ParameterBinding binding : bindings) {
if (binding.hasPosition(position)) {
return binding;
}
}
throw new IllegalArgumentException(String.format("No parameter binding found for position %s!", position));
} }
|
public class class_name {
public ParameterBinding getBindingFor(int position) {
for (ParameterBinding binding : bindings) {
if (binding.hasPosition(position)) {
return binding;
// depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException(String.format("No parameter binding found for position %s!", position));
} }
|
public class class_name {
protected VisibilityConfiguration createVisibilityConfiguration(String className, String params) {
I_CmsXmlContentVisibilityHandler handler = this;
if (className != null) {
try {
handler = (I_CmsXmlContentVisibilityHandler)(Class.forName(className).newInstance());
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
VisibilityConfiguration result = new VisibilityConfiguration(handler, params);
return result;
} }
|
public class class_name {
protected VisibilityConfiguration createVisibilityConfiguration(String className, String params) {
I_CmsXmlContentVisibilityHandler handler = this;
if (className != null) {
try {
handler = (I_CmsXmlContentVisibilityHandler)(Class.forName(className).newInstance()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
VisibilityConfiguration result = new VisibilityConfiguration(handler, params);
return result;
} }
|
public class class_name {
public void marshall(LogGroupField logGroupField, ProtocolMarshaller protocolMarshaller) {
if (logGroupField == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(logGroupField.getName(), NAME_BINDING);
protocolMarshaller.marshall(logGroupField.getPercent(), PERCENT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(LogGroupField logGroupField, ProtocolMarshaller protocolMarshaller) {
if (logGroupField == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(logGroupField.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logGroupField.getPercent(), PERCENT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(StreamNameCondition streamNameCondition, ProtocolMarshaller protocolMarshaller) {
if (streamNameCondition == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(streamNameCondition.getComparisonOperator(), COMPARISONOPERATOR_BINDING);
protocolMarshaller.marshall(streamNameCondition.getComparisonValue(), COMPARISONVALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StreamNameCondition streamNameCondition, ProtocolMarshaller protocolMarshaller) {
if (streamNameCondition == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(streamNameCondition.getComparisonOperator(), COMPARISONOPERATOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamNameCondition.getComparisonValue(), COMPARISONVALUE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
static Optional<String> validateRelationHasRolePlayers(Relation relation) {
if (!relation.rolePlayers().findAny().isPresent()) {
return Optional.of(ErrorMessage.VALIDATION_RELATION_WITH_NO_ROLE_PLAYERS.getMessage(relation.id(), relation.type().label()));
}
return Optional.empty();
} }
|
public class class_name {
static Optional<String> validateRelationHasRolePlayers(Relation relation) {
if (!relation.rolePlayers().findAny().isPresent()) {
return Optional.of(ErrorMessage.VALIDATION_RELATION_WITH_NO_ROLE_PLAYERS.getMessage(relation.id(), relation.type().label())); // depends on control dependency: [if], data = [none]
}
return Optional.empty();
} }
|
public class class_name {
private void zInternalSetLastValidTimeAndNotifyListeners(LocalTime newTime) {
LocalTime oldTime = lastValidTime;
lastValidTime = newTime;
if (!PickerUtilities.isSameLocalTime(oldTime, newTime)) {
for (TimeChangeListener timeChangeListener : timeChangeListeners) {
TimeChangeEvent timeChangeEvent = new TimeChangeEvent(this, oldTime, newTime);
timeChangeListener.timeChanged(timeChangeEvent);
}
// Fire a change event for beans binding.
firePropertyChange("time", oldTime, newTime);
}
} }
|
public class class_name {
private void zInternalSetLastValidTimeAndNotifyListeners(LocalTime newTime) {
LocalTime oldTime = lastValidTime;
lastValidTime = newTime;
if (!PickerUtilities.isSameLocalTime(oldTime, newTime)) {
for (TimeChangeListener timeChangeListener : timeChangeListeners) {
TimeChangeEvent timeChangeEvent = new TimeChangeEvent(this, oldTime, newTime);
timeChangeListener.timeChanged(timeChangeEvent); // depends on control dependency: [for], data = [timeChangeListener]
}
// Fire a change event for beans binding.
firePropertyChange("time", oldTime, newTime); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void internalSetFiled(MethodVisitor mv, Accessor acc) {
/**
* FNC params
*
* 1 -> object to alter
*
* 2 -> id of field
*
* 3 -> new value
*/
mv.visitVarInsn(ALOAD, 1);
mv.visitTypeInsn(CHECKCAST, classNameInternal);
// get VELUE
mv.visitVarInsn(ALOAD, 3);
Type fieldType = Type.getType(acc.getType());
Class<?> type = acc.getType();
String destClsName = Type.getInternalName(type);
Method conMtd = convMtds.get(type);
if (conMtd != null) {
// external converion
String clsSig = Type.getInternalName(conMtd.getDeclaringClass());
String mtdName = conMtd.getName();
String mtdSig = Type.getMethodDescriptor(conMtd);
mv.visitMethodInsn(INVOKESTATIC, clsSig, mtdName, mtdSig);
} else if (acc.isEnum()) {
// builtIn Enum Conversion
Label isNull = new Label();
mv.visitJumpInsn(IFNULL, isNull);
mv.visitVarInsn(ALOAD, 3);
// mv.visitTypeInsn(CHECKCAST, "java/lang/String");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;");
mv.visitMethodInsn(INVOKESTATIC, destClsName, "valueOf", "(Ljava/lang/String;)L" + destClsName + ";");
mv.visitVarInsn(ASTORE, 3);
mv.visitLabel(isNull);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitVarInsn(ALOAD, 1);
mv.visitTypeInsn(CHECKCAST, this.classNameInternal); // "net/minidev/asm/bean/BEnumPriv"
mv.visitVarInsn(ALOAD, 3);
mv.visitTypeInsn(CHECKCAST, destClsName);
} else if (type.equals(String.class)) {
// built In String Conversion
Label isNull = new Label();
mv.visitJumpInsn(IFNULL, isNull);
mv.visitVarInsn(ALOAD, 3);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;");
mv.visitVarInsn(ASTORE, 3);
mv.visitLabel(isNull);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitVarInsn(ALOAD, 1);
mv.visitTypeInsn(CHECKCAST, this.classNameInternal);
mv.visitVarInsn(ALOAD, 3);
mv.visitTypeInsn(CHECKCAST, destClsName);
} else {
// just check Cast
mv.visitTypeInsn(CHECKCAST, destClsName);
}
if (acc.isPublic()) {
mv.visitFieldInsn(PUTFIELD, classNameInternal, acc.getName(), fieldType.getDescriptor());
} else {
String sig = Type.getMethodDescriptor(acc.setter);
mv.visitMethodInsn(INVOKEVIRTUAL, classNameInternal, acc.setter.getName(), sig);
}
mv.visitInsn(RETURN);
} }
|
public class class_name {
private void internalSetFiled(MethodVisitor mv, Accessor acc) {
/**
* FNC params
*
* 1 -> object to alter
*
* 2 -> id of field
*
* 3 -> new value
*/
mv.visitVarInsn(ALOAD, 1);
mv.visitTypeInsn(CHECKCAST, classNameInternal);
// get VELUE
mv.visitVarInsn(ALOAD, 3);
Type fieldType = Type.getType(acc.getType());
Class<?> type = acc.getType();
String destClsName = Type.getInternalName(type);
Method conMtd = convMtds.get(type);
if (conMtd != null) {
// external converion
String clsSig = Type.getInternalName(conMtd.getDeclaringClass());
String mtdName = conMtd.getName();
String mtdSig = Type.getMethodDescriptor(conMtd);
mv.visitMethodInsn(INVOKESTATIC, clsSig, mtdName, mtdSig); // depends on control dependency: [if], data = [none]
} else if (acc.isEnum()) {
// builtIn Enum Conversion
Label isNull = new Label();
mv.visitJumpInsn(IFNULL, isNull); // depends on control dependency: [if], data = [none]
mv.visitVarInsn(ALOAD, 3); // depends on control dependency: [if], data = [none]
// mv.visitTypeInsn(CHECKCAST, "java/lang/String");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;");
mv.visitMethodInsn(INVOKESTATIC, destClsName, "valueOf", "(Ljava/lang/String;)L" + destClsName + ";");
mv.visitVarInsn(ASTORE, 3);
mv.visitLabel(isNull);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitVarInsn(ALOAD, 1);
mv.visitTypeInsn(CHECKCAST, this.classNameInternal); // "net/minidev/asm/bean/BEnumPriv"
mv.visitVarInsn(ALOAD, 3);
mv.visitTypeInsn(CHECKCAST, destClsName);
} else if (type.equals(String.class)) {
// built In String Conversion
Label isNull = new Label(); // depends on control dependency: [if], data = [none]
mv.visitJumpInsn(IFNULL, isNull); // depends on control dependency: [if], data = [none]
mv.visitVarInsn(ALOAD, 3); // depends on control dependency: [if], data = [none]
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;");
mv.visitVarInsn(ASTORE, 3);
mv.visitLabel(isNull);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitVarInsn(ALOAD, 1);
mv.visitTypeInsn(CHECKCAST, this.classNameInternal);
mv.visitVarInsn(ALOAD, 3);
mv.visitTypeInsn(CHECKCAST, destClsName); // depends on control dependency: [if], data = [none]
} else {
// just check Cast
mv.visitTypeInsn(CHECKCAST, destClsName); // depends on control dependency: [if], data = [none]
}
if (acc.isPublic()) {
mv.visitFieldInsn(PUTFIELD, classNameInternal, acc.getName(), fieldType.getDescriptor()); // depends on control dependency: [if], data = [none]
} else {
String sig = Type.getMethodDescriptor(acc.setter);
mv.visitMethodInsn(INVOKEVIRTUAL, classNameInternal, acc.setter.getName(), sig); // depends on control dependency: [if], data = [none]
}
mv.visitInsn(RETURN);
} }
|
public class class_name {
public ToConverter getToConverter(Class toClass, Class domainClass) throws JTransfoException {
ToConverter converter = withPreConverter(toClass);
List<SyntheticField> domainFields = reflectionHelper.getSyntheticFields(domainClass);
for (Field field : reflectionHelper.getFields(toClass)) {
boolean isTransient = Modifier.isTransient(field.getModifiers());
List<NotMapped> notMapped = reflectionHelper.getAnnotationWithMeta(field, NotMapped.class);
if (!isTransient && (0 == notMapped.size())) {
List<MappedBy> mappedBies = reflectionHelper.getAnnotationWithMeta(field, MappedBy.class);
if (mappedBies.size() > 1) {
throw new JTransfoException("Field " + field.getName() + " on type " +
field.getDeclaringClass().getName() +
" MappedBy is ambiguous, check your meta-annotations.");
}
MappedBy mappedBy = null;
if (1 == mappedBies.size()) {
mappedBy = mappedBies.get(0);
}
boolean isStatic = (0 != (field.getModifiers() & Modifier.STATIC));
if (0 != mappedBies.size() || !isStatic) {
buildConverters(field, domainFields, domainClass, converter, mappedBy);
}
}
}
addPostConverter(converter, toClass);
return converter;
} }
|
public class class_name {
public ToConverter getToConverter(Class toClass, Class domainClass) throws JTransfoException {
ToConverter converter = withPreConverter(toClass);
List<SyntheticField> domainFields = reflectionHelper.getSyntheticFields(domainClass);
for (Field field : reflectionHelper.getFields(toClass)) {
boolean isTransient = Modifier.isTransient(field.getModifiers());
List<NotMapped> notMapped = reflectionHelper.getAnnotationWithMeta(field, NotMapped.class);
if (!isTransient && (0 == notMapped.size())) {
List<MappedBy> mappedBies = reflectionHelper.getAnnotationWithMeta(field, MappedBy.class);
if (mappedBies.size() > 1) {
throw new JTransfoException("Field " + field.getName() + " on type " +
field.getDeclaringClass().getName() +
" MappedBy is ambiguous, check your meta-annotations.");
}
MappedBy mappedBy = null;
if (1 == mappedBies.size()) {
mappedBy = mappedBies.get(0); // depends on control dependency: [if], data = [none]
}
boolean isStatic = (0 != (field.getModifiers() & Modifier.STATIC));
if (0 != mappedBies.size() || !isStatic) {
buildConverters(field, domainFields, domainClass, converter, mappedBy); // depends on control dependency: [if], data = [none]
}
}
}
addPostConverter(converter, toClass);
return converter;
} }
|
public class class_name {
public int compareTo(Weight anotherWeight) {
boolean wIsInfinity = anotherWeight.isInfinity;
boolean wPosOrNeg = anotherWeight.posOrNeg;
if (isInfinity && wIsInfinity
&& ((posOrNeg && wPosOrNeg) || (!posOrNeg && !wPosOrNeg))) {
return 0;
} else if ((isInfinity && posOrNeg) || (wIsInfinity && !wPosOrNeg)) {
return 1;
} else if ((isInfinity && !posOrNeg) || (wIsInfinity && wPosOrNeg)) {
return -1;
} else if (val < anotherWeight.val) {
return -1;
} else if (val > anotherWeight.val) {
return 1;
} else {
return 0;
}
} }
|
public class class_name {
public int compareTo(Weight anotherWeight) {
boolean wIsInfinity = anotherWeight.isInfinity;
boolean wPosOrNeg = anotherWeight.posOrNeg;
if (isInfinity && wIsInfinity
&& ((posOrNeg && wPosOrNeg) || (!posOrNeg && !wPosOrNeg))) {
return 0; // depends on control dependency: [if], data = [none]
} else if ((isInfinity && posOrNeg) || (wIsInfinity && !wPosOrNeg)) {
return 1; // depends on control dependency: [if], data = [none]
} else if ((isInfinity && !posOrNeg) || (wIsInfinity && wPosOrNeg)) {
return -1; // depends on control dependency: [if], data = [none]
} else if (val < anotherWeight.val) {
return -1; // depends on control dependency: [if], data = [none]
} else if (val > anotherWeight.val) {
return 1; // depends on control dependency: [if], data = [none]
} else {
return 0; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected CompletableFuture<Long> configure(Collection<RaftMember> members) {
raft.checkThread();
final long term = raft.getTerm();
return appendAndCompact(new ConfigurationEntry(term, System.currentTimeMillis(), members))
.thenComposeAsync(entry -> {
// Store the index of the configuration entry in order to prevent other configurations from
// being logged and committed concurrently. This is an important safety property of Raft.
configuring = entry.index();
raft.getCluster().configure(new Configuration(entry.index(), entry.entry().term(), entry.entry().timestamp(), entry.entry().members()));
return appender.appendEntries(entry.index()).whenComplete((commitIndex, commitError) -> {
raft.checkThread();
if (isRunning() && commitError == null) {
raft.getServiceManager().<OperationResult>apply(entry.index());
}
configuring = 0;
});
}, raft.getThreadContext());
} }
|
public class class_name {
protected CompletableFuture<Long> configure(Collection<RaftMember> members) {
raft.checkThread();
final long term = raft.getTerm();
return appendAndCompact(new ConfigurationEntry(term, System.currentTimeMillis(), members))
.thenComposeAsync(entry -> {
// Store the index of the configuration entry in order to prevent other configurations from
// being logged and committed concurrently. This is an important safety property of Raft.
configuring = entry.index();
raft.getCluster().configure(new Configuration(entry.index(), entry.entry().term(), entry.entry().timestamp(), entry.entry().members()));
return appender.appendEntries(entry.index()).whenComplete((commitIndex, commitError) -> {
raft.checkThread();
if (isRunning() && commitError == null) {
raft.getServiceManager().<OperationResult>apply(entry.index()); // depends on control dependency: [if], data = [none]
}
configuring = 0;
});
}, raft.getThreadContext());
} }
|
public class class_name {
private String encodeMap(Map<String, Object> destProps) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "encodeMap", destProps);
// string result to return
StringBuffer result = new StringBuffer("");
// new HashMap which will contain only non-default NVPs
Map<String, Object> nonDefaultProps = new HashMap<String, Object>();
// Deal with each remaining property in turn.
Iterator<Map.Entry<String, Object>> props = destProps.entrySet().iterator();
while (props.hasNext()) {
// Get the name and value of the property.
Map.Entry<String, Object> nextProp = props.next();
String propName = nextProp.getKey();
Object propValue = nextProp.getValue();
// make sure the value part goes out the same as it came in....
// ie. if it contains an un-escaped '&', place '\\' behind it.
// we only do this if the property value is a String.
if (propValue instanceof String) {
propValue = URIDestinationCreator.escapeValueString((String) propValue);
}
// for the name, get the default value
Object propDefaultValue = MsgDestEncodingUtilsImpl.getDefaultPropertyValue(propName);
// check to see if the value we have is the same as the default
if (((propDefaultValue == null) && (propValue == null))
|| ((propDefaultValue != null) && (propDefaultValue.equals(propValue)))) {
// Do nothing - we don't want to waste space encoding default values.
}
else {
// if Queue, we don't want to add DEST_NAME as it will be added later manually
if (this instanceof JmsQueue && !propName.equals(DEST_NAME)) {
// place the non-default name and value in the new HashMap
nonDefaultProps.put(propName, propValue);
}
// we don't want to add DEST_DISCRIM if its a topic, or the topic space if its default,
// or the DEST_NAME, because they get added manually later.
else if (this instanceof JmsTopic
&& !DEST_DISCRIM.equals(propName)
&& !DEST_NAME.equals(propName)
&& !JmsTopicImpl.DEFAULT_TOPIC_SPACE.equals(propValue)) {
if (propValue != null) {
// place the non-default name and value in the new HashMap
nonDefaultProps.put(propName, propValue);
}
}
}
}
// Now prepare to loop through the new HashMap which only contains non-default properties,
// and print each name and value separated by an "&" (unless its the last NVP).
Iterator<Map.Entry<String, Object>> iter = nonDefaultProps.entrySet().iterator();
// Queue specific stuff
if (this instanceof JmsQueue) {
// add the prefix
result.append("queue://");
// get the dest name out of the map
String destName = (String) destProps.get(DEST_NAME);
// guard against null values being printed as "null"
if (destName == null)
destName = "";
// Validate the dest name value to escape unescaped illegal chars.
// These escape chars would have been removed when the dest was created.
destName = URIDestinationCreator.escapeDestName(destName);
// put the name of the queue name as the first part of the result
result.append(destName);
// if there are no more NVPs, we don't want a '?' on the end of the name
if (iter.hasNext()) {
result.append("?");
}
}
// Topic specific stuff
else if (this instanceof JmsTopic) {
// add prefix
result.append("topic://");
// get out the props we know names of
String destName = (String) destProps.get(DEST_DISCRIM);
String topicSpace = (String) destProps.get(DEST_NAME);
// guard against null values being printed as "null"
if (destName == null)
destName = "";
if (topicSpace == null)
topicSpace = "";
// Validate the dest name and topic space values to escape unescaped illegal chars.
// These escape chars would have been removed when the dest was created.
destName = URIDestinationCreator.escapeDestName(destName);
topicSpace = URIDestinationCreator.escapeValueString(topicSpace);
// Add the name of the topic first.
result.append(destName);
// Make sure topic space is the first NVP after topic name.
// We don't want to print the topic space if it is the default value.
if (!JmsTopicImpl.DEFAULT_TOPIC_SPACE.equals(topicSpace)) {
//NB. By putting the constant first we avoid doing null/empty checking.
result.append("?topicSpace=");
result.append(topicSpace);
// Now prepare the string for further properties if they exist.
if (iter.hasNext())
result.append("&");
}
else {
// We have not added the topic space in, but need to prepare the string
// for further properties if they exist.
if (iter.hasNext())
result.append("?");
}
}
// If this isn't a Queue or a Topic, not much we can do other than alert the user
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Destination in question is neither a JmsQueue of JmsTopic");
}
// loop through the non-default NVPs and append to dest name
while (iter.hasNext()) {
Map.Entry<String, Object> nextProp = iter.next();
// Liberty change :
// Setting the name of the bus to null so that it does not get printed in
// the Message
if (nextProp.getKey().equals(BUS_NAME)) {
continue;
}
result.append(nextProp.getKey());
result.append("=");
result.append(nextProp.getValue());
// only append an ampersand if there are more props to come
if (iter.hasNext())
result.append("&");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "encodeMap", result);
return result.toString();
} }
|
public class class_name {
private String encodeMap(Map<String, Object> destProps) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "encodeMap", destProps);
// string result to return
StringBuffer result = new StringBuffer("");
// new HashMap which will contain only non-default NVPs
Map<String, Object> nonDefaultProps = new HashMap<String, Object>();
// Deal with each remaining property in turn.
Iterator<Map.Entry<String, Object>> props = destProps.entrySet().iterator();
while (props.hasNext()) {
// Get the name and value of the property.
Map.Entry<String, Object> nextProp = props.next();
String propName = nextProp.getKey();
Object propValue = nextProp.getValue();
// make sure the value part goes out the same as it came in....
// ie. if it contains an un-escaped '&', place '\\' behind it.
// we only do this if the property value is a String.
if (propValue instanceof String) {
propValue = URIDestinationCreator.escapeValueString((String) propValue); // depends on control dependency: [if], data = [none]
}
// for the name, get the default value
Object propDefaultValue = MsgDestEncodingUtilsImpl.getDefaultPropertyValue(propName);
// check to see if the value we have is the same as the default
if (((propDefaultValue == null) && (propValue == null))
|| ((propDefaultValue != null) && (propDefaultValue.equals(propValue)))) {
// Do nothing - we don't want to waste space encoding default values.
}
else {
// if Queue, we don't want to add DEST_NAME as it will be added later manually
if (this instanceof JmsQueue && !propName.equals(DEST_NAME)) {
// place the non-default name and value in the new HashMap
nonDefaultProps.put(propName, propValue); // depends on control dependency: [if], data = [none]
}
// we don't want to add DEST_DISCRIM if its a topic, or the topic space if its default,
// or the DEST_NAME, because they get added manually later.
else if (this instanceof JmsTopic
&& !DEST_DISCRIM.equals(propName)
&& !DEST_NAME.equals(propName)
&& !JmsTopicImpl.DEFAULT_TOPIC_SPACE.equals(propValue)) {
if (propValue != null) {
// place the non-default name and value in the new HashMap
nonDefaultProps.put(propName, propValue); // depends on control dependency: [if], data = [none]
}
}
}
}
// Now prepare to loop through the new HashMap which only contains non-default properties,
// and print each name and value separated by an "&" (unless its the last NVP).
Iterator<Map.Entry<String, Object>> iter = nonDefaultProps.entrySet().iterator();
// Queue specific stuff
if (this instanceof JmsQueue) {
// add the prefix
result.append("queue://");
// get the dest name out of the map
String destName = (String) destProps.get(DEST_NAME); // depends on control dependency: [if], data = [none]
// guard against null values being printed as "null"
if (destName == null)
destName = "";
// Validate the dest name value to escape unescaped illegal chars.
// These escape chars would have been removed when the dest was created.
destName = URIDestinationCreator.escapeDestName(destName); // depends on control dependency: [if], data = [none]
// put the name of the queue name as the first part of the result
result.append(destName); // depends on control dependency: [if], data = [none]
// if there are no more NVPs, we don't want a '?' on the end of the name
if (iter.hasNext()) {
result.append("?"); // depends on control dependency: [if], data = [none]
}
}
// Topic specific stuff
else if (this instanceof JmsTopic) {
// add prefix
result.append("topic://");
// get out the props we know names of
String destName = (String) destProps.get(DEST_DISCRIM); // depends on control dependency: [if], data = [none]
String topicSpace = (String) destProps.get(DEST_NAME);
// guard against null values being printed as "null"
if (destName == null)
destName = "";
if (topicSpace == null)
topicSpace = "";
// Validate the dest name and topic space values to escape unescaped illegal chars.
// These escape chars would have been removed when the dest was created.
destName = URIDestinationCreator.escapeDestName(destName); // depends on control dependency: [if], data = [none]
topicSpace = URIDestinationCreator.escapeValueString(topicSpace); // depends on control dependency: [if], data = [none]
// Add the name of the topic first.
result.append(destName); // depends on control dependency: [if], data = [none]
// Make sure topic space is the first NVP after topic name.
// We don't want to print the topic space if it is the default value.
if (!JmsTopicImpl.DEFAULT_TOPIC_SPACE.equals(topicSpace)) {
//NB. By putting the constant first we avoid doing null/empty checking.
result.append("?topicSpace="); // depends on control dependency: [if], data = [none]
result.append(topicSpace); // depends on control dependency: [if], data = [none]
// Now prepare the string for further properties if they exist.
if (iter.hasNext())
result.append("&");
}
else {
// We have not added the topic space in, but need to prepare the string
// for further properties if they exist.
if (iter.hasNext())
result.append("?");
}
}
// If this isn't a Queue or a Topic, not much we can do other than alert the user
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Destination in question is neither a JmsQueue of JmsTopic");
}
// loop through the non-default NVPs and append to dest name
while (iter.hasNext()) {
Map.Entry<String, Object> nextProp = iter.next();
// Liberty change :
// Setting the name of the bus to null so that it does not get printed in
// the Message
if (nextProp.getKey().equals(BUS_NAME)) {
continue;
}
result.append(nextProp.getKey()); // depends on control dependency: [while], data = [none]
result.append("="); // depends on control dependency: [while], data = [none]
result.append(nextProp.getValue()); // depends on control dependency: [while], data = [none]
// only append an ampersand if there are more props to come
if (iter.hasNext())
result.append("&");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "encodeMap", result);
return result.toString();
} }
|
public class class_name {
public String[] getDictionaryEntries(String dictionaryName) {
Dictionary dictionary = getDictionary(dictionaryName);
if (dictionary == null) {
logger.error("Cannot find requested dictionary");
return new String[0];
} else {
// FIXME: dummy method that needs an implementation
Entry[] entries = dictionary.getEntries();
String[] entryNames = new String[entries.length];
logger.info("Found ", "" + entryNames.length, " entries in dictionary ", dictionaryName);
for (int i = 0; i < entries.length; i++) {
entryNames[i] = entries[i].getLabel();
}
return entryNames;
}
} }
|
public class class_name {
public String[] getDictionaryEntries(String dictionaryName) {
Dictionary dictionary = getDictionary(dictionaryName);
if (dictionary == null) {
logger.error("Cannot find requested dictionary"); // depends on control dependency: [if], data = [none]
return new String[0]; // depends on control dependency: [if], data = [none]
} else {
// FIXME: dummy method that needs an implementation
Entry[] entries = dictionary.getEntries();
String[] entryNames = new String[entries.length];
logger.info("Found ", "" + entryNames.length, " entries in dictionary ", dictionaryName); // depends on control dependency: [if], data = [none]
for (int i = 0; i < entries.length; i++) {
entryNames[i] = entries[i].getLabel(); // depends on control dependency: [for], data = [i]
}
return entryNames; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void bufferRgbToMsU8( byte []input , Planar<GrayU8> output ) {
GrayU8 band0 = output.getBand(0);
GrayU8 band1 = output.getBand(1);
GrayU8 band2 = output.getBand(2);
int indexIn = 0;
for( int y = 0; y < output.height; y++ ) {
int indexOut = output.startIndex + y*output.stride;
for( int x = 0; x < output.width; x++ , indexOut++ ) {
band0.data[indexOut] = input[indexIn++];
band1.data[indexOut] = input[indexIn++];
band2.data[indexOut] = input[indexIn++];
}
}
} }
|
public class class_name {
public static void bufferRgbToMsU8( byte []input , Planar<GrayU8> output ) {
GrayU8 band0 = output.getBand(0);
GrayU8 band1 = output.getBand(1);
GrayU8 band2 = output.getBand(2);
int indexIn = 0;
for( int y = 0; y < output.height; y++ ) {
int indexOut = output.startIndex + y*output.stride;
for( int x = 0; x < output.width; x++ , indexOut++ ) {
band0.data[indexOut] = input[indexIn++]; // depends on control dependency: [for], data = [none]
band1.data[indexOut] = input[indexIn++]; // depends on control dependency: [for], data = [none]
band2.data[indexOut] = input[indexIn++]; // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public static void checkSize(final int size, final String className) {
if (MemoryUtil.WARN_THRESHOLD < size) {
MemoryUtil.log(className + " may be leaking memory, it contains a large number of items: " + size);
}
} }
|
public class class_name {
public static void checkSize(final int size, final String className) {
if (MemoryUtil.WARN_THRESHOLD < size) {
MemoryUtil.log(className + " may be leaking memory, it contains a large number of items: " + size); // depends on control dependency: [if], data = [size)]
}
} }
|
public class class_name {
public boolean removeSpace() {
int start = pos;
while (pos < text.length && lcText[pos] == ' ') {
pos++;
}
return (start < pos);
} }
|
public class class_name {
public boolean removeSpace() {
int start = pos;
while (pos < text.length && lcText[pos] == ' ') {
pos++; // depends on control dependency: [while], data = [none]
}
return (start < pos);
} }
|
public class class_name {
public boolean remove(int o)
{
if (isEmpty()) {
return false;
}
// the element cannot exist
if (o > last) {
return false;
}
// check if the element can be removed from a literal word
int blockIndex = maxLiteralLengthDivision(o);
int bitPosition = maxLiteralLengthModulus(o);
for (int i = 0; i <= lastWordIndex && blockIndex >= 0; i++) {
final int w = words[i];
if (isLiteral(w)) {
// check if the current literal word is the "right" one
if (blockIndex == 0) {
// the bit is already unset
if ((w & (1 << bitPosition)) == 0) {
return false;
}
// By removing the bit we potentially create a sequence:
// -- If the literal is made up of all ones, it definitely
// cannot be part of a sequence (otherwise it would not have
// been created). Thus, we can create a 30-bit literal word
// -- If there are 2 set bits, by removing the specified
// one we potentially allow for a 1's sequence together with
// the successive word
// -- If there is 1 set bit, by removing the new one we
// potentially allow for a 0's sequence
// together with the successive and/or the preceding words
if (!simulateWAH) {
int bitCount = getLiteralBitCount(w);
if (bitCount <= 2) {
break;
}
} else {
final int l = getLiteralBits(w);
if (l == 0 || containsOnlyOneBit(l)) {
break;
}
}
// unset the bit
words[i] &= ~(1 << bitPosition);
if (size >= 0) {
size--;
}
// if the bit is the maximal element, update it
if (o == last) {
last -= maxLiteralLengthModulus(last) - (ConciseSetUtils.MAX_LITERAL_LENGTH
- Integer.numberOfLeadingZeros(getLiteralBits(words[i])));
}
return true;
}
blockIndex--;
} else {
if (simulateWAH) {
if (isZeroSequence(w) && blockIndex <= getSequenceCount(w)) {
return false;
}
} else {
// if we are at the beginning of a sequence, and it is
// an unset bit, the bit does not exist
if (blockIndex == 0
&& (getLiteral(w) & (1 << bitPosition)) == 0) {
return false;
}
// if we are in the middle of a sequence of 0's, the bit does not exist
if (blockIndex > 0
&& blockIndex <= getSequenceCount(w)
&& isZeroSequence(w)) {
return false;
}
}
// next word
blockIndex -= getSequenceCount(w) + 1;
}
}
// the bit is in the middle of a sequence or it may cause a literal to
// become a sequence, thus the "easiest" way to remove it by ANDNOTing
return replaceWith(performOperation(convert(o), Operator.ANDNOT));
} }
|
public class class_name {
public boolean remove(int o)
{
if (isEmpty()) {
return false;
// depends on control dependency: [if], data = [none]
}
// the element cannot exist
if (o > last) {
return false;
// depends on control dependency: [if], data = [none]
}
// check if the element can be removed from a literal word
int blockIndex = maxLiteralLengthDivision(o);
int bitPosition = maxLiteralLengthModulus(o);
for (int i = 0; i <= lastWordIndex && blockIndex >= 0; i++) {
final int w = words[i];
if (isLiteral(w)) {
// check if the current literal word is the "right" one
if (blockIndex == 0) {
// the bit is already unset
if ((w & (1 << bitPosition)) == 0) {
return false;
// depends on control dependency: [if], data = [none]
}
// By removing the bit we potentially create a sequence:
// -- If the literal is made up of all ones, it definitely
// cannot be part of a sequence (otherwise it would not have
// been created). Thus, we can create a 30-bit literal word
// -- If there are 2 set bits, by removing the specified
// one we potentially allow for a 1's sequence together with
// the successive word
// -- If there is 1 set bit, by removing the new one we
// potentially allow for a 0's sequence
// together with the successive and/or the preceding words
if (!simulateWAH) {
int bitCount = getLiteralBitCount(w);
if (bitCount <= 2) {
break;
}
} else {
final int l = getLiteralBits(w);
if (l == 0 || containsOnlyOneBit(l)) {
break;
}
}
// unset the bit
words[i] &= ~(1 << bitPosition);
// depends on control dependency: [if], data = [none]
if (size >= 0) {
size--;
// depends on control dependency: [if], data = [none]
}
// if the bit is the maximal element, update it
if (o == last) {
last -= maxLiteralLengthModulus(last) - (ConciseSetUtils.MAX_LITERAL_LENGTH
- Integer.numberOfLeadingZeros(getLiteralBits(words[i])));
// depends on control dependency: [if], data = [last)]
}
return true;
// depends on control dependency: [if], data = [none]
}
blockIndex--;
// depends on control dependency: [if], data = [none]
} else {
if (simulateWAH) {
if (isZeroSequence(w) && blockIndex <= getSequenceCount(w)) {
return false;
// depends on control dependency: [if], data = [none]
}
} else {
// if we are at the beginning of a sequence, and it is
// an unset bit, the bit does not exist
if (blockIndex == 0
&& (getLiteral(w) & (1 << bitPosition)) == 0) {
return false;
// depends on control dependency: [if], data = [none]
}
// if we are in the middle of a sequence of 0's, the bit does not exist
if (blockIndex > 0
&& blockIndex <= getSequenceCount(w)
&& isZeroSequence(w)) {
return false;
// depends on control dependency: [if], data = [none]
}
}
// next word
blockIndex -= getSequenceCount(w) + 1;
// depends on control dependency: [if], data = [none]
}
}
// the bit is in the middle of a sequence or it may cause a literal to
// become a sequence, thus the "easiest" way to remove it by ANDNOTing
return replaceWith(performOperation(convert(o), Operator.ANDNOT));
} }
|
public class class_name {
public void tokenizeToKAF(final KAFDocument kaf) throws IOException {
int noSents = 0;
int noParas = 1;
List<List<Token>> tokens;
if (isNoSeg) {
String[] sentences = text.toArray(new String[text.size()]);
tokens = tokenizer.tokenize(sentences);
} else {
final String[] sentences = segmenter.segmentSentence();
tokens = tokenizer.tokenize(sentences);
}
for (final List<Token> tokenizedSentence : tokens) {
noSents = noSents + 1;
for (final Token token : tokenizedSentence) {
if (token.getTokenValue().equals(RuleBasedSegmenter.PARAGRAPH)) {
++noParas;
// TODO debug this
if (noSents < noParas) {
++noSents;
}
} else {
final WF wf = kaf.newWF(token.startOffset(), token.getTokenValue(),
noSents);
wf.setLength(token.tokenLength());
wf.setPara(noParas);
}
}
}
} }
|
public class class_name {
public void tokenizeToKAF(final KAFDocument kaf) throws IOException {
int noSents = 0;
int noParas = 1;
List<List<Token>> tokens;
if (isNoSeg) {
String[] sentences = text.toArray(new String[text.size()]);
tokens = tokenizer.tokenize(sentences);
} else {
final String[] sentences = segmenter.segmentSentence();
tokens = tokenizer.tokenize(sentences);
}
for (final List<Token> tokenizedSentence : tokens) {
noSents = noSents + 1;
for (final Token token : tokenizedSentence) {
if (token.getTokenValue().equals(RuleBasedSegmenter.PARAGRAPH)) {
++noParas; // depends on control dependency: [if], data = [none]
// TODO debug this
if (noSents < noParas) {
++noSents; // depends on control dependency: [if], data = [none]
}
} else {
final WF wf = kaf.newWF(token.startOffset(), token.getTokenValue(),
noSents);
wf.setLength(token.tokenLength()); // depends on control dependency: [if], data = [none]
wf.setPara(noParas); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
@Override
public final void addTransformer(ClassTransformer transformerClass) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "addTransformer: PUID = " + ivArchivePuId + ", transformer = " + transformerClass); //d454146
}
if (transformerClass != null) {
JPAComponent jpaComp = getJPAComponent();
if (jpaComp != null && jpaComp.getCaptureEnhancedEntityClassBytecode()) {
transformerClass = new CapturingClassTransformer(transformerClass, ivApplInfo.getApplName(), jpaComp.getServerLogDirectory());
}
}
ivTransformers.add(transformerClass);
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "addTransformer : # registered transfromer = " + ivTransformers.size());
}
} }
|
public class class_name {
@Override
public final void addTransformer(ClassTransformer transformerClass) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "addTransformer: PUID = " + ivArchivePuId + ", transformer = " + transformerClass); //d454146 // depends on control dependency: [if], data = [none]
}
if (transformerClass != null) {
JPAComponent jpaComp = getJPAComponent();
if (jpaComp != null && jpaComp.getCaptureEnhancedEntityClassBytecode()) {
transformerClass = new CapturingClassTransformer(transformerClass, ivApplInfo.getApplName(), jpaComp.getServerLogDirectory()); // depends on control dependency: [if], data = [none]
}
}
ivTransformers.add(transformerClass);
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "addTransformer : # registered transfromer = " + ivTransformers.size()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Nonnull
public String getAsString (final boolean bPrintZeroElements)
{
// special handling if no ceiling version is present
final StringBuilder aSB = new StringBuilder (m_bIncludeFloor ? "[" : "(");
aSB.append (m_aFloorVersion.getAsString (bPrintZeroElements));
if (m_aCeilVersion != null)
{
aSB.append (',').append (m_aCeilVersion.getAsString (bPrintZeroElements));
}
return aSB.append (m_bIncludeCeil ? ']' : ')').toString ();
} }
|
public class class_name {
@Nonnull
public String getAsString (final boolean bPrintZeroElements)
{
// special handling if no ceiling version is present
final StringBuilder aSB = new StringBuilder (m_bIncludeFloor ? "[" : "(");
aSB.append (m_aFloorVersion.getAsString (bPrintZeroElements));
if (m_aCeilVersion != null)
{
aSB.append (',').append (m_aCeilVersion.getAsString (bPrintZeroElements)); // depends on control dependency: [if], data = [(m_aCeilVersion]
}
return aSB.append (m_bIncludeCeil ? ']' : ')').toString ();
} }
|
public class class_name {
@Override
public List<I_CmsXmlContentValue> getSubValues(String path, Locale locale) {
List<I_CmsXmlContentValue> result = new ArrayList<I_CmsXmlContentValue>();
String bookmark = getBookmarkName(CmsXmlUtils.createXpath(path, 1), locale);
int depth = CmsResource.getPathLevel(bookmark) + 1;
Iterator<String> i = getBookmarks().iterator();
while (i.hasNext()) {
String bm = i.next();
if (bm.startsWith(bookmark) && (CmsResource.getPathLevel(bm) == depth)) {
result.add(getBookmark(bm));
}
}
if (result.size() > 0) {
Collections.sort(result, COMPARE_INDEX);
}
return result;
} }
|
public class class_name {
@Override
public List<I_CmsXmlContentValue> getSubValues(String path, Locale locale) {
List<I_CmsXmlContentValue> result = new ArrayList<I_CmsXmlContentValue>();
String bookmark = getBookmarkName(CmsXmlUtils.createXpath(path, 1), locale);
int depth = CmsResource.getPathLevel(bookmark) + 1;
Iterator<String> i = getBookmarks().iterator();
while (i.hasNext()) {
String bm = i.next();
if (bm.startsWith(bookmark) && (CmsResource.getPathLevel(bm) == depth)) {
result.add(getBookmark(bm)); // depends on control dependency: [if], data = [none]
}
}
if (result.size() > 0) {
Collections.sort(result, COMPARE_INDEX); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
private static ImmutableList<String> immutableCopy(List<String> tags) {
if (tags == null
|| tags.size() == 0
|| (tags.size() == 1 && tags.get(0) == null)) {
return ImmutableList.of();
}
return ImmutableList.copyOf(tags);
} }
|
public class class_name {
private static ImmutableList<String> immutableCopy(List<String> tags) {
if (tags == null
|| tags.size() == 0
|| (tags.size() == 1 && tags.get(0) == null)) {
return ImmutableList.of(); // depends on control dependency: [if], data = [none]
}
return ImmutableList.copyOf(tags);
} }
|
public class class_name {
private void tryBackgroundEnter(boolean focused) {
if (mBackground == null) {
mBackground = new RippleBackground(this, mHotspotBounds);
}
mBackground.setup(mState.mMaxRadius, mDensity);
mBackground.enter(focused);
} }
|
public class class_name {
private void tryBackgroundEnter(boolean focused) {
if (mBackground == null) {
mBackground = new RippleBackground(this, mHotspotBounds); // depends on control dependency: [if], data = [none]
}
mBackground.setup(mState.mMaxRadius, mDensity);
mBackground.enter(focused);
} }
|
public class class_name {
static void setFramePositon(JFrame inTargetFrame) {
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
Dimension size = inTargetFrame.getSize();
// (ulrivo): full size on screen with less than 640 width
if (d.width >= 640) {
inTargetFrame.setLocation((d.width - size.width) / 2,
(d.height - size.height) / 2);
} else {
inTargetFrame.setLocation(0, 0);
inTargetFrame.setSize(d);
}
} }
|
public class class_name {
static void setFramePositon(JFrame inTargetFrame) {
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
Dimension size = inTargetFrame.getSize();
// (ulrivo): full size on screen with less than 640 width
if (d.width >= 640) {
inTargetFrame.setLocation((d.width - size.width) / 2,
(d.height - size.height) / 2); // depends on control dependency: [if], data = [(d.width]
} else {
inTargetFrame.setLocation(0, 0); // depends on control dependency: [if], data = [none]
inTargetFrame.setSize(d); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void addItemForLogger(Logger logger) {
Item item = m_container.addItem(logger);
if (item != null) {
item.getItemProperty(TableColumn.Channel).setValue(logger.getName());
Logger parent = logger.getParent();
item.getItemProperty(TableColumn.ParentChannel).setValue(parent != null ? parent.getName() : "none");
item.getItemProperty(TableColumn.File).setValue(getLogFiles(logger));
item.getItemProperty(TableColumn.Level).setValue(LoggerLevel.fromLogger(logger));
}
} }
|
public class class_name {
public void addItemForLogger(Logger logger) {
Item item = m_container.addItem(logger);
if (item != null) {
item.getItemProperty(TableColumn.Channel).setValue(logger.getName()); // depends on control dependency: [if], data = [none]
Logger parent = logger.getParent();
item.getItemProperty(TableColumn.ParentChannel).setValue(parent != null ? parent.getName() : "none"); // depends on control dependency: [if], data = [none]
item.getItemProperty(TableColumn.File).setValue(getLogFiles(logger)); // depends on control dependency: [if], data = [none]
item.getItemProperty(TableColumn.Level).setValue(LoggerLevel.fromLogger(logger)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private boolean isDuplicateName(String name) {
if (this.existingNames != null) {
final String newName = Strings.nullToEmpty(name);
for (final String existingName : this.existingNames) {
if (newName.equals(existingName)) {
return true;
}
}
}
return false;
} }
|
public class class_name {
private boolean isDuplicateName(String name) {
if (this.existingNames != null) {
final String newName = Strings.nullToEmpty(name);
for (final String existingName : this.existingNames) {
if (newName.equals(existingName)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
public void setCodePage(DBaseCodePage code) {
if (this.columns != null) {
throw new IllegalStateException();
}
if (code != null) {
this.language = code;
}
} }
|
public class class_name {
public void setCodePage(DBaseCodePage code) {
if (this.columns != null) {
throw new IllegalStateException();
}
if (code != null) {
this.language = code; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static <K extends SpecificRecord, S extends SpecificRecord> Dao<Map<String, S>> buildCompositeDaoWithEntityManager(
HTablePool tablePool, String tableName, List<Class<S>> subEntityClasses,
SchemaManager schemaManager) {
List<EntityMapper<S>> entityMappers = new ArrayList<EntityMapper<S>>();
for (Class<S> subEntityClass : subEntityClasses) {
String entityName = getSchemaFromEntityClass(subEntityClass).getName();
entityMappers.add(new VersionedAvroEntityMapper.Builder()
.setSchemaManager(schemaManager).setTableName(tableName)
.setEntityName(entityName).setSpecific(true)
.<S> build());
}
return new SpecificMapCompositeAvroDao<S>(tablePool, tableName,
entityMappers);
} }
|
public class class_name {
public static <K extends SpecificRecord, S extends SpecificRecord> Dao<Map<String, S>> buildCompositeDaoWithEntityManager(
HTablePool tablePool, String tableName, List<Class<S>> subEntityClasses,
SchemaManager schemaManager) {
List<EntityMapper<S>> entityMappers = new ArrayList<EntityMapper<S>>();
for (Class<S> subEntityClass : subEntityClasses) {
String entityName = getSchemaFromEntityClass(subEntityClass).getName();
entityMappers.add(new VersionedAvroEntityMapper.Builder()
.setSchemaManager(schemaManager).setTableName(tableName)
.setEntityName(entityName).setSpecific(true)
.<S> build()); // depends on control dependency: [for], data = [none]
}
return new SpecificMapCompositeAvroDao<S>(tablePool, tableName,
entityMappers);
} }
|
public class class_name {
private void setupProxyIfNeeded(HttpClientBuilder builder) {
if (httpProxy != null) {
builder.setProxy(new HttpHost(httpProxy.getHost(),httpProxy.getPort()));
if (httpProxy.getUser() != null) {
AuthScope proxyAuthScope = new AuthScope(httpProxy.getHost(),httpProxy.getPort());
UsernamePasswordCredentials proxyCredentials = new UsernamePasswordCredentials(httpProxy.getUser(),httpProxy.getPass());
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(proxyAuthScope,proxyCredentials);
builder.setDefaultCredentialsProvider(credentialsProvider);
}
}
} }
|
public class class_name {
private void setupProxyIfNeeded(HttpClientBuilder builder) {
if (httpProxy != null) {
builder.setProxy(new HttpHost(httpProxy.getHost(),httpProxy.getPort())); // depends on control dependency: [if], data = [(httpProxy]
if (httpProxy.getUser() != null) {
AuthScope proxyAuthScope = new AuthScope(httpProxy.getHost(),httpProxy.getPort());
UsernamePasswordCredentials proxyCredentials = new UsernamePasswordCredentials(httpProxy.getUser(),httpProxy.getPass());
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(proxyAuthScope,proxyCredentials); // depends on control dependency: [if], data = [none]
builder.setDefaultCredentialsProvider(credentialsProvider); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
Element evaluateXPathNodeNS(Node contextNode, NamespaceContext namespaceContext, String expression, Object... args) {
if (args.length > 0) {
expression = Strings.format(expression, args);
}
Node node = null;
try {
XPath xpath = XPathFactory.newInstance().newXPath();
if (namespaceContext != null) {
xpath.setNamespaceContext(namespaceContext);
}
Object result = xpath.evaluate(expression, contextNode, XPathConstants.NODE);
if (result == null) {
return null;
}
node = (Node) result;
if (node.getNodeType() != Node.ELEMENT_NODE) {
log.debug("XPath expression |%s| on |%s| yields a node that is not element. Force to null.", xpath, contextNode);
return null;
}
} catch (XPathExpressionException e) {
throw new DomException(e);
}
return getElement(node);
} }
|
public class class_name {
Element evaluateXPathNodeNS(Node contextNode, NamespaceContext namespaceContext, String expression, Object... args) {
if (args.length > 0) {
expression = Strings.format(expression, args);
// depends on control dependency: [if], data = [none]
}
Node node = null;
try {
XPath xpath = XPathFactory.newInstance().newXPath();
if (namespaceContext != null) {
xpath.setNamespaceContext(namespaceContext);
// depends on control dependency: [if], data = [(namespaceContext]
}
Object result = xpath.evaluate(expression, contextNode, XPathConstants.NODE);
if (result == null) {
return null;
// depends on control dependency: [if], data = [none]
}
node = (Node) result;
// depends on control dependency: [try], data = [none]
if (node.getNodeType() != Node.ELEMENT_NODE) {
log.debug("XPath expression |%s| on |%s| yields a node that is not element. Force to null.", xpath, contextNode);
// depends on control dependency: [if], data = [none]
return null;
// depends on control dependency: [if], data = [none]
}
} catch (XPathExpressionException e) {
throw new DomException(e);
}
// depends on control dependency: [catch], data = [none]
return getElement(node);
} }
|
public class class_name {
Optional<ExecutableElement> findGetterMethodFor(Element field) {
String getterName = getterNameFor(field);
// FIXME refine this to discover one of possible overloaded methods with correct signature (i.e. single arg of field type)
TypeElement typeElement = classElementFor(field);
if (typeElement == null) {
return Optional.empty();
}
List<? extends Element> elements = typeElement.getEnclosedElements();
List<ExecutableElement> methods = ElementFilter.methodsIn(elements);
return methods.stream()
.filter(method -> {
String methodName = method.getSimpleName().toString();
if (getterName.equals(methodName)) {
Set<Modifier> modifiers = method.getModifiers();
return
// it's not static
!modifiers.contains(STATIC)
// it's either public or package visibility
&& modifiers.contains(PUBLIC)
|| !(modifiers.contains(PRIVATE) || modifiers.contains(PROTECTED));
}
return false;
})
.findFirst();
} }
|
public class class_name {
Optional<ExecutableElement> findGetterMethodFor(Element field) {
String getterName = getterNameFor(field);
// FIXME refine this to discover one of possible overloaded methods with correct signature (i.e. single arg of field type)
TypeElement typeElement = classElementFor(field);
if (typeElement == null) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
List<? extends Element> elements = typeElement.getEnclosedElements();
List<ExecutableElement> methods = ElementFilter.methodsIn(elements);
return methods.stream()
.filter(method -> {
String methodName = method.getSimpleName().toString();
if (getterName.equals(methodName)) {
Set<Modifier> modifiers = method.getModifiers();
return
// it's not static
!modifiers.contains(STATIC)
// it's either public or package visibility
&& modifiers.contains(PUBLIC)
|| !(modifiers.contains(PRIVATE) || modifiers.contains(PROTECTED)); // depends on control dependency: [if], data = [none]
}
return false;
})
.findFirst();
} }
|
public class class_name {
@Override
public Method resolveFunction(String prefix, String localName) {
Function f = this.functions.get(prefix + ":" + localName);
if (f == null) {
return null;
}
return f.getMethod();
} }
|
public class class_name {
@Override
public Method resolveFunction(String prefix, String localName) {
Function f = this.functions.get(prefix + ":" + localName);
if (f == null) {
return null; // depends on control dependency: [if], data = [none]
}
return f.getMethod();
} }
|
public class class_name {
private static boolean processIntList(CharIter iter, char sep, List<Integer> dest) {
while (iter.hasNext()) {
char c = iter.curr();
if (isDigit(c)) {
int r = processUnsignedInt(iter);
if (r < 0) return false;
iter.nextIf(sep);
dest.add(r);
} else {
return true;
}
}
// ran off end
return false;
} }
|
public class class_name {
private static boolean processIntList(CharIter iter, char sep, List<Integer> dest) {
while (iter.hasNext()) {
char c = iter.curr();
if (isDigit(c)) {
int r = processUnsignedInt(iter);
if (r < 0) return false;
iter.nextIf(sep); // depends on control dependency: [if], data = [none]
dest.add(r); // depends on control dependency: [if], data = [none]
} else {
return true; // depends on control dependency: [if], data = [none]
}
}
// ran off end
return false;
} }
|
public class class_name {
private InputStream getDeliverableContent(Deliverable deliverable)
{
URL url = null;
try
{
String uriStart = getHostForLaunch(deliverable.getJobId());
url = new URL(uriStart + "/ws/simple/file?id=" + deliverable.getRandomId());
jqmlogger.trace("URL: " + url.toString());
}
catch (MalformedURLException e)
{
throw new JqmClientException("URL is not valid " + url, e);
}
return getFile(url.toString());
} }
|
public class class_name {
private InputStream getDeliverableContent(Deliverable deliverable)
{
URL url = null;
try
{
String uriStart = getHostForLaunch(deliverable.getJobId());
url = new URL(uriStart + "/ws/simple/file?id=" + deliverable.getRandomId()); // depends on control dependency: [try], data = [none]
jqmlogger.trace("URL: " + url.toString()); // depends on control dependency: [try], data = [none]
}
catch (MalformedURLException e)
{
throw new JqmClientException("URL is not valid " + url, e);
} // depends on control dependency: [catch], data = [none]
return getFile(url.toString());
} }
|
public class class_name {
public Query adding( Column... columns ) {
List<Column> newColumns = null;
if (this.columns != null) {
newColumns = new ArrayList<Column>(this.columns);
for (Column column : columns) {
newColumns.add(column);
}
} else {
newColumns = Arrays.asList(columns);
}
return new Query(source, constraint, orderings(), newColumns, getLimits(), distinct);
} }
|
public class class_name {
public Query adding( Column... columns ) {
List<Column> newColumns = null;
if (this.columns != null) {
newColumns = new ArrayList<Column>(this.columns); // depends on control dependency: [if], data = [(this.columns]
for (Column column : columns) {
newColumns.add(column); // depends on control dependency: [for], data = [column]
}
} else {
newColumns = Arrays.asList(columns); // depends on control dependency: [if], data = [none]
}
return new Query(source, constraint, orderings(), newColumns, getLimits(), distinct);
} }
|
public class class_name {
public void getFeature(int lat, int lon) {
info("*** GetFeature: lat={0} lon={1}", lat, lon);
Point request = Point.newBuilder().setLatitude(lat).setLongitude(lon).build();
Feature feature;
try {
feature = blockingStub.getFeature(request);
if (testHelper != null) {
testHelper.onMessage(feature);
}
} catch (StatusRuntimeException e) {
warning("RPC failed: {0}", e.getStatus());
if (testHelper != null) {
testHelper.onRpcError(e);
}
return;
}
if (RouteGuideUtil.exists(feature)) {
info("Found feature called \"{0}\" at {1}, {2}",
feature.getName(),
RouteGuideUtil.getLatitude(feature.getLocation()),
RouteGuideUtil.getLongitude(feature.getLocation()));
} else {
info("Found no feature at {0}, {1}",
RouteGuideUtil.getLatitude(feature.getLocation()),
RouteGuideUtil.getLongitude(feature.getLocation()));
}
} }
|
public class class_name {
public void getFeature(int lat, int lon) {
info("*** GetFeature: lat={0} lon={1}", lat, lon);
Point request = Point.newBuilder().setLatitude(lat).setLongitude(lon).build();
Feature feature;
try {
feature = blockingStub.getFeature(request); // depends on control dependency: [try], data = [none]
if (testHelper != null) {
testHelper.onMessage(feature); // depends on control dependency: [if], data = [none]
}
} catch (StatusRuntimeException e) {
warning("RPC failed: {0}", e.getStatus());
if (testHelper != null) {
testHelper.onRpcError(e); // depends on control dependency: [if], data = [none]
}
return;
} // depends on control dependency: [catch], data = [none]
if (RouteGuideUtil.exists(feature)) {
info("Found feature called \"{0}\" at {1}, {2}",
feature.getName(),
RouteGuideUtil.getLatitude(feature.getLocation()),
RouteGuideUtil.getLongitude(feature.getLocation())); // depends on control dependency: [if], data = [none]
} else {
info("Found no feature at {0}, {1}",
RouteGuideUtil.getLatitude(feature.getLocation()),
RouteGuideUtil.getLongitude(feature.getLocation())); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private Map<ServiceInstanceToken, InstanceHealthPair> getCacheServiceInstances() {
if (instanceCache == null) {
synchronized (this) {
if (instanceCache == null) {
instanceCache = new ConcurrentHashMap<ServiceInstanceToken, InstanceHealthPair>();
initJobTasks();
}
}
}
return instanceCache;
} }
|
public class class_name {
private Map<ServiceInstanceToken, InstanceHealthPair> getCacheServiceInstances() {
if (instanceCache == null) {
synchronized (this) { // depends on control dependency: [if], data = [none]
if (instanceCache == null) {
instanceCache = new ConcurrentHashMap<ServiceInstanceToken, InstanceHealthPair>(); // depends on control dependency: [if], data = [none]
initJobTasks(); // depends on control dependency: [if], data = [none]
}
}
}
return instanceCache;
} }
|
public class class_name {
public TagHandler getHandler(Tag tag) {
if (handlers.containsKey(tag.getName())) {
return handlers.get(tag.getName());
}
return null;
} }
|
public class class_name {
public TagHandler getHandler(Tag tag) {
if (handlers.containsKey(tag.getName())) {
return handlers.get(tag.getName()); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
protected double[] modifyPriorVector(double P[], double u, Random r, boolean skew) {
for (int j = 0; j < P.length; j++) {
if (r.nextDouble() < u) {
P[j] = r.nextDouble();
}
}
return P;
} }
|
public class class_name {
protected double[] modifyPriorVector(double P[], double u, Random r, boolean skew) {
for (int j = 0; j < P.length; j++) {
if (r.nextDouble() < u) {
P[j] = r.nextDouble(); // depends on control dependency: [if], data = [none]
}
}
return P;
} }
|
public class class_name {
public int sumConsumptions(Collection<VM> ids, boolean undef) {
int s = 0;
for (VM u: ids) {
if (consumptionDefined(u) || undef) {
s += vmsConsumption.get(u);
}
}
return s;
} }
|
public class class_name {
public int sumConsumptions(Collection<VM> ids, boolean undef) {
int s = 0;
for (VM u: ids) {
if (consumptionDefined(u) || undef) {
s += vmsConsumption.get(u); // depends on control dependency: [if], data = [none]
}
}
return s;
} }
|
public class class_name {
public void setPoolAddressRanges(java.util.Collection<PublicIpv4PoolRange> poolAddressRanges) {
if (poolAddressRanges == null) {
this.poolAddressRanges = null;
return;
}
this.poolAddressRanges = new com.amazonaws.internal.SdkInternalList<PublicIpv4PoolRange>(poolAddressRanges);
} }
|
public class class_name {
public void setPoolAddressRanges(java.util.Collection<PublicIpv4PoolRange> poolAddressRanges) {
if (poolAddressRanges == null) {
this.poolAddressRanges = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.poolAddressRanges = new com.amazonaws.internal.SdkInternalList<PublicIpv4PoolRange>(poolAddressRanges);
} }
|
public class class_name {
public final void setExceptionTimestamp(long value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setExceptionTimestamp", Long.valueOf(value));
boolean wasEmpty = (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) == JsHdr2Access.IS_EXCEPTION_EMPTY);
getHdr2().setLongField(JsHdr2Access.EXCEPTION_DETAIL_TIMESTAMP, value);
if (wasEmpty)
{
// Need to mark the optional exception fields as empty
getHdr2().setChoiceField(JsHdr2Access.EXCEPTION_DETAIL_PROBLEMDESTINATION, JsHdr2Access.IS_EXCEPTION_DETAIL_PROBLEMDESTINATION_EMPTY);
getHdr2().setChoiceField(JsHdr2Access.EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION, JsHdr2Access.IS_EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION_EMPTY);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setExceptionTimestamp");
} }
|
public class class_name {
public final void setExceptionTimestamp(long value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setExceptionTimestamp", Long.valueOf(value));
boolean wasEmpty = (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) == JsHdr2Access.IS_EXCEPTION_EMPTY);
getHdr2().setLongField(JsHdr2Access.EXCEPTION_DETAIL_TIMESTAMP, value);
if (wasEmpty)
{
// Need to mark the optional exception fields as empty
getHdr2().setChoiceField(JsHdr2Access.EXCEPTION_DETAIL_PROBLEMDESTINATION, JsHdr2Access.IS_EXCEPTION_DETAIL_PROBLEMDESTINATION_EMPTY); // depends on control dependency: [if], data = [none]
getHdr2().setChoiceField(JsHdr2Access.EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION, JsHdr2Access.IS_EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION_EMPTY); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setExceptionTimestamp");
} }
|
public class class_name {
protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType, Object... args) {
Object returnObject = invokeJavascript(function, args);
if (returnObject != null) {
return (T) returnObject;
} else {
return null;
}
} }
|
public class class_name {
protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType, Object... args) {
Object returnObject = invokeJavascript(function, args);
if (returnObject != null) {
return (T) returnObject; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Builder addPredicates(int index, Predicate... predicates) {
while (index >= this.predicates.size()) {
this.predicates.add(new ArrayList<>());
}
this.predicates.get(index).addAll(new ArrayList<>(Arrays.asList(predicates)));
return self();
} }
|
public class class_name {
public Builder addPredicates(int index, Predicate... predicates) {
while (index >= this.predicates.size()) {
this.predicates.add(new ArrayList<>()); // depends on control dependency: [while], data = [none]
}
this.predicates.get(index).addAll(new ArrayList<>(Arrays.asList(predicates)));
return self();
} }
|
public class class_name {
public boolean hasSolution(Pattern p, BioPAXElement ... ele)
{
Match m = new Match(p.size());
for (int i = 0; i < ele.length; i++)
{
m.set(ele[i], i);
}
return !search(m, p).isEmpty();
} }
|
public class class_name {
public boolean hasSolution(Pattern p, BioPAXElement ... ele)
{
Match m = new Match(p.size());
for (int i = 0; i < ele.length; i++)
{
m.set(ele[i], i); // depends on control dependency: [for], data = [i]
}
return !search(m, p).isEmpty();
} }
|
public class class_name {
public void marshall(AttachmentsSource attachmentsSource, ProtocolMarshaller protocolMarshaller) {
if (attachmentsSource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(attachmentsSource.getKey(), KEY_BINDING);
protocolMarshaller.marshall(attachmentsSource.getValues(), VALUES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(AttachmentsSource attachmentsSource, ProtocolMarshaller protocolMarshaller) {
if (attachmentsSource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(attachmentsSource.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(attachmentsSource.getValues(), VALUES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected String convertIdentifierPattern(final String pattern, boolean datanucleusFormat) {
if (pattern == null) {
return convertPattern("%", true);
} else {
return convertPattern(pattern, datanucleusFormat);
}
} }
|
public class class_name {
protected String convertIdentifierPattern(final String pattern, boolean datanucleusFormat) {
if (pattern == null) {
return convertPattern("%", true); // depends on control dependency: [if], data = [none]
} else {
return convertPattern(pattern, datanucleusFormat); // depends on control dependency: [if], data = [(pattern]
}
} }
|
public class class_name {
public static <V> void removeVertices(DirectedGraph<V, DefaultEdge> graph, Set<V> vertices) {
for (V vertex : vertices) {
if (graph.containsVertex(vertex)) {
graph.removeVertex(vertex);
}
}
} }
|
public class class_name {
public static <V> void removeVertices(DirectedGraph<V, DefaultEdge> graph, Set<V> vertices) {
for (V vertex : vertices) {
if (graph.containsVertex(vertex)) {
graph.removeVertex(vertex); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private void resizeWindowIfNecessary(int newSize) {
try {
int numberOfLinesToLoad = newSize - this.lineQueue.size();
for (int i = 0; i < numberOfLinesToLoad; i++) {
String nextLine = getNextLine();
if (nextLine != null) {
lineQueue.addLast(nextLine);
} else {
throw new IndexOutOfBoundsException("End of stream has been reached!");
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
private void resizeWindowIfNecessary(int newSize) {
try {
int numberOfLinesToLoad = newSize - this.lineQueue.size();
for (int i = 0; i < numberOfLinesToLoad; i++) {
String nextLine = getNextLine();
if (nextLine != null) {
lineQueue.addLast(nextLine); // depends on control dependency: [if], data = [(nextLine]
} else {
throw new IndexOutOfBoundsException("End of stream has been reached!");
}
}
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void proxyTo(final List<? extends URI> uris) {
for (URI uri : uris)
{
if(uri == null) {
throw new NullPointerException("URI can't be null");
}
if(!JainSipUtils.checkScheme(uri.toString())) {
throw new IllegalArgumentException("Scheme " + uri.getScheme() + " is not supported");
}
final ProxyBranchImpl branch = new ProxyBranchImpl((URI) uri, this);
branch.setRecordRoute(recordRoutingEnabled);
branch.setRecurse(recurse);
this.proxyBranches.put(uri, branch);
}
startProxy();
} }
|
public class class_name {
public void proxyTo(final List<? extends URI> uris) {
for (URI uri : uris)
{
if(uri == null) {
throw new NullPointerException("URI can't be null");
}
if(!JainSipUtils.checkScheme(uri.toString())) {
throw new IllegalArgumentException("Scheme " + uri.getScheme() + " is not supported");
}
final ProxyBranchImpl branch = new ProxyBranchImpl((URI) uri, this);
branch.setRecordRoute(recordRoutingEnabled);
// depends on control dependency: [for], data = [none]
branch.setRecurse(recurse);
// depends on control dependency: [for], data = [none]
this.proxyBranches.put(uri, branch);
// depends on control dependency: [for], data = [uri]
}
startProxy();
} }
|
public class class_name {
@Override
public final Scene remove(final Layer layer)
{
if ((null != layer) && (LienzoCore.IS_CANVAS_SUPPORTED))
{
if (getChildNodes().contains(layer))
{
getElement().removeChild(layer.getElement());
}
super.remove(layer);
}
return this;
} }
|
public class class_name {
@Override
public final Scene remove(final Layer layer)
{
if ((null != layer) && (LienzoCore.IS_CANVAS_SUPPORTED))
{
if (getChildNodes().contains(layer))
{
getElement().removeChild(layer.getElement()); // depends on control dependency: [if], data = [none]
}
super.remove(layer); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public void removeFilter(String filterName)
{
Filter filter = getFilterByName(filterName);
if (filter != null)
{
if (filter.isTaskFilter())
{
m_taskFilters.remove(filter);
}
if (filter.isResourceFilter())
{
m_resourceFilters.remove(filter);
}
m_filtersByName.remove(filterName);
m_filtersByID.remove(filter.getID());
}
} }
|
public class class_name {
public void removeFilter(String filterName)
{
Filter filter = getFilterByName(filterName);
if (filter != null)
{
if (filter.isTaskFilter())
{
m_taskFilters.remove(filter); // depends on control dependency: [if], data = [none]
}
if (filter.isResourceFilter())
{
m_resourceFilters.remove(filter); // depends on control dependency: [if], data = [none]
}
m_filtersByName.remove(filterName); // depends on control dependency: [if], data = [(filter]
m_filtersByID.remove(filter.getID()); // depends on control dependency: [if], data = [(filter]
}
} }
|
public class class_name {
public SqlRepositoryBuilder withSchema(String schemaName) {
if (schemaName != null && !schemaName.isEmpty()) {
this.schemaName = schemaName;
}
return this;
} }
|
public class class_name {
public SqlRepositoryBuilder withSchema(String schemaName) {
if (schemaName != null && !schemaName.isEmpty()) {
this.schemaName = schemaName; // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
@Override
public boolean addData(IoBuffer data) {
if (!this.canHandleData(data)) {
return false;
}
data.get();
this.updateSize(data);
int idx = 0;
int pos = 0;
byte[] tmpData = new byte[this.blockDataSize];
int countBlocks = this.blockCount;
while (data.remaining() > 0 && countBlocks > 0) {
short size = data.getShort();
countBlocks--;
if (size == 0) {
// Block has not been modified
idx += 1;
pos += this.blockDataSize;
continue;
}
// Store new block data
this.blockSize[idx] = size;
data.get(tmpData, 0, size);
System.arraycopy(tmpData, 0, this.blockData, pos, size);
idx += 1;
pos += this.blockDataSize;
}
data.rewind();
return true;
} }
|
public class class_name {
@Override
public boolean addData(IoBuffer data) {
if (!this.canHandleData(data)) {
return false;
// depends on control dependency: [if], data = [none]
}
data.get();
this.updateSize(data);
int idx = 0;
int pos = 0;
byte[] tmpData = new byte[this.blockDataSize];
int countBlocks = this.blockCount;
while (data.remaining() > 0 && countBlocks > 0) {
short size = data.getShort();
countBlocks--;
// depends on control dependency: [while], data = [none]
if (size == 0) {
// Block has not been modified
idx += 1;
// depends on control dependency: [if], data = [none]
pos += this.blockDataSize;
// depends on control dependency: [if], data = [none]
continue;
}
// Store new block data
this.blockSize[idx] = size;
// depends on control dependency: [while], data = [none]
data.get(tmpData, 0, size);
// depends on control dependency: [while], data = [none]
System.arraycopy(tmpData, 0, this.blockData, pos, size);
// depends on control dependency: [while], data = [none]
idx += 1;
// depends on control dependency: [while], data = [none]
pos += this.blockDataSize;
// depends on control dependency: [while], data = [none]
}
data.rewind();
return true;
} }
|
public class class_name {
@Override
public CommerceCountry fetchByG_N(long groupId, int numericISOCode,
boolean retrieveFromCache) {
Object[] finderArgs = new Object[] { groupId, numericISOCode };
Object result = null;
if (retrieveFromCache) {
result = finderCache.getResult(FINDER_PATH_FETCH_BY_G_N,
finderArgs, this);
}
if (result instanceof CommerceCountry) {
CommerceCountry commerceCountry = (CommerceCountry)result;
if ((groupId != commerceCountry.getGroupId()) ||
(numericISOCode != commerceCountry.getNumericISOCode())) {
result = null;
}
}
if (result == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_SELECT_COMMERCECOUNTRY_WHERE);
query.append(_FINDER_COLUMN_G_N_GROUPID_2);
query.append(_FINDER_COLUMN_G_N_NUMERICISOCODE_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
qPos.add(numericISOCode);
List<CommerceCountry> list = q.list();
if (list.isEmpty()) {
finderCache.putResult(FINDER_PATH_FETCH_BY_G_N, finderArgs,
list);
}
else {
CommerceCountry commerceCountry = list.get(0);
result = commerceCountry;
cacheResult(commerceCountry);
}
}
catch (Exception e) {
finderCache.removeResult(FINDER_PATH_FETCH_BY_G_N, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
if (result instanceof List<?>) {
return null;
}
else {
return (CommerceCountry)result;
}
} }
|
public class class_name {
@Override
public CommerceCountry fetchByG_N(long groupId, int numericISOCode,
boolean retrieveFromCache) {
Object[] finderArgs = new Object[] { groupId, numericISOCode };
Object result = null;
if (retrieveFromCache) {
result = finderCache.getResult(FINDER_PATH_FETCH_BY_G_N,
finderArgs, this); // depends on control dependency: [if], data = [none]
}
if (result instanceof CommerceCountry) {
CommerceCountry commerceCountry = (CommerceCountry)result;
if ((groupId != commerceCountry.getGroupId()) ||
(numericISOCode != commerceCountry.getNumericISOCode())) {
result = null; // depends on control dependency: [if], data = [none]
}
}
if (result == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_SELECT_COMMERCECOUNTRY_WHERE); // depends on control dependency: [if], data = [none]
query.append(_FINDER_COLUMN_G_N_GROUPID_2); // depends on control dependency: [if], data = [none]
query.append(_FINDER_COLUMN_G_N_NUMERICISOCODE_2); // depends on control dependency: [if], data = [none]
String sql = query.toString();
Session session = null;
try {
session = openSession(); // depends on control dependency: [try], data = [none]
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId); // depends on control dependency: [try], data = [none]
qPos.add(numericISOCode); // depends on control dependency: [try], data = [none]
List<CommerceCountry> list = q.list();
if (list.isEmpty()) {
finderCache.putResult(FINDER_PATH_FETCH_BY_G_N, finderArgs,
list); // depends on control dependency: [if], data = [none]
}
else {
CommerceCountry commerceCountry = list.get(0);
result = commerceCountry; // depends on control dependency: [if], data = [none]
cacheResult(commerceCountry); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e) {
finderCache.removeResult(FINDER_PATH_FETCH_BY_G_N, finderArgs);
throw processException(e);
} // depends on control dependency: [catch], data = [none]
finally {
closeSession(session);
}
}
if (result instanceof List<?>) {
return null; // depends on control dependency: [if], data = [none]
}
else {
return (CommerceCountry)result; // depends on control dependency: [if], data = [)]
}
} }
|
public class class_name {
public static String[] stripAll(final String[] strs, final String stripChars) {
int strsLen;
if (strs == null || (strsLen = strs.length) == 0) {
return strs;
}
final String[] newArr = new String[strsLen];
for (int i = 0; i < strsLen; i++) {
newArr[i] = strip(strs[i], stripChars);
}
return newArr;
} }
|
public class class_name {
public static String[] stripAll(final String[] strs, final String stripChars) {
int strsLen;
if (strs == null || (strsLen = strs.length) == 0) {
return strs; // depends on control dependency: [if], data = [none]
}
final String[] newArr = new String[strsLen];
for (int i = 0; i < strsLen; i++) {
newArr[i] = strip(strs[i], stripChars); // depends on control dependency: [for], data = [i]
}
return newArr;
} }
|
public class class_name {
public static void enableAutoRead(Channel channel) {
if (!channel.config().isAutoRead()) {
channel.config().setAutoRead(true);
channel.read();
}
} }
|
public class class_name {
public static void enableAutoRead(Channel channel) {
if (!channel.config().isAutoRead()) {
channel.config().setAutoRead(true); // depends on control dependency: [if], data = [none]
channel.read(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(ListUsersInGroupRequest listUsersInGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (listUsersInGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listUsersInGroupRequest.getUserPoolId(), USERPOOLID_BINDING);
protocolMarshaller.marshall(listUsersInGroupRequest.getGroupName(), GROUPNAME_BINDING);
protocolMarshaller.marshall(listUsersInGroupRequest.getLimit(), LIMIT_BINDING);
protocolMarshaller.marshall(listUsersInGroupRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListUsersInGroupRequest listUsersInGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (listUsersInGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listUsersInGroupRequest.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listUsersInGroupRequest.getGroupName(), GROUPNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listUsersInGroupRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listUsersInGroupRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static EntropyStats entropy(SparseMatrix m) {
double sum = 0;
double[] colSums = new double[m.columns()];
double[] rowSums = new double[m.rows()];
for (int r = 0; r < m.rows(); ++r) {
SparseDoubleVector sv = m.getRowVector(r);
for (int c : sv.getNonZeroIndices()) {
double v = m.get(r, c);
sum += v;
colSums[c] += v;
rowSums[r] += v;
}
}
double entropy = 0;
double[] colEntropy = new double[m.columns()];
double[] rowEntropy = new double[m.rows()];
for (int r = 0; r < m.rows(); ++r) {
SparseDoubleVector sv = m.getRowVector(r);
for (int c : sv.getNonZeroIndices()) {
double v = m.get(r, c);
entropy -= entropy(v, sum);
colEntropy[c] -= entropy(v, colSums[c]);
rowEntropy[r] -= entropy(v, rowSums[r]);
}
}
return new EntropyStats(entropy, colEntropy, rowEntropy);
} }
|
public class class_name {
public static EntropyStats entropy(SparseMatrix m) {
double sum = 0;
double[] colSums = new double[m.columns()];
double[] rowSums = new double[m.rows()];
for (int r = 0; r < m.rows(); ++r) {
SparseDoubleVector sv = m.getRowVector(r);
for (int c : sv.getNonZeroIndices()) {
double v = m.get(r, c);
sum += v; // depends on control dependency: [for], data = [none]
colSums[c] += v; // depends on control dependency: [for], data = [c]
rowSums[r] += v; // depends on control dependency: [for], data = [none]
}
}
double entropy = 0;
double[] colEntropy = new double[m.columns()];
double[] rowEntropy = new double[m.rows()];
for (int r = 0; r < m.rows(); ++r) {
SparseDoubleVector sv = m.getRowVector(r);
for (int c : sv.getNonZeroIndices()) {
double v = m.get(r, c);
entropy -= entropy(v, sum); // depends on control dependency: [for], data = [none]
colEntropy[c] -= entropy(v, colSums[c]); // depends on control dependency: [for], data = [c]
rowEntropy[r] -= entropy(v, rowSums[r]); // depends on control dependency: [for], data = [none]
}
}
return new EntropyStats(entropy, colEntropy, rowEntropy);
} }
|
public class class_name {
public void assignModelReferences(XAttributable target,
List<String> modelReferences) {
StringBuilder sb = new StringBuilder();
for (String ref : modelReferences) {
sb.append(ref);
sb.append(" ");
}
if (sb.toString().trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_MODELREFERENCE
.clone();
attr.setValue(sb.toString().trim());
target.getAttributes().put(KEY_MODELREFERENCE, attr);
}
} }
|
public class class_name {
public void assignModelReferences(XAttributable target,
List<String> modelReferences) {
StringBuilder sb = new StringBuilder();
for (String ref : modelReferences) {
sb.append(ref); // depends on control dependency: [for], data = [ref]
sb.append(" "); // depends on control dependency: [for], data = [none]
}
if (sb.toString().trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_MODELREFERENCE
.clone();
attr.setValue(sb.toString().trim()); // depends on control dependency: [if], data = [none]
target.getAttributes().put(KEY_MODELREFERENCE, attr); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected Object createCacheEntry(String host, String[] ips) {
try {
long expiration = System.currentTimeMillis() + EXPIRATION;// 10年失效
InetAddress[] addresses = new InetAddress[ips.length];
for (int i = 0; i < addresses.length; i++) {
// addresses[i] = InetAddress.getByAddress(host, toBytes(ips[i]));
addresses[i] = InetAddress.getByAddress(host, InetAddress.getByName(ips[i]).getAddress());
}
String className = "java.net.InetAddress$CacheEntry";
Class<?> clazz = Class.forName(className);
Constructor<?> constructor = clazz.getDeclaredConstructors()[0];
constructor.setAccessible(true);
return constructor.newInstance(addresses, expiration);
}
catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
} }
|
public class class_name {
protected Object createCacheEntry(String host, String[] ips) {
try {
long expiration = System.currentTimeMillis() + EXPIRATION;// 10年失效
InetAddress[] addresses = new InetAddress[ips.length];
for (int i = 0; i < addresses.length; i++) {
// addresses[i] = InetAddress.getByAddress(host, toBytes(ips[i]));
addresses[i] = InetAddress.getByAddress(host, InetAddress.getByName(ips[i]).getAddress()); // depends on control dependency: [for], data = [i]
}
String className = "java.net.InetAddress$CacheEntry";
Class<?> clazz = Class.forName(className);
Constructor<?> constructor = clazz.getDeclaredConstructors()[0];
constructor.setAccessible(true); // depends on control dependency: [try], data = [none]
return constructor.newInstance(addresses, expiration); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(DescribeRecoveryPointRequest describeRecoveryPointRequest, ProtocolMarshaller protocolMarshaller) {
if (describeRecoveryPointRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeRecoveryPointRequest.getBackupVaultName(), BACKUPVAULTNAME_BINDING);
protocolMarshaller.marshall(describeRecoveryPointRequest.getRecoveryPointArn(), RECOVERYPOINTARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeRecoveryPointRequest describeRecoveryPointRequest, ProtocolMarshaller protocolMarshaller) {
if (describeRecoveryPointRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeRecoveryPointRequest.getBackupVaultName(), BACKUPVAULTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeRecoveryPointRequest.getRecoveryPointArn(), RECOVERYPOINTARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public WebSphereEjbServices getWebSphereEjbServices(String applicationID) {
WebSphereEjbServices services = null;
synchronized (ejbServices) {
services = ejbServices.get(applicationID);
if (services == null) {
services = new WebSphereEjbServicesImpl(applicationID, ejbDescriptorMap);
ejbServices.put(applicationID, services);
}
}
return services;
} }
|
public class class_name {
@Override
public WebSphereEjbServices getWebSphereEjbServices(String applicationID) {
WebSphereEjbServices services = null;
synchronized (ejbServices) {
services = ejbServices.get(applicationID);
if (services == null) {
services = new WebSphereEjbServicesImpl(applicationID, ejbDescriptorMap); // depends on control dependency: [if], data = [none]
ejbServices.put(applicationID, services); // depends on control dependency: [if], data = [none]
}
}
return services;
} }
|
public class class_name {
protected void notifyModuleUpdate(@Nullable ScriptModule newModule, @Nullable ScriptModule oldModule) {
for (ScriptModuleListener listener : listeners) {
listener.moduleUpdated(newModule, oldModule);
}
} }
|
public class class_name {
protected void notifyModuleUpdate(@Nullable ScriptModule newModule, @Nullable ScriptModule oldModule) {
for (ScriptModuleListener listener : listeners) {
listener.moduleUpdated(newModule, oldModule); // depends on control dependency: [for], data = [listener]
}
} }
|
public class class_name {
protected static void parseCondFlag(String line, RewriteCond condition, String flag) {
if (flag.equals("NC") || flag.equals("nocase")) {
condition.setNocase(true);
} else if (flag.equals("OR") || flag.equals("ornext")) {
condition.setOrnext(true);
} else {
throw UndertowServletLogger.ROOT_LOGGER.invalidRewriteFlags(line, flag);
}
} }
|
public class class_name {
protected static void parseCondFlag(String line, RewriteCond condition, String flag) {
if (flag.equals("NC") || flag.equals("nocase")) {
condition.setNocase(true); // depends on control dependency: [if], data = [none]
} else if (flag.equals("OR") || flag.equals("ornext")) {
condition.setOrnext(true); // depends on control dependency: [if], data = [none]
} else {
throw UndertowServletLogger.ROOT_LOGGER.invalidRewriteFlags(line, flag);
}
} }
|
public class class_name {
public List<AbstractExpression> bindingToIndexedExpression(
AbstractExpression expr) {
// Defer the result construction for as long as possible on the
// assumption that this function mostly gets applied to eliminate
// negative cases.
if (m_type != expr.m_type) {
// The only allowed difference in expression types is between a
// parameter and its original constant value.
// That's handled in the independent override.
return null;
}
// From here, this is much like the straight equality check,
// except that this function and "equals" must each call themselves
// in their recursions.
// Delegating to this factored-out component of the "equals"
// implementation eases simultaneous refinement of both methods.
if ( ! hasEqualAttributes(expr)) {
return null;
}
// The derived classes have verified that any added attributes
// are identical.
// Check that the presence, or lack, of children is the same
if ((expr.m_left == null) != (m_left == null)) {
return null;
}
if ((expr.m_right == null) != (m_right == null)) {
return null;
}
if ((expr.m_args == null) != (m_args == null)) {
return null;
}
// Check that the children identify themselves as matching
List<AbstractExpression> leftBindings = null;
if (m_left != null) {
leftBindings = m_left.bindingToIndexedExpression(expr.m_left);
if (leftBindings == null) {
return null;
}
}
List<AbstractExpression> rightBindings = null;
if (m_right != null) {
rightBindings = m_right.bindingToIndexedExpression(expr.m_right);
if (rightBindings == null) {
return null;
}
}
List<AbstractExpression> argBindings = null;
if (m_args != null) {
if (m_args.size() != expr.m_args.size()) {
return null;
}
argBindings = new ArrayList<>();
int ii = 0;
// iterate the args lists in parallel, binding pairwise
for (AbstractExpression rhs : expr.m_args) {
AbstractExpression lhs = m_args.get(ii++);
List<AbstractExpression> moreBindings =
lhs.bindingToIndexedExpression(rhs);
if (moreBindings == null) { // fail on any non-match
return null;
}
argBindings.addAll(moreBindings);
}
}
// It's a match, so gather up the details.
// It's rare (if even possible) for the same bound parameter to get
// listed twice, so don't worry about duplicate entries, here.
// That should not cause any issue for the caller.
List<AbstractExpression> result = new ArrayList<>();
if (leftBindings != null) { // null here can only mean no left child
result.addAll(leftBindings);
}
if (rightBindings != null) { // null here can only mean no right child
result.addAll(rightBindings);
}
if (argBindings != null) { // null here can only mean no args
result.addAll(argBindings);
}
return result;
} }
|
public class class_name {
public List<AbstractExpression> bindingToIndexedExpression(
AbstractExpression expr) {
// Defer the result construction for as long as possible on the
// assumption that this function mostly gets applied to eliminate
// negative cases.
if (m_type != expr.m_type) {
// The only allowed difference in expression types is between a
// parameter and its original constant value.
// That's handled in the independent override.
return null; // depends on control dependency: [if], data = [none]
}
// From here, this is much like the straight equality check,
// except that this function and "equals" must each call themselves
// in their recursions.
// Delegating to this factored-out component of the "equals"
// implementation eases simultaneous refinement of both methods.
if ( ! hasEqualAttributes(expr)) {
return null; // depends on control dependency: [if], data = [none]
}
// The derived classes have verified that any added attributes
// are identical.
// Check that the presence, or lack, of children is the same
if ((expr.m_left == null) != (m_left == null)) {
return null; // depends on control dependency: [if], data = [none]
}
if ((expr.m_right == null) != (m_right == null)) {
return null; // depends on control dependency: [if], data = [none]
}
if ((expr.m_args == null) != (m_args == null)) {
return null; // depends on control dependency: [if], data = [none]
}
// Check that the children identify themselves as matching
List<AbstractExpression> leftBindings = null;
if (m_left != null) {
leftBindings = m_left.bindingToIndexedExpression(expr.m_left); // depends on control dependency: [if], data = [none]
if (leftBindings == null) {
return null; // depends on control dependency: [if], data = [none]
}
}
List<AbstractExpression> rightBindings = null;
if (m_right != null) {
rightBindings = m_right.bindingToIndexedExpression(expr.m_right); // depends on control dependency: [if], data = [none]
if (rightBindings == null) {
return null; // depends on control dependency: [if], data = [none]
}
}
List<AbstractExpression> argBindings = null;
if (m_args != null) {
if (m_args.size() != expr.m_args.size()) {
return null; // depends on control dependency: [if], data = [none]
}
argBindings = new ArrayList<>(); // depends on control dependency: [if], data = [none]
int ii = 0;
// iterate the args lists in parallel, binding pairwise
for (AbstractExpression rhs : expr.m_args) {
AbstractExpression lhs = m_args.get(ii++);
List<AbstractExpression> moreBindings =
lhs.bindingToIndexedExpression(rhs);
if (moreBindings == null) { // fail on any non-match
return null; // depends on control dependency: [if], data = [none]
}
argBindings.addAll(moreBindings); // depends on control dependency: [for], data = [none]
}
}
// It's a match, so gather up the details.
// It's rare (if even possible) for the same bound parameter to get
// listed twice, so don't worry about duplicate entries, here.
// That should not cause any issue for the caller.
List<AbstractExpression> result = new ArrayList<>();
if (leftBindings != null) { // null here can only mean no left child
result.addAll(leftBindings); // depends on control dependency: [if], data = [(leftBindings]
}
if (rightBindings != null) { // null here can only mean no right child
result.addAll(rightBindings); // depends on control dependency: [if], data = [(rightBindings]
}
if (argBindings != null) { // null here can only mean no args
result.addAll(argBindings); // depends on control dependency: [if], data = [(argBindings]
}
return result;
} }
|
public class class_name {
@Override
public void applicationStopped(ApplicationInfo appInfo) {
Application application = this.runtimeFactory.removeApplication(appInfo);
/* ignore apps not controlled by the app manager */
if (application == null) {
return;
}
try {
getCDIContainer().applicationStopped(application);
} catch (CDIException e) {
//FFDC and carry on
} finally {
try {
for (CDIArchive archive : application.getModuleArchives()) {
DeferredMetaDataFactory metaDataFactory = deferredMetaDataFactoryRef.getService();
CDIDeferredMetaDataFactoryImpl cdiMetaDataFactory = (CDIDeferredMetaDataFactoryImpl) metaDataFactory;
cdiMetaDataFactory.removeComponentMetaData(archive);
}
} catch (CDIException e) {
//FFDC and carry on
}
}
} }
|
public class class_name {
@Override
public void applicationStopped(ApplicationInfo appInfo) {
Application application = this.runtimeFactory.removeApplication(appInfo);
/* ignore apps not controlled by the app manager */
if (application == null) {
return; // depends on control dependency: [if], data = [none]
}
try {
getCDIContainer().applicationStopped(application); // depends on control dependency: [try], data = [none]
} catch (CDIException e) {
//FFDC and carry on
} finally { // depends on control dependency: [catch], data = [none]
try {
for (CDIArchive archive : application.getModuleArchives()) {
DeferredMetaDataFactory metaDataFactory = deferredMetaDataFactoryRef.getService();
CDIDeferredMetaDataFactoryImpl cdiMetaDataFactory = (CDIDeferredMetaDataFactoryImpl) metaDataFactory;
cdiMetaDataFactory.removeComponentMetaData(archive); // depends on control dependency: [for], data = [archive]
}
} catch (CDIException e) {
//FFDC and carry on
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
protected void initFailedJobCommandFactory() {
if (failedJobCommandFactory == null) {
failedJobCommandFactory = new DefaultFailedJobCommandFactory();
}
if (postParseListeners == null) {
postParseListeners = new ArrayList<BpmnParseListener>();
}
postParseListeners.add(new DefaultFailedJobParseListener());
} }
|
public class class_name {
protected void initFailedJobCommandFactory() {
if (failedJobCommandFactory == null) {
failedJobCommandFactory = new DefaultFailedJobCommandFactory(); // depends on control dependency: [if], data = [none]
}
if (postParseListeners == null) {
postParseListeners = new ArrayList<BpmnParseListener>(); // depends on control dependency: [if], data = [none]
}
postParseListeners.add(new DefaultFailedJobParseListener());
} }
|
public class class_name {
public <T, V extends Comparable<T>> V exclusiveBetween(final T start, final T end, final V value) {
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) {
fail(String.format(DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end));
}
return value;
} }
|
public class class_name {
public <T, V extends Comparable<T>> V exclusiveBetween(final T start, final T end, final V value) {
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) {
fail(String.format(DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end)); // depends on control dependency: [if], data = [none]
}
return value;
} }
|
public class class_name {
protected static int getTotalAttempts(ClientRequestContext ctx) {
final State state = ctx.attr(STATE).get();
if (state == null) {
return 0;
}
return state.totalAttemptNo;
} }
|
public class class_name {
protected static int getTotalAttempts(ClientRequestContext ctx) {
final State state = ctx.attr(STATE).get();
if (state == null) {
return 0; // depends on control dependency: [if], data = [none]
}
return state.totalAttemptNo;
} }
|
public class class_name {
private List<HeaderCell> loadHeaderRowWithConfigurationTab(final SheetConfiguration sheetConfig,
final RangeBuildRef rangeBuildRef, final int currentRow, final Map<String, CellRangeAddress> cellRangeMap,
final List<String> skippedRegionCells) {
Sheet sheet1 = rangeBuildRef.getSheet();
int left = rangeBuildRef.getLeft();
int right = rangeBuildRef.getRight();
double totalWidth = (double) rangeBuildRef.getTotalWidth();
Row row = sheet1.getRow(currentRow);
List<HeaderCell> headercells = new ArrayList<>();
for (int cindex = left; cindex <= right; cindex++) {
String cellindex = CellUtility.getCellIndexNumberKey(cindex, currentRow);
if (!skippedRegionCells.contains(cellindex) && !sheet1.isColumnHidden(cindex)) {
Cell cell = null;
if (row != null) {
cell = row.getCell(cindex, MissingCellPolicy.CREATE_NULL_AS_BLANK);
}
int originRowIndex = ConfigurationUtility.getOriginalRowNumInHiddenColumn(row);
if (cell != null) {
FacesCell fcell = new FacesCell();
CellUtility.convertCell(sheetConfig, fcell, cell, cellRangeMap, originRowIndex,
parent.getCellAttributesMap(), null);
parent.getPicHelper().setupFacesCellPictureCharts(sheet1, fcell, cell,
WebSheetUtility.getFullCellRefName(sheet1, cell));
CellStyleUtility.setupCellStyle(parent.getWb(), fcell, cell, row.getHeightInPoints());
fcell.setColumnStyle(fcell.getColumnStyle()
+ getColumnWidthStyle(sheet1, cellRangeMap, cellindex, cindex, totalWidth));
fcell.setColumnIndex(cindex);
headercells.add(
new HeaderCell(Integer.toString(fcell.getRowspan()), Integer.toString(fcell.getColspan()),
fcell.getStyle(), fcell.getColumnStyle(), CellUtility.getCellValueWithFormat(cell,
parent.getFormulaEvaluator(), parent.getDataFormatter()),
true, true));
}
}
}
fillToMaxColumns(headercells);
return headercells;
} }
|
public class class_name {
private List<HeaderCell> loadHeaderRowWithConfigurationTab(final SheetConfiguration sheetConfig,
final RangeBuildRef rangeBuildRef, final int currentRow, final Map<String, CellRangeAddress> cellRangeMap,
final List<String> skippedRegionCells) {
Sheet sheet1 = rangeBuildRef.getSheet();
int left = rangeBuildRef.getLeft();
int right = rangeBuildRef.getRight();
double totalWidth = (double) rangeBuildRef.getTotalWidth();
Row row = sheet1.getRow(currentRow);
List<HeaderCell> headercells = new ArrayList<>();
for (int cindex = left; cindex <= right; cindex++) {
String cellindex = CellUtility.getCellIndexNumberKey(cindex, currentRow);
if (!skippedRegionCells.contains(cellindex) && !sheet1.isColumnHidden(cindex)) {
Cell cell = null;
if (row != null) {
cell = row.getCell(cindex, MissingCellPolicy.CREATE_NULL_AS_BLANK);
// depends on control dependency: [if], data = [none]
}
int originRowIndex = ConfigurationUtility.getOriginalRowNumInHiddenColumn(row);
if (cell != null) {
FacesCell fcell = new FacesCell();
CellUtility.convertCell(sheetConfig, fcell, cell, cellRangeMap, originRowIndex,
parent.getCellAttributesMap(), null);
// depends on control dependency: [if], data = [none]
parent.getPicHelper().setupFacesCellPictureCharts(sheet1, fcell, cell,
WebSheetUtility.getFullCellRefName(sheet1, cell));
// depends on control dependency: [if], data = [none]
CellStyleUtility.setupCellStyle(parent.getWb(), fcell, cell, row.getHeightInPoints());
// depends on control dependency: [if], data = [none]
fcell.setColumnStyle(fcell.getColumnStyle()
+ getColumnWidthStyle(sheet1, cellRangeMap, cellindex, cindex, totalWidth));
// depends on control dependency: [if], data = [none]
fcell.setColumnIndex(cindex);
// depends on control dependency: [if], data = [none]
headercells.add(
new HeaderCell(Integer.toString(fcell.getRowspan()), Integer.toString(fcell.getColspan()),
fcell.getStyle(), fcell.getColumnStyle(), CellUtility.getCellValueWithFormat(cell,
parent.getFormulaEvaluator(), parent.getDataFormatter()),
true, true));
// depends on control dependency: [if], data = [none]
}
}
}
fillToMaxColumns(headercells);
return headercells;
} }
|
public class class_name {
private String getShortClassName(String className) {
int lastDot = className.lastIndexOf('.');
if (lastDot >= 0) {
className = className.substring(lastDot + 1);
}
return className.toLowerCase(Locale.US).replace('+', '$');
} }
|
public class class_name {
private String getShortClassName(String className) {
int lastDot = className.lastIndexOf('.');
if (lastDot >= 0) {
className = className.substring(lastDot + 1); // depends on control dependency: [if], data = [(lastDot]
}
return className.toLowerCase(Locale.US).replace('+', '$');
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public Map<String, Object> getParamMap(String paramName) {
Object paramValue = getParam(paramName);
if (paramValue == null) {
return null;
}
if (!(paramValue instanceof Map)) {
throw new IllegalArgumentException("Parameter '" + paramName + "' must be a map: " + paramValue);
}
return (Map<String, Object>)paramValue;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public Map<String, Object> getParamMap(String paramName) {
Object paramValue = getParam(paramName);
if (paramValue == null) {
return null;
// depends on control dependency: [if], data = [none]
}
if (!(paramValue instanceof Map)) {
throw new IllegalArgumentException("Parameter '" + paramName + "' must be a map: " + paramValue);
}
return (Map<String, Object>)paramValue;
} }
|
public class class_name {
public static void installSecureRandomProvider() {
CoGProperties props = CoGProperties.getDefault();
String providerName = props.getSecureRandomProvider();
try {
Class providerClass = Class.forName(providerName);
Security.insertProviderAt( (Provider)providerClass.newInstance(),
1 );
} catch (Exception e) {
logger.debug("Unable to install PRNG. Using default PRNG.",e);
}
} }
|
public class class_name {
public static void installSecureRandomProvider() {
CoGProperties props = CoGProperties.getDefault();
String providerName = props.getSecureRandomProvider();
try {
Class providerClass = Class.forName(providerName); // depends on control dependency: [try], data = [none]
Security.insertProviderAt( (Provider)providerClass.newInstance(),
1 ); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.debug("Unable to install PRNG. Using default PRNG.",e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setNodeGroupsToRetain(java.util.Collection<String> nodeGroupsToRetain) {
if (nodeGroupsToRetain == null) {
this.nodeGroupsToRetain = null;
return;
}
this.nodeGroupsToRetain = new com.amazonaws.internal.SdkInternalList<String>(nodeGroupsToRetain);
} }
|
public class class_name {
public void setNodeGroupsToRetain(java.util.Collection<String> nodeGroupsToRetain) {
if (nodeGroupsToRetain == null) {
this.nodeGroupsToRetain = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.nodeGroupsToRetain = new com.amazonaws.internal.SdkInternalList<String>(nodeGroupsToRetain);
} }
|
public class class_name {
public void setMinProgress(final float minProgress) {
if (composition == null) {
lazyCompositionTasks.add(new LazyCompositionTask() {
@Override
public void run(LottieComposition composition) {
setMinProgress(minProgress);
}
});
return;
}
setMinFrame((int) MiscUtils.lerp(composition.getStartFrame(), composition.getEndFrame(), minProgress));
} }
|
public class class_name {
public void setMinProgress(final float minProgress) {
if (composition == null) {
lazyCompositionTasks.add(new LazyCompositionTask() {
@Override
public void run(LottieComposition composition) {
setMinProgress(minProgress);
}
}); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
setMinFrame((int) MiscUtils.lerp(composition.getStartFrame(), composition.getEndFrame(), minProgress));
} }
|
public class class_name {
@SuppressWarnings("serial")
public Map<String, PullMeasure<?>> createPullsFromGetters(
final Object object) {
Map<String, PullMeasure<?>> measures = new HashMap<String, PullMeasure<?>>();
Class<? extends Object> clazz = object.getClass();
for (final Method method : clazz.getMethods()) {
if (method.getParameterTypes().length == 0
&& !method.getReturnType().equals(Void.TYPE)
&& !method.getName().equals("getClass")
&& method.getName().matches("get[^a-z].*")) {
String key = method.getName().substring(3);
// TODO exploit return type to restrict the generics
measures.put(key, new SimplePullMeasure<Object>(key) {
@Override
public Object get() {
try {
return method.invoke(object);
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException e) {
throw new RuntimeException(e);
}
}
});
} else {
// not a getter, ignore it
}
}
return measures;
} }
|
public class class_name {
@SuppressWarnings("serial")
public Map<String, PullMeasure<?>> createPullsFromGetters(
final Object object) {
Map<String, PullMeasure<?>> measures = new HashMap<String, PullMeasure<?>>();
Class<? extends Object> clazz = object.getClass();
for (final Method method : clazz.getMethods()) {
if (method.getParameterTypes().length == 0
&& !method.getReturnType().equals(Void.TYPE)
&& !method.getName().equals("getClass")
&& method.getName().matches("get[^a-z].*")) {
String key = method.getName().substring(3);
// TODO exploit return type to restrict the generics
measures.put(key, new SimplePullMeasure<Object>(key) {
@Override
public Object get() {
try {
return method.invoke(object); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
}); // depends on control dependency: [if], data = [none]
} else {
// not a getter, ignore it
}
}
return measures;
} }
|
public class class_name {
private static int byteCompaction(int mode,
int[] codewords,
Charset encoding,
int codeIndex,
StringBuilder result) {
ByteArrayOutputStream decodedBytes = new ByteArrayOutputStream();
int count = 0;
long value = 0;
boolean end = false;
switch (mode) {
case BYTE_COMPACTION_MODE_LATCH:
// Total number of Byte Compaction characters to be encoded
// is not a multiple of 6
int[] byteCompactedCodewords = new int[6];
int nextCode = codewords[codeIndex++];
while ((codeIndex < codewords[0]) && !end) {
byteCompactedCodewords[count++] = nextCode;
// Base 900
value = 900 * value + nextCode;
nextCode = codewords[codeIndex++];
// perhaps it should be ok to check only nextCode >= TEXT_COMPACTION_MODE_LATCH
switch (nextCode) {
case TEXT_COMPACTION_MODE_LATCH:
case BYTE_COMPACTION_MODE_LATCH:
case NUMERIC_COMPACTION_MODE_LATCH:
case BYTE_COMPACTION_MODE_LATCH_6:
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
case BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
case MACRO_PDF417_TERMINATOR:
codeIndex--;
end = true;
break;
default:
if ((count % 5 == 0) && (count > 0)) {
// Decode every 5 codewords
// Convert to Base 256
for (int j = 0; j < 6; ++j) {
decodedBytes.write((byte) (value >> (8 * (5 - j))));
}
value = 0;
count = 0;
}
break;
}
}
// if the end of all codewords is reached the last codeword needs to be added
if (codeIndex == codewords[0] && nextCode < TEXT_COMPACTION_MODE_LATCH) {
byteCompactedCodewords[count++] = nextCode;
}
// If Byte Compaction mode is invoked with codeword 901,
// the last group of codewords is interpreted directly
// as one byte per codeword, without compaction.
for (int i = 0; i < count; i++) {
decodedBytes.write((byte) byteCompactedCodewords[i]);
}
break;
case BYTE_COMPACTION_MODE_LATCH_6:
// Total number of Byte Compaction characters to be encoded
// is an integer multiple of 6
while (codeIndex < codewords[0] && !end) {
int code = codewords[codeIndex++];
if (code < TEXT_COMPACTION_MODE_LATCH) {
count++;
// Base 900
value = 900 * value + code;
} else {
switch (code) {
case TEXT_COMPACTION_MODE_LATCH:
case BYTE_COMPACTION_MODE_LATCH:
case NUMERIC_COMPACTION_MODE_LATCH:
case BYTE_COMPACTION_MODE_LATCH_6:
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
case BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
case MACRO_PDF417_TERMINATOR:
codeIndex--;
end = true;
break;
}
}
if ((count % 5 == 0) && (count > 0)) {
// Decode every 5 codewords
// Convert to Base 256
for (int j = 0; j < 6; ++j) {
decodedBytes.write((byte) (value >> (8 * (5 - j))));
}
value = 0;
count = 0;
}
}
break;
}
result.append(new String(decodedBytes.toByteArray(), encoding));
return codeIndex;
} }
|
public class class_name {
private static int byteCompaction(int mode,
int[] codewords,
Charset encoding,
int codeIndex,
StringBuilder result) {
ByteArrayOutputStream decodedBytes = new ByteArrayOutputStream();
int count = 0;
long value = 0;
boolean end = false;
switch (mode) {
case BYTE_COMPACTION_MODE_LATCH:
// Total number of Byte Compaction characters to be encoded
// is not a multiple of 6
int[] byteCompactedCodewords = new int[6];
int nextCode = codewords[codeIndex++];
while ((codeIndex < codewords[0]) && !end) {
byteCompactedCodewords[count++] = nextCode; // depends on control dependency: [while], data = [none]
// Base 900
value = 900 * value + nextCode; // depends on control dependency: [while], data = [none]
nextCode = codewords[codeIndex++]; // depends on control dependency: [while], data = [none]
// perhaps it should be ok to check only nextCode >= TEXT_COMPACTION_MODE_LATCH
switch (nextCode) {
case TEXT_COMPACTION_MODE_LATCH:
case BYTE_COMPACTION_MODE_LATCH:
case NUMERIC_COMPACTION_MODE_LATCH:
case BYTE_COMPACTION_MODE_LATCH_6:
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
case BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
case MACRO_PDF417_TERMINATOR:
codeIndex--;
end = true;
break;
default:
if ((count % 5 == 0) && (count > 0)) {
// Decode every 5 codewords
// Convert to Base 256
for (int j = 0; j < 6; ++j) {
decodedBytes.write((byte) (value >> (8 * (5 - j)))); // depends on control dependency: [for], data = [j]
}
value = 0; // depends on control dependency: [if], data = [none]
count = 0; // depends on control dependency: [if], data = [none]
}
break;
}
}
// if the end of all codewords is reached the last codeword needs to be added
if (codeIndex == codewords[0] && nextCode < TEXT_COMPACTION_MODE_LATCH) {
byteCompactedCodewords[count++] = nextCode; // depends on control dependency: [if], data = [none]
}
// If Byte Compaction mode is invoked with codeword 901,
// the last group of codewords is interpreted directly
// as one byte per codeword, without compaction.
for (int i = 0; i < count; i++) {
decodedBytes.write((byte) byteCompactedCodewords[i]); // depends on control dependency: [for], data = [i]
}
break;
case BYTE_COMPACTION_MODE_LATCH_6:
// Total number of Byte Compaction characters to be encoded
// is an integer multiple of 6
while (codeIndex < codewords[0] && !end) {
int code = codewords[codeIndex++];
if (code < TEXT_COMPACTION_MODE_LATCH) {
count++; // depends on control dependency: [if], data = [none]
// Base 900
value = 900 * value + code; // depends on control dependency: [if], data = [none]
} else {
switch (code) {
case TEXT_COMPACTION_MODE_LATCH:
case BYTE_COMPACTION_MODE_LATCH:
case NUMERIC_COMPACTION_MODE_LATCH:
case BYTE_COMPACTION_MODE_LATCH_6:
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
case BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
case MACRO_PDF417_TERMINATOR:
codeIndex--;
end = true;
break;
}
}
if ((count % 5 == 0) && (count > 0)) {
// Decode every 5 codewords
// Convert to Base 256
for (int j = 0; j < 6; ++j) {
decodedBytes.write((byte) (value >> (8 * (5 - j)))); // depends on control dependency: [for], data = [j]
}
value = 0; // depends on control dependency: [if], data = [none]
count = 0; // depends on control dependency: [if], data = [none]
}
}
break;
}
result.append(new String(decodedBytes.toByteArray(), encoding));
return codeIndex;
} }
|
public class class_name {
public static String getStringValue(JSONObject jsonObject, String key) throws JSONException {
checkArguments(jsonObject, key);
JSONValue value = jsonObject.get(key);
if (value != null) {
if (value.isString() != null) {
return ((JSONString) value).stringValue();
} else {
String valueString = value.toString();
if (!"null".equals(valueString)) {
if (valueString.charAt(0) == '"') {
return valueString.substring(1, valueString.length() - 1);
}
return valueString;
}
}
}
return null;
} }
|
public class class_name {
public static String getStringValue(JSONObject jsonObject, String key) throws JSONException {
checkArguments(jsonObject, key);
JSONValue value = jsonObject.get(key);
if (value != null) {
if (value.isString() != null) {
return ((JSONString) value).stringValue();
} else {
String valueString = value.toString();
if (!"null".equals(valueString)) {
if (valueString.charAt(0) == '"') {
return valueString.substring(1, valueString.length() - 1); // depends on control dependency: [if], data = [none]
}
return valueString; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
private static int getJavaVersion() {
String version = System.getProperty("java.version");
if (version == null) {
return -1;
} else {
int index = version.indexOf('.');
if (index > 0) {
version = version.substring(0, index);
}
try {
return Integer.parseInt(version);
} catch (NumberFormatException ex) {
return -1;
}
}
} }
|
public class class_name {
private static int getJavaVersion() {
String version = System.getProperty("java.version");
if (version == null) {
return -1; // depends on control dependency: [if], data = [none]
} else {
int index = version.indexOf('.');
if (index > 0) {
version = version.substring(0, index); // depends on control dependency: [if], data = [none]
}
try {
return Integer.parseInt(version); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException ex) {
return -1;
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public void marshall(ListAliasesRequest listAliasesRequest, ProtocolMarshaller protocolMarshaller) {
if (listAliasesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listAliasesRequest.getFunctionName(), FUNCTIONNAME_BINDING);
protocolMarshaller.marshall(listAliasesRequest.getFunctionVersion(), FUNCTIONVERSION_BINDING);
protocolMarshaller.marshall(listAliasesRequest.getMarker(), MARKER_BINDING);
protocolMarshaller.marshall(listAliasesRequest.getMaxItems(), MAXITEMS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListAliasesRequest listAliasesRequest, ProtocolMarshaller protocolMarshaller) {
if (listAliasesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listAliasesRequest.getFunctionName(), FUNCTIONNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAliasesRequest.getFunctionVersion(), FUNCTIONVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAliasesRequest.getMarker(), MARKER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAliasesRequest.getMaxItems(), MAXITEMS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private Map<String, TargetInfo> getTargets(final LinkerConfiguration linkerConfig, final Vector<File> objectFiles,
final VersionInfo versionInfo, final File outputFile) {
// FREEHEP
final List<String> order = new ArrayList<>();
final Map<String, TargetInfo> targets = new TreeMap<>(new Comparator<String>() {
// Order according to "order" List followed by alphabetical order
@Override public int compare(String f0, String f1) {
if (order.isEmpty()) {
return f0.compareTo(f1);
}
// Trimming the path and trailing file extension to allow for order
// comparison
String compf0 = FilenameUtils.getBaseName(f0);
String compf1 = FilenameUtils.getBaseName(f1);
// remove the hash
// TODO: well we hope it's a hash
compf0 = FilenameUtils.removeExtension(compf0);
compf1 = FilenameUtils.removeExtension(compf1);
// order according to list or alphabetical
final int i0 = order.indexOf(compf0);
final int i1 = order.indexOf(compf1);
if (i0 < 0 && i1 < 0) {
// none in list
// compare original values
return f0.compareTo(f1);
} else {
// make sure we use only one core
CCTask.this.ordered = true;
if (i0 > 0 && i1 > 0) {
// both in list
return i0 == i1 ? 0 : i0 < i1 ? -1 : +1;
} else if (i1 < 0) {
// i0 in list
return -1;
} else {
// i1 in list
return +1;
}
}
}
});
final TargetDef targetPlatform = getTargetPlatform();
// BEGINFREEHEP
// a little trick here, the inner function needs the list to be final,
// so that the map order doesn't change after we start adding items,
// populate with all the ordered items from each compiler type
order.clear();
for (int i = 0; i < this._compilers.size(); i++) {
final CompilerDef currentCompilerDef = this._compilers.elementAt(i);
if (currentCompilerDef.isActive()) {
final List<String> compilerFileOrder = currentCompilerDef.getOrder();
if (compilerFileOrder != null) {
order.addAll(compilerFileOrder);
}
}
}
// ENDFREEHEP
//
// find active (specialized) compilers
//
final Vector<ProcessorConfiguration> biddingProcessors = new Vector<>(this._compilers.size());
for (int i = 0; i < this._compilers.size(); i++) {
final CompilerDef currentCompilerDef = this._compilers.elementAt(i);
if (currentCompilerDef.isActive()) {
final ProcessorConfiguration config = currentCompilerDef.createConfiguration(this, this.linkType,
this.compilerDef, targetPlatform, versionInfo);
//
// see if this processor had a precompile child element
//
final PrecompileDef precompileDef = currentCompilerDef.getActivePrecompile(this.compilerDef);
CommandLineCompilerConfiguration commandLineConfig = (CommandLineCompilerConfiguration) config;
AbstractCompiler compiler = (AbstractCompiler) commandLineConfig.getCompiler();
compiler.setWorkDir(currentCompilerDef.getWorkDir());
compiler.setGccFileAbsolutePath(currentCompilerDef.getGccFileAbsolutePath());
ProcessorConfiguration[] localConfigs = new ProcessorConfiguration[] {
config
};
//
// if it does then
//
if (precompileDef != null) {
final File prototype = precompileDef.getPrototype();
//
// will throw exceptions if prototype doesn't exist, etc
//
if (!prototype.exists()) {
throw new BuildException("prototype (" + prototype.toString() + ") does not exist.");
}
if (prototype.isDirectory()) {
throw new BuildException("prototype (" + prototype.toString() + ") is a directory.");
}
final String[] exceptFiles = precompileDef.getExceptFiles();
//
// create a precompile building and precompile using
// variants of the configuration
// or return null if compiler doesn't support
// precompilation
final CompilerConfiguration[] configs = ((CompilerConfiguration) config).createPrecompileConfigurations(
prototype, exceptFiles);
if (configs != null && configs.length == 2) {
//
// visit the precompiled file to add it into the
// targets list (just like any other file if
// compiler doesn't support precompilation)
final TargetMatcher matcher = new TargetMatcher(this, this._objDir, new ProcessorConfiguration[] {
configs[0]
}, linkerConfig, objectFiles, targets, versionInfo);
matcher.visit(new File(prototype.getParent()), prototype.getName());
//
// only the configuration that uses the
// precompiled header gets added to the bidding list
biddingProcessors.addElement(configs[1]);
localConfigs = new ProcessorConfiguration[2];
localConfigs[0] = configs[1];
localConfigs[1] = config;
}
}
//
// if the compiler has a fileset
// then allow it to add its files
// to the set of potential targets
if (currentCompilerDef.hasFileSets()) {
final TargetMatcher matcher = new TargetMatcher(this, this._objDir, localConfigs, linkerConfig, objectFiles,
targets, versionInfo);
currentCompilerDef.visitFiles(matcher);
}
biddingProcessors.addElement(config);
}
}
//
// add fallback compiler at the end
//
if (this._compilers.size()==0) {
final ProcessorConfiguration config = this.compilerDef.createConfiguration(this, this.linkType, null,
targetPlatform, versionInfo);
biddingProcessors.addElement(config);
}
final ProcessorConfiguration[] bidders = new ProcessorConfiguration[biddingProcessors.size()];
biddingProcessors.copyInto(bidders);
//
// bid out the <fileset>'s in the cctask
//
final TargetMatcher matcher = new TargetMatcher(this, this._objDir, bidders, linkerConfig, objectFiles, targets,
versionInfo);
this.compilerDef.visitFiles(matcher);
//Add the VersionInfo when relevant
if (outputFile != null && versionInfo != null) {
final boolean isDebug = linkerConfig.isDebug();
try {
linkerConfig.getLinker()
.addVersionFiles(versionInfo, this.linkType, outputFile, isDebug, this._objDir, matcher);
} catch (final IOException ex) {
throw new BuildException(ex);
}
}
return targets;
} }
|
public class class_name {
private Map<String, TargetInfo> getTargets(final LinkerConfiguration linkerConfig, final Vector<File> objectFiles,
final VersionInfo versionInfo, final File outputFile) {
// FREEHEP
final List<String> order = new ArrayList<>();
final Map<String, TargetInfo> targets = new TreeMap<>(new Comparator<String>() {
// Order according to "order" List followed by alphabetical order
@Override public int compare(String f0, String f1) {
if (order.isEmpty()) {
return f0.compareTo(f1); // depends on control dependency: [if], data = [none]
}
// Trimming the path and trailing file extension to allow for order
// comparison
String compf0 = FilenameUtils.getBaseName(f0);
String compf1 = FilenameUtils.getBaseName(f1);
// remove the hash
// TODO: well we hope it's a hash
compf0 = FilenameUtils.removeExtension(compf0);
compf1 = FilenameUtils.removeExtension(compf1);
// order according to list or alphabetical
final int i0 = order.indexOf(compf0);
final int i1 = order.indexOf(compf1);
if (i0 < 0 && i1 < 0) {
// none in list
// compare original values
return f0.compareTo(f1); // depends on control dependency: [if], data = [none]
} else {
// make sure we use only one core
CCTask.this.ordered = true; // depends on control dependency: [if], data = [none]
if (i0 > 0 && i1 > 0) {
// both in list
return i0 == i1 ? 0 : i0 < i1 ? -1 : +1; // depends on control dependency: [if], data = [none]
} else if (i1 < 0) {
// i0 in list
return -1; // depends on control dependency: [if], data = [none]
} else {
// i1 in list
return +1; // depends on control dependency: [if], data = [none]
}
}
}
});
final TargetDef targetPlatform = getTargetPlatform();
// BEGINFREEHEP
// a little trick here, the inner function needs the list to be final,
// so that the map order doesn't change after we start adding items,
// populate with all the ordered items from each compiler type
order.clear();
for (int i = 0; i < this._compilers.size(); i++) {
final CompilerDef currentCompilerDef = this._compilers.elementAt(i);
if (currentCompilerDef.isActive()) {
final List<String> compilerFileOrder = currentCompilerDef.getOrder();
if (compilerFileOrder != null) {
order.addAll(compilerFileOrder); // depends on control dependency: [if], data = [(compilerFileOrder]
}
}
}
// ENDFREEHEP
//
// find active (specialized) compilers
//
final Vector<ProcessorConfiguration> biddingProcessors = new Vector<>(this._compilers.size());
for (int i = 0; i < this._compilers.size(); i++) {
final CompilerDef currentCompilerDef = this._compilers.elementAt(i);
if (currentCompilerDef.isActive()) {
final ProcessorConfiguration config = currentCompilerDef.createConfiguration(this, this.linkType,
this.compilerDef, targetPlatform, versionInfo);
//
// see if this processor had a precompile child element
//
final PrecompileDef precompileDef = currentCompilerDef.getActivePrecompile(this.compilerDef);
CommandLineCompilerConfiguration commandLineConfig = (CommandLineCompilerConfiguration) config;
AbstractCompiler compiler = (AbstractCompiler) commandLineConfig.getCompiler();
compiler.setWorkDir(currentCompilerDef.getWorkDir());
compiler.setGccFileAbsolutePath(currentCompilerDef.getGccFileAbsolutePath());
ProcessorConfiguration[] localConfigs = new ProcessorConfiguration[] {
config
};
//
// if it does then
//
if (precompileDef != null) {
final File prototype = precompileDef.getPrototype();
//
// will throw exceptions if prototype doesn't exist, etc
//
if (!prototype.exists()) {
throw new BuildException("prototype (" + prototype.toString() + ") does not exist.");
}
if (prototype.isDirectory()) {
throw new BuildException("prototype (" + prototype.toString() + ") is a directory.");
}
final String[] exceptFiles = precompileDef.getExceptFiles();
//
// create a precompile building and precompile using
// variants of the configuration
// or return null if compiler doesn't support
// precompilation
final CompilerConfiguration[] configs = ((CompilerConfiguration) config).createPrecompileConfigurations(
prototype, exceptFiles);
if (configs != null && configs.length == 2) {
//
// visit the precompiled file to add it into the
// targets list (just like any other file if
// compiler doesn't support precompilation)
final TargetMatcher matcher = new TargetMatcher(this, this._objDir, new ProcessorConfiguration[] {
configs[0]
}, linkerConfig, objectFiles, targets, versionInfo);
matcher.visit(new File(prototype.getParent()), prototype.getName());
//
// only the configuration that uses the
// precompiled header gets added to the bidding list
biddingProcessors.addElement(configs[1]);
localConfigs = new ProcessorConfiguration[2];
localConfigs[0] = configs[1];
localConfigs[1] = config;
}
}
//
// if the compiler has a fileset
// then allow it to add its files
// to the set of potential targets
if (currentCompilerDef.hasFileSets()) {
final TargetMatcher matcher = new TargetMatcher(this, this._objDir, localConfigs, linkerConfig, objectFiles,
targets, versionInfo);
currentCompilerDef.visitFiles(matcher);
}
biddingProcessors.addElement(config);
}
}
//
// add fallback compiler at the end
//
if (this._compilers.size()==0) {
final ProcessorConfiguration config = this.compilerDef.createConfiguration(this, this.linkType, null,
targetPlatform, versionInfo);
biddingProcessors.addElement(config);
}
final ProcessorConfiguration[] bidders = new ProcessorConfiguration[biddingProcessors.size()];
biddingProcessors.copyInto(bidders);
//
// bid out the <fileset>'s in the cctask
//
final TargetMatcher matcher = new TargetMatcher(this, this._objDir, bidders, linkerConfig, objectFiles, targets,
versionInfo);
this.compilerDef.visitFiles(matcher);
//Add the VersionInfo when relevant
if (outputFile != null && versionInfo != null) {
final boolean isDebug = linkerConfig.isDebug();
try {
linkerConfig.getLinker()
.addVersionFiles(versionInfo, this.linkType, outputFile, isDebug, this._objDir, matcher);
} catch (final IOException ex) {
throw new BuildException(ex);
}
}
return targets;
} }
|
public class class_name {
public void setTickMarkColor(final Color COLOR) {
if (null == tickMarkColor) {
_tickMarkColor = COLOR;
fireUpdateEvent(REDRAW_EVENT);
} else {
tickMarkColor.set(COLOR);
}
} }
|
public class class_name {
public void setTickMarkColor(final Color COLOR) {
if (null == tickMarkColor) {
_tickMarkColor = COLOR; // depends on control dependency: [if], data = [none]
fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none]
} else {
tickMarkColor.set(COLOR); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static double[] normalize(final double[] values) {
final double sum = 1.0/DoubleAdder.sum(values);
for (int i = values.length; --i >= 0;) {
values[i] = values[i]*sum;
}
return values;
} }
|
public class class_name {
public static double[] normalize(final double[] values) {
final double sum = 1.0/DoubleAdder.sum(values);
for (int i = values.length; --i >= 0;) {
values[i] = values[i]*sum; // depends on control dependency: [for], data = [i]
}
return values;
} }
|
public class class_name {
@NonNull protected ViewGroupMvpDelegate<V, P> getMvpDelegate() {
if (mvpDelegate == null) {
mvpDelegate = new ViewGroupMvpDelegateImpl<>(this, this, true);
}
return mvpDelegate;
} }
|
public class class_name {
@NonNull protected ViewGroupMvpDelegate<V, P> getMvpDelegate() {
if (mvpDelegate == null) {
mvpDelegate = new ViewGroupMvpDelegateImpl<>(this, this, true); // depends on control dependency: [if], data = [none]
}
return mvpDelegate;
} }
|
public class class_name {
@Override
@PreDestroy
public synchronized void close() {
if (this.shutdown) {
return;
}
this.shutdown = true;
for (final ManagedChannel channel : this.channels.values()) {
channel.shutdown();
}
try {
final long waitLimit = System.currentTimeMillis() + 60_000; // wait 60 seconds at max
for (final ManagedChannel channel : this.channels.values()) {
int i = 0;
do {
log.debug("Awaiting channel shutdown: {} ({}s)", channel, i++);
} while (System.currentTimeMillis() < waitLimit && !channel.awaitTermination(1, TimeUnit.SECONDS));
}
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
log.debug("We got interrupted - Speeding up shutdown process");
} finally {
for (final ManagedChannel channel : this.channels.values()) {
if (!channel.isTerminated()) {
log.debug("Channel not terminated yet - force shutdown now: {} ", channel);
channel.shutdownNow();
}
}
}
final int channelCount = this.channels.size();
this.channels.clear();
log.debug("GrpcCannelFactory closed (including {} channels)", channelCount);
} }
|
public class class_name {
@Override
@PreDestroy
public synchronized void close() {
if (this.shutdown) {
return; // depends on control dependency: [if], data = [none]
}
this.shutdown = true;
for (final ManagedChannel channel : this.channels.values()) {
channel.shutdown(); // depends on control dependency: [for], data = [channel]
}
try {
final long waitLimit = System.currentTimeMillis() + 60_000; // wait 60 seconds at max
for (final ManagedChannel channel : this.channels.values()) {
int i = 0;
do {
log.debug("Awaiting channel shutdown: {} ({}s)", channel, i++);
} while (System.currentTimeMillis() < waitLimit && !channel.awaitTermination(1, TimeUnit.SECONDS));
}
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
log.debug("We got interrupted - Speeding up shutdown process");
} finally { // depends on control dependency: [catch], data = [none]
for (final ManagedChannel channel : this.channels.values()) {
if (!channel.isTerminated()) {
log.debug("Channel not terminated yet - force shutdown now: {} ", channel); // depends on control dependency: [if], data = [none]
channel.shutdownNow(); // depends on control dependency: [if], data = [none]
}
}
}
final int channelCount = this.channels.size();
this.channels.clear();
log.debug("GrpcCannelFactory closed (including {} channels)", channelCount);
} }
|
public class class_name {
protected List<CmsRelation> validateLinks(
CmsDbContext dbc,
CmsResource resource,
Map<String, CmsResource> fileLookup,
CmsProject project,
I_CmsReport report) {
List<CmsRelation> brokenRelations = new ArrayList<CmsRelation>();
Map<String, Boolean> validatedLinks = new HashMap<String, Boolean>();
// get the relations
List<CmsRelation> incomingRelationsOnline = new ArrayList<CmsRelation>();
List<CmsRelation> outgoingRelationsOffline = new ArrayList<CmsRelation>();
try {
if (!resource.getState().isDeleted()) {
// search the target of links in the current (offline) project
outgoingRelationsOffline = m_driverManager.getRelationsForResource(
dbc,
resource,
CmsRelationFilter.TARGETS);
} else {
// search the source of links in the online project
CmsProject currentProject = dbc.currentProject();
dbc.getRequestContext().setCurrentProject(project);
try {
incomingRelationsOnline = m_driverManager.getRelationsForResource(
dbc,
resource,
CmsRelationFilter.SOURCES);
} finally {
dbc.getRequestContext().setCurrentProject(currentProject);
}
}
} catch (CmsException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_LINK_SEARCH_1, resource), e);
if (report != null) {
report.println(
Messages.get().container(Messages.LOG_LINK_SEARCH_1, dbc.removeSiteRoot(resource.getRootPath())),
I_CmsReport.FORMAT_ERROR);
}
return brokenRelations;
}
List<CmsRelation> relations = new ArrayList<CmsRelation>();
relations.addAll(incomingRelationsOnline);
relations.addAll(outgoingRelationsOffline);
HashMultimap<String, String> outgoingRelationTargets = HashMultimap.create();
for (CmsRelation outRelation : outgoingRelationsOffline) {
String sourcePath = outRelation.getSourcePath();
String targetId = outRelation.getTargetId().toString();
String targetPath = outRelation.getTargetPath();
outgoingRelationTargets.put(sourcePath, targetId);
outgoingRelationTargets.put(sourcePath, targetPath);
}
// check the relations
boolean first = true;
Iterator<CmsRelation> itRelations = relations.iterator();
while (itRelations.hasNext()) {
CmsRelation relation = itRelations.next();
String link;
if (!resource.getState().isDeleted()) {
link = relation.getTargetPath();
} else {
link = relation.getSourcePath();
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(link)) {
// skip empty links
continue;
}
if (validatedLinks.keySet().contains(link)) {
// skip already validated links
if (validatedLinks.get(link).booleanValue()) {
// add broken relation of different type
brokenRelations.add(relation);
}
continue;
}
boolean result;
if (resource.getState().isDeleted()) {
result = checkLinkForDeletedLinkTarget(relation, link, fileLookup, outgoingRelationTargets);
} else {
result = checkLinkForNewOrChangedLinkSource(dbc, resource, relation, link, project, fileLookup);
}
boolean isValidLink = result;
if (!isValidLink) {
if (first) {
if (report != null) {
report.println(
Messages.get().container(Messages.RPT_HTMLLINK_FOUND_BROKEN_LINKS_0),
I_CmsReport.FORMAT_WARNING);
}
first = false;
}
brokenRelations.add(relation);
if (report != null) {
if (!resource.getState().isDeleted()) {
report.println(
Messages.get().container(
Messages.RPT_HTMLLINK_BROKEN_TARGET_2,
relation.getSourcePath(),
dbc.removeSiteRoot(link)),
I_CmsReport.FORMAT_WARNING);
} else {
report.println(
Messages.get().container(
Messages.RPT_HTMLLINK_BROKEN_SOURCE_2,
dbc.removeSiteRoot(link),
relation.getTargetPath()),
I_CmsReport.FORMAT_WARNING);
}
}
}
validatedLinks.put(link, Boolean.valueOf(!isValidLink));
}
return brokenRelations;
} }
|
public class class_name {
protected List<CmsRelation> validateLinks(
CmsDbContext dbc,
CmsResource resource,
Map<String, CmsResource> fileLookup,
CmsProject project,
I_CmsReport report) {
List<CmsRelation> brokenRelations = new ArrayList<CmsRelation>();
Map<String, Boolean> validatedLinks = new HashMap<String, Boolean>();
// get the relations
List<CmsRelation> incomingRelationsOnline = new ArrayList<CmsRelation>();
List<CmsRelation> outgoingRelationsOffline = new ArrayList<CmsRelation>();
try {
if (!resource.getState().isDeleted()) {
// search the target of links in the current (offline) project
outgoingRelationsOffline = m_driverManager.getRelationsForResource(
dbc,
resource,
CmsRelationFilter.TARGETS); // depends on control dependency: [if], data = [none]
} else {
// search the source of links in the online project
CmsProject currentProject = dbc.currentProject();
dbc.getRequestContext().setCurrentProject(project); // depends on control dependency: [if], data = [none]
try {
incomingRelationsOnline = m_driverManager.getRelationsForResource(
dbc,
resource,
CmsRelationFilter.SOURCES); // depends on control dependency: [try], data = [none]
} finally {
dbc.getRequestContext().setCurrentProject(currentProject);
}
}
} catch (CmsException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_LINK_SEARCH_1, resource), e);
if (report != null) {
report.println(
Messages.get().container(Messages.LOG_LINK_SEARCH_1, dbc.removeSiteRoot(resource.getRootPath())),
I_CmsReport.FORMAT_ERROR); // depends on control dependency: [if], data = [none]
}
return brokenRelations;
} // depends on control dependency: [catch], data = [none]
List<CmsRelation> relations = new ArrayList<CmsRelation>();
relations.addAll(incomingRelationsOnline);
relations.addAll(outgoingRelationsOffline);
HashMultimap<String, String> outgoingRelationTargets = HashMultimap.create();
for (CmsRelation outRelation : outgoingRelationsOffline) {
String sourcePath = outRelation.getSourcePath();
String targetId = outRelation.getTargetId().toString();
String targetPath = outRelation.getTargetPath();
outgoingRelationTargets.put(sourcePath, targetId); // depends on control dependency: [for], data = [none]
outgoingRelationTargets.put(sourcePath, targetPath); // depends on control dependency: [for], data = [none]
}
// check the relations
boolean first = true;
Iterator<CmsRelation> itRelations = relations.iterator();
while (itRelations.hasNext()) {
CmsRelation relation = itRelations.next();
String link;
if (!resource.getState().isDeleted()) {
link = relation.getTargetPath(); // depends on control dependency: [if], data = [none]
} else {
link = relation.getSourcePath(); // depends on control dependency: [if], data = [none]
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(link)) {
// skip empty links
continue;
}
if (validatedLinks.keySet().contains(link)) {
// skip already validated links
if (validatedLinks.get(link).booleanValue()) {
// add broken relation of different type
brokenRelations.add(relation); // depends on control dependency: [if], data = [none]
}
continue;
}
boolean result;
if (resource.getState().isDeleted()) {
result = checkLinkForDeletedLinkTarget(relation, link, fileLookup, outgoingRelationTargets); // depends on control dependency: [if], data = [none]
} else {
result = checkLinkForNewOrChangedLinkSource(dbc, resource, relation, link, project, fileLookup); // depends on control dependency: [if], data = [none]
}
boolean isValidLink = result;
if (!isValidLink) {
if (first) {
if (report != null) {
report.println(
Messages.get().container(Messages.RPT_HTMLLINK_FOUND_BROKEN_LINKS_0),
I_CmsReport.FORMAT_WARNING); // depends on control dependency: [if], data = [none]
}
first = false; // depends on control dependency: [if], data = [none]
}
brokenRelations.add(relation); // depends on control dependency: [if], data = [none]
if (report != null) {
if (!resource.getState().isDeleted()) {
report.println(
Messages.get().container(
Messages.RPT_HTMLLINK_BROKEN_TARGET_2,
relation.getSourcePath(),
dbc.removeSiteRoot(link)),
I_CmsReport.FORMAT_WARNING); // depends on control dependency: [if], data = [none]
} else {
report.println(
Messages.get().container(
Messages.RPT_HTMLLINK_BROKEN_SOURCE_2,
dbc.removeSiteRoot(link),
relation.getTargetPath()),
I_CmsReport.FORMAT_WARNING); // depends on control dependency: [if], data = [none]
}
}
}
validatedLinks.put(link, Boolean.valueOf(!isValidLink)); // depends on control dependency: [while], data = [none]
}
return brokenRelations;
} }
|
public class class_name {
public String toCsv() {
StringBuilder sb = new StringBuilder();
Iterator<Outcome> iter = outcomeIterator();
while (iter.hasNext()) {
Outcome outcome = iter.next();
sb.append(outcome.toCsv());
if (iter.hasNext()) {
sb.append("\n");
}
}
return sb.toString();
} }
|
public class class_name {
public String toCsv() {
StringBuilder sb = new StringBuilder();
Iterator<Outcome> iter = outcomeIterator();
while (iter.hasNext()) {
Outcome outcome = iter.next();
sb.append(outcome.toCsv()); // depends on control dependency: [while], data = [none]
if (iter.hasNext()) {
sb.append("\n"); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} }
|
public class class_name {
public static MutableIntTuple min(
Collection<? extends IntTuple> tuples,
MutableIntTuple result)
{
if (tuples.isEmpty())
{
return null;
}
int size = getSize(result, tuples);
IntTuple identity =
IntTuples.constant(size, Integer.MAX_VALUE);
MutableIntTuple localResult =
tuples.parallelStream().collect(
() -> IntTuples.copy(identity),
(r,t) -> IntTuples.min(r, t, r),
(r0,r1) -> IntTuples.min(r0, r1, r0));
if (result == null)
{
return localResult;
}
result.set(localResult);
return result;
} }
|
public class class_name {
public static MutableIntTuple min(
Collection<? extends IntTuple> tuples,
MutableIntTuple result)
{
if (tuples.isEmpty())
{
return null;
// depends on control dependency: [if], data = [none]
}
int size = getSize(result, tuples);
IntTuple identity =
IntTuples.constant(size, Integer.MAX_VALUE);
MutableIntTuple localResult =
tuples.parallelStream().collect(
() -> IntTuples.copy(identity),
(r,t) -> IntTuples.min(r, t, r),
(r0,r1) -> IntTuples.min(r0, r1, r0));
if (result == null)
{
return localResult;
// depends on control dependency: [if], data = [none]
}
result.set(localResult);
return result;
} }
|
public class class_name {
public PhotoContext getContext(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CONTEXT);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
PhotoContext photoContext = new PhotoContext();
Collection<Element> payload = response.getPayloadCollection();
for (Element payloadElement : payload) {
String tagName = payloadElement.getTagName();
if (tagName.equals("prevphoto")) {
Photo photo = new Photo();
photo.setId(payloadElement.getAttribute("id"));
photo.setSecret(payloadElement.getAttribute("secret"));
photo.setTitle(payloadElement.getAttribute("title"));
photo.setFarm(payloadElement.getAttribute("farm"));
photo.setUrl(payloadElement.getAttribute("url"));
photoContext.setPreviousPhoto(photo);
} else if (tagName.equals("nextphoto")) {
Photo photo = new Photo();
photo.setId(payloadElement.getAttribute("id"));
photo.setSecret(payloadElement.getAttribute("secret"));
photo.setTitle(payloadElement.getAttribute("title"));
photo.setFarm(payloadElement.getAttribute("farm"));
photo.setUrl(payloadElement.getAttribute("url"));
photoContext.setNextPhoto(photo);
}
}
return photoContext;
} }
|
public class class_name {
public PhotoContext getContext(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CONTEXT);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
PhotoContext photoContext = new PhotoContext();
Collection<Element> payload = response.getPayloadCollection();
for (Element payloadElement : payload) {
String tagName = payloadElement.getTagName();
if (tagName.equals("prevphoto")) {
Photo photo = new Photo();
photo.setId(payloadElement.getAttribute("id"));
// depends on control dependency: [if], data = [none]
photo.setSecret(payloadElement.getAttribute("secret"));
// depends on control dependency: [if], data = [none]
photo.setTitle(payloadElement.getAttribute("title"));
// depends on control dependency: [if], data = [none]
photo.setFarm(payloadElement.getAttribute("farm"));
// depends on control dependency: [if], data = [none]
photo.setUrl(payloadElement.getAttribute("url"));
// depends on control dependency: [if], data = [none]
photoContext.setPreviousPhoto(photo);
// depends on control dependency: [if], data = [none]
} else if (tagName.equals("nextphoto")) {
Photo photo = new Photo();
photo.setId(payloadElement.getAttribute("id"));
// depends on control dependency: [if], data = [none]
photo.setSecret(payloadElement.getAttribute("secret"));
// depends on control dependency: [if], data = [none]
photo.setTitle(payloadElement.getAttribute("title"));
// depends on control dependency: [if], data = [none]
photo.setFarm(payloadElement.getAttribute("farm"));
// depends on control dependency: [if], data = [none]
photo.setUrl(payloadElement.getAttribute("url"));
// depends on control dependency: [if], data = [none]
photoContext.setNextPhoto(photo);
// depends on control dependency: [if], data = [none]
}
}
return photoContext;
} }
|
public class class_name {
public void visit(ASTNode[] nodes, final SourceUnit source) {
if (nodes.length != 2 || !(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof ClassNode)) {
source.getErrorCollector().addError(
new SyntaxErrorMessage(new SyntaxException("@Category can only be added to a ClassNode but got: " + (nodes.length==2?nodes[1]:"nothing"),
nodes[0].getLineNumber(), nodes[0].getColumnNumber()), source));
}
AnnotationNode annotation = (AnnotationNode) nodes[0];
ClassNode parent = (ClassNode) nodes[1];
ClassNode targetClass = getTargetClass(source, annotation);
thisExpression.setType(targetClass);
final LinkedList<Set<String>> varStack = new LinkedList<Set<String>>();
if (!ensureNoInstanceFieldOrProperty(source, parent)) return;
Set<String> names = new HashSet<String>();
for (FieldNode field : parent.getFields()) {
names.add(field.getName());
}
for (PropertyNode field : parent.getProperties()) {
names.add(field.getName());
}
varStack.add(names);
final Reference parameter = new Reference();
final ClassCodeExpressionTransformer expressionTransformer = new ClassCodeExpressionTransformer() {
protected SourceUnit getSourceUnit() {
return source;
}
private void addVariablesToStack(Parameter[] params) {
Set<String> names = new HashSet<String>();
names.addAll(varStack.getLast());
for (Parameter param : params) {
names.add(param.getName());
}
varStack.add(names);
}
@Override
public void visitCatchStatement(CatchStatement statement) {
varStack.getLast().add(statement.getVariable().getName());
super.visitCatchStatement(statement);
varStack.getLast().remove(statement.getVariable().getName());
}
@Override
public void visitMethod(MethodNode node) {
addVariablesToStack(node.getParameters());
super.visitMethod(node);
varStack.removeLast();
}
@Override
public void visitBlockStatement(BlockStatement block) {
Set<String> names = new HashSet<String>();
names.addAll(varStack.getLast());
varStack.add(names);
super.visitBlockStatement(block);
varStack.remove(names);
}
@Override
public void visitClosureExpression(ClosureExpression ce) {
addVariablesToStack(ce.getParameters());
super.visitClosureExpression(ce);
varStack.removeLast();
}
@Override
public void visitDeclarationExpression(DeclarationExpression expression) {
if (expression.isMultipleAssignmentDeclaration()) {
TupleExpression te = expression.getTupleExpression();
List<Expression> list = te.getExpressions();
for (Expression arg : list) {
VariableExpression ve = (VariableExpression) arg;
varStack.getLast().add(ve.getName());
}
} else {
VariableExpression ve = expression.getVariableExpression();
varStack.getLast().add(ve.getName());
}
super.visitDeclarationExpression(expression);
}
@Override
public void visitForLoop(ForStatement forLoop) {
Expression exp = forLoop.getCollectionExpression();
exp.visit(this);
Parameter loopParam = forLoop.getVariable();
if (loopParam != null) {
varStack.getLast().add(loopParam.getName());
}
super.visitForLoop(forLoop);
}
@Override
public void visitExpressionStatement(ExpressionStatement es) {
// GROOVY-3543: visit the declaration expressions so that declaration variables get added on the varStack
Expression exp = es.getExpression();
if (exp instanceof DeclarationExpression) {
exp.visit(this);
}
super.visitExpressionStatement(es);
}
@Override
public Expression transform(Expression exp) {
if (exp instanceof VariableExpression) {
VariableExpression ve = (VariableExpression) exp;
if (ve.getName().equals("this"))
return thisExpression;
else {
if (!varStack.getLast().contains(ve.getName())) {
return new PropertyExpression(thisExpression, ve.getName());
}
}
} else if (exp instanceof PropertyExpression) {
PropertyExpression pe = (PropertyExpression) exp;
if (pe.getObjectExpression() instanceof VariableExpression) {
VariableExpression vex = (VariableExpression) pe.getObjectExpression();
if (vex.isThisExpression()) {
pe.setObjectExpression(thisExpression);
return pe;
}
}
} else if (exp instanceof ClosureExpression) {
ClosureExpression ce = (ClosureExpression) exp;
ce.getVariableScope().putReferencedLocalVariable((Parameter) parameter.get());
Parameter[] params = ce.getParameters();
if (params == null) {
params = Parameter.EMPTY_ARRAY;
} else if (params.length == 0) {
params = new Parameter[]{
new Parameter(ClassHelper.OBJECT_TYPE, "it")
};
}
addVariablesToStack(params);
ce.getCode().visit(this);
varStack.removeLast();
}
return super.transform(exp);
}
};
for (MethodNode method : parent.getMethods()) {
if (!method.isStatic()) {
method.setModifiers(method.getModifiers() | Opcodes.ACC_STATIC);
final Parameter[] origParams = method.getParameters();
final Parameter[] newParams = new Parameter[origParams.length + 1];
Parameter p = new Parameter(targetClass, "$this");
p.setClosureSharedVariable(true);
newParams[0] = p;
parameter.set(p);
System.arraycopy(origParams, 0, newParams, 1, origParams.length);
method.setParameters(newParams);
expressionTransformer.visitMethod(method);
}
}
new VariableScopeVisitor(source, true).visitClass(parent);
} }
|
public class class_name {
public void visit(ASTNode[] nodes, final SourceUnit source) {
if (nodes.length != 2 || !(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof ClassNode)) {
source.getErrorCollector().addError(
new SyntaxErrorMessage(new SyntaxException("@Category can only be added to a ClassNode but got: " + (nodes.length==2?nodes[1]:"nothing"),
nodes[0].getLineNumber(), nodes[0].getColumnNumber()), source));
// depends on control dependency: [if], data = [none]
}
AnnotationNode annotation = (AnnotationNode) nodes[0];
ClassNode parent = (ClassNode) nodes[1];
ClassNode targetClass = getTargetClass(source, annotation);
thisExpression.setType(targetClass);
final LinkedList<Set<String>> varStack = new LinkedList<Set<String>>();
if (!ensureNoInstanceFieldOrProperty(source, parent)) return;
Set<String> names = new HashSet<String>();
for (FieldNode field : parent.getFields()) {
names.add(field.getName());
// depends on control dependency: [for], data = [field]
}
for (PropertyNode field : parent.getProperties()) {
names.add(field.getName());
// depends on control dependency: [for], data = [field]
}
varStack.add(names);
final Reference parameter = new Reference();
final ClassCodeExpressionTransformer expressionTransformer = new ClassCodeExpressionTransformer() {
protected SourceUnit getSourceUnit() {
return source;
}
private void addVariablesToStack(Parameter[] params) {
Set<String> names = new HashSet<String>();
names.addAll(varStack.getLast());
for (Parameter param : params) {
names.add(param.getName());
// depends on control dependency: [for], data = [param]
}
varStack.add(names);
}
@Override
public void visitCatchStatement(CatchStatement statement) {
varStack.getLast().add(statement.getVariable().getName());
super.visitCatchStatement(statement);
varStack.getLast().remove(statement.getVariable().getName());
}
@Override
public void visitMethod(MethodNode node) {
addVariablesToStack(node.getParameters());
super.visitMethod(node);
varStack.removeLast();
}
@Override
public void visitBlockStatement(BlockStatement block) {
Set<String> names = new HashSet<String>();
names.addAll(varStack.getLast());
varStack.add(names);
super.visitBlockStatement(block);
varStack.remove(names);
}
@Override
public void visitClosureExpression(ClosureExpression ce) {
addVariablesToStack(ce.getParameters());
super.visitClosureExpression(ce);
varStack.removeLast();
}
@Override
public void visitDeclarationExpression(DeclarationExpression expression) {
if (expression.isMultipleAssignmentDeclaration()) {
TupleExpression te = expression.getTupleExpression();
List<Expression> list = te.getExpressions();
for (Expression arg : list) {
VariableExpression ve = (VariableExpression) arg;
varStack.getLast().add(ve.getName());
// depends on control dependency: [for], data = [none]
}
} else {
VariableExpression ve = expression.getVariableExpression();
varStack.getLast().add(ve.getName());
// depends on control dependency: [if], data = [none]
}
super.visitDeclarationExpression(expression);
}
@Override
public void visitForLoop(ForStatement forLoop) {
Expression exp = forLoop.getCollectionExpression();
exp.visit(this);
Parameter loopParam = forLoop.getVariable();
if (loopParam != null) {
varStack.getLast().add(loopParam.getName());
// depends on control dependency: [if], data = [(loopParam]
}
super.visitForLoop(forLoop);
}
@Override
public void visitExpressionStatement(ExpressionStatement es) {
// GROOVY-3543: visit the declaration expressions so that declaration variables get added on the varStack
Expression exp = es.getExpression();
if (exp instanceof DeclarationExpression) {
exp.visit(this);
// depends on control dependency: [if], data = [none]
}
super.visitExpressionStatement(es);
}
@Override
public Expression transform(Expression exp) {
if (exp instanceof VariableExpression) {
VariableExpression ve = (VariableExpression) exp;
if (ve.getName().equals("this"))
return thisExpression;
else {
if (!varStack.getLast().contains(ve.getName())) {
return new PropertyExpression(thisExpression, ve.getName());
// depends on control dependency: [if], data = [none]
}
}
} else if (exp instanceof PropertyExpression) {
PropertyExpression pe = (PropertyExpression) exp;
if (pe.getObjectExpression() instanceof VariableExpression) {
VariableExpression vex = (VariableExpression) pe.getObjectExpression();
if (vex.isThisExpression()) {
pe.setObjectExpression(thisExpression);
// depends on control dependency: [if], data = [none]
return pe;
// depends on control dependency: [if], data = [none]
}
}
} else if (exp instanceof ClosureExpression) {
ClosureExpression ce = (ClosureExpression) exp;
ce.getVariableScope().putReferencedLocalVariable((Parameter) parameter.get());
// depends on control dependency: [if], data = [none]
Parameter[] params = ce.getParameters();
if (params == null) {
params = Parameter.EMPTY_ARRAY;
// depends on control dependency: [if], data = [none]
} else if (params.length == 0) {
params = new Parameter[]{
new Parameter(ClassHelper.OBJECT_TYPE, "it")
};
// depends on control dependency: [if], data = [none]
}
addVariablesToStack(params);
// depends on control dependency: [if], data = [none]
ce.getCode().visit(this);
// depends on control dependency: [if], data = [none]
varStack.removeLast();
// depends on control dependency: [if], data = [none]
}
return super.transform(exp);
}
};
for (MethodNode method : parent.getMethods()) {
if (!method.isStatic()) {
method.setModifiers(method.getModifiers() | Opcodes.ACC_STATIC);
// depends on control dependency: [if], data = [none]
final Parameter[] origParams = method.getParameters();
final Parameter[] newParams = new Parameter[origParams.length + 1];
Parameter p = new Parameter(targetClass, "$this");
p.setClosureSharedVariable(true);
// depends on control dependency: [if], data = [none]
newParams[0] = p;
// depends on control dependency: [if], data = [none]
parameter.set(p);
// depends on control dependency: [if], data = [none]
System.arraycopy(origParams, 0, newParams, 1, origParams.length);
// depends on control dependency: [if], data = [none]
method.setParameters(newParams);
// depends on control dependency: [if], data = [none]
expressionTransformer.visitMethod(method);
// depends on control dependency: [if], data = [none]
}
}
new VariableScopeVisitor(source, true).visitClass(parent);
} }
|
public class class_name {
Map<String, CmsSSLMode> getWebserverList() {
Map<String, CmsSSLMode> ret = new LinkedHashMap<String, CmsSSLMode>();
for (I_CmsEditableGroupRow row : m_workplaceServerGroup.getRows()) {
CmsWorkplaceServerWidget widget = (CmsWorkplaceServerWidget)row.getComponent();
ret.put(widget.getServer(), widget.getSSLMode());
}
return ret;
} }
|
public class class_name {
Map<String, CmsSSLMode> getWebserverList() {
Map<String, CmsSSLMode> ret = new LinkedHashMap<String, CmsSSLMode>();
for (I_CmsEditableGroupRow row : m_workplaceServerGroup.getRows()) {
CmsWorkplaceServerWidget widget = (CmsWorkplaceServerWidget)row.getComponent();
ret.put(widget.getServer(), widget.getSSLMode()); // depends on control dependency: [for], data = [none]
}
return ret;
} }
|
public class class_name {
public void marshall(CreateEventSubscriptionRequest createEventSubscriptionRequest, ProtocolMarshaller protocolMarshaller) {
if (createEventSubscriptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createEventSubscriptionRequest.getSubscriptionName(), SUBSCRIPTIONNAME_BINDING);
protocolMarshaller.marshall(createEventSubscriptionRequest.getSnsTopicArn(), SNSTOPICARN_BINDING);
protocolMarshaller.marshall(createEventSubscriptionRequest.getSourceType(), SOURCETYPE_BINDING);
protocolMarshaller.marshall(createEventSubscriptionRequest.getEventCategories(), EVENTCATEGORIES_BINDING);
protocolMarshaller.marshall(createEventSubscriptionRequest.getSourceIds(), SOURCEIDS_BINDING);
protocolMarshaller.marshall(createEventSubscriptionRequest.getEnabled(), ENABLED_BINDING);
protocolMarshaller.marshall(createEventSubscriptionRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CreateEventSubscriptionRequest createEventSubscriptionRequest, ProtocolMarshaller protocolMarshaller) {
if (createEventSubscriptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createEventSubscriptionRequest.getSubscriptionName(), SUBSCRIPTIONNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEventSubscriptionRequest.getSnsTopicArn(), SNSTOPICARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEventSubscriptionRequest.getSourceType(), SOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEventSubscriptionRequest.getEventCategories(), EVENTCATEGORIES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEventSubscriptionRequest.getSourceIds(), SOURCEIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEventSubscriptionRequest.getEnabled(), ENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEventSubscriptionRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setPendingMaintenanceActions(java.util.Collection<PendingMaintenanceAction> pendingMaintenanceActions) {
if (pendingMaintenanceActions == null) {
this.pendingMaintenanceActions = null;
return;
}
this.pendingMaintenanceActions = new java.util.ArrayList<PendingMaintenanceAction>(pendingMaintenanceActions);
} }
|
public class class_name {
public void setPendingMaintenanceActions(java.util.Collection<PendingMaintenanceAction> pendingMaintenanceActions) {
if (pendingMaintenanceActions == null) {
this.pendingMaintenanceActions = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.pendingMaintenanceActions = new java.util.ArrayList<PendingMaintenanceAction>(pendingMaintenanceActions);
} }
|
public class class_name {
public void addAnnotationDetailsTreeHeader(TypeElement te,
Content memberDetailsTree) {
if (!writer.printedAnnotationHeading) {
memberDetailsTree.addContent(writer.getMarkerAnchor(
SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
contents.annotationTypeDetailsLabel);
memberDetailsTree.addContent(heading);
writer.printedAnnotationHeading = true;
}
} }
|
public class class_name {
public void addAnnotationDetailsTreeHeader(TypeElement te,
Content memberDetailsTree) {
if (!writer.printedAnnotationHeading) {
memberDetailsTree.addContent(writer.getMarkerAnchor(
SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL)); // depends on control dependency: [if], data = [none]
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
contents.annotationTypeDetailsLabel);
memberDetailsTree.addContent(heading); // depends on control dependency: [if], data = [none]
writer.printedAnnotationHeading = true; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Subject getSubject(Subject subject) {
Subject result = null;
if(isSecurityEnabled) {
/*
* Check if the SIBSecurity Service is loaded. If it is not loaded,
* load SIBSecurity Service Invoke the Login method of the
* SIBSecurity Service to get the Subject
*
* Existing Code
* String userName = getAuthorisationUtils().getUserName(subject);
* SibLoginFactory loginFactory = SibLoginFactory.getInstance();
* SibLogin myLogin = loginFactory.createNewSibLogin();
* subject = myLogin.login(theBus, subject);
*/
} else {
/*
* Create a JAVA Subject and return it, anyways it does not matter
*/
result = new Subject();
}
return result;
} }
|
public class class_name {
public Subject getSubject(Subject subject) {
Subject result = null;
if(isSecurityEnabled) {
/*
* Check if the SIBSecurity Service is loaded. If it is not loaded,
* load SIBSecurity Service Invoke the Login method of the
* SIBSecurity Service to get the Subject
*
* Existing Code
* String userName = getAuthorisationUtils().getUserName(subject);
* SibLoginFactory loginFactory = SibLoginFactory.getInstance();
* SibLogin myLogin = loginFactory.createNewSibLogin();
* subject = myLogin.login(theBus, subject);
*/
} else {
/*
* Create a JAVA Subject and return it, anyways it does not matter
*/
result = new Subject(); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public java.util.List<StackResourceDrift> getStackResourceDrifts() {
if (stackResourceDrifts == null) {
stackResourceDrifts = new com.amazonaws.internal.SdkInternalList<StackResourceDrift>();
}
return stackResourceDrifts;
} }
|
public class class_name {
public java.util.List<StackResourceDrift> getStackResourceDrifts() {
if (stackResourceDrifts == null) {
stackResourceDrifts = new com.amazonaws.internal.SdkInternalList<StackResourceDrift>(); // depends on control dependency: [if], data = [none]
}
return stackResourceDrifts;
} }
|
public class class_name {
private void checkSendUpdateConfigMessage(String site1, String site2,
Status site1Status, Status site2Status) throws Exception {
String repo;
String revision;
String branch;
if(includeConfig) {
repo = site1Status.getConfigRepo();
revision = site1Status.getConfigRevision();
branch = site1Status.getConfigBranch();
if(!StringUtils.isEmptyOrNull(repo) && !StringUtils.isEmptyOrNull(revision) && !StringUtils.isEmptyOrNull(branch)) {
if(!repo.equals(site2Status.getConfigRepo()) || !revision.equals(site2Status.getConfigRevision()) || ! branch.equals(site2Status.getConfigBranch())) {
System.out.println("Sending update/config message to ["+site2+"]");
UpdateCommand.sendUpdateMessage(site2, repo, branch, revision, "Cloned config from ["+site1+"]: " + comment, token, UpdateConfigCommand.UPDATE_CONFIG_ENDPOINT, UpdateRequest.CONFIG_BRANCH_PREFIX);
} else {
System.out.println("Source [" + site1 + "] is on the same configuration repo, branch, and revision as the target [" + site2 + "].");
}
} else {
System.out.println("Configuration status not available from source site [" + site1 + "]");
}
}
} }
|
public class class_name {
private void checkSendUpdateConfigMessage(String site1, String site2,
Status site1Status, Status site2Status) throws Exception {
String repo;
String revision;
String branch;
if(includeConfig) {
repo = site1Status.getConfigRepo();
revision = site1Status.getConfigRevision();
branch = site1Status.getConfigBranch();
if(!StringUtils.isEmptyOrNull(repo) && !StringUtils.isEmptyOrNull(revision) && !StringUtils.isEmptyOrNull(branch)) {
if(!repo.equals(site2Status.getConfigRepo()) || !revision.equals(site2Status.getConfigRevision()) || ! branch.equals(site2Status.getConfigBranch())) {
System.out.println("Sending update/config message to ["+site2+"]"); // depends on control dependency: [if], data = [none]
UpdateCommand.sendUpdateMessage(site2, repo, branch, revision, "Cloned config from ["+site1+"]: " + comment, token, UpdateConfigCommand.UPDATE_CONFIG_ENDPOINT, UpdateRequest.CONFIG_BRANCH_PREFIX); // depends on control dependency: [if], data = [none]
} else {
System.out.println("Source [" + site1 + "] is on the same configuration repo, branch, and revision as the target [" + site2 + "]."); // depends on control dependency: [if], data = [none]
}
} else {
System.out.println("Configuration status not available from source site [" + site1 + "]"); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static String getCanonicalizedURI(String uri, boolean canonicalizePath) {
String canonicalURI = uri;
if (uri != null) {
String host = getHost(uri);
String path = getPath(uri);
final boolean emptyPath = "".equals(path);
final boolean noPathToCanonicalize = canonicalizePath && (path == null || emptyPath);
final boolean trailingSlashPath = "/".equals(path);
final String scheme = getScheme(uri);
final boolean pathlessScheme = "ssl".equals(scheme) || "tcp".equals(scheme) || "pipe".equals(scheme)
|| "udp".equals(scheme) || "mux".equals(scheme);
final boolean trailingSlashWithPathlessScheme = trailingSlashPath && pathlessScheme;
String newPath = trailingSlashWithPathlessScheme ? "" :
noPathToCanonicalize ? (pathlessScheme ? null : "/") : null;
if (((host != null) && !host.equals(host.toLowerCase())) || newPath != null) {
path = newPath == null ? path : newPath;
try {
canonicalURI = buildURIAsString(scheme, getUserInfo(uri), host == null ?
null : host.toLowerCase(), getPort(uri), path, getQuery(uri), getFragment(uri));
} catch (URISyntaxException ex) {
throw new IllegalArgumentException("Invalid URI: " + uri + " in Gateway configuration file", ex);
}
}
}
return canonicalURI;
} }
|
public class class_name {
public static String getCanonicalizedURI(String uri, boolean canonicalizePath) {
String canonicalURI = uri;
if (uri != null) {
String host = getHost(uri);
String path = getPath(uri);
final boolean emptyPath = "".equals(path);
final boolean noPathToCanonicalize = canonicalizePath && (path == null || emptyPath);
final boolean trailingSlashPath = "/".equals(path);
final String scheme = getScheme(uri);
final boolean pathlessScheme = "ssl".equals(scheme) || "tcp".equals(scheme) || "pipe".equals(scheme)
|| "udp".equals(scheme) || "mux".equals(scheme);
final boolean trailingSlashWithPathlessScheme = trailingSlashPath && pathlessScheme;
String newPath = trailingSlashWithPathlessScheme ? "" :
noPathToCanonicalize ? (pathlessScheme ? null : "/") : null;
if (((host != null) && !host.equals(host.toLowerCase())) || newPath != null) {
path = newPath == null ? path : newPath; // depends on control dependency: [if], data = [none]
try {
canonicalURI = buildURIAsString(scheme, getUserInfo(uri), host == null ?
null : host.toLowerCase(), getPort(uri), path, getQuery(uri), getFragment(uri)); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException ex) {
throw new IllegalArgumentException("Invalid URI: " + uri + " in Gateway configuration file", ex);
} // depends on control dependency: [catch], data = [none]
}
}
return canonicalURI;
} }
|
public class class_name {
private void setStreamIsBlocked(boolean value,
int blockingReason,
Exception exception,
JsDestinationAddress blockedAddress)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setStreamIsBlocked", new Object[] { Boolean.valueOf(value),
Integer.valueOf(blockingReason),
exception,
blockedAddress });
unexpectedBlock = false;
isStreamBlocked = value;
streamBlockingAddress = blockedAddress;
// Defect 535791 - Update the health state of the stream to signal that it has either become
// blocked or unblocked
if (isStreamBlocked)
{
// First we build a string representation of the blocking address, using ":" to delimit the
// parts of the address (name, bus, ME)
String blockingAddress = "NULL";
if (blockedAddress != null)
{
String busName = blockedAddress.getBusName();
SIBUuid8 meUuid = blockedAddress.getME();
String meUuidStr = null;
if (meUuid != null)
meUuidStr = meUuid.toString();
blockingAddress = blockedAddress.getDestinationName();
if (busName != null)
blockingAddress += ":" + busName;
if (meUuidStr != null)
{
if (busName == null)
blockingAddress += ":";
blockingAddress += ":" + meUuidStr;
}
}
// Now represent the reason as a simple string
String reasonText = "NONE";
if (exception == null)
{
switch (blockingReason)
{
case DestinationHandler.OUTPUT_HANDLER_NOT_FOUND:
reasonText = "NOT_FOUND";
break;
case DestinationHandler.OUTPUT_HANDLER_SEND_ALLOWED_FALSE:
reasonText = "SEND_NOT_ALLOWED";
break;
case DestinationHandler.OUTPUT_HANDLER_ALL_HIGH_LIMIT:
reasonText = "DESTINATION_FULL";
break;
}
}
else
{
// If we caught an unexpected failure to process a message, the
// stream becomes implicitly blocked. The one time we would 'expect'
// this is if we had an authorization problem (as that's not checked
// as part of streamCanAcceptNewMessage) so we handle that
// explicitly. For anything else, putting out the exception class
// name is probably as good as it gets (if anything really nasty happened
// then deliverOrderedMessages will probably have FFDC'd too).
if (exception instanceof SINotAuthorizedException)
reasonText = "NOT_AUTHORIZED";
else
reasonText = exception.getClass().getSimpleName();
// If an exception is passed in then we obviously thought the message should
// have worked but it actually failed to be delivered for some reason. We need
// to handle those failures specially, so remember this fact.
unexpectedBlock = true;
}
String[] inserts = { reasonText, blockingAddress };
// The stream is blocked
getControlAdapter().getHealthState().updateHealth(HealthStateListener.BLOCKED_TARGET_STREAM_STATE,
HealthState.AMBER,
inserts);
}
else
{
// The link is no longer blocked
getControlAdapter().getHealthState().updateHealth(HealthStateListener.BLOCKED_TARGET_STREAM_STATE,
HealthState.GREEN);
linkBlockingTick = -1;
blockingCount = 0;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setStreamIsBlocked");
} }
|
public class class_name {
private void setStreamIsBlocked(boolean value,
int blockingReason,
Exception exception,
JsDestinationAddress blockedAddress)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setStreamIsBlocked", new Object[] { Boolean.valueOf(value),
Integer.valueOf(blockingReason),
exception,
blockedAddress });
unexpectedBlock = false;
isStreamBlocked = value;
streamBlockingAddress = blockedAddress;
// Defect 535791 - Update the health state of the stream to signal that it has either become
// blocked or unblocked
if (isStreamBlocked)
{
// First we build a string representation of the blocking address, using ":" to delimit the
// parts of the address (name, bus, ME)
String blockingAddress = "NULL";
if (blockedAddress != null)
{
String busName = blockedAddress.getBusName();
SIBUuid8 meUuid = blockedAddress.getME();
String meUuidStr = null;
if (meUuid != null)
meUuidStr = meUuid.toString();
blockingAddress = blockedAddress.getDestinationName(); // depends on control dependency: [if], data = [none]
if (busName != null)
blockingAddress += ":" + busName;
if (meUuidStr != null)
{
if (busName == null)
blockingAddress += ":";
blockingAddress += ":" + meUuidStr; // depends on control dependency: [if], data = [none]
}
}
// Now represent the reason as a simple string
String reasonText = "NONE";
if (exception == null)
{
switch (blockingReason)
{
case DestinationHandler.OUTPUT_HANDLER_NOT_FOUND:
reasonText = "NOT_FOUND";
break;
case DestinationHandler.OUTPUT_HANDLER_SEND_ALLOWED_FALSE:
reasonText = "SEND_NOT_ALLOWED";
break;
case DestinationHandler.OUTPUT_HANDLER_ALL_HIGH_LIMIT:
reasonText = "DESTINATION_FULL";
break;
}
}
else
{
// If we caught an unexpected failure to process a message, the
// stream becomes implicitly blocked. The one time we would 'expect'
// this is if we had an authorization problem (as that's not checked
// as part of streamCanAcceptNewMessage) so we handle that
// explicitly. For anything else, putting out the exception class
// name is probably as good as it gets (if anything really nasty happened
// then deliverOrderedMessages will probably have FFDC'd too).
if (exception instanceof SINotAuthorizedException)
reasonText = "NOT_AUTHORIZED";
else
reasonText = exception.getClass().getSimpleName();
// If an exception is passed in then we obviously thought the message should
// have worked but it actually failed to be delivered for some reason. We need
// to handle those failures specially, so remember this fact.
unexpectedBlock = true; // depends on control dependency: [if], data = [none]
}
String[] inserts = { reasonText, blockingAddress };
// The stream is blocked
getControlAdapter().getHealthState().updateHealth(HealthStateListener.BLOCKED_TARGET_STREAM_STATE,
HealthState.AMBER,
inserts); // depends on control dependency: [if], data = [none]
}
else
{
// The link is no longer blocked
getControlAdapter().getHealthState().updateHealth(HealthStateListener.BLOCKED_TARGET_STREAM_STATE,
HealthState.GREEN); // depends on control dependency: [if], data = [none]
linkBlockingTick = -1; // depends on control dependency: [if], data = [none]
blockingCount = 0; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setStreamIsBlocked");
} }
|
public class class_name {
public static boolean blockAligned( int blockLength , DSubmatrixD1 A ) {
if( A.col0 % blockLength != 0 )
return false;
if( A.row0 % blockLength != 0 )
return false;
if( A.col1 % blockLength != 0 && A.col1 != A.original.numCols ) {
return false;
}
if( A.row1 % blockLength != 0 && A.row1 != A.original.numRows) {
return false;
}
return true;
} }
|
public class class_name {
public static boolean blockAligned( int blockLength , DSubmatrixD1 A ) {
if( A.col0 % blockLength != 0 )
return false;
if( A.row0 % blockLength != 0 )
return false;
if( A.col1 % blockLength != 0 && A.col1 != A.original.numCols ) {
return false; // depends on control dependency: [if], data = [none]
}
if( A.row1 % blockLength != 0 && A.row1 != A.original.numRows) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.