code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public Double getDouble(Double defaultValue) {
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
if (value instanceof String) {
String s = (String) value;
return Double.parseDouble(s);
}
if (value == null) {
return defaultValue;
}
throw createException("Expected number:");
} }
|
public class class_name {
public Double getDouble(Double defaultValue) {
if (value instanceof Number) {
return ((Number) value).doubleValue(); // depends on control dependency: [if], data = [none]
}
if (value instanceof String) {
String s = (String) value;
return Double.parseDouble(s); // depends on control dependency: [if], data = [none]
}
if (value == null) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
throw createException("Expected number:");
} }
|
public class class_name {
private void unsubscribeAndRetry(final Subscription subscription, final CouchbaseRequest request) {
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
RetryHelper.retryOrCancel(env, request, responseBuffer);
} }
|
public class class_name {
private void unsubscribeAndRetry(final Subscription subscription, final CouchbaseRequest request) {
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe(); // depends on control dependency: [if], data = [none]
}
RetryHelper.retryOrCancel(env, request, responseBuffer);
} }
|
public class class_name {
private javax.swing.JPanel getPanelCommand() {
if (panelCommand == null) {
panelCommand = new javax.swing.JPanel();
panelCommand.setLayout(new java.awt.GridBagLayout());
panelCommand.setName("Search Panel");
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.gridy = 0;
gridBagConstraints1.weightx = 1.0D;
gridBagConstraints1.insets = new java.awt.Insets(2,2,2,2);
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints2.gridx = 0;
gridBagConstraints2.gridy = 1;
gridBagConstraints2.weightx = 1.0;
gridBagConstraints2.weighty = 1.0;
gridBagConstraints2.insets = new java.awt.Insets(0,0,0,0);
gridBagConstraints2.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST;
panelCommand.add(this.getPanelToolbar(), gridBagConstraints1);
panelCommand.add(getJScrollPane(), gridBagConstraints2);
}
return panelCommand;
} }
|
public class class_name {
private javax.swing.JPanel getPanelCommand() {
if (panelCommand == null) {
panelCommand = new javax.swing.JPanel();
// depends on control dependency: [if], data = [none]
panelCommand.setLayout(new java.awt.GridBagLayout());
// depends on control dependency: [if], data = [none]
panelCommand.setName("Search Panel");
// depends on control dependency: [if], data = [none]
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints1.gridx = 0;
// depends on control dependency: [if], data = [none]
gridBagConstraints1.gridy = 0;
// depends on control dependency: [if], data = [none]
gridBagConstraints1.weightx = 1.0D;
// depends on control dependency: [if], data = [none]
gridBagConstraints1.insets = new java.awt.Insets(2,2,2,2);
// depends on control dependency: [if], data = [none]
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
// depends on control dependency: [if], data = [none]
gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
// depends on control dependency: [if], data = [none]
gridBagConstraints2.gridx = 0;
// depends on control dependency: [if], data = [none]
gridBagConstraints2.gridy = 1;
// depends on control dependency: [if], data = [none]
gridBagConstraints2.weightx = 1.0;
// depends on control dependency: [if], data = [none]
gridBagConstraints2.weighty = 1.0;
// depends on control dependency: [if], data = [none]
gridBagConstraints2.insets = new java.awt.Insets(0,0,0,0);
// depends on control dependency: [if], data = [none]
gridBagConstraints2.fill = java.awt.GridBagConstraints.BOTH;
// depends on control dependency: [if], data = [none]
gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST;
// depends on control dependency: [if], data = [none]
panelCommand.add(this.getPanelToolbar(), gridBagConstraints1);
// depends on control dependency: [if], data = [none]
panelCommand.add(getJScrollPane(), gridBagConstraints2);
// depends on control dependency: [if], data = [none]
}
return panelCommand;
} }
|
public class class_name {
@Override
public String getCookieName() {
if (allowedProps != null) {
return (String) allowedProps.get(CFG_COOKIE_NAME);
}
return null;
} }
|
public class class_name {
@Override
public String getCookieName() {
if (allowedProps != null) {
return (String) allowedProps.get(CFG_COOKIE_NAME); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public S parse(
CharSequence text,
int offset
) throws ParseException {
int pos = offset;
Map<Object, Long> unitsToValues = new HashMap<>();
for (int i = 0, n = this.items.size(); i < n; i++) {
FormatItem<U> item = this.items.get(i);
if (item == OrItem.INSTANCE) {
break;
}
int reply = item.parse(unitsToValues, text, pos);
if (reply < 0) {
int found = -1;
for (int j = i + 1; j < n; j++) {
if (this.items.get(j) == OrItem.INSTANCE) {
found = j;
break;
}
}
if (found == -1) {
throw new ParseException("Cannot parse: " + text, ~reply);
} else {
unitsToValues.clear();
i = found;
}
} else {
pos = reply;
}
}
int len = text.length();
if (pos < len) {
throw new ParseException(
"Unparsed trailing characters found: \""
+ text.subSequence(pos, len)
+ "\" in \""
+ text,
pos);
}
Long sign = unitsToValues.remove(SIGN_KEY);
boolean negative = ((sign != null) && (sign.longValue() < 0));
Map<U, Long> map = new HashMap<>();
for (Object key : unitsToValues.keySet()) {
if (this.type.isInstance(key)) {
map.put(this.type.cast(key), unitsToValues.get(key));
} else {
throw new ParseException(
"Duration type mismatched: " + unitsToValues, pos);
}
}
return this.convert(map, negative);
} }
|
public class class_name {
public S parse(
CharSequence text,
int offset
) throws ParseException {
int pos = offset;
Map<Object, Long> unitsToValues = new HashMap<>();
for (int i = 0, n = this.items.size(); i < n; i++) {
FormatItem<U> item = this.items.get(i);
if (item == OrItem.INSTANCE) {
break;
}
int reply = item.parse(unitsToValues, text, pos);
if (reply < 0) {
int found = -1;
for (int j = i + 1; j < n; j++) {
if (this.items.get(j) == OrItem.INSTANCE) {
found = j; // depends on control dependency: [if], data = [none]
break;
}
}
if (found == -1) {
throw new ParseException("Cannot parse: " + text, ~reply);
} else {
unitsToValues.clear(); // depends on control dependency: [if], data = [none]
i = found; // depends on control dependency: [if], data = [none]
}
} else {
pos = reply; // depends on control dependency: [if], data = [none]
}
}
int len = text.length();
if (pos < len) {
throw new ParseException(
"Unparsed trailing characters found: \""
+ text.subSequence(pos, len)
+ "\" in \""
+ text,
pos);
}
Long sign = unitsToValues.remove(SIGN_KEY);
boolean negative = ((sign != null) && (sign.longValue() < 0));
Map<U, Long> map = new HashMap<>();
for (Object key : unitsToValues.keySet()) {
if (this.type.isInstance(key)) {
map.put(this.type.cast(key), unitsToValues.get(key));
} else {
throw new ParseException(
"Duration type mismatched: " + unitsToValues, pos);
}
}
return this.convert(map, negative);
} }
|
public class class_name {
@Deprecated
State isState(Object obj) {
State state = null;
if (obj == null) {
state = State.VALUE_NULL;
} else if (obj instanceof String) {
state = State.VALUE_STRING;
} else if (obj instanceof Boolean) {
state = State.VALUE_BOOLEAN;
} else if (obj instanceof Double || obj instanceof Float) {
state = State.VALUE_DOUBLE;
} else if (obj instanceof Byte || obj instanceof Short || obj instanceof Integer
|| obj instanceof Long) {
state = State.VALUE_LONG;
} else if (obj instanceof JsonArray) {
state = State.START_ARRAY;
} else if (obj instanceof JsonHash) {
state = State.START_HASH;
} else {
throw new IllegalArgumentException(obj.getClass().getCanonicalName()
+ " is not supported");
}
return state;
} }
|
public class class_name {
@Deprecated
State isState(Object obj) {
State state = null;
if (obj == null) {
state = State.VALUE_NULL; // depends on control dependency: [if], data = [none]
} else if (obj instanceof String) {
state = State.VALUE_STRING; // depends on control dependency: [if], data = [none]
} else if (obj instanceof Boolean) {
state = State.VALUE_BOOLEAN; // depends on control dependency: [if], data = [none]
} else if (obj instanceof Double || obj instanceof Float) {
state = State.VALUE_DOUBLE; // depends on control dependency: [if], data = [none]
} else if (obj instanceof Byte || obj instanceof Short || obj instanceof Integer
|| obj instanceof Long) {
state = State.VALUE_LONG; // depends on control dependency: [if], data = [none]
} else if (obj instanceof JsonArray) {
state = State.START_ARRAY; // depends on control dependency: [if], data = [none]
} else if (obj instanceof JsonHash) {
state = State.START_HASH; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException(obj.getClass().getCanonicalName()
+ " is not supported");
}
return state;
} }
|
public class class_name {
@SuppressWarnings("WeakerAccess")
public synchronized void stop() {
if (isRunning()) {
running.set(false);
MetadataFinder.getInstance().removeMetadataProvider(metadataProvider);
for (Database database : databases.values()) {
//noinspection ResultOfMethodCallIgnored
database.sourceFile.delete();
}
databases.clear();
}
} }
|
public class class_name {
@SuppressWarnings("WeakerAccess")
public synchronized void stop() {
if (isRunning()) {
running.set(false); // depends on control dependency: [if], data = [none]
MetadataFinder.getInstance().removeMetadataProvider(metadataProvider); // depends on control dependency: [if], data = [none]
for (Database database : databases.values()) {
//noinspection ResultOfMethodCallIgnored
database.sourceFile.delete(); // depends on control dependency: [for], data = [database]
}
databases.clear(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
String getResponseToken(String responseInbox) {
int len = getRespInboxLength();
if (responseInbox.length() <= len) {
return responseInbox;
}
return responseInbox.substring(len);
} }
|
public class class_name {
String getResponseToken(String responseInbox) {
int len = getRespInboxLength();
if (responseInbox.length() <= len) {
return responseInbox;
// depends on control dependency: [if], data = [none]
}
return responseInbox.substring(len);
} }
|
public class class_name {
public static String addLeftOpt(String str, String left) {
if (str.startsWith(left)) {
return str;
} else {
return left + str;
}
} }
|
public class class_name {
public static String addLeftOpt(String str, String left) {
if (str.startsWith(left)) {
return str; // depends on control dependency: [if], data = [none]
} else {
return left + str; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void handleEvent(final WatchKey key) {
try {
key.pollEvents().forEach(event -> {
val eventName = event.kind().name();
val ev = (WatchEvent<Path>) event;
val filename = ev.context();
val parent = (Path) key.watchable();
val fullPath = parent.resolve(filename);
val file = fullPath.toFile();
LOGGER.trace("Detected event [{}] on file [{}]", eventName, file);
if (eventName.equals(ENTRY_CREATE.name()) && file.exists()) {
onCreate.accept(file);
} else if (eventName.equals(ENTRY_DELETE.name())) {
onDelete.accept(file);
} else if (eventName.equals(ENTRY_MODIFY.name()) && file.exists()) {
onModify.accept(file);
}
});
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
}
} }
|
public class class_name {
private void handleEvent(final WatchKey key) {
try {
key.pollEvents().forEach(event -> {
val eventName = event.kind().name(); // depends on control dependency: [try], data = [none]
val ev = (WatchEvent<Path>) event;
val filename = ev.context();
val parent = (Path) key.watchable();
val fullPath = parent.resolve(filename);
val file = fullPath.toFile();
LOGGER.trace("Detected event [{}] on file [{}]", eventName, file); // depends on control dependency: [try], data = [none]
if (eventName.equals(ENTRY_CREATE.name()) && file.exists()) {
onCreate.accept(file); // depends on control dependency: [if], data = [none]
} else if (eventName.equals(ENTRY_DELETE.name())) {
onDelete.accept(file); // depends on control dependency: [if], data = [none]
} else if (eventName.equals(ENTRY_MODIFY.name()) && file.exists()) {
onModify.accept(file); // depends on control dependency: [if], data = [none]
}
});
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public final void execute(@NonNull final ReportBuilder reportBuilder) {
if (!enabled) {
ACRA.log.v(LOG_TAG, "ACRA is disabled. Report not sent.");
return;
}
ReportingAdministrator blockingAdministrator = null;
for (ReportingAdministrator administrator : reportingAdministrators) {
try {
if (!administrator.shouldStartCollecting(context, config, reportBuilder)) {
blockingAdministrator = administrator;
}
} catch (Exception t) {
ACRA.log.w(LOG_TAG, "ReportingAdministrator " + administrator.getClass().getName() + " threw exception", t);
}
}
final CrashReportData crashReportData;
if (blockingAdministrator == null) {
crashReportData = crashReportDataFactory.createCrashData(reportBuilder);
for (ReportingAdministrator administrator : reportingAdministrators) {
try {
if (!administrator.shouldSendReport(context, config, crashReportData)) {
blockingAdministrator = administrator;
}
} catch (Exception t) {
ACRA.log.w(LOG_TAG, "ReportingAdministrator " + administrator.getClass().getName() + " threw exception", t);
}
}
} else {
crashReportData = null;
if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Not collecting crash report because of ReportingAdministrator " + blockingAdministrator.getClass().getName());
}
if (reportBuilder.isEndApplication()) {
boolean finishActivity = true;
for (ReportingAdministrator administrator : reportingAdministrators) {
try {
if (!administrator.shouldFinishActivity(context, config, lastActivityManager)) {
finishActivity = false;
}
} catch (Exception t) {
ACRA.log.w(LOG_TAG, "ReportingAdministrator " + administrator.getClass().getName() + " threw exception", t);
}
}
if (finishActivity) {
// Finish the last activity early to prevent restarts on android 7+
processFinisher.finishLastActivity(reportBuilder.getUncaughtExceptionThread());
}
}
if (blockingAdministrator == null) {
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
final File reportFile = getReportFileName(crashReportData);
saveCrashReportFile(reportFile, crashReportData);
final ReportInteractionExecutor executor = new ReportInteractionExecutor(context, config);
if (reportBuilder.isSendSilently()) {
//if no interactions are present we can send all reports
sendReport(reportFile, executor.hasInteractions());
} else {
if (executor.performInteractions(reportFile)) {
sendReport(reportFile, false);
}
}
StrictMode.setThreadPolicy(oldPolicy);
} else {
if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Not sending crash report because of ReportingAdministrator " + blockingAdministrator.getClass().getName());
try {
blockingAdministrator.notifyReportDropped(context, config);
} catch (Exception t) {
ACRA.log.w(LOG_TAG, "ReportingAdministrator " + blockingAdministrator.getClass().getName() + " threw exeption", t);
}
}
if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Wait for Interactions + worker ended. Kill Application ? " + reportBuilder.isEndApplication());
if (reportBuilder.isEndApplication()) {
boolean endApplication = true;
for (ReportingAdministrator administrator : reportingAdministrators) {
try {
if (!administrator.shouldKillApplication(context, config, reportBuilder, crashReportData)) {
endApplication = false;
}
} catch (Exception t) {
ACRA.log.w(LOG_TAG, "ReportingAdministrator " + administrator.getClass().getName() + " threw exception", t);
}
}
if (endApplication) {
if (Debug.isDebuggerConnected()) {
//Killing a process with a debugger attached would kill the whole application including our service, so we can't do that.
final String warning = "Warning: Acra may behave differently with a debugger attached";
new Thread(() -> {
Looper.prepare();
ToastSender.sendToast(context, warning, Toast.LENGTH_LONG);
Looper.loop();
}).start();
ACRA.log.w(LOG_TAG, warning);
} else {
endApplication(reportBuilder.getUncaughtExceptionThread(), reportBuilder.getException());
}
}
}
} }
|
public class class_name {
public final void execute(@NonNull final ReportBuilder reportBuilder) {
if (!enabled) {
ACRA.log.v(LOG_TAG, "ACRA is disabled. Report not sent."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
ReportingAdministrator blockingAdministrator = null;
for (ReportingAdministrator administrator : reportingAdministrators) {
try {
if (!administrator.shouldStartCollecting(context, config, reportBuilder)) {
blockingAdministrator = administrator; // depends on control dependency: [if], data = [none]
}
} catch (Exception t) {
ACRA.log.w(LOG_TAG, "ReportingAdministrator " + administrator.getClass().getName() + " threw exception", t);
} // depends on control dependency: [catch], data = [none]
}
final CrashReportData crashReportData;
if (blockingAdministrator == null) {
crashReportData = crashReportDataFactory.createCrashData(reportBuilder); // depends on control dependency: [if], data = [none]
for (ReportingAdministrator administrator : reportingAdministrators) {
try {
if (!administrator.shouldSendReport(context, config, crashReportData)) {
blockingAdministrator = administrator; // depends on control dependency: [if], data = [none]
}
} catch (Exception t) {
ACRA.log.w(LOG_TAG, "ReportingAdministrator " + administrator.getClass().getName() + " threw exception", t);
} // depends on control dependency: [catch], data = [none]
}
} else {
crashReportData = null; // depends on control dependency: [if], data = [none]
if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Not collecting crash report because of ReportingAdministrator " + blockingAdministrator.getClass().getName());
}
if (reportBuilder.isEndApplication()) {
boolean finishActivity = true;
for (ReportingAdministrator administrator : reportingAdministrators) {
try {
if (!administrator.shouldFinishActivity(context, config, lastActivityManager)) {
finishActivity = false; // depends on control dependency: [if], data = [none]
}
} catch (Exception t) {
ACRA.log.w(LOG_TAG, "ReportingAdministrator " + administrator.getClass().getName() + " threw exception", t);
} // depends on control dependency: [catch], data = [none]
}
if (finishActivity) {
// Finish the last activity early to prevent restarts on android 7+
processFinisher.finishLastActivity(reportBuilder.getUncaughtExceptionThread()); // depends on control dependency: [if], data = [none]
}
}
if (blockingAdministrator == null) {
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
final File reportFile = getReportFileName(crashReportData);
saveCrashReportFile(reportFile, crashReportData); // depends on control dependency: [if], data = [none]
final ReportInteractionExecutor executor = new ReportInteractionExecutor(context, config);
if (reportBuilder.isSendSilently()) {
//if no interactions are present we can send all reports
sendReport(reportFile, executor.hasInteractions()); // depends on control dependency: [if], data = [none]
} else {
if (executor.performInteractions(reportFile)) {
sendReport(reportFile, false); // depends on control dependency: [if], data = [none]
}
}
StrictMode.setThreadPolicy(oldPolicy); // depends on control dependency: [if], data = [none]
} else {
if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Not sending crash report because of ReportingAdministrator " + blockingAdministrator.getClass().getName());
try {
blockingAdministrator.notifyReportDropped(context, config); // depends on control dependency: [try], data = [none]
} catch (Exception t) {
ACRA.log.w(LOG_TAG, "ReportingAdministrator " + blockingAdministrator.getClass().getName() + " threw exeption", t);
} // depends on control dependency: [catch], data = [none]
}
if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Wait for Interactions + worker ended. Kill Application ? " + reportBuilder.isEndApplication());
if (reportBuilder.isEndApplication()) {
boolean endApplication = true;
for (ReportingAdministrator administrator : reportingAdministrators) {
try {
if (!administrator.shouldKillApplication(context, config, reportBuilder, crashReportData)) {
endApplication = false; // depends on control dependency: [if], data = [none]
}
} catch (Exception t) {
ACRA.log.w(LOG_TAG, "ReportingAdministrator " + administrator.getClass().getName() + " threw exception", t);
} // depends on control dependency: [catch], data = [none]
}
if (endApplication) {
if (Debug.isDebuggerConnected()) {
//Killing a process with a debugger attached would kill the whole application including our service, so we can't do that.
final String warning = "Warning: Acra may behave differently with a debugger attached";
new Thread(() -> {
Looper.prepare(); // depends on control dependency: [if], data = [none]
ToastSender.sendToast(context, warning, Toast.LENGTH_LONG); // depends on control dependency: [if], data = [none]
Looper.loop(); // depends on control dependency: [if], data = [none]
}).start(); // depends on control dependency: [if], data = [none]
ACRA.log.w(LOG_TAG, warning); // depends on control dependency: [if], data = [none]
} else {
endApplication(reportBuilder.getUncaughtExceptionThread(), reportBuilder.getException()); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public double getContactOverlapScore(StructureInterface other, boolean invert) {
Structure thisStruct = getParentStructure();
Structure otherStruct = other.getParentStructure();
if (thisStruct!=otherStruct) {
// in the current implementation, comparison between different structure doesn't make much sense
// and won't even work since the compounds of both will never match. We warn because it
// really is not what this is intended for at the moment
logger.warn("Comparing interfaces from different structures, contact overlap score will be 0");
return 0;
}
Pair<Chain> thisChains = getParentChains();
Pair<Chain> otherChains = other.getParentChains();
if (thisChains.getFirst().getEntityInfo() == null || thisChains.getSecond().getEntityInfo() == null ||
otherChains.getFirst().getEntityInfo() == null || otherChains.getSecond().getEntityInfo() == null ) {
// this happens in cases like 2uub
logger.warn("Found chains with null compounds while comparing interfaces {} and {}. Contact overlap score for them will be 0.",
this.getId(), other.getId());
return 0;
}
Pair<EntityInfo> thisCompounds = new Pair<EntityInfo>(thisChains.getFirst().getEntityInfo(), thisChains.getSecond().getEntityInfo());
Pair<EntityInfo> otherCompounds = new Pair<EntityInfo>(otherChains.getFirst().getEntityInfo(), otherChains.getSecond().getEntityInfo());
if ( ( (thisCompounds.getFirst() == otherCompounds.getFirst()) &&
(thisCompounds.getSecond() == otherCompounds.getSecond()) ) ||
( (thisCompounds.getFirst() == otherCompounds.getSecond()) &&
(thisCompounds.getSecond() == otherCompounds.getFirst()) ) ) {
int common = 0;
GroupContactSet thisContacts = getGroupContacts();
GroupContactSet otherContacts = other.getGroupContacts();
for (GroupContact thisContact:thisContacts) {
ResidueIdentifier first = null;
ResidueIdentifier second = null;
if (!invert) {
first = new ResidueIdentifier(thisContact.getPair().getFirst());
second = new ResidueIdentifier(thisContact.getPair().getSecond());
} else {
first = new ResidueIdentifier(thisContact.getPair().getSecond());
second = new ResidueIdentifier(thisContact.getPair().getFirst());
}
if (otherContacts.hasContact(first,second)) {
common++;
}
}
return (2.0*common)/(thisContacts.size()+otherContacts.size());
} else {
logger.debug("Chain pairs {},{} and {},{} belong to different compound pairs, contact overlap score will be 0 ",
thisChains.getFirst().getId(),thisChains.getSecond().getId(),
otherChains.getFirst().getId(),otherChains.getSecond().getId());
return 0.0;
}
} }
|
public class class_name {
public double getContactOverlapScore(StructureInterface other, boolean invert) {
Structure thisStruct = getParentStructure();
Structure otherStruct = other.getParentStructure();
if (thisStruct!=otherStruct) {
// in the current implementation, comparison between different structure doesn't make much sense
// and won't even work since the compounds of both will never match. We warn because it
// really is not what this is intended for at the moment
logger.warn("Comparing interfaces from different structures, contact overlap score will be 0"); // depends on control dependency: [if], data = [none]
return 0; // depends on control dependency: [if], data = [none]
}
Pair<Chain> thisChains = getParentChains();
Pair<Chain> otherChains = other.getParentChains();
if (thisChains.getFirst().getEntityInfo() == null || thisChains.getSecond().getEntityInfo() == null ||
otherChains.getFirst().getEntityInfo() == null || otherChains.getSecond().getEntityInfo() == null ) {
// this happens in cases like 2uub
logger.warn("Found chains with null compounds while comparing interfaces {} and {}. Contact overlap score for them will be 0.",
this.getId(), other.getId()); // depends on control dependency: [if], data = [none]
return 0; // depends on control dependency: [if], data = [none]
}
Pair<EntityInfo> thisCompounds = new Pair<EntityInfo>(thisChains.getFirst().getEntityInfo(), thisChains.getSecond().getEntityInfo());
Pair<EntityInfo> otherCompounds = new Pair<EntityInfo>(otherChains.getFirst().getEntityInfo(), otherChains.getSecond().getEntityInfo());
if ( ( (thisCompounds.getFirst() == otherCompounds.getFirst()) &&
(thisCompounds.getSecond() == otherCompounds.getSecond()) ) ||
( (thisCompounds.getFirst() == otherCompounds.getSecond()) &&
(thisCompounds.getSecond() == otherCompounds.getFirst()) ) ) {
int common = 0;
GroupContactSet thisContacts = getGroupContacts();
GroupContactSet otherContacts = other.getGroupContacts();
for (GroupContact thisContact:thisContacts) {
ResidueIdentifier first = null;
ResidueIdentifier second = null;
if (!invert) {
first = new ResidueIdentifier(thisContact.getPair().getFirst()); // depends on control dependency: [if], data = [none]
second = new ResidueIdentifier(thisContact.getPair().getSecond()); // depends on control dependency: [if], data = [none]
} else {
first = new ResidueIdentifier(thisContact.getPair().getSecond()); // depends on control dependency: [if], data = [none]
second = new ResidueIdentifier(thisContact.getPair().getFirst()); // depends on control dependency: [if], data = [none]
}
if (otherContacts.hasContact(first,second)) {
common++; // depends on control dependency: [if], data = [none]
}
}
return (2.0*common)/(thisContacts.size()+otherContacts.size()); // depends on control dependency: [if], data = [none]
} else {
logger.debug("Chain pairs {},{} and {},{} belong to different compound pairs, contact overlap score will be 0 ",
thisChains.getFirst().getId(),thisChains.getSecond().getId(),
otherChains.getFirst().getId(),otherChains.getSecond().getId()); // depends on control dependency: [if], data = [none]
return 0.0; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public String getSecureVirtualHostName() {
if (this.getSecurePortEnabled()) {
return configInstance.getStringProperty(namespace + SECURE_VIRTUAL_HOSTNAME_KEY,
super.getSecureVirtualHostName()).get();
} else {
return null;
}
} }
|
public class class_name {
@Override
public String getSecureVirtualHostName() {
if (this.getSecurePortEnabled()) {
return configInstance.getStringProperty(namespace + SECURE_VIRTUAL_HOSTNAME_KEY,
super.getSecureVirtualHostName()).get(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected static URL findConfigUrlInDirectory(File directory, String configName) {
if (directory.isDirectory()) {
File cfile = new File(directory, configName);
if (cfile.isFile()) {
try {
return cfile.toURI().toURL();
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
return null;
} }
|
public class class_name {
protected static URL findConfigUrlInDirectory(File directory, String configName) {
if (directory.isDirectory()) {
File cfile = new File(directory, configName);
if (cfile.isFile()) {
try {
return cfile.toURI().toURL(); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
}
return null;
} }
|
public class class_name {
public static Date getDate(
Object value)
{
if (value == null)
{
return null;
}
if (value instanceof Date)
{
return ((Date) value);
}
return parseISODate(value.toString());
} }
|
public class class_name {
public static Date getDate(
Object value)
{
if (value == null)
{
return null; // depends on control dependency: [if], data = [none]
}
if (value instanceof Date)
{
return ((Date) value); // depends on control dependency: [if], data = [none]
}
return parseISODate(value.toString());
} }
|
public class class_name {
public void marshall(JobExecutionSummary jobExecutionSummary, ProtocolMarshaller protocolMarshaller) {
if (jobExecutionSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(jobExecutionSummary.getJobId(), JOBID_BINDING);
protocolMarshaller.marshall(jobExecutionSummary.getQueuedAt(), QUEUEDAT_BINDING);
protocolMarshaller.marshall(jobExecutionSummary.getStartedAt(), STARTEDAT_BINDING);
protocolMarshaller.marshall(jobExecutionSummary.getLastUpdatedAt(), LASTUPDATEDAT_BINDING);
protocolMarshaller.marshall(jobExecutionSummary.getVersionNumber(), VERSIONNUMBER_BINDING);
protocolMarshaller.marshall(jobExecutionSummary.getExecutionNumber(), EXECUTIONNUMBER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(JobExecutionSummary jobExecutionSummary, ProtocolMarshaller protocolMarshaller) {
if (jobExecutionSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(jobExecutionSummary.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecutionSummary.getQueuedAt(), QUEUEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecutionSummary.getStartedAt(), STARTEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecutionSummary.getLastUpdatedAt(), LASTUPDATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecutionSummary.getVersionNumber(), VERSIONNUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecutionSummary.getExecutionNumber(), EXECUTIONNUMBER_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static void push( Stack<String> stack, String value )
{
if( stack.size() > 0 )
{
String data = stack.pop();
if( "${".equals( data ) )
{
stack.push( data );
stack.push( value );
}
else
{
stack.push( data + value );
}
}
else
{
stack.push( value );
}
} }
|
public class class_name {
private static void push( Stack<String> stack, String value )
{
if( stack.size() > 0 )
{
String data = stack.pop();
if( "${".equals( data ) )
{
stack.push( data ); // depends on control dependency: [if], data = [none]
stack.push( value ); // depends on control dependency: [if], data = [none]
}
else
{
stack.push( data + value ); // depends on control dependency: [if], data = [none]
}
}
else
{
stack.push( value ); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void main( String[] args ) {
ImageMetadata imageMetadata = new ImageMetadata();
imageMetadata.setDetermineImageNumber(true);
boolean verbose = determineVerbosity(args);
if (args.length == 0) {
run(null, System.in, imageMetadata, verbose);
} else {
int index = 0;
while (index < args.length) {
InputStream in = null;
try {
String name = args[index++];
// System.out.print(name + ";");
if (name.startsWith("http://")) {
in = new URL(name).openConnection().getInputStream();
} else {
in = new FileInputStream(name);
}
run(name, in, imageMetadata, verbose);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ee) {
ee.printStackTrace();
}
}
}
}
}
} }
|
public class class_name {
public static void main( String[] args ) {
ImageMetadata imageMetadata = new ImageMetadata();
imageMetadata.setDetermineImageNumber(true);
boolean verbose = determineVerbosity(args);
if (args.length == 0) {
run(null, System.in, imageMetadata, verbose); // depends on control dependency: [if], data = [none]
} else {
int index = 0;
while (index < args.length) {
InputStream in = null;
try {
String name = args[index++];
// System.out.print(name + ";");
if (name.startsWith("http://")) {
in = new URL(name).openConnection().getInputStream();
} else {
in = new FileInputStream(name);
}
run(name, in, imageMetadata, verbose); // depends on control dependency: [while], data = [none]
} catch (IOException e) { // depends on control dependency: [if], data = [none]
e.printStackTrace();
} finally { // depends on control dependency: [if], data = [none]
if (in != null) {
try {
in.close(); // depends on control dependency: [try], data = [none]
} catch (IOException ee) {
ee.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
}
}
} }
|
public class class_name {
long getMessageLockExpiry() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
final String methodName = "getMessageLockExpiry";
SibTr.entry(this, TRACE, methodName);
SibTr.exit(this, TRACE, methodName, "0");
}
return 0;
} }
|
public class class_name {
long getMessageLockExpiry() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
final String methodName = "getMessageLockExpiry";
SibTr.entry(this, TRACE, methodName); // depends on control dependency: [if], data = [none]
SibTr.exit(this, TRACE, methodName, "0"); // depends on control dependency: [if], data = [none]
}
return 0;
} }
|
public class class_name {
public void removeAllDependencies() {
registryLock.writeLock().lock();
try {
dependingRegistryMapLock.writeLock().lock();
try {
List<Registry> dependingRegistryList = new ArrayList<>(dependingRegistryMap.keySet());
Collections.reverse(dependingRegistryList);
dependingRegistryList.stream().forEach((registry) -> {
dependingRegistryMap.remove(registry).shutdown();
});
} finally {
dependingRegistryMapLock.writeLock().unlock();
}
} finally {
registryLock.writeLock().unlock();
}
} }
|
public class class_name {
public void removeAllDependencies() {
registryLock.writeLock().lock();
try {
dependingRegistryMapLock.writeLock().lock(); // depends on control dependency: [try], data = [none]
try {
List<Registry> dependingRegistryList = new ArrayList<>(dependingRegistryMap.keySet());
Collections.reverse(dependingRegistryList); // depends on control dependency: [try], data = [none]
dependingRegistryList.stream().forEach((registry) -> {
dependingRegistryMap.remove(registry).shutdown(); // depends on control dependency: [try], data = [none]
});
} finally {
dependingRegistryMapLock.writeLock().unlock();
}
} finally {
registryLock.writeLock().unlock();
}
} }
|
public class class_name {
private void encodeStreamBody(StringBuffer result, JsJmsStreamMessage msg) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "encodeStreamBody");
// Internal method to get the stream as a List
try {
List<Object> body = ((JsJmsStreamMessageImpl)msg).getBodyList();
if (body.size() > 0) {
result.append('~');
for (int i = 0; i < body.size(); i++) {
encodeObject(result, body.get(i));
if (i < body.size()-1)
result.append('&');
}
}
}
catch (UnsupportedEncodingException e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageEncoderImpl.encodeStreamBody", "245");
// Just treat it as null.
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "encodeStreamBody");
} }
|
public class class_name {
private void encodeStreamBody(StringBuffer result, JsJmsStreamMessage msg) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "encodeStreamBody");
// Internal method to get the stream as a List
try {
List<Object> body = ((JsJmsStreamMessageImpl)msg).getBodyList();
if (body.size() > 0) {
result.append('~'); // depends on control dependency: [if], data = [none]
for (int i = 0; i < body.size(); i++) {
encodeObject(result, body.get(i)); // depends on control dependency: [for], data = [i]
if (i < body.size()-1)
result.append('&');
}
}
}
catch (UnsupportedEncodingException e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageEncoderImpl.encodeStreamBody", "245");
// Just treat it as null.
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "encodeStreamBody");
} }
|
public class class_name {
public void registerMockResource(String location, String contents) {
try {
mockResources.put(location, new GrailsByteArrayResource(contents.getBytes("UTF-8"), location));
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
public void registerMockResource(String location, String contents) {
try {
mockResources.put(location, new GrailsByteArrayResource(contents.getBytes("UTF-8"), location)); // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void event(Kernel kernel, Event event)
{
if (event == Event.PRE_CLASSLOADER)
{
SecurityActions.setSystemProperty("xb.builder.useUnorderedSequence", "true");
SecurityActions.setSystemProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
SecurityActions.setSystemProperty("log4j.defaultInitOverride", "true");
}
} }
|
public class class_name {
public void event(Kernel kernel, Event event)
{
if (event == Event.PRE_CLASSLOADER)
{
SecurityActions.setSystemProperty("xb.builder.useUnorderedSequence", "true"); // depends on control dependency: [if], data = [none]
SecurityActions.setSystemProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager"); // depends on control dependency: [if], data = [none]
SecurityActions.setSystemProperty("log4j.defaultInitOverride", "true"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Properties toProperties(JSONObject jo) throws JSONException {
Properties properties = new Properties();
if (jo != null) {
// Don't use the new entrySet API to maintain Android support
for (final String key : jo.keySet()) {
Object value = jo.opt(key);
if (!JSONObject.NULL.equals(value)) {
properties.put(key, value.toString());
}
}
}
return properties;
} }
|
public class class_name {
public static Properties toProperties(JSONObject jo) throws JSONException {
Properties properties = new Properties();
if (jo != null) {
// Don't use the new entrySet API to maintain Android support
for (final String key : jo.keySet()) {
Object value = jo.opt(key);
if (!JSONObject.NULL.equals(value)) {
properties.put(key, value.toString()); // depends on control dependency: [if], data = [none]
}
}
}
return properties;
} }
|
public class class_name {
private static byte[] decodeBase64Digest(String base64Digest) {
String expectedPrefix = "sha1-";
if (!base64Digest.startsWith(expectedPrefix)) {
throw new IllegalArgumentException(base64Digest + " did not start with " +
expectedPrefix);
}
base64Digest = base64Digest.replaceFirst(expectedPrefix, "");
byte[] bytes = new byte[0];
try {
bytes = Base64.decode(base64Digest);
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
return bytes;
} }
|
public class class_name {
private static byte[] decodeBase64Digest(String base64Digest) {
String expectedPrefix = "sha1-";
if (!base64Digest.startsWith(expectedPrefix)) {
throw new IllegalArgumentException(base64Digest + " did not start with " +
expectedPrefix);
}
base64Digest = base64Digest.replaceFirst(expectedPrefix, "");
byte[] bytes = new byte[0];
try {
bytes = Base64.decode(base64Digest); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
return bytes;
} }
|
public class class_name {
public final T getParent() {
if (parent == null) {
synchronized (this) {
if (parent == null) {
T ev = getParentFromConfig();
if (ev != null && ev != getSingleRoot()) {
parent = Cast.as(ev);
}
}
}
}
return parent == null ? getSingleRoot() : parent;
} }
|
public class class_name {
public final T getParent() {
if (parent == null) {
synchronized (this) { // depends on control dependency: [if], data = [none]
if (parent == null) {
T ev = getParentFromConfig();
if (ev != null && ev != getSingleRoot()) {
parent = Cast.as(ev); // depends on control dependency: [if], data = [(ev]
}
}
}
}
return parent == null ? getSingleRoot() : parent;
} }
|
public class class_name {
protected String extractLastName(String name) {
if (StringUtils.isBlank(name)) {
return null;
}
int lastIndexOf = name.lastIndexOf(' ');
if (lastIndexOf == -1)
return null;
else
return name.substring(lastIndexOf + 1);
} }
|
public class class_name {
protected String extractLastName(String name) {
if (StringUtils.isBlank(name)) {
return null; // depends on control dependency: [if], data = [none]
}
int lastIndexOf = name.lastIndexOf(' ');
if (lastIndexOf == -1)
return null;
else
return name.substring(lastIndexOf + 1);
} }
|
public class class_name {
public void bindAnnotationConfig(final Class<? extends Annotation> annotationType, final Class<? extends ActionConfig> actionConfigClass) {
final ActionConfig actionConfig = registerNewActionConfiguration(actionConfigClass);
actionConfigs.put(annotationType, actionConfig);
for (final AnnotationParser annotationParser : annotationParsers) {
if (annotationType.equals(annotationParser.getAnnotationType())) {
// parser already exists
return;
}
}
annotationParsers = ArraysUtil.append(annotationParsers, new AnnotationParser(annotationType, Action.class));
} }
|
public class class_name {
public void bindAnnotationConfig(final Class<? extends Annotation> annotationType, final Class<? extends ActionConfig> actionConfigClass) {
final ActionConfig actionConfig = registerNewActionConfiguration(actionConfigClass);
actionConfigs.put(annotationType, actionConfig);
for (final AnnotationParser annotationParser : annotationParsers) {
if (annotationType.equals(annotationParser.getAnnotationType())) {
// parser already exists
return; // depends on control dependency: [if], data = [none]
}
}
annotationParsers = ArraysUtil.append(annotationParsers, new AnnotationParser(annotationType, Action.class));
} }
|
public class class_name {
public static Map<String, Object> getBeansWithAnnotation(ApplicationContext appContext,
Class<? extends Annotation> annotationType) {
try {
return appContext.getBeansWithAnnotation(annotationType);
} catch (BeansException e) {
return new HashMap<String, Object>();
}
} }
|
public class class_name {
public static Map<String, Object> getBeansWithAnnotation(ApplicationContext appContext,
Class<? extends Annotation> annotationType) {
try {
return appContext.getBeansWithAnnotation(annotationType); // depends on control dependency: [try], data = [none]
} catch (BeansException e) {
return new HashMap<String, Object>();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public RandomVariableInterface getCovariance(int timeIndex, int component1, int component2, RandomVariableInterface[] realizationAtTimeIndex) {
RandomVariableInterface[] factorLoadingOfComponent1 = getFactorLoading(timeIndex, component1, realizationAtTimeIndex);
RandomVariableInterface[] factorLoadingOfComponent2 = getFactorLoading(timeIndex, component2, realizationAtTimeIndex);
// Multiply first factor loading (this avoids that we have to init covariance to 0).
RandomVariableInterface covariance = factorLoadingOfComponent1[0].mult(factorLoadingOfComponent2[0]);
// Add others, if any
for(int factorIndex=1; factorIndex<this.getNumberOfFactors(); factorIndex++) {
covariance = covariance.addProduct(factorLoadingOfComponent1[factorIndex],factorLoadingOfComponent2[factorIndex]);
}
return covariance;
} }
|
public class class_name {
public RandomVariableInterface getCovariance(int timeIndex, int component1, int component2, RandomVariableInterface[] realizationAtTimeIndex) {
RandomVariableInterface[] factorLoadingOfComponent1 = getFactorLoading(timeIndex, component1, realizationAtTimeIndex);
RandomVariableInterface[] factorLoadingOfComponent2 = getFactorLoading(timeIndex, component2, realizationAtTimeIndex);
// Multiply first factor loading (this avoids that we have to init covariance to 0).
RandomVariableInterface covariance = factorLoadingOfComponent1[0].mult(factorLoadingOfComponent2[0]);
// Add others, if any
for(int factorIndex=1; factorIndex<this.getNumberOfFactors(); factorIndex++) {
covariance = covariance.addProduct(factorLoadingOfComponent1[factorIndex],factorLoadingOfComponent2[factorIndex]); // depends on control dependency: [for], data = [factorIndex]
}
return covariance;
} }
|
public class class_name {
protected void createFakeTemplateCellsForEmptyOnes(Range oneRowRange,
Map<CellReference, Cell> cellsForOneRowRange,
List<Cell> templateCells) {
if (oneRowRange.toCellReferences().size() != templateCells.size()) {
final HashBiMap<CellReference, Cell> referencesToCells = HashBiMap.create(cellsForOneRowRange);
for (CellReference cellReference : oneRowRange.toCellReferences()) {
if (!cellsForOneRowRange.containsKey(cellReference)) {
Cell newCell = Context.getsmlObjectFactory().createCell();
newCell.setV(null);
newCell.setT(STCellType.STR);
newCell.setR(cellReference.toReference());
templateCells.add(newCell);
referencesToCells.put(cellReference, newCell);
}
}
templateCells.sort((o1, o2) -> {
CellReference cellReference1 = referencesToCells.inverse().get(o1);
CellReference cellReference2 = referencesToCells.inverse().get(o2);
return cellReference1.compareTo(cellReference2);
});
}
} }
|
public class class_name {
protected void createFakeTemplateCellsForEmptyOnes(Range oneRowRange,
Map<CellReference, Cell> cellsForOneRowRange,
List<Cell> templateCells) {
if (oneRowRange.toCellReferences().size() != templateCells.size()) {
final HashBiMap<CellReference, Cell> referencesToCells = HashBiMap.create(cellsForOneRowRange);
for (CellReference cellReference : oneRowRange.toCellReferences()) {
if (!cellsForOneRowRange.containsKey(cellReference)) {
Cell newCell = Context.getsmlObjectFactory().createCell();
newCell.setV(null); // depends on control dependency: [if], data = [none]
newCell.setT(STCellType.STR); // depends on control dependency: [if], data = [none]
newCell.setR(cellReference.toReference()); // depends on control dependency: [if], data = [none]
templateCells.add(newCell); // depends on control dependency: [if], data = [none]
referencesToCells.put(cellReference, newCell); // depends on control dependency: [if], data = [none]
}
}
templateCells.sort((o1, o2) -> {
CellReference cellReference1 = referencesToCells.inverse().get(o1);
CellReference cellReference2 = referencesToCells.inverse().get(o2);
return cellReference1.compareTo(cellReference2);
});
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
void maybeMovePartition(final short partition) {
Observable
.timer(50, TimeUnit.MILLISECONDS)
.filter(ignored -> {
PartitionState ps = sessionState.get(partition);
boolean desiredSeqnoReached = ps.isAtEnd();
if (desiredSeqnoReached) {
LOGGER.debug("Reached desired high seqno {} for vbucket {}, not reopening stream.",
ps.getEndSeqno(), partition);
}
return !desiredSeqnoReached;
})
.flatMapCompletable(ignored -> {
PartitionState ps = sessionState.get(partition);
return startStreamForPartition(
partition,
ps.getLastUuid(),
ps.getStartSeqno(),
ps.getEndSeqno(),
ps.getSnapshotStartSeqno(),
ps.getSnapshotEndSeqno()
).retryWhen(anyOf(NotMyVbucketException.class)
.max(Integer.MAX_VALUE)
.delay(Delay.fixed(200, TimeUnit.MILLISECONDS))
.build());
}).toCompletable().subscribe(new CompletableSubscriber() {
@Override
public void onCompleted() {
LOGGER.trace("Completed Partition Move for partition {}", partition);
}
@Override
public void onError(Throwable e) {
if (e instanceof RollbackException) {
// Benign, so don't log a scary stack trace. A synthetic "rollback" message has been passed
// to the Control Event Handler, which may react by calling Client.rollbackAndRestartStream().
LOGGER.warn("Rollback during Partition Move for partition {}", partition);
} else {
LOGGER.warn("Error during Partition Move for partition {}", partition, e);
}
if (env.eventBus() != null) {
env.eventBus().publish(new FailedToMovePartitionEvent(partition, e));
}
}
@Override
public void onSubscribe(Subscription d) {
LOGGER.debug("Subscribing for Partition Move for partition {}", partition);
}
});
} }
|
public class class_name {
@SuppressWarnings("unchecked")
void maybeMovePartition(final short partition) {
Observable
.timer(50, TimeUnit.MILLISECONDS)
.filter(ignored -> {
PartitionState ps = sessionState.get(partition);
boolean desiredSeqnoReached = ps.isAtEnd();
if (desiredSeqnoReached) {
LOGGER.debug("Reached desired high seqno {} for vbucket {}, not reopening stream.",
ps.getEndSeqno(), partition); // depends on control dependency: [if], data = [none]
}
return !desiredSeqnoReached;
})
.flatMapCompletable(ignored -> {
PartitionState ps = sessionState.get(partition);
return startStreamForPartition(
partition,
ps.getLastUuid(),
ps.getStartSeqno(),
ps.getEndSeqno(),
ps.getSnapshotStartSeqno(),
ps.getSnapshotEndSeqno()
).retryWhen(anyOf(NotMyVbucketException.class)
.max(Integer.MAX_VALUE)
.delay(Delay.fixed(200, TimeUnit.MILLISECONDS))
.build());
}).toCompletable().subscribe(new CompletableSubscriber() {
@Override
public void onCompleted() {
LOGGER.trace("Completed Partition Move for partition {}", partition);
}
@Override
public void onError(Throwable e) {
if (e instanceof RollbackException) {
// Benign, so don't log a scary stack trace. A synthetic "rollback" message has been passed
// to the Control Event Handler, which may react by calling Client.rollbackAndRestartStream().
LOGGER.warn("Rollback during Partition Move for partition {}", partition);
} else {
LOGGER.warn("Error during Partition Move for partition {}", partition, e);
}
if (env.eventBus() != null) {
env.eventBus().publish(new FailedToMovePartitionEvent(partition, e));
}
}
@Override
public void onSubscribe(Subscription d) {
LOGGER.debug("Subscribing for Partition Move for partition {}", partition);
}
});
} }
|
public class class_name {
public List<ResourceHandle> getChildrenByResourceType(final String resourceType) {
final ArrayList<ResourceHandle> children = new ArrayList<>();
if (this.isValid()) {
for (final Resource child : this.resource.getChildren()) {
ResourceHandle handle = ResourceHandle.use(child);
if (handle.isResourceType(resourceType)) {
children.add(handle);
}
}
}
return children;
} }
|
public class class_name {
public List<ResourceHandle> getChildrenByResourceType(final String resourceType) {
final ArrayList<ResourceHandle> children = new ArrayList<>();
if (this.isValid()) {
for (final Resource child : this.resource.getChildren()) {
ResourceHandle handle = ResourceHandle.use(child);
if (handle.isResourceType(resourceType)) {
children.add(handle); // depends on control dependency: [if], data = [none]
}
}
}
return children;
} }
|
public class class_name {
public void addPath(T value, byte[]... parts)
{
int depth = 0;
ByteTrieNode<T> node = _root;
for (byte[] part : parts) {
for (byte b : part) {
ByteTrieNode<T> child = node._children.get(b);
if (child == null) {
child = new ByteTrieNode<T>();
node._children.put(b, child);
}
node = child;
depth++;
}
}
if (depth == 0)
throw new IllegalArgumentException("Parts must contain at least one byte.");
node.setValue(value);
_maxDepth = Math.max(_maxDepth, depth);
} }
|
public class class_name {
public void addPath(T value, byte[]... parts)
{
int depth = 0;
ByteTrieNode<T> node = _root;
for (byte[] part : parts) {
for (byte b : part) {
ByteTrieNode<T> child = node._children.get(b);
if (child == null) {
child = new ByteTrieNode<T>(); // depends on control dependency: [if], data = [none]
node._children.put(b, child); // depends on control dependency: [if], data = [none]
}
node = child; // depends on control dependency: [for], data = [none]
depth++; // depends on control dependency: [for], data = [none]
}
}
if (depth == 0)
throw new IllegalArgumentException("Parts must contain at least one byte.");
node.setValue(value);
_maxDepth = Math.max(_maxDepth, depth);
} }
|
public class class_name {
public static void run(final @Nonnull String message, final @Nonnull ThrowingRunnable runnable) {
Objects.requireNonNull(message, "message must not be null");
Objects.requireNonNull(runnable, "runnable must not be null");
try {
runnable.run();
} catch (final Exception exc) {
throw new RuntimeException(message, exc);
}
} }
|
public class class_name {
public static void run(final @Nonnull String message, final @Nonnull ThrowingRunnable runnable) {
Objects.requireNonNull(message, "message must not be null");
Objects.requireNonNull(runnable, "runnable must not be null");
try {
runnable.run(); // depends on control dependency: [try], data = [none]
} catch (final Exception exc) {
throw new RuntimeException(message, exc);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(Messages messages, ProtocolMarshaller protocolMarshaller) {
if (messages == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(messages.getErrors(), ERRORS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Messages messages, ProtocolMarshaller protocolMarshaller) {
if (messages == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(messages.getErrors(), ERRORS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String getCommandName(Object obj) {
String name = obj.getClass().getName();
int dollar = name.indexOf("_$$_");
if (-1 == dollar) {
name = name.substring(name.lastIndexOf('.') + 1);
} else {
name = name.substring(name.lastIndexOf('.') + 1, dollar);
}
return Strings.uncapitalize(name);
} }
|
public class class_name {
public static String getCommandName(Object obj) {
String name = obj.getClass().getName();
int dollar = name.indexOf("_$$_");
if (-1 == dollar) {
name = name.substring(name.lastIndexOf('.') + 1); // depends on control dependency: [if], data = [none]
} else {
name = name.substring(name.lastIndexOf('.') + 1, dollar); // depends on control dependency: [if], data = [dollar)]
}
return Strings.uncapitalize(name);
} }
|
public class class_name {
public void parse(final String in) {
ParseState state = ParseState.TEXT;
ParseState stateOnEscape = null;
boolean insideSection = false;
String currentSection = null;
String key = null;
Operator operator = Operator.ASSIGN;
final StringBuilder sb = new StringBuilder();
final int len = in.length();
int ndx = 0;
while (ndx < len) {
final char c = in.charAt(ndx);
ndx++;
if (state == ParseState.COMMENT) {
// comment, skip to the end of the line
if (c == '\r') {
if ((ndx < len) && (in.charAt(ndx) == '\n')) {
ndx++;
}
state = ParseState.TEXT;
}
else if (c == '\n') {
state = ParseState.TEXT;
}
} else if (state == ParseState.ESCAPE) {
state = stateOnEscape; //ParseState.VALUE;
switch (c) {
case '\r':
if ((ndx < len) && (in.charAt(ndx) == '\n')) {
ndx++;
}
case '\n':
// need to go 1 step back in order to escape
// the current line ending in the follow-up state
ndx--;
state = ParseState.ESCAPE_NEWLINE;
break;
// encode UTF character
case 'u':
int value = 0;
for (int i = 0; i < 4; i++) {
final char hexChar = in.charAt(ndx++);
if (CharUtil.isDigit(hexChar)) {
value = (value << 4) + hexChar - '0';
} else if (hexChar >= 'a' && hexChar <= 'f') {
value = (value << 4) + 10 + hexChar - 'a';
} else if (hexChar >= 'A' && hexChar <= 'F') {
value = (value << 4) + 10 + hexChar - 'A';
} else {
throw new IllegalArgumentException("Malformed \\uXXXX encoding.");
}
}
sb.append((char) value);
break;
case 't':
sb.append('\t');
break;
case 'n':
sb.append('\n');
break;
case 'r':
sb.append('\r');
break;
case 'f':
sb.append('\f');
break;
default:
sb.append(c);
}
} else if (state == ParseState.TEXT) {
switch (c) {
case '\\':
// escape char, take the next char as is
stateOnEscape = state;
state = ParseState.ESCAPE;
break;
// start section
case '[':
if (sb.length() > 0) {
if (StringUtil.isNotBlank(sb)) {
sb.append(c);
// previous string is not blank, hence it's not the section
break;
}
}
sb.setLength(0);
insideSection = true;
break;
// end section
case ']':
if (insideSection) {
currentSection = sb.toString().trim();
sb.setLength(0);
insideSection = false;
if (currentSection.length() == 0) {
currentSection = null;
}
} else {
sb.append(c);
}
break;
case '#':
case ';':
state = ParseState.COMMENT;
break;
// copy operator
case '<':
if (ndx == len || in.charAt(ndx) != '=') {
sb.append(c);
break;
}
operator = Operator.COPY;
//ndx++;
continue;
// assignment operator
case '+':
if (ndx == len || in.charAt(ndx) != '=') {
sb.append(c);
break;
}
operator = Operator.QUICK_APPEND;
//ndx++;
continue;
case '=':
case ':':
if (key == null) {
key = sb.toString().trim();
sb.setLength(0);
} else {
sb.append(c);
}
state = ParseState.VALUE;
break;
case '\r':
case '\n':
add(currentSection, key, sb, true, operator);
sb.setLength(0);
key = null;
operator = Operator.ASSIGN;
break;
case ' ':
case '\t':
// ignore whitespaces
break;
default:
sb.append(c);
}
} else {
switch (c) {
case '\\':
// escape char, take the next char as is
stateOnEscape = state;
state = ParseState.ESCAPE;
break;
case '\r':
if ((ndx < len) && (in.charAt(ndx) == '\n')) {
ndx++;
}
case '\n':
if (state == ParseState.ESCAPE_NEWLINE) {
sb.append(escapeNewLineValue);
if (!ignorePrefixWhitespacesOnNewLine) {
state = ParseState.VALUE;
}
} else {
add(currentSection, key, sb, true, operator);
sb.setLength(0);
key = null;
operator = Operator.ASSIGN;
// end of value, continue to text
state = ParseState.TEXT;
}
break;
case ' ':
case '\t':
if (state == ParseState.ESCAPE_NEWLINE) {
break;
}
default:
sb.append(c);
state = ParseState.VALUE;
if (multilineValues) {
if (sb.length() == 3) {
// check for ''' beginning
if (sb.toString().equals("'''")) {
sb.setLength(0);
int endIndex = in.indexOf("'''", ndx);
if (endIndex == -1) {
endIndex = in.length();
}
sb.append(in, ndx, endIndex);
// append
add(currentSection, key, sb, false, operator);
sb.setLength(0);
key = null;
operator = Operator.ASSIGN;
// end of value, continue to text
state = ParseState.TEXT;
ndx = endIndex + 3;
}
}
}
}
}
}
if (key != null) {
add(currentSection, key, sb, true, operator);
}
} }
|
public class class_name {
public void parse(final String in) {
ParseState state = ParseState.TEXT;
ParseState stateOnEscape = null;
boolean insideSection = false;
String currentSection = null;
String key = null;
Operator operator = Operator.ASSIGN;
final StringBuilder sb = new StringBuilder();
final int len = in.length();
int ndx = 0;
while (ndx < len) {
final char c = in.charAt(ndx);
ndx++; // depends on control dependency: [while], data = [none]
if (state == ParseState.COMMENT) {
// comment, skip to the end of the line
if (c == '\r') {
if ((ndx < len) && (in.charAt(ndx) == '\n')) {
ndx++; // depends on control dependency: [if], data = [none]
}
state = ParseState.TEXT; // depends on control dependency: [if], data = [none]
}
else if (c == '\n') {
state = ParseState.TEXT; // depends on control dependency: [if], data = [none]
}
} else if (state == ParseState.ESCAPE) {
state = stateOnEscape; //ParseState.VALUE; // depends on control dependency: [if], data = [none]
switch (c) {
case '\r':
if ((ndx < len) && (in.charAt(ndx) == '\n')) {
ndx++; // depends on control dependency: [if], data = [none]
}
case '\n':
// need to go 1 step back in order to escape
// the current line ending in the follow-up state
ndx--;
state = ParseState.ESCAPE_NEWLINE;
break;
// encode UTF character
case 'u':
int value = 0;
for (int i = 0; i < 4; i++) {
final char hexChar = in.charAt(ndx++);
if (CharUtil.isDigit(hexChar)) {
value = (value << 4) + hexChar - '0'; // depends on control dependency: [if], data = [none]
} else if (hexChar >= 'a' && hexChar <= 'f') {
value = (value << 4) + 10 + hexChar - 'a'; // depends on control dependency: [if], data = [none]
} else if (hexChar >= 'A' && hexChar <= 'F') {
value = (value << 4) + 10 + hexChar - 'A'; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Malformed \\uXXXX encoding.");
}
}
sb.append((char) value);
break;
case 't':
sb.append('\t');
break;
case 'n':
sb.append('\n');
break;
case 'r':
sb.append('\r');
break;
case 'f':
sb.append('\f');
break;
default:
sb.append(c);
}
} else if (state == ParseState.TEXT) {
switch (c) {
case '\\':
// escape char, take the next char as is
stateOnEscape = state;
state = ParseState.ESCAPE;
break;
// start section
case '[':
if (sb.length() > 0) {
if (StringUtil.isNotBlank(sb)) {
sb.append(c); // depends on control dependency: [if], data = [none]
// previous string is not blank, hence it's not the section
break;
}
}
sb.setLength(0);
insideSection = true;
break;
// end section
case ']':
if (insideSection) {
currentSection = sb.toString().trim(); // depends on control dependency: [if], data = [none]
sb.setLength(0); // depends on control dependency: [if], data = [none]
insideSection = false; // depends on control dependency: [if], data = [none]
if (currentSection.length() == 0) {
currentSection = null; // depends on control dependency: [if], data = [none]
}
} else {
sb.append(c); // depends on control dependency: [if], data = [none]
}
break;
case '#':
case ';':
state = ParseState.COMMENT;
break;
// copy operator
case '<':
if (ndx == len || in.charAt(ndx) != '=') {
sb.append(c); // depends on control dependency: [if], data = [none]
break;
}
operator = Operator.COPY;
//ndx++;
continue;
// assignment operator
case '+':
if (ndx == len || in.charAt(ndx) != '=') {
sb.append(c); // depends on control dependency: [if], data = [none]
break;
}
operator = Operator.QUICK_APPEND;
//ndx++;
continue;
case '=':
case ':':
if (key == null) {
key = sb.toString().trim(); // depends on control dependency: [if], data = [none]
sb.setLength(0); // depends on control dependency: [if], data = [none]
} else {
sb.append(c); // depends on control dependency: [if], data = [none]
}
state = ParseState.VALUE;
break;
case '\r':
case '\n':
add(currentSection, key, sb, true, operator);
sb.setLength(0);
key = null;
operator = Operator.ASSIGN;
break;
case ' ':
case '\t':
// ignore whitespaces
break;
default:
sb.append(c);
}
} else {
switch (c) {
case '\\':
// escape char, take the next char as is
stateOnEscape = state;
state = ParseState.ESCAPE;
break;
case '\r':
if ((ndx < len) && (in.charAt(ndx) == '\n')) {
ndx++; // depends on control dependency: [if], data = [none]
}
case '\n':
if (state == ParseState.ESCAPE_NEWLINE) {
sb.append(escapeNewLineValue); // depends on control dependency: [if], data = [none]
if (!ignorePrefixWhitespacesOnNewLine) {
state = ParseState.VALUE; // depends on control dependency: [if], data = [none]
}
} else {
add(currentSection, key, sb, true, operator); // depends on control dependency: [if], data = [none]
sb.setLength(0); // depends on control dependency: [if], data = [none]
key = null; // depends on control dependency: [if], data = [none]
operator = Operator.ASSIGN; // depends on control dependency: [if], data = [none]
// end of value, continue to text
state = ParseState.TEXT; // depends on control dependency: [if], data = [none]
}
break;
case ' ':
case '\t':
if (state == ParseState.ESCAPE_NEWLINE) {
break;
}
default:
sb.append(c);
state = ParseState.VALUE;
if (multilineValues) {
if (sb.length() == 3) {
// check for ''' beginning
if (sb.toString().equals("'''")) {
sb.setLength(0); // depends on control dependency: [if], data = [none]
int endIndex = in.indexOf("'''", ndx);
if (endIndex == -1) {
endIndex = in.length(); // depends on control dependency: [if], data = [none]
}
sb.append(in, ndx, endIndex); // depends on control dependency: [if], data = [none]
// append
add(currentSection, key, sb, false, operator); // depends on control dependency: [if], data = [none]
sb.setLength(0); // depends on control dependency: [if], data = [none]
key = null; // depends on control dependency: [if], data = [none]
operator = Operator.ASSIGN; // depends on control dependency: [if], data = [none]
// end of value, continue to text
state = ParseState.TEXT; // depends on control dependency: [if], data = [none]
ndx = endIndex + 3; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
if (key != null) {
add(currentSection, key, sb, true, operator); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String getFields() {
if (m_parameters.getFields() == null) {
return "";
}
StringBuffer result = new StringBuffer();
Iterator<String> it = m_parameters.getFields().iterator();
while (it.hasNext()) {
result.append(it.next());
result.append(" ");
}
return result.toString();
} }
|
public class class_name {
public String getFields() {
if (m_parameters.getFields() == null) {
return ""; // depends on control dependency: [if], data = [none]
}
StringBuffer result = new StringBuffer();
Iterator<String> it = m_parameters.getFields().iterator();
while (it.hasNext()) {
result.append(it.next()); // depends on control dependency: [while], data = [none]
result.append(" "); // depends on control dependency: [while], data = [none]
}
return result.toString();
} }
|
public class class_name {
public ContainerDefinition withResourceRequirements(ResourceRequirement... resourceRequirements) {
if (this.resourceRequirements == null) {
setResourceRequirements(new com.amazonaws.internal.SdkInternalList<ResourceRequirement>(resourceRequirements.length));
}
for (ResourceRequirement ele : resourceRequirements) {
this.resourceRequirements.add(ele);
}
return this;
} }
|
public class class_name {
public ContainerDefinition withResourceRequirements(ResourceRequirement... resourceRequirements) {
if (this.resourceRequirements == null) {
setResourceRequirements(new com.amazonaws.internal.SdkInternalList<ResourceRequirement>(resourceRequirements.length)); // depends on control dependency: [if], data = [none]
}
for (ResourceRequirement ele : resourceRequirements) {
this.resourceRequirements.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
protected void updateComputerList(final boolean automaticSlaveLaunch) {
final Map<Node,Computer> computers = getComputerMap();
final Set<Computer> old = new HashSet<Computer>(computers.size());
Queue.withLock(new Runnable() {
@Override
public void run() {
Map<String,Computer> byName = new HashMap<String,Computer>();
for (Computer c : computers.values()) {
old.add(c);
Node node = c.getNode();
if (node == null)
continue; // this computer is gone
byName.put(node.getNodeName(),c);
}
Set<Computer> used = new HashSet<>(old.size());
updateComputer(AbstractCIBase.this, byName, used, automaticSlaveLaunch);
for (Node s : getNodes()) {
long start = System.currentTimeMillis();
updateComputer(s, byName, used, automaticSlaveLaunch);
if (LOG_STARTUP_PERFORMANCE && LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(String.format("Took %dms to update node %s",
System.currentTimeMillis() - start, s.getNodeName()));
}
}
// find out what computers are removed, and kill off all executors.
// when all executors exit, it will be removed from the computers map.
// so don't remove too quickly
old.removeAll(used);
// we need to start the process of reducing the executors on all computers as distinct
// from the killing action which should not excessively use the Queue lock.
for (Computer c : old) {
c.inflictMortalWound();
}
}
});
for (Computer c : old) {
// when we get to here, the number of executors should be zero so this call should not need the Queue.lock
killComputer(c);
}
getQueue().scheduleMaintenance();
for (ComputerListener cl : ComputerListener.all()) {
try {
cl.onConfigurationChange();
} catch (Throwable t) {
LOGGER.log(Level.WARNING, null, t);
}
}
} }
|
public class class_name {
protected void updateComputerList(final boolean automaticSlaveLaunch) {
final Map<Node,Computer> computers = getComputerMap();
final Set<Computer> old = new HashSet<Computer>(computers.size());
Queue.withLock(new Runnable() {
@Override
public void run() {
Map<String,Computer> byName = new HashMap<String,Computer>();
for (Computer c : computers.values()) {
old.add(c); // depends on control dependency: [for], data = [c]
Node node = c.getNode();
if (node == null)
continue; // this computer is gone
byName.put(node.getNodeName(),c); // depends on control dependency: [for], data = [c]
}
Set<Computer> used = new HashSet<>(old.size());
updateComputer(AbstractCIBase.this, byName, used, automaticSlaveLaunch);
for (Node s : getNodes()) {
long start = System.currentTimeMillis();
updateComputer(s, byName, used, automaticSlaveLaunch); // depends on control dependency: [for], data = [s]
if (LOG_STARTUP_PERFORMANCE && LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(String.format("Took %dms to update node %s",
System.currentTimeMillis() - start, s.getNodeName())); // depends on control dependency: [if], data = [none]
}
}
// find out what computers are removed, and kill off all executors.
// when all executors exit, it will be removed from the computers map.
// so don't remove too quickly
old.removeAll(used);
// we need to start the process of reducing the executors on all computers as distinct
// from the killing action which should not excessively use the Queue lock.
for (Computer c : old) {
c.inflictMortalWound(); // depends on control dependency: [for], data = [c]
}
}
});
for (Computer c : old) {
// when we get to here, the number of executors should be zero so this call should not need the Queue.lock
killComputer(c); // depends on control dependency: [for], data = [c]
}
getQueue().scheduleMaintenance();
for (ComputerListener cl : ComputerListener.all()) {
try {
cl.onConfigurationChange(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
LOGGER.log(Level.WARNING, null, t);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static String inputStream2String(final InputStream is, final String charsetName) {
if (is == null || isSpace(charsetName)) return null;
try {
return new String(inputStream2Bytes(is), charsetName);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
} }
|
public class class_name {
public static String inputStream2String(final InputStream is, final String charsetName) {
if (is == null || isSpace(charsetName)) return null;
try {
return new String(inputStream2Bytes(is), charsetName); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Coordinate getCoordinateN(int n) {
if (isEmpty()) {
return null;
}
if (n >= 0 && n < coordinates.length) {
return coordinates[n];
}
return null;
} }
|
public class class_name {
public Coordinate getCoordinateN(int n) {
if (isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
if (n >= 0 && n < coordinates.length) {
return coordinates[n]; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public T addParameters(String key, Object value) {
try {
if (this.params_ == null) {
this.params_ = new JSONObject();
}
this.params_.put(key, value);
} catch (JSONException ignore) {
}
return (T) this;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public T addParameters(String key, Object value) {
try {
if (this.params_ == null) {
this.params_ = new JSONObject(); // depends on control dependency: [if], data = [none]
}
this.params_.put(key, value); // depends on control dependency: [try], data = [none]
} catch (JSONException ignore) {
} // depends on control dependency: [catch], data = [none]
return (T) this;
} }
|
public class class_name {
@Override
protected AuthenticationHandlerExecutionResult doAuthentication(final Credential credential) throws GeneralSecurityException {
val x509Credential = (X509CertificateCredential) credential;
val certificates = x509Credential.getCertificates();
var clientCert = (X509Certificate) null;
var hasTrustedIssuer = false;
for (var i = certificates.length - 1; i >= 0; i--) {
val certificate = certificates[i];
LOGGER.debug("Evaluating [{}]", CertUtils.toString(certificate));
validate(certificate);
if (!hasTrustedIssuer) {
hasTrustedIssuer = isCertificateFromTrustedIssuer(certificate);
}
val pathLength = certificate.getBasicConstraints();
if (pathLength < 0) {
LOGGER.debug("Found valid client certificate");
clientCert = certificate;
} else {
LOGGER.debug("Found valid CA certificate");
}
}
if (hasTrustedIssuer && clientCert != null) {
x509Credential.setCertificate(clientCert);
return new DefaultAuthenticationHandlerExecutionResult(this, x509Credential,
this.principalFactory.createPrincipal(x509Credential.getId()));
}
LOGGER.warn("Either client certificate could not be determined, or a trusted issuer could not be located");
throw new FailedLoginException();
} }
|
public class class_name {
@Override
protected AuthenticationHandlerExecutionResult doAuthentication(final Credential credential) throws GeneralSecurityException {
val x509Credential = (X509CertificateCredential) credential;
val certificates = x509Credential.getCertificates();
var clientCert = (X509Certificate) null;
var hasTrustedIssuer = false;
for (var i = certificates.length - 1; i >= 0; i--) {
val certificate = certificates[i];
LOGGER.debug("Evaluating [{}]", CertUtils.toString(certificate));
validate(certificate);
if (!hasTrustedIssuer) {
hasTrustedIssuer = isCertificateFromTrustedIssuer(certificate); // depends on control dependency: [if], data = [none]
}
val pathLength = certificate.getBasicConstraints();
if (pathLength < 0) {
LOGGER.debug("Found valid client certificate"); // depends on control dependency: [if], data = [none]
clientCert = certificate; // depends on control dependency: [if], data = [none]
} else {
LOGGER.debug("Found valid CA certificate"); // depends on control dependency: [if], data = [none]
}
}
if (hasTrustedIssuer && clientCert != null) {
x509Credential.setCertificate(clientCert);
return new DefaultAuthenticationHandlerExecutionResult(this, x509Credential,
this.principalFactory.createPrincipal(x509Credential.getId()));
}
LOGGER.warn("Either client certificate could not be determined, or a trusted issuer could not be located");
throw new FailedLoginException();
} }
|
public class class_name {
public EEnum getExternalAlgorithmRGPADALMT() {
if (externalAlgorithmRGPADALMTEEnum == null) {
externalAlgorithmRGPADALMTEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(130);
}
return externalAlgorithmRGPADALMTEEnum;
} }
|
public class class_name {
public EEnum getExternalAlgorithmRGPADALMT() {
if (externalAlgorithmRGPADALMTEEnum == null) {
externalAlgorithmRGPADALMTEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(130); // depends on control dependency: [if], data = [none]
}
return externalAlgorithmRGPADALMTEEnum;
} }
|
public class class_name {
@Override
public void close() {
if (conn != null) {
LOG.trace("Close connection. conn[{}], hashCode[{}]", conn, conn.hashCode());
try {
conn.close();
} catch (SQLException e) {
throw new UroborosqlSQLException(e);
}
conn = null;
}
} }
|
public class class_name {
@Override
public void close() {
if (conn != null) {
LOG.trace("Close connection. conn[{}], hashCode[{}]", conn, conn.hashCode()); // depends on control dependency: [if], data = [none]
try {
conn.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new UroborosqlSQLException(e);
} // depends on control dependency: [catch], data = [none]
conn = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected final Constraint getConstraint(final Element element) {
Element constraintElement = element.getChild(XMLTags.CONSTRAINT);
if (constraintElement != null) {
return generator.getConstraintFactory().createModel(random, constraintElement);
}
constraintElement = element.getChild(XMLTags.CONSTRAINT_REF);
if (constraintElement != null) {
try {
return generator.getConstraintFactory().getModel(constraintElement);
} catch (IdNotFoundException e) {
log.error("Could not find constraint in map. Maybe it has not been initialised;"
+ " in this case, try rearranging order of constraints in the xml file.", e);
}
}
throw new IllegalStateException("No element constraint or constraint_ref could be found for " + this);
} }
|
public class class_name {
protected final Constraint getConstraint(final Element element) {
Element constraintElement = element.getChild(XMLTags.CONSTRAINT);
if (constraintElement != null) {
return generator.getConstraintFactory().createModel(random, constraintElement);
// depends on control dependency: [if], data = [none]
}
constraintElement = element.getChild(XMLTags.CONSTRAINT_REF);
if (constraintElement != null) {
try {
return generator.getConstraintFactory().getModel(constraintElement);
// depends on control dependency: [try], data = [none]
} catch (IdNotFoundException e) {
log.error("Could not find constraint in map. Maybe it has not been initialised;"
+ " in this case, try rearranging order of constraints in the xml file.", e);
}
// depends on control dependency: [catch], data = [none]
}
throw new IllegalStateException("No element constraint or constraint_ref could be found for " + this);
} }
|
public class class_name {
public static void addFiles(final Project findBugsProject, File clzDir, final Pattern pat) {
if (clzDir.isDirectory()) {
clzDir.listFiles(new FileCollector(pat, findBugsProject));
}
} }
|
public class class_name {
public static void addFiles(final Project findBugsProject, File clzDir, final Pattern pat) {
if (clzDir.isDirectory()) {
clzDir.listFiles(new FileCollector(pat, findBugsProject)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Object invokeMethod(String name, Object args) {
if (args != null && Object[].class.isAssignableFrom(args.getClass())) {
Object[] arr = (Object[]) args;
if (arr.length == 0) {
return setAndGetContent(name, new HashMap<String, Object>());
} else if (arr.length == 1) {
if (arr[0] instanceof Closure) {
return setAndGetContent(name, JsonDelegate.cloneDelegateAndGetContent((Closure) arr[0]));
} else if (arr[0] instanceof Map) {
return setAndGetContent(name, arr[0]);
}
} else if (arr.length == 2) {
final Object first = arr[0];
final Object second = arr[1];
if (second instanceof Closure) {
final Closure closure = (Closure)second;
if (first instanceof Map) {
Map subMap = new LinkedHashMap();
subMap.putAll((Map) first);
subMap.putAll(JsonDelegate.cloneDelegateAndGetContent(closure));
return setAndGetContent(name, subMap);
} else if (first instanceof Iterable) {
List<Map<String, Object>> list = collectContentForEachEntry((Iterable) first, closure);
return setAndGetContent(name, list);
} else if (first != null && first.getClass().isArray()) {
final Iterable coll = Arrays.asList((Object[])first);
List<Map<String, Object>> list = collectContentForEachEntry(coll, closure);
return setAndGetContent(name, list);
}
}
}
throw new JsonException("Expected no arguments, a single map, a single closure, or a map and closure as arguments.");
} else {
return setAndGetContent(name, new HashMap<String, Object>());
}
} }
|
public class class_name {
public Object invokeMethod(String name, Object args) {
if (args != null && Object[].class.isAssignableFrom(args.getClass())) {
Object[] arr = (Object[]) args;
if (arr.length == 0) {
return setAndGetContent(name, new HashMap<String, Object>()); // depends on control dependency: [if], data = [none]
} else if (arr.length == 1) {
if (arr[0] instanceof Closure) {
return setAndGetContent(name, JsonDelegate.cloneDelegateAndGetContent((Closure) arr[0])); // depends on control dependency: [if], data = [none]
} else if (arr[0] instanceof Map) {
return setAndGetContent(name, arr[0]); // depends on control dependency: [if], data = [none]
}
} else if (arr.length == 2) {
final Object first = arr[0];
final Object second = arr[1];
if (second instanceof Closure) {
final Closure closure = (Closure)second;
if (first instanceof Map) {
Map subMap = new LinkedHashMap();
subMap.putAll((Map) first); // depends on control dependency: [if], data = [none]
subMap.putAll(JsonDelegate.cloneDelegateAndGetContent(closure)); // depends on control dependency: [if], data = [none]
return setAndGetContent(name, subMap); // depends on control dependency: [if], data = [none]
} else if (first instanceof Iterable) {
List<Map<String, Object>> list = collectContentForEachEntry((Iterable) first, closure);
return setAndGetContent(name, list); // depends on control dependency: [if], data = [none]
} else if (first != null && first.getClass().isArray()) {
final Iterable coll = Arrays.asList((Object[])first);
List<Map<String, Object>> list = collectContentForEachEntry(coll, closure);
return setAndGetContent(name, list); // depends on control dependency: [if], data = [none]
}
}
}
throw new JsonException("Expected no arguments, a single map, a single closure, or a map and closure as arguments.");
} else {
return setAndGetContent(name, new HashMap<String, Object>()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static boolean safeCloseAll(Closeable... closeables) {
boolean result = true;
for (final Closeable c : closeables) {
result &= safeClose(c);
}
return result;
} }
|
public class class_name {
public static boolean safeCloseAll(Closeable... closeables) {
boolean result = true;
for (final Closeable c : closeables) {
result &= safeClose(c); // depends on control dependency: [for], data = [c]
}
return result;
} }
|
public class class_name {
@Override
public String visit(IndexedClass element) {
ElkClass entity = element.getElkEntity();
if (entity.getIri().equals(PredefinedElkIris.OWL_THING)) {
return "⊤";
}
// else
if (entity.getIri().equals(PredefinedElkIris.OWL_NOTHING)) {
return "⊥";
}
// else
return entity.toString();
} }
|
public class class_name {
@Override
public String visit(IndexedClass element) {
ElkClass entity = element.getElkEntity();
if (entity.getIri().equals(PredefinedElkIris.OWL_THING)) {
return "⊤"; // depends on control dependency: [if], data = [none]
}
// else
if (entity.getIri().equals(PredefinedElkIris.OWL_NOTHING)) {
return "⊥"; // depends on control dependency: [if], data = [none]
}
// else
return entity.toString();
} }
|
public class class_name {
protected CmsLock getRelatedLock() {
if (m_relatedLock == null) {
CmsLockType type;
if (isSystemLock()) {
type = CmsLockType.UNLOCKED;
} else {
type = CmsLockType.SYSTEM_UNLOCKED;
}
CmsLock lock = new CmsLock(getResourceName(), getUserId(), getProject(), type);
lock.setRelatedLock(this);
if (isUnlocked()) {
// prevent the null lock gets modified
return lock;
}
m_relatedLock = lock;
}
return m_relatedLock;
} }
|
public class class_name {
protected CmsLock getRelatedLock() {
if (m_relatedLock == null) {
CmsLockType type;
if (isSystemLock()) {
type = CmsLockType.UNLOCKED; // depends on control dependency: [if], data = [none]
} else {
type = CmsLockType.SYSTEM_UNLOCKED; // depends on control dependency: [if], data = [none]
}
CmsLock lock = new CmsLock(getResourceName(), getUserId(), getProject(), type);
lock.setRelatedLock(this); // depends on control dependency: [if], data = [none]
if (isUnlocked()) {
// prevent the null lock gets modified
return lock; // depends on control dependency: [if], data = [none]
}
m_relatedLock = lock; // depends on control dependency: [if], data = [none]
}
return m_relatedLock;
} }
|
public class class_name {
protected boolean delistResource(XAResource xaRes, int flag) throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "delistResource", new Object[] { xaRes, Util.printFlag(flag) });
// get resource manager instance
JTAResourceBase jtaRes = (JTAResourceBase) getResourceTable().get(xaRes);
if (jtaRes == null && _onePhaseResourceEnlisted != null) {
if (_onePhaseResourceEnlisted.XAResource().equals(xaRes))
jtaRes = _onePhaseResourceEnlisted;
}
if (jtaRes == null) {
Tr.error(tc, "WTRN0065_XARESOURCE_NOT_KNOWN", xaRes);
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", Boolean.FALSE);
return false;
}
// try to end transaction association using specified flag.
try {
jtaRes.end(flag);
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.delistResource", "711", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
Throwable toThrow = null;
if (_errorCode >= XAException.XA_RBBASE &&
_errorCode <= XAException.XA_RBEND) {
if (tc.isEventEnabled())
Tr.event(tc, "Transaction branch has been marked rollback-only by the RM");
} else if (_errorCode == XAException.XAER_RMFAIL) {
if (tc.isEventEnabled())
Tr.event(tc, "RM has failed");
// Resource has rolled back
jtaRes.setResourceStatus(StatefulResource.ROLLEDBACK);
jtaRes.destroy();
} else // XAER_RMERR, XAER_INVAL, XAER_PROTO, XAER_NOTA
{
Tr.error(tc, "WTRN0079_END_FAILED", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae });
toThrow = new SystemException("XAResource end association error:" + XAReturnCodeHelper.convertXACode(_errorCode)).initCause(xae);
}
// Mark transaction as rollback only.
try {
_transaction.setRollbackOnly();
if (tc.isEventEnabled())
Tr.event(tc, "Transaction marked as rollback only.");
} catch (IllegalStateException e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RegisteredResources.delistResource", "742", this);
toThrow = new SystemException(e.getLocalizedMessage()).initCause(e);
}
if (toThrow != null) {
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", toThrow);
throw (SystemException) toThrow;
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", Boolean.TRUE);
return true;
} }
|
public class class_name {
protected boolean delistResource(XAResource xaRes, int flag) throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "delistResource", new Object[] { xaRes, Util.printFlag(flag) });
// get resource manager instance
JTAResourceBase jtaRes = (JTAResourceBase) getResourceTable().get(xaRes);
if (jtaRes == null && _onePhaseResourceEnlisted != null) {
if (_onePhaseResourceEnlisted.XAResource().equals(xaRes))
jtaRes = _onePhaseResourceEnlisted;
}
if (jtaRes == null) {
Tr.error(tc, "WTRN0065_XARESOURCE_NOT_KNOWN", xaRes); // depends on control dependency: [if], data = [none]
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", Boolean.FALSE);
return false; // depends on control dependency: [if], data = [none]
}
// try to end transaction association using specified flag.
try {
jtaRes.end(flag); // depends on control dependency: [try], data = [none]
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.delistResource", "711", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
Throwable toThrow = null;
if (_errorCode >= XAException.XA_RBBASE &&
_errorCode <= XAException.XA_RBEND) {
if (tc.isEventEnabled())
Tr.event(tc, "Transaction branch has been marked rollback-only by the RM");
} else if (_errorCode == XAException.XAER_RMFAIL) {
if (tc.isEventEnabled())
Tr.event(tc, "RM has failed");
// Resource has rolled back
jtaRes.setResourceStatus(StatefulResource.ROLLEDBACK); // depends on control dependency: [if], data = [none]
jtaRes.destroy(); // depends on control dependency: [if], data = [none]
} else // XAER_RMERR, XAER_INVAL, XAER_PROTO, XAER_NOTA
{
Tr.error(tc, "WTRN0079_END_FAILED", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae }); // depends on control dependency: [if], data = [(_errorCode]
toThrow = new SystemException("XAResource end association error:" + XAReturnCodeHelper.convertXACode(_errorCode)).initCause(xae); // depends on control dependency: [if], data = [(_errorCode]
}
// Mark transaction as rollback only.
try {
_transaction.setRollbackOnly(); // depends on control dependency: [try], data = [none]
if (tc.isEventEnabled())
Tr.event(tc, "Transaction marked as rollback only.");
} catch (IllegalStateException e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RegisteredResources.delistResource", "742", this);
toThrow = new SystemException(e.getLocalizedMessage()).initCause(e);
} // depends on control dependency: [catch], data = [none]
if (toThrow != null) {
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", toThrow);
throw (SystemException) toThrow;
}
} // depends on control dependency: [catch], data = [none]
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", Boolean.TRUE);
return true;
} }
|
public class class_name {
public static String getFirstSubstring(final String inputString,
final String startingWith, final String endingWith) {
if (!inputString.contains(startingWith)
|| !inputString.contains(endingWith)) {
return null;
}
final int startIndex = inputString.indexOf(startingWith);
if (!((startIndex + 1) < inputString.length())) {
return null;
}
final int endIndex = inputString.indexOf(endingWith, startIndex + 1)
+ 1;
if (startIndex > endIndex || startIndex < 0 || endIndex < 0) {
return null;
}
return inputString.substring(startIndex, endIndex);
} }
|
public class class_name {
public static String getFirstSubstring(final String inputString,
final String startingWith, final String endingWith) {
if (!inputString.contains(startingWith)
|| !inputString.contains(endingWith)) {
return null; // depends on control dependency: [if], data = [none]
}
final int startIndex = inputString.indexOf(startingWith);
if (!((startIndex + 1) < inputString.length())) {
return null; // depends on control dependency: [if], data = [none]
}
final int endIndex = inputString.indexOf(endingWith, startIndex + 1)
+ 1;
if (startIndex > endIndex || startIndex < 0 || endIndex < 0) {
return null; // depends on control dependency: [if], data = [none]
}
return inputString.substring(startIndex, endIndex);
} }
|
public class class_name {
public static <T> Response call(RestUtils.RestCallable<T> callable,
AlluxioConfiguration alluxioConf, @Nullable Map<String, Object> headers) {
try {
// TODO(cc): reconsider how to enable authentication
if (SecurityUtils.isSecurityEnabled(alluxioConf)
&& AuthenticatedClientUser.get(alluxioConf) == null) {
AuthenticatedClientUser.set(LoginUser.get(alluxioConf).getName());
}
} catch (IOException e) {
LOG.warn("Failed to set AuthenticatedClientUser in REST service handler: {}", e.getMessage());
return createErrorResponse(e, alluxioConf);
}
try {
return createResponse(callable.call(), alluxioConf, headers);
} catch (Exception e) {
LOG.warn("Unexpected error invoking rest endpoint: {}", e.getMessage());
return createErrorResponse(e, alluxioConf);
}
} }
|
public class class_name {
public static <T> Response call(RestUtils.RestCallable<T> callable,
AlluxioConfiguration alluxioConf, @Nullable Map<String, Object> headers) {
try {
// TODO(cc): reconsider how to enable authentication
if (SecurityUtils.isSecurityEnabled(alluxioConf)
&& AuthenticatedClientUser.get(alluxioConf) == null) {
AuthenticatedClientUser.set(LoginUser.get(alluxioConf).getName()); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
LOG.warn("Failed to set AuthenticatedClientUser in REST service handler: {}", e.getMessage());
return createErrorResponse(e, alluxioConf);
} // depends on control dependency: [catch], data = [none]
try {
return createResponse(callable.call(), alluxioConf, headers); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.warn("Unexpected error invoking rest endpoint: {}", e.getMessage());
return createErrorResponse(e, alluxioConf);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static BaasUser withUserName(String username) {
BaasUser current = current();
if (current != null && current.username.equals(username)) {
return current;
}
return new BaasUser(username);
} }
|
public class class_name {
public static BaasUser withUserName(String username) {
BaasUser current = current();
if (current != null && current.username.equals(username)) {
return current; // depends on control dependency: [if], data = [none]
}
return new BaasUser(username);
} }
|
public class class_name {
public void marshall(InviteAccountToOrganizationRequest inviteAccountToOrganizationRequest, ProtocolMarshaller protocolMarshaller) {
if (inviteAccountToOrganizationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inviteAccountToOrganizationRequest.getTarget(), TARGET_BINDING);
protocolMarshaller.marshall(inviteAccountToOrganizationRequest.getNotes(), NOTES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(InviteAccountToOrganizationRequest inviteAccountToOrganizationRequest, ProtocolMarshaller protocolMarshaller) {
if (inviteAccountToOrganizationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inviteAccountToOrganizationRequest.getTarget(), TARGET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(inviteAccountToOrganizationRequest.getNotes(), NOTES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void moduleMetaDataCreated(MetaDataEvent<ModuleMetaData> event) throws MetaDataException {
// We only save meta data if it is for a web module
if (event.getMetaData() instanceof WebModuleMetaData) {
String appName = event.getMetaData().getJ2EEName().getApplication();
// Synchronization needed here, so only the first web module in an app initializes the data structures.
// The if condition and the logic in the else clause must be run without any other threads changing webModulesInStartingApps
synchronized (webModulesInStartingApps_lock) {
if (webModulesInStartingApps.containsKey(appName)) {
// Some other web module was already found for this app, so just get the HashMap for this app and add the new metadata to it
webModulesInStartingApps.get(appName).put(event.getMetaData().getJ2EEName(),(WebModuleMetaData)event.getMetaData());
}
else {
// First web module for this app, so initialize the set of WebModuleMetaDatas
// Store the WebModuleMetaData in webModulesInStartingApps
ConcurrentHashMap<J2EEName,WebModuleMetaData>moduleMetadatas = new ConcurrentHashMap<J2EEName,WebModuleMetaData>();
moduleMetadatas.put(event.getMetaData().getJ2EEName(),(WebModuleMetaData)event.getMetaData());
webModulesInStartingApps.put(appName, moduleMetadatas);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "WebModule metadata saved for " + event.getMetaData().getJ2EEName());
}
}
} }
|
public class class_name {
@Override
public void moduleMetaDataCreated(MetaDataEvent<ModuleMetaData> event) throws MetaDataException {
// We only save meta data if it is for a web module
if (event.getMetaData() instanceof WebModuleMetaData) {
String appName = event.getMetaData().getJ2EEName().getApplication();
// Synchronization needed here, so only the first web module in an app initializes the data structures.
// The if condition and the logic in the else clause must be run without any other threads changing webModulesInStartingApps
synchronized (webModulesInStartingApps_lock) {
if (webModulesInStartingApps.containsKey(appName)) {
// Some other web module was already found for this app, so just get the HashMap for this app and add the new metadata to it
webModulesInStartingApps.get(appName).put(event.getMetaData().getJ2EEName(),(WebModuleMetaData)event.getMetaData()); // depends on control dependency: [if], data = [none]
}
else {
// First web module for this app, so initialize the set of WebModuleMetaDatas
// Store the WebModuleMetaData in webModulesInStartingApps
ConcurrentHashMap<J2EEName,WebModuleMetaData>moduleMetadatas = new ConcurrentHashMap<J2EEName,WebModuleMetaData>();
moduleMetadatas.put(event.getMetaData().getJ2EEName(),(WebModuleMetaData)event.getMetaData()); // depends on control dependency: [if], data = [none]
webModulesInStartingApps.put(appName, moduleMetadatas); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "WebModule metadata saved for " + event.getMetaData().getJ2EEName()); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void listContents() throws IOException {
for (;;) {
TarEntry entry = this.tarIn.getNextEntry();
if (entry == null) {
if (this.debug) {
System.err.println("READ EOF RECORD");
}
break;
}
if (this.progressDisplay != null) {
this.progressDisplay.showTarProgressMessage(entry.getName());
}
}
} }
|
public class class_name {
public void listContents() throws IOException {
for (;;) {
TarEntry entry = this.tarIn.getNextEntry();
if (entry == null) {
if (this.debug) {
System.err.println("READ EOF RECORD");
// depends on control dependency: [if], data = [none]
}
break;
}
if (this.progressDisplay != null) {
this.progressDisplay.showTarProgressMessage(entry.getName());
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public boolean canGenerate(String jobName) {
try {
Class.forName(this.getGeneratorClass(jobName));
return true;
} catch (ClassNotFoundException e) {
return false;
}
} }
|
public class class_name {
public boolean canGenerate(String jobName) {
try {
Class.forName(this.getGeneratorClass(jobName)); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
return false;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String protectKeyword(String text) {
if (!Strings.isEmpty(text) && isKeyword(text)) {
return "^" + text;
}
return text;
} }
|
public class class_name {
public String protectKeyword(String text) {
if (!Strings.isEmpty(text) && isKeyword(text)) {
return "^" + text; // depends on control dependency: [if], data = [none]
}
return text;
} }
|
public class class_name {
public double[][] getScoreMatrix() {
double[][] matrix = new double[sequences.size()][sequences.size()];
for (int i = 0, n = 0; i < matrix.length; i++) {
matrix[i][i] = scorers.get(i).getMaxScore();
for (int j = i+1; j < matrix.length; j++) {
matrix[i][j] = matrix[j][i] = scorers.get(n++).getScore();
}
}
return matrix;
} }
|
public class class_name {
public double[][] getScoreMatrix() {
double[][] matrix = new double[sequences.size()][sequences.size()];
for (int i = 0, n = 0; i < matrix.length; i++) {
matrix[i][i] = scorers.get(i).getMaxScore(); // depends on control dependency: [for], data = [i]
for (int j = i+1; j < matrix.length; j++) {
matrix[i][j] = matrix[j][i] = scorers.get(n++).getScore(); // depends on control dependency: [for], data = [j]
}
}
return matrix;
} }
|
public class class_name {
public Field updateFieldDateTimeDate(Field routeFieldParam) {
if(routeFieldParam != null && this.serviceTicket != null) {
routeFieldParam.setServiceTicket(this.serviceTicket);
}
if(routeFieldParam != null) {
routeFieldParam.setTypeAsEnum(Field.Type.DateTime);
routeFieldParam.setTypeMetaData(FieldMetaData.DateTime.DATE);
}
return new Field(this.postJson(
routeFieldParam, Version1.routeFieldUpdate()));
} }
|
public class class_name {
public Field updateFieldDateTimeDate(Field routeFieldParam) {
if(routeFieldParam != null && this.serviceTicket != null) {
routeFieldParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none]
}
if(routeFieldParam != null) {
routeFieldParam.setTypeAsEnum(Field.Type.DateTime); // depends on control dependency: [if], data = [none]
routeFieldParam.setTypeMetaData(FieldMetaData.DateTime.DATE); // depends on control dependency: [if], data = [none]
}
return new Field(this.postJson(
routeFieldParam, Version1.routeFieldUpdate()));
} }
|
public class class_name {
public String pageHtml(int segment, String helpUrl, String title) {
if (segment == HTML_START) {
String stylesheet = null;
if (isPopup() && !useNewStyle()) {
stylesheet = "popup.css";
}
StringBuffer result = new StringBuffer(pageHtmlStyle(segment, title, stylesheet));
if (getSettings().isViewExplorer()) {
result.append("<script type=\"text/javascript\" src=\"");
result.append(getSkinUri());
result.append("commons/explorer.js\"></script>\n");
}
result.append("<script type=\"text/javascript\">\n");
result.append(dialogScriptSubmit());
if (helpUrl != null) {
result.append("if (top.head && top.head.helpUrl) {\n");
result.append("\ttop.head.helpUrl=\"");
result.append(helpUrl + "\";\n");
result.append("}\n\n");
}
// the variable that may be set as path: if non-null this will be
// used as path for the online help window. This is needed because there are pages
// e.g. /administration/accounts/users/new that perform a jsp - forward while leaving the
// path parameter on the old page: no correct online help possible.
result.append("var onlineHelpUriCustom = ");
result.append(getOnlineHelpUriCustom());
result.append(";\n");
result.append("</script>\n");
return result.toString();
} else {
return super.pageHtml(segment, null);
}
} }
|
public class class_name {
public String pageHtml(int segment, String helpUrl, String title) {
if (segment == HTML_START) {
String stylesheet = null;
if (isPopup() && !useNewStyle()) {
stylesheet = "popup.css"; // depends on control dependency: [if], data = [none]
}
StringBuffer result = new StringBuffer(pageHtmlStyle(segment, title, stylesheet));
if (getSettings().isViewExplorer()) {
result.append("<script type=\"text/javascript\" src=\""); // depends on control dependency: [if], data = [none]
result.append(getSkinUri()); // depends on control dependency: [if], data = [none]
result.append("commons/explorer.js\"></script>\n"); // depends on control dependency: [if], data = [none]
}
result.append("<script type=\"text/javascript\">\n"); // depends on control dependency: [if], data = [none]
result.append(dialogScriptSubmit()); // depends on control dependency: [if], data = [none]
if (helpUrl != null) {
result.append("if (top.head && top.head.helpUrl) {\n"); // depends on control dependency: [if], data = [none]
result.append("\ttop.head.helpUrl=\""); // depends on control dependency: [if], data = [none]
result.append(helpUrl + "\";\n"); // depends on control dependency: [if], data = [(helpUrl]
result.append("}\n\n"); // depends on control dependency: [if], data = [none]
}
// the variable that may be set as path: if non-null this will be
// used as path for the online help window. This is needed because there are pages
// e.g. /administration/accounts/users/new that perform a jsp - forward while leaving the
// path parameter on the old page: no correct online help possible.
result.append("var onlineHelpUriCustom = "); // depends on control dependency: [if], data = [none]
result.append(getOnlineHelpUriCustom()); // depends on control dependency: [if], data = [none]
result.append(";\n"); // depends on control dependency: [if], data = [none]
result.append("</script>\n"); // depends on control dependency: [if], data = [none]
return result.toString(); // depends on control dependency: [if], data = [none]
} else {
return super.pageHtml(segment, null); // depends on control dependency: [if], data = [(segment]
}
} }
|
public class class_name {
synchronized public long generateId64() {
long timestamp = System.currentTimeMillis();
long sequence = 0;
boolean done = false;
while (!done) {
done = true;
while (timestamp < lastTimestampMillisec.get()) {
timestamp = waitTillNextMillisec(timestamp);
}
if (timestamp == lastTimestampMillisec.get()) {
// increase sequence
sequence = sequenceMillisec.incrementAndGet();
if (sequence > MAX_SEQUENCE_64) {
// reset sequence
sequenceMillisec.set(sequence = 0);
timestamp = waitTillNextMillisec(timestamp);
done = false;
}
}
}
sequenceMillisec.set(sequence);
lastTimestampMillisec.set(timestamp);
timestamp = (timestamp - TIMESTAMP_EPOCH) & MASK_TIMESTAMP_64;
return timestamp << SHIFT_TIMESTAMP_64 | template64 | (sequence & MASK_SEQUENCE_64);
} }
|
public class class_name {
synchronized public long generateId64() {
long timestamp = System.currentTimeMillis();
long sequence = 0;
boolean done = false;
while (!done) {
done = true; // depends on control dependency: [while], data = [none]
while (timestamp < lastTimestampMillisec.get()) {
timestamp = waitTillNextMillisec(timestamp); // depends on control dependency: [while], data = [(timestamp]
}
if (timestamp == lastTimestampMillisec.get()) {
// increase sequence
sequence = sequenceMillisec.incrementAndGet(); // depends on control dependency: [if], data = [none]
if (sequence > MAX_SEQUENCE_64) {
// reset sequence
sequenceMillisec.set(sequence = 0); // depends on control dependency: [if], data = [(sequence]
timestamp = waitTillNextMillisec(timestamp); // depends on control dependency: [if], data = [none]
done = false; // depends on control dependency: [if], data = [none]
}
}
}
sequenceMillisec.set(sequence);
lastTimestampMillisec.set(timestamp);
timestamp = (timestamp - TIMESTAMP_EPOCH) & MASK_TIMESTAMP_64;
return timestamp << SHIFT_TIMESTAMP_64 | template64 | (sequence & MASK_SEQUENCE_64);
} }
|
public class class_name {
private static boolean isValidKey(final String s) {
// Equivalent to this regex \*|[_a-zA-Z](?:[-_a-zA-Z0-9]*[_a-zA-Z0-9]) but faster
if (s == null) {
return false;
}
if (s.equals(WILDCARD_VALUE)) {
return true;
}
int lastIndex = s.length() - 1;
if (lastIndex == -1) {
return false;
}
if (!isValidKeyStartCharacter(s.charAt(0))) {
return false;
}
for (int i = 1; i < lastIndex; i++) {
if (!isValidKeyCharacter(s.charAt(i))) {
return false;
}
}
if (lastIndex > 0 && !isValidKeyEndCharacter(s.charAt(lastIndex))) {
return false;
}
return true;
} }
|
public class class_name {
private static boolean isValidKey(final String s) {
// Equivalent to this regex \*|[_a-zA-Z](?:[-_a-zA-Z0-9]*[_a-zA-Z0-9]) but faster
if (s == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (s.equals(WILDCARD_VALUE)) {
return true; // depends on control dependency: [if], data = [none]
}
int lastIndex = s.length() - 1;
if (lastIndex == -1) {
return false; // depends on control dependency: [if], data = [none]
}
if (!isValidKeyStartCharacter(s.charAt(0))) {
return false; // depends on control dependency: [if], data = [none]
}
for (int i = 1; i < lastIndex; i++) {
if (!isValidKeyCharacter(s.charAt(i))) {
return false; // depends on control dependency: [if], data = [none]
}
}
if (lastIndex > 0 && !isValidKeyEndCharacter(s.charAt(lastIndex))) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
private String explainSearchKeys(String[] asIndexed, int nCovered) {
// By default, indexing starts at the start of the index.
if (m_searchkeyExpressions.isEmpty()) {
return "start";
}
String conjunction = "";
String result = "(";
int prefixSize = nCovered - 1;
for (int ii = 0; ii < prefixSize; ++ii) {
result += conjunction + asIndexed[ii] + (m_compareNotDistinct.get(ii) ? " NOT DISTINCT " : " = ") +
m_searchkeyExpressions.get(ii).explain(getTableNameForExplain());
conjunction = ") AND (";
}
// last element
result += conjunction + asIndexed[prefixSize] + " ";
if (m_lookupType == IndexLookupType.EQ && m_compareNotDistinct.get(prefixSize)) {
result += "NOT DISTINCT";
} else {
result += m_lookupType.getSymbol();
}
result += " " + m_searchkeyExpressions.get(prefixSize).explain(getTableNameForExplain());
if (m_lookupType != IndexLookupType.EQ && m_compareNotDistinct.get(prefixSize)) {
result += ", including NULLs";
}
result += ")";
return result;
} }
|
public class class_name {
private String explainSearchKeys(String[] asIndexed, int nCovered) {
// By default, indexing starts at the start of the index.
if (m_searchkeyExpressions.isEmpty()) {
return "start"; // depends on control dependency: [if], data = [none]
}
String conjunction = "";
String result = "(";
int prefixSize = nCovered - 1;
for (int ii = 0; ii < prefixSize; ++ii) {
result += conjunction + asIndexed[ii] + (m_compareNotDistinct.get(ii) ? " NOT DISTINCT " : " = ") +
m_searchkeyExpressions.get(ii).explain(getTableNameForExplain()); // depends on control dependency: [for], data = [ii]
conjunction = ") AND ("; // depends on control dependency: [for], data = [none]
}
// last element
result += conjunction + asIndexed[prefixSize] + " ";
if (m_lookupType == IndexLookupType.EQ && m_compareNotDistinct.get(prefixSize)) {
result += "NOT DISTINCT"; // depends on control dependency: [if], data = [none]
} else {
result += m_lookupType.getSymbol(); // depends on control dependency: [if], data = [none]
}
result += " " + m_searchkeyExpressions.get(prefixSize).explain(getTableNameForExplain());
if (m_lookupType != IndexLookupType.EQ && m_compareNotDistinct.get(prefixSize)) {
result += ", including NULLs"; // depends on control dependency: [if], data = [none]
}
result += ")";
return result;
} }
|
public class class_name {
public static Node createUserNode(final String userId) {
if (INDEX_USERS.get(IDENTIFIER, userId).getSingle() == null) {
final Node user = DATABASE.createNode();
user.setProperty(Properties.User.IDENTIFIER, userId);
INDEX_USERS.add(user, IDENTIFIER, userId);
return user;
}
throw new IllegalArgumentException("user node with identifier \""
+ userId + "\" already existing!");
} }
|
public class class_name {
public static Node createUserNode(final String userId) {
if (INDEX_USERS.get(IDENTIFIER, userId).getSingle() == null) {
final Node user = DATABASE.createNode();
user.setProperty(Properties.User.IDENTIFIER, userId); // depends on control dependency: [if], data = [none]
INDEX_USERS.add(user, IDENTIFIER, userId); // depends on control dependency: [if], data = [none]
return user; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("user node with identifier \""
+ userId + "\" already existing!");
} }
|
public class class_name {
public void marshall(ListFunctionsRequest listFunctionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listFunctionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listFunctionsRequest.getApiId(), APIID_BINDING);
protocolMarshaller.marshall(listFunctionsRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listFunctionsRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListFunctionsRequest listFunctionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listFunctionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listFunctionsRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listFunctionsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listFunctionsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
static AtsdServerException fromResponse(final Response response) {
final int status = response.getStatus();
try {
final ServerError serverError = response.readEntity(ServerError.class);
final String message = AtsdServerMessageFactory.from(serverError);
return new AtsdServerException(message, status);
} catch (ProcessingException e) {
throw new IllegalArgumentException("Failed to extract server error", e);
}
} }
|
public class class_name {
static AtsdServerException fromResponse(final Response response) {
final int status = response.getStatus();
try {
final ServerError serverError = response.readEntity(ServerError.class);
final String message = AtsdServerMessageFactory.from(serverError);
return new AtsdServerException(message, status); // depends on control dependency: [try], data = [none]
} catch (ProcessingException e) {
throw new IllegalArgumentException("Failed to extract server error", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public EEnum getMFCMFCScpe() {
if (mfcmfcScpeEEnum == null) {
mfcmfcScpeEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(49);
}
return mfcmfcScpeEEnum;
} }
|
public class class_name {
public EEnum getMFCMFCScpe() {
if (mfcmfcScpeEEnum == null) {
mfcmfcScpeEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(49); // depends on control dependency: [if], data = [none]
}
return mfcmfcScpeEEnum;
} }
|
public class class_name {
public final void end() {
final Thread thread = threadRef;
if (thread != null) {
thread.interrupt();
try {
thread.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
this.threadRef = null;
} }
|
public class class_name {
public final void end() {
final Thread thread = threadRef;
if (thread != null) {
thread.interrupt(); // depends on control dependency: [if], data = [none]
try {
thread.join(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
}
this.threadRef = null;
} }
|
public class class_name {
public PubSubMessageItemStream getPublishPoint()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getPublishPoint");
SibTr.exit(tc, "getPublishPoint", _pubsubMessageItemStream);
}
return _pubsubMessageItemStream;
} }
|
public class class_name {
public PubSubMessageItemStream getPublishPoint()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getPublishPoint"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "getPublishPoint", _pubsubMessageItemStream); // depends on control dependency: [if], data = [none]
}
return _pubsubMessageItemStream;
} }
|
public class class_name {
protected void fireFaxEvent(FaxClientActionEventID id,FaxJob faxJob)
{
//create new fax event
FaxClientActionEvent event=new FaxClientActionEvent(id,faxJob);
//get listeners
FaxClientActionEventListener[] listeners=null;
synchronized(this.faxClientActionEventListeners)
{
listeners=this.faxClientActionEventListeners.toArray(new FaxClientActionEventListener[this.faxClientActionEventListeners.size()]);
}
int amount=listeners.length;
FaxClientActionEventListener listener=null;
for(int index=0;index<amount;index++)
{
//get next element
listener=listeners[index];
//fire event
if(listener!=null)
{
switch(id)
{
case CREATE_FAX_JOB:
listener.faxJobCreated(event);
break;
case SUBMIT_FAX_JOB:
listener.faxJobSubmitted(event);
break;
case SUSPEND_FAX_JOB:
listener.faxJobSuspended(event);
break;
case RESUME_FAX_JOB:
listener.faxJobResumed(event);
break;
case CANCEL_FAX_JOB:
listener.faxJobCancelled(event);
break;
default:
throw new FaxException("Unable to support fax event, for event ID: "+id);
}
}
}
} }
|
public class class_name {
protected void fireFaxEvent(FaxClientActionEventID id,FaxJob faxJob)
{
//create new fax event
FaxClientActionEvent event=new FaxClientActionEvent(id,faxJob);
//get listeners
FaxClientActionEventListener[] listeners=null;
synchronized(this.faxClientActionEventListeners)
{
listeners=this.faxClientActionEventListeners.toArray(new FaxClientActionEventListener[this.faxClientActionEventListeners.size()]);
}
int amount=listeners.length;
FaxClientActionEventListener listener=null;
for(int index=0;index<amount;index++)
{
//get next element
listener=listeners[index]; // depends on control dependency: [for], data = [index]
//fire event
if(listener!=null)
{
switch(id)
{
case CREATE_FAX_JOB:
listener.faxJobCreated(event);
break;
case SUBMIT_FAX_JOB:
listener.faxJobSubmitted(event);
break;
case SUSPEND_FAX_JOB:
listener.faxJobSuspended(event);
break;
case RESUME_FAX_JOB:
listener.faxJobResumed(event);
break;
case CANCEL_FAX_JOB:
listener.faxJobCancelled(event);
break;
default:
throw new FaxException("Unable to support fax event, for event ID: "+id);
}
}
}
} }
|
public class class_name {
public ChorusHandlerJmxExporter export() {
if (Boolean.getBoolean(JMX_EXPORTER_ENABLED_PROPERTY)) {
//export this object as an MBean
if (exported.getAndSet(true) == false) {
try {
log.info(String.format("Exporting ChorusHandlerJmxExporter with jmx name (%s)", JMX_EXPORTER_NAME));
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbs.registerMBean(this, new ObjectName(JMX_EXPORTER_NAME));
} catch (Exception e) {
throw new ChorusException(String.format("Failed to export ChorusHandlerJmxExporter with jmx name (%s)", JMX_EXPORTER_NAME), e);
}
}
} else {
log.info(String.format("Will not export ChorusHandlerJmxExporter : '%s' system property must be set to true.",
JMX_EXPORTER_ENABLED_PROPERTY)
);
}
return this;
} }
|
public class class_name {
public ChorusHandlerJmxExporter export() {
if (Boolean.getBoolean(JMX_EXPORTER_ENABLED_PROPERTY)) {
//export this object as an MBean
if (exported.getAndSet(true) == false) {
try {
log.info(String.format("Exporting ChorusHandlerJmxExporter with jmx name (%s)", JMX_EXPORTER_NAME)); // depends on control dependency: [try], data = [none]
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbs.registerMBean(this, new ObjectName(JMX_EXPORTER_NAME)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new ChorusException(String.format("Failed to export ChorusHandlerJmxExporter with jmx name (%s)", JMX_EXPORTER_NAME), e);
} // depends on control dependency: [catch], data = [none]
}
} else {
log.info(String.format("Will not export ChorusHandlerJmxExporter : '%s' system property must be set to true.",
JMX_EXPORTER_ENABLED_PROPERTY)
); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public static int exec(String origArgs[])
{
errorReporter = new ToolErrorReporter(false, global.getErr());
shellContextFactory.setErrorReporter(errorReporter);
String[] args = processOptions(origArgs);
if (exitCode > 0) {
return exitCode;
}
if (processStdin) {
fileList.add(null);
}
if (!global.initialized) {
global.init(shellContextFactory);
}
IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
iproxy.args = args;
shellContextFactory.call(iproxy);
return exitCode;
} }
|
public class class_name {
public static int exec(String origArgs[])
{
errorReporter = new ToolErrorReporter(false, global.getErr());
shellContextFactory.setErrorReporter(errorReporter);
String[] args = processOptions(origArgs);
if (exitCode > 0) {
return exitCode; // depends on control dependency: [if], data = [none]
}
if (processStdin) {
fileList.add(null); // depends on control dependency: [if], data = [none]
}
if (!global.initialized) {
global.init(shellContextFactory); // depends on control dependency: [if], data = [none]
}
IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
iproxy.args = args;
shellContextFactory.call(iproxy);
return exitCode;
} }
|
public class class_name {
private void createScopeServices() {
try {
services = new ScopeServices(getRequiredServices(),
settings.getPort(),
!settings.autostart());
services.startStpThread();
} catch (IOException e) {
throw new CommunicationException(e);
}
} }
|
public class class_name {
private void createScopeServices() {
try {
services = new ScopeServices(getRequiredServices(),
settings.getPort(),
!settings.autostart()); // depends on control dependency: [try], data = [none]
services.startStpThread(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new CommunicationException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static Response getDeleteResponse(App app, ParaObject content) {
try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
RestUtils.class, "crud", "delete")) {
if (app != null && content != null && content.getId() != null && content.getAppid() != null) {
if (checkImplicitAppPermissions(app, content) && checkIfUserCanModifyObject(app, content)) {
content.setAppid(isNotAnApp(content.getType()) ? app.getAppIdentifier() : app.getAppid());
content.delete();
return Response.ok().build();
}
return getStatusResponse(Response.Status.BAD_REQUEST);
}
return getStatusResponse(Response.Status.NOT_FOUND);
}
} }
|
public class class_name {
public static Response getDeleteResponse(App app, ParaObject content) {
try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
RestUtils.class, "crud", "delete")) {
if (app != null && content != null && content.getId() != null && content.getAppid() != null) {
if (checkImplicitAppPermissions(app, content) && checkIfUserCanModifyObject(app, content)) {
content.setAppid(isNotAnApp(content.getType()) ? app.getAppIdentifier() : app.getAppid()); // depends on control dependency: [if], data = [none]
content.delete(); // depends on control dependency: [if], data = [none]
return Response.ok().build(); // depends on control dependency: [if], data = [none]
}
return getStatusResponse(Response.Status.BAD_REQUEST); // depends on control dependency: [if], data = [none]
}
return getStatusResponse(Response.Status.NOT_FOUND);
}
} }
|
public class class_name {
public void start()
{
try
{
getRemoteBundleContext().startBundle( 0 );
}
catch( RemoteException e )
{
throw new TestContainerException( "Remote exception", e );
}
catch( BundleException e )
{
throw new TestContainerException( "System bundle cannot be started", e );
}
} }
|
public class class_name {
public void start()
{
try
{
getRemoteBundleContext().startBundle( 0 ); // depends on control dependency: [try], data = [none]
}
catch( RemoteException e )
{
throw new TestContainerException( "Remote exception", e );
} // depends on control dependency: [catch], data = [none]
catch( BundleException e )
{
throw new TestContainerException( "System bundle cannot be started", e );
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public BaseWindowedBolt<T> withStateSize(Time size) {
long s = size.toMilliseconds();
ensurePositiveTime(s);
ensureStateSizeGreaterThanWindowSize(this.size, s);
this.stateSize = s;
if (WindowAssigner.isEventTime(this.windowAssigner)) {
this.stateWindowAssigner = TumblingEventTimeWindows.of(s);
} else if (WindowAssigner.isProcessingTime(this.windowAssigner)) {
this.stateWindowAssigner = TumblingProcessingTimeWindows.of(s);
} else if (WindowAssigner.isIngestionTime(this.windowAssigner)) {
this.stateWindowAssigner = TumblingIngestionTimeWindows.of(s);
}
return this;
} }
|
public class class_name {
public BaseWindowedBolt<T> withStateSize(Time size) {
long s = size.toMilliseconds();
ensurePositiveTime(s);
ensureStateSizeGreaterThanWindowSize(this.size, s);
this.stateSize = s;
if (WindowAssigner.isEventTime(this.windowAssigner)) {
this.stateWindowAssigner = TumblingEventTimeWindows.of(s); // depends on control dependency: [if], data = [none]
} else if (WindowAssigner.isProcessingTime(this.windowAssigner)) {
this.stateWindowAssigner = TumblingProcessingTimeWindows.of(s); // depends on control dependency: [if], data = [none]
} else if (WindowAssigner.isIngestionTime(this.windowAssigner)) {
this.stateWindowAssigner = TumblingIngestionTimeWindows.of(s); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
@Override
public boolean apply(Map.Entry mapEntry) {
if (predicate != null) {
return predicate.apply(mapEntry);
}
return true;
} }
|
public class class_name {
@Override
public boolean apply(Map.Entry mapEntry) {
if (predicate != null) {
return predicate.apply(mapEntry); // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
private Collection<TypeElement> subinterfaces(TypeElement te) {
Collection<TypeElement> ret = classToSubinterface.get(te);
if (ret == null) {
ret = new TreeSet<>(utils.makeClassUseComparator());
Set<TypeElement> subs = classtree.subInterfaces(te);
if (subs != null) {
ret.addAll(subs);
for (TypeElement sub : subs) {
ret.addAll(subinterfaces(sub));
}
}
addAll(classToSubinterface, te, ret);
}
return ret;
} }
|
public class class_name {
private Collection<TypeElement> subinterfaces(TypeElement te) {
Collection<TypeElement> ret = classToSubinterface.get(te);
if (ret == null) {
ret = new TreeSet<>(utils.makeClassUseComparator()); // depends on control dependency: [if], data = [none]
Set<TypeElement> subs = classtree.subInterfaces(te);
if (subs != null) {
ret.addAll(subs); // depends on control dependency: [if], data = [(subs]
for (TypeElement sub : subs) {
ret.addAll(subinterfaces(sub)); // depends on control dependency: [for], data = [sub]
}
}
addAll(classToSubinterface, te, ret); // depends on control dependency: [if], data = [none]
}
return ret;
} }
|
public class class_name {
@Override
public Set<String> getSupportedAnnotationTypes() {
Set<String> set = new HashSet<>();
// Analyze @SupportedAnnotationTypes
SupportedAnnotationTypes sat = this.getClass().getAnnotation(SupportedAnnotationTypes.class);
if (sat != null) {
Arrays.stream(sat.value()).forEach(set::add);
}
// Analyze @SupportedAnnotation
SupportedAnnotation sa = this.getClass().getAnnotation(SupportedAnnotation.class);
if (sa != null) {
Arrays.stream(sa.value()).map(Class::getCanonicalName).forEach(set::add);
}
if (set.isEmpty() && isInitialized()) {
debug().log("No SupportedAnnotationTypes annotation found on " + this.getClass().getName()
+ ", returning an empty set.");
}
return Collections.unmodifiableSet(set);
} }
|
public class class_name {
@Override
public Set<String> getSupportedAnnotationTypes() {
Set<String> set = new HashSet<>();
// Analyze @SupportedAnnotationTypes
SupportedAnnotationTypes sat = this.getClass().getAnnotation(SupportedAnnotationTypes.class);
if (sat != null) {
Arrays.stream(sat.value()).forEach(set::add); // depends on control dependency: [if], data = [(sat]
}
// Analyze @SupportedAnnotation
SupportedAnnotation sa = this.getClass().getAnnotation(SupportedAnnotation.class);
if (sa != null) {
Arrays.stream(sa.value()).map(Class::getCanonicalName).forEach(set::add); // depends on control dependency: [if], data = [(sa]
}
if (set.isEmpty() && isInitialized()) {
debug().log("No SupportedAnnotationTypes annotation found on " + this.getClass().getName()
+ ", returning an empty set."); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableSet(set);
} }
|
public class class_name {
public void addWebSocketScope(WebSocketScope webSocketScope) {
String path = webSocketScope.getPath();
if (scopes.putIfAbsent(path, webSocketScope) == null) {
log.info("addWebSocketScope: {}", webSocketScope);
notifyListeners(WebSocketEvent.SCOPE_ADDED, webSocketScope);
}
} }
|
public class class_name {
public void addWebSocketScope(WebSocketScope webSocketScope) {
String path = webSocketScope.getPath();
if (scopes.putIfAbsent(path, webSocketScope) == null) {
log.info("addWebSocketScope: {}", webSocketScope); // depends on control dependency: [if], data = [none]
notifyListeners(WebSocketEvent.SCOPE_ADDED, webSocketScope); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Set<String> getJobNames() {
if (authService == null || authService.isAdmin() || authService.isMonitor()) {
return persistenceManagerService.getJobNamesSet();
} else if (authService.isSubmitter()) {
return persistenceManagerService.getJobNamesSet(authService.getRunAsUser());
}
throw new JobSecurityException("The current user " + authService.getRunAsUser() + " is not authorized to perform any batch operations.");
} }
|
public class class_name {
@Override
public Set<String> getJobNames() {
if (authService == null || authService.isAdmin() || authService.isMonitor()) {
return persistenceManagerService.getJobNamesSet(); // depends on control dependency: [if], data = [none]
} else if (authService.isSubmitter()) {
return persistenceManagerService.getJobNamesSet(authService.getRunAsUser()); // depends on control dependency: [if], data = [none]
}
throw new JobSecurityException("The current user " + authService.getRunAsUser() + " is not authorized to perform any batch operations.");
} }
|
public class class_name {
protected void validateChildOrder() {
Log.d(TAG, "validating child count " + getChildCount());
if (getChildCount() < 1) {
return;
}
int lastPos = getPosition(getChildAt(0));
int lastScreenLoc = mOrientationHelper.getDecoratedStart(getChildAt(0));
if (mShouldReverseLayout) {
for (int i = 1; i < getChildCount(); i++) {
View child = getChildAt(i);
int pos = getPosition(child);
int screenLoc = mOrientationHelper.getDecoratedStart(child);
if (pos < lastPos) {
logChildren();
throw new RuntimeException("detected invalid position. loc invalid? " +
(screenLoc < lastScreenLoc));
}
if (screenLoc > lastScreenLoc) {
logChildren();
throw new RuntimeException("detected invalid location");
}
}
} else {
for (int i = 1; i < getChildCount(); i++) {
View child = getChildAt(i);
int pos = getPosition(child);
int screenLoc = mOrientationHelper.getDecoratedStart(child);
if (pos < lastPos) {
logChildren();
throw new RuntimeException("detected invalid position. loc invalid? " +
(screenLoc < lastScreenLoc));
}
if (screenLoc < lastScreenLoc) {
logChildren();
throw new RuntimeException("detected invalid location");
}
}
}
} }
|
public class class_name {
protected void validateChildOrder() {
Log.d(TAG, "validating child count " + getChildCount());
if (getChildCount() < 1) {
return; // depends on control dependency: [if], data = [none]
}
int lastPos = getPosition(getChildAt(0));
int lastScreenLoc = mOrientationHelper.getDecoratedStart(getChildAt(0));
if (mShouldReverseLayout) {
for (int i = 1; i < getChildCount(); i++) {
View child = getChildAt(i);
int pos = getPosition(child);
int screenLoc = mOrientationHelper.getDecoratedStart(child);
if (pos < lastPos) {
logChildren(); // depends on control dependency: [if], data = [none]
throw new RuntimeException("detected invalid position. loc invalid? " +
(screenLoc < lastScreenLoc));
}
if (screenLoc > lastScreenLoc) {
logChildren(); // depends on control dependency: [if], data = [none]
throw new RuntimeException("detected invalid location");
}
}
} else {
for (int i = 1; i < getChildCount(); i++) {
View child = getChildAt(i);
int pos = getPosition(child);
int screenLoc = mOrientationHelper.getDecoratedStart(child);
if (pos < lastPos) {
logChildren(); // depends on control dependency: [if], data = [none]
throw new RuntimeException("detected invalid position. loc invalid? " +
(screenLoc < lastScreenLoc));
}
if (screenLoc < lastScreenLoc) {
logChildren(); // depends on control dependency: [if], data = [none]
throw new RuntimeException("detected invalid location");
}
}
}
} }
|
public class class_name {
public static boolean containsAny(boolean _ignoreCase, String _str, String... _args) {
if (_str == null || _args == null || _args.length == 0) {
return false;
}
String heystack = _str;
if (_ignoreCase) {
heystack = _str.toLowerCase();
}
for (String s : _args) {
String needle = _ignoreCase ? s.toLowerCase() : s;
if (heystack.contains(needle)) {
return true;
}
}
return false;
} }
|
public class class_name {
public static boolean containsAny(boolean _ignoreCase, String _str, String... _args) {
if (_str == null || _args == null || _args.length == 0) {
return false; // depends on control dependency: [if], data = [none]
}
String heystack = _str;
if (_ignoreCase) {
heystack = _str.toLowerCase(); // depends on control dependency: [if], data = [none]
}
for (String s : _args) {
String needle = _ignoreCase ? s.toLowerCase() : s;
if (heystack.contains(needle)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public static ZonedDateTime toNullableDateTime(Object value) {
if (value == null)
return null;
if (value instanceof ZonedDateTime)
return (ZonedDateTime) value;
if (value instanceof Calendar) {
Calendar calendar = (Calendar) value;
return ZonedDateTime.ofInstant(calendar.toInstant(), calendar.getTimeZone().toZoneId());
}
if (value instanceof Date)
return ZonedDateTime.ofInstant(((Date) value).toInstant(), ZoneId.systemDefault());
if (value instanceof LocalDate)
return ZonedDateTime.of((LocalDate) value, LocalTime.of(0, 0), ZoneId.systemDefault());
if (value instanceof LocalDateTime)
return ZonedDateTime.of((LocalDateTime) value, ZoneId.systemDefault());
if (value instanceof Integer)
return millisToDateTime((int) value);
if (value instanceof Short)
return millisToDateTime((short) value);
if (value instanceof Long)
return millisToDateTime((long) value);
if (value instanceof Float)
return millisToDateTime((long) ((float) value));
if (value instanceof Double)
return millisToDateTime((long) ((double) value));
if (value instanceof Duration)
return millisToDateTime(((Duration) value).toMillis());
if (value instanceof String) {
try {
return ZonedDateTime.parse((String) value, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
} catch (DateTimeParseException ex) {
}
try {
return ZonedDateTime.of(LocalDateTime.parse((String) value, simpleDateTimeFormatter),
ZoneId.systemDefault());
} catch (DateTimeParseException ex) {
}
try {
return ZonedDateTime.of(LocalDate.parse((String) value, simpleDateFormatter), LocalTime.of(0, 0),
ZoneId.systemDefault());
} catch (DateTimeParseException ex) {
}
}
return null;
} }
|
public class class_name {
public static ZonedDateTime toNullableDateTime(Object value) {
if (value == null)
return null;
if (value instanceof ZonedDateTime)
return (ZonedDateTime) value;
if (value instanceof Calendar) {
Calendar calendar = (Calendar) value;
return ZonedDateTime.ofInstant(calendar.toInstant(), calendar.getTimeZone().toZoneId()); // depends on control dependency: [if], data = [none]
}
if (value instanceof Date)
return ZonedDateTime.ofInstant(((Date) value).toInstant(), ZoneId.systemDefault());
if (value instanceof LocalDate)
return ZonedDateTime.of((LocalDate) value, LocalTime.of(0, 0), ZoneId.systemDefault());
if (value instanceof LocalDateTime)
return ZonedDateTime.of((LocalDateTime) value, ZoneId.systemDefault());
if (value instanceof Integer)
return millisToDateTime((int) value);
if (value instanceof Short)
return millisToDateTime((short) value);
if (value instanceof Long)
return millisToDateTime((long) value);
if (value instanceof Float)
return millisToDateTime((long) ((float) value));
if (value instanceof Double)
return millisToDateTime((long) ((double) value));
if (value instanceof Duration)
return millisToDateTime(((Duration) value).toMillis());
if (value instanceof String) {
try {
return ZonedDateTime.parse((String) value, DateTimeFormatter.ISO_OFFSET_DATE_TIME); // depends on control dependency: [try], data = [none]
} catch (DateTimeParseException ex) {
} // depends on control dependency: [catch], data = [none]
try {
return ZonedDateTime.of(LocalDateTime.parse((String) value, simpleDateTimeFormatter),
ZoneId.systemDefault()); // depends on control dependency: [try], data = [none]
} catch (DateTimeParseException ex) {
} // depends on control dependency: [catch], data = [none]
try {
return ZonedDateTime.of(LocalDate.parse((String) value, simpleDateFormatter), LocalTime.of(0, 0),
ZoneId.systemDefault()); // depends on control dependency: [try], data = [none]
} catch (DateTimeParseException ex) {
} // depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
public void addConverter(int index, IConverter converter) {
converterList.add(index, converter);
if (converter instanceof IContainerConverter) {
IContainerConverter containerConverter = (IContainerConverter) converter;
if (containerConverter.getElementConverter() == null) {
containerConverter.setElementConverter(elementConverter);
}
}
} }
|
public class class_name {
public void addConverter(int index, IConverter converter) {
converterList.add(index, converter);
if (converter instanceof IContainerConverter) {
IContainerConverter containerConverter = (IContainerConverter) converter;
if (containerConverter.getElementConverter() == null) {
containerConverter.setElementConverter(elementConverter);
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public boolean implicitlyCloseParentTagOnTagEnd(String parentNodeName, String nodeName) {
if (parentNodeName == null) {
return false;
}
parentNodeName = parentNodeName.toLowerCase();
nodeName = nodeName.toLowerCase();
for (int i = 0; i < IMPLIED_ON_END.length; i += 2) {
if (StringUtil.equalsOne(nodeName, IMPLIED_ON_END[i]) != -1) {
if (StringUtil.equalsOne(parentNodeName, IMPLIED_ON_END[i + 1]) != -1) {
return true;
}
}
}
return false;
} }
|
public class class_name {
public boolean implicitlyCloseParentTagOnTagEnd(String parentNodeName, String nodeName) {
if (parentNodeName == null) {
return false; // depends on control dependency: [if], data = [none]
}
parentNodeName = parentNodeName.toLowerCase();
nodeName = nodeName.toLowerCase();
for (int i = 0; i < IMPLIED_ON_END.length; i += 2) {
if (StringUtil.equalsOne(nodeName, IMPLIED_ON_END[i]) != -1) {
if (StringUtil.equalsOne(parentNodeName, IMPLIED_ON_END[i + 1]) != -1) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
@Deprecated
public static boolean isOriginalURI(Node node, String uri) {
if (node.getUri().equals(uri)) {
return true;
}
if (node.hasProperty(APM_ORIGINAL_URI)) {
return node.getProperties(APM_ORIGINAL_URI).iterator().next().getValue().equals(uri);
}
return false;
} }
|
public class class_name {
@Deprecated
public static boolean isOriginalURI(Node node, String uri) {
if (node.getUri().equals(uri)) {
return true; // depends on control dependency: [if], data = [none]
}
if (node.hasProperty(APM_ORIGINAL_URI)) {
return node.getProperties(APM_ORIGINAL_URI).iterator().next().getValue().equals(uri); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public void setGroupFlags(String groupFlags) {
try {
m_groupFlags = Integer.parseInt(groupFlags);
} catch (Throwable e) {
setThrowable(e);
}
} }
|
public class class_name {
public void setGroupFlags(String groupFlags) {
try {
m_groupFlags = Integer.parseInt(groupFlags); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
setThrowable(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public ObjectResult addNewObject(SpiderTransaction parentTran, DBObject dbObj) {
ObjectResult result = new ObjectResult();
try {
addBrandNewObject(dbObj);
result.setObjectID(dbObj.getObjectID());
result.setUpdated(true);
parentTran.mergeSubTransaction(m_dbTran);
m_logger.trace("addNewObject(): Object added/updated for ID={}", dbObj.getObjectID());
} catch (Throwable ex) {
buildErrorStatus(result, dbObj.getObjectID(), ex);
}
return result;
} }
|
public class class_name {
public ObjectResult addNewObject(SpiderTransaction parentTran, DBObject dbObj) {
ObjectResult result = new ObjectResult();
try {
addBrandNewObject(dbObj);
// depends on control dependency: [try], data = [none]
result.setObjectID(dbObj.getObjectID());
// depends on control dependency: [try], data = [none]
result.setUpdated(true);
// depends on control dependency: [try], data = [none]
parentTran.mergeSubTransaction(m_dbTran);
// depends on control dependency: [try], data = [none]
m_logger.trace("addNewObject(): Object added/updated for ID={}", dbObj.getObjectID());
// depends on control dependency: [try], data = [none]
} catch (Throwable ex) {
buildErrorStatus(result, dbObj.getObjectID(), ex);
}
// depends on control dependency: [catch], data = [none]
return result;
} }
|
public class class_name {
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING")
protected void assignToUserObjectInDb(final Type _assignType,
final JAASSystem _jaasSystem,
final AbstractUserObject _object)
throws EFapsException
{
Connection con = null;
try {
final Context context = Context.getThreadContext();
con = Context.getConnection();
Statement stmt = null;
final StringBuilder cmd = new StringBuilder();
try {
cmd.append("insert into ").append(_assignType.getMainTable().getSqlTable()).append("(");
long keyId = 0;
if (!Context.getDbType().supportsGetGeneratedKeys()) {
keyId = Context.getDbType().getNewId(new ConnectionResource(con),
_assignType.getMainTable().getSqlTable(), "ID");
cmd.append("ID,");
}
cmd.append("TYPEID,CREATOR,CREATED,MODIFIER,MODIFIED,").append(
"USERABSTRACTFROM,USERABSTRACTTO,USERJAASSYSTEM) ").append("values (");
if (keyId != 0) {
cmd.append(keyId).append(",");
}
cmd.append(_assignType.getId()).append(",").append(context.getPersonId()).append(",").append(
Context.getDbType().getCurrentTimeStamp()).append(",").append(context.getPersonId())
.append(",").append(Context.getDbType().getCurrentTimeStamp()).append(",").append(
getId()).append(",").append(_object.getId()).append(",").append(
_jaasSystem.getId()).append(")");
stmt = con.createStatement();
final int rows = stmt.executeUpdate(cmd.toString());
if (rows == 0) {
AbstractUserObject.LOG.error("could not execute '" + cmd.toString()
+ "' to assign user object '" + toString()
+ "' to object '" + _object + "' for JAAS system '" + _jaasSystem + "' ");
throw new EFapsException(getClass(), "assignInDb.NotInserted", _jaasSystem.getName(), _object
.getName(), getName());
}
} catch (final SQLException e) {
AbstractUserObject.LOG.error("could not execute '" + cmd.toString()
+ "' to assign user object '" + toString()
+ "' to object '" + _object + "' for JAAS system '" + _jaasSystem + "' ", e);
throw new EFapsException(getClass(), "assignInDb.SQLException", e, cmd.toString(), getName());
} finally {
try {
if (stmt != null) {
stmt.close();
}
con.commit();
} catch (final SQLException e) {
AbstractUserObject.LOG.error("Could not close a statement.", e);
}
}
} finally {
try {
if (con != null && !con.isClosed()) {
con.close();
}
} catch (final SQLException e) {
AbstractUserObject.LOG.error("Could not close a connection.", e);
}
}
} }
|
public class class_name {
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING")
protected void assignToUserObjectInDb(final Type _assignType,
final JAASSystem _jaasSystem,
final AbstractUserObject _object)
throws EFapsException
{
Connection con = null;
try {
final Context context = Context.getThreadContext();
con = Context.getConnection();
Statement stmt = null;
final StringBuilder cmd = new StringBuilder();
try {
cmd.append("insert into ").append(_assignType.getMainTable().getSqlTable()).append("("); // depends on control dependency: [try], data = [none]
long keyId = 0;
if (!Context.getDbType().supportsGetGeneratedKeys()) {
keyId = Context.getDbType().getNewId(new ConnectionResource(con),
_assignType.getMainTable().getSqlTable(), "ID"); // depends on control dependency: [if], data = [none]
cmd.append("ID,"); // depends on control dependency: [if], data = [none]
}
cmd.append("TYPEID,CREATOR,CREATED,MODIFIER,MODIFIED,").append(
"USERABSTRACTFROM,USERABSTRACTTO,USERJAASSYSTEM) ").append("values ("); // depends on control dependency: [try], data = [none]
if (keyId != 0) {
cmd.append(keyId).append(","); // depends on control dependency: [if], data = [(keyId]
}
cmd.append(_assignType.getId()).append(",").append(context.getPersonId()).append(",").append(
Context.getDbType().getCurrentTimeStamp()).append(",").append(context.getPersonId())
.append(",").append(Context.getDbType().getCurrentTimeStamp()).append(",").append(
getId()).append(",").append(_object.getId()).append(",").append(
_jaasSystem.getId()).append(")"); // depends on control dependency: [try], data = [none]
stmt = con.createStatement(); // depends on control dependency: [try], data = [none]
final int rows = stmt.executeUpdate(cmd.toString());
if (rows == 0) {
AbstractUserObject.LOG.error("could not execute '" + cmd.toString()
+ "' to assign user object '" + toString()
+ "' to object '" + _object + "' for JAAS system '" + _jaasSystem + "' "); // depends on control dependency: [if], data = [none]
throw new EFapsException(getClass(), "assignInDb.NotInserted", _jaasSystem.getName(), _object
.getName(), getName());
}
} catch (final SQLException e) {
AbstractUserObject.LOG.error("could not execute '" + cmd.toString()
+ "' to assign user object '" + toString()
+ "' to object '" + _object + "' for JAAS system '" + _jaasSystem + "' ", e);
throw new EFapsException(getClass(), "assignInDb.SQLException", e, cmd.toString(), getName());
} finally { // depends on control dependency: [catch], data = [none]
try {
if (stmt != null) {
stmt.close(); // depends on control dependency: [if], data = [none]
}
con.commit(); // depends on control dependency: [try], data = [none]
} catch (final SQLException e) {
AbstractUserObject.LOG.error("Could not close a statement.", e);
} // depends on control dependency: [catch], data = [none]
}
} finally {
try {
if (con != null && !con.isClosed()) {
con.close(); // depends on control dependency: [if], data = [none]
}
} catch (final SQLException e) {
AbstractUserObject.LOG.error("Could not close a connection.", e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public void marshall(ApplicationConfigurationDescription applicationConfigurationDescription, ProtocolMarshaller protocolMarshaller) {
if (applicationConfigurationDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(applicationConfigurationDescription.getSqlApplicationConfigurationDescription(),
SQLAPPLICATIONCONFIGURATIONDESCRIPTION_BINDING);
protocolMarshaller.marshall(applicationConfigurationDescription.getApplicationCodeConfigurationDescription(),
APPLICATIONCODECONFIGURATIONDESCRIPTION_BINDING);
protocolMarshaller.marshall(applicationConfigurationDescription.getRunConfigurationDescription(), RUNCONFIGURATIONDESCRIPTION_BINDING);
protocolMarshaller.marshall(applicationConfigurationDescription.getFlinkApplicationConfigurationDescription(),
FLINKAPPLICATIONCONFIGURATIONDESCRIPTION_BINDING);
protocolMarshaller.marshall(applicationConfigurationDescription.getEnvironmentPropertyDescriptions(), ENVIRONMENTPROPERTYDESCRIPTIONS_BINDING);
protocolMarshaller.marshall(applicationConfigurationDescription.getApplicationSnapshotConfigurationDescription(),
APPLICATIONSNAPSHOTCONFIGURATIONDESCRIPTION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ApplicationConfigurationDescription applicationConfigurationDescription, ProtocolMarshaller protocolMarshaller) {
if (applicationConfigurationDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(applicationConfigurationDescription.getSqlApplicationConfigurationDescription(),
SQLAPPLICATIONCONFIGURATIONDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(applicationConfigurationDescription.getApplicationCodeConfigurationDescription(),
APPLICATIONCODECONFIGURATIONDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(applicationConfigurationDescription.getRunConfigurationDescription(), RUNCONFIGURATIONDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(applicationConfigurationDescription.getFlinkApplicationConfigurationDescription(),
FLINKAPPLICATIONCONFIGURATIONDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(applicationConfigurationDescription.getEnvironmentPropertyDescriptions(), ENVIRONMENTPROPERTYDESCRIPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(applicationConfigurationDescription.getApplicationSnapshotConfigurationDescription(),
APPLICATIONSNAPSHOTCONFIGURATIONDESCRIPTION_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 mergeRelationInformation(TDRelation relation) {
if (relation.hasTags()) {
addTags(relation.getTags());
}
if (getName() == null && relation.getName() != null) {
setName(relation.getName());
}
if (getRef() == null && relation.getRef() != null) {
setRef(relation.getRef());
}
} }
|
public class class_name {
public void mergeRelationInformation(TDRelation relation) {
if (relation.hasTags()) {
addTags(relation.getTags()); // depends on control dependency: [if], data = [none]
}
if (getName() == null && relation.getName() != null) {
setName(relation.getName()); // depends on control dependency: [if], data = [none]
}
if (getRef() == null && relation.getRef() != null) {
setRef(relation.getRef()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Map<Object, String> getTrimToSize() {
if (m_trimToSize == null) {
m_trimToSize = CmsCollectionsGenericWrapper.createLazyMap(new CmsTrimToSizeTransformer());
}
return m_trimToSize;
} }
|
public class class_name {
public Map<Object, String> getTrimToSize() {
if (m_trimToSize == null) {
m_trimToSize = CmsCollectionsGenericWrapper.createLazyMap(new CmsTrimToSizeTransformer()); // depends on control dependency: [if], data = [none]
}
return m_trimToSize;
} }
|
public class class_name {
private static void initialize()
{
double lFlen = 1.0f / (double)SPLINE_LUTLEN;
double lScale = (double)SPLINE_QUANTSCALE;
for(int i=0; i<SPLINE_LUTLEN; i++)
{
double lX = ((double)i)*lFlen;
int lIdx = i<<2;
double lCm1 = Math.floor(0.5 + lScale * (-0.5*lX*lX*lX + 1.0 * lX*lX - 0.5 * lX ));
double lC0 = Math.floor(0.5 + lScale * ( 1.5*lX*lX*lX - 2.5 * lX*lX + 1.0));
double lC1 = Math.floor(0.5 + lScale * (-1.5*lX*lX*lX + 2.0 * lX*lX + 0.5 * lX ));
double lC2 = Math.floor(0.5 + lScale * ( 0.5*lX*lX*lX - 0.5 * lX*lX ));
lut[lIdx+0] = (int)((lCm1 < -lScale) ? -lScale : ((lCm1 > lScale) ? lScale : lCm1));
lut[lIdx+1] = (int)((lC0 < -lScale) ? -lScale : ((lC0 > lScale) ? lScale : lC0 ));
lut[lIdx+2] = (int)((lC1 < -lScale) ? -lScale : ((lC1 > lScale) ? lScale : lC1 ));
lut[lIdx+3] = (int)((lC2 < -lScale) ? -lScale : ((lC2 > lScale) ? lScale : lC2 ));
// forces coefs-set to unity gain:
int lSum = lut[lIdx+0] + lut[lIdx+1] + lut[lIdx+2] + lut[lIdx+3];
if (lSum != SPLINE_QUANTSCALE)
{
int lMax = lIdx;
if (lut[lIdx+1] > lut[lMax]) lMax = lIdx+1;
if (lut[lIdx+2] > lut[lMax]) lMax = lIdx+2;
if (lut[lIdx+3] > lut[lMax]) lMax = lIdx+3;
lut[lMax] += (SPLINE_QUANTSCALE-lSum);
}
}
} }
|
public class class_name {
private static void initialize()
{
double lFlen = 1.0f / (double)SPLINE_LUTLEN;
double lScale = (double)SPLINE_QUANTSCALE;
for(int i=0; i<SPLINE_LUTLEN; i++)
{
double lX = ((double)i)*lFlen;
int lIdx = i<<2;
double lCm1 = Math.floor(0.5 + lScale * (-0.5*lX*lX*lX + 1.0 * lX*lX - 0.5 * lX ));
double lC0 = Math.floor(0.5 + lScale * ( 1.5*lX*lX*lX - 2.5 * lX*lX + 1.0));
double lC1 = Math.floor(0.5 + lScale * (-1.5*lX*lX*lX + 2.0 * lX*lX + 0.5 * lX ));
double lC2 = Math.floor(0.5 + lScale * ( 0.5*lX*lX*lX - 0.5 * lX*lX ));
lut[lIdx+0] = (int)((lCm1 < -lScale) ? -lScale : ((lCm1 > lScale) ? lScale : lCm1)); // depends on control dependency: [for], data = [none]
lut[lIdx+1] = (int)((lC0 < -lScale) ? -lScale : ((lC0 > lScale) ? lScale : lC0 )); // depends on control dependency: [for], data = [none]
lut[lIdx+2] = (int)((lC1 < -lScale) ? -lScale : ((lC1 > lScale) ? lScale : lC1 )); // depends on control dependency: [for], data = [none]
lut[lIdx+3] = (int)((lC2 < -lScale) ? -lScale : ((lC2 > lScale) ? lScale : lC2 )); // depends on control dependency: [for], data = [none]
// forces coefs-set to unity gain:
int lSum = lut[lIdx+0] + lut[lIdx+1] + lut[lIdx+2] + lut[lIdx+3];
if (lSum != SPLINE_QUANTSCALE)
{
int lMax = lIdx;
if (lut[lIdx+1] > lut[lMax]) lMax = lIdx+1;
if (lut[lIdx+2] > lut[lMax]) lMax = lIdx+2;
if (lut[lIdx+3] > lut[lMax]) lMax = lIdx+3;
lut[lMax] += (SPLINE_QUANTSCALE-lSum); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private void updatePaginationState(final SimplePager pager) {
for (int i = 0; i < getWidgetCount(); i++) {
if (i == 0) { //previous button
((AnchorListItem)getWidget(i)).setEnabled(pager.hasPreviousPage());
}
else if (i == getWidgetCount() - 1) { //next button
((AnchorListItem)getWidget(i)).setEnabled(pager.hasNextPage());
}
else {
int index = i - 1;
if (index == pager.getPage()) {
((AnchorListItem)getWidget(i)).setActive(true);
}
else {
((AnchorListItem)getWidget(i)).setActive(false);
}
}
}
} }
|
public class class_name {
private void updatePaginationState(final SimplePager pager) {
for (int i = 0; i < getWidgetCount(); i++) {
if (i == 0) { //previous button
((AnchorListItem)getWidget(i)).setEnabled(pager.hasPreviousPage()); // depends on control dependency: [if], data = [(i]
}
else if (i == getWidgetCount() - 1) { //next button
((AnchorListItem)getWidget(i)).setEnabled(pager.hasNextPage()); // depends on control dependency: [if], data = [(i]
}
else {
int index = i - 1;
if (index == pager.getPage()) {
((AnchorListItem)getWidget(i)).setActive(true); // depends on control dependency: [if], data = [none]
}
else {
((AnchorListItem)getWidget(i)).setActive(false); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.