code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private boolean exactMatch(String str, int i) {
int end = str.length() - i;
for (String p : _patterns) {
int start = end - p.length();
if (start >= 0 && str.regionMatches(start, p, 0, p.length())) {
return true;
}
}
return false;
} }
|
public class class_name {
private boolean exactMatch(String str, int i) {
int end = str.length() - i;
for (String p : _patterns) {
int start = end - p.length();
if (start >= 0 && str.regionMatches(start, p, 0, p.length())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public static int[] extractThemeAttrs(TypedArray array) {
int[] scrap = null;
/*if (mRecycled) {
throw new RuntimeException("Cannot make calls to a recycled instance!");
}*/
int[] attrs = null;
int[] mData = null;
try {
Field mDataField = array.getClass().getDeclaredField("mData");
mDataField.setAccessible(true);
mData = (int[]) mDataField.get(array);
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
final int[] data = mData;
final int N = array.length();
for (int i = 0; i < N; i++) {
final int index = i * STYLE_NUM_ENTRIES;
if (data[index + STYLE_TYPE] != TypedValue.TYPE_ATTRIBUTE) {
// Not an attribute, ignore.
continue;
}
// Null the entry so that we can safely call getZzz().
data[index + STYLE_TYPE] = TypedValue.TYPE_NULL;
final int attr = data[index + STYLE_DATA];
if (attr == 0) {
// Useless data, ignore.
continue;
}
// Ensure we have a usable attribute array.
if (attrs == null) {
if (scrap != null && scrap.length == N) {
attrs = scrap;
Arrays.fill(attrs, 0);
} else {
attrs = new int[N];
}
}
attrs[i] = attr;
}
return attrs;
} }
|
public class class_name {
public static int[] extractThemeAttrs(TypedArray array) {
int[] scrap = null;
/*if (mRecycled) {
throw new RuntimeException("Cannot make calls to a recycled instance!");
}*/
int[] attrs = null;
int[] mData = null;
try {
Field mDataField = array.getClass().getDeclaredField("mData");
mDataField.setAccessible(true); // depends on control dependency: [try], data = [none]
mData = (int[]) mDataField.get(array); // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
final int[] data = mData;
final int N = array.length();
for (int i = 0; i < N; i++) {
final int index = i * STYLE_NUM_ENTRIES;
if (data[index + STYLE_TYPE] != TypedValue.TYPE_ATTRIBUTE) {
// Not an attribute, ignore.
continue;
}
// Null the entry so that we can safely call getZzz().
data[index + STYLE_TYPE] = TypedValue.TYPE_NULL; // depends on control dependency: [for], data = [none]
final int attr = data[index + STYLE_DATA];
if (attr == 0) {
// Useless data, ignore.
continue;
}
// Ensure we have a usable attribute array.
if (attrs == null) {
if (scrap != null && scrap.length == N) {
attrs = scrap; // depends on control dependency: [if], data = [none]
Arrays.fill(attrs, 0); // depends on control dependency: [if], data = [none]
} else {
attrs = new int[N]; // depends on control dependency: [if], data = [none]
}
}
attrs[i] = attr; // depends on control dependency: [for], data = [i]
}
return attrs;
} }
|
public class class_name {
public static synchronized Runnable performRuntimeAttachment() {
if (runtimeAttached || !corePlugin.isStagemonitorActive() || !corePlugin.isAttachAgentAtRuntime()) {
return NOOP_ON_SHUTDOWN_ACTION;
}
runtimeAttached = true;
final List<ClassFileTransformer> classFileTransformers = new ArrayList<ClassFileTransformer>();
final AutoEvictingCachingBinaryLocator binaryLocator = new AutoEvictingCachingBinaryLocator();
if (assertNoDifferentStagemonitorVersionIsDeployedOnSameJvm() && initInstrumentation()) {
final long start = System.currentTimeMillis();
classFileTransformers.add(initByteBuddyClassFileTransformer(binaryLocator));
if (corePlugin.isDebugInstrumentation()) {
logger.info("Attached agents in {} ms", System.currentTimeMillis() - start);
}
TimedElementMatcherDecorator.logMetrics();
}
return new Runnable() {
public void run() {
for (ClassFileTransformer classFileTransformer : classFileTransformers) {
instrumentation.removeTransformer(classFileTransformer);
}
// This ClassLoader is shutting down so don't try to retransform classes of it in the future
hashCodesOfClassLoadersToIgnore.add(ClassUtils.getIdentityString(AgentAttacher.class.getClassLoader()));
binaryLocator.close();
}
};
} }
|
public class class_name {
public static synchronized Runnable performRuntimeAttachment() {
if (runtimeAttached || !corePlugin.isStagemonitorActive() || !corePlugin.isAttachAgentAtRuntime()) {
return NOOP_ON_SHUTDOWN_ACTION; // depends on control dependency: [if], data = [none]
}
runtimeAttached = true;
final List<ClassFileTransformer> classFileTransformers = new ArrayList<ClassFileTransformer>();
final AutoEvictingCachingBinaryLocator binaryLocator = new AutoEvictingCachingBinaryLocator();
if (assertNoDifferentStagemonitorVersionIsDeployedOnSameJvm() && initInstrumentation()) {
final long start = System.currentTimeMillis();
classFileTransformers.add(initByteBuddyClassFileTransformer(binaryLocator)); // depends on control dependency: [if], data = [none]
if (corePlugin.isDebugInstrumentation()) {
logger.info("Attached agents in {} ms", System.currentTimeMillis() - start); // depends on control dependency: [if], data = [none]
}
TimedElementMatcherDecorator.logMetrics(); // depends on control dependency: [if], data = [none]
}
return new Runnable() {
public void run() {
for (ClassFileTransformer classFileTransformer : classFileTransformers) {
instrumentation.removeTransformer(classFileTransformer); // depends on control dependency: [for], data = [classFileTransformer]
}
// This ClassLoader is shutting down so don't try to retransform classes of it in the future
hashCodesOfClassLoadersToIgnore.add(ClassUtils.getIdentityString(AgentAttacher.class.getClassLoader()));
binaryLocator.close();
}
};
} }
|
public class class_name {
public V put(final Object key, final Object value)
{
final Object val = mapNullValue(value);
requireNonNull(val, "value cannot be null");
final Object[] entries = this.entries;
final int mask = entries.length - 1;
int index = Hashing.evenHash(key.hashCode(), mask);
Object oldValue = null;
while (entries[index + 1] != null)
{
if (entries[index] == key || entries[index].equals(key))
{
oldValue = entries[index + 1];
break;
}
index = next(index, mask);
}
if (oldValue == null)
{
++size;
entries[index] = key;
}
entries[index + 1] = val;
increaseCapacity();
return unmapNullValue(oldValue);
} }
|
public class class_name {
public V put(final Object key, final Object value)
{
final Object val = mapNullValue(value);
requireNonNull(val, "value cannot be null");
final Object[] entries = this.entries;
final int mask = entries.length - 1;
int index = Hashing.evenHash(key.hashCode(), mask);
Object oldValue = null;
while (entries[index + 1] != null)
{
if (entries[index] == key || entries[index].equals(key))
{
oldValue = entries[index + 1]; // depends on control dependency: [if], data = [none]
break;
}
index = next(index, mask); // depends on control dependency: [while], data = [none]
}
if (oldValue == null)
{
++size; // depends on control dependency: [if], data = [none]
entries[index] = key; // depends on control dependency: [if], data = [none]
}
entries[index + 1] = val;
increaseCapacity();
return unmapNullValue(oldValue);
} }
|
public class class_name {
@Override
public void sort()
throws EFapsException
{
if (getSortKey() != null && getSortKey().length() > 0) {
int sortKeyTmp = 0;
final List<Field> fields = getUserSortedColumns();
for (int i = 0; i < fields.size(); i++) {
final Field field = fields.get(i);
if (field.hasAccess(getMode(), getInstance(), getCommand(), getInstance())
&& !field.isNoneDisplay(getMode()) && !field.isHiddenDisplay(getMode())) {
if (field.getName().equals(getSortKey())) {
break;
}
sortKeyTmp++;
}
}
if (sortKeyTmp < getTable().getFields().size()) {
final int index = sortKeyTmp;
Collections.sort(this.values, new Comparator<UIRow>()
{
@Override
public int compare(final UIRow _rowModel1,
final UIRow _rowModel2)
{
final ISortable cellModel1 = _rowModel1.getCells().get(index);
final ISortable cellModel2 = _rowModel2.getCells().get(index);
return cellModel1.compareTo(cellModel2);
}
});
if (getSortDirection() == SortDirection.DESCENDING) {
Collections.reverse(this.values);
}
}
}
} }
|
public class class_name {
@Override
public void sort()
throws EFapsException
{
if (getSortKey() != null && getSortKey().length() > 0) {
int sortKeyTmp = 0;
final List<Field> fields = getUserSortedColumns();
for (int i = 0; i < fields.size(); i++) {
final Field field = fields.get(i);
if (field.hasAccess(getMode(), getInstance(), getCommand(), getInstance())
&& !field.isNoneDisplay(getMode()) && !field.isHiddenDisplay(getMode())) {
if (field.getName().equals(getSortKey())) {
break;
}
sortKeyTmp++; // depends on control dependency: [if], data = [none]
}
}
if (sortKeyTmp < getTable().getFields().size()) {
final int index = sortKeyTmp;
Collections.sort(this.values, new Comparator<UIRow>()
{
@Override
public int compare(final UIRow _rowModel1,
final UIRow _rowModel2)
{
final ISortable cellModel1 = _rowModel1.getCells().get(index);
final ISortable cellModel2 = _rowModel2.getCells().get(index);
return cellModel1.compareTo(cellModel2);
}
}); // depends on control dependency: [if], data = [none]
if (getSortDirection() == SortDirection.DESCENDING) {
Collections.reverse(this.values); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public void restoreFromLastState() {
producer.initializeDataModel(dataModel);
long latestAnnouncedVersion = announcementWatcher.getLatestVersion();
if (latestAnnouncedVersion == HollowFilesystemAnnouncementWatcher.NO_ANNOUNCEMENT_AVAILABLE || latestAnnouncedVersion < 0) {
return;
}
restore(latestAnnouncedVersion, blobRetriever);
} }
|
public class class_name {
public void restoreFromLastState() {
producer.initializeDataModel(dataModel);
long latestAnnouncedVersion = announcementWatcher.getLatestVersion();
if (latestAnnouncedVersion == HollowFilesystemAnnouncementWatcher.NO_ANNOUNCEMENT_AVAILABLE || latestAnnouncedVersion < 0) {
return; // depends on control dependency: [if], data = [none]
}
restore(latestAnnouncedVersion, blobRetriever);
} }
|
public class class_name {
public static Context get() {
Context tls = slot.get();
if (tls == null) {
if (isStrictMode) {
log.error("Thread is missing a bitcoinj context.");
log.error("You should use Context.propagate() or a ContextPropagatingThreadFactory.");
throw new IllegalStateException("missing context");
}
if (lastConstructed == null)
throw new IllegalStateException("You must construct a Context object before using bitcoinj!");
slot.set(lastConstructed);
log.error("Performing thread fixup: you are accessing bitcoinj via a thread that has not had any context set on it.");
log.error("This error has been corrected for, but doing this makes your app less robust.");
log.error("You should use Context.propagate() or a ContextPropagatingThreadFactory.");
log.error("Please refer to the user guide for more information about this.");
log.error("Thread name is {}.", Thread.currentThread().getName());
// TODO: Actually write the user guide section about this.
// TODO: If the above TODO makes it past the 0.13 release, kick Mike and tell him he sucks.
return lastConstructed;
} else {
return tls;
}
} }
|
public class class_name {
public static Context get() {
Context tls = slot.get();
if (tls == null) {
if (isStrictMode) {
log.error("Thread is missing a bitcoinj context."); // depends on control dependency: [if], data = [none]
log.error("You should use Context.propagate() or a ContextPropagatingThreadFactory."); // depends on control dependency: [if], data = [none]
throw new IllegalStateException("missing context");
}
if (lastConstructed == null)
throw new IllegalStateException("You must construct a Context object before using bitcoinj!");
slot.set(lastConstructed); // depends on control dependency: [if], data = [none]
log.error("Performing thread fixup: you are accessing bitcoinj via a thread that has not had any context set on it."); // depends on control dependency: [if], data = [none]
log.error("This error has been corrected for, but doing this makes your app less robust."); // depends on control dependency: [if], data = [none]
log.error("You should use Context.propagate() or a ContextPropagatingThreadFactory."); // depends on control dependency: [if], data = [none]
log.error("Please refer to the user guide for more information about this."); // depends on control dependency: [if], data = [none]
log.error("Thread name is {}.", Thread.currentThread().getName()); // depends on control dependency: [if], data = [none]
// TODO: Actually write the user guide section about this.
// TODO: If the above TODO makes it past the 0.13 release, kick Mike and tell him he sucks.
return lastConstructed; // depends on control dependency: [if], data = [none]
} else {
return tls; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void firePacketInterceptors(Stanza packet) {
List<StanzaListener> interceptorsToInvoke = new LinkedList<>();
synchronized (interceptors) {
for (InterceptorWrapper interceptorWrapper : interceptors.values()) {
if (interceptorWrapper.filterMatches(packet)) {
interceptorsToInvoke.add(interceptorWrapper.getInterceptor());
}
}
}
for (StanzaListener interceptor : interceptorsToInvoke) {
try {
interceptor.processStanza(packet);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Packet interceptor threw exception", e);
}
}
} }
|
public class class_name {
private void firePacketInterceptors(Stanza packet) {
List<StanzaListener> interceptorsToInvoke = new LinkedList<>();
synchronized (interceptors) {
for (InterceptorWrapper interceptorWrapper : interceptors.values()) {
if (interceptorWrapper.filterMatches(packet)) {
interceptorsToInvoke.add(interceptorWrapper.getInterceptor()); // depends on control dependency: [if], data = [none]
}
}
}
for (StanzaListener interceptor : interceptorsToInvoke) {
try {
interceptor.processStanza(packet); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Packet interceptor threw exception", e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static void setImageBitmap(EfficientCacheView cacheView, int viewId, Bitmap bm) {
View view = cacheView.findViewByIdEfficient(viewId);
if (view instanceof ImageView) {
((ImageView) view).setImageBitmap(bm);
}
} }
|
public class class_name {
public static void setImageBitmap(EfficientCacheView cacheView, int viewId, Bitmap bm) {
View view = cacheView.findViewByIdEfficient(viewId);
if (view instanceof ImageView) {
((ImageView) view).setImageBitmap(bm); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected String transformQuery(String query, QueryTransformer qt) {
StringBuffer modified_query = new StringBuffer();
Matcher matcher = qt.m_queryPattern.matcher(query);
int count = 0;
while (matcher.find()) {
StringBuffer replaceText = new StringBuffer(qt.m_initialText);
String wholeMatch = matcher.group();
String lastGroup = wholeMatch;
List<String> groups = new ArrayList<String>();
if (qt.m_debugPrint) {
if (count < 1) {
System.out.println("In NonVoltDBBackend.transformQuery,\n with query : " + query);
System.out.println(" QueryTransformer:\n " + qt);
}
System.out.println(" " + ++count + ".wholeMatch: " + wholeMatch);
}
for (String groupName : qt.m_groups) {
String group = matcher.group(groupName);
groups.add(group);
if (qt.m_debugPrint) {
System.out.println(" group : " + group);
}
if (group == null) {
continue;
} else if (!qt.m_useWholeMatch) {
String groupValue = group, suffixValue = qt.m_suffix;
// Check for the case where a multiplier & minimum are used
if (qt.m_multiplier != null && qt.m_minimum != null) {
groupValue = Long.toString(Math.round(Math.max(Integer.parseInt(group) * qt.m_multiplier, qt.m_minimum)));
}
// Check for the ending that indicates to use the alternate suffix
if (qt.m_altSuffix != null && group.toUpperCase().endsWith(qt.m_useAltSuffixAfter)) {
suffixValue = qt.m_altSuffix;
}
// If a specific column type was specified for this
// QueryTransformer, check that it matches
if (columnTypeMatches(qt.m_columnType, qt.m_allColumnsShouldMatchType,
query, qt.m_debugPrint, groupValue)) {
// Make sure not to swallow up extra ')', in this group
replaceText.append(handleParens(groupValue, qt.m_prefix, suffixValue, qt.m_debugPrint));
} else {
// Since column type does not match, don't change anything
replaceText.append(wholeMatch);
}
}
lastGroup = group;
}
if (qt.m_debugPrint) {
System.out.println(" lastGroup : " + lastGroup);
}
if (qt.m_useWholeMatch) {
boolean noChangesNeeded = false;
// If the matched string contains one of the strings in the
// (possibly empty) list of excluded strings, then no changes
// are needed
if (qt.m_exclude != null) {
for (String excl : qt.m_exclude) {
if (wholeMatch.contains(excl)) {
noChangesNeeded = true;
if (qt.m_debugPrint) {
System.out.println(" noChangesNeeded, because wholeMatch contains excl:");
System.out.println(" wholeMatch: " + wholeMatch);
System.out.println(" m_exclude : " + qt.m_exclude);
System.out.println(" excl : " + excl);
}
}
}
}
// When columnType is specified, it means only modify queries
// that use that type; so if the relevant column(s) are not of
// the specified type, no changes are needed
if (!noChangesNeeded) {
String[] groupsArray = new String[groups.size()];
groupsArray = groups.toArray(groupsArray);
if (!columnTypeMatches(qt.m_columnType, qt.m_allColumnsShouldMatchType,
query, qt.m_debugPrint, groupsArray)) {
noChangesNeeded = true;
if (qt.m_debugPrint) {
System.out.println(" noChangesNeeded, because columnType(s) do not Match");
}
}
}
if (noChangesNeeded) {
// Make no changes to the query, if one of the excluded
// strings was found, or when the columnType is specified,
// but does not match the column type(s) found in this query
replaceText.append(wholeMatch);
} else {
// Check for the case where the group (or the whole text) is to be replaced with replacementText
if (qt.m_replacementText != null) {
wholeMatch = wholeMatch.replace(lastGroup, qt.m_replacementText);
}
// Check for the case where each group is to be replaced using groupReplacementTexts
if (qt.m_groupReplacementTexts != null && !qt.m_groupReplacementTexts.isEmpty()) {
for (int i=0; i < Math.min(groups.size(), qt.m_groupReplacementTexts.size()); i++) {
if (groups.get(i) != null && qt.m_groupReplacementTexts.get(i) != null) {
if (qt.m_debugPrint) {
String instances = (qt.m_groupReplaceAll ? "all instances" : "first instance");
System.out.println(" replacing "+instances+" of groups(i) "
+ "with groupReplacementTexts(i).");
System.out.println(" wholeMatch: " + wholeMatch);
System.out.println(" i : " + i);
System.out.println(" groups [i]: " + groups.get(i));
System.out.println(" gRepTxt[i]: " + qt.m_groupReplacementTexts.get(i));
}
if (qt.m_groupReplaceAll) {
// Extra escaping to make sure that "\" remains as "\" and "$"
// remains "$", despite replace's efforts to change them
wholeMatch = wholeMatch.replace ( groups.get(i), protectSpecialChars (
qt.m_groupReplacementTexts.get(i), qt.m_debugPrint ));
} else {
wholeMatch = wholeMatch.replaceFirst ( groups.get(i), protectSpecialChars (
qt.m_groupReplacementTexts.get(i), qt.m_debugPrint ));
}
}
}
if (qt.m_debugPrint) {
System.out.println(" wholeMatch : " + wholeMatch);
}
}
// Make sure not to swallow up extra ')', in whole match; and
// replace symbols like {foo} with the appropriate group values
replaceText.append(replaceGroupNameVariables(
handleParens(wholeMatch, qt.m_prefix, qt.m_suffix, qt.m_debugPrint),
qt.m_groups, groups, qt.m_debugPrint));
}
}
if (qt.m_debugPrint) {
System.out.println(" replaceText : " + replaceText);
}
// Extra escaping to make sure that "\" remains as "\" and "$"
// remains "$", despite appendReplacement's efforts to change them
matcher.appendReplacement ( modified_query,
protectSpecialChars ( replaceText.toString(), qt.m_debugPrint ));
}
matcher.appendTail(modified_query);
if ((DEBUG || qt.m_debugPrint) && !query.equalsIgnoreCase(modified_query.toString())) {
System.out.println("In NonVoltDBBackend.transformQuery,\n with query : " + query);
System.out.println(" modified_query: " + modified_query);
}
return modified_query.toString();
} }
|
public class class_name {
protected String transformQuery(String query, QueryTransformer qt) {
StringBuffer modified_query = new StringBuffer();
Matcher matcher = qt.m_queryPattern.matcher(query);
int count = 0;
while (matcher.find()) {
StringBuffer replaceText = new StringBuffer(qt.m_initialText);
String wholeMatch = matcher.group();
String lastGroup = wholeMatch;
List<String> groups = new ArrayList<String>();
if (qt.m_debugPrint) {
if (count < 1) {
System.out.println("In NonVoltDBBackend.transformQuery,\n with query : " + query); // depends on control dependency: [if], data = [none]
System.out.println(" QueryTransformer:\n " + qt); // depends on control dependency: [if], data = [none]
}
System.out.println(" " + ++count + ".wholeMatch: " + wholeMatch); // depends on control dependency: [if], data = [none]
}
for (String groupName : qt.m_groups) {
String group = matcher.group(groupName);
groups.add(group); // depends on control dependency: [for], data = [none]
if (qt.m_debugPrint) {
System.out.println(" group : " + group); // depends on control dependency: [if], data = [none]
}
if (group == null) {
continue;
} else if (!qt.m_useWholeMatch) {
String groupValue = group, suffixValue = qt.m_suffix;
// Check for the case where a multiplier & minimum are used
if (qt.m_multiplier != null && qt.m_minimum != null) {
groupValue = Long.toString(Math.round(Math.max(Integer.parseInt(group) * qt.m_multiplier, qt.m_minimum))); // depends on control dependency: [if], data = [none]
}
// Check for the ending that indicates to use the alternate suffix
if (qt.m_altSuffix != null && group.toUpperCase().endsWith(qt.m_useAltSuffixAfter)) {
suffixValue = qt.m_altSuffix; // depends on control dependency: [if], data = [none]
}
// If a specific column type was specified for this
// QueryTransformer, check that it matches
if (columnTypeMatches(qt.m_columnType, qt.m_allColumnsShouldMatchType,
query, qt.m_debugPrint, groupValue)) {
// Make sure not to swallow up extra ')', in this group
replaceText.append(handleParens(groupValue, qt.m_prefix, suffixValue, qt.m_debugPrint)); // depends on control dependency: [if], data = [none]
} else {
// Since column type does not match, don't change anything
replaceText.append(wholeMatch); // depends on control dependency: [if], data = [none]
}
}
lastGroup = group; // depends on control dependency: [for], data = [none]
}
if (qt.m_debugPrint) {
System.out.println(" lastGroup : " + lastGroup); // depends on control dependency: [if], data = [none]
}
if (qt.m_useWholeMatch) {
boolean noChangesNeeded = false;
// If the matched string contains one of the strings in the
// (possibly empty) list of excluded strings, then no changes
// are needed
if (qt.m_exclude != null) {
for (String excl : qt.m_exclude) {
if (wholeMatch.contains(excl)) {
noChangesNeeded = true; // depends on control dependency: [if], data = [none]
if (qt.m_debugPrint) {
System.out.println(" noChangesNeeded, because wholeMatch contains excl:"); // depends on control dependency: [if], data = [none]
System.out.println(" wholeMatch: " + wholeMatch); // depends on control dependency: [if], data = [none]
System.out.println(" m_exclude : " + qt.m_exclude); // depends on control dependency: [if], data = [none]
System.out.println(" excl : " + excl); // depends on control dependency: [if], data = [none]
}
}
}
}
// When columnType is specified, it means only modify queries
// that use that type; so if the relevant column(s) are not of
// the specified type, no changes are needed
if (!noChangesNeeded) {
String[] groupsArray = new String[groups.size()];
groupsArray = groups.toArray(groupsArray); // depends on control dependency: [if], data = [none]
if (!columnTypeMatches(qt.m_columnType, qt.m_allColumnsShouldMatchType,
query, qt.m_debugPrint, groupsArray)) {
noChangesNeeded = true; // depends on control dependency: [if], data = [none]
if (qt.m_debugPrint) {
System.out.println(" noChangesNeeded, because columnType(s) do not Match"); // depends on control dependency: [if], data = [none]
}
}
}
if (noChangesNeeded) {
// Make no changes to the query, if one of the excluded
// strings was found, or when the columnType is specified,
// but does not match the column type(s) found in this query
replaceText.append(wholeMatch); // depends on control dependency: [if], data = [none]
} else {
// Check for the case where the group (or the whole text) is to be replaced with replacementText
if (qt.m_replacementText != null) {
wholeMatch = wholeMatch.replace(lastGroup, qt.m_replacementText); // depends on control dependency: [if], data = [none]
}
// Check for the case where each group is to be replaced using groupReplacementTexts
if (qt.m_groupReplacementTexts != null && !qt.m_groupReplacementTexts.isEmpty()) {
for (int i=0; i < Math.min(groups.size(), qt.m_groupReplacementTexts.size()); i++) {
if (groups.get(i) != null && qt.m_groupReplacementTexts.get(i) != null) {
if (qt.m_debugPrint) {
String instances = (qt.m_groupReplaceAll ? "all instances" : "first instance");
System.out.println(" replacing "+instances+" of groups(i) "
+ "with groupReplacementTexts(i)."); // depends on control dependency: [if], data = [none]
System.out.println(" wholeMatch: " + wholeMatch); // depends on control dependency: [if], data = [none]
System.out.println(" i : " + i); // depends on control dependency: [if], data = [none]
System.out.println(" groups [i]: " + groups.get(i)); // depends on control dependency: [if], data = [none]
System.out.println(" gRepTxt[i]: " + qt.m_groupReplacementTexts.get(i)); // depends on control dependency: [if], data = [none]
}
if (qt.m_groupReplaceAll) {
// Extra escaping to make sure that "\" remains as "\" and "$"
// remains "$", despite replace's efforts to change them
wholeMatch = wholeMatch.replace ( groups.get(i), protectSpecialChars (
qt.m_groupReplacementTexts.get(i), qt.m_debugPrint )); // depends on control dependency: [if], data = [none]
} else {
wholeMatch = wholeMatch.replaceFirst ( groups.get(i), protectSpecialChars (
qt.m_groupReplacementTexts.get(i), qt.m_debugPrint )); // depends on control dependency: [if], data = [none]
}
}
}
if (qt.m_debugPrint) {
System.out.println(" wholeMatch : " + wholeMatch); // depends on control dependency: [if], data = [none]
}
}
// Make sure not to swallow up extra ')', in whole match; and
// replace symbols like {foo} with the appropriate group values
replaceText.append(replaceGroupNameVariables(
handleParens(wholeMatch, qt.m_prefix, qt.m_suffix, qt.m_debugPrint),
qt.m_groups, groups, qt.m_debugPrint)); // depends on control dependency: [if], data = [none]
}
}
if (qt.m_debugPrint) {
System.out.println(" replaceText : " + replaceText); // depends on control dependency: [if], data = [none]
}
// Extra escaping to make sure that "\" remains as "\" and "$"
// remains "$", despite appendReplacement's efforts to change them
matcher.appendReplacement ( modified_query,
protectSpecialChars ( replaceText.toString(), qt.m_debugPrint )); // depends on control dependency: [while], data = [none]
}
matcher.appendTail(modified_query);
if ((DEBUG || qt.m_debugPrint) && !query.equalsIgnoreCase(modified_query.toString())) {
System.out.println("In NonVoltDBBackend.transformQuery,\n with query : " + query); // depends on control dependency: [if], data = [none]
System.out.println(" modified_query: " + modified_query); // depends on control dependency: [if], data = [none]
}
return modified_query.toString();
} }
|
public class class_name {
public static Cookie parseCookie(String rawCookie) throws ParseException {
String[] rawCookieParams = rawCookie.split(";");
//get the cookie name, check for valid cookie
String[] rawCookieNameAndValue = rawCookieParams[0].split("=");
String cookieName = rawCookieNameAndValue[0].trim();
if (Utils.isEmpty(cookieName)) {
throw new ParseException("Invalid cookie: missing name", 0);
}
//get the cookie value
String cookieValue = rawCookieNameAndValue[1].trim();
//construct output
Cookie output = new Cookie(cookieName, cookieValue);
//parse other cookie params
for (int i = 1; i < rawCookieParams.length; i++) {
String[] rawCookieParam = rawCookieParams[i].trim().split("=");
String paramName = rawCookieParam[0].trim();
if ("secure".equalsIgnoreCase(paramName)) {
output.setSecure(true);
} else if ("HttpOnly".equalsIgnoreCase(paramName)) {
output.setHttpOnly(true);
} else {
if (rawCookieParam.length != 2) {
//attribute not a flag or missing value
continue;
}
String paramValue = rawCookieParam[1].trim();
if ("expires".equalsIgnoreCase(paramName)) {
try {
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz");
Date expiryDate = format.parse(paramValue);
output.setExpiration(expiryDate);
} catch (Exception e) {
//couldn't parse date, ignore
BaseExtender.getCallbacks().printError("WARNING: unable to parse cookie expiration: " + paramValue);
}
} else if ("max-age".equalsIgnoreCase(paramName)) {
long maxAge = Long.parseLong(paramValue);
output.setMaxAge(maxAge);
} else if ("domain".equalsIgnoreCase(paramName)) {
output.setDomain(paramValue);
} else if ("path".equalsIgnoreCase(paramName)) {
output.setPath(paramValue);
}
}
}
return output;
} }
|
public class class_name {
public static Cookie parseCookie(String rawCookie) throws ParseException {
String[] rawCookieParams = rawCookie.split(";");
//get the cookie name, check for valid cookie
String[] rawCookieNameAndValue = rawCookieParams[0].split("=");
String cookieName = rawCookieNameAndValue[0].trim();
if (Utils.isEmpty(cookieName)) {
throw new ParseException("Invalid cookie: missing name", 0);
}
//get the cookie value
String cookieValue = rawCookieNameAndValue[1].trim();
//construct output
Cookie output = new Cookie(cookieName, cookieValue);
//parse other cookie params
for (int i = 1; i < rawCookieParams.length; i++) {
String[] rawCookieParam = rawCookieParams[i].trim().split("=");
String paramName = rawCookieParam[0].trim();
if ("secure".equalsIgnoreCase(paramName)) {
output.setSecure(true);
} else if ("HttpOnly".equalsIgnoreCase(paramName)) {
output.setHttpOnly(true);
} else {
if (rawCookieParam.length != 2) {
//attribute not a flag or missing value
continue;
}
String paramValue = rawCookieParam[1].trim();
if ("expires".equalsIgnoreCase(paramName)) {
try {
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz");
Date expiryDate = format.parse(paramValue);
output.setExpiration(expiryDate); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
//couldn't parse date, ignore
BaseExtender.getCallbacks().printError("WARNING: unable to parse cookie expiration: " + paramValue);
} // depends on control dependency: [catch], data = [none]
} else if ("max-age".equalsIgnoreCase(paramName)) {
long maxAge = Long.parseLong(paramValue);
output.setMaxAge(maxAge); // depends on control dependency: [if], data = [none]
} else if ("domain".equalsIgnoreCase(paramName)) {
output.setDomain(paramValue); // depends on control dependency: [if], data = [none]
} else if ("path".equalsIgnoreCase(paramName)) {
output.setPath(paramValue); // depends on control dependency: [if], data = [none]
}
}
}
return output;
} }
|
public class class_name {
private static void listHierarchy(Task task, String indent)
{
for (Task child : task.getChildTasks())
{
System.out.println(indent + "Task: " + child.getName() + "\t" + child.getStart() + "\t" + child.getFinish());
listHierarchy(child, indent + " ");
}
} }
|
public class class_name {
private static void listHierarchy(Task task, String indent)
{
for (Task child : task.getChildTasks())
{
System.out.println(indent + "Task: " + child.getName() + "\t" + child.getStart() + "\t" + child.getFinish()); // depends on control dependency: [for], data = [child]
listHierarchy(child, indent + " "); // depends on control dependency: [for], data = [child]
}
} }
|
public class class_name {
protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound,
Throwable cause, Http2Exception http2Ex) {
if (http2Ex == null) {
http2Ex = new Http2Exception(INTERNAL_ERROR, cause.getMessage(), cause);
}
ChannelPromise promise = ctx.newPromise();
ChannelFuture future = goAway(ctx, http2Ex, ctx.newPromise());
if (http2Ex.shutdownHint() == Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN) {
doGracefulShutdown(ctx, future, promise);
} else {
future.addListener(new ClosingChannelFutureListener(ctx, promise));
}
} }
|
public class class_name {
protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound,
Throwable cause, Http2Exception http2Ex) {
if (http2Ex == null) {
http2Ex = new Http2Exception(INTERNAL_ERROR, cause.getMessage(), cause); // depends on control dependency: [if], data = [none]
}
ChannelPromise promise = ctx.newPromise();
ChannelFuture future = goAway(ctx, http2Ex, ctx.newPromise());
if (http2Ex.shutdownHint() == Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN) {
doGracefulShutdown(ctx, future, promise); // depends on control dependency: [if], data = [none]
} else {
future.addListener(new ClosingChannelFutureListener(ctx, promise)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public float similarity(K what, K with)
{
Vector vectorWhat = storage.get(what);
if (vectorWhat == null)
{
return -1f;
}
Vector vectorWith = storage.get(with);
if (vectorWith == null)
{
return -1f;
}
return vectorWhat.cosineForUnitVector(vectorWith);
} }
|
public class class_name {
public float similarity(K what, K with)
{
Vector vectorWhat = storage.get(what);
if (vectorWhat == null)
{
return -1f; // depends on control dependency: [if], data = [none]
}
Vector vectorWith = storage.get(with);
if (vectorWith == null)
{
return -1f; // depends on control dependency: [if], data = [none]
}
return vectorWhat.cosineForUnitVector(vectorWith);
} }
|
public class class_name {
protected void addFlagCondition(CmsSelectQuery select, TableAlias users, int flags, boolean allowCore) {
if (flags != 0) {
I_CmsQueryFragment condition = createFlagCondition(users, flags);
if (allowCore) {
I_CmsQueryFragment coreCondition = createCoreCondition(users);
select.addCondition(CmsSqlBooleanClause.makeOr(condition, coreCondition));
} else {
select.addCondition(condition);
}
}
} }
|
public class class_name {
protected void addFlagCondition(CmsSelectQuery select, TableAlias users, int flags, boolean allowCore) {
if (flags != 0) {
I_CmsQueryFragment condition = createFlagCondition(users, flags);
if (allowCore) {
I_CmsQueryFragment coreCondition = createCoreCondition(users);
select.addCondition(CmsSqlBooleanClause.makeOr(condition, coreCondition)); // depends on control dependency: [if], data = [none]
} else {
select.addCondition(condition); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void marshall(DescribeJobRequest describeJobRequest, ProtocolMarshaller protocolMarshaller) {
if (describeJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeJobRequest.getAccountId(), ACCOUNTID_BINDING);
protocolMarshaller.marshall(describeJobRequest.getVaultName(), VAULTNAME_BINDING);
protocolMarshaller.marshall(describeJobRequest.getJobId(), JOBID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeJobRequest describeJobRequest, ProtocolMarshaller protocolMarshaller) {
if (describeJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeJobRequest.getAccountId(), ACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeJobRequest.getVaultName(), VAULTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeJobRequest.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setProxy(final JinxProxy proxyConfig) {
if (proxyConfig == null) {
System.clearProperty("http.proxyHost");
System.clearProperty("http.proxyPort");
System.clearProperty("https.proxyHost");
System.clearProperty("https.proxyPort");
this.proxy = Proxy.NO_PROXY;
} else if (!JinxUtils.isNullOrEmpty(proxyConfig.getProxyHost())) {
System.setProperty("http.proxyHost", proxyConfig.getProxyHost());
System.setProperty("http.proxyPort", Integer.toString(proxyConfig.getProxyPort()));
System.setProperty("https.proxyHost", proxyConfig.getProxyHost());
System.setProperty("https.proxyPort", Integer.toString(proxyConfig.getProxyPort()));
this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyConfig.getProxyHost(), proxyConfig.getProxyPort()));
if (!JinxUtils.isNullOrEmpty(proxyConfig.getProxyUser())) {
Authenticator authenticator = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(proxyConfig.getProxyUser(), proxyConfig.getProxyPassword()));
}
};
Authenticator.setDefault(authenticator);
}
}
} }
|
public class class_name {
public void setProxy(final JinxProxy proxyConfig) {
if (proxyConfig == null) {
System.clearProperty("http.proxyHost"); // depends on control dependency: [if], data = [none]
System.clearProperty("http.proxyPort"); // depends on control dependency: [if], data = [none]
System.clearProperty("https.proxyHost"); // depends on control dependency: [if], data = [none]
System.clearProperty("https.proxyPort");
this.proxy = Proxy.NO_PROXY;
} else if (!JinxUtils.isNullOrEmpty(proxyConfig.getProxyHost())) {
System.setProperty("http.proxyHost", proxyConfig.getProxyHost()); // depends on control dependency: [if], data = [none]
System.setProperty("http.proxyPort", Integer.toString(proxyConfig.getProxyPort())); // depends on control dependency: [if], data = [(proxyConfig]
System.setProperty("https.proxyHost", proxyConfig.getProxyHost()); // depends on control dependency: [if], data = [none]
System.setProperty("https.proxyPort", Integer.toString(proxyConfig.getProxyPort())); // depends on control dependency: [if], data = [(proxyConfig]
this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyConfig.getProxyHost(), proxyConfig.getProxyPort())); // depends on control dependency: [if], data = [(proxyConfig]
if (!JinxUtils.isNullOrEmpty(proxyConfig.getProxyUser())) {
Authenticator authenticator = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(proxyConfig.getProxyUser(), proxyConfig.getProxyPassword()));
}
};
Authenticator.setDefault(authenticator); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void accumulate(AverageData data,
Object value) {
if (value != null) {
data.count++;
data.total += ( (Number) value ).doubleValue();
}
} }
|
public class class_name {
public void accumulate(AverageData data,
Object value) {
if (value != null) {
data.count++; // depends on control dependency: [if], data = [none]
data.total += ( (Number) value ).doubleValue(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void redirect(String location) {
if (LOG.isDebugEnabled()) {
LOG.debug("Redirecting ({} {} to {}", "Found", HttpServletResponse.SC_FOUND, location);
}
try {
response.sendRedirect(location);
} catch (IOException ioException) {
LOG.warn("Redirect failure", ioException);
}
} }
|
public class class_name {
public void redirect(String location) {
if (LOG.isDebugEnabled()) {
LOG.debug("Redirecting ({} {} to {}", "Found", HttpServletResponse.SC_FOUND, location); // depends on control dependency: [if], data = [none]
}
try {
response.sendRedirect(location); // depends on control dependency: [try], data = [none]
} catch (IOException ioException) {
LOG.warn("Redirect failure", ioException);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void notifyListeners() {
Iterator it = listeners.iterator();
while (it.hasNext()) {
((ComponentListener) it.next()).componentActivated(this);
}
} }
|
public class class_name {
protected void notifyListeners() {
Iterator it = listeners.iterator();
while (it.hasNext()) {
((ComponentListener) it.next()).componentActivated(this);
// depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
private Decoder getColumnDecoder(Schema writtenFieldAvroSchema, InputStream in) {
// Use a special Avro decoder that has special handling for int, long,
// and String types. See ColumnDecoder for more information.
if (writtenFieldAvroSchema.getType() == Type.INT
|| writtenFieldAvroSchema.getType() == Type.LONG
|| writtenFieldAvroSchema.getType() == Type.STRING) {
return new ColumnDecoder(in);
} else {
return DecoderFactory.get().binaryDecoder(in, null);
}
} }
|
public class class_name {
private Decoder getColumnDecoder(Schema writtenFieldAvroSchema, InputStream in) {
// Use a special Avro decoder that has special handling for int, long,
// and String types. See ColumnDecoder for more information.
if (writtenFieldAvroSchema.getType() == Type.INT
|| writtenFieldAvroSchema.getType() == Type.LONG
|| writtenFieldAvroSchema.getType() == Type.STRING) {
return new ColumnDecoder(in); // depends on control dependency: [if], data = [none]
} else {
return DecoderFactory.get().binaryDecoder(in, null); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public String getFullPredString()
{
if (valuetree.getPredicate() == null)
{
return "";
}
String result = valuetree.getPredicate().toString();
return result;
} }
|
public class class_name {
@Override
public String getFullPredString()
{
if (valuetree.getPredicate() == null)
{
return ""; // depends on control dependency: [if], data = [none]
}
String result = valuetree.getPredicate().toString();
return result;
} }
|
public class class_name {
@Override
protected void restoreRepository() throws RepositoryRestoreExeption
{
// list of data restorers
List<DataRestore> dataRestorer = new ArrayList<DataRestore>();
List<WorkspaceContainerFacade> workspacesWaits4Resume = new ArrayList<WorkspaceContainerFacade>();
try
{
WorkspaceEntry wsEntry = repositoryEntry.getWorkspaceEntries().get(0);
// define one common connection for all restores and cleaners for single db case
Connection jdbcConn = null;
// define one common database cleaner for all restores for single db case
DBCleanerTool dbCleaner = null;
DatabaseStructureType dbType = DBInitializerHelper.getDatabaseType(wsEntry);
if (dbType.isShareSameDatasource())
{
String dsName = wsEntry.getContainer().getParameterValue(JDBCWorkspaceDataContainer.SOURCE_NAME);
final DataSource ds = (DataSource)new InitialContext().lookup(dsName);
if (ds == null)
{
throw new NameNotFoundException("Data source " + dsName + " not found");
}
jdbcConn = SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<Connection>()
{
public Connection run() throws Exception
{
return ds.getConnection();
}
});
jdbcConn.setAutoCommit(false);
if (dbType == DatabaseStructureType.SINGLE)
{
dbCleaner = DBCleanService.getRepositoryDBCleaner(jdbcConn, repositoryEntry);
}
}
ManageableRepository repository = repositoryService.getRepository(this.repositoryEntry.getName());
for (String wsName : repository.getWorkspaceNames())
{
LOG.info("Trying to suspend workspace '"+ wsName+"'");
WorkspaceContainerFacade wsContainer = repository.getWorkspaceContainer(wsName);
wsContainer.setState(ManageableRepository.SUSPENDED);
workspacesWaits4Resume.add(wsContainer);
}
boolean isSharedDbCleaner = false;
// collect all restorers
for (WorkspaceEntry wEntry : repositoryEntry.getWorkspaceEntries())
{
// get all backupable components
List<Backupable> backupable =
repositoryService.getRepository(this.repositoryEntry.getName()).getWorkspaceContainer(wEntry.getName())
.getComponentInstancesOfType(Backupable.class);
File fullBackupDir =
JCRRestore.getFullBackupFile(new BackupChainLog(workspacesMapping.get(wEntry.getName()))
.getBackupConfig().getBackupDir());
DataRestoreContext context;
if (jdbcConn != null)
{
if (dbType == DatabaseStructureType.SINGLE)
{
context = new DataRestoreContext(
new String[]{
DataRestoreContext.STORAGE_DIR,
DataRestoreContext.DB_CONNECTION,
DataRestoreContext.DB_CLEANER},
new Object[]{
fullBackupDir,
jdbcConn,
isSharedDbCleaner ? new DummyDBCleanerTool() : dbCleaner});
isSharedDbCleaner = true;
}
else
{
context = new DataRestoreContext(
new String[]{
DataRestoreContext.STORAGE_DIR,
DataRestoreContext.DB_CONNECTION},
new Object[]{
fullBackupDir,
jdbcConn});
}
}
else
{
context = new DataRestoreContext(
new String[] {DataRestoreContext.STORAGE_DIR},
new Object[] {fullBackupDir});
}
for (Backupable component : backupable)
{
dataRestorer.add(component.getDataRestorer(context));
}
}
for (DataRestore restorer : dataRestorer)
{
restorer.clean();
}
for (DataRestore restorer : dataRestorer)
{
restorer.restore();
}
for (DataRestore restorer : dataRestorer)
{
restorer.commit();
}
// resume components
for (WorkspaceContainerFacade wsContainer : workspacesWaits4Resume)
{
wsContainer.setState(ManageableRepository.ONLINE);
}
// incremental restore
for (WorkspaceEntry wEntry : repositoryEntry.getWorkspaceEntries())
{
LOG.info("Trying to restore an incremental backup for the workspace '"+wEntry.getName()+"'");
repositoryService.getRepository(this.repositoryEntry.getName()).getWorkspaceContainer(wEntry.getName())
.getComponentInstancesOfType(Backupable.class);
DataManager dataManager =
(WorkspacePersistentDataManager)repositoryService.getRepository(this.repositoryEntry.getName())
.getWorkspaceContainer(wEntry.getName()).getComponent(WorkspacePersistentDataManager.class);
File storageDir =
JCRRestore.getFullBackupFile(new BackupChainLog(workspacesMapping.get(wEntry.getName()))
.getBackupConfig().getBackupDir());
FileCleanerHolder cleanerHolder =
(FileCleanerHolder)repositoryService.getRepository(this.repositoryEntry.getName())
.getWorkspaceContainer(wEntry.getName()).getComponent(FileCleanerHolder.class);
JCRRestore restorer = new JCRRestore(dataManager, cleanerHolder.getFileCleaner());
for (File incrBackupFile : JCRRestore.getIncrementalFiles(storageDir))
{
restorer.incrementalRestore(incrBackupFile);
}
}
}
catch (Throwable t) //NOSONAR
{
LOG.info("Trying to roll back the changes");
for (DataRestore restorer : dataRestorer)
{
try
{
restorer.rollback();
}
catch (BackupException e)
{
LOG.error("Can't rollback changes", e);
}
}
throw new RepositoryRestoreExeption("Repository " + repositoryEntry.getName() + " was not restored", t);
}
finally
{
// close
for (DataRestore restorer : dataRestorer)
{
try
{
restorer.close();
}
catch (BackupException e)
{
LOG.error("Can't close restorer", e);
}
}
try
{
for (WorkspaceContainerFacade wsContainer : workspacesWaits4Resume)
{
wsContainer.setState(ManageableRepository.ONLINE);
}
}
catch (RepositoryException e)
{
LOG.error("Can't resume repository", e);
}
}
} }
|
public class class_name {
@Override
protected void restoreRepository() throws RepositoryRestoreExeption
{
// list of data restorers
List<DataRestore> dataRestorer = new ArrayList<DataRestore>();
List<WorkspaceContainerFacade> workspacesWaits4Resume = new ArrayList<WorkspaceContainerFacade>();
try
{
WorkspaceEntry wsEntry = repositoryEntry.getWorkspaceEntries().get(0);
// define one common connection for all restores and cleaners for single db case
Connection jdbcConn = null;
// define one common database cleaner for all restores for single db case
DBCleanerTool dbCleaner = null;
DatabaseStructureType dbType = DBInitializerHelper.getDatabaseType(wsEntry);
if (dbType.isShareSameDatasource())
{
String dsName = wsEntry.getContainer().getParameterValue(JDBCWorkspaceDataContainer.SOURCE_NAME);
final DataSource ds = (DataSource)new InitialContext().lookup(dsName);
if (ds == null)
{
throw new NameNotFoundException("Data source " + dsName + " not found");
}
jdbcConn = SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<Connection>()
{
public Connection run() throws Exception
{
return ds.getConnection();
}
});
// depends on control dependency: [if], data = [none]
jdbcConn.setAutoCommit(false);
// depends on control dependency: [if], data = [none]
if (dbType == DatabaseStructureType.SINGLE)
{
dbCleaner = DBCleanService.getRepositoryDBCleaner(jdbcConn, repositoryEntry);
// depends on control dependency: [if], data = [none]
}
}
ManageableRepository repository = repositoryService.getRepository(this.repositoryEntry.getName());
for (String wsName : repository.getWorkspaceNames())
{
LOG.info("Trying to suspend workspace '"+ wsName+"'");
// depends on control dependency: [for], data = [wsName]
WorkspaceContainerFacade wsContainer = repository.getWorkspaceContainer(wsName);
wsContainer.setState(ManageableRepository.SUSPENDED);
// depends on control dependency: [for], data = [none]
workspacesWaits4Resume.add(wsContainer);
// depends on control dependency: [for], data = [none]
}
boolean isSharedDbCleaner = false;
// collect all restorers
for (WorkspaceEntry wEntry : repositoryEntry.getWorkspaceEntries())
{
// get all backupable components
List<Backupable> backupable =
repositoryService.getRepository(this.repositoryEntry.getName()).getWorkspaceContainer(wEntry.getName())
.getComponentInstancesOfType(Backupable.class);
File fullBackupDir =
JCRRestore.getFullBackupFile(new BackupChainLog(workspacesMapping.get(wEntry.getName()))
.getBackupConfig().getBackupDir());
DataRestoreContext context;
if (jdbcConn != null)
{
if (dbType == DatabaseStructureType.SINGLE)
{
context = new DataRestoreContext(
new String[]{
DataRestoreContext.STORAGE_DIR,
DataRestoreContext.DB_CONNECTION,
DataRestoreContext.DB_CLEANER},
new Object[]{
fullBackupDir,
jdbcConn,
isSharedDbCleaner ? new DummyDBCleanerTool() : dbCleaner});
// depends on control dependency: [if], data = [none]
isSharedDbCleaner = true;
// depends on control dependency: [if], data = [none]
}
else
{
context = new DataRestoreContext(
new String[]{
DataRestoreContext.STORAGE_DIR,
DataRestoreContext.DB_CONNECTION},
new Object[]{
fullBackupDir,
jdbcConn});
// depends on control dependency: [if], data = [none]
}
}
else
{
context = new DataRestoreContext(
new String[] {DataRestoreContext.STORAGE_DIR},
new Object[] {fullBackupDir});
// depends on control dependency: [if], data = [none]
}
for (Backupable component : backupable)
{
dataRestorer.add(component.getDataRestorer(context));
// depends on control dependency: [for], data = [component]
}
}
for (DataRestore restorer : dataRestorer)
{
restorer.clean();
// depends on control dependency: [for], data = [restorer]
}
for (DataRestore restorer : dataRestorer)
{
restorer.restore();
// depends on control dependency: [for], data = [restorer]
}
for (DataRestore restorer : dataRestorer)
{
restorer.commit();
// depends on control dependency: [for], data = [restorer]
}
// resume components
for (WorkspaceContainerFacade wsContainer : workspacesWaits4Resume)
{
wsContainer.setState(ManageableRepository.ONLINE);
// depends on control dependency: [for], data = [wsContainer]
}
// incremental restore
for (WorkspaceEntry wEntry : repositoryEntry.getWorkspaceEntries())
{
LOG.info("Trying to restore an incremental backup for the workspace '"+wEntry.getName()+"'");
// depends on control dependency: [for], data = [wEntry]
repositoryService.getRepository(this.repositoryEntry.getName()).getWorkspaceContainer(wEntry.getName())
.getComponentInstancesOfType(Backupable.class);
// depends on control dependency: [for], data = [none]
DataManager dataManager =
(WorkspacePersistentDataManager)repositoryService.getRepository(this.repositoryEntry.getName())
.getWorkspaceContainer(wEntry.getName()).getComponent(WorkspacePersistentDataManager.class);
File storageDir =
JCRRestore.getFullBackupFile(new BackupChainLog(workspacesMapping.get(wEntry.getName()))
.getBackupConfig().getBackupDir());
FileCleanerHolder cleanerHolder =
(FileCleanerHolder)repositoryService.getRepository(this.repositoryEntry.getName())
.getWorkspaceContainer(wEntry.getName()).getComponent(FileCleanerHolder.class);
JCRRestore restorer = new JCRRestore(dataManager, cleanerHolder.getFileCleaner());
for (File incrBackupFile : JCRRestore.getIncrementalFiles(storageDir))
{
restorer.incrementalRestore(incrBackupFile);
// depends on control dependency: [for], data = [incrBackupFile]
}
}
}
catch (Throwable t) //NOSONAR
{
LOG.info("Trying to roll back the changes");
for (DataRestore restorer : dataRestorer)
{
try
{
restorer.rollback();
// depends on control dependency: [try], data = [none]
}
catch (BackupException e)
{
LOG.error("Can't rollback changes", e);
}
}
throw new RepositoryRestoreExeption("Repository " + repositoryEntry.getName() + " was not restored", t);
}
finally
{
// close
for (DataRestore restorer : dataRestorer)
{
try
{
restorer.close();
}
catch (BackupException e)
{
LOG.error("Can't close restorer", e);
}
// depends on control dependency: [catch], data = [none]
}
try
{
for (WorkspaceContainerFacade wsContainer : workspacesWaits4Resume)
{
wsContainer.setState(ManageableRepository.ONLINE);
// depends on control dependency: [for], data = [wsContainer]
}
}
catch (RepositoryException e)
{
LOG.error("Can't resume repository", e);
}
// depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static String getPollStatusToolTip(final PollStatus pollStatus, final VaadinMessageSource i18N) {
if (pollStatus != null && pollStatus.getLastPollDate() != null && pollStatus.isOverdue()) {
final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone();
return i18N.getMessage(UIMessageIdProvider.TOOLTIP_OVERDUE, SPDateTimeUtil.getDurationFormattedString(
pollStatus.getOverdueDate().atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant().toEpochMilli(),
pollStatus.getCurrentDate().atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant().toEpochMilli(),
i18N));
}
return null;
} }
|
public class class_name {
public static String getPollStatusToolTip(final PollStatus pollStatus, final VaadinMessageSource i18N) {
if (pollStatus != null && pollStatus.getLastPollDate() != null && pollStatus.isOverdue()) {
final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone();
return i18N.getMessage(UIMessageIdProvider.TOOLTIP_OVERDUE, SPDateTimeUtil.getDurationFormattedString(
pollStatus.getOverdueDate().atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant().toEpochMilli(),
pollStatus.getCurrentDate().atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant().toEpochMilli(),
i18N)); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public REC next() {
checkDirection(true);
if (currentRecord != null)
try {
// RETURN LAST LOADED RECORD
return (REC) currentRecord;
} finally {
currentRecord = null;
}
ORecord record;
// MOVE FORWARD IN THE CURRENT CLUSTER
while (hasNext()) {
if (currentRecord != null)
try {
// RETURN LAST LOADED RECORD
return (REC) currentRecord;
} finally {
currentRecord = null;
}
record = getTransactionEntry();
if (record == null)
record = readCurrentRecord(null, +1);
if (record != null)
// FOUND
if (include(record))
return (REC) record;
}
record = getTransactionEntry();
if (record != null)
return (REC) record;
throw new NoSuchElementException(
"Direction: forward, last position was: " + current + ", range: " + beginRange + "-" + endRange);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public REC next() {
checkDirection(true);
if (currentRecord != null)
try {
// RETURN LAST LOADED RECORD
return (REC) currentRecord;
// depends on control dependency: [try], data = [none]
} finally {
currentRecord = null;
}
ORecord record;
// MOVE FORWARD IN THE CURRENT CLUSTER
while (hasNext()) {
if (currentRecord != null)
try {
// RETURN LAST LOADED RECORD
return (REC) currentRecord;
// depends on control dependency: [try], data = [none]
} finally {
currentRecord = null;
}
record = getTransactionEntry();
// depends on control dependency: [while], data = [none]
if (record == null)
record = readCurrentRecord(null, +1);
if (record != null)
// FOUND
if (include(record))
return (REC) record;
}
record = getTransactionEntry();
if (record != null)
return (REC) record;
throw new NoSuchElementException(
"Direction: forward, last position was: " + current + ", range: " + beginRange + "-" + endRange);
} }
|
public class class_name {
public static String encodePassword(String password, String algorithm) {
byte[] unencodedPassword = password.getBytes();
MessageDigest md = null;
try {
// first create an instance, given the provider
md = MessageDigest.getInstance(algorithm);
} catch (Exception e) {
System.err.print("Exception: " + e);
return password;
}
md.reset();
// call the update method one or more times
// (useful when you don't know the size of your data, eg. stream)
md.update(unencodedPassword);
// now calculate the hash
byte[] encodedPassword = md.digest();
StringBuilder buf = new StringBuilder();
for (int i = 0; i < encodedPassword.length; i++) {
if (((int) encodedPassword[i] & 0xff) < 0x10) {
buf.append("0");
}
buf.append(Long.toString((int) encodedPassword[i] & 0xff, 16));
}
return buf.toString();
} }
|
public class class_name {
public static String encodePassword(String password, String algorithm) {
byte[] unencodedPassword = password.getBytes();
MessageDigest md = null;
try {
// first create an instance, given the provider
md = MessageDigest.getInstance(algorithm);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
System.err.print("Exception: " + e);
return password;
}
// depends on control dependency: [catch], data = [none]
md.reset();
// call the update method one or more times
// (useful when you don't know the size of your data, eg. stream)
md.update(unencodedPassword);
// now calculate the hash
byte[] encodedPassword = md.digest();
StringBuilder buf = new StringBuilder();
for (int i = 0; i < encodedPassword.length; i++) {
if (((int) encodedPassword[i] & 0xff) < 0x10) {
buf.append("0");
// depends on control dependency: [if], data = [none]
}
buf.append(Long.toString((int) encodedPassword[i] & 0xff, 16));
// depends on control dependency: [for], data = [i]
}
return buf.toString();
} }
|
public class class_name {
public KeyArea setupKey(int iKeyArea)
{
KeyArea keyArea = null;
if (iKeyArea == 0)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY);
keyArea.addKeyField(ID, DBConstants.ASCENDING);
}
if (iKeyArea == 1)
{
keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, FIELD_FILE_NAME_KEY);
keyArea.addKeyField(FIELD_FILE_NAME, DBConstants.ASCENDING);
keyArea.addKeyField(FIELD_SEQ_NO, DBConstants.ASCENDING);
}
if (iKeyArea == 2)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, FIELD_NAME_KEY);
keyArea.addKeyField(FIELD_FILE_NAME, DBConstants.ASCENDING);
keyArea.addKeyField(FIELD_NAME, DBConstants.ASCENDING);
}
if (keyArea == null)
keyArea = super.setupKey(iKeyArea);
return keyArea;
} }
|
public class class_name {
public KeyArea setupKey(int iKeyArea)
{
KeyArea keyArea = null;
if (iKeyArea == 0)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (iKeyArea == 1)
{
keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, FIELD_FILE_NAME_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(FIELD_FILE_NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(FIELD_SEQ_NO, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (iKeyArea == 2)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, FIELD_NAME_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(FIELD_FILE_NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(FIELD_NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (keyArea == null)
keyArea = super.setupKey(iKeyArea);
return keyArea;
} }
|
public class class_name {
private void encodeGeneration(CodeAssembler a, LocalVariable encodedVar,
int offset, int generation)
{
if (offset < 0) {
throw new IllegalArgumentException();
}
if (generation < 0) {
return;
}
if (generation < 128) {
a.loadLocal(encodedVar);
a.loadConstant(offset);
a.loadConstant((byte) generation);
a.storeToArray(TypeDesc.BYTE);
} else {
generation |= 0x80000000;
for (int i=0; i<4; i++) {
a.loadLocal(encodedVar);
a.loadConstant(offset + i);
a.loadConstant((byte) (generation >> (8 * (3 - i))));
a.storeToArray(TypeDesc.BYTE);
}
}
} }
|
public class class_name {
private void encodeGeneration(CodeAssembler a, LocalVariable encodedVar,
int offset, int generation)
{
if (offset < 0) {
throw new IllegalArgumentException();
}
if (generation < 0) {
return;
// depends on control dependency: [if], data = [none]
}
if (generation < 128) {
a.loadLocal(encodedVar);
// depends on control dependency: [if], data = [none]
a.loadConstant(offset);
// depends on control dependency: [if], data = [none]
a.loadConstant((byte) generation);
// depends on control dependency: [if], data = [none]
a.storeToArray(TypeDesc.BYTE);
// depends on control dependency: [if], data = [none]
} else {
generation |= 0x80000000;
// depends on control dependency: [if], data = [none]
for (int i=0; i<4; i++) {
a.loadLocal(encodedVar);
// depends on control dependency: [for], data = [none]
a.loadConstant(offset + i);
// depends on control dependency: [for], data = [i]
a.loadConstant((byte) (generation >> (8 * (3 - i))));
// depends on control dependency: [for], data = [i]
a.storeToArray(TypeDesc.BYTE);
// depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if (mSelection != null && which < mSelection.length) {
mSelection[which] = isChecked;
List<String> selected = getSelectedStrings();
mProxyAdapter.clear();
mProxyAdapter.add(mHelper.sumUpCircles(selected));
setSelection(0);
if (mListener != null) {
String item = mItems[which];
if (isChecked) {
mListener.onItemAdded(item);
} else {
mListener.onItemRemoved(item);
}
}
} else {
throw new IllegalArgumentException("Argument 'which' is out of bounds.");
}
} }
|
public class class_name {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if (mSelection != null && which < mSelection.length) {
mSelection[which] = isChecked; // depends on control dependency: [if], data = [none]
List<String> selected = getSelectedStrings();
mProxyAdapter.clear(); // depends on control dependency: [if], data = [none]
mProxyAdapter.add(mHelper.sumUpCircles(selected)); // depends on control dependency: [if], data = [none]
setSelection(0); // depends on control dependency: [if], data = [none]
if (mListener != null) {
String item = mItems[which];
if (isChecked) {
mListener.onItemAdded(item); // depends on control dependency: [if], data = [none]
} else {
mListener.onItemRemoved(item); // depends on control dependency: [if], data = [none]
}
}
} else {
throw new IllegalArgumentException("Argument 'which' is out of bounds.");
}
} }
|
public class class_name {
static <T extends Comparable<? super T>> int binarySearch(final List<? extends T> list, final T key) {
if (N.isNullOrEmpty(list)) {
return N.INDEX_NOT_FOUND;
}
return binarySearch(list, 0, list.size(), key);
} }
|
public class class_name {
static <T extends Comparable<? super T>> int binarySearch(final List<? extends T> list, final T key) {
if (N.isNullOrEmpty(list)) {
return N.INDEX_NOT_FOUND;
// depends on control dependency: [if], data = [none]
}
return binarySearch(list, 0, list.size(), key);
} }
|
public class class_name {
public static Set<String> getContributors(Set<String> baseContributors, ProbeTest methodAnnotation, ProbeTestClass classAnnotation) {
Set<String> contributors;
if (baseContributors == null) {
contributors = new HashSet<>();
}
else {
contributors = populateContributors(baseContributors, new HashSet<String>());
}
if (classAnnotation != null && classAnnotation.contributors() != null) {
contributors = populateContributors(new HashSet<>(Arrays.asList(classAnnotation.contributors())), contributors);
}
if (methodAnnotation != null && methodAnnotation.contributors() != null) {
contributors = populateContributors(new HashSet<>(Arrays.asList(methodAnnotation.contributors())), contributors);
}
return contributors;
} }
|
public class class_name {
public static Set<String> getContributors(Set<String> baseContributors, ProbeTest methodAnnotation, ProbeTestClass classAnnotation) {
Set<String> contributors;
if (baseContributors == null) {
contributors = new HashSet<>(); // depends on control dependency: [if], data = [none]
}
else {
contributors = populateContributors(baseContributors, new HashSet<String>()); // depends on control dependency: [if], data = [(baseContributors]
}
if (classAnnotation != null && classAnnotation.contributors() != null) {
contributors = populateContributors(new HashSet<>(Arrays.asList(classAnnotation.contributors())), contributors); // depends on control dependency: [if], data = [(classAnnotation]
}
if (methodAnnotation != null && methodAnnotation.contributors() != null) {
contributors = populateContributors(new HashSet<>(Arrays.asList(methodAnnotation.contributors())), contributors); // depends on control dependency: [if], data = [(methodAnnotation]
}
return contributors;
} }
|
public class class_name {
private void parseNth() {
// Remove all '+' and spaces.
String str = argument.replaceAll("\\+|\\s+", "");
if ("odd".equals(str)) {
a = 2;
b = 1;
} else if ("even".equals(str)) {
a = 2;
} else {
int n = str.indexOf('n');
if (n != -1) {
if (n == 0) {
a = 1;
} else if (n == 1 && str.charAt(0) == '-') {
a = -1;
} else {
a = Integer.parseInt(str.substring(0, n));
}
if ((n + 1) != str.length()) {
b = Integer.parseInt(str.substring(n + 1, str.length()));
}
} else {
b = Integer.parseInt(str);
}
}
} }
|
public class class_name {
private void parseNth() {
// Remove all '+' and spaces.
String str = argument.replaceAll("\\+|\\s+", "");
if ("odd".equals(str)) {
a = 2;
// depends on control dependency: [if], data = [none]
b = 1;
// depends on control dependency: [if], data = [none]
} else if ("even".equals(str)) {
a = 2;
// depends on control dependency: [if], data = [none]
} else {
int n = str.indexOf('n');
if (n != -1) {
if (n == 0) {
a = 1;
// depends on control dependency: [if], data = [none]
} else if (n == 1 && str.charAt(0) == '-') {
a = -1;
// depends on control dependency: [if], data = [none]
} else {
a = Integer.parseInt(str.substring(0, n));
// depends on control dependency: [if], data = [none]
}
if ((n + 1) != str.length()) {
b = Integer.parseInt(str.substring(n + 1, str.length()));
// depends on control dependency: [if], data = [str.length())]
}
} else {
b = Integer.parseInt(str);
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void marshall(DescribeReplicationInstanceTaskLogsRequest describeReplicationInstanceTaskLogsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeReplicationInstanceTaskLogsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeReplicationInstanceTaskLogsRequest.getReplicationInstanceArn(), REPLICATIONINSTANCEARN_BINDING);
protocolMarshaller.marshall(describeReplicationInstanceTaskLogsRequest.getMaxRecords(), MAXRECORDS_BINDING);
protocolMarshaller.marshall(describeReplicationInstanceTaskLogsRequest.getMarker(), MARKER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeReplicationInstanceTaskLogsRequest describeReplicationInstanceTaskLogsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeReplicationInstanceTaskLogsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeReplicationInstanceTaskLogsRequest.getReplicationInstanceArn(), REPLICATIONINSTANCEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeReplicationInstanceTaskLogsRequest.getMaxRecords(), MAXRECORDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeReplicationInstanceTaskLogsRequest.getMarker(), MARKER_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void storeDataSource(DataSource ds, XMLStreamWriter writer) throws Exception
{
writer.writeStartElement(XML.ELEMENT_DATASOURCE);
if (ds.isJTA() != null && (ds.hasExpression(XML.ATTRIBUTE_JTA) ||
!Defaults.JTA.equals(ds.isJTA())))
writer.writeAttribute(XML.ATTRIBUTE_JTA,
ds.getValue(XML.ATTRIBUTE_JTA, ds.isJTA().toString()));
if (ds.getJndiName() != null)
writer.writeAttribute(XML.ATTRIBUTE_JNDI_NAME,
ds.getValue(XML.ATTRIBUTE_JNDI_NAME, ds.getJndiName()));
if (ds.getId() != null)
writer.writeAttribute(XML.ATTRIBUTE_ID,
ds.getValue(XML.ATTRIBUTE_ID, ds.getId()));
if (ds.isEnabled() != null && (ds.hasExpression(XML.ATTRIBUTE_ENABLED) ||
!Defaults.ENABLED.equals(ds.isEnabled())))
writer.writeAttribute(XML.ATTRIBUTE_ENABLED,
ds.getValue(XML.ATTRIBUTE_ENABLED, ds.isEnabled().toString()));
if (ds.isSpy() != null && (ds.hasExpression(XML.ATTRIBUTE_SPY) ||
!Defaults.SPY.equals(ds.isSpy())))
writer.writeAttribute(XML.ATTRIBUTE_SPY,
ds.getValue(XML.ATTRIBUTE_SPY, ds.isSpy().toString()));
if (ds.isUseCcm() != null && (ds.hasExpression(XML.ATTRIBUTE_USE_CCM) ||
!Defaults.USE_CCM.equals(ds.isUseCcm())))
writer.writeAttribute(XML.ATTRIBUTE_USE_CCM,
ds.getValue(XML.ATTRIBUTE_USE_CCM, ds.isUseCcm().toString()));
if (ds.isConnectable() != null && (ds.hasExpression(XML.ATTRIBUTE_CONNECTABLE) ||
!Defaults.CONNECTABLE.equals(ds.isConnectable())))
writer.writeAttribute(XML.ATTRIBUTE_CONNECTABLE,
ds.getValue(XML.ATTRIBUTE_CONNECTABLE, ds.isConnectable().toString()));
if (ds.isTracking() != null)
writer.writeAttribute(XML.ATTRIBUTE_TRACKING,
ds.getValue(XML.ATTRIBUTE_TRACKING, ds.isTracking().toString()));
if (ds.getConnectionUrl() != null)
{
writer.writeStartElement(XML.ELEMENT_CONNECTION_URL);
writer.writeCharacters(ds.getValue(XML.ELEMENT_CONNECTION_URL, ds.getConnectionUrl()));
writer.writeEndElement();
}
if (ds.getDriverClass() != null)
{
writer.writeStartElement(XML.ELEMENT_DRIVER_CLASS);
writer.writeCharacters(ds.getValue(XML.ELEMENT_DRIVER_CLASS, ds.getDriverClass()));
writer.writeEndElement();
}
if (ds.getDataSourceClass() != null)
{
writer.writeStartElement(XML.ELEMENT_DATASOURCE_CLASS);
writer.writeCharacters(ds.getValue(XML.ELEMENT_DATASOURCE_CLASS, ds.getDataSourceClass()));
writer.writeEndElement();
}
if (ds.getDriver() != null)
{
writer.writeStartElement(XML.ELEMENT_DRIVER);
writer.writeCharacters(ds.getValue(XML.ELEMENT_DRIVER, ds.getDriver()));
writer.writeEndElement();
}
if (ds.getConnectionProperties() != null && !ds.getConnectionProperties().isEmpty())
{
Iterator<Map.Entry<String, String>> it = ds.getConnectionProperties().entrySet().iterator();
while (it.hasNext())
{
Map.Entry<String, String> entry = it.next();
writer.writeStartElement(XML.ELEMENT_CONNECTION_PROPERTY);
writer.writeAttribute(XML.ATTRIBUTE_NAME, entry.getKey());
writer.writeCharacters(ds.getValue(XML.ELEMENT_CONNECTION_PROPERTY, entry.getKey(), entry.getValue()));
writer.writeEndElement();
}
}
if (ds.getNewConnectionSql() != null)
{
writer.writeStartElement(XML.ELEMENT_NEW_CONNECTION_SQL);
writer.writeCharacters(ds.getValue(XML.ELEMENT_NEW_CONNECTION_SQL, ds.getNewConnectionSql()));
writer.writeEndElement();
}
if (ds.getTransactionIsolation() != null)
{
writer.writeStartElement(XML.ELEMENT_TRANSACTION_ISOLATION);
writer.writeCharacters(ds.getValue(XML.ELEMENT_TRANSACTION_ISOLATION,
ds.getTransactionIsolation().toString()));
writer.writeEndElement();
}
if (ds.getUrlDelimiter() != null)
{
writer.writeStartElement(XML.ELEMENT_URL_DELIMITER);
writer.writeCharacters(ds.getValue(XML.ELEMENT_URL_DELIMITER, ds.getUrlDelimiter()));
writer.writeEndElement();
}
if (ds.getUrlSelectorStrategyClassName() != null)
{
writer.writeStartElement(XML.ELEMENT_URL_SELECTOR_STRATEGY_CLASS_NAME);
writer.writeCharacters(ds.getValue(XML.ELEMENT_URL_SELECTOR_STRATEGY_CLASS_NAME,
ds.getUrlSelectorStrategyClassName()));
writer.writeEndElement();
}
if (ds.getPool() != null)
storePool(ds.getPool(), writer);
if (ds.getSecurity() != null)
storeSecurity(ds.getSecurity(), writer);
if (ds.getValidation() != null)
storeValidation(ds.getValidation(), writer);
if (ds.getTimeout() != null)
storeTimeout(ds.getTimeout(), writer);
if (ds.getStatement() != null)
storeStatement(ds.getStatement(), writer);
writer.writeEndElement();
} }
|
public class class_name {
protected void storeDataSource(DataSource ds, XMLStreamWriter writer) throws Exception
{
writer.writeStartElement(XML.ELEMENT_DATASOURCE);
if (ds.isJTA() != null && (ds.hasExpression(XML.ATTRIBUTE_JTA) ||
!Defaults.JTA.equals(ds.isJTA())))
writer.writeAttribute(XML.ATTRIBUTE_JTA,
ds.getValue(XML.ATTRIBUTE_JTA, ds.isJTA().toString()));
if (ds.getJndiName() != null)
writer.writeAttribute(XML.ATTRIBUTE_JNDI_NAME,
ds.getValue(XML.ATTRIBUTE_JNDI_NAME, ds.getJndiName()));
if (ds.getId() != null)
writer.writeAttribute(XML.ATTRIBUTE_ID,
ds.getValue(XML.ATTRIBUTE_ID, ds.getId()));
if (ds.isEnabled() != null && (ds.hasExpression(XML.ATTRIBUTE_ENABLED) ||
!Defaults.ENABLED.equals(ds.isEnabled())))
writer.writeAttribute(XML.ATTRIBUTE_ENABLED,
ds.getValue(XML.ATTRIBUTE_ENABLED, ds.isEnabled().toString()));
if (ds.isSpy() != null && (ds.hasExpression(XML.ATTRIBUTE_SPY) ||
!Defaults.SPY.equals(ds.isSpy())))
writer.writeAttribute(XML.ATTRIBUTE_SPY,
ds.getValue(XML.ATTRIBUTE_SPY, ds.isSpy().toString()));
if (ds.isUseCcm() != null && (ds.hasExpression(XML.ATTRIBUTE_USE_CCM) ||
!Defaults.USE_CCM.equals(ds.isUseCcm())))
writer.writeAttribute(XML.ATTRIBUTE_USE_CCM,
ds.getValue(XML.ATTRIBUTE_USE_CCM, ds.isUseCcm().toString()));
if (ds.isConnectable() != null && (ds.hasExpression(XML.ATTRIBUTE_CONNECTABLE) ||
!Defaults.CONNECTABLE.equals(ds.isConnectable())))
writer.writeAttribute(XML.ATTRIBUTE_CONNECTABLE,
ds.getValue(XML.ATTRIBUTE_CONNECTABLE, ds.isConnectable().toString()));
if (ds.isTracking() != null)
writer.writeAttribute(XML.ATTRIBUTE_TRACKING,
ds.getValue(XML.ATTRIBUTE_TRACKING, ds.isTracking().toString()));
if (ds.getConnectionUrl() != null)
{
writer.writeStartElement(XML.ELEMENT_CONNECTION_URL);
writer.writeCharacters(ds.getValue(XML.ELEMENT_CONNECTION_URL, ds.getConnectionUrl()));
writer.writeEndElement();
}
if (ds.getDriverClass() != null)
{
writer.writeStartElement(XML.ELEMENT_DRIVER_CLASS);
writer.writeCharacters(ds.getValue(XML.ELEMENT_DRIVER_CLASS, ds.getDriverClass()));
writer.writeEndElement();
}
if (ds.getDataSourceClass() != null)
{
writer.writeStartElement(XML.ELEMENT_DATASOURCE_CLASS);
writer.writeCharacters(ds.getValue(XML.ELEMENT_DATASOURCE_CLASS, ds.getDataSourceClass()));
writer.writeEndElement();
}
if (ds.getDriver() != null)
{
writer.writeStartElement(XML.ELEMENT_DRIVER);
writer.writeCharacters(ds.getValue(XML.ELEMENT_DRIVER, ds.getDriver()));
writer.writeEndElement();
}
if (ds.getConnectionProperties() != null && !ds.getConnectionProperties().isEmpty())
{
Iterator<Map.Entry<String, String>> it = ds.getConnectionProperties().entrySet().iterator();
while (it.hasNext())
{
Map.Entry<String, String> entry = it.next();
writer.writeStartElement(XML.ELEMENT_CONNECTION_PROPERTY); // depends on control dependency: [while], data = [none]
writer.writeAttribute(XML.ATTRIBUTE_NAME, entry.getKey()); // depends on control dependency: [while], data = [none]
writer.writeCharacters(ds.getValue(XML.ELEMENT_CONNECTION_PROPERTY, entry.getKey(), entry.getValue())); // depends on control dependency: [while], data = [none]
writer.writeEndElement(); // depends on control dependency: [while], data = [none]
}
}
if (ds.getNewConnectionSql() != null)
{
writer.writeStartElement(XML.ELEMENT_NEW_CONNECTION_SQL);
writer.writeCharacters(ds.getValue(XML.ELEMENT_NEW_CONNECTION_SQL, ds.getNewConnectionSql()));
writer.writeEndElement();
}
if (ds.getTransactionIsolation() != null)
{
writer.writeStartElement(XML.ELEMENT_TRANSACTION_ISOLATION);
writer.writeCharacters(ds.getValue(XML.ELEMENT_TRANSACTION_ISOLATION,
ds.getTransactionIsolation().toString()));
writer.writeEndElement();
}
if (ds.getUrlDelimiter() != null)
{
writer.writeStartElement(XML.ELEMENT_URL_DELIMITER);
writer.writeCharacters(ds.getValue(XML.ELEMENT_URL_DELIMITER, ds.getUrlDelimiter()));
writer.writeEndElement();
}
if (ds.getUrlSelectorStrategyClassName() != null)
{
writer.writeStartElement(XML.ELEMENT_URL_SELECTOR_STRATEGY_CLASS_NAME);
writer.writeCharacters(ds.getValue(XML.ELEMENT_URL_SELECTOR_STRATEGY_CLASS_NAME,
ds.getUrlSelectorStrategyClassName()));
writer.writeEndElement();
}
if (ds.getPool() != null)
storePool(ds.getPool(), writer);
if (ds.getSecurity() != null)
storeSecurity(ds.getSecurity(), writer);
if (ds.getValidation() != null)
storeValidation(ds.getValidation(), writer);
if (ds.getTimeout() != null)
storeTimeout(ds.getTimeout(), writer);
if (ds.getStatement() != null)
storeStatement(ds.getStatement(), writer);
writer.writeEndElement();
} }
|
public class class_name {
private ThreadContextDescriptor captureThreadContext(Map<String, String> execProps, Object task, Set<String> internalNames,
Map<String, ?>... additionalThreadContextConfig) {
execProps = execProps == null ? new TreeMap<String, String>() : new TreeMap<String, String>(execProps);
if (internalNames == null || !execProps.containsKey(TASK_OWNER)) {
execProps.put(TASK_OWNER, name);
if (internalNames != null)
internalNames.add(TASK_OWNER);
}
if (task != null && (internalNames == null || !execProps.containsKey(ManagedTask.IDENTITY_NAME))) {
execProps.put(ManagedTask.IDENTITY_NAME, task.getClass().getName());
if (internalNames != null)
internalNames.add(ManagedTask.IDENTITY_NAME);
}
lock.readLock().lock();
try {
if (threadContextConfigurations == null) {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
try {
if (threadContextConfigurations == null)
init();
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
}
Map<String, Map<String, ?>> threadContextConfig = threadContextConfigurations;
if (additionalThreadContextConfig != null && additionalThreadContextConfig.length > 0) {
threadContextConfig = new HashMap<String, Map<String, ?>>();
threadContextConfig.putAll(threadContextConfigurations);
for (Map<String, ?> config : additionalThreadContextConfig) {
String providerName = (String) config.get(THREAD_CONTEXT_PROVIDER);
if (providerName == null)
throw new IllegalArgumentException("additionalThreadContextConfig: " + config.toString());
threadContextConfig.put(providerName, config);
}
}
return threadContextMgr.captureThreadContext(threadContextConfig, execProps);
} finally {
lock.readLock().unlock();
}
} }
|
public class class_name {
private ThreadContextDescriptor captureThreadContext(Map<String, String> execProps, Object task, Set<String> internalNames,
Map<String, ?>... additionalThreadContextConfig) {
execProps = execProps == null ? new TreeMap<String, String>() : new TreeMap<String, String>(execProps);
if (internalNames == null || !execProps.containsKey(TASK_OWNER)) {
execProps.put(TASK_OWNER, name); // depends on control dependency: [if], data = [none]
if (internalNames != null)
internalNames.add(TASK_OWNER);
}
if (task != null && (internalNames == null || !execProps.containsKey(ManagedTask.IDENTITY_NAME))) {
execProps.put(ManagedTask.IDENTITY_NAME, task.getClass().getName()); // depends on control dependency: [if], data = [none]
if (internalNames != null)
internalNames.add(ManagedTask.IDENTITY_NAME);
}
lock.readLock().lock();
try {
if (threadContextConfigurations == null) {
// Switch to write lock for lazy initialization
lock.readLock().unlock(); // depends on control dependency: [if], data = [none]
lock.writeLock().lock(); // depends on control dependency: [if], data = [none]
try {
if (threadContextConfigurations == null)
init();
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
}
Map<String, Map<String, ?>> threadContextConfig = threadContextConfigurations; // depends on control dependency: [try], data = [none]
if (additionalThreadContextConfig != null && additionalThreadContextConfig.length > 0) {
threadContextConfig = new HashMap<String, Map<String, ?>>();
threadContextConfig.putAll(threadContextConfigurations); // depends on control dependency: [if], data = [none]
for (Map<String, ?> config : additionalThreadContextConfig) {
String providerName = (String) config.get(THREAD_CONTEXT_PROVIDER);
if (providerName == null)
throw new IllegalArgumentException("additionalThreadContextConfig: " + config.toString());
threadContextConfig.put(providerName, config); // depends on control dependency: [for], data = [config]
}
}
return threadContextMgr.captureThreadContext(threadContextConfig, execProps); // depends on control dependency: [try], data = [none]
} finally {
lock.readLock().unlock();
}
} }
|
public class class_name {
@Override
public synchronized IChemObject readRecord(int record) throws Exception {
String buffer = readContent(record);
if (chemObjectReader == null)
throw new CDKException("No chemobject reader!");
else {
chemObjectReader.setReader(new StringReader(buffer));
currentRecord = record;
return processContent();
}
} }
|
public class class_name {
@Override
public synchronized IChemObject readRecord(int record) throws Exception {
String buffer = readContent(record);
if (chemObjectReader == null)
throw new CDKException("No chemobject reader!");
else {
chemObjectReader.setReader(new StringReader(buffer)); // depends on control dependency: [if], data = [none]
currentRecord = record; // depends on control dependency: [if], data = [none]
return processContent(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Observable<ServiceResponse<Void>> syncStorageKeysWithServiceResponseAsync(String resourceGroupName, String mediaServiceName, String id) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (mediaServiceName == null) {
throw new IllegalArgumentException("Parameter mediaServiceName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (id == null) {
throw new IllegalArgumentException("Parameter id is required and cannot be null.");
}
SyncStorageKeysInput parameters = new SyncStorageKeysInput();
parameters.withId(id);
return service.syncStorageKeys(this.client.subscriptionId(), resourceGroupName, mediaServiceName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = syncStorageKeysDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Void>> syncStorageKeysWithServiceResponseAsync(String resourceGroupName, String mediaServiceName, String id) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (mediaServiceName == null) {
throw new IllegalArgumentException("Parameter mediaServiceName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (id == null) {
throw new IllegalArgumentException("Parameter id is required and cannot be null.");
}
SyncStorageKeysInput parameters = new SyncStorageKeysInput();
parameters.withId(id);
return service.syncStorageKeys(this.client.subscriptionId(), resourceGroupName, mediaServiceName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = syncStorageKeysDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
<T> InternalProviderImpl<? extends T> lookupProvider(Class<T> clazz, String bindingName) {
if (clazz == null) {
throw new IllegalArgumentException("TP can't get an instance of a null class.");
}
InternalProviderImpl<? extends T> scopedProvider = getBoundProvider(clazz, bindingName);
if (scopedProvider != null) {
return scopedProvider;
}
Iterator<ScopeNode> iterator = parentScopes.iterator();
while (iterator.hasNext()) {
Scope parentScope = iterator.next();
ScopeImpl parentScopeImpl = (ScopeImpl) parentScope;
InternalProviderImpl<? extends T> parentScopedProvider = parentScopeImpl.getBoundProvider(clazz, bindingName);
if (parentScopedProvider != null) {
return parentScopedProvider;
}
}
//if the binding is named
//we couldn't find it in any scope, we must fail
//as only unnamed bindings can be created dynamically
if (bindingName != null) {
throw new RuntimeException(format("No binding was defined for class %s and name %s " //
+ "in scope %s and its parents %s", clazz.getName(), bindingName, getName(), getParentScopesNames()));
}
//we now look for an unnamed binding
//bindingName = null; <-- valid but fails checkstyle as we use null directly
//check if we have a cached un-scoped provider
InternalProviderImpl unScopedProviderInPool = getUnBoundProvider(clazz, null);
if (unScopedProviderInPool != null) {
return unScopedProviderInPool;
}
//classes discovered at runtime, not bound by any module
//they will be a bit slower as we need to get the factory first
//we need to know whether they are scoped or not, if so we scope them
//if not, they are place in the pool
Factory<T> factory = FactoryLocator.getFactory(clazz);
if (factory.hasScopeAnnotation()) {
//the new provider will have to work in the current scope
Scope targetScope = factory.getTargetScope(this);
ScopedProviderImpl<? extends T> newProvider = new ScopedProviderImpl<>(targetScope, factory, false);
//it is bound to its target scope only if it has a scope annotation.
//lock free installing a provider means there could have been one set concurrently since last testing
//its value. We allow to return it here
ScopeImpl targetScopeImpl = (ScopeImpl) targetScope;
return targetScopeImpl.installScopedProvider(clazz, null, newProvider, false);
} else {
//the provider is but in a pool of unbound providers for later reuse
final InternalProviderImpl<T> newProvider = new InternalProviderImpl<>(factory,
false);
//the pool is static as it is accessible from all scopes
//lock free installing a provider means there could have been one set concurrently since last testing
//its value. We allow to return it here
return installUnBoundProvider(clazz, null, newProvider);
}
} }
|
public class class_name {
<T> InternalProviderImpl<? extends T> lookupProvider(Class<T> clazz, String bindingName) {
if (clazz == null) {
throw new IllegalArgumentException("TP can't get an instance of a null class.");
}
InternalProviderImpl<? extends T> scopedProvider = getBoundProvider(clazz, bindingName);
if (scopedProvider != null) {
return scopedProvider;
}
Iterator<ScopeNode> iterator = parentScopes.iterator();
while (iterator.hasNext()) {
Scope parentScope = iterator.next();
ScopeImpl parentScopeImpl = (ScopeImpl) parentScope;
InternalProviderImpl<? extends T> parentScopedProvider = parentScopeImpl.getBoundProvider(clazz, bindingName);
if (parentScopedProvider != null) {
return parentScopedProvider;
}
}
//if the binding is named
//we couldn't find it in any scope, we must fail
//as only unnamed bindings can be created dynamically
if (bindingName != null) {
throw new RuntimeException(format("No binding was defined for class %s and name %s " //
+ "in scope %s and its parents %s", clazz.getName(), bindingName, getName(), getParentScopesNames()));
}
//we now look for an unnamed binding
//bindingName = null; <-- valid but fails checkstyle as we use null directly
//check if we have a cached un-scoped provider
InternalProviderImpl unScopedProviderInPool = getUnBoundProvider(clazz, null);
if (unScopedProviderInPool != null) {
return unScopedProviderInPool; // depends on control dependency: [if], data = [none]
}
//classes discovered at runtime, not bound by any module
//they will be a bit slower as we need to get the factory first
//we need to know whether they are scoped or not, if so we scope them
//if not, they are place in the pool
Factory<T> factory = FactoryLocator.getFactory(clazz);
if (factory.hasScopeAnnotation()) {
//the new provider will have to work in the current scope
Scope targetScope = factory.getTargetScope(this);
ScopedProviderImpl<? extends T> newProvider = new ScopedProviderImpl<>(targetScope, factory, false); // depends on control dependency: [if], data = [none]
//it is bound to its target scope only if it has a scope annotation.
//lock free installing a provider means there could have been one set concurrently since last testing
//its value. We allow to return it here
ScopeImpl targetScopeImpl = (ScopeImpl) targetScope;
return targetScopeImpl.installScopedProvider(clazz, null, newProvider, false); // depends on control dependency: [if], data = [none]
} else {
//the provider is but in a pool of unbound providers for later reuse
final InternalProviderImpl<T> newProvider = new InternalProviderImpl<>(factory,
false);
//the pool is static as it is accessible from all scopes
//lock free installing a provider means there could have been one set concurrently since last testing
//its value. We allow to return it here
return installUnBoundProvider(clazz, null, newProvider); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Set<Node> getGroupsForUser(Node user) {
Set<Node> groups = new TreeSet<>();
try {
String query = "(& (objectClass=" + groupObjectClass + ") (" + groupMemberAttribut + "=" + ((LdapUser) user).getDn() + "))";
SearchResult searchResult;
Attributes attributes;
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration<SearchResult> results = ctx.search("", query, controls);
queryCount++;
Node group;
while (results.hasMore()) {
searchResult = results.next();
attributes = searchResult.getAttributes();
group = getGroup(getAttributeOrNa(attributes, groupIdentifyer));
group.setDn(searchResult.getNameInNamespace());
groups.add(group);
}
} catch (NamingException ex) {
handleNamingException(user, ex);
}
return groups;
} }
|
public class class_name {
@Override
public Set<Node> getGroupsForUser(Node user) {
Set<Node> groups = new TreeSet<>();
try {
String query = "(& (objectClass=" + groupObjectClass + ") (" + groupMemberAttribut + "=" + ((LdapUser) user).getDn() + "))";
SearchResult searchResult;
Attributes attributes;
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE); // depends on control dependency: [try], data = [none]
NamingEnumeration<SearchResult> results = ctx.search("", query, controls);
queryCount++; // depends on control dependency: [try], data = [none]
Node group;
while (results.hasMore()) {
searchResult = results.next(); // depends on control dependency: [while], data = [none]
attributes = searchResult.getAttributes(); // depends on control dependency: [while], data = [none]
group = getGroup(getAttributeOrNa(attributes, groupIdentifyer)); // depends on control dependency: [while], data = [none]
group.setDn(searchResult.getNameInNamespace()); // depends on control dependency: [while], data = [none]
groups.add(group); // depends on control dependency: [while], data = [none]
}
} catch (NamingException ex) {
handleNamingException(user, ex);
} // depends on control dependency: [catch], data = [none]
return groups;
} }
|
public class class_name {
private void parseFeaturesMetadata(JsonParser jp) throws IOException, SQLException {
jp.nextToken(); // FIELD_NAME features
// Passes all the properties until "Feature" object is found
while(!jp.getText().equalsIgnoreCase(GeoJsonField.FEATURES) &&
!jp.getText().equalsIgnoreCase(GeoJsonField.CRS)){
jp.nextToken();
if(jp.getCurrentToken().equals(JsonToken.START_ARRAY) || jp.getCurrentToken().equals(JsonToken.START_OBJECT)){
jp.skipChildren();
}
jp.nextToken();
}
if(jp.getText().equalsIgnoreCase(GeoJsonField.CRS)){
parsedSRID = readCRS(jp);
}
if (jp.getText().equalsIgnoreCase(GeoJsonField.FEATURES)) {
jp.nextToken(); // START_ARRAY [
JsonToken token = jp.nextToken(); // START_OBJECT {
while (token != JsonToken.END_ARRAY) {
jp.nextToken(); // FIELD_NAME type
jp.nextToken(); // VALUE_STRING Feature
String geomType = jp.getText();
if (geomType.equalsIgnoreCase(GeoJsonField.FEATURE)) {
if (progress.isCanceled()) {
throw new SQLException("Canceled by user");
}
parseFeatureMetadata(jp);
token = jp.nextToken(); //START_OBJECT new feature
featureCounter++;
if (nodeCountProgress++ % readFileSizeEachNode == 0) {
// Update Progress
try {
progress.setStep((int) (((double) fc.position() / fileSize) * 100));
} catch (IOException ex) {
// Ignore
}
}
} else {
throw new SQLException("Malformed GeoJSON file. Expected 'Feature', found '" + geomType + "'");
}
}
//LOOP END_ARRAY ]
} else {
throw new SQLException("Malformed GeoJSON file. Expected 'features', found '" + jp.getText() + "'");
}
} }
|
public class class_name {
private void parseFeaturesMetadata(JsonParser jp) throws IOException, SQLException {
jp.nextToken(); // FIELD_NAME features
// Passes all the properties until "Feature" object is found
while(!jp.getText().equalsIgnoreCase(GeoJsonField.FEATURES) &&
!jp.getText().equalsIgnoreCase(GeoJsonField.CRS)){
jp.nextToken();
if(jp.getCurrentToken().equals(JsonToken.START_ARRAY) || jp.getCurrentToken().equals(JsonToken.START_OBJECT)){
jp.skipChildren(); // depends on control dependency: [if], data = [none]
}
jp.nextToken();
}
if(jp.getText().equalsIgnoreCase(GeoJsonField.CRS)){
parsedSRID = readCRS(jp);
}
if (jp.getText().equalsIgnoreCase(GeoJsonField.FEATURES)) {
jp.nextToken(); // START_ARRAY [
JsonToken token = jp.nextToken(); // START_OBJECT {
while (token != JsonToken.END_ARRAY) {
jp.nextToken(); // FIELD_NAME type // depends on control dependency: [while], data = [none]
jp.nextToken(); // VALUE_STRING Feature // depends on control dependency: [while], data = [none]
String geomType = jp.getText();
if (geomType.equalsIgnoreCase(GeoJsonField.FEATURE)) {
if (progress.isCanceled()) {
throw new SQLException("Canceled by user");
}
parseFeatureMetadata(jp); // depends on control dependency: [if], data = [none]
token = jp.nextToken(); //START_OBJECT new feature // depends on control dependency: [if], data = [none]
featureCounter++; // depends on control dependency: [if], data = [none]
if (nodeCountProgress++ % readFileSizeEachNode == 0) {
// Update Progress
try {
progress.setStep((int) (((double) fc.position() / fileSize) * 100)); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
// Ignore
} // depends on control dependency: [catch], data = [none]
}
} else {
throw new SQLException("Malformed GeoJSON file. Expected 'Feature', found '" + geomType + "'");
}
}
//LOOP END_ARRAY ]
} else {
throw new SQLException("Malformed GeoJSON file. Expected 'features', found '" + jp.getText() + "'");
}
} }
|
public class class_name {
public void dumpPartitions(List<Partition<T>> partitions) {
int i = 0;
for(Partition<T> partition : partitions) {
i++;
logDates("Partition("+i+")",
partition.getStart(), partition.getEnd());
}
} }
|
public class class_name {
public void dumpPartitions(List<Partition<T>> partitions) {
int i = 0;
for(Partition<T> partition : partitions) {
i++; // depends on control dependency: [for], data = [none]
logDates("Partition("+i+")",
partition.getStart(), partition.getEnd()); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
private Description describe(MethodInvocationTree methodInvocationTree, VisitorState state) {
ExpressionTree receiver = ASTHelpers.getReceiver(methodInvocationTree);
List<? extends ExpressionTree> arguments = methodInvocationTree.getArguments();
ExpressionTree argument;
// .addAll(int, Collection); for the true case
argument = arguments.size() == 2 ? arguments.get(1) : arguments.get(0);
Description.Builder builder = buildDescription(methodInvocationTree);
for (Fix fix : buildFixes(methodInvocationTree, state, receiver, argument)) {
builder.addFix(fix);
}
return builder.build();
} }
|
public class class_name {
private Description describe(MethodInvocationTree methodInvocationTree, VisitorState state) {
ExpressionTree receiver = ASTHelpers.getReceiver(methodInvocationTree);
List<? extends ExpressionTree> arguments = methodInvocationTree.getArguments();
ExpressionTree argument;
// .addAll(int, Collection); for the true case
argument = arguments.size() == 2 ? arguments.get(1) : arguments.get(0);
Description.Builder builder = buildDescription(methodInvocationTree);
for (Fix fix : buildFixes(methodInvocationTree, state, receiver, argument)) {
builder.addFix(fix); // depends on control dependency: [for], data = [fix]
}
return builder.build();
} }
|
public class class_name {
public static MatchResult doMatch(final String requestURI, final String httpMethod) {
MatchResult ret;
final int segs = StringUtils.countMatches(requestURI, "/");
ContextHandlerMeta contextHandlerMeta;
String concreteKey = httpMethod + "." + requestURI;
switch (segs) {
case 1:
contextHandlerMeta = ONE_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
if (null != contextHandlerMeta) {
return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI);
}
switch (httpMethod) {
case "GET":
return route(requestURI, httpMethod, ONE_SEG_GET_VAR_CTX_HANDLER_METAS);
case "POST":
return route(requestURI, httpMethod, ONE_SEG_POST_VAR_CTX_HANDLER_METAS);
case "PUT":
return route(requestURI, httpMethod, ONE_SEG_PUT_VAR_CTX_HANDLER_METAS);
case "DELETE":
return route(requestURI, httpMethod, ONE_SEG_DELETE_VAR_CTX_HANDLER_METAS);
default:
return route(requestURI, httpMethod, ONE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
}
case 2:
contextHandlerMeta = TWO_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
if (null != contextHandlerMeta) {
return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI);
}
switch (httpMethod) {
case "GET":
return route(requestURI, httpMethod, TWO_SEG_GET_VAR_CTX_HANDLER_METAS);
case "POST":
return route(requestURI, httpMethod, TWO_SEG_POST_VAR_CTX_HANDLER_METAS);
case "PUT":
return route(requestURI, httpMethod, TWO_SEG_PUT_VAR_CTX_HANDLER_METAS);
case "DELETE":
return route(requestURI, httpMethod, TWO_SEG_DELETE_VAR_CTX_HANDLER_METAS);
default:
return route(requestURI, httpMethod, TWO_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
}
case 3:
contextHandlerMeta = THREE_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
if (null != contextHandlerMeta) {
return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI);
}
switch (httpMethod) {
case "GET":
return route(requestURI, httpMethod, THREE_SEG_GET_VAR_CTX_HANDLER_METAS);
case "POST":
return route(requestURI, httpMethod, THREE_SEG_POST_VAR_CTX_HANDLER_METAS);
case "PUT":
return route(requestURI, httpMethod, THREE_SEG_PUT_VAR_CTX_HANDLER_METAS);
case "DELETE":
return route(requestURI, httpMethod, THREE_SEG_DELETE_VAR_CTX_HANDLER_METAS);
default:
return route(requestURI, httpMethod, THREE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
}
default:
contextHandlerMeta = FOUR_MORE_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
if (null != contextHandlerMeta) {
return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI);
}
switch (httpMethod) {
case "GET":
return route(requestURI, httpMethod, FOUR_MORE_SEG_GET_VAR_CTX_HANDLER_METAS);
case "POST":
return route(requestURI, httpMethod, FOUR_MORE_SEG_POST_VAR_CTX_HANDLER_METAS);
case "PUT":
return route(requestURI, httpMethod, FOUR_MORE_SEG_PUT_VAR_CTX_HANDLER_METAS);
case "DELETE":
return route(requestURI, httpMethod, FOUR_MORE_SEG_DELETE_VAR_CTX_HANDLER_METAS);
default:
return route(requestURI, httpMethod, FOUR_MORE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
}
}
} }
|
public class class_name {
public static MatchResult doMatch(final String requestURI, final String httpMethod) {
MatchResult ret;
final int segs = StringUtils.countMatches(requestURI, "/");
ContextHandlerMeta contextHandlerMeta;
String concreteKey = httpMethod + "." + requestURI;
switch (segs) {
case 1:
contextHandlerMeta = ONE_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
if (null != contextHandlerMeta) {
return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI); // depends on control dependency: [if], data = [none]
}
switch (httpMethod) {
case "GET":
return route(requestURI, httpMethod, ONE_SEG_GET_VAR_CTX_HANDLER_METAS);
case "POST":
return route(requestURI, httpMethod, ONE_SEG_POST_VAR_CTX_HANDLER_METAS);
case "PUT":
return route(requestURI, httpMethod, ONE_SEG_PUT_VAR_CTX_HANDLER_METAS);
case "DELETE":
return route(requestURI, httpMethod, ONE_SEG_DELETE_VAR_CTX_HANDLER_METAS);
default:
return route(requestURI, httpMethod, ONE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
}
case 2:
contextHandlerMeta = TWO_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
if (null != contextHandlerMeta) {
return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI); // depends on control dependency: [if], data = [none]
}
switch (httpMethod) {
case "GET":
return route(requestURI, httpMethod, TWO_SEG_GET_VAR_CTX_HANDLER_METAS);
case "POST":
return route(requestURI, httpMethod, TWO_SEG_POST_VAR_CTX_HANDLER_METAS);
case "PUT":
return route(requestURI, httpMethod, TWO_SEG_PUT_VAR_CTX_HANDLER_METAS);
case "DELETE":
return route(requestURI, httpMethod, TWO_SEG_DELETE_VAR_CTX_HANDLER_METAS);
default:
return route(requestURI, httpMethod, TWO_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
}
case 3:
contextHandlerMeta = THREE_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
if (null != contextHandlerMeta) {
return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI); // depends on control dependency: [if], data = [none]
}
switch (httpMethod) {
case "GET":
return route(requestURI, httpMethod, THREE_SEG_GET_VAR_CTX_HANDLER_METAS);
case "POST":
return route(requestURI, httpMethod, THREE_SEG_POST_VAR_CTX_HANDLER_METAS);
case "PUT":
return route(requestURI, httpMethod, THREE_SEG_PUT_VAR_CTX_HANDLER_METAS);
case "DELETE":
return route(requestURI, httpMethod, THREE_SEG_DELETE_VAR_CTX_HANDLER_METAS);
default:
return route(requestURI, httpMethod, THREE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
}
default:
contextHandlerMeta = FOUR_MORE_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
if (null != contextHandlerMeta) {
return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI); // depends on control dependency: [if], data = [none]
}
switch (httpMethod) {
case "GET":
return route(requestURI, httpMethod, FOUR_MORE_SEG_GET_VAR_CTX_HANDLER_METAS);
case "POST":
return route(requestURI, httpMethod, FOUR_MORE_SEG_POST_VAR_CTX_HANDLER_METAS);
case "PUT":
return route(requestURI, httpMethod, FOUR_MORE_SEG_PUT_VAR_CTX_HANDLER_METAS);
case "DELETE":
return route(requestURI, httpMethod, FOUR_MORE_SEG_DELETE_VAR_CTX_HANDLER_METAS);
default:
return route(requestURI, httpMethod, FOUR_MORE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
}
}
} }
|
public class class_name {
public synchronized OtpErlangPid createPid() {
final OtpErlangPid p = new OtpErlangPid(node, pidCount, serial,
creation);
pidCount++;
if (pidCount > 0x7fff) {
pidCount = 0;
serial++;
if (serial > 0x1fff) { /* 13 bits */
serial = 0;
}
}
return p;
} }
|
public class class_name {
public synchronized OtpErlangPid createPid() {
final OtpErlangPid p = new OtpErlangPid(node, pidCount, serial,
creation);
pidCount++;
if (pidCount > 0x7fff) {
pidCount = 0; // depends on control dependency: [if], data = [none]
serial++; // depends on control dependency: [if], data = [none]
if (serial > 0x1fff) { /* 13 bits */
serial = 0; // depends on control dependency: [if], data = [none]
}
}
return p;
} }
|
public class class_name {
private void append(final StringBuffer buf, final Integer num, final int digits) {
if (num == null) {
for (int i = 0; i < digits; i++) {
buf.append('?');
}
} else {
for (int digit = 1, test = 10; digit < digits; digit++, test *= 10) {
if (num < test) {
buf.append('0');
}
}
buf.append(num);
}
} }
|
public class class_name {
private void append(final StringBuffer buf, final Integer num, final int digits) {
if (num == null) {
for (int i = 0; i < digits; i++) {
buf.append('?'); // depends on control dependency: [for], data = [none]
}
} else {
for (int digit = 1, test = 10; digit < digits; digit++, test *= 10) {
if (num < test) {
buf.append('0'); // depends on control dependency: [if], data = [none]
}
}
buf.append(num); // depends on control dependency: [if], data = [(num]
}
} }
|
public class class_name {
@Nullable
public static IJson readFromStream (@Nonnull final InputStream aIS,
@Nonnull final Charset aFallbackCharset,
@Nullable final IJsonParseExceptionCallback aCustomExceptionCallback)
{
ValueEnforcer.notNull (aIS, "InputStream");
ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset");
try
{
final Reader aReader = CharsetHelper.getReaderByBOM (aIS, aFallbackCharset);
return readJson (aReader, (IJsonParserCustomizeCallback) null, aCustomExceptionCallback);
}
finally
{
StreamHelper.close (aIS);
}
} }
|
public class class_name {
@Nullable
public static IJson readFromStream (@Nonnull final InputStream aIS,
@Nonnull final Charset aFallbackCharset,
@Nullable final IJsonParseExceptionCallback aCustomExceptionCallback)
{
ValueEnforcer.notNull (aIS, "InputStream");
ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset");
try
{
final Reader aReader = CharsetHelper.getReaderByBOM (aIS, aFallbackCharset);
return readJson (aReader, (IJsonParserCustomizeCallback) null, aCustomExceptionCallback); // depends on control dependency: [try], data = [none]
}
finally
{
StreamHelper.close (aIS);
}
} }
|
public class class_name {
@Override public ORID getIdentity() {
if (rawElement == null)
return ORecordId.EMPTY_RECORD_ID;
final ORID rid = rawElement.getIdentity();
if (!rid.isValid()) {
final OrientBaseGraph graph = getGraph();
if (graph != null) {
// SAVE THE RECORD TO OBTAIN A VALID RID
graph.setCurrentGraphInThreadLocal();
graph.autoStartTransaction();
save();
}
}
return rid;
} }
|
public class class_name {
@Override public ORID getIdentity() {
if (rawElement == null)
return ORecordId.EMPTY_RECORD_ID;
final ORID rid = rawElement.getIdentity();
if (!rid.isValid()) {
final OrientBaseGraph graph = getGraph();
if (graph != null) {
// SAVE THE RECORD TO OBTAIN A VALID RID
graph.setCurrentGraphInThreadLocal(); // depends on control dependency: [if], data = [none]
graph.autoStartTransaction(); // depends on control dependency: [if], data = [none]
save(); // depends on control dependency: [if], data = [none]
}
}
return rid;
} }
|
public class class_name {
public static String determineReadableClassName(String qualifiedName) {
String readableClassName = StringUtils.removeWhitespace(qualifiedName);
if (readableClassName == null) {
throw new IllegalArgumentException("qualifiedName must not be null.");
} else if (readableClassName.startsWith("[")) {
StringBuilder classNameBuffer = new StringBuilder();
while (readableClassName.startsWith("[")) {
classNameBuffer.append("[]");
readableClassName = readableClassName.substring(1);
}
if (PRIMITIVE_MAPPING.containsValue(readableClassName)) {
for (Map.Entry<String,String> next : PRIMITIVE_MAPPING.entrySet()) {
if (next.getValue().equals(readableClassName)) {
readableClassName = next.getKey() + classNameBuffer.toString();
break;
}
}
} else if (readableClassName.startsWith("L") && readableClassName.endsWith(";")) {
readableClassName = readableClassName.substring(1, readableClassName.length() - 1) + classNameBuffer.toString();
} else {
throw new IllegalArgumentException("qualifiedName was invalid {" + readableClassName + "}");
}
} else if (readableClassName.endsWith("]")) {
throw new IllegalArgumentException("qualifiedName was invalid {" + readableClassName + "}");
}
return readableClassName;
} }
|
public class class_name {
public static String determineReadableClassName(String qualifiedName) {
String readableClassName = StringUtils.removeWhitespace(qualifiedName);
if (readableClassName == null) {
throw new IllegalArgumentException("qualifiedName must not be null.");
} else if (readableClassName.startsWith("[")) {
StringBuilder classNameBuffer = new StringBuilder();
while (readableClassName.startsWith("[")) {
classNameBuffer.append("[]");
// depends on control dependency: [while], data = [none]
readableClassName = readableClassName.substring(1);
// depends on control dependency: [while], data = [none]
}
if (PRIMITIVE_MAPPING.containsValue(readableClassName)) {
for (Map.Entry<String,String> next : PRIMITIVE_MAPPING.entrySet()) {
if (next.getValue().equals(readableClassName)) {
readableClassName = next.getKey() + classNameBuffer.toString();
// depends on control dependency: [if], data = [none]
break;
}
}
} else if (readableClassName.startsWith("L") && readableClassName.endsWith(";")) {
readableClassName = readableClassName.substring(1, readableClassName.length() - 1) + classNameBuffer.toString();
// depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("qualifiedName was invalid {" + readableClassName + "}");
}
} else if (readableClassName.endsWith("]")) {
throw new IllegalArgumentException("qualifiedName was invalid {" + readableClassName + "}");
}
return readableClassName;
} }
|
public class class_name {
public static Date str2DateUnmatch2Null(String strDate) {
Date date;
try {
date = str2Date(strDate);
} catch (Exception e) {
throw new TimeMatchFormatException("[" + strDate + "] date auto parse exception", e);
}
return date;
} }
|
public class class_name {
public static Date str2DateUnmatch2Null(String strDate) {
Date date;
try {
date = str2Date(strDate); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new TimeMatchFormatException("[" + strDate + "] date auto parse exception", e);
} // depends on control dependency: [catch], data = [none]
return date;
} }
|
public class class_name {
public CampaignResponse withAdditionalTreatments(TreatmentResource... additionalTreatments) {
if (this.additionalTreatments == null) {
setAdditionalTreatments(new java.util.ArrayList<TreatmentResource>(additionalTreatments.length));
}
for (TreatmentResource ele : additionalTreatments) {
this.additionalTreatments.add(ele);
}
return this;
} }
|
public class class_name {
public CampaignResponse withAdditionalTreatments(TreatmentResource... additionalTreatments) {
if (this.additionalTreatments == null) {
setAdditionalTreatments(new java.util.ArrayList<TreatmentResource>(additionalTreatments.length)); // depends on control dependency: [if], data = [none]
}
for (TreatmentResource ele : additionalTreatments) {
this.additionalTreatments.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static Artifact process(byte[] bytes, String fileName,
Boolean knownTypesOnly) {
String fileType = Processor.getFileType(fileName);
if (!knownTypesOnly
|| (knownTypesOnly && Processor.isKnownType(fileType))) {
// Only handle types we know about eg: .class .jar
Class<?> cls = Processor.getProcessor(fileType);
if (AbstractFile.class.isAssignableFrom(cls)) {
try {
// TOOD: Maybe find a better way of doing this.
Constructor<?> ctor;
ctor = cls.getConstructor(byte[].class, String.class);
Object object;
object = ctor.newInstance(new Object[] { bytes, fileName });
return ((FingerprintInterface) object).getRecord();
} catch (NoSuchMethodException e) {
} catch (SecurityException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (IllegalArgumentException e) {
} catch (InvocationTargetException e) {
} catch (Exception e) {
}
}
}
return null;
} }
|
public class class_name {
public static Artifact process(byte[] bytes, String fileName,
Boolean knownTypesOnly) {
String fileType = Processor.getFileType(fileName);
if (!knownTypesOnly
|| (knownTypesOnly && Processor.isKnownType(fileType))) {
// Only handle types we know about eg: .class .jar
Class<?> cls = Processor.getProcessor(fileType);
if (AbstractFile.class.isAssignableFrom(cls)) {
try {
// TOOD: Maybe find a better way of doing this.
Constructor<?> ctor;
ctor = cls.getConstructor(byte[].class, String.class); // depends on control dependency: [try], data = [none]
Object object;
object = ctor.newInstance(new Object[] { bytes, fileName }); // depends on control dependency: [try], data = [none]
return ((FingerprintInterface) object).getRecord(); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
} catch (SecurityException e) { // depends on control dependency: [catch], data = [none]
} catch (InstantiationException e) { // depends on control dependency: [catch], data = [none]
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
} catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none]
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
}
return null;
} }
|
public class class_name {
public Dimension resolve(Dimension nativeSize, List<Dimension> availableSizes, ImageApiProfile profile) throws ResolvingException {
double aspect = (double) nativeSize.width / (double) nativeSize.height;
// "max"
if (max) {
// By default, identical to the largest available size or the native size if no sizes were specified
Dimension dim = availableSizes.stream()
// Avoid upscaling when dealing with region requests
.filter(s -> s.width <= nativeSize.width && s.height <= nativeSize.height)
// Select the largest available size
.max(Comparator.comparing(Dimension::getWidth).thenComparing(Dimension::getHeight))
// Otherwise, fall back to the native size
.orElse(new Dimension(nativeSize.width, nativeSize.height));
if (profile != null && profile.maxWidth != null) {
if (dim.width > profile.maxWidth) {
// If maximum width is set, width cannot exceed it
dim.width = profile.maxWidth;
dim.height = (int) (profile.maxWidth / aspect);
}
int maxHeight = profile.maxHeight != null ? profile.maxHeight : profile.maxWidth;
if (dim.height > maxHeight) {
// Adjust height if it exceeds maximum height
dim.height = maxHeight;
dim.width = (int) (aspect * dim.height);
}
}
if (profile != null && profile.maxArea != null) {
// Fit width and height into the maximum available area, preserving the aspect ratio
long currentArea = (long) dim.width * (long) dim.height;
if (currentArea > profile.maxArea) {
dim.width = (int) Math.sqrt(aspect * (double) profile.maxArea);
dim.height = (int) (dim.width / aspect);
if (dim.width <= 0 || dim.height <= 0) {
throw new ResolvingException(String.format(
"Cannot fit image with dimensions %dx%d into maximum area of %d pixels.",
nativeSize.width, nativeSize.height, profile.maxArea));
}
}
}
return dim;
}
Dimension out;
if (percentage != null || bestFit) { // "pct:"
double ratio;
if (percentage != null) {
ratio = percentage.doubleValue() / 100.0;
} else {
ratio = Math.min(width / nativeSize.getWidth(), height / nativeSize.getHeight());
}
out = new Dimension((int) (ratio * nativeSize.width), (int) (ratio * nativeSize.height));
} else if (width == null && height == null) { // "full"
out = nativeSize;
} else {
out = new Dimension();
if (width != null) {
out.width = width;
}
if (height != null) {
out.height = height;
}
if (width == null) { // ",h"
out.width = (int) (out.height * aspect);
}
if (height == null) { // "w,"
out.height = (int) (out.width / aspect);
}
}
Integer maxHeight = profile.maxHeight != null ? profile.maxHeight : profile.maxWidth;
if (profile.maxWidth != null && out.width > profile.maxWidth) {
throw new ResolvingException(String.format(
"Requested width (%d) exceeds maximum width (%d) as specified in the profile.", out.width, profile.maxWidth));
} else if (maxHeight != null && out.height > maxHeight) {
throw new ResolvingException(String.format(
"Requested height (%d) exceeds maximum height (%d) as specified in the profile.", out.height, maxHeight));
} else if (profile.maxArea != null && out.height * out.width > profile.maxArea) {
throw new ResolvingException(String.format(
"Requested area (%d*%d = %d) exceeds maximum area (%d) as specified in the profile",
out.width, out.height, out.width * out.height, profile.maxArea));
} else if ((profile.features == null || !profile.features.contains(ImageApiProfile.Feature.SIZE_ABOVE_FULL))
&& (out.width > nativeSize.width || out.height > nativeSize.height)) {
throw new ResolvingException(String.format(
"Requested dimensions (%dx%d) exceed native dimensions (%dx%d), profile states that upscaling is not supported.",
out.width, out.height, nativeSize.width, nativeSize.height));
}
return out;
} }
|
public class class_name {
public Dimension resolve(Dimension nativeSize, List<Dimension> availableSizes, ImageApiProfile profile) throws ResolvingException {
double aspect = (double) nativeSize.width / (double) nativeSize.height;
// "max"
if (max) {
// By default, identical to the largest available size or the native size if no sizes were specified
Dimension dim = availableSizes.stream()
// Avoid upscaling when dealing with region requests
.filter(s -> s.width <= nativeSize.width && s.height <= nativeSize.height)
// Select the largest available size
.max(Comparator.comparing(Dimension::getWidth).thenComparing(Dimension::getHeight))
// Otherwise, fall back to the native size
.orElse(new Dimension(nativeSize.width, nativeSize.height));
if (profile != null && profile.maxWidth != null) {
if (dim.width > profile.maxWidth) {
// If maximum width is set, width cannot exceed it
dim.width = profile.maxWidth; // depends on control dependency: [if], data = [none]
dim.height = (int) (profile.maxWidth / aspect); // depends on control dependency: [if], data = [none]
}
int maxHeight = profile.maxHeight != null ? profile.maxHeight : profile.maxWidth;
if (dim.height > maxHeight) {
// Adjust height if it exceeds maximum height
dim.height = maxHeight; // depends on control dependency: [if], data = [none]
dim.width = (int) (aspect * dim.height); // depends on control dependency: [if], data = [none]
}
}
if (profile != null && profile.maxArea != null) {
// Fit width and height into the maximum available area, preserving the aspect ratio
long currentArea = (long) dim.width * (long) dim.height;
if (currentArea > profile.maxArea) {
dim.width = (int) Math.sqrt(aspect * (double) profile.maxArea); // depends on control dependency: [if], data = [profile.maxArea)]
dim.height = (int) (dim.width / aspect); // depends on control dependency: [if], data = [none]
if (dim.width <= 0 || dim.height <= 0) {
throw new ResolvingException(String.format(
"Cannot fit image with dimensions %dx%d into maximum area of %d pixels.",
nativeSize.width, nativeSize.height, profile.maxArea));
}
}
}
return dim;
}
Dimension out;
if (percentage != null || bestFit) { // "pct:"
double ratio;
if (percentage != null) {
ratio = percentage.doubleValue() / 100.0; // depends on control dependency: [if], data = [none]
} else {
ratio = Math.min(width / nativeSize.getWidth(), height / nativeSize.getHeight()); // depends on control dependency: [if], data = [none]
}
out = new Dimension((int) (ratio * nativeSize.width), (int) (ratio * nativeSize.height));
} else if (width == null && height == null) { // "full"
out = nativeSize;
} else {
out = new Dimension();
if (width != null) {
out.width = width;
}
if (height != null) {
out.height = height;
}
if (width == null) { // ",h"
out.width = (int) (out.height * aspect);
}
if (height == null) { // "w,"
out.height = (int) (out.width / aspect);
}
}
Integer maxHeight = profile.maxHeight != null ? profile.maxHeight : profile.maxWidth;
if (profile.maxWidth != null && out.width > profile.maxWidth) {
throw new ResolvingException(String.format(
"Requested width (%d) exceeds maximum width (%d) as specified in the profile.", out.width, profile.maxWidth));
} else if (maxHeight != null && out.height > maxHeight) {
throw new ResolvingException(String.format(
"Requested height (%d) exceeds maximum height (%d) as specified in the profile.", out.height, maxHeight));
} else if (profile.maxArea != null && out.height * out.width > profile.maxArea) {
throw new ResolvingException(String.format(
"Requested area (%d*%d = %d) exceeds maximum area (%d) as specified in the profile",
out.width, out.height, out.width * out.height, profile.maxArea));
} else if ((profile.features == null || !profile.features.contains(ImageApiProfile.Feature.SIZE_ABOVE_FULL))
&& (out.width > nativeSize.width || out.height > nativeSize.height)) {
throw new ResolvingException(String.format(
"Requested dimensions (%dx%d) exceed native dimensions (%dx%d), profile states that upscaling is not supported.",
out.width, out.height, nativeSize.width, nativeSize.height));
}
return out;
} }
|
public class class_name {
public T getUser(String accountName) {
Optional<T> optional = (Optional<T>) userStore.findByUsername(accountName);
if (optional.isPresent()) {
return optional.get();
} else {
return null;
}
} }
|
public class class_name {
public T getUser(String accountName) {
Optional<T> optional = (Optional<T>) userStore.findByUsername(accountName);
if (optional.isPresent()) {
return optional.get(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public TldExtensionType<WebJsptaglibraryDescriptor> getOrCreateTaglibExtension()
{
List<Node> nodeList = model.get("taglib-extension");
if (nodeList != null && nodeList.size() > 0)
{
return new TldExtensionTypeImpl<WebJsptaglibraryDescriptor>(this, "taglib-extension", model, nodeList.get(0));
}
return createTaglibExtension();
} }
|
public class class_name {
public TldExtensionType<WebJsptaglibraryDescriptor> getOrCreateTaglibExtension()
{
List<Node> nodeList = model.get("taglib-extension");
if (nodeList != null && nodeList.size() > 0)
{
return new TldExtensionTypeImpl<WebJsptaglibraryDescriptor>(this, "taglib-extension", model, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createTaglibExtension();
} }
|
public class class_name {
public void marshall(PutConfigurationSetReputationOptionsRequest putConfigurationSetReputationOptionsRequest, ProtocolMarshaller protocolMarshaller) {
if (putConfigurationSetReputationOptionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putConfigurationSetReputationOptionsRequest.getConfigurationSetName(), CONFIGURATIONSETNAME_BINDING);
protocolMarshaller.marshall(putConfigurationSetReputationOptionsRequest.getReputationMetricsEnabled(), REPUTATIONMETRICSENABLED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(PutConfigurationSetReputationOptionsRequest putConfigurationSetReputationOptionsRequest, ProtocolMarshaller protocolMarshaller) {
if (putConfigurationSetReputationOptionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putConfigurationSetReputationOptionsRequest.getConfigurationSetName(), CONFIGURATIONSETNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putConfigurationSetReputationOptionsRequest.getReputationMetricsEnabled(), REPUTATIONMETRICSENABLED_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 {
@Deprecated
public static String normalize(int char32, Mode mode, int options) {
if(mode == NFD && options == 0) {
String decomposition = Normalizer2.getNFCInstance().getDecomposition(char32);
if(decomposition == null) {
decomposition = UTF16.valueOf(char32);
}
return decomposition;
}
return normalize(UTF16.valueOf(char32), mode, options);
} }
|
public class class_name {
@Deprecated
public static String normalize(int char32, Mode mode, int options) {
if(mode == NFD && options == 0) {
String decomposition = Normalizer2.getNFCInstance().getDecomposition(char32);
if(decomposition == null) {
decomposition = UTF16.valueOf(char32); // depends on control dependency: [if], data = [none]
}
return decomposition; // depends on control dependency: [if], data = [none]
}
return normalize(UTF16.valueOf(char32), mode, options);
} }
|
public class class_name {
public Object saveState(FacesContext context) {
if (context == null) {
throw new NullPointerException();
}
if (!initialStateMarked()) {
Object values[] = new Object[6];
values[0] = dateStyle;
values[1] = locale;
values[2] = pattern;
values[3] = timeStyle;
values[4] = timeZone;
values[5] = type;
return (values);
}
return null;
} }
|
public class class_name {
public Object saveState(FacesContext context) {
if (context == null) {
throw new NullPointerException();
}
if (!initialStateMarked()) {
Object values[] = new Object[6];
values[0] = dateStyle; // depends on control dependency: [if], data = [none]
values[1] = locale; // depends on control dependency: [if], data = [none]
values[2] = pattern; // depends on control dependency: [if], data = [none]
values[3] = timeStyle; // depends on control dependency: [if], data = [none]
values[4] = timeZone; // depends on control dependency: [if], data = [none]
values[5] = type; // depends on control dependency: [if], data = [none]
return (values); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public final Runnable watch(final GroupChangeListener groupChangeListener)
throws WatchException, InterruptedException {
Objects.requireNonNull(groupChangeListener);
try {
ensurePersistentGroupPath();
} catch (JoinException e) {
throw new WatchException("Failed to create group path: " + path, e);
}
final GroupMonitor groupMonitor = new GroupMonitor(groupChangeListener);
backoffHelper.doUntilSuccess(new ExceptionalSupplier<Boolean, WatchException>() {
@Override public Boolean get() throws WatchException {
try {
groupMonitor.watchGroup();
return true;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new WatchException("Interrupted trying to watch group at path: " + path, e);
} catch (ZooKeeperConnectionException e) {
LOG.log(Level.WARNING, "Temporary error trying to watch group at path: " + path, e);
return null;
} catch (KeeperException e) {
if (zkClient.shouldRetry(e)) {
LOG.log(Level.WARNING, "Temporary error trying to watch group at path: " + path, e);
return null;
} else {
throw new WatchException("Problem trying to watch group at path: " + path, e);
}
}
}
});
return new Runnable() {
@Override public void run() {
groupMonitor.stopWatching();
}
};
} }
|
public class class_name {
public final Runnable watch(final GroupChangeListener groupChangeListener)
throws WatchException, InterruptedException {
Objects.requireNonNull(groupChangeListener);
try {
ensurePersistentGroupPath();
} catch (JoinException e) {
throw new WatchException("Failed to create group path: " + path, e);
}
final GroupMonitor groupMonitor = new GroupMonitor(groupChangeListener);
backoffHelper.doUntilSuccess(new ExceptionalSupplier<Boolean, WatchException>() {
@Override public Boolean get() throws WatchException {
try {
groupMonitor.watchGroup(); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new WatchException("Interrupted trying to watch group at path: " + path, e);
} catch (ZooKeeperConnectionException e) { // depends on control dependency: [catch], data = [none]
LOG.log(Level.WARNING, "Temporary error trying to watch group at path: " + path, e);
return null;
} catch (KeeperException e) { // depends on control dependency: [catch], data = [none]
if (zkClient.shouldRetry(e)) {
LOG.log(Level.WARNING, "Temporary error trying to watch group at path: " + path, e); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
} else {
throw new WatchException("Problem trying to watch group at path: " + path, e);
}
} // depends on control dependency: [catch], data = [none]
}
});
return new Runnable() {
@Override public void run() {
groupMonitor.stopWatching();
}
};
} }
|
public class class_name {
private int intersectionSize(int[] px, int[] py) {
int i = 0, j = 0, c = 0;
while(i < px.length && j < py.length) {
final int vx = px[i], vy = py[j];
if(vx < vy) {
++i;
}
else if(vx > vy) {
++j;
}
else {
++c;
++i;
++j;
}
}
return c;
} }
|
public class class_name {
private int intersectionSize(int[] px, int[] py) {
int i = 0, j = 0, c = 0;
while(i < px.length && j < py.length) {
final int vx = px[i], vy = py[j];
if(vx < vy) {
++i; // depends on control dependency: [if], data = [none]
}
else if(vx > vy) {
++j; // depends on control dependency: [if], data = [none]
}
else {
++c; // depends on control dependency: [if], data = [none]
++i; // depends on control dependency: [if], data = [none]
++j; // depends on control dependency: [if], data = [none]
}
}
return c;
} }
|
public class class_name {
public long[][] getRemoteSites() {
int localhost = VoltDB.instance().getHostMessenger().getHostId();
long[][] retval = new long[m_allHostsImmutable.size() - 1][];
int i = 0;
for (int host : m_allHostsImmutable) {
if (host != localhost) {
retval[i++] = longListToArray(m_hostsToSitesImmutable.get(host));
}
}
return retval;
} }
|
public class class_name {
public long[][] getRemoteSites() {
int localhost = VoltDB.instance().getHostMessenger().getHostId();
long[][] retval = new long[m_allHostsImmutable.size() - 1][];
int i = 0;
for (int host : m_allHostsImmutable) {
if (host != localhost) {
retval[i++] = longListToArray(m_hostsToSitesImmutable.get(host)); // depends on control dependency: [if], data = [(host]
}
}
return retval;
} }
|
public class class_name {
public void marshall(ObjectAttributeUpdate objectAttributeUpdate, ProtocolMarshaller protocolMarshaller) {
if (objectAttributeUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(objectAttributeUpdate.getObjectAttributeKey(), OBJECTATTRIBUTEKEY_BINDING);
protocolMarshaller.marshall(objectAttributeUpdate.getObjectAttributeAction(), OBJECTATTRIBUTEACTION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ObjectAttributeUpdate objectAttributeUpdate, ProtocolMarshaller protocolMarshaller) {
if (objectAttributeUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(objectAttributeUpdate.getObjectAttributeKey(), OBJECTATTRIBUTEKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(objectAttributeUpdate.getObjectAttributeAction(), OBJECTATTRIBUTEACTION_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 SupportedProductConfig withArgs(String... args) {
if (this.args == null) {
setArgs(new com.amazonaws.internal.SdkInternalList<String>(args.length));
}
for (String ele : args) {
this.args.add(ele);
}
return this;
} }
|
public class class_name {
public SupportedProductConfig withArgs(String... args) {
if (this.args == null) {
setArgs(new com.amazonaws.internal.SdkInternalList<String>(args.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : args) {
this.args.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public GetLoadBalancerMetricDataResult withMetricData(MetricDatapoint... metricData) {
if (this.metricData == null) {
setMetricData(new java.util.ArrayList<MetricDatapoint>(metricData.length));
}
for (MetricDatapoint ele : metricData) {
this.metricData.add(ele);
}
return this;
} }
|
public class class_name {
public GetLoadBalancerMetricDataResult withMetricData(MetricDatapoint... metricData) {
if (this.metricData == null) {
setMetricData(new java.util.ArrayList<MetricDatapoint>(metricData.length)); // depends on control dependency: [if], data = [none]
}
for (MetricDatapoint ele : metricData) {
this.metricData.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static float getTypeDifferenceWeight(Class<?>[] paramTypes, Object[] destArgs) {
if (paramTypes.length != destArgs.length) {
return Float.MAX_VALUE;
}
float weight = 0.0f;
for (int i = 0; i < paramTypes.length; i++) {
Class<?> srcClass = paramTypes[i];
Object destArg = destArgs[i];
weight += getTypeDifferenceWeight(srcClass, destArg);
if (weight == Float.MAX_VALUE) {
break;
}
}
return weight;
} }
|
public class class_name {
public static float getTypeDifferenceWeight(Class<?>[] paramTypes, Object[] destArgs) {
if (paramTypes.length != destArgs.length) {
return Float.MAX_VALUE; // depends on control dependency: [if], data = [none]
}
float weight = 0.0f;
for (int i = 0; i < paramTypes.length; i++) {
Class<?> srcClass = paramTypes[i];
Object destArg = destArgs[i];
weight += getTypeDifferenceWeight(srcClass, destArg);
if (weight == Float.MAX_VALUE) {
break;
}
}
return weight;
} }
|
public class class_name {
public com.google.protobuf.ByteString
getProtocolBytes() {
java.lang.Object ref = protocol_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
protocol_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
} }
|
public class class_name {
public com.google.protobuf.ByteString
getProtocolBytes() {
java.lang.Object ref = protocol_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
protocol_ = b; // depends on control dependency: [if], data = [none]
return b; // depends on control dependency: [if], data = [none]
} else {
return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static CodepageDetectorProxy getInstance() {
if (CodepageDetectorProxy.instance == null) {
CodepageDetectorProxy.instance = new CodepageDetectorProxy();
}
return CodepageDetectorProxy.instance;
} }
|
public class class_name {
public static CodepageDetectorProxy getInstance() {
if (CodepageDetectorProxy.instance == null) {
CodepageDetectorProxy.instance = new CodepageDetectorProxy(); // depends on control dependency: [if], data = [none]
}
return CodepageDetectorProxy.instance;
} }
|
public class class_name {
protected int checkDirectoryWriteable(String location) {
final String methodName = "checkDirectoryWriteable()";
int rc = CacheOnDisk.LOCATION_OK;
if (location.equals("")) {
rc = CacheOnDisk.LOCATION_NOT_DEFINED;
} else if (location.startsWith("${") && location.indexOf("}") > 0) {
rc = CacheOnDisk.LOCATION_NOT_VALID;
} else {
try {
File f = new File(location);
if (!f.exists()) {
if (!f.mkdirs()) {
rc = CacheOnDisk.LOCATION_CANNOT_MAKE_DIR;
}
} else if (!f.isDirectory()) {
rc = CacheOnDisk.LOCATION_NOT_DIRECTORY;
} else if (!f.canWrite()) {
rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
}
} catch (Throwable t) {
rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.checkDirectoryWriteable", "1779", this);
traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + "\nException: " + ExceptionUtility.getStackTrace(t));
}
}
traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + " rc=" + rc);
return rc;
} }
|
public class class_name {
protected int checkDirectoryWriteable(String location) {
final String methodName = "checkDirectoryWriteable()";
int rc = CacheOnDisk.LOCATION_OK;
if (location.equals("")) {
rc = CacheOnDisk.LOCATION_NOT_DEFINED; // depends on control dependency: [if], data = [none]
} else if (location.startsWith("${") && location.indexOf("}") > 0) {
rc = CacheOnDisk.LOCATION_NOT_VALID; // depends on control dependency: [if], data = [none]
} else {
try {
File f = new File(location);
if (!f.exists()) {
if (!f.mkdirs()) {
rc = CacheOnDisk.LOCATION_CANNOT_MAKE_DIR; // depends on control dependency: [if], data = [none]
}
} else if (!f.isDirectory()) {
rc = CacheOnDisk.LOCATION_NOT_DIRECTORY; // depends on control dependency: [if], data = [none]
} else if (!f.canWrite()) {
rc = CacheOnDisk.LOCATION_NOT_WRITABLE; // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.checkDirectoryWriteable", "1779", this);
traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + "\nException: " + ExceptionUtility.getStackTrace(t));
} // depends on control dependency: [catch], data = [none]
}
traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + " rc=" + rc);
return rc;
} }
|
public class class_name {
public M cp(String... attrs) {
M m = this.cp(false);
for (String attr : attrs) {
m.set(attr, this.get(attr));
}
return m;
} }
|
public class class_name {
public M cp(String... attrs) {
M m = this.cp(false);
for (String attr : attrs) {
m.set(attr, this.get(attr)); // depends on control dependency: [for], data = [attr]
}
return m;
} }
|
public class class_name {
private void dfs(Visitor visitor, int v, int[] cc, int id) {
visitor.visit(v);
cc[v] = id;
for (int t = 0; t < n; t++) {
if (graph[v][t] != 0.0) {
if (cc[t] == -1) {
dfs(visitor, t, cc, id);
}
}
}
} }
|
public class class_name {
private void dfs(Visitor visitor, int v, int[] cc, int id) {
visitor.visit(v);
cc[v] = id;
for (int t = 0; t < n; t++) {
if (graph[v][t] != 0.0) {
if (cc[t] == -1) {
dfs(visitor, t, cc, id); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
private <T> Set<? extends T> create(Iterable<Class<? extends T>> types)
{
Set<T> result = new HashSet<>();
for(Class<? extends T> t : types)
{
if(! Modifier.isAbstract(t.getModifiers()) && ! t.isInterface())
{
T instance = factory.create(t);
result.add(instance);
}
}
return Collections.unmodifiableSet(result);
} }
|
public class class_name {
private <T> Set<? extends T> create(Iterable<Class<? extends T>> types)
{
Set<T> result = new HashSet<>();
for(Class<? extends T> t : types)
{
if(! Modifier.isAbstract(t.getModifiers()) && ! t.isInterface())
{
T instance = factory.create(t);
result.add(instance); // depends on control dependency: [if], data = [none]
}
}
return Collections.unmodifiableSet(result);
} }
|
public class class_name {
private void highlightAll() {
HighlighterManager highlighter = HighlighterManager.getInstance();
LinkedList<HighlightSearchEntry> highlights = highlighter.getHighlights();
for (HighlightSearchEntry entry: highlights) {
highlightEntryParser(entry);
}
} }
|
public class class_name {
private void highlightAll() {
HighlighterManager highlighter = HighlighterManager.getInstance();
LinkedList<HighlightSearchEntry> highlights = highlighter.getHighlights();
for (HighlightSearchEntry entry: highlights) {
highlightEntryParser(entry);
// depends on control dependency: [for], data = [entry]
}
} }
|
public class class_name {
protected final LightweightTypeReference doGetActualType(JvmIdentifiableElement identifiable, boolean ignoreReassignedTypes) {
if (ignoreReassignedTypes) {
if (!shared.allTypes.contains(identifiable)) {
return doGetDeclaredType(identifiable);
}
} else if (!shared.allReassignedTypes.contains(identifiable) && !shared.allTypes.contains(identifiable)) {
int prevSize = shared.allReassignedTypes.size();
LightweightTypeReference result = doGetDeclaredType(identifiable);
// iff the declared type is a computed type and the type computation itself
// reassignes the type, try again to find it
// in other words: if a reassigned type was added while a declared type was converted
// to a lightweight type, check again if the identifiable is reassigned now
if (prevSize == shared.allReassignedTypes.size() || !shared.allReassignedTypes.contains(identifiable)) {
return result;
}
}
LightweightTypeReference result = doGetActualTypeNoDeclaration(identifiable, ignoreReassignedTypes);
if (result == null) {
return doGetDeclaredType(identifiable);
}
return result;
} }
|
public class class_name {
protected final LightweightTypeReference doGetActualType(JvmIdentifiableElement identifiable, boolean ignoreReassignedTypes) {
if (ignoreReassignedTypes) {
if (!shared.allTypes.contains(identifiable)) {
return doGetDeclaredType(identifiable); // depends on control dependency: [if], data = [none]
}
} else if (!shared.allReassignedTypes.contains(identifiable) && !shared.allTypes.contains(identifiable)) {
int prevSize = shared.allReassignedTypes.size();
LightweightTypeReference result = doGetDeclaredType(identifiable);
// iff the declared type is a computed type and the type computation itself
// reassignes the type, try again to find it
// in other words: if a reassigned type was added while a declared type was converted
// to a lightweight type, check again if the identifiable is reassigned now
if (prevSize == shared.allReassignedTypes.size() || !shared.allReassignedTypes.contains(identifiable)) {
return result; // depends on control dependency: [if], data = [none]
}
}
LightweightTypeReference result = doGetActualTypeNoDeclaration(identifiable, ignoreReassignedTypes);
if (result == null) {
return doGetDeclaredType(identifiable); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public static double cosh(double x) {
if (x != x) {
return x;
}
// cosh[z] = (exp(z) + exp(-z))/2
// for numbers with magnitude 20 or so,
// exp(-z) can be ignored in comparison with exp(z)
if (x > 20) {
if (x >= LOG_MAX_VALUE) {
// Avoid overflow (MATH-905).
final double t = exp(0.5 * x);
return (0.5 * t) * t;
} else {
return 0.5 * exp(x);
}
} else if (x < -20) {
if (x <= -LOG_MAX_VALUE) {
// Avoid overflow (MATH-905).
final double t = exp(-0.5 * x);
return (0.5 * t) * t;
} else {
return 0.5 * exp(-x);
}
}
final double hiPrec[] = new double[2];
if (x < 0.0) {
x = -x;
}
exp(x, 0.0, hiPrec);
double ya = hiPrec[0] + hiPrec[1];
double yb = -(ya - hiPrec[0] - hiPrec[1]);
double temp = ya * HEX_40000000;
double yaa = ya + temp - temp;
double yab = ya - yaa;
// recip = 1/y
double recip = 1.0/ya;
temp = recip * HEX_40000000;
double recipa = recip + temp - temp;
double recipb = recip - recipa;
// Correct for rounding in division
recipb += (1.0 - yaa*recipa - yaa*recipb - yab*recipa - yab*recipb) * recip;
// Account for yb
recipb += -yb * recip * recip;
// y = y + 1/y
temp = ya + recipa;
yb += -(temp - ya - recipa);
ya = temp;
temp = ya + recipb;
yb += -(temp - ya - recipb);
ya = temp;
double result = ya + yb;
result *= 0.5;
return result;
} }
|
public class class_name {
public static double cosh(double x) {
if (x != x) {
return x; // depends on control dependency: [if], data = [none]
}
// cosh[z] = (exp(z) + exp(-z))/2
// for numbers with magnitude 20 or so,
// exp(-z) can be ignored in comparison with exp(z)
if (x > 20) {
if (x >= LOG_MAX_VALUE) {
// Avoid overflow (MATH-905).
final double t = exp(0.5 * x);
return (0.5 * t) * t; // depends on control dependency: [if], data = [none]
} else {
return 0.5 * exp(x); // depends on control dependency: [if], data = [(x]
}
} else if (x < -20) {
if (x <= -LOG_MAX_VALUE) {
// Avoid overflow (MATH-905).
final double t = exp(-0.5 * x);
return (0.5 * t) * t; // depends on control dependency: [if], data = [none]
} else {
return 0.5 * exp(-x); // depends on control dependency: [if], data = [none]
}
}
final double hiPrec[] = new double[2];
if (x < 0.0) {
x = -x; // depends on control dependency: [if], data = [none]
}
exp(x, 0.0, hiPrec);
double ya = hiPrec[0] + hiPrec[1];
double yb = -(ya - hiPrec[0] - hiPrec[1]);
double temp = ya * HEX_40000000;
double yaa = ya + temp - temp;
double yab = ya - yaa;
// recip = 1/y
double recip = 1.0/ya;
temp = recip * HEX_40000000;
double recipa = recip + temp - temp;
double recipb = recip - recipa;
// Correct for rounding in division
recipb += (1.0 - yaa*recipa - yaa*recipb - yab*recipa - yab*recipb) * recip;
// Account for yb
recipb += -yb * recip * recip;
// y = y + 1/y
temp = ya + recipa;
yb += -(temp - ya - recipa);
ya = temp;
temp = ya + recipb;
yb += -(temp - ya - recipb);
ya = temp;
double result = ya + yb;
result *= 0.5;
return result;
} }
|
public class class_name {
private void afterDataFsync(Result<Boolean> result,
int position,
FsyncType fsyncType,
ArrayList<SegmentFsyncCallback> listeners)
{
try {
completeIndex(position);
Result<Boolean> cont = result.then((v,r)->
afterIndexFsync(r, fsyncType, listeners));
if (fsyncType.isSchedule()) {
_sOut.fsyncSchedule(cont);
}
else {
_sOut.fsync(cont);
}
} catch (Throwable e) {
result.fail(e);
}
} }
|
public class class_name {
private void afterDataFsync(Result<Boolean> result,
int position,
FsyncType fsyncType,
ArrayList<SegmentFsyncCallback> listeners)
{
try {
completeIndex(position); // depends on control dependency: [try], data = [none]
Result<Boolean> cont = result.then((v,r)->
afterIndexFsync(r, fsyncType, listeners));
if (fsyncType.isSchedule()) {
_sOut.fsyncSchedule(cont); // depends on control dependency: [if], data = [none]
}
else {
_sOut.fsync(cont); // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
result.fail(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public long avgRate() {
long sum = 0L;
for (Sample s : samples) {
sum += s.rate();
}
return sum / (long) samples.size();
} }
|
public class class_name {
public long avgRate() {
long sum = 0L;
for (Sample s : samples) {
sum += s.rate(); // depends on control dependency: [for], data = [s]
}
return sum / (long) samples.size();
} }
|
public class class_name {
public static String addPredicate(String query, String predicateCond) {
if (Strings.isNullOrEmpty(predicateCond)) {
return query;
}
String normalizedQuery = query.toLowerCase().trim();
checkArgument(normalizedQuery.contains(" from "),
"query does not contain 'from': " + query);
checkArgument(! normalizedQuery.contains(" by "),
"query contains 'order by' or 'group by': " + query);
checkArgument(! normalizedQuery.contains(" having "),
"query contains 'having': " + query);
checkArgument(! normalizedQuery.contains(" limit "),
"query contains 'limit': " + query);
String keyword = " where ";
if (normalizedQuery.contains(keyword)) {
keyword = " and ";
}
query = query + keyword + "(" + predicateCond + ")";
return query;
} }
|
public class class_name {
public static String addPredicate(String query, String predicateCond) {
if (Strings.isNullOrEmpty(predicateCond)) {
return query; // depends on control dependency: [if], data = [none]
}
String normalizedQuery = query.toLowerCase().trim();
checkArgument(normalizedQuery.contains(" from "),
"query does not contain 'from': " + query);
checkArgument(! normalizedQuery.contains(" by "),
"query contains 'order by' or 'group by': " + query);
checkArgument(! normalizedQuery.contains(" having "),
"query contains 'having': " + query);
checkArgument(! normalizedQuery.contains(" limit "),
"query contains 'limit': " + query);
String keyword = " where ";
if (normalizedQuery.contains(keyword)) {
keyword = " and "; // depends on control dependency: [if], data = [none]
}
query = query + keyword + "(" + predicateCond + ")";
return query;
} }
|
public class class_name {
public int getMessageLength() {
// Message type, Id length
int length = 1 + 4;
if (this.identifier != null) {
try {
length += this.identifier.getBytes("UTF-16BE").length;
} catch (UnsupportedEncodingException e) {
log.error("Unable to encode to UTF-16BE.");
}
}
// Attribute name length
length += 4;
if (this.attributeName != null) {
try {
length += this.attributeName.getBytes("UTF-16BE").length;
} catch (UnsupportedEncodingException e) {
log.error("Unable to encode to UTF-16BE.");
}
}
if (this.origin != null) {
try {
length += this.origin.getBytes("UTF-16BE").length;
} catch (UnsupportedEncodingException uee) {
log.error("Unable to encode to UTF-16BE.");
}
}
return length;
} }
|
public class class_name {
public int getMessageLength() {
// Message type, Id length
int length = 1 + 4;
if (this.identifier != null) {
try {
length += this.identifier.getBytes("UTF-16BE").length; // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
log.error("Unable to encode to UTF-16BE.");
} // depends on control dependency: [catch], data = [none]
}
// Attribute name length
length += 4;
if (this.attributeName != null) {
try {
length += this.attributeName.getBytes("UTF-16BE").length; // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
log.error("Unable to encode to UTF-16BE.");
} // depends on control dependency: [catch], data = [none]
}
if (this.origin != null) {
try {
length += this.origin.getBytes("UTF-16BE").length; // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException uee) {
log.error("Unable to encode to UTF-16BE.");
} // depends on control dependency: [catch], data = [none]
}
return length;
} }
|
public class class_name {
public Expression eliminateDuplicates(final Session session) {
// First build the map of child expressions joined by the logical AND
// The key is the expression id and the value is the expression itself
Map<String, Expression> subExprMap = new HashMap<>();
extractAndSubExpressions(session, this, subExprMap);
// Reconstruct the expression
if (!subExprMap.isEmpty()) {
Iterator<Map.Entry<String, Expression>> itExpr = subExprMap.entrySet().iterator();
Expression finalExpr = itExpr.next().getValue();
while (itExpr.hasNext()) {
finalExpr = new ExpressionLogical(OpTypes.AND, finalExpr, itExpr.next().getValue());
}
return finalExpr;
}
return this;
} }
|
public class class_name {
public Expression eliminateDuplicates(final Session session) {
// First build the map of child expressions joined by the logical AND
// The key is the expression id and the value is the expression itself
Map<String, Expression> subExprMap = new HashMap<>();
extractAndSubExpressions(session, this, subExprMap);
// Reconstruct the expression
if (!subExprMap.isEmpty()) {
Iterator<Map.Entry<String, Expression>> itExpr = subExprMap.entrySet().iterator();
Expression finalExpr = itExpr.next().getValue();
while (itExpr.hasNext()) {
finalExpr = new ExpressionLogical(OpTypes.AND, finalExpr, itExpr.next().getValue()); // depends on control dependency: [while], data = [none]
}
return finalExpr; // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public java.util.List<InternetGateway> getInternetGateways() {
if (internetGateways == null) {
internetGateways = new com.amazonaws.internal.SdkInternalList<InternetGateway>();
}
return internetGateways;
} }
|
public class class_name {
public java.util.List<InternetGateway> getInternetGateways() {
if (internetGateways == null) {
internetGateways = new com.amazonaws.internal.SdkInternalList<InternetGateway>(); // depends on control dependency: [if], data = [none]
}
return internetGateways;
} }
|
public class class_name {
public static Message fromJson(Message.Builder builder, JsonObject input) throws Exception {
Descriptors.Descriptor descriptor = builder.getDescriptorForType();
for (Map.Entry<String, JsonElement> entry : input.entrySet()) {
String protoName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, entry.getKey());
Descriptors.FieldDescriptor field = descriptor.findFieldByName(protoName);
if (field == null) {
throw new Exception("Can't find descriptor for field " + protoName);
}
if (field.isRepeated()) {
if (!entry.getValue().isJsonArray()) {
// fail
}
JsonArray array = entry.getValue().getAsJsonArray();
for (JsonElement item : array) {
builder.addRepeatedField(field, parseField(field, item, builder));
}
} else {
builder.setField(field, parseField(field, entry.getValue(), builder));
}
}
return builder.build();
} }
|
public class class_name {
public static Message fromJson(Message.Builder builder, JsonObject input) throws Exception {
Descriptors.Descriptor descriptor = builder.getDescriptorForType();
for (Map.Entry<String, JsonElement> entry : input.entrySet()) {
String protoName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, entry.getKey());
Descriptors.FieldDescriptor field = descriptor.findFieldByName(protoName);
if (field == null) {
throw new Exception("Can't find descriptor for field " + protoName);
}
if (field.isRepeated()) {
if (!entry.getValue().isJsonArray()) {
// fail
}
JsonArray array = entry.getValue().getAsJsonArray();
for (JsonElement item : array) {
builder.addRepeatedField(field, parseField(field, item, builder)); // depends on control dependency: [for], data = [item]
}
} else {
builder.setField(field, parseField(field, entry.getValue(), builder));
}
}
return builder.build();
} }
|
public class class_name {
private boolean streamCanAcceptNewMessage(MessageItem msgItem, long valueTick) throws SIException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "streamCanAcceptNewMessage", new Object[] { msgItem, Long.valueOf(valueTick) });
boolean allowSend = false;
if (isStreamBlocked())
{
//once the stream is blocked, only an AckExpected message or a Silence on the blocking tick
//can unset it - therefore we do not re-check and we only allow this message through if it fills a gap.
if (valueTick <= valueHorizon)
{
//the message might fill in a gap so we allow it through
allowSend = true;
}
}
else
{
//the stream is not currently blocked.
//However, the destination might no longer be able to accept messages, in which case
//we should update the flag and only allow the send if the message fills a gap.
JsMessage msg = msgItem.getMessage();
int blockingReason = deliverer.checkAbleToAcceptMessage(msg.getRoutingDestination());
if (blockingReason != DestinationHandler.OUTPUT_HANDLER_FOUND)
{
//We might still be able to let this message through if it
//fills in a gap
if (valueTick <= valueHorizon)
{
//the message might fill in a gap so we allow it through
allowSend = true;
}
else
{
// The stream is now blocked
setStreamIsBlocked(true, blockingReason, null, msg.getRoutingDestination());
// Keep track of the value tick. We may subsequently get a SILENCE for the
// tick signalling that the associated message has been deleted from the
// source and that the stream may be marked as unblocked.
linkBlockingTick = valueTick;
}
}
else
{
allowSend = true;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "streamCanAcceptNewMessage", Boolean.valueOf(allowSend));
return allowSend;
} }
|
public class class_name {
private boolean streamCanAcceptNewMessage(MessageItem msgItem, long valueTick) throws SIException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "streamCanAcceptNewMessage", new Object[] { msgItem, Long.valueOf(valueTick) });
boolean allowSend = false;
if (isStreamBlocked())
{
//once the stream is blocked, only an AckExpected message or a Silence on the blocking tick
//can unset it - therefore we do not re-check and we only allow this message through if it fills a gap.
if (valueTick <= valueHorizon)
{
//the message might fill in a gap so we allow it through
allowSend = true;
}
}
else
{
//the stream is not currently blocked.
//However, the destination might no longer be able to accept messages, in which case
//we should update the flag and only allow the send if the message fills a gap.
JsMessage msg = msgItem.getMessage();
int blockingReason = deliverer.checkAbleToAcceptMessage(msg.getRoutingDestination());
if (blockingReason != DestinationHandler.OUTPUT_HANDLER_FOUND)
{
//We might still be able to let this message through if it
//fills in a gap
if (valueTick <= valueHorizon)
{
//the message might fill in a gap so we allow it through
allowSend = true; // depends on control dependency: [if], data = [none]
}
else
{
// The stream is now blocked
setStreamIsBlocked(true, blockingReason, null, msg.getRoutingDestination()); // depends on control dependency: [if], data = [none]
// Keep track of the value tick. We may subsequently get a SILENCE for the
// tick signalling that the associated message has been deleted from the
// source and that the stream may be marked as unblocked.
linkBlockingTick = valueTick; // depends on control dependency: [if], data = [none]
}
}
else
{
allowSend = true;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "streamCanAcceptNewMessage", Boolean.valueOf(allowSend));
return allowSend;
} }
|
public class class_name {
private void project3(double[] output) {
int observationIndex = 0;
for( int viewIndex = 0; viewIndex < structure.views.length; viewIndex++ ) {
SceneStructureProjective.View view = structure.views[viewIndex];
SceneObservations.View obsView = observations.views[viewIndex];
for (int i = 0; i < obsView.size(); i++) {
obsView.get(i,observedPixel);
SceneStructureMetric.Point worldPt = structure.points[observedPixel.index];
worldPt.get(p3);
PerspectiveOps.renderPixel(view.worldToView, p3, predictedPixel);
int outputIndex = observationIndex*2;
output[outputIndex ] = predictedPixel.x - observedPixel.x;
output[outputIndex+1] = predictedPixel.y - observedPixel.y;
observationIndex++;
}
}
} }
|
public class class_name {
private void project3(double[] output) {
int observationIndex = 0;
for( int viewIndex = 0; viewIndex < structure.views.length; viewIndex++ ) {
SceneStructureProjective.View view = structure.views[viewIndex];
SceneObservations.View obsView = observations.views[viewIndex];
for (int i = 0; i < obsView.size(); i++) {
obsView.get(i,observedPixel); // depends on control dependency: [for], data = [i]
SceneStructureMetric.Point worldPt = structure.points[observedPixel.index];
worldPt.get(p3); // depends on control dependency: [for], data = [none]
PerspectiveOps.renderPixel(view.worldToView, p3, predictedPixel); // depends on control dependency: [for], data = [none]
int outputIndex = observationIndex*2;
output[outputIndex ] = predictedPixel.x - observedPixel.x; // depends on control dependency: [for], data = [none]
output[outputIndex+1] = predictedPixel.y - observedPixel.y; // depends on control dependency: [for], data = [none]
observationIndex++; // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public void addAll(T... fragments) {
for (T fragment : fragments) {
mItems.add(fragment);
}
notifyDataSetChanged();
} }
|
public class class_name {
public void addAll(T... fragments) {
for (T fragment : fragments) {
mItems.add(fragment); // depends on control dependency: [for], data = [fragment]
}
notifyDataSetChanged();
} }
|
public class class_name {
public void parseReport(File xmlFile) {
try {
parseSources(xmlFile);
parsePackages(xmlFile);
} catch (XMLStreamException e) {
throw MessageException.of("Unable to parse Cobertura report.", e);
}
} }
|
public class class_name {
public void parseReport(File xmlFile) {
try {
parseSources(xmlFile); // depends on control dependency: [try], data = [none]
parsePackages(xmlFile); // depends on control dependency: [try], data = [none]
} catch (XMLStreamException e) {
throw MessageException.of("Unable to parse Cobertura report.", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String getPropertyRelativeSuffix(String prefix, String str) {
String realPrefix = prefix + ".";
if (str.startsWith(realPrefix)) {
return str.substring(realPrefix.length());
}
return null;
} }
|
public class class_name {
public static String getPropertyRelativeSuffix(String prefix, String str) {
String realPrefix = prefix + ".";
if (str.startsWith(realPrefix)) {
return str.substring(realPrefix.length()); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public IndexRequest expireAfter(final Long expireAfter, final TimeUnit timeUnit) {
if (expireAfter == null) {
this.expireAfterSeconds = null;
} else {
this.expireAfterSeconds = TimeUnit.SECONDS.convert(expireAfter, timeUnit);
}
return this;
} }
|
public class class_name {
public IndexRequest expireAfter(final Long expireAfter, final TimeUnit timeUnit) {
if (expireAfter == null) {
this.expireAfterSeconds = null; // depends on control dependency: [if], data = [none]
} else {
this.expireAfterSeconds = TimeUnit.SECONDS.convert(expireAfter, timeUnit); // depends on control dependency: [if], data = [(expireAfter]
}
return this;
} }
|
public class class_name {
private String getDefaultPluginId() {
if (defaultPluginId == null) {
try {
defaultPluginId = PropertyUtil.getValue("CAREWEB.INITIAL.SECTION", null);
if (defaultPluginId == null) {
defaultPluginId = "";
}
} catch (Exception e) {
defaultPluginId = "";
}
}
return defaultPluginId;
} }
|
public class class_name {
private String getDefaultPluginId() {
if (defaultPluginId == null) {
try {
defaultPluginId = PropertyUtil.getValue("CAREWEB.INITIAL.SECTION", null); // depends on control dependency: [try], data = [none]
if (defaultPluginId == null) {
defaultPluginId = ""; // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
defaultPluginId = "";
} // depends on control dependency: [catch], data = [none]
}
return defaultPluginId;
} }
|
public class class_name {
public boolean sleep(final boolean mayInterrupt)
{
while (isValid())
{
try
{
Thread.sleep(getTimeLeft(TimeUnit.MILLISECONDS));
}
catch (InterruptedException e)
{
if (mayInterrupt)
return true;
}
}
return false;
} }
|
public class class_name {
public boolean sleep(final boolean mayInterrupt)
{
while (isValid())
{
try
{
Thread.sleep(getTimeLeft(TimeUnit.MILLISECONDS)); // depends on control dependency: [try], data = [none]
}
catch (InterruptedException e)
{
if (mayInterrupt)
return true;
} // depends on control dependency: [catch], data = [none]
}
return false;
} }
|
public class class_name {
@Override
public int getBatchLimit ( String cmd ) {
Integer set = this.batchLimits.get(cmd);
if ( set != null ) {
return set;
}
set = doGetBatchLimit(cmd);
if ( set != null ) {
this.batchLimits.put(cmd, set);
return set;
}
set = DEFAULT_BATCH_LIMITS.get(cmd);
if ( set != null ) {
return set;
}
return 1;
} }
|
public class class_name {
@Override
public int getBatchLimit ( String cmd ) {
Integer set = this.batchLimits.get(cmd);
if ( set != null ) {
return set; // depends on control dependency: [if], data = [none]
}
set = doGetBatchLimit(cmd);
if ( set != null ) {
this.batchLimits.put(cmd, set); // depends on control dependency: [if], data = [none]
return set; // depends on control dependency: [if], data = [none]
}
set = DEFAULT_BATCH_LIMITS.get(cmd);
if ( set != null ) {
return set; // depends on control dependency: [if], data = [none]
}
return 1;
} }
|
public class class_name {
public static InetAddress guessPrimaryNetworkAddress(boolean preferIPv4) throws SocketException {
final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
if (interfaces != null) {
for (NetworkInterface interf : Collections.list(interfaces)) {
if (!interf.isLoopback() && interf.isUp()) {
// Interface is not loopback and up. Try to get the first address.
for (InetAddress addr : Collections.list(interf.getInetAddresses())) {
if (preferIPv4 && addr instanceof Inet4Address) {
return addr;
}
if (!preferIPv4 && addr instanceof Inet6Address) {
return addr;
}
}
}
}
}
return InetAddress.getLoopbackAddress();
} }
|
public class class_name {
public static InetAddress guessPrimaryNetworkAddress(boolean preferIPv4) throws SocketException {
final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
if (interfaces != null) {
for (NetworkInterface interf : Collections.list(interfaces)) {
if (!interf.isLoopback() && interf.isUp()) {
// Interface is not loopback and up. Try to get the first address.
for (InetAddress addr : Collections.list(interf.getInetAddresses())) {
if (preferIPv4 && addr instanceof Inet4Address) {
return addr; // depends on control dependency: [if], data = [none]
}
if (!preferIPv4 && addr instanceof Inet6Address) {
return addr; // depends on control dependency: [if], data = [none]
}
}
}
}
}
return InetAddress.getLoopbackAddress();
} }
|
public class class_name {
public static String getCertIdByKeyStoreMap(String certPath, String certPwd) {
if (!keyStoreMap.containsKey(certPath)) {
// 缓存中未查询到,则加载RSA证书
loadSignCert(certPath, certPwd);
}
return getCertIdIdByStore(keyStoreMap.get(certPath));
} }
|
public class class_name {
public static String getCertIdByKeyStoreMap(String certPath, String certPwd) {
if (!keyStoreMap.containsKey(certPath)) {
// 缓存中未查询到,则加载RSA证书
loadSignCert(certPath, certPwd); // depends on control dependency: [if], data = [none]
}
return getCertIdIdByStore(keyStoreMap.get(certPath));
} }
|
public class class_name {
public String resultToReplayUrl(CaptureSearchResult result) {
if(uriConverter == null) {
return null;
}
String url = result.getOriginalUrl();
String captureDate = result.getCaptureTimestamp();
return uriConverter.makeReplayURI(captureDate,url);
} }
|
public class class_name {
public String resultToReplayUrl(CaptureSearchResult result) {
if(uriConverter == null) {
return null; // depends on control dependency: [if], data = [none]
}
String url = result.getOriginalUrl();
String captureDate = result.getCaptureTimestamp();
return uriConverter.makeReplayURI(captureDate,url);
} }
|
public class class_name {
public String getWrappingHint(String fieldName) {
if (isEmpty()) {
return "";
}
return String.format(" You can use this expression: %s(%s(%s))",
formatMethod(wrappingMethodOwnerName, wrappingMethodName, ""),
formatMethod(copyMethodOwnerName, copyMethodName, copyTypeParameterName),
fieldName);
} }
|
public class class_name {
public String getWrappingHint(String fieldName) {
if (isEmpty()) {
return ""; // depends on control dependency: [if], data = [none]
}
return String.format(" You can use this expression: %s(%s(%s))",
formatMethod(wrappingMethodOwnerName, wrappingMethodName, ""),
formatMethod(copyMethodOwnerName, copyMethodName, copyTypeParameterName),
fieldName);
} }
|
public class class_name {
public static boolean isFieldParameterizedWithPropertyType(final Field field) {
if (field.getGenericType() instanceof ParameterizedType) {
final ParameterizedType genericType = (ParameterizedType) field.getGenericType();
for (final Type type : genericType.getActualTypeArguments()) {
if (isPropertyType((Class) type)) {
return true;
}
}
}
return false;
} }
|
public class class_name {
public static boolean isFieldParameterizedWithPropertyType(final Field field) {
if (field.getGenericType() instanceof ParameterizedType) {
final ParameterizedType genericType = (ParameterizedType) field.getGenericType();
for (final Type type : genericType.getActualTypeArguments()) {
if (isPropertyType((Class) type)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
public final static ExtendedBoolean getExtendedBooleanByName(String name) throws NullPointerException, IllegalArgumentException {
if (tc.isDebugEnabled())
SibTr.info(tc, "Name = " + name);
if (name == null) {
throw new NullPointerException();
}
/* Look for the name in the nameSet, and return the corresponding */
/* Reliability from the indexSet. */
for (int i = 0; i <= MAX_INDEX + 1; i++) {
if (name.equals(nameSet[i])) {
return indexSet[i];
}
}
/* If the name didn't match, throw IllegalArgumentException */
throw new IllegalArgumentException();
} }
|
public class class_name {
public final static ExtendedBoolean getExtendedBooleanByName(String name) throws NullPointerException, IllegalArgumentException {
if (tc.isDebugEnabled())
SibTr.info(tc, "Name = " + name);
if (name == null) {
throw new NullPointerException();
}
/* Look for the name in the nameSet, and return the corresponding */
/* Reliability from the indexSet. */
for (int i = 0; i <= MAX_INDEX + 1; i++) {
if (name.equals(nameSet[i])) {
return indexSet[i]; // depends on control dependency: [if], data = [none]
}
}
/* If the name didn't match, throw IllegalArgumentException */
throw new IllegalArgumentException();
} }
|
public class class_name {
public void addModifier(String modifier) {
if (!Strings.isEmpty(modifier)) {
this.sarlSkill.getModifiers().add(modifier);
}
} }
|
public class class_name {
public void addModifier(String modifier) {
if (!Strings.isEmpty(modifier)) {
this.sarlSkill.getModifiers().add(modifier); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static void addMarkerLine(String label, Double value, Double offset, Axis axis) {
if (value != null) {
MarkerLine markerLine = MarkerLineImpl.create(axis, NumberDataElementImpl.create(value + (offset != null ? offset : 0d)));
markerLine.getLineAttributes().setStyle(LineStyle.DASHED_LITERAL);
markerLine.getLabel().getCaption().setValue(label);
markerLine.setLabelAnchor(Anchor.NORTH_EAST_LITERAL);
}
} }
|
public class class_name {
private static void addMarkerLine(String label, Double value, Double offset, Axis axis) {
if (value != null) {
MarkerLine markerLine = MarkerLineImpl.create(axis, NumberDataElementImpl.create(value + (offset != null ? offset : 0d)));
markerLine.getLineAttributes().setStyle(LineStyle.DASHED_LITERAL); // depends on control dependency: [if], data = [none]
markerLine.getLabel().getCaption().setValue(label); // depends on control dependency: [if], data = [none]
markerLine.setLabelAnchor(Anchor.NORTH_EAST_LITERAL); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Trivial // generates too much trace
private Object getJSONValue(Object value, Set<String> processed) throws IOException {
if (value instanceof String) {
String s = (String) value;
if (s.matches(".*_\\d+")) {
// If a value ends with _<numbers> assume it's a PID and try to look it up
Configuration[] c;
try {
String filter = FilterUtils.createPropertyFilter("service.pid", s);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "getJSONValue pid filter", filter);
c = configAdmin.listConfigurations(filter);
} catch (InvalidSyntaxException x) {
throw new RuntimeException(x);
}
if (c != null) {
Dictionary<String, Object> props = c[0].getProperties();
String uid = getUID((String) props.get("config.displayId"), (String) props.get("id"));
Object configInfo = getConfigInfo(uid, props, new HashSet<String>(processed));
if (configInfo != null)
value = configInfo;
}
}
} else if (value instanceof Number || value instanceof Boolean)
; // common paths - no special handling
else if (value instanceof SerializableProtectedString)
value = "******"; // hide passwords
else if (value.getClass().isArray()) { // list supplied as an array for positive cardinality
JSONArray a = new JSONArray();
int length = Array.getLength(value);
for (int i = 0; i < length; i++)
a.add(getJSONValue(Array.get(value, i), processed));
value = a;
} else if (value instanceof Collection) { // list supplied as a Vector for negative cardinality
JSONArray a = new JSONArray();
for (Object o : (Collection<?>) value)
a.add(getJSONValue(o, processed));
value = a;
} else
value = value.toString(); // TODO any special handling here? Example: com.ibm.wsspi.kernel.service.utils.OnErrorUtil$OnError
return value;
} }
|
public class class_name {
@Trivial // generates too much trace
private Object getJSONValue(Object value, Set<String> processed) throws IOException {
if (value instanceof String) {
String s = (String) value;
if (s.matches(".*_\\d+")) {
// If a value ends with _<numbers> assume it's a PID and try to look it up
Configuration[] c;
try {
String filter = FilterUtils.createPropertyFilter("service.pid", s);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "getJSONValue pid filter", filter);
c = configAdmin.listConfigurations(filter); // depends on control dependency: [try], data = [none]
} catch (InvalidSyntaxException x) {
throw new RuntimeException(x);
} // depends on control dependency: [catch], data = [none]
if (c != null) {
Dictionary<String, Object> props = c[0].getProperties();
String uid = getUID((String) props.get("config.displayId"), (String) props.get("id"));
Object configInfo = getConfigInfo(uid, props, new HashSet<String>(processed));
if (configInfo != null)
value = configInfo;
}
}
} else if (value instanceof Number || value instanceof Boolean)
; // common paths - no special handling
else if (value instanceof SerializableProtectedString)
value = "******"; // hide passwords
else if (value.getClass().isArray()) { // list supplied as an array for positive cardinality
JSONArray a = new JSONArray();
int length = Array.getLength(value);
for (int i = 0; i < length; i++)
a.add(getJSONValue(Array.get(value, i), processed));
value = a;
} else if (value instanceof Collection) { // list supplied as a Vector for negative cardinality
JSONArray a = new JSONArray();
for (Object o : (Collection<?>) value)
a.add(getJSONValue(o, processed));
value = a;
} else
value = value.toString(); // TODO any special handling here? Example: com.ibm.wsspi.kernel.service.utils.OnErrorUtil$OnError
return value;
} }
|
public class class_name {
public boolean hasNextLong(int radix) {
setRadix(radix);
boolean result = hasNext(integerPattern());
if (result) { // Cache it
try {
String s = (matcher.group(SIMPLE_GROUP_INDEX) == null) ?
processIntegerToken(hasNextResult) :
hasNextResult;
typeCache = Long.parseLong(s, radix);
} catch (NumberFormatException nfe) {
result = false;
}
}
return result;
} }
|
public class class_name {
public boolean hasNextLong(int radix) {
setRadix(radix);
boolean result = hasNext(integerPattern());
if (result) { // Cache it
try {
String s = (matcher.group(SIMPLE_GROUP_INDEX) == null) ?
processIntegerToken(hasNextResult) :
hasNextResult;
typeCache = Long.parseLong(s, radix); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
result = false;
} // depends on control dependency: [catch], data = [none]
}
return result;
} }
|
public class class_name {
private List<E> snapshot() {
List<E> list = Lists.newArrayListWithExpectedSize(size());
for (Multiset.Entry<E> entry : entrySet()) {
E element = entry.getElement();
for (int i = entry.getCount(); i > 0; i--) {
list.add(element);
}
}
return list;
} }
|
public class class_name {
private List<E> snapshot() {
List<E> list = Lists.newArrayListWithExpectedSize(size());
for (Multiset.Entry<E> entry : entrySet()) {
E element = entry.getElement();
for (int i = entry.getCount(); i > 0; i--) {
list.add(element); // depends on control dependency: [for], data = [none]
}
}
return list;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.