code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public String getDocumentTypeDeclarationSystemIdentifier()
{
Document doc;
if (m_root.getNodeType() == Node.DOCUMENT_NODE)
doc = (Document) m_root;
else
doc = m_root.getOwnerDocument();
if (null != doc)
{
DocumentType dtd = doc.getDoctype();
if (null != dtd)
{
return dtd.getSystemId();
}
}
return null;
} } | public class class_name {
public String getDocumentTypeDeclarationSystemIdentifier()
{
Document doc;
if (m_root.getNodeType() == Node.DOCUMENT_NODE)
doc = (Document) m_root;
else
doc = m_root.getOwnerDocument();
if (null != doc)
{
DocumentType dtd = doc.getDoctype();
if (null != dtd)
{
return dtd.getSystemId(); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public int[] deduplicateIntArray(int[] original) {
if (original == null) return null;
IntArray intArray = new IntArray(original);
IntArray canonical = canonicalIntArrays.get(intArray);
if (canonical == null) {
canonical = intArray;
canonicalIntArrays.put(canonical, canonical);
}
return canonical.array;
} } | public class class_name {
public int[] deduplicateIntArray(int[] original) {
if (original == null) return null;
IntArray intArray = new IntArray(original);
IntArray canonical = canonicalIntArrays.get(intArray);
if (canonical == null) {
canonical = intArray; // depends on control dependency: [if], data = [none]
canonicalIntArrays.put(canonical, canonical); // depends on control dependency: [if], data = [(canonical]
}
return canonical.array;
} } |
public class class_name {
public static byte[] chars2Bytes(final char[] chars) {
if (chars == null || chars.length <= 0) return null;
int len = chars.length;
byte[] bytes = new byte[len];
for (int i = 0; i < len; i++) {
bytes[i] = (byte) (chars[i]);
}
return bytes;
} } | public class class_name {
public static byte[] chars2Bytes(final char[] chars) {
if (chars == null || chars.length <= 0) return null;
int len = chars.length;
byte[] bytes = new byte[len];
for (int i = 0; i < len; i++) {
bytes[i] = (byte) (chars[i]); // depends on control dependency: [for], data = [i]
}
return bytes;
} } |
public class class_name {
public synchronized I_CmsScheduledJob getJobInstance() {
if (m_jobInstance != null) {
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_REUSING_INSTANCE_1,
m_jobInstance.getClass().getName()));
}
// job instance already initialized
return m_jobInstance;
}
I_CmsScheduledJob job = null;
try {
// create an instance of the OpenCms job class
job = (I_CmsScheduledJob)Class.forName(getClassName()).newInstance();
} catch (ClassNotFoundException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_CLASS_NOT_FOUND_1, getClassName()), e);
} catch (IllegalAccessException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_ILLEGAL_ACCESS_0), e);
} catch (InstantiationException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_INSTANCE_GENERATION_0), e);
} catch (ClassCastException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_BAD_INTERFACE_0), e);
}
if (m_reuseInstance) {
// job instance must be re-used
m_jobInstance = job;
}
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_JOB_CREATED_1, getClassName()));
}
// this should not flood the log files: if class name is wrong or jar files missing this will
// most likely persist until restart.
if (job == null) {
setActive(false);
}
return job;
} } | public class class_name {
public synchronized I_CmsScheduledJob getJobInstance() {
if (m_jobInstance != null) {
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_REUSING_INSTANCE_1,
m_jobInstance.getClass().getName())); // depends on control dependency: [if], data = [none]
}
// job instance already initialized
return m_jobInstance; // depends on control dependency: [if], data = [none]
}
I_CmsScheduledJob job = null;
try {
// create an instance of the OpenCms job class
job = (I_CmsScheduledJob)Class.forName(getClassName()).newInstance(); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_CLASS_NOT_FOUND_1, getClassName()), e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
LOG.error(Messages.get().getBundle().key(Messages.LOG_ILLEGAL_ACCESS_0), e);
} catch (InstantiationException e) { // depends on control dependency: [catch], data = [none]
LOG.error(Messages.get().getBundle().key(Messages.LOG_INSTANCE_GENERATION_0), e);
} catch (ClassCastException e) { // depends on control dependency: [catch], data = [none]
LOG.error(Messages.get().getBundle().key(Messages.LOG_BAD_INTERFACE_0), e);
} // depends on control dependency: [catch], data = [none]
if (m_reuseInstance) {
// job instance must be re-used
m_jobInstance = job; // depends on control dependency: [if], data = [none]
}
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_JOB_CREATED_1, getClassName())); // depends on control dependency: [if], data = [none]
}
// this should not flood the log files: if class name is wrong or jar files missing this will
// most likely persist until restart.
if (job == null) {
setActive(false); // depends on control dependency: [if], data = [none]
}
return job;
} } |
public class class_name {
public static SgClass create(final SgClassPool pool, final Class<?> clasz) {
if (pool == null) {
throw new IllegalArgumentException("The argument 'pool' cannot be null!");
}
if (clasz == null) {
throw new IllegalArgumentException("The argument 'clasz' cannot be null!");
}
final SgClass cached = pool.get(clasz.getName());
if (cached != null) {
return cached;
}
try {
final SgClass cl = createClass(pool, clasz);
addInterfaces(pool, cl, clasz);
addFields(pool, cl, clasz);
addConstructors(pool, cl, clasz);
addMethods(pool, cl, clasz);
addInnerClasses(pool, cl, clasz);
return cl;
} catch (final RuntimeException ex) {
System.out.println("ERROR CLASS: " + clasz);
throw ex;
}
} } | public class class_name {
public static SgClass create(final SgClassPool pool, final Class<?> clasz) {
if (pool == null) {
throw new IllegalArgumentException("The argument 'pool' cannot be null!");
}
if (clasz == null) {
throw new IllegalArgumentException("The argument 'clasz' cannot be null!");
}
final SgClass cached = pool.get(clasz.getName());
if (cached != null) {
return cached;
// depends on control dependency: [if], data = [none]
}
try {
final SgClass cl = createClass(pool, clasz);
addInterfaces(pool, cl, clasz);
addFields(pool, cl, clasz);
addConstructors(pool, cl, clasz);
addMethods(pool, cl, clasz);
addInnerClasses(pool, cl, clasz);
return cl;
} catch (final RuntimeException ex) {
System.out.println("ERROR CLASS: " + clasz);
throw ex;
}
} } |
public class class_name {
@Override
public final byte[] toBytes(Object o)
{
try
{
if (o != null)
{
if (o instanceof byte[])
{
return (byte[]) o;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(o);
oos.close();
return baos.toByteArray();
}
}
catch (IOException e)
{
log.error("IO exception, Caused by {}.", e);
throw new PropertyAccessException(e);
}
return null;
} } | public class class_name {
@Override
public final byte[] toBytes(Object o)
{
try
{
if (o != null)
{
if (o instanceof byte[])
{
return (byte[]) o;
// depends on control dependency: [if], data = [none]
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(o);
// depends on control dependency: [if], data = [(o]
oos.close();
// depends on control dependency: [if], data = [none]
return baos.toByteArray();
// depends on control dependency: [if], data = [none]
}
}
catch (IOException e)
{
log.error("IO exception, Caused by {}.", e);
throw new PropertyAccessException(e);
}
// depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public static void postorder(final int sequenceLength, int[] sa, int[] lcp,
IPostOrderVisitor visitor) {
assert sequenceLength <= sa.length && sequenceLength <= lcp.length : "Input sequence length larger than suffix array or the LCP.";
final Deque<Integer> stack = new ArrayDeque<>();
// Push the stack bottom marker (sentinel).
stack.push(-1);
stack.push(-1);
// Process every leaf.
int top_h;
for (int i = 0; i <= sequenceLength; i++) {
final int h = (sequenceLength == i ? -1 : lcp[i]);
while (true) {
top_h = stack.peek();
if (top_h <= h) break;
stack.pop();
// Visit the node and remove it from the end of the stack.
final int top_i = stack.pop();
final boolean leaf = (top_i < 0);
visitor.visitNode(sa[leaf ? -(top_i + 1) : top_i], top_h, leaf);
}
if (top_h < h) {
stack.push(i);
stack.push(h);
}
if (i < sequenceLength) {
// Mark leaf nodes in the stack.
stack.push(-(i + 1));
stack.push(sequenceLength - sa[i]);
}
}
} } | public class class_name {
public static void postorder(final int sequenceLength, int[] sa, int[] lcp,
IPostOrderVisitor visitor) {
assert sequenceLength <= sa.length && sequenceLength <= lcp.length : "Input sequence length larger than suffix array or the LCP.";
final Deque<Integer> stack = new ArrayDeque<>();
// Push the stack bottom marker (sentinel).
stack.push(-1);
stack.push(-1);
// Process every leaf.
int top_h;
for (int i = 0; i <= sequenceLength; i++) {
final int h = (sequenceLength == i ? -1 : lcp[i]);
while (true) {
top_h = stack.peek(); // depends on control dependency: [while], data = [none]
if (top_h <= h) break;
stack.pop(); // depends on control dependency: [while], data = [none]
// Visit the node and remove it from the end of the stack.
final int top_i = stack.pop();
final boolean leaf = (top_i < 0);
visitor.visitNode(sa[leaf ? -(top_i + 1) : top_i], top_h, leaf); // depends on control dependency: [while], data = [none]
}
if (top_h < h) {
stack.push(i); // depends on control dependency: [if], data = [none]
stack.push(h); // depends on control dependency: [if], data = [h)]
}
if (i < sequenceLength) {
// Mark leaf nodes in the stack.
stack.push(-(i + 1)); // depends on control dependency: [if], data = [(i]
stack.push(sequenceLength - sa[i]); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public java.util.List<SupportedOperation> getSupportedOperations() {
if (supportedOperations == null) {
supportedOperations = new com.amazonaws.internal.SdkInternalList<SupportedOperation>();
}
return supportedOperations;
} } | public class class_name {
public java.util.List<SupportedOperation> getSupportedOperations() {
if (supportedOperations == null) {
supportedOperations = new com.amazonaws.internal.SdkInternalList<SupportedOperation>(); // depends on control dependency: [if], data = [none]
}
return supportedOperations;
} } |
public class class_name {
static ArchivePath getParent(final ArchivePath path) {
// Precondition checks
assert path != null : "Path must be specified";
// Get the last index of "/"
final String resolvedContext = PathUtil.optionallyRemoveFollowingSlash(path.get());
final int lastIndex = resolvedContext.lastIndexOf(ArchivePath.SEPARATOR);
// If it either doesn't occur or is the root
if (lastIndex == -1 || (lastIndex == 0 && resolvedContext.length() == 1)) {
// No parent present, return null
return null;
}
// Get the parent context
final String sub = resolvedContext.substring(0, lastIndex);
// Return
return new BasicPath(sub);
} } | public class class_name {
static ArchivePath getParent(final ArchivePath path) {
// Precondition checks
assert path != null : "Path must be specified";
// Get the last index of "/"
final String resolvedContext = PathUtil.optionallyRemoveFollowingSlash(path.get());
final int lastIndex = resolvedContext.lastIndexOf(ArchivePath.SEPARATOR);
// If it either doesn't occur or is the root
if (lastIndex == -1 || (lastIndex == 0 && resolvedContext.length() == 1)) {
// No parent present, return null
return null; // depends on control dependency: [if], data = [none]
}
// Get the parent context
final String sub = resolvedContext.substring(0, lastIndex);
// Return
return new BasicPath(sub);
} } |
public class class_name {
public List<CmsContainerElementBean> getFavoriteList(CmsObject cms) throws CmsException {
CmsUser user = cms.getRequestContext().getCurrentUser();
Object obj = user.getAdditionalInfo(ADDINFO_ADE_FAVORITE_LIST);
List<CmsContainerElementBean> favList = new ArrayList<CmsContainerElementBean>();
if (obj instanceof String) {
try {
JSONArray array = new JSONArray((String)obj);
for (int i = 0; i < array.length(); i++) {
try {
favList.add(elementFromJson(array.getJSONObject(i)));
} catch (Throwable e) {
// should never happen, catches wrong or no longer existing values
LOG.warn(e.getLocalizedMessage());
}
}
} catch (Throwable e) {
// should never happen, catches json parsing
LOG.warn(e.getLocalizedMessage());
}
} else {
// save to be better next time
saveFavoriteList(cms, favList);
}
return favList;
} } | public class class_name {
public List<CmsContainerElementBean> getFavoriteList(CmsObject cms) throws CmsException {
CmsUser user = cms.getRequestContext().getCurrentUser();
Object obj = user.getAdditionalInfo(ADDINFO_ADE_FAVORITE_LIST);
List<CmsContainerElementBean> favList = new ArrayList<CmsContainerElementBean>();
if (obj instanceof String) {
try {
JSONArray array = new JSONArray((String)obj);
for (int i = 0; i < array.length(); i++) {
try {
favList.add(elementFromJson(array.getJSONObject(i))); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
// should never happen, catches wrong or no longer existing values
LOG.warn(e.getLocalizedMessage());
} // depends on control dependency: [catch], data = [none]
}
} catch (Throwable e) {
// should never happen, catches json parsing
LOG.warn(e.getLocalizedMessage());
} // depends on control dependency: [catch], data = [none]
} else {
// save to be better next time
saveFavoriteList(cms, favList);
}
return favList;
} } |
public class class_name {
public Duration<ClockUnit> getDuration() {
PlainTime t1 = this.getTemporalOfClosedStart();
PlainTime t2 = this.getEnd().getTemporal();
if (this.getEnd().isClosed()) {
if (t2.getHour() == 24) {
if (t1.equals(PlainTime.midnightAtStartOfDay())) {
return Duration.of(24, HOURS).plus(1, NANOS);
} else {
t1 = t1.minus(1, NANOS);
}
} else {
t2 = t2.plus(1, NANOS);
}
}
return Duration.inClockUnits().between(t1, t2);
} } | public class class_name {
public Duration<ClockUnit> getDuration() {
PlainTime t1 = this.getTemporalOfClosedStart();
PlainTime t2 = this.getEnd().getTemporal();
if (this.getEnd().isClosed()) {
if (t2.getHour() == 24) {
if (t1.equals(PlainTime.midnightAtStartOfDay())) {
return Duration.of(24, HOURS).plus(1, NANOS); // depends on control dependency: [if], data = [none]
} else {
t1 = t1.minus(1, NANOS); // depends on control dependency: [if], data = [none]
}
} else {
t2 = t2.plus(1, NANOS); // depends on control dependency: [if], data = [none]
}
}
return Duration.inClockUnits().between(t1, t2);
} } |
public class class_name {
public void marshall(Scte35DescriptorSettings scte35DescriptorSettings, ProtocolMarshaller protocolMarshaller) {
if (scte35DescriptorSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(scte35DescriptorSettings.getSegmentationDescriptorScte35DescriptorSettings(),
SEGMENTATIONDESCRIPTORSCTE35DESCRIPTORSETTINGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Scte35DescriptorSettings scte35DescriptorSettings, ProtocolMarshaller protocolMarshaller) {
if (scte35DescriptorSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(scte35DescriptorSettings.getSegmentationDescriptorScte35DescriptorSettings(),
SEGMENTATIONDESCRIPTORSCTE35DESCRIPTORSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void writeClassDescriptions(BeanReferences references) throws IOException {
// write out ref count first, which is the number of instances that are referenced
output.writeInt(references.getReferences().size());
// write map of class name to a list of metatype names (which is empty if not a bean)
List<ClassInfo> classInfos = references.getClassInfoList();
output.writeMapHeader(classInfos.size());
for (ClassInfo classInfo : classInfos) {
// known types parameter is null as we never serialize the class names again
String className = SerTypeMapper.encodeType(classInfo.type, settings, null, null);
output.writeString(className);
output.writeArrayHeader(classInfo.metaProperties.length);
for (MetaProperty<?> property : classInfo.metaProperties) {
output.writeString(property.name());
}
}
} } | public class class_name {
private void writeClassDescriptions(BeanReferences references) throws IOException {
// write out ref count first, which is the number of instances that are referenced
output.writeInt(references.getReferences().size());
// write map of class name to a list of metatype names (which is empty if not a bean)
List<ClassInfo> classInfos = references.getClassInfoList();
output.writeMapHeader(classInfos.size());
for (ClassInfo classInfo : classInfos) {
// known types parameter is null as we never serialize the class names again
String className = SerTypeMapper.encodeType(classInfo.type, settings, null, null);
output.writeString(className);
output.writeArrayHeader(classInfo.metaProperties.length);
for (MetaProperty<?> property : classInfo.metaProperties) {
output.writeString(property.name()); // depends on control dependency: [for], data = [property]
}
}
} } |
public class class_name {
@Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
viewHolder.swipeResultContent.setVisibility(swipedDirection != 0 ? View.VISIBLE : View.GONE);
viewHolder.itemContent.setVisibility(swipedDirection != 0 ? View.GONE : View.VISIBLE);
CharSequence swipedAction = null;
CharSequence swipedText = null;
if (swipedDirection != 0) {
swipedAction = viewHolder.itemView.getContext().getString(R.string.action_undo);
swipedText = swipedDirection == ItemTouchHelper.LEFT ? "Removed" : "Archived";
viewHolder.swipeResultContent.setBackgroundColor(ContextCompat.getColor(viewHolder.itemView.getContext(), swipedDirection == ItemTouchHelper.LEFT ? R.color.md_red_900 : R.color.md_blue_900));
}
viewHolder.swipedAction.setText(swipedAction == null ? "" : swipedAction);
viewHolder.swipedText.setText(swipedText == null ? "" : swipedText);
viewHolder.swipedActionRunnable = this.swipedAction;
} } | public class class_name {
@Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
viewHolder.swipeResultContent.setVisibility(swipedDirection != 0 ? View.VISIBLE : View.GONE);
viewHolder.itemContent.setVisibility(swipedDirection != 0 ? View.GONE : View.VISIBLE);
CharSequence swipedAction = null;
CharSequence swipedText = null;
if (swipedDirection != 0) {
swipedAction = viewHolder.itemView.getContext().getString(R.string.action_undo); // depends on control dependency: [if], data = [none]
swipedText = swipedDirection == ItemTouchHelper.LEFT ? "Removed" : "Archived"; // depends on control dependency: [if], data = [none]
viewHolder.swipeResultContent.setBackgroundColor(ContextCompat.getColor(viewHolder.itemView.getContext(), swipedDirection == ItemTouchHelper.LEFT ? R.color.md_red_900 : R.color.md_blue_900)); // depends on control dependency: [if], data = [0)]
}
viewHolder.swipedAction.setText(swipedAction == null ? "" : swipedAction);
viewHolder.swipedText.setText(swipedText == null ? "" : swipedText);
viewHolder.swipedActionRunnable = this.swipedAction;
} } |
public class class_name {
@Override
public void sawOpcode(int seen) {
XField userValue = null;
try {
stack.precomputation(this);
if ((seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEDYNAMIC)) {
String sig = getSigConstantOperand();
int argCount = SignatureUtils.getNumParameters(sig);
if (stack.getStackDepth() > argCount) {
OpcodeStack.Item itm = stack.getStackItem(argCount);
XField field = itm.getXField();
if ((field != null) && bloatableCandidates.containsKey(field)) {
checkMethodAsDecreasingOrIncreasing(field);
}
String calledMethod = getNameConstantOperand();
if ("iterator".equals(calledMethod)) {
userValue = (XField) itm.getUserValue();
if (userValue == null) {
userValue = field;
}
} else {
if (field == null) {
field = (XField) itm.getUserValue();
}
if (field != null) {
if (mapSubsets.contains(calledMethod)) {
userValue = field;
} else if ("remove".equals(calledMethod) && "java/util/Iterator".equals(getClassConstantOperand())) {
bloatableCandidates.remove(field);
bloatableFields.remove(field);
}
}
}
for (int i = 0; i < argCount; i++) {
itm = stack.getStackItem(i);
jaxbContextRegs.remove(itm.getRegisterNumber());
}
}
} else if (seen == Const.PUTFIELD) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
jaxbContextRegs.remove(item.getRegisterNumber());
}
} else if (seen == Const.PUTSTATIC) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
if (nonBloatableSigs.contains(item.getSignature())) {
XField field = item.getXField();
bloatableFields.remove(field);
}
jaxbContextRegs.remove(item.getRegisterNumber());
}
}
// Should not include private methods
else if (seen == Const.ARETURN) {
removeFieldsThatGetReturned();
} else if (OpcodeUtils.isALoad(seen)) {
userValue = userValues.get(RegisterUtils.getALoadReg(this, seen));
} else if (OpcodeUtils.isAStore(seen)) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
userValues.put(RegisterUtils.getAStoreReg(this, seen), (XField) itm.getUserValue());
XMethod xm = itm.getReturnValueOf();
if (xm != null) {
FQMethod calledMethod = new FQMethod(xm.getClassName().replace('.', '/'), xm.getName(), xm.getSignature());
if (jaxbNewInstance.equals(calledMethod)) {
jaxbContextRegs.put(RegisterUtils.getAStoreReg(this, seen), getPC());
}
}
}
}
} finally {
stack.sawOpcode(this, seen);
if ((userValue != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
itm.setUserValue(userValue);
}
}
} } | public class class_name {
@Override
public void sawOpcode(int seen) {
XField userValue = null;
try {
stack.precomputation(this); // depends on control dependency: [try], data = [none]
if ((seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEDYNAMIC)) {
String sig = getSigConstantOperand();
int argCount = SignatureUtils.getNumParameters(sig);
if (stack.getStackDepth() > argCount) {
OpcodeStack.Item itm = stack.getStackItem(argCount);
XField field = itm.getXField();
if ((field != null) && bloatableCandidates.containsKey(field)) {
checkMethodAsDecreasingOrIncreasing(field); // depends on control dependency: [if], data = [none]
}
String calledMethod = getNameConstantOperand();
if ("iterator".equals(calledMethod)) {
userValue = (XField) itm.getUserValue(); // depends on control dependency: [if], data = [none]
if (userValue == null) {
userValue = field; // depends on control dependency: [if], data = [none]
}
} else {
if (field == null) {
field = (XField) itm.getUserValue(); // depends on control dependency: [if], data = [none]
}
if (field != null) {
if (mapSubsets.contains(calledMethod)) {
userValue = field; // depends on control dependency: [if], data = [none]
} else if ("remove".equals(calledMethod) && "java/util/Iterator".equals(getClassConstantOperand())) {
bloatableCandidates.remove(field); // depends on control dependency: [if], data = [none]
bloatableFields.remove(field); // depends on control dependency: [if], data = [none]
}
}
}
for (int i = 0; i < argCount; i++) {
itm = stack.getStackItem(i); // depends on control dependency: [for], data = [i]
jaxbContextRegs.remove(itm.getRegisterNumber()); // depends on control dependency: [for], data = [none]
}
}
} else if (seen == Const.PUTFIELD) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
jaxbContextRegs.remove(item.getRegisterNumber()); // depends on control dependency: [if], data = [none]
}
} else if (seen == Const.PUTSTATIC) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
if (nonBloatableSigs.contains(item.getSignature())) {
XField field = item.getXField();
bloatableFields.remove(field); // depends on control dependency: [if], data = [none]
}
jaxbContextRegs.remove(item.getRegisterNumber()); // depends on control dependency: [if], data = [none]
}
}
// Should not include private methods
else if (seen == Const.ARETURN) {
removeFieldsThatGetReturned(); // depends on control dependency: [if], data = [none]
} else if (OpcodeUtils.isALoad(seen)) {
userValue = userValues.get(RegisterUtils.getALoadReg(this, seen)); // depends on control dependency: [if], data = [none]
} else if (OpcodeUtils.isAStore(seen)) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
userValues.put(RegisterUtils.getAStoreReg(this, seen), (XField) itm.getUserValue()); // depends on control dependency: [if], data = [none]
XMethod xm = itm.getReturnValueOf();
if (xm != null) {
FQMethod calledMethod = new FQMethod(xm.getClassName().replace('.', '/'), xm.getName(), xm.getSignature());
if (jaxbNewInstance.equals(calledMethod)) {
jaxbContextRegs.put(RegisterUtils.getAStoreReg(this, seen), getPC()); // depends on control dependency: [if], data = [none]
}
}
}
}
} finally {
stack.sawOpcode(this, seen);
if ((userValue != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
itm.setUserValue(userValue); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static String getSLLL(String[] soilParas) {
if (soilParas != null && soilParas.length >= 3) {
return divide(calcMoisture1500Kpa(soilParas[0], soilParas[1], soilParas[2]), "100", 3);
} else {
return null;
}
} } | public class class_name {
public static String getSLLL(String[] soilParas) {
if (soilParas != null && soilParas.length >= 3) {
return divide(calcMoisture1500Kpa(soilParas[0], soilParas[1], soilParas[2]), "100", 3); // depends on control dependency: [if], data = [(soilParas]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static IConjunct getUnsatisfied( IConjunct condition, PropertySet properties)
{
Conjunction unsatisfied = new Conjunction();
for( Iterator<IDisjunct> disjuncts = condition.getDisjuncts();
disjuncts.hasNext();)
{
IDisjunct disjunct = disjuncts.next();
if( !disjunct.satisfied( properties))
{
unsatisfied.add( disjunct);
}
}
return unsatisfied;
} } | public class class_name {
public static IConjunct getUnsatisfied( IConjunct condition, PropertySet properties)
{
Conjunction unsatisfied = new Conjunction();
for( Iterator<IDisjunct> disjuncts = condition.getDisjuncts();
disjuncts.hasNext();)
{
IDisjunct disjunct = disjuncts.next();
if( !disjunct.satisfied( properties))
{
unsatisfied.add( disjunct); // depends on control dependency: [if], data = [none]
}
}
return unsatisfied;
} } |
public class class_name {
public int compareTo(CandidateField o) {
if (o == null) {
return 1;
}
int myWeight = this.weight == null ? 0 : this.weight.toInteger();
int otherWeight = o.getWeight() == null ? 0 : o.getWeight().toInteger();
if(myWeight > otherWeight) {
return 1;
}
if(myWeight < otherWeight) {
return -1;
}
return 0;
} } | public class class_name {
public int compareTo(CandidateField o) {
if (o == null) {
return 1; // depends on control dependency: [if], data = [none]
}
int myWeight = this.weight == null ? 0 : this.weight.toInteger();
int otherWeight = o.getWeight() == null ? 0 : o.getWeight().toInteger();
if(myWeight > otherWeight) {
return 1; // depends on control dependency: [if], data = [none]
}
if(myWeight < otherWeight) {
return -1; // depends on control dependency: [if], data = [none]
}
return 0;
} } |
public class class_name {
public void disconnect() throws Exception {
if (connection != null) {
try {
if (connection instanceof Closeable) {
((Closeable) connection).close();
} else {
try {
connection.getInputStream().close();
} catch (IOException e) {
// ignore
}
try {
connection.getOutputStream().close();
} catch (IOException e) {
// ignore
}
}
} finally {
connection = null;
}
}
} } | public class class_name {
public void disconnect() throws Exception {
if (connection != null) {
try {
if (connection instanceof Closeable) {
((Closeable) connection).close();
} else {
try {
connection.getInputStream().close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// ignore
} // depends on control dependency: [catch], data = [none]
try {
connection.getOutputStream().close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// ignore
} // depends on control dependency: [catch], data = [none]
}
} finally {
connection = null;
}
}
} } |
public class class_name {
@Override
public int compareTo(JSONDocFieldWrapper o) {
if(this.getOrder().equals(o.getOrder())) {
return this.getField().getName().compareTo(o.getField().getName());
} else {
return this.getOrder() - o.getOrder();
}
} } | public class class_name {
@Override
public int compareTo(JSONDocFieldWrapper o) {
if(this.getOrder().equals(o.getOrder())) {
return this.getField().getName().compareTo(o.getField().getName()); // depends on control dependency: [if], data = [none]
} else {
return this.getOrder() - o.getOrder(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfTransportationObject() {
if (_GenericApplicationPropertyOfTransportationObject == null) {
_GenericApplicationPropertyOfTransportationObject = new ArrayList<JAXBElement<Object>>();
}
return this._GenericApplicationPropertyOfTransportationObject;
} } | public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfTransportationObject() {
if (_GenericApplicationPropertyOfTransportationObject == null) {
_GenericApplicationPropertyOfTransportationObject = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none]
}
return this._GenericApplicationPropertyOfTransportationObject;
} } |
public class class_name {
private Set<Tuple> toEdgeSet(int[] mapping) {
Set<Tuple> edges = new HashSet<Tuple>(mapping.length * 2);
for (int u = 0; u < g.length; u++) {
for (int v : g[u]) {
edges.add(new Tuple(mapping[u], mapping[v]));
}
}
return edges;
} } | public class class_name {
private Set<Tuple> toEdgeSet(int[] mapping) {
Set<Tuple> edges = new HashSet<Tuple>(mapping.length * 2);
for (int u = 0; u < g.length; u++) {
for (int v : g[u]) {
edges.add(new Tuple(mapping[u], mapping[v])); // depends on control dependency: [for], data = [v]
}
}
return edges;
} } |
public class class_name {
public void add(ASN1Set entry) {
ASN1EncodableVector v = new ASN1EncodableVector();
int size = seq.size();
for (int i = 0; i < size; i++) {
v.add(seq.getObjectAt(i));
}
v.add(entry);
seq = new DERSequence(v);
} } | public class class_name {
public void add(ASN1Set entry) {
ASN1EncodableVector v = new ASN1EncodableVector();
int size = seq.size();
for (int i = 0; i < size; i++) {
v.add(seq.getObjectAt(i)); // depends on control dependency: [for], data = [i]
}
v.add(entry);
seq = new DERSequence(v);
} } |
public class class_name {
public Set<ElementDescriptor<?>> getProperties()
{
if (mPropStatByProperty == null)
{
return null;
}
return Collections.unmodifiableSet(mPropStatByProperty.keySet());
} } | public class class_name {
public Set<ElementDescriptor<?>> getProperties()
{
if (mPropStatByProperty == null)
{
return null; // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableSet(mPropStatByProperty.keySet());
} } |
public class class_name {
public void connectUsingTrmWithTargetData(String targetType, String targetSignificance, String target)
throws ResourceException
{
final String methodName = "connectUsingTrmWithTargetData";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName, new Object[] { targetType, targetSignificance, target });
}
synchronized (_connections)
{
// At this point in the code path we can be sure that:
// 1. There are no local preferred ME's (this method would not be called if there were)
// 2. Target data has been set (we are in the else block of the "if (target == null)" block
//
// Since we have been passed target data it means we are attempting to create a connection
// to a preferred (or required) ME (no target data is ever passed if we are trying to create
// a connection to a non preferred ME). With this in mind, if we are currently connected to
// a non preferred ME (_connectToPreferred is false) or we do not currently have a connection
// then we'll try and create a connection that matches our target data. If a connection
// is created then we should close any non preferred connections (if they are any).
if ((!_connectedToPreferred) || (_connections.size() == 0))
{
// Set to required (even if user opted for preferred)
// Pass targetType and target from user data.
SibRaMessagingEngineConnection newConnection = null;
try
{
newConnection = new SibRaMessagingEngineConnection(this, _endpointConfiguration.getBusName(),
targetType, SibTrmConstants.TARGET_SIGNIFICANCE_REQUIRED, target);
dropNonPreferredConnections();
if (newConnection.getConnection() != null) {
_connections.put(newConnection.getConnection().getMeUuid(), newConnection);
createListener(newConnection);
}
if (_connections.size() > 0)
{
_connectedRemotely = checkIfRemote(_connections.values()
.iterator().next());
_connectedToPreferred = true;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
{
SibTr.debug(TRACE, "We have connect <remote=" + _connectedRemotely + " > <preferred="
+ _connectedToPreferred + ">");
}
}
} catch (final SIResourceException exception)
{
// No FFDC code needed
// We are potentially connecting remotely so this error may be transient
// Possibly the remote ME is not available
SibTr.warning(TRACE, SibTr.Suppressor.ALL_FOR_A_WHILE, "TARGETTED_CONNECTION_FAILED_CWSIV0787",
new Object[] { targetType, targetSignificance, target, _endpointConfiguration.getBusName() });
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
{
SibTr.debug(TRACE, "Failed to obtain a connection - retry after a set interval");
}
} catch (final SIException exception)
{
FFDCFilter.processException(exception, CLASS_NAME + "." + methodName, "1:711:1.45", this);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled())
{
SibTr.exception(this, TRACE, exception);
}
throw new ResourceException(NLS.getFormattedMessage("CONNECT_FAILED_CWSIV0782", new Object[] {
_endpointConfiguration.getDestination().getDestinationName(),
_endpointConfiguration.getBusName(), this, exception }, null), exception);
}
}
} // Sync block
// Failed to get a preferred one, try for any ME next.
// Also if we have connected to a remote non preferred ME we may wish to try again for a local
// non preferred ME (We know there is not a local preferred ME as we would not be in this
// method if there were).
if (((_connections.size() == 0) || (_connectedRemotely && !_connectedToPreferred && _destinationStrategy
.isDropRemoteNonPreferredForLocalNonPreferred()))
&& (targetSignificance.equals(SibTrmConstants.TARGET_SIGNIFICANCE_PREFERRED)))
{
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
{
SibTr.debug(TRACE,
"Could not obtain the preferred connection - try again without any target preferences");
}
// For durable pub sub there are no local preferred MEs, for point to point and non durable pub
// sub then they all count as preferred
connect(_destinationStrategy.isDurablePubsSub() ? null : getMEsToCheck(), null, null, null, false);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(TRACE, methodName);
}
} } | public class class_name {
public void connectUsingTrmWithTargetData(String targetType, String targetSignificance, String target)
throws ResourceException
{
final String methodName = "connectUsingTrmWithTargetData";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName, new Object[] { targetType, targetSignificance, target });
}
synchronized (_connections)
{
// At this point in the code path we can be sure that:
// 1. There are no local preferred ME's (this method would not be called if there were)
// 2. Target data has been set (we are in the else block of the "if (target == null)" block
//
// Since we have been passed target data it means we are attempting to create a connection
// to a preferred (or required) ME (no target data is ever passed if we are trying to create
// a connection to a non preferred ME). With this in mind, if we are currently connected to
// a non preferred ME (_connectToPreferred is false) or we do not currently have a connection
// then we'll try and create a connection that matches our target data. If a connection
// is created then we should close any non preferred connections (if they are any).
if ((!_connectedToPreferred) || (_connections.size() == 0))
{
// Set to required (even if user opted for preferred)
// Pass targetType and target from user data.
SibRaMessagingEngineConnection newConnection = null;
try
{
newConnection = new SibRaMessagingEngineConnection(this, _endpointConfiguration.getBusName(),
targetType, SibTrmConstants.TARGET_SIGNIFICANCE_REQUIRED, target); // depends on control dependency: [try], data = [none]
dropNonPreferredConnections(); // depends on control dependency: [try], data = [none]
if (newConnection.getConnection() != null) {
_connections.put(newConnection.getConnection().getMeUuid(), newConnection); // depends on control dependency: [if], data = [(newConnection.getConnection()]
createListener(newConnection); // depends on control dependency: [if], data = [none]
}
if (_connections.size() > 0)
{
_connectedRemotely = checkIfRemote(_connections.values()
.iterator().next()); // depends on control dependency: [if], data = [none]
_connectedToPreferred = true; // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
{
SibTr.debug(TRACE, "We have connect <remote=" + _connectedRemotely + " > <preferred="
+ _connectedToPreferred + ">"); // depends on control dependency: [if], data = [none]
}
}
} catch (final SIResourceException exception)
{
// No FFDC code needed
// We are potentially connecting remotely so this error may be transient
// Possibly the remote ME is not available
SibTr.warning(TRACE, SibTr.Suppressor.ALL_FOR_A_WHILE, "TARGETTED_CONNECTION_FAILED_CWSIV0787",
new Object[] { targetType, targetSignificance, target, _endpointConfiguration.getBusName() });
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
{
SibTr.debug(TRACE, "Failed to obtain a connection - retry after a set interval"); // depends on control dependency: [if], data = [none]
}
} catch (final SIException exception) // depends on control dependency: [catch], data = [none]
{
FFDCFilter.processException(exception, CLASS_NAME + "." + methodName, "1:711:1.45", this);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled())
{
SibTr.exception(this, TRACE, exception); // depends on control dependency: [if], data = [none]
}
throw new ResourceException(NLS.getFormattedMessage("CONNECT_FAILED_CWSIV0782", new Object[] {
_endpointConfiguration.getDestination().getDestinationName(),
_endpointConfiguration.getBusName(), this, exception }, null), exception);
} // depends on control dependency: [catch], data = [none]
}
} // Sync block
// Failed to get a preferred one, try for any ME next.
// Also if we have connected to a remote non preferred ME we may wish to try again for a local
// non preferred ME (We know there is not a local preferred ME as we would not be in this
// method if there were).
if (((_connections.size() == 0) || (_connectedRemotely && !_connectedToPreferred && _destinationStrategy
.isDropRemoteNonPreferredForLocalNonPreferred()))
&& (targetSignificance.equals(SibTrmConstants.TARGET_SIGNIFICANCE_PREFERRED)))
{
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
{
SibTr.debug(TRACE,
"Could not obtain the preferred connection - try again without any target preferences"); // depends on control dependency: [if], data = [none]
}
// For durable pub sub there are no local preferred MEs, for point to point and non durable pub
// sub then they all count as preferred
connect(_destinationStrategy.isDurablePubsSub() ? null : getMEsToCheck(), null, null, null, false);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(TRACE, methodName);
}
} } |
public class class_name {
public static MutableLongTuple clamp(
LongTuple t, long min, long max, MutableLongTuple result)
{
result = validate(t, result);
for (int i=0; i<result.getSize(); i++)
{
long v = t.get(i);
long r = Math.min(max, Math.max(min, v));
result.set(i, r);
}
return result;
} } | public class class_name {
public static MutableLongTuple clamp(
LongTuple t, long min, long max, MutableLongTuple result)
{
result = validate(t, result);
for (int i=0; i<result.getSize(); i++)
{
long v = t.get(i);
long r = Math.min(max, Math.max(min, v));
result.set(i, r);
// depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
public JobExecution completeNewJobWithRestart(String jobXMLName, Properties jobParameters, int restartAttempts) throws IllegalStateException {
long executionId = jobOp.start(jobXMLName, jobParameters);
JobExecution jobExec = waitForFinish(executionId);
if (jobExec.getBatchStatus().equals(BatchStatus.FAILED)) {
for (int i = 0; i < restartAttempts; i++) {
jobParameters.put("restartCount", Integer.toString(i + 1));
executionId = jobOp.restart(executionId, jobParameters);
jobExec = waitForFinish(executionId);
if (jobExec.getBatchStatus().equals(BatchStatus.COMPLETED)) {
logger.finer("Job " + executionId + " successfully completed.");
return jobExec;
}
}
throw new IllegalStateException("Job " + executionId + " failed to complete within the allowed number of restarts (" + restartAttempts + ")."
+ " Last execution status is: " + jobExec.getBatchStatus());
} else {
throw new IllegalStateException("Job " + executionId + " expected to fail and be restartable, but status is: " + jobExec.getBatchStatus());
}
} } | public class class_name {
public JobExecution completeNewJobWithRestart(String jobXMLName, Properties jobParameters, int restartAttempts) throws IllegalStateException {
long executionId = jobOp.start(jobXMLName, jobParameters);
JobExecution jobExec = waitForFinish(executionId);
if (jobExec.getBatchStatus().equals(BatchStatus.FAILED)) {
for (int i = 0; i < restartAttempts; i++) {
jobParameters.put("restartCount", Integer.toString(i + 1)); // depends on control dependency: [for], data = [i]
executionId = jobOp.restart(executionId, jobParameters); // depends on control dependency: [for], data = [none]
jobExec = waitForFinish(executionId); // depends on control dependency: [for], data = [none]
if (jobExec.getBatchStatus().equals(BatchStatus.COMPLETED)) {
logger.finer("Job " + executionId + " successfully completed."); // depends on control dependency: [if], data = [none]
return jobExec; // depends on control dependency: [if], data = [none]
}
}
throw new IllegalStateException("Job " + executionId + " failed to complete within the allowed number of restarts (" + restartAttempts + ")."
+ " Last execution status is: " + jobExec.getBatchStatus());
} else {
throw new IllegalStateException("Job " + executionId + " expected to fail and be restartable, but status is: " + jobExec.getBatchStatus());
}
} } |
public class class_name {
protected synchronized void fireOutputChangeEvent(OUTPUT_EVENT event) {
OutputChangeEvent oce = new OutputChangeEvent(this, event);
for (OutputChangeListener pcl : outputListeners) {
pcl.outputChanged(oce);
}
} } | public class class_name {
protected synchronized void fireOutputChangeEvent(OUTPUT_EVENT event) {
OutputChangeEvent oce = new OutputChangeEvent(this, event);
for (OutputChangeListener pcl : outputListeners) {
pcl.outputChanged(oce); // depends on control dependency: [for], data = [pcl]
}
} } |
public class class_name {
private void addDisallowedConstructors(TypeDeclaration node) {
TypeElement typeElement = node.getTypeElement();
TypeElement superClass = ElementUtil.getSuperclass(typeElement);
if (ElementUtil.isPrivateInnerType(typeElement) || ElementUtil.isAbstract(typeElement)
|| superClass == null
// If we're not emitting constructors we don't need to disallow anything unless our
// superclass is NSObject.
|| (!options.emitWrapperMethods()
&& typeUtil.getObjcClass(superClass) != TypeUtil.NS_OBJECT)) {
return;
}
Map<String, ExecutableElement> inheritedConstructors = new HashMap<>();
// Add super constructors that have unique parameter lists.
for (ExecutableElement superC : ElementUtil.getConstructors(superClass)) {
if (ElementUtil.isPrivate(superC)) {
// Skip private super constructors since they're already unavailable.
continue;
}
String selector = nameTable.getMethodSelector(superC);
inheritedConstructors.put(selector, superC);
}
// Don't disallow this class' constructors if we're emitting wrapper methods.
if (options.emitWrapperMethods()) {
for (ExecutableElement constructor : ElementUtil.getConstructors(typeElement)) {
inheritedConstructors.remove(nameTable.getMethodSelector(constructor));
}
}
for (Map.Entry<String, ExecutableElement> entry : inheritedConstructors.entrySet()) {
ExecutableElement oldConstructor = entry.getValue();
GeneratedExecutableElement newConstructor =
GeneratedExecutableElement.newConstructorWithSelector(
entry.getKey(), typeElement, typeUtil);
MethodDeclaration decl = new MethodDeclaration(newConstructor).setUnavailable(true);
decl.addModifiers(Modifier.ABSTRACT);
int count = 0;
for (VariableElement param : oldConstructor.getParameters()) {
VariableElement newParam = GeneratedVariableElement.newParameter(
"arg" + count++, param.asType(), newConstructor);
newConstructor.addParameter(newParam);
decl.addParameter(new SingleVariableDeclaration(newParam));
}
addImplicitParameters(decl, ElementUtil.getDeclaringClass(oldConstructor));
node.addBodyDeclaration(decl);
}
} } | public class class_name {
private void addDisallowedConstructors(TypeDeclaration node) {
TypeElement typeElement = node.getTypeElement();
TypeElement superClass = ElementUtil.getSuperclass(typeElement);
if (ElementUtil.isPrivateInnerType(typeElement) || ElementUtil.isAbstract(typeElement)
|| superClass == null
// If we're not emitting constructors we don't need to disallow anything unless our
// superclass is NSObject.
|| (!options.emitWrapperMethods()
&& typeUtil.getObjcClass(superClass) != TypeUtil.NS_OBJECT)) {
return; // depends on control dependency: [if], data = [none]
}
Map<String, ExecutableElement> inheritedConstructors = new HashMap<>();
// Add super constructors that have unique parameter lists.
for (ExecutableElement superC : ElementUtil.getConstructors(superClass)) {
if (ElementUtil.isPrivate(superC)) {
// Skip private super constructors since they're already unavailable.
continue;
}
String selector = nameTable.getMethodSelector(superC);
inheritedConstructors.put(selector, superC); // depends on control dependency: [for], data = [superC]
}
// Don't disallow this class' constructors if we're emitting wrapper methods.
if (options.emitWrapperMethods()) {
for (ExecutableElement constructor : ElementUtil.getConstructors(typeElement)) {
inheritedConstructors.remove(nameTable.getMethodSelector(constructor)); // depends on control dependency: [for], data = [constructor]
}
}
for (Map.Entry<String, ExecutableElement> entry : inheritedConstructors.entrySet()) {
ExecutableElement oldConstructor = entry.getValue();
GeneratedExecutableElement newConstructor =
GeneratedExecutableElement.newConstructorWithSelector(
entry.getKey(), typeElement, typeUtil);
MethodDeclaration decl = new MethodDeclaration(newConstructor).setUnavailable(true);
decl.addModifiers(Modifier.ABSTRACT); // depends on control dependency: [for], data = [none]
int count = 0;
for (VariableElement param : oldConstructor.getParameters()) {
VariableElement newParam = GeneratedVariableElement.newParameter(
"arg" + count++, param.asType(), newConstructor);
newConstructor.addParameter(newParam); // depends on control dependency: [for], data = [none]
decl.addParameter(new SingleVariableDeclaration(newParam)); // depends on control dependency: [for], data = [none]
}
addImplicitParameters(decl, ElementUtil.getDeclaringClass(oldConstructor)); // depends on control dependency: [for], data = [none]
node.addBodyDeclaration(decl); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static String getAnnotatedTypeIdentifier(AnnotatedType annotatedType, Class<?> extensionClass) {
//We use the symbolic name as a compromise between makeing the ID unique enough to allow multiple annotated types based on the same type
//to quote the javadoc: " This method allows multiple annotated types, based on the same underlying type, to be defined."
//and allowing failover to work. Failover will fail if the BeanIdentifierIndex is not identical across all severs, and some of these
//identifiers end up in the BeanIdentifierIndex. In particular problems hae been reported with ViewScopeBeanHolder
Bundle bundle = FrameworkUtil.getBundle(extensionClass);
String symbolicName = getSymbolicNameWithoutMinorOrMicroVersionPart(bundle.getSymbolicName());
if (annotatedType != null) {
return (annotatedType.getJavaClass().getCanonicalName() + "#" + extensionClass.getCanonicalName() + "#" + symbolicName);
} else {
return ("NULL" + "#" + extensionClass.getCanonicalName() + "#" + symbolicName);
}
} } | public class class_name {
public static String getAnnotatedTypeIdentifier(AnnotatedType annotatedType, Class<?> extensionClass) {
//We use the symbolic name as a compromise between makeing the ID unique enough to allow multiple annotated types based on the same type
//to quote the javadoc: " This method allows multiple annotated types, based on the same underlying type, to be defined."
//and allowing failover to work. Failover will fail if the BeanIdentifierIndex is not identical across all severs, and some of these
//identifiers end up in the BeanIdentifierIndex. In particular problems hae been reported with ViewScopeBeanHolder
Bundle bundle = FrameworkUtil.getBundle(extensionClass);
String symbolicName = getSymbolicNameWithoutMinorOrMicroVersionPart(bundle.getSymbolicName());
if (annotatedType != null) {
return (annotatedType.getJavaClass().getCanonicalName() + "#" + extensionClass.getCanonicalName() + "#" + symbolicName); // depends on control dependency: [if], data = [(annotatedType]
} else {
return ("NULL" + "#" + extensionClass.getCanonicalName() + "#" + symbolicName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static List<LineString> getSectionsAtInterval( LineString line, double interval, double width, double startFrom,
double endAt ) {
if (interval <= 0) {
throw new IllegalArgumentException("Interval needs to be > 0.");
}
double length = line.getLength();
if (startFrom < 0) {
startFrom = 0.0;
}
if (endAt < 0) {
endAt = length;
}
double halfWidth = width / 2.0;
List<LineString> linesList = new ArrayList<LineString>();
LengthIndexedLine indexedLine = new LengthIndexedLine(line);
double runningLength = startFrom;
while( runningLength < endAt ) {
Coordinate centerCoordinate = indexedLine.extractPoint(runningLength);
Coordinate leftCoordinate = indexedLine.extractPoint(runningLength, -halfWidth);
Coordinate rightCoordinate = indexedLine.extractPoint(runningLength, halfWidth);
LineString lineString = geomFactory
.createLineString(new Coordinate[]{leftCoordinate, centerCoordinate, rightCoordinate});
linesList.add(lineString);
runningLength = runningLength + interval;
}
Coordinate centerCoordinate = indexedLine.extractPoint(endAt);
Coordinate leftCoordinate = indexedLine.extractPoint(endAt, -halfWidth);
Coordinate rightCoordinate = indexedLine.extractPoint(endAt, halfWidth);
LineString lineString = geomFactory.createLineString(new Coordinate[]{leftCoordinate, centerCoordinate, rightCoordinate});
linesList.add(lineString);
return linesList;
} } | public class class_name {
public static List<LineString> getSectionsAtInterval( LineString line, double interval, double width, double startFrom,
double endAt ) {
if (interval <= 0) {
throw new IllegalArgumentException("Interval needs to be > 0.");
}
double length = line.getLength();
if (startFrom < 0) {
startFrom = 0.0; // depends on control dependency: [if], data = [none]
}
if (endAt < 0) {
endAt = length; // depends on control dependency: [if], data = [none]
}
double halfWidth = width / 2.0;
List<LineString> linesList = new ArrayList<LineString>();
LengthIndexedLine indexedLine = new LengthIndexedLine(line);
double runningLength = startFrom;
while( runningLength < endAt ) {
Coordinate centerCoordinate = indexedLine.extractPoint(runningLength);
Coordinate leftCoordinate = indexedLine.extractPoint(runningLength, -halfWidth);
Coordinate rightCoordinate = indexedLine.extractPoint(runningLength, halfWidth);
LineString lineString = geomFactory
.createLineString(new Coordinate[]{leftCoordinate, centerCoordinate, rightCoordinate});
linesList.add(lineString); // depends on control dependency: [while], data = [none]
runningLength = runningLength + interval; // depends on control dependency: [while], data = [none]
}
Coordinate centerCoordinate = indexedLine.extractPoint(endAt);
Coordinate leftCoordinate = indexedLine.extractPoint(endAt, -halfWidth);
Coordinate rightCoordinate = indexedLine.extractPoint(endAt, halfWidth);
LineString lineString = geomFactory.createLineString(new Coordinate[]{leftCoordinate, centerCoordinate, rightCoordinate});
linesList.add(lineString);
return linesList;
} } |
public class class_name {
public static String parseEchoErrorStatement(String statement) {
Matcher matcher = EchoErrorToken.matcher(statement);
if (matcher.matches()) {
String commandWordTerminator = matcher.group(1);
if (OneWhitespace.matcher(commandWordTerminator).matches()) {
return matcher.group(2);
}
return "";
}
return null;
} } | public class class_name {
public static String parseEchoErrorStatement(String statement) {
Matcher matcher = EchoErrorToken.matcher(statement);
if (matcher.matches()) {
String commandWordTerminator = matcher.group(1);
if (OneWhitespace.matcher(commandWordTerminator).matches()) {
return matcher.group(2); // depends on control dependency: [if], data = [none]
}
return ""; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void printJob(PrinterJob job)
{
Frame frame = this.getFrame();
dialog = new PrintDialog(frame, false);
dialog.pack();
if (frame != null)
this.centerDialogInFrame(dialog, frame);
Map<String,Object> map = new Hashtable<String,Object>();
map.put("job", job);
SyncPageWorker thread = new SyncPageWorker(dialog, map)
{
public void runPageLoader()
{
Thread swingPageLoader = new Thread("SwingPageLoader")
{
public void run()
{
((PrintDialog)m_syncPage).setVisible(true);
}
};
SwingUtilities.invokeLater(swingPageLoader);
}
public void afterPageDisplay()
{
Thread swingPageLoader = new Thread("SwingPageLoader")
{
public void run()
{
try {
PrinterJob job = (PrinterJob)get("job");
job.print();
} catch (PrinterException ex) {
ex.printStackTrace ();
}
((PrintDialog)m_syncPage).setVisible(false);
}
};
SwingUtilities.invokeLater(swingPageLoader);
}
};
thread.start();
} } | public class class_name {
public void printJob(PrinterJob job)
{
Frame frame = this.getFrame();
dialog = new PrintDialog(frame, false);
dialog.pack();
if (frame != null)
this.centerDialogInFrame(dialog, frame);
Map<String,Object> map = new Hashtable<String,Object>();
map.put("job", job);
SyncPageWorker thread = new SyncPageWorker(dialog, map)
{
public void runPageLoader()
{
Thread swingPageLoader = new Thread("SwingPageLoader")
{
public void run()
{
((PrintDialog)m_syncPage).setVisible(true);
}
};
SwingUtilities.invokeLater(swingPageLoader);
}
public void afterPageDisplay()
{
Thread swingPageLoader = new Thread("SwingPageLoader")
{
public void run()
{
try {
PrinterJob job = (PrinterJob)get("job");
job.print(); // depends on control dependency: [try], data = [none]
} catch (PrinterException ex) {
ex.printStackTrace ();
} // depends on control dependency: [catch], data = [none]
((PrintDialog)m_syncPage).setVisible(false);
}
};
SwingUtilities.invokeLater(swingPageLoader);
}
};
thread.start();
} } |
public class class_name {
@Nullable
private Module getModuleFromScopeRoot(Node moduleBody) {
if (moduleBody.isModuleBody()) {
// TODO(b/128633181): handle ES modules here
Node scriptNode = moduleBody.getParent();
checkState(
scriptNode.getBooleanProp(Node.GOOG_MODULE),
"Typechecking of non-goog-modules not supported");
Node googModuleCall = moduleBody.getFirstChild();
String namespace = googModuleCall.getFirstChild().getSecondChild().getString();
return moduleMap.getClosureModule(namespace);
} else if (isGoogLoadModuleBlock(moduleBody)) {
Node googModuleCall = moduleBody.getFirstChild();
String namespace = googModuleCall.getFirstChild().getSecondChild().getString();
return moduleMap.getClosureModule(namespace);
}
return null;
} } | public class class_name {
@Nullable
private Module getModuleFromScopeRoot(Node moduleBody) {
if (moduleBody.isModuleBody()) {
// TODO(b/128633181): handle ES modules here
Node scriptNode = moduleBody.getParent();
checkState(
scriptNode.getBooleanProp(Node.GOOG_MODULE),
"Typechecking of non-goog-modules not supported"); // depends on control dependency: [if], data = [none]
Node googModuleCall = moduleBody.getFirstChild();
String namespace = googModuleCall.getFirstChild().getSecondChild().getString();
return moduleMap.getClosureModule(namespace); // depends on control dependency: [if], data = [none]
} else if (isGoogLoadModuleBlock(moduleBody)) {
Node googModuleCall = moduleBody.getFirstChild();
String namespace = googModuleCall.getFirstChild().getSecondChild().getString();
return moduleMap.getClosureModule(namespace); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
List<IntermediateResultPartition> finishAllBlockingPartitions() {
List<IntermediateResultPartition> finishedBlockingPartitions = null;
for (IntermediateResultPartition partition : resultPartitions.values()) {
if (partition.getResultType().isBlocking() && partition.markFinished()) {
if (finishedBlockingPartitions == null) {
finishedBlockingPartitions = new LinkedList<IntermediateResultPartition>();
}
finishedBlockingPartitions.add(partition);
}
}
if (finishedBlockingPartitions == null) {
return Collections.emptyList();
}
else {
return finishedBlockingPartitions;
}
} } | public class class_name {
List<IntermediateResultPartition> finishAllBlockingPartitions() {
List<IntermediateResultPartition> finishedBlockingPartitions = null;
for (IntermediateResultPartition partition : resultPartitions.values()) {
if (partition.getResultType().isBlocking() && partition.markFinished()) {
if (finishedBlockingPartitions == null) {
finishedBlockingPartitions = new LinkedList<IntermediateResultPartition>(); // depends on control dependency: [if], data = [none]
}
finishedBlockingPartitions.add(partition); // depends on control dependency: [if], data = [none]
}
}
if (finishedBlockingPartitions == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
else {
return finishedBlockingPartitions; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static RemoteException RemoteException(String message,
Throwable cause) {
RemoteException remote = null;
// -----------------------------------------------------------------------
// If a cause was not specified, then this method has been called to
// just create a generic RemoteException with the specified message.
// -----------------------------------------------------------------------
if (cause == null) {
remote = new RemoteException(message);
}
// -----------------------------------------------------------------------
// If the cause happens to be a WebSphere specific subclass of
// EJBException or RemoteException, then convert it to a plain
// RemoteException or at least unwrap it, so a plain RemoteException
// is created below.
// -----------------------------------------------------------------------
String causeMessage = null;
while (cause != null &&
(cause instanceof ContainerException ||
cause instanceof UncheckedException ||
cause instanceof EJSPersistenceException ||
cause instanceof CPIException ||
cause instanceof CPMIException ||
cause instanceof CSIException ||
cause instanceof InjectionException || // d436080
(cause instanceof EJBException &&
cause instanceof WsNestedException))) {
Throwable nextCause = cause.getCause();
if (nextCause == null) {
// Nothing was nested in the WebSphere specific exception,
// so convert to RemoteException, copying the message and stack.
if (causeMessage == null) {
causeMessage = cause.getMessage();
}
remote = new RemoteException(causeMessage);
remote.setStackTrace(cause.getStackTrace());
} else if (causeMessage == null && cause instanceof InjectionException) {
causeMessage = cause.getMessage();
}
cause = nextCause;
}
// -----------------------------------------------------------------------
// If the cause is not already a RemoteException, then create a new
// RemoteException and clear the stack ... let the cause stack point to
// the failure.
// -----------------------------------------------------------------------
if (remote == null) {
if (cause instanceof RemoteException) {
remote = (RemoteException) cause;
} else {
if (causeMessage == null) {
causeMessage = message;
}
remote = new RemoteException(message, cause);
}
}
return remote;
} } | public class class_name {
public static RemoteException RemoteException(String message,
Throwable cause) {
RemoteException remote = null;
// -----------------------------------------------------------------------
// If a cause was not specified, then this method has been called to
// just create a generic RemoteException with the specified message.
// -----------------------------------------------------------------------
if (cause == null) {
remote = new RemoteException(message); // depends on control dependency: [if], data = [none]
}
// -----------------------------------------------------------------------
// If the cause happens to be a WebSphere specific subclass of
// EJBException or RemoteException, then convert it to a plain
// RemoteException or at least unwrap it, so a plain RemoteException
// is created below.
// -----------------------------------------------------------------------
String causeMessage = null;
while (cause != null &&
(cause instanceof ContainerException ||
cause instanceof UncheckedException ||
cause instanceof EJSPersistenceException ||
cause instanceof CPIException ||
cause instanceof CPMIException ||
cause instanceof CSIException ||
cause instanceof InjectionException || // d436080
(cause instanceof EJBException &&
cause instanceof WsNestedException))) {
Throwable nextCause = cause.getCause();
if (nextCause == null) {
// Nothing was nested in the WebSphere specific exception,
// so convert to RemoteException, copying the message and stack.
if (causeMessage == null) {
causeMessage = cause.getMessage(); // depends on control dependency: [if], data = [none]
}
remote = new RemoteException(causeMessage); // depends on control dependency: [if], data = [none]
remote.setStackTrace(cause.getStackTrace()); // depends on control dependency: [if], data = [none]
} else if (causeMessage == null && cause instanceof InjectionException) {
causeMessage = cause.getMessage(); // depends on control dependency: [if], data = [none]
}
cause = nextCause; // depends on control dependency: [while], data = [none]
}
// -----------------------------------------------------------------------
// If the cause is not already a RemoteException, then create a new
// RemoteException and clear the stack ... let the cause stack point to
// the failure.
// -----------------------------------------------------------------------
if (remote == null) {
if (cause instanceof RemoteException) {
remote = (RemoteException) cause; // depends on control dependency: [if], data = [none]
} else {
if (causeMessage == null) {
causeMessage = message; // depends on control dependency: [if], data = [none]
}
remote = new RemoteException(message, cause); // depends on control dependency: [if], data = [none]
}
}
return remote;
} } |
public class class_name {
public void add(Object key, Object value) {
Object existing = mMap.get(key);
if (existing instanceof List) {
if (value instanceof List) {
((List)existing).addAll((List)value);
}
else {
((List)existing).add(value);
}
}
else if (existing == null && !mMap.containsKey(key)) {
if (value instanceof List) {
mMap.put(key, new ArrayList((List)value));
}
else {
mMap.put(key, value);
}
}
else {
List list = new ArrayList();
list.add(existing);
if (value instanceof List) {
list.addAll((List)value);
}
else {
list.add(value);
}
mMap.put(key, list);
}
} } | public class class_name {
public void add(Object key, Object value) {
Object existing = mMap.get(key);
if (existing instanceof List) {
if (value instanceof List) {
((List)existing).addAll((List)value); // depends on control dependency: [if], data = [none]
}
else {
((List)existing).add(value); // depends on control dependency: [if], data = [none]
}
}
else if (existing == null && !mMap.containsKey(key)) {
if (value instanceof List) {
mMap.put(key, new ArrayList((List)value)); // depends on control dependency: [if], data = [none]
}
else {
mMap.put(key, value); // depends on control dependency: [if], data = [none]
}
}
else {
List list = new ArrayList();
list.add(existing); // depends on control dependency: [if], data = [(existing]
if (value instanceof List) {
list.addAll((List)value); // depends on control dependency: [if], data = [none]
}
else {
list.add(value); // depends on control dependency: [if], data = [none]
}
mMap.put(key, list); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public int compareTo(Duration otherDuration) {
int cmp = Long.compare(seconds, otherDuration.seconds);
if (cmp != 0) {
return cmp;
}
return nanos - otherDuration.nanos;
} } | public class class_name {
@Override
public int compareTo(Duration otherDuration) {
int cmp = Long.compare(seconds, otherDuration.seconds);
if (cmp != 0) {
return cmp; // depends on control dependency: [if], data = [none]
}
return nanos - otherDuration.nanos;
} } |
public class class_name {
public static String maskRegex(String input, String key, String name) {
Map<String, Object> regexConfig = (Map<String, Object>) config.get(MASK_TYPE_REGEX);
if (regexConfig != null) {
Map<String, Object> keyConfig = (Map<String, Object>) regexConfig.get(key);
if (keyConfig != null) {
String regex = (String) keyConfig.get(name);
if (regex != null && regex.length() > 0) {
return replaceWithMask(input, MASK_REPLACEMENT_CHAR.charAt(0), regex);
}
}
}
return input;
} } | public class class_name {
public static String maskRegex(String input, String key, String name) {
Map<String, Object> regexConfig = (Map<String, Object>) config.get(MASK_TYPE_REGEX);
if (regexConfig != null) {
Map<String, Object> keyConfig = (Map<String, Object>) regexConfig.get(key);
if (keyConfig != null) {
String regex = (String) keyConfig.get(name);
if (regex != null && regex.length() > 0) {
return replaceWithMask(input, MASK_REPLACEMENT_CHAR.charAt(0), regex); // depends on control dependency: [if], data = [none]
}
}
}
return input;
} } |
public class class_name {
@Override
public void onReceive(Object message) {
if (message instanceof OnAppVisible) {
onAppVisible();
} else if (message instanceof OnAppHidden) {
onAppHidden();
} else if (message instanceof PerformOnline) {
performOnline();
} else {
super.onReceive(message);
}
} } | public class class_name {
@Override
public void onReceive(Object message) {
if (message instanceof OnAppVisible) {
onAppVisible(); // depends on control dependency: [if], data = [none]
} else if (message instanceof OnAppHidden) {
onAppHidden(); // depends on control dependency: [if], data = [none]
} else if (message instanceof PerformOnline) {
performOnline(); // depends on control dependency: [if], data = [none]
} else {
super.onReceive(message); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void extractInstructions(InstructionGroup group) {
for (InstructionGraphNode node : group.getNodes()) {
if (node != group.getRoot()) {
AbstractInsnNode insn = node.getInstruction();
method.instructions.remove(insn);
group.getInstructions().add(insn);
}
}
} } | public class class_name {
private void extractInstructions(InstructionGroup group) {
for (InstructionGraphNode node : group.getNodes()) {
if (node != group.getRoot()) {
AbstractInsnNode insn = node.getInstruction();
method.instructions.remove(insn); // depends on control dependency: [if], data = [none]
group.getInstructions().add(insn); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public AsyncContext startAsync() {
try {
collaborator.preInvoke(componentMetaData);
return request.startAsync();
} finally {
collaborator.postInvoke();
}
} } | public class class_name {
@Override
public AsyncContext startAsync() {
try {
collaborator.preInvoke(componentMetaData); // depends on control dependency: [try], data = [none]
return request.startAsync(); // depends on control dependency: [try], data = [none]
} finally {
collaborator.postInvoke();
}
} } |
public class class_name {
protected String getProjectRelativePath(File file) {
String path = file.getAbsolutePath();
String prefix = project.getBasedir().getAbsolutePath();
if (path.startsWith(prefix)) {
path = path.substring(prefix.length() + 1);
}
if (File.separatorChar != '/') {
path = path.replace(File.separatorChar, '/');
}
return path;
} } | public class class_name {
protected String getProjectRelativePath(File file) {
String path = file.getAbsolutePath();
String prefix = project.getBasedir().getAbsolutePath();
if (path.startsWith(prefix)) {
path = path.substring(prefix.length() + 1); // depends on control dependency: [if], data = [none]
}
if (File.separatorChar != '/') {
path = path.replace(File.separatorChar, '/'); // depends on control dependency: [if], data = [(File.separatorChar]
}
return path;
} } |
public class class_name {
public boolean isHandlingCssImage(String cssResourcePath) {
boolean isHandlingCssImage = false;
ResourceGenerator generator = resolveResourceGenerator(cssResourcePath);
if (generator != null && cssImageResourceGeneratorRegistry.contains(generator)) {
isHandlingCssImage = true;
}
return isHandlingCssImage;
} } | public class class_name {
public boolean isHandlingCssImage(String cssResourcePath) {
boolean isHandlingCssImage = false;
ResourceGenerator generator = resolveResourceGenerator(cssResourcePath);
if (generator != null && cssImageResourceGeneratorRegistry.contains(generator)) {
isHandlingCssImage = true; // depends on control dependency: [if], data = [none]
}
return isHandlingCssImage;
} } |
public class class_name {
public boolean isDeleted(QPath itemPath)
{
ItemState lastState = changesLog.getItemState(itemPath);
if (lastState != null && lastState.isDeleted())
{
return true;
}
return false;
} } | public class class_name {
public boolean isDeleted(QPath itemPath)
{
ItemState lastState = changesLog.getItemState(itemPath);
if (lastState != null && lastState.isDeleted())
{
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public ObjectProperty<PathWindingRule> windingRuleProperty() {
if (this.windingRule == null) {
this.windingRule = new SimpleObjectProperty<>(this, MathFXAttributeNames.WINDING_RULE, DEFAULT_WINDING_RULE);
}
return this.windingRule;
} } | public class class_name {
public ObjectProperty<PathWindingRule> windingRuleProperty() {
if (this.windingRule == null) {
this.windingRule = new SimpleObjectProperty<>(this, MathFXAttributeNames.WINDING_RULE, DEFAULT_WINDING_RULE); // depends on control dependency: [if], data = [none]
}
return this.windingRule;
} } |
public class class_name {
public static String disentangle(
final BiMap<Character, ObfuscationRule<Character, Character>> rules,
final String obfuscated)
{
boolean processed = false;
char currentChar;
Character currentCharacter;
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < obfuscated.length(); i++)
{
currentChar = obfuscated.charAt(i);
currentCharacter = Character.valueOf(currentChar);
for (final Entry<Character, ObfuscationRule<Character, Character>> entry : rules
.entrySet())
{
ObfuscationRule<Character, Character> obfuscationRule = entry.getValue();
Character replaceWith = obfuscationRule.getReplaceWith();
Character character = obfuscationRule.getCharacter();
if (currentCharacter.equals(replaceWith) && rules.containsKey(replaceWith))
{
sb.append(character);
processed = true;
break;
}
}
if (!processed)
{
sb.append(currentChar);
}
processed = false;
}
return sb.toString();
} } | public class class_name {
public static String disentangle(
final BiMap<Character, ObfuscationRule<Character, Character>> rules,
final String obfuscated)
{
boolean processed = false;
char currentChar;
Character currentCharacter;
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < obfuscated.length(); i++)
{
currentChar = obfuscated.charAt(i); // depends on control dependency: [for], data = [i]
currentCharacter = Character.valueOf(currentChar); // depends on control dependency: [for], data = [none]
for (final Entry<Character, ObfuscationRule<Character, Character>> entry : rules
.entrySet())
{
ObfuscationRule<Character, Character> obfuscationRule = entry.getValue();
Character replaceWith = obfuscationRule.getReplaceWith();
Character character = obfuscationRule.getCharacter();
if (currentCharacter.equals(replaceWith) && rules.containsKey(replaceWith))
{
sb.append(character); // depends on control dependency: [if], data = [none]
processed = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!processed)
{
sb.append(currentChar); // depends on control dependency: [if], data = [none]
}
processed = false; // depends on control dependency: [for], data = [none]
}
return sb.toString();
} } |
public class class_name {
final void helpQuiescePool(WorkQueue w) {
for (boolean active = true;;) {
ForkJoinTask<?> localTask; // exhaust local queue
while ((localTask = w.nextLocalTask()) != null)
localTask.doExec();
WorkQueue q = findNonEmptyStealQueue(w);
if (q != null) {
ForkJoinTask<?> t; int b;
if (!active) { // re-establish active count
long c;
active = true;
do {} while (!U.compareAndSwapLong
(this, CTL, c = ctl, c + AC_UNIT));
}
if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null)
w.runSubtask(t);
}
else {
long c;
if (active) { // decrement active count without queuing
active = false;
do {} while (!U.compareAndSwapLong
(this, CTL, c = ctl, c -= AC_UNIT));
}
else
c = ctl; // re-increment on exit
if ((int)(c >> AC_SHIFT) + parallelism == 0) {
do {} while (!U.compareAndSwapLong
(this, CTL, c = ctl, c + AC_UNIT));
break;
}
}
}
} } | public class class_name {
final void helpQuiescePool(WorkQueue w) {
for (boolean active = true;;) {
ForkJoinTask<?> localTask; // exhaust local queue
while ((localTask = w.nextLocalTask()) != null)
localTask.doExec();
WorkQueue q = findNonEmptyStealQueue(w);
if (q != null) {
ForkJoinTask<?> t; int b;
if (!active) { // re-establish active count
long c;
active = true; // depends on control dependency: [if], data = [none]
do {} while (!U.compareAndSwapLong
(this, CTL, c = ctl, c + AC_UNIT));
}
if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null)
w.runSubtask(t);
}
else {
long c;
if (active) { // decrement active count without queuing
active = false; // depends on control dependency: [if], data = [none]
do {} while (!U.compareAndSwapLong
(this, CTL, c = ctl, c -= AC_UNIT));
}
else
c = ctl; // re-increment on exit
if ((int)(c >> AC_SHIFT) + parallelism == 0) {
do {} while (!U.compareAndSwapLong
(this, CTL, c = ctl, c + AC_UNIT));
break;
}
}
}
} } |
public class class_name {
private void bend(int[] indexes, int from, int to, IAtom pivotAtm, double r) {
double s = Math.sin(r);
double c = Math.cos(r);
Point2d pivot = pivotAtm.getPoint2d();
for (int i = from; i < to; i++) {
Point2d p = mol.getAtom(indexes[i]).getPoint2d();
double x = p.x - pivot.x;
double y = p.y - pivot.y;
double nx = x * c + y * s;
double ny = -x * s + y * c;
p.x = nx + pivot.x;
p.y = ny + pivot.y;
}
} } | public class class_name {
private void bend(int[] indexes, int from, int to, IAtom pivotAtm, double r) {
double s = Math.sin(r);
double c = Math.cos(r);
Point2d pivot = pivotAtm.getPoint2d();
for (int i = from; i < to; i++) {
Point2d p = mol.getAtom(indexes[i]).getPoint2d();
double x = p.x - pivot.x;
double y = p.y - pivot.y;
double nx = x * c + y * s;
double ny = -x * s + y * c;
p.x = nx + pivot.x; // depends on control dependency: [for], data = [none]
p.y = ny + pivot.y; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public java.util.List<String> getLaunchTemplateIds() {
if (launchTemplateIds == null) {
launchTemplateIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return launchTemplateIds;
} } | public class class_name {
public java.util.List<String> getLaunchTemplateIds() {
if (launchTemplateIds == null) {
launchTemplateIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return launchTemplateIds;
} } |
public class class_name {
public void addMapping(Mapping mapping)
{
if (mapping != null)
{
mappings.put(mapping.getType(), mapping);
}
} } | public class class_name {
public void addMapping(Mapping mapping)
{
if (mapping != null)
{
mappings.put(mapping.getType(), mapping); // depends on control dependency: [if], data = [(mapping]
}
} } |
public class class_name {
public ScriptTaskActivityBehavior createScriptTaskActivityBehavior(ScriptTask scriptTask) {
String language = scriptTask.getScriptFormat();
if (language == null) {
language = ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE;
}
return new ScriptTaskActivityBehavior(scriptTask.getId(),
scriptTask.getScript(),
language,
scriptTask.getResultVariable(),
scriptTask.isAutoStoreVariables());
} } | public class class_name {
public ScriptTaskActivityBehavior createScriptTaskActivityBehavior(ScriptTask scriptTask) {
String language = scriptTask.getScriptFormat();
if (language == null) {
language = ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE; // depends on control dependency: [if], data = [none]
}
return new ScriptTaskActivityBehavior(scriptTask.getId(),
scriptTask.getScript(),
language,
scriptTask.getResultVariable(),
scriptTask.isAutoStoreVariables());
} } |
public class class_name {
@Trivial
private void addAttributes(Attributes sourceAttrs, Attributes descAttrs) {
for (NamingEnumeration<?> neu = sourceAttrs.getAll(); neu.hasMoreElements();) {
descAttrs.put((Attribute) neu.nextElement());
}
} } | public class class_name {
@Trivial
private void addAttributes(Attributes sourceAttrs, Attributes descAttrs) {
for (NamingEnumeration<?> neu = sourceAttrs.getAll(); neu.hasMoreElements();) {
descAttrs.put((Attribute) neu.nextElement()); // depends on control dependency: [for], data = [neu]
}
} } |
public class class_name {
private Set<String> validateJobId(final Job job) {
final Set<String> errors = Sets.newHashSet();
final JobId jobId = job.getId();
if (jobId == null) {
errors.add("Job id was not specified.");
return errors;
}
final String jobIdVersion = jobId.getVersion();
final String jobIdHash = jobId.getHash();
final JobId recomputedId = job.toBuilder().build().getId();
errors.addAll(validateJobName(jobId, recomputedId));
errors.addAll(validateJobVersion(jobIdVersion, recomputedId));
if (this.shouldValidateJobHash) {
errors.addAll(validateJobHash(jobIdHash, recomputedId));
}
return errors;
} } | public class class_name {
private Set<String> validateJobId(final Job job) {
final Set<String> errors = Sets.newHashSet();
final JobId jobId = job.getId();
if (jobId == null) {
errors.add("Job id was not specified."); // depends on control dependency: [if], data = [none]
return errors; // depends on control dependency: [if], data = [none]
}
final String jobIdVersion = jobId.getVersion();
final String jobIdHash = jobId.getHash();
final JobId recomputedId = job.toBuilder().build().getId();
errors.addAll(validateJobName(jobId, recomputedId));
errors.addAll(validateJobVersion(jobIdVersion, recomputedId));
if (this.shouldValidateJobHash) {
errors.addAll(validateJobHash(jobIdHash, recomputedId)); // depends on control dependency: [if], data = [none]
}
return errors;
} } |
public class class_name {
public void addServerNotificationListener(RESTRequest request, ServerNotificationRegistration serverNotificationRegistration, JSONConverter converter) {
NotificationTargetInformation nti = toNotificationTargetInformation(request, serverNotificationRegistration.objectName.getCanonicalName());
//Fetch the filter/handback objects
NotificationFilter filter = (NotificationFilter) getObject(serverNotificationRegistration.filterID, serverNotificationRegistration.filter, converter);
Object handback = getObject(serverNotificationRegistration.handbackID, serverNotificationRegistration.handback, converter);
// Check whether the producer of the notification is local or remote.
if (nti.getRoutingInformation() == null) {
//Add to the MBeanServer
MBeanServerHelper.addServerNotification(serverNotificationRegistration.objectName,
serverNotificationRegistration.listener,
filter,
handback,
converter);
} else {
// Add the notification listener to the Target-Client Manager through EventAdmin
MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
helper.addRoutedServerNotificationListener(nti,
serverNotificationRegistration.listener,
filter,
handback,
converter);
}
//Make the local ServerNotification
ServerNotification serverNotification = new ServerNotification();
serverNotification.listener = serverNotificationRegistration.listener;
serverNotification.filter = serverNotificationRegistration.filterID;
serverNotification.handback = serverNotificationRegistration.handbackID;
//See if there's a list already
List<ServerNotification> list = serverNotifications.get(nti);
if (list == null) {
list = Collections.synchronizedList(new ArrayList<ServerNotification>());
List<ServerNotification> mapList = serverNotifications.putIfAbsent(nti, list);
if (mapList != null) {
list = mapList;
}
}
//Add the new notification into the list
list.add(serverNotification);
} } | public class class_name {
public void addServerNotificationListener(RESTRequest request, ServerNotificationRegistration serverNotificationRegistration, JSONConverter converter) {
NotificationTargetInformation nti = toNotificationTargetInformation(request, serverNotificationRegistration.objectName.getCanonicalName());
//Fetch the filter/handback objects
NotificationFilter filter = (NotificationFilter) getObject(serverNotificationRegistration.filterID, serverNotificationRegistration.filter, converter);
Object handback = getObject(serverNotificationRegistration.handbackID, serverNotificationRegistration.handback, converter);
// Check whether the producer of the notification is local or remote.
if (nti.getRoutingInformation() == null) {
//Add to the MBeanServer
MBeanServerHelper.addServerNotification(serverNotificationRegistration.objectName,
serverNotificationRegistration.listener,
filter,
handback,
converter); // depends on control dependency: [if], data = [none]
} else {
// Add the notification listener to the Target-Client Manager through EventAdmin
MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
helper.addRoutedServerNotificationListener(nti,
serverNotificationRegistration.listener,
filter,
handback,
converter); // depends on control dependency: [if], data = [none]
}
//Make the local ServerNotification
ServerNotification serverNotification = new ServerNotification();
serverNotification.listener = serverNotificationRegistration.listener;
serverNotification.filter = serverNotificationRegistration.filterID;
serverNotification.handback = serverNotificationRegistration.handbackID;
//See if there's a list already
List<ServerNotification> list = serverNotifications.get(nti);
if (list == null) {
list = Collections.synchronizedList(new ArrayList<ServerNotification>()); // depends on control dependency: [if], data = [none]
List<ServerNotification> mapList = serverNotifications.putIfAbsent(nti, list);
if (mapList != null) {
list = mapList; // depends on control dependency: [if], data = [none]
}
}
//Add the new notification into the list
list.add(serverNotification);
} } |
public class class_name {
public void marshall(ListThingTypesRequest listThingTypesRequest, ProtocolMarshaller protocolMarshaller) {
if (listThingTypesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listThingTypesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listThingTypesRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listThingTypesRequest.getThingTypeName(), THINGTYPENAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListThingTypesRequest listThingTypesRequest, ProtocolMarshaller protocolMarshaller) {
if (listThingTypesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listThingTypesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listThingTypesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listThingTypesRequest.getThingTypeName(), THINGTYPENAME_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 ChronoLocalDateTime<?> localDateTime(TemporalAccessor temporal) {
try {
ChronoLocalDate date = date(temporal);
return date.atTime(LocalTime.from(temporal));
} catch (DateTimeException ex) {
throw new DateTimeException("Unable to obtain ChronoLocalDateTime from TemporalAccessor: " + temporal.getClass(), ex);
}
} } | public class class_name {
public ChronoLocalDateTime<?> localDateTime(TemporalAccessor temporal) {
try {
ChronoLocalDate date = date(temporal);
return date.atTime(LocalTime.from(temporal)); // depends on control dependency: [try], data = [none]
} catch (DateTimeException ex) {
throw new DateTimeException("Unable to obtain ChronoLocalDateTime from TemporalAccessor: " + temporal.getClass(), ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String print(Enum<?> value) {
int index = value.ordinal();
if (this.textForms.size() <= index) {
return value.name();
} else {
return this.textForms.get(index);
}
} } | public class class_name {
public String print(Enum<?> value) {
int index = value.ordinal();
if (this.textForms.size() <= index) {
return value.name(); // depends on control dependency: [if], data = [none]
} else {
return this.textForms.get(index); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Furnace getInstance()
{
try
{
final BootstrapClassLoader loader = new BootstrapClassLoader("bootpath");
return getInstance(FurnaceFactory.class.getClassLoader(), loader);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
} } | public class class_name {
public static Furnace getInstance()
{
try
{
final BootstrapClassLoader loader = new BootstrapClassLoader("bootpath");
return getInstance(FurnaceFactory.class.getClassLoader(), loader); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public ExtensionRating getRating()
{
if (this.overwrites.containsKey(RatingExtension.FIELD_AVERAGE_VOTE)) {
return (ExtensionRating) this.overwrites.get(RatingExtension.FIELD_AVERAGE_VOTE);
}
return getWrapped().getRating();
} } | public class class_name {
@Override
public ExtensionRating getRating()
{
if (this.overwrites.containsKey(RatingExtension.FIELD_AVERAGE_VOTE)) {
return (ExtensionRating) this.overwrites.get(RatingExtension.FIELD_AVERAGE_VOTE); // depends on control dependency: [if], data = [none]
}
return getWrapped().getRating();
} } |
public class class_name {
static Text asEngineText(final IText text) {
if (text instanceof Text) {
return (Text) text;
}
return new Text(text.getText(), text.getTemplateName(), text.getLine(), text.getCol());
} } | public class class_name {
static Text asEngineText(final IText text) {
if (text instanceof Text) {
return (Text) text; // depends on control dependency: [if], data = [none]
}
return new Text(text.getText(), text.getTemplateName(), text.getLine(), text.getCol());
} } |
public class class_name {
public static PasswordAuthentication requestPasswordAuthentication(
InetAddress addr,
int port,
String protocol,
String prompt,
String scheme) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
NetPermission requestPermission
= new NetPermission("requestPasswordAuthentication");
sm.checkPermission(requestPermission);
}
Authenticator a = theAuthenticator;
if (a == null) {
return null;
} else {
synchronized(a) {
a.reset();
a.requestingSite = addr;
a.requestingPort = port;
a.requestingProtocol = protocol;
a.requestingPrompt = prompt;
a.requestingScheme = scheme;
return a.getPasswordAuthentication();
}
}
} } | public class class_name {
public static PasswordAuthentication requestPasswordAuthentication(
InetAddress addr,
int port,
String protocol,
String prompt,
String scheme) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
NetPermission requestPermission
= new NetPermission("requestPasswordAuthentication");
sm.checkPermission(requestPermission); // depends on control dependency: [if], data = [none]
}
Authenticator a = theAuthenticator;
if (a == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
synchronized(a) { // depends on control dependency: [if], data = [(a]
a.reset();
a.requestingSite = addr;
a.requestingPort = port;
a.requestingProtocol = protocol;
a.requestingPrompt = prompt;
a.requestingScheme = scheme;
return a.getPasswordAuthentication();
}
}
} } |
public class class_name {
public static final String extractPackageName(String className) {
if (className == null || className.trim().isEmpty()) {
return "";
}
final int idx = className.lastIndexOf('.');
if (idx == -1) {
return "";
} else {
return className.substring(0, idx);
}
} } | public class class_name {
public static final String extractPackageName(String className) {
if (className == null || className.trim().isEmpty()) {
return ""; // depends on control dependency: [if], data = [none]
}
final int idx = className.lastIndexOf('.');
if (idx == -1) {
return ""; // depends on control dependency: [if], data = [none]
} else {
return className.substring(0, idx); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void close() {
if (closed) return;
closed = true;
try {
channel.close();
} catch (Exception e) {
logger.log("Failed to close channel for: '" + name + "'", e);
}
} } | public class class_name {
@Override
public void close() {
if (closed) return;
closed = true;
try {
channel.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.log("Failed to close channel for: '" + name + "'", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd,
ChannelPromise promise) {
NettyClientStream.TransportState stream = cmd.stream();
Status reason = cmd.reason();
if (reason != null) {
stream.transportReportStatus(reason, true, new Metadata());
}
if (!cmd.stream().isNonExistent()) {
encoder().writeRstStream(ctx, stream.id(), Http2Error.CANCEL.code(), promise);
} else {
promise.setSuccess();
}
} } | public class class_name {
private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd,
ChannelPromise promise) {
NettyClientStream.TransportState stream = cmd.stream();
Status reason = cmd.reason();
if (reason != null) {
stream.transportReportStatus(reason, true, new Metadata()); // depends on control dependency: [if], data = [(reason]
}
if (!cmd.stream().isNonExistent()) {
encoder().writeRstStream(ctx, stream.id(), Http2Error.CANCEL.code(), promise); // depends on control dependency: [if], data = [none]
} else {
promise.setSuccess(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
protected Query parseQuery( TokenStream tokens,
TypeSystem typeSystem ) {
Query query = super.parseQuery(tokens, typeSystem);
// See if we have to rewrite the JCR-SQL-style join ...
if (query.source() instanceof JoinableSources) {
JoinableSources joinableSources = (JoinableSources)query.source();
// Rewrite the joins ...
Source newSource = rewrite(joinableSources);
query = new Query(newSource, query.constraint(), query.orderings(), query.columns(), query.getLimits(),
query.isDistinct());
}
return query;
} } | public class class_name {
@Override
protected Query parseQuery( TokenStream tokens,
TypeSystem typeSystem ) {
Query query = super.parseQuery(tokens, typeSystem);
// See if we have to rewrite the JCR-SQL-style join ...
if (query.source() instanceof JoinableSources) {
JoinableSources joinableSources = (JoinableSources)query.source();
// Rewrite the joins ...
Source newSource = rewrite(joinableSources);
query = new Query(newSource, query.constraint(), query.orderings(), query.columns(), query.getLimits(),
query.isDistinct()); // depends on control dependency: [if], data = [none]
}
return query;
} } |
public class class_name {
public JSONObject basicGeneralUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(OcrConsts.GENERAL_BASIC);
postOperation(request);
return requestServer(request);
} } | public class class_name {
public JSONObject basicGeneralUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options); // depends on control dependency: [if], data = [(options]
}
request.setUri(OcrConsts.GENERAL_BASIC);
postOperation(request);
return requestServer(request);
} } |
public class class_name {
private static Substitution createUnifier(Term term1, Term term2, TermFactory termFactory) {
if (!(term1 instanceof Variable) && !(term2 instanceof Variable)) {
// neither is a variable, impossible to unify unless the two terms are
// equal, in which case there the substitution is empty
if (/*(term1 instanceof VariableImpl) ||*/ (term1 instanceof FunctionalTermImpl)
|| (term1 instanceof ValueConstantImpl)
|| (term1 instanceof IRIConstantImpl)
|| (term1 instanceof BNodeConstantImpl)
) {
// ROMAN: why is BNodeConstantImpl not mentioned?
// BC: let's accept it, templates for Bnodes should be supported
if (term1.equals(term2))
return new SubstitutionImpl(termFactory);
else
return null;
}
throw new RuntimeException("Exception comparing two terms, unknown term class. Terms: "
+ term1 + ", " + term2 + " Classes: " + term1.getClass()
+ ", " + term2.getClass());
}
// arranging the terms so that the first is always a variable
Variable t1;
Term t2;
if (term1 instanceof Variable) {
t1 = (Variable)term1;
t2 = term2;
} else {
t1 = (Variable)term2;
t2 = term1;
}
// Undistinguished variables do not need a substitution,
// the unifier knows about this
if (t2 instanceof Variable) {
if (t1.equals(t2)) // ROMAN: no need in isEqual(t1, t2) -- both are proper variables
return new SubstitutionImpl(termFactory);
else
return new SingletonSubstitution(t1, t2);
}
else if ((t2 instanceof ValueConstantImpl) || (t2 instanceof IRIConstantImpl)) {
return new SingletonSubstitution(t1, t2);
}
else if (t2 instanceof Function) {
Function fterm = (Function) t2;
if (fterm.containsTerm(t1))
return null;
else
return new SingletonSubstitution(t1, t2);
}
// this should never happen
throw new RuntimeException("Unsupported unification case: " + term1 + " " + term2);
} } | public class class_name {
private static Substitution createUnifier(Term term1, Term term2, TermFactory termFactory) {
if (!(term1 instanceof Variable) && !(term2 instanceof Variable)) {
// neither is a variable, impossible to unify unless the two terms are
// equal, in which case there the substitution is empty
if (/*(term1 instanceof VariableImpl) ||*/ (term1 instanceof FunctionalTermImpl)
|| (term1 instanceof ValueConstantImpl)
|| (term1 instanceof IRIConstantImpl)
|| (term1 instanceof BNodeConstantImpl)
) {
// ROMAN: why is BNodeConstantImpl not mentioned?
// BC: let's accept it, templates for Bnodes should be supported
if (term1.equals(term2))
return new SubstitutionImpl(termFactory);
else
return null;
}
throw new RuntimeException("Exception comparing two terms, unknown term class. Terms: "
+ term1 + ", " + term2 + " Classes: " + term1.getClass()
+ ", " + term2.getClass());
}
// arranging the terms so that the first is always a variable
Variable t1;
Term t2;
if (term1 instanceof Variable) {
t1 = (Variable)term1; // depends on control dependency: [if], data = [none]
t2 = term2; // depends on control dependency: [if], data = [none]
} else {
t1 = (Variable)term2; // depends on control dependency: [if], data = [none]
t2 = term1; // depends on control dependency: [if], data = [none]
}
// Undistinguished variables do not need a substitution,
// the unifier knows about this
if (t2 instanceof Variable) {
if (t1.equals(t2)) // ROMAN: no need in isEqual(t1, t2) -- both are proper variables
return new SubstitutionImpl(termFactory);
else
return new SingletonSubstitution(t1, t2);
}
else if ((t2 instanceof ValueConstantImpl) || (t2 instanceof IRIConstantImpl)) {
return new SingletonSubstitution(t1, t2); // depends on control dependency: [if], data = [none]
}
else if (t2 instanceof Function) {
Function fterm = (Function) t2;
if (fterm.containsTerm(t1))
return null;
else
return new SingletonSubstitution(t1, t2);
}
// this should never happen
throw new RuntimeException("Unsupported unification case: " + term1 + " " + term2);
} } |
public class class_name {
private void pauseConsumers(SIMPMessage msg, long retryInterval)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "pauseConsumers", new Object[] { msg, Long.valueOf(retryInterval) });
// We need to lock the consumerPoints to check for consumers to pause but
// we can't actually suspend them under that lock or we'll deadlock (465125)
// so we build a new consumer list and process them outside the lock
LinkedList<DispatchableKey> cachedConsumerPoints = new LinkedList<DispatchableKey>();
synchronized (consumerPoints)
{
Iterator<DispatchableKey> itr = consumerPoints.iterator();
while (itr.hasNext())
{
DispatchableKey cKey = itr.next();
// If consumer is interested in this message, suspend it.
if (((LocalQPConsumerKey) cKey).filterMatches((AbstractItem) msg))
{
cachedConsumerPoints.add(cKey);
}
}
} // sync
// Now pause the consumers outside the lock
Iterator<DispatchableKey> itr2 = cachedConsumerPoints.iterator();
while (itr2.hasNext())
{
DispatchableKey cKey = itr2.next();
DispatchableConsumerPoint consumerPoint =
cKey.getConsumerPoint();
// If this consumer is already suspended then don't sent up a new alarm and
// don't resuspend the consumer
BlockedConsumerRetryHandler blockedConsumerRetryHandler = new BlockedConsumerRetryHandler(consumerPoint);
if (blockedConsumerRetryHandler.startSuspend())
{
// Spin of a new alarm that will suspend the consumer immediately
// then wake up and resume the consumer
_messageProcessor.getAlarmManager().
create(retryInterval, blockedConsumerRetryHandler);
}
}
// Spin of a new alarm that will mark the itemStream as blocked
// and unblock it in time with the consumers. This allows us to
// display the state via the MBeans/panels using the QueueMessage
// objects
_messageProcessor.getAlarmManager().create(retryInterval,
new BlockedRetryHandler());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "pauseConsumers");
} } | public class class_name {
private void pauseConsumers(SIMPMessage msg, long retryInterval)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "pauseConsumers", new Object[] { msg, Long.valueOf(retryInterval) });
// We need to lock the consumerPoints to check for consumers to pause but
// we can't actually suspend them under that lock or we'll deadlock (465125)
// so we build a new consumer list and process them outside the lock
LinkedList<DispatchableKey> cachedConsumerPoints = new LinkedList<DispatchableKey>();
synchronized (consumerPoints)
{
Iterator<DispatchableKey> itr = consumerPoints.iterator();
while (itr.hasNext())
{
DispatchableKey cKey = itr.next();
// If consumer is interested in this message, suspend it.
if (((LocalQPConsumerKey) cKey).filterMatches((AbstractItem) msg))
{
cachedConsumerPoints.add(cKey); // depends on control dependency: [if], data = [none]
}
}
} // sync
// Now pause the consumers outside the lock
Iterator<DispatchableKey> itr2 = cachedConsumerPoints.iterator();
while (itr2.hasNext())
{
DispatchableKey cKey = itr2.next();
DispatchableConsumerPoint consumerPoint =
cKey.getConsumerPoint();
// If this consumer is already suspended then don't sent up a new alarm and
// don't resuspend the consumer
BlockedConsumerRetryHandler blockedConsumerRetryHandler = new BlockedConsumerRetryHandler(consumerPoint);
if (blockedConsumerRetryHandler.startSuspend())
{
// Spin of a new alarm that will suspend the consumer immediately
// then wake up and resume the consumer
_messageProcessor.getAlarmManager().
create(retryInterval, blockedConsumerRetryHandler); // depends on control dependency: [if], data = [none]
}
}
// Spin of a new alarm that will mark the itemStream as blocked
// and unblock it in time with the consumers. This allows us to
// display the state via the MBeans/panels using the QueueMessage
// objects
_messageProcessor.getAlarmManager().create(retryInterval,
new BlockedRetryHandler());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "pauseConsumers");
} } |
public class class_name {
public static Map<String, String> convertJsObjectToMap(JavaScriptObject jso) {
Map<String, String> result = new HashMap<String, String>();
JSONObject json = new JSONObject(jso);
for (String key : json.keySet()) {
if ((json.get(key) != null) && (json.get(key).isString() != null)) {
result.put(key, json.get(key).isString().stringValue());
} else {
result.put(key, null);
}
}
return result;
} } | public class class_name {
public static Map<String, String> convertJsObjectToMap(JavaScriptObject jso) {
Map<String, String> result = new HashMap<String, String>();
JSONObject json = new JSONObject(jso);
for (String key : json.keySet()) {
if ((json.get(key) != null) && (json.get(key).isString() != null)) {
result.put(key, json.get(key).isString().stringValue()); // depends on control dependency: [if], data = [none]
} else {
result.put(key, null); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public void skipWhitespace(List<Token> tokens) {
while (pos < input.length()
&& (input.charAt(pos) == '\n' || input.charAt(pos) == '\t')) {
pos++;
}
} } | public class class_name {
public void skipWhitespace(List<Token> tokens) {
while (pos < input.length()
&& (input.charAt(pos) == '\n' || input.charAt(pos) == '\t')) {
pos++; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public ModifyCacheClusterRequest withNewAvailabilityZones(String... newAvailabilityZones) {
if (this.newAvailabilityZones == null) {
setNewAvailabilityZones(new com.amazonaws.internal.SdkInternalList<String>(newAvailabilityZones.length));
}
for (String ele : newAvailabilityZones) {
this.newAvailabilityZones.add(ele);
}
return this;
} } | public class class_name {
public ModifyCacheClusterRequest withNewAvailabilityZones(String... newAvailabilityZones) {
if (this.newAvailabilityZones == null) {
setNewAvailabilityZones(new com.amazonaws.internal.SdkInternalList<String>(newAvailabilityZones.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : newAvailabilityZones) {
this.newAvailabilityZones.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private String getSourceCodePath(StackTraceElement stackTraceElement) {
Objects.requireNonNull(stackTraceElement, Required.STACK_TRACE_ELEMENT.toString());
String packageName = stackTraceElement.getClassName();
int position = packageName.lastIndexOf('.');
if (position > 0) {
packageName = packageName.substring(0, position);
return StringUtils.replace(packageName, ".", File.separator) + File.separator + stackTraceElement.getFileName();
}
return stackTraceElement.getFileName();
} } | public class class_name {
private String getSourceCodePath(StackTraceElement stackTraceElement) {
Objects.requireNonNull(stackTraceElement, Required.STACK_TRACE_ELEMENT.toString());
String packageName = stackTraceElement.getClassName();
int position = packageName.lastIndexOf('.');
if (position > 0) {
packageName = packageName.substring(0, position); // depends on control dependency: [if], data = [none]
return StringUtils.replace(packageName, ".", File.separator) + File.separator + stackTraceElement.getFileName(); // depends on control dependency: [if], data = [none]
}
return stackTraceElement.getFileName();
} } |
public class class_name {
private boolean createSQLEntityFromDao(final SQLiteDatabaseSchema schema, TypeElement dataSource, String daoName) {
TypeElement daoElement = globalDaoElements.get(daoName);
if (daoElement == null) {
String msg = String.format("Data source %s references a DAO %s without @%s annotation",
dataSource.toString(), daoName, BindDao.class.getSimpleName());
throw (new InvalidNameException(msg));
}
String entityClassName = AnnotationUtility.extractAsClassName(daoElement, BindDao.class,
AnnotationAttributeType.VALUE);
// if there is no entity, exit now
if (!StringUtils.hasText(entityClassName)) {
return false;
}
final SQLiteEntity currentEntity = createSQLEntity(schema, daoElement, entityClassName);
if (!schema.contains(currentEntity.getName())) {
schema.addEntity(currentEntity);
}
return true;
} } | public class class_name {
private boolean createSQLEntityFromDao(final SQLiteDatabaseSchema schema, TypeElement dataSource, String daoName) {
TypeElement daoElement = globalDaoElements.get(daoName);
if (daoElement == null) {
String msg = String.format("Data source %s references a DAO %s without @%s annotation",
dataSource.toString(), daoName, BindDao.class.getSimpleName());
throw (new InvalidNameException(msg));
}
String entityClassName = AnnotationUtility.extractAsClassName(daoElement, BindDao.class,
AnnotationAttributeType.VALUE);
// if there is no entity, exit now
if (!StringUtils.hasText(entityClassName)) {
return false; // depends on control dependency: [if], data = [none]
}
final SQLiteEntity currentEntity = createSQLEntity(schema, daoElement, entityClassName);
if (!schema.contains(currentEntity.getName())) {
schema.addEntity(currentEntity); // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
@Override
public String getInfo() {
StringBuilder b = new StringBuilder();
b.append("-----------------" + NL + "Section Table" + NL
+ "-----------------" + NL + NL);
int i = 0;
for(SectionHeader header : headers) {
i++;
b.append("entry number " + i + ": " + NL + "..............."
+ NL + NL);
b.append(header.getInfo());
}
return b.toString();
} } | public class class_name {
@Override
public String getInfo() {
StringBuilder b = new StringBuilder();
b.append("-----------------" + NL + "Section Table" + NL
+ "-----------------" + NL + NL);
int i = 0;
for(SectionHeader header : headers) {
i++; // depends on control dependency: [for], data = [none]
b.append("entry number " + i + ": " + NL + "..............."
+ NL + NL); // depends on control dependency: [for], data = [none]
b.append(header.getInfo()); // depends on control dependency: [for], data = [header]
}
return b.toString();
} } |
public class class_name {
public PathMatcher.PathMatch<T> match(String path){
if (!exactPathMatches.isEmpty()) {
T match = getExactPath(path);
if (match != null) {
UndertowLogger.REQUEST_LOGGER.debugf("Matched exact path %s", path);
return new PathMatcher.PathMatch<>(path, "", match);
}
}
int length = path.length();
final int[] lengths = this.lengths;
for (int i = 0; i < lengths.length; ++i) {
int pathLength = lengths[i];
if (pathLength == length) {
SubstringMap.SubstringMatch<T> next = paths.get(path, length);
if (next != null) {
UndertowLogger.REQUEST_LOGGER.debugf("Matched prefix path %s for path %s", next.getKey(), path);
return new PathMatcher.PathMatch<>(path, "", next.getValue());
}
} else if (pathLength < length) {
char c = path.charAt(pathLength);
if (c == '/') {
//String part = path.substring(0, pathLength);
SubstringMap.SubstringMatch<T> next = paths.get(path, pathLength);
if (next != null) {
UndertowLogger.REQUEST_LOGGER.debugf("Matched prefix path %s for path %s", next.getKey(), path);
return new PathMatcher.PathMatch<>(next.getKey(), path.substring(pathLength), next.getValue());
}
}
}
}
UndertowLogger.REQUEST_LOGGER.debugf("Matched default handler path %s", path);
return new PathMatcher.PathMatch<>("", path, defaultHandler);
} } | public class class_name {
public PathMatcher.PathMatch<T> match(String path){
if (!exactPathMatches.isEmpty()) {
T match = getExactPath(path);
if (match != null) {
UndertowLogger.REQUEST_LOGGER.debugf("Matched exact path %s", path); // depends on control dependency: [if], data = [none]
return new PathMatcher.PathMatch<>(path, "", match); // depends on control dependency: [if], data = [none]
}
}
int length = path.length();
final int[] lengths = this.lengths;
for (int i = 0; i < lengths.length; ++i) {
int pathLength = lengths[i];
if (pathLength == length) {
SubstringMap.SubstringMatch<T> next = paths.get(path, length);
if (next != null) {
UndertowLogger.REQUEST_LOGGER.debugf("Matched prefix path %s for path %s", next.getKey(), path); // depends on control dependency: [if], data = [none]
return new PathMatcher.PathMatch<>(path, "", next.getValue()); // depends on control dependency: [if], data = [none]
}
} else if (pathLength < length) {
char c = path.charAt(pathLength);
if (c == '/') {
//String part = path.substring(0, pathLength);
SubstringMap.SubstringMatch<T> next = paths.get(path, pathLength);
if (next != null) {
UndertowLogger.REQUEST_LOGGER.debugf("Matched prefix path %s for path %s", next.getKey(), path); // depends on control dependency: [if], data = [none]
return new PathMatcher.PathMatch<>(next.getKey(), path.substring(pathLength), next.getValue()); // depends on control dependency: [if], data = [(next]
}
}
}
}
UndertowLogger.REQUEST_LOGGER.debugf("Matched default handler path %s", path);
return new PathMatcher.PathMatch<>("", path, defaultHandler);
} } |
public class class_name {
@Override
public void triggeredJobComplete(final OperableTrigger trigger, final JobDetail jobDetail, final Trigger.CompletedExecutionInstruction triggerInstCode) {
try {
doWithLock(new LockCallbackWithoutResult() {
@Override
public Void doWithLock(JedisCommands jedis) throws JobPersistenceException {
try {
storage.triggeredJobComplete(trigger, jobDetail, triggerInstCode, jedis);
} catch (ClassNotFoundException e) {
logger.error("Could not handle job completion.", e);
}
return null;
}
});
} catch (JobPersistenceException e) {
logger.error("Could not handle job completion.", e);
}
} } | public class class_name {
@Override
public void triggeredJobComplete(final OperableTrigger trigger, final JobDetail jobDetail, final Trigger.CompletedExecutionInstruction triggerInstCode) {
try {
doWithLock(new LockCallbackWithoutResult() {
@Override
public Void doWithLock(JedisCommands jedis) throws JobPersistenceException {
try {
storage.triggeredJobComplete(trigger, jobDetail, triggerInstCode, jedis);
} catch (ClassNotFoundException e) { // depends on control dependency: [try], data = [none]
logger.error("Could not handle job completion.", e);
}
return null; // depends on control dependency: [try], data = [none]
}
});
} catch (JobPersistenceException e) {
logger.error("Could not handle job completion.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public String getChangedProperties(WebAppSecurityConfig original) {
WebAppSecurityConfig globalConfig = WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig();
if (globalConfig != null) {
return globalConfig.getChangedProperties(original);
} else {
return "";
}
} } | public class class_name {
@Override
public String getChangedProperties(WebAppSecurityConfig original) {
WebAppSecurityConfig globalConfig = WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig();
if (globalConfig != null) {
return globalConfig.getChangedProperties(original); // depends on control dependency: [if], data = [none]
} else {
return ""; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String getServer() {
final StringBuilder serverBuilder = new StringBuilder(getServerScheme()).append("://").append(getServerHost());
final String port = getServerPort();
if (StringUtils.isNotBlank(port) && !"80".equals(port) && !"443".equals(port)) {
serverBuilder.append(':').append(port);
}
return serverBuilder.toString();
} } | public class class_name {
public static String getServer() {
final StringBuilder serverBuilder = new StringBuilder(getServerScheme()).append("://").append(getServerHost());
final String port = getServerPort();
if (StringUtils.isNotBlank(port) && !"80".equals(port) && !"443".equals(port)) {
serverBuilder.append(':').append(port); // depends on control dependency: [if], data = [none]
}
return serverBuilder.toString();
} } |
public class class_name {
public void delegateTo(final ClassLoader classLoader, final boolean isParent) {
if (classLoader == null) {
return;
}
// Check if this is a parent before checking if the classloader is already in the delegatedTo set,
// so that if the classloader is a context classloader but also a parent, it still gets marked as
// a parent classloader.
if (isParent) {
allParentClassLoaders.add(classLoader);
}
if (delegatedTo.add(classLoader)) {
// Find ClassLoaderHandlerRegistryEntry for this classloader
final ClassLoaderHandlerRegistryEntry entry = getRegistryEntry(classLoader);
// Delegate to this classloader, by recursing to that classloader to get its classloader order
entry.findClassLoaderOrder(classLoader, this);
}
} } | public class class_name {
public void delegateTo(final ClassLoader classLoader, final boolean isParent) {
if (classLoader == null) {
return; // depends on control dependency: [if], data = [none]
}
// Check if this is a parent before checking if the classloader is already in the delegatedTo set,
// so that if the classloader is a context classloader but also a parent, it still gets marked as
// a parent classloader.
if (isParent) {
allParentClassLoaders.add(classLoader); // depends on control dependency: [if], data = [none]
}
if (delegatedTo.add(classLoader)) {
// Find ClassLoaderHandlerRegistryEntry for this classloader
final ClassLoaderHandlerRegistryEntry entry = getRegistryEntry(classLoader);
// Delegate to this classloader, by recursing to that classloader to get its classloader order
entry.findClassLoaderOrder(classLoader, this); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean updateAttribute(final Attribute attribute) {
if (!this.sentAttrSpecifications) {
log.error("Haven't sent type specifications yet, can't send solutions.");
return false;
}
AttributeUpdateMessage message = new AttributeUpdateMessage();
message.setCreateId(this.createIds);
message.setAttributes(new Attribute[] { attribute });
Integer attributeAlias = this.attributeAliases.get(attribute
.getAttributeName());
if (attributeAlias == null) {
log.error(
"Cannot update attribute: Unregistered attribute type: {}",
attribute.getAttributeName());
return false;
}
attribute.setAttributeNameAlias(attributeAlias.intValue());
this.session.write(message);
log.debug("Sent {} to {}", message, this);
return true;
} } | public class class_name {
public boolean updateAttribute(final Attribute attribute) {
if (!this.sentAttrSpecifications) {
log.error("Haven't sent type specifications yet, can't send solutions."); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
AttributeUpdateMessage message = new AttributeUpdateMessage();
message.setCreateId(this.createIds);
message.setAttributes(new Attribute[] { attribute });
Integer attributeAlias = this.attributeAliases.get(attribute
.getAttributeName());
if (attributeAlias == null) {
log.error(
"Cannot update attribute: Unregistered attribute type: {}",
attribute.getAttributeName()); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
attribute.setAttributeNameAlias(attributeAlias.intValue());
this.session.write(message);
log.debug("Sent {} to {}", message, this);
return true;
} } |
public class class_name {
public void generate() throws CodeGenerationException
{
for (AnnotationTypeDeclaration atd : _atds)
{
Collection<Declaration> decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith(atd);
for (Declaration decl : decls)
{
generate(decl);
}
}
} } | public class class_name {
public void generate() throws CodeGenerationException
{
for (AnnotationTypeDeclaration atd : _atds)
{
Collection<Declaration> decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith(atd);
for (Declaration decl : decls)
{
generate(decl); // depends on control dependency: [for], data = [decl]
}
}
} } |
public class class_name {
public void marshall(UpdateApiKeyRequest updateApiKeyRequest, ProtocolMarshaller protocolMarshaller) {
if (updateApiKeyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateApiKeyRequest.getApiId(), APIID_BINDING);
protocolMarshaller.marshall(updateApiKeyRequest.getId(), ID_BINDING);
protocolMarshaller.marshall(updateApiKeyRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(updateApiKeyRequest.getExpires(), EXPIRES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateApiKeyRequest updateApiKeyRequest, ProtocolMarshaller protocolMarshaller) {
if (updateApiKeyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateApiKeyRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateApiKeyRequest.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateApiKeyRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateApiKeyRequest.getExpires(), EXPIRES_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 Set<String> getRequestValue(final Request request) {
if (isPresent(request)) {
return getNewSelections(request);
} else {
return getValue();
}
} } | public class class_name {
@Override
public Set<String> getRequestValue(final Request request) {
if (isPresent(request)) {
return getNewSelections(request); // depends on control dependency: [if], data = [none]
} else {
return getValue(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void registerExtensions(final Class<?>... extensions) {
for (Class<?> extension : extensions) {
register(ConfigItem.Extension, extension);
}
} } | public class class_name {
public void registerExtensions(final Class<?>... extensions) {
for (Class<?> extension : extensions) {
register(ConfigItem.Extension, extension); // depends on control dependency: [for], data = [extension]
}
} } |
public class class_name {
@Override
public void updateStreamState(final String scopeName, final String streamName,
final StreamState updateStreamStateRequest, SecurityContext securityContext, AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "updateStreamState");
try {
restAuthHelper.authenticateAuthorize(
getAuthorizationHeader(),
AuthResourceRepresentation.ofStreamInScope(scopeName, streamName), READ_UPDATE);
} catch (AuthException e) {
log.warn("Update stream for {} failed due to authentication failure.", scopeName + "/" + streamName);
asyncResponse.resume(Response.status(Status.fromStatusCode(e.getResponseCode())).build());
LoggerHelpers.traceLeave(log, "Update stream", traceId);
return;
}
// We only support sealed state now.
if (updateStreamStateRequest.getStreamState() != StreamState.StreamStateEnum.SEALED) {
log.warn("Received invalid stream state: {} from client for stream {}/{}",
updateStreamStateRequest.getStreamState(), scopeName, streamName);
asyncResponse.resume(Response.status(Status.BAD_REQUEST).build());
return;
}
controllerService.sealStream(scopeName, streamName).thenApply(updateStreamStatus -> {
if (updateStreamStatus.getStatus() == UpdateStreamStatus.Status.SUCCESS) {
log.info("Successfully sealed stream: {}", streamName);
return Response.status(Status.OK).entity(updateStreamStateRequest).build();
} else if (updateStreamStatus.getStatus() == UpdateStreamStatus.Status.SCOPE_NOT_FOUND ||
updateStreamStatus.getStatus() == UpdateStreamStatus.Status.STREAM_NOT_FOUND) {
log.warn("Scope: {} or Stream {} not found", scopeName, streamName);
return Response.status(Status.NOT_FOUND).build();
} else {
log.warn("updateStreamState for {} failed", streamName);
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
}).exceptionally(exception -> {
log.warn("updateStreamState for {} failed with exception: {}", streamName, exception);
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}).thenApply(asyncResponse::resume)
.thenAccept(x -> LoggerHelpers.traceLeave(log, "updateStreamState", traceId));
} } | public class class_name {
@Override
public void updateStreamState(final String scopeName, final String streamName,
final StreamState updateStreamStateRequest, SecurityContext securityContext, AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "updateStreamState");
try {
restAuthHelper.authenticateAuthorize(
getAuthorizationHeader(),
AuthResourceRepresentation.ofStreamInScope(scopeName, streamName), READ_UPDATE); // depends on control dependency: [try], data = [none]
} catch (AuthException e) {
log.warn("Update stream for {} failed due to authentication failure.", scopeName + "/" + streamName);
asyncResponse.resume(Response.status(Status.fromStatusCode(e.getResponseCode())).build());
LoggerHelpers.traceLeave(log, "Update stream", traceId);
return;
} // depends on control dependency: [catch], data = [none]
// We only support sealed state now.
if (updateStreamStateRequest.getStreamState() != StreamState.StreamStateEnum.SEALED) {
log.warn("Received invalid stream state: {} from client for stream {}/{}",
updateStreamStateRequest.getStreamState(), scopeName, streamName); // depends on control dependency: [if], data = [none]
asyncResponse.resume(Response.status(Status.BAD_REQUEST).build()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
controllerService.sealStream(scopeName, streamName).thenApply(updateStreamStatus -> {
if (updateStreamStatus.getStatus() == UpdateStreamStatus.Status.SUCCESS) {
log.info("Successfully sealed stream: {}", streamName);
return Response.status(Status.OK).entity(updateStreamStateRequest).build();
} else if (updateStreamStatus.getStatus() == UpdateStreamStatus.Status.SCOPE_NOT_FOUND ||
updateStreamStatus.getStatus() == UpdateStreamStatus.Status.STREAM_NOT_FOUND) {
log.warn("Scope: {} or Stream {} not found", scopeName, streamName);
return Response.status(Status.NOT_FOUND).build();
} else {
log.warn("updateStreamState for {} failed", streamName);
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
}).exceptionally(exception -> {
log.warn("updateStreamState for {} failed with exception: {}", streamName, exception);
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}).thenApply(asyncResponse::resume)
.thenAccept(x -> LoggerHelpers.traceLeave(log, "updateStreamState", traceId));
} } |
public class class_name {
public void dump() {
if (log.isTraceEnabled()) {
log.trace("Scope: {} {}", this.getClass().getName(), this);
log.trace("Running: {}", running);
if (hasParent()) {
log.trace("Parent: {}", parent);
Set<String> names = parent.getBasicScopeNames(null);
log.trace("Sibling count: {}", names.size());
for (String sib : names) {
log.trace("Siblings - {}", sib);
}
names = null;
}
log.trace("Handler: {}", handler);
log.trace("Child count: {}", children.size());
for (IBasicScope child : children.keySet()) {
log.trace("Child: {}", child);
}
}
} } | public class class_name {
public void dump() {
if (log.isTraceEnabled()) {
log.trace("Scope: {} {}", this.getClass().getName(), this);
log.trace("Running: {}", running);
if (hasParent()) {
log.trace("Parent: {}", parent);
// depends on control dependency: [if], data = [none]
Set<String> names = parent.getBasicScopeNames(null);
log.trace("Sibling count: {}", names.size());
// depends on control dependency: [if], data = [none]
for (String sib : names) {
log.trace("Siblings - {}", sib);
// depends on control dependency: [for], data = [sib]
}
names = null;
// depends on control dependency: [if], data = [none]
}
log.trace("Handler: {}", handler);
log.trace("Child count: {}", children.size());
for (IBasicScope child : children.keySet()) {
log.trace("Child: {}", child);
}
}
} } |
public class class_name {
public void setFaceDetails(java.util.Collection<FaceDetail> faceDetails) {
if (faceDetails == null) {
this.faceDetails = null;
return;
}
this.faceDetails = new java.util.ArrayList<FaceDetail>(faceDetails);
} } | public class class_name {
public void setFaceDetails(java.util.Collection<FaceDetail> faceDetails) {
if (faceDetails == null) {
this.faceDetails = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.faceDetails = new java.util.ArrayList<FaceDetail>(faceDetails);
} } |
public class class_name {
public static void parseCamundaInputParameters(Element inputOutputElement, IoMapping ioMapping) {
List<Element> inputParameters = inputOutputElement.elementsNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "inputParameter");
for (Element inputParameterElement : inputParameters) {
parseInputParameterElement(inputParameterElement, ioMapping);
}
} } | public class class_name {
public static void parseCamundaInputParameters(Element inputOutputElement, IoMapping ioMapping) {
List<Element> inputParameters = inputOutputElement.elementsNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "inputParameter");
for (Element inputParameterElement : inputParameters) {
parseInputParameterElement(inputParameterElement, ioMapping); // depends on control dependency: [for], data = [inputParameterElement]
}
} } |
public class class_name {
@Override
public boolean equalsKey(long address, WrappedBytes wrappedBytes) {
// 16 bytes for eviction if needed (optional)
// 8 bytes for linked pointer
int headerOffset = evictionEnabled ? 24 : 8;
byte type = MEMORY.getByte(address, headerOffset);
headerOffset++;
// First if hashCode doesn't match then the key can't be equal
int hashCode = wrappedBytes.hashCode();
if (hashCode != MEMORY.getInt(address, headerOffset)) {
return false;
}
headerOffset += 4;
// If the length of the key is not the same it can't match either!
int keyLength = MEMORY.getInt(address, headerOffset);
if (keyLength != wrappedBytes.getLength()) {
return false;
}
headerOffset += 4;
if (requiresMetadataSize(type)) {
headerOffset += 4;
}
// This is for the value size which we don't need to read
headerOffset += 4;
// Finally read each byte individually so we don't have to copy them into a byte[]
for (int i = 0; i < keyLength; i++) {
byte b = MEMORY.getByte(address, headerOffset + i);
if (b != wrappedBytes.getByte(i))
return false;
}
return true;
} } | public class class_name {
@Override
public boolean equalsKey(long address, WrappedBytes wrappedBytes) {
// 16 bytes for eviction if needed (optional)
// 8 bytes for linked pointer
int headerOffset = evictionEnabled ? 24 : 8;
byte type = MEMORY.getByte(address, headerOffset);
headerOffset++;
// First if hashCode doesn't match then the key can't be equal
int hashCode = wrappedBytes.hashCode();
if (hashCode != MEMORY.getInt(address, headerOffset)) {
return false; // depends on control dependency: [if], data = [none]
}
headerOffset += 4;
// If the length of the key is not the same it can't match either!
int keyLength = MEMORY.getInt(address, headerOffset);
if (keyLength != wrappedBytes.getLength()) {
return false; // depends on control dependency: [if], data = [none]
}
headerOffset += 4;
if (requiresMetadataSize(type)) {
headerOffset += 4; // depends on control dependency: [if], data = [none]
}
// This is for the value size which we don't need to read
headerOffset += 4;
// Finally read each byte individually so we don't have to copy them into a byte[]
for (int i = 0; i < keyLength; i++) {
byte b = MEMORY.getByte(address, headerOffset + i);
if (b != wrappedBytes.getByte(i))
return false;
}
return true;
} } |
public class class_name {
@Override
public void selectionChanged(IAction action, ISelection selection) {
bugInstance = null;
// TODO learn to deal with ALL elements
IMarker marker = MarkerUtil.getMarkerFromSingleSelection(selection);
if (marker == null) {
return;
}
bugInstance = MarkerUtil.findBugInstanceForMarker(marker);
} } | public class class_name {
@Override
public void selectionChanged(IAction action, ISelection selection) {
bugInstance = null;
// TODO learn to deal with ALL elements
IMarker marker = MarkerUtil.getMarkerFromSingleSelection(selection);
if (marker == null) {
return; // depends on control dependency: [if], data = [none]
}
bugInstance = MarkerUtil.findBugInstanceForMarker(marker);
} } |
public class class_name {
static void putBooleanIfNotNull(
@NonNull JSONObject jsonObject,
@NonNull @Size(min = 1) String fieldName,
@Nullable Boolean value) {
if (value == null) {
return;
}
try {
jsonObject.put(fieldName, value.booleanValue());
} catch (JSONException ignored) { }
} } | public class class_name {
static void putBooleanIfNotNull(
@NonNull JSONObject jsonObject,
@NonNull @Size(min = 1) String fieldName,
@Nullable Boolean value) {
if (value == null) {
return; // depends on control dependency: [if], data = [none]
}
try {
jsonObject.put(fieldName, value.booleanValue()); // depends on control dependency: [try], data = [none]
} catch (JSONException ignored) { } // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String getStringValue()
{
// Check if the attribute class has been finalized yet.
if (attributeClass.finalized)
{
// Fetch the string value from the attribute class.
return attributeClass.lookupValue[value].label;
}
else
{
return attributeClass.lookupValueList.get(value).label;
}
} } | public class class_name {
public String getStringValue()
{
// Check if the attribute class has been finalized yet.
if (attributeClass.finalized)
{
// Fetch the string value from the attribute class.
return attributeClass.lookupValue[value].label; // depends on control dependency: [if], data = [none]
}
else
{
return attributeClass.lookupValueList.get(value).label; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void script(String line, DispatchCallback callback) {
if (sqlLine.getScriptOutputFile() == null) {
startScript(line, callback);
} else {
stopScript(line, callback);
}
} } | public class class_name {
public void script(String line, DispatchCallback callback) {
if (sqlLine.getScriptOutputFile() == null) {
startScript(line, callback); // depends on control dependency: [if], data = [none]
} else {
stopScript(line, callback); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
final public void Value() throws ParseException {
AstValue jjtn001 = new AstValue(JJTVALUE);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
try {
ValuePrefix();
label_14:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DOT:
case LBRACK:
;
break;
default:
jj_la1[33] = jj_gen;
break label_14;
}
ValueSuffix();
}
} catch (Throwable jjte001) {
if (jjtc001) {
jjtree.clearNodeScope(jjtn001);
jjtc001 = false;
} else {
jjtree.popNode();
}
if (jjte001 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte001;}
}
if (jjte001 instanceof ParseException) {
{if (true) throw (ParseException)jjte001;}
}
{if (true) throw (Error)jjte001;}
} finally {
if (jjtc001) {
jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1);
}
}
} } | public class class_name {
final public void Value() throws ParseException {
AstValue jjtn001 = new AstValue(JJTVALUE);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
try {
ValuePrefix();
label_14:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DOT:
case LBRACK:
;
break;
default:
jj_la1[33] = jj_gen;
break label_14;
}
ValueSuffix(); // depends on control dependency: [while], data = [none]
}
} catch (Throwable jjte001) {
if (jjtc001) {
jjtree.clearNodeScope(jjtn001); // depends on control dependency: [if], data = [none]
jjtc001 = false; // depends on control dependency: [if], data = [none]
} else {
jjtree.popNode(); // depends on control dependency: [if], data = [none]
}
if (jjte001 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte001;}
}
if (jjte001 instanceof ParseException) {
{if (true) throw (ParseException)jjte001;}
}
{if (true) throw (Error)jjte001;}
} finally {
if (jjtc001) {
jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(ListElasticsearchVersionsRequest listElasticsearchVersionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listElasticsearchVersionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listElasticsearchVersionsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listElasticsearchVersionsRequest.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(ListElasticsearchVersionsRequest listElasticsearchVersionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listElasticsearchVersionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listElasticsearchVersionsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listElasticsearchVersionsRequest.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 {
@SuppressWarnings("unchecked")
public static boolean hasProperty(Object obj, String name) {
if (obj == null || name == null) {
return false;
} else if (obj instanceof Map<?, ?>) {
Map<Object, Object> map = (Map<Object, Object>) obj;
for (Object key : map.keySet()) {
if (name.equalsIgnoreCase(key.toString()))
return true;
}
return false;
} else if (obj instanceof List<?>) {
Integer index = IntegerConverter.toNullableInteger(name);
List<Object> list = (List<Object>) obj;
return index != null && index.intValue() >= 0 && index.intValue() < list.size();
} else if (obj.getClass().isArray()) {
Integer index = IntegerConverter.toNullableInteger(name);
int length = Array.getLength(obj);
return index != null && index.intValue() >= 0 && index.intValue() < length;
} else {
return PropertyReflector.hasProperty(obj, name);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public static boolean hasProperty(Object obj, String name) {
if (obj == null || name == null) {
return false; // depends on control dependency: [if], data = [none]
} else if (obj instanceof Map<?, ?>) {
Map<Object, Object> map = (Map<Object, Object>) obj;
for (Object key : map.keySet()) {
if (name.equalsIgnoreCase(key.toString()))
return true;
}
return false; // depends on control dependency: [if], data = [none]
} else if (obj instanceof List<?>) {
Integer index = IntegerConverter.toNullableInteger(name);
List<Object> list = (List<Object>) obj;
return index != null && index.intValue() >= 0 && index.intValue() < list.size(); // depends on control dependency: [if], data = [)]
} else if (obj.getClass().isArray()) {
Integer index = IntegerConverter.toNullableInteger(name);
int length = Array.getLength(obj);
return index != null && index.intValue() >= 0 && index.intValue() < length; // depends on control dependency: [if], data = [none]
} else {
return PropertyReflector.hasProperty(obj, name); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static URL getResource(String name, ClassLoader[] classLoaders)
{
// Java standard class loader require resource name to be an absolute path without leading path separator
// at this point <name> argument is guaranteed to not start with leading path separator
for(ClassLoader classLoader : classLoaders) {
URL url = classLoader.getResource(name);
if(url == null) {
// it seems there are class loaders that require leading path separator
// not confirmed rumor but found in similar libraries
url = classLoader.getResource('/' + name);
}
if(url != null) {
return url;
}
}
return null;
} } | public class class_name {
private static URL getResource(String name, ClassLoader[] classLoaders)
{
// Java standard class loader require resource name to be an absolute path without leading path separator
// at this point <name> argument is guaranteed to not start with leading path separator
for(ClassLoader classLoader : classLoaders) {
URL url = classLoader.getResource(name);
if(url == null) {
// it seems there are class loaders that require leading path separator
// not confirmed rumor but found in similar libraries
url = classLoader.getResource('/' + name);
// depends on control dependency: [if], data = [none]
}
if(url != null) {
return url;
// depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
protected Object makeModel(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, ModelHandler modelHandler)
throws Exception {
Object model = null;
try {
String formName = actionMapping.getName();
if (formName == null)
throw new Exception("no define the FormName in struts_config.xml");
ModelMapping modelMapping = modelHandler.getModelMapping();
String keyName = modelMapping.getKeyName();
String keyValue = request.getParameter(keyName);
if (keyValue == null) {
Debug.logError("[JdonFramework]Need a model's key field : <html:hidden property=MODEL KEY /> in jsp's form! ", module);
}
modelManager.removeCache(keyValue);
Debug.logVerbose("[JdonFramework] no model cache, keyName is " + keyName, module);
model = modelManager.getModelObject(formName);
} catch (Exception e) {
Debug.logError("[JdonFramework] makeModel error: " + e);
throw new Exception(e);
}
return model;
} } | public class class_name {
protected Object makeModel(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, ModelHandler modelHandler)
throws Exception {
Object model = null;
try {
String formName = actionMapping.getName();
if (formName == null)
throw new Exception("no define the FormName in struts_config.xml");
ModelMapping modelMapping = modelHandler.getModelMapping();
String keyName = modelMapping.getKeyName();
String keyValue = request.getParameter(keyName);
if (keyValue == null) {
Debug.logError("[JdonFramework]Need a model's key field : <html:hidden property=MODEL KEY /> in jsp's form! ", module);
// depends on control dependency: [if], data = [none]
}
modelManager.removeCache(keyValue);
Debug.logVerbose("[JdonFramework] no model cache, keyName is " + keyName, module);
model = modelManager.getModelObject(formName);
} catch (Exception e) {
Debug.logError("[JdonFramework] makeModel error: " + e);
throw new Exception(e);
}
return model;
} } |
public class class_name {
public List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity) {
Object[] args = { parentIdentity.getIdentifier().toString(), parentIdentity.getType() };
List<ObjectIdentity> objects = jdbcOperations.query(findChildrenSql, args,
new RowMapper<ObjectIdentity>() {
public ObjectIdentity mapRow(ResultSet rs, int rowNum)
throws SQLException {
String javaType = rs.getString("class");
Serializable identifier = (Serializable) rs.getObject("obj_id");
identifier = aclClassIdUtils.identifierFrom(identifier, rs);
return new ObjectIdentityImpl(javaType, identifier);
}
});
if (objects.size() == 0) {
return null;
}
return objects;
} } | public class class_name {
public List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity) {
Object[] args = { parentIdentity.getIdentifier().toString(), parentIdentity.getType() };
List<ObjectIdentity> objects = jdbcOperations.query(findChildrenSql, args,
new RowMapper<ObjectIdentity>() {
public ObjectIdentity mapRow(ResultSet rs, int rowNum)
throws SQLException {
String javaType = rs.getString("class");
Serializable identifier = (Serializable) rs.getObject("obj_id");
identifier = aclClassIdUtils.identifierFrom(identifier, rs);
return new ObjectIdentityImpl(javaType, identifier);
}
});
if (objects.size() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
return objects;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.